isl_tab_pip.c: context_tab_for_lexmin: add memory management annotation
[isl.git] / doc / user.pod
blob8bd9e1e6f713fc8b1eb5d0ccec92769546b2f8cb
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);
772 On integer values, we additionally have the following operations.
774         #include <isl/val.h>
775         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
776         __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
777                 __isl_take isl_val *v2);
778         __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
779                 __isl_take isl_val *v2);
780         __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
781                 __isl_take isl_val *v2, __isl_give isl_val **x,
782                 __isl_give isl_val **y);
784 The function C<isl_val_gcdext> returns the greatest common divisor g
785 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
786 that C<*x> * C<v1> + C<*y> * C<v2> = g.
788 =head3 GMP specific functions
790 These functions are only available if C<isl> has been compiled with C<GMP>
791 support.
793 Specific integer and rational values can be created from C<GMP> values using
794 the following functions.
796         #include <isl/val_gmp.h>
797         __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
798                 mpz_t z);
799         __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
800                 const mpz_t n, const mpz_t d);
802 The numerator and denominator of a rational value can be extracted as
803 C<GMP> values using the following functions.
805         #include <isl/val_gmp.h>
806         int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
807         int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
809 =head2 Sets and Relations
811 C<isl> uses six types of objects for representing sets and relations,
812 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
813 C<isl_union_set> and C<isl_union_map>.
814 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
815 can be described as a conjunction of affine constraints, while
816 C<isl_set> and C<isl_map> represent unions of
817 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
818 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
819 to live in the same space.  C<isl_union_set>s and C<isl_union_map>s
820 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
821 where spaces are considered different if they have a different number
822 of dimensions and/or different names (see L<"Spaces">).
823 The difference between sets and relations (maps) is that sets have
824 one set of variables, while relations have two sets of variables,
825 input variables and output variables.
827 =head2 Error Handling
829 C<isl> supports different ways to react in case a runtime error is triggered.
830 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
831 with two maps that have incompatible spaces. There are three possible ways
832 to react on error: to warn, to continue or to abort.
834 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
835 the last error in the corresponding C<isl_ctx> and the function in which the
836 error was triggered returns a value indicating that some error has
837 occurred.  In case of functions returning a pointer, this value is
838 C<NULL>.  In case of functions returning an C<isl_bool> or an
839 C<isl_stat>, this valus is C<isl_bool_error> or C<isl_stat_error>.
840 An error does not corrupt internal state,
841 such that isl can continue to be used. C<isl> also provides functions to
842 read the last error and to reset the memory that stores the last error. The
843 last error is only stored for information purposes. Its presence does not
844 change the behavior of C<isl>. Hence, resetting an error is not required to
845 continue to use isl, but only to observe new errors.
847         #include <isl/ctx.h>
848         enum isl_error isl_ctx_last_error(isl_ctx *ctx);
849         void isl_ctx_reset_error(isl_ctx *ctx);
851 Another option is to continue on error. This is similar to warn on error mode,
852 except that C<isl> does not print any warning. This allows a program to
853 implement its own error reporting.
855 The last option is to directly abort the execution of the program from within
856 the isl library. This makes it obviously impossible to recover from an error,
857 but it allows to directly spot the error location. By aborting on error,
858 debuggers break at the location the error occurred and can provide a stack
859 trace. Other tools that automatically provide stack traces on abort or that do
860 not want to continue execution after an error was triggered may also prefer to
861 abort on error.
863 The on error behavior of isl can be specified by calling
864 C<isl_options_set_on_error> or by setting the command line option
865 C<--isl-on-error>. Valid arguments for the function call are
866 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
867 choices for the command line option are C<warn>, C<continue> and C<abort>.
868 It is also possible to query the current error mode.
870         #include <isl/options.h>
871         isl_stat isl_options_set_on_error(isl_ctx *ctx, int val);
872         int isl_options_get_on_error(isl_ctx *ctx);
874 =head2 Identifiers
876 Identifiers are used to identify both individual dimensions
877 and tuples of dimensions.  They consist of an optional name and an optional
878 user pointer.  The name and the user pointer cannot both be C<NULL>, however.
879 Identifiers with the same name but different pointer values
880 are considered to be distinct.
881 Similarly, identifiers with different names but the same pointer value
882 are also considered to be distinct.
883 Equal identifiers are represented using the same object.
884 Pairs of identifiers can therefore be tested for equality using the
885 C<==> operator.
886 Identifiers can be constructed, copied, freed, inspected and printed
887 using the following functions.
889         #include <isl/id.h>
890         __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
891                 __isl_keep const char *name, void *user);
892         __isl_give isl_id *isl_id_set_free_user(
893                 __isl_take isl_id *id,
894                 void (*free_user)(void *user));
895         __isl_give isl_id *isl_id_copy(isl_id *id);
896         __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
898         void *isl_id_get_user(__isl_keep isl_id *id);
899         __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
901         __isl_give isl_printer *isl_printer_print_id(
902                 __isl_take isl_printer *p, __isl_keep isl_id *id);
904 The callback set by C<isl_id_set_free_user> is called on the user
905 pointer when the last reference to the C<isl_id> is freed.
906 Note that C<isl_id_get_name> returns a pointer to some internal
907 data structure, so the result can only be used while the
908 corresponding C<isl_id> is alive.
910 =head2 Spaces
912 Whenever a new set, relation or similar object is created from scratch,
913 the space in which it lives needs to be specified using an C<isl_space>.
914 Each space involves zero or more parameters and zero, one or two
915 tuples of set or input/output dimensions.  The parameters and dimensions
916 are identified by an C<isl_dim_type> and a position.
917 The type C<isl_dim_param> refers to parameters,
918 the type C<isl_dim_set> refers to set dimensions (for spaces
919 with a single tuple of dimensions) and the types C<isl_dim_in>
920 and C<isl_dim_out> refer to input and output dimensions
921 (for spaces with two tuples of dimensions).
922 Local spaces (see L</"Local Spaces">) also contain dimensions
923 of type C<isl_dim_div>.
924 Note that parameters are only identified by their position within
925 a given object.  Across different objects, parameters are (usually)
926 identified by their names or identifiers.  Only unnamed parameters
927 are identified by their positions across objects.  The use of unnamed
928 parameters is discouraged.
930         #include <isl/space.h>
931         __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
932                 unsigned nparam, unsigned n_in, unsigned n_out);
933         __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
934                 unsigned nparam);
935         __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
936                 unsigned nparam, unsigned dim);
937         __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
938         __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
940 The space used for creating a parameter domain
941 needs to be created using C<isl_space_params_alloc>.
942 For other sets, the space
943 needs to be created using C<isl_space_set_alloc>, while
944 for a relation, the space
945 needs to be created using C<isl_space_alloc>.
947 To check whether a given space is that of a set or a map
948 or whether it is a parameter space, use these functions:
950         #include <isl/space.h>
951         isl_bool isl_space_is_params(__isl_keep isl_space *space);
952         isl_bool isl_space_is_set(__isl_keep isl_space *space);
953         isl_bool isl_space_is_map(__isl_keep isl_space *space);
955 Spaces can be compared using the following functions:
957         #include <isl/space.h>
958         isl_bool isl_space_is_equal(__isl_keep isl_space *space1,
959                 __isl_keep isl_space *space2);
960         isl_bool isl_space_has_equal_params(
961                 __isl_keep isl_space *space1,
962                 __isl_keep isl_space *space2);
963         isl_bool isl_space_has_equal_tuples(
964                 __isl_keep isl_space *space1,
965                 __isl_keep isl_space *space2);
966         isl_bool isl_space_is_domain(__isl_keep isl_space *space1,
967                 __isl_keep isl_space *space2);
968         isl_bool isl_space_is_range(__isl_keep isl_space *space1,
969                 __isl_keep isl_space *space2);
970         isl_bool isl_space_tuple_is_equal(
971                 __isl_keep isl_space *space1,
972                 enum isl_dim_type type1,
973                 __isl_keep isl_space *space2,
974                 enum isl_dim_type type2);
976 C<isl_space_is_domain> checks whether the first argument is equal
977 to the domain of the second argument.  This requires in particular that
978 the first argument is a set space and that the second argument
979 is a map space.  C<isl_space_tuple_is_equal> checks whether the given
980 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
981 spaces are the same.  That is, it checks if they have the same
982 identifier (if any), the same dimension and the same internal structure
983 (if any).
984 The function
985 C<isl_space_has_equal_params> checks whether two spaces
986 have the same parameters in the same order.
987 C<isl_space_has_equal_tuples> check whether two spaces have
988 the same tuples.  In contrast to C<isl_space_is_equal> below,
989 it does not check the
990 parameters.  This is useful because many C<isl> functions align the
991 parameters before they perform their operations, such that equivalence
992 is not necessary.
993 C<isl_space_is_equal> checks whether two spaces are identical,
994 meaning that they have the same parameters and the same tuples.
995 That is, it checks whether both C<isl_space_has_equal_params> and
996 C<isl_space_has_equal_tuples> hold.
998 It is often useful to create objects that live in the
999 same space as some other object.  This can be accomplished
1000 by creating the new objects
1001 (see L</"Creating New Sets and Relations"> or
1002 L</"Functions">) based on the space
1003 of the original object.
1005         #include <isl/set.h>
1006         __isl_give isl_space *isl_basic_set_get_space(
1007                 __isl_keep isl_basic_set *bset);
1008         __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
1010         #include <isl/union_set.h>
1011         __isl_give isl_space *isl_union_set_get_space(
1012                 __isl_keep isl_union_set *uset);
1014         #include <isl/map.h>
1015         __isl_give isl_space *isl_basic_map_get_space(
1016                 __isl_keep isl_basic_map *bmap);
1017         __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
1019         #include <isl/union_map.h>
1020         __isl_give isl_space *isl_union_map_get_space(
1021                 __isl_keep isl_union_map *umap);
1023         #include <isl/constraint.h>
1024         __isl_give isl_space *isl_constraint_get_space(
1025                 __isl_keep isl_constraint *constraint);
1027         #include <isl/polynomial.h>
1028         __isl_give isl_space *isl_qpolynomial_get_domain_space(
1029                 __isl_keep isl_qpolynomial *qp);
1030         __isl_give isl_space *isl_qpolynomial_get_space(
1031                 __isl_keep isl_qpolynomial *qp);
1032         __isl_give isl_space *
1033         isl_qpolynomial_fold_get_domain_space(
1034                 __isl_keep isl_qpolynomial_fold *fold);
1035         __isl_give isl_space *isl_qpolynomial_fold_get_space(
1036                 __isl_keep isl_qpolynomial_fold *fold);
1037         __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
1038                 __isl_keep isl_pw_qpolynomial *pwqp);
1039         __isl_give isl_space *isl_pw_qpolynomial_get_space(
1040                 __isl_keep isl_pw_qpolynomial *pwqp);
1041         __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
1042                 __isl_keep isl_pw_qpolynomial_fold *pwf);
1043         __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
1044                 __isl_keep isl_pw_qpolynomial_fold *pwf);
1045         __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
1046                 __isl_keep isl_union_pw_qpolynomial *upwqp);
1047         __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
1048                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
1050         #include <isl/val.h>
1051         __isl_give isl_space *isl_multi_val_get_space(
1052                 __isl_keep isl_multi_val *mv);
1054         #include <isl/aff.h>
1055         __isl_give isl_space *isl_aff_get_domain_space(
1056                 __isl_keep isl_aff *aff);
1057         __isl_give isl_space *isl_aff_get_space(
1058                 __isl_keep isl_aff *aff);
1059         __isl_give isl_space *isl_pw_aff_get_domain_space(
1060                 __isl_keep isl_pw_aff *pwaff);
1061         __isl_give isl_space *isl_pw_aff_get_space(
1062                 __isl_keep isl_pw_aff *pwaff);
1063         __isl_give isl_space *isl_multi_aff_get_domain_space(
1064                 __isl_keep isl_multi_aff *maff);
1065         __isl_give isl_space *isl_multi_aff_get_space(
1066                 __isl_keep isl_multi_aff *maff);
1067         __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
1068                 __isl_keep isl_pw_multi_aff *pma);
1069         __isl_give isl_space *isl_pw_multi_aff_get_space(
1070                 __isl_keep isl_pw_multi_aff *pma);
1071         __isl_give isl_space *isl_union_pw_aff_get_space(
1072                 __isl_keep isl_union_pw_aff *upa);
1073         __isl_give isl_space *isl_union_pw_multi_aff_get_space(
1074                 __isl_keep isl_union_pw_multi_aff *upma);
1075         __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
1076                 __isl_keep isl_multi_pw_aff *mpa);
1077         __isl_give isl_space *isl_multi_pw_aff_get_space(
1078                 __isl_keep isl_multi_pw_aff *mpa);
1079         __isl_give isl_space *
1080         isl_multi_union_pw_aff_get_domain_space(
1081                 __isl_keep isl_multi_union_pw_aff *mupa);
1082         __isl_give isl_space *
1083         isl_multi_union_pw_aff_get_space(
1084                 __isl_keep isl_multi_union_pw_aff *mupa);
1086         #include <isl/point.h>
1087         __isl_give isl_space *isl_point_get_space(
1088                 __isl_keep isl_point *pnt);
1090 The number of dimensions of a given type of space
1091 may be read off from a space or an object that lives
1092 in a space using the following functions.
1093 In case of C<isl_space_dim>, type may be
1094 C<isl_dim_param>, C<isl_dim_in> (only for relations),
1095 C<isl_dim_out> (only for relations), C<isl_dim_set>
1096 (only for sets) or C<isl_dim_all>.
1098         #include <isl/space.h>
1099         unsigned isl_space_dim(__isl_keep isl_space *space,
1100                 enum isl_dim_type type);
1102         #include <isl/local_space.h>
1103         int isl_local_space_dim(__isl_keep isl_local_space *ls,
1104                 enum isl_dim_type type);
1106         #include <isl/set.h>
1107         unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1108                 enum isl_dim_type type);
1109         unsigned isl_set_dim(__isl_keep isl_set *set,
1110                 enum isl_dim_type type);
1112         #include <isl/union_set.h>
1113         unsigned isl_union_set_dim(__isl_keep isl_union_set *uset,
1114                 enum isl_dim_type type);
1116         #include <isl/map.h>
1117         unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1118                 enum isl_dim_type type);
1119         unsigned isl_map_dim(__isl_keep isl_map *map,
1120                 enum isl_dim_type type);
1122         #include <isl/union_map.h>
1123         unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
1124                 enum isl_dim_type type);
1126         #include <isl/val.h>
1127         unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1128                 enum isl_dim_type type);
1130         #include <isl/aff.h>
1131         int isl_aff_dim(__isl_keep isl_aff *aff,
1132                 enum isl_dim_type type);
1133         unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1134                 enum isl_dim_type type);
1135         unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1136                 enum isl_dim_type type);
1137         unsigned isl_pw_multi_aff_dim(
1138                 __isl_keep isl_pw_multi_aff *pma,
1139                 enum isl_dim_type type);
1140         unsigned isl_multi_pw_aff_dim(
1141                 __isl_keep isl_multi_pw_aff *mpa,
1142                 enum isl_dim_type type);
1143         unsigned isl_union_pw_aff_dim(
1144                 __isl_keep isl_union_pw_aff *upa,
1145                 enum isl_dim_type type);
1146         unsigned isl_union_pw_multi_aff_dim(
1147                 __isl_keep isl_union_pw_multi_aff *upma,
1148                 enum isl_dim_type type);
1149         unsigned isl_multi_union_pw_aff_dim(
1150                 __isl_keep isl_multi_union_pw_aff *mupa,
1151                 enum isl_dim_type type);
1153         #include <isl/polynomial.h>
1154         unsigned isl_union_pw_qpolynomial_dim(
1155                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1156                 enum isl_dim_type type);
1157         unsigned isl_union_pw_qpolynomial_fold_dim(
1158                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1159                 enum isl_dim_type type);
1161 Note that an C<isl_union_set>, an C<isl_union_map>,
1162 an C<isl_union_pw_multi_aff>,
1163 an C<isl_union_pw_qpolynomial> and
1164 an C<isl_union_pw_qpolynomial_fold>
1165 only have parameters.
1167 The identifiers or names of the individual dimensions of spaces
1168 may be set or read off using the following functions on spaces
1169 or objects that live in spaces.
1170 These functions are mostly useful to obtain the identifiers, positions
1171 or names of the parameters.  Identifiers of individual dimensions are
1172 essentially only useful for printing.  They are ignored by all other
1173 operations and may not be preserved across those operations.
1175         #include <isl/space.h>
1176         __isl_give isl_space *isl_space_set_dim_id(
1177                 __isl_take isl_space *space,
1178                 enum isl_dim_type type, unsigned pos,
1179                 __isl_take isl_id *id);
1180         isl_bool isl_space_has_dim_id(__isl_keep isl_space *space,
1181                 enum isl_dim_type type, unsigned pos);
1182         __isl_give isl_id *isl_space_get_dim_id(
1183                 __isl_keep isl_space *space,
1184                 enum isl_dim_type type, unsigned pos);
1185         __isl_give isl_space *isl_space_set_dim_name(
1186                 __isl_take isl_space *space,
1187                  enum isl_dim_type type, unsigned pos,
1188                  __isl_keep const char *name);
1189         isl_bool isl_space_has_dim_name(__isl_keep isl_space *space,
1190                 enum isl_dim_type type, unsigned pos);
1191         __isl_keep const char *isl_space_get_dim_name(
1192                 __isl_keep isl_space *space,
1193                 enum isl_dim_type type, unsigned pos);
1195         #include <isl/local_space.h>
1196         __isl_give isl_local_space *isl_local_space_set_dim_id(
1197                 __isl_take isl_local_space *ls,
1198                 enum isl_dim_type type, unsigned pos,
1199                 __isl_take isl_id *id);
1200         isl_bool isl_local_space_has_dim_id(
1201                 __isl_keep isl_local_space *ls,
1202                 enum isl_dim_type type, unsigned pos);
1203         __isl_give isl_id *isl_local_space_get_dim_id(
1204                 __isl_keep isl_local_space *ls,
1205                 enum isl_dim_type type, unsigned pos);
1206         __isl_give isl_local_space *isl_local_space_set_dim_name(
1207                 __isl_take isl_local_space *ls,
1208                 enum isl_dim_type type, unsigned pos, const char *s);
1209         isl_bool isl_local_space_has_dim_name(
1210                 __isl_keep isl_local_space *ls,
1211                 enum isl_dim_type type, unsigned pos)
1212         const char *isl_local_space_get_dim_name(
1213                 __isl_keep isl_local_space *ls,
1214                 enum isl_dim_type type, unsigned pos);
1216         #include <isl/constraint.h>
1217         const char *isl_constraint_get_dim_name(
1218                 __isl_keep isl_constraint *constraint,
1219                 enum isl_dim_type type, unsigned pos);
1221         #include <isl/set.h>
1222         __isl_give isl_id *isl_basic_set_get_dim_id(
1223                 __isl_keep isl_basic_set *bset,
1224                 enum isl_dim_type type, unsigned pos);
1225         __isl_give isl_set *isl_set_set_dim_id(
1226                 __isl_take isl_set *set, enum isl_dim_type type,
1227                 unsigned pos, __isl_take isl_id *id);
1228         isl_bool isl_set_has_dim_id(__isl_keep isl_set *set,
1229                 enum isl_dim_type type, unsigned pos);
1230         __isl_give isl_id *isl_set_get_dim_id(
1231                 __isl_keep isl_set *set, enum isl_dim_type type,
1232                 unsigned pos);
1233         const char *isl_basic_set_get_dim_name(
1234                 __isl_keep isl_basic_set *bset,
1235                 enum isl_dim_type type, unsigned pos);
1236         isl_bool isl_set_has_dim_name(__isl_keep isl_set *set,
1237                 enum isl_dim_type type, unsigned pos);
1238         const char *isl_set_get_dim_name(
1239                 __isl_keep isl_set *set,
1240                 enum isl_dim_type type, unsigned pos);
1242         #include <isl/map.h>
1243         __isl_give isl_map *isl_map_set_dim_id(
1244                 __isl_take isl_map *map, enum isl_dim_type type,
1245                 unsigned pos, __isl_take isl_id *id);
1246         isl_bool isl_basic_map_has_dim_id(
1247                 __isl_keep isl_basic_map *bmap,
1248                 enum isl_dim_type type, unsigned pos);
1249         isl_bool isl_map_has_dim_id(__isl_keep isl_map *map,
1250                 enum isl_dim_type type, unsigned pos);
1251         __isl_give isl_id *isl_map_get_dim_id(
1252                 __isl_keep isl_map *map, enum isl_dim_type type,
1253                 unsigned pos);
1254         __isl_give isl_id *isl_union_map_get_dim_id(
1255                 __isl_keep isl_union_map *umap,
1256                 enum isl_dim_type type, unsigned pos);
1257         const char *isl_basic_map_get_dim_name(
1258                 __isl_keep isl_basic_map *bmap,
1259                 enum isl_dim_type type, unsigned pos);
1260         isl_bool isl_map_has_dim_name(__isl_keep isl_map *map,
1261                 enum isl_dim_type type, unsigned pos);
1262         const char *isl_map_get_dim_name(
1263                 __isl_keep isl_map *map,
1264                 enum isl_dim_type type, unsigned pos);
1266         #include <isl/val.h>
1267         __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1268                 __isl_take isl_multi_val *mv,
1269                 enum isl_dim_type type, unsigned pos,
1270                 __isl_take isl_id *id);
1271         __isl_give isl_id *isl_multi_val_get_dim_id(
1272                 __isl_keep isl_multi_val *mv,
1273                 enum isl_dim_type type, unsigned pos);
1274         __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1275                 __isl_take isl_multi_val *mv,
1276                 enum isl_dim_type type, unsigned pos, const char *s);
1278         #include <isl/aff.h>
1279         __isl_give isl_aff *isl_aff_set_dim_id(
1280                 __isl_take isl_aff *aff, enum isl_dim_type type,
1281                 unsigned pos, __isl_take isl_id *id);
1282         __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1283                 __isl_take isl_multi_aff *maff,
1284                 enum isl_dim_type type, unsigned pos,
1285                 __isl_take isl_id *id);
1286         __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1287                 __isl_take isl_pw_aff *pma,
1288                 enum isl_dim_type type, unsigned pos,
1289                 __isl_take isl_id *id);
1290         __isl_give isl_multi_pw_aff *
1291         isl_multi_pw_aff_set_dim_id(
1292                 __isl_take isl_multi_pw_aff *mpa,
1293                 enum isl_dim_type type, unsigned pos,
1294                 __isl_take isl_id *id);
1295         __isl_give isl_multi_union_pw_aff *
1296         isl_multi_union_pw_aff_set_dim_id(
1297                 __isl_take isl_multi_union_pw_aff *mupa,
1298                 enum isl_dim_type type, unsigned pos,
1299                 __isl_take isl_id *id);
1300         __isl_give isl_id *isl_multi_aff_get_dim_id(
1301                 __isl_keep isl_multi_aff *ma,
1302                 enum isl_dim_type type, unsigned pos);
1303         isl_bool isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1304                 enum isl_dim_type type, unsigned pos);
1305         __isl_give isl_id *isl_pw_aff_get_dim_id(
1306                 __isl_keep isl_pw_aff *pa,
1307                 enum isl_dim_type type, unsigned pos);
1308         __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1309                 __isl_keep isl_pw_multi_aff *pma,
1310                 enum isl_dim_type type, unsigned pos);
1311         __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1312                 __isl_keep isl_multi_pw_aff *mpa,
1313                 enum isl_dim_type type, unsigned pos);
1314         __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1315                 __isl_keep isl_multi_union_pw_aff *mupa,
1316                 enum isl_dim_type type, unsigned pos);
1317         __isl_give isl_aff *isl_aff_set_dim_name(
1318                 __isl_take isl_aff *aff, enum isl_dim_type type,
1319                 unsigned pos, const char *s);
1320         __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1321                 __isl_take isl_multi_aff *maff,
1322                 enum isl_dim_type type, unsigned pos, const char *s);
1323         __isl_give isl_multi_pw_aff *
1324         isl_multi_pw_aff_set_dim_name(
1325                 __isl_take isl_multi_pw_aff *mpa,
1326                 enum isl_dim_type type, unsigned pos, const char *s);
1327         __isl_give isl_union_pw_aff *
1328         isl_union_pw_aff_set_dim_name(
1329                 __isl_take isl_union_pw_aff *upa,
1330                 enum isl_dim_type type, unsigned pos,
1331                 const char *s);
1332         __isl_give isl_union_pw_multi_aff *
1333         isl_union_pw_multi_aff_set_dim_name(
1334                 __isl_take isl_union_pw_multi_aff *upma,
1335                 enum isl_dim_type type, unsigned pos,
1336                 const char *s);
1337         __isl_give isl_multi_union_pw_aff *
1338         isl_multi_union_pw_aff_set_dim_name(
1339                 __isl_take isl_multi_union_pw_aff *mupa,
1340                 enum isl_dim_type type, unsigned pos,
1341         const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1342                 enum isl_dim_type type, unsigned pos);
1343         const char *isl_pw_aff_get_dim_name(
1344                 __isl_keep isl_pw_aff *pa,
1345                 enum isl_dim_type type, unsigned pos);
1346         const char *isl_pw_multi_aff_get_dim_name(
1347                 __isl_keep isl_pw_multi_aff *pma,
1348                 enum isl_dim_type type, unsigned pos);
1350         #include <isl/polynomial.h>
1351         __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1352                 __isl_take isl_qpolynomial *qp,
1353                 enum isl_dim_type type, unsigned pos,
1354                 const char *s);
1355         __isl_give isl_pw_qpolynomial *
1356         isl_pw_qpolynomial_set_dim_name(
1357                 __isl_take isl_pw_qpolynomial *pwqp,
1358                 enum isl_dim_type type, unsigned pos,
1359                 const char *s);
1360         __isl_give isl_pw_qpolynomial_fold *
1361         isl_pw_qpolynomial_fold_set_dim_name(
1362                 __isl_take isl_pw_qpolynomial_fold *pwf,
1363                 enum isl_dim_type type, unsigned pos,
1364                 const char *s);
1365         __isl_give isl_union_pw_qpolynomial *
1366         isl_union_pw_qpolynomial_set_dim_name(
1367                 __isl_take isl_union_pw_qpolynomial *upwqp,
1368                 enum isl_dim_type type, unsigned pos,
1369                 const char *s);
1370         __isl_give isl_union_pw_qpolynomial_fold *
1371         isl_union_pw_qpolynomial_fold_set_dim_name(
1372                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1373                 enum isl_dim_type type, unsigned pos,
1374                 const char *s);
1376 Note that C<isl_space_get_name> returns a pointer to some internal
1377 data structure, so the result can only be used while the
1378 corresponding C<isl_space> is alive.
1379 Also note that every function that operates on two sets or relations
1380 requires that both arguments have the same parameters.  This also
1381 means that if one of the arguments has named parameters, then the
1382 other needs to have named parameters too and the names need to match.
1383 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1384 arguments may have different parameters (as long as they are named),
1385 in which case the result will have as parameters the union of the parameters of
1386 the arguments.
1388 Given the identifier or name of a dimension (typically a parameter),
1389 its position can be obtained from the following functions.
1391         #include <isl/space.h>
1392         int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1393                 enum isl_dim_type type, __isl_keep isl_id *id);
1394         int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1395                 enum isl_dim_type type, const char *name);
1397         #include <isl/local_space.h>
1398         int isl_local_space_find_dim_by_name(
1399                 __isl_keep isl_local_space *ls,
1400                 enum isl_dim_type type, const char *name);
1402         #include <isl/val.h>
1403         int isl_multi_val_find_dim_by_id(
1404                 __isl_keep isl_multi_val *mv,
1405                 enum isl_dim_type type, __isl_keep isl_id *id);
1406         int isl_multi_val_find_dim_by_name(
1407                 __isl_keep isl_multi_val *mv,
1408                 enum isl_dim_type type, const char *name);
1410         #include <isl/set.h>
1411         int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1412                 enum isl_dim_type type, __isl_keep isl_id *id);
1413         int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1414                 enum isl_dim_type type, const char *name);
1416         #include <isl/map.h>
1417         int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1418                 enum isl_dim_type type, __isl_keep isl_id *id);
1419         int isl_basic_map_find_dim_by_name(
1420                 __isl_keep isl_basic_map *bmap,
1421                 enum isl_dim_type type, const char *name);
1422         int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1423                 enum isl_dim_type type, const char *name);
1424         int isl_union_map_find_dim_by_name(
1425                 __isl_keep isl_union_map *umap,
1426                 enum isl_dim_type type, const char *name);
1428         #include <isl/aff.h>
1429         int isl_multi_aff_find_dim_by_id(
1430                 __isl_keep isl_multi_aff *ma,
1431                 enum isl_dim_type type, __isl_keep isl_id *id);
1432         int isl_multi_pw_aff_find_dim_by_id(
1433                 __isl_keep isl_multi_pw_aff *mpa,
1434                 enum isl_dim_type type, __isl_keep isl_id *id);
1435         int isl_multi_union_pw_aff_find_dim_by_id(
1436                 __isl_keep isl_union_multi_pw_aff *mupa,
1437                 enum isl_dim_type type, __isl_keep isl_id *id);
1438         int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1439                 enum isl_dim_type type, const char *name);
1440         int isl_multi_aff_find_dim_by_name(
1441                 __isl_keep isl_multi_aff *ma,
1442                 enum isl_dim_type type, const char *name);
1443         int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1444                 enum isl_dim_type type, const char *name);
1445         int isl_multi_pw_aff_find_dim_by_name(
1446                 __isl_keep isl_multi_pw_aff *mpa,
1447                 enum isl_dim_type type, const char *name);
1448         int isl_pw_multi_aff_find_dim_by_name(
1449                 __isl_keep isl_pw_multi_aff *pma,
1450                 enum isl_dim_type type, const char *name);
1451         int isl_union_pw_aff_find_dim_by_name(
1452                 __isl_keep isl_union_pw_aff *upa,
1453                 enum isl_dim_type type, const char *name);
1454         int isl_union_pw_multi_aff_find_dim_by_name(
1455                 __isl_keep isl_union_pw_multi_aff *upma,
1456                 enum isl_dim_type type, const char *name);
1457         int isl_multi_union_pw_aff_find_dim_by_name(
1458                 __isl_keep isl_multi_union_pw_aff *mupa,
1459                 enum isl_dim_type type, const char *name);
1461         #include <isl/polynomial.h>
1462         int isl_pw_qpolynomial_find_dim_by_name(
1463                 __isl_keep isl_pw_qpolynomial *pwqp,
1464                 enum isl_dim_type type, const char *name);
1465         int isl_pw_qpolynomial_fold_find_dim_by_name(
1466                 __isl_keep isl_pw_qpolynomial_fold *pwf,
1467                 enum isl_dim_type type, const char *name);
1468         int isl_union_pw_qpolynomial_find_dim_by_name(
1469                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1470                 enum isl_dim_type type, const char *name);
1471         int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1472                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1473                 enum isl_dim_type type, const char *name);
1475 The identifiers or names of entire spaces may be set or read off
1476 using the following functions.
1478         #include <isl/space.h>
1479         __isl_give isl_space *isl_space_set_tuple_id(
1480                 __isl_take isl_space *space,
1481                 enum isl_dim_type type, __isl_take isl_id *id);
1482         __isl_give isl_space *isl_space_reset_tuple_id(
1483                 __isl_take isl_space *space, enum isl_dim_type type);
1484         isl_bool isl_space_has_tuple_id(
1485                 __isl_keep isl_space *space,
1486                 enum isl_dim_type type);
1487         __isl_give isl_id *isl_space_get_tuple_id(
1488                 __isl_keep isl_space *space, enum isl_dim_type type);
1489         __isl_give isl_space *isl_space_set_tuple_name(
1490                 __isl_take isl_space *space,
1491                 enum isl_dim_type type, const char *s);
1492         isl_bool isl_space_has_tuple_name(
1493                 __isl_keep isl_space *space,
1494                 enum isl_dim_type type);
1495         __isl_keep const char *isl_space_get_tuple_name(
1496                 __isl_keep isl_space *space,
1497                 enum isl_dim_type type);
1499         #include <isl/local_space.h>
1500         __isl_give isl_local_space *isl_local_space_set_tuple_id(
1501                 __isl_take isl_local_space *ls,
1502                 enum isl_dim_type type, __isl_take isl_id *id);
1504         #include <isl/set.h>
1505         __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1506                 __isl_take isl_basic_set *bset,
1507                 __isl_take isl_id *id);
1508         __isl_give isl_set *isl_set_set_tuple_id(
1509                 __isl_take isl_set *set, __isl_take isl_id *id);
1510         __isl_give isl_set *isl_set_reset_tuple_id(
1511                 __isl_take isl_set *set);
1512         isl_bool isl_set_has_tuple_id(__isl_keep isl_set *set);
1513         __isl_give isl_id *isl_set_get_tuple_id(
1514                 __isl_keep isl_set *set);
1515         __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1516                 __isl_take isl_basic_set *set, const char *s);
1517         __isl_give isl_set *isl_set_set_tuple_name(
1518                 __isl_take isl_set *set, const char *s);
1519         const char *isl_basic_set_get_tuple_name(
1520                 __isl_keep isl_basic_set *bset);
1521         isl_bool isl_set_has_tuple_name(__isl_keep isl_set *set);
1522         const char *isl_set_get_tuple_name(
1523                 __isl_keep isl_set *set);
1525         #include <isl/map.h>
1526         __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1527                 __isl_take isl_basic_map *bmap,
1528                 enum isl_dim_type type, __isl_take isl_id *id);
1529         __isl_give isl_map *isl_map_set_tuple_id(
1530                 __isl_take isl_map *map, enum isl_dim_type type,
1531                 __isl_take isl_id *id);
1532         __isl_give isl_map *isl_map_reset_tuple_id(
1533                 __isl_take isl_map *map, enum isl_dim_type type);
1534         isl_bool isl_map_has_tuple_id(__isl_keep isl_map *map,
1535                 enum isl_dim_type type);
1536         __isl_give isl_id *isl_map_get_tuple_id(
1537                 __isl_keep isl_map *map, enum isl_dim_type type);
1538         __isl_give isl_map *isl_map_set_tuple_name(
1539                 __isl_take isl_map *map,
1540                 enum isl_dim_type type, const char *s);
1541         const char *isl_basic_map_get_tuple_name(
1542                 __isl_keep isl_basic_map *bmap,
1543                 enum isl_dim_type type);
1544         __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1545                 __isl_take isl_basic_map *bmap,
1546                 enum isl_dim_type type, const char *s);
1547         isl_bool isl_map_has_tuple_name(__isl_keep isl_map *map,
1548                 enum isl_dim_type type);
1549         const char *isl_map_get_tuple_name(
1550                 __isl_keep isl_map *map,
1551                 enum isl_dim_type type);
1553         #include <isl/val.h>
1554         __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1555                 __isl_take isl_multi_val *mv,
1556                 enum isl_dim_type type, __isl_take isl_id *id);
1557         __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1558                 __isl_take isl_multi_val *mv,
1559                 enum isl_dim_type type);
1560         isl_bool isl_multi_val_has_tuple_id(
1561                 __isl_keep isl_multi_val *mv,
1562                 enum isl_dim_type type);
1563         __isl_give isl_id *isl_multi_val_get_tuple_id(
1564                 __isl_keep isl_multi_val *mv,
1565                 enum isl_dim_type type);
1566         __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1567                 __isl_take isl_multi_val *mv,
1568                 enum isl_dim_type type, const char *s);
1569         const char *isl_multi_val_get_tuple_name(
1570                 __isl_keep isl_multi_val *mv,
1571                 enum isl_dim_type type);
1573         #include <isl/aff.h>
1574         __isl_give isl_aff *isl_aff_set_tuple_id(
1575                 __isl_take isl_aff *aff,
1576                 enum isl_dim_type type, __isl_take isl_id *id);
1577         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1578                 __isl_take isl_multi_aff *maff,
1579                 enum isl_dim_type type, __isl_take isl_id *id);
1580         __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1581                 __isl_take isl_pw_aff *pwaff,
1582                 enum isl_dim_type type, __isl_take isl_id *id);
1583         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1584                 __isl_take isl_pw_multi_aff *pma,
1585                 enum isl_dim_type type, __isl_take isl_id *id);
1586         __isl_give isl_multi_union_pw_aff *
1587         isl_multi_union_pw_aff_set_tuple_id(
1588                 __isl_take isl_multi_union_pw_aff *mupa,
1589                 enum isl_dim_type type, __isl_take isl_id *id);
1590         __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1591                 __isl_take isl_multi_aff *ma,
1592                 enum isl_dim_type type);
1593         __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1594                 __isl_take isl_pw_aff *pa,
1595                 enum isl_dim_type type);
1596         __isl_give isl_multi_pw_aff *
1597         isl_multi_pw_aff_reset_tuple_id(
1598                 __isl_take isl_multi_pw_aff *mpa,
1599                 enum isl_dim_type type);
1600         __isl_give isl_pw_multi_aff *
1601         isl_pw_multi_aff_reset_tuple_id(
1602                 __isl_take isl_pw_multi_aff *pma,
1603                 enum isl_dim_type type);
1604         __isl_give isl_multi_union_pw_aff *
1605         isl_multi_union_pw_aff_reset_tuple_id(
1606                 __isl_take isl_multi_union_pw_aff *mupa,
1607                 enum isl_dim_type type);
1608         isl_bool isl_multi_aff_has_tuple_id(
1609                 __isl_keep isl_multi_aff *ma,
1610                 enum isl_dim_type type);
1611         __isl_give isl_id *isl_multi_aff_get_tuple_id(
1612                 __isl_keep isl_multi_aff *ma,
1613                 enum isl_dim_type type);
1614         isl_bool isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1615                 enum isl_dim_type type);
1616         __isl_give isl_id *isl_pw_aff_get_tuple_id(
1617                 __isl_keep isl_pw_aff *pa,
1618                 enum isl_dim_type type);
1619         isl_bool isl_pw_multi_aff_has_tuple_id(
1620                 __isl_keep isl_pw_multi_aff *pma,
1621                 enum isl_dim_type type);
1622         __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1623                 __isl_keep isl_pw_multi_aff *pma,
1624                 enum isl_dim_type type);
1625         isl_bool isl_multi_pw_aff_has_tuple_id(
1626                 __isl_keep isl_multi_pw_aff *mpa,
1627                 enum isl_dim_type type);
1628         __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1629                 __isl_keep isl_multi_pw_aff *mpa,
1630                 enum isl_dim_type type);
1631         isl_bool isl_multi_union_pw_aff_has_tuple_id(
1632                 __isl_keep isl_multi_union_pw_aff *mupa,
1633                 enum isl_dim_type type);
1634         __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1635                 __isl_keep isl_multi_union_pw_aff *mupa,
1636                 enum isl_dim_type type);
1637         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1638                 __isl_take isl_multi_aff *maff,
1639                 enum isl_dim_type type, const char *s);
1640         __isl_give isl_multi_pw_aff *
1641         isl_multi_pw_aff_set_tuple_name(
1642                 __isl_take isl_multi_pw_aff *mpa,
1643                 enum isl_dim_type type, const char *s);
1644         __isl_give isl_multi_union_pw_aff *
1645         isl_multi_union_pw_aff_set_tuple_name(
1646                 __isl_take isl_multi_union_pw_aff *mupa,
1647                 enum isl_dim_type type, const char *s);
1648         const char *isl_multi_aff_get_tuple_name(
1649                 __isl_keep isl_multi_aff *multi,
1650                 enum isl_dim_type type);
1651         isl_bool isl_pw_multi_aff_has_tuple_name(
1652                 __isl_keep isl_pw_multi_aff *pma,
1653                 enum isl_dim_type type);
1654         const char *isl_pw_multi_aff_get_tuple_name(
1655                 __isl_keep isl_pw_multi_aff *pma,
1656                 enum isl_dim_type type);
1657         const char *isl_multi_union_pw_aff_get_tuple_name(
1658                 __isl_keep isl_multi_union_pw_aff *mupa,
1659                 enum isl_dim_type type);
1661 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1662 or C<isl_dim_set>.  As with C<isl_space_get_name>,
1663 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1664 data structure.
1665 Binary operations require the corresponding spaces of their arguments
1666 to have the same name.
1668 To keep the names of all parameters and tuples, but reset the user pointers
1669 of all the corresponding identifiers, use the following function.
1671         #include <isl/space.h>
1672         __isl_give isl_space *isl_space_reset_user(
1673                 __isl_take isl_space *space);
1675         #include <isl/set.h>
1676         __isl_give isl_set *isl_set_reset_user(
1677                 __isl_take isl_set *set);
1679         #include <isl/map.h>
1680         __isl_give isl_map *isl_map_reset_user(
1681                 __isl_take isl_map *map);
1683         #include <isl/union_set.h>
1684         __isl_give isl_union_set *isl_union_set_reset_user(
1685                 __isl_take isl_union_set *uset);
1687         #include <isl/union_map.h>
1688         __isl_give isl_union_map *isl_union_map_reset_user(
1689                 __isl_take isl_union_map *umap);
1691         #include <isl/val.h>
1692         __isl_give isl_multi_val *isl_multi_val_reset_user(
1693                 __isl_take isl_multi_val *mv);
1695         #include <isl/aff.h>
1696         __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1697                 __isl_take isl_multi_aff *ma);
1698         __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1699                 __isl_take isl_pw_aff *pa);
1700         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1701                 __isl_take isl_multi_pw_aff *mpa);
1702         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1703                 __isl_take isl_pw_multi_aff *pma);
1704         __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1705                 __isl_take isl_union_pw_aff *upa);
1706         __isl_give isl_multi_union_pw_aff *
1707         isl_multi_union_pw_aff_reset_user(
1708                 __isl_take isl_multi_union_pw_aff *mupa);
1709         __isl_give isl_union_pw_multi_aff *
1710         isl_union_pw_multi_aff_reset_user(
1711                 __isl_take isl_union_pw_multi_aff *upma);
1713         #include <isl/polynomial.h>
1714         __isl_give isl_pw_qpolynomial *
1715         isl_pw_qpolynomial_reset_user(
1716                 __isl_take isl_pw_qpolynomial *pwqp);
1717         __isl_give isl_union_pw_qpolynomial *
1718         isl_union_pw_qpolynomial_reset_user(
1719                 __isl_take isl_union_pw_qpolynomial *upwqp);
1720         __isl_give isl_pw_qpolynomial_fold *
1721         isl_pw_qpolynomial_fold_reset_user(
1722                 __isl_take isl_pw_qpolynomial_fold *pwf);
1723         __isl_give isl_union_pw_qpolynomial_fold *
1724         isl_union_pw_qpolynomial_fold_reset_user(
1725                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1727 Spaces can be nested.  In particular, the domain of a set or
1728 the domain or range of a relation can be a nested relation.
1729 This process is also called I<wrapping>.
1730 The functions for detecting, constructing and deconstructing
1731 such nested spaces can be found in the wrapping properties
1732 of L</"Unary Properties">, the wrapping operations
1733 of L</"Unary Operations"> and the Cartesian product operations
1734 of L</"Basic Operations">.
1736 Spaces can be created from other spaces
1737 using the functions described in L</"Unary Operations">
1738 and L</"Binary Operations">.
1740 =head2 Local Spaces
1742 A local space is essentially a space with
1743 zero or more existentially quantified variables.
1744 The local space of various objects can be obtained
1745 using the following functions.
1747         #include <isl/constraint.h>
1748         __isl_give isl_local_space *isl_constraint_get_local_space(
1749                 __isl_keep isl_constraint *constraint);
1751         #include <isl/set.h>
1752         __isl_give isl_local_space *isl_basic_set_get_local_space(
1753                 __isl_keep isl_basic_set *bset);
1755         #include <isl/map.h>
1756         __isl_give isl_local_space *isl_basic_map_get_local_space(
1757                 __isl_keep isl_basic_map *bmap);
1759         #include <isl/aff.h>
1760         __isl_give isl_local_space *isl_aff_get_domain_local_space(
1761                 __isl_keep isl_aff *aff);
1762         __isl_give isl_local_space *isl_aff_get_local_space(
1763                 __isl_keep isl_aff *aff);
1765 A new local space can be created from a space using
1767         #include <isl/local_space.h>
1768         __isl_give isl_local_space *isl_local_space_from_space(
1769                 __isl_take isl_space *space);
1771 They can be inspected, modified, copied and freed using the following functions.
1773         #include <isl/local_space.h>
1774         isl_bool isl_local_space_is_params(
1775                 __isl_keep isl_local_space *ls);
1776         isl_bool isl_local_space_is_set(
1777                 __isl_keep isl_local_space *ls);
1778         __isl_give isl_space *isl_local_space_get_space(
1779                 __isl_keep isl_local_space *ls);
1780         __isl_give isl_aff *isl_local_space_get_div(
1781                 __isl_keep isl_local_space *ls, int pos);
1782         __isl_give isl_local_space *isl_local_space_copy(
1783                 __isl_keep isl_local_space *ls);
1784         __isl_null isl_local_space *isl_local_space_free(
1785                 __isl_take isl_local_space *ls);
1787 Note that C<isl_local_space_get_div> can only be used on local spaces
1788 of sets.
1790 Two local spaces can be compared using
1792         isl_bool isl_local_space_is_equal(
1793                 __isl_keep isl_local_space *ls1,
1794                 __isl_keep isl_local_space *ls2);
1796 Local spaces can be created from other local spaces
1797 using the functions described in L</"Unary Operations">
1798 and L</"Binary Operations">.
1800 =head2 Creating New Sets and Relations
1802 C<isl> has functions for creating some standard sets and relations.
1804 =over
1806 =item * Empty sets and relations
1808         __isl_give isl_basic_set *isl_basic_set_empty(
1809                 __isl_take isl_space *space);
1810         __isl_give isl_basic_map *isl_basic_map_empty(
1811                 __isl_take isl_space *space);
1812         __isl_give isl_set *isl_set_empty(
1813                 __isl_take isl_space *space);
1814         __isl_give isl_map *isl_map_empty(
1815                 __isl_take isl_space *space);
1816         __isl_give isl_union_set *isl_union_set_empty(
1817                 __isl_take isl_space *space);
1818         __isl_give isl_union_map *isl_union_map_empty(
1819                 __isl_take isl_space *space);
1821 For C<isl_union_set>s and C<isl_union_map>s, the space
1822 is only used to specify the parameters.
1824 =item * Universe sets and relations
1826         __isl_give isl_basic_set *isl_basic_set_universe(
1827                 __isl_take isl_space *space);
1828         __isl_give isl_basic_map *isl_basic_map_universe(
1829                 __isl_take isl_space *space);
1830         __isl_give isl_set *isl_set_universe(
1831                 __isl_take isl_space *space);
1832         __isl_give isl_map *isl_map_universe(
1833                 __isl_take isl_space *space);
1834         __isl_give isl_union_set *isl_union_set_universe(
1835                 __isl_take isl_union_set *uset);
1836         __isl_give isl_union_map *isl_union_map_universe(
1837                 __isl_take isl_union_map *umap);
1839 The sets and relations constructed by the functions above
1840 contain all integer values, while those constructed by the
1841 functions below only contain non-negative values.
1843         __isl_give isl_basic_set *isl_basic_set_nat_universe(
1844                 __isl_take isl_space *space);
1845         __isl_give isl_basic_map *isl_basic_map_nat_universe(
1846                 __isl_take isl_space *space);
1847         __isl_give isl_set *isl_set_nat_universe(
1848                 __isl_take isl_space *space);
1849         __isl_give isl_map *isl_map_nat_universe(
1850                 __isl_take isl_space *space);
1852 =item * Identity relations
1854         __isl_give isl_basic_map *isl_basic_map_identity(
1855                 __isl_take isl_space *space);
1856         __isl_give isl_map *isl_map_identity(
1857                 __isl_take isl_space *space);
1859 The number of input and output dimensions in C<space> needs
1860 to be the same.
1862 =item * Lexicographic order
1864         __isl_give isl_map *isl_map_lex_lt(
1865                 __isl_take isl_space *set_space);
1866         __isl_give isl_map *isl_map_lex_le(
1867                 __isl_take isl_space *set_space);
1868         __isl_give isl_map *isl_map_lex_gt(
1869                 __isl_take isl_space *set_space);
1870         __isl_give isl_map *isl_map_lex_ge(
1871                 __isl_take isl_space *set_space);
1872         __isl_give isl_map *isl_map_lex_lt_first(
1873                 __isl_take isl_space *space, unsigned n);
1874         __isl_give isl_map *isl_map_lex_le_first(
1875                 __isl_take isl_space *space, unsigned n);
1876         __isl_give isl_map *isl_map_lex_gt_first(
1877                 __isl_take isl_space *space, unsigned n);
1878         __isl_give isl_map *isl_map_lex_ge_first(
1879                 __isl_take isl_space *space, unsigned n);
1881 The first four functions take a space for a B<set>
1882 and return relations that express that the elements in the domain
1883 are lexicographically less
1884 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1885 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1886 than the elements in the range.
1887 The last four functions take a space for a map
1888 and return relations that express that the first C<n> dimensions
1889 in the domain are lexicographically less
1890 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1891 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1892 than the first C<n> dimensions in the range.
1894 =back
1896 A basic set or relation can be converted to a set or relation
1897 using the following functions.
1899         __isl_give isl_set *isl_set_from_basic_set(
1900                 __isl_take isl_basic_set *bset);
1901         __isl_give isl_map *isl_map_from_basic_map(
1902                 __isl_take isl_basic_map *bmap);
1904 Sets and relations can be converted to union sets and relations
1905 using the following functions.
1907         __isl_give isl_union_set *isl_union_set_from_basic_set(
1908                 __isl_take isl_basic_set *bset);
1909         __isl_give isl_union_map *isl_union_map_from_basic_map(
1910                 __isl_take isl_basic_map *bmap);
1911         __isl_give isl_union_set *isl_union_set_from_set(
1912                 __isl_take isl_set *set);
1913         __isl_give isl_union_map *isl_union_map_from_map(
1914                 __isl_take isl_map *map);
1916 The inverse conversions below can only be used if the input
1917 union set or relation is known to contain elements in exactly one
1918 space.
1920         __isl_give isl_set *isl_set_from_union_set(
1921                 __isl_take isl_union_set *uset);
1922         __isl_give isl_map *isl_map_from_union_map(
1923                 __isl_take isl_union_map *umap);
1925 Sets and relations can be copied and freed again using the following
1926 functions.
1928         __isl_give isl_basic_set *isl_basic_set_copy(
1929                 __isl_keep isl_basic_set *bset);
1930         __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1931         __isl_give isl_union_set *isl_union_set_copy(
1932                 __isl_keep isl_union_set *uset);
1933         __isl_give isl_basic_map *isl_basic_map_copy(
1934                 __isl_keep isl_basic_map *bmap);
1935         __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1936         __isl_give isl_union_map *isl_union_map_copy(
1937                 __isl_keep isl_union_map *umap);
1938         __isl_null isl_basic_set *isl_basic_set_free(
1939                 __isl_take isl_basic_set *bset);
1940         __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1941         __isl_null isl_union_set *isl_union_set_free(
1942                 __isl_take isl_union_set *uset);
1943         __isl_null isl_basic_map *isl_basic_map_free(
1944                 __isl_take isl_basic_map *bmap);
1945         __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1946         __isl_null isl_union_map *isl_union_map_free(
1947                 __isl_take isl_union_map *umap);
1949 Other sets and relations can be constructed by starting
1950 from a universe set or relation, adding equality and/or
1951 inequality constraints and then projecting out the
1952 existentially quantified variables, if any.
1953 Constraints can be constructed, manipulated and
1954 added to (or removed from) (basic) sets and relations
1955 using the following functions.
1957         #include <isl/constraint.h>
1958         __isl_give isl_constraint *isl_constraint_alloc_equality(
1959                 __isl_take isl_local_space *ls);
1960         __isl_give isl_constraint *isl_constraint_alloc_inequality(
1961                 __isl_take isl_local_space *ls);
1962         __isl_give isl_constraint *isl_constraint_set_constant_si(
1963                 __isl_take isl_constraint *constraint, int v);
1964         __isl_give isl_constraint *isl_constraint_set_constant_val(
1965                 __isl_take isl_constraint *constraint,
1966                 __isl_take isl_val *v);
1967         __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1968                 __isl_take isl_constraint *constraint,
1969                 enum isl_dim_type type, int pos, int v);
1970         __isl_give isl_constraint *
1971         isl_constraint_set_coefficient_val(
1972                 __isl_take isl_constraint *constraint,
1973                 enum isl_dim_type type, int pos,
1974                 __isl_take isl_val *v);
1975         __isl_give isl_basic_map *isl_basic_map_add_constraint(
1976                 __isl_take isl_basic_map *bmap,
1977                 __isl_take isl_constraint *constraint);
1978         __isl_give isl_basic_set *isl_basic_set_add_constraint(
1979                 __isl_take isl_basic_set *bset,
1980                 __isl_take isl_constraint *constraint);
1981         __isl_give isl_map *isl_map_add_constraint(
1982                 __isl_take isl_map *map,
1983                 __isl_take isl_constraint *constraint);
1984         __isl_give isl_set *isl_set_add_constraint(
1985                 __isl_take isl_set *set,
1986                 __isl_take isl_constraint *constraint);
1988 For example, to create a set containing the even integers
1989 between 10 and 42, you would use the following code.
1991         isl_space *space;
1992         isl_local_space *ls;
1993         isl_constraint *c;
1994         isl_basic_set *bset;
1996         space = isl_space_set_alloc(ctx, 0, 2);
1997         bset = isl_basic_set_universe(isl_space_copy(space));
1998         ls = isl_local_space_from_space(space);
2000         c = isl_constraint_alloc_equality(isl_local_space_copy(ls));
2001         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
2002         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
2003         bset = isl_basic_set_add_constraint(bset, c);
2005         c = isl_constraint_alloc_inequality(isl_local_space_copy(ls));
2006         c = isl_constraint_set_constant_si(c, -10);
2007         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
2008         bset = isl_basic_set_add_constraint(bset, c);
2010         c = isl_constraint_alloc_inequality(ls);
2011         c = isl_constraint_set_constant_si(c, 42);
2012         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
2013         bset = isl_basic_set_add_constraint(bset, c);
2015         bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
2017 Or, alternatively,
2019         isl_basic_set *bset;
2020         bset = isl_basic_set_read_from_str(ctx,
2021                 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
2023 A basic set or relation can also be constructed from two matrices
2024 describing the equalities and the inequalities.
2026         __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
2027                 __isl_take isl_space *space,
2028                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
2029                 enum isl_dim_type c1,
2030                 enum isl_dim_type c2, enum isl_dim_type c3,
2031                 enum isl_dim_type c4);
2032         __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
2033                 __isl_take isl_space *space,
2034                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
2035                 enum isl_dim_type c1,
2036                 enum isl_dim_type c2, enum isl_dim_type c3,
2037                 enum isl_dim_type c4, enum isl_dim_type c5);
2039 The C<isl_dim_type> arguments indicate the order in which
2040 different kinds of variables appear in the input matrices
2041 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
2042 C<isl_dim_set> and C<isl_dim_div> for sets and
2043 of C<isl_dim_cst>, C<isl_dim_param>,
2044 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
2046 A (basic or union) set or relation can also be constructed from a
2047 (union) (piecewise) (multiple) affine expression
2048 or a list of affine expressions
2049 (See L</"Functions">), provided these affine expressions do not
2050 involve any NaN.
2052         __isl_give isl_basic_map *isl_basic_map_from_aff(
2053                 __isl_take isl_aff *aff);
2054         __isl_give isl_map *isl_map_from_aff(
2055                 __isl_take isl_aff *aff);
2056         __isl_give isl_set *isl_set_from_pw_aff(
2057                 __isl_take isl_pw_aff *pwaff);
2058         __isl_give isl_map *isl_map_from_pw_aff(
2059                 __isl_take isl_pw_aff *pwaff);
2060         __isl_give isl_basic_map *isl_basic_map_from_aff_list(
2061                 __isl_take isl_space *domain_space,
2062                 __isl_take isl_aff_list *list);
2063         __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
2064                 __isl_take isl_multi_aff *maff)
2065         __isl_give isl_map *isl_map_from_multi_aff(
2066                 __isl_take isl_multi_aff *maff)
2067         __isl_give isl_set *isl_set_from_pw_multi_aff(
2068                 __isl_take isl_pw_multi_aff *pma);
2069         __isl_give isl_map *isl_map_from_pw_multi_aff(
2070                 __isl_take isl_pw_multi_aff *pma);
2071         __isl_give isl_set *isl_set_from_multi_pw_aff(
2072                 __isl_take isl_multi_pw_aff *mpa);
2073         __isl_give isl_map *isl_map_from_multi_pw_aff(
2074                 __isl_take isl_multi_pw_aff *mpa);
2075         __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
2076                 __isl_take isl_union_pw_aff *upa);
2077         __isl_give isl_union_map *
2078         isl_union_map_from_union_pw_multi_aff(
2079                 __isl_take isl_union_pw_multi_aff *upma);
2080         __isl_give isl_union_map *
2081         isl_union_map_from_multi_union_pw_aff(
2082                 __isl_take isl_multi_union_pw_aff *mupa);
2084 The C<domain_space> argument describes the domain of the resulting
2085 basic relation.  It is required because the C<list> may consist
2086 of zero affine expressions.
2087 The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
2088 is not allowed to be zero-dimensional.  The domain of the result
2089 is the shared domain of the union piecewise affine elements.
2091 =head2 Inspecting Sets and Relations
2093 Usually, the user should not have to care about the actual constraints
2094 of the sets and maps, but should instead apply the abstract operations
2095 explained in the following sections.
2096 Occasionally, however, it may be required to inspect the individual
2097 coefficients of the constraints.  This section explains how to do so.
2098 In these cases, it may also be useful to have C<isl> compute
2099 an explicit representation of the existentially quantified variables.
2101         __isl_give isl_set *isl_set_compute_divs(
2102                 __isl_take isl_set *set);
2103         __isl_give isl_map *isl_map_compute_divs(
2104                 __isl_take isl_map *map);
2105         __isl_give isl_union_set *isl_union_set_compute_divs(
2106                 __isl_take isl_union_set *uset);
2107         __isl_give isl_union_map *isl_union_map_compute_divs(
2108                 __isl_take isl_union_map *umap);
2110 This explicit representation defines the existentially quantified
2111 variables as integer divisions of the other variables, possibly
2112 including earlier existentially quantified variables.
2113 An explicitly represented existentially quantified variable therefore
2114 has a unique value when the values of the other variables are known.
2116 Alternatively, the existentially quantified variables can be removed
2117 using the following functions, which compute an overapproximation.
2119         __isl_give isl_basic_set *isl_basic_set_remove_divs(
2120                 __isl_take isl_basic_set *bset);
2121         __isl_give isl_basic_map *isl_basic_map_remove_divs(
2122                 __isl_take isl_basic_map *bmap);
2123         __isl_give isl_set *isl_set_remove_divs(
2124                 __isl_take isl_set *set);
2125         __isl_give isl_map *isl_map_remove_divs(
2126                 __isl_take isl_map *map);
2128 It is also possible to only remove those divs that are defined
2129 in terms of a given range of dimensions or only those for which
2130 no explicit representation is known.
2132         __isl_give isl_basic_set *
2133         isl_basic_set_remove_divs_involving_dims(
2134                 __isl_take isl_basic_set *bset,
2135                 enum isl_dim_type type,
2136                 unsigned first, unsigned n);
2137         __isl_give isl_basic_map *
2138         isl_basic_map_remove_divs_involving_dims(
2139                 __isl_take isl_basic_map *bmap,
2140                 enum isl_dim_type type,
2141                 unsigned first, unsigned n);
2142         __isl_give isl_set *isl_set_remove_divs_involving_dims(
2143                 __isl_take isl_set *set, enum isl_dim_type type,
2144                 unsigned first, unsigned n);
2145         __isl_give isl_map *isl_map_remove_divs_involving_dims(
2146                 __isl_take isl_map *map, enum isl_dim_type type,
2147                 unsigned first, unsigned n);
2149         __isl_give isl_basic_set *
2150         isl_basic_set_remove_unknown_divs(
2151                 __isl_take isl_basic_set *bset);
2152         __isl_give isl_set *isl_set_remove_unknown_divs(
2153                 __isl_take isl_set *set);
2154         __isl_give isl_map *isl_map_remove_unknown_divs(
2155                 __isl_take isl_map *map);
2157 To iterate over all the sets or maps in a union set or map, use
2159         isl_stat isl_union_set_foreach_set(
2160                 __isl_keep isl_union_set *uset,
2161                 isl_stat (*fn)(__isl_take isl_set *set, void *user),
2162                 void *user);
2163         isl_stat isl_union_map_foreach_map(
2164                 __isl_keep isl_union_map *umap,
2165                 isl_stat (*fn)(__isl_take isl_map *map, void *user),
2166                 void *user);
2168 These functions call the callback function once for each
2169 (pair of) space(s) for which there are elements in the input.
2170 The argument to the callback contains all elements in the input
2171 with that (pair of) space(s).
2173 The number of sets or maps in a union set or map can be obtained
2174 from
2176         int isl_union_set_n_set(__isl_keep isl_union_set *uset);
2177         int isl_union_map_n_map(__isl_keep isl_union_map *umap);
2179 To extract the set or map in a given space from a union, use
2181         __isl_give isl_set *isl_union_set_extract_set(
2182                 __isl_keep isl_union_set *uset,
2183                 __isl_take isl_space *space);
2184         __isl_give isl_map *isl_union_map_extract_map(
2185                 __isl_keep isl_union_map *umap,
2186                 __isl_take isl_space *space);
2188 To iterate over all the basic sets or maps in a set or map, use
2190         isl_stat isl_set_foreach_basic_set(__isl_keep isl_set *set,
2191                 isl_stat (*fn)(__isl_take isl_basic_set *bset,
2192                         void *user),
2193                 void *user);
2194         isl_stat isl_map_foreach_basic_map(__isl_keep isl_map *map,
2195                 isl_stat (*fn)(__isl_take isl_basic_map *bmap,
2196                         void *user),
2197                 void *user);
2199 The callback function C<fn> should return 0 if successful and
2200 -1 if an error occurs.  In the latter case, or if any other error
2201 occurs, the above functions will return -1.
2203 It should be noted that C<isl> does not guarantee that
2204 the basic sets or maps passed to C<fn> are disjoint.
2205 If this is required, then the user should call one of
2206 the following functions first.
2208         __isl_give isl_set *isl_set_make_disjoint(
2209                 __isl_take isl_set *set);
2210         __isl_give isl_map *isl_map_make_disjoint(
2211                 __isl_take isl_map *map);
2213 The number of basic sets in a set can be obtained
2214 or the number of basic maps in a map can be obtained
2215 from
2217         #include <isl/set.h>
2218         int isl_set_n_basic_set(__isl_keep isl_set *set);
2220         #include <isl/map.h>
2221         int isl_map_n_basic_map(__isl_keep isl_map *map);
2223 It is also possible to obtain a list of basic sets from a set
2225         #include <isl/set.h>
2226         __isl_give isl_basic_set_list *isl_set_get_basic_set_list(
2227                 __isl_keep isl_set *set);
2229 The returned list can be manipulated using the functions in L<"Lists">.
2231 To iterate over the constraints of a basic set or map, use
2233         #include <isl/constraint.h>
2235         int isl_basic_set_n_constraint(
2236                 __isl_keep isl_basic_set *bset);
2237         isl_stat isl_basic_set_foreach_constraint(
2238                 __isl_keep isl_basic_set *bset,
2239                 isl_stat (*fn)(__isl_take isl_constraint *c,
2240                         void *user),
2241                 void *user);
2242         int isl_basic_map_n_constraint(
2243                 __isl_keep isl_basic_map *bmap);
2244         isl_stat isl_basic_map_foreach_constraint(
2245                 __isl_keep isl_basic_map *bmap,
2246                 isl_stat (*fn)(__isl_take isl_constraint *c,
2247                         void *user),
2248                 void *user);
2249         __isl_null isl_constraint *isl_constraint_free(
2250                 __isl_take isl_constraint *c);
2252 Again, the callback function C<fn> should return 0 if successful and
2253 -1 if an error occurs.  In the latter case, or if any other error
2254 occurs, the above functions will return -1.
2255 The constraint C<c> represents either an equality or an inequality.
2256 Use the following function to find out whether a constraint
2257 represents an equality.  If not, it represents an inequality.
2259         isl_bool isl_constraint_is_equality(
2260                 __isl_keep isl_constraint *constraint);
2262 It is also possible to obtain a list of constraints from a basic
2263 map or set
2265         #include <isl/constraint.h>
2266         __isl_give isl_constraint_list *
2267         isl_basic_map_get_constraint_list(
2268                 __isl_keep isl_basic_map *bmap);
2269         __isl_give isl_constraint_list *
2270         isl_basic_set_get_constraint_list(
2271                 __isl_keep isl_basic_set *bset);
2273 These functions require that all existentially quantified variables
2274 have an explicit representation.
2275 The returned list can be manipulated using the functions in L<"Lists">.
2277 The coefficients of the constraints can be inspected using
2278 the following functions.
2280         isl_bool isl_constraint_is_lower_bound(
2281                 __isl_keep isl_constraint *constraint,
2282                 enum isl_dim_type type, unsigned pos);
2283         isl_bool isl_constraint_is_upper_bound(
2284                 __isl_keep isl_constraint *constraint,
2285                 enum isl_dim_type type, unsigned pos);
2286         __isl_give isl_val *isl_constraint_get_constant_val(
2287                 __isl_keep isl_constraint *constraint);
2288         __isl_give isl_val *isl_constraint_get_coefficient_val(
2289                 __isl_keep isl_constraint *constraint,
2290                 enum isl_dim_type type, int pos);
2292 The explicit representations of the existentially quantified
2293 variables can be inspected using the following function.
2294 Note that the user is only allowed to use this function
2295 if the inspected set or map is the result of a call
2296 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2297 The existentially quantified variable is equal to the floor
2298 of the returned affine expression.  The affine expression
2299 itself can be inspected using the functions in
2300 L</"Functions">.
2302         __isl_give isl_aff *isl_constraint_get_div(
2303                 __isl_keep isl_constraint *constraint, int pos);
2305 To obtain the constraints of a basic set or map in matrix
2306 form, use the following functions.
2308         __isl_give isl_mat *isl_basic_set_equalities_matrix(
2309                 __isl_keep isl_basic_set *bset,
2310                 enum isl_dim_type c1, enum isl_dim_type c2,
2311                 enum isl_dim_type c3, enum isl_dim_type c4);
2312         __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2313                 __isl_keep isl_basic_set *bset,
2314                 enum isl_dim_type c1, enum isl_dim_type c2,
2315                 enum isl_dim_type c3, enum isl_dim_type c4);
2316         __isl_give isl_mat *isl_basic_map_equalities_matrix(
2317                 __isl_keep isl_basic_map *bmap,
2318                 enum isl_dim_type c1,
2319                 enum isl_dim_type c2, enum isl_dim_type c3,
2320                 enum isl_dim_type c4, enum isl_dim_type c5);
2321         __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2322                 __isl_keep isl_basic_map *bmap,
2323                 enum isl_dim_type c1,
2324                 enum isl_dim_type c2, enum isl_dim_type c3,
2325                 enum isl_dim_type c4, enum isl_dim_type c5);
2327 The C<isl_dim_type> arguments dictate the order in which
2328 different kinds of variables appear in the resulting matrix.
2329 For set inputs, they should be a permutation of
2330 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2331 For map inputs, they should be a permutation of
2332 C<isl_dim_cst>, C<isl_dim_param>,
2333 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2335 =head2 Points
2337 Points are elements of a set.  They can be used to construct
2338 simple sets (boxes) or they can be used to represent the
2339 individual elements of a set.
2340 The zero point (the origin) can be created using
2342         __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2344 The coordinates of a point can be inspected, set and changed
2345 using
2347         __isl_give isl_val *isl_point_get_coordinate_val(
2348                 __isl_keep isl_point *pnt,
2349                 enum isl_dim_type type, int pos);
2350         __isl_give isl_point *isl_point_set_coordinate_val(
2351                 __isl_take isl_point *pnt,
2352                 enum isl_dim_type type, int pos,
2353                 __isl_take isl_val *v);
2355         __isl_give isl_point *isl_point_add_ui(
2356                 __isl_take isl_point *pnt,
2357                 enum isl_dim_type type, int pos, unsigned val);
2358         __isl_give isl_point *isl_point_sub_ui(
2359                 __isl_take isl_point *pnt,
2360                 enum isl_dim_type type, int pos, unsigned val);
2362 Points can be copied or freed using
2364         __isl_give isl_point *isl_point_copy(
2365                 __isl_keep isl_point *pnt);
2366         __isl_null isl_point *isl_point_free(
2367                 __isl_take isl_point *pnt);
2369 A singleton set can be created from a point using
2371         __isl_give isl_basic_set *isl_basic_set_from_point(
2372                 __isl_take isl_point *pnt);
2373         __isl_give isl_set *isl_set_from_point(
2374                 __isl_take isl_point *pnt);
2375         __isl_give isl_union_set *isl_union_set_from_point(
2376                 __isl_take isl_point *pnt);
2378 and a box can be created from two opposite extremal points using
2380         __isl_give isl_basic_set *isl_basic_set_box_from_points(
2381                 __isl_take isl_point *pnt1,
2382                 __isl_take isl_point *pnt2);
2383         __isl_give isl_set *isl_set_box_from_points(
2384                 __isl_take isl_point *pnt1,
2385                 __isl_take isl_point *pnt2);
2387 All elements of a B<bounded> (union) set can be enumerated using
2388 the following functions.
2390         isl_stat isl_set_foreach_point(__isl_keep isl_set *set,
2391                 isl_stat (*fn)(__isl_take isl_point *pnt,
2392                         void *user),
2393                 void *user);
2394         isl_stat isl_union_set_foreach_point(
2395                 __isl_keep isl_union_set *uset,
2396                 isl_stat (*fn)(__isl_take isl_point *pnt,
2397                         void *user),
2398                 void *user);
2400 The function C<fn> is called for each integer point in
2401 C<set> with as second argument the last argument of
2402 the C<isl_set_foreach_point> call.  The function C<fn>
2403 should return C<0> on success and C<-1> on failure.
2404 In the latter case, C<isl_set_foreach_point> will stop
2405 enumerating and return C<-1> as well.
2406 If the enumeration is performed successfully and to completion,
2407 then C<isl_set_foreach_point> returns C<0>.
2409 To obtain a single point of a (basic or union) set, use
2411         __isl_give isl_point *isl_basic_set_sample_point(
2412                 __isl_take isl_basic_set *bset);
2413         __isl_give isl_point *isl_set_sample_point(
2414                 __isl_take isl_set *set);
2415         __isl_give isl_point *isl_union_set_sample_point(
2416                 __isl_take isl_union_set *uset);
2418 If C<set> does not contain any (integer) points, then the
2419 resulting point will be ``void'', a property that can be
2420 tested using
2422         isl_bool isl_point_is_void(__isl_keep isl_point *pnt);
2424 =head2 Functions
2426 Besides sets and relation, C<isl> also supports various types of functions.
2427 Each of these types is derived from the value type (see L</"Values">)
2428 or from one of two primitive function types
2429 through the application of zero or more type constructors.
2430 We first describe the primitive type and then we describe
2431 the types derived from these primitive types.
2433 =head3 Primitive Functions
2435 C<isl> support two primitive function types, quasi-affine
2436 expressions and quasipolynomials.
2437 A quasi-affine expression is defined either over a parameter
2438 space or over a set and is composed of integer constants,
2439 parameters and set variables, addition, subtraction and
2440 integer division by an integer constant.
2441 For example, the quasi-affine expression
2443         [n] -> { [x] -> [2*floor((4 n + x)/9] }
2445 maps C<x> to C<2*floor((4 n + x)/9>.
2446 A quasipolynomial is a polynomial expression in quasi-affine
2447 expression.  That is, it additionally allows for multiplication.
2448 Note, though, that it is not allowed to construct an integer
2449 division of an expression involving multiplications.
2450 Here is an example of a quasipolynomial that is not
2451 quasi-affine expression
2453         [n] -> { [x] -> (n*floor((4 n + x)/9) }
2455 Note that the external representations of quasi-affine expressions
2456 and quasipolynomials are different.  Quasi-affine expressions
2457 use a notation with square brackets just like binary relations,
2458 while quasipolynomials do not.  This might change at some point.
2460 If a primitive function is defined over a parameter space,
2461 then the space of the function itself is that of a set.
2462 If it is defined over a set, then the space of the function
2463 is that of a relation.  In both cases, the set space (or
2464 the output space) is single-dimensional, anonymous and unstructured.
2465 To create functions with multiple dimensions or with other kinds
2466 of set or output spaces, use multiple expressions
2467 (see L</"Multiple Expressions">).
2469 =over
2471 =item * Quasi-affine Expressions
2473 Besides the expressions described above, a quasi-affine
2474 expression can also be set to NaN.  Such expressions
2475 typically represent a failure to represent a result
2476 as a quasi-affine expression.
2478 The zero quasi affine expression or the quasi affine expression
2479 that is equal to a given value or
2480 a specified dimension on a given domain can be created using
2482         #include <isl/aff.h>
2483         __isl_give isl_aff *isl_aff_zero_on_domain(
2484                 __isl_take isl_local_space *ls);
2485         __isl_give isl_aff *isl_aff_val_on_domain(
2486                 __isl_take isl_local_space *ls,
2487                 __isl_take isl_val *val);
2488         __isl_give isl_aff *isl_aff_var_on_domain(
2489                 __isl_take isl_local_space *ls,
2490                 enum isl_dim_type type, unsigned pos);
2491         __isl_give isl_aff *isl_aff_nan_on_domain(
2492                 __isl_take isl_local_space *ls);
2494 Quasi affine expressions can be copied and freed using
2496         #include <isl/aff.h>
2497         __isl_give isl_aff *isl_aff_copy(
2498                 __isl_keep isl_aff *aff);
2499         __isl_null isl_aff *isl_aff_free(
2500                 __isl_take isl_aff *aff);
2502 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2503 using the following function.  The constraint is required to have
2504 a non-zero coefficient for the specified dimension.
2506         #include <isl/constraint.h>
2507         __isl_give isl_aff *isl_constraint_get_bound(
2508                 __isl_keep isl_constraint *constraint,
2509                 enum isl_dim_type type, int pos);
2511 The entire affine expression of the constraint can also be extracted
2512 using the following function.
2514         #include <isl/constraint.h>
2515         __isl_give isl_aff *isl_constraint_get_aff(
2516                 __isl_keep isl_constraint *constraint);
2518 Conversely, an equality constraint equating
2519 the affine expression to zero or an inequality constraint enforcing
2520 the affine expression to be non-negative, can be constructed using
2522         __isl_give isl_constraint *isl_equality_from_aff(
2523                 __isl_take isl_aff *aff);
2524         __isl_give isl_constraint *isl_inequality_from_aff(
2525                 __isl_take isl_aff *aff);
2527 The coefficients and the integer divisions of an affine expression
2528 can be inspected using the following functions.
2530         #include <isl/aff.h>
2531         __isl_give isl_val *isl_aff_get_constant_val(
2532                 __isl_keep isl_aff *aff);
2533         __isl_give isl_val *isl_aff_get_coefficient_val(
2534                 __isl_keep isl_aff *aff,
2535                 enum isl_dim_type type, int pos);
2536         int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2537                 enum isl_dim_type type, int pos);
2538         __isl_give isl_val *isl_aff_get_denominator_val(
2539                 __isl_keep isl_aff *aff);
2540         __isl_give isl_aff *isl_aff_get_div(
2541                 __isl_keep isl_aff *aff, int pos);
2543 They can be modified using the following functions.
2545         #include <isl/aff.h>
2546         __isl_give isl_aff *isl_aff_set_constant_si(
2547                 __isl_take isl_aff *aff, int v);
2548         __isl_give isl_aff *isl_aff_set_constant_val(
2549                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2550         __isl_give isl_aff *isl_aff_set_coefficient_si(
2551                 __isl_take isl_aff *aff,
2552                 enum isl_dim_type type, int pos, int v);
2553         __isl_give isl_aff *isl_aff_set_coefficient_val(
2554                 __isl_take isl_aff *aff,
2555                 enum isl_dim_type type, int pos,
2556                 __isl_take isl_val *v);
2558         __isl_give isl_aff *isl_aff_add_constant_si(
2559                 __isl_take isl_aff *aff, int v);
2560         __isl_give isl_aff *isl_aff_add_constant_val(
2561                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2562         __isl_give isl_aff *isl_aff_add_constant_num_si(
2563                 __isl_take isl_aff *aff, int v);
2564         __isl_give isl_aff *isl_aff_add_coefficient_si(
2565                 __isl_take isl_aff *aff,
2566                 enum isl_dim_type type, int pos, int v);
2567         __isl_give isl_aff *isl_aff_add_coefficient_val(
2568                 __isl_take isl_aff *aff,
2569                 enum isl_dim_type type, int pos,
2570                 __isl_take isl_val *v);
2572 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2573 set the I<numerator> of the constant or coefficient, while
2574 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2575 the constant or coefficient as a whole.
2576 The C<add_constant> and C<add_coefficient> functions add an integer
2577 or rational value to
2578 the possibly rational constant or coefficient.
2579 The C<add_constant_num> functions add an integer value to
2580 the numerator.
2582 =item * Quasipolynomials
2584 Some simple quasipolynomials can be created using the following functions.
2586         #include <isl/polynomial.h>
2587         __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2588                 __isl_take isl_space *domain);
2589         __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2590                 __isl_take isl_space *domain);
2591         __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2592                 __isl_take isl_space *domain);
2593         __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2594                 __isl_take isl_space *domain);
2595         __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2596                 __isl_take isl_space *domain);
2597         __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2598                 __isl_take isl_space *domain,
2599                 __isl_take isl_val *val);
2600         __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2601                 __isl_take isl_space *domain,
2602                 enum isl_dim_type type, unsigned pos);
2603         __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2604                 __isl_take isl_aff *aff);
2606 Recall that the space in which a quasipolynomial lives is a map space
2607 with a one-dimensional range.  The C<domain> argument in some of
2608 the functions above corresponds to the domain of this map space.
2610 Quasipolynomials can be copied and freed again using the following
2611 functions.
2613         #include <isl/polynomial.h>
2614         __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2615                 __isl_keep isl_qpolynomial *qp);
2616         __isl_null isl_qpolynomial *isl_qpolynomial_free(
2617                 __isl_take isl_qpolynomial *qp);
2619 The constant term of a quasipolynomial can be extracted using
2621         __isl_give isl_val *isl_qpolynomial_get_constant_val(
2622                 __isl_keep isl_qpolynomial *qp);
2624 To iterate over all terms in a quasipolynomial,
2627         isl_stat isl_qpolynomial_foreach_term(
2628                 __isl_keep isl_qpolynomial *qp,
2629                 isl_stat (*fn)(__isl_take isl_term *term,
2630                           void *user), void *user);
2632 The terms themselves can be inspected and freed using
2633 these functions
2635         unsigned isl_term_dim(__isl_keep isl_term *term,
2636                 enum isl_dim_type type);
2637         __isl_give isl_val *isl_term_get_coefficient_val(
2638                 __isl_keep isl_term *term);
2639         int isl_term_get_exp(__isl_keep isl_term *term,
2640                 enum isl_dim_type type, unsigned pos);
2641         __isl_give isl_aff *isl_term_get_div(
2642                 __isl_keep isl_term *term, unsigned pos);
2643         void isl_term_free(__isl_take isl_term *term);
2645 Each term is a product of parameters, set variables and
2646 integer divisions.  The function C<isl_term_get_exp>
2647 returns the exponent of a given dimensions in the given term.
2649 =back
2651 =head3 Reductions
2653 A reduction represents a maximum or a minimum of its
2654 base expressions.
2655 The only reduction type defined by C<isl> is
2656 C<isl_qpolynomial_fold>.
2658 There are currently no functions to directly create such
2659 objects, but they do appear in the piecewise quasipolynomial
2660 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2662 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2664 Reductions can be copied and freed using
2665 the following functions.
2667         #include <isl/polynomial.h>
2668         __isl_give isl_qpolynomial_fold *
2669         isl_qpolynomial_fold_copy(
2670                 __isl_keep isl_qpolynomial_fold *fold);
2671         void isl_qpolynomial_fold_free(
2672                 __isl_take isl_qpolynomial_fold *fold);
2674 To iterate over all quasipolynomials in a reduction, use
2676         isl_stat isl_qpolynomial_fold_foreach_qpolynomial(
2677                 __isl_keep isl_qpolynomial_fold *fold,
2678                 isl_stat (*fn)(__isl_take isl_qpolynomial *qp,
2679                           void *user), void *user);
2681 =head3 Multiple Expressions
2683 A multiple expression represents a sequence of zero or
2684 more base expressions, all defined on the same domain space.
2685 The domain space of the multiple expression is the same
2686 as that of the base expressions, but the range space
2687 can be any space.  In case the base expressions have
2688 a set space, the corresponding multiple expression
2689 also has a set space.
2690 Objects of the value type do not have an associated space.
2691 The space of a multiple value is therefore always a set space.
2692 Similarly, the space of a multiple union piecewise
2693 affine expression is always a set space.
2695 The multiple expression types defined by C<isl>
2696 are C<isl_multi_val>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
2697 C<isl_multi_union_pw_aff>.
2699 A multiple expression with the value zero for
2700 each output (or set) dimension can be created
2701 using the following functions.
2703         #include <isl/val.h>
2704         __isl_give isl_multi_val *isl_multi_val_zero(
2705                 __isl_take isl_space *space);
2707         #include <isl/aff.h>
2708         __isl_give isl_multi_aff *isl_multi_aff_zero(
2709                 __isl_take isl_space *space);
2710         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2711                 __isl_take isl_space *space);
2712         __isl_give isl_multi_union_pw_aff *
2713         isl_multi_union_pw_aff_zero(
2714                 __isl_take isl_space *space);
2716 Since there is no canonical way of representing a zero
2717 value of type C<isl_union_pw_aff>, the space passed
2718 to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
2720 An identity function can be created using the following
2721 functions.  The space needs to be that of a relation
2722 with the same number of input and output dimensions.
2724         #include <isl/aff.h>
2725         __isl_give isl_multi_aff *isl_multi_aff_identity(
2726                 __isl_take isl_space *space);
2727         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2728                 __isl_take isl_space *space);
2730 A function that performs a projection on a universe
2731 relation or set can be created using the following functions.
2732 See also the corresponding
2733 projection operations in L</"Unary Operations">.
2735         #include <isl/aff.h>
2736         __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2737                 __isl_take isl_space *space);
2738         __isl_give isl_multi_aff *isl_multi_aff_range_map(
2739                 __isl_take isl_space *space);
2740         __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2741                 __isl_take isl_space *space,
2742                 enum isl_dim_type type,
2743                 unsigned first, unsigned n);
2745 A multiple expression can be created from a single
2746 base expression using the following functions.
2747 The space of the created multiple expression is the same
2748 as that of the base expression, except for
2749 C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
2750 lives in a parameter space and the output lives
2751 in a single-dimensional set space.
2753         #include <isl/aff.h>
2754         __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2755                 __isl_take isl_aff *aff);
2756         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2757                 __isl_take isl_pw_aff *pa);
2758         __isl_give isl_multi_union_pw_aff *
2759         isl_multi_union_pw_aff_from_union_pw_aff(
2760                 __isl_take isl_union_pw_aff *upa);
2762 A multiple expression can be created from a list
2763 of base expression in a specified space.
2764 The domain of this space needs to be the same
2765 as the domains of the base expressions in the list.
2766 If the base expressions have a set space (or no associated space),
2767 then this space also needs to be a set space.
2769         #include <isl/val.h>
2770         __isl_give isl_multi_val *isl_multi_val_from_val_list(
2771                 __isl_take isl_space *space,
2772                 __isl_take isl_val_list *list);
2774         #include <isl/aff.h>
2775         __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2776                 __isl_take isl_space *space,
2777                 __isl_take isl_aff_list *list);
2778         __isl_give isl_multi_pw_aff *
2779         isl_multi_pw_aff_from_pw_aff_list(
2780                 __isl_take isl_space *space,
2781                 __isl_take isl_pw_aff_list *list);
2782         __isl_give isl_multi_union_pw_aff *
2783         isl_multi_union_pw_aff_from_union_pw_aff_list(
2784                 __isl_take isl_space *space,
2785                 __isl_take isl_union_pw_aff_list *list);
2787 As a convenience, a multiple piecewise expression can
2788 also be created from a multiple expression.
2789 Each piecewise expression in the result has a single
2790 universe cell.
2792         #include <isl/aff.h>
2793         __isl_give isl_multi_pw_aff *
2794         isl_multi_pw_aff_from_multi_aff(
2795                 __isl_take isl_multi_aff *ma);
2797 Similarly, a multiple union expression can be
2798 created from a multiple expression.
2800         #include <isl/aff.h>
2801         __isl_give isl_multi_union_pw_aff *
2802         isl_multi_union_pw_aff_from_multi_aff(
2803                 __isl_take isl_multi_aff *ma);
2804         __isl_give isl_multi_union_pw_aff *
2805         isl_multi_union_pw_aff_from_multi_pw_aff(
2806                 __isl_take isl_multi_pw_aff *mpa);
2808 A multiple quasi-affine expression can be created from
2809 a multiple value with a given domain space using the following
2810 function.
2812         #include <isl/aff.h>
2813         __isl_give isl_multi_aff *
2814         isl_multi_aff_multi_val_on_space(
2815                 __isl_take isl_space *space,
2816                 __isl_take isl_multi_val *mv);
2818 Similarly,
2819 a multiple union piecewise affine expression can be created from
2820 a multiple value with a given domain or
2821 a multiple affine expression with a given domain
2822 using the following functions.
2824         #include <isl/aff.h>
2825         __isl_give isl_multi_union_pw_aff *
2826         isl_multi_union_pw_aff_multi_val_on_domain(
2827                 __isl_take isl_union_set *domain,
2828                 __isl_take isl_multi_val *mv);
2829         __isl_give isl_multi_union_pw_aff *
2830         isl_multi_union_pw_aff_multi_aff_on_domain(
2831                 __isl_take isl_union_set *domain,
2832                 __isl_take isl_multi_aff *ma);
2834 Multiple expressions can be copied and freed using
2835 the following functions.
2837         #include <isl/val.h>
2838         __isl_give isl_multi_val *isl_multi_val_copy(
2839                 __isl_keep isl_multi_val *mv);
2840         __isl_null isl_multi_val *isl_multi_val_free(
2841                 __isl_take isl_multi_val *mv);
2843         #include <isl/aff.h>
2844         __isl_give isl_multi_aff *isl_multi_aff_copy(
2845                 __isl_keep isl_multi_aff *maff);
2846         __isl_null isl_multi_aff *isl_multi_aff_free(
2847                 __isl_take isl_multi_aff *maff);
2848         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2849                 __isl_keep isl_multi_pw_aff *mpa);
2850         __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2851                 __isl_take isl_multi_pw_aff *mpa);
2852         __isl_give isl_multi_union_pw_aff *
2853         isl_multi_union_pw_aff_copy(
2854                 __isl_keep isl_multi_union_pw_aff *mupa);
2855         __isl_null isl_multi_union_pw_aff *
2856         isl_multi_union_pw_aff_free(
2857                 __isl_take isl_multi_union_pw_aff *mupa);
2859 The base expression at a given position of a multiple
2860 expression can be extracted using the following functions.
2862         #include <isl/val.h>
2863         __isl_give isl_val *isl_multi_val_get_val(
2864                 __isl_keep isl_multi_val *mv, int pos);
2866         #include <isl/aff.h>
2867         __isl_give isl_aff *isl_multi_aff_get_aff(
2868                 __isl_keep isl_multi_aff *multi, int pos);
2869         __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2870                 __isl_keep isl_multi_pw_aff *mpa, int pos);
2871         __isl_give isl_union_pw_aff *
2872         isl_multi_union_pw_aff_get_union_pw_aff(
2873                 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
2875 It can be replaced using the following functions.
2877         #include <isl/val.h>
2878         __isl_give isl_multi_val *isl_multi_val_set_val(
2879                 __isl_take isl_multi_val *mv, int pos,
2880                 __isl_take isl_val *val);
2882         #include <isl/aff.h>
2883         __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2884                 __isl_take isl_multi_aff *multi, int pos,
2885                 __isl_take isl_aff *aff);
2886         __isl_give isl_multi_union_pw_aff *
2887         isl_multi_union_pw_aff_set_union_pw_aff(
2888                 __isl_take isl_multi_union_pw_aff *mupa, int pos,
2889                 __isl_take isl_union_pw_aff *upa);
2891 As a convenience, a sequence of base expressions that have
2892 their domains in a given space can be extracted from a sequence
2893 of union expressions using the following function.
2895         #include <isl/aff.h>
2896         __isl_give isl_multi_pw_aff *
2897         isl_multi_union_pw_aff_extract_multi_pw_aff(
2898                 __isl_keep isl_multi_union_pw_aff *mupa,
2899                 __isl_take isl_space *space);
2901 Note that there is a difference between C<isl_multi_union_pw_aff>
2902 and C<isl_union_pw_multi_aff> objects.  The first is a sequence
2903 of unions of piecewise expressions, while the second is a union
2904 of piecewise sequences.  In particular, multiple affine expressions
2905 in an C<isl_union_pw_multi_aff> may live in different spaces,
2906 while there is only a single multiple expression in
2907 an C<isl_multi_union_pw_aff>, which can therefore only live
2908 in a single space.  This means that not every
2909 C<isl_union_pw_multi_aff> can be converted to
2910 an C<isl_multi_union_pw_aff>.  Conversely, a zero-dimensional
2911 C<isl_multi_union_pw_aff> carries no information
2912 about any possible domain and therefore cannot be converted
2913 to an C<isl_union_pw_multi_aff>.  Moreover, the elements
2914 of an C<isl_multi_union_pw_aff> may be defined over different domains,
2915 while each multiple expression inside an C<isl_union_pw_multi_aff>
2916 has a single domain.  The conversion of an C<isl_union_pw_multi_aff>
2917 of dimension greater than one may therefore not be exact.
2918 The following functions can
2919 be used to perform these conversions when they are possible.
2921         #include <isl/aff.h>
2922         __isl_give isl_multi_union_pw_aff *
2923         isl_multi_union_pw_aff_from_union_pw_multi_aff(
2924                 __isl_take isl_union_pw_multi_aff *upma);
2925         __isl_give isl_union_pw_multi_aff *
2926         isl_union_pw_multi_aff_from_multi_union_pw_aff(
2927                 __isl_take isl_multi_union_pw_aff *mupa);
2929 =head3 Piecewise Expressions
2931 A piecewise expression is an expression that is described
2932 using zero or more base expression defined over the same
2933 number of cells in the domain space of the base expressions.
2934 All base expressions are defined over the same
2935 domain space and the cells are disjoint.
2936 The space of a piecewise expression is the same as
2937 that of the base expressions.
2938 If the union of the cells is a strict subset of the domain
2939 space, then the value of the piecewise expression outside
2940 this union is different for types derived from quasi-affine
2941 expressions and those derived from quasipolynomials.
2942 Piecewise expressions derived from quasi-affine expressions
2943 are considered to be undefined outside the union of their cells.
2944 Piecewise expressions derived from quasipolynomials
2945 are considered to be zero outside the union of their cells.
2947 Piecewise quasipolynomials are mainly used by the C<barvinok>
2948 library for representing the number of elements in a parametric set or map.
2949 For example, the piecewise quasipolynomial
2951         [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
2953 represents the number of points in the map
2955         [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
2957 The piecewise expression types defined by C<isl>
2958 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
2959 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
2961 A piecewise expression with no cells can be created using
2962 the following functions.
2964         #include <isl/aff.h>
2965         __isl_give isl_pw_aff *isl_pw_aff_empty(
2966                 __isl_take isl_space *space);
2967         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
2968                 __isl_take isl_space *space);
2970 A piecewise expression with a single universe cell can be
2971 created using the following functions.
2973         #include <isl/aff.h>
2974         __isl_give isl_pw_aff *isl_pw_aff_from_aff(
2975                 __isl_take isl_aff *aff);
2976         __isl_give isl_pw_multi_aff *
2977         isl_pw_multi_aff_from_multi_aff(
2978                 __isl_take isl_multi_aff *ma);
2980         #include <isl/polynomial.h>
2981         __isl_give isl_pw_qpolynomial *
2982         isl_pw_qpolynomial_from_qpolynomial(
2983                 __isl_take isl_qpolynomial *qp);
2985 A piecewise expression with a single specified cell can be
2986 created using the following functions.
2988         #include <isl/aff.h>
2989         __isl_give isl_pw_aff *isl_pw_aff_alloc(
2990                 __isl_take isl_set *set, __isl_take isl_aff *aff);
2991         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
2992                 __isl_take isl_set *set,
2993                 __isl_take isl_multi_aff *maff);
2995         #include <isl/polynomial.h>
2996         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
2997                 __isl_take isl_set *set,
2998                 __isl_take isl_qpolynomial *qp);
3000 The following convenience functions first create a base expression and
3001 then create a piecewise expression over a universe domain.
3003         #include <isl/aff.h>
3004         __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
3005                 __isl_take isl_local_space *ls);
3006         __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
3007                 __isl_take isl_local_space *ls,
3008                 enum isl_dim_type type, unsigned pos);
3009         __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
3010                 __isl_take isl_local_space *ls);
3011         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
3012                 __isl_take isl_space *space);
3013         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
3014                 __isl_take isl_space *space);
3015         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
3016                 __isl_take isl_space *space);
3017         __isl_give isl_pw_multi_aff *
3018         isl_pw_multi_aff_project_out_map(
3019                 __isl_take isl_space *space,
3020                 enum isl_dim_type type,
3021                 unsigned first, unsigned n);
3023         #include <isl/polynomial.h>
3024         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
3025                 __isl_take isl_space *space);
3027 The following convenience functions first create a base expression and
3028 then create a piecewise expression over a given domain.
3030         #include <isl/aff.h>
3031         __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
3032                 __isl_take isl_set *domain,
3033                 __isl_take isl_val *v);
3034         __isl_give isl_pw_multi_aff *
3035         isl_pw_multi_aff_multi_val_on_domain(
3036                 __isl_take isl_set *domain,
3037                 __isl_take isl_multi_val *mv);
3039 As a convenience, a piecewise multiple expression can
3040 also be created from a piecewise expression.
3041 Each multiple expression in the result is derived
3042 from the corresponding base expression.
3044         #include <isl/aff.h>
3045         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
3046                 __isl_take isl_pw_aff *pa);
3048 Similarly, a piecewise quasipolynomial can be
3049 created from a piecewise quasi-affine expression using
3050 the following function.
3052         #include <isl/polynomial.h>
3053         __isl_give isl_pw_qpolynomial *
3054         isl_pw_qpolynomial_from_pw_aff(
3055                 __isl_take isl_pw_aff *pwaff);
3057 Piecewise expressions can be copied and freed using the following functions.
3059         #include <isl/aff.h>
3060         __isl_give isl_pw_aff *isl_pw_aff_copy(
3061                 __isl_keep isl_pw_aff *pwaff);
3062         __isl_null isl_pw_aff *isl_pw_aff_free(
3063                 __isl_take isl_pw_aff *pwaff);
3064         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
3065                 __isl_keep isl_pw_multi_aff *pma);
3066         __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
3067                 __isl_take isl_pw_multi_aff *pma);
3069         #include <isl/polynomial.h>
3070         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
3071                 __isl_keep isl_pw_qpolynomial *pwqp);
3072         __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
3073                 __isl_take isl_pw_qpolynomial *pwqp);
3074         __isl_give isl_pw_qpolynomial_fold *
3075         isl_pw_qpolynomial_fold_copy(
3076                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3077         __isl_null isl_pw_qpolynomial_fold *
3078         isl_pw_qpolynomial_fold_free(
3079                 __isl_take isl_pw_qpolynomial_fold *pwf);
3081 To iterate over the different cells of a piecewise expression,
3082 use the following functions.
3084         #include <isl/aff.h>
3085         isl_bool isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
3086         int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
3087         isl_stat isl_pw_aff_foreach_piece(
3088                 __isl_keep isl_pw_aff *pwaff,
3089                 isl_stat (*fn)(__isl_take isl_set *set,
3090                           __isl_take isl_aff *aff,
3091                           void *user), void *user);
3092         int isl_pw_multi_aff_n_piece(
3093                 __isl_keep isl_pw_multi_aff *pma);
3094         isl_stat isl_pw_multi_aff_foreach_piece(
3095                 __isl_keep isl_pw_multi_aff *pma,
3096                 isl_stat (*fn)(__isl_take isl_set *set,
3097                             __isl_take isl_multi_aff *maff,
3098                             void *user), void *user);
3100         #include <isl/polynomial.h>
3101         int isl_pw_qpolynomial_n_piece(
3102                 __isl_keep isl_pw_qpolynomial *pwqp);
3103         isl_stat isl_pw_qpolynomial_foreach_piece(
3104                 __isl_keep isl_pw_qpolynomial *pwqp,
3105                 isl_stat (*fn)(__isl_take isl_set *set,
3106                           __isl_take isl_qpolynomial *qp,
3107                           void *user), void *user);
3108         isl_stat isl_pw_qpolynomial_foreach_lifted_piece(
3109                 __isl_keep isl_pw_qpolynomial *pwqp,
3110                 isl_stat (*fn)(__isl_take isl_set *set,
3111                           __isl_take isl_qpolynomial *qp,
3112                           void *user), void *user);
3113         int isl_pw_qpolynomial_fold_n_piece(
3114                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3115         isl_stat isl_pw_qpolynomial_fold_foreach_piece(
3116                 __isl_keep isl_pw_qpolynomial_fold *pwf,
3117                 isl_stat (*fn)(__isl_take isl_set *set,
3118                           __isl_take isl_qpolynomial_fold *fold,
3119                           void *user), void *user);
3120         isl_stat isl_pw_qpolynomial_fold_foreach_lifted_piece(
3121                 __isl_keep isl_pw_qpolynomial_fold *pwf,
3122                 isl_stat (*fn)(__isl_take isl_set *set,
3123                           __isl_take isl_qpolynomial_fold *fold,
3124                           void *user), void *user);
3126 As usual, the function C<fn> should return C<0> on success
3127 and C<-1> on failure.  The difference between
3128 C<isl_pw_qpolynomial_foreach_piece> and
3129 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
3130 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
3131 compute unique representations for all existentially quantified
3132 variables and then turn these existentially quantified variables
3133 into extra set variables, adapting the associated quasipolynomial
3134 accordingly.  This means that the C<set> passed to C<fn>
3135 will not have any existentially quantified variables, but that
3136 the dimensions of the sets may be different for different
3137 invocations of C<fn>.
3138 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
3139 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
3141 A piecewise expression consisting of the expressions at a given
3142 position of a piecewise multiple expression can be extracted
3143 using the following function.
3145         #include <isl/aff.h>
3146         __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3147                 __isl_keep isl_pw_multi_aff *pma, int pos);
3149 These expressions can be replaced using the following function.
3151         #include <isl/aff.h>
3152         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3153                 __isl_take isl_pw_multi_aff *pma, unsigned pos,
3154                 __isl_take isl_pw_aff *pa);
3156 Note that there is a difference between C<isl_multi_pw_aff> and
3157 C<isl_pw_multi_aff> objects.  The first is a sequence of piecewise
3158 affine expressions, while the second is a piecewise sequence
3159 of affine expressions.  In particular, each of the piecewise
3160 affine expressions in an C<isl_multi_pw_aff> may have a different
3161 domain, while all multiple expressions associated to a cell
3162 in an C<isl_pw_multi_aff> have the same domain.
3163 It is possible to convert between the two, but when converting
3164 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3165 of the result is the intersection of the domains of the input.
3166 The reverse conversion is exact.
3168         #include <isl/aff.h>
3169         __isl_give isl_pw_multi_aff *
3170         isl_pw_multi_aff_from_multi_pw_aff(
3171                 __isl_take isl_multi_pw_aff *mpa);
3172         __isl_give isl_multi_pw_aff *
3173         isl_multi_pw_aff_from_pw_multi_aff(
3174                 __isl_take isl_pw_multi_aff *pma);
3176 =head3 Union Expressions
3178 A union expression collects base expressions defined
3179 over different domains.  The space of a union expression
3180 is that of the shared parameter space.
3182 The union expression types defined by C<isl>
3183 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3184 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3185 In case of
3186 C<isl_union_pw_aff>,
3187 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>,
3188 there can be at most one base expression for a given domain space.
3189 In case of
3190 C<isl_union_pw_multi_aff>,
3191 there can be multiple such expressions for a given domain space,
3192 but the domains of these expressions need to be disjoint.
3194 An empty union expression can be created using the following functions.
3196         #include <isl/aff.h>
3197         __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
3198                 __isl_take isl_space *space);
3199         __isl_give isl_union_pw_multi_aff *
3200         isl_union_pw_multi_aff_empty(
3201                 __isl_take isl_space *space);
3203         #include <isl/polynomial.h>
3204         __isl_give isl_union_pw_qpolynomial *
3205         isl_union_pw_qpolynomial_zero(
3206                 __isl_take isl_space *space);
3208 A union expression containing a single base expression
3209 can be created using the following functions.
3211         #include <isl/aff.h>
3212         __isl_give isl_union_pw_aff *
3213         isl_union_pw_aff_from_pw_aff(
3214                 __isl_take isl_pw_aff *pa);
3215         __isl_give isl_union_pw_multi_aff *
3216         isl_union_pw_multi_aff_from_aff(
3217                 __isl_take isl_aff *aff);
3218         __isl_give isl_union_pw_multi_aff *
3219         isl_union_pw_multi_aff_from_pw_multi_aff(
3220                 __isl_take isl_pw_multi_aff *pma);
3222         #include <isl/polynomial.h>
3223         __isl_give isl_union_pw_qpolynomial *
3224         isl_union_pw_qpolynomial_from_pw_qpolynomial(
3225                 __isl_take isl_pw_qpolynomial *pwqp);
3227 The following functions create a base expression on each
3228 of the sets in the union set and collect the results.
3230         #include <isl/aff.h>
3231         __isl_give isl_union_pw_multi_aff *
3232         isl_union_pw_multi_aff_from_union_pw_aff(
3233                 __isl_take isl_union_pw_aff *upa);
3234         __isl_give isl_union_pw_aff *
3235         isl_union_pw_multi_aff_get_union_pw_aff(
3236                 __isl_keep isl_union_pw_multi_aff *upma, int pos);
3237         __isl_give isl_union_pw_aff *
3238         isl_union_pw_aff_val_on_domain(
3239                 __isl_take isl_union_set *domain,
3240                 __isl_take isl_val *v);
3241         __isl_give isl_union_pw_multi_aff *
3242         isl_union_pw_multi_aff_multi_val_on_domain(
3243                 __isl_take isl_union_set *domain,
3244                 __isl_take isl_multi_val *mv);
3246 An C<isl_union_pw_aff> that is equal to a (parametric) affine
3247 expression on a given domain can be created using the following
3248 function.
3250         #include <isl/aff.h>
3251         __isl_give isl_union_pw_aff *
3252         isl_union_pw_aff_aff_on_domain(
3253                 __isl_take isl_union_set *domain,
3254                 __isl_take isl_aff *aff);
3256 A base expression can be added to a union expression using
3257 the following functions.
3259         #include <isl/aff.h>
3260         __isl_give isl_union_pw_aff *
3261         isl_union_pw_aff_add_pw_aff(
3262                 __isl_take isl_union_pw_aff *upa,
3263                 __isl_take isl_pw_aff *pa);
3264         __isl_give isl_union_pw_multi_aff *
3265         isl_union_pw_multi_aff_add_pw_multi_aff(
3266                 __isl_take isl_union_pw_multi_aff *upma,
3267                 __isl_take isl_pw_multi_aff *pma);
3269         #include <isl/polynomial.h>
3270         __isl_give isl_union_pw_qpolynomial *
3271         isl_union_pw_qpolynomial_add_pw_qpolynomial(
3272                 __isl_take isl_union_pw_qpolynomial *upwqp,
3273                 __isl_take isl_pw_qpolynomial *pwqp);
3275 Union expressions can be copied and freed using
3276 the following functions.
3278         #include <isl/aff.h>
3279         __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
3280                 __isl_keep isl_union_pw_aff *upa);
3281         __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
3282                 __isl_take isl_union_pw_aff *upa);
3283         __isl_give isl_union_pw_multi_aff *
3284         isl_union_pw_multi_aff_copy(
3285                 __isl_keep isl_union_pw_multi_aff *upma);
3286         __isl_null isl_union_pw_multi_aff *
3287         isl_union_pw_multi_aff_free(
3288                 __isl_take isl_union_pw_multi_aff *upma);
3290         #include <isl/polynomial.h>
3291         __isl_give isl_union_pw_qpolynomial *
3292         isl_union_pw_qpolynomial_copy(
3293                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3294         __isl_null isl_union_pw_qpolynomial *
3295         isl_union_pw_qpolynomial_free(
3296                 __isl_take isl_union_pw_qpolynomial *upwqp);
3297         __isl_give isl_union_pw_qpolynomial_fold *
3298         isl_union_pw_qpolynomial_fold_copy(
3299                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3300         __isl_null isl_union_pw_qpolynomial_fold *
3301         isl_union_pw_qpolynomial_fold_free(
3302                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3304 To iterate over the base expressions in a union expression,
3305 use the following functions.
3307         #include <isl/aff.h>
3308         int isl_union_pw_aff_n_pw_aff(
3309                 __isl_keep isl_union_pw_aff *upa);
3310         isl_stat isl_union_pw_aff_foreach_pw_aff(
3311                 __isl_keep isl_union_pw_aff *upa,
3312                 isl_stat (*fn)(__isl_take isl_pw_aff *pa,
3313                         void *user), void *user);
3314         int isl_union_pw_multi_aff_n_pw_multi_aff(
3315                 __isl_keep isl_union_pw_multi_aff *upma);
3316         isl_stat isl_union_pw_multi_aff_foreach_pw_multi_aff(
3317                 __isl_keep isl_union_pw_multi_aff *upma,
3318                 isl_stat (*fn)(__isl_take isl_pw_multi_aff *pma,
3319                             void *user), void *user);
3321         #include <isl/polynomial.h>
3322         int isl_union_pw_qpolynomial_n_pw_qpolynomial(
3323                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3324         isl_stat isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3325                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3326                 isl_stat (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3327                             void *user), void *user);
3328         int isl_union_pw_qpolynomial_fold_n_pw_qpolynomial_fold(
3329                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3330         isl_stat isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3331                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3332                 isl_stat (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3333                             void *user), void *user);
3335 To extract the base expression in a given space from a union, use
3336 the following functions.
3338         #include <isl/aff.h>
3339         __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3340                 __isl_keep isl_union_pw_aff *upa,
3341                 __isl_take isl_space *space);
3342         __isl_give isl_pw_multi_aff *
3343         isl_union_pw_multi_aff_extract_pw_multi_aff(
3344                 __isl_keep isl_union_pw_multi_aff *upma,
3345                 __isl_take isl_space *space);
3347         #include <isl/polynomial.h>
3348         __isl_give isl_pw_qpolynomial *
3349         isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3350                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3351                 __isl_take isl_space *space);
3353 =head2 Input and Output
3355 For set and relation,
3356 C<isl> supports its own input/output format, which is similar
3357 to the C<Omega> format, but also supports the C<PolyLib> format
3358 in some cases.
3359 For other object types, typically only an C<isl> format is supported.
3361 =head3 C<isl> format
3363 The C<isl> format is similar to that of C<Omega>, but has a different
3364 syntax for describing the parameters and allows for the definition
3365 of an existentially quantified variable as the integer division
3366 of an affine expression.
3367 For example, the set of integers C<i> between C<0> and C<n>
3368 such that C<i % 10 <= 6> can be described as
3370         [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3371                                 i - 10 a <= 6) }
3373 A set or relation can have several disjuncts, separated
3374 by the keyword C<or>.  Each disjunct is either a conjunction
3375 of constraints or a projection (C<exists>) of a conjunction
3376 of constraints.  The constraints are separated by the keyword
3377 C<and>.
3379 =head3 C<PolyLib> format
3381 If the represented set is a union, then the first line
3382 contains a single number representing the number of disjuncts.
3383 Otherwise, a line containing the number C<1> is optional.
3385 Each disjunct is represented by a matrix of constraints.
3386 The first line contains two numbers representing
3387 the number of rows and columns,
3388 where the number of rows is equal to the number of constraints
3389 and the number of columns is equal to two plus the number of variables.
3390 The following lines contain the actual rows of the constraint matrix.
3391 In each row, the first column indicates whether the constraint
3392 is an equality (C<0>) or inequality (C<1>).  The final column
3393 corresponds to the constant term.
3395 If the set is parametric, then the coefficients of the parameters
3396 appear in the last columns before the constant column.
3397 The coefficients of any existentially quantified variables appear
3398 between those of the set variables and those of the parameters.
3400 =head3 Extended C<PolyLib> format
3402 The extended C<PolyLib> format is nearly identical to the
3403 C<PolyLib> format.  The only difference is that the line
3404 containing the number of rows and columns of a constraint matrix
3405 also contains four additional numbers:
3406 the number of output dimensions, the number of input dimensions,
3407 the number of local dimensions (i.e., the number of existentially
3408 quantified variables) and the number of parameters.
3409 For sets, the number of ``output'' dimensions is equal
3410 to the number of set dimensions, while the number of ``input''
3411 dimensions is zero.
3413 =head3 Input
3415 Objects can be read from input using the following functions.
3417         #include <isl/val.h>
3418         __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3419                 const char *str);
3420         __isl_give isl_multi_val *isl_multi_val_read_from_str(
3421                 isl_ctx *ctx, const char *str);
3423         #include <isl/set.h>
3424         __isl_give isl_basic_set *isl_basic_set_read_from_file(
3425                 isl_ctx *ctx, FILE *input);
3426         __isl_give isl_basic_set *isl_basic_set_read_from_str(
3427                 isl_ctx *ctx, const char *str);
3428         __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3429                 FILE *input);
3430         __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3431                 const char *str);
3433         #include <isl/map.h>
3434         __isl_give isl_basic_map *isl_basic_map_read_from_file(
3435                 isl_ctx *ctx, FILE *input);
3436         __isl_give isl_basic_map *isl_basic_map_read_from_str(
3437                 isl_ctx *ctx, const char *str);
3438         __isl_give isl_map *isl_map_read_from_file(
3439                 isl_ctx *ctx, FILE *input);
3440         __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3441                 const char *str);
3443         #include <isl/union_set.h>
3444         __isl_give isl_union_set *isl_union_set_read_from_file(
3445                 isl_ctx *ctx, FILE *input);
3446         __isl_give isl_union_set *isl_union_set_read_from_str(
3447                 isl_ctx *ctx, const char *str);
3449         #include <isl/union_map.h>
3450         __isl_give isl_union_map *isl_union_map_read_from_file(
3451                 isl_ctx *ctx, FILE *input);
3452         __isl_give isl_union_map *isl_union_map_read_from_str(
3453                 isl_ctx *ctx, const char *str);
3455         #include <isl/aff.h>
3456         __isl_give isl_aff *isl_aff_read_from_str(
3457                 isl_ctx *ctx, const char *str);
3458         __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3459                 isl_ctx *ctx, const char *str);
3460         __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3461                 isl_ctx *ctx, const char *str);
3462         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3463                 isl_ctx *ctx, const char *str);
3464         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3465                 isl_ctx *ctx, const char *str);
3466         __isl_give isl_union_pw_aff *
3467         isl_union_pw_aff_read_from_str(
3468                 isl_ctx *ctx, const char *str);
3469         __isl_give isl_union_pw_multi_aff *
3470         isl_union_pw_multi_aff_read_from_str(
3471                 isl_ctx *ctx, const char *str);
3472         __isl_give isl_multi_union_pw_aff *
3473         isl_multi_union_pw_aff_read_from_str(
3474                 isl_ctx *ctx, const char *str);
3476         #include <isl/polynomial.h>
3477         __isl_give isl_union_pw_qpolynomial *
3478         isl_union_pw_qpolynomial_read_from_str(
3479                 isl_ctx *ctx, const char *str);
3481 For sets and relations,
3482 the input format is autodetected and may be either the C<PolyLib> format
3483 or the C<isl> format.
3485 =head3 Output
3487 Before anything can be printed, an C<isl_printer> needs to
3488 be created.
3490         __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3491                 FILE *file);
3492         __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3493         __isl_null isl_printer *isl_printer_free(
3494                 __isl_take isl_printer *printer);
3496 C<isl_printer_to_file> prints to the given file, while
3497 C<isl_printer_to_str> prints to a string that can be extracted
3498 using the following function.
3500         #include <isl/printer.h>
3501         __isl_give char *isl_printer_get_str(
3502                 __isl_keep isl_printer *printer);
3504 The printer can be inspected using the following functions.
3506         FILE *isl_printer_get_file(
3507                 __isl_keep isl_printer *printer);
3508         int isl_printer_get_output_format(
3509                 __isl_keep isl_printer *p);
3510         int isl_printer_get_yaml_style(__isl_keep isl_printer *p);
3512 The behavior of the printer can be modified in various ways
3514         __isl_give isl_printer *isl_printer_set_output_format(
3515                 __isl_take isl_printer *p, int output_format);
3516         __isl_give isl_printer *isl_printer_set_indent(
3517                 __isl_take isl_printer *p, int indent);
3518         __isl_give isl_printer *isl_printer_set_indent_prefix(
3519                 __isl_take isl_printer *p, const char *prefix);
3520         __isl_give isl_printer *isl_printer_indent(
3521                 __isl_take isl_printer *p, int indent);
3522         __isl_give isl_printer *isl_printer_set_prefix(
3523                 __isl_take isl_printer *p, const char *prefix);
3524         __isl_give isl_printer *isl_printer_set_suffix(
3525                 __isl_take isl_printer *p, const char *suffix);
3526         __isl_give isl_printer *isl_printer_set_yaml_style(
3527                 __isl_take isl_printer *p, int yaml_style);
3529 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3530 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3531 and defaults to C<ISL_FORMAT_ISL>.
3532 Each line in the output is prefixed by C<indent_prefix>,
3533 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3534 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3535 In the C<PolyLib> format output,
3536 the coefficients of the existentially quantified variables
3537 appear between those of the set variables and those
3538 of the parameters.
3539 The function C<isl_printer_indent> increases the indentation
3540 by the specified amount (which may be negative).
3541 The YAML style may be either C<ISL_YAML_STYLE_BLOCK> or
3542 C<ISL_YAML_STYLE_FLOW> and when we are printing something
3543 in YAML format.
3545 To actually print something, use
3547         #include <isl/printer.h>
3548         __isl_give isl_printer *isl_printer_print_double(
3549                 __isl_take isl_printer *p, double d);
3551         #include <isl/val.h>
3552         __isl_give isl_printer *isl_printer_print_val(
3553                 __isl_take isl_printer *p, __isl_keep isl_val *v);
3555         #include <isl/set.h>
3556         __isl_give isl_printer *isl_printer_print_basic_set(
3557                 __isl_take isl_printer *printer,
3558                 __isl_keep isl_basic_set *bset);
3559         __isl_give isl_printer *isl_printer_print_set(
3560                 __isl_take isl_printer *printer,
3561                 __isl_keep isl_set *set);
3563         #include <isl/map.h>
3564         __isl_give isl_printer *isl_printer_print_basic_map(
3565                 __isl_take isl_printer *printer,
3566                 __isl_keep isl_basic_map *bmap);
3567         __isl_give isl_printer *isl_printer_print_map(
3568                 __isl_take isl_printer *printer,
3569                 __isl_keep isl_map *map);
3571         #include <isl/union_set.h>
3572         __isl_give isl_printer *isl_printer_print_union_set(
3573                 __isl_take isl_printer *p,
3574                 __isl_keep isl_union_set *uset);
3576         #include <isl/union_map.h>
3577         __isl_give isl_printer *isl_printer_print_union_map(
3578                 __isl_take isl_printer *p,
3579                 __isl_keep isl_union_map *umap);
3581         #include <isl/val.h>
3582         __isl_give isl_printer *isl_printer_print_multi_val(
3583                 __isl_take isl_printer *p,
3584                 __isl_keep isl_multi_val *mv);
3586         #include <isl/aff.h>
3587         __isl_give isl_printer *isl_printer_print_aff(
3588                 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3589         __isl_give isl_printer *isl_printer_print_multi_aff(
3590                 __isl_take isl_printer *p,
3591                 __isl_keep isl_multi_aff *maff);
3592         __isl_give isl_printer *isl_printer_print_pw_aff(
3593                 __isl_take isl_printer *p,
3594                 __isl_keep isl_pw_aff *pwaff);
3595         __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3596                 __isl_take isl_printer *p,
3597                 __isl_keep isl_pw_multi_aff *pma);
3598         __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3599                 __isl_take isl_printer *p,
3600                 __isl_keep isl_multi_pw_aff *mpa);
3601         __isl_give isl_printer *isl_printer_print_union_pw_aff(
3602                 __isl_take isl_printer *p,
3603                 __isl_keep isl_union_pw_aff *upa);
3604         __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3605                 __isl_take isl_printer *p,
3606                 __isl_keep isl_union_pw_multi_aff *upma);
3607         __isl_give isl_printer *
3608         isl_printer_print_multi_union_pw_aff(
3609                 __isl_take isl_printer *p,
3610                 __isl_keep isl_multi_union_pw_aff *mupa);
3612         #include <isl/polynomial.h>
3613         __isl_give isl_printer *isl_printer_print_qpolynomial(
3614                 __isl_take isl_printer *p,
3615                 __isl_keep isl_qpolynomial *qp);
3616         __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3617                 __isl_take isl_printer *p,
3618                 __isl_keep isl_pw_qpolynomial *pwqp);
3619         __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3620                 __isl_take isl_printer *p,
3621                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3623         __isl_give isl_printer *
3624         isl_printer_print_pw_qpolynomial_fold(
3625                 __isl_take isl_printer *p,
3626                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3627         __isl_give isl_printer *
3628         isl_printer_print_union_pw_qpolynomial_fold(
3629                 __isl_take isl_printer *p,
3630                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3632 For C<isl_printer_print_qpolynomial>,
3633 C<isl_printer_print_pw_qpolynomial> and
3634 C<isl_printer_print_pw_qpolynomial_fold>,
3635 the output format of the printer
3636 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3637 For C<isl_printer_print_union_pw_qpolynomial> and
3638 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3639 is supported.
3640 In case of printing in C<ISL_FORMAT_C>, the user may want
3641 to set the names of all dimensions first.
3643 C<isl> also provides limited support for printing YAML documents,
3644 just enough for the internal use for printing such documents.
3646         #include <isl/printer.h>
3647         __isl_give isl_printer *isl_printer_yaml_start_mapping(
3648                 __isl_take isl_printer *p);
3649         __isl_give isl_printer *isl_printer_yaml_end_mapping(
3650                 __isl_take isl_printer *p);
3651         __isl_give isl_printer *isl_printer_yaml_start_sequence(
3652                 __isl_take isl_printer *p);
3653         __isl_give isl_printer *isl_printer_yaml_end_sequence(
3654                 __isl_take isl_printer *p);
3655         __isl_give isl_printer *isl_printer_yaml_next(
3656                 __isl_take isl_printer *p);
3658 A document is started by a call to either
3659 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3660 Anything printed to the printer after such a call belong to the
3661 first key of the mapping or the first element in the sequence.
3662 The function C<isl_printer_yaml_next> moves to the value if
3663 we are currently printing a mapping key, the next key if we
3664 are printing a value or the next element if we are printing
3665 an element in a sequence.
3666 Nested mappings and sequences are initiated by the same
3667 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3668 Each call to these functions needs to have a corresponding call to
3669 C<isl_printer_yaml_end_mapping> or C<isl_printer_yaml_end_sequence>.
3671 When called on a file printer, the following function flushes
3672 the file.  When called on a string printer, the buffer is cleared.
3674         __isl_give isl_printer *isl_printer_flush(
3675                 __isl_take isl_printer *p);
3677 The following functions allow the user to attach
3678 notes to a printer in order to keep track of additional state.
3680         #include <isl/printer.h>
3681         isl_bool isl_printer_has_note(__isl_keep isl_printer *p,
3682                 __isl_keep isl_id *id);
3683         __isl_give isl_id *isl_printer_get_note(
3684                 __isl_keep isl_printer *p, __isl_take isl_id *id);
3685         __isl_give isl_printer *isl_printer_set_note(
3686                 __isl_take isl_printer *p,
3687                 __isl_take isl_id *id, __isl_take isl_id *note);
3689 C<isl_printer_set_note> associates the given note to the given
3690 identifier in the printer.
3691 C<isl_printer_get_note> retrieves a note associated to an
3692 identifier, while
3693 C<isl_printer_has_note> checks if there is such a note.
3694 C<isl_printer_get_note> fails if the requested note does not exist.
3696 Alternatively, a string representation can be obtained
3697 directly using the following functions, which always print
3698 in isl format.
3700         #include <isl/id.h>
3701         __isl_give char *isl_id_to_str(
3702                 __isl_keep isl_id *id);
3704         #include <isl/space.h>
3705         __isl_give char *isl_space_to_str(
3706                 __isl_keep isl_space *space);
3708         #include <isl/val.h>
3709         __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3710         __isl_give char *isl_multi_val_to_str(
3711                 __isl_keep isl_multi_val *mv);
3713         #include <isl/set.h>
3714         __isl_give char *isl_basic_set_to_str(
3715                 __isl_keep isl_basic_set *bset);
3716         __isl_give char *isl_set_to_str(
3717                 __isl_keep isl_set *set);
3719         #include <isl/union_set.h>
3720         __isl_give char *isl_union_set_to_str(
3721                 __isl_keep isl_union_set *uset);
3723         #include <isl/map.h>
3724         __isl_give char *isl_basic_map_to_str(
3725                 __isl_keep isl_basic_map *bmap);
3726         __isl_give char *isl_map_to_str(
3727                 __isl_keep isl_map *map);
3729         #include <isl/union_map.h>
3730         __isl_give char *isl_union_map_to_str(
3731                 __isl_keep isl_union_map *umap);
3733         #include <isl/aff.h>
3734         __isl_give char *isl_aff_to_str(__isl_keep isl_aff *aff);
3735         __isl_give char *isl_pw_aff_to_str(
3736                 __isl_keep isl_pw_aff *pa);
3737         __isl_give char *isl_multi_aff_to_str(
3738                 __isl_keep isl_multi_aff *ma);
3739         __isl_give char *isl_pw_multi_aff_to_str(
3740                 __isl_keep isl_pw_multi_aff *pma);
3741         __isl_give char *isl_multi_pw_aff_to_str(
3742                 __isl_keep isl_multi_pw_aff *mpa);
3743         __isl_give char *isl_union_pw_aff_to_str(
3744                 __isl_keep isl_union_pw_aff *upa);
3745         __isl_give char *isl_union_pw_multi_aff_to_str(
3746                 __isl_keep isl_union_pw_multi_aff *upma);
3747         __isl_give char *isl_multi_union_pw_aff_to_str(
3748                 __isl_keep isl_multi_union_pw_aff *mupa);
3750         #include <isl/point.h>
3751         __isl_give char *isl_point_to_str(
3752                 __isl_keep isl_point *pnt);
3754         #include <isl/polynomial.h>
3755         __isl_give char *isl_pw_qpolynomial_to_str(
3756                 __isl_keep isl_pw_qpolynomial *pwqp);
3757         __isl_give char *isl_union_pw_qpolynomial_to_str(
3758                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3760 =head2 Properties
3762 =head3 Unary Properties
3764 =over
3766 =item * Emptiness
3768 The following functions test whether the given set or relation
3769 contains any integer points.  The ``plain'' variants do not perform
3770 any computations, but simply check if the given set or relation
3771 is already known to be empty.
3773         isl_bool isl_basic_set_plain_is_empty(
3774                 __isl_keep isl_basic_set *bset);
3775         isl_bool isl_basic_set_is_empty(
3776                 __isl_keep isl_basic_set *bset);
3777         isl_bool isl_set_plain_is_empty(
3778                 __isl_keep isl_set *set);
3779         isl_bool isl_set_is_empty(__isl_keep isl_set *set);
3780         isl_bool isl_union_set_is_empty(
3781                 __isl_keep isl_union_set *uset);
3782         isl_bool isl_basic_map_plain_is_empty(
3783                 __isl_keep isl_basic_map *bmap);
3784         isl_bool isl_basic_map_is_empty(
3785                 __isl_keep isl_basic_map *bmap);
3786         isl_bool isl_map_plain_is_empty(
3787                 __isl_keep isl_map *map);
3788         isl_bool isl_map_is_empty(__isl_keep isl_map *map);
3789         isl_bool isl_union_map_is_empty(
3790                 __isl_keep isl_union_map *umap);
3792 =item * Universality
3794         isl_bool isl_basic_set_plain_is_universe(
3795                 __isl_keep isl_basic_set *bset);
3796         isl_bool isl_basic_set_is_universe(
3797                 __isl_keep isl_basic_set *bset);
3798         isl_bool isl_basic_map_plain_is_universe(
3799                 __isl_keep isl_basic_map *bmap);
3800         isl_bool isl_basic_map_is_universe(
3801                 __isl_keep isl_basic_map *bmap);
3802         isl_bool isl_set_plain_is_universe(
3803                 __isl_keep isl_set *set);
3804         isl_bool isl_map_plain_is_universe(
3805                 __isl_keep isl_map *map);
3807 =item * Single-valuedness
3809         #include <isl/set.h>
3810         isl_bool isl_set_is_singleton(__isl_keep isl_set *set);
3812         #include <isl/map.h>
3813         isl_bool isl_basic_map_is_single_valued(
3814                 __isl_keep isl_basic_map *bmap);
3815         isl_bool isl_map_plain_is_single_valued(
3816                 __isl_keep isl_map *map);
3817         isl_bool isl_map_is_single_valued(__isl_keep isl_map *map);
3819         #include <isl/union_map.h>
3820         isl_bool isl_union_map_is_single_valued(
3821                 __isl_keep isl_union_map *umap);
3823 =item * Injectivity
3825         isl_bool isl_map_plain_is_injective(
3826                 __isl_keep isl_map *map);
3827         isl_bool isl_map_is_injective(
3828                 __isl_keep isl_map *map);
3829         isl_bool isl_union_map_plain_is_injective(
3830                 __isl_keep isl_union_map *umap);
3831         isl_bool isl_union_map_is_injective(
3832                 __isl_keep isl_union_map *umap);
3834 =item * Bijectivity
3836         isl_bool isl_map_is_bijective(
3837                 __isl_keep isl_map *map);
3838         isl_bool isl_union_map_is_bijective(
3839                 __isl_keep isl_union_map *umap);
3841 =item * Identity
3843 The following functions test whether the given relation
3844 only maps elements to themselves.
3846         #include <isl/map.h>
3847         isl_bool isl_map_is_identity(
3848                 __isl_keep isl_map *map);
3850         #include <isl/union_map.h>
3851         isl_bool isl_union_map_is_identity(
3852                 __isl_keep isl_union_map *umap);
3854 =item * Position
3856         __isl_give isl_val *
3857         isl_basic_map_plain_get_val_if_fixed(
3858                 __isl_keep isl_basic_map *bmap,
3859                 enum isl_dim_type type, unsigned pos);
3860         __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3861                 __isl_keep isl_set *set,
3862                 enum isl_dim_type type, unsigned pos);
3863         __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3864                 __isl_keep isl_map *map,
3865                 enum isl_dim_type type, unsigned pos);
3867 If the set or relation obviously lies on a hyperplane where the given dimension
3868 has a fixed value, then return that value.
3869 Otherwise return NaN.
3871 =item * Stride
3873         isl_stat isl_set_dim_residue_class_val(
3874                 __isl_keep isl_set *set,
3875                 int pos, __isl_give isl_val **modulo,
3876                 __isl_give isl_val **residue);
3878 Check if the values of the given set dimension are equal to a fixed
3879 value modulo some integer value.  If so, assign the modulo to C<*modulo>
3880 and the fixed value to C<*residue>.  If the given dimension attains only
3881 a single value, then assign C<0> to C<*modulo> and the fixed value to
3882 C<*residue>.
3883 If the dimension does not attain only a single value and if no modulo
3884 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3886 =item * Dependence
3888 To check whether the description of a set, relation or function depends
3889 on one or more given dimensions,
3890 the following functions can be used.
3892         #include <isl/constraint.h>
3893         isl_bool isl_constraint_involves_dims(
3894                 __isl_keep isl_constraint *constraint,
3895                 enum isl_dim_type type, unsigned first, unsigned n);
3897         #include <isl/set.h>
3898         isl_bool isl_basic_set_involves_dims(
3899                 __isl_keep isl_basic_set *bset,
3900                 enum isl_dim_type type, unsigned first, unsigned n);
3901         isl_bool isl_set_involves_dims(__isl_keep isl_set *set,
3902                 enum isl_dim_type type, unsigned first, unsigned n);
3904         #include <isl/map.h>
3905         isl_bool isl_basic_map_involves_dims(
3906                 __isl_keep isl_basic_map *bmap,
3907                 enum isl_dim_type type, unsigned first, unsigned n);
3908         isl_bool isl_map_involves_dims(__isl_keep isl_map *map,
3909                 enum isl_dim_type type, unsigned first, unsigned n);
3911         #include <isl/union_map.h>
3912         isl_bool isl_union_map_involves_dims(
3913                 __isl_keep isl_union_map *umap,
3914                 enum isl_dim_type type, unsigned first, unsigned n);
3916         #include <isl/aff.h>
3917         isl_bool isl_aff_involves_dims(__isl_keep isl_aff *aff,
3918                 enum isl_dim_type type, unsigned first, unsigned n);
3919         isl_bool isl_pw_aff_involves_dims(
3920                 __isl_keep isl_pw_aff *pwaff,
3921                 enum isl_dim_type type, unsigned first, unsigned n);
3922         isl_bool isl_multi_aff_involves_dims(
3923                 __isl_keep isl_multi_aff *ma,
3924                 enum isl_dim_type type, unsigned first, unsigned n);
3925         isl_bool isl_multi_pw_aff_involves_dims(
3926                 __isl_keep isl_multi_pw_aff *mpa,
3927                 enum isl_dim_type type, unsigned first, unsigned n);
3929         #include <isl/polynomial.h>
3930         isl_bool isl_qpolynomial_involves_dims(
3931                 __isl_keep isl_qpolynomial *qp,
3932                 enum isl_dim_type type, unsigned first, unsigned n);
3934 Similarly, the following functions can be used to check whether
3935 a given dimension is involved in any lower or upper bound.
3937         #include <isl/set.h>
3938         isl_bool isl_set_dim_has_any_lower_bound(
3939                 __isl_keep isl_set *set,
3940                 enum isl_dim_type type, unsigned pos);
3941         isl_bool isl_set_dim_has_any_upper_bound(
3942                 __isl_keep isl_set *set,
3943                 enum isl_dim_type type, unsigned pos);
3945 Note that these functions return true even if there is a bound on
3946 the dimension on only some of the basic sets of C<set>.
3947 To check if they have a bound for all of the basic sets in C<set>,
3948 use the following functions instead.
3950         #include <isl/set.h>
3951         isl_bool isl_set_dim_has_lower_bound(
3952                 __isl_keep isl_set *set,
3953                 enum isl_dim_type type, unsigned pos);
3954         isl_bool isl_set_dim_has_upper_bound(
3955                 __isl_keep isl_set *set,
3956                 enum isl_dim_type type, unsigned pos);
3958 =item * Space
3960 To check whether a set is a parameter domain, use this function:
3962         isl_bool isl_set_is_params(__isl_keep isl_set *set);
3963         isl_bool isl_union_set_is_params(
3964                 __isl_keep isl_union_set *uset);
3966 =item * Wrapping
3968 The following functions check whether the space of the given
3969 (basic) set or relation range is a wrapped relation.
3971         #include <isl/space.h>
3972         isl_bool isl_space_is_wrapping(
3973                 __isl_keep isl_space *space);
3974         isl_bool isl_space_domain_is_wrapping(
3975                 __isl_keep isl_space *space);
3976         isl_bool isl_space_range_is_wrapping(
3977                 __isl_keep isl_space *space);
3979         #include <isl/set.h>
3980         isl_bool isl_basic_set_is_wrapping(
3981                 __isl_keep isl_basic_set *bset);
3982         isl_bool isl_set_is_wrapping(__isl_keep isl_set *set);
3984         #include <isl/map.h>
3985         isl_bool isl_map_domain_is_wrapping(
3986                 __isl_keep isl_map *map);
3987         isl_bool isl_map_range_is_wrapping(
3988                 __isl_keep isl_map *map);
3990         #include <isl/val.h>
3991         isl_bool isl_multi_val_range_is_wrapping(
3992                 __isl_keep isl_multi_val *mv);
3994         #include <isl/aff.h>
3995         isl_bool isl_multi_aff_range_is_wrapping(
3996                 __isl_keep isl_multi_aff *ma);
3997         isl_bool isl_multi_pw_aff_range_is_wrapping(
3998                 __isl_keep isl_multi_pw_aff *mpa);
3999         isl_bool isl_multi_union_pw_aff_range_is_wrapping(
4000                 __isl_keep isl_multi_union_pw_aff *mupa);
4002 The input to C<isl_space_is_wrapping> should
4003 be the space of a set, while that of
4004 C<isl_space_domain_is_wrapping> and
4005 C<isl_space_range_is_wrapping> should be the space of a relation.
4007 =item * Internal Product
4009         isl_bool isl_basic_map_can_zip(
4010                 __isl_keep isl_basic_map *bmap);
4011         isl_bool isl_map_can_zip(__isl_keep isl_map *map);
4013 Check whether the product of domain and range of the given relation
4014 can be computed,
4015 i.e., whether both domain and range are nested relations.
4017 =item * Currying
4019         #include <isl/space.h>
4020         isl_bool isl_space_can_curry(
4021                 __isl_keep isl_space *space);
4023         #include <isl/map.h>
4024         isl_bool isl_basic_map_can_curry(
4025                 __isl_keep isl_basic_map *bmap);
4026         isl_bool isl_map_can_curry(__isl_keep isl_map *map);
4028 Check whether the domain of the (basic) relation is a wrapped relation.
4030         #include <isl/space.h>
4031         __isl_give isl_space *isl_space_uncurry(
4032                 __isl_take isl_space *space);
4034         #include <isl/map.h>
4035         isl_bool isl_basic_map_can_uncurry(
4036                 __isl_keep isl_basic_map *bmap);
4037         isl_bool isl_map_can_uncurry(__isl_keep isl_map *map);
4039 Check whether the range of the (basic) relation is a wrapped relation.
4041         #include <isl/space.h>
4042         isl_bool isl_space_can_range_curry(
4043                 __isl_keep isl_space *space);
4045         #include <isl/map.h>
4046         isl_bool isl_map_can_range_curry(
4047                 __isl_keep isl_map *map);
4049 Check whether the domain of the relation wrapped in the range of
4050 the input is itself a wrapped relation.
4052 =item * Special Values
4054         #include <isl/aff.h>
4055         isl_bool isl_aff_is_cst(__isl_keep isl_aff *aff);
4056         isl_bool isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
4057         isl_bool isl_multi_pw_aff_is_cst(
4058                 __isl_keep isl_multi_pw_aff *mpa);
4060 Check whether the given expression is a constant.
4062         #include <isl/val.h>
4063         isl_bool isl_multi_val_involves_nan(
4064                 __isl_keep isl_multi_val *mv);
4066         #include <isl/aff.h>
4067         isl_bool isl_aff_is_nan(__isl_keep isl_aff *aff);
4068         isl_bool isl_multi_aff_involves_nan(
4069                 __isl_keep isl_multi_aff *ma);
4070         isl_bool isl_pw_aff_involves_nan(
4071                 __isl_keep isl_pw_aff *pa);
4072         isl_bool isl_pw_multi_aff_involves_nan(
4073                 __isl_keep isl_pw_multi_aff *pma);
4074         isl_bool isl_multi_pw_aff_involves_nan(
4075                 __isl_keep isl_multi_pw_aff *mpa);
4076         isl_bool isl_union_pw_aff_involves_nan(
4077                 __isl_keep isl_union_pw_aff *upa);
4078         isl_bool isl_union_pw_multi_aff_involves_nan(
4079                 __isl_keep isl_union_pw_multi_aff *upma);
4080         isl_bool isl_multi_union_pw_aff_involves_nan(
4081                 __isl_keep isl_multi_union_pw_aff *mupa);
4083         #include <isl/polynomial.h>
4084         isl_bool isl_qpolynomial_is_nan(
4085                 __isl_keep isl_qpolynomial *qp);
4086         isl_bool isl_qpolynomial_fold_is_nan(
4087                 __isl_keep isl_qpolynomial_fold *fold);
4088         isl_bool isl_pw_qpolynomial_involves_nan(
4089                 __isl_keep isl_pw_qpolynomial *pwqp);
4090         isl_bool isl_pw_qpolynomial_fold_involves_nan(
4091                 __isl_keep isl_pw_qpolynomial_fold *pwf);
4092         isl_bool isl_union_pw_qpolynomial_involves_nan(
4093                 __isl_keep isl_union_pw_qpolynomial *upwqp);
4094         isl_bool isl_union_pw_qpolynomial_fold_involves_nan(
4095                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
4097 Check whether the given expression is equal to or involves NaN.
4099         #include <isl/aff.h>
4100         isl_bool isl_aff_plain_is_zero(
4101                 __isl_keep isl_aff *aff);
4103 Check whether the affine expression is obviously zero.
4105 =back
4107 =head3 Binary Properties
4109 =over
4111 =item * Equality
4113 The following functions check whether two objects
4114 represent the same set, relation or function.
4115 The C<plain> variants only return true if the objects
4116 are obviously the same.  That is, they may return false
4117 even if the objects are the same, but they will never
4118 return true if the objects are not the same.
4120         #include <isl/set.h>
4121         isl_bool isl_basic_set_plain_is_equal(
4122                 __isl_keep isl_basic_set *bset1,
4123                 __isl_keep isl_basic_set *bset2);
4124         isl_bool isl_basic_set_is_equal(
4125                 __isl_keep isl_basic_set *bset1,
4126                 __isl_keep isl_basic_set *bset2);
4127         isl_bool isl_set_plain_is_equal(
4128                 __isl_keep isl_set *set1,
4129                 __isl_keep isl_set *set2);
4130         isl_bool isl_set_is_equal(__isl_keep isl_set *set1,
4131                 __isl_keep isl_set *set2);
4133         #include <isl/map.h>
4134         isl_bool isl_basic_map_is_equal(
4135                 __isl_keep isl_basic_map *bmap1,
4136                 __isl_keep isl_basic_map *bmap2);
4137         isl_bool isl_map_is_equal(__isl_keep isl_map *map1,
4138                 __isl_keep isl_map *map2);
4139         isl_bool isl_map_plain_is_equal(
4140                 __isl_keep isl_map *map1,
4141                 __isl_keep isl_map *map2);
4143         #include <isl/union_set.h>
4144         isl_bool isl_union_set_is_equal(
4145                 __isl_keep isl_union_set *uset1,
4146                 __isl_keep isl_union_set *uset2);
4148         #include <isl/union_map.h>
4149         isl_bool isl_union_map_is_equal(
4150                 __isl_keep isl_union_map *umap1,
4151                 __isl_keep isl_union_map *umap2);
4153         #include <isl/aff.h>
4154         isl_bool isl_aff_plain_is_equal(
4155                 __isl_keep isl_aff *aff1,
4156                 __isl_keep isl_aff *aff2);
4157         isl_bool isl_multi_aff_plain_is_equal(
4158                 __isl_keep isl_multi_aff *maff1,
4159                 __isl_keep isl_multi_aff *maff2);
4160         isl_bool isl_pw_aff_plain_is_equal(
4161                 __isl_keep isl_pw_aff *pwaff1,
4162                 __isl_keep isl_pw_aff *pwaff2);
4163         isl_bool isl_pw_aff_is_equal(
4164                 __isl_keep isl_pw_aff *pa1,
4165                 __isl_keep isl_pw_aff *pa2);
4166         isl_bool isl_pw_multi_aff_plain_is_equal(
4167                 __isl_keep isl_pw_multi_aff *pma1,
4168                 __isl_keep isl_pw_multi_aff *pma2);
4169         isl_bool isl_pw_multi_aff_is_equal(
4170                 __isl_keep isl_pw_multi_aff *pma1,
4171                 __isl_keep isl_pw_multi_aff *pma2);
4172         isl_bool isl_multi_pw_aff_plain_is_equal(
4173                 __isl_keep isl_multi_pw_aff *mpa1,
4174                 __isl_keep isl_multi_pw_aff *mpa2);
4175         isl_bool isl_multi_pw_aff_is_equal(
4176                 __isl_keep isl_multi_pw_aff *mpa1,
4177                 __isl_keep isl_multi_pw_aff *mpa2);
4178         isl_bool isl_union_pw_aff_plain_is_equal(
4179                 __isl_keep isl_union_pw_aff *upa1,
4180                 __isl_keep isl_union_pw_aff *upa2);
4181         isl_bool isl_union_pw_multi_aff_plain_is_equal(
4182                 __isl_keep isl_union_pw_multi_aff *upma1,
4183                 __isl_keep isl_union_pw_multi_aff *upma2);
4184         isl_bool isl_multi_union_pw_aff_plain_is_equal(
4185                 __isl_keep isl_multi_union_pw_aff *mupa1,
4186                 __isl_keep isl_multi_union_pw_aff *mupa2);
4188         #include <isl/polynomial.h>
4189         isl_bool isl_union_pw_qpolynomial_plain_is_equal(
4190                 __isl_keep isl_union_pw_qpolynomial *upwqp1,
4191                 __isl_keep isl_union_pw_qpolynomial *upwqp2);
4192         isl_bool isl_union_pw_qpolynomial_fold_plain_is_equal(
4193                 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
4194                 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
4196 =item * Disjointness
4198         #include <isl/set.h>
4199         isl_bool isl_basic_set_is_disjoint(
4200                 __isl_keep isl_basic_set *bset1,
4201                 __isl_keep isl_basic_set *bset2);
4202         isl_bool isl_set_plain_is_disjoint(
4203                 __isl_keep isl_set *set1,
4204                 __isl_keep isl_set *set2);
4205         isl_bool isl_set_is_disjoint(__isl_keep isl_set *set1,
4206                 __isl_keep isl_set *set2);
4208         #include <isl/map.h>
4209         isl_bool isl_basic_map_is_disjoint(
4210                 __isl_keep isl_basic_map *bmap1,
4211                 __isl_keep isl_basic_map *bmap2);
4212         isl_bool isl_map_is_disjoint(__isl_keep isl_map *map1,
4213                 __isl_keep isl_map *map2);
4215         #include <isl/union_set.h>
4216         isl_bool isl_union_set_is_disjoint(
4217                 __isl_keep isl_union_set *uset1,
4218                 __isl_keep isl_union_set *uset2);
4220         #include <isl/union_map.h>
4221         isl_bool isl_union_map_is_disjoint(
4222                 __isl_keep isl_union_map *umap1,
4223                 __isl_keep isl_union_map *umap2);
4225 =item * Subset
4227         isl_bool isl_basic_set_is_subset(
4228                 __isl_keep isl_basic_set *bset1,
4229                 __isl_keep isl_basic_set *bset2);
4230         isl_bool isl_set_is_subset(__isl_keep isl_set *set1,
4231                 __isl_keep isl_set *set2);
4232         isl_bool isl_set_is_strict_subset(
4233                 __isl_keep isl_set *set1,
4234                 __isl_keep isl_set *set2);
4235         isl_bool isl_union_set_is_subset(
4236                 __isl_keep isl_union_set *uset1,
4237                 __isl_keep isl_union_set *uset2);
4238         isl_bool isl_union_set_is_strict_subset(
4239                 __isl_keep isl_union_set *uset1,
4240                 __isl_keep isl_union_set *uset2);
4241         isl_bool isl_basic_map_is_subset(
4242                 __isl_keep isl_basic_map *bmap1,
4243                 __isl_keep isl_basic_map *bmap2);
4244         isl_bool isl_basic_map_is_strict_subset(
4245                 __isl_keep isl_basic_map *bmap1,
4246                 __isl_keep isl_basic_map *bmap2);
4247         isl_bool isl_map_is_subset(
4248                 __isl_keep isl_map *map1,
4249                 __isl_keep isl_map *map2);
4250         isl_bool isl_map_is_strict_subset(
4251                 __isl_keep isl_map *map1,
4252                 __isl_keep isl_map *map2);
4253         isl_bool isl_union_map_is_subset(
4254                 __isl_keep isl_union_map *umap1,
4255                 __isl_keep isl_union_map *umap2);
4256         isl_bool isl_union_map_is_strict_subset(
4257                 __isl_keep isl_union_map *umap1,
4258                 __isl_keep isl_union_map *umap2);
4260 Check whether the first argument is a (strict) subset of the
4261 second argument.
4263 =item * Order
4265 Every comparison function returns a negative value if the first
4266 argument is considered smaller than the second, a positive value
4267 if the first argument is considered greater and zero if the two
4268 constraints are considered the same by the comparison criterion.
4270         #include <isl/constraint.h>
4271         int isl_constraint_plain_cmp(
4272                 __isl_keep isl_constraint *c1,
4273                 __isl_keep isl_constraint *c2);
4275 This function is useful for sorting C<isl_constraint>s.
4276 The order depends on the internal representation of the inputs.
4277 The order is fixed over different calls to the function (assuming
4278 the internal representation of the inputs has not changed), but may
4279 change over different versions of C<isl>.
4281         #include <isl/constraint.h>
4282         int isl_constraint_cmp_last_non_zero(
4283                 __isl_keep isl_constraint *c1,
4284                 __isl_keep isl_constraint *c2);
4286 This function can be used to sort constraints that live in the same
4287 local space.  Constraints that involve ``earlier'' dimensions or
4288 that have a smaller coefficient for the shared latest dimension
4289 are considered smaller than other constraints.
4290 This function only defines a B<partial> order.
4292         #include <isl/set.h>
4293         int isl_set_plain_cmp(__isl_keep isl_set *set1,
4294                 __isl_keep isl_set *set2);
4296 This function is useful for sorting C<isl_set>s.
4297 The order depends on the internal representation of the inputs.
4298 The order is fixed over different calls to the function (assuming
4299 the internal representation of the inputs has not changed), but may
4300 change over different versions of C<isl>.
4302         #include <isl/aff.h>
4303         int isl_multi_aff_plain_cmp(
4304                 __isl_keep isl_multi_aff *ma1,
4305                 __isl_keep isl_multi_aff *ma2);
4306         int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
4307                 __isl_keep isl_pw_aff *pa2);
4309 The functions C<isl_multi_aff_plain_cmp> and
4310 C<isl_pw_aff_plain_cmp> can be used to sort C<isl_multi_aff>s and
4311 C<isl_pw_aff>s.  The order is not strictly defined.
4312 The current order sorts expressions that only involve
4313 earlier dimensions before those that involve later dimensions.
4315 =back
4317 =head2 Unary Operations
4319 =over
4321 =item * Complement
4323         __isl_give isl_set *isl_set_complement(
4324                 __isl_take isl_set *set);
4325         __isl_give isl_map *isl_map_complement(
4326                 __isl_take isl_map *map);
4328 =item * Inverse map
4330         #include <isl/space.h>
4331         __isl_give isl_space *isl_space_reverse(
4332                 __isl_take isl_space *space);
4334         #include <isl/map.h>
4335         __isl_give isl_basic_map *isl_basic_map_reverse(
4336                 __isl_take isl_basic_map *bmap);
4337         __isl_give isl_map *isl_map_reverse(
4338                 __isl_take isl_map *map);
4340         #include <isl/union_map.h>
4341         __isl_give isl_union_map *isl_union_map_reverse(
4342                 __isl_take isl_union_map *umap);
4344 =item * Projection
4346         #include <isl/space.h>
4347         __isl_give isl_space *isl_space_domain(
4348                 __isl_take isl_space *space);
4349         __isl_give isl_space *isl_space_range(
4350                 __isl_take isl_space *space);
4351         __isl_give isl_space *isl_space_params(
4352                 __isl_take isl_space *space);
4354         #include <isl/local_space.h>
4355         __isl_give isl_local_space *isl_local_space_domain(
4356                 __isl_take isl_local_space *ls);
4357         __isl_give isl_local_space *isl_local_space_range(
4358                 __isl_take isl_local_space *ls);
4360         #include <isl/set.h>
4361         __isl_give isl_basic_set *isl_basic_set_project_out(
4362                 __isl_take isl_basic_set *bset,
4363                 enum isl_dim_type type, unsigned first, unsigned n);
4364         __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
4365                 enum isl_dim_type type, unsigned first, unsigned n);
4366         __isl_give isl_map *isl_set_project_onto_map(
4367                 __isl_take isl_set *set,
4368                 enum isl_dim_type type, unsigned first,
4369                 unsigned n);
4370         __isl_give isl_basic_set *isl_basic_set_params(
4371                 __isl_take isl_basic_set *bset);
4372         __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
4374 The function C<isl_set_project_onto_map> returns a relation
4375 that projects the input set onto the given set dimensions.
4377         #include <isl/map.h>
4378         __isl_give isl_basic_map *isl_basic_map_project_out(
4379                 __isl_take isl_basic_map *bmap,
4380                 enum isl_dim_type type, unsigned first, unsigned n);
4381         __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
4382                 enum isl_dim_type type, unsigned first, unsigned n);
4383         __isl_give isl_basic_set *isl_basic_map_domain(
4384                 __isl_take isl_basic_map *bmap);
4385         __isl_give isl_basic_set *isl_basic_map_range(
4386                 __isl_take isl_basic_map *bmap);
4387         __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
4388         __isl_give isl_set *isl_map_domain(
4389                 __isl_take isl_map *bmap);
4390         __isl_give isl_set *isl_map_range(
4391                 __isl_take isl_map *map);
4393         #include <isl/union_set.h>
4394         __isl_give isl_union_set *isl_union_set_project_out(
4395                 __isl_take isl_union_set *uset,
4396                 enum isl_dim_type type,
4397                 unsigned first, unsigned n);
4398         __isl_give isl_set *isl_union_set_params(
4399                 __isl_take isl_union_set *uset);
4401 The function C<isl_union_set_project_out> can only project out
4402 parameters.
4404         #include <isl/union_map.h>
4405         __isl_give isl_union_map *isl_union_map_project_out(
4406                 __isl_take isl_union_map *umap,
4407                 enum isl_dim_type type, unsigned first, unsigned n);
4408         __isl_give isl_set *isl_union_map_params(
4409                 __isl_take isl_union_map *umap);
4410         __isl_give isl_union_set *isl_union_map_domain(
4411                 __isl_take isl_union_map *umap);
4412         __isl_give isl_union_set *isl_union_map_range(
4413                 __isl_take isl_union_map *umap);
4415 The function C<isl_union_map_project_out> can only project out
4416 parameters.
4418         #include <isl/aff.h>
4419         __isl_give isl_aff *isl_aff_project_domain_on_params(
4420                 __isl_take isl_aff *aff);
4421         __isl_give isl_pw_aff *
4422         isl_pw_aff_project_domain_on_params(
4423                 __isl_take isl_pw_aff *pa);
4424         __isl_give isl_pw_multi_aff *
4425         isl_pw_multi_aff_project_domain_on_params(
4426                 __isl_take isl_pw_multi_aff *pma);
4427         __isl_give isl_set *isl_pw_aff_domain(
4428                 __isl_take isl_pw_aff *pwaff);
4429         __isl_give isl_set *isl_pw_multi_aff_domain(
4430                 __isl_take isl_pw_multi_aff *pma);
4431         __isl_give isl_set *isl_multi_pw_aff_domain(
4432                 __isl_take isl_multi_pw_aff *mpa);
4433         __isl_give isl_union_set *isl_union_pw_aff_domain(
4434                 __isl_take isl_union_pw_aff *upa);
4435         __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
4436                 __isl_take isl_union_pw_multi_aff *upma);
4437         __isl_give isl_union_set *
4438         isl_multi_union_pw_aff_domain(
4439                 __isl_take isl_multi_union_pw_aff *mupa);
4440         __isl_give isl_set *isl_pw_aff_params(
4441                 __isl_take isl_pw_aff *pwa);
4443 The function C<isl_multi_union_pw_aff_domain> requires its
4444 input to have at least one set dimension.
4446         #include <isl/polynomial.h>
4447         __isl_give isl_qpolynomial *
4448         isl_qpolynomial_project_domain_on_params(
4449                 __isl_take isl_qpolynomial *qp);
4450         __isl_give isl_pw_qpolynomial *
4451         isl_pw_qpolynomial_project_domain_on_params(
4452                 __isl_take isl_pw_qpolynomial *pwqp);
4453         __isl_give isl_pw_qpolynomial_fold *
4454         isl_pw_qpolynomial_fold_project_domain_on_params(
4455                 __isl_take isl_pw_qpolynomial_fold *pwf);
4456         __isl_give isl_set *isl_pw_qpolynomial_domain(
4457                 __isl_take isl_pw_qpolynomial *pwqp);
4458         __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
4459                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4460         __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
4461                 __isl_take isl_union_pw_qpolynomial *upwqp);
4463         #include <isl/space.h>
4464         __isl_give isl_space *isl_space_domain_map(
4465                 __isl_take isl_space *space);
4466         __isl_give isl_space *isl_space_range_map(
4467                 __isl_take isl_space *space);
4469         #include <isl/map.h>
4470         __isl_give isl_map *isl_set_wrapped_domain_map(
4471                 __isl_take isl_set *set);
4472         __isl_give isl_basic_map *isl_basic_map_domain_map(
4473                 __isl_take isl_basic_map *bmap);
4474         __isl_give isl_basic_map *isl_basic_map_range_map(
4475                 __isl_take isl_basic_map *bmap);
4476         __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
4477         __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
4479         #include <isl/union_map.h>
4480         __isl_give isl_union_map *isl_union_map_domain_map(
4481                 __isl_take isl_union_map *umap);
4482         __isl_give isl_union_pw_multi_aff *
4483         isl_union_map_domain_map_union_pw_multi_aff(
4484                 __isl_take isl_union_map *umap);
4485         __isl_give isl_union_map *isl_union_map_range_map(
4486                 __isl_take isl_union_map *umap);
4487         __isl_give isl_union_map *
4488         isl_union_set_wrapped_domain_map(
4489                 __isl_take isl_union_set *uset);
4491 The functions above construct a (basic, regular or union) relation
4492 that maps (a wrapped version of) the input relation to its domain or range.
4493 C<isl_set_wrapped_domain_map> maps the input set to the domain
4494 of its wrapped relation.
4496 =item * Elimination
4498         __isl_give isl_basic_set *isl_basic_set_eliminate(
4499                 __isl_take isl_basic_set *bset,
4500                 enum isl_dim_type type,
4501                 unsigned first, unsigned n);
4502         __isl_give isl_set *isl_set_eliminate(
4503                 __isl_take isl_set *set, enum isl_dim_type type,
4504                 unsigned first, unsigned n);
4505         __isl_give isl_basic_map *isl_basic_map_eliminate(
4506                 __isl_take isl_basic_map *bmap,
4507                 enum isl_dim_type type,
4508                 unsigned first, unsigned n);
4509         __isl_give isl_map *isl_map_eliminate(
4510                 __isl_take isl_map *map, enum isl_dim_type type,
4511                 unsigned first, unsigned n);
4513 Eliminate the coefficients for the given dimensions from the constraints,
4514 without removing the dimensions.
4516 =item * Constructing a set from a parameter domain
4518 A zero-dimensional space or (basic) set can be constructed
4519 on a given parameter domain using the following functions.
4521         #include <isl/space.h>
4522         __isl_give isl_space *isl_space_set_from_params(
4523                 __isl_take isl_space *space);
4525         #include <isl/set.h>
4526         __isl_give isl_basic_set *isl_basic_set_from_params(
4527                 __isl_take isl_basic_set *bset);
4528         __isl_give isl_set *isl_set_from_params(
4529                 __isl_take isl_set *set);
4531 =item * Constructing a relation from one or two sets
4533 Create a relation with the given set(s) as domain and/or range.
4534 If only the domain or the range is specified, then
4535 the range or domain of the created relation is a zero-dimensional
4536 flat anonymous space.
4538         #include <isl/space.h>
4539         __isl_give isl_space *isl_space_from_domain(
4540                 __isl_take isl_space *space);
4541         __isl_give isl_space *isl_space_from_range(
4542                 __isl_take isl_space *space);
4543         __isl_give isl_space *isl_space_map_from_set(
4544                 __isl_take isl_space *space);
4545         __isl_give isl_space *isl_space_map_from_domain_and_range(
4546                 __isl_take isl_space *domain,
4547                 __isl_take isl_space *range);
4549         #include <isl/local_space.h>
4550         __isl_give isl_local_space *isl_local_space_from_domain(
4551                 __isl_take isl_local_space *ls);
4553         #include <isl/map.h>
4554         __isl_give isl_map *isl_map_from_domain(
4555                 __isl_take isl_set *set);
4556         __isl_give isl_map *isl_map_from_range(
4557                 __isl_take isl_set *set);
4559         #include <isl/union_map.h>
4560         __isl_give isl_union_map *
4561         isl_union_map_from_domain_and_range(
4562                 __isl_take isl_union_set *domain,
4563                 __isl_take isl_union_set *range);
4565         #include <isl/val.h>
4566         __isl_give isl_multi_val *isl_multi_val_from_range(
4567                 __isl_take isl_multi_val *mv);
4569         #include <isl/aff.h>
4570         __isl_give isl_multi_aff *isl_multi_aff_from_range(
4571                 __isl_take isl_multi_aff *ma);
4572         __isl_give isl_pw_aff *isl_pw_aff_from_range(
4573                 __isl_take isl_pw_aff *pwa);
4574         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
4575                 __isl_take isl_multi_pw_aff *mpa);
4576         __isl_give isl_multi_union_pw_aff *
4577         isl_multi_union_pw_aff_from_range(
4578                 __isl_take isl_multi_union_pw_aff *mupa);
4579         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
4580                 __isl_take isl_set *set);
4581         __isl_give isl_union_pw_multi_aff *
4582         isl_union_pw_multi_aff_from_domain(
4583                 __isl_take isl_union_set *uset);
4585         #include <isl/polynomial.h>
4586         __isl_give isl_pw_qpolynomial *
4587         isl_pw_qpolynomial_from_range(
4588                 __isl_take isl_pw_qpolynomial *pwqp);
4589         __isl_give isl_pw_qpolynomial_fold *
4590         isl_pw_qpolynomial_fold_from_range(
4591                 __isl_take isl_pw_qpolynomial_fold *pwf);
4593 =item * Slicing
4595         #include <isl/set.h>
4596         __isl_give isl_basic_set *isl_basic_set_fix_si(
4597                 __isl_take isl_basic_set *bset,
4598                 enum isl_dim_type type, unsigned pos, int value);
4599         __isl_give isl_basic_set *isl_basic_set_fix_val(
4600                 __isl_take isl_basic_set *bset,
4601                 enum isl_dim_type type, unsigned pos,
4602                 __isl_take isl_val *v);
4603         __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
4604                 enum isl_dim_type type, unsigned pos, int value);
4605         __isl_give isl_set *isl_set_fix_val(
4606                 __isl_take isl_set *set,
4607                 enum isl_dim_type type, unsigned pos,
4608                 __isl_take isl_val *v);
4610         #include <isl/map.h>
4611         __isl_give isl_basic_map *isl_basic_map_fix_si(
4612                 __isl_take isl_basic_map *bmap,
4613                 enum isl_dim_type type, unsigned pos, int value);
4614         __isl_give isl_basic_map *isl_basic_map_fix_val(
4615                 __isl_take isl_basic_map *bmap,
4616                 enum isl_dim_type type, unsigned pos,
4617                 __isl_take isl_val *v);
4618         __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
4619                 enum isl_dim_type type, unsigned pos, int value);
4620         __isl_give isl_map *isl_map_fix_val(
4621                 __isl_take isl_map *map,
4622                 enum isl_dim_type type, unsigned pos,
4623                 __isl_take isl_val *v);
4625         #include <isl/aff.h>
4626         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
4627                 __isl_take isl_pw_multi_aff *pma,
4628                 enum isl_dim_type type, unsigned pos, int value);
4630         #include <isl/polynomial.h>
4631         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
4632                 __isl_take isl_pw_qpolynomial *pwqp,
4633                 enum isl_dim_type type, unsigned n,
4634                 __isl_take isl_val *v);
4636 Intersect the set, relation or function domain
4637 with the hyperplane where the given
4638 dimension has the fixed given value.
4640         __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
4641                 __isl_take isl_basic_map *bmap,
4642                 enum isl_dim_type type, unsigned pos, int value);
4643         __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
4644                 __isl_take isl_basic_map *bmap,
4645                 enum isl_dim_type type, unsigned pos, int value);
4646         __isl_give isl_set *isl_set_lower_bound_si(
4647                 __isl_take isl_set *set,
4648                 enum isl_dim_type type, unsigned pos, int value);
4649         __isl_give isl_set *isl_set_lower_bound_val(
4650                 __isl_take isl_set *set,
4651                 enum isl_dim_type type, unsigned pos,
4652                 __isl_take isl_val *value);
4653         __isl_give isl_map *isl_map_lower_bound_si(
4654                 __isl_take isl_map *map,
4655                 enum isl_dim_type type, unsigned pos, int value);
4656         __isl_give isl_set *isl_set_upper_bound_si(
4657                 __isl_take isl_set *set,
4658                 enum isl_dim_type type, unsigned pos, int value);
4659         __isl_give isl_set *isl_set_upper_bound_val(
4660                 __isl_take isl_set *set,
4661                 enum isl_dim_type type, unsigned pos,
4662                 __isl_take isl_val *value);
4663         __isl_give isl_map *isl_map_upper_bound_si(
4664                 __isl_take isl_map *map,
4665                 enum isl_dim_type type, unsigned pos, int value);
4667 Intersect the set or relation with the half-space where the given
4668 dimension has a value bounded by the fixed given integer value.
4670         __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
4671                 enum isl_dim_type type1, int pos1,
4672                 enum isl_dim_type type2, int pos2);
4673         __isl_give isl_basic_map *isl_basic_map_equate(
4674                 __isl_take isl_basic_map *bmap,
4675                 enum isl_dim_type type1, int pos1,
4676                 enum isl_dim_type type2, int pos2);
4677         __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
4678                 enum isl_dim_type type1, int pos1,
4679                 enum isl_dim_type type2, int pos2);
4681 Intersect the set or relation with the hyperplane where the given
4682 dimensions are equal to each other.
4684         __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4685                 enum isl_dim_type type1, int pos1,
4686                 enum isl_dim_type type2, int pos2);
4688 Intersect the relation with the hyperplane where the given
4689 dimensions have opposite values.
4691         __isl_give isl_map *isl_map_order_le(
4692                 __isl_take isl_map *map,
4693                 enum isl_dim_type type1, int pos1,
4694                 enum isl_dim_type type2, int pos2);
4695         __isl_give isl_basic_map *isl_basic_map_order_ge(
4696                 __isl_take isl_basic_map *bmap,
4697                 enum isl_dim_type type1, int pos1,
4698                 enum isl_dim_type type2, int pos2);
4699         __isl_give isl_map *isl_map_order_ge(
4700                 __isl_take isl_map *map,
4701                 enum isl_dim_type type1, int pos1,
4702                 enum isl_dim_type type2, int pos2);
4703         __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4704                 enum isl_dim_type type1, int pos1,
4705                 enum isl_dim_type type2, int pos2);
4706         __isl_give isl_basic_map *isl_basic_map_order_gt(
4707                 __isl_take isl_basic_map *bmap,
4708                 enum isl_dim_type type1, int pos1,
4709                 enum isl_dim_type type2, int pos2);
4710         __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4711                 enum isl_dim_type type1, int pos1,
4712                 enum isl_dim_type type2, int pos2);
4714 Intersect the relation with the half-space where the given
4715 dimensions satisfy the given ordering.
4717 =item * Locus
4719         #include <isl/aff.h>
4720         __isl_give isl_basic_set *isl_aff_zero_basic_set(
4721                 __isl_take isl_aff *aff);
4722         __isl_give isl_basic_set *isl_aff_neg_basic_set(
4723                 __isl_take isl_aff *aff);
4724         __isl_give isl_set *isl_pw_aff_pos_set(
4725                 __isl_take isl_pw_aff *pa);
4726         __isl_give isl_set *isl_pw_aff_nonneg_set(
4727                 __isl_take isl_pw_aff *pwaff);
4728         __isl_give isl_set *isl_pw_aff_zero_set(
4729                 __isl_take isl_pw_aff *pwaff);
4730         __isl_give isl_set *isl_pw_aff_non_zero_set(
4731                 __isl_take isl_pw_aff *pwaff);
4732         __isl_give isl_union_set *
4733         isl_union_pw_aff_zero_union_set(
4734                 __isl_take isl_union_pw_aff *upa);
4735         __isl_give isl_union_set *
4736         isl_multi_union_pw_aff_zero_union_set(
4737                 __isl_take isl_multi_union_pw_aff *mupa);
4739 The function C<isl_aff_neg_basic_set> returns a basic set
4740 containing those elements in the domain space
4741 of C<aff> where C<aff> is negative.
4742 The function C<isl_pw_aff_nonneg_set> returns a set
4743 containing those elements in the domain
4744 of C<pwaff> where C<pwaff> is non-negative.
4745 The function C<isl_multi_union_pw_aff_zero_union_set>
4746 returns a union set containing those elements
4747 in the domains of its elements where they are all zero.
4749 =item * Identity
4751         __isl_give isl_map *isl_set_identity(
4752                 __isl_take isl_set *set);
4753         __isl_give isl_union_map *isl_union_set_identity(
4754                 __isl_take isl_union_set *uset);
4755         __isl_give isl_union_pw_multi_aff *
4756         isl_union_set_identity_union_pw_multi_aff(
4757                 __isl_take isl_union_set *uset);
4759 Construct an identity relation on the given (union) set.
4761 =item * Function Extraction
4763 A piecewise quasi affine expression that is equal to 1 on a set
4764 and 0 outside the set can be created using the following function.
4766         #include <isl/aff.h>
4767         __isl_give isl_pw_aff *isl_set_indicator_function(
4768                 __isl_take isl_set *set);
4770 A piecewise multiple quasi affine expression can be extracted
4771 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4772 and the C<isl_map> is single-valued.
4773 In case of a conversion from an C<isl_union_map>
4774 to an C<isl_union_pw_multi_aff>, these properties need to hold
4775 in each domain space.
4776 A conversion to a C<isl_multi_union_pw_aff> additionally
4777 requires that the input is non-empty and involves only a single
4778 range space.
4780         #include <isl/aff.h>
4781         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4782                 __isl_take isl_set *set);
4783         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4784                 __isl_take isl_map *map);
4786         __isl_give isl_union_pw_multi_aff *
4787         isl_union_pw_multi_aff_from_union_set(
4788                 __isl_take isl_union_set *uset);
4789         __isl_give isl_union_pw_multi_aff *
4790         isl_union_pw_multi_aff_from_union_map(
4791                 __isl_take isl_union_map *umap);
4793         __isl_give isl_multi_union_pw_aff *
4794         isl_multi_union_pw_aff_from_union_map(
4795                 __isl_take isl_union_map *umap);
4797 =item * Deltas
4799         __isl_give isl_basic_set *isl_basic_map_deltas(
4800                 __isl_take isl_basic_map *bmap);
4801         __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
4802         __isl_give isl_union_set *isl_union_map_deltas(
4803                 __isl_take isl_union_map *umap);
4805 These functions return a (basic) set containing the differences
4806 between image elements and corresponding domain elements in the input.
4808         __isl_give isl_basic_map *isl_basic_map_deltas_map(
4809                 __isl_take isl_basic_map *bmap);
4810         __isl_give isl_map *isl_map_deltas_map(
4811                 __isl_take isl_map *map);
4812         __isl_give isl_union_map *isl_union_map_deltas_map(
4813                 __isl_take isl_union_map *umap);
4815 The functions above construct a (basic, regular or union) relation
4816 that maps (a wrapped version of) the input relation to its delta set.
4818 =item * Coalescing
4820 Simplify the representation of a set, relation or functions by trying
4821 to combine pairs of basic sets or relations into a single
4822 basic set or relation.
4824         #include <isl/set.h>
4825         __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
4827         #include <isl/map.h>
4828         __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
4830         #include <isl/union_set.h>
4831         __isl_give isl_union_set *isl_union_set_coalesce(
4832                 __isl_take isl_union_set *uset);
4834         #include <isl/union_map.h>
4835         __isl_give isl_union_map *isl_union_map_coalesce(
4836                 __isl_take isl_union_map *umap);
4838         #include <isl/aff.h>
4839         __isl_give isl_pw_aff *isl_pw_aff_coalesce(
4840                 __isl_take isl_pw_aff *pwqp);
4841         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
4842                 __isl_take isl_pw_multi_aff *pma);
4843         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
4844                 __isl_take isl_multi_pw_aff *mpa);
4845         __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
4846                 __isl_take isl_union_pw_aff *upa);
4847         __isl_give isl_union_pw_multi_aff *
4848         isl_union_pw_multi_aff_coalesce(
4849                 __isl_take isl_union_pw_multi_aff *upma);
4850         __isl_give isl_multi_union_pw_aff *
4851         isl_multi_union_pw_aff_coalesce(
4852                 __isl_take isl_multi_union_pw_aff *aff);
4854         #include <isl/polynomial.h>
4855         __isl_give isl_pw_qpolynomial_fold *
4856         isl_pw_qpolynomial_fold_coalesce(
4857                 __isl_take isl_pw_qpolynomial_fold *pwf);
4858         __isl_give isl_union_pw_qpolynomial *
4859         isl_union_pw_qpolynomial_coalesce(
4860                 __isl_take isl_union_pw_qpolynomial *upwqp);
4861         __isl_give isl_union_pw_qpolynomial_fold *
4862         isl_union_pw_qpolynomial_fold_coalesce(
4863                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4865 One of the methods for combining pairs of basic sets or relations
4866 can result in coefficients that are much larger than those that appear
4867 in the constraints of the input.  By default, the coefficients are
4868 not allowed to grow larger, but this can be changed by unsetting
4869 the following option.
4871         isl_stat isl_options_set_coalesce_bounded_wrapping(
4872                 isl_ctx *ctx, int val);
4873         int isl_options_get_coalesce_bounded_wrapping(
4874                 isl_ctx *ctx);
4876 =item * Detecting equalities
4878         __isl_give isl_basic_set *isl_basic_set_detect_equalities(
4879                 __isl_take isl_basic_set *bset);
4880         __isl_give isl_basic_map *isl_basic_map_detect_equalities(
4881                 __isl_take isl_basic_map *bmap);
4882         __isl_give isl_set *isl_set_detect_equalities(
4883                 __isl_take isl_set *set);
4884         __isl_give isl_map *isl_map_detect_equalities(
4885                 __isl_take isl_map *map);
4886         __isl_give isl_union_set *isl_union_set_detect_equalities(
4887                 __isl_take isl_union_set *uset);
4888         __isl_give isl_union_map *isl_union_map_detect_equalities(
4889                 __isl_take isl_union_map *umap);
4891 Simplify the representation of a set or relation by detecting implicit
4892 equalities.
4894 =item * Removing redundant constraints
4896         #include <isl/set.h>
4897         __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
4898                 __isl_take isl_basic_set *bset);
4899         __isl_give isl_set *isl_set_remove_redundancies(
4900                 __isl_take isl_set *set);
4902         #include <isl/union_set.h>
4903         __isl_give isl_union_set *
4904         isl_union_set_remove_redundancies(
4905                 __isl_take isl_union_set *uset);
4907         #include <isl/map.h>
4908         __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
4909                 __isl_take isl_basic_map *bmap);
4910         __isl_give isl_map *isl_map_remove_redundancies(
4911                 __isl_take isl_map *map);
4913         #include <isl/union_map.h>
4914         __isl_give isl_union_map *
4915         isl_union_map_remove_redundancies(
4916                 __isl_take isl_union_map *umap);
4918 =item * Convex hull
4920         __isl_give isl_basic_set *isl_set_convex_hull(
4921                 __isl_take isl_set *set);
4922         __isl_give isl_basic_map *isl_map_convex_hull(
4923                 __isl_take isl_map *map);
4925 If the input set or relation has any existentially quantified
4926 variables, then the result of these operations is currently undefined.
4928 =item * Simple hull
4930         #include <isl/set.h>
4931         __isl_give isl_basic_set *
4932         isl_set_unshifted_simple_hull(
4933                 __isl_take isl_set *set);
4934         __isl_give isl_basic_set *isl_set_simple_hull(
4935                 __isl_take isl_set *set);
4936         __isl_give isl_basic_set *
4937         isl_set_plain_unshifted_simple_hull(
4938                 __isl_take isl_set *set);
4939         __isl_give isl_basic_set *
4940         isl_set_unshifted_simple_hull_from_set_list(
4941                 __isl_take isl_set *set,
4942                 __isl_take isl_set_list *list);
4944         #include <isl/map.h>
4945         __isl_give isl_basic_map *
4946         isl_map_unshifted_simple_hull(
4947                 __isl_take isl_map *map);
4948         __isl_give isl_basic_map *isl_map_simple_hull(
4949                 __isl_take isl_map *map);
4950         __isl_give isl_basic_map *
4951         isl_map_plain_unshifted_simple_hull(
4952                 __isl_take isl_map *map);
4953                 __isl_give isl_basic_map *
4954         isl_map_unshifted_simple_hull_from_map_list(
4955                 __isl_take isl_map *map,
4956                 __isl_take isl_map_list *list);
4958         #include <isl/union_map.h>
4959         __isl_give isl_union_map *isl_union_map_simple_hull(
4960                 __isl_take isl_union_map *umap);
4962 These functions compute a single basic set or relation
4963 that contains the whole input set or relation.
4964 In particular, the output is described by translates
4965 of the constraints describing the basic sets or relations in the input.
4966 In case of C<isl_set_unshifted_simple_hull>, only the original
4967 constraints are used, without any translation.
4968 In case of C<isl_set_plain_unshifted_simple_hull> and
4969 C<isl_map_plain_unshifted_simple_hull>, the result is described
4970 by original constraints that are obviously satisfied
4971 by the entire input set or relation.
4972 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
4973 C<isl_map_unshifted_simple_hull_from_map_list>, the
4974 constraints are taken from the elements of the second argument.
4976 =begin latex
4978 (See \autoref{s:simple hull}.)
4980 =end latex
4982 =item * Affine hull
4984         __isl_give isl_basic_set *isl_basic_set_affine_hull(
4985                 __isl_take isl_basic_set *bset);
4986         __isl_give isl_basic_set *isl_set_affine_hull(
4987                 __isl_take isl_set *set);
4988         __isl_give isl_union_set *isl_union_set_affine_hull(
4989                 __isl_take isl_union_set *uset);
4990         __isl_give isl_basic_map *isl_basic_map_affine_hull(
4991                 __isl_take isl_basic_map *bmap);
4992         __isl_give isl_basic_map *isl_map_affine_hull(
4993                 __isl_take isl_map *map);
4994         __isl_give isl_union_map *isl_union_map_affine_hull(
4995                 __isl_take isl_union_map *umap);
4997 In case of union sets and relations, the affine hull is computed
4998 per space.
5000 =item * Polyhedral hull
5002         __isl_give isl_basic_set *isl_set_polyhedral_hull(
5003                 __isl_take isl_set *set);
5004         __isl_give isl_basic_map *isl_map_polyhedral_hull(
5005                 __isl_take isl_map *map);
5006         __isl_give isl_union_set *isl_union_set_polyhedral_hull(
5007                 __isl_take isl_union_set *uset);
5008         __isl_give isl_union_map *isl_union_map_polyhedral_hull(
5009                 __isl_take isl_union_map *umap);
5011 These functions compute a single basic set or relation
5012 not involving any existentially quantified variables
5013 that contains the whole input set or relation.
5014 In case of union sets and relations, the polyhedral hull is computed
5015 per space.
5017 =item * Other approximations
5019         #include <isl/set.h>
5020         __isl_give isl_basic_set *
5021         isl_basic_set_drop_constraints_involving_dims(
5022                 __isl_take isl_basic_set *bset,
5023                 enum isl_dim_type type,
5024                 unsigned first, unsigned n);
5025         __isl_give isl_basic_set *
5026         isl_basic_set_drop_constraints_not_involving_dims(
5027                 __isl_take isl_basic_set *bset,
5028                 enum isl_dim_type type,
5029                 unsigned first, unsigned n);
5030         __isl_give isl_set *
5031         isl_set_drop_constraints_involving_dims(
5032                 __isl_take isl_set *set,
5033                 enum isl_dim_type type,
5034                 unsigned first, unsigned n);
5035         __isl_give isl_set *
5036         isl_set_drop_constraints_not_involving_dims(
5037                 __isl_take isl_set *set,
5038                 enum isl_dim_type type,
5039                 unsigned first, unsigned n);
5041         #include <isl/map.h>
5042         __isl_give isl_basic_map *
5043         isl_basic_map_drop_constraints_involving_dims(
5044                 __isl_take isl_basic_map *bmap,
5045                 enum isl_dim_type type,
5046                 unsigned first, unsigned n);
5047         __isl_give isl_basic_map *
5048         isl_basic_map_drop_constraints_not_involving_dims(
5049                 __isl_take isl_basic_map *bmap,
5050                 enum isl_dim_type type,
5051                 unsigned first, unsigned n);
5052         __isl_give isl_map *
5053         isl_map_drop_constraints_involving_dims(
5054                 __isl_take isl_map *map,
5055                 enum isl_dim_type type,
5056                 unsigned first, unsigned n);
5057         __isl_give isl_map *
5058         isl_map_drop_constraints_not_involving_dims(
5059                 __isl_take isl_map *map,
5060                 enum isl_dim_type type,
5061                 unsigned first, unsigned n);
5063 These functions drop any constraints (not) involving the specified dimensions.
5064 Note that the result depends on the representation of the input.
5066         #include <isl/polynomial.h>
5067         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
5068                 __isl_take isl_pw_qpolynomial *pwqp, int sign);
5069         __isl_give isl_union_pw_qpolynomial *
5070         isl_union_pw_qpolynomial_to_polynomial(
5071                 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
5073 Approximate each quasipolynomial by a polynomial.  If C<sign> is positive,
5074 the polynomial will be an overapproximation.  If C<sign> is negative,
5075 it will be an underapproximation.  If C<sign> is zero, the approximation
5076 will lie somewhere in between.
5078 =item * Feasibility
5080         __isl_give isl_basic_set *isl_basic_set_sample(
5081                 __isl_take isl_basic_set *bset);
5082         __isl_give isl_basic_set *isl_set_sample(
5083                 __isl_take isl_set *set);
5084         __isl_give isl_basic_map *isl_basic_map_sample(
5085                 __isl_take isl_basic_map *bmap);
5086         __isl_give isl_basic_map *isl_map_sample(
5087                 __isl_take isl_map *map);
5089 If the input (basic) set or relation is non-empty, then return
5090 a singleton subset of the input.  Otherwise, return an empty set.
5092 =item * Optimization
5094         #include <isl/ilp.h>
5095         __isl_give isl_val *isl_basic_set_max_val(
5096                 __isl_keep isl_basic_set *bset,
5097                 __isl_keep isl_aff *obj);
5098         __isl_give isl_val *isl_set_min_val(
5099                 __isl_keep isl_set *set,
5100                 __isl_keep isl_aff *obj);
5101         __isl_give isl_val *isl_set_max_val(
5102                 __isl_keep isl_set *set,
5103                 __isl_keep isl_aff *obj);
5104         __isl_give isl_multi_val *
5105         isl_union_set_min_multi_union_pw_aff(
5106                 __isl_keep isl_union_set *set,
5107                 __isl_keep isl_multi_union_pw_aff *obj);
5109 Compute the minimum or maximum of the integer affine expression C<obj>
5110 over the points in C<set>, returning the result in C<opt>.
5111 The result is C<NULL> in case of an error, the optimal value in case
5112 there is one, negative infinity or infinity if the problem is unbounded and
5113 NaN if the problem is empty.
5115 =item * Parametric optimization
5117         __isl_give isl_pw_aff *isl_set_dim_min(
5118                 __isl_take isl_set *set, int pos);
5119         __isl_give isl_pw_aff *isl_set_dim_max(
5120                 __isl_take isl_set *set, int pos);
5121         __isl_give isl_pw_aff *isl_map_dim_min(
5122                 __isl_take isl_map *map, int pos);
5123         __isl_give isl_pw_aff *isl_map_dim_max(
5124                 __isl_take isl_map *map, int pos);
5126 Compute the minimum or maximum of the given set or output dimension
5127 as a function of the parameters (and input dimensions), but independently
5128 of the other set or output dimensions.
5129 For lexicographic optimization, see L<"Lexicographic Optimization">.
5131 =item * Dual
5133 The following functions compute either the set of (rational) coefficient
5134 values of valid constraints for the given set or the set of (rational)
5135 values satisfying the constraints with coefficients from the given set.
5136 Internally, these two sets of functions perform essentially the
5137 same operations, except that the set of coefficients is assumed to
5138 be a cone, while the set of values may be any polyhedron.
5139 The current implementation is based on the Farkas lemma and
5140 Fourier-Motzkin elimination, but this may change or be made optional
5141 in future.  In particular, future implementations may use different
5142 dualization algorithms or skip the elimination step.
5144         __isl_give isl_basic_set *isl_basic_set_coefficients(
5145                 __isl_take isl_basic_set *bset);
5146         __isl_give isl_basic_set *isl_set_coefficients(
5147                 __isl_take isl_set *set);
5148         __isl_give isl_union_set *isl_union_set_coefficients(
5149                 __isl_take isl_union_set *bset);
5150         __isl_give isl_basic_set *isl_basic_set_solutions(
5151                 __isl_take isl_basic_set *bset);
5152         __isl_give isl_basic_set *isl_set_solutions(
5153                 __isl_take isl_set *set);
5154         __isl_give isl_union_set *isl_union_set_solutions(
5155                 __isl_take isl_union_set *bset);
5157 =item * Power
5159         __isl_give isl_map *isl_map_fixed_power_val(
5160                 __isl_take isl_map *map,
5161                 __isl_take isl_val *exp);
5162         __isl_give isl_union_map *
5163         isl_union_map_fixed_power_val(
5164                 __isl_take isl_union_map *umap,
5165                 __isl_take isl_val *exp);
5167 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
5168 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
5169 of C<map> is computed.
5171         __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
5172                 int *exact);
5173         __isl_give isl_union_map *isl_union_map_power(
5174                 __isl_take isl_union_map *umap, int *exact);
5176 Compute a parametric representation for all positive powers I<k> of C<map>.
5177 The result maps I<k> to a nested relation corresponding to the
5178 I<k>th power of C<map>.
5179 The result may be an overapproximation.  If the result is known to be exact,
5180 then C<*exact> is set to C<1>.
5182 =item * Transitive closure
5184         __isl_give isl_map *isl_map_transitive_closure(
5185                 __isl_take isl_map *map, int *exact);
5186         __isl_give isl_union_map *isl_union_map_transitive_closure(
5187                 __isl_take isl_union_map *umap, int *exact);
5189 Compute the transitive closure of C<map>.
5190 The result may be an overapproximation.  If the result is known to be exact,
5191 then C<*exact> is set to C<1>.
5193 =item * Reaching path lengths
5195         __isl_give isl_map *isl_map_reaching_path_lengths(
5196                 __isl_take isl_map *map, int *exact);
5198 Compute a relation that maps each element in the range of C<map>
5199 to the lengths of all paths composed of edges in C<map> that
5200 end up in the given element.
5201 The result may be an overapproximation.  If the result is known to be exact,
5202 then C<*exact> is set to C<1>.
5203 To compute the I<maximal> path length, the resulting relation
5204 should be postprocessed by C<isl_map_lexmax>.
5205 In particular, if the input relation is a dependence relation
5206 (mapping sources to sinks), then the maximal path length corresponds
5207 to the free schedule.
5208 Note, however, that C<isl_map_lexmax> expects the maximum to be
5209 finite, so if the path lengths are unbounded (possibly due to
5210 the overapproximation), then you will get an error message.
5212 =item * Wrapping
5214         #include <isl/space.h>
5215         __isl_give isl_space *isl_space_wrap(
5216                 __isl_take isl_space *space);
5217         __isl_give isl_space *isl_space_unwrap(
5218                 __isl_take isl_space *space);
5220         #include <isl/local_space.h>
5221         __isl_give isl_local_space *isl_local_space_wrap(
5222                 __isl_take isl_local_space *ls);
5224         #include <isl/set.h>
5225         __isl_give isl_basic_map *isl_basic_set_unwrap(
5226                 __isl_take isl_basic_set *bset);
5227         __isl_give isl_map *isl_set_unwrap(
5228                 __isl_take isl_set *set);
5230         #include <isl/map.h>
5231         __isl_give isl_basic_set *isl_basic_map_wrap(
5232                 __isl_take isl_basic_map *bmap);
5233         __isl_give isl_set *isl_map_wrap(
5234                 __isl_take isl_map *map);
5236         #include <isl/union_set.h>
5237         __isl_give isl_union_map *isl_union_set_unwrap(
5238                 __isl_take isl_union_set *uset);
5240         #include <isl/union_map.h>
5241         __isl_give isl_union_set *isl_union_map_wrap(
5242                 __isl_take isl_union_map *umap);
5244 The input to C<isl_space_unwrap> should
5245 be the space of a set, while that of
5246 C<isl_space_wrap> should be the space of a relation.
5247 Conversely, the output of C<isl_space_unwrap> is the space
5248 of a relation, while that of C<isl_space_wrap> is the space of a set.
5250 =item * Flattening
5252 Remove any internal structure of domain (and range) of the given
5253 set or relation.  If there is any such internal structure in the input,
5254 then the name of the space is also removed.
5256         #include <isl/local_space.h>
5257         __isl_give isl_local_space *
5258         isl_local_space_flatten_domain(
5259                 __isl_take isl_local_space *ls);
5260         __isl_give isl_local_space *
5261         isl_local_space_flatten_range(
5262                 __isl_take isl_local_space *ls);
5264         #include <isl/set.h>
5265         __isl_give isl_basic_set *isl_basic_set_flatten(
5266                 __isl_take isl_basic_set *bset);
5267         __isl_give isl_set *isl_set_flatten(
5268                 __isl_take isl_set *set);
5270         #include <isl/map.h>
5271         __isl_give isl_basic_map *isl_basic_map_flatten_domain(
5272                 __isl_take isl_basic_map *bmap);
5273         __isl_give isl_basic_map *isl_basic_map_flatten_range(
5274                 __isl_take isl_basic_map *bmap);
5275         __isl_give isl_map *isl_map_flatten_range(
5276                 __isl_take isl_map *map);
5277         __isl_give isl_map *isl_map_flatten_domain(
5278                 __isl_take isl_map *map);
5279         __isl_give isl_basic_map *isl_basic_map_flatten(
5280                 __isl_take isl_basic_map *bmap);
5281         __isl_give isl_map *isl_map_flatten(
5282                 __isl_take isl_map *map);
5284         #include <isl/val.h>
5285         __isl_give isl_multi_val *isl_multi_val_flatten_range(
5286                 __isl_take isl_multi_val *mv);
5288         #include <isl/aff.h>
5289         __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
5290                 __isl_take isl_multi_aff *ma);
5291         __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
5292                 __isl_take isl_multi_aff *ma);
5293         __isl_give isl_multi_pw_aff *
5294         isl_multi_pw_aff_flatten_range(
5295                 __isl_take isl_multi_pw_aff *mpa);
5296         __isl_give isl_multi_union_pw_aff *
5297         isl_multi_union_pw_aff_flatten_range(
5298                 __isl_take isl_multi_union_pw_aff *mupa);
5300         #include <isl/map.h>
5301         __isl_give isl_map *isl_set_flatten_map(
5302                 __isl_take isl_set *set);
5304 The function above constructs a relation
5305 that maps the input set to a flattened version of the set.
5307 =item * Lifting
5309 Lift the input set to a space with extra dimensions corresponding
5310 to the existentially quantified variables in the input.
5311 In particular, the result lives in a wrapped map where the domain
5312 is the original space and the range corresponds to the original
5313 existentially quantified variables.
5315         #include <isl/set.h>
5316         __isl_give isl_basic_set *isl_basic_set_lift(
5317                 __isl_take isl_basic_set *bset);
5318         __isl_give isl_set *isl_set_lift(
5319                 __isl_take isl_set *set);
5320         __isl_give isl_union_set *isl_union_set_lift(
5321                 __isl_take isl_union_set *uset);
5323 Given a local space that contains the existentially quantified
5324 variables of a set, a basic relation that, when applied to
5325 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
5326 can be constructed using the following function.
5328         #include <isl/local_space.h>
5329         __isl_give isl_basic_map *isl_local_space_lifting(
5330                 __isl_take isl_local_space *ls);
5332         #include <isl/aff.h>
5333         __isl_give isl_multi_aff *isl_multi_aff_lift(
5334                 __isl_take isl_multi_aff *maff,
5335                 __isl_give isl_local_space **ls);
5337 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
5338 then it is assigned the local space that lies at the basis of
5339 the lifting applied.
5341 =item * Internal Product
5343         #include <isl/space.h>
5344         __isl_give isl_space *isl_space_zip(
5345                 __isl_take isl_space *space);
5347         #include <isl/map.h>
5348         __isl_give isl_basic_map *isl_basic_map_zip(
5349                 __isl_take isl_basic_map *bmap);
5350         __isl_give isl_map *isl_map_zip(
5351                 __isl_take isl_map *map);
5353         #include <isl/union_map.h>
5354         __isl_give isl_union_map *isl_union_map_zip(
5355                 __isl_take isl_union_map *umap);
5357 Given a relation with nested relations for domain and range,
5358 interchange the range of the domain with the domain of the range.
5360 =item * Currying
5362         #include <isl/space.h>
5363         __isl_give isl_space *isl_space_curry(
5364                 __isl_take isl_space *space);
5365         __isl_give isl_space *isl_space_uncurry(
5366                 __isl_take isl_space *space);
5368         #include <isl/map.h>
5369         __isl_give isl_basic_map *isl_basic_map_curry(
5370                 __isl_take isl_basic_map *bmap);
5371         __isl_give isl_basic_map *isl_basic_map_uncurry(
5372                 __isl_take isl_basic_map *bmap);
5373         __isl_give isl_map *isl_map_curry(
5374                 __isl_take isl_map *map);
5375         __isl_give isl_map *isl_map_uncurry(
5376                 __isl_take isl_map *map);
5378         #include <isl/union_map.h>
5379         __isl_give isl_union_map *isl_union_map_curry(
5380                 __isl_take isl_union_map *umap);
5381         __isl_give isl_union_map *isl_union_map_uncurry(
5382                 __isl_take isl_union_map *umap);
5384 Given a relation with a nested relation for domain,
5385 the C<curry> functions
5386 move the range of the nested relation out of the domain
5387 and use it as the domain of a nested relation in the range,
5388 with the original range as range of this nested relation.
5389 The C<uncurry> functions perform the inverse operation.
5391         #include <isl/space.h>
5392         __isl_give isl_space *isl_space_range_curry(
5393                 __isl_take isl_space *space);
5395         #include <isl/map.h>
5396         __isl_give isl_map *isl_map_range_curry(
5397                 __isl_take isl_map *map);
5399         #include <isl/union_map.h>
5400         __isl_give isl_union_map *isl_union_map_range_curry(
5401                 __isl_take isl_union_map *umap);
5403 These functions apply the currying to the relation that
5404 is nested inside the range of the input.
5406 =item * Aligning parameters
5408 Change the order of the parameters of the given set, relation
5409 or function
5410 such that the first parameters match those of C<model>.
5411 This may involve the introduction of extra parameters.
5412 All parameters need to be named.
5414         #include <isl/space.h>
5415         __isl_give isl_space *isl_space_align_params(
5416                 __isl_take isl_space *space1,
5417                 __isl_take isl_space *space2)
5419         #include <isl/set.h>
5420         __isl_give isl_basic_set *isl_basic_set_align_params(
5421                 __isl_take isl_basic_set *bset,
5422                 __isl_take isl_space *model);
5423         __isl_give isl_set *isl_set_align_params(
5424                 __isl_take isl_set *set,
5425                 __isl_take isl_space *model);
5427         #include <isl/map.h>
5428         __isl_give isl_basic_map *isl_basic_map_align_params(
5429                 __isl_take isl_basic_map *bmap,
5430                 __isl_take isl_space *model);
5431         __isl_give isl_map *isl_map_align_params(
5432                 __isl_take isl_map *map,
5433                 __isl_take isl_space *model);
5435         #include <isl/val.h>
5436         __isl_give isl_multi_val *isl_multi_val_align_params(
5437                 __isl_take isl_multi_val *mv,
5438                 __isl_take isl_space *model);
5440         #include <isl/aff.h>
5441         __isl_give isl_aff *isl_aff_align_params(
5442                 __isl_take isl_aff *aff,
5443                 __isl_take isl_space *model);
5444         __isl_give isl_multi_aff *isl_multi_aff_align_params(
5445                 __isl_take isl_multi_aff *multi,
5446                 __isl_take isl_space *model);
5447         __isl_give isl_pw_aff *isl_pw_aff_align_params(
5448                 __isl_take isl_pw_aff *pwaff,
5449                 __isl_take isl_space *model);
5450         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
5451                 __isl_take isl_pw_multi_aff *pma,
5452                 __isl_take isl_space *model);
5453         __isl_give isl_union_pw_aff *
5454         isl_union_pw_aff_align_params(
5455                 __isl_take isl_union_pw_aff *upa,
5456                 __isl_take isl_space *model);
5457         __isl_give isl_union_pw_multi_aff *
5458         isl_union_pw_multi_aff_align_params(
5459                 __isl_take isl_union_pw_multi_aff *upma,
5460                 __isl_take isl_space *model);
5461         __isl_give isl_multi_union_pw_aff *
5462         isl_multi_union_pw_aff_align_params(
5463                 __isl_take isl_multi_union_pw_aff *mupa,
5464                 __isl_take isl_space *model);
5466         #include <isl/polynomial.h>
5467         __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
5468                 __isl_take isl_qpolynomial *qp,
5469                 __isl_take isl_space *model);
5471 =item * Unary Arithmetic Operations
5473         #include <isl/set.h>
5474         __isl_give isl_set *isl_set_neg(
5475                 __isl_take isl_set *set);
5476         #include <isl/map.h>
5477         __isl_give isl_map *isl_map_neg(
5478                 __isl_take isl_map *map);
5480 C<isl_set_neg> constructs a set containing the opposites of
5481 the elements in its argument.
5482 The domain of the result of C<isl_map_neg> is the same
5483 as the domain of its argument.  The corresponding range
5484 elements are the opposites of the corresponding range
5485 elements in the argument.
5487         #include <isl/val.h>
5488         __isl_give isl_multi_val *isl_multi_val_neg(
5489                 __isl_take isl_multi_val *mv);
5491         #include <isl/aff.h>
5492         __isl_give isl_aff *isl_aff_neg(
5493                 __isl_take isl_aff *aff);
5494         __isl_give isl_multi_aff *isl_multi_aff_neg(
5495                 __isl_take isl_multi_aff *ma);
5496         __isl_give isl_pw_aff *isl_pw_aff_neg(
5497                 __isl_take isl_pw_aff *pwaff);
5498         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
5499                 __isl_take isl_pw_multi_aff *pma);
5500         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
5501                 __isl_take isl_multi_pw_aff *mpa);
5502         __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
5503                 __isl_take isl_union_pw_aff *upa);
5504         __isl_give isl_union_pw_multi_aff *
5505         isl_union_pw_multi_aff_neg(
5506                 __isl_take isl_union_pw_multi_aff *upma);
5507         __isl_give isl_multi_union_pw_aff *
5508         isl_multi_union_pw_aff_neg(
5509                 __isl_take isl_multi_union_pw_aff *mupa);
5510         __isl_give isl_aff *isl_aff_ceil(
5511                 __isl_take isl_aff *aff);
5512         __isl_give isl_pw_aff *isl_pw_aff_ceil(
5513                 __isl_take isl_pw_aff *pwaff);
5514         __isl_give isl_aff *isl_aff_floor(
5515                 __isl_take isl_aff *aff);
5516         __isl_give isl_multi_aff *isl_multi_aff_floor(
5517                 __isl_take isl_multi_aff *ma);
5518         __isl_give isl_pw_aff *isl_pw_aff_floor(
5519                 __isl_take isl_pw_aff *pwaff);
5520         __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
5521                 __isl_take isl_union_pw_aff *upa);
5522         __isl_give isl_multi_union_pw_aff *
5523         isl_multi_union_pw_aff_floor(
5524                 __isl_take isl_multi_union_pw_aff *mupa);
5526         #include <isl/aff.h>
5527         __isl_give isl_pw_aff *isl_pw_aff_list_min(
5528                 __isl_take isl_pw_aff_list *list);
5529         __isl_give isl_pw_aff *isl_pw_aff_list_max(
5530                 __isl_take isl_pw_aff_list *list);
5532         #include <isl/polynomial.h>
5533         __isl_give isl_qpolynomial *isl_qpolynomial_neg(
5534                 __isl_take isl_qpolynomial *qp);
5535         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
5536                 __isl_take isl_pw_qpolynomial *pwqp);
5537         __isl_give isl_union_pw_qpolynomial *
5538         isl_union_pw_qpolynomial_neg(
5539                 __isl_take isl_union_pw_qpolynomial *upwqp);
5540         __isl_give isl_qpolynomial *isl_qpolynomial_pow(
5541                 __isl_take isl_qpolynomial *qp,
5542                 unsigned exponent);
5543         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
5544                 __isl_take isl_pw_qpolynomial *pwqp,
5545                 unsigned exponent);
5547 =item * Evaluation
5549 The following functions evaluate a function in a point.
5551         #include <isl/polynomial.h>
5552         __isl_give isl_val *isl_pw_qpolynomial_eval(
5553                 __isl_take isl_pw_qpolynomial *pwqp,
5554                 __isl_take isl_point *pnt);
5555         __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
5556                 __isl_take isl_pw_qpolynomial_fold *pwf,
5557                 __isl_take isl_point *pnt);
5558         __isl_give isl_val *isl_union_pw_qpolynomial_eval(
5559                 __isl_take isl_union_pw_qpolynomial *upwqp,
5560                 __isl_take isl_point *pnt);
5561         __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
5562                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5563                 __isl_take isl_point *pnt);
5565 =item * Dimension manipulation
5567 It is usually not advisable to directly change the (input or output)
5568 space of a set or a relation as this removes the name and the internal
5569 structure of the space.  However, the functions below can be useful
5570 to add new parameters, assuming
5571 C<isl_set_align_params> and C<isl_map_align_params>
5572 are not sufficient.
5574         #include <isl/space.h>
5575         __isl_give isl_space *isl_space_add_dims(
5576                 __isl_take isl_space *space,
5577                 enum isl_dim_type type, unsigned n);
5578         __isl_give isl_space *isl_space_insert_dims(
5579                 __isl_take isl_space *space,
5580                 enum isl_dim_type type, unsigned pos, unsigned n);
5581         __isl_give isl_space *isl_space_drop_dims(
5582                 __isl_take isl_space *space,
5583                 enum isl_dim_type type, unsigned first, unsigned n);
5584         __isl_give isl_space *isl_space_move_dims(
5585                 __isl_take isl_space *space,
5586                 enum isl_dim_type dst_type, unsigned dst_pos,
5587                 enum isl_dim_type src_type, unsigned src_pos,
5588                 unsigned n);
5590         #include <isl/local_space.h>
5591         __isl_give isl_local_space *isl_local_space_add_dims(
5592                 __isl_take isl_local_space *ls,
5593                 enum isl_dim_type type, unsigned n);
5594         __isl_give isl_local_space *isl_local_space_insert_dims(
5595                 __isl_take isl_local_space *ls,
5596                 enum isl_dim_type type, unsigned first, unsigned n);
5597         __isl_give isl_local_space *isl_local_space_drop_dims(
5598                 __isl_take isl_local_space *ls,
5599                 enum isl_dim_type type, unsigned first, unsigned n);
5601         #include <isl/set.h>
5602         __isl_give isl_basic_set *isl_basic_set_add_dims(
5603                 __isl_take isl_basic_set *bset,
5604                 enum isl_dim_type type, unsigned n);
5605         __isl_give isl_set *isl_set_add_dims(
5606                 __isl_take isl_set *set,
5607                 enum isl_dim_type type, unsigned n);
5608         __isl_give isl_basic_set *isl_basic_set_insert_dims(
5609                 __isl_take isl_basic_set *bset,
5610                 enum isl_dim_type type, unsigned pos,
5611                 unsigned n);
5612         __isl_give isl_set *isl_set_insert_dims(
5613                 __isl_take isl_set *set,
5614                 enum isl_dim_type type, unsigned pos, unsigned n);
5615         __isl_give isl_basic_set *isl_basic_set_move_dims(
5616                 __isl_take isl_basic_set *bset,
5617                 enum isl_dim_type dst_type, unsigned dst_pos,
5618                 enum isl_dim_type src_type, unsigned src_pos,
5619                 unsigned n);
5620         __isl_give isl_set *isl_set_move_dims(
5621                 __isl_take isl_set *set,
5622                 enum isl_dim_type dst_type, unsigned dst_pos,
5623                 enum isl_dim_type src_type, unsigned src_pos,
5624                 unsigned n);
5626         #include <isl/map.h>
5627         __isl_give isl_basic_map *isl_basic_map_add_dims(
5628                 __isl_take isl_basic_map *bmap,
5629                 enum isl_dim_type type, unsigned n);
5630         __isl_give isl_map *isl_map_add_dims(
5631                 __isl_take isl_map *map,
5632                 enum isl_dim_type type, unsigned n);
5633         __isl_give isl_basic_map *isl_basic_map_insert_dims(
5634                 __isl_take isl_basic_map *bmap,
5635                 enum isl_dim_type type, unsigned pos,
5636                 unsigned n);
5637         __isl_give isl_map *isl_map_insert_dims(
5638                 __isl_take isl_map *map,
5639                 enum isl_dim_type type, unsigned pos, unsigned n);
5640         __isl_give isl_basic_map *isl_basic_map_move_dims(
5641                 __isl_take isl_basic_map *bmap,
5642                 enum isl_dim_type dst_type, unsigned dst_pos,
5643                 enum isl_dim_type src_type, unsigned src_pos,
5644                 unsigned n);
5645         __isl_give isl_map *isl_map_move_dims(
5646                 __isl_take isl_map *map,
5647                 enum isl_dim_type dst_type, unsigned dst_pos,
5648                 enum isl_dim_type src_type, unsigned src_pos,
5649                 unsigned n);
5651         #include <isl/val.h>
5652         __isl_give isl_multi_val *isl_multi_val_insert_dims(
5653                 __isl_take isl_multi_val *mv,
5654                 enum isl_dim_type type, unsigned first, unsigned n);
5655         __isl_give isl_multi_val *isl_multi_val_add_dims(
5656                 __isl_take isl_multi_val *mv,
5657                 enum isl_dim_type type, unsigned n);
5658         __isl_give isl_multi_val *isl_multi_val_drop_dims(
5659                 __isl_take isl_multi_val *mv,
5660                 enum isl_dim_type type, unsigned first, unsigned n);
5662         #include <isl/aff.h>
5663         __isl_give isl_aff *isl_aff_insert_dims(
5664                 __isl_take isl_aff *aff,
5665                 enum isl_dim_type type, unsigned first, unsigned n);
5666         __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
5667                 __isl_take isl_multi_aff *ma,
5668                 enum isl_dim_type type, unsigned first, unsigned n);
5669         __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
5670                 __isl_take isl_pw_aff *pwaff,
5671                 enum isl_dim_type type, unsigned first, unsigned n);
5672         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
5673                 __isl_take isl_multi_pw_aff *mpa,
5674                 enum isl_dim_type type, unsigned first, unsigned n);
5675         __isl_give isl_aff *isl_aff_add_dims(
5676                 __isl_take isl_aff *aff,
5677                 enum isl_dim_type type, unsigned n);
5678         __isl_give isl_multi_aff *isl_multi_aff_add_dims(
5679                 __isl_take isl_multi_aff *ma,
5680                 enum isl_dim_type type, unsigned n);
5681         __isl_give isl_pw_aff *isl_pw_aff_add_dims(
5682                 __isl_take isl_pw_aff *pwaff,
5683                 enum isl_dim_type type, unsigned n);
5684         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
5685                 __isl_take isl_multi_pw_aff *mpa,
5686                 enum isl_dim_type type, unsigned n);
5687         __isl_give isl_aff *isl_aff_drop_dims(
5688                 __isl_take isl_aff *aff,
5689                 enum isl_dim_type type, unsigned first, unsigned n);
5690         __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
5691                 __isl_take isl_multi_aff *maff,
5692                 enum isl_dim_type type, unsigned first, unsigned n);
5693         __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
5694                 __isl_take isl_pw_aff *pwaff,
5695                 enum isl_dim_type type, unsigned first, unsigned n);
5696         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
5697                 __isl_take isl_pw_multi_aff *pma,
5698                 enum isl_dim_type type, unsigned first, unsigned n);
5699         __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
5700                 __isl_take isl_union_pw_aff *upa,
5701                 enum isl_dim_type type, unsigned first, unsigned n);
5702         __isl_give isl_union_pw_multi_aff *
5703                 isl_union_pw_multi_aff_drop_dims(
5704                 __isl_take isl_union_pw_multi_aff *upma,
5705                 enum isl_dim_type type,
5706                 unsigned first, unsigned n);
5707         __isl_give isl_multi_union_pw_aff *
5708         isl_multi_union_pw_aff_drop_dims(
5709                 __isl_take isl_multi_union_pw_aff *mupa,
5710                 enum isl_dim_type type, unsigned first,
5711                 unsigned n);
5712         __isl_give isl_aff *isl_aff_move_dims(
5713                 __isl_take isl_aff *aff,
5714                 enum isl_dim_type dst_type, unsigned dst_pos,
5715                 enum isl_dim_type src_type, unsigned src_pos,
5716                 unsigned n);
5717         __isl_give isl_multi_aff *isl_multi_aff_move_dims(
5718                 __isl_take isl_multi_aff *ma,
5719                 enum isl_dim_type dst_type, unsigned dst_pos,
5720                 enum isl_dim_type src_type, unsigned src_pos,
5721                 unsigned n);
5722         __isl_give isl_pw_aff *isl_pw_aff_move_dims(
5723                 __isl_take isl_pw_aff *pa,
5724                 enum isl_dim_type dst_type, unsigned dst_pos,
5725                 enum isl_dim_type src_type, unsigned src_pos,
5726                 unsigned n);
5727         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
5728                 __isl_take isl_multi_pw_aff *pma,
5729                 enum isl_dim_type dst_type, unsigned dst_pos,
5730                 enum isl_dim_type src_type, unsigned src_pos,
5731                 unsigned n);
5733         #include <isl/polynomial.h>
5734         __isl_give isl_union_pw_qpolynomial *
5735         isl_union_pw_qpolynomial_drop_dims(
5736                 __isl_take isl_union_pw_qpolynomial *upwqp,
5737                 enum isl_dim_type type,
5738                 unsigned first, unsigned n);
5739         __isl_give isl_union_pw_qpolynomial_fold *
5740                 isl_union_pw_qpolynomial_fold_drop_dims(
5741                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5742                 enum isl_dim_type type,
5743                 unsigned first, unsigned n);
5745 The operations on union expressions can only manipulate parameters.
5747 =back
5749 =head2 Binary Operations
5751 The two arguments of a binary operation not only need to live
5752 in the same C<isl_ctx>, they currently also need to have
5753 the same (number of) parameters.
5755 =head3 Basic Operations
5757 =over
5759 =item * Intersection
5761         #include <isl/local_space.h>
5762         __isl_give isl_local_space *isl_local_space_intersect(
5763                 __isl_take isl_local_space *ls1,
5764                 __isl_take isl_local_space *ls2);
5766         #include <isl/set.h>
5767         __isl_give isl_basic_set *isl_basic_set_intersect_params(
5768                 __isl_take isl_basic_set *bset1,
5769                 __isl_take isl_basic_set *bset2);
5770         __isl_give isl_basic_set *isl_basic_set_intersect(
5771                 __isl_take isl_basic_set *bset1,
5772                 __isl_take isl_basic_set *bset2);
5773         __isl_give isl_basic_set *isl_basic_set_list_intersect(
5774                 __isl_take struct isl_basic_set_list *list);
5775         __isl_give isl_set *isl_set_intersect_params(
5776                 __isl_take isl_set *set,
5777                 __isl_take isl_set *params);
5778         __isl_give isl_set *isl_set_intersect(
5779                 __isl_take isl_set *set1,
5780                 __isl_take isl_set *set2);
5782         #include <isl/map.h>
5783         __isl_give isl_basic_map *isl_basic_map_intersect_domain(
5784                 __isl_take isl_basic_map *bmap,
5785                 __isl_take isl_basic_set *bset);
5786         __isl_give isl_basic_map *isl_basic_map_intersect_range(
5787                 __isl_take isl_basic_map *bmap,
5788                 __isl_take isl_basic_set *bset);
5789         __isl_give isl_basic_map *isl_basic_map_intersect(
5790                 __isl_take isl_basic_map *bmap1,
5791                 __isl_take isl_basic_map *bmap2);
5792         __isl_give isl_basic_map *isl_basic_map_list_intersect(
5793                 __isl_take isl_basic_map_list *list);
5794         __isl_give isl_map *isl_map_intersect_params(
5795                 __isl_take isl_map *map,
5796                 __isl_take isl_set *params);
5797         __isl_give isl_map *isl_map_intersect_domain(
5798                 __isl_take isl_map *map,
5799                 __isl_take isl_set *set);
5800         __isl_give isl_map *isl_map_intersect_range(
5801                 __isl_take isl_map *map,
5802                 __isl_take isl_set *set);
5803         __isl_give isl_map *isl_map_intersect(
5804                 __isl_take isl_map *map1,
5805                 __isl_take isl_map *map2);
5807         #include <isl/union_set.h>
5808         __isl_give isl_union_set *isl_union_set_intersect_params(
5809                 __isl_take isl_union_set *uset,
5810                 __isl_take isl_set *set);
5811         __isl_give isl_union_set *isl_union_set_intersect(
5812                 __isl_take isl_union_set *uset1,
5813                 __isl_take isl_union_set *uset2);
5815         #include <isl/union_map.h>
5816         __isl_give isl_union_map *isl_union_map_intersect_params(
5817                 __isl_take isl_union_map *umap,
5818                 __isl_take isl_set *set);
5819         __isl_give isl_union_map *isl_union_map_intersect_domain(
5820                 __isl_take isl_union_map *umap,
5821                 __isl_take isl_union_set *uset);
5822         __isl_give isl_union_map *isl_union_map_intersect_range(
5823                 __isl_take isl_union_map *umap,
5824                 __isl_take isl_union_set *uset);
5825         __isl_give isl_union_map *isl_union_map_intersect(
5826                 __isl_take isl_union_map *umap1,
5827                 __isl_take isl_union_map *umap2);
5829         #include <isl/aff.h>
5830         __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
5831                 __isl_take isl_pw_aff *pa,
5832                 __isl_take isl_set *set);
5833         __isl_give isl_multi_pw_aff *
5834         isl_multi_pw_aff_intersect_domain(
5835                 __isl_take isl_multi_pw_aff *mpa,
5836                 __isl_take isl_set *domain);
5837         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
5838                 __isl_take isl_pw_multi_aff *pma,
5839                 __isl_take isl_set *set);
5840         __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
5841                 __isl_take isl_union_pw_aff *upa,
5842                 __isl_take isl_union_set *uset);
5843         __isl_give isl_union_pw_multi_aff *
5844         isl_union_pw_multi_aff_intersect_domain(
5845                 __isl_take isl_union_pw_multi_aff *upma,
5846                 __isl_take isl_union_set *uset);
5847         __isl_give isl_multi_union_pw_aff *
5848         isl_multi_union_pw_aff_intersect_domain(
5849                 __isl_take isl_multi_union_pw_aff *mupa,
5850                 __isl_take isl_union_set *uset);
5851         __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
5852                 __isl_take isl_pw_aff *pa,
5853                 __isl_take isl_set *set);
5854         __isl_give isl_multi_pw_aff *
5855         isl_multi_pw_aff_intersect_params(
5856                 __isl_take isl_multi_pw_aff *mpa,
5857                 __isl_take isl_set *set);
5858         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
5859                 __isl_take isl_pw_multi_aff *pma,
5860                 __isl_take isl_set *set);
5861         __isl_give isl_union_pw_aff *
5862         isl_union_pw_aff_intersect_params(
5863                 __isl_take isl_union_pw_aff *upa,
5864         __isl_give isl_union_pw_multi_aff *
5865         isl_union_pw_multi_aff_intersect_params(
5866                 __isl_take isl_union_pw_multi_aff *upma,
5867                 __isl_take isl_set *set);
5868         __isl_give isl_multi_union_pw_aff *
5869         isl_multi_union_pw_aff_intersect_params(
5870                 __isl_take isl_multi_union_pw_aff *mupa,
5871                 __isl_take isl_set *params);
5872         isl_multi_union_pw_aff_intersect_range(
5873                 __isl_take isl_multi_union_pw_aff *mupa,
5874                 __isl_take isl_set *set);
5876         #include <isl/polynomial.h>
5877         __isl_give isl_pw_qpolynomial *
5878         isl_pw_qpolynomial_intersect_domain(
5879                 __isl_take isl_pw_qpolynomial *pwpq,
5880                 __isl_take isl_set *set);
5881         __isl_give isl_union_pw_qpolynomial *
5882         isl_union_pw_qpolynomial_intersect_domain(
5883                 __isl_take isl_union_pw_qpolynomial *upwpq,
5884                 __isl_take isl_union_set *uset);
5885         __isl_give isl_union_pw_qpolynomial_fold *
5886         isl_union_pw_qpolynomial_fold_intersect_domain(
5887                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5888                 __isl_take isl_union_set *uset);
5889         __isl_give isl_pw_qpolynomial *
5890         isl_pw_qpolynomial_intersect_params(
5891                 __isl_take isl_pw_qpolynomial *pwpq,
5892                 __isl_take isl_set *set);
5893         __isl_give isl_pw_qpolynomial_fold *
5894         isl_pw_qpolynomial_fold_intersect_params(
5895                 __isl_take isl_pw_qpolynomial_fold *pwf,
5896                 __isl_take isl_set *set);
5897         __isl_give isl_union_pw_qpolynomial *
5898         isl_union_pw_qpolynomial_intersect_params(
5899                 __isl_take isl_union_pw_qpolynomial *upwpq,
5900                 __isl_take isl_set *set);
5901         __isl_give isl_union_pw_qpolynomial_fold *
5902         isl_union_pw_qpolynomial_fold_intersect_params(
5903                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5904                 __isl_take isl_set *set);
5906 The second argument to the C<_params> functions needs to be
5907 a parametric (basic) set.  For the other functions, a parametric set
5908 for either argument is only allowed if the other argument is
5909 a parametric set as well.
5910 The list passed to C<isl_basic_set_list_intersect> needs to have
5911 at least one element and all elements need to live in the same space.
5912 The function C<isl_multi_union_pw_aff_intersect_range>
5913 restricts the input function to those shared domain elements
5914 that map to the specified range.
5916 =item * Union
5918         #include <isl/set.h>
5919         __isl_give isl_set *isl_basic_set_union(
5920                 __isl_take isl_basic_set *bset1,
5921                 __isl_take isl_basic_set *bset2);
5922         __isl_give isl_set *isl_set_union(
5923                 __isl_take isl_set *set1,
5924                 __isl_take isl_set *set2);
5925         __isl_give isl_set *isl_set_list_union(
5926                 __isl_take isl_set_list *list);
5928         #include <isl/map.h>
5929         __isl_give isl_map *isl_basic_map_union(
5930                 __isl_take isl_basic_map *bmap1,
5931                 __isl_take isl_basic_map *bmap2);
5932         __isl_give isl_map *isl_map_union(
5933                 __isl_take isl_map *map1,
5934                 __isl_take isl_map *map2);
5936         #include <isl/union_set.h>
5937         __isl_give isl_union_set *isl_union_set_union(
5938                 __isl_take isl_union_set *uset1,
5939                 __isl_take isl_union_set *uset2);
5940         __isl_give isl_union_set *isl_union_set_list_union(
5941                 __isl_take isl_union_set_list *list);
5943         #include <isl/union_map.h>
5944         __isl_give isl_union_map *isl_union_map_union(
5945                 __isl_take isl_union_map *umap1,
5946                 __isl_take isl_union_map *umap2);
5948 The list passed to C<isl_set_list_union> needs to have
5949 at least one element and all elements need to live in the same space.
5951 =item * Set difference
5953         #include <isl/set.h>
5954         __isl_give isl_set *isl_set_subtract(
5955                 __isl_take isl_set *set1,
5956                 __isl_take isl_set *set2);
5958         #include <isl/map.h>
5959         __isl_give isl_map *isl_map_subtract(
5960                 __isl_take isl_map *map1,
5961                 __isl_take isl_map *map2);
5962         __isl_give isl_map *isl_map_subtract_domain(
5963                 __isl_take isl_map *map,
5964                 __isl_take isl_set *dom);
5965         __isl_give isl_map *isl_map_subtract_range(
5966                 __isl_take isl_map *map,
5967                 __isl_take isl_set *dom);
5969         #include <isl/union_set.h>
5970         __isl_give isl_union_set *isl_union_set_subtract(
5971                 __isl_take isl_union_set *uset1,
5972                 __isl_take isl_union_set *uset2);
5974         #include <isl/union_map.h>
5975         __isl_give isl_union_map *isl_union_map_subtract(
5976                 __isl_take isl_union_map *umap1,
5977                 __isl_take isl_union_map *umap2);
5978         __isl_give isl_union_map *isl_union_map_subtract_domain(
5979                 __isl_take isl_union_map *umap,
5980                 __isl_take isl_union_set *dom);
5981         __isl_give isl_union_map *isl_union_map_subtract_range(
5982                 __isl_take isl_union_map *umap,
5983                 __isl_take isl_union_set *dom);
5985         #include <isl/aff.h>
5986         __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
5987                 __isl_take isl_pw_aff *pa,
5988                 __isl_take isl_set *set);
5989         __isl_give isl_pw_multi_aff *
5990         isl_pw_multi_aff_subtract_domain(
5991                 __isl_take isl_pw_multi_aff *pma,
5992                 __isl_take isl_set *set);
5993         __isl_give isl_union_pw_aff *
5994         isl_union_pw_aff_subtract_domain(
5995                 __isl_take isl_union_pw_aff *upa,
5996                 __isl_take isl_union_set *uset);
5997         __isl_give isl_union_pw_multi_aff *
5998         isl_union_pw_multi_aff_subtract_domain(
5999                 __isl_take isl_union_pw_multi_aff *upma,
6000                 __isl_take isl_set *set);
6002         #include <isl/polynomial.h>
6003         __isl_give isl_pw_qpolynomial *
6004         isl_pw_qpolynomial_subtract_domain(
6005                 __isl_take isl_pw_qpolynomial *pwpq,
6006                 __isl_take isl_set *set);
6007         __isl_give isl_pw_qpolynomial_fold *
6008         isl_pw_qpolynomial_fold_subtract_domain(
6009                 __isl_take isl_pw_qpolynomial_fold *pwf,
6010                 __isl_take isl_set *set);
6011         __isl_give isl_union_pw_qpolynomial *
6012         isl_union_pw_qpolynomial_subtract_domain(
6013                 __isl_take isl_union_pw_qpolynomial *upwpq,
6014                 __isl_take isl_union_set *uset);
6015         __isl_give isl_union_pw_qpolynomial_fold *
6016         isl_union_pw_qpolynomial_fold_subtract_domain(
6017                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6018                 __isl_take isl_union_set *uset);
6020 =item * Application
6022         #include <isl/space.h>
6023         __isl_give isl_space *isl_space_join(
6024                 __isl_take isl_space *left,
6025                 __isl_take isl_space *right);
6027         #include <isl/map.h>
6028         __isl_give isl_basic_set *isl_basic_set_apply(
6029                 __isl_take isl_basic_set *bset,
6030                 __isl_take isl_basic_map *bmap);
6031         __isl_give isl_set *isl_set_apply(
6032                 __isl_take isl_set *set,
6033                 __isl_take isl_map *map);
6034         __isl_give isl_union_set *isl_union_set_apply(
6035                 __isl_take isl_union_set *uset,
6036                 __isl_take isl_union_map *umap);
6037         __isl_give isl_basic_map *isl_basic_map_apply_domain(
6038                 __isl_take isl_basic_map *bmap1,
6039                 __isl_take isl_basic_map *bmap2);
6040         __isl_give isl_basic_map *isl_basic_map_apply_range(
6041                 __isl_take isl_basic_map *bmap1,
6042                 __isl_take isl_basic_map *bmap2);
6043         __isl_give isl_map *isl_map_apply_domain(
6044                 __isl_take isl_map *map1,
6045                 __isl_take isl_map *map2);
6046         __isl_give isl_map *isl_map_apply_range(
6047                 __isl_take isl_map *map1,
6048                 __isl_take isl_map *map2);
6050         #include <isl/union_map.h>
6051         __isl_give isl_union_map *isl_union_map_apply_domain(
6052                 __isl_take isl_union_map *umap1,
6053                 __isl_take isl_union_map *umap2);
6054         __isl_give isl_union_map *isl_union_map_apply_range(
6055                 __isl_take isl_union_map *umap1,
6056                 __isl_take isl_union_map *umap2);
6058         #include <isl/aff.h>
6059         __isl_give isl_union_pw_aff *
6060         isl_multi_union_pw_aff_apply_aff(
6061                 __isl_take isl_multi_union_pw_aff *mupa,
6062                 __isl_take isl_aff *aff);
6063         __isl_give isl_union_pw_aff *
6064         isl_multi_union_pw_aff_apply_pw_aff(
6065                 __isl_take isl_multi_union_pw_aff *mupa,
6066                 __isl_take isl_pw_aff *pa);
6067         __isl_give isl_multi_union_pw_aff *
6068         isl_multi_union_pw_aff_apply_multi_aff(
6069                 __isl_take isl_multi_union_pw_aff *mupa,
6070                 __isl_take isl_multi_aff *ma);
6071         __isl_give isl_multi_union_pw_aff *
6072         isl_multi_union_pw_aff_apply_pw_multi_aff(
6073                 __isl_take isl_multi_union_pw_aff *mupa,
6074                 __isl_take isl_pw_multi_aff *pma);
6076 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
6077 over the shared domain of the elements of the input.  The dimension is
6078 required to be greater than zero.
6079 The C<isl_multi_union_pw_aff> argument of
6080 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
6081 but only if the range of the C<isl_multi_aff> argument
6082 is also zero-dimensional.
6083 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
6085         #include <isl/polynomial.h>
6086         __isl_give isl_pw_qpolynomial_fold *
6087         isl_set_apply_pw_qpolynomial_fold(
6088                 __isl_take isl_set *set,
6089                 __isl_take isl_pw_qpolynomial_fold *pwf,
6090                 int *tight);
6091         __isl_give isl_pw_qpolynomial_fold *
6092         isl_map_apply_pw_qpolynomial_fold(
6093                 __isl_take isl_map *map,
6094                 __isl_take isl_pw_qpolynomial_fold *pwf,
6095                 int *tight);
6096         __isl_give isl_union_pw_qpolynomial_fold *
6097         isl_union_set_apply_union_pw_qpolynomial_fold(
6098                 __isl_take isl_union_set *uset,
6099                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6100                 int *tight);
6101         __isl_give isl_union_pw_qpolynomial_fold *
6102         isl_union_map_apply_union_pw_qpolynomial_fold(
6103                 __isl_take isl_union_map *umap,
6104                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6105                 int *tight);
6107 The functions taking a map
6108 compose the given map with the given piecewise quasipolynomial reduction.
6109 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
6110 over all elements in the intersection of the range of the map
6111 and the domain of the piecewise quasipolynomial reduction
6112 as a function of an element in the domain of the map.
6113 The functions taking a set compute a bound over all elements in the
6114 intersection of the set and the domain of the
6115 piecewise quasipolynomial reduction.
6117 =item * Preimage
6119         #include <isl/set.h>
6120         __isl_give isl_basic_set *
6121         isl_basic_set_preimage_multi_aff(
6122                 __isl_take isl_basic_set *bset,
6123                 __isl_take isl_multi_aff *ma);
6124         __isl_give isl_set *isl_set_preimage_multi_aff(
6125                 __isl_take isl_set *set,
6126                 __isl_take isl_multi_aff *ma);
6127         __isl_give isl_set *isl_set_preimage_pw_multi_aff(
6128                 __isl_take isl_set *set,
6129                 __isl_take isl_pw_multi_aff *pma);
6130         __isl_give isl_set *isl_set_preimage_multi_pw_aff(
6131                 __isl_take isl_set *set,
6132                 __isl_take isl_multi_pw_aff *mpa);
6134         #include <isl/union_set.h>
6135         __isl_give isl_union_set *
6136         isl_union_set_preimage_multi_aff(
6137                 __isl_take isl_union_set *uset,
6138                 __isl_take isl_multi_aff *ma);
6139         __isl_give isl_union_set *
6140         isl_union_set_preimage_pw_multi_aff(
6141                 __isl_take isl_union_set *uset,
6142                 __isl_take isl_pw_multi_aff *pma);
6143         __isl_give isl_union_set *
6144         isl_union_set_preimage_union_pw_multi_aff(
6145                 __isl_take isl_union_set *uset,
6146                 __isl_take isl_union_pw_multi_aff *upma);
6148         #include <isl/map.h>
6149         __isl_give isl_basic_map *
6150         isl_basic_map_preimage_domain_multi_aff(
6151                 __isl_take isl_basic_map *bmap,
6152                 __isl_take isl_multi_aff *ma);
6153         __isl_give isl_map *isl_map_preimage_domain_multi_aff(
6154                 __isl_take isl_map *map,
6155                 __isl_take isl_multi_aff *ma);
6156         __isl_give isl_map *isl_map_preimage_range_multi_aff(
6157                 __isl_take isl_map *map,
6158                 __isl_take isl_multi_aff *ma);
6159         __isl_give isl_map *
6160         isl_map_preimage_domain_pw_multi_aff(
6161                 __isl_take isl_map *map,
6162                 __isl_take isl_pw_multi_aff *pma);
6163         __isl_give isl_map *
6164         isl_map_preimage_range_pw_multi_aff(
6165                 __isl_take isl_map *map,
6166                 __isl_take isl_pw_multi_aff *pma);
6167         __isl_give isl_map *
6168         isl_map_preimage_domain_multi_pw_aff(
6169                 __isl_take isl_map *map,
6170                 __isl_take isl_multi_pw_aff *mpa);
6171         __isl_give isl_basic_map *
6172         isl_basic_map_preimage_range_multi_aff(
6173                 __isl_take isl_basic_map *bmap,
6174                 __isl_take isl_multi_aff *ma);
6176         #include <isl/union_map.h>
6177         __isl_give isl_union_map *
6178         isl_union_map_preimage_domain_multi_aff(
6179                 __isl_take isl_union_map *umap,
6180                 __isl_take isl_multi_aff *ma);
6181         __isl_give isl_union_map *
6182         isl_union_map_preimage_range_multi_aff(
6183                 __isl_take isl_union_map *umap,
6184                 __isl_take isl_multi_aff *ma);
6185         __isl_give isl_union_map *
6186         isl_union_map_preimage_domain_pw_multi_aff(
6187                 __isl_take isl_union_map *umap,
6188                 __isl_take isl_pw_multi_aff *pma);
6189         __isl_give isl_union_map *
6190         isl_union_map_preimage_range_pw_multi_aff(
6191                 __isl_take isl_union_map *umap,
6192                 __isl_take isl_pw_multi_aff *pma);
6193         __isl_give isl_union_map *
6194         isl_union_map_preimage_domain_union_pw_multi_aff(
6195                 __isl_take isl_union_map *umap,
6196                 __isl_take isl_union_pw_multi_aff *upma);
6197         __isl_give isl_union_map *
6198         isl_union_map_preimage_range_union_pw_multi_aff(
6199                 __isl_take isl_union_map *umap,
6200                 __isl_take isl_union_pw_multi_aff *upma);
6202 These functions compute the preimage of the given set or map domain/range under
6203 the given function.  In other words, the expression is plugged
6204 into the set description or into the domain/range of the map.
6206 =item * Pullback
6208         #include <isl/aff.h>
6209         __isl_give isl_aff *isl_aff_pullback_aff(
6210                 __isl_take isl_aff *aff1,
6211                 __isl_take isl_aff *aff2);
6212         __isl_give isl_aff *isl_aff_pullback_multi_aff(
6213                 __isl_take isl_aff *aff,
6214                 __isl_take isl_multi_aff *ma);
6215         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
6216                 __isl_take isl_pw_aff *pa,
6217                 __isl_take isl_multi_aff *ma);
6218         __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
6219                 __isl_take isl_pw_aff *pa,
6220                 __isl_take isl_pw_multi_aff *pma);
6221         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
6222                 __isl_take isl_pw_aff *pa,
6223                 __isl_take isl_multi_pw_aff *mpa);
6224         __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
6225                 __isl_take isl_multi_aff *ma1,
6226                 __isl_take isl_multi_aff *ma2);
6227         __isl_give isl_pw_multi_aff *
6228         isl_pw_multi_aff_pullback_multi_aff(
6229                 __isl_take isl_pw_multi_aff *pma,
6230                 __isl_take isl_multi_aff *ma);
6231         __isl_give isl_multi_pw_aff *
6232         isl_multi_pw_aff_pullback_multi_aff(
6233                 __isl_take isl_multi_pw_aff *mpa,
6234                 __isl_take isl_multi_aff *ma);
6235         __isl_give isl_pw_multi_aff *
6236         isl_pw_multi_aff_pullback_pw_multi_aff(
6237                 __isl_take isl_pw_multi_aff *pma1,
6238                 __isl_take isl_pw_multi_aff *pma2);
6239         __isl_give isl_multi_pw_aff *
6240         isl_multi_pw_aff_pullback_pw_multi_aff(
6241                 __isl_take isl_multi_pw_aff *mpa,
6242                 __isl_take isl_pw_multi_aff *pma);
6243         __isl_give isl_multi_pw_aff *
6244         isl_multi_pw_aff_pullback_multi_pw_aff(
6245                 __isl_take isl_multi_pw_aff *mpa1,
6246                 __isl_take isl_multi_pw_aff *mpa2);
6247         __isl_give isl_union_pw_aff *
6248         isl_union_pw_aff_pullback_union_pw_multi_aff(
6249                 __isl_take isl_union_pw_aff *upa,
6250                 __isl_take isl_union_pw_multi_aff *upma);
6251         __isl_give isl_union_pw_multi_aff *
6252         isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
6253                 __isl_take isl_union_pw_multi_aff *upma1,
6254                 __isl_take isl_union_pw_multi_aff *upma2);
6255         __isl_give isl_multi_union_pw_aff *
6256         isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
6257                 __isl_take isl_multi_union_pw_aff *mupa,
6258                 __isl_take isl_union_pw_multi_aff *upma);
6260 These functions precompose the first expression by the second function.
6261 In other words, the second function is plugged
6262 into the first expression.
6264 =item * Locus
6266         #include <isl/aff.h>
6267         __isl_give isl_basic_set *isl_aff_eq_basic_set(
6268                 __isl_take isl_aff *aff1,
6269                 __isl_take isl_aff *aff2);
6270         __isl_give isl_set *isl_aff_eq_set(
6271                 __isl_take isl_aff *aff1,
6272                 __isl_take isl_aff *aff2);
6273         __isl_give isl_basic_set *isl_aff_le_basic_set(
6274                 __isl_take isl_aff *aff1,
6275                 __isl_take isl_aff *aff2);
6276         __isl_give isl_set *isl_aff_le_set(
6277                 __isl_take isl_aff *aff1,
6278                 __isl_take isl_aff *aff2);
6279         __isl_give isl_basic_set *isl_aff_lt_basic_set(
6280                 __isl_take isl_aff *aff1,
6281                 __isl_take isl_aff *aff2);
6282         __isl_give isl_set *isl_aff_lt_set(
6283                 __isl_take isl_aff *aff1,
6284                 __isl_take isl_aff *aff2);
6285         __isl_give isl_basic_set *isl_aff_ge_basic_set(
6286                 __isl_take isl_aff *aff1,
6287                 __isl_take isl_aff *aff2);
6288         __isl_give isl_set *isl_aff_ge_set(
6289                 __isl_take isl_aff *aff1,
6290                 __isl_take isl_aff *aff2);
6291         __isl_give isl_basic_set *isl_aff_gt_basic_set(
6292                 __isl_take isl_aff *aff1,
6293                 __isl_take isl_aff *aff2);
6294         __isl_give isl_set *isl_pw_aff_eq_set(
6295                 __isl_take isl_pw_aff *pwaff1,
6296                 __isl_take isl_pw_aff *pwaff2);
6297         __isl_give isl_set *isl_pw_aff_ne_set(
6298                 __isl_take isl_pw_aff *pwaff1,
6299                 __isl_take isl_pw_aff *pwaff2);
6300         __isl_give isl_set *isl_pw_aff_le_set(
6301                 __isl_take isl_pw_aff *pwaff1,
6302                 __isl_take isl_pw_aff *pwaff2);
6303         __isl_give isl_set *isl_pw_aff_lt_set(
6304                 __isl_take isl_pw_aff *pwaff1,
6305                 __isl_take isl_pw_aff *pwaff2);
6306         __isl_give isl_set *isl_pw_aff_ge_set(
6307                 __isl_take isl_pw_aff *pwaff1,
6308                 __isl_take isl_pw_aff *pwaff2);
6309         __isl_give isl_set *isl_pw_aff_gt_set(
6310                 __isl_take isl_pw_aff *pwaff1,
6311                 __isl_take isl_pw_aff *pwaff2);
6313         __isl_give isl_set *isl_multi_aff_lex_le_set(
6314                 __isl_take isl_multi_aff *ma1,
6315                 __isl_take isl_multi_aff *ma2);
6316         __isl_give isl_set *isl_multi_aff_lex_lt_set(
6317                 __isl_take isl_multi_aff *ma1,
6318                 __isl_take isl_multi_aff *ma2);
6319         __isl_give isl_set *isl_multi_aff_lex_ge_set(
6320                 __isl_take isl_multi_aff *ma1,
6321                 __isl_take isl_multi_aff *ma2);
6322         __isl_give isl_set *isl_multi_aff_lex_gt_set(
6323                 __isl_take isl_multi_aff *ma1,
6324                 __isl_take isl_multi_aff *ma2);
6326         __isl_give isl_set *isl_pw_aff_list_eq_set(
6327                 __isl_take isl_pw_aff_list *list1,
6328                 __isl_take isl_pw_aff_list *list2);
6329         __isl_give isl_set *isl_pw_aff_list_ne_set(
6330                 __isl_take isl_pw_aff_list *list1,
6331                 __isl_take isl_pw_aff_list *list2);
6332         __isl_give isl_set *isl_pw_aff_list_le_set(
6333                 __isl_take isl_pw_aff_list *list1,
6334                 __isl_take isl_pw_aff_list *list2);
6335         __isl_give isl_set *isl_pw_aff_list_lt_set(
6336                 __isl_take isl_pw_aff_list *list1,
6337                 __isl_take isl_pw_aff_list *list2);
6338         __isl_give isl_set *isl_pw_aff_list_ge_set(
6339                 __isl_take isl_pw_aff_list *list1,
6340                 __isl_take isl_pw_aff_list *list2);
6341         __isl_give isl_set *isl_pw_aff_list_gt_set(
6342                 __isl_take isl_pw_aff_list *list1,
6343                 __isl_take isl_pw_aff_list *list2);
6345 The function C<isl_aff_ge_basic_set> returns a basic set
6346 containing those elements in the shared space
6347 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
6348 The function C<isl_pw_aff_ge_set> returns a set
6349 containing those elements in the shared domain
6350 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
6351 greater than or equal to C<pwaff2>.
6352 The function C<isl_multi_aff_lex_le_set> returns a set
6353 containing those elements in the shared domain space
6354 where C<ma1> is lexicographically smaller than or
6355 equal to C<ma2>.
6356 The functions operating on C<isl_pw_aff_list> apply the corresponding
6357 C<isl_pw_aff> function to each pair of elements in the two lists.
6359         #include <isl/aff.h>
6360         __isl_give isl_map *isl_pw_aff_eq_map(
6361                 __isl_take isl_pw_aff *pa1,
6362                 __isl_take isl_pw_aff *pa2);
6363         __isl_give isl_map *isl_pw_aff_lt_map(
6364                 __isl_take isl_pw_aff *pa1,
6365                 __isl_take isl_pw_aff *pa2);
6366         __isl_give isl_map *isl_pw_aff_gt_map(
6367                 __isl_take isl_pw_aff *pa1,
6368                 __isl_take isl_pw_aff *pa2);
6370         __isl_give isl_map *isl_multi_pw_aff_eq_map(
6371                 __isl_take isl_multi_pw_aff *mpa1,
6372                 __isl_take isl_multi_pw_aff *mpa2);
6373         __isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
6374                 __isl_take isl_multi_pw_aff *mpa1,
6375                 __isl_take isl_multi_pw_aff *mpa2);
6376         __isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
6377                 __isl_take isl_multi_pw_aff *mpa1,
6378                 __isl_take isl_multi_pw_aff *mpa2);
6380 These functions return a map between domain elements of the arguments
6381 where the function values satisfy the given relation.
6383         #include <isl/union_map.h>
6384         __isl_give isl_union_map *
6385         isl_union_map_eq_at_multi_union_pw_aff(
6386                 __isl_take isl_union_map *umap,
6387                 __isl_take isl_multi_union_pw_aff *mupa);
6388         __isl_give isl_union_map *
6389         isl_union_map_lex_lt_at_multi_union_pw_aff(
6390                 __isl_take isl_union_map *umap,
6391                 __isl_take isl_multi_union_pw_aff *mupa);
6392         __isl_give isl_union_map *
6393         isl_union_map_lex_gt_at_multi_union_pw_aff(
6394                 __isl_take isl_union_map *umap,
6395                 __isl_take isl_multi_union_pw_aff *mupa);
6397 These functions select the subset of elements in the union map
6398 that have an equal or lexicographically smaller function value.
6400 =item * Cartesian Product
6402         #include <isl/space.h>
6403         __isl_give isl_space *isl_space_product(
6404                 __isl_take isl_space *space1,
6405                 __isl_take isl_space *space2);
6406         __isl_give isl_space *isl_space_domain_product(
6407                 __isl_take isl_space *space1,
6408                 __isl_take isl_space *space2);
6409         __isl_give isl_space *isl_space_range_product(
6410                 __isl_take isl_space *space1,
6411                 __isl_take isl_space *space2);
6413 The functions
6414 C<isl_space_product>, C<isl_space_domain_product>
6415 and C<isl_space_range_product> take pairs or relation spaces and
6416 produce a single relations space, where either the domain, the range
6417 or both domain and range are wrapped spaces of relations between
6418 the domains and/or ranges of the input spaces.
6419 If the product is only constructed over the domain or the range
6420 then the ranges or the domains of the inputs should be the same.
6421 The function C<isl_space_product> also accepts a pair of set spaces,
6422 in which case it returns a wrapped space of a relation between the
6423 two input spaces.
6425         #include <isl/set.h>
6426         __isl_give isl_set *isl_set_product(
6427                 __isl_take isl_set *set1,
6428                 __isl_take isl_set *set2);
6430         #include <isl/map.h>
6431         __isl_give isl_basic_map *isl_basic_map_domain_product(
6432                 __isl_take isl_basic_map *bmap1,
6433                 __isl_take isl_basic_map *bmap2);
6434         __isl_give isl_basic_map *isl_basic_map_range_product(
6435                 __isl_take isl_basic_map *bmap1,
6436                 __isl_take isl_basic_map *bmap2);
6437         __isl_give isl_basic_map *isl_basic_map_product(
6438                 __isl_take isl_basic_map *bmap1,
6439                 __isl_take isl_basic_map *bmap2);
6440         __isl_give isl_map *isl_map_domain_product(
6441                 __isl_take isl_map *map1,
6442                 __isl_take isl_map *map2);
6443         __isl_give isl_map *isl_map_range_product(
6444                 __isl_take isl_map *map1,
6445                 __isl_take isl_map *map2);
6446         __isl_give isl_map *isl_map_product(
6447                 __isl_take isl_map *map1,
6448                 __isl_take isl_map *map2);
6450         #include <isl/union_set.h>
6451         __isl_give isl_union_set *isl_union_set_product(
6452                 __isl_take isl_union_set *uset1,
6453                 __isl_take isl_union_set *uset2);
6455         #include <isl/union_map.h>
6456         __isl_give isl_union_map *isl_union_map_domain_product(
6457                 __isl_take isl_union_map *umap1,
6458                 __isl_take isl_union_map *umap2);
6459         __isl_give isl_union_map *isl_union_map_range_product(
6460                 __isl_take isl_union_map *umap1,
6461                 __isl_take isl_union_map *umap2);
6462         __isl_give isl_union_map *isl_union_map_product(
6463                 __isl_take isl_union_map *umap1,
6464                 __isl_take isl_union_map *umap2);
6466         #include <isl/val.h>
6467         __isl_give isl_multi_val *isl_multi_val_range_product(
6468                 __isl_take isl_multi_val *mv1,
6469                 __isl_take isl_multi_val *mv2);
6470         __isl_give isl_multi_val *isl_multi_val_product(
6471                 __isl_take isl_multi_val *mv1,
6472                 __isl_take isl_multi_val *mv2);
6474         #include <isl/aff.h>
6475         __isl_give isl_multi_aff *isl_multi_aff_range_product(
6476                 __isl_take isl_multi_aff *ma1,
6477                 __isl_take isl_multi_aff *ma2);
6478         __isl_give isl_multi_aff *isl_multi_aff_product(
6479                 __isl_take isl_multi_aff *ma1,
6480                 __isl_take isl_multi_aff *ma2);
6481         __isl_give isl_multi_pw_aff *
6482         isl_multi_pw_aff_range_product(
6483                 __isl_take isl_multi_pw_aff *mpa1,
6484                 __isl_take isl_multi_pw_aff *mpa2);
6485         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
6486                 __isl_take isl_multi_pw_aff *mpa1,
6487                 __isl_take isl_multi_pw_aff *mpa2);
6488         __isl_give isl_pw_multi_aff *
6489         isl_pw_multi_aff_range_product(
6490                 __isl_take isl_pw_multi_aff *pma1,
6491                 __isl_take isl_pw_multi_aff *pma2);
6492         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
6493                 __isl_take isl_pw_multi_aff *pma1,
6494                 __isl_take isl_pw_multi_aff *pma2);
6495         __isl_give isl_multi_union_pw_aff *
6496         isl_multi_union_pw_aff_range_product(
6497                 __isl_take isl_multi_union_pw_aff *mupa1,
6498                 __isl_take isl_multi_union_pw_aff *mupa2);
6500 The above functions compute the cross product of the given
6501 sets, relations or functions.  The domains and ranges of the results
6502 are wrapped maps between domains and ranges of the inputs.
6503 To obtain a ``flat'' product, use the following functions
6504 instead.
6506         #include <isl/set.h>
6507         __isl_give isl_basic_set *isl_basic_set_flat_product(
6508                 __isl_take isl_basic_set *bset1,
6509                 __isl_take isl_basic_set *bset2);
6510         __isl_give isl_set *isl_set_flat_product(
6511                 __isl_take isl_set *set1,
6512                 __isl_take isl_set *set2);
6514         #include <isl/map.h>
6515         __isl_give isl_basic_map *isl_basic_map_flat_range_product(
6516                 __isl_take isl_basic_map *bmap1,
6517                 __isl_take isl_basic_map *bmap2);
6518         __isl_give isl_map *isl_map_flat_domain_product(
6519                 __isl_take isl_map *map1,
6520                 __isl_take isl_map *map2);
6521         __isl_give isl_map *isl_map_flat_range_product(
6522                 __isl_take isl_map *map1,
6523                 __isl_take isl_map *map2);
6524         __isl_give isl_basic_map *isl_basic_map_flat_product(
6525                 __isl_take isl_basic_map *bmap1,
6526                 __isl_take isl_basic_map *bmap2);
6527         __isl_give isl_map *isl_map_flat_product(
6528                 __isl_take isl_map *map1,
6529                 __isl_take isl_map *map2);
6531         #include <isl/union_map.h>
6532         __isl_give isl_union_map *
6533         isl_union_map_flat_domain_product(
6534                 __isl_take isl_union_map *umap1,
6535                 __isl_take isl_union_map *umap2);
6536         __isl_give isl_union_map *
6537         isl_union_map_flat_range_product(
6538                 __isl_take isl_union_map *umap1,
6539                 __isl_take isl_union_map *umap2);
6541         #include <isl/val.h>
6542         __isl_give isl_multi_val *isl_multi_val_flat_range_product(
6543                 __isl_take isl_multi_val *mv1,
6544                 __isl_take isl_multi_aff *mv2);
6546         #include <isl/aff.h>
6547         __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
6548                 __isl_take isl_multi_aff *ma1,
6549                 __isl_take isl_multi_aff *ma2);
6550         __isl_give isl_pw_multi_aff *
6551         isl_pw_multi_aff_flat_range_product(
6552                 __isl_take isl_pw_multi_aff *pma1,
6553                 __isl_take isl_pw_multi_aff *pma2);
6554         __isl_give isl_multi_pw_aff *
6555         isl_multi_pw_aff_flat_range_product(
6556                 __isl_take isl_multi_pw_aff *mpa1,
6557                 __isl_take isl_multi_pw_aff *mpa2);
6558         __isl_give isl_union_pw_multi_aff *
6559         isl_union_pw_multi_aff_flat_range_product(
6560                 __isl_take isl_union_pw_multi_aff *upma1,
6561                 __isl_take isl_union_pw_multi_aff *upma2);
6562         __isl_give isl_multi_union_pw_aff *
6563         isl_multi_union_pw_aff_flat_range_product(
6564                 __isl_take isl_multi_union_pw_aff *mupa1,
6565                 __isl_take isl_multi_union_pw_aff *mupa2);
6567         #include <isl/space.h>
6568         __isl_give isl_space *isl_space_factor_domain(
6569                 __isl_take isl_space *space);
6570         __isl_give isl_space *isl_space_factor_range(
6571                 __isl_take isl_space *space);
6572         __isl_give isl_space *isl_space_domain_factor_domain(
6573                 __isl_take isl_space *space);
6574         __isl_give isl_space *isl_space_domain_factor_range(
6575                 __isl_take isl_space *space);
6576         __isl_give isl_space *isl_space_range_factor_domain(
6577                 __isl_take isl_space *space);
6578         __isl_give isl_space *isl_space_range_factor_range(
6579                 __isl_take isl_space *space);
6581 The functions C<isl_space_range_factor_domain> and
6582 C<isl_space_range_factor_range> extract the two arguments from
6583 the result of a call to C<isl_space_range_product>.
6585 The arguments of a call to a product can be extracted
6586 from the result using the following functions.
6588         #include <isl/map.h>
6589         __isl_give isl_map *isl_map_factor_domain(
6590                 __isl_take isl_map *map);
6591         __isl_give isl_map *isl_map_factor_range(
6592                 __isl_take isl_map *map);
6593         __isl_give isl_map *isl_map_domain_factor_domain(
6594                 __isl_take isl_map *map);
6595         __isl_give isl_map *isl_map_domain_factor_range(
6596                 __isl_take isl_map *map);
6597         __isl_give isl_map *isl_map_range_factor_domain(
6598                 __isl_take isl_map *map);
6599         __isl_give isl_map *isl_map_range_factor_range(
6600                 __isl_take isl_map *map);
6602         #include <isl/union_map.h>
6603         __isl_give isl_union_map *isl_union_map_factor_domain(
6604                 __isl_take isl_union_map *umap);
6605         __isl_give isl_union_map *isl_union_map_factor_range(
6606                 __isl_take isl_union_map *umap);
6607         __isl_give isl_union_map *
6608         isl_union_map_domain_factor_domain(
6609                 __isl_take isl_union_map *umap);
6610         __isl_give isl_union_map *
6611         isl_union_map_domain_factor_range(
6612                 __isl_take isl_union_map *umap);
6613         __isl_give isl_union_map *
6614         isl_union_map_range_factor_domain(
6615                 __isl_take isl_union_map *umap);
6616         __isl_give isl_union_map *
6617         isl_union_map_range_factor_range(
6618                 __isl_take isl_union_map *umap);
6620         #include <isl/val.h>
6621         __isl_give isl_multi_val *isl_multi_val_factor_range(
6622                 __isl_take isl_multi_val *mv);
6623         __isl_give isl_multi_val *
6624         isl_multi_val_range_factor_domain(
6625                 __isl_take isl_multi_val *mv);
6626         __isl_give isl_multi_val *
6627         isl_multi_val_range_factor_range(
6628                 __isl_take isl_multi_val *mv);
6630         #include <isl/aff.h>
6631         __isl_give isl_multi_aff *isl_multi_aff_factor_range(
6632                 __isl_take isl_multi_aff *ma);
6633         __isl_give isl_multi_aff *
6634         isl_multi_aff_range_factor_domain(
6635                 __isl_take isl_multi_aff *ma);
6636         __isl_give isl_multi_aff *
6637         isl_multi_aff_range_factor_range(
6638                 __isl_take isl_multi_aff *ma);
6639         __isl_give isl_multi_pw_aff *
6640         isl_multi_pw_aff_factor_range(
6641                 __isl_take isl_multi_pw_aff *mpa);
6642         __isl_give isl_multi_pw_aff *
6643         isl_multi_pw_aff_range_factor_domain(
6644                 __isl_take isl_multi_pw_aff *mpa);
6645         __isl_give isl_multi_pw_aff *
6646         isl_multi_pw_aff_range_factor_range(
6647                 __isl_take isl_multi_pw_aff *mpa);
6648         __isl_give isl_multi_union_pw_aff *
6649         isl_multi_union_pw_aff_factor_range(
6650                 __isl_take isl_multi_union_pw_aff *mupa);
6651         __isl_give isl_multi_union_pw_aff *
6652         isl_multi_union_pw_aff_range_factor_domain(
6653                 __isl_take isl_multi_union_pw_aff *mupa);
6654         __isl_give isl_multi_union_pw_aff *
6655         isl_multi_union_pw_aff_range_factor_range(
6656                 __isl_take isl_multi_union_pw_aff *mupa);
6658 The splice functions are a generalization of the flat product functions,
6659 where the second argument may be inserted at any position inside
6660 the first argument rather than being placed at the end.
6661 The functions C<isl_multi_val_factor_range>,
6662 C<isl_multi_aff_factor_range>,
6663 C<isl_multi_pw_aff_factor_range> and
6664 C<isl_multi_union_pw_aff_factor_range>
6665 take functions that live in a set space.
6667         #include <isl/val.h>
6668         __isl_give isl_multi_val *isl_multi_val_range_splice(
6669                 __isl_take isl_multi_val *mv1, unsigned pos,
6670                 __isl_take isl_multi_val *mv2);
6672         #include <isl/aff.h>
6673         __isl_give isl_multi_aff *isl_multi_aff_range_splice(
6674                 __isl_take isl_multi_aff *ma1, unsigned pos,
6675                 __isl_take isl_multi_aff *ma2);
6676         __isl_give isl_multi_aff *isl_multi_aff_splice(
6677                 __isl_take isl_multi_aff *ma1,
6678                 unsigned in_pos, unsigned out_pos,
6679                 __isl_take isl_multi_aff *ma2);
6680         __isl_give isl_multi_pw_aff *
6681         isl_multi_pw_aff_range_splice(
6682                 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
6683                 __isl_take isl_multi_pw_aff *mpa2);
6684         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
6685                 __isl_take isl_multi_pw_aff *mpa1,
6686                 unsigned in_pos, unsigned out_pos,
6687                 __isl_take isl_multi_pw_aff *mpa2);
6688         __isl_give isl_multi_union_pw_aff *
6689         isl_multi_union_pw_aff_range_splice(
6690                 __isl_take isl_multi_union_pw_aff *mupa1,
6691                 unsigned pos,
6692                 __isl_take isl_multi_union_pw_aff *mupa2);
6694 =item * Simplification
6696 When applied to a set or relation,
6697 the gist operation returns a set or relation that has the
6698 same intersection with the context as the input set or relation.
6699 Any implicit equality in the intersection is made explicit in the result,
6700 while all inequalities that are redundant with respect to the intersection
6701 are removed.
6702 In case of union sets and relations, the gist operation is performed
6703 per space.
6705 When applied to a function,
6706 the gist operation applies the set gist operation to each of
6707 the cells in the domain of the input piecewise expression.
6708 The context is also exploited
6709 to simplify the expression associated to each cell.
6711         #include <isl/set.h>
6712         __isl_give isl_basic_set *isl_basic_set_gist(
6713                 __isl_take isl_basic_set *bset,
6714                 __isl_take isl_basic_set *context);
6715         __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
6716                 __isl_take isl_set *context);
6717         __isl_give isl_set *isl_set_gist_params(
6718                 __isl_take isl_set *set,
6719                 __isl_take isl_set *context);
6721         #include <isl/map.h>
6722         __isl_give isl_basic_map *isl_basic_map_gist(
6723                 __isl_take isl_basic_map *bmap,
6724                 __isl_take isl_basic_map *context);
6725         __isl_give isl_basic_map *isl_basic_map_gist_domain(
6726                 __isl_take isl_basic_map *bmap,
6727                 __isl_take isl_basic_set *context);
6728         __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
6729                 __isl_take isl_map *context);
6730         __isl_give isl_map *isl_map_gist_params(
6731                 __isl_take isl_map *map,
6732                 __isl_take isl_set *context);
6733         __isl_give isl_map *isl_map_gist_domain(
6734                 __isl_take isl_map *map,
6735                 __isl_take isl_set *context);
6736         __isl_give isl_map *isl_map_gist_range(
6737                 __isl_take isl_map *map,
6738                 __isl_take isl_set *context);
6740         #include <isl/union_set.h>
6741         __isl_give isl_union_set *isl_union_set_gist(
6742                 __isl_take isl_union_set *uset,
6743                 __isl_take isl_union_set *context);
6744         __isl_give isl_union_set *isl_union_set_gist_params(
6745                 __isl_take isl_union_set *uset,
6746                 __isl_take isl_set *set);
6748         #include <isl/union_map.h>
6749         __isl_give isl_union_map *isl_union_map_gist(
6750                 __isl_take isl_union_map *umap,
6751                 __isl_take isl_union_map *context);
6752         __isl_give isl_union_map *isl_union_map_gist_params(
6753                 __isl_take isl_union_map *umap,
6754                 __isl_take isl_set *set);
6755         __isl_give isl_union_map *isl_union_map_gist_domain(
6756                 __isl_take isl_union_map *umap,
6757                 __isl_take isl_union_set *uset);
6758         __isl_give isl_union_map *isl_union_map_gist_range(
6759                 __isl_take isl_union_map *umap,
6760                 __isl_take isl_union_set *uset);
6762         #include <isl/aff.h>
6763         __isl_give isl_aff *isl_aff_gist_params(
6764                 __isl_take isl_aff *aff,
6765                 __isl_take isl_set *context);
6766         __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
6767                 __isl_take isl_set *context);
6768         __isl_give isl_multi_aff *isl_multi_aff_gist_params(
6769                 __isl_take isl_multi_aff *maff,
6770                 __isl_take isl_set *context);
6771         __isl_give isl_multi_aff *isl_multi_aff_gist(
6772                 __isl_take isl_multi_aff *maff,
6773                 __isl_take isl_set *context);
6774         __isl_give isl_pw_aff *isl_pw_aff_gist_params(
6775                 __isl_take isl_pw_aff *pwaff,
6776                 __isl_take isl_set *context);
6777         __isl_give isl_pw_aff *isl_pw_aff_gist(
6778                 __isl_take isl_pw_aff *pwaff,
6779                 __isl_take isl_set *context);
6780         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
6781                 __isl_take isl_pw_multi_aff *pma,
6782                 __isl_take isl_set *set);
6783         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
6784                 __isl_take isl_pw_multi_aff *pma,
6785                 __isl_take isl_set *set);
6786         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
6787                 __isl_take isl_multi_pw_aff *mpa,
6788                 __isl_take isl_set *set);
6789         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
6790                 __isl_take isl_multi_pw_aff *mpa,
6791                 __isl_take isl_set *set);
6792         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
6793                 __isl_take isl_union_pw_aff *upa,
6794                 __isl_take isl_union_set *context);
6795         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
6796                 __isl_take isl_union_pw_aff *upa,
6797                 __isl_take isl_set *context);
6798         __isl_give isl_union_pw_multi_aff *
6799         isl_union_pw_multi_aff_gist_params(
6800                 __isl_take isl_union_pw_multi_aff *upma,
6801                 __isl_take isl_set *context);
6802         __isl_give isl_union_pw_multi_aff *
6803         isl_union_pw_multi_aff_gist(
6804                 __isl_take isl_union_pw_multi_aff *upma,
6805                 __isl_take isl_union_set *context);
6806         __isl_give isl_multi_union_pw_aff *
6807         isl_multi_union_pw_aff_gist_params(
6808                 __isl_take isl_multi_union_pw_aff *aff,
6809                 __isl_take isl_set *context);
6810         __isl_give isl_multi_union_pw_aff *
6811         isl_multi_union_pw_aff_gist(
6812                 __isl_take isl_multi_union_pw_aff *aff,
6813                 __isl_take isl_union_set *context);
6815         #include <isl/polynomial.h>
6816         __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
6817                 __isl_take isl_qpolynomial *qp,
6818                 __isl_take isl_set *context);
6819         __isl_give isl_qpolynomial *isl_qpolynomial_gist(
6820                 __isl_take isl_qpolynomial *qp,
6821                 __isl_take isl_set *context);
6822         __isl_give isl_qpolynomial_fold *
6823         isl_qpolynomial_fold_gist_params(
6824                 __isl_take isl_qpolynomial_fold *fold,
6825                 __isl_take isl_set *context);
6826         __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
6827                 __isl_take isl_qpolynomial_fold *fold,
6828                 __isl_take isl_set *context);
6829         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
6830                 __isl_take isl_pw_qpolynomial *pwqp,
6831                 __isl_take isl_set *context);
6832         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
6833                 __isl_take isl_pw_qpolynomial *pwqp,
6834                 __isl_take isl_set *context);
6835         __isl_give isl_pw_qpolynomial_fold *
6836         isl_pw_qpolynomial_fold_gist(
6837                 __isl_take isl_pw_qpolynomial_fold *pwf,
6838                 __isl_take isl_set *context);
6839         __isl_give isl_pw_qpolynomial_fold *
6840         isl_pw_qpolynomial_fold_gist_params(
6841                 __isl_take isl_pw_qpolynomial_fold *pwf,
6842                 __isl_take isl_set *context);
6843         __isl_give isl_union_pw_qpolynomial *
6844         isl_union_pw_qpolynomial_gist_params(
6845                 __isl_take isl_union_pw_qpolynomial *upwqp,
6846                 __isl_take isl_set *context);
6847         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
6848                 __isl_take isl_union_pw_qpolynomial *upwqp,
6849                 __isl_take isl_union_set *context);
6850         __isl_give isl_union_pw_qpolynomial_fold *
6851         isl_union_pw_qpolynomial_fold_gist(
6852                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6853                 __isl_take isl_union_set *context);
6854         __isl_give isl_union_pw_qpolynomial_fold *
6855         isl_union_pw_qpolynomial_fold_gist_params(
6856                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6857                 __isl_take isl_set *context);
6859 =item * Binary Arithmetic Operations
6861         #include <isl/set.h>
6862         __isl_give isl_set *isl_set_sum(
6863                 __isl_take isl_set *set1,
6864                 __isl_take isl_set *set2);
6865         #include <isl/map.h>
6866         __isl_give isl_map *isl_map_sum(
6867                 __isl_take isl_map *map1,
6868                 __isl_take isl_map *map2);
6870 C<isl_set_sum> computes the Minkowski sum of its two arguments,
6871 i.e., the set containing the sums of pairs of elements from
6872 C<set1> and C<set2>.
6873 The domain of the result of C<isl_map_sum> is the intersection
6874 of the domains of its two arguments.  The corresponding range
6875 elements are the sums of the corresponding range elements
6876 in the two arguments.
6878         #include <isl/val.h>
6879         __isl_give isl_multi_val *isl_multi_val_add(
6880                 __isl_take isl_multi_val *mv1,
6881                 __isl_take isl_multi_val *mv2);
6882         __isl_give isl_multi_val *isl_multi_val_sub(
6883                 __isl_take isl_multi_val *mv1,
6884                 __isl_take isl_multi_val *mv2);
6886         #include <isl/aff.h>
6887         __isl_give isl_aff *isl_aff_add(
6888                 __isl_take isl_aff *aff1,
6889                 __isl_take isl_aff *aff2);
6890         __isl_give isl_multi_aff *isl_multi_aff_add(
6891                 __isl_take isl_multi_aff *maff1,
6892                 __isl_take isl_multi_aff *maff2);
6893         __isl_give isl_pw_aff *isl_pw_aff_add(
6894                 __isl_take isl_pw_aff *pwaff1,
6895                 __isl_take isl_pw_aff *pwaff2);
6896         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add(
6897                 __isl_take isl_multi_pw_aff *mpa1,
6898                 __isl_take isl_multi_pw_aff *mpa2);
6899         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
6900                 __isl_take isl_pw_multi_aff *pma1,
6901                 __isl_take isl_pw_multi_aff *pma2);
6902         __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
6903                 __isl_take isl_union_pw_aff *upa1,
6904                 __isl_take isl_union_pw_aff *upa2);
6905         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
6906                 __isl_take isl_union_pw_multi_aff *upma1,
6907                 __isl_take isl_union_pw_multi_aff *upma2);
6908         __isl_give isl_multi_union_pw_aff *
6909         isl_multi_union_pw_aff_add(
6910                 __isl_take isl_multi_union_pw_aff *mupa1,
6911                 __isl_take isl_multi_union_pw_aff *mupa2);
6912         __isl_give isl_pw_aff *isl_pw_aff_min(
6913                 __isl_take isl_pw_aff *pwaff1,
6914                 __isl_take isl_pw_aff *pwaff2);
6915         __isl_give isl_pw_aff *isl_pw_aff_max(
6916                 __isl_take isl_pw_aff *pwaff1,
6917                 __isl_take isl_pw_aff *pwaff2);
6918         __isl_give isl_aff *isl_aff_sub(
6919                 __isl_take isl_aff *aff1,
6920                 __isl_take isl_aff *aff2);
6921         __isl_give isl_multi_aff *isl_multi_aff_sub(
6922                 __isl_take isl_multi_aff *ma1,
6923                 __isl_take isl_multi_aff *ma2);
6924         __isl_give isl_pw_aff *isl_pw_aff_sub(
6925                 __isl_take isl_pw_aff *pwaff1,
6926                 __isl_take isl_pw_aff *pwaff2);
6927         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
6928                 __isl_take isl_multi_pw_aff *mpa1,
6929                 __isl_take isl_multi_pw_aff *mpa2);
6930         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
6931                 __isl_take isl_pw_multi_aff *pma1,
6932                 __isl_take isl_pw_multi_aff *pma2);
6933         __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
6934                 __isl_take isl_union_pw_aff *upa1,
6935                 __isl_take isl_union_pw_aff *upa2);
6936         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
6937                 __isl_take isl_union_pw_multi_aff *upma1,
6938                 __isl_take isl_union_pw_multi_aff *upma2);
6939         __isl_give isl_multi_union_pw_aff *
6940         isl_multi_union_pw_aff_sub(
6941                 __isl_take isl_multi_union_pw_aff *mupa1,
6942                 __isl_take isl_multi_union_pw_aff *mupa2);
6944 C<isl_aff_sub> subtracts the second argument from the first.
6946         #include <isl/polynomial.h>
6947         __isl_give isl_qpolynomial *isl_qpolynomial_add(
6948                 __isl_take isl_qpolynomial *qp1,
6949                 __isl_take isl_qpolynomial *qp2);
6950         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
6951                 __isl_take isl_pw_qpolynomial *pwqp1,
6952                 __isl_take isl_pw_qpolynomial *pwqp2);
6953         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
6954                 __isl_take isl_pw_qpolynomial *pwqp1,
6955                 __isl_take isl_pw_qpolynomial *pwqp2);
6956         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
6957                 __isl_take isl_pw_qpolynomial_fold *pwf1,
6958                 __isl_take isl_pw_qpolynomial_fold *pwf2);
6959         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
6960                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6961                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6962         __isl_give isl_qpolynomial *isl_qpolynomial_sub(
6963                 __isl_take isl_qpolynomial *qp1,
6964                 __isl_take isl_qpolynomial *qp2);
6965         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
6966                 __isl_take isl_pw_qpolynomial *pwqp1,
6967                 __isl_take isl_pw_qpolynomial *pwqp2);
6968         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
6969                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6970                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6971         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
6972                 __isl_take isl_pw_qpolynomial_fold *pwf1,
6973                 __isl_take isl_pw_qpolynomial_fold *pwf2);
6974         __isl_give isl_union_pw_qpolynomial_fold *
6975         isl_union_pw_qpolynomial_fold_fold(
6976                 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
6977                 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
6979         #include <isl/aff.h>
6980         __isl_give isl_pw_aff *isl_pw_aff_union_add(
6981                 __isl_take isl_pw_aff *pwaff1,
6982                 __isl_take isl_pw_aff *pwaff2);
6983         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
6984                 __isl_take isl_pw_multi_aff *pma1,
6985                 __isl_take isl_pw_multi_aff *pma2);
6986         __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
6987                 __isl_take isl_union_pw_aff *upa1,
6988                 __isl_take isl_union_pw_aff *upa2);
6989         __isl_give isl_union_pw_multi_aff *
6990         isl_union_pw_multi_aff_union_add(
6991                 __isl_take isl_union_pw_multi_aff *upma1,
6992                 __isl_take isl_union_pw_multi_aff *upma2);
6993         __isl_give isl_multi_union_pw_aff *
6994         isl_multi_union_pw_aff_union_add(
6995                 __isl_take isl_multi_union_pw_aff *mupa1,
6996                 __isl_take isl_multi_union_pw_aff *mupa2);
6997         __isl_give isl_pw_aff *isl_pw_aff_union_min(
6998                 __isl_take isl_pw_aff *pwaff1,
6999                 __isl_take isl_pw_aff *pwaff2);
7000         __isl_give isl_pw_aff *isl_pw_aff_union_max(
7001                 __isl_take isl_pw_aff *pwaff1,
7002                 __isl_take isl_pw_aff *pwaff2);
7004 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
7005 expression with a domain that is the union of those of C<pwaff1> and
7006 C<pwaff2> and such that on each cell, the quasi-affine expression is
7007 the maximum of those of C<pwaff1> and C<pwaff2>.  If only one of
7008 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
7009 associated expression is the defined one.
7010 This in contrast to the C<isl_pw_aff_max> function, which is
7011 only defined on the shared definition domain of the arguments.
7013         #include <isl/val.h>
7014         __isl_give isl_multi_val *isl_multi_val_add_val(
7015                 __isl_take isl_multi_val *mv,
7016                 __isl_take isl_val *v);
7017         __isl_give isl_multi_val *isl_multi_val_mod_val(
7018                 __isl_take isl_multi_val *mv,
7019                 __isl_take isl_val *v);
7020         __isl_give isl_multi_val *isl_multi_val_scale_val(
7021                 __isl_take isl_multi_val *mv,
7022                 __isl_take isl_val *v);
7023         __isl_give isl_multi_val *isl_multi_val_scale_down_val(
7024                 __isl_take isl_multi_val *mv,
7025                 __isl_take isl_val *v);
7027         #include <isl/aff.h>
7028         __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
7029                 __isl_take isl_val *mod);
7030         __isl_give isl_pw_aff *isl_pw_aff_mod_val(
7031                 __isl_take isl_pw_aff *pa,
7032                 __isl_take isl_val *mod);
7033         __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
7034                 __isl_take isl_union_pw_aff *upa,
7035                 __isl_take isl_val *f);
7036         __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
7037                 __isl_take isl_val *v);
7038         __isl_give isl_multi_aff *isl_multi_aff_scale_val(
7039                 __isl_take isl_multi_aff *ma,
7040                 __isl_take isl_val *v);
7041         __isl_give isl_pw_aff *isl_pw_aff_scale_val(
7042                 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
7043         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
7044                 __isl_take isl_multi_pw_aff *mpa,
7045                 __isl_take isl_val *v);
7046         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
7047                 __isl_take isl_pw_multi_aff *pma,
7048                 __isl_take isl_val *v);
7049         __isl_give isl_union_pw_multi_aff *
7050         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
7051                 __isl_take isl_union_pw_aff *upa,
7052                 __isl_take isl_val *f);
7053         isl_union_pw_multi_aff_scale_val(
7054                 __isl_take isl_union_pw_multi_aff *upma,
7055                 __isl_take isl_val *val);
7056         __isl_give isl_multi_union_pw_aff *
7057         isl_multi_union_pw_aff_scale_val(
7058                 __isl_take isl_multi_union_pw_aff *mupa,
7059                 __isl_take isl_val *v);
7060         __isl_give isl_aff *isl_aff_scale_down_ui(
7061                 __isl_take isl_aff *aff, unsigned f);
7062         __isl_give isl_aff *isl_aff_scale_down_val(
7063                 __isl_take isl_aff *aff, __isl_take isl_val *v);
7064         __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
7065                 __isl_take isl_multi_aff *ma,
7066                 __isl_take isl_val *v);
7067         __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
7068                 __isl_take isl_pw_aff *pa,
7069                 __isl_take isl_val *f);
7070         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
7071                 __isl_take isl_multi_pw_aff *mpa,
7072                 __isl_take isl_val *v);
7073         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
7074                 __isl_take isl_pw_multi_aff *pma,
7075                 __isl_take isl_val *v);
7076         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
7077                 __isl_take isl_union_pw_aff *upa,
7078                 __isl_take isl_val *v);
7079         __isl_give isl_union_pw_multi_aff *
7080         isl_union_pw_multi_aff_scale_down_val(
7081                 __isl_take isl_union_pw_multi_aff *upma,
7082                 __isl_take isl_val *val);
7083         __isl_give isl_multi_union_pw_aff *
7084         isl_multi_union_pw_aff_scale_down_val(
7085                 __isl_take isl_multi_union_pw_aff *mupa,
7086                 __isl_take isl_val *v);
7088         #include <isl/polynomial.h>
7089         __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
7090                 __isl_take isl_qpolynomial *qp,
7091                 __isl_take isl_val *v);
7092         __isl_give isl_qpolynomial_fold *
7093         isl_qpolynomial_fold_scale_val(
7094                 __isl_take isl_qpolynomial_fold *fold,
7095                 __isl_take isl_val *v);
7096         __isl_give isl_pw_qpolynomial *
7097         isl_pw_qpolynomial_scale_val(
7098                 __isl_take isl_pw_qpolynomial *pwqp,
7099                 __isl_take isl_val *v);
7100         __isl_give isl_pw_qpolynomial_fold *
7101         isl_pw_qpolynomial_fold_scale_val(
7102                 __isl_take isl_pw_qpolynomial_fold *pwf,
7103                 __isl_take isl_val *v);
7104         __isl_give isl_union_pw_qpolynomial *
7105         isl_union_pw_qpolynomial_scale_val(
7106                 __isl_take isl_union_pw_qpolynomial *upwqp,
7107                 __isl_take isl_val *v);
7108         __isl_give isl_union_pw_qpolynomial_fold *
7109         isl_union_pw_qpolynomial_fold_scale_val(
7110                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7111                 __isl_take isl_val *v);
7112         __isl_give isl_qpolynomial *
7113         isl_qpolynomial_scale_down_val(
7114                 __isl_take isl_qpolynomial *qp,
7115                 __isl_take isl_val *v);
7116         __isl_give isl_qpolynomial_fold *
7117         isl_qpolynomial_fold_scale_down_val(
7118                 __isl_take isl_qpolynomial_fold *fold,
7119                 __isl_take isl_val *v);
7120         __isl_give isl_pw_qpolynomial *
7121         isl_pw_qpolynomial_scale_down_val(
7122                 __isl_take isl_pw_qpolynomial *pwqp,
7123                 __isl_take isl_val *v);
7124         __isl_give isl_pw_qpolynomial_fold *
7125         isl_pw_qpolynomial_fold_scale_down_val(
7126                 __isl_take isl_pw_qpolynomial_fold *pwf,
7127                 __isl_take isl_val *v);
7128         __isl_give isl_union_pw_qpolynomial *
7129         isl_union_pw_qpolynomial_scale_down_val(
7130                 __isl_take isl_union_pw_qpolynomial *upwqp,
7131                 __isl_take isl_val *v);
7132         __isl_give isl_union_pw_qpolynomial_fold *
7133         isl_union_pw_qpolynomial_fold_scale_down_val(
7134                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7135                 __isl_take isl_val *v);
7137         #include <isl/val.h>
7138         __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
7139                 __isl_take isl_multi_val *mv1,
7140                 __isl_take isl_multi_val *mv2);
7141         __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
7142                 __isl_take isl_multi_val *mv1,
7143                 __isl_take isl_multi_val *mv2);
7144         __isl_give isl_multi_val *
7145         isl_multi_val_scale_down_multi_val(
7146                 __isl_take isl_multi_val *mv1,
7147                 __isl_take isl_multi_val *mv2);
7149         #include <isl/aff.h>
7150         __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
7151                 __isl_take isl_multi_aff *ma,
7152                 __isl_take isl_multi_val *mv);
7153         __isl_give isl_multi_union_pw_aff *
7154         isl_multi_union_pw_aff_mod_multi_val(
7155                 __isl_take isl_multi_union_pw_aff *upma,
7156                 __isl_take isl_multi_val *mv);
7157         __isl_give isl_multi_pw_aff *
7158         isl_multi_pw_aff_mod_multi_val(
7159                 __isl_take isl_multi_pw_aff *mpa,
7160                 __isl_take isl_multi_val *mv);
7161         __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
7162                 __isl_take isl_multi_aff *ma,
7163                 __isl_take isl_multi_val *mv);
7164         __isl_give isl_pw_multi_aff *
7165         isl_pw_multi_aff_scale_multi_val(
7166                 __isl_take isl_pw_multi_aff *pma,
7167                 __isl_take isl_multi_val *mv);
7168         __isl_give isl_multi_pw_aff *
7169         isl_multi_pw_aff_scale_multi_val(
7170                 __isl_take isl_multi_pw_aff *mpa,
7171                 __isl_take isl_multi_val *mv);
7172         __isl_give isl_multi_union_pw_aff *
7173         isl_multi_union_pw_aff_scale_multi_val(
7174                 __isl_take isl_multi_union_pw_aff *mupa,
7175                 __isl_take isl_multi_val *mv);
7176         __isl_give isl_union_pw_multi_aff *
7177         isl_union_pw_multi_aff_scale_multi_val(
7178                 __isl_take isl_union_pw_multi_aff *upma,
7179                 __isl_take isl_multi_val *mv);
7180         __isl_give isl_multi_aff *
7181         isl_multi_aff_scale_down_multi_val(
7182                 __isl_take isl_multi_aff *ma,
7183                 __isl_take isl_multi_val *mv);
7184         __isl_give isl_multi_pw_aff *
7185         isl_multi_pw_aff_scale_down_multi_val(
7186                 __isl_take isl_multi_pw_aff *mpa,
7187                 __isl_take isl_multi_val *mv);
7188         __isl_give isl_multi_union_pw_aff *
7189         isl_multi_union_pw_aff_scale_down_multi_val(
7190                 __isl_take isl_multi_union_pw_aff *mupa,
7191                 __isl_take isl_multi_val *mv);
7193 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
7194 by the corresponding elements of C<mv>.
7196         #include <isl/aff.h>
7197         __isl_give isl_aff *isl_aff_mul(
7198                 __isl_take isl_aff *aff1,
7199                 __isl_take isl_aff *aff2);
7200         __isl_give isl_aff *isl_aff_div(
7201                 __isl_take isl_aff *aff1,
7202                 __isl_take isl_aff *aff2);
7203         __isl_give isl_pw_aff *isl_pw_aff_mul(
7204                 __isl_take isl_pw_aff *pwaff1,
7205                 __isl_take isl_pw_aff *pwaff2);
7206         __isl_give isl_pw_aff *isl_pw_aff_div(
7207                 __isl_take isl_pw_aff *pa1,
7208                 __isl_take isl_pw_aff *pa2);
7209         __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
7210                 __isl_take isl_pw_aff *pa1,
7211                 __isl_take isl_pw_aff *pa2);
7212         __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
7213                 __isl_take isl_pw_aff *pa1,
7214                 __isl_take isl_pw_aff *pa2);
7216 When multiplying two affine expressions, at least one of the two needs
7217 to be a constant.  Similarly, when dividing an affine expression by another,
7218 the second expression needs to be a constant.
7219 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
7220 rounding towards zero.  C<isl_pw_aff_tdiv_r> computes the corresponding
7221 remainder.
7223         #include <isl/polynomial.h>
7224         __isl_give isl_qpolynomial *isl_qpolynomial_mul(
7225                 __isl_take isl_qpolynomial *qp1,
7226                 __isl_take isl_qpolynomial *qp2);
7227         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
7228                 __isl_take isl_pw_qpolynomial *pwqp1,
7229                 __isl_take isl_pw_qpolynomial *pwqp2);
7230         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
7231                 __isl_take isl_union_pw_qpolynomial *upwqp1,
7232                 __isl_take isl_union_pw_qpolynomial *upwqp2);
7234 =back
7236 =head3 Lexicographic Optimization
7238 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
7239 the following functions
7240 compute a set that contains the lexicographic minimum or maximum
7241 of the elements in C<set> (or C<bset>) for those values of the parameters
7242 that satisfy C<dom>.
7243 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
7244 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
7245 has no elements.
7246 In other words, the union of the parameter values
7247 for which the result is non-empty and of C<*empty>
7248 is equal to C<dom>.
7250         #include <isl/set.h>
7251         __isl_give isl_set *isl_basic_set_partial_lexmin(
7252                 __isl_take isl_basic_set *bset,
7253                 __isl_take isl_basic_set *dom,
7254                 __isl_give isl_set **empty);
7255         __isl_give isl_set *isl_basic_set_partial_lexmax(
7256                 __isl_take isl_basic_set *bset,
7257                 __isl_take isl_basic_set *dom,
7258                 __isl_give isl_set **empty);
7259         __isl_give isl_set *isl_set_partial_lexmin(
7260                 __isl_take isl_set *set, __isl_take isl_set *dom,
7261                 __isl_give isl_set **empty);
7262         __isl_give isl_set *isl_set_partial_lexmax(
7263                 __isl_take isl_set *set, __isl_take isl_set *dom,
7264                 __isl_give isl_set **empty);
7266 Given a (basic) set C<set> (or C<bset>), the following functions simply
7267 return a set containing the lexicographic minimum or maximum
7268 of the elements in C<set> (or C<bset>).
7269 In case of union sets, the optimum is computed per space.
7271         #include <isl/set.h>
7272         __isl_give isl_set *isl_basic_set_lexmin(
7273                 __isl_take isl_basic_set *bset);
7274         __isl_give isl_set *isl_basic_set_lexmax(
7275                 __isl_take isl_basic_set *bset);
7276         __isl_give isl_set *isl_set_lexmin(
7277                 __isl_take isl_set *set);
7278         __isl_give isl_set *isl_set_lexmax(
7279                 __isl_take isl_set *set);
7280         __isl_give isl_union_set *isl_union_set_lexmin(
7281                 __isl_take isl_union_set *uset);
7282         __isl_give isl_union_set *isl_union_set_lexmax(
7283                 __isl_take isl_union_set *uset);
7285 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
7286 the following functions
7287 compute a relation that maps each element of C<dom>
7288 to the single lexicographic minimum or maximum
7289 of the elements that are associated to that same
7290 element in C<map> (or C<bmap>).
7291 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
7292 that contains the elements in C<dom> that do not map
7293 to any elements in C<map> (or C<bmap>).
7294 In other words, the union of the domain of the result and of C<*empty>
7295 is equal to C<dom>.
7297         #include <isl/map.h>
7298         __isl_give isl_map *isl_basic_map_partial_lexmax(
7299                 __isl_take isl_basic_map *bmap,
7300                 __isl_take isl_basic_set *dom,
7301                 __isl_give isl_set **empty);
7302         __isl_give isl_map *isl_basic_map_partial_lexmin(
7303                 __isl_take isl_basic_map *bmap,
7304                 __isl_take isl_basic_set *dom,
7305                 __isl_give isl_set **empty);
7306         __isl_give isl_map *isl_map_partial_lexmax(
7307                 __isl_take isl_map *map, __isl_take isl_set *dom,
7308                 __isl_give isl_set **empty);
7309         __isl_give isl_map *isl_map_partial_lexmin(
7310                 __isl_take isl_map *map, __isl_take isl_set *dom,
7311                 __isl_give isl_set **empty);
7313 Given a (basic) map C<map> (or C<bmap>), the following functions simply
7314 return a map mapping each element in the domain of
7315 C<map> (or C<bmap>) to the lexicographic minimum or maximum
7316 of all elements associated to that element.
7317 In case of union relations, the optimum is computed per space.
7319         #include <isl/map.h>
7320         __isl_give isl_map *isl_basic_map_lexmin(
7321                 __isl_take isl_basic_map *bmap);
7322         __isl_give isl_map *isl_basic_map_lexmax(
7323                 __isl_take isl_basic_map *bmap);
7324         __isl_give isl_map *isl_map_lexmin(
7325                 __isl_take isl_map *map);
7326         __isl_give isl_map *isl_map_lexmax(
7327                 __isl_take isl_map *map);
7328         __isl_give isl_union_map *isl_union_map_lexmin(
7329                 __isl_take isl_union_map *umap);
7330         __isl_give isl_union_map *isl_union_map_lexmax(
7331                 __isl_take isl_union_map *umap);
7333 The following functions return their result in the form of
7334 a piecewise multi-affine expression,
7335 but are otherwise equivalent to the corresponding functions
7336 returning a basic set or relation.
7338         #include <isl/set.h>
7339         __isl_give isl_pw_multi_aff *
7340         isl_basic_set_partial_lexmin_pw_multi_aff(
7341                 __isl_take isl_basic_set *bset,
7342                 __isl_take isl_basic_set *dom,
7343                 __isl_give isl_set **empty);
7344         __isl_give isl_pw_multi_aff *
7345         isl_basic_set_partial_lexmax_pw_multi_aff(
7346                 __isl_take isl_basic_set *bset,
7347                 __isl_take isl_basic_set *dom,
7348                 __isl_give isl_set **empty);
7349         __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
7350                 __isl_take isl_set *set);
7351         __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
7352                 __isl_take isl_set *set);
7354         #include <isl/map.h>
7355         __isl_give isl_pw_multi_aff *
7356         isl_basic_map_lexmin_pw_multi_aff(
7357                 __isl_take isl_basic_map *bmap);
7358         __isl_give isl_pw_multi_aff *
7359         isl_basic_map_partial_lexmin_pw_multi_aff(
7360                 __isl_take isl_basic_map *bmap,
7361                 __isl_take isl_basic_set *dom,
7362                 __isl_give isl_set **empty);
7363         __isl_give isl_pw_multi_aff *
7364         isl_basic_map_partial_lexmax_pw_multi_aff(
7365                 __isl_take isl_basic_map *bmap,
7366                 __isl_take isl_basic_set *dom,
7367                 __isl_give isl_set **empty);
7368         __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
7369                 __isl_take isl_map *map);
7370         __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
7371                 __isl_take isl_map *map);
7373 The following functions return the lexicographic minimum or maximum
7374 on the shared domain of the inputs and the single defined function
7375 on those parts of the domain where only a single function is defined.
7377         #include <isl/aff.h>
7378         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
7379                 __isl_take isl_pw_multi_aff *pma1,
7380                 __isl_take isl_pw_multi_aff *pma2);
7381         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
7382                 __isl_take isl_pw_multi_aff *pma1,
7383                 __isl_take isl_pw_multi_aff *pma2);
7385 If the input to a lexicographic optimization problem has
7386 multiple constraints with the same coefficients for the optimized
7387 variables, then, by default, this symmetry is exploited by
7388 replacing those constraints by a single constraint with
7389 an abstract bound, which is in turn bounded by the corresponding terms
7390 in the original constraints.
7391 Without this optimization, the solver would typically consider
7392 all possible orderings of those original bounds, resulting in a needless
7393 decomposition of the domain.
7394 However, the optimization can also result in slowdowns since
7395 an extra parameter is introduced that may get used in additional
7396 integer divisions.
7397 The following option determines whether symmetry detection is applied
7398 during lexicographic optimization.
7400         #include <isl/options.h>
7401         isl_stat isl_options_set_pip_symmetry(isl_ctx *ctx,
7402                 int val);
7403         int isl_options_get_pip_symmetry(isl_ctx *ctx);
7405 =begin latex
7407 See also \autoref{s:offline}.
7409 =end latex
7411 =head2 Ternary Operations
7413         #include <isl/aff.h>
7414         __isl_give isl_pw_aff *isl_pw_aff_cond(
7415                 __isl_take isl_pw_aff *cond,
7416                 __isl_take isl_pw_aff *pwaff_true,
7417                 __isl_take isl_pw_aff *pwaff_false);
7419 The function C<isl_pw_aff_cond> performs a conditional operator
7420 and returns an expression that is equal to C<pwaff_true>
7421 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
7422 where C<cond> is zero.
7424 =head2 Lists
7426 Lists are defined over several element types, including
7427 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_union_pw_aff>,
7428 C<isl_union_pw_multi_aff>, C<isl_constraint>,
7429 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
7430 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
7431 Here we take lists of C<isl_set>s as an example.
7432 Lists can be created, copied, modified and freed using the following functions.
7434         #include <isl/set.h>
7435         __isl_give isl_set_list *isl_set_list_from_set(
7436                 __isl_take isl_set *el);
7437         __isl_give isl_set_list *isl_set_list_alloc(
7438                 isl_ctx *ctx, int n);
7439         __isl_give isl_set_list *isl_set_list_copy(
7440                 __isl_keep isl_set_list *list);
7441         __isl_give isl_set_list *isl_set_list_insert(
7442                 __isl_take isl_set_list *list, unsigned pos,
7443                 __isl_take isl_set *el);
7444         __isl_give isl_set_list *isl_set_list_add(
7445                 __isl_take isl_set_list *list,
7446                 __isl_take isl_set *el);
7447         __isl_give isl_set_list *isl_set_list_drop(
7448                 __isl_take isl_set_list *list,
7449                 unsigned first, unsigned n);
7450         __isl_give isl_set_list *isl_set_list_set_set(
7451                 __isl_take isl_set_list *list, int index,
7452                 __isl_take isl_set *set);
7453         __isl_give isl_set_list *isl_set_list_concat(
7454                 __isl_take isl_set_list *list1,
7455                 __isl_take isl_set_list *list2);
7456         __isl_give isl_set_list *isl_set_list_sort(
7457                 __isl_take isl_set_list *list,
7458                 int (*cmp)(__isl_keep isl_set *a,
7459                         __isl_keep isl_set *b, void *user),
7460                 void *user);
7461         __isl_null isl_set_list *isl_set_list_free(
7462                 __isl_take isl_set_list *list);
7464 C<isl_set_list_alloc> creates an empty list with an initial capacity
7465 for C<n> elements.  C<isl_set_list_insert> and C<isl_set_list_add>
7466 add elements to a list, increasing its capacity as needed.
7467 C<isl_set_list_from_set> creates a list with a single element.
7469 Lists can be inspected using the following functions.
7471         #include <isl/set.h>
7472         int isl_set_list_n_set(__isl_keep isl_set_list *list);
7473         __isl_give isl_set *isl_set_list_get_set(
7474                 __isl_keep isl_set_list *list, int index);
7475         isl_stat isl_set_list_foreach(__isl_keep isl_set_list *list,
7476                 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7477                 void *user);
7478         isl_stat isl_set_list_foreach_scc(
7479                 __isl_keep isl_set_list *list,
7480                 isl_bool (*follows)(__isl_keep isl_set *a,
7481                         __isl_keep isl_set *b, void *user),
7482                 void *follows_user,
7483                 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7484                 void *fn_user);
7486 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
7487 strongly connected components of the graph with as vertices the elements
7488 of C<list> and a directed edge from vertex C<b> to vertex C<a>
7489 iff C<follows(a, b)> returns C<isl_bool_true>.  The callbacks C<follows> and
7490 C<fn> should return C<isl_bool_error> or C<isl_stat_error> on error.
7492 Lists can be printed using
7494         #include <isl/set.h>
7495         __isl_give isl_printer *isl_printer_print_set_list(
7496                 __isl_take isl_printer *p,
7497                 __isl_keep isl_set_list *list);
7499 =head2 Associative arrays
7501 Associative arrays map isl objects of a specific type to isl objects
7502 of some (other) specific type.  They are defined for several pairs
7503 of types, including (C<isl_map>, C<isl_basic_set>),
7504 (C<isl_id>, C<isl_ast_expr>),
7505 (C<isl_id>, C<isl_id>) and
7506 (C<isl_id>, C<isl_pw_aff>).
7507 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
7508 as an example.
7510 Associative arrays can be created, copied and freed using
7511 the following functions.
7513         #include <isl/id_to_ast_expr.h>
7514         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
7515                 isl_ctx *ctx, int min_size);
7516         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
7517                 __isl_keep isl_id_to_ast_expr *id2expr);
7518         __isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
7519                 __isl_take isl_id_to_ast_expr *id2expr);
7521 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
7522 to specify the expected size of the associative array.
7523 The associative array will be grown automatically as needed.
7525 Associative arrays can be inspected using the following functions.
7527         #include <isl/id_to_ast_expr.h>
7528         __isl_give isl_maybe_isl_ast_expr
7529         isl_id_to_ast_expr_try_get(
7530                 __isl_keep isl_id_to_ast_expr *id2expr,
7531                 __isl_keep isl_id *key);
7532         isl_bool isl_id_to_ast_expr_has(
7533                 __isl_keep isl_id_to_ast_expr *id2expr,
7534                 __isl_keep isl_id *key);
7535         __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
7536                 __isl_keep isl_id_to_ast_expr *id2expr,
7537                 __isl_take isl_id *key);
7538         isl_stat isl_id_to_ast_expr_foreach(
7539                 __isl_keep isl_id_to_ast_expr *id2expr,
7540                 isl_stat (*fn)(__isl_take isl_id *key,
7541                         __isl_take isl_ast_expr *val, void *user),
7542                 void *user);
7544 The function C<isl_id_to_ast_expr_try_get> returns a structure
7545 containing two elements, C<valid> and C<value>.
7546 If there is a value associated to the key, then C<valid>
7547 is set to C<isl_bool_true> and C<value> contains a copy of
7548 the associated value.  Otherwise C<value> is C<NULL> and
7549 C<valid> may be C<isl_bool_error> or C<isl_bool_false> depending
7550 on whether some error has occurred or there simply is no associated value.
7551 The function C<isl_id_to_ast_expr_has> returns the C<valid> field
7552 in the structure and
7553 the function C<isl_id_to_ast_expr_get> returns the C<value> field.
7555 Associative arrays can be modified using the following functions.
7557         #include <isl/id_to_ast_expr.h>
7558         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
7559                 __isl_take isl_id_to_ast_expr *id2expr,
7560                 __isl_take isl_id *key,
7561                 __isl_take isl_ast_expr *val);
7562         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
7563                 __isl_take isl_id_to_ast_expr *id2expr,
7564                 __isl_take isl_id *key);
7566 Associative arrays can be printed using the following function.
7568         #include <isl/id_to_ast_expr.h>
7569         __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
7570                 __isl_take isl_printer *p,
7571                 __isl_keep isl_id_to_ast_expr *id2expr);
7573 =head2 Vectors
7575 Vectors can be created, copied and freed using the following functions.
7577         #include <isl/vec.h>
7578         __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
7579                 unsigned size);
7580         __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
7581         __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
7583 Note that the elements of a newly created vector may have arbitrary values.
7584 The elements can be changed and inspected using the following functions.
7586         int isl_vec_size(__isl_keep isl_vec *vec);
7587         __isl_give isl_val *isl_vec_get_element_val(
7588                 __isl_keep isl_vec *vec, int pos);
7589         __isl_give isl_vec *isl_vec_set_element_si(
7590                 __isl_take isl_vec *vec, int pos, int v);
7591         __isl_give isl_vec *isl_vec_set_element_val(
7592                 __isl_take isl_vec *vec, int pos,
7593                 __isl_take isl_val *v);
7594         __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
7595                 int v);
7596         __isl_give isl_vec *isl_vec_set_val(
7597                 __isl_take isl_vec *vec, __isl_take isl_val *v);
7598         int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
7599                 __isl_keep isl_vec *vec2, int pos);
7601 C<isl_vec_get_element> will return a negative value if anything went wrong.
7602 In that case, the value of C<*v> is undefined.
7604 The following function can be used to concatenate two vectors.
7606         __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
7607                 __isl_take isl_vec *vec2);
7609 =head2 Matrices
7611 Matrices can be created, copied and freed using the following functions.
7613         #include <isl/mat.h>
7614         __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
7615                 unsigned n_row, unsigned n_col);
7616         __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
7617         __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
7619 Note that the elements of a newly created matrix may have arbitrary values.
7620 The elements can be changed and inspected using the following functions.
7622         int isl_mat_rows(__isl_keep isl_mat *mat);
7623         int isl_mat_cols(__isl_keep isl_mat *mat);
7624         __isl_give isl_val *isl_mat_get_element_val(
7625                 __isl_keep isl_mat *mat, int row, int col);
7626         __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
7627                 int row, int col, int v);
7628         __isl_give isl_mat *isl_mat_set_element_val(
7629                 __isl_take isl_mat *mat, int row, int col,
7630                 __isl_take isl_val *v);
7632 C<isl_mat_get_element> will return a negative value if anything went wrong.
7633 In that case, the value of C<*v> is undefined.
7635 The following function can be used to compute the (right) inverse
7636 of a matrix, i.e., a matrix such that the product of the original
7637 and the inverse (in that order) is a multiple of the identity matrix.
7638 The input matrix is assumed to be of full row-rank.
7640         __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
7642 The following function can be used to compute the (right) kernel
7643 (or null space) of a matrix, i.e., a matrix such that the product of
7644 the original and the kernel (in that order) is the zero matrix.
7646         __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
7648 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
7650 The following functions determine
7651 an upper or lower bound on a quasipolynomial over its domain.
7653         __isl_give isl_pw_qpolynomial_fold *
7654         isl_pw_qpolynomial_bound(
7655                 __isl_take isl_pw_qpolynomial *pwqp,
7656                 enum isl_fold type, int *tight);
7658         __isl_give isl_union_pw_qpolynomial_fold *
7659         isl_union_pw_qpolynomial_bound(
7660                 __isl_take isl_union_pw_qpolynomial *upwqp,
7661                 enum isl_fold type, int *tight);
7663 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
7664 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
7665 is the returned bound is known be tight, i.e., for each value
7666 of the parameters there is at least
7667 one element in the domain that reaches the bound.
7668 If the domain of C<pwqp> is not wrapping, then the bound is computed
7669 over all elements in that domain and the result has a purely parametric
7670 domain.  If the domain of C<pwqp> is wrapping, then the bound is
7671 computed over the range of the wrapped relation.  The domain of the
7672 wrapped relation becomes the domain of the result.
7674 =head2 Parametric Vertex Enumeration
7676 The parametric vertex enumeration described in this section
7677 is mainly intended to be used internally and by the C<barvinok>
7678 library.
7680         #include <isl/vertices.h>
7681         __isl_give isl_vertices *isl_basic_set_compute_vertices(
7682                 __isl_keep isl_basic_set *bset);
7684 The function C<isl_basic_set_compute_vertices> performs the
7685 actual computation of the parametric vertices and the chamber
7686 decomposition and stores the result in an C<isl_vertices> object.
7687 This information can be queried by either iterating over all
7688 the vertices or iterating over all the chambers or cells
7689 and then iterating over all vertices that are active on the chamber.
7691         isl_stat isl_vertices_foreach_vertex(
7692                 __isl_keep isl_vertices *vertices,
7693                 isl_stat (*fn)(__isl_take isl_vertex *vertex,
7694                         void *user), void *user);
7696         isl_stat isl_vertices_foreach_cell(
7697                 __isl_keep isl_vertices *vertices,
7698                 isl_stat (*fn)(__isl_take isl_cell *cell,
7699                         void *user), void *user);
7700         isl_stat isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
7701                 isl_stat (*fn)(__isl_take isl_vertex *vertex,
7702                         void *user), void *user);
7704 Other operations that can be performed on an C<isl_vertices> object are
7705 the following.
7707         int isl_vertices_get_n_vertices(
7708                 __isl_keep isl_vertices *vertices);
7709         __isl_null isl_vertices *isl_vertices_free(
7710                 __isl_take isl_vertices *vertices);
7712 Vertices can be inspected and destroyed using the following functions.
7714         int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
7715         __isl_give isl_basic_set *isl_vertex_get_domain(
7716                 __isl_keep isl_vertex *vertex);
7717         __isl_give isl_multi_aff *isl_vertex_get_expr(
7718                 __isl_keep isl_vertex *vertex);
7719         void isl_vertex_free(__isl_take isl_vertex *vertex);
7721 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
7722 describing the vertex in terms of the parameters,
7723 while C<isl_vertex_get_domain> returns the activity domain
7724 of the vertex.
7726 Chambers can be inspected and destroyed using the following functions.
7728         __isl_give isl_basic_set *isl_cell_get_domain(
7729                 __isl_keep isl_cell *cell);
7730         void isl_cell_free(__isl_take isl_cell *cell);
7732 =head1 Polyhedral Compilation Library
7734 This section collects functionality in C<isl> that has been specifically
7735 designed for use during polyhedral compilation.
7737 =head2 Schedule Trees
7739 A schedule tree is a structured representation of a schedule,
7740 assigning a relative order to a set of domain elements.
7741 The relative order expressed by the schedule tree is
7742 defined recursively.  In particular, the order between
7743 two domain elements is determined by the node that is closest
7744 to the root that refers to both elements and that orders them apart.
7745 Each node in the tree is of one of several types.
7746 The root node is always of type C<isl_schedule_node_domain>
7747 (or C<isl_schedule_node_extension>)
7748 and it describes the (extra) domain elements to which the schedule applies.
7749 The other types of nodes are as follows.
7751 =over
7753 =item C<isl_schedule_node_band>
7755 A band of schedule dimensions.  Each schedule dimension is represented
7756 by a union piecewise quasi-affine expression.  If this expression
7757 assigns a different value to two domain elements, while all previous
7758 schedule dimensions in the same band assign them the same value,
7759 then the two domain elements are ordered according to these two
7760 different values.
7761 Each expression is required to be total in the domain elements
7762 that reach the band node.
7764 =item C<isl_schedule_node_expansion>
7766 An expansion node maps each of the domain elements that reach the node
7767 to one or more domain elements.  The image of this mapping forms
7768 the set of domain elements that reach the child of the expansion node.
7769 The function that maps each of the expanded domain elements
7770 to the original domain element from which it was expanded
7771 is called the contraction.
7773 =item C<isl_schedule_node_filter>
7775 A filter node does not impose any ordering, but rather intersects
7776 the set of domain elements that the current subtree refers to
7777 with a given union set.  The subtree of the filter node only
7778 refers to domain elements in the intersection.
7779 A filter node is typically only used as a child of a sequence or
7780 set node.
7782 =item C<isl_schedule_node_leaf>
7784 A leaf of the schedule tree.  Leaf nodes do not impose any ordering.
7786 =item C<isl_schedule_node_mark>
7788 A mark node can be used to attach any kind of information to a subtree
7789 of the schedule tree.
7791 =item C<isl_schedule_node_sequence>
7793 A sequence node has one or more children, each of which is a filter node.
7794 The filters on these filter nodes form a partition of
7795 the domain elements that the current subtree refers to.
7796 If two domain elements appear in distinct filters then the sequence
7797 node orders them according to the child positions of the corresponding
7798 filter nodes.
7800 =item C<isl_schedule_node_set>
7802 A set node is similar to a sequence node, except that
7803 it expresses that domain elements appearing in distinct filters
7804 may have any order.  The order of the children of a set node
7805 is therefore also immaterial.
7807 =back
7809 The following node types are only supported by the AST generator.
7811 =over
7813 =item C<isl_schedule_node_context>
7815 The context describes constraints on the parameters and
7816 the schedule dimensions of outer
7817 bands that the AST generator may assume to hold.  It is also the only
7818 kind of node that may introduce additional parameters.
7819 The space of the context is that of the flat product of the outer
7820 band nodes.  In particular, if there are no outer band nodes, then
7821 this space is the unnamed zero-dimensional space.
7822 Since a context node references the outer band nodes, any tree
7823 containing a context node is considered to be anchored.
7825 =item C<isl_schedule_node_extension>
7827 An extension node instructs the AST generator to add additional
7828 domain elements that need to be scheduled.
7829 The additional domain elements are described by the range of
7830 the extension map in terms of the outer schedule dimensions,
7831 i.e., the flat product of the outer band nodes.
7832 Note that domain elements are added whenever the AST generator
7833 reaches the extension node, meaning that there are still some
7834 active domain elements for which an AST needs to be generated.
7835 The conditions under which some domain elements are still active
7836 may however not be completely described by the outer AST nodes
7837 generated at that point.
7839 An extension node may also appear as the root of a schedule tree,
7840 when it is intended to be inserted into another tree
7841 using C<isl_schedule_node_graft_before> or C<isl_schedule_node_graft_after>.
7842 In this case, the domain of the extension node should
7843 correspond to the flat product of the outer band nodes
7844 in this other schedule tree at the point where the extension tree
7845 will be inserted.
7847 =item C<isl_schedule_node_guard>
7849 The guard describes constraints on the parameters and
7850 the schedule dimensions of outer
7851 bands that need to be enforced by the outer nodes
7852 in the generated AST.
7853 The space of the guard is that of the flat product of the outer
7854 band nodes.  In particular, if there are no outer band nodes, then
7855 this space is the unnamed zero-dimensional space.
7856 Since a guard node references the outer band nodes, any tree
7857 containing a guard node is considered to be anchored.
7859 =back
7861 Except for the C<isl_schedule_node_context> nodes,
7862 none of the nodes may introduce any parameters that were not
7863 already present in the root domain node.
7865 A schedule tree is encapsulated in an C<isl_schedule> object.
7866 The simplest such objects, those with a tree consisting of single domain node,
7867 can be created using the following functions with either an empty
7868 domain or a given domain.
7870         #include <isl/schedule.h>
7871         __isl_give isl_schedule *isl_schedule_empty(
7872                 __isl_take isl_space *space);
7873         __isl_give isl_schedule *isl_schedule_from_domain(
7874                 __isl_take isl_union_set *domain);
7876 The function C<isl_schedule_constraints_compute_schedule> described
7877 in L</"Scheduling"> can also be used to construct schedules.
7879 C<isl_schedule> objects may be copied and freed using the following functions.
7881         #include <isl/schedule.h>
7882         __isl_give isl_schedule *isl_schedule_copy(
7883                 __isl_keep isl_schedule *sched);
7884         __isl_null isl_schedule *isl_schedule_free(
7885                 __isl_take isl_schedule *sched);
7887 The following functions checks whether two C<isl_schedule> objects
7888 are obviously the same.
7890         #include <isl/schedule.h>
7891         isl_bool isl_schedule_plain_is_equal(
7892                 __isl_keep isl_schedule *schedule1,
7893                 __isl_keep isl_schedule *schedule2);
7895 The domain of the schedule, i.e., the domain described by the root node,
7896 can be obtained using the following function.
7898         #include <isl/schedule.h>
7899         __isl_give isl_union_set *isl_schedule_get_domain(
7900                 __isl_keep isl_schedule *schedule);
7902 An extra top-level band node (right underneath the domain node) can
7903 be introduced into the schedule using the following function.
7904 The schedule tree is assumed not to have any anchored nodes.
7906         #include <isl/schedule.h>
7907         __isl_give isl_schedule *
7908         isl_schedule_insert_partial_schedule(
7909                 __isl_take isl_schedule *schedule,
7910                 __isl_take isl_multi_union_pw_aff *partial);
7912 A top-level context node (right underneath the domain node) can
7913 be introduced into the schedule using the following function.
7915         #include <isl/schedule.h>
7916         __isl_give isl_schedule *isl_schedule_insert_context(
7917                 __isl_take isl_schedule *schedule,
7918                 __isl_take isl_set *context)
7920 A top-level guard node (right underneath the domain node) can
7921 be introduced into the schedule using the following function.
7923         #include <isl/schedule.h>
7924         __isl_give isl_schedule *isl_schedule_insert_guard(
7925                 __isl_take isl_schedule *schedule,
7926                 __isl_take isl_set *guard)
7928 A schedule that combines two schedules either in the given
7929 order or in an arbitrary order, i.e., with an C<isl_schedule_node_sequence>
7930 or an C<isl_schedule_node_set> node,
7931 can be created using the following functions.
7933         #include <isl/schedule.h>
7934         __isl_give isl_schedule *isl_schedule_sequence(
7935                 __isl_take isl_schedule *schedule1,
7936                 __isl_take isl_schedule *schedule2);
7937         __isl_give isl_schedule *isl_schedule_set(
7938                 __isl_take isl_schedule *schedule1,
7939                 __isl_take isl_schedule *schedule2);
7941 The domains of the two input schedules need to be disjoint.
7943 The following function can be used to restrict the domain
7944 of a schedule with a domain node as root to be a subset of the given union set.
7945 This operation may remove nodes in the tree that have become
7946 redundant.
7948         #include <isl/schedule.h>
7949         __isl_give isl_schedule *isl_schedule_intersect_domain(
7950                 __isl_take isl_schedule *schedule,
7951                 __isl_take isl_union_set *domain);
7953 The following function can be used to simplify the domain
7954 of a schedule with a domain node as root with respect to the given
7955 parameter domain.
7957         #include <isl/schedule.h>
7958         __isl_give isl_schedule *isl_schedule_gist_domain_params(
7959                 __isl_take isl_schedule *schedule,
7960                 __isl_take isl_set *context);
7962 The following function resets the user pointers on all parameter
7963 and tuple identifiers referenced by the nodes of the given schedule.
7965         #include <isl/schedule.h>
7966         __isl_give isl_schedule *isl_schedule_reset_user(
7967                 __isl_take isl_schedule *schedule);
7969 The following function aligns the parameters of all nodes
7970 in the given schedule to the given space.
7972         #include <isl/schedule.h>
7973         __isl_give isl_schedule *isl_schedule_align_params(
7974                 __isl_take isl_schedule *schedule,
7975                 __isl_take isl_space *space);
7977 The following function allows the user to plug in a given function
7978 in the iteration domains.  The input schedule is not allowed to contain
7979 any expansion nodes.
7981         #include <isl/schedule.h>
7982         __isl_give isl_schedule *
7983         isl_schedule_pullback_union_pw_multi_aff(
7984                 __isl_take isl_schedule *schedule,
7985                 __isl_take isl_union_pw_multi_aff *upma);
7987 The following function can be used to plug in the schedule C<expansion>
7988 in the leaves of C<schedule>, where C<contraction> describes how
7989 the domain elements of C<expansion> map to the domain elements
7990 at the original leaves of C<schedule>.
7991 The resulting schedule will contain expansion nodes, unless
7992 C<contraction> is an identity function.
7994         #include <isl/schedule.h>
7995         __isl_give isl_schedule *isl_schedule_expand(
7996                 __isl_take isl_schedule *schedule,
7997                 __isl_take isl_union_pw_multi_aff *contraction,
7998                 __isl_take isl_schedule *expansion);
8000 An C<isl_union_map> representation of the schedule can be obtained
8001 from an C<isl_schedule> using the following function.
8003         #include <isl/schedule.h>
8004         __isl_give isl_union_map *isl_schedule_get_map(
8005                 __isl_keep isl_schedule *sched);
8007 The resulting relation encodes the same relative ordering as
8008 the schedule by mapping the domain elements to a common schedule space.
8009 If the schedule_separate_components option is set, then the order
8010 of the children of a set node is explicitly encoded in the result.
8011 If the tree contains any expansion nodes, then the relation
8012 is formulated in terms of the expanded domain elements.
8014 Schedules can be read from input using the following functions.
8016         #include <isl/schedule.h>
8017         __isl_give isl_schedule *isl_schedule_read_from_file(
8018                 isl_ctx *ctx, FILE *input);
8019         __isl_give isl_schedule *isl_schedule_read_from_str(
8020                 isl_ctx *ctx, const char *str);
8022 A representation of the schedule can be printed using
8024         #include <isl/schedule.h>
8025         __isl_give isl_printer *isl_printer_print_schedule(
8026                 __isl_take isl_printer *p,
8027                 __isl_keep isl_schedule *schedule);
8028         __isl_give char *isl_schedule_to_str(
8029                 __isl_keep isl_schedule *schedule);
8031 C<isl_schedule_to_str> prints the schedule in flow format.
8033 The schedule tree can be traversed through the use of
8034 C<isl_schedule_node> objects that point to a particular
8035 position in the schedule tree.  Whenever a C<isl_schedule_node>
8036 is use to modify a node in the schedule tree, the original schedule
8037 tree is left untouched and the modifications are performed to a copy
8038 of the tree.  The returned C<isl_schedule_node> then points to
8039 this modified copy of the tree.
8041 The root of the schedule tree can be obtained using the following function.
8043         #include <isl/schedule.h>
8044         __isl_give isl_schedule_node *isl_schedule_get_root(
8045                 __isl_keep isl_schedule *schedule);
8047 A pointer to a newly created schedule tree with a single domain
8048 node can be created using the following functions.
8050         #include <isl/schedule_node.h>
8051         __isl_give isl_schedule_node *
8052         isl_schedule_node_from_domain(
8053                 __isl_take isl_union_set *domain);
8054         __isl_give isl_schedule_node *
8055         isl_schedule_node_from_extension(
8056                 __isl_take isl_union_map *extension);
8058 C<isl_schedule_node_from_extension> creates a tree with an extension
8059 node as root.
8061 Schedule nodes can be copied and freed using the following functions.
8063         #include <isl/schedule_node.h>
8064         __isl_give isl_schedule_node *isl_schedule_node_copy(
8065                 __isl_keep isl_schedule_node *node);
8066         __isl_null isl_schedule_node *isl_schedule_node_free(
8067                 __isl_take isl_schedule_node *node);
8069 The following functions can be used to check if two schedule
8070 nodes point to the same position in the same schedule.
8072         #include <isl/schedule_node.h>
8073         isl_bool isl_schedule_node_is_equal(
8074                 __isl_keep isl_schedule_node *node1,
8075                 __isl_keep isl_schedule_node *node2);
8077 The following properties can be obtained from a schedule node.
8079         #include <isl/schedule_node.h>
8080         enum isl_schedule_node_type isl_schedule_node_get_type(
8081                 __isl_keep isl_schedule_node *node);
8082         enum isl_schedule_node_type
8083         isl_schedule_node_get_parent_type(
8084                 __isl_keep isl_schedule_node *node);
8085         __isl_give isl_schedule *isl_schedule_node_get_schedule(
8086                 __isl_keep isl_schedule_node *node);
8088 The function C<isl_schedule_node_get_type> returns the type of
8089 the node, while C<isl_schedule_node_get_parent_type> returns
8090 type of the parent of the node, which is required to exist.
8091 The function C<isl_schedule_node_get_schedule> returns a copy
8092 to the schedule to which the node belongs.
8094 The following functions can be used to move the schedule node
8095 to a different position in the tree or to check if such a position
8096 exists.
8098         #include <isl/schedule_node.h>
8099         isl_bool isl_schedule_node_has_parent(
8100                 __isl_keep isl_schedule_node *node);
8101         __isl_give isl_schedule_node *isl_schedule_node_parent(
8102                 __isl_take isl_schedule_node *node);
8103         __isl_give isl_schedule_node *isl_schedule_node_root(
8104                 __isl_take isl_schedule_node *node);
8105         __isl_give isl_schedule_node *isl_schedule_node_ancestor(
8106                 __isl_take isl_schedule_node *node,
8107                 int generation);
8108         int isl_schedule_node_n_children(
8109                 __isl_keep isl_schedule_node *node);
8110         __isl_give isl_schedule_node *isl_schedule_node_child(
8111                 __isl_take isl_schedule_node *node, int pos);
8112         isl_bool isl_schedule_node_has_children(
8113                 __isl_keep isl_schedule_node *node);
8114         __isl_give isl_schedule_node *isl_schedule_node_first_child(
8115                 __isl_take isl_schedule_node *node);
8116         isl_bool isl_schedule_node_has_previous_sibling(
8117                 __isl_keep isl_schedule_node *node);
8118         __isl_give isl_schedule_node *
8119         isl_schedule_node_previous_sibling(
8120                 __isl_take isl_schedule_node *node);
8121         isl_bool isl_schedule_node_has_next_sibling(
8122                 __isl_keep isl_schedule_node *node);
8123         __isl_give isl_schedule_node *
8124         isl_schedule_node_next_sibling(
8125                 __isl_take isl_schedule_node *node);
8127 For C<isl_schedule_node_ancestor>, the ancestor of generation 0
8128 is the node itself, the ancestor of generation 1 is its parent and so on.
8130 It is also possible to query the number of ancestors of a node,
8131 the position of the current node
8132 within the children of its parent, the position of the subtree
8133 containing a node within the children of an ancestor
8134 or to obtain a copy of a given
8135 child without destroying the current node.
8136 Given two nodes that point to the same schedule, their closest
8137 shared ancestor can be obtained using
8138 C<isl_schedule_node_get_shared_ancestor>.
8140         #include <isl/schedule_node.h>
8141         int isl_schedule_node_get_tree_depth(
8142                 __isl_keep isl_schedule_node *node);
8143         int isl_schedule_node_get_child_position(
8144                 __isl_keep isl_schedule_node *node);
8145         int isl_schedule_node_get_ancestor_child_position(
8146                 __isl_keep isl_schedule_node *node,
8147                 __isl_keep isl_schedule_node *ancestor);
8148         __isl_give isl_schedule_node *isl_schedule_node_get_child(
8149                 __isl_keep isl_schedule_node *node, int pos);
8150         __isl_give isl_schedule_node *
8151         isl_schedule_node_get_shared_ancestor(
8152                 __isl_keep isl_schedule_node *node1,
8153                 __isl_keep isl_schedule_node *node2);
8155 All nodes in a schedule tree or
8156 all descendants of a specific node (including the node) can be visited
8157 in depth-first pre-order using the following functions.
8159         #include <isl/schedule.h>
8160         isl_stat isl_schedule_foreach_schedule_node_top_down(
8161                 __isl_keep isl_schedule *sched,
8162                 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
8163                         void *user), void *user);
8165         #include <isl/schedule_node.h>
8166         isl_stat isl_schedule_node_foreach_descendant_top_down(
8167                 __isl_keep isl_schedule_node *node,
8168                 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
8169                         void *user), void *user);
8171 The callback function is slightly different from the usual
8172 callbacks in that it not only indicates success (non-negative result)
8173 or failure (negative result), but also indicates whether the children
8174 of the given node should be visited.  In particular, if the callback
8175 returns a positive value, then the children are visited, but if
8176 the callback returns zero, then the children are not visited.
8178 The ancestors of a node in a schedule tree can be visited from
8179 the root down to and including the parent of the node using
8180 the following function.
8182         #include <isl/schedule_node.h>
8183         isl_stat isl_schedule_node_foreach_ancestor_top_down(
8184                 __isl_keep isl_schedule_node *node,
8185                 isl_stat (*fn)(__isl_keep isl_schedule_node *node,
8186                         void *user), void *user);
8188 The following functions allows for a depth-first post-order
8189 traversal of the nodes in a schedule tree or
8190 of the descendants of a specific node (including the node
8191 itself), where the user callback is allowed to modify the
8192 visited node.
8194         #include <isl/schedule.h>
8195         __isl_give isl_schedule *
8196         isl_schedule_map_schedule_node_bottom_up(
8197                 __isl_take isl_schedule *schedule,
8198                 __isl_give isl_schedule_node *(*fn)(
8199                         __isl_take isl_schedule_node *node,
8200                         void *user), void *user);
8202         #include <isl/schedule_node.h>
8203         __isl_give isl_schedule_node *
8204         isl_schedule_node_map_descendant_bottom_up(
8205                 __isl_take isl_schedule_node *node,
8206                 __isl_give isl_schedule_node *(*fn)(
8207                         __isl_take isl_schedule_node *node,
8208                         void *user), void *user);
8210 The traversal continues from the node returned by the callback function.
8211 It is the responsibility of the user to ensure that this does not
8212 lead to an infinite loop.  It is safest to always return a pointer
8213 to the same position (same ancestors and child positions) as the input node.
8215 The following function removes a node (along with its descendants)
8216 from a schedule tree and returns a pointer to the leaf at the
8217 same position in the updated tree.
8218 It is not allowed to remove the root of a schedule tree or
8219 a child of a set or sequence node.
8221         #include <isl/schedule_node.h>
8222         __isl_give isl_schedule_node *isl_schedule_node_cut(
8223                 __isl_take isl_schedule_node *node);
8225 The following function removes a single node
8226 from a schedule tree and returns a pointer to the child
8227 of the node, now located at the position of the original node
8228 or to a leaf node at that position if there was no child.
8229 It is not allowed to remove the root of a schedule tree,
8230 a set or sequence node, a child of a set or sequence node or
8231 a band node with an anchored subtree.
8233         #include <isl/schedule_node.h>
8234         __isl_give isl_schedule_node *isl_schedule_node_delete(
8235                 __isl_take isl_schedule_node *node);
8237 Most nodes in a schedule tree only contain local information.
8238 In some cases, however, a node may also refer to the schedule dimensions
8239 of its outer band nodes.
8240 This means that the position of the node within the tree should
8241 not be changed, or at least that no changes are performed to the
8242 outer band nodes.  The following function can be used to test
8243 whether the subtree rooted at a given node contains any such nodes.
8245         #include <isl/schedule_node.h>
8246         isl_bool isl_schedule_node_is_subtree_anchored(
8247                 __isl_keep isl_schedule_node *node);
8249 The following function resets the user pointers on all parameter
8250 and tuple identifiers referenced by the given schedule node.
8252         #include <isl/schedule_node.h>
8253         __isl_give isl_schedule_node *isl_schedule_node_reset_user(
8254                 __isl_take isl_schedule_node *node);
8256 The following function aligns the parameters of the given schedule
8257 node to the given space.
8259         #include <isl/schedule_node.h>
8260         __isl_give isl_schedule_node *
8261         isl_schedule_node_align_params(
8262                 __isl_take isl_schedule_node *node,
8263                 __isl_take isl_space *space);
8265 Several node types have their own functions for querying
8266 (and in some cases setting) some node type specific properties.
8268         #include <isl/schedule_node.h>
8269         __isl_give isl_space *isl_schedule_node_band_get_space(
8270                 __isl_keep isl_schedule_node *node);
8271         __isl_give isl_multi_union_pw_aff *
8272         isl_schedule_node_band_get_partial_schedule(
8273                 __isl_keep isl_schedule_node *node);
8274         __isl_give isl_union_map *
8275         isl_schedule_node_band_get_partial_schedule_union_map(
8276                 __isl_keep isl_schedule_node *node);
8277         unsigned isl_schedule_node_band_n_member(
8278                 __isl_keep isl_schedule_node *node);
8279         isl_bool isl_schedule_node_band_member_get_coincident(
8280                 __isl_keep isl_schedule_node *node, int pos);
8281         __isl_give isl_schedule_node *
8282         isl_schedule_node_band_member_set_coincident(
8283                 __isl_take isl_schedule_node *node, int pos,
8284                 int coincident);
8285         isl_bool isl_schedule_node_band_get_permutable(
8286                 __isl_keep isl_schedule_node *node);
8287         __isl_give isl_schedule_node *
8288         isl_schedule_node_band_set_permutable(
8289                 __isl_take isl_schedule_node *node, int permutable);
8290         enum isl_ast_loop_type
8291         isl_schedule_node_band_member_get_ast_loop_type(
8292                 __isl_keep isl_schedule_node *node, int pos);
8293         __isl_give isl_schedule_node *
8294         isl_schedule_node_band_member_set_ast_loop_type(
8295                 __isl_take isl_schedule_node *node, int pos,
8296                 enum isl_ast_loop_type type);
8297         __isl_give isl_union_set *
8298         enum isl_ast_loop_type
8299         isl_schedule_node_band_member_get_isolate_ast_loop_type(
8300                 __isl_keep isl_schedule_node *node, int pos);
8301         __isl_give isl_schedule_node *
8302         isl_schedule_node_band_member_set_isolate_ast_loop_type(
8303                 __isl_take isl_schedule_node *node, int pos,
8304                 enum isl_ast_loop_type type);
8305         isl_schedule_node_band_get_ast_build_options(
8306                 __isl_keep isl_schedule_node *node);
8307         __isl_give isl_schedule_node *
8308         isl_schedule_node_band_set_ast_build_options(
8309                 __isl_take isl_schedule_node *node,
8310                 __isl_take isl_union_set *options);
8311         __isl_give isl_set *
8312         isl_schedule_node_band_get_ast_isolate_option(
8313                 __isl_keep isl_schedule_node *node);
8315 The function C<isl_schedule_node_band_get_space> returns the space
8316 of the partial schedule of the band.
8317 The function C<isl_schedule_node_band_get_partial_schedule_union_map>
8318 returns a representation of the partial schedule of the band node
8319 in the form of an C<isl_union_map>.
8320 The coincident and permutable properties are set by
8321 C<isl_schedule_constraints_compute_schedule> on the schedule tree
8322 it produces.
8323 A scheduling dimension is considered to be ``coincident''
8324 if it satisfies the coincidence constraints within its band.
8325 That is, if the dependence distances of the coincidence
8326 constraints are all zero in that direction (for fixed
8327 iterations of outer bands).
8328 A band is marked permutable if it was produced using the Pluto-like scheduler.
8329 Note that the scheduler may have to resort to a Feautrier style scheduling
8330 step even if the default scheduler is used.
8331 An C<isl_ast_loop_type> is one of C<isl_ast_loop_default>,
8332 C<isl_ast_loop_atomic>, C<isl_ast_loop_unroll> or C<isl_ast_loop_separate>.
8333 For the meaning of these loop AST generation types and the difference
8334 between the regular loop AST generation type and the isolate
8335 loop AST generation type, see L</"AST Generation Options (Schedule Tree)">.
8336 The functions C<isl_schedule_node_band_member_get_ast_loop_type>
8337 and C<isl_schedule_node_band_member_get_isolate_ast_loop_type>
8338 may return C<isl_ast_loop_error> if an error occurs.
8339 The AST build options govern how an AST is generated for
8340 the individual schedule dimensions during AST generation.
8341 See L</"AST Generation Options (Schedule Tree)">.
8342 The isolate option for the given node can be extracted from these
8343 AST build options using the function
8344 C<isl_schedule_node_band_get_ast_isolate_option>.
8346         #include <isl/schedule_node.h>
8347         __isl_give isl_set *
8348         isl_schedule_node_context_get_context(
8349                 __isl_keep isl_schedule_node *node);
8351         #include <isl/schedule_node.h>
8352         __isl_give isl_union_set *
8353         isl_schedule_node_domain_get_domain(
8354                 __isl_keep isl_schedule_node *node);
8356         #include <isl/schedule_node.h>
8357         __isl_give isl_union_map *
8358         isl_schedule_node_expansion_get_expansion(
8359                 __isl_keep isl_schedule_node *node);
8360         __isl_give isl_union_pw_multi_aff *
8361         isl_schedule_node_expansion_get_contraction(
8362                 __isl_keep isl_schedule_node *node);
8364         #include <isl/schedule_node.h>
8365         __isl_give isl_union_map *
8366         isl_schedule_node_extension_get_extension(
8367                 __isl_keep isl_schedule_node *node);
8369         #include <isl/schedule_node.h>
8370         __isl_give isl_union_set *
8371         isl_schedule_node_filter_get_filter(
8372                 __isl_keep isl_schedule_node *node);
8374         #include <isl/schedule_node.h>
8375         __isl_give isl_set *isl_schedule_node_guard_get_guard(
8376                 __isl_keep isl_schedule_node *node);
8378         #include <isl/schedule_node.h>
8379         __isl_give isl_id *isl_schedule_node_mark_get_id(
8380                 __isl_keep isl_schedule_node *node);
8382 The following functions can be used to obtain an C<isl_multi_union_pw_aff>,
8383 an C<isl_union_pw_multi_aff> or C<isl_union_map> representation of
8384 partial schedules related to the node.
8386         #include <isl/schedule_node.h>
8387         __isl_give isl_multi_union_pw_aff *
8388         isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(
8389                 __isl_keep isl_schedule_node *node);
8390         __isl_give isl_union_pw_multi_aff *
8391         isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(
8392                 __isl_keep isl_schedule_node *node);
8393         __isl_give isl_union_map *
8394         isl_schedule_node_get_prefix_schedule_union_map(
8395                 __isl_keep isl_schedule_node *node);
8396         __isl_give isl_union_map *
8397         isl_schedule_node_get_prefix_schedule_relation(
8398                 __isl_keep isl_schedule_node *node);
8399         __isl_give isl_union_map *
8400         isl_schedule_node_get_subtree_schedule_union_map(
8401                 __isl_keep isl_schedule_node *node);
8403 In particular, the functions
8404 C<isl_schedule_node_get_prefix_schedule_multi_union_pw_aff>,
8405 C<isl_schedule_node_get_prefix_schedule_union_pw_multi_aff>
8406 and C<isl_schedule_node_get_prefix_schedule_union_map>
8407 return a relative ordering on the domain elements that reach the given
8408 node determined by its ancestors.
8409 The function C<isl_schedule_node_get_prefix_schedule_relation>
8410 additionally includes the domain constraints in the result.
8411 The function C<isl_schedule_node_get_subtree_schedule_union_map>
8412 returns a representation of the partial schedule defined by the
8413 subtree rooted at the given node.
8414 If the tree contains any expansion nodes, then the subtree schedule
8415 is formulated in terms of the expanded domain elements.
8416 The tree passed to functions returning a prefix schedule
8417 may only contain extension nodes if these would not affect
8418 the result of these functions.  That is, if one of the ancestors
8419 is an extension node, then all of the domain elements that were
8420 added by the extension node need to have been filtered out
8421 by filter nodes between the extension node and the input node.
8422 The tree passed to C<isl_schedule_node_get_subtree_schedule_union_map>
8423 may not contain in extension nodes in the selected subtree.
8425 The expansion/contraction defined by an entire subtree, combining
8426 the expansions/contractions
8427 on the expansion nodes in the subtree, can be obtained using
8428 the following functions.
8430         #include <isl/schedule_node.h>
8431         __isl_give isl_union_map *
8432         isl_schedule_node_get_subtree_expansion(
8433                 __isl_keep isl_schedule_node *node);
8434         __isl_give isl_union_pw_multi_aff *
8435         isl_schedule_node_get_subtree_contraction(
8436                 __isl_keep isl_schedule_node *node);
8438 The total number of outer band members of given node, i.e.,
8439 the shared output dimension of the maps in the result
8440 of C<isl_schedule_node_get_prefix_schedule_union_map> can be obtained
8441 using the following function.
8443         #include <isl/schedule_node.h>
8444         int isl_schedule_node_get_schedule_depth(
8445                 __isl_keep isl_schedule_node *node);
8447 The following functions return the elements that reach the given node
8448 or the union of universes in the spaces that contain these elements.
8450         #include <isl/schedule_node.h>
8451         __isl_give isl_union_set *
8452         isl_schedule_node_get_domain(
8453                 __isl_keep isl_schedule_node *node);
8454         __isl_give isl_union_set *
8455         isl_schedule_node_get_universe_domain(
8456                 __isl_keep isl_schedule_node *node);
8458 The input tree of C<isl_schedule_node_get_domain>
8459 may only contain extension nodes if these would not affect
8460 the result of this function.  That is, if one of the ancestors
8461 is an extension node, then all of the domain elements that were
8462 added by the extension node need to have been filtered out
8463 by filter nodes between the extension node and the input node.
8465 The following functions can be used to introduce additional nodes
8466 in the schedule tree.  The new node is introduced at the point
8467 in the tree where the C<isl_schedule_node> points to and
8468 the results points to the new node.
8470         #include <isl/schedule_node.h>
8471         __isl_give isl_schedule_node *
8472         isl_schedule_node_insert_partial_schedule(
8473                 __isl_take isl_schedule_node *node,
8474                 __isl_take isl_multi_union_pw_aff *schedule);
8476 This function inserts a new band node with (the greatest integer
8477 part of) the given partial schedule.
8478 The subtree rooted at the given node is assumed not to have
8479 any anchored nodes.
8481         #include <isl/schedule_node.h>
8482         __isl_give isl_schedule_node *
8483         isl_schedule_node_insert_context(
8484                 __isl_take isl_schedule_node *node,
8485                 __isl_take isl_set *context);
8487 This function inserts a new context node with the given context constraints.
8489         #include <isl/schedule_node.h>
8490         __isl_give isl_schedule_node *
8491         isl_schedule_node_insert_filter(
8492                 __isl_take isl_schedule_node *node,
8493                 __isl_take isl_union_set *filter);
8495 This function inserts a new filter node with the given filter.
8496 If the original node already pointed to a filter node, then the
8497 two filter nodes are merged into one.
8499         #include <isl/schedule_node.h>
8500         __isl_give isl_schedule_node *
8501         isl_schedule_node_insert_guard(
8502                 __isl_take isl_schedule_node *node,
8503                 __isl_take isl_set *guard);
8505 This function inserts a new guard node with the given guard constraints.
8507         #include <isl/schedule_node.h>
8508         __isl_give isl_schedule_node *
8509         isl_schedule_node_insert_mark(
8510                 __isl_take isl_schedule_node *node,
8511                 __isl_take isl_id *mark);
8513 This function inserts a new mark node with the give mark identifier.
8515         #include <isl/schedule_node.h>
8516         __isl_give isl_schedule_node *
8517         isl_schedule_node_insert_sequence(
8518                 __isl_take isl_schedule_node *node,
8519                 __isl_take isl_union_set_list *filters);
8520         __isl_give isl_schedule_node *
8521         isl_schedule_node_insert_set(
8522                 __isl_take isl_schedule_node *node,
8523                 __isl_take isl_union_set_list *filters);
8525 These functions insert a new sequence or set node with the given
8526 filters as children.
8528         #include <isl/schedule_node.h>
8529         __isl_give isl_schedule_node *isl_schedule_node_group(
8530                 __isl_take isl_schedule_node *node,
8531                 __isl_take isl_id *group_id);
8533 This function introduces an expansion node in between the current
8534 node and its parent that expands instances of a space with tuple
8535 identifier C<group_id> to the original domain elements that reach
8536 the node.  The group instances are identified by the prefix schedule
8537 of those domain elements.  The ancestors of the node are adjusted
8538 to refer to the group instances instead of the original domain
8539 elements.  The return value points to the same node in the updated
8540 schedule tree as the input node, i.e., to the child of the newly
8541 introduced expansion node.  Grouping instances of different statements
8542 ensures that they will be treated as a single statement by the
8543 AST generator up to the point of the expansion node.
8545 The following function can be used to flatten a nested
8546 sequence.
8548         #include <isl/schedule_node.h>
8549         __isl_give isl_schedule_node *
8550         isl_schedule_node_sequence_splice_child(
8551                 __isl_take isl_schedule_node *node, int pos);
8553 That is, given a sequence node C<node> that has another sequence node
8554 in its child at position C<pos> (in particular, the child of that filter
8555 node is a sequence node), attach the children of that other sequence
8556 node as children of C<node>, replacing the original child at position
8557 C<pos>.
8559 The partial schedule of a band node can be scaled (down) or reduced using
8560 the following functions.
8562         #include <isl/schedule_node.h>
8563         __isl_give isl_schedule_node *
8564         isl_schedule_node_band_scale(
8565                 __isl_take isl_schedule_node *node,
8566                 __isl_take isl_multi_val *mv);
8567         __isl_give isl_schedule_node *
8568         isl_schedule_node_band_scale_down(
8569                 __isl_take isl_schedule_node *node,
8570                 __isl_take isl_multi_val *mv);
8571         __isl_give isl_schedule_node *
8572         isl_schedule_node_band_mod(
8573                 __isl_take isl_schedule_node *node,
8574                 __isl_take isl_multi_val *mv);
8576 The spaces of the two arguments need to match.
8577 After scaling, the partial schedule is replaced by its greatest
8578 integer part to ensure that the schedule remains integral.
8580 The partial schedule of a band node can be shifted by an
8581 C<isl_multi_union_pw_aff> with a domain that is a superset
8582 of the domain of the partial schedule using
8583 the following function.
8585         #include <isl/schedule_node.h>
8586         __isl_give isl_schedule_node *
8587         isl_schedule_node_band_shift(
8588                 __isl_take isl_schedule_node *node,
8589                 __isl_take isl_multi_union_pw_aff *shift);
8591 A band node can be tiled using the following function.
8593         #include <isl/schedule_node.h>
8594         __isl_give isl_schedule_node *isl_schedule_node_band_tile(
8595                 __isl_take isl_schedule_node *node,
8596                 __isl_take isl_multi_val *sizes);
8598         isl_stat isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
8599                 int val);
8600         int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
8601         isl_stat isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
8602                 int val);
8603         int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
8605 The C<isl_schedule_node_band_tile> function tiles
8606 the band using the given tile sizes inside its schedule.
8607 A new child band node is created to represent the point loops and it is
8608 inserted between the modified band and its children.
8609 The subtree rooted at the given node is assumed not to have
8610 any anchored nodes.
8611 The C<tile_scale_tile_loops> option specifies whether the tile
8612 loops iterators should be scaled by the tile sizes.
8613 If the C<tile_shift_point_loops> option is set, then the point loops
8614 are shifted to start at zero.
8616 A band node can be split into two nested band nodes
8617 using the following function.
8619         #include <isl/schedule_node.h>
8620         __isl_give isl_schedule_node *isl_schedule_node_band_split(
8621                 __isl_take isl_schedule_node *node, int pos);
8623 The resulting outer band node contains the first C<pos> dimensions of
8624 the schedule of C<node> while the inner band contains the remaining dimensions.
8625 The schedules of the two band nodes live in anonymous spaces.
8626 The loop AST generation type options and the isolate option
8627 are split over the the two band nodes.
8629 A band node can be moved down to the leaves of the subtree rooted
8630 at the band node using the following function.
8632         #include <isl/schedule_node.h>
8633         __isl_give isl_schedule_node *isl_schedule_node_band_sink(
8634                 __isl_take isl_schedule_node *node);
8636 The subtree rooted at the given node is assumed not to have
8637 any anchored nodes.
8638 The result points to the node in the resulting tree that is in the same
8639 position as the node pointed to by C<node> in the original tree.
8641         #include <isl/schedule_node.h>
8642         __isl_give isl_schedule_node *
8643         isl_schedule_node_order_before(
8644                 __isl_take isl_schedule_node *node,
8645                 __isl_take isl_union_set *filter);
8646         __isl_give isl_schedule_node *
8647         isl_schedule_node_order_after(
8648                 __isl_take isl_schedule_node *node,
8649                 __isl_take isl_union_set *filter);
8651 These functions split the domain elements that reach C<node>
8652 into those that satisfy C<filter> and those that do not and
8653 arranges for the elements that do satisfy the filter to be
8654 executed before (in case of C<isl_schedule_node_order_before>)
8655 or after (in case of C<isl_schedule_node_order_after>)
8656 those that do not.  The order is imposed by
8657 a sequence node, possibly reusing the grandparent of C<node>
8658 on two copies of the subtree attached to the original C<node>.
8659 Both copies are simplified with respect to their filter.
8661 Return a pointer to the copy of the subtree that does not
8662 satisfy C<filter>.  If there is no such copy (because all
8663 reaching domain elements satisfy the filter), then return
8664 the original pointer.
8666         #include <isl/schedule_node.h>
8667         __isl_give isl_schedule_node *
8668         isl_schedule_node_graft_before(
8669                 __isl_take isl_schedule_node *node,
8670                 __isl_take isl_schedule_node *graft);
8671         __isl_give isl_schedule_node *
8672         isl_schedule_node_graft_after(
8673                 __isl_take isl_schedule_node *node,
8674                 __isl_take isl_schedule_node *graft);
8676 This function inserts the C<graft> tree into the tree containing C<node>
8677 such that it is executed before (in case of C<isl_schedule_node_graft_before>)
8678 or after (in case of C<isl_schedule_node_graft_after>) C<node>.
8679 The root node of C<graft>
8680 should be an extension node where the domain of the extension
8681 is the flat product of all outer band nodes of C<node>.
8682 The root node may also be a domain node.
8683 The elements of the domain or the range of the extension may not
8684 intersect with the domain elements that reach "node".
8685 The schedule tree of C<graft> may not be anchored.
8687 The schedule tree of C<node> is modified to include an extension node
8688 corresponding to the root node of C<graft> as a child of the original
8689 parent of C<node>.  The original node that C<node> points to and the
8690 child of the root node of C<graft> are attached to this extension node
8691 through a sequence, with appropriate filters and with the child
8692 of C<graft> appearing before or after the original C<node>.
8694 If C<node> already appears inside a sequence that is the child of
8695 an extension node and if the spaces of the new domain elements
8696 do not overlap with those of the original domain elements,
8697 then that extension node is extended with the new extension
8698 rather than introducing a new segment of extension and sequence nodes.
8700 Return a pointer to the same node in the modified tree that
8701 C<node> pointed to in the original tree.
8703 A representation of the schedule node can be printed using
8705         #include <isl/schedule_node.h>
8706         __isl_give isl_printer *isl_printer_print_schedule_node(
8707                 __isl_take isl_printer *p,
8708                 __isl_keep isl_schedule_node *node);
8709         __isl_give char *isl_schedule_node_to_str(
8710                 __isl_keep isl_schedule_node *node);
8712 C<isl_schedule_node_to_str> prints the schedule node in block format.
8714 =head2 Dependence Analysis
8716 C<isl> contains specialized functionality for performing
8717 array dataflow analysis.  That is, given a I<sink> access relation
8718 and a collection of possible I<source> access relations,
8719 C<isl> can compute relations that describe
8720 for each iteration of the sink access, which iteration
8721 of which of the source access relations was the last
8722 to access the same data element before the given iteration
8723 of the sink access.
8724 The resulting dependence relations map source iterations
8725 to either the corresponding sink iterations or
8726 pairs of corresponding sink iterations and accessed data elements.
8727 To compute standard flow dependences, the sink should be
8728 a read, while the sources should be writes.
8729 If any of the source accesses are marked as being I<may>
8730 accesses, then there will be a (may) dependence from the last
8731 I<must> access B<and> from any I<may> access that follows
8732 this last I<must> access, but still precedes the sink access.
8733 Only dependences originating in a must access and without
8734 any may accesses between the must access and the sink access
8735 are considered to be must dependences.
8736 In particular, if I<all> sources are I<may> accesses,
8737 then memory based dependence analysis is performed.
8738 If, on the other hand, all sources are I<must> accesses,
8739 then value based dependence analysis is performed.
8741 =head3 High-level Interface
8743 A high-level interface to dependence analysis is provided
8744 by the following function.
8746         #include <isl/flow.h>
8747         __isl_give isl_union_flow *
8748         isl_union_access_info_compute_flow(
8749                 __isl_take isl_union_access_info *access);
8751 The input C<isl_union_access_info> object describes the sink
8752 access relations, the source access relations and a schedule,
8753 while the output C<isl_union_flow> object describes
8754 the resulting dependence relations and the subsets of the
8755 sink relations for which no source was found.
8757 An C<isl_union_access_info> is created, modified, copied and freed using
8758 the following functions.
8760         #include <isl/flow.h>
8761         __isl_give isl_union_access_info *
8762         isl_union_access_info_from_sink(
8763                 __isl_take isl_union_map *sink);
8764         __isl_give isl_union_access_info *
8765         isl_union_access_info_set_must_source(
8766                 __isl_take isl_union_access_info *access,
8767                 __isl_take isl_union_map *must_source);
8768         __isl_give isl_union_access_info *
8769         isl_union_access_info_set_may_source(
8770                 __isl_take isl_union_access_info *access,
8771                 __isl_take isl_union_map *may_source);
8772         __isl_give isl_union_access_info *
8773         isl_union_access_info_set_schedule(
8774                 __isl_take isl_union_access_info *access,
8775                 __isl_take isl_schedule *schedule);
8776         __isl_give isl_union_access_info *
8777         isl_union_access_info_set_schedule_map(
8778                 __isl_take isl_union_access_info *access,
8779                 __isl_take isl_union_map *schedule_map);
8780         __isl_give isl_union_access_info *
8781         isl_union_access_info_copy(
8782                 __isl_keep isl_union_access_info *access);
8783         __isl_null isl_union_access_info *
8784         isl_union_access_info_free(
8785                 __isl_take isl_union_access_info *access);
8787 The may sources set by C<isl_union_access_info_set_may_source>
8788 do not need to include the must sources set by
8789 C<isl_union_access_info_set_must_source> as a subset.
8790 The user is free not to call one (or both) of these functions,
8791 in which case the corresponding set is kept to its empty default.
8792 Similarly, the default schedule initialized by
8793 C<isl_union_access_info_from_sink> is empty.
8794 The current schedule is determined by the last call to either
8795 C<isl_union_access_info_set_schedule> or
8796 C<isl_union_access_info_set_schedule_map>.
8797 The domain of the schedule corresponds to the domains of
8798 the access relations.  In particular, the domains of the access
8799 relations are effectively intersected with the domain of the schedule
8800 and only the resulting accesses are considered by the dependence analysis.
8802 A representation of the information contained in an object
8803 of type C<isl_union_access_info> can be obtained using
8805         #include <isl/flow.h>
8806         __isl_give isl_printer *
8807         isl_printer_print_union_access_info(
8808                 __isl_take isl_printer *p,
8809                 __isl_keep isl_union_access_info *access);
8810         __isl_give char *isl_union_access_info_to_str(
8811                 __isl_keep isl_union_access_info *access);
8813 C<isl_union_access_info_to_str> prints the information in flow format.
8815 The output of C<isl_union_access_info_compute_flow> can be examined,
8816 copied, and freed using the following functions.
8818         #include <isl/flow.h>
8819         __isl_give isl_union_map *isl_union_flow_get_must_dependence(
8820                 __isl_keep isl_union_flow *flow);
8821         __isl_give isl_union_map *isl_union_flow_get_may_dependence(
8822                 __isl_keep isl_union_flow *flow);
8823         __isl_give isl_union_map *
8824         isl_union_flow_get_full_must_dependence(
8825                 __isl_keep isl_union_flow *flow);
8826         __isl_give isl_union_map *
8827         isl_union_flow_get_full_may_dependence(
8828                 __isl_keep isl_union_flow *flow);
8829         __isl_give isl_union_map *isl_union_flow_get_must_no_source(
8830                 __isl_keep isl_union_flow *flow);
8831         __isl_give isl_union_map *isl_union_flow_get_may_no_source(
8832                 __isl_keep isl_union_flow *flow);
8833         __isl_give isl_union_flow *isl_union_flow_copy(
8834                 __isl_keep isl_union_flow *flow);
8835         __isl_null isl_union_flow *isl_union_flow_free(
8836                 __isl_take isl_union_flow *flow);
8838 The relation returned by C<isl_union_flow_get_must_dependence>
8839 relates domain elements of must sources to domain elements of the sink.
8840 The relation returned by C<isl_union_flow_get_may_dependence>
8841 relates domain elements of must or may sources to domain elements of the sink
8842 and includes the previous relation as a subset.
8843 The relation returned by C<isl_union_flow_get_full_must_dependence>
8844 relates domain elements of must sources to pairs of domain elements of the sink
8845 and accessed data elements.
8846 The relation returned by C<isl_union_flow_get_full_may_dependence>
8847 relates domain elements of must or may sources to pairs of
8848 domain elements of the sink and accessed data elements.
8849 This relation includes the previous relation as a subset.
8850 The relation returned by C<isl_union_flow_get_must_no_source> is the subset
8851 of the sink relation for which no dependences have been found.
8852 The relation returned by C<isl_union_flow_get_may_no_source> is the subset
8853 of the sink relation for which no definite dependences have been found.
8854 That is, it contains those sink access that do not contribute to any
8855 of the elements in the relation returned
8856 by C<isl_union_flow_get_must_dependence>.
8858 A representation of the information contained in an object
8859 of type C<isl_union_flow> can be obtained using
8861         #include <isl/flow.h>
8862         __isl_give isl_printer *isl_printer_print_union_flow(
8863                 __isl_take isl_printer *p,
8864                 __isl_keep isl_union_flow *flow);
8865         __isl_give char *isl_union_flow_to_str(
8866                 __isl_keep isl_union_flow *flow);
8868 C<isl_union_flow_to_str> prints the information in flow format.
8870 =head3 Low-level Interface
8872 A lower-level interface is provided by the following functions.
8874         #include <isl/flow.h>
8876         typedef int (*isl_access_level_before)(void *first, void *second);
8878         __isl_give isl_access_info *isl_access_info_alloc(
8879                 __isl_take isl_map *sink,
8880                 void *sink_user, isl_access_level_before fn,
8881                 int max_source);
8882         __isl_give isl_access_info *isl_access_info_add_source(
8883                 __isl_take isl_access_info *acc,
8884                 __isl_take isl_map *source, int must,
8885                 void *source_user);
8886         __isl_null isl_access_info *isl_access_info_free(
8887                 __isl_take isl_access_info *acc);
8889         __isl_give isl_flow *isl_access_info_compute_flow(
8890                 __isl_take isl_access_info *acc);
8892         isl_stat isl_flow_foreach(__isl_keep isl_flow *deps,
8893                 isl_stat (*fn)(__isl_take isl_map *dep, int must,
8894                           void *dep_user, void *user),
8895                 void *user);
8896         __isl_give isl_map *isl_flow_get_no_source(
8897                 __isl_keep isl_flow *deps, int must);
8898         void isl_flow_free(__isl_take isl_flow *deps);
8900 The function C<isl_access_info_compute_flow> performs the actual
8901 dependence analysis.  The other functions are used to construct
8902 the input for this function or to read off the output.
8904 The input is collected in an C<isl_access_info>, which can
8905 be created through a call to C<isl_access_info_alloc>.
8906 The arguments to this functions are the sink access relation
8907 C<sink>, a token C<sink_user> used to identify the sink
8908 access to the user, a callback function for specifying the
8909 relative order of source and sink accesses, and the number
8910 of source access relations that will be added.
8911 The callback function has type C<int (*)(void *first, void *second)>.
8912 The function is called with two user supplied tokens identifying
8913 either a source or the sink and it should return the shared nesting
8914 level and the relative order of the two accesses.
8915 In particular, let I<n> be the number of loops shared by
8916 the two accesses.  If C<first> precedes C<second> textually,
8917 then the function should return I<2 * n + 1>; otherwise,
8918 it should return I<2 * n>.
8919 The sources can be added to the C<isl_access_info> by performing
8920 (at most) C<max_source> calls to C<isl_access_info_add_source>.
8921 C<must> indicates whether the source is a I<must> access
8922 or a I<may> access.  Note that a multi-valued access relation
8923 should only be marked I<must> if every iteration in the domain
8924 of the relation accesses I<all> elements in its image.
8925 The C<source_user> token is again used to identify
8926 the source access.  The range of the source access relation
8927 C<source> should have the same dimension as the range
8928 of the sink access relation.
8929 The C<isl_access_info_free> function should usually not be
8930 called explicitly, because it is called implicitly by
8931 C<isl_access_info_compute_flow>.
8933 The result of the dependence analysis is collected in an
8934 C<isl_flow>.  There may be elements of
8935 the sink access for which no preceding source access could be
8936 found or for which all preceding sources are I<may> accesses.
8937 The relations containing these elements can be obtained through
8938 calls to C<isl_flow_get_no_source>, the first with C<must> set
8939 and the second with C<must> unset.
8940 In the case of standard flow dependence analysis,
8941 with the sink a read and the sources I<must> writes,
8942 the first relation corresponds to the reads from uninitialized
8943 array elements and the second relation is empty.
8944 The actual flow dependences can be extracted using
8945 C<isl_flow_foreach>.  This function will call the user-specified
8946 callback function C<fn> for each B<non-empty> dependence between
8947 a source and the sink.  The callback function is called
8948 with four arguments, the actual flow dependence relation
8949 mapping source iterations to sink iterations, a boolean that
8950 indicates whether it is a I<must> or I<may> dependence, a token
8951 identifying the source and an additional C<void *> with value
8952 equal to the third argument of the C<isl_flow_foreach> call.
8953 A dependence is marked I<must> if it originates from a I<must>
8954 source and if it is not followed by any I<may> sources.
8956 After finishing with an C<isl_flow>, the user should call
8957 C<isl_flow_free> to free all associated memory.
8959 =head3 Interaction with the Low-level Interface
8961 During the dependence analysis, we frequently need to perform
8962 the following operation.  Given a relation between sink iterations
8963 and potential source iterations from a particular source domain,
8964 what is the last potential source iteration corresponding to each
8965 sink iteration.  It can sometimes be convenient to adjust
8966 the set of potential source iterations before or after each such operation.
8967 The prototypical example is fuzzy array dataflow analysis,
8968 where we need to analyze if, based on data-dependent constraints,
8969 the sink iteration can ever be executed without one or more of
8970 the corresponding potential source iterations being executed.
8971 If so, we can introduce extra parameters and select an unknown
8972 but fixed source iteration from the potential source iterations.
8973 To be able to perform such manipulations, C<isl> provides the following
8974 function.
8976         #include <isl/flow.h>
8978         typedef __isl_give isl_restriction *(*isl_access_restrict)(
8979                 __isl_keep isl_map *source_map,
8980                 __isl_keep isl_set *sink, void *source_user,
8981                 void *user);
8982         __isl_give isl_access_info *isl_access_info_set_restrict(
8983                 __isl_take isl_access_info *acc,
8984                 isl_access_restrict fn, void *user);
8986 The function C<isl_access_info_set_restrict> should be called
8987 before calling C<isl_access_info_compute_flow> and registers a callback function
8988 that will be called any time C<isl> is about to compute the last
8989 potential source.  The first argument is the (reverse) proto-dependence,
8990 mapping sink iterations to potential source iterations.
8991 The second argument represents the sink iterations for which
8992 we want to compute the last source iteration.
8993 The third argument is the token corresponding to the source
8994 and the final argument is the token passed to C<isl_access_info_set_restrict>.
8995 The callback is expected to return a restriction on either the input or
8996 the output of the operation computing the last potential source.
8997 If the input needs to be restricted then restrictions are needed
8998 for both the source and the sink iterations.  The sink iterations
8999 and the potential source iterations will be intersected with these sets.
9000 If the output needs to be restricted then only a restriction on the source
9001 iterations is required.
9002 If any error occurs, the callback should return C<NULL>.
9003 An C<isl_restriction> object can be created, freed and inspected
9004 using the following functions.
9006         #include <isl/flow.h>
9008         __isl_give isl_restriction *isl_restriction_input(
9009                 __isl_take isl_set *source_restr,
9010                 __isl_take isl_set *sink_restr);
9011         __isl_give isl_restriction *isl_restriction_output(
9012                 __isl_take isl_set *source_restr);
9013         __isl_give isl_restriction *isl_restriction_none(
9014                 __isl_take isl_map *source_map);
9015         __isl_give isl_restriction *isl_restriction_empty(
9016                 __isl_take isl_map *source_map);
9017         __isl_null isl_restriction *isl_restriction_free(
9018                 __isl_take isl_restriction *restr);
9020 C<isl_restriction_none> and C<isl_restriction_empty> are special
9021 cases of C<isl_restriction_input>.  C<isl_restriction_none>
9022 is essentially equivalent to
9024         isl_restriction_input(isl_set_universe(
9025             isl_space_range(isl_map_get_space(source_map))),
9026                             isl_set_universe(
9027             isl_space_domain(isl_map_get_space(source_map))));
9029 whereas C<isl_restriction_empty> is essentially equivalent to
9031         isl_restriction_input(isl_set_empty(
9032             isl_space_range(isl_map_get_space(source_map))),
9033                             isl_set_universe(
9034             isl_space_domain(isl_map_get_space(source_map))));
9036 =head2 Scheduling
9038         #include <isl/schedule.h>
9039         __isl_give isl_schedule *
9040         isl_schedule_constraints_compute_schedule(
9041                 __isl_take isl_schedule_constraints *sc);
9043 The function C<isl_schedule_constraints_compute_schedule> can be
9044 used to compute a schedule that satisfies the given schedule constraints.
9045 These schedule constraints include the iteration domain for which
9046 a schedule should be computed and dependences between pairs of
9047 iterations.  In particular, these dependences include
9048 I<validity> dependences and I<proximity> dependences.
9049 By default, the algorithm used to construct the schedule is similar
9050 to that of C<Pluto>.
9051 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
9052 be selected.
9053 The generated schedule respects all validity dependences.
9054 That is, all dependence distances over these dependences in the
9055 scheduled space are lexicographically positive.
9057 The default algorithm tries to ensure that the dependence distances
9058 over coincidence constraints are zero and to minimize the
9059 dependence distances over proximity dependences.
9060 Moreover, it tries to obtain sequences (bands) of schedule dimensions
9061 for groups of domains where the dependence distances over validity
9062 dependences have only non-negative values.
9063 Note that when minimizing the maximal dependence distance
9064 over proximity dependences, a single affine expression in the parameters
9065 is constructed that bounds all dependence distances.  If no such expression
9066 exists, then the algorithm will fail and resort to an alternative
9067 scheduling algorithm.  In particular, this means that adding proximity
9068 dependences may eliminate valid solutions.  A typical example where this
9069 phenomenon may occur is when some subset of the proximity dependences
9070 has no restriction on some parameter, forcing the coefficient of that
9071 parameter to be zero, while some other subset forces the dependence
9072 distance to depend on that parameter, requiring the same coefficient
9073 to be non-zero.
9074 When using Feautrier's algorithm, the coincidence and proximity constraints
9075 are only taken into account during the extension to a
9076 full-dimensional schedule.
9078 An C<isl_schedule_constraints> object can be constructed
9079 and manipulated using the following functions.
9081         #include <isl/schedule.h>
9082         __isl_give isl_schedule_constraints *
9083         isl_schedule_constraints_copy(
9084                 __isl_keep isl_schedule_constraints *sc);
9085         __isl_give isl_schedule_constraints *
9086         isl_schedule_constraints_on_domain(
9087                 __isl_take isl_union_set *domain);
9088         __isl_give isl_schedule_constraints *
9089         isl_schedule_constraints_set_context(
9090                 __isl_take isl_schedule_constraints *sc,
9091                 __isl_take isl_set *context);
9092         __isl_give isl_schedule_constraints *
9093         isl_schedule_constraints_set_validity(
9094                 __isl_take isl_schedule_constraints *sc,
9095                 __isl_take isl_union_map *validity);
9096         __isl_give isl_schedule_constraints *
9097         isl_schedule_constraints_set_coincidence(
9098                 __isl_take isl_schedule_constraints *sc,
9099                 __isl_take isl_union_map *coincidence);
9100         __isl_give isl_schedule_constraints *
9101         isl_schedule_constraints_set_proximity(
9102                 __isl_take isl_schedule_constraints *sc,
9103                 __isl_take isl_union_map *proximity);
9104         __isl_give isl_schedule_constraints *
9105         isl_schedule_constraints_set_conditional_validity(
9106                 __isl_take isl_schedule_constraints *sc,
9107                 __isl_take isl_union_map *condition,
9108                 __isl_take isl_union_map *validity);
9109         __isl_give isl_schedule_constraints *
9110         isl_schedule_constraints_apply(
9111                 __isl_take isl_schedule_constraints *sc,
9112                 __isl_take isl_union_map *umap);
9113         __isl_null isl_schedule_constraints *
9114         isl_schedule_constraints_free(
9115                 __isl_take isl_schedule_constraints *sc);
9117 The initial C<isl_schedule_constraints> object created by
9118 C<isl_schedule_constraints_on_domain> does not impose any constraints.
9119 That is, it has an empty set of dependences.
9120 The function C<isl_schedule_constraints_set_context> allows the user
9121 to specify additional constraints on the parameters that may
9122 be assumed to hold during the construction of the schedule.
9123 The function C<isl_schedule_constraints_set_validity> replaces the
9124 validity dependences, mapping domain elements I<i> to domain
9125 elements that should be scheduled after I<i>.
9126 The function C<isl_schedule_constraints_set_coincidence> replaces the
9127 coincidence dependences, mapping domain elements I<i> to domain
9128 elements that should be scheduled together with I<I>, if possible.
9129 The function C<isl_schedule_constraints_set_proximity> replaces the
9130 proximity dependences, mapping domain elements I<i> to domain
9131 elements that should be scheduled either before I<I>
9132 or as early as possible after I<i>.
9134 The function C<isl_schedule_constraints_set_conditional_validity>
9135 replaces the conditional validity constraints.
9136 A conditional validity constraint is only imposed when any of the corresponding
9137 conditions is satisfied, i.e., when any of them is non-zero.
9138 That is, the scheduler ensures that within each band if the dependence
9139 distances over the condition constraints are not all zero
9140 then all corresponding conditional validity constraints are respected.
9141 A conditional validity constraint corresponds to a condition
9142 if the two are adjacent, i.e., if the domain of one relation intersect
9143 the range of the other relation.
9144 The typical use case of conditional validity constraints is
9145 to allow order constraints between live ranges to be violated
9146 as long as the live ranges themselves are local to the band.
9147 To allow more fine-grained control over which conditions correspond
9148 to which conditional validity constraints, the domains and ranges
9149 of these relations may include I<tags>.  That is, the domains and
9150 ranges of those relation may themselves be wrapped relations
9151 where the iteration domain appears in the domain of those wrapped relations
9152 and the range of the wrapped relations can be arbitrarily chosen
9153 by the user.  Conditions and conditional validity constraints are only
9154 considered adjacent to each other if the entire wrapped relation matches.
9155 In particular, a relation with a tag will never be considered adjacent
9156 to a relation without a tag.
9158 The function C<isl_schedule_constraints_compute_schedule> takes
9159 schedule constraints that are defined on some set of domain elements
9160 and transforms them to schedule constraints on the elements
9161 to which these domain elements are mapped by the given transformation.
9163 An C<isl_schedule_constraints> object can be inspected
9164 using the following functions.
9166         #include <isl/schedule.h>
9167         __isl_give isl_union_set *
9168         isl_schedule_constraints_get_domain(
9169                 __isl_keep isl_schedule_constraints *sc);
9170         __isl_give isl_set *isl_schedule_constraints_get_context(
9171                 __isl_keep isl_schedule_constraints *sc);
9172         __isl_give isl_union_map *
9173         isl_schedule_constraints_get_validity(
9174                 __isl_keep isl_schedule_constraints *sc);
9175         __isl_give isl_union_map *
9176         isl_schedule_constraints_get_coincidence(
9177                 __isl_keep isl_schedule_constraints *sc);
9178         __isl_give isl_union_map *
9179         isl_schedule_constraints_get_proximity(
9180                 __isl_keep isl_schedule_constraints *sc);
9181         __isl_give isl_union_map *
9182         isl_schedule_constraints_get_conditional_validity(
9183                 __isl_keep isl_schedule_constraints *sc);
9184         __isl_give isl_union_map *
9185         isl_schedule_constraints_get_conditional_validity_condition(
9186                 __isl_keep isl_schedule_constraints *sc);
9188 An C<isl_schedule_constraints> object can be read from input
9189 using the following functions.
9191         #include <isl/schedule.h>
9192         __isl_give isl_schedule_constraints *
9193         isl_schedule_constraints_read_from_str(isl_ctx *ctx,
9194                 const char *str);
9195         __isl_give isl_schedule_constraints *
9196         isl_schedule_constraints_read_from_file(isl_ctx *ctx,
9197                 FILE *input);
9199 The contents of an C<isl_schedule_constraints> object can be printed
9200 using the following functions.
9202         #include <isl/schedule.h>
9203         __isl_give isl_printer *
9204         isl_printer_print_schedule_constraints(
9205                 __isl_take isl_printer *p,
9206                 __isl_keep isl_schedule_constraints *sc);
9207         __isl_give char *isl_schedule_constraints_to_str(
9208                 __isl_keep isl_schedule_constraints *sc);
9210 The following function computes a schedule directly from
9211 an iteration domain and validity and proximity dependences
9212 and is implemented in terms of the functions described above.
9213 The use of C<isl_union_set_compute_schedule> is discouraged.
9215         #include <isl/schedule.h>
9216         __isl_give isl_schedule *isl_union_set_compute_schedule(
9217                 __isl_take isl_union_set *domain,
9218                 __isl_take isl_union_map *validity,
9219                 __isl_take isl_union_map *proximity);
9221 The generated schedule represents a schedule tree.
9222 For more information on schedule trees, see
9223 L</"Schedule Trees">.
9225 =head3 Options
9227         #include <isl/schedule.h>
9228         isl_stat isl_options_set_schedule_max_coefficient(
9229                 isl_ctx *ctx, int val);
9230         int isl_options_get_schedule_max_coefficient(
9231                 isl_ctx *ctx);
9232         isl_stat isl_options_set_schedule_max_constant_term(
9233                 isl_ctx *ctx, int val);
9234         int isl_options_get_schedule_max_constant_term(
9235                 isl_ctx *ctx);
9236         isl_stat isl_options_set_schedule_serialize_sccs(
9237                 isl_ctx *ctx, int val);
9238         int isl_options_get_schedule_serialize_sccs(isl_ctx *ctx);
9239         isl_stat isl_options_set_schedule_whole_component(
9240                 isl_ctx *ctx, int val);
9241         int isl_options_get_schedule_whole_component(
9242                 isl_ctx *ctx);
9243         isl_stat isl_options_set_schedule_maximize_band_depth(
9244                 isl_ctx *ctx, int val);
9245         int isl_options_get_schedule_maximize_band_depth(
9246                 isl_ctx *ctx);
9247         isl_stat isl_options_set_schedule_maximize_coincidence(
9248                 isl_ctx *ctx, int val);
9249         int isl_options_get_schedule_maximize_coincidence(
9250                 isl_ctx *ctx);
9251         isl_stat isl_options_set_schedule_outer_coincidence(
9252                 isl_ctx *ctx, int val);
9253         int isl_options_get_schedule_outer_coincidence(
9254                 isl_ctx *ctx);
9255         isl_stat isl_options_set_schedule_split_scaled(
9256                 isl_ctx *ctx, int val);
9257         int isl_options_get_schedule_split_scaled(
9258                 isl_ctx *ctx);
9259         isl_stat isl_options_set_schedule_treat_coalescing(
9260                 isl_ctx *ctx, int val);
9261         int isl_options_get_schedule_treat_coalescing(
9262                 isl_ctx *ctx);
9263         isl_stat isl_options_set_schedule_algorithm(
9264                 isl_ctx *ctx, int val);
9265         int isl_options_get_schedule_algorithm(
9266                 isl_ctx *ctx);
9267         isl_stat isl_options_set_schedule_separate_components(
9268                 isl_ctx *ctx, int val);
9269         int isl_options_get_schedule_separate_components(
9270                 isl_ctx *ctx);
9272 =over
9274 =item * schedule_max_coefficient
9276 This option enforces that the coefficients for variable and parameter
9277 dimensions in the calculated schedule are not larger than the specified value.
9278 This option can significantly increase the speed of the scheduling calculation
9279 and may also prevent fusing of unrelated dimensions. A value of -1 means that
9280 this option does not introduce bounds on the variable or parameter
9281 coefficients.
9283 =item * schedule_max_constant_term
9285 This option enforces that the constant coefficients in the calculated schedule
9286 are not larger than the maximal constant term. This option can significantly
9287 increase the speed of the scheduling calculation and may also prevent fusing of
9288 unrelated dimensions. A value of -1 means that this option does not introduce
9289 bounds on the constant coefficients.
9291 =item * schedule_serialize_sccs
9293 If this option is set, then all strongly connected components
9294 in the dependence graph are serialized as soon as they are detected.
9295 This means in particular that instances of statements will only
9296 appear in the same band node if these statements belong
9297 to the same strongly connected component at the point where
9298 the band node is constructed.
9300 =item * schedule_whole_component
9302 If this option is set, then entire (weakly) connected
9303 components in the dependence graph are scheduled together
9304 as a whole.
9305 Otherwise, each strongly connected component within
9306 such a weakly connected component is first scheduled separately
9307 and then combined with other strongly connected components.
9308 This option has no effect if C<schedule_serialize_sccs> is set.
9310 =item * schedule_maximize_band_depth
9312 If this option is set, then the scheduler tries to maximize
9313 the width of the bands.  Wider bands give more possibilities for tiling.
9314 In particular, if the C<schedule_whole_component> option is set,
9315 then bands are split if this might result in wider bands.
9316 Otherwise, the effect of this option is to only allow
9317 strongly connected components to be combined if this does
9318 not reduce the width of the bands.
9319 Note that if the C<schedule_serialize_sccs> options is set, then
9320 the C<schedule_maximize_band_depth> option therefore has no effect.
9322 =item * schedule_maximize_coincidence
9324 This option is only effective if the C<schedule_whole_component>
9325 option is turned off.
9326 If the C<schedule_maximize_coincidence> option is set, then (clusters of)
9327 strongly connected components are only combined with each other
9328 if this does not reduce the number of coincident band members.
9330 =item * schedule_outer_coincidence
9332 If this option is set, then we try to construct schedules
9333 where the outermost scheduling dimension in each band
9334 satisfies the coincidence constraints.
9336 =item * schedule_algorithm
9338 Selects the scheduling algorithm to be used.
9339 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
9340 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
9342 =item * schedule_split_scaled
9344 If this option is set, then we try to construct schedules in which the
9345 constant term is split off from the linear part if the linear parts of
9346 the scheduling rows for all nodes in the graphs have a common non-trivial
9347 divisor.
9348 The constant term is then placed in a separate band and the linear
9349 part is reduced.
9350 This option is only effective when the Feautrier style scheduler is
9351 being used, either as the main scheduler or as a fallback for the
9352 Pluto-like scheduler.
9354 =item * schedule_treat_coalescing
9356 If this option is set, then the scheduler will try and avoid
9357 producing schedules that perform loop coalescing.
9358 In particular, for the Pluto-like scheduler, this option places
9359 bounds on the schedule coefficients based on the sizes of the instance sets.
9360 For the Feautrier style scheduler, this option detects potentially
9361 coalescing schedules and then tries to adjust the schedule to avoid
9362 the coalescing.
9364 =item * schedule_separate_components
9366 If this option is set then the function C<isl_schedule_get_map>
9367 will treat set nodes in the same way as sequence nodes.
9369 =back
9371 =head2 AST Generation
9373 This section describes the C<isl> functionality for generating
9374 ASTs that visit all the elements
9375 in a domain in an order specified by a schedule tree or
9376 a schedule map.
9377 In case the schedule given as a C<isl_union_map>, an AST is generated
9378 that visits all the elements in the domain of the C<isl_union_map>
9379 according to the lexicographic order of the corresponding image
9380 element(s).  If the range of the C<isl_union_map> consists of
9381 elements in more than one space, then each of these spaces is handled
9382 separately in an arbitrary order.
9383 It should be noted that the schedule tree or the image elements
9384 in a schedule map only specify the I<order>
9385 in which the corresponding domain elements should be visited.
9386 No direct relation between the partial schedule values
9387 or the image elements on the one hand and the loop iterators
9388 in the generated AST on the other hand should be assumed.
9390 Each AST is generated within a build.  The initial build
9391 simply specifies the constraints on the parameters (if any)
9392 and can be created, inspected, copied and freed using the following functions.
9394         #include <isl/ast_build.h>
9395         __isl_give isl_ast_build *isl_ast_build_alloc(
9396                 isl_ctx *ctx);
9397         __isl_give isl_ast_build *isl_ast_build_from_context(
9398                 __isl_take isl_set *set);
9399         __isl_give isl_ast_build *isl_ast_build_copy(
9400                 __isl_keep isl_ast_build *build);
9401         __isl_null isl_ast_build *isl_ast_build_free(
9402                 __isl_take isl_ast_build *build);
9404 The C<set> argument is usually a parameter set with zero or more parameters.
9405 In fact, when creating an AST using C<isl_ast_build_node_from_schedule>,
9406 this set is required to be a parameter set.
9407 An C<isl_ast_build> created using C<isl_ast_build_alloc> does not
9408 specify any parameter constraints.
9409 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
9410 and L</"Fine-grained Control over AST Generation">.
9411 Finally, the AST itself can be constructed using one of the following
9412 functions.
9414         #include <isl/ast_build.h>
9415         __isl_give isl_ast_node *isl_ast_build_node_from_schedule(
9416                 __isl_keep isl_ast_build *build,
9417                 __isl_take isl_schedule *schedule);
9418         __isl_give isl_ast_node *
9419         isl_ast_build_node_from_schedule_map(
9420                 __isl_keep isl_ast_build *build,
9421                 __isl_take isl_union_map *schedule);
9423 =head3 Inspecting the AST
9425 The basic properties of an AST node can be obtained as follows.
9427         #include <isl/ast.h>
9428         enum isl_ast_node_type isl_ast_node_get_type(
9429                 __isl_keep isl_ast_node *node);
9431 The type of an AST node is one of
9432 C<isl_ast_node_for>,
9433 C<isl_ast_node_if>,
9434 C<isl_ast_node_block>,
9435 C<isl_ast_node_mark> or
9436 C<isl_ast_node_user>.
9437 An C<isl_ast_node_for> represents a for node.
9438 An C<isl_ast_node_if> represents an if node.
9439 An C<isl_ast_node_block> represents a compound node.
9440 An C<isl_ast_node_mark> introduces a mark in the AST.
9441 An C<isl_ast_node_user> represents an expression statement.
9442 An expression statement typically corresponds to a domain element, i.e.,
9443 one of the elements that is visited by the AST.
9445 Each type of node has its own additional properties.
9447         #include <isl/ast.h>
9448         __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
9449                 __isl_keep isl_ast_node *node);
9450         __isl_give isl_ast_expr *isl_ast_node_for_get_init(
9451                 __isl_keep isl_ast_node *node);
9452         __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
9453                 __isl_keep isl_ast_node *node);
9454         __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
9455                 __isl_keep isl_ast_node *node);
9456         __isl_give isl_ast_node *isl_ast_node_for_get_body(
9457                 __isl_keep isl_ast_node *node);
9458         isl_bool isl_ast_node_for_is_degenerate(
9459                 __isl_keep isl_ast_node *node);
9461 An C<isl_ast_for> is considered degenerate if it is known to execute
9462 exactly once.
9464         #include <isl/ast.h>
9465         __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
9466                 __isl_keep isl_ast_node *node);
9467         __isl_give isl_ast_node *isl_ast_node_if_get_then(
9468                 __isl_keep isl_ast_node *node);
9469         isl_bool isl_ast_node_if_has_else(
9470                 __isl_keep isl_ast_node *node);
9471         __isl_give isl_ast_node *isl_ast_node_if_get_else(
9472                 __isl_keep isl_ast_node *node);
9474         __isl_give isl_ast_node_list *
9475         isl_ast_node_block_get_children(
9476                 __isl_keep isl_ast_node *node);
9478         __isl_give isl_id *isl_ast_node_mark_get_id(
9479                 __isl_keep isl_ast_node *node);
9480         __isl_give isl_ast_node *isl_ast_node_mark_get_node(
9481                 __isl_keep isl_ast_node *node);
9483 C<isl_ast_node_mark_get_id> returns the identifier of the mark.
9484 C<isl_ast_node_mark_get_node> returns the child node that is being marked.
9486         #include <isl/ast.h>
9487         __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
9488                 __isl_keep isl_ast_node *node);
9490 All descendants of a specific node in the AST (including the node itself)
9491 can be visited
9492 in depth-first pre-order using the following function.
9494         #include <isl/ast.h>
9495         isl_stat isl_ast_node_foreach_descendant_top_down(
9496                 __isl_keep isl_ast_node *node,
9497                 isl_bool (*fn)(__isl_keep isl_ast_node *node,
9498                         void *user), void *user);
9500 The callback function should return C<isl_bool_true> if the children
9501 of the given node should be visited and C<isl_bool_false> if they should not.
9502 It should return C<isl_bool_error> in case of failure, in which case
9503 the entire traversal is aborted.
9505 Each of the returned C<isl_ast_expr>s can in turn be inspected using
9506 the following functions.
9508         #include <isl/ast.h>
9509         enum isl_ast_expr_type isl_ast_expr_get_type(
9510                 __isl_keep isl_ast_expr *expr);
9512 The type of an AST expression is one of
9513 C<isl_ast_expr_op>,
9514 C<isl_ast_expr_id> or
9515 C<isl_ast_expr_int>.
9516 An C<isl_ast_expr_op> represents the result of an operation.
9517 An C<isl_ast_expr_id> represents an identifier.
9518 An C<isl_ast_expr_int> represents an integer value.
9520 Each type of expression has its own additional properties.
9522         #include <isl/ast.h>
9523         enum isl_ast_op_type isl_ast_expr_get_op_type(
9524                 __isl_keep isl_ast_expr *expr);
9525         int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
9526         __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
9527                 __isl_keep isl_ast_expr *expr, int pos);
9528         isl_stat isl_ast_expr_foreach_ast_op_type(
9529                 __isl_keep isl_ast_expr *expr,
9530                 isl_stat (*fn)(enum isl_ast_op_type type,
9531                         void *user), void *user);
9532         isl_stat isl_ast_node_foreach_ast_op_type(
9533                 __isl_keep isl_ast_node *node,
9534                 isl_stat (*fn)(enum isl_ast_op_type type,
9535                         void *user), void *user);
9537 C<isl_ast_expr_get_op_type> returns the type of the operation
9538 performed.  C<isl_ast_expr_get_op_n_arg> returns the number of
9539 arguments.  C<isl_ast_expr_get_op_arg> returns the specified
9540 argument.
9541 C<isl_ast_expr_foreach_ast_op_type> calls C<fn> for each distinct
9542 C<isl_ast_op_type> that appears in C<expr>.
9543 C<isl_ast_node_foreach_ast_op_type> does the same for each distinct
9544 C<isl_ast_op_type> that appears in C<node>.
9545 The operation type is one of the following.
9547 =over
9549 =item C<isl_ast_op_and>
9551 Logical I<and> of two arguments.
9552 Both arguments can be evaluated.
9554 =item C<isl_ast_op_and_then>
9556 Logical I<and> of two arguments.
9557 The second argument can only be evaluated if the first evaluates to true.
9559 =item C<isl_ast_op_or>
9561 Logical I<or> of two arguments.
9562 Both arguments can be evaluated.
9564 =item C<isl_ast_op_or_else>
9566 Logical I<or> of two arguments.
9567 The second argument can only be evaluated if the first evaluates to false.
9569 =item C<isl_ast_op_max>
9571 Maximum of two or more arguments.
9573 =item C<isl_ast_op_min>
9575 Minimum of two or more arguments.
9577 =item C<isl_ast_op_minus>
9579 Change sign.
9581 =item C<isl_ast_op_add>
9583 Sum of two arguments.
9585 =item C<isl_ast_op_sub>
9587 Difference of two arguments.
9589 =item C<isl_ast_op_mul>
9591 Product of two arguments.
9593 =item C<isl_ast_op_div>
9595 Exact division.  That is, the result is known to be an integer.
9597 =item C<isl_ast_op_fdiv_q>
9599 Result of integer division, rounded towards negative
9600 infinity.
9602 =item C<isl_ast_op_pdiv_q>
9604 Result of integer division, where dividend is known to be non-negative.
9606 =item C<isl_ast_op_pdiv_r>
9608 Remainder of integer division, where dividend is known to be non-negative.
9610 =item C<isl_ast_op_zdiv_r>
9612 Equal to zero iff the remainder on integer division is zero.
9614 =item C<isl_ast_op_cond>
9616 Conditional operator defined on three arguments.
9617 If the first argument evaluates to true, then the result
9618 is equal to the second argument.  Otherwise, the result
9619 is equal to the third argument.
9620 The second and third argument may only be evaluated if
9621 the first argument evaluates to true and false, respectively.
9622 Corresponds to C<a ? b : c> in C.
9624 =item C<isl_ast_op_select>
9626 Conditional operator defined on three arguments.
9627 If the first argument evaluates to true, then the result
9628 is equal to the second argument.  Otherwise, the result
9629 is equal to the third argument.
9630 The second and third argument may be evaluated independently
9631 of the value of the first argument.
9632 Corresponds to C<a * b + (1 - a) * c> in C.
9634 =item C<isl_ast_op_eq>
9636 Equality relation.
9638 =item C<isl_ast_op_le>
9640 Less than or equal relation.
9642 =item C<isl_ast_op_lt>
9644 Less than relation.
9646 =item C<isl_ast_op_ge>
9648 Greater than or equal relation.
9650 =item C<isl_ast_op_gt>
9652 Greater than relation.
9654 =item C<isl_ast_op_call>
9656 A function call.
9657 The number of arguments of the C<isl_ast_expr> is one more than
9658 the number of arguments in the function call, the first argument
9659 representing the function being called.
9661 =item C<isl_ast_op_access>
9663 An array access.
9664 The number of arguments of the C<isl_ast_expr> is one more than
9665 the number of index expressions in the array access, the first argument
9666 representing the array being accessed.
9668 =item C<isl_ast_op_member>
9670 A member access.
9671 This operation has two arguments, a structure and the name of
9672 the member of the structure being accessed.
9674 =back
9676         #include <isl/ast.h>
9677         __isl_give isl_id *isl_ast_expr_get_id(
9678                 __isl_keep isl_ast_expr *expr);
9680 Return the identifier represented by the AST expression.
9682         #include <isl/ast.h>
9683         __isl_give isl_val *isl_ast_expr_get_val(
9684                 __isl_keep isl_ast_expr *expr);
9686 Return the integer represented by the AST expression.
9688 =head3 Properties of ASTs
9690         #include <isl/ast.h>
9691         isl_bool isl_ast_expr_is_equal(
9692                 __isl_keep isl_ast_expr *expr1,
9693                 __isl_keep isl_ast_expr *expr2);
9695 Check if two C<isl_ast_expr>s are equal to each other.
9697 =head3 Manipulating and printing the AST
9699 AST nodes can be copied and freed using the following functions.
9701         #include <isl/ast.h>
9702         __isl_give isl_ast_node *isl_ast_node_copy(
9703                 __isl_keep isl_ast_node *node);
9704         __isl_null isl_ast_node *isl_ast_node_free(
9705                 __isl_take isl_ast_node *node);
9707 AST expressions can be copied and freed using the following functions.
9709         #include <isl/ast.h>
9710         __isl_give isl_ast_expr *isl_ast_expr_copy(
9711                 __isl_keep isl_ast_expr *expr);
9712         __isl_null isl_ast_expr *isl_ast_expr_free(
9713                 __isl_take isl_ast_expr *expr);
9715 New AST expressions can be created either directly or within
9716 the context of an C<isl_ast_build>.
9718         #include <isl/ast.h>
9719         __isl_give isl_ast_expr *isl_ast_expr_from_val(
9720                 __isl_take isl_val *v);
9721         __isl_give isl_ast_expr *isl_ast_expr_from_id(
9722                 __isl_take isl_id *id);
9723         __isl_give isl_ast_expr *isl_ast_expr_neg(
9724                 __isl_take isl_ast_expr *expr);
9725         __isl_give isl_ast_expr *isl_ast_expr_address_of(
9726                 __isl_take isl_ast_expr *expr);
9727         __isl_give isl_ast_expr *isl_ast_expr_add(
9728                 __isl_take isl_ast_expr *expr1,
9729                 __isl_take isl_ast_expr *expr2);
9730         __isl_give isl_ast_expr *isl_ast_expr_sub(
9731                 __isl_take isl_ast_expr *expr1,
9732                 __isl_take isl_ast_expr *expr2);
9733         __isl_give isl_ast_expr *isl_ast_expr_mul(
9734                 __isl_take isl_ast_expr *expr1,
9735                 __isl_take isl_ast_expr *expr2);
9736         __isl_give isl_ast_expr *isl_ast_expr_div(
9737                 __isl_take isl_ast_expr *expr1,
9738                 __isl_take isl_ast_expr *expr2);
9739         __isl_give isl_ast_expr *isl_ast_expr_pdiv_q(
9740                 __isl_take isl_ast_expr *expr1,
9741                 __isl_take isl_ast_expr *expr2);
9742         __isl_give isl_ast_expr *isl_ast_expr_pdiv_r(
9743                 __isl_take isl_ast_expr *expr1,
9744                 __isl_take isl_ast_expr *expr2);
9745         __isl_give isl_ast_expr *isl_ast_expr_and(
9746                 __isl_take isl_ast_expr *expr1,
9747                 __isl_take isl_ast_expr *expr2)
9748         __isl_give isl_ast_expr *isl_ast_expr_and_then(
9749                 __isl_take isl_ast_expr *expr1,
9750                 __isl_take isl_ast_expr *expr2)
9751         __isl_give isl_ast_expr *isl_ast_expr_or(
9752                 __isl_take isl_ast_expr *expr1,
9753                 __isl_take isl_ast_expr *expr2)
9754         __isl_give isl_ast_expr *isl_ast_expr_or_else(
9755                 __isl_take isl_ast_expr *expr1,
9756                 __isl_take isl_ast_expr *expr2)
9757         __isl_give isl_ast_expr *isl_ast_expr_eq(
9758                 __isl_take isl_ast_expr *expr1,
9759                 __isl_take isl_ast_expr *expr2);
9760         __isl_give isl_ast_expr *isl_ast_expr_le(
9761                 __isl_take isl_ast_expr *expr1,
9762                 __isl_take isl_ast_expr *expr2);
9763         __isl_give isl_ast_expr *isl_ast_expr_lt(
9764                 __isl_take isl_ast_expr *expr1,
9765                 __isl_take isl_ast_expr *expr2);
9766         __isl_give isl_ast_expr *isl_ast_expr_ge(
9767                 __isl_take isl_ast_expr *expr1,
9768                 __isl_take isl_ast_expr *expr2);
9769         __isl_give isl_ast_expr *isl_ast_expr_gt(
9770                 __isl_take isl_ast_expr *expr1,
9771                 __isl_take isl_ast_expr *expr2);
9772         __isl_give isl_ast_expr *isl_ast_expr_access(
9773                 __isl_take isl_ast_expr *array,
9774                 __isl_take isl_ast_expr_list *indices);
9775         __isl_give isl_ast_expr *isl_ast_expr_call(
9776                 __isl_take isl_ast_expr *function,
9777                 __isl_take isl_ast_expr_list *arguments);
9779 The function C<isl_ast_expr_address_of> can be applied to an
9780 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
9781 to represent the address of the C<isl_ast_expr_access>. The function
9782 C<isl_ast_expr_and_then> as well as C<isl_ast_expr_or_else> are short-circuit
9783 versions of C<isl_ast_expr_and> and C<isl_ast_expr_or>, respectively.
9785         #include <isl/ast_build.h>
9786         __isl_give isl_ast_expr *isl_ast_build_expr_from_set(
9787                 __isl_keep isl_ast_build *build,
9788                 __isl_take isl_set *set);
9789         __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
9790                 __isl_keep isl_ast_build *build,
9791                 __isl_take isl_pw_aff *pa);
9792         __isl_give isl_ast_expr *
9793         isl_ast_build_access_from_pw_multi_aff(
9794                 __isl_keep isl_ast_build *build,
9795                 __isl_take isl_pw_multi_aff *pma);
9796         __isl_give isl_ast_expr *
9797         isl_ast_build_access_from_multi_pw_aff(
9798                 __isl_keep isl_ast_build *build,
9799                 __isl_take isl_multi_pw_aff *mpa);
9800         __isl_give isl_ast_expr *
9801         isl_ast_build_call_from_pw_multi_aff(
9802                 __isl_keep isl_ast_build *build,
9803                 __isl_take isl_pw_multi_aff *pma);
9804         __isl_give isl_ast_expr *
9805         isl_ast_build_call_from_multi_pw_aff(
9806                 __isl_keep isl_ast_build *build,
9807                 __isl_take isl_multi_pw_aff *mpa);
9809 The set <set> and
9810 the domains of C<pa>, C<mpa> and C<pma> should correspond
9811 to the schedule space of C<build>.
9812 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
9813 the function being called.
9814 If the accessed space is a nested relation, then it is taken
9815 to represent an access of the member specified by the range
9816 of this nested relation of the structure specified by the domain
9817 of the nested relation.
9819 The following functions can be used to modify an C<isl_ast_expr>.
9821         #include <isl/ast.h>
9822         __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
9823                 __isl_take isl_ast_expr *expr, int pos,
9824                 __isl_take isl_ast_expr *arg);
9826 Replace the argument of C<expr> at position C<pos> by C<arg>.
9828         #include <isl/ast.h>
9829         __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
9830                 __isl_take isl_ast_expr *expr,
9831                 __isl_take isl_id_to_ast_expr *id2expr);
9833 The function C<isl_ast_expr_substitute_ids> replaces the
9834 subexpressions of C<expr> of type C<isl_ast_expr_id>
9835 by the corresponding expression in C<id2expr>, if there is any.
9838 User specified data can be attached to an C<isl_ast_node> and obtained
9839 from the same C<isl_ast_node> using the following functions.
9841         #include <isl/ast.h>
9842         __isl_give isl_ast_node *isl_ast_node_set_annotation(
9843                 __isl_take isl_ast_node *node,
9844                 __isl_take isl_id *annotation);
9845         __isl_give isl_id *isl_ast_node_get_annotation(
9846                 __isl_keep isl_ast_node *node);
9848 Basic printing can be performed using the following functions.
9850         #include <isl/ast.h>
9851         __isl_give isl_printer *isl_printer_print_ast_expr(
9852                 __isl_take isl_printer *p,
9853                 __isl_keep isl_ast_expr *expr);
9854         __isl_give isl_printer *isl_printer_print_ast_node(
9855                 __isl_take isl_printer *p,
9856                 __isl_keep isl_ast_node *node);
9857         __isl_give char *isl_ast_expr_to_str(
9858                 __isl_keep isl_ast_expr *expr);
9859         __isl_give char *isl_ast_node_to_str(
9860                 __isl_keep isl_ast_node *node);
9861         __isl_give char *isl_ast_expr_to_C_str(
9862                 __isl_keep isl_ast_expr *expr);
9863         __isl_give char *isl_ast_node_to_C_str(
9864                 __isl_keep isl_ast_node *node);
9866 The functions C<isl_ast_expr_to_C_str> and
9867 C<isl_ast_node_to_C_str> are convenience functions
9868 that return a string representation of the input in C format.
9870 More advanced printing can be performed using the following functions.
9872         #include <isl/ast.h>
9873         __isl_give isl_printer *isl_ast_op_type_set_print_name(
9874                 __isl_take isl_printer *p,
9875                 enum isl_ast_op_type type,
9876                 __isl_keep const char *name);
9877         isl_stat isl_options_set_ast_print_macro_once(
9878                 isl_ctx *ctx, int val);
9879         int isl_options_get_ast_print_macro_once(isl_ctx *ctx);
9880         __isl_give isl_printer *isl_ast_op_type_print_macro(
9881                 enum isl_ast_op_type type,
9882                 __isl_take isl_printer *p);
9883         __isl_give isl_printer *isl_ast_expr_print_macros(
9884                 __isl_keep isl_ast_expr *expr,
9885                 __isl_take isl_printer *p);
9886         __isl_give isl_printer *isl_ast_node_print_macros(
9887                 __isl_keep isl_ast_node *node,
9888                 __isl_take isl_printer *p);
9889         __isl_give isl_printer *isl_ast_node_print(
9890                 __isl_keep isl_ast_node *node,
9891                 __isl_take isl_printer *p,
9892                 __isl_take isl_ast_print_options *options);
9893         __isl_give isl_printer *isl_ast_node_for_print(
9894                 __isl_keep isl_ast_node *node,
9895                 __isl_take isl_printer *p,
9896                 __isl_take isl_ast_print_options *options);
9897         __isl_give isl_printer *isl_ast_node_if_print(
9898                 __isl_keep isl_ast_node *node,
9899                 __isl_take isl_printer *p,
9900                 __isl_take isl_ast_print_options *options);
9902 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
9903 C<isl> may print out an AST that makes use of macros such
9904 as C<floord>, C<min> and C<max>.
9905 The names of these macros may be modified by a call
9906 to C<isl_ast_op_type_set_print_name>.  The user-specified
9907 names are associated to the printer object.
9908 C<isl_ast_op_type_print_macro> prints out the macro
9909 corresponding to a specific C<isl_ast_op_type>.
9910 If the print-macro-once option is set, then a given macro definition
9911 is only printed once to any given printer object.
9912 C<isl_ast_expr_print_macros> scans the C<isl_ast_expr>
9913 for subexpressions where these macros would be used and prints
9914 out the required macro definitions.
9915 Essentially, C<isl_ast_expr_print_macros> calls
9916 C<isl_ast_expr_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
9917 as function argument.
9918 C<isl_ast_node_print_macros> does the same
9919 for expressions in its C<isl_ast_node> argument.
9920 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
9921 C<isl_ast_node_if_print> print an C<isl_ast_node>
9922 in C<ISL_FORMAT_C>, but allow for some extra control
9923 through an C<isl_ast_print_options> object.
9924 This object can be created using the following functions.
9926         #include <isl/ast.h>
9927         __isl_give isl_ast_print_options *
9928         isl_ast_print_options_alloc(isl_ctx *ctx);
9929         __isl_give isl_ast_print_options *
9930         isl_ast_print_options_copy(
9931                 __isl_keep isl_ast_print_options *options);
9932         __isl_null isl_ast_print_options *
9933         isl_ast_print_options_free(
9934                 __isl_take isl_ast_print_options *options);
9936         __isl_give isl_ast_print_options *
9937         isl_ast_print_options_set_print_user(
9938                 __isl_take isl_ast_print_options *options,
9939                 __isl_give isl_printer *(*print_user)(
9940                         __isl_take isl_printer *p,
9941                         __isl_take isl_ast_print_options *options,
9942                         __isl_keep isl_ast_node *node, void *user),
9943                 void *user);
9944         __isl_give isl_ast_print_options *
9945         isl_ast_print_options_set_print_for(
9946                 __isl_take isl_ast_print_options *options,
9947                 __isl_give isl_printer *(*print_for)(
9948                         __isl_take isl_printer *p,
9949                         __isl_take isl_ast_print_options *options,
9950                         __isl_keep isl_ast_node *node, void *user),
9951                 void *user);
9953 The callback set by C<isl_ast_print_options_set_print_user>
9954 is called whenever a node of type C<isl_ast_node_user> needs to
9955 be printed.
9956 The callback set by C<isl_ast_print_options_set_print_for>
9957 is called whenever a node of type C<isl_ast_node_for> needs to
9958 be printed.
9959 Note that C<isl_ast_node_for_print> will I<not> call the
9960 callback set by C<isl_ast_print_options_set_print_for> on the node
9961 on which C<isl_ast_node_for_print> is called, but only on nested
9962 nodes of type C<isl_ast_node_for>.  It is therefore safe to
9963 call C<isl_ast_node_for_print> from within the callback set by
9964 C<isl_ast_print_options_set_print_for>.
9966 The following option determines the type to be used for iterators
9967 while printing the AST.
9969         isl_stat isl_options_set_ast_iterator_type(
9970                 isl_ctx *ctx, const char *val);
9971         const char *isl_options_get_ast_iterator_type(
9972                 isl_ctx *ctx);
9974 The AST printer only prints body nodes as blocks if these
9975 blocks cannot be safely omitted.
9976 For example, a C<for> node with one body node will not be
9977 surrounded with braces in C<ISL_FORMAT_C>.
9978 A block will always be printed by setting the following option.
9980         isl_stat isl_options_set_ast_always_print_block(isl_ctx *ctx,
9981                 int val);
9982         int isl_options_get_ast_always_print_block(isl_ctx *ctx);
9984 =head3 Options
9986         #include <isl/ast_build.h>
9987         isl_stat isl_options_set_ast_build_atomic_upper_bound(
9988                 isl_ctx *ctx, int val);
9989         int isl_options_get_ast_build_atomic_upper_bound(
9990                 isl_ctx *ctx);
9991         isl_stat isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
9992                 int val);
9993         int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
9994         isl_stat isl_options_set_ast_build_detect_min_max(
9995                 isl_ctx *ctx, int val);
9996         int isl_options_get_ast_build_detect_min_max(
9997                 isl_ctx *ctx);
9998         isl_stat isl_options_set_ast_build_exploit_nested_bounds(
9999                 isl_ctx *ctx, int val);
10000         int isl_options_get_ast_build_exploit_nested_bounds(
10001                 isl_ctx *ctx);
10002         isl_stat isl_options_set_ast_build_group_coscheduled(
10003                 isl_ctx *ctx, int val);
10004         int isl_options_get_ast_build_group_coscheduled(
10005                 isl_ctx *ctx);
10006         isl_stat isl_options_set_ast_build_scale_strides(
10007                 isl_ctx *ctx, int val);
10008         int isl_options_get_ast_build_scale_strides(
10009                 isl_ctx *ctx);
10010         isl_stat isl_options_set_ast_build_allow_else(isl_ctx *ctx,
10011                 int val);
10012         int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
10013         isl_stat isl_options_set_ast_build_allow_or(isl_ctx *ctx,
10014                 int val);
10015         int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
10017 =over
10019 =item * ast_build_atomic_upper_bound
10021 Generate loop upper bounds that consist of the current loop iterator,
10022 an operator and an expression not involving the iterator.
10023 If this option is not set, then the current loop iterator may appear
10024 several times in the upper bound.
10025 For example, when this option is turned off, AST generation
10026 for the schedule
10028         [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
10030 produces
10032         for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
10033           A(c0);
10035 When the option is turned on, the following AST is generated
10037         for (int c0 = 0; c0 <= min(100, n); c0 += 1)
10038           A(c0);
10040 =item * ast_build_prefer_pdiv
10042 If this option is turned off, then the AST generation will
10043 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
10044 operators, but no C<isl_ast_op_pdiv_q> or
10045 C<isl_ast_op_pdiv_r> operators.
10046 If this option is turned on, then C<isl> will try to convert
10047 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
10048 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
10050 =item * ast_build_detect_min_max
10052 If this option is turned on, then C<isl> will try and detect
10053 min or max-expressions when building AST expressions from
10054 piecewise affine expressions.
10056 =item * ast_build_exploit_nested_bounds
10058 Simplify conditions based on bounds of nested for loops.
10059 In particular, remove conditions that are implied by the fact
10060 that one or more nested loops have at least one iteration,
10061 meaning that the upper bound is at least as large as the lower bound.
10062 For example, when this option is turned off, AST generation
10063 for the schedule
10065         [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
10066                                         0 <= j <= M }
10068 produces
10070         if (M >= 0)
10071           for (int c0 = 0; c0 <= N; c0 += 1)
10072             for (int c1 = 0; c1 <= M; c1 += 1)
10073               A(c0, c1);
10075 When the option is turned on, the following AST is generated
10077         for (int c0 = 0; c0 <= N; c0 += 1)
10078           for (int c1 = 0; c1 <= M; c1 += 1)
10079             A(c0, c1);
10081 =item * ast_build_group_coscheduled
10083 If two domain elements are assigned the same schedule point, then
10084 they may be executed in any order and they may even appear in different
10085 loops.  If this options is set, then the AST generator will make
10086 sure that coscheduled domain elements do not appear in separate parts
10087 of the AST.  This is useful in case of nested AST generation
10088 if the outer AST generation is given only part of a schedule
10089 and the inner AST generation should handle the domains that are
10090 coscheduled by this initial part of the schedule together.
10091 For example if an AST is generated for a schedule
10093         { A[i] -> [0]; B[i] -> [0] }
10095 then the C<isl_ast_build_set_create_leaf> callback described
10096 below may get called twice, once for each domain.
10097 Setting this option ensures that the callback is only called once
10098 on both domains together.
10100 =item * ast_build_separation_bounds
10102 This option specifies which bounds to use during separation.
10103 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
10104 then all (possibly implicit) bounds on the current dimension will
10105 be used during separation.
10106 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
10107 then only those bounds that are explicitly available will
10108 be used during separation.
10110 =item * ast_build_scale_strides
10112 This option specifies whether the AST generator is allowed
10113 to scale down iterators of strided loops.
10115 =item * ast_build_allow_else
10117 This option specifies whether the AST generator is allowed
10118 to construct if statements with else branches.
10120 =item * ast_build_allow_or
10122 This option specifies whether the AST generator is allowed
10123 to construct if conditions with disjunctions.
10125 =back
10127 =head3 AST Generation Options (Schedule Tree)
10129 In case of AST construction from a schedule tree, the options
10130 that control how an AST is created from the individual schedule
10131 dimensions are stored in the band nodes of the tree
10132 (see L</"Schedule Trees">).
10134 In particular, a schedule dimension can be handled in four
10135 different ways, atomic, separate, unroll or the default.
10136 This loop AST generation type can be set using
10137 C<isl_schedule_node_band_member_set_ast_loop_type>.
10138 Alternatively,
10139 the first three can be selected by including a one-dimensional
10140 element with as value the position of the schedule dimension
10141 within the band and as name one of C<atomic>, C<separate>
10142 or C<unroll> in the options
10143 set by C<isl_schedule_node_band_set_ast_build_options>.
10144 Only one of these three may be specified for
10145 any given schedule dimension within a band node.
10146 If none of these is specified, then the default
10147 is used.  The meaning of the options is as follows.
10149 =over
10151 =item C<atomic>
10153 When this option is specified, the AST generator will make
10154 sure that a given domains space only appears in a single
10155 loop at the specified level.
10157 For example, for the schedule tree
10159         domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
10160         child:
10161           schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
10162           options: "{ atomic[x] }"
10164 the following AST will be generated
10166         for (int c0 = 0; c0 <= 10; c0 += 1) {
10167           if (c0 >= 1)
10168             b(c0 - 1);
10169           if (c0 <= 9)
10170             a(c0);
10171         }
10173 On the other hand, for the schedule tree
10175         domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
10176         child:
10177           schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
10178           options: "{ separate[x] }"
10180 the following AST will be generated
10182         {
10183           a(0);
10184           for (int c0 = 1; c0 <= 9; c0 += 1) {
10185             b(c0 - 1);
10186             a(c0);
10187           }
10188           b(9);
10189         }
10191 If neither C<atomic> nor C<separate> is specified, then the AST generator
10192 may produce either of these two results or some intermediate form.
10194 =item C<separate>
10196 When this option is specified, the AST generator will
10197 split the domain of the specified schedule dimension
10198 into pieces with a fixed set of statements for which
10199 instances need to be executed by the iterations in
10200 the schedule domain part.  This option tends to avoid
10201 the generation of guards inside the corresponding loops.
10202 See also the C<atomic> option.
10204 =item C<unroll>
10206 When this option is specified, the AST generator will
10207 I<completely> unroll the corresponding schedule dimension.
10208 It is the responsibility of the user to ensure that such
10209 unrolling is possible.
10210 To obtain a partial unrolling, the user should apply an additional
10211 strip-mining to the schedule and fully unroll the inner schedule
10212 dimension.
10214 =back
10216 The C<isolate> option is a bit more involved.  It allows the user
10217 to isolate a range of schedule dimension values from smaller and
10218 greater values.  Additionally, the user may specify a different
10219 atomic/separate/unroll choice for the isolated part and the remaining
10220 parts.  The typical use case of the C<isolate> option is to isolate
10221 full tiles from partial tiles.
10222 The part that needs to be isolated may depend on outer schedule dimensions.
10223 The option therefore needs to be able to reference those outer schedule
10224 dimensions.  In particular, the space of the C<isolate> option is that
10225 of a wrapped map with as domain the flat product of all outer band nodes
10226 and as range the space of the current band node.
10227 The atomic/separate/unroll choice for the isolated part is determined
10228 by an option that lives in an unnamed wrapped space with as domain
10229 a zero-dimensional C<isolate> space and as range the regular
10230 C<atomic>, C<separate> or C<unroll> space.
10231 This option may also be set directly using
10232 C<isl_schedule_node_band_member_set_isolate_ast_loop_type>.
10233 The atomic/separate/unroll choice for the remaining part is determined
10234 by the regular C<atomic>, C<separate> or C<unroll> option.
10235 Since the C<isolate> option references outer schedule dimensions,
10236 its use in a band node causes any tree containing the node
10237 to be considered anchored.
10239 As an example, consider the isolation of full tiles from partial tiles
10240 in a tiling of a triangular domain.  The original schedule is as follows.
10242         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10243         child:
10244           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10245                 { A[i,j] -> [floor(j/10)] }, \
10246                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10248 The output is
10250         for (int c0 = 0; c0 <= 10; c0 += 1)
10251           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10252             for (int c2 = 10 * c0;
10253                  c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10254               for (int c3 = 10 * c1;
10255                    c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10256                 A(c2, c3);
10258 Isolating the full tiles, we have the following input
10260         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10261         child:
10262           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10263                 { A[i,j] -> [floor(j/10)] }, \
10264                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10265           options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
10266                 10a+9+10b+9 <= 100 }"
10268 and output
10270         {
10271           for (int c0 = 0; c0 <= 8; c0 += 1) {
10272             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10273               for (int c2 = 10 * c0;
10274                    c2 <= 10 * c0 + 9; c2 += 1)
10275                 for (int c3 = 10 * c1;
10276                      c3 <= 10 * c1 + 9; c3 += 1)
10277                   A(c2, c3);
10278             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10279               for (int c2 = 10 * c0;
10280                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10281                 for (int c3 = 10 * c1;
10282                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10283                   A(c2, c3);
10284           }
10285           for (int c0 = 9; c0 <= 10; c0 += 1)
10286             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10287               for (int c2 = 10 * c0;
10288                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10289                 for (int c3 = 10 * c1;
10290                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10291                   A(c2, c3);
10292         }
10294 We may then additionally unroll the innermost loop of the isolated part
10296         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10297         child:
10298           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10299                 { A[i,j] -> [floor(j/10)] }, \
10300                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10301           options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
10302                 10a+9+10b+9 <= 100; [isolate[] -> unroll[3]] }"
10304 to obtain
10306         {
10307           for (int c0 = 0; c0 <= 8; c0 += 1) {
10308             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10309               for (int c2 = 10 * c0; c2 <= 10 * c0 + 9; c2 += 1) {
10310                 A(c2, 10 * c1);
10311                 A(c2, 10 * c1 + 1);
10312                 A(c2, 10 * c1 + 2);
10313                 A(c2, 10 * c1 + 3);
10314                 A(c2, 10 * c1 + 4);
10315                 A(c2, 10 * c1 + 5);
10316                 A(c2, 10 * c1 + 6);
10317                 A(c2, 10 * c1 + 7);
10318                 A(c2, 10 * c1 + 8);
10319                 A(c2, 10 * c1 + 9);
10320               }
10321             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10322               for (int c2 = 10 * c0;
10323                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10324                 for (int c3 = 10 * c1;
10325                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10326                   A(c2, c3);
10327           }
10328           for (int c0 = 9; c0 <= 10; c0 += 1)
10329             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10330               for (int c2 = 10 * c0;
10331                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10332                 for (int c3 = 10 * c1;
10333                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10334                   A(c2, c3);
10335         }
10338 =head3 AST Generation Options (Schedule Map)
10340 In case of AST construction using
10341 C<isl_ast_build_node_from_schedule_map>, the options
10342 that control how an AST is created from the individual schedule
10343 dimensions are stored in the C<isl_ast_build>.
10344 They can be set using the following function.
10346         #include <isl/ast_build.h>
10347         __isl_give isl_ast_build *
10348         isl_ast_build_set_options(
10349                 __isl_take isl_ast_build *control,
10350                 __isl_take isl_union_map *options);
10352 The options are encoded in an C<isl_union_map>.
10353 The domain of this union relation refers to the schedule domain,
10354 i.e., the range of the schedule passed
10355 to C<isl_ast_build_node_from_schedule_map>.
10356 In the case of nested AST generation (see L</"Nested AST Generation">),
10357 the domain of C<options> should refer to the extra piece of the schedule.
10358 That is, it should be equal to the range of the wrapped relation in the
10359 range of the schedule.
10360 The range of the options can consist of elements in one or more spaces,
10361 the names of which determine the effect of the option.
10362 The values of the range typically also refer to the schedule dimension
10363 to which the option applies.  In case of nested AST generation
10364 (see L</"Nested AST Generation">), these values refer to the position
10365 of the schedule dimension within the innermost AST generation.
10366 The constraints on the domain elements of
10367 the option should only refer to this dimension and earlier dimensions.
10368 We consider the following spaces.
10370 =over
10372 =item C<separation_class>
10374 B<This option has been deprecated.  Use the isolate option on
10375 schedule trees instead.>
10377 This space is a wrapped relation between two one dimensional spaces.
10378 The input space represents the schedule dimension to which the option
10379 applies and the output space represents the separation class.
10380 While constructing a loop corresponding to the specified schedule
10381 dimension(s), the AST generator will try to generate separate loops
10382 for domain elements that are assigned different classes.
10383 If only some of the elements are assigned a class, then those elements
10384 that are not assigned any class will be treated as belonging to a class
10385 that is separate from the explicitly assigned classes.
10386 The typical use case for this option is to separate full tiles from
10387 partial tiles.
10388 The other options, described below, are applied after the separation
10389 into classes.
10391 As an example, consider the separation into full and partial tiles
10392 of a tiling of a triangular domain.
10393 Take, for example, the domain
10395         { A[i,j] : 0 <= i,j and i + j <= 100 }
10397 and a tiling into tiles of 10 by 10.  The input to the AST generator
10398 is then the schedule
10400         { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
10401                                                 i + j <= 100 }
10403 Without any options, the following AST is generated
10405         for (int c0 = 0; c0 <= 10; c0 += 1)
10406           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10407             for (int c2 = 10 * c0;
10408                  c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10409                  c2 += 1)
10410               for (int c3 = 10 * c1;
10411                    c3 <= min(10 * c1 + 9, -c2 + 100);
10412                    c3 += 1)
10413                 A(c2, c3);
10415 Separation into full and partial tiles can be obtained by assigning
10416 a class, say C<0>, to the full tiles.  The full tiles are represented by those
10417 values of the first and second schedule dimensions for which there are
10418 values of the third and fourth dimensions to cover an entire tile.
10419 That is, we need to specify the following option
10421         { [a,b,c,d] -> separation_class[[0]->[0]] :
10422                 exists b': 0 <= 10a,10b' and
10423                            10a+9+10b'+9 <= 100;
10424           [a,b,c,d] -> separation_class[[1]->[0]] :
10425                 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
10427 which simplifies to
10429         { [a, b, c, d] -> separation_class[[1] -> [0]] :
10430                 a >= 0 and b >= 0 and b <= 8 - a;
10431           [a, b, c, d] -> separation_class[[0] -> [0]] :
10432                 a >= 0 and a <= 8 }
10434 With this option, the generated AST is as follows
10436         {
10437           for (int c0 = 0; c0 <= 8; c0 += 1) {
10438             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10439               for (int c2 = 10 * c0;
10440                    c2 <= 10 * c0 + 9; c2 += 1)
10441                 for (int c3 = 10 * c1;
10442                      c3 <= 10 * c1 + 9; c3 += 1)
10443                   A(c2, c3);
10444             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10445               for (int c2 = 10 * c0;
10446                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10447                    c2 += 1)
10448                 for (int c3 = 10 * c1;
10449                      c3 <= min(-c2 + 100, 10 * c1 + 9);
10450                      c3 += 1)
10451                   A(c2, c3);
10452           }
10453           for (int c0 = 9; c0 <= 10; c0 += 1)
10454             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10455               for (int c2 = 10 * c0;
10456                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10457                    c2 += 1)
10458                 for (int c3 = 10 * c1;
10459                      c3 <= min(10 * c1 + 9, -c2 + 100);
10460                      c3 += 1)
10461                   A(c2, c3);
10462         }
10464 =item C<separate>
10466 This is a single-dimensional space representing the schedule dimension(s)
10467 to which ``separation'' should be applied.  Separation tries to split
10468 a loop into several pieces if this can avoid the generation of guards
10469 inside the loop.
10470 See also the C<atomic> option.
10472 =item C<atomic>
10474 This is a single-dimensional space representing the schedule dimension(s)
10475 for which the domains should be considered ``atomic''.  That is, the
10476 AST generator will make sure that any given domain space will only appear
10477 in a single loop at the specified level.
10479 Consider the following schedule
10481         { a[i] -> [i] : 0 <= i < 10;
10482           b[i] -> [i+1] : 0 <= i < 10 }
10484 If the following option is specified
10486         { [i] -> separate[x] }
10488 then the following AST will be generated
10490         {
10491           a(0);
10492           for (int c0 = 1; c0 <= 9; c0 += 1) {
10493             a(c0);
10494             b(c0 - 1);
10495           }
10496           b(9);
10497         }
10499 If, on the other hand, the following option is specified
10501         { [i] -> atomic[x] }
10503 then the following AST will be generated
10505         for (int c0 = 0; c0 <= 10; c0 += 1) {
10506           if (c0 <= 9)
10507             a(c0);
10508           if (c0 >= 1)
10509             b(c0 - 1);
10510         }
10512 If neither C<atomic> nor C<separate> is specified, then the AST generator
10513 may produce either of these two results or some intermediate form.
10515 =item C<unroll>
10517 This is a single-dimensional space representing the schedule dimension(s)
10518 that should be I<completely> unrolled.
10519 To obtain a partial unrolling, the user should apply an additional
10520 strip-mining to the schedule and fully unroll the inner loop.
10522 =back
10524 =head3 Fine-grained Control over AST Generation
10526 Besides specifying the constraints on the parameters,
10527 an C<isl_ast_build> object can be used to control
10528 various aspects of the AST generation process.
10529 In case of AST construction using
10530 C<isl_ast_build_node_from_schedule_map>,
10531 the most prominent way of control is through ``options'',
10532 as explained above.
10534 Additional control is available through the following functions.
10536         #include <isl/ast_build.h>
10537         __isl_give isl_ast_build *
10538         isl_ast_build_set_iterators(
10539                 __isl_take isl_ast_build *control,
10540                 __isl_take isl_id_list *iterators);
10542 The function C<isl_ast_build_set_iterators> allows the user to
10543 specify a list of iterator C<isl_id>s to be used as iterators.
10544 If the input schedule is injective, then
10545 the number of elements in this list should be as large as the dimension
10546 of the schedule space, but no direct correspondence should be assumed
10547 between dimensions and elements.
10548 If the input schedule is not injective, then an additional number
10549 of C<isl_id>s equal to the largest dimension of the input domains
10550 may be required.
10551 If the number of provided C<isl_id>s is insufficient, then additional
10552 names are automatically generated.
10554         #include <isl/ast_build.h>
10555         __isl_give isl_ast_build *
10556         isl_ast_build_set_create_leaf(
10557                 __isl_take isl_ast_build *control,
10558                 __isl_give isl_ast_node *(*fn)(
10559                         __isl_take isl_ast_build *build,
10560                         void *user), void *user);
10563 C<isl_ast_build_set_create_leaf> function allows for the
10564 specification of a callback that should be called whenever the AST
10565 generator arrives at an element of the schedule domain.
10566 The callback should return an AST node that should be inserted
10567 at the corresponding position of the AST.  The default action (when
10568 the callback is not set) is to continue generating parts of the AST to scan
10569 all the domain elements associated to the schedule domain element
10570 and to insert user nodes, ``calling'' the domain element, for each of them.
10571 The C<build> argument contains the current state of the C<isl_ast_build>.
10572 To ease nested AST generation (see L</"Nested AST Generation">),
10573 all control information that is
10574 specific to the current AST generation such as the options and
10575 the callbacks has been removed from this C<isl_ast_build>.
10576 The callback would typically return the result of a nested
10577 AST generation or a
10578 user defined node created using the following function.
10580         #include <isl/ast.h>
10581         __isl_give isl_ast_node *isl_ast_node_alloc_user(
10582                 __isl_take isl_ast_expr *expr);
10584         #include <isl/ast_build.h>
10585         __isl_give isl_ast_build *
10586         isl_ast_build_set_at_each_domain(
10587                 __isl_take isl_ast_build *build,
10588                 __isl_give isl_ast_node *(*fn)(
10589                         __isl_take isl_ast_node *node,
10590                         __isl_keep isl_ast_build *build,
10591                         void *user), void *user);
10592         __isl_give isl_ast_build *
10593         isl_ast_build_set_before_each_for(
10594                 __isl_take isl_ast_build *build,
10595                 __isl_give isl_id *(*fn)(
10596                         __isl_keep isl_ast_build *build,
10597                         void *user), void *user);
10598         __isl_give isl_ast_build *
10599         isl_ast_build_set_after_each_for(
10600                 __isl_take isl_ast_build *build,
10601                 __isl_give isl_ast_node *(*fn)(
10602                         __isl_take isl_ast_node *node,
10603                         __isl_keep isl_ast_build *build,
10604                         void *user), void *user);
10605         __isl_give isl_ast_build *
10606         isl_ast_build_set_before_each_mark(
10607                 __isl_take isl_ast_build *build,
10608                 isl_stat (*fn)(__isl_keep isl_id *mark,
10609                         __isl_keep isl_ast_build *build,
10610                         void *user), void *user);
10611         __isl_give isl_ast_build *
10612         isl_ast_build_set_after_each_mark(
10613                 __isl_take isl_ast_build *build,
10614                 __isl_give isl_ast_node *(*fn)(
10615                         __isl_take isl_ast_node *node,
10616                         __isl_keep isl_ast_build *build,
10617                         void *user), void *user);
10619 The callback set by C<isl_ast_build_set_at_each_domain> will
10620 be called for each domain AST node.
10621 The callbacks set by C<isl_ast_build_set_before_each_for>
10622 and C<isl_ast_build_set_after_each_for> will be called
10623 for each for AST node.  The first will be called in depth-first
10624 pre-order, while the second will be called in depth-first post-order.
10625 Since C<isl_ast_build_set_before_each_for> is called before the for
10626 node is actually constructed, it is only passed an C<isl_ast_build>.
10627 The returned C<isl_id> will be added as an annotation (using
10628 C<isl_ast_node_set_annotation>) to the constructed for node.
10629 In particular, if the user has also specified an C<after_each_for>
10630 callback, then the annotation can be retrieved from the node passed to
10631 that callback using C<isl_ast_node_get_annotation>.
10632 The callbacks set by C<isl_ast_build_set_before_each_mark>
10633 and C<isl_ast_build_set_after_each_mark> will be called for each
10634 mark AST node that is created, i.e., for each mark schedule node
10635 in the input schedule tree.  The first will be called in depth-first
10636 pre-order, while the second will be called in depth-first post-order.
10637 Since the callback set by C<isl_ast_build_set_before_each_mark>
10638 is called before the mark AST node is actually constructed, it is passed
10639 the identifier of the mark node.
10640 All callbacks should C<NULL> (or -1) on failure.
10641 The given C<isl_ast_build> can be used to create new
10642 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
10643 or C<isl_ast_build_call_from_pw_multi_aff>.
10645 =head3 Nested AST Generation
10647 C<isl> allows the user to create an AST within the context
10648 of another AST.  These nested ASTs are created using the
10649 same C<isl_ast_build_node_from_schedule_map> function that is used to create
10650 the outer AST.  The C<build> argument should be an C<isl_ast_build>
10651 passed to a callback set by
10652 C<isl_ast_build_set_create_leaf>.
10653 The space of the range of the C<schedule> argument should refer
10654 to this build.  In particular, the space should be a wrapped
10655 relation and the domain of this wrapped relation should be the
10656 same as that of the range of the schedule returned by
10657 C<isl_ast_build_get_schedule> below.
10658 In practice, the new schedule is typically
10659 created by calling C<isl_union_map_range_product> on the old schedule
10660 and some extra piece of the schedule.
10661 The space of the schedule domain is also available from
10662 the C<isl_ast_build>.
10664         #include <isl/ast_build.h>
10665         __isl_give isl_union_map *isl_ast_build_get_schedule(
10666                 __isl_keep isl_ast_build *build);
10667         __isl_give isl_space *isl_ast_build_get_schedule_space(
10668                 __isl_keep isl_ast_build *build);
10669         __isl_give isl_ast_build *isl_ast_build_restrict(
10670                 __isl_take isl_ast_build *build,
10671                 __isl_take isl_set *set);
10673 The C<isl_ast_build_get_schedule> function returns a (partial)
10674 schedule for the domains elements for which part of the AST still needs to
10675 be generated in the current build.
10676 In particular, the domain elements are mapped to those iterations of the loops
10677 enclosing the current point of the AST generation inside which
10678 the domain elements are executed.
10679 No direct correspondence between
10680 the input schedule and this schedule should be assumed.
10681 The space obtained from C<isl_ast_build_get_schedule_space> can be used
10682 to create a set for C<isl_ast_build_restrict> to intersect
10683 with the current build.  In particular, the set passed to
10684 C<isl_ast_build_restrict> can have additional parameters.
10685 The ids of the set dimensions in the space returned by
10686 C<isl_ast_build_get_schedule_space> correspond to the
10687 iterators of the already generated loops.
10688 The user should not rely on the ids of the output dimensions
10689 of the relations in the union relation returned by
10690 C<isl_ast_build_get_schedule> having any particular value.
10692 =head1 Applications
10694 Although C<isl> is mainly meant to be used as a library,
10695 it also contains some basic applications that use some
10696 of the functionality of C<isl>.
10697 For applications that take one or more polytopes or polyhedra
10698 as input, this input may be specified in either the L<isl format>
10699 or the L<PolyLib format>.
10701 =head2 C<isl_polyhedron_sample>
10703 C<isl_polyhedron_sample> takes a polyhedron as input and prints
10704 an integer element of the polyhedron, if there is any.
10705 The first column in the output is the denominator and is always
10706 equal to 1.  If the polyhedron contains no integer points,
10707 then a vector of length zero is printed.
10709 =head2 C<isl_pip>
10711 C<isl_pip> takes the same input as the C<example> program
10712 from the C<piplib> distribution, i.e., a set of constraints
10713 on the parameters, a line containing only -1 and finally a set
10714 of constraints on a parametric polyhedron.
10715 The coefficients of the parameters appear in the last columns
10716 (but before the final constant column).
10717 The output is the lexicographic minimum of the parametric polyhedron.
10718 As C<isl> currently does not have its own output format, the output
10719 is just a dump of the internal state.
10721 =head2 C<isl_polyhedron_minimize>
10723 C<isl_polyhedron_minimize> computes the minimum of some linear
10724 or affine objective function over the integer points in a polyhedron.
10725 If an affine objective function
10726 is given, then the constant should appear in the last column.
10728 =head2 C<isl_polytope_scan>
10730 Given a polytope, C<isl_polytope_scan> prints
10731 all integer points in the polytope.
10733 =head2 C<isl_codegen>
10735 Given either a schedule tree or a sequence consisting of
10736 a schedule map, a context set and an options relation,
10737 C<isl_codegen> prints out an AST that scans the domain elements
10738 of the schedule in the order of their image(s) taking into account
10739 the constraints in the context set.
10741 =head2 C<isl_schedule>
10743 Given an C<isl_schedule_constraints> object as input,
10744 C<isl_schedule> prints out a schedule that satisfies the given
10745 constraints.