rename isl_ast_build_ast_from_schedule to isl_ast_build_node_from_schedule_map
[isl.git] / doc / user.pod
blobc8259a70fb90cfa8613efab1a0843d8851cda7ef
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 is 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 * Objects of type C<isl_union_pw_multi_aff> can no longer contain
216 two or more C<isl_pw_multi_aff> objects with the same domain space.
218 =item * The function C<isl_union_pw_multi_aff_add> now consistently
219 computes the sum on the shared definition domain.
220 The function C<isl_union_pw_multi_aff_union_add> has been added
221 to compute the sum on the union of definition domains.
222 The original behavior of C<isl_union_pw_multi_aff_add> was
223 confused and is no longer available.
225 =item * Band forests have been replaced by schedule trees.
227 =item * The function C<isl_union_map_compute_flow> has been
228 replaced by the function C<isl_union_access_info_compute_flow>.
229 Note that the may dependence relation returned by
230 C<isl_union_flow_get_may_dependence> is the union of
231 the two dependence relations returned by
232 C<isl_union_map_compute_flow>.  Similarly for the no source relations.
233 The function C<isl_union_map_compute_flow> is still available
234 for backward compatibility, but it will be removed in the future.
236 =item * The function C<isl_basic_set_drop_constraint> has been
237 deprecated.
239 =item * The function C<isl_ast_build_ast_from_schedule> has been
240 renamed to C<isl_ast_build_node_from_schedule_map>.
241 The original name is still available
242 for backward compatibility, but it will be removed in the future.
244 =back
246 =head1 License
248 C<isl> is released under the MIT license.
250 =over
252 Permission is hereby granted, free of charge, to any person obtaining a copy of
253 this software and associated documentation files (the "Software"), to deal in
254 the Software without restriction, including without limitation the rights to
255 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
256 of the Software, and to permit persons to whom the Software is furnished to do
257 so, subject to the following conditions:
259 The above copyright notice and this permission notice shall be included in all
260 copies or substantial portions of the Software.
262 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
263 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
264 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
265 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
266 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
267 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
268 SOFTWARE.
270 =back
272 Note that by default C<isl> requires C<GMP>, which is released
273 under the GNU Lesser General Public License (LGPL).  This means
274 that code linked against C<isl> is also linked against LGPL code.
276 When configuring with C<--with-int=imath>, C<isl> will link against C<imath>, a
277 library for exact integer arithmetic released under the MIT license.
279 =head1 Installation
281 The source of C<isl> can be obtained either as a tarball
282 or from the git repository.  Both are available from
283 L<http://freshmeat.net/projects/isl/>.
284 The installation process depends on how you obtained
285 the source.
287 =head2 Installation from the git repository
289 =over
291 =item 1 Clone or update the repository
293 The first time the source is obtained, you need to clone
294 the repository.
296         git clone git://repo.or.cz/isl.git
298 To obtain updates, you need to pull in the latest changes
300         git pull
302 =item 2 Optionally get C<imath> submodule
304 To build C<isl> with C<imath>, you need to obtain the C<imath>
305 submodule by running in the git source tree of C<isl>
307        git submodule init
308        git submodule update
310 This will fetch the required version of C<imath> in a subdirectory of C<isl>.
312 =item 2 Generate C<configure>
314         ./autogen.sh
316 =back
318 After performing the above steps, continue
319 with the L<Common installation instructions>.
321 =head2 Common installation instructions
323 =over
325 =item 1 Obtain C<GMP>
327 By default, building C<isl> requires C<GMP>, including its headers files.
328 Your distribution may not provide these header files by default
329 and you may need to install a package called C<gmp-devel> or something
330 similar.  Alternatively, C<GMP> can be built from
331 source, available from L<http://gmplib.org/>.
332 C<GMP> is not needed if you build C<isl> with C<imath>.
334 =item 2 Configure
336 C<isl> uses the standard C<autoconf> C<configure> script.
337 To run it, just type
339         ./configure
341 optionally followed by some configure options.
342 A complete list of options can be obtained by running
344         ./configure --help
346 Below we discuss some of the more common options.
348 =over
350 =item C<--prefix>
352 Installation prefix for C<isl>
354 =item C<--with-int=[gmp|imath]>
356 Select the integer library to be used by C<isl>, the default is C<gmp>.
357 Note that C<isl> may run significantly slower if you use C<imath>.
359 =item C<--with-gmp-prefix>
361 Installation prefix for C<GMP> (architecture-independent files).
363 =item C<--with-gmp-exec-prefix>
365 Installation prefix for C<GMP> (architecture-dependent files).
367 =back
369 =item 3 Compile
371         make
373 =item 4 Install (optional)
375         make install
377 =back
379 =head1 Integer Set Library
381 =head2 Memory Management
383 Since a high-level operation on isl objects usually involves
384 several substeps and since the user is usually not interested in
385 the intermediate results, most functions that return a new object
386 will also release all the objects passed as arguments.
387 If the user still wants to use one or more of these arguments
388 after the function call, she should pass along a copy of the
389 object rather than the object itself.
390 The user is then responsible for making sure that the original
391 object gets used somewhere else or is explicitly freed.
393 The arguments and return values of all documented functions are
394 annotated to make clear which arguments are released and which
395 arguments are preserved.  In particular, the following annotations
396 are used
398 =over
400 =item C<__isl_give>
402 C<__isl_give> means that a new object is returned.
403 The user should make sure that the returned pointer is
404 used exactly once as a value for an C<__isl_take> argument.
405 In between, it can be used as a value for as many
406 C<__isl_keep> arguments as the user likes.
407 There is one exception, and that is the case where the
408 pointer returned is C<NULL>.  Is this case, the user
409 is free to use it as an C<__isl_take> argument or not.
410 When applied to a C<char *>, the returned pointer needs to be
411 freed using C<free>.
413 =item C<__isl_null>
415 C<__isl_null> means that a C<NULL> value is returned.
417 =item C<__isl_take>
419 C<__isl_take> means that the object the argument points to
420 is taken over by the function and may no longer be used
421 by the user as an argument to any other function.
422 The pointer value must be one returned by a function
423 returning an C<__isl_give> pointer.
424 If the user passes in a C<NULL> value, then this will
425 be treated as an error in the sense that the function will
426 not perform its usual operation.  However, it will still
427 make sure that all the other C<__isl_take> arguments
428 are released.
430 =item C<__isl_keep>
432 C<__isl_keep> means that the function will only use the object
433 temporarily.  After the function has finished, the user
434 can still use it as an argument to other functions.
435 A C<NULL> value will be treated in the same way as
436 a C<NULL> value for an C<__isl_take> argument.
437 This annotation may also be used on return values of
438 type C<const char *>, in which case the returned pointer should
439 not be freed by the user and is only valid until the object
440 from which it was derived is updated or freed.
442 =back
444 =head2 Initialization
446 All manipulations of integer sets and relations occur within
447 the context of an C<isl_ctx>.
448 A given C<isl_ctx> can only be used within a single thread.
449 All arguments of a function are required to have been allocated
450 within the same context.
451 There are currently no functions available for moving an object
452 from one C<isl_ctx> to another C<isl_ctx>.  This means that
453 there is currently no way of safely moving an object from one
454 thread to another, unless the whole C<isl_ctx> is moved.
456 An C<isl_ctx> can be allocated using C<isl_ctx_alloc> and
457 freed using C<isl_ctx_free>.
458 All objects allocated within an C<isl_ctx> should be freed
459 before the C<isl_ctx> itself is freed.
461         isl_ctx *isl_ctx_alloc();
462         void isl_ctx_free(isl_ctx *ctx);
464 The user can impose a bound on the number of low-level I<operations>
465 that can be performed by an C<isl_ctx>.  This bound can be set and
466 retrieved using the following functions.  A bound of zero means that
467 no bound is imposed.  The number of operations performed can be
468 reset using C<isl_ctx_reset_operations>.  Note that the number
469 of low-level operations needed to perform a high-level computation
470 may differ significantly across different versions
471 of C<isl>, but it should be the same across different platforms
472 for the same version of C<isl>.
474 Warning: This feature is experimental.  C<isl> has good support to abort and
475 bail out during the computation, but this feature may exercise error code paths
476 that are normally not used that much. Consequently, it is not unlikely that
477 hidden bugs will be exposed.
479         void isl_ctx_set_max_operations(isl_ctx *ctx,
480                 unsigned long max_operations);
481         unsigned long isl_ctx_get_max_operations(isl_ctx *ctx);
482         void isl_ctx_reset_operations(isl_ctx *ctx);
484 In order to be able to create an object in the same context
485 as another object, most object types (described later in
486 this document) provide a function to obtain the context
487 in which the object was created.
489         #include <isl/val.h>
490         isl_ctx *isl_val_get_ctx(__isl_keep isl_val *val);
491         isl_ctx *isl_multi_val_get_ctx(
492                 __isl_keep isl_multi_val *mv);
494         #include <isl/id.h>
495         isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
497         #include <isl/local_space.h>
498         isl_ctx *isl_local_space_get_ctx(
499                 __isl_keep isl_local_space *ls);
501         #include <isl/set.h>
502         isl_ctx *isl_set_list_get_ctx(
503                 __isl_keep isl_set_list *list);
505         #include <isl/aff.h>
506         isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
507         isl_ctx *isl_multi_aff_get_ctx(
508                 __isl_keep isl_multi_aff *maff);
509         isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pa);
510         isl_ctx *isl_pw_multi_aff_get_ctx(
511                 __isl_keep isl_pw_multi_aff *pma);
512         isl_ctx *isl_multi_pw_aff_get_ctx(
513                 __isl_keep isl_multi_pw_aff *mpa);
514         isl_ctx *isl_union_pw_aff_get_ctx(
515                 __isl_keep isl_union_pw_aff *upa);
516         isl_ctx *isl_union_pw_multi_aff_get_ctx(
517                 __isl_keep isl_union_pw_multi_aff *upma);
518         isl_ctx *isl_multi_union_pw_aff_get_ctx(
519                 __isl_keep isl_multi_union_pw_aff *mupa);
521         #include <isl/id_to_ast_expr.h>
522         isl_ctx *isl_id_to_ast_expr_get_ctx(
523                 __isl_keep isl_id_to_ast_expr *id2expr);
525         #include <isl/point.h>
526         isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
528         #include <isl/vec.h>
529         isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
531         #include <isl/mat.h>
532         isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
534         #include <isl/vertices.h>
535         isl_ctx *isl_vertices_get_ctx(
536                 __isl_keep isl_vertices *vertices);
537         isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
538         isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
540         #include <isl/flow.h>
541         isl_ctx *isl_restriction_get_ctx(
542                 __isl_keep isl_restriction *restr);
544         #include <isl/schedule.h>
545         isl_ctx *isl_schedule_get_ctx(
546                 __isl_keep isl_schedule *sched);
547         isl_ctx *isl_schedule_constraints_get_ctx(
548                 __isl_keep isl_schedule_constraints *sc);
550         #include <isl/schedule_node.h>
551         isl_ctx *isl_schedule_node_get_ctx(
552                 __isl_keep isl_schedule_node *node);
554         #include <isl/band.h>
555         isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band);
557         #include <isl/ast_build.h>
558         isl_ctx *isl_ast_build_get_ctx(
559                 __isl_keep isl_ast_build *build);
561         #include <isl/ast.h>
562         isl_ctx *isl_ast_expr_get_ctx(
563                 __isl_keep isl_ast_expr *expr);
564         isl_ctx *isl_ast_node_get_ctx(
565                 __isl_keep isl_ast_node *node);
567 =head2 Values
569 An C<isl_val> represents an integer value, a rational value
570 or one of three special values, infinity, negative infinity and NaN.
571 Some predefined values can be created using the following functions.
573         #include <isl/val.h>
574         __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
575         __isl_give isl_val *isl_val_one(isl_ctx *ctx);
576         __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
577         __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
578         __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
579         __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
581 Specific integer values can be created using the following functions.
583         #include <isl/val.h>
584         __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
585                 long i);
586         __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
587                 unsigned long u);
588         __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
589                 size_t n, size_t size, const void *chunks);
591 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
592 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
593 The least significant digit is assumed to be stored first.
595 Value objects can be copied and freed using the following functions.
597         #include <isl/val.h>
598         __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
599         __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
601 They can be inspected using the following functions.
603         #include <isl/val.h>
604         long isl_val_get_num_si(__isl_keep isl_val *v);
605         long isl_val_get_den_si(__isl_keep isl_val *v);
606         double isl_val_get_d(__isl_keep isl_val *v);
607         size_t isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
608                 size_t size);
609         int isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
610                 size_t size, void *chunks);
612 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
613 of C<size> bytes needed to store the absolute value of the
614 numerator of C<v>.
615 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
616 which is assumed to have been preallocated by the caller.
617 The least significant digit is stored first.
618 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
619 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
620 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
622 An C<isl_val> can be modified using the following function.
624         #include <isl/val.h>
625         __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
626                 long i);
628 The following unary properties are defined on C<isl_val>s.
630         #include <isl/val.h>
631         int isl_val_sgn(__isl_keep isl_val *v);
632         int isl_val_is_zero(__isl_keep isl_val *v);
633         int isl_val_is_one(__isl_keep isl_val *v);
634         int isl_val_is_negone(__isl_keep isl_val *v);
635         int isl_val_is_nonneg(__isl_keep isl_val *v);
636         int isl_val_is_nonpos(__isl_keep isl_val *v);
637         int isl_val_is_pos(__isl_keep isl_val *v);
638         int isl_val_is_neg(__isl_keep isl_val *v);
639         int isl_val_is_int(__isl_keep isl_val *v);
640         int isl_val_is_rat(__isl_keep isl_val *v);
641         int isl_val_is_nan(__isl_keep isl_val *v);
642         int isl_val_is_infty(__isl_keep isl_val *v);
643         int isl_val_is_neginfty(__isl_keep isl_val *v);
645 Note that the sign of NaN is undefined.
647 The following binary properties are defined on pairs of C<isl_val>s.
649         #include <isl/val.h>
650         int isl_val_lt(__isl_keep isl_val *v1,
651                 __isl_keep isl_val *v2);
652         int isl_val_le(__isl_keep isl_val *v1,
653                 __isl_keep isl_val *v2);
654         int isl_val_gt(__isl_keep isl_val *v1,
655                 __isl_keep isl_val *v2);
656         int isl_val_ge(__isl_keep isl_val *v1,
657                 __isl_keep isl_val *v2);
658         int isl_val_eq(__isl_keep isl_val *v1,
659                 __isl_keep isl_val *v2);
660         int isl_val_ne(__isl_keep isl_val *v1,
661                 __isl_keep isl_val *v2);
662         int isl_val_abs_eq(__isl_keep isl_val *v1,
663                 __isl_keep isl_val *v2);
665 The function C<isl_val_abs_eq> checks whether its two arguments
666 are equal in absolute value.
668 For integer C<isl_val>s we additionally have the following binary property.
670         #include <isl/val.h>
671         int isl_val_is_divisible_by(__isl_keep isl_val *v1,
672                 __isl_keep isl_val *v2);
674 An C<isl_val> can also be compared to an integer using the following
675 function.  The result is undefined for NaN.
677         #include <isl/val.h>
678         int isl_val_cmp_si(__isl_keep isl_val *v, long i);
680 The following unary operations are available on C<isl_val>s.
682         #include <isl/val.h>
683         __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
684         __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
685         __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
686         __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
687         __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
688         __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
689         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
691 The following binary operations are available on C<isl_val>s.
693         #include <isl/val.h>
694         __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
695                 __isl_take isl_val *v2);
696         __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
697                 __isl_take isl_val *v2);
698         __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
699                 __isl_take isl_val *v2);
700         __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
701                 unsigned long v2);
702         __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
703                 __isl_take isl_val *v2);
704         __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
705                 unsigned long v2);
706         __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
707                 __isl_take isl_val *v2);
708         __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
709                 unsigned long v2);
710         __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
711                 __isl_take isl_val *v2);
713 On integer values, we additionally have the following operations.
715         #include <isl/val.h>
716         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
717         __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
718                 __isl_take isl_val *v2);
719         __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
720                 __isl_take isl_val *v2);
721         __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
722                 __isl_take isl_val *v2, __isl_give isl_val **x,
723                 __isl_give isl_val **y);
725 The function C<isl_val_gcdext> returns the greatest common divisor g
726 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
727 that C<*x> * C<v1> + C<*y> * C<v2> = g.
729 =head3 GMP specific functions
731 These functions are only available if C<isl> has been compiled with C<GMP>
732 support.
734 Specific integer and rational values can be created from C<GMP> values using
735 the following functions.
737         #include <isl/val_gmp.h>
738         __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
739                 mpz_t z);
740         __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
741                 const mpz_t n, const mpz_t d);
743 The numerator and denominator of a rational value can be extracted as
744 C<GMP> values using the following functions.
746         #include <isl/val_gmp.h>
747         int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
748         int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
750 =head2 Sets and Relations
752 C<isl> uses six types of objects for representing sets and relations,
753 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
754 C<isl_union_set> and C<isl_union_map>.
755 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
756 can be described as a conjunction of affine constraints, while
757 C<isl_set> and C<isl_map> represent unions of
758 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
759 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
760 to live in the same space.  C<isl_union_set>s and C<isl_union_map>s
761 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
762 where spaces are considered different if they have a different number
763 of dimensions and/or different names (see L<"Spaces">).
764 The difference between sets and relations (maps) is that sets have
765 one set of variables, while relations have two sets of variables,
766 input variables and output variables.
768 =head2 Error Handling
770 C<isl> supports different ways to react in case a runtime error is triggered.
771 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
772 with two maps that have incompatible spaces. There are three possible ways
773 to react on error: to warn, to continue or to abort.
775 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
776 the last error in the corresponding C<isl_ctx> and the function in which the
777 error was triggered returns C<NULL>. An error does not corrupt internal state,
778 such that isl can continue to be used. C<isl> also provides functions to
779 read the last error and to reset the memory that stores the last error. The
780 last error is only stored for information purposes. Its presence does not
781 change the behavior of C<isl>. Hence, resetting an error is not required to
782 continue to use isl, but only to observe new errors.
784         #include <isl/ctx.h>
785         enum isl_error isl_ctx_last_error(isl_ctx *ctx);
786         void isl_ctx_reset_error(isl_ctx *ctx);
788 Another option is to continue on error. This is similar to warn on error mode,
789 except that C<isl> does not print any warning. This allows a program to
790 implement its own error reporting.
792 The last option is to directly abort the execution of the program from within
793 the isl library. This makes it obviously impossible to recover from an error,
794 but it allows to directly spot the error location. By aborting on error,
795 debuggers break at the location the error occurred and can provide a stack
796 trace. Other tools that automatically provide stack traces on abort or that do
797 not want to continue execution after an error was triggered may also prefer to
798 abort on error.
800 The on error behavior of isl can be specified by calling
801 C<isl_options_set_on_error> or by setting the command line option
802 C<--isl-on-error>. Valid arguments for the function call are
803 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
804 choices for the command line option are C<warn>, C<continue> and C<abort>.
805 It is also possible to query the current error mode.
807         #include <isl/options.h>
808         int isl_options_set_on_error(isl_ctx *ctx, int val);
809         int isl_options_get_on_error(isl_ctx *ctx);
811 =head2 Identifiers
813 Identifiers are used to identify both individual dimensions
814 and tuples of dimensions.  They consist of an optional name and an optional
815 user pointer.  The name and the user pointer cannot both be C<NULL>, however.
816 Identifiers with the same name but different pointer values
817 are considered to be distinct.
818 Similarly, identifiers with different names but the same pointer value
819 are also considered to be distinct.
820 Equal identifiers are represented using the same object.
821 Pairs of identifiers can therefore be tested for equality using the
822 C<==> operator.
823 Identifiers can be constructed, copied, freed, inspected and printed
824 using the following functions.
826         #include <isl/id.h>
827         __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
828                 __isl_keep const char *name, void *user);
829         __isl_give isl_id *isl_id_set_free_user(
830                 __isl_take isl_id *id,
831                 __isl_give void (*free_user)(void *user));
832         __isl_give isl_id *isl_id_copy(isl_id *id);
833         __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
835         void *isl_id_get_user(__isl_keep isl_id *id);
836         __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
838         __isl_give isl_printer *isl_printer_print_id(
839                 __isl_take isl_printer *p, __isl_keep isl_id *id);
841 The callback set by C<isl_id_set_free_user> is called on the user
842 pointer when the last reference to the C<isl_id> is freed.
843 Note that C<isl_id_get_name> returns a pointer to some internal
844 data structure, so the result can only be used while the
845 corresponding C<isl_id> is alive.
847 =head2 Spaces
849 Whenever a new set, relation or similar object is created from scratch,
850 the space in which it lives needs to be specified using an C<isl_space>.
851 Each space involves zero or more parameters and zero, one or two
852 tuples of set or input/output dimensions.  The parameters and dimensions
853 are identified by an C<isl_dim_type> and a position.
854 The type C<isl_dim_param> refers to parameters,
855 the type C<isl_dim_set> refers to set dimensions (for spaces
856 with a single tuple of dimensions) and the types C<isl_dim_in>
857 and C<isl_dim_out> refer to input and output dimensions
858 (for spaces with two tuples of dimensions).
859 Local spaces (see L</"Local Spaces">) also contain dimensions
860 of type C<isl_dim_div>.
861 Note that parameters are only identified by their position within
862 a given object.  Across different objects, parameters are (usually)
863 identified by their names or identifiers.  Only unnamed parameters
864 are identified by their positions across objects.  The use of unnamed
865 parameters is discouraged.
867         #include <isl/space.h>
868         __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
869                 unsigned nparam, unsigned n_in, unsigned n_out);
870         __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
871                 unsigned nparam);
872         __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
873                 unsigned nparam, unsigned dim);
874         __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
875         __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
877 The space used for creating a parameter domain
878 needs to be created using C<isl_space_params_alloc>.
879 For other sets, the space
880 needs to be created using C<isl_space_set_alloc>, while
881 for a relation, the space
882 needs to be created using C<isl_space_alloc>.
884 To check whether a given space is that of a set or a map
885 or whether it is a parameter space, use these functions:
887         #include <isl/space.h>
888         int isl_space_is_params(__isl_keep isl_space *space);
889         int isl_space_is_set(__isl_keep isl_space *space);
890         int isl_space_is_map(__isl_keep isl_space *space);
892 Spaces can be compared using the following functions:
894         #include <isl/space.h>
895         int isl_space_is_equal(__isl_keep isl_space *space1,
896                 __isl_keep isl_space *space2);
897         int isl_space_is_domain(__isl_keep isl_space *space1,
898                 __isl_keep isl_space *space2);
899         int isl_space_is_range(__isl_keep isl_space *space1,
900                 __isl_keep isl_space *space2);
901         int isl_space_tuple_is_equal(
902                 __isl_keep isl_space *space1,
903                 enum isl_dim_type type1,
904                 __isl_keep isl_space *space2,
905                 enum isl_dim_type type2);
907 C<isl_space_is_domain> checks whether the first argument is equal
908 to the domain of the second argument.  This requires in particular that
909 the first argument is a set space and that the second argument
910 is a map space.  C<isl_space_tuple_is_equal> checks whether the given
911 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
912 spaces are the same.  That is, it checks if they have the same
913 identifier (if any), the same dimension and the same internal structure
914 (if any).
916 It is often useful to create objects that live in the
917 same space as some other object.  This can be accomplished
918 by creating the new objects
919 (see L</"Creating New Sets and Relations"> or
920 L</"Functions">) based on the space
921 of the original object.
923         #include <isl/set.h>
924         __isl_give isl_space *isl_basic_set_get_space(
925                 __isl_keep isl_basic_set *bset);
926         __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
928         #include <isl/union_set.h>
929         __isl_give isl_space *isl_union_set_get_space(
930                 __isl_keep isl_union_set *uset);
932         #include <isl/map.h>
933         __isl_give isl_space *isl_basic_map_get_space(
934                 __isl_keep isl_basic_map *bmap);
935         __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
937         #include <isl/union_map.h>
938         __isl_give isl_space *isl_union_map_get_space(
939                 __isl_keep isl_union_map *umap);
941         #include <isl/constraint.h>
942         __isl_give isl_space *isl_constraint_get_space(
943                 __isl_keep isl_constraint *constraint);
945         #include <isl/polynomial.h>
946         __isl_give isl_space *isl_qpolynomial_get_domain_space(
947                 __isl_keep isl_qpolynomial *qp);
948         __isl_give isl_space *isl_qpolynomial_get_space(
949                 __isl_keep isl_qpolynomial *qp);
950         __isl_give isl_space *isl_qpolynomial_fold_get_space(
951                 __isl_keep isl_qpolynomial_fold *fold);
952         __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
953                 __isl_keep isl_pw_qpolynomial *pwqp);
954         __isl_give isl_space *isl_pw_qpolynomial_get_space(
955                 __isl_keep isl_pw_qpolynomial *pwqp);
956         __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
957                 __isl_keep isl_pw_qpolynomial_fold *pwf);
958         __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
959                 __isl_keep isl_pw_qpolynomial_fold *pwf);
960         __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
961                 __isl_keep isl_union_pw_qpolynomial *upwqp);
962         __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
963                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
965         #include <isl/val.h>
966         __isl_give isl_space *isl_multi_val_get_space(
967                 __isl_keep isl_multi_val *mv);
969         #include <isl/aff.h>
970         __isl_give isl_space *isl_aff_get_domain_space(
971                 __isl_keep isl_aff *aff);
972         __isl_give isl_space *isl_aff_get_space(
973                 __isl_keep isl_aff *aff);
974         __isl_give isl_space *isl_pw_aff_get_domain_space(
975                 __isl_keep isl_pw_aff *pwaff);
976         __isl_give isl_space *isl_pw_aff_get_space(
977                 __isl_keep isl_pw_aff *pwaff);
978         __isl_give isl_space *isl_multi_aff_get_domain_space(
979                 __isl_keep isl_multi_aff *maff);
980         __isl_give isl_space *isl_multi_aff_get_space(
981                 __isl_keep isl_multi_aff *maff);
982         __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
983                 __isl_keep isl_pw_multi_aff *pma);
984         __isl_give isl_space *isl_pw_multi_aff_get_space(
985                 __isl_keep isl_pw_multi_aff *pma);
986         __isl_give isl_space *isl_union_pw_aff_get_space(
987                 __isl_keep isl_union_pw_aff *upa);
988         __isl_give isl_space *isl_union_pw_multi_aff_get_space(
989                 __isl_keep isl_union_pw_multi_aff *upma);
990         __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
991                 __isl_keep isl_multi_pw_aff *mpa);
992         __isl_give isl_space *isl_multi_pw_aff_get_space(
993                 __isl_keep isl_multi_pw_aff *mpa);
994         __isl_give isl_space *
995         isl_multi_union_pw_aff_get_domain_space(
996                 __isl_keep isl_multi_union_pw_aff *mupa);
997         __isl_give isl_space *
998         isl_multi_union_pw_aff_get_space(
999                 __isl_keep isl_multi_union_pw_aff *mupa);
1001         #include <isl/point.h>
1002         __isl_give isl_space *isl_point_get_space(
1003                 __isl_keep isl_point *pnt);
1005 The number of dimensions of a given type of space
1006 may be read off from a space or an object that lives
1007 in a space using the following functions.
1008 In case of C<isl_space_dim>, type may be
1009 C<isl_dim_param>, C<isl_dim_in> (only for relations),
1010 C<isl_dim_out> (only for relations), C<isl_dim_set>
1011 (only for sets) or C<isl_dim_all>.
1013         #include <isl/space.h>
1014         unsigned isl_space_dim(__isl_keep isl_space *space,
1015                 enum isl_dim_type type);
1017         #include <isl/local_space.h>
1018         int isl_local_space_dim(__isl_keep isl_local_space *ls,
1019                 enum isl_dim_type type);
1021         #include <isl/set.h>
1022         unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1023                 enum isl_dim_type type);
1024         unsigned isl_set_dim(__isl_keep isl_set *set,
1025                 enum isl_dim_type type);
1027         #include <isl/union_set.h>
1028         unsigned isl_union_set_dim(__isl_keep isl_union_set *uset,
1029                 enum isl_dim_type type);
1031         #include <isl/map.h>
1032         unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1033                 enum isl_dim_type type);
1034         unsigned isl_map_dim(__isl_keep isl_map *map,
1035                 enum isl_dim_type type);
1037         #include <isl/union_map.h>
1038         unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
1039                 enum isl_dim_type type);
1041         #include <isl/val.h>
1042         unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1043                 enum isl_dim_type type);
1045         #include <isl/aff.h>
1046         int isl_aff_dim(__isl_keep isl_aff *aff,
1047                 enum isl_dim_type type);
1048         unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1049                 enum isl_dim_type type);
1050         unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1051                 enum isl_dim_type type);
1052         unsigned isl_pw_multi_aff_dim(
1053                 __isl_keep isl_pw_multi_aff *pma,
1054                 enum isl_dim_type type);
1055         unsigned isl_multi_pw_aff_dim(
1056                 __isl_keep isl_multi_pw_aff *mpa,
1057                 enum isl_dim_type type);
1058         unsigned isl_union_pw_aff_dim(
1059                 __isl_keep isl_union_pw_aff *upa,
1060                 enum isl_dim_type type);
1061         unsigned isl_union_pw_multi_aff_dim(
1062                 __isl_keep isl_union_pw_multi_aff *upma,
1063                 enum isl_dim_type type);
1064         unsigned isl_multi_union_pw_aff_dim(
1065                 __isl_keep isl_multi_union_pw_aff *mupa,
1066                 enum isl_dim_type type);
1068         #include <isl/polynomial.h>
1069         unsigned isl_union_pw_qpolynomial_dim(
1070                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1071                 enum isl_dim_type type);
1072         unsigned isl_union_pw_qpolynomial_fold_dim(
1073                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1074                 enum isl_dim_type type);
1076 Note that an C<isl_union_set>, an C<isl_union_map>,
1077 an C<isl_union_pw_multi_aff>,
1078 an C<isl_union_pw_qpolynomial> and
1079 an C<isl_union_pw_qpolynomial_fold>
1080 only have parameters.
1082 The identifiers or names of the individual dimensions of spaces
1083 may be set or read off using the following functions on spaces
1084 or objects that live in spaces.
1085 These functions are mostly useful to obtain the identifiers, positions
1086 or names of the parameters.  Identifiers of individual dimensions are
1087 essentially only useful for printing.  They are ignored by all other
1088 operations and may not be preserved across those operations.
1090         #include <isl/space.h>
1091         __isl_give isl_space *isl_space_set_dim_id(
1092                 __isl_take isl_space *space,
1093                 enum isl_dim_type type, unsigned pos,
1094                 __isl_take isl_id *id);
1095         int isl_space_has_dim_id(__isl_keep isl_space *space,
1096                 enum isl_dim_type type, unsigned pos);
1097         __isl_give isl_id *isl_space_get_dim_id(
1098                 __isl_keep isl_space *space,
1099                 enum isl_dim_type type, unsigned pos);
1100         __isl_give isl_space *isl_space_set_dim_name(
1101                 __isl_take isl_space *space,
1102                  enum isl_dim_type type, unsigned pos,
1103                  __isl_keep const char *name);
1104         int isl_space_has_dim_name(__isl_keep isl_space *space,
1105                 enum isl_dim_type type, unsigned pos);
1106         __isl_keep const char *isl_space_get_dim_name(
1107                 __isl_keep isl_space *space,
1108                 enum isl_dim_type type, unsigned pos);
1110         #include <isl/local_space.h>
1111         __isl_give isl_local_space *isl_local_space_set_dim_id(
1112                 __isl_take isl_local_space *ls,
1113                 enum isl_dim_type type, unsigned pos,
1114                 __isl_take isl_id *id);
1115         int isl_local_space_has_dim_id(
1116                 __isl_keep isl_local_space *ls,
1117                 enum isl_dim_type type, unsigned pos);
1118         __isl_give isl_id *isl_local_space_get_dim_id(
1119                 __isl_keep isl_local_space *ls,
1120                 enum isl_dim_type type, unsigned pos);
1121         __isl_give isl_local_space *isl_local_space_set_dim_name(
1122                 __isl_take isl_local_space *ls,
1123                 enum isl_dim_type type, unsigned pos, const char *s);
1124         int isl_local_space_has_dim_name(
1125                 __isl_keep isl_local_space *ls,
1126                 enum isl_dim_type type, unsigned pos)
1127         const char *isl_local_space_get_dim_name(
1128                 __isl_keep isl_local_space *ls,
1129                 enum isl_dim_type type, unsigned pos);
1131         #include <isl/constraint.h>
1132         const char *isl_constraint_get_dim_name(
1133                 __isl_keep isl_constraint *constraint,
1134                 enum isl_dim_type type, unsigned pos);
1136         #include <isl/set.h>
1137         __isl_give isl_id *isl_basic_set_get_dim_id(
1138                 __isl_keep isl_basic_set *bset,
1139                 enum isl_dim_type type, unsigned pos);
1140         __isl_give isl_set *isl_set_set_dim_id(
1141                 __isl_take isl_set *set, enum isl_dim_type type,
1142                 unsigned pos, __isl_take isl_id *id);
1143         int isl_set_has_dim_id(__isl_keep isl_set *set,
1144                 enum isl_dim_type type, unsigned pos);
1145         __isl_give isl_id *isl_set_get_dim_id(
1146                 __isl_keep isl_set *set, enum isl_dim_type type,
1147                 unsigned pos);
1148         const char *isl_basic_set_get_dim_name(
1149                 __isl_keep isl_basic_set *bset,
1150                 enum isl_dim_type type, unsigned pos);
1151         int isl_set_has_dim_name(__isl_keep isl_set *set,
1152                 enum isl_dim_type type, unsigned pos);
1153         const char *isl_set_get_dim_name(
1154                 __isl_keep isl_set *set,
1155                 enum isl_dim_type type, unsigned pos);
1157         #include <isl/map.h>
1158         __isl_give isl_map *isl_map_set_dim_id(
1159                 __isl_take isl_map *map, enum isl_dim_type type,
1160                 unsigned pos, __isl_take isl_id *id);
1161         int isl_basic_map_has_dim_id(
1162                 __isl_keep isl_basic_map *bmap,
1163                 enum isl_dim_type type, unsigned pos);
1164         int isl_map_has_dim_id(__isl_keep isl_map *map,
1165                 enum isl_dim_type type, unsigned pos);
1166         __isl_give isl_id *isl_map_get_dim_id(
1167                 __isl_keep isl_map *map, enum isl_dim_type type,
1168                 unsigned pos);
1169         __isl_give isl_id *isl_union_map_get_dim_id(
1170                 __isl_keep isl_union_map *umap,
1171                 enum isl_dim_type type, unsigned pos);
1172         const char *isl_basic_map_get_dim_name(
1173                 __isl_keep isl_basic_map *bmap,
1174                 enum isl_dim_type type, unsigned pos);
1175         int isl_map_has_dim_name(__isl_keep isl_map *map,
1176                 enum isl_dim_type type, unsigned pos);
1177         const char *isl_map_get_dim_name(
1178                 __isl_keep isl_map *map,
1179                 enum isl_dim_type type, unsigned pos);
1181         #include <isl/val.h>
1182         __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1183                 __isl_take isl_multi_val *mv,
1184                 enum isl_dim_type type, unsigned pos,
1185                 __isl_take isl_id *id);
1186         __isl_give isl_id *isl_multi_val_get_dim_id(
1187                 __isl_keep isl_multi_val *mv,
1188                 enum isl_dim_type type, unsigned pos);
1189         __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1190                 __isl_take isl_multi_val *mv,
1191                 enum isl_dim_type type, unsigned pos, const char *s);
1193         #include <isl/aff.h>
1194         __isl_give isl_aff *isl_aff_set_dim_id(
1195                 __isl_take isl_aff *aff, enum isl_dim_type type,
1196                 unsigned pos, __isl_take isl_id *id);
1197         __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1198                 __isl_take isl_multi_aff *maff,
1199                 enum isl_dim_type type, unsigned pos,
1200                 __isl_take isl_id *id);
1201         __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1202                 __isl_take isl_pw_aff *pma,
1203                 enum isl_dim_type type, unsigned pos,
1204                 __isl_take isl_id *id);
1205         __isl_give isl_multi_pw_aff *
1206         isl_multi_pw_aff_set_dim_id(
1207                 __isl_take isl_multi_pw_aff *mpa,
1208                 enum isl_dim_type type, unsigned pos,
1209                 __isl_take isl_id *id);
1210         __isl_give isl_multi_union_pw_aff *
1211         isl_multi_union_pw_aff_set_dim_id(
1212                 __isl_take isl_multi_union_pw_aff *mupa,
1213                 enum isl_dim_type type, unsigned pos,
1214                 __isl_take isl_id *id);
1215         __isl_give isl_id *isl_multi_aff_get_dim_id(
1216                 __isl_keep isl_multi_aff *ma,
1217                 enum isl_dim_type type, unsigned pos);
1218         int isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1219                 enum isl_dim_type type, unsigned pos);
1220         __isl_give isl_id *isl_pw_aff_get_dim_id(
1221                 __isl_keep isl_pw_aff *pa,
1222                 enum isl_dim_type type, unsigned pos);
1223         __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1224                 __isl_keep isl_pw_multi_aff *pma,
1225                 enum isl_dim_type type, unsigned pos);
1226         __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1227                 __isl_keep isl_multi_pw_aff *mpa,
1228                 enum isl_dim_type type, unsigned pos);
1229         __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1230                 __isl_keep isl_multi_union_pw_aff *mupa,
1231                 enum isl_dim_type type, unsigned pos);
1232         __isl_give isl_aff *isl_aff_set_dim_name(
1233                 __isl_take isl_aff *aff, enum isl_dim_type type,
1234                 unsigned pos, const char *s);
1235         __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1236                 __isl_take isl_multi_aff *maff,
1237                 enum isl_dim_type type, unsigned pos, const char *s);
1238         __isl_give isl_multi_pw_aff *
1239         isl_multi_pw_aff_set_dim_name(
1240                 __isl_take isl_multi_pw_aff *mpa,
1241                 enum isl_dim_type type, unsigned pos, const char *s);
1242         __isl_give isl_union_pw_aff *
1243         isl_union_pw_aff_set_dim_name(
1244                 __isl_take isl_union_pw_aff *upa,
1245                 enum isl_dim_type type, unsigned pos,
1246                 const char *s);
1247         __isl_give isl_union_pw_multi_aff *
1248         isl_union_pw_multi_aff_set_dim_name(
1249                 __isl_take isl_union_pw_multi_aff *upma,
1250                 enum isl_dim_type type, unsigned pos,
1251                 const char *s);
1252         __isl_give isl_multi_union_pw_aff *
1253         isl_multi_union_pw_aff_set_dim_name(
1254                 __isl_take isl_multi_union_pw_aff *mupa,
1255                 enum isl_dim_type type, unsigned pos,
1256         const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1257                 enum isl_dim_type type, unsigned pos);
1258         const char *isl_pw_aff_get_dim_name(
1259                 __isl_keep isl_pw_aff *pa,
1260                 enum isl_dim_type type, unsigned pos);
1261         const char *isl_pw_multi_aff_get_dim_name(
1262                 __isl_keep isl_pw_multi_aff *pma,
1263                 enum isl_dim_type type, unsigned pos);
1265         #include <isl/polynomial.h>
1266         __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1267                 __isl_take isl_qpolynomial *qp,
1268                 enum isl_dim_type type, unsigned pos,
1269                 const char *s);
1270         __isl_give isl_pw_qpolynomial *
1271         isl_pw_qpolynomial_set_dim_name(
1272                 __isl_take isl_pw_qpolynomial *pwqp,
1273                 enum isl_dim_type type, unsigned pos,
1274                 const char *s);
1275         __isl_give isl_pw_qpolynomial_fold *
1276         isl_pw_qpolynomial_fold_set_dim_name(
1277                 __isl_take isl_pw_qpolynomial_fold *pwf,
1278                 enum isl_dim_type type, unsigned pos,
1279                 const char *s);
1280         __isl_give isl_union_pw_qpolynomial *
1281         isl_union_pw_qpolynomial_set_dim_name(
1282                 __isl_take isl_union_pw_qpolynomial *upwqp,
1283                 enum isl_dim_type type, unsigned pos,
1284                 const char *s);
1285         __isl_give isl_union_pw_qpolynomial_fold *
1286         isl_union_pw_qpolynomial_fold_set_dim_name(
1287                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1288                 enum isl_dim_type type, unsigned pos,
1289                 const char *s);
1291 Note that C<isl_space_get_name> returns a pointer to some internal
1292 data structure, so the result can only be used while the
1293 corresponding C<isl_space> is alive.
1294 Also note that every function that operates on two sets or relations
1295 requires that both arguments have the same parameters.  This also
1296 means that if one of the arguments has named parameters, then the
1297 other needs to have named parameters too and the names need to match.
1298 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1299 arguments may have different parameters (as long as they are named),
1300 in which case the result will have as parameters the union of the parameters of
1301 the arguments.
1303 Given the identifier or name of a dimension (typically a parameter),
1304 its position can be obtained from the following functions.
1306         #include <isl/space.h>
1307         int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1308                 enum isl_dim_type type, __isl_keep isl_id *id);
1309         int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1310                 enum isl_dim_type type, const char *name);
1312         #include <isl/local_space.h>
1313         int isl_local_space_find_dim_by_name(
1314                 __isl_keep isl_local_space *ls,
1315                 enum isl_dim_type type, const char *name);
1317         #include <isl/val.h>
1318         int isl_multi_val_find_dim_by_id(
1319                 __isl_keep isl_multi_val *mv,
1320                 enum isl_dim_type type, __isl_keep isl_id *id);
1321         int isl_multi_val_find_dim_by_name(
1322                 __isl_keep isl_multi_val *mv,
1323                 enum isl_dim_type type, const char *name);
1325         #include <isl/set.h>
1326         int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1327                 enum isl_dim_type type, __isl_keep isl_id *id);
1328         int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1329                 enum isl_dim_type type, const char *name);
1331         #include <isl/map.h>
1332         int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1333                 enum isl_dim_type type, __isl_keep isl_id *id);
1334         int isl_basic_map_find_dim_by_name(
1335                 __isl_keep isl_basic_map *bmap,
1336                 enum isl_dim_type type, const char *name);
1337         int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1338                 enum isl_dim_type type, const char *name);
1339         int isl_union_map_find_dim_by_name(
1340                 __isl_keep isl_union_map *umap,
1341                 enum isl_dim_type type, const char *name);
1343         #include <isl/aff.h>
1344         int isl_multi_aff_find_dim_by_id(
1345                 __isl_keep isl_multi_aff *ma,
1346                 enum isl_dim_type type, __isl_keep isl_id *id);
1347         int isl_multi_pw_aff_find_dim_by_id(
1348                 __isl_keep isl_multi_pw_aff *mpa,
1349                 enum isl_dim_type type, __isl_keep isl_id *id);
1350         int isl_multi_union_pw_aff_find_dim_by_id(
1351                 __isl_keep isl_union_multi_pw_aff *mupa,
1352                 enum isl_dim_type type, __isl_keep isl_id *id);
1353         int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1354                 enum isl_dim_type type, const char *name);
1355         int isl_multi_aff_find_dim_by_name(
1356                 __isl_keep isl_multi_aff *ma,
1357                 enum isl_dim_type type, const char *name);
1358         int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1359                 enum isl_dim_type type, const char *name);
1360         int isl_multi_pw_aff_find_dim_by_name(
1361                 __isl_keep isl_multi_pw_aff *mpa,
1362                 enum isl_dim_type type, const char *name);
1363         int isl_pw_multi_aff_find_dim_by_name(
1364                 __isl_keep isl_pw_multi_aff *pma,
1365                 enum isl_dim_type type, const char *name);
1366         int isl_union_pw_aff_find_dim_by_name(
1367                 __isl_keep isl_union_pw_aff *upa,
1368                 enum isl_dim_type type, const char *name);
1369         int isl_union_pw_multi_aff_find_dim_by_name(
1370                 __isl_keep isl_union_pw_multi_aff *upma,
1371                 enum isl_dim_type type, const char *name);
1372         int isl_multi_union_pw_aff_find_dim_by_name(
1373                 __isl_keep isl_multi_union_pw_aff *mupa,
1374                 enum isl_dim_type type, const char *name);
1376         #include <isl/polynomial.h>
1377         int isl_pw_qpolynomial_find_dim_by_name(
1378                 __isl_keep isl_pw_qpolynomial *pwqp,
1379                 enum isl_dim_type type, const char *name);
1380         int isl_pw_qpolynomial_fold_find_dim_by_name(
1381                 __isl_keep isl_pw_qpolynomial_fold *pwf,
1382                 enum isl_dim_type type, const char *name);
1383         int isl_union_pw_qpolynomial_find_dim_by_name(
1384                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1385                 enum isl_dim_type type, const char *name);
1386         int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1387                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1388                 enum isl_dim_type type, const char *name);
1390 The identifiers or names of entire spaces may be set or read off
1391 using the following functions.
1393         #include <isl/space.h>
1394         __isl_give isl_space *isl_space_set_tuple_id(
1395                 __isl_take isl_space *space,
1396                 enum isl_dim_type type, __isl_take isl_id *id);
1397         __isl_give isl_space *isl_space_reset_tuple_id(
1398                 __isl_take isl_space *space, enum isl_dim_type type);
1399         int isl_space_has_tuple_id(__isl_keep isl_space *space,
1400                 enum isl_dim_type type);
1401         __isl_give isl_id *isl_space_get_tuple_id(
1402                 __isl_keep isl_space *space, enum isl_dim_type type);
1403         __isl_give isl_space *isl_space_set_tuple_name(
1404                 __isl_take isl_space *space,
1405                 enum isl_dim_type type, const char *s);
1406         int isl_space_has_tuple_name(__isl_keep isl_space *space,
1407                 enum isl_dim_type type);
1408         const char *isl_space_get_tuple_name(__isl_keep isl_space *space,
1409                 enum isl_dim_type type);
1411         #include <isl/local_space.h>
1412         __isl_give isl_local_space *isl_local_space_set_tuple_id(
1413                 __isl_take isl_local_space *ls,
1414                 enum isl_dim_type type, __isl_take isl_id *id);
1416         #include <isl/set.h>
1417         __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1418                 __isl_take isl_basic_set *bset,
1419                 __isl_take isl_id *id);
1420         __isl_give isl_set *isl_set_set_tuple_id(
1421                 __isl_take isl_set *set, __isl_take isl_id *id);
1422         __isl_give isl_set *isl_set_reset_tuple_id(
1423                 __isl_take isl_set *set);
1424         int isl_set_has_tuple_id(__isl_keep isl_set *set);
1425         __isl_give isl_id *isl_set_get_tuple_id(
1426                 __isl_keep isl_set *set);
1427         __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1428                 __isl_take isl_basic_set *set, const char *s);
1429         __isl_give isl_set *isl_set_set_tuple_name(
1430                 __isl_take isl_set *set, const char *s);
1431         const char *isl_basic_set_get_tuple_name(
1432                 __isl_keep isl_basic_set *bset);
1433         int isl_set_has_tuple_name(__isl_keep isl_set *set);
1434         const char *isl_set_get_tuple_name(
1435                 __isl_keep isl_set *set);
1437         #include <isl/map.h>
1438         __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1439                 __isl_take isl_basic_map *bmap,
1440                 enum isl_dim_type type, __isl_take isl_id *id);
1441         __isl_give isl_map *isl_map_set_tuple_id(
1442                 __isl_take isl_map *map, enum isl_dim_type type,
1443                 __isl_take isl_id *id);
1444         __isl_give isl_map *isl_map_reset_tuple_id(
1445                 __isl_take isl_map *map, enum isl_dim_type type);
1446         int isl_map_has_tuple_id(__isl_keep isl_map *map,
1447                 enum isl_dim_type type);
1448         __isl_give isl_id *isl_map_get_tuple_id(
1449                 __isl_keep isl_map *map, enum isl_dim_type type);
1450         __isl_give isl_map *isl_map_set_tuple_name(
1451                 __isl_take isl_map *map,
1452                 enum isl_dim_type type, const char *s);
1453         const char *isl_basic_map_get_tuple_name(
1454                 __isl_keep isl_basic_map *bmap,
1455                 enum isl_dim_type type);
1456         __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1457                 __isl_take isl_basic_map *bmap,
1458                 enum isl_dim_type type, const char *s);
1459         int isl_map_has_tuple_name(__isl_keep isl_map *map,
1460                 enum isl_dim_type type);
1461         const char *isl_map_get_tuple_name(
1462                 __isl_keep isl_map *map,
1463                 enum isl_dim_type type);
1465         #include <isl/val.h>
1466         __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1467                 __isl_take isl_multi_val *mv,
1468                 enum isl_dim_type type, __isl_take isl_id *id);
1469         __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1470                 __isl_take isl_multi_val *mv,
1471                 enum isl_dim_type type);
1472         int isl_multi_val_has_tuple_id(__isl_keep isl_multi_val *mv,
1473                 enum isl_dim_type type);
1474         __isl_give isl_id *isl_multi_val_get_tuple_id(
1475                 __isl_keep isl_multi_val *mv,
1476                 enum isl_dim_type type);
1477         __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1478                 __isl_take isl_multi_val *mv,
1479                 enum isl_dim_type type, const char *s);
1480         const char *isl_multi_val_get_tuple_name(
1481                 __isl_keep isl_multi_val *mv,
1482                 enum isl_dim_type type);
1484         #include <isl/aff.h>
1485         __isl_give isl_aff *isl_aff_set_tuple_id(
1486                 __isl_take isl_aff *aff,
1487                 enum isl_dim_type type, __isl_take isl_id *id);
1488         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1489                 __isl_take isl_multi_aff *maff,
1490                 enum isl_dim_type type, __isl_take isl_id *id);
1491         __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1492                 __isl_take isl_pw_aff *pwaff,
1493                 enum isl_dim_type type, __isl_take isl_id *id);
1494         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1495                 __isl_take isl_pw_multi_aff *pma,
1496                 enum isl_dim_type type, __isl_take isl_id *id);
1497         __isl_give isl_multi_union_pw_aff *
1498         isl_multi_union_pw_aff_set_tuple_id(
1499                 __isl_take isl_multi_union_pw_aff *mupa,
1500                 enum isl_dim_type type, __isl_take isl_id *id);
1501         __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1502                 __isl_take isl_multi_aff *ma,
1503                 enum isl_dim_type type);
1504         __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1505                 __isl_take isl_pw_aff *pa,
1506                 enum isl_dim_type type);
1507         __isl_give isl_multi_pw_aff *
1508         isl_multi_pw_aff_reset_tuple_id(
1509                 __isl_take isl_multi_pw_aff *mpa,
1510                 enum isl_dim_type type);
1511         __isl_give isl_pw_multi_aff *
1512         isl_pw_multi_aff_reset_tuple_id(
1513                 __isl_take isl_pw_multi_aff *pma,
1514                 enum isl_dim_type type);
1515         __isl_give isl_multi_union_pw_aff *
1516         isl_multi_union_pw_aff_reset_tuple_id(
1517                 __isl_take isl_multi_union_pw_aff *mupa,
1518                 enum isl_dim_type type);
1519         int isl_multi_aff_has_tuple_id(__isl_keep isl_multi_aff *ma,
1520                 enum isl_dim_type type);
1521         __isl_give isl_id *isl_multi_aff_get_tuple_id(
1522                 __isl_keep isl_multi_aff *ma,
1523                 enum isl_dim_type type);
1524         int isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1525                 enum isl_dim_type type);
1526         __isl_give isl_id *isl_pw_aff_get_tuple_id(
1527                 __isl_keep isl_pw_aff *pa,
1528                 enum isl_dim_type type);
1529         int isl_pw_multi_aff_has_tuple_id(
1530                 __isl_keep isl_pw_multi_aff *pma,
1531                 enum isl_dim_type type);
1532         __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1533                 __isl_keep isl_pw_multi_aff *pma,
1534                 enum isl_dim_type type);
1535         int isl_multi_pw_aff_has_tuple_id(
1536                 __isl_keep isl_multi_pw_aff *mpa,
1537                 enum isl_dim_type type);
1538         __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1539                 __isl_keep isl_multi_pw_aff *mpa,
1540                 enum isl_dim_type type);
1541         int isl_multi_union_pw_aff_has_tuple_id(
1542                 __isl_keep isl_multi_union_pw_aff *mupa,
1543                 enum isl_dim_type type);
1544         __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1545                 __isl_keep isl_multi_union_pw_aff *mupa,
1546                 enum isl_dim_type type);
1547         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1548                 __isl_take isl_multi_aff *maff,
1549                 enum isl_dim_type type, const char *s);
1550         __isl_give isl_multi_pw_aff *
1551         isl_multi_pw_aff_set_tuple_name(
1552                 __isl_take isl_multi_pw_aff *mpa,
1553                 enum isl_dim_type type, const char *s);
1554         __isl_give isl_multi_union_pw_aff *
1555         isl_multi_union_pw_aff_set_tuple_name(
1556                 __isl_take isl_multi_union_pw_aff *mupa,
1557                 enum isl_dim_type type, const char *s);
1558         const char *isl_multi_aff_get_tuple_name(
1559                 __isl_keep isl_multi_aff *multi,
1560                 enum isl_dim_type type);
1561         int isl_pw_multi_aff_has_tuple_name(
1562                 __isl_keep isl_pw_multi_aff *pma,
1563                 enum isl_dim_type type);
1564         const char *isl_pw_multi_aff_get_tuple_name(
1565                 __isl_keep isl_pw_multi_aff *pma,
1566                 enum isl_dim_type type);
1567         const char *isl_multi_union_pw_aff_get_tuple_name(
1568                 __isl_keep isl_multi_union_pw_aff *mupa,
1569                 enum isl_dim_type type);
1571 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1572 or C<isl_dim_set>.  As with C<isl_space_get_name>,
1573 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1574 data structure.
1575 Binary operations require the corresponding spaces of their arguments
1576 to have the same name.
1578 To keep the names of all parameters and tuples, but reset the user pointers
1579 of all the corresponding identifiers, use the following function.
1581         #include <isl/space.h>
1582         __isl_give isl_space *isl_space_reset_user(
1583                 __isl_take isl_space *space);
1585         #include <isl/set.h>
1586         __isl_give isl_set *isl_set_reset_user(
1587                 __isl_take isl_set *set);
1589         #include <isl/map.h>
1590         __isl_give isl_map *isl_map_reset_user(
1591                 __isl_take isl_map *map);
1593         #include <isl/union_set.h>
1594         __isl_give isl_union_set *isl_union_set_reset_user(
1595                 __isl_take isl_union_set *uset);
1597         #include <isl/union_map.h>
1598         __isl_give isl_union_map *isl_union_map_reset_user(
1599                 __isl_take isl_union_map *umap);
1601         #include <isl/val.h>
1602         __isl_give isl_multi_val *isl_multi_val_reset_user(
1603                 __isl_take isl_multi_val *mv);
1605         #include <isl/aff.h>
1606         __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1607                 __isl_take isl_multi_aff *ma);
1608         __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1609                 __isl_take isl_pw_aff *pa);
1610         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1611                 __isl_take isl_multi_pw_aff *mpa);
1612         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1613                 __isl_take isl_pw_multi_aff *pma);
1614         __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1615                 __isl_take isl_union_pw_aff *upa);
1616         __isl_give isl_multi_union_pw_aff *
1617         isl_multi_union_pw_aff_reset_user(
1618                 __isl_take isl_multi_union_pw_aff *mupa);
1619         __isl_give isl_union_pw_multi_aff *
1620         isl_union_pw_multi_aff_reset_user(
1621                 __isl_take isl_union_pw_multi_aff *upma);
1623         #include <isl/polynomial.h>
1624         __isl_give isl_pw_qpolynomial *
1625         isl_pw_qpolynomial_reset_user(
1626                 __isl_take isl_pw_qpolynomial *pwqp);
1627         __isl_give isl_union_pw_qpolynomial *
1628         isl_union_pw_qpolynomial_reset_user(
1629                 __isl_take isl_union_pw_qpolynomial *upwqp);
1630         __isl_give isl_pw_qpolynomial_fold *
1631         isl_pw_qpolynomial_fold_reset_user(
1632                 __isl_take isl_pw_qpolynomial_fold *pwf);
1633         __isl_give isl_union_pw_qpolynomial_fold *
1634         isl_union_pw_qpolynomial_fold_reset_user(
1635                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1637 Spaces can be nested.  In particular, the domain of a set or
1638 the domain or range of a relation can be a nested relation.
1639 This process is also called I<wrapping>.
1640 The functions for detecting, constructing and deconstructing
1641 such nested spaces can be found in the wrapping properties
1642 of L</"Unary Properties">, the wrapping operations
1643 of L</"Unary Operations"> and the Cartesian product operations
1644 of L</"Basic Operations">.
1646 Spaces can be created from other spaces
1647 using the functions described in L</"Unary Operations">
1648 and L</"Binary Operations">.
1650 =head2 Local Spaces
1652 A local space is essentially a space with
1653 zero or more existentially quantified variables.
1654 The local space of various objects can be obtained
1655 using the following functions.
1657         #include <isl/constraint.h>
1658         __isl_give isl_local_space *isl_constraint_get_local_space(
1659                 __isl_keep isl_constraint *constraint);
1661         #include <isl/set.h>
1662         __isl_give isl_local_space *isl_basic_set_get_local_space(
1663                 __isl_keep isl_basic_set *bset);
1665         #include <isl/map.h>
1666         __isl_give isl_local_space *isl_basic_map_get_local_space(
1667                 __isl_keep isl_basic_map *bmap);
1669         #include <isl/aff.h>
1670         __isl_give isl_local_space *isl_aff_get_domain_local_space(
1671                 __isl_keep isl_aff *aff);
1672         __isl_give isl_local_space *isl_aff_get_local_space(
1673                 __isl_keep isl_aff *aff);
1675 A new local space can be created from a space using
1677         #include <isl/local_space.h>
1678         __isl_give isl_local_space *isl_local_space_from_space(
1679                 __isl_take isl_space *space);
1681 They can be inspected, modified, copied and freed using the following functions.
1683         #include <isl/local_space.h>
1684         int isl_local_space_is_params(
1685                 __isl_keep isl_local_space *ls);
1686         int isl_local_space_is_set(__isl_keep isl_local_space *ls);
1687         __isl_give isl_space *isl_local_space_get_space(
1688                 __isl_keep isl_local_space *ls);
1689         __isl_give isl_aff *isl_local_space_get_div(
1690                 __isl_keep isl_local_space *ls, int pos);
1691         __isl_give isl_local_space *isl_local_space_copy(
1692                 __isl_keep isl_local_space *ls);
1693         __isl_null isl_local_space *isl_local_space_free(
1694                 __isl_take isl_local_space *ls);
1696 Note that C<isl_local_space_get_div> can only be used on local spaces
1697 of sets.
1699 Two local spaces can be compared using
1701         int isl_local_space_is_equal(__isl_keep isl_local_space *ls1,
1702                 __isl_keep isl_local_space *ls2);
1704 Local spaces can be created from other local spaces
1705 using the functions described in L</"Unary Operations">
1706 and L</"Binary Operations">.
1708 =head2 Creating New Sets and Relations
1710 C<isl> has functions for creating some standard sets and relations.
1712 =over
1714 =item * Empty sets and relations
1716         __isl_give isl_basic_set *isl_basic_set_empty(
1717                 __isl_take isl_space *space);
1718         __isl_give isl_basic_map *isl_basic_map_empty(
1719                 __isl_take isl_space *space);
1720         __isl_give isl_set *isl_set_empty(
1721                 __isl_take isl_space *space);
1722         __isl_give isl_map *isl_map_empty(
1723                 __isl_take isl_space *space);
1724         __isl_give isl_union_set *isl_union_set_empty(
1725                 __isl_take isl_space *space);
1726         __isl_give isl_union_map *isl_union_map_empty(
1727                 __isl_take isl_space *space);
1729 For C<isl_union_set>s and C<isl_union_map>s, the space
1730 is only used to specify the parameters.
1732 =item * Universe sets and relations
1734         __isl_give isl_basic_set *isl_basic_set_universe(
1735                 __isl_take isl_space *space);
1736         __isl_give isl_basic_map *isl_basic_map_universe(
1737                 __isl_take isl_space *space);
1738         __isl_give isl_set *isl_set_universe(
1739                 __isl_take isl_space *space);
1740         __isl_give isl_map *isl_map_universe(
1741                 __isl_take isl_space *space);
1742         __isl_give isl_union_set *isl_union_set_universe(
1743                 __isl_take isl_union_set *uset);
1744         __isl_give isl_union_map *isl_union_map_universe(
1745                 __isl_take isl_union_map *umap);
1747 The sets and relations constructed by the functions above
1748 contain all integer values, while those constructed by the
1749 functions below only contain non-negative values.
1751         __isl_give isl_basic_set *isl_basic_set_nat_universe(
1752                 __isl_take isl_space *space);
1753         __isl_give isl_basic_map *isl_basic_map_nat_universe(
1754                 __isl_take isl_space *space);
1755         __isl_give isl_set *isl_set_nat_universe(
1756                 __isl_take isl_space *space);
1757         __isl_give isl_map *isl_map_nat_universe(
1758                 __isl_take isl_space *space);
1760 =item * Identity relations
1762         __isl_give isl_basic_map *isl_basic_map_identity(
1763                 __isl_take isl_space *space);
1764         __isl_give isl_map *isl_map_identity(
1765                 __isl_take isl_space *space);
1767 The number of input and output dimensions in C<space> needs
1768 to be the same.
1770 =item * Lexicographic order
1772         __isl_give isl_map *isl_map_lex_lt(
1773                 __isl_take isl_space *set_space);
1774         __isl_give isl_map *isl_map_lex_le(
1775                 __isl_take isl_space *set_space);
1776         __isl_give isl_map *isl_map_lex_gt(
1777                 __isl_take isl_space *set_space);
1778         __isl_give isl_map *isl_map_lex_ge(
1779                 __isl_take isl_space *set_space);
1780         __isl_give isl_map *isl_map_lex_lt_first(
1781                 __isl_take isl_space *space, unsigned n);
1782         __isl_give isl_map *isl_map_lex_le_first(
1783                 __isl_take isl_space *space, unsigned n);
1784         __isl_give isl_map *isl_map_lex_gt_first(
1785                 __isl_take isl_space *space, unsigned n);
1786         __isl_give isl_map *isl_map_lex_ge_first(
1787                 __isl_take isl_space *space, unsigned n);
1789 The first four functions take a space for a B<set>
1790 and return relations that express that the elements in the domain
1791 are lexicographically less
1792 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1793 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1794 than the elements in the range.
1795 The last four functions take a space for a map
1796 and return relations that express that the first C<n> dimensions
1797 in the domain are lexicographically less
1798 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1799 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1800 than the first C<n> dimensions in the range.
1802 =back
1804 A basic set or relation can be converted to a set or relation
1805 using the following functions.
1807         __isl_give isl_set *isl_set_from_basic_set(
1808                 __isl_take isl_basic_set *bset);
1809         __isl_give isl_map *isl_map_from_basic_map(
1810                 __isl_take isl_basic_map *bmap);
1812 Sets and relations can be converted to union sets and relations
1813 using the following functions.
1815         __isl_give isl_union_set *isl_union_set_from_basic_set(
1816                 __isl_take isl_basic_set *bset);
1817         __isl_give isl_union_map *isl_union_map_from_basic_map(
1818                 __isl_take isl_basic_map *bmap);
1819         __isl_give isl_union_set *isl_union_set_from_set(
1820                 __isl_take isl_set *set);
1821         __isl_give isl_union_map *isl_union_map_from_map(
1822                 __isl_take isl_map *map);
1824 The inverse conversions below can only be used if the input
1825 union set or relation is known to contain elements in exactly one
1826 space.
1828         __isl_give isl_set *isl_set_from_union_set(
1829                 __isl_take isl_union_set *uset);
1830         __isl_give isl_map *isl_map_from_union_map(
1831                 __isl_take isl_union_map *umap);
1833 Sets and relations can be copied and freed again using the following
1834 functions.
1836         __isl_give isl_basic_set *isl_basic_set_copy(
1837                 __isl_keep isl_basic_set *bset);
1838         __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1839         __isl_give isl_union_set *isl_union_set_copy(
1840                 __isl_keep isl_union_set *uset);
1841         __isl_give isl_basic_map *isl_basic_map_copy(
1842                 __isl_keep isl_basic_map *bmap);
1843         __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1844         __isl_give isl_union_map *isl_union_map_copy(
1845                 __isl_keep isl_union_map *umap);
1846         __isl_null isl_basic_set *isl_basic_set_free(
1847                 __isl_take isl_basic_set *bset);
1848         __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1849         __isl_null isl_union_set *isl_union_set_free(
1850                 __isl_take isl_union_set *uset);
1851         __isl_null isl_basic_map *isl_basic_map_free(
1852                 __isl_take isl_basic_map *bmap);
1853         __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1854         __isl_null isl_union_map *isl_union_map_free(
1855                 __isl_take isl_union_map *umap);
1857 Other sets and relations can be constructed by starting
1858 from a universe set or relation, adding equality and/or
1859 inequality constraints and then projecting out the
1860 existentially quantified variables, if any.
1861 Constraints can be constructed, manipulated and
1862 added to (or removed from) (basic) sets and relations
1863 using the following functions.
1865         #include <isl/constraint.h>
1866         __isl_give isl_constraint *isl_equality_alloc(
1867                 __isl_take isl_local_space *ls);
1868         __isl_give isl_constraint *isl_inequality_alloc(
1869                 __isl_take isl_local_space *ls);
1870         __isl_give isl_constraint *isl_constraint_set_constant_si(
1871                 __isl_take isl_constraint *constraint, int v);
1872         __isl_give isl_constraint *isl_constraint_set_constant_val(
1873                 __isl_take isl_constraint *constraint,
1874                 __isl_take isl_val *v);
1875         __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1876                 __isl_take isl_constraint *constraint,
1877                 enum isl_dim_type type, int pos, int v);
1878         __isl_give isl_constraint *
1879         isl_constraint_set_coefficient_val(
1880                 __isl_take isl_constraint *constraint,
1881                 enum isl_dim_type type, int pos,
1882                 __isl_take isl_val *v);
1883         __isl_give isl_basic_map *isl_basic_map_add_constraint(
1884                 __isl_take isl_basic_map *bmap,
1885                 __isl_take isl_constraint *constraint);
1886         __isl_give isl_basic_set *isl_basic_set_add_constraint(
1887                 __isl_take isl_basic_set *bset,
1888                 __isl_take isl_constraint *constraint);
1889         __isl_give isl_map *isl_map_add_constraint(
1890                 __isl_take isl_map *map,
1891                 __isl_take isl_constraint *constraint);
1892         __isl_give isl_set *isl_set_add_constraint(
1893                 __isl_take isl_set *set,
1894                 __isl_take isl_constraint *constraint);
1896 For example, to create a set containing the even integers
1897 between 10 and 42, you would use the following code.
1899         isl_space *space;
1900         isl_local_space *ls;
1901         isl_constraint *c;
1902         isl_basic_set *bset;
1904         space = isl_space_set_alloc(ctx, 0, 2);
1905         bset = isl_basic_set_universe(isl_space_copy(space));
1906         ls = isl_local_space_from_space(space);
1908         c = isl_equality_alloc(isl_local_space_copy(ls));
1909         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1910         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
1911         bset = isl_basic_set_add_constraint(bset, c);
1913         c = isl_inequality_alloc(isl_local_space_copy(ls));
1914         c = isl_constraint_set_constant_si(c, -10);
1915         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
1916         bset = isl_basic_set_add_constraint(bset, c);
1918         c = isl_inequality_alloc(ls);
1919         c = isl_constraint_set_constant_si(c, 42);
1920         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1921         bset = isl_basic_set_add_constraint(bset, c);
1923         bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
1925 Or, alternatively,
1927         isl_basic_set *bset;
1928         bset = isl_basic_set_read_from_str(ctx,
1929                 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
1931 A basic set or relation can also be constructed from two matrices
1932 describing the equalities and the inequalities.
1934         __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
1935                 __isl_take isl_space *space,
1936                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1937                 enum isl_dim_type c1,
1938                 enum isl_dim_type c2, enum isl_dim_type c3,
1939                 enum isl_dim_type c4);
1940         __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
1941                 __isl_take isl_space *space,
1942                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1943                 enum isl_dim_type c1,
1944                 enum isl_dim_type c2, enum isl_dim_type c3,
1945                 enum isl_dim_type c4, enum isl_dim_type c5);
1947 The C<isl_dim_type> arguments indicate the order in which
1948 different kinds of variables appear in the input matrices
1949 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
1950 C<isl_dim_set> and C<isl_dim_div> for sets and
1951 of C<isl_dim_cst>, C<isl_dim_param>,
1952 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
1954 A (basic or union) set or relation can also be constructed from a
1955 (union) (piecewise) (multiple) affine expression
1956 or a list of affine expressions
1957 (See L</"Functions">).
1959         __isl_give isl_basic_map *isl_basic_map_from_aff(
1960                 __isl_take isl_aff *aff);
1961         __isl_give isl_map *isl_map_from_aff(
1962                 __isl_take isl_aff *aff);
1963         __isl_give isl_set *isl_set_from_pw_aff(
1964                 __isl_take isl_pw_aff *pwaff);
1965         __isl_give isl_map *isl_map_from_pw_aff(
1966                 __isl_take isl_pw_aff *pwaff);
1967         __isl_give isl_basic_map *isl_basic_map_from_aff_list(
1968                 __isl_take isl_space *domain_space,
1969                 __isl_take isl_aff_list *list);
1970         __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
1971                 __isl_take isl_multi_aff *maff)
1972         __isl_give isl_map *isl_map_from_multi_aff(
1973                 __isl_take isl_multi_aff *maff)
1974         __isl_give isl_set *isl_set_from_pw_multi_aff(
1975                 __isl_take isl_pw_multi_aff *pma);
1976         __isl_give isl_map *isl_map_from_pw_multi_aff(
1977                 __isl_take isl_pw_multi_aff *pma);
1978         __isl_give isl_set *isl_set_from_multi_pw_aff(
1979                 __isl_take isl_multi_pw_aff *mpa);
1980         __isl_give isl_map *isl_map_from_multi_pw_aff(
1981                 __isl_take isl_multi_pw_aff *mpa);
1982         __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
1983                 __isl_take isl_union_pw_aff *upa);
1984         __isl_give isl_union_map *
1985         isl_union_map_from_union_pw_multi_aff(
1986                 __isl_take isl_union_pw_multi_aff *upma);
1987         __isl_give isl_union_map *
1988         isl_union_map_from_multi_union_pw_aff(
1989                 __isl_take isl_multi_union_pw_aff *mupa);
1991 The C<domain_space> argument describes the domain of the resulting
1992 basic relation.  It is required because the C<list> may consist
1993 of zero affine expressions.
1994 The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
1995 is not allowed to be zero-dimensional.  The domain of the result
1996 is the shared domain of the union piecewise affine elements.
1998 =head2 Inspecting Sets and Relations
2000 Usually, the user should not have to care about the actual constraints
2001 of the sets and maps, but should instead apply the abstract operations
2002 explained in the following sections.
2003 Occasionally, however, it may be required to inspect the individual
2004 coefficients of the constraints.  This section explains how to do so.
2005 In these cases, it may also be useful to have C<isl> compute
2006 an explicit representation of the existentially quantified variables.
2008         __isl_give isl_set *isl_set_compute_divs(
2009                 __isl_take isl_set *set);
2010         __isl_give isl_map *isl_map_compute_divs(
2011                 __isl_take isl_map *map);
2012         __isl_give isl_union_set *isl_union_set_compute_divs(
2013                 __isl_take isl_union_set *uset);
2014         __isl_give isl_union_map *isl_union_map_compute_divs(
2015                 __isl_take isl_union_map *umap);
2017 This explicit representation defines the existentially quantified
2018 variables as integer divisions of the other variables, possibly
2019 including earlier existentially quantified variables.
2020 An explicitly represented existentially quantified variable therefore
2021 has a unique value when the values of the other variables are known.
2022 If, furthermore, the same existentials, i.e., existentials
2023 with the same explicit representations, should appear in the
2024 same order in each of the disjuncts of a set or map, then the user should call
2025 either of the following functions.
2027         __isl_give isl_set *isl_set_align_divs(
2028                 __isl_take isl_set *set);
2029         __isl_give isl_map *isl_map_align_divs(
2030                 __isl_take isl_map *map);
2032 Alternatively, the existentially quantified variables can be removed
2033 using the following functions, which compute an overapproximation.
2035         __isl_give isl_basic_set *isl_basic_set_remove_divs(
2036                 __isl_take isl_basic_set *bset);
2037         __isl_give isl_basic_map *isl_basic_map_remove_divs(
2038                 __isl_take isl_basic_map *bmap);
2039         __isl_give isl_set *isl_set_remove_divs(
2040                 __isl_take isl_set *set);
2041         __isl_give isl_map *isl_map_remove_divs(
2042                 __isl_take isl_map *map);
2044 It is also possible to only remove those divs that are defined
2045 in terms of a given range of dimensions or only those for which
2046 no explicit representation is known.
2048         __isl_give isl_basic_set *
2049         isl_basic_set_remove_divs_involving_dims(
2050                 __isl_take isl_basic_set *bset,
2051                 enum isl_dim_type type,
2052                 unsigned first, unsigned n);
2053         __isl_give isl_basic_map *
2054         isl_basic_map_remove_divs_involving_dims(
2055                 __isl_take isl_basic_map *bmap,
2056                 enum isl_dim_type type,
2057                 unsigned first, unsigned n);
2058         __isl_give isl_set *isl_set_remove_divs_involving_dims(
2059                 __isl_take isl_set *set, enum isl_dim_type type,
2060                 unsigned first, unsigned n);
2061         __isl_give isl_map *isl_map_remove_divs_involving_dims(
2062                 __isl_take isl_map *map, enum isl_dim_type type,
2063                 unsigned first, unsigned n);
2065         __isl_give isl_basic_set *
2066         isl_basic_set_remove_unknown_divs(
2067                 __isl_take isl_basic_set *bset);
2068         __isl_give isl_set *isl_set_remove_unknown_divs(
2069                 __isl_take isl_set *set);
2070         __isl_give isl_map *isl_map_remove_unknown_divs(
2071                 __isl_take isl_map *map);
2073 To iterate over all the sets or maps in a union set or map, use
2075         int isl_union_set_foreach_set(__isl_keep isl_union_set *uset,
2076                 int (*fn)(__isl_take isl_set *set, void *user),
2077                 void *user);
2078         int isl_union_map_foreach_map(__isl_keep isl_union_map *umap,
2079                 int (*fn)(__isl_take isl_map *map, void *user),
2080                 void *user);
2082 The number of sets or maps in a union set or map can be obtained
2083 from
2085         int isl_union_set_n_set(__isl_keep isl_union_set *uset);
2086         int isl_union_map_n_map(__isl_keep isl_union_map *umap);
2088 To extract the set or map in a given space from a union, use
2090         __isl_give isl_set *isl_union_set_extract_set(
2091                 __isl_keep isl_union_set *uset,
2092                 __isl_take isl_space *space);
2093         __isl_give isl_map *isl_union_map_extract_map(
2094                 __isl_keep isl_union_map *umap,
2095                 __isl_take isl_space *space);
2097 To iterate over all the basic sets or maps in a set or map, use
2099         int isl_set_foreach_basic_set(__isl_keep isl_set *set,
2100                 int (*fn)(__isl_take isl_basic_set *bset, void *user),
2101                 void *user);
2102         int isl_map_foreach_basic_map(__isl_keep isl_map *map,
2103                 int (*fn)(__isl_take isl_basic_map *bmap, void *user),
2104                 void *user);
2106 The callback function C<fn> should return 0 if successful and
2107 -1 if an error occurs.  In the latter case, or if any other error
2108 occurs, the above functions will return -1.
2110 It should be noted that C<isl> does not guarantee that
2111 the basic sets or maps passed to C<fn> are disjoint.
2112 If this is required, then the user should call one of
2113 the following functions first.
2115         __isl_give isl_set *isl_set_make_disjoint(
2116                 __isl_take isl_set *set);
2117         __isl_give isl_map *isl_map_make_disjoint(
2118                 __isl_take isl_map *map);
2120 The number of basic sets in a set can be obtained
2121 or the number of basic maps in a map can be obtained
2122 from
2124         #include <isl/set.h>
2125         int isl_set_n_basic_set(__isl_keep isl_set *set);
2127         #include <isl/map.h>
2128         int isl_map_n_basic_map(__isl_keep isl_map *map);
2130 To iterate over the constraints of a basic set or map, use
2132         #include <isl/constraint.h>
2134         int isl_basic_set_n_constraint(
2135                 __isl_keep isl_basic_set *bset);
2136         int isl_basic_set_foreach_constraint(
2137                 __isl_keep isl_basic_set *bset,
2138                 int (*fn)(__isl_take isl_constraint *c, void *user),
2139                 void *user);
2140         int isl_basic_map_n_constraint(
2141                 __isl_keep isl_basic_map *bmap);
2142         int isl_basic_map_foreach_constraint(
2143                 __isl_keep isl_basic_map *bmap,
2144                 int (*fn)(__isl_take isl_constraint *c, void *user),
2145                 void *user);
2146         __isl_null isl_constraint *isl_constraint_free(
2147                 __isl_take isl_constraint *c);
2149 Again, the callback function C<fn> should return 0 if successful and
2150 -1 if an error occurs.  In the latter case, or if any other error
2151 occurs, the above functions will return -1.
2152 The constraint C<c> represents either an equality or an inequality.
2153 Use the following function to find out whether a constraint
2154 represents an equality.  If not, it represents an inequality.
2156         int isl_constraint_is_equality(
2157                 __isl_keep isl_constraint *constraint);
2159 It is also possible to obtain a list of constraints from a basic
2160 map or set
2162         #include <isl/constraint.h>
2163         __isl_give isl_constraint_list *
2164         isl_basic_map_get_constraint_list(
2165                 __isl_keep isl_basic_map *bmap);
2166         __isl_give isl_constraint_list *
2167         isl_basic_set_get_constraint_list(
2168                 __isl_keep isl_basic_set *bset);
2170 These functions require that all existentially quantified variables
2171 have an explicit representation.
2172 The returned list can be manipulated using the functions in L<"Lists">.
2174 The coefficients of the constraints can be inspected using
2175 the following functions.
2177         int isl_constraint_is_lower_bound(
2178                 __isl_keep isl_constraint *constraint,
2179                 enum isl_dim_type type, unsigned pos);
2180         int isl_constraint_is_upper_bound(
2181                 __isl_keep isl_constraint *constraint,
2182                 enum isl_dim_type type, unsigned pos);
2183         __isl_give isl_val *isl_constraint_get_constant_val(
2184                 __isl_keep isl_constraint *constraint);
2185         __isl_give isl_val *isl_constraint_get_coefficient_val(
2186                 __isl_keep isl_constraint *constraint,
2187                 enum isl_dim_type type, int pos);
2189 The explicit representations of the existentially quantified
2190 variables can be inspected using the following function.
2191 Note that the user is only allowed to use this function
2192 if the inspected set or map is the result of a call
2193 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2194 The existentially quantified variable is equal to the floor
2195 of the returned affine expression.  The affine expression
2196 itself can be inspected using the functions in
2197 L</"Functions">.
2199         __isl_give isl_aff *isl_constraint_get_div(
2200                 __isl_keep isl_constraint *constraint, int pos);
2202 To obtain the constraints of a basic set or map in matrix
2203 form, use the following functions.
2205         __isl_give isl_mat *isl_basic_set_equalities_matrix(
2206                 __isl_keep isl_basic_set *bset,
2207                 enum isl_dim_type c1, enum isl_dim_type c2,
2208                 enum isl_dim_type c3, enum isl_dim_type c4);
2209         __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2210                 __isl_keep isl_basic_set *bset,
2211                 enum isl_dim_type c1, enum isl_dim_type c2,
2212                 enum isl_dim_type c3, enum isl_dim_type c4);
2213         __isl_give isl_mat *isl_basic_map_equalities_matrix(
2214                 __isl_keep isl_basic_map *bmap,
2215                 enum isl_dim_type c1,
2216                 enum isl_dim_type c2, enum isl_dim_type c3,
2217                 enum isl_dim_type c4, enum isl_dim_type c5);
2218         __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2219                 __isl_keep isl_basic_map *bmap,
2220                 enum isl_dim_type c1,
2221                 enum isl_dim_type c2, enum isl_dim_type c3,
2222                 enum isl_dim_type c4, enum isl_dim_type c5);
2224 The C<isl_dim_type> arguments dictate the order in which
2225 different kinds of variables appear in the resulting matrix.
2226 For set inputs, they should be a permutation of
2227 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2228 For map inputs, they should be a permutation of
2229 C<isl_dim_cst>, C<isl_dim_param>,
2230 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2232 =head2 Points
2234 Points are elements of a set.  They can be used to construct
2235 simple sets (boxes) or they can be used to represent the
2236 individual elements of a set.
2237 The zero point (the origin) can be created using
2239         __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2241 The coordinates of a point can be inspected, set and changed
2242 using
2244         __isl_give isl_val *isl_point_get_coordinate_val(
2245                 __isl_keep isl_point *pnt,
2246                 enum isl_dim_type type, int pos);
2247         __isl_give isl_point *isl_point_set_coordinate_val(
2248                 __isl_take isl_point *pnt,
2249                 enum isl_dim_type type, int pos,
2250                 __isl_take isl_val *v);
2252         __isl_give isl_point *isl_point_add_ui(
2253                 __isl_take isl_point *pnt,
2254                 enum isl_dim_type type, int pos, unsigned val);
2255         __isl_give isl_point *isl_point_sub_ui(
2256                 __isl_take isl_point *pnt,
2257                 enum isl_dim_type type, int pos, unsigned val);
2259 Points can be copied or freed using
2261         __isl_give isl_point *isl_point_copy(
2262                 __isl_keep isl_point *pnt);
2263         void isl_point_free(__isl_take isl_point *pnt);
2265 A singleton set can be created from a point using
2267         __isl_give isl_basic_set *isl_basic_set_from_point(
2268                 __isl_take isl_point *pnt);
2269         __isl_give isl_set *isl_set_from_point(
2270                 __isl_take isl_point *pnt);
2272 and a box can be created from two opposite extremal points using
2274         __isl_give isl_basic_set *isl_basic_set_box_from_points(
2275                 __isl_take isl_point *pnt1,
2276                 __isl_take isl_point *pnt2);
2277         __isl_give isl_set *isl_set_box_from_points(
2278                 __isl_take isl_point *pnt1,
2279                 __isl_take isl_point *pnt2);
2281 All elements of a B<bounded> (union) set can be enumerated using
2282 the following functions.
2284         int isl_set_foreach_point(__isl_keep isl_set *set,
2285                 int (*fn)(__isl_take isl_point *pnt, void *user),
2286                 void *user);
2287         int isl_union_set_foreach_point(__isl_keep isl_union_set *uset,
2288                 int (*fn)(__isl_take isl_point *pnt, void *user),
2289                 void *user);
2291 The function C<fn> is called for each integer point in
2292 C<set> with as second argument the last argument of
2293 the C<isl_set_foreach_point> call.  The function C<fn>
2294 should return C<0> on success and C<-1> on failure.
2295 In the latter case, C<isl_set_foreach_point> will stop
2296 enumerating and return C<-1> as well.
2297 If the enumeration is performed successfully and to completion,
2298 then C<isl_set_foreach_point> returns C<0>.
2300 To obtain a single point of a (basic) set, use
2302         __isl_give isl_point *isl_basic_set_sample_point(
2303                 __isl_take isl_basic_set *bset);
2304         __isl_give isl_point *isl_set_sample_point(
2305                 __isl_take isl_set *set);
2307 If C<set> does not contain any (integer) points, then the
2308 resulting point will be ``void'', a property that can be
2309 tested using
2311         int isl_point_is_void(__isl_keep isl_point *pnt);
2313 =head2 Functions
2315 Besides sets and relation, C<isl> also supports various types of functions.
2316 Each of these types is derived from the value type (see L</"Values">)
2317 or from one of two primitive function types
2318 through the application of zero or more type constructors.
2319 We first describe the primitive type and then we describe
2320 the types derived from these primitive types.
2322 =head3 Primitive Functions
2324 C<isl> support two primitive function types, quasi-affine
2325 expressions and quasipolynomials.
2326 A quasi-affine expression is defined either over a parameter
2327 space or over a set and is composed of integer constants,
2328 parameters and set variables, addition, subtraction and
2329 integer division by an integer constant.
2330 For example, the quasi-affine expression
2332         [n] -> { [x] -> [2*floor((4 n + x)/9] }
2334 maps C<x> to C<2*floor((4 n + x)/9>.
2335 A quasipolynomial is a polynomial expression in quasi-affine
2336 expression.  That is, it additionally allows for multiplication.
2337 Note, though, that it is not allowed to construct an integer
2338 division of an expression involving multiplications.
2339 Here is an example of a quasipolynomial that is not
2340 quasi-affine expression
2342         [n] -> { [x] -> (n*floor((4 n + x)/9) }
2344 Note that the external representations of quasi-affine expressions
2345 and quasipolynomials are different.  Quasi-affine expressions
2346 use a notation with square brackets just like binary relations,
2347 while quasipolynomials do not.  This might change at some point.
2349 If a primitive function is defined over a parameter space,
2350 then the space of the function itself is that of a set.
2351 If it is defined over a set, then the space of the function
2352 is that of a relation.  In both cases, the set space (or
2353 the output space) is single-dimensional, anonymous and unstructured.
2354 To create functions with multiple dimensions or with other kinds
2355 of set or output spaces, use multiple expressions
2356 (see L</"Multiple Expressions">).
2358 =over
2360 =item * Quasi-affine Expressions
2362 Besides the expressions described above, a quasi-affine
2363 expression can also be set to NaN.  Such expressions
2364 typically represent a failure to represent a result
2365 as a quasi-affine expression.
2367 The zero quasi affine expression or the quasi affine expression
2368 that is equal to a given value or
2369 a specified dimension on a given domain can be created using
2371         #include <isl/aff.h>
2372         __isl_give isl_aff *isl_aff_zero_on_domain(
2373                 __isl_take isl_local_space *ls);
2374         __isl_give isl_aff *isl_aff_val_on_domain(
2375                 __isl_take isl_local_space *ls,
2376                 __isl_take isl_val *val);
2377         __isl_give isl_aff *isl_aff_var_on_domain(
2378                 __isl_take isl_local_space *ls,
2379                 enum isl_dim_type type, unsigned pos);
2380         __isl_give isl_aff *isl_aff_nan_on_domain(
2381                 __isl_take isl_local_space *ls);
2383 Quasi affine expressions can be copied and freed using
2385         #include <isl/aff.h>
2386         __isl_give isl_aff *isl_aff_copy(
2387                 __isl_keep isl_aff *aff);
2388         __isl_null isl_aff *isl_aff_free(
2389                 __isl_take isl_aff *aff);
2391 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2392 using the following function.  The constraint is required to have
2393 a non-zero coefficient for the specified dimension.
2395         #include <isl/constraint.h>
2396         __isl_give isl_aff *isl_constraint_get_bound(
2397                 __isl_keep isl_constraint *constraint,
2398                 enum isl_dim_type type, int pos);
2400 The entire affine expression of the constraint can also be extracted
2401 using the following function.
2403         #include <isl/constraint.h>
2404         __isl_give isl_aff *isl_constraint_get_aff(
2405                 __isl_keep isl_constraint *constraint);
2407 Conversely, an equality constraint equating
2408 the affine expression to zero or an inequality constraint enforcing
2409 the affine expression to be non-negative, can be constructed using
2411         __isl_give isl_constraint *isl_equality_from_aff(
2412                 __isl_take isl_aff *aff);
2413         __isl_give isl_constraint *isl_inequality_from_aff(
2414                 __isl_take isl_aff *aff);
2416 The coefficients and the integer divisions of an affine expression
2417 can be inspected using the following functions.
2419         #include <isl/aff.h>
2420         __isl_give isl_val *isl_aff_get_constant_val(
2421                 __isl_keep isl_aff *aff);
2422         __isl_give isl_val *isl_aff_get_coefficient_val(
2423                 __isl_keep isl_aff *aff,
2424                 enum isl_dim_type type, int pos);
2425         int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2426                 enum isl_dim_type type, int pos);
2427         __isl_give isl_val *isl_aff_get_denominator_val(
2428                 __isl_keep isl_aff *aff);
2429         __isl_give isl_aff *isl_aff_get_div(
2430                 __isl_keep isl_aff *aff, int pos);
2432 They can be modified using the following functions.
2434         #include <isl/aff.h>
2435         __isl_give isl_aff *isl_aff_set_constant_si(
2436                 __isl_take isl_aff *aff, int v);
2437         __isl_give isl_aff *isl_aff_set_constant_val(
2438                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2439         __isl_give isl_aff *isl_aff_set_coefficient_si(
2440                 __isl_take isl_aff *aff,
2441                 enum isl_dim_type type, int pos, int v);
2442         __isl_give isl_aff *isl_aff_set_coefficient_val(
2443                 __isl_take isl_aff *aff,
2444                 enum isl_dim_type type, int pos,
2445                 __isl_take isl_val *v);
2447         __isl_give isl_aff *isl_aff_add_constant_si(
2448                 __isl_take isl_aff *aff, int v);
2449         __isl_give isl_aff *isl_aff_add_constant_val(
2450                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2451         __isl_give isl_aff *isl_aff_add_constant_num_si(
2452                 __isl_take isl_aff *aff, int v);
2453         __isl_give isl_aff *isl_aff_add_coefficient_si(
2454                 __isl_take isl_aff *aff,
2455                 enum isl_dim_type type, int pos, int v);
2456         __isl_give isl_aff *isl_aff_add_coefficient_val(
2457                 __isl_take isl_aff *aff,
2458                 enum isl_dim_type type, int pos,
2459                 __isl_take isl_val *v);
2461 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2462 set the I<numerator> of the constant or coefficient, while
2463 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2464 the constant or coefficient as a whole.
2465 The C<add_constant> and C<add_coefficient> functions add an integer
2466 or rational value to
2467 the possibly rational constant or coefficient.
2468 The C<add_constant_num> functions add an integer value to
2469 the numerator.
2471 =item * Quasipolynomials
2473 Some simple quasipolynomials can be created using the following functions.
2475         #include <isl/polynomial.h>
2476         __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2477                 __isl_take isl_space *domain);
2478         __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2479                 __isl_take isl_space *domain);
2480         __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2481                 __isl_take isl_space *domain);
2482         __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2483                 __isl_take isl_space *domain);
2484         __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2485                 __isl_take isl_space *domain);
2486         __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2487                 __isl_take isl_space *domain,
2488                 __isl_take isl_val *val);
2489         __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2490                 __isl_take isl_space *domain,
2491                 enum isl_dim_type type, unsigned pos);
2492         __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2493                 __isl_take isl_aff *aff);
2495 Recall that the space in which a quasipolynomial lives is a map space
2496 with a one-dimensional range.  The C<domain> argument in some of
2497 the functions above corresponds to the domain of this map space.
2499 Quasipolynomials can be copied and freed again using the following
2500 functions.
2502         #include <isl/polynomial.h>
2503         __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2504                 __isl_keep isl_qpolynomial *qp);
2505         __isl_null isl_qpolynomial *isl_qpolynomial_free(
2506                 __isl_take isl_qpolynomial *qp);
2508 The constant term of a quasipolynomial can be extracted using
2510         __isl_give isl_val *isl_qpolynomial_get_constant_val(
2511                 __isl_keep isl_qpolynomial *qp);
2513 To iterate over all terms in a quasipolynomial,
2516         int isl_qpolynomial_foreach_term(
2517                 __isl_keep isl_qpolynomial *qp,
2518                 int (*fn)(__isl_take isl_term *term,
2519                           void *user), void *user);
2521 The terms themselves can be inspected and freed using
2522 these functions
2524         unsigned isl_term_dim(__isl_keep isl_term *term,
2525                 enum isl_dim_type type);
2526         __isl_give isl_val *isl_term_get_coefficient_val(
2527                 __isl_keep isl_term *term);
2528         int isl_term_get_exp(__isl_keep isl_term *term,
2529                 enum isl_dim_type type, unsigned pos);
2530         __isl_give isl_aff *isl_term_get_div(
2531                 __isl_keep isl_term *term, unsigned pos);
2532         void isl_term_free(__isl_take isl_term *term);
2534 Each term is a product of parameters, set variables and
2535 integer divisions.  The function C<isl_term_get_exp>
2536 returns the exponent of a given dimensions in the given term.
2538 =back
2540 =head3 Reductions
2542 A reduction represents a maximum or a minimum of its
2543 base expressions.
2544 The only reduction type defined by C<isl> is
2545 C<isl_qpolynomial_fold>.
2547 There are currently no functions to directly create such
2548 objects, but they do appear in the piecewise quasipolynomial
2549 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2551 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2553 Reductions can be copied and freed using
2554 the following functions.
2556         #include <isl/polynomial.h>
2557         __isl_give isl_qpolynomial_fold *
2558         isl_qpolynomial_fold_copy(
2559                 __isl_keep isl_qpolynomial_fold *fold);
2560         void isl_qpolynomial_fold_free(
2561                 __isl_take isl_qpolynomial_fold *fold);
2563 To iterate over all quasipolynomials in a reduction, use
2565         int isl_qpolynomial_fold_foreach_qpolynomial(
2566                 __isl_keep isl_qpolynomial_fold *fold,
2567                 int (*fn)(__isl_take isl_qpolynomial *qp,
2568                           void *user), void *user);
2570 =head3 Multiple Expressions
2572 A multiple expression represents a sequence of zero or
2573 more base expressions, all defined on the same domain space.
2574 The domain space of the multiple expression is the same
2575 as that of the base expressions, but the range space
2576 can be any space.  In case the base expressions have
2577 a set space, the corresponding multiple expression
2578 also has a set space.
2579 Objects of the value type do not have an associated space.
2580 The space of a multiple value is therefore always a set space.
2581 Similarly, the space of a multiple union piecewise
2582 affine expression is always a set space.
2584 The multiple expression types defined by C<isl>
2585 are C<isl_multi_val>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
2586 C<isl_multi_union_pw_aff>.
2588 A multiple expression with the value zero for
2589 each output (or set) dimension can be created
2590 using the following functions.
2592         #include <isl/val.h>
2593         __isl_give isl_multi_val *isl_multi_val_zero(
2594                 __isl_take isl_space *space);
2596         #include <isl/aff.h>
2597         __isl_give isl_multi_aff *isl_multi_aff_zero(
2598                 __isl_take isl_space *space);
2599         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2600                 __isl_take isl_space *space);
2601         __isl_give isl_multi_union_pw_aff *
2602         isl_multi_union_pw_aff_zero(
2603                 __isl_take isl_space *space);
2605 Since there is no canonical way of representing a zero
2606 value of type C<isl_union_pw_aff>, the space passed
2607 to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
2609 An identity function can be created using the following
2610 functions.  The space needs to be that of a relation
2611 with the same number of input and output dimensions.
2613         #include <isl/aff.h>
2614         __isl_give isl_multi_aff *isl_multi_aff_identity(
2615                 __isl_take isl_space *space);
2616         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2617                 __isl_take isl_space *space);
2619 A function that performs a projection on a universe
2620 relation or set can be created using the following functions.
2621 See also the corresponding
2622 projection operations in L</"Unary Operations">.
2624         #include <isl/aff.h>
2625         __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2626                 __isl_take isl_space *space);
2627         __isl_give isl_multi_aff *isl_multi_aff_range_map(
2628                 __isl_take isl_space *space);
2629         __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2630                 __isl_take isl_space *space,
2631                 enum isl_dim_type type,
2632                 unsigned first, unsigned n);
2634 A multiple expression can be created from a single
2635 base expression using the following functions.
2636 The space of the created multiple expression is the same
2637 as that of the base expression, except for
2638 C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
2639 lives in a parameter space and the output lives
2640 in a single-dimensional set space.
2642         #include <isl/aff.h>
2643         __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2644                 __isl_take isl_aff *aff);
2645         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2646                 __isl_take isl_pw_aff *pa);
2647         __isl_give isl_multi_union_pw_aff *
2648         isl_multi_union_pw_aff_from_union_pw_aff(
2649                 __isl_take isl_union_pw_aff *upa);
2651 A multiple expression can be created from a list
2652 of base expression in a specified space.
2653 The domain of this space needs to be the same
2654 as the domains of the base expressions in the list.
2655 If the base expressions have a set space (or no associated space),
2656 then this space also needs to be a set space.
2658         #include <isl/val.h>
2659         __isl_give isl_multi_val *isl_multi_val_from_val_list(
2660                 __isl_take isl_space *space,
2661                 __isl_take isl_val_list *list);
2663         #include <isl/aff.h>
2664         __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2665                 __isl_take isl_space *space,
2666                 __isl_take isl_aff_list *list);
2667         __isl_give isl_multi_union_pw_aff *
2668         isl_multi_union_pw_aff_from_union_pw_aff_list(
2669                 __isl_take isl_space *space,
2670                 __isl_take isl_union_pw_aff_list *list);
2672 As a convenience, a multiple piecewise expression can
2673 also be created from a multiple expression.
2674 Each piecewise expression in the result has a single
2675 universe cell.
2677         #include <isl/aff.h>
2678         __isl_give isl_multi_pw_aff *
2679         isl_multi_pw_aff_from_multi_aff(
2680                 __isl_take isl_multi_aff *ma);
2682 Similarly, a multiple union expression can be
2683 created from a multiple expression.
2685         #include <isl/aff.h>
2686         __isl_give isl_multi_union_pw_aff *
2687         isl_multi_union_pw_aff_from_multi_aff(
2688                 __isl_take isl_multi_aff *ma);
2689         __isl_give isl_multi_union_pw_aff *
2690         isl_multi_union_pw_aff_from_multi_pw_aff(
2691                 __isl_take isl_multi_pw_aff *mpa);
2693 A multiple quasi-affine expression can be created from
2694 a multiple value with a given domain space using the following
2695 function.
2697         #include <isl/aff.h>
2698         __isl_give isl_multi_aff *
2699         isl_multi_aff_multi_val_on_space(
2700                 __isl_take isl_space *space,
2701                 __isl_take isl_multi_val *mv);
2703 Similarly,
2704 a multiple union piecewise affine expression can be created from
2705 a multiple value with a given domain or
2706 a multiple affine expression with a given domain
2707 using the following functions.
2709         #include <isl/aff.h>
2710         __isl_give isl_multi_union_pw_aff *
2711         isl_multi_union_pw_aff_multi_val_on_domain(
2712                 __isl_take isl_union_set *domain,
2713                 __isl_take isl_multi_val *mv);
2714         __isl_give isl_multi_union_pw_aff *
2715         isl_multi_union_pw_aff_multi_aff_on_domain(
2716                 __isl_take isl_union_set *domain,
2717                 __isl_take isl_multi_aff *ma);
2719 Multiple expressions can be copied and freed using
2720 the following functions.
2722         #include <isl/val.h>
2723         __isl_give isl_multi_val *isl_multi_val_copy(
2724                 __isl_keep isl_multi_val *mv);
2725         __isl_null isl_multi_val *isl_multi_val_free(
2726                 __isl_take isl_multi_val *mv);
2728         #include <isl/aff.h>
2729         __isl_give isl_multi_aff *isl_multi_aff_copy(
2730                 __isl_keep isl_multi_aff *maff);
2731         __isl_null isl_multi_aff *isl_multi_aff_free(
2732                 __isl_take isl_multi_aff *maff);
2733         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2734                 __isl_keep isl_multi_pw_aff *mpa);
2735         __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2736                 __isl_take isl_multi_pw_aff *mpa);
2737         __isl_give isl_multi_union_pw_aff *
2738         isl_multi_union_pw_aff_copy(
2739                 __isl_keep isl_multi_union_pw_aff *mupa);
2740         __isl_null isl_multi_union_pw_aff *
2741         isl_multi_union_pw_aff_free(
2742                 __isl_take isl_multi_union_pw_aff *mupa);
2744 The base expression at a given position of a multiple
2745 expression can be extracted using the following functions.
2747         #include <isl/val.h>
2748         __isl_give isl_val *isl_multi_val_get_val(
2749                 __isl_keep isl_multi_val *mv, int pos);
2751         #include <isl/aff.h>
2752         __isl_give isl_aff *isl_multi_aff_get_aff(
2753                 __isl_keep isl_multi_aff *multi, int pos);
2754         __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2755                 __isl_keep isl_multi_pw_aff *mpa, int pos);
2756         __isl_give isl_union_pw_aff *
2757         isl_multi_union_pw_aff_get_union_pw_aff(
2758                 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
2760 It can be replaced using the following functions.
2762         #include <isl/val.h>
2763         __isl_give isl_multi_val *isl_multi_val_set_val(
2764                 __isl_take isl_multi_val *mv, int pos,
2765                 __isl_take isl_val *val);
2767         #include <isl/aff.h>
2768         __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2769                 __isl_take isl_multi_aff *multi, int pos,
2770                 __isl_take isl_aff *aff);
2771         __isl_give isl_multi_union_pw_aff *
2772         isl_multi_union_pw_aff_set_union_pw_aff(
2773                 __isl_take isl_multi_union_pw_aff *mupa, int pos,
2774                 __isl_take isl_union_pw_aff *upa);
2776 As a convenience, a sequence of base expressions that have
2777 their domains in a given space can be extracted from a sequence
2778 of union expressions using the following function.
2780         #include <isl/aff.h>
2781         __isl_give isl_multi_pw_aff *
2782         isl_multi_union_pw_aff_extract_multi_pw_aff(
2783                 __isl_keep isl_multi_union_pw_aff *mupa,
2784                 __isl_take isl_space *space);
2786 Note that there is a difference between C<isl_multi_union_pw_aff>
2787 and C<isl_union_pw_multi_aff> objects.  The first is a sequence
2788 of unions of piecewise expressions, while the second is a union
2789 of piecewise sequences.  In particular, multiple affine expressions
2790 in an C<isl_union_pw_multi_aff> may live in different spaces,
2791 while there is only a single multiple expression in
2792 an C<isl_multi_union_pw_aff>, which can therefore only live
2793 in a single space.  This means that not every
2794 C<isl_union_pw_multi_aff> can be converted to
2795 an C<isl_multi_union_pw_aff>.  Conversely, a zero-dimensional
2796 C<isl_multi_union_pw_aff> carries no information
2797 about any possible domain and therefore cannot be converted
2798 to an C<isl_union_pw_multi_aff>.  Moreover, the elements
2799 of an C<isl_multi_union_pw_aff> may be defined over different domains,
2800 while each multiple expression inside an C<isl_union_pw_multi_aff>
2801 has a single domain.  The conversion of an C<isl_union_pw_multi_aff>
2802 of dimension greater than one may therefore not be exact.
2803 The following functions can
2804 be used to perform these conversions when they are possible.
2806         #include <isl/aff.h>
2807         __isl_give isl_multi_union_pw_aff *
2808         isl_multi_union_pw_aff_from_union_pw_multi_aff(
2809                 __isl_take isl_union_pw_multi_aff *upma);
2810         __isl_give isl_union_pw_multi_aff *
2811         isl_union_pw_multi_aff_from_multi_union_pw_aff(
2812                 __isl_take isl_multi_union_pw_aff *mupa);
2814 =head3 Piecewise Expressions
2816 A piecewise expression is an expression that is described
2817 using zero or more base expression defined over the same
2818 number of cells in the domain space of the base expressions.
2819 All base expressions are defined over the same
2820 domain space and the cells are disjoint.
2821 The space of a piecewise expression is the same as
2822 that of the base expressions.
2823 If the union of the cells is a strict subset of the domain
2824 space, then the value of the piecewise expression outside
2825 this union is different for types derived from quasi-affine
2826 expressions and those derived from quasipolynomials.
2827 Piecewise expressions derived from quasi-affine expressions
2828 are considered to be undefined outside the union of their cells.
2829 Piecewise expressions derived from quasipolynomials
2830 are considered to be zero outside the union of their cells.
2832 Piecewise quasipolynomials are mainly used by the C<barvinok>
2833 library for representing the number of elements in a parametric set or map.
2834 For example, the piecewise quasipolynomial
2836         [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
2838 represents the number of points in the map
2840         [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
2842 The piecewise expression types defined by C<isl>
2843 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
2844 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
2846 A piecewise expression with no cells can be created using
2847 the following functions.
2849         #include <isl/aff.h>
2850         __isl_give isl_pw_aff *isl_pw_aff_empty(
2851                 __isl_take isl_space *space);
2852         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
2853                 __isl_take isl_space *space);
2855 A piecewise expression with a single universe cell can be
2856 created using the following functions.
2858         #include <isl/aff.h>
2859         __isl_give isl_pw_aff *isl_pw_aff_from_aff(
2860                 __isl_take isl_aff *aff);
2861         __isl_give isl_pw_multi_aff *
2862         isl_pw_multi_aff_from_multi_aff(
2863                 __isl_take isl_multi_aff *ma);
2865         #include <isl/polynomial.h>
2866         __isl_give isl_pw_qpolynomial *
2867         isl_pw_qpolynomial_from_qpolynomial(
2868                 __isl_take isl_qpolynomial *qp);
2870 A piecewise expression with a single specified cell can be
2871 created using the following functions.
2873         #include <isl/aff.h>
2874         __isl_give isl_pw_aff *isl_pw_aff_alloc(
2875                 __isl_take isl_set *set, __isl_take isl_aff *aff);
2876         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
2877                 __isl_take isl_set *set,
2878                 __isl_take isl_multi_aff *maff);
2880         #include <isl/polynomial.h>
2881         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
2882                 __isl_take isl_set *set,
2883                 __isl_take isl_qpolynomial *qp);
2885 The following convenience functions first create a base expression and
2886 then create a piecewise expression over a universe domain.
2888         #include <isl/aff.h>
2889         __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
2890                 __isl_take isl_local_space *ls);
2891         __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
2892                 __isl_take isl_local_space *ls,
2893                 enum isl_dim_type type, unsigned pos);
2894         __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
2895                 __isl_take isl_local_space *ls);
2896         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
2897                 __isl_take isl_space *space);
2898         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
2899                 __isl_take isl_space *space);
2900         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
2901                 __isl_take isl_space *space);
2902         __isl_give isl_pw_multi_aff *
2903         isl_pw_multi_aff_project_out_map(
2904                 __isl_take isl_space *space,
2905                 enum isl_dim_type type,
2906                 unsigned first, unsigned n);
2908         #include <isl/polynomial.h>
2909         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
2910                 __isl_take isl_space *space);
2912 The following convenience functions first create a base expression and
2913 then create a piecewise expression over a given domain.
2915         #include <isl/aff.h>
2916         __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
2917                 __isl_take isl_set *domain,
2918                 __isl_take isl_val *v);
2919         __isl_give isl_pw_multi_aff *
2920         isl_pw_multi_aff_multi_val_on_domain(
2921                 __isl_take isl_set *domain,
2922                 __isl_take isl_multi_val *mv);
2924 As a convenience, a piecewise multiple expression can
2925 also be created from a piecewise expression.
2926 Each multiple expression in the result is derived
2927 from the corresponding base expression.
2929         #include <isl/aff.h>
2930         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
2931                 __isl_take isl_pw_aff *pa);
2933 Similarly, a piecewise quasipolynomial can be
2934 created from a piecewise quasi-affine expression using
2935 the following function.
2937         #include <isl/polynomial.h>
2938         __isl_give isl_pw_qpolynomial *
2939         isl_pw_qpolynomial_from_pw_aff(
2940                 __isl_take isl_pw_aff *pwaff);
2942 Piecewise expressions can be copied and freed using the following functions.
2944         #include <isl/aff.h>
2945         __isl_give isl_pw_aff *isl_pw_aff_copy(
2946                 __isl_keep isl_pw_aff *pwaff);
2947         __isl_null isl_pw_aff *isl_pw_aff_free(
2948                 __isl_take isl_pw_aff *pwaff);
2949         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
2950                 __isl_keep isl_pw_multi_aff *pma);
2951         __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
2952                 __isl_take isl_pw_multi_aff *pma);
2954         #include <isl/polynomial.h>
2955         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
2956                 __isl_keep isl_pw_qpolynomial *pwqp);
2957         __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
2958                 __isl_take isl_pw_qpolynomial *pwqp);
2959         __isl_give isl_pw_qpolynomial_fold *
2960         isl_pw_qpolynomial_fold_copy(
2961                 __isl_keep isl_pw_qpolynomial_fold *pwf);
2962         __isl_null isl_pw_qpolynomial_fold *
2963         isl_pw_qpolynomial_fold_free(
2964                 __isl_take isl_pw_qpolynomial_fold *pwf);
2966 To iterate over the different cells of a piecewise expression,
2967 use the following functions.
2969         #include <isl/aff.h>
2970         int isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
2971         int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
2972         int isl_pw_aff_foreach_piece(__isl_keep isl_pw_aff *pwaff,
2973                 int (*fn)(__isl_take isl_set *set,
2974                           __isl_take isl_aff *aff,
2975                           void *user), void *user);
2976         int isl_pw_multi_aff_foreach_piece(
2977                 __isl_keep isl_pw_multi_aff *pma,
2978                 int (*fn)(__isl_take isl_set *set,
2979                             __isl_take isl_multi_aff *maff,
2980                             void *user), void *user);
2982         #include <isl/polynomial.h>
2983         int isl_pw_qpolynomial_foreach_piece(
2984                 __isl_keep isl_pw_qpolynomial *pwqp,
2985                 int (*fn)(__isl_take isl_set *set,
2986                           __isl_take isl_qpolynomial *qp,
2987                           void *user), void *user);
2988         int isl_pw_qpolynomial_foreach_lifted_piece(
2989                 __isl_keep isl_pw_qpolynomial *pwqp,
2990                 int (*fn)(__isl_take isl_set *set,
2991                           __isl_take isl_qpolynomial *qp,
2992                           void *user), void *user);
2993         int isl_pw_qpolynomial_fold_foreach_piece(
2994                 __isl_keep isl_pw_qpolynomial_fold *pwf,
2995                 int (*fn)(__isl_take isl_set *set,
2996                           __isl_take isl_qpolynomial_fold *fold,
2997                           void *user), void *user);
2998         int isl_pw_qpolynomial_fold_foreach_lifted_piece(
2999                 __isl_keep isl_pw_qpolynomial_fold *pwf,
3000                 int (*fn)(__isl_take isl_set *set,
3001                           __isl_take isl_qpolynomial_fold *fold,
3002                           void *user), void *user);
3004 As usual, the function C<fn> should return C<0> on success
3005 and C<-1> on failure.  The difference between
3006 C<isl_pw_qpolynomial_foreach_piece> and
3007 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
3008 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
3009 compute unique representations for all existentially quantified
3010 variables and then turn these existentially quantified variables
3011 into extra set variables, adapting the associated quasipolynomial
3012 accordingly.  This means that the C<set> passed to C<fn>
3013 will not have any existentially quantified variables, but that
3014 the dimensions of the sets may be different for different
3015 invocations of C<fn>.
3016 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
3017 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
3019 A piecewise expression consisting of the expressions at a given
3020 position of a piecewise multiple expression can be extracted
3021 using the following function.
3023         #include <isl/aff.h>
3024         __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3025                 __isl_keep isl_pw_multi_aff *pma, int pos);
3027 These expressions can be replaced using the following function.
3029         #include <isl/aff.h>
3030         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3031                 __isl_take isl_pw_multi_aff *pma, unsigned pos,
3032                 __isl_take isl_pw_aff *pa);
3034 Note that there is a difference between C<isl_multi_pw_aff> and
3035 C<isl_pw_multi_aff> objects.  The first is a sequence of piecewise
3036 affine expressions, while the second is a piecewise sequence
3037 of affine expressions.  In particular, each of the piecewise
3038 affine expressions in an C<isl_multi_pw_aff> may have a different
3039 domain, while all multiple expressions associated to a cell
3040 in an C<isl_pw_multi_aff> have the same domain.
3041 It is possible to convert between the two, but when converting
3042 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3043 of the result is the intersection of the domains of the input.
3044 The reverse conversion is exact.
3046         #include <isl/aff.h>
3047         __isl_give isl_pw_multi_aff *
3048         isl_pw_multi_aff_from_multi_pw_aff(
3049                 __isl_take isl_multi_pw_aff *mpa);
3050         __isl_give isl_multi_pw_aff *
3051         isl_multi_pw_aff_from_pw_multi_aff(
3052                 __isl_take isl_pw_multi_aff *pma);
3054 =head3 Union Expressions
3056 A union expression collects base expressions defined
3057 over different domains.  The space of a union expression
3058 is that of the shared parameter space.
3060 The union expression types defined by C<isl>
3061 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3062 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3064 An empty union expression can be created using the following functions.
3066         #include <isl/aff.h>
3067         __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
3068                 __isl_take isl_space *space);
3069         __isl_give isl_union_pw_multi_aff *
3070         isl_union_pw_multi_aff_empty(
3071                 __isl_take isl_space *space);
3073         #include <isl/polynomial.h>
3074         __isl_give isl_union_pw_qpolynomial *
3075         isl_union_pw_qpolynomial_zero(
3076                 __isl_take isl_space *space);
3078 A union expression containing a single base expression
3079 can be created using the following functions.
3081         #include <isl/aff.h>
3082         __isl_give isl_union_pw_aff *
3083         isl_union_pw_aff_from_pw_aff(
3084                 __isl_take isl_pw_aff *pa);
3085         __isl_give isl_union_pw_multi_aff *
3086         isl_union_pw_multi_aff_from_aff(
3087                 __isl_take isl_aff *aff);
3088         __isl_give isl_union_pw_multi_aff *
3089         isl_union_pw_multi_aff_from_pw_multi_aff(
3090                 __isl_take isl_pw_multi_aff *pma);
3092         #include <isl/polynomial.h>
3093         __isl_give isl_union_pw_qpolynomial *
3094         isl_union_pw_qpolynomial_from_pw_qpolynomial(
3095                 __isl_take isl_pw_qpolynomial *pwqp);
3097 The following functions create a base expression on each
3098 of the sets in the union set and collect the results.
3100         #include <isl/aff.h>
3101         __isl_give isl_union_pw_multi_aff *
3102         isl_union_pw_multi_aff_from_union_pw_aff(
3103                 __isl_take isl_union_pw_aff *upa);
3104         __isl_give isl_union_pw_aff *
3105         isl_union_pw_multi_aff_get_union_pw_aff(
3106                 __isl_keep isl_union_pw_multi_aff *upma, int pos);
3107         __isl_give isl_union_pw_aff *
3108         isl_union_pw_aff_val_on_domain(
3109                 __isl_take isl_union_set *domain,
3110                 __isl_take isl_val *v);
3111         __isl_give isl_union_pw_multi_aff *
3112         isl_union_pw_multi_aff_multi_val_on_domain(
3113                 __isl_take isl_union_set *domain,
3114                 __isl_take isl_multi_val *mv);
3116 An C<isl_union_pw_aff> that is equal to a (parametric) affine
3117 expression on a given domain can be created using the following
3118 function.
3120         #include <isl/aff.h>
3121         __isl_give isl_union_pw_aff *
3122         isl_union_pw_aff_aff_on_domain(
3123                 __isl_take isl_union_set *domain,
3124                 __isl_take isl_aff *aff);
3126 A base expression can be added to a union expression using
3127 the following functions.
3129         #include <isl/aff.h>
3130         __isl_give isl_union_pw_aff *
3131         isl_union_pw_aff_add_pw_aff(
3132                 __isl_take isl_union_pw_aff *upa,
3133                 __isl_take isl_pw_aff *pa);
3134         __isl_give isl_union_pw_multi_aff *
3135         isl_union_pw_multi_aff_add_pw_multi_aff(
3136                 __isl_take isl_union_pw_multi_aff *upma,
3137                 __isl_take isl_pw_multi_aff *pma);
3139         #include <isl/polynomial.h>
3140         __isl_give isl_union_pw_qpolynomial *
3141         isl_union_pw_qpolynomial_add_pw_qpolynomial(
3142                 __isl_take isl_union_pw_qpolynomial *upwqp,
3143                 __isl_take isl_pw_qpolynomial *pwqp);
3145 Union expressions can be copied and freed using
3146 the following functions.
3148         #include <isl/aff.h>
3149         __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
3150                 __isl_keep isl_union_pw_aff *upa);
3151         __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
3152                 __isl_take isl_union_pw_aff *upa);
3153         __isl_give isl_union_pw_multi_aff *
3154         isl_union_pw_multi_aff_copy(
3155                 __isl_keep isl_union_pw_multi_aff *upma);
3156         __isl_null isl_union_pw_multi_aff *
3157         isl_union_pw_multi_aff_free(
3158                 __isl_take isl_union_pw_multi_aff *upma);
3160         #include <isl/polynomial.h>
3161         __isl_give isl_union_pw_qpolynomial *
3162         isl_union_pw_qpolynomial_copy(
3163                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3164         __isl_null isl_union_pw_qpolynomial *
3165         isl_union_pw_qpolynomial_free(
3166                 __isl_take isl_union_pw_qpolynomial *upwqp);
3167         __isl_give isl_union_pw_qpolynomial_fold *
3168         isl_union_pw_qpolynomial_fold_copy(
3169                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3170         __isl_null isl_union_pw_qpolynomial_fold *
3171         isl_union_pw_qpolynomial_fold_free(
3172                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3174 To iterate over the base expressions in a union expression,
3175 use the following functions.
3177         #include <isl/aff.h>
3178         int isl_union_pw_aff_n_pw_aff(
3179                 __isl_keep isl_union_pw_aff *upa);
3180         int isl_union_pw_aff_foreach_pw_aff(
3181                 __isl_keep isl_union_pw_aff *upa,
3182                 int (*fn)(__isl_take isl_pw_aff *ma, void *user),
3183                         void *user);
3184         int isl_union_pw_multi_aff_n_pw_multi_aff(
3185                 __isl_keep isl_union_pw_multi_aff *upma);
3186         int isl_union_pw_multi_aff_foreach_pw_multi_aff(
3187                 __isl_keep isl_union_pw_multi_aff *upma,
3188                 int (*fn)(__isl_take isl_pw_multi_aff *pma,
3189                             void *user), void *user);
3191         #include <isl/polynomial.h>
3192         int isl_union_pw_qpolynomial_n_pw_qpolynomial(
3193                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3194         int isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3195                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3196                 int (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3197                             void *user), void *user);
3198         int isl_union_pw_qpolynomial_fold_n_pw_qpolynomial_fold(
3199                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3200         int isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3201                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3202                 int (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3203                             void *user), void *user);
3205 To extract the base expression in a given space from a union, use
3206 the following functions.
3208         #include <isl/aff.h>
3209         __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3210                 __isl_keep isl_union_pw_aff *upa,
3211                 __isl_take isl_space *space);
3212         __isl_give isl_pw_multi_aff *
3213         isl_union_pw_multi_aff_extract_pw_multi_aff(
3214                 __isl_keep isl_union_pw_multi_aff *upma,
3215                 __isl_take isl_space *space);
3217         #include <isl/polynomial.h>
3218         __isl_give isl_pw_qpolynomial *
3219         isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3220                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3221                 __isl_take isl_space *space);
3223 =head2 Input and Output
3225 For set and relation,
3226 C<isl> supports its own input/output format, which is similar
3227 to the C<Omega> format, but also supports the C<PolyLib> format
3228 in some cases.
3229 For other object types, typically only an C<isl> format is supported.
3231 =head3 C<isl> format
3233 The C<isl> format is similar to that of C<Omega>, but has a different
3234 syntax for describing the parameters and allows for the definition
3235 of an existentially quantified variable as the integer division
3236 of an affine expression.
3237 For example, the set of integers C<i> between C<0> and C<n>
3238 such that C<i % 10 <= 6> can be described as
3240         [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3241                                 i - 10 a <= 6) }
3243 A set or relation can have several disjuncts, separated
3244 by the keyword C<or>.  Each disjunct is either a conjunction
3245 of constraints or a projection (C<exists>) of a conjunction
3246 of constraints.  The constraints are separated by the keyword
3247 C<and>.
3249 =head3 C<PolyLib> format
3251 If the represented set is a union, then the first line
3252 contains a single number representing the number of disjuncts.
3253 Otherwise, a line containing the number C<1> is optional.
3255 Each disjunct is represented by a matrix of constraints.
3256 The first line contains two numbers representing
3257 the number of rows and columns,
3258 where the number of rows is equal to the number of constraints
3259 and the number of columns is equal to two plus the number of variables.
3260 The following lines contain the actual rows of the constraint matrix.
3261 In each row, the first column indicates whether the constraint
3262 is an equality (C<0>) or inequality (C<1>).  The final column
3263 corresponds to the constant term.
3265 If the set is parametric, then the coefficients of the parameters
3266 appear in the last columns before the constant column.
3267 The coefficients of any existentially quantified variables appear
3268 between those of the set variables and those of the parameters.
3270 =head3 Extended C<PolyLib> format
3272 The extended C<PolyLib> format is nearly identical to the
3273 C<PolyLib> format.  The only difference is that the line
3274 containing the number of rows and columns of a constraint matrix
3275 also contains four additional numbers:
3276 the number of output dimensions, the number of input dimensions,
3277 the number of local dimensions (i.e., the number of existentially
3278 quantified variables) and the number of parameters.
3279 For sets, the number of ``output'' dimensions is equal
3280 to the number of set dimensions, while the number of ``input''
3281 dimensions is zero.
3283 =head3 Input
3285 Objects can be read from input using the following functions.
3287         #include <isl/val.h>
3288         __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3289                 const char *str);
3290         __isl_give isl_multi_val *isl_multi_val_read_from_str(
3291                 isl_ctx *ctx, const char *str);
3293         #include <isl/set.h>
3294         __isl_give isl_basic_set *isl_basic_set_read_from_file(
3295                 isl_ctx *ctx, FILE *input);
3296         __isl_give isl_basic_set *isl_basic_set_read_from_str(
3297                 isl_ctx *ctx, const char *str);
3298         __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3299                 FILE *input);
3300         __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3301                 const char *str);
3303         #include <isl/map.h>
3304         __isl_give isl_basic_map *isl_basic_map_read_from_file(
3305                 isl_ctx *ctx, FILE *input);
3306         __isl_give isl_basic_map *isl_basic_map_read_from_str(
3307                 isl_ctx *ctx, const char *str);
3308         __isl_give isl_map *isl_map_read_from_file(
3309                 isl_ctx *ctx, FILE *input);
3310         __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3311                 const char *str);
3313         #include <isl/union_set.h>
3314         __isl_give isl_union_set *isl_union_set_read_from_file(
3315                 isl_ctx *ctx, FILE *input);
3316         __isl_give isl_union_set *isl_union_set_read_from_str(
3317                 isl_ctx *ctx, const char *str);
3319         #include <isl/union_map.h>
3320         __isl_give isl_union_map *isl_union_map_read_from_file(
3321                 isl_ctx *ctx, FILE *input);
3322         __isl_give isl_union_map *isl_union_map_read_from_str(
3323                 isl_ctx *ctx, const char *str);
3325         #include <isl/aff.h>
3326         __isl_give isl_aff *isl_aff_read_from_str(
3327                 isl_ctx *ctx, const char *str);
3328         __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3329                 isl_ctx *ctx, const char *str);
3330         __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3331                 isl_ctx *ctx, const char *str);
3332         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3333                 isl_ctx *ctx, const char *str);
3334         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3335                 isl_ctx *ctx, const char *str);
3336         __isl_give isl_union_pw_multi_aff *
3337         isl_union_pw_multi_aff_read_from_str(
3338                 isl_ctx *ctx, const char *str);
3339         __isl_give isl_multi_union_pw_aff *
3340         isl_multi_union_pw_aff_read_from_str(
3341                 isl_ctx *ctx, const char *str);
3343         #include <isl/polynomial.h>
3344         __isl_give isl_union_pw_qpolynomial *
3345         isl_union_pw_qpolynomial_read_from_str(
3346                 isl_ctx *ctx, const char *str);
3348 For sets and relations,
3349 the input format is autodetected and may be either the C<PolyLib> format
3350 or the C<isl> format.
3352 =head3 Output
3354 Before anything can be printed, an C<isl_printer> needs to
3355 be created.
3357         __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3358                 FILE *file);
3359         __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3360         __isl_null isl_printer *isl_printer_free(
3361                 __isl_take isl_printer *printer);
3362         __isl_give char *isl_printer_get_str(
3363                 __isl_keep isl_printer *printer);
3365 The printer can be inspected using the following functions.
3367         FILE *isl_printer_get_file(
3368                 __isl_keep isl_printer *printer);
3369         int isl_printer_get_output_format(
3370                 __isl_keep isl_printer *p);
3371         int isl_printer_get_yaml_style(__isl_keep isl_printer *p);
3373 The behavior of the printer can be modified in various ways
3375         __isl_give isl_printer *isl_printer_set_output_format(
3376                 __isl_take isl_printer *p, int output_format);
3377         __isl_give isl_printer *isl_printer_set_indent(
3378                 __isl_take isl_printer *p, int indent);
3379         __isl_give isl_printer *isl_printer_set_indent_prefix(
3380                 __isl_take isl_printer *p, const char *prefix);
3381         __isl_give isl_printer *isl_printer_indent(
3382                 __isl_take isl_printer *p, int indent);
3383         __isl_give isl_printer *isl_printer_set_prefix(
3384                 __isl_take isl_printer *p, const char *prefix);
3385         __isl_give isl_printer *isl_printer_set_suffix(
3386                 __isl_take isl_printer *p, const char *suffix);
3387         __isl_give isl_printer *isl_printer_set_yaml_style(
3388                 __isl_take isl_printer *p, int yaml_style);
3390 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3391 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3392 and defaults to C<ISL_FORMAT_ISL>.
3393 Each line in the output is prefixed by C<indent_prefix>,
3394 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3395 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3396 In the C<PolyLib> format output,
3397 the coefficients of the existentially quantified variables
3398 appear between those of the set variables and those
3399 of the parameters.
3400 The function C<isl_printer_indent> increases the indentation
3401 by the specified amount (which may be negative).
3402 The YAML style may be either C<ISL_YAML_STYLE_BLOCK> or
3403 C<ISL_YAML_STYLE_FLOW> and when we are printing something
3404 in YAML format.
3406 To actually print something, use
3408         #include <isl/printer.h>
3409         __isl_give isl_printer *isl_printer_print_double(
3410                 __isl_take isl_printer *p, double d);
3412         #include <isl/val.h>
3413         __isl_give isl_printer *isl_printer_print_val(
3414                 __isl_take isl_printer *p, __isl_keep isl_val *v);
3416         #include <isl/set.h>
3417         __isl_give isl_printer *isl_printer_print_basic_set(
3418                 __isl_take isl_printer *printer,
3419                 __isl_keep isl_basic_set *bset);
3420         __isl_give isl_printer *isl_printer_print_set(
3421                 __isl_take isl_printer *printer,
3422                 __isl_keep isl_set *set);
3424         #include <isl/map.h>
3425         __isl_give isl_printer *isl_printer_print_basic_map(
3426                 __isl_take isl_printer *printer,
3427                 __isl_keep isl_basic_map *bmap);
3428         __isl_give isl_printer *isl_printer_print_map(
3429                 __isl_take isl_printer *printer,
3430                 __isl_keep isl_map *map);
3432         #include <isl/union_set.h>
3433         __isl_give isl_printer *isl_printer_print_union_set(
3434                 __isl_take isl_printer *p,
3435                 __isl_keep isl_union_set *uset);
3437         #include <isl/union_map.h>
3438         __isl_give isl_printer *isl_printer_print_union_map(
3439                 __isl_take isl_printer *p,
3440                 __isl_keep isl_union_map *umap);
3442         #include <isl/val.h>
3443         __isl_give isl_printer *isl_printer_print_multi_val(
3444                 __isl_take isl_printer *p,
3445                 __isl_keep isl_multi_val *mv);
3447         #include <isl/aff.h>
3448         __isl_give isl_printer *isl_printer_print_aff(
3449                 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3450         __isl_give isl_printer *isl_printer_print_multi_aff(
3451                 __isl_take isl_printer *p,
3452                 __isl_keep isl_multi_aff *maff);
3453         __isl_give isl_printer *isl_printer_print_pw_aff(
3454                 __isl_take isl_printer *p,
3455                 __isl_keep isl_pw_aff *pwaff);
3456         __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3457                 __isl_take isl_printer *p,
3458                 __isl_keep isl_pw_multi_aff *pma);
3459         __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3460                 __isl_take isl_printer *p,
3461                 __isl_keep isl_multi_pw_aff *mpa);
3462         __isl_give isl_printer *isl_printer_print_union_pw_aff(
3463                 __isl_take isl_printer *p,
3464                 __isl_keep isl_union_pw_aff *upa);
3465         __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3466                 __isl_take isl_printer *p,
3467                 __isl_keep isl_union_pw_multi_aff *upma);
3468         __isl_give isl_printer *
3469         isl_printer_print_multi_union_pw_aff(
3470                 __isl_take isl_printer *p,
3471                 __isl_keep isl_multi_union_pw_aff *mupa);
3473         #include <isl/polynomial.h>
3474         __isl_give isl_printer *isl_printer_print_qpolynomial(
3475                 __isl_take isl_printer *p,
3476                 __isl_keep isl_qpolynomial *qp);
3477         __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3478                 __isl_take isl_printer *p,
3479                 __isl_keep isl_pw_qpolynomial *pwqp);
3480         __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3481                 __isl_take isl_printer *p,
3482                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3484         __isl_give isl_printer *
3485         isl_printer_print_pw_qpolynomial_fold(
3486                 __isl_take isl_printer *p,
3487                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3488         __isl_give isl_printer *
3489         isl_printer_print_union_pw_qpolynomial_fold(
3490                 __isl_take isl_printer *p,
3491                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3493 For C<isl_printer_print_qpolynomial>,
3494 C<isl_printer_print_pw_qpolynomial> and
3495 C<isl_printer_print_pw_qpolynomial_fold>,
3496 the output format of the printer
3497 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3498 For C<isl_printer_print_union_pw_qpolynomial> and
3499 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3500 is supported.
3501 In case of printing in C<ISL_FORMAT_C>, the user may want
3502 to set the names of all dimensions first.
3504 C<isl> also provides limited support for printing YAML documents,
3505 just enough for the internal use for printing such documents.
3507         #include <isl/printer.h>
3508         __isl_give isl_printer *isl_printer_yaml_start_mapping(
3509                 __isl_take isl_printer *p);
3510         __isl_give isl_printer *isl_printer_yaml_end_mapping(
3511                 __isl_take isl_printer *p);
3512         __isl_give isl_printer *isl_printer_yaml_start_sequence(
3513                 __isl_take isl_printer *p);
3514         __isl_give isl_printer *isl_printer_yaml_end_sequence(
3515                 __isl_take isl_printer *p);
3516         __isl_give isl_printer *isl_printer_yaml_next(
3517                 __isl_take isl_printer *p);
3519 A document is started by a call to either
3520 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3521 Anything printed to the printer after such a call belong to the
3522 first key of the mapping or the first element in the sequence.
3523 The function C<isl_printer_yaml_next> moves to the value if
3524 we are currently printing a mapping key, the next key if we
3525 are printing a value or the next element if we are printing
3526 an element in a sequence.
3527 Nested mappings and sequences are initiated by the same
3528 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3529 Each call to these functions needs to have a corresponding call to
3530 C<isl_printer_yaml_end_mapping> or C<isl_printer_yaml_end_sequence>.
3532 When called on a file printer, the following function flushes
3533 the file.  When called on a string printer, the buffer is cleared.
3535         __isl_give isl_printer *isl_printer_flush(
3536                 __isl_take isl_printer *p);
3538 Alternatively, a string representation can be obtained
3539 directly using the following functions, which always print
3540 in isl format.
3542         #include <isl/space.h>
3543         __isl_give char *isl_space_to_str(
3544                 __isl_keep isl_space *space);
3546         #include <isl/val.h>
3547         __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3548         __isl_give char *isl_multi_val_to_str(
3549                 __isl_keep isl_multi_val *mv);
3551         #include <isl/set.h>
3552         __isl_give char *isl_set_to_str(
3553                 __isl_keep isl_set *set);
3555         #include <isl/union_set.h>
3556         __isl_give char *isl_union_set_to_str(
3557                 __isl_keep isl_union_set *uset);
3559         #include <isl/map.h>
3560         __isl_give char *isl_map_to_str(
3561                 __isl_keep isl_map *map);
3563         #include <isl/union_map.h>
3564         __isl_give char *isl_union_map_to_str(
3565                 __isl_keep isl_union_map *umap);
3567         #include <isl/aff.h>
3568         __isl_give char *isl_multi_aff_to_str(
3569                 __isl_keep isl_multi_aff *aff);
3570         __isl_give char *isl_union_pw_aff_to_str(
3571                 __isl_keep isl_union_pw_aff *upa);
3572         __isl_give char *isl_union_pw_multi_aff_to_str(
3573                 __isl_keep isl_union_pw_multi_aff *upma);
3574         __isl_give char *isl_multi_union_pw_aff_to_str(
3575                 __isl_keep isl_multi_union_pw_aff *mupa);
3577 =head2 Properties
3579 =head3 Unary Properties
3581 =over
3583 =item * Emptiness
3585 The following functions test whether the given set or relation
3586 contains any integer points.  The ``plain'' variants do not perform
3587 any computations, but simply check if the given set or relation
3588 is already known to be empty.
3590         int isl_basic_set_plain_is_empty(__isl_keep isl_basic_set *bset);
3591         int isl_basic_set_is_empty(__isl_keep isl_basic_set *bset);
3592         int isl_set_plain_is_empty(__isl_keep isl_set *set);
3593         int isl_set_is_empty(__isl_keep isl_set *set);
3594         int isl_union_set_is_empty(__isl_keep isl_union_set *uset);
3595         int isl_basic_map_plain_is_empty(__isl_keep isl_basic_map *bmap);
3596         int isl_basic_map_is_empty(__isl_keep isl_basic_map *bmap);
3597         int isl_map_plain_is_empty(__isl_keep isl_map *map);
3598         int isl_map_is_empty(__isl_keep isl_map *map);
3599         int isl_union_map_is_empty(__isl_keep isl_union_map *umap);
3601 =item * Universality
3603         int isl_basic_set_is_universe(__isl_keep isl_basic_set *bset);
3604         int isl_basic_map_is_universe(__isl_keep isl_basic_map *bmap);
3605         int isl_set_plain_is_universe(__isl_keep isl_set *set);
3607 =item * Single-valuedness
3609         #include <isl/set.h>
3610         int isl_set_is_singleton(__isl_keep isl_set *set);
3612         #include <isl/map.h>
3613         int isl_basic_map_is_single_valued(
3614                 __isl_keep isl_basic_map *bmap);
3615         int isl_map_plain_is_single_valued(
3616                 __isl_keep isl_map *map);
3617         int isl_map_is_single_valued(__isl_keep isl_map *map);
3619         #include <isl/union_map.h>
3620         int isl_union_map_is_single_valued(__isl_keep isl_union_map *umap);
3622 =item * Injectivity
3624         int isl_map_plain_is_injective(__isl_keep isl_map *map);
3625         int isl_map_is_injective(__isl_keep isl_map *map);
3626         int isl_union_map_plain_is_injective(
3627                 __isl_keep isl_union_map *umap);
3628         int isl_union_map_is_injective(
3629                 __isl_keep isl_union_map *umap);
3631 =item * Bijectivity
3633         int isl_map_is_bijective(__isl_keep isl_map *map);
3634         int isl_union_map_is_bijective(__isl_keep isl_union_map *umap);
3636 =item * Position
3638         __isl_give isl_val *
3639         isl_basic_map_plain_get_val_if_fixed(
3640                 __isl_keep isl_basic_map *bmap,
3641                 enum isl_dim_type type, unsigned pos);
3642         __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3643                 __isl_keep isl_set *set,
3644                 enum isl_dim_type type, unsigned pos);
3645         __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3646                 __isl_keep isl_map *map,
3647                 enum isl_dim_type type, unsigned pos);
3649 If the set or relation obviously lies on a hyperplane where the given dimension
3650 has a fixed value, then return that value.
3651 Otherwise return NaN.
3653 =item * Stride
3655         int isl_set_dim_residue_class_val(
3656                 __isl_keep isl_set *set,
3657                 int pos, __isl_give isl_val **modulo,
3658                 __isl_give isl_val **residue);
3660 Check if the values of the given set dimension are equal to a fixed
3661 value modulo some integer value.  If so, assign the modulo to C<*modulo>
3662 and the fixed value to C<*residue>.  If the given dimension attains only
3663 a single value, then assign C<0> to C<*modulo> and the fixed value to
3664 C<*residue>.
3665 If the dimension does not attain only a single value and if no modulo
3666 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3668 =item * Dependence
3670 To check whether the description of a set, relation or function depends
3671 on one or more given dimensions,
3672 the following functions can be used.
3674         #include <isl/constraint.h>
3675         int isl_constraint_involves_dims(
3676                 __isl_keep isl_constraint *constraint,
3677                 enum isl_dim_type type, unsigned first, unsigned n);
3679         #include <isl/set.h>
3680         int isl_basic_set_involves_dims(
3681                 __isl_keep isl_basic_set *bset,
3682                 enum isl_dim_type type, unsigned first, unsigned n);
3683         int isl_set_involves_dims(__isl_keep isl_set *set,
3684                 enum isl_dim_type type, unsigned first, unsigned n);
3686         #include <isl/map.h>
3687         int isl_basic_map_involves_dims(
3688                 __isl_keep isl_basic_map *bmap,
3689                 enum isl_dim_type type, unsigned first, unsigned n);
3690         int isl_map_involves_dims(__isl_keep isl_map *map,
3691                 enum isl_dim_type type, unsigned first, unsigned n);
3693         #include <isl/union_map.h>
3694         int isl_union_map_involves_dims(
3695                 __isl_keep isl_union_map *umap,
3696                 enum isl_dim_type type, unsigned first, unsigned n);
3698         #include <isl/aff.h>
3699         int isl_aff_involves_dims(__isl_keep isl_aff *aff,
3700                 enum isl_dim_type type, unsigned first, unsigned n);
3701         int isl_pw_aff_involves_dims(__isl_keep isl_pw_aff *pwaff,
3702                 enum isl_dim_type type, unsigned first, unsigned n);
3703         int isl_multi_aff_involves_dims(
3704                 __isl_keep isl_multi_aff *ma,
3705                 enum isl_dim_type type, unsigned first, unsigned n);
3706         int isl_multi_pw_aff_involves_dims(
3707                 __isl_keep isl_multi_pw_aff *mpa,
3708                 enum isl_dim_type type, unsigned first, unsigned n);
3710 Similarly, the following functions can be used to check whether
3711 a given dimension is involved in any lower or upper bound.
3713         #include <isl/set.h>
3714         int isl_set_dim_has_any_lower_bound(__isl_keep isl_set *set,
3715                 enum isl_dim_type type, unsigned pos);
3716         int isl_set_dim_has_any_upper_bound(__isl_keep isl_set *set,
3717                 enum isl_dim_type type, unsigned pos);
3719 Note that these functions return true even if there is a bound on
3720 the dimension on only some of the basic sets of C<set>.
3721 To check if they have a bound for all of the basic sets in C<set>,
3722 use the following functions instead.
3724         #include <isl/set.h>
3725         int isl_set_dim_has_lower_bound(__isl_keep isl_set *set,
3726                 enum isl_dim_type type, unsigned pos);
3727         int isl_set_dim_has_upper_bound(__isl_keep isl_set *set,
3728                 enum isl_dim_type type, unsigned pos);
3730 =item * Space
3732 To check whether a set is a parameter domain, use this function:
3734         int isl_set_is_params(__isl_keep isl_set *set);
3735         int isl_union_set_is_params(
3736                 __isl_keep isl_union_set *uset);
3738 =item * Wrapping
3740 The following functions check whether the space of the given
3741 (basic) set or relation range is a wrapped relation.
3743         #include <isl/space.h>
3744         int isl_space_is_wrapping(
3745                 __isl_keep isl_space *space);
3746         int isl_space_domain_is_wrapping(
3747                 __isl_keep isl_space *space);
3748         int isl_space_range_is_wrapping(
3749                 __isl_keep isl_space *space);
3751         #include <isl/set.h>
3752         int isl_basic_set_is_wrapping(
3753                 __isl_keep isl_basic_set *bset);
3754         int isl_set_is_wrapping(__isl_keep isl_set *set);
3756         #include <isl/map.h>
3757         int isl_map_domain_is_wrapping(
3758                 __isl_keep isl_map *map);
3759         int isl_map_range_is_wrapping(
3760                 __isl_keep isl_map *map);
3762         #include <isl/val.h>
3763         int isl_multi_val_range_is_wrapping(
3764                 __isl_keep isl_multi_val *mv);
3766         #include <isl/aff.h>
3767         int isl_multi_aff_range_is_wrapping(
3768                 __isl_keep isl_multi_aff *ma);
3769         int isl_multi_pw_aff_range_is_wrapping(
3770                 __isl_keep isl_multi_pw_aff *mpa);
3771         int isl_multi_union_pw_aff_range_is_wrapping(
3772                 __isl_keep isl_multi_union_pw_aff *mupa);
3774 The input to C<isl_space_is_wrapping> should
3775 be the space of a set, while that of
3776 C<isl_space_domain_is_wrapping> and
3777 C<isl_space_range_is_wrapping> should be the space of a relation.
3779 =item * Internal Product
3781         int isl_basic_map_can_zip(
3782                 __isl_keep isl_basic_map *bmap);
3783         int isl_map_can_zip(__isl_keep isl_map *map);
3785 Check whether the product of domain and range of the given relation
3786 can be computed,
3787 i.e., whether both domain and range are nested relations.
3789 =item * Currying
3791         int isl_basic_map_can_curry(
3792                 __isl_keep isl_basic_map *bmap);
3793         int isl_map_can_curry(__isl_keep isl_map *map);
3795 Check whether the domain of the (basic) relation is a wrapped relation.
3797         int isl_basic_map_can_uncurry(
3798                 __isl_keep isl_basic_map *bmap);
3799         int isl_map_can_uncurry(__isl_keep isl_map *map);
3801 Check whether the range of the (basic) relation is a wrapped relation.
3803 =item * Special Values
3805         #include <isl/aff.h>
3806         int isl_aff_is_cst(__isl_keep isl_aff *aff);
3807         int isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
3809 Check whether the given expression is a constant.
3811         #include <isl/aff.h>
3812         int isl_aff_is_nan(__isl_keep isl_aff *aff);
3813         int isl_pw_aff_involves_nan(__isl_keep isl_pw_aff *pa);
3815 Check whether the given expression is equal to or involves NaN.
3817         #include <isl/aff.h>
3818         int isl_aff_plain_is_zero(__isl_keep isl_aff *aff);
3820 Check whether the affine expression is obviously zero.
3822 =back
3824 =head3 Binary Properties
3826 =over
3828 =item * Equality
3830 The following functions check whether two objects
3831 represent the same set, relation or function.
3832 The C<plain> variants only return true if the objects
3833 are obviously the same.  That is, they may return false
3834 even if the objects are the same, but they will never
3835 return true if the objects are not the same.
3837         #include <isl/set.h>
3838         int isl_basic_set_plain_is_equal(
3839                 __isl_keep isl_basic_set *bset1,
3840                 __isl_keep isl_basic_set *bset2);
3841         int isl_set_plain_is_equal(__isl_keep isl_set *set1,
3842                 __isl_keep isl_set *set2);
3843         int isl_set_is_equal(__isl_keep isl_set *set1,
3844                 __isl_keep isl_set *set2);
3846         #include <isl/map.h>
3847         int isl_basic_map_is_equal(
3848                 __isl_keep isl_basic_map *bmap1,
3849                 __isl_keep isl_basic_map *bmap2);
3850         int isl_map_is_equal(__isl_keep isl_map *map1,
3851                 __isl_keep isl_map *map2);
3852         int isl_map_plain_is_equal(__isl_keep isl_map *map1,
3853                 __isl_keep isl_map *map2);
3855         #include <isl/union_set.h>
3856         int isl_union_set_is_equal(
3857                 __isl_keep isl_union_set *uset1,
3858                 __isl_keep isl_union_set *uset2);
3860         #include <isl/union_map.h>
3861         int isl_union_map_is_equal(
3862                 __isl_keep isl_union_map *umap1,
3863                 __isl_keep isl_union_map *umap2);
3865         #include <isl/aff.h>
3866         int isl_aff_plain_is_equal(__isl_keep isl_aff *aff1,
3867                 __isl_keep isl_aff *aff2);
3868         int isl_multi_aff_plain_is_equal(
3869                 __isl_keep isl_multi_aff *maff1,
3870                 __isl_keep isl_multi_aff *maff2);
3871         int isl_pw_aff_plain_is_equal(
3872                 __isl_keep isl_pw_aff *pwaff1,
3873                 __isl_keep isl_pw_aff *pwaff2);
3874         int isl_pw_multi_aff_plain_is_equal(
3875                 __isl_keep isl_pw_multi_aff *pma1,
3876                 __isl_keep isl_pw_multi_aff *pma2);
3877         int isl_multi_pw_aff_plain_is_equal(
3878                 __isl_keep isl_multi_pw_aff *mpa1,
3879                 __isl_keep isl_multi_pw_aff *mpa2);
3880         int isl_multi_pw_aff_is_equal(
3881                 __isl_keep isl_multi_pw_aff *mpa1,
3882                 __isl_keep isl_multi_pw_aff *mpa2);
3883         int isl_union_pw_aff_plain_is_equal(
3884                 __isl_keep isl_union_pw_aff *upa1,
3885                 __isl_keep isl_union_pw_aff *upa2);
3886         int isl_union_pw_multi_aff_plain_is_equal(
3887                 __isl_keep isl_union_pw_multi_aff *upma1,
3888                 __isl_keep isl_union_pw_multi_aff *upma2);
3889         int isl_multi_union_pw_aff_plain_is_equal(
3890                 __isl_keep isl_multi_union_pw_aff *mupa1,
3891                 __isl_keep isl_multi_union_pw_aff *mupa2);
3893         #include <isl/polynomial.h>
3894         int isl_union_pw_qpolynomial_plain_is_equal(
3895                 __isl_keep isl_union_pw_qpolynomial *upwqp1,
3896                 __isl_keep isl_union_pw_qpolynomial *upwqp2);
3897         int isl_union_pw_qpolynomial_fold_plain_is_equal(
3898                 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
3899                 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
3901 =item * Disjointness
3903         #include <isl/set.h>
3904         int isl_basic_set_is_disjoint(
3905                 __isl_keep isl_basic_set *bset1,
3906                 __isl_keep isl_basic_set *bset2);
3907         int isl_set_plain_is_disjoint(__isl_keep isl_set *set1,
3908                 __isl_keep isl_set *set2);
3909         int isl_set_is_disjoint(__isl_keep isl_set *set1,
3910                 __isl_keep isl_set *set2);
3912         #include <isl/map.h>
3913         int isl_basic_map_is_disjoint(
3914                 __isl_keep isl_basic_map *bmap1,
3915                 __isl_keep isl_basic_map *bmap2);
3916         int isl_map_is_disjoint(__isl_keep isl_map *map1,
3917                 __isl_keep isl_map *map2);
3919         #include <isl/union_set.h>
3920         int isl_union_set_is_disjoint(
3921                 __isl_keep isl_union_set *uset1,
3922                 __isl_keep isl_union_set *uset2);
3924         #include <isl/union_map.h>
3925         int isl_union_map_is_disjoint(
3926                 __isl_keep isl_union_map *umap1,
3927                 __isl_keep isl_union_map *umap2);
3929 =item * Subset
3931         int isl_basic_set_is_subset(
3932                 __isl_keep isl_basic_set *bset1,
3933                 __isl_keep isl_basic_set *bset2);
3934         int isl_set_is_subset(__isl_keep isl_set *set1,
3935                 __isl_keep isl_set *set2);
3936         int isl_set_is_strict_subset(
3937                 __isl_keep isl_set *set1,
3938                 __isl_keep isl_set *set2);
3939         int isl_union_set_is_subset(
3940                 __isl_keep isl_union_set *uset1,
3941                 __isl_keep isl_union_set *uset2);
3942         int isl_union_set_is_strict_subset(
3943                 __isl_keep isl_union_set *uset1,
3944                 __isl_keep isl_union_set *uset2);
3945         int isl_basic_map_is_subset(
3946                 __isl_keep isl_basic_map *bmap1,
3947                 __isl_keep isl_basic_map *bmap2);
3948         int isl_basic_map_is_strict_subset(
3949                 __isl_keep isl_basic_map *bmap1,
3950                 __isl_keep isl_basic_map *bmap2);
3951         int isl_map_is_subset(
3952                 __isl_keep isl_map *map1,
3953                 __isl_keep isl_map *map2);
3954         int isl_map_is_strict_subset(
3955                 __isl_keep isl_map *map1,
3956                 __isl_keep isl_map *map2);
3957         int isl_union_map_is_subset(
3958                 __isl_keep isl_union_map *umap1,
3959                 __isl_keep isl_union_map *umap2);
3960         int isl_union_map_is_strict_subset(
3961                 __isl_keep isl_union_map *umap1,
3962                 __isl_keep isl_union_map *umap2);
3964 Check whether the first argument is a (strict) subset of the
3965 second argument.
3967 =item * Order
3969 Every comparison function returns a negative value if the first
3970 argument is considered smaller than the second, a positive value
3971 if the first argument is considered greater and zero if the two
3972 constraints are considered the same by the comparison criterion.
3974         #include <isl/constraint.h>
3975         int isl_constraint_plain_cmp(
3976                 __isl_keep isl_constraint *c1,
3977                 __isl_keep isl_constraint *c2);
3979 This function is useful for sorting C<isl_constraint>s.
3980 The order depends on the internal representation of the inputs.
3981 The order is fixed over different calls to the function (assuming
3982 the internal representation of the inputs has not changed), but may
3983 change over different versions of C<isl>.
3985         #include <isl/constraint.h>
3986         int isl_constraint_cmp_last_non_zero(
3987                 __isl_keep isl_constraint *c1,
3988                 __isl_keep isl_constraint *c2);
3990 This function can be used to sort constraints that live in the same
3991 local space.  Constraints that involve ``earlier'' dimensions or
3992 that have a smaller coefficient for the shared latest dimension
3993 are considered smaller than other constraints.
3994 This function only defines a B<partial> order.
3996         #include <isl/set.h>
3997         int isl_set_plain_cmp(__isl_keep isl_set *set1,
3998                 __isl_keep isl_set *set2);
4000 This function is useful for sorting C<isl_set>s.
4001 The order depends on the internal representation of the inputs.
4002 The order is fixed over different calls to the function (assuming
4003 the internal representation of the inputs has not changed), but may
4004 change over different versions of C<isl>.
4006         #include <isl/aff.h>
4007         int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
4008                 __isl_keep isl_pw_aff *pa2);
4010 The function C<isl_pw_aff_plain_cmp> can be used to sort
4011 C<isl_pw_aff>s.  The order is not strictly defined.
4012 The current order sorts expressions that only involve
4013 earlier dimensions before those that involve later dimensions.
4015 =back
4017 =head2 Unary Operations
4019 =over
4021 =item * Complement
4023         __isl_give isl_set *isl_set_complement(
4024                 __isl_take isl_set *set);
4025         __isl_give isl_map *isl_map_complement(
4026                 __isl_take isl_map *map);
4028 =item * Inverse map
4030         #include <isl/space.h>
4031         __isl_give isl_space *isl_space_reverse(
4032                 __isl_take isl_space *space);
4034         #include <isl/map.h>
4035         __isl_give isl_basic_map *isl_basic_map_reverse(
4036                 __isl_take isl_basic_map *bmap);
4037         __isl_give isl_map *isl_map_reverse(
4038                 __isl_take isl_map *map);
4040         #include <isl/union_map.h>
4041         __isl_give isl_union_map *isl_union_map_reverse(
4042                 __isl_take isl_union_map *umap);
4044 =item * Projection
4046         #include <isl/space.h>
4047         __isl_give isl_space *isl_space_domain(
4048                 __isl_take isl_space *space);
4049         __isl_give isl_space *isl_space_range(
4050                 __isl_take isl_space *space);
4051         __isl_give isl_space *isl_space_params(
4052                 __isl_take isl_space *space);
4054         #include <isl/local_space.h>
4055         __isl_give isl_local_space *isl_local_space_domain(
4056                 __isl_take isl_local_space *ls);
4057         __isl_give isl_local_space *isl_local_space_range(
4058                 __isl_take isl_local_space *ls);
4060         #include <isl/set.h>
4061         __isl_give isl_basic_set *isl_basic_set_project_out(
4062                 __isl_take isl_basic_set *bset,
4063                 enum isl_dim_type type, unsigned first, unsigned n);
4064         __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
4065                 enum isl_dim_type type, unsigned first, unsigned n);
4066         __isl_give isl_basic_set *isl_basic_set_params(
4067                 __isl_take isl_basic_set *bset);
4068         __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
4070         #include <isl/map.h>
4071         __isl_give isl_basic_map *isl_basic_map_project_out(
4072                 __isl_take isl_basic_map *bmap,
4073                 enum isl_dim_type type, unsigned first, unsigned n);
4074         __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
4075                 enum isl_dim_type type, unsigned first, unsigned n);
4076         __isl_give isl_basic_set *isl_basic_map_domain(
4077                 __isl_take isl_basic_map *bmap);
4078         __isl_give isl_basic_set *isl_basic_map_range(
4079                 __isl_take isl_basic_map *bmap);
4080         __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
4081         __isl_give isl_set *isl_map_domain(
4082                 __isl_take isl_map *bmap);
4083         __isl_give isl_set *isl_map_range(
4084                 __isl_take isl_map *map);
4086         #include <isl/union_set.h>
4087         __isl_give isl_union_set *isl_union_set_project_out(
4088                 __isl_take isl_union_set *uset,
4089                 enum isl_dim_type type,
4090                 unsigned first, unsigned n);
4091         __isl_give isl_set *isl_union_set_params(
4092                 __isl_take isl_union_set *uset);
4094 The function C<isl_union_set_project_out> can only project out
4095 parameters.
4097         #include <isl/union_map.h>
4098         __isl_give isl_union_map *isl_union_map_project_out(
4099                 __isl_take isl_union_map *umap,
4100                 enum isl_dim_type type, unsigned first, unsigned n);
4101         __isl_give isl_set *isl_union_map_params(
4102                 __isl_take isl_union_map *umap);
4103         __isl_give isl_union_set *isl_union_map_domain(
4104                 __isl_take isl_union_map *umap);
4105         __isl_give isl_union_set *isl_union_map_range(
4106                 __isl_take isl_union_map *umap);
4108 The function C<isl_union_map_project_out> can only project out
4109 parameters.
4111         #include <isl/aff.h>
4112         __isl_give isl_aff *isl_aff_project_domain_on_params(
4113                 __isl_take isl_aff *aff);
4114         __isl_give isl_pw_multi_aff *
4115         isl_pw_multi_aff_project_domain_on_params(
4116                 __isl_take isl_pw_multi_aff *pma);
4117         __isl_give isl_set *isl_pw_aff_domain(
4118                 __isl_take isl_pw_aff *pwaff);
4119         __isl_give isl_set *isl_pw_multi_aff_domain(
4120                 __isl_take isl_pw_multi_aff *pma);
4121         __isl_give isl_set *isl_multi_pw_aff_domain(
4122                 __isl_take isl_multi_pw_aff *mpa);
4123         __isl_give isl_union_set *isl_union_pw_aff_domain(
4124                 __isl_take isl_union_pw_aff *upa);
4125         __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
4126                 __isl_take isl_union_pw_multi_aff *upma);
4127         __isl_give isl_union_set *
4128         isl_multi_union_pw_aff_domain(
4129                 __isl_take isl_multi_union_pw_aff *mupa);
4130         __isl_give isl_set *isl_pw_aff_params(
4131                 __isl_take isl_pw_aff *pwa);
4133 The function C<isl_multi_union_pw_aff_domain> requires its
4134 input to have at least one set dimension.
4136         #include <isl/polynomial.h>
4137         __isl_give isl_qpolynomial *
4138         isl_qpolynomial_project_domain_on_params(
4139                 __isl_take isl_qpolynomial *qp);
4140         __isl_give isl_pw_qpolynomial *
4141         isl_pw_qpolynomial_project_domain_on_params(
4142                 __isl_take isl_pw_qpolynomial *pwqp);
4143         __isl_give isl_pw_qpolynomial_fold *
4144         isl_pw_qpolynomial_fold_project_domain_on_params(
4145                 __isl_take isl_pw_qpolynomial_fold *pwf);
4146         __isl_give isl_set *isl_pw_qpolynomial_domain(
4147                 __isl_take isl_pw_qpolynomial *pwqp);
4148         __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
4149                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4150         __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
4151                 __isl_take isl_union_pw_qpolynomial *upwqp);
4153         #include <isl/space.h>
4154         __isl_give isl_space *isl_space_domain_map(
4155                 __isl_take isl_space *space);
4156         __isl_give isl_space *isl_space_range_map(
4157                 __isl_take isl_space *space);
4159         #include <isl/map.h>
4160         __isl_give isl_map *isl_set_wrapped_domain_map(
4161                 __isl_take isl_set *set);
4162         __isl_give isl_basic_map *isl_basic_map_domain_map(
4163                 __isl_take isl_basic_map *bmap);
4164         __isl_give isl_basic_map *isl_basic_map_range_map(
4165                 __isl_take isl_basic_map *bmap);
4166         __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
4167         __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
4169         #include <isl/union_map.h>
4170         __isl_give isl_union_map *isl_union_map_domain_map(
4171                 __isl_take isl_union_map *umap);
4172         __isl_give isl_union_pw_multi_aff *
4173         isl_union_map_domain_map_union_pw_multi_aff(
4174                 __isl_take isl_union_map *umap);
4175         __isl_give isl_union_map *isl_union_map_range_map(
4176                 __isl_take isl_union_map *umap);
4177         __isl_give isl_union_map *
4178         isl_union_set_wrapped_domain_map(
4179                 __isl_take isl_union_set *uset);
4181 The functions above construct a (basic, regular or union) relation
4182 that maps (a wrapped version of) the input relation to its domain or range.
4183 C<isl_set_wrapped_domain_map> maps the input set to the domain
4184 of its wrapped relation.
4186 =item * Elimination
4188         __isl_give isl_basic_set *isl_basic_set_eliminate(
4189                 __isl_take isl_basic_set *bset,
4190                 enum isl_dim_type type,
4191                 unsigned first, unsigned n);
4192         __isl_give isl_set *isl_set_eliminate(
4193                 __isl_take isl_set *set, enum isl_dim_type type,
4194                 unsigned first, unsigned n);
4195         __isl_give isl_basic_map *isl_basic_map_eliminate(
4196                 __isl_take isl_basic_map *bmap,
4197                 enum isl_dim_type type,
4198                 unsigned first, unsigned n);
4199         __isl_give isl_map *isl_map_eliminate(
4200                 __isl_take isl_map *map, enum isl_dim_type type,
4201                 unsigned first, unsigned n);
4203 Eliminate the coefficients for the given dimensions from the constraints,
4204 without removing the dimensions.
4206 =item * Constructing a set from a parameter domain
4208 A zero-dimensional space or (basic) set can be constructed
4209 on a given parameter domain using the following functions.
4211         #include <isl/space.h>
4212         __isl_give isl_space *isl_space_set_from_params(
4213                 __isl_take isl_space *space);
4215         #include <isl/set.h>
4216         __isl_give isl_basic_set *isl_basic_set_from_params(
4217                 __isl_take isl_basic_set *bset);
4218         __isl_give isl_set *isl_set_from_params(
4219                 __isl_take isl_set *set);
4221 =item * Constructing a relation from a set
4223 Create a relation with the given set as domain or range.
4224 The range or domain of the created relation is a zero-dimensional
4225 flat anonymous space.
4227         #include <isl/space.h>
4228         __isl_give isl_space *isl_space_from_domain(
4229                 __isl_take isl_space *space);
4230         __isl_give isl_space *isl_space_from_range(
4231                 __isl_take isl_space *space);
4232         __isl_give isl_space *isl_space_map_from_set(
4233                 __isl_take isl_space *space);
4234         __isl_give isl_space *isl_space_map_from_domain_and_range(
4235                 __isl_take isl_space *domain,
4236                 __isl_take isl_space *range);
4238         #include <isl/local_space.h>
4239         __isl_give isl_local_space *isl_local_space_from_domain(
4240                 __isl_take isl_local_space *ls);
4242         #include <isl/map.h>
4243         __isl_give isl_map *isl_map_from_domain(
4244                 __isl_take isl_set *set);
4245         __isl_give isl_map *isl_map_from_range(
4246                 __isl_take isl_set *set);
4248         #include <isl/val.h>
4249         __isl_give isl_multi_val *isl_multi_val_from_range(
4250                 __isl_take isl_multi_val *mv);
4252         #include <isl/aff.h>
4253         __isl_give isl_multi_aff *isl_multi_aff_from_range(
4254                 __isl_take isl_multi_aff *ma);
4255         __isl_give isl_pw_aff *isl_pw_aff_from_range(
4256                 __isl_take isl_pw_aff *pwa);
4257         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
4258                 __isl_take isl_multi_pw_aff *mpa);
4259         __isl_give isl_multi_union_pw_aff *
4260         isl_multi_union_pw_aff_from_range(
4261                 __isl_take isl_multi_union_pw_aff *mupa);
4262         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
4263                 __isl_take isl_set *set);
4264         __isl_give isl_union_pw_multi_aff *
4265         isl_union_pw_multi_aff_from_domain(
4266                 __isl_take isl_union_set *uset);
4268 =item * Slicing
4270         #include <isl/set.h>
4271         __isl_give isl_basic_set *isl_basic_set_fix_si(
4272                 __isl_take isl_basic_set *bset,
4273                 enum isl_dim_type type, unsigned pos, int value);
4274         __isl_give isl_basic_set *isl_basic_set_fix_val(
4275                 __isl_take isl_basic_set *bset,
4276                 enum isl_dim_type type, unsigned pos,
4277                 __isl_take isl_val *v);
4278         __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
4279                 enum isl_dim_type type, unsigned pos, int value);
4280         __isl_give isl_set *isl_set_fix_val(
4281                 __isl_take isl_set *set,
4282                 enum isl_dim_type type, unsigned pos,
4283                 __isl_take isl_val *v);
4285         #include <isl/map.h>
4286         __isl_give isl_basic_map *isl_basic_map_fix_si(
4287                 __isl_take isl_basic_map *bmap,
4288                 enum isl_dim_type type, unsigned pos, int value);
4289         __isl_give isl_basic_map *isl_basic_map_fix_val(
4290                 __isl_take isl_basic_map *bmap,
4291                 enum isl_dim_type type, unsigned pos,
4292                 __isl_take isl_val *v);
4293         __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
4294                 enum isl_dim_type type, unsigned pos, int value);
4295         __isl_give isl_map *isl_map_fix_val(
4296                 __isl_take isl_map *map,
4297                 enum isl_dim_type type, unsigned pos,
4298                 __isl_take isl_val *v);
4300         #include <isl/aff.h>
4301         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
4302                 __isl_take isl_pw_multi_aff *pma,
4303                 enum isl_dim_type type, unsigned pos, int value);
4305         #include <isl/polynomial.h>
4306         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
4307                 __isl_take isl_pw_qpolynomial *pwqp,
4308                 enum isl_dim_type type, unsigned n,
4309                 __isl_take isl_val *v);
4311 Intersect the set, relation or function domain
4312 with the hyperplane where the given
4313 dimension has the fixed given value.
4315         __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
4316                 __isl_take isl_basic_map *bmap,
4317                 enum isl_dim_type type, unsigned pos, int value);
4318         __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
4319                 __isl_take isl_basic_map *bmap,
4320                 enum isl_dim_type type, unsigned pos, int value);
4321         __isl_give isl_set *isl_set_lower_bound_si(
4322                 __isl_take isl_set *set,
4323                 enum isl_dim_type type, unsigned pos, int value);
4324         __isl_give isl_set *isl_set_lower_bound_val(
4325                 __isl_take isl_set *set,
4326                 enum isl_dim_type type, unsigned pos,
4327                 __isl_take isl_val *value);
4328         __isl_give isl_map *isl_map_lower_bound_si(
4329                 __isl_take isl_map *map,
4330                 enum isl_dim_type type, unsigned pos, int value);
4331         __isl_give isl_set *isl_set_upper_bound_si(
4332                 __isl_take isl_set *set,
4333                 enum isl_dim_type type, unsigned pos, int value);
4334         __isl_give isl_set *isl_set_upper_bound_val(
4335                 __isl_take isl_set *set,
4336                 enum isl_dim_type type, unsigned pos,
4337                 __isl_take isl_val *value);
4338         __isl_give isl_map *isl_map_upper_bound_si(
4339                 __isl_take isl_map *map,
4340                 enum isl_dim_type type, unsigned pos, int value);
4342 Intersect the set or relation with the half-space where the given
4343 dimension has a value bounded by the fixed given integer value.
4345         __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
4346                 enum isl_dim_type type1, int pos1,
4347                 enum isl_dim_type type2, int pos2);
4348         __isl_give isl_basic_map *isl_basic_map_equate(
4349                 __isl_take isl_basic_map *bmap,
4350                 enum isl_dim_type type1, int pos1,
4351                 enum isl_dim_type type2, int pos2);
4352         __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
4353                 enum isl_dim_type type1, int pos1,
4354                 enum isl_dim_type type2, int pos2);
4356 Intersect the set or relation with the hyperplane where the given
4357 dimensions are equal to each other.
4359         __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4360                 enum isl_dim_type type1, int pos1,
4361                 enum isl_dim_type type2, int pos2);
4363 Intersect the relation with the hyperplane where the given
4364 dimensions have opposite values.
4366         __isl_give isl_map *isl_map_order_le(
4367                 __isl_take isl_map *map,
4368                 enum isl_dim_type type1, int pos1,
4369                 enum isl_dim_type type2, int pos2);
4370         __isl_give isl_basic_map *isl_basic_map_order_ge(
4371                 __isl_take isl_basic_map *bmap,
4372                 enum isl_dim_type type1, int pos1,
4373                 enum isl_dim_type type2, int pos2);
4374         __isl_give isl_map *isl_map_order_ge(
4375                 __isl_take isl_map *map,
4376                 enum isl_dim_type type1, int pos1,
4377                 enum isl_dim_type type2, int pos2);
4378         __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4379                 enum isl_dim_type type1, int pos1,
4380                 enum isl_dim_type type2, int pos2);
4381         __isl_give isl_basic_map *isl_basic_map_order_gt(
4382                 __isl_take isl_basic_map *bmap,
4383                 enum isl_dim_type type1, int pos1,
4384                 enum isl_dim_type type2, int pos2);
4385         __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4386                 enum isl_dim_type type1, int pos1,
4387                 enum isl_dim_type type2, int pos2);
4389 Intersect the relation with the half-space where the given
4390 dimensions satisfy the given ordering.
4392 =item * Locus
4394         #include <isl/aff.h>
4395         __isl_give isl_basic_set *isl_aff_zero_basic_set(
4396                 __isl_take isl_aff *aff);
4397         __isl_give isl_basic_set *isl_aff_neg_basic_set(
4398                 __isl_take isl_aff *aff);
4399         __isl_give isl_set *isl_pw_aff_pos_set(
4400                 __isl_take isl_pw_aff *pa);
4401         __isl_give isl_set *isl_pw_aff_nonneg_set(
4402                 __isl_take isl_pw_aff *pwaff);
4403         __isl_give isl_set *isl_pw_aff_zero_set(
4404                 __isl_take isl_pw_aff *pwaff);
4405         __isl_give isl_set *isl_pw_aff_non_zero_set(
4406                 __isl_take isl_pw_aff *pwaff);
4407         __isl_give isl_union_set *
4408         isl_union_pw_aff_zero_union_set(
4409                 __isl_take isl_union_pw_aff *upa);
4410         __isl_give isl_union_set *
4411         isl_multi_union_pw_aff_zero_union_set(
4412                 __isl_take isl_multi_union_pw_aff *mupa);
4414 The function C<isl_aff_neg_basic_set> returns a basic set
4415 containing those elements in the domain space
4416 of C<aff> where C<aff> is negative.
4417 The function C<isl_pw_aff_nonneg_set> returns a set
4418 containing those elements in the domain
4419 of C<pwaff> where C<pwaff> is non-negative.
4420 The function C<isl_multi_union_pw_aff_zero_union_set>
4421 returns a union set containing those elements
4422 in the domains of its elements where they are all zero.
4424 =item * Identity
4426         __isl_give isl_map *isl_set_identity(
4427                 __isl_take isl_set *set);
4428         __isl_give isl_union_map *isl_union_set_identity(
4429                 __isl_take isl_union_set *uset);
4430         __isl_give isl_union_pw_multi_aff *
4431         isl_union_set_identity_union_pw_multi_aff(
4432                 __isl_take isl_union_set *uset);
4434 Construct an identity relation on the given (union) set.
4436 =item * Function Extraction
4438 A piecewise quasi affine expression that is equal to 1 on a set
4439 and 0 outside the set can be created using the following function.
4441         #include <isl/aff.h>
4442         __isl_give isl_pw_aff *isl_set_indicator_function(
4443                 __isl_take isl_set *set);
4445 A piecewise multiple quasi affine expression can be extracted
4446 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4447 and the C<isl_map> is single-valued.
4448 In case of a conversion from an C<isl_union_map>
4449 to an C<isl_union_pw_multi_aff>, these properties need to hold
4450 in each domain space.
4451 A conversion to a C<isl_multi_union_pw_aff> additionally
4452 requires that the input is non-empty and involves only a single
4453 range space.
4455         #include <isl/aff.h>
4456         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4457                 __isl_take isl_set *set);
4458         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4459                 __isl_take isl_map *map);
4461         __isl_give isl_union_pw_multi_aff *
4462         isl_union_pw_multi_aff_from_union_set(
4463                 __isl_take isl_union_set *uset);
4464         __isl_give isl_union_pw_multi_aff *
4465         isl_union_pw_multi_aff_from_union_map(
4466                 __isl_take isl_union_map *umap);
4468         __isl_give isl_multi_union_pw_aff *
4469         isl_multi_union_pw_aff_from_union_map(
4470                 __isl_take isl_union_map *umap);
4472 =item * Deltas
4474         __isl_give isl_basic_set *isl_basic_map_deltas(
4475                 __isl_take isl_basic_map *bmap);
4476         __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
4477         __isl_give isl_union_set *isl_union_map_deltas(
4478                 __isl_take isl_union_map *umap);
4480 These functions return a (basic) set containing the differences
4481 between image elements and corresponding domain elements in the input.
4483         __isl_give isl_basic_map *isl_basic_map_deltas_map(
4484                 __isl_take isl_basic_map *bmap);
4485         __isl_give isl_map *isl_map_deltas_map(
4486                 __isl_take isl_map *map);
4487         __isl_give isl_union_map *isl_union_map_deltas_map(
4488                 __isl_take isl_union_map *umap);
4490 The functions above construct a (basic, regular or union) relation
4491 that maps (a wrapped version of) the input relation to its delta set.
4493 =item * Coalescing
4495 Simplify the representation of a set, relation or functions by trying
4496 to combine pairs of basic sets or relations into a single
4497 basic set or relation.
4499         #include <isl/set.h>
4500         __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
4502         #include <isl/map.h>
4503         __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
4505         #include <isl/union_set.h>
4506         __isl_give isl_union_set *isl_union_set_coalesce(
4507                 __isl_take isl_union_set *uset);
4509         #include <isl/union_map.h>
4510         __isl_give isl_union_map *isl_union_map_coalesce(
4511                 __isl_take isl_union_map *umap);
4513         #include <isl/aff.h>
4514         __isl_give isl_pw_aff *isl_pw_aff_coalesce(
4515                 __isl_take isl_pw_aff *pwqp);
4516         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
4517                 __isl_take isl_pw_multi_aff *pma);
4518         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
4519                 __isl_take isl_multi_pw_aff *mpa);
4520         __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
4521                 __isl_take isl_union_pw_aff *upa);
4522         __isl_give isl_union_pw_multi_aff *
4523         isl_union_pw_multi_aff_coalesce(
4524                 __isl_take isl_union_pw_multi_aff *upma);
4526         #include <isl/polynomial.h>
4527         __isl_give isl_pw_qpolynomial_fold *
4528         isl_pw_qpolynomial_fold_coalesce(
4529                 __isl_take isl_pw_qpolynomial_fold *pwf);
4530         __isl_give isl_union_pw_qpolynomial *
4531         isl_union_pw_qpolynomial_coalesce(
4532                 __isl_take isl_union_pw_qpolynomial *upwqp);
4533         __isl_give isl_union_pw_qpolynomial_fold *
4534         isl_union_pw_qpolynomial_fold_coalesce(
4535                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4537 One of the methods for combining pairs of basic sets or relations
4538 can result in coefficients that are much larger than those that appear
4539 in the constraints of the input.  By default, the coefficients are
4540 not allowed to grow larger, but this can be changed by unsetting
4541 the following option.
4543         int isl_options_set_coalesce_bounded_wrapping(
4544                 isl_ctx *ctx, int val);
4545         int isl_options_get_coalesce_bounded_wrapping(
4546                 isl_ctx *ctx);
4548 =item * Detecting equalities
4550         __isl_give isl_basic_set *isl_basic_set_detect_equalities(
4551                 __isl_take isl_basic_set *bset);
4552         __isl_give isl_basic_map *isl_basic_map_detect_equalities(
4553                 __isl_take isl_basic_map *bmap);
4554         __isl_give isl_set *isl_set_detect_equalities(
4555                 __isl_take isl_set *set);
4556         __isl_give isl_map *isl_map_detect_equalities(
4557                 __isl_take isl_map *map);
4558         __isl_give isl_union_set *isl_union_set_detect_equalities(
4559                 __isl_take isl_union_set *uset);
4560         __isl_give isl_union_map *isl_union_map_detect_equalities(
4561                 __isl_take isl_union_map *umap);
4563 Simplify the representation of a set or relation by detecting implicit
4564 equalities.
4566 =item * Removing redundant constraints
4568         #include <isl/set.h>
4569         __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
4570                 __isl_take isl_basic_set *bset);
4571         __isl_give isl_set *isl_set_remove_redundancies(
4572                 __isl_take isl_set *set);
4574         #include <isl/union_set.h>
4575         __isl_give isl_union_set *
4576         isl_union_set_remove_redundancies(
4577                 __isl_take isl_union_set *uset);
4579         #include <isl/map.h>
4580         __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
4581                 __isl_take isl_basic_map *bmap);
4582         __isl_give isl_map *isl_map_remove_redundancies(
4583                 __isl_take isl_map *map);
4585         #include <isl/union_map.h>
4586         __isl_give isl_union_map *
4587         isl_union_map_remove_redundancies(
4588                 __isl_take isl_union_map *umap);
4590 =item * Convex hull
4592         __isl_give isl_basic_set *isl_set_convex_hull(
4593                 __isl_take isl_set *set);
4594         __isl_give isl_basic_map *isl_map_convex_hull(
4595                 __isl_take isl_map *map);
4597 If the input set or relation has any existentially quantified
4598 variables, then the result of these operations is currently undefined.
4600 =item * Simple hull
4602         #include <isl/set.h>
4603         __isl_give isl_basic_set *
4604         isl_set_unshifted_simple_hull(
4605                 __isl_take isl_set *set);
4606         __isl_give isl_basic_set *isl_set_simple_hull(
4607                 __isl_take isl_set *set);
4608         __isl_give isl_basic_set *
4609         isl_set_unshifted_simple_hull_from_set_list(
4610                 __isl_take isl_set *set,
4611                 __isl_take isl_set_list *list);
4613         #include <isl/map.h>
4614         __isl_give isl_basic_map *
4615         isl_map_unshifted_simple_hull(
4616                 __isl_take isl_map *map);
4617         __isl_give isl_basic_map *isl_map_simple_hull(
4618                 __isl_take isl_map *map);
4619         __isl_give isl_basic_map *
4620         isl_map_unshifted_simple_hull_from_map_list(
4621                 __isl_take isl_map *map,
4622                 __isl_take isl_map_list *list);
4624         #include <isl/union_map.h>
4625         __isl_give isl_union_map *isl_union_map_simple_hull(
4626                 __isl_take isl_union_map *umap);
4628 These functions compute a single basic set or relation
4629 that contains the whole input set or relation.
4630 In particular, the output is described by translates
4631 of the constraints describing the basic sets or relations in the input.
4632 In case of C<isl_set_unshifted_simple_hull>, only the original
4633 constraints are used, without any translation.
4634 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
4635 C<isl_map_unshifted_simple_hull_from_map_list>, the
4636 constraints are taken from the elements of the second argument.
4638 =begin latex
4640 (See \autoref{s:simple hull}.)
4642 =end latex
4644 =item * Affine hull
4646         __isl_give isl_basic_set *isl_basic_set_affine_hull(
4647                 __isl_take isl_basic_set *bset);
4648         __isl_give isl_basic_set *isl_set_affine_hull(
4649                 __isl_take isl_set *set);
4650         __isl_give isl_union_set *isl_union_set_affine_hull(
4651                 __isl_take isl_union_set *uset);
4652         __isl_give isl_basic_map *isl_basic_map_affine_hull(
4653                 __isl_take isl_basic_map *bmap);
4654         __isl_give isl_basic_map *isl_map_affine_hull(
4655                 __isl_take isl_map *map);
4656         __isl_give isl_union_map *isl_union_map_affine_hull(
4657                 __isl_take isl_union_map *umap);
4659 In case of union sets and relations, the affine hull is computed
4660 per space.
4662 =item * Polyhedral hull
4664         __isl_give isl_basic_set *isl_set_polyhedral_hull(
4665                 __isl_take isl_set *set);
4666         __isl_give isl_basic_map *isl_map_polyhedral_hull(
4667                 __isl_take isl_map *map);
4668         __isl_give isl_union_set *isl_union_set_polyhedral_hull(
4669                 __isl_take isl_union_set *uset);
4670         __isl_give isl_union_map *isl_union_map_polyhedral_hull(
4671                 __isl_take isl_union_map *umap);
4673 These functions compute a single basic set or relation
4674 not involving any existentially quantified variables
4675 that contains the whole input set or relation.
4676 In case of union sets and relations, the polyhedral hull is computed
4677 per space.
4679 =item * Other approximations
4681         #include <isl/set.h>
4682         __isl_give isl_basic_set *
4683         isl_basic_set_drop_constraints_involving_dims(
4684                 __isl_take isl_basic_set *bset,
4685                 enum isl_dim_type type,
4686                 unsigned first, unsigned n);
4687         __isl_give isl_basic_set *
4688         isl_basic_set_drop_constraints_not_involving_dims(
4689                 __isl_take isl_basic_set *bset,
4690                 enum isl_dim_type type,
4691                 unsigned first, unsigned n);
4692         __isl_give isl_set *
4693         isl_set_drop_constraints_involving_dims(
4694                 __isl_take isl_set *set,
4695                 enum isl_dim_type type,
4696                 unsigned first, unsigned n);
4698         #include <isl/map.h>
4699         __isl_give isl_basic_map *
4700         isl_basic_map_drop_constraints_involving_dims(
4701                 __isl_take isl_basic_map *bmap,
4702                 enum isl_dim_type type,
4703                 unsigned first, unsigned n);
4704         __isl_give isl_map *
4705         isl_map_drop_constraints_involving_dims(
4706                 __isl_take isl_map *map,
4707                 enum isl_dim_type type,
4708                 unsigned first, unsigned n);
4710 These functions drop any constraints (not) involving the specified dimensions.
4711 Note that the result depends on the representation of the input.
4713         #include <isl/polynomial.h>
4714         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
4715                 __isl_take isl_pw_qpolynomial *pwqp, int sign);
4716         __isl_give isl_union_pw_qpolynomial *
4717         isl_union_pw_qpolynomial_to_polynomial(
4718                 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
4720 Approximate each quasipolynomial by a polynomial.  If C<sign> is positive,
4721 the polynomial will be an overapproximation.  If C<sign> is negative,
4722 it will be an underapproximation.  If C<sign> is zero, the approximation
4723 will lie somewhere in between.
4725 =item * Feasibility
4727         __isl_give isl_basic_set *isl_basic_set_sample(
4728                 __isl_take isl_basic_set *bset);
4729         __isl_give isl_basic_set *isl_set_sample(
4730                 __isl_take isl_set *set);
4731         __isl_give isl_basic_map *isl_basic_map_sample(
4732                 __isl_take isl_basic_map *bmap);
4733         __isl_give isl_basic_map *isl_map_sample(
4734                 __isl_take isl_map *map);
4736 If the input (basic) set or relation is non-empty, then return
4737 a singleton subset of the input.  Otherwise, return an empty set.
4739 =item * Optimization
4741         #include <isl/ilp.h>
4742         __isl_give isl_val *isl_basic_set_max_val(
4743                 __isl_keep isl_basic_set *bset,
4744                 __isl_keep isl_aff *obj);
4745         __isl_give isl_val *isl_set_min_val(
4746                 __isl_keep isl_set *set,
4747                 __isl_keep isl_aff *obj);
4748         __isl_give isl_val *isl_set_max_val(
4749                 __isl_keep isl_set *set,
4750                 __isl_keep isl_aff *obj);
4752 Compute the minimum or maximum of the integer affine expression C<obj>
4753 over the points in C<set>, returning the result in C<opt>.
4754 The result is C<NULL> in case of an error, the optimal value in case
4755 there is one, negative infinity or infinity if the problem is unbounded and
4756 NaN if the problem is empty.
4758 =item * Parametric optimization
4760         __isl_give isl_pw_aff *isl_set_dim_min(
4761                 __isl_take isl_set *set, int pos);
4762         __isl_give isl_pw_aff *isl_set_dim_max(
4763                 __isl_take isl_set *set, int pos);
4764         __isl_give isl_pw_aff *isl_map_dim_max(
4765                 __isl_take isl_map *map, int pos);
4767 Compute the minimum or maximum of the given set or output dimension
4768 as a function of the parameters (and input dimensions), but independently
4769 of the other set or output dimensions.
4770 For lexicographic optimization, see L<"Lexicographic Optimization">.
4772 =item * Dual
4774 The following functions compute either the set of (rational) coefficient
4775 values of valid constraints for the given set or the set of (rational)
4776 values satisfying the constraints with coefficients from the given set.
4777 Internally, these two sets of functions perform essentially the
4778 same operations, except that the set of coefficients is assumed to
4779 be a cone, while the set of values may be any polyhedron.
4780 The current implementation is based on the Farkas lemma and
4781 Fourier-Motzkin elimination, but this may change or be made optional
4782 in future.  In particular, future implementations may use different
4783 dualization algorithms or skip the elimination step.
4785         __isl_give isl_basic_set *isl_basic_set_coefficients(
4786                 __isl_take isl_basic_set *bset);
4787         __isl_give isl_basic_set *isl_set_coefficients(
4788                 __isl_take isl_set *set);
4789         __isl_give isl_union_set *isl_union_set_coefficients(
4790                 __isl_take isl_union_set *bset);
4791         __isl_give isl_basic_set *isl_basic_set_solutions(
4792                 __isl_take isl_basic_set *bset);
4793         __isl_give isl_basic_set *isl_set_solutions(
4794                 __isl_take isl_set *set);
4795         __isl_give isl_union_set *isl_union_set_solutions(
4796                 __isl_take isl_union_set *bset);
4798 =item * Power
4800         __isl_give isl_map *isl_map_fixed_power_val(
4801                 __isl_take isl_map *map,
4802                 __isl_take isl_val *exp);
4803         __isl_give isl_union_map *
4804         isl_union_map_fixed_power_val(
4805                 __isl_take isl_union_map *umap,
4806                 __isl_take isl_val *exp);
4808 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
4809 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
4810 of C<map> is computed.
4812         __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
4813                 int *exact);
4814         __isl_give isl_union_map *isl_union_map_power(
4815                 __isl_take isl_union_map *umap, int *exact);
4817 Compute a parametric representation for all positive powers I<k> of C<map>.
4818 The result maps I<k> to a nested relation corresponding to the
4819 I<k>th power of C<map>.
4820 The result may be an overapproximation.  If the result is known to be exact,
4821 then C<*exact> is set to C<1>.
4823 =item * Transitive closure
4825         __isl_give isl_map *isl_map_transitive_closure(
4826                 __isl_take isl_map *map, int *exact);
4827         __isl_give isl_union_map *isl_union_map_transitive_closure(
4828                 __isl_take isl_union_map *umap, int *exact);
4830 Compute the transitive closure of C<map>.
4831 The result may be an overapproximation.  If the result is known to be exact,
4832 then C<*exact> is set to C<1>.
4834 =item * Reaching path lengths
4836         __isl_give isl_map *isl_map_reaching_path_lengths(
4837                 __isl_take isl_map *map, int *exact);
4839 Compute a relation that maps each element in the range of C<map>
4840 to the lengths of all paths composed of edges in C<map> that
4841 end up in the given element.
4842 The result may be an overapproximation.  If the result is known to be exact,
4843 then C<*exact> is set to C<1>.
4844 To compute the I<maximal> path length, the resulting relation
4845 should be postprocessed by C<isl_map_lexmax>.
4846 In particular, if the input relation is a dependence relation
4847 (mapping sources to sinks), then the maximal path length corresponds
4848 to the free schedule.
4849 Note, however, that C<isl_map_lexmax> expects the maximum to be
4850 finite, so if the path lengths are unbounded (possibly due to
4851 the overapproximation), then you will get an error message.
4853 =item * Wrapping
4855         #include <isl/space.h>
4856         __isl_give isl_space *isl_space_wrap(
4857                 __isl_take isl_space *space);
4858         __isl_give isl_space *isl_space_unwrap(
4859                 __isl_take isl_space *space);
4861         #include <isl/local_space.h>
4862         __isl_give isl_local_space *isl_local_space_wrap(
4863                 __isl_take isl_local_space *ls);
4865         #include <isl/set.h>
4866         __isl_give isl_basic_map *isl_basic_set_unwrap(
4867                 __isl_take isl_basic_set *bset);
4868         __isl_give isl_map *isl_set_unwrap(
4869                 __isl_take isl_set *set);
4871         #include <isl/map.h>
4872         __isl_give isl_basic_set *isl_basic_map_wrap(
4873                 __isl_take isl_basic_map *bmap);
4874         __isl_give isl_set *isl_map_wrap(
4875                 __isl_take isl_map *map);
4877         #include <isl/union_set.h>
4878         __isl_give isl_union_map *isl_union_set_unwrap(
4879                 __isl_take isl_union_set *uset);
4881         #include <isl/union_map.h>
4882         __isl_give isl_union_set *isl_union_map_wrap(
4883                 __isl_take isl_union_map *umap);
4885 The input to C<isl_space_unwrap> should
4886 be the space of a set, while that of
4887 C<isl_space_wrap> should be the space of a relation.
4888 Conversely, the output of C<isl_space_unwrap> is the space
4889 of a relation, while that of C<isl_space_wrap> is the space of a set.
4891 =item * Flattening
4893 Remove any internal structure of domain (and range) of the given
4894 set or relation.  If there is any such internal structure in the input,
4895 then the name of the space is also removed.
4897         #include <isl/local_space.h>
4898         __isl_give isl_local_space *
4899         isl_local_space_flatten_domain(
4900                 __isl_take isl_local_space *ls);
4901         __isl_give isl_local_space *
4902         isl_local_space_flatten_range(
4903                 __isl_take isl_local_space *ls);
4905         #include <isl/set.h>
4906         __isl_give isl_basic_set *isl_basic_set_flatten(
4907                 __isl_take isl_basic_set *bset);
4908         __isl_give isl_set *isl_set_flatten(
4909                 __isl_take isl_set *set);
4911         #include <isl/map.h>
4912         __isl_give isl_basic_map *isl_basic_map_flatten_domain(
4913                 __isl_take isl_basic_map *bmap);
4914         __isl_give isl_basic_map *isl_basic_map_flatten_range(
4915                 __isl_take isl_basic_map *bmap);
4916         __isl_give isl_map *isl_map_flatten_range(
4917                 __isl_take isl_map *map);
4918         __isl_give isl_map *isl_map_flatten_domain(
4919                 __isl_take isl_map *map);
4920         __isl_give isl_basic_map *isl_basic_map_flatten(
4921                 __isl_take isl_basic_map *bmap);
4922         __isl_give isl_map *isl_map_flatten(
4923                 __isl_take isl_map *map);
4925         #include <isl/val.h>
4926         __isl_give isl_multi_val *isl_multi_val_flatten_range(
4927                 __isl_take isl_multi_val *mv);
4929         #include <isl/aff.h>
4930         __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
4931                 __isl_take isl_multi_aff *ma);
4932         __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
4933                 __isl_take isl_multi_aff *ma);
4934         __isl_give isl_multi_pw_aff *
4935         isl_multi_pw_aff_flatten_range(
4936                 __isl_take isl_multi_pw_aff *mpa);
4937         __isl_give isl_multi_union_pw_aff *
4938         isl_multi_union_pw_aff_flatten_range(
4939                 __isl_take isl_multi_union_pw_aff *mupa);
4941         #include <isl/map.h>
4942         __isl_give isl_map *isl_set_flatten_map(
4943                 __isl_take isl_set *set);
4945 The function above constructs a relation
4946 that maps the input set to a flattened version of the set.
4948 =item * Lifting
4950 Lift the input set to a space with extra dimensions corresponding
4951 to the existentially quantified variables in the input.
4952 In particular, the result lives in a wrapped map where the domain
4953 is the original space and the range corresponds to the original
4954 existentially quantified variables.
4956         #include <isl/set.h>
4957         __isl_give isl_basic_set *isl_basic_set_lift(
4958                 __isl_take isl_basic_set *bset);
4959         __isl_give isl_set *isl_set_lift(
4960                 __isl_take isl_set *set);
4961         __isl_give isl_union_set *isl_union_set_lift(
4962                 __isl_take isl_union_set *uset);
4964 Given a local space that contains the existentially quantified
4965 variables of a set, a basic relation that, when applied to
4966 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
4967 can be constructed using the following function.
4969         #include <isl/local_space.h>
4970         __isl_give isl_basic_map *isl_local_space_lifting(
4971                 __isl_take isl_local_space *ls);
4973         #include <isl/aff.h>
4974         __isl_give isl_multi_aff *isl_multi_aff_lift(
4975                 __isl_take isl_multi_aff *maff,
4976                 __isl_give isl_local_space **ls);
4978 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
4979 then it is assigned the local space that lies at the basis of
4980 the lifting applied.
4982 =item * Internal Product
4984         #include <isl/space.h>
4985         __isl_give isl_space *isl_space_zip(
4986                 __isl_take isl_space *space);
4988         #include <isl/map.h>
4989         __isl_give isl_basic_map *isl_basic_map_zip(
4990                 __isl_take isl_basic_map *bmap);
4991         __isl_give isl_map *isl_map_zip(
4992                 __isl_take isl_map *map);
4994         #include <isl/union_map.h>
4995         __isl_give isl_union_map *isl_union_map_zip(
4996                 __isl_take isl_union_map *umap);
4998 Given a relation with nested relations for domain and range,
4999 interchange the range of the domain with the domain of the range.
5001 =item * Currying
5003         #include <isl/space.h>
5004         __isl_give isl_space *isl_space_curry(
5005                 __isl_take isl_space *space);
5006         __isl_give isl_space *isl_space_uncurry(
5007                 __isl_take isl_space *space);
5009         #include <isl/map.h>
5010         __isl_give isl_basic_map *isl_basic_map_curry(
5011                 __isl_take isl_basic_map *bmap);
5012         __isl_give isl_basic_map *isl_basic_map_uncurry(
5013                 __isl_take isl_basic_map *bmap);
5014         __isl_give isl_map *isl_map_curry(
5015                 __isl_take isl_map *map);
5016         __isl_give isl_map *isl_map_uncurry(
5017                 __isl_take isl_map *map);
5019         #include <isl/union_map.h>
5020         __isl_give isl_union_map *isl_union_map_curry(
5021                 __isl_take isl_union_map *umap);
5022         __isl_give isl_union_map *isl_union_map_uncurry(
5023                 __isl_take isl_union_map *umap);
5025 Given a relation with a nested relation for domain,
5026 the C<curry> functions
5027 move the range of the nested relation out of the domain
5028 and use it as the domain of a nested relation in the range,
5029 with the original range as range of this nested relation.
5030 The C<uncurry> functions perform the inverse operation.
5032 =item * Aligning parameters
5034 Change the order of the parameters of the given set, relation
5035 or function
5036 such that the first parameters match those of C<model>.
5037 This may involve the introduction of extra parameters.
5038 All parameters need to be named.
5040         #include <isl/space.h>
5041         __isl_give isl_space *isl_space_align_params(
5042                 __isl_take isl_space *space1,
5043                 __isl_take isl_space *space2)
5045         #include <isl/set.h>
5046         __isl_give isl_basic_set *isl_basic_set_align_params(
5047                 __isl_take isl_basic_set *bset,
5048                 __isl_take isl_space *model);
5049         __isl_give isl_set *isl_set_align_params(
5050                 __isl_take isl_set *set,
5051                 __isl_take isl_space *model);
5053         #include <isl/map.h>
5054         __isl_give isl_basic_map *isl_basic_map_align_params(
5055                 __isl_take isl_basic_map *bmap,
5056                 __isl_take isl_space *model);
5057         __isl_give isl_map *isl_map_align_params(
5058                 __isl_take isl_map *map,
5059                 __isl_take isl_space *model);
5061         #include <isl/val.h>
5062         __isl_give isl_multi_val *isl_multi_val_align_params(
5063                 __isl_take isl_multi_val *mv,
5064                 __isl_take isl_space *model);
5066         #include <isl/aff.h>
5067         __isl_give isl_aff *isl_aff_align_params(
5068                 __isl_take isl_aff *aff,
5069                 __isl_take isl_space *model);
5070         __isl_give isl_multi_aff *isl_multi_aff_align_params(
5071                 __isl_take isl_multi_aff *multi,
5072                 __isl_take isl_space *model);
5073         __isl_give isl_pw_aff *isl_pw_aff_align_params(
5074                 __isl_take isl_pw_aff *pwaff,
5075                 __isl_take isl_space *model);
5076         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
5077                 __isl_take isl_pw_multi_aff *pma,
5078                 __isl_take isl_space *model);
5079         __isl_give isl_union_pw_aff *
5080         isl_union_pw_aff_align_params(
5081                 __isl_take isl_union_pw_aff *upa,
5082                 __isl_take isl_space *model);
5083         __isl_give isl_union_pw_multi_aff *
5084         isl_union_pw_multi_aff_align_params(
5085                 __isl_take isl_union_pw_multi_aff *upma,
5086                 __isl_take isl_space *model);
5087         __isl_give isl_multi_union_pw_aff *
5088         isl_multi_union_pw_aff_align_params(
5089                 __isl_take isl_multi_union_pw_aff *mupa,
5090                 __isl_take isl_space *model);
5092         #include <isl/polynomial.h>
5093         __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
5094                 __isl_take isl_qpolynomial *qp,
5095                 __isl_take isl_space *model);
5097 =item * Unary Arithmethic Operations
5099         #include <isl/val.h>
5100         __isl_give isl_multi_val *isl_multi_val_neg(
5101                 __isl_take isl_multi_val *mv);
5103         #include <isl/aff.h>
5104         __isl_give isl_aff *isl_aff_neg(
5105                 __isl_take isl_aff *aff);
5106         __isl_give isl_multi_aff *isl_multi_aff_neg(
5107                 __isl_take isl_multi_aff *ma);
5108         __isl_give isl_pw_aff *isl_pw_aff_neg(
5109                 __isl_take isl_pw_aff *pwaff);
5110         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
5111                 __isl_take isl_pw_multi_aff *pma);
5112         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
5113                 __isl_take isl_multi_pw_aff *mpa);
5114         __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
5115                 __isl_take isl_union_pw_aff *upa);
5116         __isl_give isl_union_pw_multi_aff *
5117         isl_union_pw_multi_aff_neg(
5118                 __isl_take isl_union_pw_multi_aff *upma);
5119         __isl_give isl_multi_union_pw_aff *
5120         isl_multi_union_pw_aff_neg(
5121                 __isl_take isl_multi_union_pw_aff *mupa);
5122         __isl_give isl_aff *isl_aff_ceil(
5123                 __isl_take isl_aff *aff);
5124         __isl_give isl_pw_aff *isl_pw_aff_ceil(
5125                 __isl_take isl_pw_aff *pwaff);
5126         __isl_give isl_aff *isl_aff_floor(
5127                 __isl_take isl_aff *aff);
5128         __isl_give isl_multi_aff *isl_multi_aff_floor(
5129                 __isl_take isl_multi_aff *ma);
5130         __isl_give isl_pw_aff *isl_pw_aff_floor(
5131                 __isl_take isl_pw_aff *pwaff);
5132         __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
5133                 __isl_take isl_union_pw_aff *upa);
5134         __isl_give isl_multi_union_pw_aff *
5135         isl_multi_union_pw_aff_floor(
5136                 __isl_take isl_multi_union_pw_aff *mupa);
5138         #include <isl/aff.h>
5139         __isl_give isl_pw_aff *isl_pw_aff_list_min(
5140                 __isl_take isl_pw_aff_list *list);
5141         __isl_give isl_pw_aff *isl_pw_aff_list_max(
5142                 __isl_take isl_pw_aff_list *list);
5144         #include <isl/polynomial.h>
5145         __isl_give isl_qpolynomial *isl_qpolynomial_neg(
5146                 __isl_take isl_qpolynomial *qp);
5147         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
5148                 __isl_take isl_pw_qpolynomial *pwqp);
5149         __isl_give isl_union_pw_qpolynomial *
5150         isl_union_pw_qpolynomial_neg(
5151                 __isl_take isl_union_pw_qpolynomial *upwqp);
5152         __isl_give isl_qpolynomial *isl_qpolynomial_pow(
5153                 __isl_take isl_qpolynomial *qp,
5154                 unsigned exponent);
5155         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
5156                 __isl_take isl_pw_qpolynomial *pwqp,
5157                 unsigned exponent);
5159 =item * Evaluation
5161 The following functions evaluate a function in a point.
5163         #include <isl/polynomial.h>
5164         __isl_give isl_val *isl_pw_qpolynomial_eval(
5165                 __isl_take isl_pw_qpolynomial *pwqp,
5166                 __isl_take isl_point *pnt);
5167         __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
5168                 __isl_take isl_pw_qpolynomial_fold *pwf,
5169                 __isl_take isl_point *pnt);
5170         __isl_give isl_val *isl_union_pw_qpolynomial_eval(
5171                 __isl_take isl_union_pw_qpolynomial *upwqp,
5172                 __isl_take isl_point *pnt);
5173         __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
5174                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5175                 __isl_take isl_point *pnt);
5177 =item * Dimension manipulation
5179 It is usually not advisable to directly change the (input or output)
5180 space of a set or a relation as this removes the name and the internal
5181 structure of the space.  However, the functions below can be useful
5182 to add new parameters, assuming
5183 C<isl_set_align_params> and C<isl_map_align_params>
5184 are not sufficient.
5186         #include <isl/space.h>
5187         __isl_give isl_space *isl_space_add_dims(
5188                 __isl_take isl_space *space,
5189                 enum isl_dim_type type, unsigned n);
5190         __isl_give isl_space *isl_space_insert_dims(
5191                 __isl_take isl_space *space,
5192                 enum isl_dim_type type, unsigned pos, unsigned n);
5193         __isl_give isl_space *isl_space_drop_dims(
5194                 __isl_take isl_space *space,
5195                 enum isl_dim_type type, unsigned first, unsigned n);
5196         __isl_give isl_space *isl_space_move_dims(
5197                 __isl_take isl_space *space,
5198                 enum isl_dim_type dst_type, unsigned dst_pos,
5199                 enum isl_dim_type src_type, unsigned src_pos,
5200                 unsigned n);
5202         #include <isl/local_space.h>
5203         __isl_give isl_local_space *isl_local_space_add_dims(
5204                 __isl_take isl_local_space *ls,
5205                 enum isl_dim_type type, unsigned n);
5206         __isl_give isl_local_space *isl_local_space_insert_dims(
5207                 __isl_take isl_local_space *ls,
5208                 enum isl_dim_type type, unsigned first, unsigned n);
5209         __isl_give isl_local_space *isl_local_space_drop_dims(
5210                 __isl_take isl_local_space *ls,
5211                 enum isl_dim_type type, unsigned first, unsigned n);
5213         #include <isl/set.h>
5214         __isl_give isl_basic_set *isl_basic_set_add_dims(
5215                 __isl_take isl_basic_set *bset,
5216                 enum isl_dim_type type, unsigned n);
5217         __isl_give isl_set *isl_set_add_dims(
5218                 __isl_take isl_set *set,
5219                 enum isl_dim_type type, unsigned n);
5220         __isl_give isl_basic_set *isl_basic_set_insert_dims(
5221                 __isl_take isl_basic_set *bset,
5222                 enum isl_dim_type type, unsigned pos,
5223                 unsigned n);
5224         __isl_give isl_set *isl_set_insert_dims(
5225                 __isl_take isl_set *set,
5226                 enum isl_dim_type type, unsigned pos, unsigned n);
5227         __isl_give isl_basic_set *isl_basic_set_move_dims(
5228                 __isl_take isl_basic_set *bset,
5229                 enum isl_dim_type dst_type, unsigned dst_pos,
5230                 enum isl_dim_type src_type, unsigned src_pos,
5231                 unsigned n);
5232         __isl_give isl_set *isl_set_move_dims(
5233                 __isl_take isl_set *set,
5234                 enum isl_dim_type dst_type, unsigned dst_pos,
5235                 enum isl_dim_type src_type, unsigned src_pos,
5236                 unsigned n);
5238         #include <isl/map.h>
5239         __isl_give isl_map *isl_map_add_dims(
5240                 __isl_take isl_map *map,
5241                 enum isl_dim_type type, unsigned n);
5242         __isl_give isl_basic_map *isl_basic_map_insert_dims(
5243                 __isl_take isl_basic_map *bmap,
5244                 enum isl_dim_type type, unsigned pos,
5245                 unsigned n);
5246         __isl_give isl_map *isl_map_insert_dims(
5247                 __isl_take isl_map *map,
5248                 enum isl_dim_type type, unsigned pos, unsigned n);
5249         __isl_give isl_basic_map *isl_basic_map_move_dims(
5250                 __isl_take isl_basic_map *bmap,
5251                 enum isl_dim_type dst_type, unsigned dst_pos,
5252                 enum isl_dim_type src_type, unsigned src_pos,
5253                 unsigned n);
5254         __isl_give isl_map *isl_map_move_dims(
5255                 __isl_take isl_map *map,
5256                 enum isl_dim_type dst_type, unsigned dst_pos,
5257                 enum isl_dim_type src_type, unsigned src_pos,
5258                 unsigned n);
5260         #include <isl/val.h>
5261         __isl_give isl_multi_val *isl_multi_val_insert_dims(
5262                 __isl_take isl_multi_val *mv,
5263                 enum isl_dim_type type, unsigned first, unsigned n);
5264         __isl_give isl_multi_val *isl_multi_val_add_dims(
5265                 __isl_take isl_multi_val *mv,
5266                 enum isl_dim_type type, unsigned n);
5267         __isl_give isl_multi_val *isl_multi_val_drop_dims(
5268                 __isl_take isl_multi_val *mv,
5269                 enum isl_dim_type type, unsigned first, unsigned n);
5271         #include <isl/aff.h>
5272         __isl_give isl_aff *isl_aff_insert_dims(
5273                 __isl_take isl_aff *aff,
5274                 enum isl_dim_type type, unsigned first, unsigned n);
5275         __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
5276                 __isl_take isl_multi_aff *ma,
5277                 enum isl_dim_type type, unsigned first, unsigned n);
5278         __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
5279                 __isl_take isl_pw_aff *pwaff,
5280                 enum isl_dim_type type, unsigned first, unsigned n);
5281         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
5282                 __isl_take isl_multi_pw_aff *mpa,
5283                 enum isl_dim_type type, unsigned first, unsigned n);
5284         __isl_give isl_aff *isl_aff_add_dims(
5285                 __isl_take isl_aff *aff,
5286                 enum isl_dim_type type, unsigned n);
5287         __isl_give isl_multi_aff *isl_multi_aff_add_dims(
5288                 __isl_take isl_multi_aff *ma,
5289                 enum isl_dim_type type, unsigned n);
5290         __isl_give isl_pw_aff *isl_pw_aff_add_dims(
5291                 __isl_take isl_pw_aff *pwaff,
5292                 enum isl_dim_type type, unsigned n);
5293         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
5294                 __isl_take isl_multi_pw_aff *mpa,
5295                 enum isl_dim_type type, unsigned n);
5296         __isl_give isl_aff *isl_aff_drop_dims(
5297                 __isl_take isl_aff *aff,
5298                 enum isl_dim_type type, unsigned first, unsigned n);
5299         __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
5300                 __isl_take isl_multi_aff *maff,
5301                 enum isl_dim_type type, unsigned first, unsigned n);
5302         __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
5303                 __isl_take isl_pw_aff *pwaff,
5304                 enum isl_dim_type type, unsigned first, unsigned n);
5305         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
5306                 __isl_take isl_pw_multi_aff *pma,
5307                 enum isl_dim_type type, unsigned first, unsigned n);
5308         __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
5309                 __isl_take isl_union_pw_aff *upa,
5310                 enum isl_dim_type type, unsigned first, unsigned n);
5311         __isl_give isl_union_pw_multi_aff *
5312                 isl_union_pw_multi_aff_drop_dims(
5313                 __isl_take isl_union_pw_multi_aff *upma,
5314                 enum isl_dim_type type,
5315                 unsigned first, unsigned n);
5316         __isl_give isl_multi_union_pw_aff *
5317         isl_multi_union_pw_aff_drop_dims(
5318                 __isl_take isl_multi_union_pw_aff *mupa,
5319                 enum isl_dim_type type, unsigned first,
5320                 unsigned n);
5321         __isl_give isl_aff *isl_aff_move_dims(
5322                 __isl_take isl_aff *aff,
5323                 enum isl_dim_type dst_type, unsigned dst_pos,
5324                 enum isl_dim_type src_type, unsigned src_pos,
5325                 unsigned n);
5326         __isl_give isl_multi_aff *isl_multi_aff_move_dims(
5327                 __isl_take isl_multi_aff *ma,
5328                 enum isl_dim_type dst_type, unsigned dst_pos,
5329                 enum isl_dim_type src_type, unsigned src_pos,
5330                 unsigned n);
5331         __isl_give isl_pw_aff *isl_pw_aff_move_dims(
5332                 __isl_take isl_pw_aff *pa,
5333                 enum isl_dim_type dst_type, unsigned dst_pos,
5334                 enum isl_dim_type src_type, unsigned src_pos,
5335                 unsigned n);
5336         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
5337                 __isl_take isl_multi_pw_aff *pma,
5338                 enum isl_dim_type dst_type, unsigned dst_pos,
5339                 enum isl_dim_type src_type, unsigned src_pos,
5340                 unsigned n);
5342         #include <isl/polynomial.h>
5343         __isl_give isl_union_pw_qpolynomial *
5344         isl_union_pw_qpolynomial_drop_dims(
5345                 __isl_take isl_union_pw_qpolynomial *upwqp,
5346                 enum isl_dim_type type,
5347                 unsigned first, unsigned n);
5348         __isl_give isl_union_pw_qpolynomial_fold *
5349                 isl_union_pw_qpolynomial_fold_drop_dims(
5350                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5351                 enum isl_dim_type type,
5352                 unsigned first, unsigned n);
5354 The operations on union expressions can only manipulate parameters.
5356 =back
5358 =head2 Binary Operations
5360 The two arguments of a binary operation not only need to live
5361 in the same C<isl_ctx>, they currently also need to have
5362 the same (number of) parameters.
5364 =head3 Basic Operations
5366 =over
5368 =item * Intersection
5370         #include <isl/local_space.h>
5371         __isl_give isl_local_space *isl_local_space_intersect(
5372                 __isl_take isl_local_space *ls1,
5373                 __isl_take isl_local_space *ls2);
5375         #include <isl/set.h>
5376         __isl_give isl_basic_set *isl_basic_set_intersect_params(
5377                 __isl_take isl_basic_set *bset1,
5378                 __isl_take isl_basic_set *bset2);
5379         __isl_give isl_basic_set *isl_basic_set_intersect(
5380                 __isl_take isl_basic_set *bset1,
5381                 __isl_take isl_basic_set *bset2);
5382         __isl_give isl_basic_set *isl_basic_set_list_intersect(
5383                 __isl_take struct isl_basic_set_list *list);
5384         __isl_give isl_set *isl_set_intersect_params(
5385                 __isl_take isl_set *set,
5386                 __isl_take isl_set *params);
5387         __isl_give isl_set *isl_set_intersect(
5388                 __isl_take isl_set *set1,
5389                 __isl_take isl_set *set2);
5391         #include <isl/map.h>
5392         __isl_give isl_basic_map *isl_basic_map_intersect_domain(
5393                 __isl_take isl_basic_map *bmap,
5394                 __isl_take isl_basic_set *bset);
5395         __isl_give isl_basic_map *isl_basic_map_intersect_range(
5396                 __isl_take isl_basic_map *bmap,
5397                 __isl_take isl_basic_set *bset);
5398         __isl_give isl_basic_map *isl_basic_map_intersect(
5399                 __isl_take isl_basic_map *bmap1,
5400                 __isl_take isl_basic_map *bmap2);
5401         __isl_give isl_basic_map *isl_basic_map_list_intersect(
5402                 __isl_take isl_basic_map_list *list);
5403         __isl_give isl_map *isl_map_intersect_params(
5404                 __isl_take isl_map *map,
5405                 __isl_take isl_set *params);
5406         __isl_give isl_map *isl_map_intersect_domain(
5407                 __isl_take isl_map *map,
5408                 __isl_take isl_set *set);
5409         __isl_give isl_map *isl_map_intersect_range(
5410                 __isl_take isl_map *map,
5411                 __isl_take isl_set *set);
5412         __isl_give isl_map *isl_map_intersect(
5413                 __isl_take isl_map *map1,
5414                 __isl_take isl_map *map2);
5416         #include <isl/union_set.h>
5417         __isl_give isl_union_set *isl_union_set_intersect_params(
5418                 __isl_take isl_union_set *uset,
5419                 __isl_take isl_set *set);
5420         __isl_give isl_union_set *isl_union_set_intersect(
5421                 __isl_take isl_union_set *uset1,
5422                 __isl_take isl_union_set *uset2);
5424         #include <isl/union_map.h>
5425         __isl_give isl_union_map *isl_union_map_intersect_params(
5426                 __isl_take isl_union_map *umap,
5427                 __isl_take isl_set *set);
5428         __isl_give isl_union_map *isl_union_map_intersect_domain(
5429                 __isl_take isl_union_map *umap,
5430                 __isl_take isl_union_set *uset);
5431         __isl_give isl_union_map *isl_union_map_intersect_range(
5432                 __isl_take isl_union_map *umap,
5433                 __isl_take isl_union_set *uset);
5434         __isl_give isl_union_map *isl_union_map_intersect(
5435                 __isl_take isl_union_map *umap1,
5436                 __isl_take isl_union_map *umap2);
5438         #include <isl/aff.h>
5439         __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
5440                 __isl_take isl_pw_aff *pa,
5441                 __isl_take isl_set *set);
5442         __isl_give isl_multi_pw_aff *
5443         isl_multi_pw_aff_intersect_domain(
5444                 __isl_take isl_multi_pw_aff *mpa,
5445                 __isl_take isl_set *domain);
5446         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
5447                 __isl_take isl_pw_multi_aff *pma,
5448                 __isl_take isl_set *set);
5449         __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
5450                 __isl_take isl_union_pw_aff *upa,
5451                 __isl_take isl_union_set *uset);
5452         __isl_give isl_union_pw_multi_aff *
5453         isl_union_pw_multi_aff_intersect_domain(
5454                 __isl_take isl_union_pw_multi_aff *upma,
5455                 __isl_take isl_union_set *uset);
5456         __isl_give isl_multi_union_pw_aff *
5457         isl_multi_union_pw_aff_intersect_domain(
5458                 __isl_take isl_multi_union_pw_aff *mupa,
5459                 __isl_take isl_union_set *uset);
5460         __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
5461                 __isl_take isl_pw_aff *pa,
5462                 __isl_take isl_set *set);
5463         __isl_give isl_multi_pw_aff *
5464         isl_multi_pw_aff_intersect_params(
5465                 __isl_take isl_multi_pw_aff *mpa,
5466                 __isl_take isl_set *set);
5467         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
5468                 __isl_take isl_pw_multi_aff *pma,
5469                 __isl_take isl_set *set);
5470         __isl_give isl_union_pw_aff *
5471         isl_union_pw_aff_intersect_params(
5472                 __isl_take isl_union_pw_aff *upa,
5473         __isl_give isl_union_pw_multi_aff *
5474         isl_union_pw_multi_aff_intersect_params(
5475                 __isl_take isl_union_pw_multi_aff *upma,
5476                 __isl_take isl_set *set);
5477         __isl_give isl_multi_union_pw_aff *
5478         isl_multi_union_pw_aff_intersect_params(
5479                 __isl_take isl_multi_union_pw_aff *mupa,
5480                 __isl_take isl_set *params);
5481         isl_multi_union_pw_aff_intersect_range(
5482                 __isl_take isl_multi_union_pw_aff *mupa,
5483                 __isl_take isl_set *set);
5485         #include <isl/polynomial.h>
5486         __isl_give isl_pw_qpolynomial *
5487         isl_pw_qpolynomial_intersect_domain(
5488                 __isl_take isl_pw_qpolynomial *pwpq,
5489                 __isl_take isl_set *set);
5490         __isl_give isl_union_pw_qpolynomial *
5491         isl_union_pw_qpolynomial_intersect_domain(
5492                 __isl_take isl_union_pw_qpolynomial *upwpq,
5493                 __isl_take isl_union_set *uset);
5494         __isl_give isl_union_pw_qpolynomial_fold *
5495         isl_union_pw_qpolynomial_fold_intersect_domain(
5496                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5497                 __isl_take isl_union_set *uset);
5498         __isl_give isl_pw_qpolynomial *
5499         isl_pw_qpolynomial_intersect_params(
5500                 __isl_take isl_pw_qpolynomial *pwpq,
5501                 __isl_take isl_set *set);
5502         __isl_give isl_pw_qpolynomial_fold *
5503         isl_pw_qpolynomial_fold_intersect_params(
5504                 __isl_take isl_pw_qpolynomial_fold *pwf,
5505                 __isl_take isl_set *set);
5506         __isl_give isl_union_pw_qpolynomial *
5507         isl_union_pw_qpolynomial_intersect_params(
5508                 __isl_take isl_union_pw_qpolynomial *upwpq,
5509                 __isl_take isl_set *set);
5510         __isl_give isl_union_pw_qpolynomial_fold *
5511         isl_union_pw_qpolynomial_fold_intersect_params(
5512                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5513                 __isl_take isl_set *set);
5515 The second argument to the C<_params> functions needs to be
5516 a parametric (basic) set.  For the other functions, a parametric set
5517 for either argument is only allowed if the other argument is
5518 a parametric set as well.
5519 The list passed to C<isl_basic_set_list_intersect> needs to have
5520 at least one element and all elements need to live in the same space.
5521 The function C<isl_multi_union_pw_aff_intersect_range>
5522 restricts the input function to those shared domain elements
5523 that map to the specified range.
5525 =item * Union
5527         #include <isl/set.h>
5528         __isl_give isl_set *isl_basic_set_union(
5529                 __isl_take isl_basic_set *bset1,
5530                 __isl_take isl_basic_set *bset2);
5531         __isl_give isl_set *isl_set_union(
5532                 __isl_take isl_set *set1,
5533                 __isl_take isl_set *set2);
5535         #include <isl/map.h>
5536         __isl_give isl_map *isl_basic_map_union(
5537                 __isl_take isl_basic_map *bmap1,
5538                 __isl_take isl_basic_map *bmap2);
5539         __isl_give isl_map *isl_map_union(
5540                 __isl_take isl_map *map1,
5541                 __isl_take isl_map *map2);
5543         #include <isl/union_set.h>
5544         __isl_give isl_union_set *isl_union_set_union(
5545                 __isl_take isl_union_set *uset1,
5546                 __isl_take isl_union_set *uset2);
5547         __isl_give isl_union_set *isl_union_set_list_union(
5548                 __isl_take isl_union_set_list *list);
5550         #include <isl/union_map.h>
5551         __isl_give isl_union_map *isl_union_map_union(
5552                 __isl_take isl_union_map *umap1,
5553                 __isl_take isl_union_map *umap2);
5555 =item * Set difference
5557         #include <isl/set.h>
5558         __isl_give isl_set *isl_set_subtract(
5559                 __isl_take isl_set *set1,
5560                 __isl_take isl_set *set2);
5562         #include <isl/map.h>
5563         __isl_give isl_map *isl_map_subtract(
5564                 __isl_take isl_map *map1,
5565                 __isl_take isl_map *map2);
5566         __isl_give isl_map *isl_map_subtract_domain(
5567                 __isl_take isl_map *map,
5568                 __isl_take isl_set *dom);
5569         __isl_give isl_map *isl_map_subtract_range(
5570                 __isl_take isl_map *map,
5571                 __isl_take isl_set *dom);
5573         #include <isl/union_set.h>
5574         __isl_give isl_union_set *isl_union_set_subtract(
5575                 __isl_take isl_union_set *uset1,
5576                 __isl_take isl_union_set *uset2);
5578         #include <isl/union_map.h>
5579         __isl_give isl_union_map *isl_union_map_subtract(
5580                 __isl_take isl_union_map *umap1,
5581                 __isl_take isl_union_map *umap2);
5582         __isl_give isl_union_map *isl_union_map_subtract_domain(
5583                 __isl_take isl_union_map *umap,
5584                 __isl_take isl_union_set *dom);
5585         __isl_give isl_union_map *isl_union_map_subtract_range(
5586                 __isl_take isl_union_map *umap,
5587                 __isl_take isl_union_set *dom);
5589         #include <isl/aff.h>
5590         __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
5591                 __isl_take isl_pw_aff *pa,
5592                 __isl_take isl_set *set);
5593         __isl_give isl_pw_multi_aff *
5594         isl_pw_multi_aff_subtract_domain(
5595                 __isl_take isl_pw_multi_aff *pma,
5596                 __isl_take isl_set *set);
5597         __isl_give isl_union_pw_aff *
5598         isl_union_pw_aff_subtract_domain(
5599                 __isl_take isl_union_pw_aff *upa,
5600                 __isl_take isl_union_set *uset);
5601         __isl_give isl_union_pw_multi_aff *
5602         isl_union_pw_multi_aff_subtract_domain(
5603                 __isl_take isl_union_pw_multi_aff *upma,
5604                 __isl_take isl_set *set);
5606         #include <isl/polynomial.h>
5607         __isl_give isl_pw_qpolynomial *
5608         isl_pw_qpolynomial_subtract_domain(
5609                 __isl_take isl_pw_qpolynomial *pwpq,
5610                 __isl_take isl_set *set);
5611         __isl_give isl_pw_qpolynomial_fold *
5612         isl_pw_qpolynomial_fold_subtract_domain(
5613                 __isl_take isl_pw_qpolynomial_fold *pwf,
5614                 __isl_take isl_set *set);
5615         __isl_give isl_union_pw_qpolynomial *
5616         isl_union_pw_qpolynomial_subtract_domain(
5617                 __isl_take isl_union_pw_qpolynomial *upwpq,
5618                 __isl_take isl_union_set *uset);
5619         __isl_give isl_union_pw_qpolynomial_fold *
5620         isl_union_pw_qpolynomial_fold_subtract_domain(
5621                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5622                 __isl_take isl_union_set *uset);
5624 =item * Application
5626         #include <isl/space.h>
5627         __isl_give isl_space *isl_space_join(
5628                 __isl_take isl_space *left,
5629                 __isl_take isl_space *right);
5631         #include <isl/map.h>
5632         __isl_give isl_basic_set *isl_basic_set_apply(
5633                 __isl_take isl_basic_set *bset,
5634                 __isl_take isl_basic_map *bmap);
5635         __isl_give isl_set *isl_set_apply(
5636                 __isl_take isl_set *set,
5637                 __isl_take isl_map *map);
5638         __isl_give isl_union_set *isl_union_set_apply(
5639                 __isl_take isl_union_set *uset,
5640                 __isl_take isl_union_map *umap);
5641         __isl_give isl_basic_map *isl_basic_map_apply_domain(
5642                 __isl_take isl_basic_map *bmap1,
5643                 __isl_take isl_basic_map *bmap2);
5644         __isl_give isl_basic_map *isl_basic_map_apply_range(
5645                 __isl_take isl_basic_map *bmap1,
5646                 __isl_take isl_basic_map *bmap2);
5647         __isl_give isl_map *isl_map_apply_domain(
5648                 __isl_take isl_map *map1,
5649                 __isl_take isl_map *map2);
5650         __isl_give isl_map *isl_map_apply_range(
5651                 __isl_take isl_map *map1,
5652                 __isl_take isl_map *map2);
5654         #include <isl/union_map.h>
5655         __isl_give isl_union_map *isl_union_map_apply_domain(
5656                 __isl_take isl_union_map *umap1,
5657                 __isl_take isl_union_map *umap2);
5658         __isl_give isl_union_map *isl_union_map_apply_range(
5659                 __isl_take isl_union_map *umap1,
5660                 __isl_take isl_union_map *umap2);
5662         #include <isl/aff.h>
5663         __isl_give isl_union_pw_aff *
5664         isl_multi_union_pw_aff_apply_aff(
5665                 __isl_take isl_multi_union_pw_aff *mupa,
5666                 __isl_take isl_aff *aff);
5667         __isl_give isl_union_pw_aff *
5668         isl_multi_union_pw_aff_apply_pw_aff(
5669                 __isl_take isl_multi_union_pw_aff *mupa,
5670                 __isl_take isl_pw_aff *pa);
5671         __isl_give isl_multi_union_pw_aff *
5672         isl_multi_union_pw_aff_apply_multi_aff(
5673                 __isl_take isl_multi_union_pw_aff *mupa,
5674                 __isl_take isl_multi_aff *ma);
5675         __isl_give isl_multi_union_pw_aff *
5676         isl_multi_union_pw_aff_apply_pw_multi_aff(
5677                 __isl_take isl_multi_union_pw_aff *mupa,
5678                 __isl_take isl_pw_multi_aff *pma);
5680 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
5681 over the shared domain of the elements of the input.  The dimension is
5682 required to be greater than zero.
5683 The C<isl_multi_union_pw_aff> argument of
5684 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
5685 but only if the range of the C<isl_multi_aff> argument
5686 is also zero-dimensional.
5687 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
5689         #include <isl/polynomial.h>
5690         __isl_give isl_pw_qpolynomial_fold *
5691         isl_set_apply_pw_qpolynomial_fold(
5692                 __isl_take isl_set *set,
5693                 __isl_take isl_pw_qpolynomial_fold *pwf,
5694                 int *tight);
5695         __isl_give isl_pw_qpolynomial_fold *
5696         isl_map_apply_pw_qpolynomial_fold(
5697                 __isl_take isl_map *map,
5698                 __isl_take isl_pw_qpolynomial_fold *pwf,
5699                 int *tight);
5700         __isl_give isl_union_pw_qpolynomial_fold *
5701         isl_union_set_apply_union_pw_qpolynomial_fold(
5702                 __isl_take isl_union_set *uset,
5703                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5704                 int *tight);
5705         __isl_give isl_union_pw_qpolynomial_fold *
5706         isl_union_map_apply_union_pw_qpolynomial_fold(
5707                 __isl_take isl_union_map *umap,
5708                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5709                 int *tight);
5711 The functions taking a map
5712 compose the given map with the given piecewise quasipolynomial reduction.
5713 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
5714 over all elements in the intersection of the range of the map
5715 and the domain of the piecewise quasipolynomial reduction
5716 as a function of an element in the domain of the map.
5717 The functions taking a set compute a bound over all elements in the
5718 intersection of the set and the domain of the
5719 piecewise quasipolynomial reduction.
5721 =item * Preimage
5723         #include <isl/set.h>
5724         __isl_give isl_basic_set *
5725         isl_basic_set_preimage_multi_aff(
5726                 __isl_take isl_basic_set *bset,
5727                 __isl_take isl_multi_aff *ma);
5728         __isl_give isl_set *isl_set_preimage_multi_aff(
5729                 __isl_take isl_set *set,
5730                 __isl_take isl_multi_aff *ma);
5731         __isl_give isl_set *isl_set_preimage_pw_multi_aff(
5732                 __isl_take isl_set *set,
5733                 __isl_take isl_pw_multi_aff *pma);
5734         __isl_give isl_set *isl_set_preimage_multi_pw_aff(
5735                 __isl_take isl_set *set,
5736                 __isl_take isl_multi_pw_aff *mpa);
5738         #include <isl/union_set.h>
5739         __isl_give isl_union_set *
5740         isl_union_set_preimage_multi_aff(
5741                 __isl_take isl_union_set *uset,
5742                 __isl_take isl_multi_aff *ma);
5743         __isl_give isl_union_set *
5744         isl_union_set_preimage_pw_multi_aff(
5745                 __isl_take isl_union_set *uset,
5746                 __isl_take isl_pw_multi_aff *pma);
5747         __isl_give isl_union_set *
5748         isl_union_set_preimage_union_pw_multi_aff(
5749                 __isl_take isl_union_set *uset,
5750                 __isl_take isl_union_pw_multi_aff *upma);
5752         #include <isl/map.h>
5753         __isl_give isl_basic_map *
5754         isl_basic_map_preimage_domain_multi_aff(
5755                 __isl_take isl_basic_map *bmap,
5756                 __isl_take isl_multi_aff *ma);
5757         __isl_give isl_map *isl_map_preimage_domain_multi_aff(
5758                 __isl_take isl_map *map,
5759                 __isl_take isl_multi_aff *ma);
5760         __isl_give isl_map *isl_map_preimage_range_multi_aff(
5761                 __isl_take isl_map *map,
5762                 __isl_take isl_multi_aff *ma);
5763         __isl_give isl_map *
5764         isl_map_preimage_domain_pw_multi_aff(
5765                 __isl_take isl_map *map,
5766                 __isl_take isl_pw_multi_aff *pma);
5767         __isl_give isl_map *
5768         isl_map_preimage_range_pw_multi_aff(
5769                 __isl_take isl_map *map,
5770                 __isl_take isl_pw_multi_aff *pma);
5771         __isl_give isl_map *
5772         isl_map_preimage_domain_multi_pw_aff(
5773                 __isl_take isl_map *map,
5774                 __isl_take isl_multi_pw_aff *mpa);
5775         __isl_give isl_basic_map *
5776         isl_basic_map_preimage_range_multi_aff(
5777                 __isl_take isl_basic_map *bmap,
5778                 __isl_take isl_multi_aff *ma);
5780         #include <isl/union_map.h>
5781         __isl_give isl_union_map *
5782         isl_union_map_preimage_domain_multi_aff(
5783                 __isl_take isl_union_map *umap,
5784                 __isl_take isl_multi_aff *ma);
5785         __isl_give isl_union_map *
5786         isl_union_map_preimage_range_multi_aff(
5787                 __isl_take isl_union_map *umap,
5788                 __isl_take isl_multi_aff *ma);
5789         __isl_give isl_union_map *
5790         isl_union_map_preimage_domain_pw_multi_aff(
5791                 __isl_take isl_union_map *umap,
5792                 __isl_take isl_pw_multi_aff *pma);
5793         __isl_give isl_union_map *
5794         isl_union_map_preimage_range_pw_multi_aff(
5795                 __isl_take isl_union_map *umap,
5796                 __isl_take isl_pw_multi_aff *pma);
5797         __isl_give isl_union_map *
5798         isl_union_map_preimage_domain_union_pw_multi_aff(
5799                 __isl_take isl_union_map *umap,
5800                 __isl_take isl_union_pw_multi_aff *upma);
5801         __isl_give isl_union_map *
5802         isl_union_map_preimage_range_union_pw_multi_aff(
5803                 __isl_take isl_union_map *umap,
5804                 __isl_take isl_union_pw_multi_aff *upma);
5806 These functions compute the preimage of the given set or map domain/range under
5807 the given function.  In other words, the expression is plugged
5808 into the set description or into the domain/range of the map.
5810 =item * Pullback
5812         #include <isl/aff.h>
5813         __isl_give isl_aff *isl_aff_pullback_aff(
5814                 __isl_take isl_aff *aff1,
5815                 __isl_take isl_aff *aff2);
5816         __isl_give isl_aff *isl_aff_pullback_multi_aff(
5817                 __isl_take isl_aff *aff,
5818                 __isl_take isl_multi_aff *ma);
5819         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
5820                 __isl_take isl_pw_aff *pa,
5821                 __isl_take isl_multi_aff *ma);
5822         __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
5823                 __isl_take isl_pw_aff *pa,
5824                 __isl_take isl_pw_multi_aff *pma);
5825         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
5826                 __isl_take isl_pw_aff *pa,
5827                 __isl_take isl_multi_pw_aff *mpa);
5828         __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
5829                 __isl_take isl_multi_aff *ma1,
5830                 __isl_take isl_multi_aff *ma2);
5831         __isl_give isl_pw_multi_aff *
5832         isl_pw_multi_aff_pullback_multi_aff(
5833                 __isl_take isl_pw_multi_aff *pma,
5834                 __isl_take isl_multi_aff *ma);
5835         __isl_give isl_multi_pw_aff *
5836         isl_multi_pw_aff_pullback_multi_aff(
5837                 __isl_take isl_multi_pw_aff *mpa,
5838                 __isl_take isl_multi_aff *ma);
5839         __isl_give isl_pw_multi_aff *
5840         isl_pw_multi_aff_pullback_pw_multi_aff(
5841                 __isl_take isl_pw_multi_aff *pma1,
5842                 __isl_take isl_pw_multi_aff *pma2);
5843         __isl_give isl_multi_pw_aff *
5844         isl_multi_pw_aff_pullback_pw_multi_aff(
5845                 __isl_take isl_multi_pw_aff *mpa,
5846                 __isl_take isl_pw_multi_aff *pma);
5847         __isl_give isl_multi_pw_aff *
5848         isl_multi_pw_aff_pullback_multi_pw_aff(
5849                 __isl_take isl_multi_pw_aff *mpa1,
5850                 __isl_take isl_multi_pw_aff *mpa2);
5851         __isl_give isl_union_pw_aff *
5852         isl_union_pw_aff_pullback_union_pw_multi_aff(
5853                 __isl_take isl_union_pw_aff *upa,
5854                 __isl_take isl_union_pw_multi_aff *upma);
5855         __isl_give isl_union_pw_multi_aff *
5856         isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
5857                 __isl_take isl_union_pw_multi_aff *upma1,
5858                 __isl_take isl_union_pw_multi_aff *upma2);
5859         __isl_give isl_multi_union_pw_aff *
5860         isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
5861                 __isl_take isl_multi_union_pw_aff *mupa,
5862                 __isl_take isl_union_pw_multi_aff *upma);
5864 These functions precompose the first expression by the second function.
5865 In other words, the second function is plugged
5866 into the first expression.
5868 =item * Locus
5870         #include <isl/aff.h>
5871         __isl_give isl_basic_set *isl_aff_le_basic_set(
5872                 __isl_take isl_aff *aff1,
5873                 __isl_take isl_aff *aff2);
5874         __isl_give isl_basic_set *isl_aff_ge_basic_set(
5875                 __isl_take isl_aff *aff1,
5876                 __isl_take isl_aff *aff2);
5877         __isl_give isl_set *isl_pw_aff_eq_set(
5878                 __isl_take isl_pw_aff *pwaff1,
5879                 __isl_take isl_pw_aff *pwaff2);
5880         __isl_give isl_set *isl_pw_aff_ne_set(
5881                 __isl_take isl_pw_aff *pwaff1,
5882                 __isl_take isl_pw_aff *pwaff2);
5883         __isl_give isl_set *isl_pw_aff_le_set(
5884                 __isl_take isl_pw_aff *pwaff1,
5885                 __isl_take isl_pw_aff *pwaff2);
5886         __isl_give isl_set *isl_pw_aff_lt_set(
5887                 __isl_take isl_pw_aff *pwaff1,
5888                 __isl_take isl_pw_aff *pwaff2);
5889         __isl_give isl_set *isl_pw_aff_ge_set(
5890                 __isl_take isl_pw_aff *pwaff1,
5891                 __isl_take isl_pw_aff *pwaff2);
5892         __isl_give isl_set *isl_pw_aff_gt_set(
5893                 __isl_take isl_pw_aff *pwaff1,
5894                 __isl_take isl_pw_aff *pwaff2);
5896         __isl_give isl_set *isl_multi_aff_lex_le_set(
5897                 __isl_take isl_multi_aff *ma1,
5898                 __isl_take isl_multi_aff *ma2);
5899         __isl_give isl_set *isl_multi_aff_lex_ge_set(
5900                 __isl_take isl_multi_aff *ma1,
5901                 __isl_take isl_multi_aff *ma2);
5903         __isl_give isl_set *isl_pw_aff_list_eq_set(
5904                 __isl_take isl_pw_aff_list *list1,
5905                 __isl_take isl_pw_aff_list *list2);
5906         __isl_give isl_set *isl_pw_aff_list_ne_set(
5907                 __isl_take isl_pw_aff_list *list1,
5908                 __isl_take isl_pw_aff_list *list2);
5909         __isl_give isl_set *isl_pw_aff_list_le_set(
5910                 __isl_take isl_pw_aff_list *list1,
5911                 __isl_take isl_pw_aff_list *list2);
5912         __isl_give isl_set *isl_pw_aff_list_lt_set(
5913                 __isl_take isl_pw_aff_list *list1,
5914                 __isl_take isl_pw_aff_list *list2);
5915         __isl_give isl_set *isl_pw_aff_list_ge_set(
5916                 __isl_take isl_pw_aff_list *list1,
5917                 __isl_take isl_pw_aff_list *list2);
5918         __isl_give isl_set *isl_pw_aff_list_gt_set(
5919                 __isl_take isl_pw_aff_list *list1,
5920                 __isl_take isl_pw_aff_list *list2);
5922 The function C<isl_aff_ge_basic_set> returns a basic set
5923 containing those elements in the shared space
5924 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
5925 The function C<isl_pw_aff_ge_set> returns a set
5926 containing those elements in the shared domain
5927 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
5928 greater than or equal to C<pwaff2>.
5929 The function C<isl_multi_aff_lex_le_set> returns a set
5930 containing those elements in the shared domain space
5931 where C<ma1> is lexicographically smaller than or
5932 equal to C<ma2>.
5933 The functions operating on C<isl_pw_aff_list> apply the corresponding
5934 C<isl_pw_aff> function to each pair of elements in the two lists.
5936         #include <isl/aff.h>
5937         __isl_give isl_map *isl_pw_aff_eq_map(
5938                 __isl_take isl_pw_aff *pa1,
5939                 __isl_take isl_pw_aff *pa2);
5940         __isl_give isl_map *isl_pw_aff_lt_map(
5941                 __isl_take isl_pw_aff *pa1,
5942                 __isl_take isl_pw_aff *pa2);
5943         __isl_give isl_map *isl_pw_aff_gt_map(
5944                 __isl_take isl_pw_aff *pa1,
5945                 __isl_take isl_pw_aff *pa2);
5947         __isl_give isl_map *isl_multi_pw_aff_eq_map(
5948                 __isl_take isl_multi_pw_aff *mpa1,
5949                 __isl_take isl_multi_pw_aff *mpa2);
5950         __isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
5951                 __isl_take isl_multi_pw_aff *mpa1,
5952                 __isl_take isl_multi_pw_aff *mpa2);
5953         __isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
5954                 __isl_take isl_multi_pw_aff *mpa1,
5955                 __isl_take isl_multi_pw_aff *mpa2);
5957 These functions return a map between domain elements of the arguments
5958 where the function values satisfy the given relation.
5960         #include <isl/union_map.h>
5961         __isl_give isl_union_map *
5962         isl_union_map_eq_at_multi_union_pw_aff(
5963                 __isl_take isl_union_map *umap,
5964                 __isl_take isl_multi_union_pw_aff *mupa);
5965         __isl_give isl_union_map *
5966         isl_union_map_lex_lt_at_multi_union_pw_aff(
5967                 __isl_take isl_union_map *umap,
5968                 __isl_take isl_multi_union_pw_aff *mupa);
5969         __isl_give isl_union_map *
5970         isl_union_map_lex_gt_at_multi_union_pw_aff(
5971                 __isl_take isl_union_map *umap,
5972                 __isl_take isl_multi_union_pw_aff *mupa);
5974 These functions select the subset of elements in the union map
5975 that have an equal or lexicographically smaller function value.
5977 =item * Cartesian Product
5979         #include <isl/space.h>
5980         __isl_give isl_space *isl_space_product(
5981                 __isl_take isl_space *space1,
5982                 __isl_take isl_space *space2);
5983         __isl_give isl_space *isl_space_domain_product(
5984                 __isl_take isl_space *space1,
5985                 __isl_take isl_space *space2);
5986         __isl_give isl_space *isl_space_range_product(
5987                 __isl_take isl_space *space1,
5988                 __isl_take isl_space *space2);
5990 The functions
5991 C<isl_space_product>, C<isl_space_domain_product>
5992 and C<isl_space_range_product> take pairs or relation spaces and
5993 produce a single relations space, where either the domain, the range
5994 or both domain and range are wrapped spaces of relations between
5995 the domains and/or ranges of the input spaces.
5996 If the product is only constructed over the domain or the range
5997 then the ranges or the domains of the inputs should be the same.
5998 The function C<isl_space_product> also accepts a pair of set spaces,
5999 in which case it returns a wrapped space of a relation between the
6000 two input spaces.
6002         #include <isl/set.h>
6003         __isl_give isl_set *isl_set_product(
6004                 __isl_take isl_set *set1,
6005                 __isl_take isl_set *set2);
6007         #include <isl/map.h>
6008         __isl_give isl_basic_map *isl_basic_map_domain_product(
6009                 __isl_take isl_basic_map *bmap1,
6010                 __isl_take isl_basic_map *bmap2);
6011         __isl_give isl_basic_map *isl_basic_map_range_product(
6012                 __isl_take isl_basic_map *bmap1,
6013                 __isl_take isl_basic_map *bmap2);
6014         __isl_give isl_basic_map *isl_basic_map_product(
6015                 __isl_take isl_basic_map *bmap1,
6016                 __isl_take isl_basic_map *bmap2);
6017         __isl_give isl_map *isl_map_domain_product(
6018                 __isl_take isl_map *map1,
6019                 __isl_take isl_map *map2);
6020         __isl_give isl_map *isl_map_range_product(
6021                 __isl_take isl_map *map1,
6022                 __isl_take isl_map *map2);
6023         __isl_give isl_map *isl_map_product(
6024                 __isl_take isl_map *map1,
6025                 __isl_take isl_map *map2);
6027         #include <isl/union_set.h>
6028         __isl_give isl_union_set *isl_union_set_product(
6029                 __isl_take isl_union_set *uset1,
6030                 __isl_take isl_union_set *uset2);
6032         #include <isl/union_map.h>
6033         __isl_give isl_union_map *isl_union_map_domain_product(
6034                 __isl_take isl_union_map *umap1,
6035                 __isl_take isl_union_map *umap2);
6036         __isl_give isl_union_map *isl_union_map_range_product(
6037                 __isl_take isl_union_map *umap1,
6038                 __isl_take isl_union_map *umap2);
6039         __isl_give isl_union_map *isl_union_map_product(
6040                 __isl_take isl_union_map *umap1,
6041                 __isl_take isl_union_map *umap2);
6043         #include <isl/val.h>
6044         __isl_give isl_multi_val *isl_multi_val_range_product(
6045                 __isl_take isl_multi_val *mv1,
6046                 __isl_take isl_multi_val *mv2);
6047         __isl_give isl_multi_val *isl_multi_val_product(
6048                 __isl_take isl_multi_val *mv1,
6049                 __isl_take isl_multi_val *mv2);
6051         #include <isl/aff.h>
6052         __isl_give isl_multi_aff *isl_multi_aff_range_product(
6053                 __isl_take isl_multi_aff *ma1,
6054                 __isl_take isl_multi_aff *ma2);
6055         __isl_give isl_multi_aff *isl_multi_aff_product(
6056                 __isl_take isl_multi_aff *ma1,
6057                 __isl_take isl_multi_aff *ma2);
6058         __isl_give isl_multi_pw_aff *
6059         isl_multi_pw_aff_range_product(
6060                 __isl_take isl_multi_pw_aff *mpa1,
6061                 __isl_take isl_multi_pw_aff *mpa2);
6062         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
6063                 __isl_take isl_multi_pw_aff *mpa1,
6064                 __isl_take isl_multi_pw_aff *mpa2);
6065         __isl_give isl_pw_multi_aff *
6066         isl_pw_multi_aff_range_product(
6067                 __isl_take isl_pw_multi_aff *pma1,
6068                 __isl_take isl_pw_multi_aff *pma2);
6069         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
6070                 __isl_take isl_pw_multi_aff *pma1,
6071                 __isl_take isl_pw_multi_aff *pma2);
6072         __isl_give isl_multi_union_pw_aff *
6073         isl_multi_union_pw_aff_range_product(
6074                 __isl_take isl_multi_union_pw_aff *mupa1,
6075                 __isl_take isl_multi_union_pw_aff *mupa2);
6077 The above functions compute the cross product of the given
6078 sets, relations or functions.  The domains and ranges of the results
6079 are wrapped maps between domains and ranges of the inputs.
6080 To obtain a ``flat'' product, use the following functions
6081 instead.
6083         #include <isl/set.h>
6084         __isl_give isl_basic_set *isl_basic_set_flat_product(
6085                 __isl_take isl_basic_set *bset1,
6086                 __isl_take isl_basic_set *bset2);
6087         __isl_give isl_set *isl_set_flat_product(
6088                 __isl_take isl_set *set1,
6089                 __isl_take isl_set *set2);
6091         #include <isl/map.h>
6092         __isl_give isl_basic_map *isl_basic_map_flat_range_product(
6093                 __isl_take isl_basic_map *bmap1,
6094                 __isl_take isl_basic_map *bmap2);
6095         __isl_give isl_map *isl_map_flat_domain_product(
6096                 __isl_take isl_map *map1,
6097                 __isl_take isl_map *map2);
6098         __isl_give isl_map *isl_map_flat_range_product(
6099                 __isl_take isl_map *map1,
6100                 __isl_take isl_map *map2);
6101         __isl_give isl_basic_map *isl_basic_map_flat_product(
6102                 __isl_take isl_basic_map *bmap1,
6103                 __isl_take isl_basic_map *bmap2);
6104         __isl_give isl_map *isl_map_flat_product(
6105                 __isl_take isl_map *map1,
6106                 __isl_take isl_map *map2);
6108         #include <isl/union_map.h>
6109         __isl_give isl_union_map *
6110         isl_union_map_flat_domain_product(
6111                 __isl_take isl_union_map *umap1,
6112                 __isl_take isl_union_map *umap2);
6113         __isl_give isl_union_map *
6114         isl_union_map_flat_range_product(
6115                 __isl_take isl_union_map *umap1,
6116                 __isl_take isl_union_map *umap2);
6118         #include <isl/val.h>
6119         __isl_give isl_multi_val *isl_multi_val_flat_range_product(
6120                 __isl_take isl_multi_val *mv1,
6121                 __isl_take isl_multi_aff *mv2);
6123         #include <isl/aff.h>
6124         __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
6125                 __isl_take isl_multi_aff *ma1,
6126                 __isl_take isl_multi_aff *ma2);
6127         __isl_give isl_pw_multi_aff *
6128         isl_pw_multi_aff_flat_range_product(
6129                 __isl_take isl_pw_multi_aff *pma1,
6130                 __isl_take isl_pw_multi_aff *pma2);
6131         __isl_give isl_multi_pw_aff *
6132         isl_multi_pw_aff_flat_range_product(
6133                 __isl_take isl_multi_pw_aff *mpa1,
6134                 __isl_take isl_multi_pw_aff *mpa2);
6135         __isl_give isl_union_pw_multi_aff *
6136         isl_union_pw_multi_aff_flat_range_product(
6137                 __isl_take isl_union_pw_multi_aff *upma1,
6138                 __isl_take isl_union_pw_multi_aff *upma2);
6139         __isl_give isl_multi_union_pw_aff *
6140         isl_multi_union_pw_aff_flat_range_product(
6141                 __isl_take isl_multi_union_pw_aff *mupa1,
6142                 __isl_take isl_multi_union_pw_aff *mupa2);
6144         #include <isl/space.h>
6145         __isl_give isl_space *isl_space_factor_domain(
6146                 __isl_take isl_space *space);
6147         __isl_give isl_space *isl_space_factor_range(
6148                 __isl_take isl_space *space);
6149         __isl_give isl_space *isl_space_domain_factor_domain(
6150                 __isl_take isl_space *space);
6151         __isl_give isl_space *isl_space_domain_factor_range(
6152                 __isl_take isl_space *space);
6153         __isl_give isl_space *isl_space_range_factor_domain(
6154                 __isl_take isl_space *space);
6155         __isl_give isl_space *isl_space_range_factor_range(
6156                 __isl_take isl_space *space);
6158 The functions C<isl_space_range_factor_domain> and
6159 C<isl_space_range_factor_range> extract the two arguments from
6160 the result of a call to C<isl_space_range_product>.
6162 The arguments of a call to C<isl_map_range_product> can be extracted
6163 from the result using the following functions.
6165         #include <isl/map.h>
6166         __isl_give isl_map *isl_map_factor_domain(
6167                 __isl_take isl_map *map);
6168         __isl_give isl_map *isl_map_factor_range(
6169                 __isl_take isl_map *map);
6170         __isl_give isl_map *isl_map_domain_factor_domain(
6171                 __isl_take isl_map *map);
6172         __isl_give isl_map *isl_map_domain_factor_range(
6173                 __isl_take isl_map *map);
6174         __isl_give isl_map *isl_map_range_factor_domain(
6175                 __isl_take isl_map *map);
6176         __isl_give isl_map *isl_map_range_factor_range(
6177                 __isl_take isl_map *map);
6179         #include <isl/union_map.h>
6180         __isl_give isl_union_map *isl_union_map_factor_domain(
6181                 __isl_take isl_union_map *umap);
6182         __isl_give isl_union_map *isl_union_map_factor_range(
6183                 __isl_take isl_union_map *umap);
6184         __isl_give isl_union_map *
6185         isl_union_map_domain_factor_domain(
6186                 __isl_take isl_union_map *umap);
6187         __isl_give isl_union_map *
6188         isl_union_map_domain_factor_range(
6189                 __isl_take isl_union_map *umap);
6190         __isl_give isl_union_map *
6191         isl_union_map_range_factor_range(
6192                 __isl_take isl_union_map *umap);
6194         #include <isl/val.h>
6195         __isl_give isl_multi_val *
6196         isl_multi_val_range_factor_domain(
6197                 __isl_take isl_multi_val *mv);
6198         __isl_give isl_multi_val *
6199         isl_multi_val_range_factor_range(
6200                 __isl_take isl_multi_val *mv);
6202         #include <isl/aff.h>
6203         __isl_give isl_multi_aff *
6204         isl_multi_aff_range_factor_domain(
6205                 __isl_take isl_multi_aff *ma);
6206         __isl_give isl_multi_aff *
6207         isl_multi_aff_range_factor_range(
6208                 __isl_take isl_multi_aff *ma);
6209         __isl_give isl_multi_pw_aff *
6210         isl_multi_pw_aff_range_factor_domain(
6211                 __isl_take isl_multi_pw_aff *mpa);
6212         __isl_give isl_multi_pw_aff *
6213         isl_multi_pw_aff_range_factor_range(
6214                 __isl_take isl_multi_pw_aff *mpa);
6215         __isl_give isl_multi_union_pw_aff *
6216         isl_multi_union_pw_aff_range_factor_domain(
6217                 __isl_take isl_multi_union_pw_aff *mupa);
6218         __isl_give isl_multi_union_pw_aff *
6219         isl_multi_union_pw_aff_range_factor_range(
6220                 __isl_take isl_multi_union_pw_aff *mupa);
6222 The splice functions are a generalization of the flat product functions,
6223 where the second argument may be inserted at any position inside
6224 the first argument rather than being placed at the end.
6226         #include <isl/val.h>
6227         __isl_give isl_multi_val *isl_multi_val_range_splice(
6228                 __isl_take isl_multi_val *mv1, unsigned pos,
6229                 __isl_take isl_multi_val *mv2);
6231         #include <isl/aff.h>
6232         __isl_give isl_multi_aff *isl_multi_aff_range_splice(
6233                 __isl_take isl_multi_aff *ma1, unsigned pos,
6234                 __isl_take isl_multi_aff *ma2);
6235         __isl_give isl_multi_aff *isl_multi_aff_splice(
6236                 __isl_take isl_multi_aff *ma1,
6237                 unsigned in_pos, unsigned out_pos,
6238                 __isl_take isl_multi_aff *ma2);
6239         __isl_give isl_multi_pw_aff *
6240         isl_multi_pw_aff_range_splice(
6241                 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
6242                 __isl_take isl_multi_pw_aff *mpa2);
6243         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
6244                 __isl_take isl_multi_pw_aff *mpa1,
6245                 unsigned in_pos, unsigned out_pos,
6246                 __isl_take isl_multi_pw_aff *mpa2);
6247         __isl_give isl_multi_union_pw_aff *
6248         isl_multi_union_pw_aff_range_splice(
6249                 __isl_take isl_multi_union_pw_aff *mupa1,
6250                 unsigned pos,
6251                 __isl_take isl_multi_union_pw_aff *mupa2);
6253 =item * Simplification
6255 When applied to a set or relation,
6256 the gist operation returns a set or relation that has the
6257 same intersection with the context as the input set or relation.
6258 Any implicit equality in the intersection is made explicit in the result,
6259 while all inequalities that are redundant with respect to the intersection
6260 are removed.
6261 In case of union sets and relations, the gist operation is performed
6262 per space.
6264 When applied to a function,
6265 the gist operation applies the set gist operation to each of
6266 the cells in the domain of the input piecewise expression.
6267 The context is also exploited
6268 to simplify the expression associated to each cell.
6270         #include <isl/set.h>
6271         __isl_give isl_basic_set *isl_basic_set_gist(
6272                 __isl_take isl_basic_set *bset,
6273                 __isl_take isl_basic_set *context);
6274         __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
6275                 __isl_take isl_set *context);
6276         __isl_give isl_set *isl_set_gist_params(
6277                 __isl_take isl_set *set,
6278                 __isl_take isl_set *context);
6280         #include <isl/map.h>
6281         __isl_give isl_basic_map *isl_basic_map_gist(
6282                 __isl_take isl_basic_map *bmap,
6283                 __isl_take isl_basic_map *context);
6284         __isl_give isl_basic_map *isl_basic_map_gist_domain(
6285                 __isl_take isl_basic_map *bmap,
6286                 __isl_take isl_basic_set *context);
6287         __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
6288                 __isl_take isl_map *context);
6289         __isl_give isl_map *isl_map_gist_params(
6290                 __isl_take isl_map *map,
6291                 __isl_take isl_set *context);
6292         __isl_give isl_map *isl_map_gist_domain(
6293                 __isl_take isl_map *map,
6294                 __isl_take isl_set *context);
6295         __isl_give isl_map *isl_map_gist_range(
6296                 __isl_take isl_map *map,
6297                 __isl_take isl_set *context);
6299         #include <isl/union_set.h>
6300         __isl_give isl_union_set *isl_union_set_gist(
6301                 __isl_take isl_union_set *uset,
6302                 __isl_take isl_union_set *context);
6303         __isl_give isl_union_set *isl_union_set_gist_params(
6304                 __isl_take isl_union_set *uset,
6305                 __isl_take isl_set *set);
6307         #include <isl/union_map.h>
6308         __isl_give isl_union_map *isl_union_map_gist(
6309                 __isl_take isl_union_map *umap,
6310                 __isl_take isl_union_map *context);
6311         __isl_give isl_union_map *isl_union_map_gist_params(
6312                 __isl_take isl_union_map *umap,
6313                 __isl_take isl_set *set);
6314         __isl_give isl_union_map *isl_union_map_gist_domain(
6315                 __isl_take isl_union_map *umap,
6316                 __isl_take isl_union_set *uset);
6317         __isl_give isl_union_map *isl_union_map_gist_range(
6318                 __isl_take isl_union_map *umap,
6319                 __isl_take isl_union_set *uset);
6321         #include <isl/aff.h>
6322         __isl_give isl_aff *isl_aff_gist_params(
6323                 __isl_take isl_aff *aff,
6324                 __isl_take isl_set *context);
6325         __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
6326                 __isl_take isl_set *context);
6327         __isl_give isl_multi_aff *isl_multi_aff_gist_params(
6328                 __isl_take isl_multi_aff *maff,
6329                 __isl_take isl_set *context);
6330         __isl_give isl_multi_aff *isl_multi_aff_gist(
6331                 __isl_take isl_multi_aff *maff,
6332                 __isl_take isl_set *context);
6333         __isl_give isl_pw_aff *isl_pw_aff_gist_params(
6334                 __isl_take isl_pw_aff *pwaff,
6335                 __isl_take isl_set *context);
6336         __isl_give isl_pw_aff *isl_pw_aff_gist(
6337                 __isl_take isl_pw_aff *pwaff,
6338                 __isl_take isl_set *context);
6339         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
6340                 __isl_take isl_pw_multi_aff *pma,
6341                 __isl_take isl_set *set);
6342         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
6343                 __isl_take isl_pw_multi_aff *pma,
6344                 __isl_take isl_set *set);
6345         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
6346                 __isl_take isl_multi_pw_aff *mpa,
6347                 __isl_take isl_set *set);
6348         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
6349                 __isl_take isl_multi_pw_aff *mpa,
6350                 __isl_take isl_set *set);
6351         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
6352                 __isl_take isl_union_pw_aff *upa,
6353                 __isl_take isl_union_set *context);
6354         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
6355                 __isl_take isl_union_pw_aff *upa,
6356                 __isl_take isl_set *context);
6357         __isl_give isl_union_pw_multi_aff *
6358         isl_union_pw_multi_aff_gist_params(
6359                 __isl_take isl_union_pw_multi_aff *upma,
6360                 __isl_take isl_set *context);
6361         __isl_give isl_union_pw_multi_aff *
6362         isl_union_pw_multi_aff_gist(
6363                 __isl_take isl_union_pw_multi_aff *upma,
6364                 __isl_take isl_union_set *context);
6365         __isl_give isl_multi_union_pw_aff *
6366         isl_multi_union_pw_aff_gist_params(
6367                 __isl_take isl_multi_union_pw_aff *aff,
6368                 __isl_take isl_set *context);
6369         __isl_give isl_multi_union_pw_aff *
6370         isl_multi_union_pw_aff_gist(
6371                 __isl_take isl_multi_union_pw_aff *aff,
6372                 __isl_take isl_union_set *context);
6374         #include <isl/polynomial.h>
6375         __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
6376                 __isl_take isl_qpolynomial *qp,
6377                 __isl_take isl_set *context);
6378         __isl_give isl_qpolynomial *isl_qpolynomial_gist(
6379                 __isl_take isl_qpolynomial *qp,
6380                 __isl_take isl_set *context);
6381         __isl_give isl_qpolynomial_fold *
6382         isl_qpolynomial_fold_gist_params(
6383                 __isl_take isl_qpolynomial_fold *fold,
6384                 __isl_take isl_set *context);
6385         __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
6386                 __isl_take isl_qpolynomial_fold *fold,
6387                 __isl_take isl_set *context);
6388         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
6389                 __isl_take isl_pw_qpolynomial *pwqp,
6390                 __isl_take isl_set *context);
6391         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
6392                 __isl_take isl_pw_qpolynomial *pwqp,
6393                 __isl_take isl_set *context);
6394         __isl_give isl_pw_qpolynomial_fold *
6395         isl_pw_qpolynomial_fold_gist(
6396                 __isl_take isl_pw_qpolynomial_fold *pwf,
6397                 __isl_take isl_set *context);
6398         __isl_give isl_pw_qpolynomial_fold *
6399         isl_pw_qpolynomial_fold_gist_params(
6400                 __isl_take isl_pw_qpolynomial_fold *pwf,
6401                 __isl_take isl_set *context);
6402         __isl_give isl_union_pw_qpolynomial *
6403         isl_union_pw_qpolynomial_gist_params(
6404                 __isl_take isl_union_pw_qpolynomial *upwqp,
6405                 __isl_take isl_set *context);
6406         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
6407                 __isl_take isl_union_pw_qpolynomial *upwqp,
6408                 __isl_take isl_union_set *context);
6409         __isl_give isl_union_pw_qpolynomial_fold *
6410         isl_union_pw_qpolynomial_fold_gist(
6411                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6412                 __isl_take isl_union_set *context);
6413         __isl_give isl_union_pw_qpolynomial_fold *
6414         isl_union_pw_qpolynomial_fold_gist_params(
6415                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6416                 __isl_take isl_set *context);
6418 =item * Binary Arithmethic Operations
6420         #include <isl/val.h>
6421         __isl_give isl_multi_val *isl_multi_val_sub(
6422                 __isl_take isl_multi_val *mv1,
6423                 __isl_take isl_multi_val *mv2);
6425         #include <isl/aff.h>
6426         __isl_give isl_aff *isl_aff_add(
6427                 __isl_take isl_aff *aff1,
6428                 __isl_take isl_aff *aff2);
6429         __isl_give isl_multi_aff *isl_multi_aff_add(
6430                 __isl_take isl_multi_aff *maff1,
6431                 __isl_take isl_multi_aff *maff2);
6432         __isl_give isl_pw_aff *isl_pw_aff_add(
6433                 __isl_take isl_pw_aff *pwaff1,
6434                 __isl_take isl_pw_aff *pwaff2);
6435         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
6436                 __isl_take isl_pw_multi_aff *pma1,
6437                 __isl_take isl_pw_multi_aff *pma2);
6438         __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
6439                 __isl_take isl_union_pw_aff *upa1,
6440                 __isl_take isl_union_pw_aff *upa2);
6441         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
6442                 __isl_take isl_union_pw_multi_aff *upma1,
6443                 __isl_take isl_union_pw_multi_aff *upma2);
6444         __isl_give isl_pw_aff *isl_pw_aff_min(
6445                 __isl_take isl_pw_aff *pwaff1,
6446                 __isl_take isl_pw_aff *pwaff2);
6447         __isl_give isl_pw_aff *isl_pw_aff_max(
6448                 __isl_take isl_pw_aff *pwaff1,
6449                 __isl_take isl_pw_aff *pwaff2);
6450         __isl_give isl_aff *isl_aff_sub(
6451                 __isl_take isl_aff *aff1,
6452                 __isl_take isl_aff *aff2);
6453         __isl_give isl_multi_aff *isl_multi_aff_sub(
6454                 __isl_take isl_multi_aff *ma1,
6455                 __isl_take isl_multi_aff *ma2);
6456         __isl_give isl_pw_aff *isl_pw_aff_sub(
6457                 __isl_take isl_pw_aff *pwaff1,
6458                 __isl_take isl_pw_aff *pwaff2);
6459         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
6460                 __isl_take isl_multi_pw_aff *mpa1,
6461                 __isl_take isl_multi_pw_aff *mpa2);
6462         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
6463                 __isl_take isl_pw_multi_aff *pma1,
6464                 __isl_take isl_pw_multi_aff *pma2);
6465         __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
6466                 __isl_take isl_union_pw_aff *upa1,
6467                 __isl_take isl_union_pw_aff *upa2);
6468         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
6469                 __isl_take isl_union_pw_multi_aff *upma1,
6470                 __isl_take isl_union_pw_multi_aff *upma2);
6471         __isl_give isl_multi_union_pw_aff *
6472         isl_multi_union_pw_aff_sub(
6473                 __isl_take isl_multi_union_pw_aff *mupa1,
6474                 __isl_take isl_multi_union_pw_aff *mupa2);
6476 C<isl_aff_sub> subtracts the second argument from the first.
6478         #include <isl/polynomial.h>
6479         __isl_give isl_qpolynomial *isl_qpolynomial_add(
6480                 __isl_take isl_qpolynomial *qp1,
6481                 __isl_take isl_qpolynomial *qp2);
6482         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
6483                 __isl_take isl_pw_qpolynomial *pwqp1,
6484                 __isl_take isl_pw_qpolynomial *pwqp2);
6485         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
6486                 __isl_take isl_pw_qpolynomial *pwqp1,
6487                 __isl_take isl_pw_qpolynomial *pwqp2);
6488         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
6489                 __isl_take isl_pw_qpolynomial_fold *pwf1,
6490                 __isl_take isl_pw_qpolynomial_fold *pwf2);
6491         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
6492                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6493                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6494         __isl_give isl_qpolynomial *isl_qpolynomial_sub(
6495                 __isl_take isl_qpolynomial *qp1,
6496                 __isl_take isl_qpolynomial *qp2);
6497         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
6498                 __isl_take isl_pw_qpolynomial *pwqp1,
6499                 __isl_take isl_pw_qpolynomial *pwqp2);
6500         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
6501                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6502                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6503         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
6504                 __isl_take isl_pw_qpolynomial_fold *pwf1,
6505                 __isl_take isl_pw_qpolynomial_fold *pwf2);
6506         __isl_give isl_union_pw_qpolynomial_fold *
6507         isl_union_pw_qpolynomial_fold_fold(
6508                 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
6509                 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
6511         #include <isl/aff.h>
6512         __isl_give isl_pw_aff *isl_pw_aff_union_add(
6513                 __isl_take isl_pw_aff *pwaff1,
6514                 __isl_take isl_pw_aff *pwaff2);
6515         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
6516                 __isl_take isl_pw_multi_aff *pma1,
6517                 __isl_take isl_pw_multi_aff *pma2);
6518         __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
6519                 __isl_take isl_union_pw_aff *upa1,
6520                 __isl_take isl_union_pw_aff *upa2);
6521         __isl_give isl_union_pw_multi_aff *
6522         isl_union_pw_multi_aff_union_add(
6523                 __isl_take isl_union_pw_multi_aff *upma1,
6524                 __isl_take isl_union_pw_multi_aff *upma2);
6525         __isl_give isl_multi_union_pw_aff *
6526         isl_multi_union_pw_aff_union_add(
6527                 __isl_take isl_multi_union_pw_aff *mupa1,
6528                 __isl_take isl_multi_union_pw_aff *mupa2);
6529         __isl_give isl_pw_aff *isl_pw_aff_union_min(
6530                 __isl_take isl_pw_aff *pwaff1,
6531                 __isl_take isl_pw_aff *pwaff2);
6532         __isl_give isl_pw_aff *isl_pw_aff_union_max(
6533                 __isl_take isl_pw_aff *pwaff1,
6534                 __isl_take isl_pw_aff *pwaff2);
6536 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
6537 expression with a domain that is the union of those of C<pwaff1> and
6538 C<pwaff2> and such that on each cell, the quasi-affine expression is
6539 the maximum of those of C<pwaff1> and C<pwaff2>.  If only one of
6540 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
6541 associated expression is the defined one.
6542 This in contrast to the C<isl_pw_aff_max> function, which is
6543 only defined on the shared definition domain of the arguments.
6545         #include <isl/val.h>
6546         __isl_give isl_multi_val *isl_multi_val_add_val(
6547                 __isl_take isl_multi_val *mv,
6548                 __isl_take isl_val *v);
6549         __isl_give isl_multi_val *isl_multi_val_mod_val(
6550                 __isl_take isl_multi_val *mv,
6551                 __isl_take isl_val *v);
6552         __isl_give isl_multi_val *isl_multi_val_scale_val(
6553                 __isl_take isl_multi_val *mv,
6554                 __isl_take isl_val *v);
6555         __isl_give isl_multi_val *isl_multi_val_scale_down_val(
6556                 __isl_take isl_multi_val *mv,
6557                 __isl_take isl_val *v);
6559         #include <isl/aff.h>
6560         __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
6561                 __isl_take isl_val *mod);
6562         __isl_give isl_pw_aff *isl_pw_aff_mod_val(
6563                 __isl_take isl_pw_aff *pa,
6564                 __isl_take isl_val *mod);
6565         __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
6566                 __isl_take isl_union_pw_aff *upa,
6567                 __isl_take isl_val *f);
6568         __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
6569                 __isl_take isl_val *v);
6570         __isl_give isl_multi_aff *isl_multi_aff_scale_val(
6571                 __isl_take isl_multi_aff *ma,
6572                 __isl_take isl_val *v);
6573         __isl_give isl_pw_aff *isl_pw_aff_scale_val(
6574                 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
6575         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
6576                 __isl_take isl_multi_pw_aff *mpa,
6577                 __isl_take isl_val *v);
6578         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
6579                 __isl_take isl_pw_multi_aff *pma,
6580                 __isl_take isl_val *v);
6581         __isl_give isl_union_pw_multi_aff *
6582         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
6583                 __isl_take isl_union_pw_aff *upa,
6584                 __isl_take isl_val *f);
6585         isl_union_pw_multi_aff_scale_val(
6586                 __isl_take isl_union_pw_multi_aff *upma,
6587                 __isl_take isl_val *val);
6588         __isl_give isl_multi_union_pw_aff *
6589         isl_multi_union_pw_aff_scale_val(
6590                 __isl_take isl_multi_union_pw_aff *mupa,
6591                 __isl_take isl_val *v);
6592         __isl_give isl_aff *isl_aff_scale_down_ui(
6593                 __isl_take isl_aff *aff, unsigned f);
6594         __isl_give isl_aff *isl_aff_scale_down_val(
6595                 __isl_take isl_aff *aff, __isl_take isl_val *v);
6596         __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
6597                 __isl_take isl_multi_aff *ma,
6598                 __isl_take isl_val *v);
6599         __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
6600                 __isl_take isl_pw_aff *pa,
6601                 __isl_take isl_val *f);
6602         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
6603                 __isl_take isl_multi_pw_aff *mpa,
6604                 __isl_take isl_val *v);
6605         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
6606                 __isl_take isl_pw_multi_aff *pma,
6607                 __isl_take isl_val *v);
6608         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
6609                 __isl_take isl_union_pw_aff *upa,
6610                 __isl_take isl_val *v);
6611         __isl_give isl_union_pw_multi_aff *
6612         isl_union_pw_multi_aff_scale_down_val(
6613                 __isl_take isl_union_pw_multi_aff *upma,
6614                 __isl_take isl_val *val);
6615         __isl_give isl_multi_union_pw_aff *
6616         isl_multi_union_pw_aff_scale_down_val(
6617                 __isl_take isl_multi_union_pw_aff *mupa,
6618                 __isl_take isl_val *v);
6620         #include <isl/polynomial.h>
6621         __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
6622                 __isl_take isl_qpolynomial *qp,
6623                 __isl_take isl_val *v);
6624         __isl_give isl_qpolynomial_fold *
6625         isl_qpolynomial_fold_scale_val(
6626                 __isl_take isl_qpolynomial_fold *fold,
6627                 __isl_take isl_val *v);
6628         __isl_give isl_pw_qpolynomial *
6629         isl_pw_qpolynomial_scale_val(
6630                 __isl_take isl_pw_qpolynomial *pwqp,
6631                 __isl_take isl_val *v);
6632         __isl_give isl_pw_qpolynomial_fold *
6633         isl_pw_qpolynomial_fold_scale_val(
6634                 __isl_take isl_pw_qpolynomial_fold *pwf,
6635                 __isl_take isl_val *v);
6636         __isl_give isl_union_pw_qpolynomial *
6637         isl_union_pw_qpolynomial_scale_val(
6638                 __isl_take isl_union_pw_qpolynomial *upwqp,
6639                 __isl_take isl_val *v);
6640         __isl_give isl_union_pw_qpolynomial_fold *
6641         isl_union_pw_qpolynomial_fold_scale_val(
6642                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6643                 __isl_take isl_val *v);
6644         __isl_give isl_qpolynomial *
6645         isl_qpolynomial_scale_down_val(
6646                 __isl_take isl_qpolynomial *qp,
6647                 __isl_take isl_val *v);
6648         __isl_give isl_qpolynomial_fold *
6649         isl_qpolynomial_fold_scale_down_val(
6650                 __isl_take isl_qpolynomial_fold *fold,
6651                 __isl_take isl_val *v);
6652         __isl_give isl_pw_qpolynomial *
6653         isl_pw_qpolynomial_scale_down_val(
6654                 __isl_take isl_pw_qpolynomial *pwqp,
6655                 __isl_take isl_val *v);
6656         __isl_give isl_pw_qpolynomial_fold *
6657         isl_pw_qpolynomial_fold_scale_down_val(
6658                 __isl_take isl_pw_qpolynomial_fold *pwf,
6659                 __isl_take isl_val *v);
6660         __isl_give isl_union_pw_qpolynomial *
6661         isl_union_pw_qpolynomial_scale_down_val(
6662                 __isl_take isl_union_pw_qpolynomial *upwqp,
6663                 __isl_take isl_val *v);
6664         __isl_give isl_union_pw_qpolynomial_fold *
6665         isl_union_pw_qpolynomial_fold_scale_down_val(
6666                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6667                 __isl_take isl_val *v);
6669         #include <isl/val.h>
6670         __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
6671                 __isl_take isl_multi_val *mv1,
6672                 __isl_take isl_multi_val *mv2);
6673         __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
6674                 __isl_take isl_multi_val *mv1,
6675                 __isl_take isl_multi_val *mv2);
6676         __isl_give isl_multi_val *
6677         isl_multi_val_scale_down_multi_val(
6678                 __isl_take isl_multi_val *mv1,
6679                 __isl_take isl_multi_val *mv2);
6681         #include <isl/aff.h>
6682         __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
6683                 __isl_take isl_multi_aff *ma,
6684                 __isl_take isl_multi_val *mv);
6685         __isl_give isl_multi_union_pw_aff *
6686         isl_multi_union_pw_aff_mod_multi_val(
6687                 __isl_take isl_multi_union_pw_aff *upma,
6688                 __isl_take isl_multi_val *mv);
6689         __isl_give isl_multi_pw_aff *
6690         isl_multi_pw_aff_mod_multi_val(
6691                 __isl_take isl_multi_pw_aff *mpa,
6692                 __isl_take isl_multi_val *mv);
6693         __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
6694                 __isl_take isl_multi_aff *ma,
6695                 __isl_take isl_multi_val *mv);
6696         __isl_give isl_pw_multi_aff *
6697         isl_pw_multi_aff_scale_multi_val(
6698                 __isl_take isl_pw_multi_aff *pma,
6699                 __isl_take isl_multi_val *mv);
6700         __isl_give isl_multi_pw_aff *
6701         isl_multi_pw_aff_scale_multi_val(
6702                 __isl_take isl_multi_pw_aff *mpa,
6703                 __isl_take isl_multi_val *mv);
6704         __isl_give isl_multi_union_pw_aff *
6705         isl_multi_union_pw_aff_scale_multi_val(
6706                 __isl_take isl_multi_union_pw_aff *mupa,
6707                 __isl_take isl_multi_val *mv);
6708         __isl_give isl_union_pw_multi_aff *
6709         isl_union_pw_multi_aff_scale_multi_val(
6710                 __isl_take isl_union_pw_multi_aff *upma,
6711                 __isl_take isl_multi_val *mv);
6712         __isl_give isl_multi_aff *
6713         isl_multi_aff_scale_down_multi_val(
6714                 __isl_take isl_multi_aff *ma,
6715                 __isl_take isl_multi_val *mv);
6716         __isl_give isl_multi_pw_aff *
6717         isl_multi_pw_aff_scale_down_multi_val(
6718                 __isl_take isl_multi_pw_aff *mpa,
6719                 __isl_take isl_multi_val *mv);
6720         __isl_give isl_multi_union_pw_aff *
6721         isl_multi_union_pw_aff_scale_down_multi_val(
6722                 __isl_take isl_multi_union_pw_aff *mupa,
6723                 __isl_take isl_multi_val *mv);
6725 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
6726 by the corresponding elements of C<mv>.
6728         #include <isl/aff.h>
6729         __isl_give isl_aff *isl_aff_mul(
6730                 __isl_take isl_aff *aff1,
6731                 __isl_take isl_aff *aff2);
6732         __isl_give isl_aff *isl_aff_div(
6733                 __isl_take isl_aff *aff1,
6734                 __isl_take isl_aff *aff2);
6735         __isl_give isl_pw_aff *isl_pw_aff_mul(
6736                 __isl_take isl_pw_aff *pwaff1,
6737                 __isl_take isl_pw_aff *pwaff2);
6738         __isl_give isl_pw_aff *isl_pw_aff_div(
6739                 __isl_take isl_pw_aff *pa1,
6740                 __isl_take isl_pw_aff *pa2);
6741         __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
6742                 __isl_take isl_pw_aff *pa1,
6743                 __isl_take isl_pw_aff *pa2);
6744         __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
6745                 __isl_take isl_pw_aff *pa1,
6746                 __isl_take isl_pw_aff *pa2);
6748 When multiplying two affine expressions, at least one of the two needs
6749 to be a constant.  Similarly, when dividing an affine expression by another,
6750 the second expression needs to be a constant.
6751 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
6752 rounding towards zero.  C<isl_pw_aff_tdiv_r> computes the corresponding
6753 remainder.
6755         #include <isl/polynomial.h>
6756         __isl_give isl_qpolynomial *isl_qpolynomial_mul(
6757                 __isl_take isl_qpolynomial *qp1,
6758                 __isl_take isl_qpolynomial *qp2);
6759         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
6760                 __isl_take isl_pw_qpolynomial *pwqp1,
6761                 __isl_take isl_pw_qpolynomial *pwqp2);
6762         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
6763                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6764                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6766 =back
6768 =head3 Lexicographic Optimization
6770 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
6771 the following functions
6772 compute a set that contains the lexicographic minimum or maximum
6773 of the elements in C<set> (or C<bset>) for those values of the parameters
6774 that satisfy C<dom>.
6775 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6776 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
6777 has no elements.
6778 In other words, the union of the parameter values
6779 for which the result is non-empty and of C<*empty>
6780 is equal to C<dom>.
6782         #include <isl/set.h>
6783         __isl_give isl_set *isl_basic_set_partial_lexmin(
6784                 __isl_take isl_basic_set *bset,
6785                 __isl_take isl_basic_set *dom,
6786                 __isl_give isl_set **empty);
6787         __isl_give isl_set *isl_basic_set_partial_lexmax(
6788                 __isl_take isl_basic_set *bset,
6789                 __isl_take isl_basic_set *dom,
6790                 __isl_give isl_set **empty);
6791         __isl_give isl_set *isl_set_partial_lexmin(
6792                 __isl_take isl_set *set, __isl_take isl_set *dom,
6793                 __isl_give isl_set **empty);
6794         __isl_give isl_set *isl_set_partial_lexmax(
6795                 __isl_take isl_set *set, __isl_take isl_set *dom,
6796                 __isl_give isl_set **empty);
6798 Given a (basic) set C<set> (or C<bset>), the following functions simply
6799 return a set containing the lexicographic minimum or maximum
6800 of the elements in C<set> (or C<bset>).
6801 In case of union sets, the optimum is computed per space.
6803         #include <isl/set.h>
6804         __isl_give isl_set *isl_basic_set_lexmin(
6805                 __isl_take isl_basic_set *bset);
6806         __isl_give isl_set *isl_basic_set_lexmax(
6807                 __isl_take isl_basic_set *bset);
6808         __isl_give isl_set *isl_set_lexmin(
6809                 __isl_take isl_set *set);
6810         __isl_give isl_set *isl_set_lexmax(
6811                 __isl_take isl_set *set);
6812         __isl_give isl_union_set *isl_union_set_lexmin(
6813                 __isl_take isl_union_set *uset);
6814         __isl_give isl_union_set *isl_union_set_lexmax(
6815                 __isl_take isl_union_set *uset);
6817 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
6818 the following functions
6819 compute a relation that maps each element of C<dom>
6820 to the single lexicographic minimum or maximum
6821 of the elements that are associated to that same
6822 element in C<map> (or C<bmap>).
6823 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6824 that contains the elements in C<dom> that do not map
6825 to any elements in C<map> (or C<bmap>).
6826 In other words, the union of the domain of the result and of C<*empty>
6827 is equal to C<dom>.
6829         #include <isl/map.h>
6830         __isl_give isl_map *isl_basic_map_partial_lexmax(
6831                 __isl_take isl_basic_map *bmap,
6832                 __isl_take isl_basic_set *dom,
6833                 __isl_give isl_set **empty);
6834         __isl_give isl_map *isl_basic_map_partial_lexmin(
6835                 __isl_take isl_basic_map *bmap,
6836                 __isl_take isl_basic_set *dom,
6837                 __isl_give isl_set **empty);
6838         __isl_give isl_map *isl_map_partial_lexmax(
6839                 __isl_take isl_map *map, __isl_take isl_set *dom,
6840                 __isl_give isl_set **empty);
6841         __isl_give isl_map *isl_map_partial_lexmin(
6842                 __isl_take isl_map *map, __isl_take isl_set *dom,
6843                 __isl_give isl_set **empty);
6845 Given a (basic) map C<map> (or C<bmap>), the following functions simply
6846 return a map mapping each element in the domain of
6847 C<map> (or C<bmap>) to the lexicographic minimum or maximum
6848 of all elements associated to that element.
6849 In case of union relations, the optimum is computed per space.
6851         #include <isl/map.h>
6852         __isl_give isl_map *isl_basic_map_lexmin(
6853                 __isl_take isl_basic_map *bmap);
6854         __isl_give isl_map *isl_basic_map_lexmax(
6855                 __isl_take isl_basic_map *bmap);
6856         __isl_give isl_map *isl_map_lexmin(
6857                 __isl_take isl_map *map);
6858         __isl_give isl_map *isl_map_lexmax(
6859                 __isl_take isl_map *map);
6860         __isl_give isl_union_map *isl_union_map_lexmin(
6861                 __isl_take isl_union_map *umap);
6862         __isl_give isl_union_map *isl_union_map_lexmax(
6863                 __isl_take isl_union_map *umap);
6865 The following functions return their result in the form of
6866 a piecewise multi-affine expression,
6867 but are otherwise equivalent to the corresponding functions
6868 returning a basic set or relation.
6870         #include <isl/set.h>
6871         __isl_give isl_pw_multi_aff *
6872         isl_basic_set_partial_lexmin_pw_multi_aff(
6873                 __isl_take isl_basic_set *bset,
6874                 __isl_take isl_basic_set *dom,
6875                 __isl_give isl_set **empty);
6876         __isl_give isl_pw_multi_aff *
6877         isl_basic_set_partial_lexmax_pw_multi_aff(
6878                 __isl_take isl_basic_set *bset,
6879                 __isl_take isl_basic_set *dom,
6880                 __isl_give isl_set **empty);
6881         __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
6882                 __isl_take isl_set *set);
6883         __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
6884                 __isl_take isl_set *set);
6886         #include <isl/map.h>
6887         __isl_give isl_pw_multi_aff *
6888         isl_basic_map_lexmin_pw_multi_aff(
6889                 __isl_take isl_basic_map *bmap);
6890         __isl_give isl_pw_multi_aff *
6891         isl_basic_map_partial_lexmin_pw_multi_aff(
6892                 __isl_take isl_basic_map *bmap,
6893                 __isl_take isl_basic_set *dom,
6894                 __isl_give isl_set **empty);
6895         __isl_give isl_pw_multi_aff *
6896         isl_basic_map_partial_lexmax_pw_multi_aff(
6897                 __isl_take isl_basic_map *bmap,
6898                 __isl_take isl_basic_set *dom,
6899                 __isl_give isl_set **empty);
6900         __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
6901                 __isl_take isl_map *map);
6902         __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
6903                 __isl_take isl_map *map);
6905 The following functions return the lexicographic minimum or maximum
6906 on the shared domain of the inputs and the single defined function
6907 on those parts of the domain where only a single function is defined.
6909         #include <isl/aff.h>
6910         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
6911                 __isl_take isl_pw_multi_aff *pma1,
6912                 __isl_take isl_pw_multi_aff *pma2);
6913         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
6914                 __isl_take isl_pw_multi_aff *pma1,
6915                 __isl_take isl_pw_multi_aff *pma2);
6917 =head2 Ternary Operations
6919         #include <isl/aff.h>
6920         __isl_give isl_pw_aff *isl_pw_aff_cond(
6921                 __isl_take isl_pw_aff *cond,
6922                 __isl_take isl_pw_aff *pwaff_true,
6923                 __isl_take isl_pw_aff *pwaff_false);
6925 The function C<isl_pw_aff_cond> performs a conditional operator
6926 and returns an expression that is equal to C<pwaff_true>
6927 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
6928 where C<cond> is zero.
6930 =head2 Lists
6932 Lists are defined over several element types, including
6933 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_union_pw_aff>,
6934 C<isl_union_pw_multi_aff>, C<isl_constraint>,
6935 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
6936 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
6937 Here we take lists of C<isl_set>s as an example.
6938 Lists can be created, copied, modified and freed using the following functions.
6940         #include <isl/set.h>
6941         __isl_give isl_set_list *isl_set_list_from_set(
6942                 __isl_take isl_set *el);
6943         __isl_give isl_set_list *isl_set_list_alloc(
6944                 isl_ctx *ctx, int n);
6945         __isl_give isl_set_list *isl_set_list_copy(
6946                 __isl_keep isl_set_list *list);
6947         __isl_give isl_set_list *isl_set_list_insert(
6948                 __isl_take isl_set_list *list, unsigned pos,
6949                 __isl_take isl_set *el);
6950         __isl_give isl_set_list *isl_set_list_add(
6951                 __isl_take isl_set_list *list,
6952                 __isl_take isl_set *el);
6953         __isl_give isl_set_list *isl_set_list_drop(
6954                 __isl_take isl_set_list *list,
6955                 unsigned first, unsigned n);
6956         __isl_give isl_set_list *isl_set_list_set_set(
6957                 __isl_take isl_set_list *list, int index,
6958                 __isl_take isl_set *set);
6959         __isl_give isl_set_list *isl_set_list_concat(
6960                 __isl_take isl_set_list *list1,
6961                 __isl_take isl_set_list *list2);
6962         __isl_give isl_set_list *isl_set_list_sort(
6963                 __isl_take isl_set_list *list,
6964                 int (*cmp)(__isl_keep isl_set *a,
6965                         __isl_keep isl_set *b, void *user),
6966                 void *user);
6967         __isl_null isl_set_list *isl_set_list_free(
6968                 __isl_take isl_set_list *list);
6970 C<isl_set_list_alloc> creates an empty list with an initial capacity
6971 for C<n> elements.  C<isl_set_list_insert> and C<isl_set_list_add>
6972 add elements to a list, increasing its capacity as needed.
6973 C<isl_set_list_from_set> creates a list with a single element.
6975 Lists can be inspected using the following functions.
6977         #include <isl/set.h>
6978         int isl_set_list_n_set(__isl_keep isl_set_list *list);
6979         __isl_give isl_set *isl_set_list_get_set(
6980                 __isl_keep isl_set_list *list, int index);
6981         int isl_set_list_foreach(__isl_keep isl_set_list *list,
6982                 int (*fn)(__isl_take isl_set *el, void *user),
6983                 void *user);
6984         int isl_set_list_foreach_scc(__isl_keep isl_set_list *list,
6985                 int (*follows)(__isl_keep isl_set *a,
6986                         __isl_keep isl_set *b, void *user),
6987                 void *follows_user
6988                 int (*fn)(__isl_take isl_set *el, void *user),
6989                 void *fn_user);
6991 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
6992 strongly connected components of the graph with as vertices the elements
6993 of C<list> and a directed edge from vertex C<b> to vertex C<a>
6994 iff C<follows(a, b)> returns C<1>.  The callbacks C<follows> and C<fn>
6995 should return C<-1> on error.
6997 Lists can be printed using
6999         #include <isl/set.h>
7000         __isl_give isl_printer *isl_printer_print_set_list(
7001                 __isl_take isl_printer *p,
7002                 __isl_keep isl_set_list *list);
7004 =head2 Associative arrays
7006 Associative arrays map isl objects of a specific type to isl objects
7007 of some (other) specific type.  They are defined for several pairs
7008 of types, including (C<isl_map>, C<isl_basic_set>),
7009 (C<isl_id>, C<isl_ast_expr>) and.
7010 (C<isl_id>, C<isl_pw_aff>).
7011 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
7012 as an example.
7014 Associative arrays can be created, copied and freed using
7015 the following functions.
7017         #include <isl/id_to_ast_expr.h>
7018         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
7019                 isl_ctx *ctx, int min_size);
7020         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
7021                 __isl_keep isl_id_to_ast_expr *id2expr);
7022         __isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
7023                 __isl_take isl_id_to_ast_expr *id2expr);
7025 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
7026 to specify the expected size of the associative array.
7027 The associative array will be grown automatically as needed.
7029 Associative arrays can be inspected using the following functions.
7031         #include <isl/id_to_ast_expr.h>
7032         int isl_id_to_ast_expr_has(
7033                 __isl_keep isl_id_to_ast_expr *id2expr,
7034                 __isl_keep isl_id *key);
7035         __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
7036                 __isl_keep isl_id_to_ast_expr *id2expr,
7037                 __isl_take isl_id *key);
7038         int isl_id_to_ast_expr_foreach(
7039                 __isl_keep isl_id_to_ast_expr *id2expr,
7040                 int (*fn)(__isl_take isl_id *key,
7041                         __isl_take isl_ast_expr *val, void *user),
7042                 void *user);
7044 They can be modified using the following function.
7046         #include <isl/id_to_ast_expr.h>
7047         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
7048                 __isl_take isl_id_to_ast_expr *id2expr,
7049                 __isl_take isl_id *key,
7050                 __isl_take isl_ast_expr *val);
7051         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
7052                 __isl_take isl_id_to_ast_expr *id2expr,
7053                 __isl_take isl_id *key);
7055 Associative arrays can be printed using the following function.
7057         #include <isl/id_to_ast_expr.h>
7058         __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
7059                 __isl_take isl_printer *p,
7060                 __isl_keep isl_id_to_ast_expr *id2expr);
7062 =head2 Vectors
7064 Vectors can be created, copied and freed using the following functions.
7066         #include <isl/vec.h>
7067         __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
7068                 unsigned size);
7069         __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
7070         __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
7072 Note that the elements of a newly created vector may have arbitrary values.
7073 The elements can be changed and inspected using the following functions.
7075         int isl_vec_size(__isl_keep isl_vec *vec);
7076         __isl_give isl_val *isl_vec_get_element_val(
7077                 __isl_keep isl_vec *vec, int pos);
7078         __isl_give isl_vec *isl_vec_set_element_si(
7079                 __isl_take isl_vec *vec, int pos, int v);
7080         __isl_give isl_vec *isl_vec_set_element_val(
7081                 __isl_take isl_vec *vec, int pos,
7082                 __isl_take isl_val *v);
7083         __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
7084                 int v);
7085         __isl_give isl_vec *isl_vec_set_val(
7086                 __isl_take isl_vec *vec, __isl_take isl_val *v);
7087         int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
7088                 __isl_keep isl_vec *vec2, int pos);
7090 C<isl_vec_get_element> will return a negative value if anything went wrong.
7091 In that case, the value of C<*v> is undefined.
7093 The following function can be used to concatenate two vectors.
7095         __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
7096                 __isl_take isl_vec *vec2);
7098 =head2 Matrices
7100 Matrices can be created, copied and freed using the following functions.
7102         #include <isl/mat.h>
7103         __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
7104                 unsigned n_row, unsigned n_col);
7105         __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
7106         __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
7108 Note that the elements of a newly created matrix may have arbitrary values.
7109 The elements can be changed and inspected using the following functions.
7111         int isl_mat_rows(__isl_keep isl_mat *mat);
7112         int isl_mat_cols(__isl_keep isl_mat *mat);
7113         __isl_give isl_val *isl_mat_get_element_val(
7114                 __isl_keep isl_mat *mat, int row, int col);
7115         __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
7116                 int row, int col, int v);
7117         __isl_give isl_mat *isl_mat_set_element_val(
7118                 __isl_take isl_mat *mat, int row, int col,
7119                 __isl_take isl_val *v);
7121 C<isl_mat_get_element> will return a negative value if anything went wrong.
7122 In that case, the value of C<*v> is undefined.
7124 The following function can be used to compute the (right) inverse
7125 of a matrix, i.e., a matrix such that the product of the original
7126 and the inverse (in that order) is a multiple of the identity matrix.
7127 The input matrix is assumed to be of full row-rank.
7129         __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
7131 The following function can be used to compute the (right) kernel
7132 (or null space) of a matrix, i.e., a matrix such that the product of
7133 the original and the kernel (in that order) is the zero matrix.
7135         __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
7137 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
7139 The following functions determine
7140 an upper or lower bound on a quasipolynomial over its domain.
7142         __isl_give isl_pw_qpolynomial_fold *
7143         isl_pw_qpolynomial_bound(
7144                 __isl_take isl_pw_qpolynomial *pwqp,
7145                 enum isl_fold type, int *tight);
7147         __isl_give isl_union_pw_qpolynomial_fold *
7148         isl_union_pw_qpolynomial_bound(
7149                 __isl_take isl_union_pw_qpolynomial *upwqp,
7150                 enum isl_fold type, int *tight);
7152 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
7153 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
7154 is the returned bound is known be tight, i.e., for each value
7155 of the parameters there is at least
7156 one element in the domain that reaches the bound.
7157 If the domain of C<pwqp> is not wrapping, then the bound is computed
7158 over all elements in that domain and the result has a purely parametric
7159 domain.  If the domain of C<pwqp> is wrapping, then the bound is
7160 computed over the range of the wrapped relation.  The domain of the
7161 wrapped relation becomes the domain of the result.
7163 =head2 Parametric Vertex Enumeration
7165 The parametric vertex enumeration described in this section
7166 is mainly intended to be used internally and by the C<barvinok>
7167 library.
7169         #include <isl/vertices.h>
7170         __isl_give isl_vertices *isl_basic_set_compute_vertices(
7171                 __isl_keep isl_basic_set *bset);
7173 The function C<isl_basic_set_compute_vertices> performs the
7174 actual computation of the parametric vertices and the chamber
7175 decomposition and store the result in an C<isl_vertices> object.
7176 This information can be queried by either iterating over all
7177 the vertices or iterating over all the chambers or cells
7178 and then iterating over all vertices that are active on the chamber.
7180         int isl_vertices_foreach_vertex(
7181                 __isl_keep isl_vertices *vertices,
7182                 int (*fn)(__isl_take isl_vertex *vertex, void *user),
7183                 void *user);
7185         int isl_vertices_foreach_cell(
7186                 __isl_keep isl_vertices *vertices,
7187                 int (*fn)(__isl_take isl_cell *cell, void *user),
7188                 void *user);
7189         int isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
7190                 int (*fn)(__isl_take isl_vertex *vertex, void *user),
7191                 void *user);
7193 Other operations that can be performed on an C<isl_vertices> object are
7194 the following.
7196         int isl_vertices_get_n_vertices(
7197                 __isl_keep isl_vertices *vertices);
7198         void isl_vertices_free(__isl_take isl_vertices *vertices);
7200 Vertices can be inspected and destroyed using the following functions.
7202         int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
7203         __isl_give isl_basic_set *isl_vertex_get_domain(
7204                 __isl_keep isl_vertex *vertex);
7205         __isl_give isl_multi_aff *isl_vertex_get_expr(
7206                 __isl_keep isl_vertex *vertex);
7207         void isl_vertex_free(__isl_take isl_vertex *vertex);
7209 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
7210 describing the vertex in terms of the parameters,
7211 while C<isl_vertex_get_domain> returns the activity domain
7212 of the vertex.
7214 Chambers can be inspected and destroyed using the following functions.
7216         __isl_give isl_basic_set *isl_cell_get_domain(
7217                 __isl_keep isl_cell *cell);
7218         void isl_cell_free(__isl_take isl_cell *cell);
7220 =head1 Polyhedral Compilation Library
7222 This section collects functionality in C<isl> that has been specifically
7223 designed for use during polyhedral compilation.
7225 =head2 Schedule Trees
7227 A schedule tree is a structured representation of a schedule,
7228 assigning a relative order to a set of domain elements.
7229 The relative order expressed by the schedule tree is
7230 defined recursively.  In particular, the order between
7231 two domain elements is determined by the node that is closest
7232 to the root that refers to both elements and that orders them apart.
7233 Each node in the tree is of one of several types.
7234 The root node is always of type C<isl_schedule_node_domain>
7235 and it describes the domain elements to which the schedule applies.
7236 The other types of nodes are as follows.
7238 =over
7240 =item C<isl_schedule_node_band>
7242 A band of schedule dimensions.  Each schedule dimension is represented
7243 by a union piecewise quasi-affine expression.  If this expression
7244 assigns a different value to two domain elements, while all previous
7245 schedule dimensions in the same band assign them the same value,
7246 then the two domain elements are ordered according to these two
7247 different values.
7249 =item C<isl_schedule_node_filter>
7251 A filter node does not impose any ordering, but rather intersects
7252 the set of domain elements that the current subtree refers to
7253 with a given union set.  The subtree of the filter node only
7254 refers to domain elements in the intersection.
7255 A filter node is typically only used a child of a sequence or
7256 set node.
7258 =item C<isl_schedule_node_leaf>
7260 A leaf of the schedule tree.  Leaf nodes do not impose any ordering.
7262 =item C<isl_schedule_node_sequence>
7264 A sequence node has one or more children, each of which is a filter node.
7265 The filters on these filter nodes form a partition of
7266 the domain elements that the current subtree refers to.
7267 If two domain elements appear in distinct filters then the sequence
7268 node orders them according to the child positions of the corresponding
7269 filter nodes.
7271 =item C<isl_schedule_node_set>
7273 A set node is similar to a sequence node, except that
7274 it expresses that domain elements appearing in distinct filters
7275 may have any order.  The order of the children of a set node
7276 is therefore also immaterial.
7278 =back
7280 A schedule tree is encapsulated in an C<isl_schedule> object.
7281 The simplest such objects, those with a tree consisting of single domain node,
7282 can be created using the following functions with either an empty
7283 domain or a given domain.
7285         #include <isl/schedule.h>
7286         __isl_give isl_schedule *isl_schedule_empty(
7287                 __isl_take isl_space *space);
7288         __isl_give isl_schedule *isl_schedule_from_domain(
7289                 __isl_take isl_union_set *domain);
7291 The function C<isl_schedule_constraints_compute_schedule> described
7292 in L</"Scheduling"> can also be used to construct schedules.
7294 C<isl_schedule> objects may be copied and freed using the following functions.
7296         #include <isl/schedule.h>
7297         __isl_give isl_schedule *isl_schedule_copy(
7298                 __isl_keep isl_schedule *sched);
7299         __isl_null isl_schedule *isl_schedule_free(
7300                 __isl_take isl_schedule *sched);
7302 The following functions checks whether two C<isl_schedule> objects
7303 are obviously the same.
7305         #include <isl/schedule.h>
7306         int isl_schedule_plain_is_equal(
7307                 __isl_keep isl_schedule *schedule1,
7308                 __isl_keep isl_schedule *schedule2);
7310 The domain of the schedule, i.e., the domain described by the root node,
7311 can be obtained using the following function.
7313         #include <isl/schedule.h>
7314         __isl_give isl_union_set *isl_schedule_get_domain(
7315                 __isl_keep isl_schedule *schedule);
7317 An extra top-level band node (right underneath the domain node) can
7318 be introduced into the schedule using the following function.
7320         #include <isl/schedule.h>
7321         __isl_give isl_schedule *
7322         isl_schedule_insert_partial_schedule(
7323                 __isl_take isl_schedule *schedule,
7324                 __isl_take isl_multi_union_pw_aff *partial);
7326 A schedule that combines two schedules either in the given
7327 order or in an arbitrary order, i.e., with an C<isl_schedule_node_sequence>
7328 or an C<isl_schedule_node_set> node,
7329 can be created using the following functions.
7331         #include <isl/schedule.h>
7332         __isl_give isl_schedule *isl_schedule_sequence(
7333                 __isl_take isl_schedule *schedule1,
7334                 __isl_take isl_schedule *schedule2);
7335         __isl_give isl_schedule *isl_schedule_set(
7336                 __isl_take isl_schedule *schedule1,
7337                 __isl_take isl_schedule *schedule2);
7339 The domains of the two input schedules need to be disjoint.
7341 The following function can be used to restrict the domain
7342 of a schedule to be a subset of the given union set.
7343 This operation may remove nodes in the tree that have become
7344 redundant.
7346         #include <isl/schedule.h>
7347         __isl_give isl_schedule *isl_schedule_intersect_domain(
7348                 __isl_take isl_schedule *schedule,
7349                 __isl_take isl_union_set *domain);
7351 The following function resets the user pointers on all parameter
7352 and tuple identifiers referenced by the nodes of the given schedule.
7354         #include <isl/schedule.h>
7355         __isl_give isl_schedule *isl_schedule_reset_user(
7356                 __isl_take isl_schedule *schedule);
7358 The following function aligns the parameters of all nodes
7359 in the given schedule to the given space.
7361         #include <isl/schedule.h>
7362         __isl_give isl_schedule *isl_schedule_align_params(
7363                 __isl_take isl_schedule *schedule,
7364                 __isl_take isl_space *space);
7366 The following function allows the user to plug in a given function
7367 in the iteration domains.
7369         #include <isl/schedule.h>
7370         __isl_give isl_schedule *
7371         isl_schedule_pullback_union_pw_multi_aff(
7372                 __isl_take isl_schedule *schedule,
7373                 __isl_take isl_union_pw_multi_aff *upma);
7375 An C<isl_union_map> representation of the schedule can be obtained
7376 from an C<isl_schedule> using the following function.
7378         #include <isl/schedule.h>
7379         __isl_give isl_union_map *isl_schedule_get_map(
7380                 __isl_keep isl_schedule *sched);
7382 The resulting relation encodes the same relative ordering as
7383 the schedule by mapping the domain elements to a common schedule space.
7384 If the schedule_separate_components option is set, then the order
7385 of the children of a set node is explicitly encoded in the result.
7387 Schedules can be read from input using the following functions.
7389         #include <isl/schedule.h>
7390         __isl_give isl_schedule *isl_schedule_read_from_file(
7391                 isl_ctx *ctx, FILE *input);
7392         __isl_give isl_schedule *isl_schedule_read_from_str(
7393                 isl_ctx *ctx, const char *str);
7395 A representation of the schedule can be printed using
7397         #include <isl/schedule.h>
7398         __isl_give isl_printer *isl_printer_print_schedule(
7399                 __isl_take isl_printer *p,
7400                 __isl_keep isl_schedule *schedule);
7402 The schedule tree can be traversed through the use of
7403 C<isl_schedule_node> objects that point to a particular
7404 position in the schedule tree.  Whenever a C<isl_schedule_node>
7405 is use to modify a node in the schedule tree, the original schedule
7406 tree is left untouched and the modifications are performed to a copy
7407 of the tree.  The returned C<isl_schedule_node> then points to
7408 this modified copy of the tree.
7410 The root of the schedule tree can be obtained using the following function.
7412         #include <isl/schedule.h>
7413         __isl_give isl_schedule_node *isl_schedule_get_root(
7414                 __isl_keep isl_schedule *schedule);
7416 A pointer to a newly created schedule tree with a single domain
7417 node can be created using the following function.
7419         #include <isl/schedule_node.h>
7420         __isl_give isl_schedule_node *
7421         isl_schedule_node_from_domain(
7422                 __isl_take isl_union_set *domain);
7424 Schedule nodes can be copied and freed using the following functions.
7426         #include <isl/schedule_node.h>
7427         __isl_give isl_schedule_node *isl_schedule_node_copy(
7428                 __isl_keep isl_schedule_node *node);
7429         __isl_null isl_schedule_node *isl_schedule_node_free(
7430                 __isl_take isl_schedule_node *node);
7432 The following functions can be used to check if two schedule
7433 nodes point to the same position in the same schedule.
7435         #include <isl/schedule_node.h>
7436         int isl_schedule_node_is_equal(
7437                 __isl_keep isl_schedule_node *node1,
7438                 __isl_keep isl_schedule_node *node2);
7440 The following properties can be obtained from a schedule node.
7442         #include <isl/schedule_node.h>
7443         enum isl_schedule_node_type isl_schedule_node_get_type(
7444                 __isl_keep isl_schedule_node *node);
7445         enum isl_schedule_node_type
7446         isl_schedule_node_get_parent_type(
7447                 __isl_keep isl_schedule_node *node);
7448         __isl_give isl_schedule *isl_schedule_node_get_schedule(
7449                 __isl_keep isl_schedule_node *node);
7451 The function C<isl_schedule_node_get_type> returns the type of
7452 the node, while C<isl_schedule_node_get_parent_type> returns
7453 type of the parent of the node, which is required to exist.
7454 The function C<isl_schedule_node_get_schedule> returns a copy
7455 to the schedule to which the node belongs.
7457 The following functions can be used to move the schedule node
7458 to a different position in the tree or to check if such a position
7459 exists.
7461         #include <isl/schedule_node.h>
7462         int isl_schedule_node_has_parent(
7463                 __isl_keep isl_schedule_node *node);
7464         __isl_give isl_schedule_node *isl_schedule_node_parent(
7465                 __isl_take isl_schedule_node *node);
7466         __isl_give isl_schedule_node *isl_schedule_node_root(
7467                 __isl_take isl_schedule_node *node);
7468         __isl_give isl_schedule_node *isl_schedule_node_ancestor(
7469                 __isl_take isl_schedule_node *node,
7470                 int generation);
7471         int isl_schedule_node_n_children(
7472                 __isl_keep isl_schedule_node *node);
7473         __isl_give isl_schedule_node *isl_schedule_node_child(
7474                 __isl_take isl_schedule_node *node, int pos);
7475         int isl_schedule_node_has_children(
7476                 __isl_keep isl_schedule_node *node);
7477         __isl_give isl_schedule_node *isl_schedule_node_first_child(
7478                 __isl_take isl_schedule_node *node);
7479         int isl_schedule_node_has_previous_sibling(
7480                 __isl_keep isl_schedule_node *node);
7481         __isl_give isl_schedule_node *
7482         isl_schedule_node_previous_sibling(
7483                 __isl_take isl_schedule_node *node);
7484         int isl_schedule_node_has_next_sibling(
7485                 __isl_keep isl_schedule_node *node);
7486         __isl_give isl_schedule_node *
7487         isl_schedule_node_next_sibling(
7488                 __isl_take isl_schedule_node *node);
7490 For C<isl_schedule_node_ancestor>, the ancestor of generation 0
7491 is the node itself, the ancestor of generation 1 is its parent and so on.
7493 It is also possible to query the number of ancestors of a node,
7494 the position of the current node
7495 within the children of its parent, the position of the subtree
7496 containing a node within the children of an ancestor
7497 or to obtain a copy of a given
7498 child without destroying the current node.
7499 Given two nodes that point to the same schedule, their closest
7500 shared ancestor can be obtained using
7501 C<isl_schedule_node_get_shared_ancestor>.
7503         #include <isl/schedule_node.h>
7504         int isl_schedule_node_get_tree_depth(
7505                 __isl_keep isl_schedule_node *node);
7506         int isl_schedule_node_get_child_position(
7507                 __isl_keep isl_schedule_node *node);
7508         int isl_schedule_node_get_ancestor_child_position(
7509                 __isl_keep isl_schedule_node *node,
7510                 __isl_keep isl_schedule_node *ancestor);
7511         __isl_give isl_schedule_node *isl_schedule_node_get_child(
7512                 __isl_keep isl_schedule_node *node, int pos);
7513         __isl_give isl_schedule_node *
7514         isl_schedule_node_get_shared_ancestor(
7515                 __isl_keep isl_schedule_node *node1,
7516                 __isl_keep isl_schedule_node *node2);
7518 All nodes in a schedule tree or
7519 all descendants of a specific node (including the node) can be visited
7520 in depth-first pre-order using the following functions.
7522         #include <isl/schedule.h>
7523         int isl_schedule_foreach_schedule_node(
7524                 __isl_keep isl_schedule *sched,
7525                 int (*fn)(__isl_keep isl_schedule_node *node,
7526                         void *user), void *user);
7528         #include <isl/schedule_node.h>
7529         int isl_schedule_node_foreach_descendant(
7530                 __isl_keep isl_schedule_node *node,
7531                 int (*fn)(__isl_keep isl_schedule_node *node,
7532                         void *user), void *user);
7534 The callback function is slightly different from the usual
7535 callbacks in that it not only indicates success (non-negative result)
7536 or failure (negative result), but also indicates whether the children
7537 of the given node should be visited.  In particular, if the callback
7538 returns a positive value, then the children are visited, but if
7539 the callback returns zero, then the children are not visited.
7541 The ancestors of a node in a schedule tree can be visited from
7542 the root down to and including the parent of the node using
7543 the following function.
7545         #include <isl/schedule_node.h>
7546         int isl_schedule_node_foreach_ancestor_top_down(
7547                 __isl_keep isl_schedule_node *node,
7548                 int (*fn)(__isl_keep isl_schedule_node *node,
7549                         void *user), void *user);
7551 The following functions allows for a depth-first post-order
7552 traversal of the nodes in a schedule tree or
7553 of the descendants of a specific node (including the node
7554 itself), where the user callback is allowed to modify the
7555 visited node.
7557         #include <isl/schedule.h>
7558         __isl_give isl_schedule *isl_schedule_map_schedule_node(
7559                 __isl_take isl_schedule *schedule,
7560                 __isl_give isl_schedule_node *(*fn)(
7561                         __isl_take isl_schedule_node *node,
7562                         void *user), void *user);
7564         #include <isl/schedule_node.h>
7565         __isl_give isl_schedule_node *
7566         isl_schedule_node_map_descendant(
7567                 __isl_take isl_schedule_node *node,
7568                 __isl_give isl_schedule_node *(*fn)(
7569                         __isl_take isl_schedule_node *node,
7570                         void *user), void *user);
7572 The traversal continues from the node returned by the callback function.
7573 It is the responsibility of the user to ensure that this does not
7574 lead to an infinite loop.  It is safest to always return a pointer
7575 to the same position (same ancestors and child positions) as the input node.
7577 The following function removes a node (along with its descendants)
7578 from a schedule tree and returns a pointer to the leaf at the
7579 same position in the updated tree.
7580 It is not allowed to remove the root of a schedule tree or
7581 a child of a set or sequence node.
7583         #include <isl/schedule_node.h>
7584         __isl_give isl_schedule_node *isl_schedule_node_cut(
7585                 __isl_take isl_schedule_node *node);
7587 The following function removes a single node
7588 from a schedule tree and returns a pointer to the child
7589 of the node, now located at the position of the original node
7590 or to a leaf node at that position if there was no child.
7591 It is not allowed to remove the root of a schedule tree,
7592 a set or sequence node or a child of a set or sequence node.
7594         #include <isl/schedule_node.h>
7595         __isl_give isl_schedule_node *isl_schedule_node_delete(
7596                 __isl_take isl_schedule_node *node);
7598 The following function resets the user pointers on all parameter
7599 and tuple identifiers referenced by the given schedule node.
7601         #include <isl/schedule_node.h>
7602         __isl_give isl_schedule_node *isl_schedule_node_reset_user(
7603                 __isl_take isl_schedule_node *node);
7605 The following function aligns the parameters of the given schedule
7606 node to the given space.
7608         #include <isl/schedule_node.h>
7609         __isl_give isl_schedule_node *
7610         isl_schedule_node_align_params(
7611                 __isl_take isl_schedule_node *node,
7612                 __isl_take isl_space *space);
7614 Several node types have their own functions for querying
7615 (and in some cases setting) some node type specific properties.
7617         #include <isl/schedule_node.h>
7618         __isl_give isl_space *isl_schedule_node_band_get_space(
7619                 __isl_keep isl_schedule_node *node);
7620         __isl_give isl_multi_union_pw_aff *
7621         isl_schedule_node_band_get_partial_schedule(
7622                 __isl_keep isl_schedule_node *node);
7623         __isl_give isl_union_map *
7624         isl_schedule_node_band_get_partial_schedule_union_map(
7625                 __isl_keep isl_schedule_node *node);
7626         unsigned isl_schedule_node_band_n_member(
7627                 __isl_keep isl_schedule_node *node);
7628         int isl_schedule_node_band_member_get_coincident(
7629                 __isl_keep isl_schedule_node *node, int pos);
7630         __isl_give isl_schedule_node *
7631         isl_schedule_node_band_member_set_coincident(
7632                 __isl_take isl_schedule_node *node, int pos,
7633                 int coincident);
7634         int isl_schedule_node_band_get_permutable(
7635                 __isl_keep isl_schedule_node *node);
7636         __isl_give isl_schedule_node *
7637         isl_schedule_node_band_set_permutable(
7638                 __isl_take isl_schedule_node *node, int permutable);
7640 The function C<isl_schedule_node_band_get_space> returns the space
7641 of the partial schedule of the band.
7642 The function C<isl_schedule_node_band_get_partial_schedule_union_map>
7643 returns a representation of the partial schedule of the band node
7644 in the form of an C<isl_union_map>.
7645 The coincident and permutable properties are set by
7646 C<isl_schedule_constraints_compute_schedule> on the schedule tree
7647 it produces.
7648 A scheduling dimension is considered to be ``coincident''
7649 if it satisfies the coincidence constraints within its band.
7650 That is, if the dependence distances of the coincidence
7651 constraints are all zero in that direction (for fixed
7652 iterations of outer bands).
7653 A band is marked permutable if it was produced using the Pluto-like scheduler.
7654 Note that the scheduler may have to resort to a Feautrier style scheduling
7655 step even if the default scheduler is used.
7657         #include <isl/schedule_node.h>
7658         __isl_give isl_union_set *
7659         isl_schedule_node_domain_get_domain(
7660                 __isl_keep isl_schedule_node *node);
7662         #include <isl/schedule_node.h>
7663         __isl_give isl_union_set *
7664         isl_schedule_node_filter_get_filter(
7665                 __isl_keep isl_schedule_node *node);
7667 The following functions can be used to obtain an C<isl_union_pw_multi_aff>
7668 or C<isl_union_map> representation of partial schedules related to the node.
7670         #include <isl/schedule_node.h>
7671         __isl_give isl_union_pw_multi_aff *
7672         isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(
7673                 __isl_keep isl_schedule_node *node);
7674         __isl_give isl_union_map *
7675         isl_schedule_node_get_prefix_schedule_union_map(
7676                 __isl_keep isl_schedule_node *node);
7677         __isl_give isl_union_map *
7678         isl_schedule_node_get_subtree_schedule_union_map(
7679                 __isl_keep isl_schedule_node *node);
7681 In particular, the functions
7682 C<isl_schedule_node_get_prefix_schedule_union_pw_multi_aff>
7683 and C<isl_schedule_node_get_prefix_schedule_union_map>
7684 return a relative ordering on the domain elements that reach the given
7685 node determined by its ancestors.
7686 The function C<isl_schedule_node_get_subtree_schedule_union_map>
7687 returns a representation of the partial schedule defined by the
7688 subtree rooted at the given node.
7690 The total number of outer band members of given node, i.e.,
7691 the shared output dimension of the maps in the result
7692 of C<isl_schedule_node_get_prefix_schedule_union_map> can be obtained
7693 using the following function.
7695         #include <isl/schedule_node.h>
7696         int isl_schedule_node_get_schedule_depth(
7697                 __isl_keep isl_schedule_node *node);
7699 The following function returns the union of universes in the spaces that
7700 contain elements that reach the given node.
7702         #include <isl/schedule_node.h>
7703         __isl_give isl_union_set *
7704         isl_schedule_node_get_universe_domain(
7705                 __isl_keep isl_schedule_node *node);
7707 The following functions can be used to introduce additional nodes
7708 in the schedule tree.  The new node is introduced at the point
7709 in the tree where the C<isl_schedule_node> points to and
7710 the results points to the new node.
7712         #include <isl/schedule_node.h>
7713         __isl_give isl_schedule_node *
7714         isl_schedule_node_insert_partial_schedule(
7715                 __isl_take isl_schedule_node *node,
7716                 __isl_take isl_multi_union_pw_aff *schedule);
7718 This function inserts a new band node with (the greatest integer
7719 part of) the given partial schedule.
7721         #include <isl/schedule_node.h>
7722         __isl_give isl_schedule_node *
7723         isl_schedule_node_insert_filter(
7724                 __isl_take isl_schedule_node *node,
7725                 __isl_take isl_union_set *filter);
7727 This function inserts a new filter node with the given filter.
7728 If the original node already pointed to a filter node, then the
7729 two filter nodes are merged into one.
7731         #include <isl/schedule_node.h>
7732         __isl_give isl_schedule_node *
7733         isl_schedule_node_insert_sequence(
7734                 __isl_take isl_schedule_node *node,
7735                 __isl_take isl_union_set_list *filters);
7736         __isl_give isl_schedule_node *
7737         isl_schedule_node_insert_set(
7738                 __isl_take isl_schedule_node *node,
7739                 __isl_take isl_union_set_list *filters);
7741 These functions insert a new sequence or set node with the given
7742 filters as children.
7744 The partial schedule of a band node can be scaled (down) using
7745 the following functions.
7747         #include <isl/schedule_node.h>
7748         __isl_give isl_schedule_node *
7749         isl_schedule_node_band_scale(
7750                 __isl_take isl_schedule_node *node,
7751                 __isl_take isl_multi_val *mv);
7752         __isl_give isl_schedule_node *
7753         isl_schedule_node_band_scale_down(
7754                 __isl_take isl_schedule_node *node,
7755                 __isl_take isl_multi_val *mv);
7757 The spaces of the two arguments need to match.
7758 After scaling, the partial schedule is replaced by its greatest
7759 integer part to ensure that the schedule remains integral.
7761 A band node can be tiled using the following function.
7763         #include <isl/schedule_node.h>
7764         __isl_give isl_schedule_node *isl_schedule_node_band_tile(
7765                 __isl_take isl_schedule_node *node,
7766                 __isl_take isl_multi_val *sizes);
7768         int isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
7769                 int val);
7770         int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
7771         int isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
7772                 int val);
7773         int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
7775 The C<isl_schedule_node_band_tile> function tiles
7776 the band using the given tile sizes inside its schedule.
7777 A new child band node is created to represent the point loops and it is
7778 inserted between the modified band and its children.
7779 The C<tile_scale_tile_loops> option specifies whether the tile
7780 loops iterators should be scaled by the tile sizes.
7781 If the C<tile_shift_point_loops> option is set, then the point loops
7782 are shifted to start at zero.
7784 A band node can be split into two nested band nodes
7785 using the following function.
7787         #include <isl/schedule_node.h>
7788         __isl_give isl_schedule_node *isl_schedule_node_band_split(
7789                 __isl_take isl_schedule_node *node, int pos);
7791 The resulting outer band node contains the first C<pos> dimensions of
7792 the schedule of C<node> while the inner band contains the remaining dimensions.
7793 The schedules of the two band nodes live in anonymous spaces.
7795 A band node can be moved down to the leaves of the subtree rooted
7796 at the band node using the following function.
7798         #include <isl/schedule_node.h>
7799         __isl_give isl_schedule_node *isl_schedule_node_band_sink(
7800                 __isl_take isl_schedule_node *node);
7802 The result points to the node in the resulting tree that is in the same
7803 position as the node pointed to by C<node> in the original tree.
7805 A representation of the schedule node can be printed using
7807         #include <isl/schedule_node.h>
7808         __isl_give isl_printer *isl_printer_print_schedule_node(
7809                 __isl_take isl_printer *p,
7810                 __isl_keep isl_schedule_node *node);
7812 =head2 Dependence Analysis
7814 C<isl> contains specialized functionality for performing
7815 array dataflow analysis.  That is, given a I<sink> access relation
7816 and a collection of possible I<source> access relations,
7817 C<isl> can compute relations that describe
7818 for each iteration of the sink access, which iteration
7819 of which of the source access relations was the last
7820 to access the same data element before the given iteration
7821 of the sink access.
7822 The resulting dependence relations map source iterations
7823 to the corresponding sink iterations.
7824 To compute standard flow dependences, the sink should be
7825 a read, while the sources should be writes.
7826 If any of the source accesses are marked as being I<may>
7827 accesses, then there will be a dependence from the last
7828 I<must> access B<and> from any I<may> access that follows
7829 this last I<must> access.
7830 In particular, if I<all> sources are I<may> accesses,
7831 then memory based dependence analysis is performed.
7832 If, on the other hand, all sources are I<must> accesses,
7833 then value based dependence analysis is performed.
7835 =head3 High-level Interface
7837 A high-level interface to dependence analysis is provided
7838 by the following function.
7840         #include <isl/flow.h>
7841         __isl_give isl_union_flow *
7842         isl_union_access_info_compute_flow(
7843                 __isl_take isl_union_access_info *access);
7845 The input C<isl_union_access_info> object describes the sink
7846 access relations, the source access relations and a schedule,
7847 while the output C<isl_union_flow> object describes
7848 the resulting dependence relations and the subsets of the
7849 sink relations for which no source was found.
7851 An C<isl_union_access_info> is created, modified and freed using
7852 the following functions.
7854         #include <isl/flow.h>
7855         __isl_give isl_union_access_info *
7856         isl_union_access_info_from_sink(
7857                 __isl_take isl_union_map *sink);
7858         __isl_give isl_union_access_info *
7859         isl_union_access_info_set_must_source(
7860                 __isl_take isl_union_access_info *access,
7861                 __isl_take isl_union_map *must_source);
7862         __isl_give isl_union_access_info *
7863         isl_union_access_info_set_may_source(
7864                 __isl_take isl_union_access_info *access,
7865                 __isl_take isl_union_map *may_source);
7866         __isl_give isl_union_access_info *
7867         isl_union_access_info_set_schedule(
7868                 __isl_take isl_union_access_info *access,
7869                 __isl_take isl_schedule *schedule);
7870         __isl_give isl_union_access_info *
7871         isl_union_access_info_set_schedule_map(
7872                 __isl_take isl_union_access_info *access,
7873                 __isl_take isl_union_map *schedule_map);
7874         __isl_null isl_union_access_info *
7875         isl_union_access_info_free(
7876                 __isl_take isl_union_access_info *access);
7878 The may sources set by C<isl_union_access_info_set_may_source>
7879 do not need to include the must sources set by
7880 C<isl_union_access_info_set_must_source> as a subset.
7881 The user is free not to call one (or both) of these functions,
7882 in which case the corresponding set is kept to its empty default.
7883 Similarly, the default schedule initialized by
7884 C<isl_union_access_info_from_sink> is empty.
7885 The current schedule is determined by the last call to either
7886 C<isl_union_access_info_set_schedule> or
7887 C<isl_union_access_info_set_schedule_map>.
7888 The domain of the schedule corresponds to the domains of
7889 the access relations.  In particular, the domains of the access
7890 relations are effectively intersected with the domain of the schedule
7891 and only the resulting accesses are considered by the dependence analysis.
7893 The output of C<isl_union_access_info_compute_flow> can be examined
7894 and freed using the following functions.
7896         #include <isl/flow.h>
7897         __isl_give isl_union_map *isl_union_flow_get_must_dependence(
7898                 __isl_keep isl_union_flow *flow);
7899         __isl_give isl_union_map *isl_union_flow_get_may_dependence(
7900                 __isl_keep isl_union_flow *flow);
7901         __isl_give isl_union_map *isl_union_flow_get_must_no_source(
7902                 __isl_keep isl_union_flow *flow);
7903         __isl_give isl_union_map *isl_union_flow_get_may_no_source(
7904                 __isl_keep isl_union_flow *flow);
7905         __isl_null isl_union_flow *isl_union_flow_free(
7906                 __isl_take isl_union_flow *flow);
7908 The relation returned by C<isl_union_flow_get_must_dependence>
7909 relates domain elements of must sources to domain elements of the sink.
7910 The relation returned by C<isl_union_flow_get_may_dependence>
7911 relates domain elements of must or may sources to domain elements of the sink
7912 and includes the previous relation as a subset.
7913 The relation returned by C<isl_union_flow_get_must_no_source> is the subset
7914 of the sink relation for which no dependences have been found.
7915 The relation returned by C<isl_union_flow_get_may_no_source> is the subset
7916 of the sink relation for which no definite dependences have been found.
7917 That is, it contains those sink access that do not contribute to any
7918 of the elements in the relation returned
7919 by C<isl_union_flow_get_must_dependence>.
7921 =head3 Low-level Interface
7923 A lower-level interface is provided by the following functions.
7925         #include <isl/flow.h>
7927         typedef int (*isl_access_level_before)(void *first, void *second);
7929         __isl_give isl_access_info *isl_access_info_alloc(
7930                 __isl_take isl_map *sink,
7931                 void *sink_user, isl_access_level_before fn,
7932                 int max_source);
7933         __isl_give isl_access_info *isl_access_info_add_source(
7934                 __isl_take isl_access_info *acc,
7935                 __isl_take isl_map *source, int must,
7936                 void *source_user);
7937         __isl_null isl_access_info *isl_access_info_free(
7938                 __isl_take isl_access_info *acc);
7940         __isl_give isl_flow *isl_access_info_compute_flow(
7941                 __isl_take isl_access_info *acc);
7943         int isl_flow_foreach(__isl_keep isl_flow *deps,
7944                 int (*fn)(__isl_take isl_map *dep, int must,
7945                           void *dep_user, void *user),
7946                 void *user);
7947         __isl_give isl_map *isl_flow_get_no_source(
7948                 __isl_keep isl_flow *deps, int must);
7949         void isl_flow_free(__isl_take isl_flow *deps);
7951 The function C<isl_access_info_compute_flow> performs the actual
7952 dependence analysis.  The other functions are used to construct
7953 the input for this function or to read off the output.
7955 The input is collected in an C<isl_access_info>, which can
7956 be created through a call to C<isl_access_info_alloc>.
7957 The arguments to this functions are the sink access relation
7958 C<sink>, a token C<sink_user> used to identify the sink
7959 access to the user, a callback function for specifying the
7960 relative order of source and sink accesses, and the number
7961 of source access relations that will be added.
7962 The callback function has type C<int (*)(void *first, void *second)>.
7963 The function is called with two user supplied tokens identifying
7964 either a source or the sink and it should return the shared nesting
7965 level and the relative order of the two accesses.
7966 In particular, let I<n> be the number of loops shared by
7967 the two accesses.  If C<first> precedes C<second> textually,
7968 then the function should return I<2 * n + 1>; otherwise,
7969 it should return I<2 * n>.
7970 The sources can be added to the C<isl_access_info> by performing
7971 (at most) C<max_source> calls to C<isl_access_info_add_source>.
7972 C<must> indicates whether the source is a I<must> access
7973 or a I<may> access.  Note that a multi-valued access relation
7974 should only be marked I<must> if every iteration in the domain
7975 of the relation accesses I<all> elements in its image.
7976 The C<source_user> token is again used to identify
7977 the source access.  The range of the source access relation
7978 C<source> should have the same dimension as the range
7979 of the sink access relation.
7980 The C<isl_access_info_free> function should usually not be
7981 called explicitly, because it is called implicitly by
7982 C<isl_access_info_compute_flow>.
7984 The result of the dependence analysis is collected in an
7985 C<isl_flow>.  There may be elements of
7986 the sink access for which no preceding source access could be
7987 found or for which all preceding sources are I<may> accesses.
7988 The relations containing these elements can be obtained through
7989 calls to C<isl_flow_get_no_source>, the first with C<must> set
7990 and the second with C<must> unset.
7991 In the case of standard flow dependence analysis,
7992 with the sink a read and the sources I<must> writes,
7993 the first relation corresponds to the reads from uninitialized
7994 array elements and the second relation is empty.
7995 The actual flow dependences can be extracted using
7996 C<isl_flow_foreach>.  This function will call the user-specified
7997 callback function C<fn> for each B<non-empty> dependence between
7998 a source and the sink.  The callback function is called
7999 with four arguments, the actual flow dependence relation
8000 mapping source iterations to sink iterations, a boolean that
8001 indicates whether it is a I<must> or I<may> dependence, a token
8002 identifying the source and an additional C<void *> with value
8003 equal to the third argument of the C<isl_flow_foreach> call.
8004 A dependence is marked I<must> if it originates from a I<must>
8005 source and if it is not followed by any I<may> sources.
8007 After finishing with an C<isl_flow>, the user should call
8008 C<isl_flow_free> to free all associated memory.
8010 =head3 Interaction with the Low-level Interface
8012 During the dependence analysis, we frequently need to perform
8013 the following operation.  Given a relation between sink iterations
8014 and potential source iterations from a particular source domain,
8015 what is the last potential source iteration corresponding to each
8016 sink iteration.  It can sometimes be convenient to adjust
8017 the set of potential source iterations before or after each such operation.
8018 The prototypical example is fuzzy array dataflow analysis,
8019 where we need to analyze if, based on data-dependent constraints,
8020 the sink iteration can ever be executed without one or more of
8021 the corresponding potential source iterations being executed.
8022 If so, we can introduce extra parameters and select an unknown
8023 but fixed source iteration from the potential source iterations.
8024 To be able to perform such manipulations, C<isl> provides the following
8025 function.
8027         #include <isl/flow.h>
8029         typedef __isl_give isl_restriction *(*isl_access_restrict)(
8030                 __isl_keep isl_map *source_map,
8031                 __isl_keep isl_set *sink, void *source_user,
8032                 void *user);
8033         __isl_give isl_access_info *isl_access_info_set_restrict(
8034                 __isl_take isl_access_info *acc,
8035                 isl_access_restrict fn, void *user);
8037 The function C<isl_access_info_set_restrict> should be called
8038 before calling C<isl_access_info_compute_flow> and registers a callback function
8039 that will be called any time C<isl> is about to compute the last
8040 potential source.  The first argument is the (reverse) proto-dependence,
8041 mapping sink iterations to potential source iterations.
8042 The second argument represents the sink iterations for which
8043 we want to compute the last source iteration.
8044 The third argument is the token corresponding to the source
8045 and the final argument is the token passed to C<isl_access_info_set_restrict>.
8046 The callback is expected to return a restriction on either the input or
8047 the output of the operation computing the last potential source.
8048 If the input needs to be restricted then restrictions are needed
8049 for both the source and the sink iterations.  The sink iterations
8050 and the potential source iterations will be intersected with these sets.
8051 If the output needs to be restricted then only a restriction on the source
8052 iterations is required.
8053 If any error occurs, the callback should return C<NULL>.
8054 An C<isl_restriction> object can be created, freed and inspected
8055 using the following functions.
8057         #include <isl/flow.h>
8059         __isl_give isl_restriction *isl_restriction_input(
8060                 __isl_take isl_set *source_restr,
8061                 __isl_take isl_set *sink_restr);
8062         __isl_give isl_restriction *isl_restriction_output(
8063                 __isl_take isl_set *source_restr);
8064         __isl_give isl_restriction *isl_restriction_none(
8065                 __isl_take isl_map *source_map);
8066         __isl_give isl_restriction *isl_restriction_empty(
8067                 __isl_take isl_map *source_map);
8068         __isl_null isl_restriction *isl_restriction_free(
8069                 __isl_take isl_restriction *restr);
8071 C<isl_restriction_none> and C<isl_restriction_empty> are special
8072 cases of C<isl_restriction_input>.  C<isl_restriction_none>
8073 is essentially equivalent to
8075         isl_restriction_input(isl_set_universe(
8076             isl_space_range(isl_map_get_space(source_map))),
8077                             isl_set_universe(
8078             isl_space_domain(isl_map_get_space(source_map))));
8080 whereas C<isl_restriction_empty> is essentially equivalent to
8082         isl_restriction_input(isl_set_empty(
8083             isl_space_range(isl_map_get_space(source_map))),
8084                             isl_set_universe(
8085             isl_space_domain(isl_map_get_space(source_map))));
8087 =head2 Scheduling
8089 B<The functionality described in this section is fairly new
8090 and may be subject to change.>
8092         #include <isl/schedule.h>
8093         __isl_give isl_schedule *
8094         isl_schedule_constraints_compute_schedule(
8095                 __isl_take isl_schedule_constraints *sc);
8097 The function C<isl_schedule_constraints_compute_schedule> can be
8098 used to compute a schedule that satisfies the given schedule constraints.
8099 These schedule constraints include the iteration domain for which
8100 a schedule should be computed and dependences between pairs of
8101 iterations.  In particular, these dependences include
8102 I<validity> dependences and I<proximity> dependences.
8103 By default, the algorithm used to construct the schedule is similar
8104 to that of C<Pluto>.
8105 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
8106 be selected.
8107 The generated schedule respects all validity dependences.
8108 That is, all dependence distances over these dependences in the
8109 scheduled space are lexicographically positive.
8110 The default algorithm tries to ensure that the dependence distances
8111 over coincidence constraints are zero and to minimize the
8112 dependence distances over proximity dependences.
8113 Moreover, it tries to obtain sequences (bands) of schedule dimensions
8114 for groups of domains where the dependence distances over validity
8115 dependences have only non-negative values.
8116 When using Feautrier's algorithm, the coincidence and proximity constraints
8117 are only taken into account during the extension to a
8118 full-dimensional schedule.
8120 An C<isl_schedule_constraints> object can be constructed
8121 and manipulated using the following functions.
8123         #include <isl/schedule.h>
8124         __isl_give isl_schedule_constraints *
8125         isl_schedule_constraints_copy(
8126                 __isl_keep isl_schedule_constraints *sc);
8127         __isl_give isl_schedule_constraints *
8128         isl_schedule_constraints_on_domain(
8129                 __isl_take isl_union_set *domain);
8130         __isl_give isl_schedule_constraints *
8131         isl_schedule_constraints_set_context(
8132                 __isl_take isl_schedule_constraints *sc,
8133                 __isl_take isl_set *context);
8134         __isl_give isl_schedule_constraints *
8135         isl_schedule_constraints_set_validity(
8136                 __isl_take isl_schedule_constraints *sc,
8137                 __isl_take isl_union_map *validity);
8138         __isl_give isl_schedule_constraints *
8139         isl_schedule_constraints_set_coincidence(
8140                 __isl_take isl_schedule_constraints *sc,
8141                 __isl_take isl_union_map *coincidence);
8142         __isl_give isl_schedule_constraints *
8143         isl_schedule_constraints_set_proximity(
8144                 __isl_take isl_schedule_constraints *sc,
8145                 __isl_take isl_union_map *proximity);
8146         __isl_give isl_schedule_constraints *
8147         isl_schedule_constraints_set_conditional_validity(
8148                 __isl_take isl_schedule_constraints *sc,
8149                 __isl_take isl_union_map *condition,
8150                 __isl_take isl_union_map *validity);
8151         __isl_null isl_schedule_constraints *
8152         isl_schedule_constraints_free(
8153                 __isl_take isl_schedule_constraints *sc);
8155 The initial C<isl_schedule_constraints> object created by
8156 C<isl_schedule_constraints_on_domain> does not impose any constraints.
8157 That is, it has an empty set of dependences.
8158 The function C<isl_schedule_constraints_set_context> allows the user
8159 to specify additional constraints on the parameters that may
8160 be assumed to hold during the construction of the schedule.
8161 The function C<isl_schedule_constraints_set_validity> replaces the
8162 validity dependences, mapping domain elements I<i> to domain
8163 elements that should be scheduled after I<i>.
8164 The function C<isl_schedule_constraints_set_coincidence> replaces the
8165 coincidence dependences, mapping domain elements I<i> to domain
8166 elements that should be scheduled together with I<I>, if possible.
8167 The function C<isl_schedule_constraints_set_proximity> replaces the
8168 proximity dependences, mapping domain elements I<i> to domain
8169 elements that should be scheduled either before I<I>
8170 or as early as possible after I<i>.
8172 The function C<isl_schedule_constraints_set_conditional_validity>
8173 replaces the conditional validity constraints.
8174 A conditional validity constraint is only imposed when any of the corresponding
8175 conditions is satisfied, i.e., when any of them is non-zero.
8176 That is, the scheduler ensures that within each band if the dependence
8177 distances over the condition constraints are not all zero
8178 then all corresponding conditional validity constraints are respected.
8179 A conditional validity constraint corresponds to a condition
8180 if the two are adjacent, i.e., if the domain of one relation intersect
8181 the range of the other relation.
8182 The typical use case of conditional validity constraints is
8183 to allow order constraints between live ranges to be violated
8184 as long as the live ranges themselves are local to the band.
8185 To allow more fine-grained control over which conditions correspond
8186 to which conditional validity constraints, the domains and ranges
8187 of these relations may include I<tags>.  That is, the domains and
8188 ranges of those relation may themselves be wrapped relations
8189 where the iteration domain appears in the domain of those wrapped relations
8190 and the range of the wrapped relations can be arbitrarily chosen
8191 by the user.  Conditions and conditional validity constraints are only
8192 considered adjacent to each other if the entire wrapped relation matches.
8193 In particular, a relation with a tag will never be considered adjacent
8194 to a relation without a tag.
8196 The following function computes a schedule directly from
8197 an iteration domain and validity and proximity dependences
8198 and is implemented in terms of the functions described above.
8199 The use of C<isl_union_set_compute_schedule> is discouraged.
8201         #include <isl/schedule.h>
8202         __isl_give isl_schedule *isl_union_set_compute_schedule(
8203                 __isl_take isl_union_set *domain,
8204                 __isl_take isl_union_map *validity,
8205                 __isl_take isl_union_map *proximity);
8207 The generated schedule represents a schedule tree.
8208 For more information on schedule trees, see
8209 L</"Schedule Trees">.
8211 =head3 Options
8213         #include <isl/schedule.h>
8214         int isl_options_set_schedule_max_coefficient(
8215                 isl_ctx *ctx, int val);
8216         int isl_options_get_schedule_max_coefficient(
8217                 isl_ctx *ctx);
8218         int isl_options_set_schedule_max_constant_term(
8219                 isl_ctx *ctx, int val);
8220         int isl_options_get_schedule_max_constant_term(
8221                 isl_ctx *ctx);
8222         int isl_options_set_schedule_fuse(isl_ctx *ctx, int val);
8223         int isl_options_get_schedule_fuse(isl_ctx *ctx);
8224         int isl_options_set_schedule_maximize_band_depth(
8225                 isl_ctx *ctx, int val);
8226         int isl_options_get_schedule_maximize_band_depth(
8227                 isl_ctx *ctx);
8228         int isl_options_set_schedule_outer_coincidence(
8229                 isl_ctx *ctx, int val);
8230         int isl_options_get_schedule_outer_coincidence(
8231                 isl_ctx *ctx);
8232         int isl_options_set_schedule_split_scaled(
8233                 isl_ctx *ctx, int val);
8234         int isl_options_get_schedule_split_scaled(
8235                 isl_ctx *ctx);
8236         int isl_options_set_schedule_algorithm(
8237                 isl_ctx *ctx, int val);
8238         int isl_options_get_schedule_algorithm(
8239                 isl_ctx *ctx);
8240         int isl_options_set_schedule_separate_components(
8241                 isl_ctx *ctx, int val);
8242         int isl_options_get_schedule_separate_components(
8243                 isl_ctx *ctx);
8245 =over
8247 =item * schedule_max_coefficient
8249 This option enforces that the coefficients for variable and parameter
8250 dimensions in the calculated schedule are not larger than the specified value.
8251 This option can significantly increase the speed of the scheduling calculation
8252 and may also prevent fusing of unrelated dimensions. A value of -1 means that
8253 this option does not introduce bounds on the variable or parameter
8254 coefficients.
8256 =item * schedule_max_constant_term
8258 This option enforces that the constant coefficients in the calculated schedule
8259 are not larger than the maximal constant term. This option can significantly
8260 increase the speed of the scheduling calculation and may also prevent fusing of
8261 unrelated dimensions. A value of -1 means that this option does not introduce
8262 bounds on the constant coefficients.
8264 =item * schedule_fuse
8266 This option controls the level of fusion.
8267 If this option is set to C<ISL_SCHEDULE_FUSE_MIN>, then loops in the
8268 resulting schedule will be distributed as much as possible.
8269 If this option is set to C<ISL_SCHEDULE_FUSE_MAX>, then C<isl> will
8270 try to fuse loops in the resulting schedule.
8272 =item * schedule_maximize_band_depth
8274 If this option is set, we do not split bands at the point
8275 where we detect splitting is necessary. Instead, we
8276 backtrack and split bands as early as possible. This
8277 reduces the number of splits and maximizes the width of
8278 the bands. Wider bands give more possibilities for tiling.
8279 Note that if the C<schedule_fuse> option is set to C<ISL_SCHEDULE_FUSE_MIN>,
8280 then bands will be split as early as possible, even if there is no need.
8281 The C<schedule_maximize_band_depth> option therefore has no effect in this case.
8283 =item * schedule_outer_coincidence
8285 If this option is set, then we try to construct schedules
8286 where the outermost scheduling dimension in each band
8287 satisfies the coincidence constraints.
8289 =item * schedule_split_scaled
8291 If this option is set, then we try to construct schedules in which the
8292 constant term is split off from the linear part if the linear parts of
8293 the scheduling rows for all nodes in the graphs have a common non-trivial
8294 divisor.
8295 The constant term is then placed in a separate band and the linear
8296 part is reduced.
8298 =item * schedule_algorithm
8300 Selects the scheduling algorithm to be used.
8301 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
8302 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
8304 =item * schedule_separate_components
8306 If this option is set then the function C<isl_schedule_get_map>
8307 will treat set nodes in the same way as sequence nodes.
8309 =back
8311 =head2 AST Generation
8313 This section describes the C<isl> functionality for generating
8314 ASTs that visit all the elements
8315 in a domain in an order specified by a schedule.
8316 In particular, given a C<isl_union_map>, an AST is generated
8317 that visits all the elements in the domain of the C<isl_union_map>
8318 according to the lexicographic order of the corresponding image
8319 element(s).  If the range of the C<isl_union_map> consists of
8320 elements in more than one space, then each of these spaces is handled
8321 separately in an arbitrary order.
8322 It should be noted that the image elements only specify the I<order>
8323 in which the corresponding domain elements should be visited.
8324 No direct relation between the image elements and the loop iterators
8325 in the generated AST should be assumed.
8327 Each AST is generated within a build.  The initial build
8328 simply specifies the constraints on the parameters (if any)
8329 and can be created, inspected, copied and freed using the following functions.
8331         #include <isl/ast_build.h>
8332         __isl_give isl_ast_build *isl_ast_build_from_context(
8333                 __isl_take isl_set *set);
8334         __isl_give isl_ast_build *isl_ast_build_copy(
8335                 __isl_keep isl_ast_build *build);
8336         __isl_null isl_ast_build *isl_ast_build_free(
8337                 __isl_take isl_ast_build *build);
8339 The C<set> argument is usually a parameter set with zero or more parameters.
8340 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
8341 and L</"Fine-grained Control over AST Generation">.
8342 Finally, the AST itself can be constructed using the following
8343 function.
8345         #include <isl/ast_build.h>
8346         __isl_give isl_ast_node *
8347         isl_ast_build_node_from_schedule_map(
8348                 __isl_keep isl_ast_build *build,
8349                 __isl_take isl_union_map *schedule);
8351 =head3 Inspecting the AST
8353 The basic properties of an AST node can be obtained as follows.
8355         #include <isl/ast.h>
8356         enum isl_ast_node_type isl_ast_node_get_type(
8357                 __isl_keep isl_ast_node *node);
8359 The type of an AST node is one of
8360 C<isl_ast_node_for>,
8361 C<isl_ast_node_if>,
8362 C<isl_ast_node_block> or
8363 C<isl_ast_node_user>.
8364 An C<isl_ast_node_for> represents a for node.
8365 An C<isl_ast_node_if> represents an if node.
8366 An C<isl_ast_node_block> represents a compound node.
8367 An C<isl_ast_node_user> represents an expression statement.
8368 An expression statement typically corresponds to a domain element, i.e.,
8369 one of the elements that is visited by the AST.
8371 Each type of node has its own additional properties.
8373         #include <isl/ast.h>
8374         __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
8375                 __isl_keep isl_ast_node *node);
8376         __isl_give isl_ast_expr *isl_ast_node_for_get_init(
8377                 __isl_keep isl_ast_node *node);
8378         __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
8379                 __isl_keep isl_ast_node *node);
8380         __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
8381                 __isl_keep isl_ast_node *node);
8382         __isl_give isl_ast_node *isl_ast_node_for_get_body(
8383                 __isl_keep isl_ast_node *node);
8384         int isl_ast_node_for_is_degenerate(
8385                 __isl_keep isl_ast_node *node);
8387 An C<isl_ast_for> is considered degenerate if it is known to execute
8388 exactly once.
8390         #include <isl/ast.h>
8391         __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
8392                 __isl_keep isl_ast_node *node);
8393         __isl_give isl_ast_node *isl_ast_node_if_get_then(
8394                 __isl_keep isl_ast_node *node);
8395         int isl_ast_node_if_has_else(
8396                 __isl_keep isl_ast_node *node);
8397         __isl_give isl_ast_node *isl_ast_node_if_get_else(
8398                 __isl_keep isl_ast_node *node);
8400         __isl_give isl_ast_node_list *
8401         isl_ast_node_block_get_children(
8402                 __isl_keep isl_ast_node *node);
8404         __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
8405                 __isl_keep isl_ast_node *node);
8407 Each of the returned C<isl_ast_expr>s can in turn be inspected using
8408 the following functions.
8410         #include <isl/ast.h>
8411         enum isl_ast_expr_type isl_ast_expr_get_type(
8412                 __isl_keep isl_ast_expr *expr);
8414 The type of an AST expression is one of
8415 C<isl_ast_expr_op>,
8416 C<isl_ast_expr_id> or
8417 C<isl_ast_expr_int>.
8418 An C<isl_ast_expr_op> represents the result of an operation.
8419 An C<isl_ast_expr_id> represents an identifier.
8420 An C<isl_ast_expr_int> represents an integer value.
8422 Each type of expression has its own additional properties.
8424         #include <isl/ast.h>
8425         enum isl_ast_op_type isl_ast_expr_get_op_type(
8426                 __isl_keep isl_ast_expr *expr);
8427         int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
8428         __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
8429                 __isl_keep isl_ast_expr *expr, int pos);
8430         int isl_ast_node_foreach_ast_op_type(
8431                 __isl_keep isl_ast_node *node,
8432                 int (*fn)(enum isl_ast_op_type type, void *user),
8433                 void *user);
8435 C<isl_ast_expr_get_op_type> returns the type of the operation
8436 performed.  C<isl_ast_expr_get_op_n_arg> returns the number of
8437 arguments.  C<isl_ast_expr_get_op_arg> returns the specified
8438 argument.
8439 C<isl_ast_node_foreach_ast_op_type> calls C<fn> for each distinct
8440 C<isl_ast_op_type> that appears in C<node>.
8441 The operation type is one of the following.
8443 =over
8445 =item C<isl_ast_op_and>
8447 Logical I<and> of two arguments.
8448 Both arguments can be evaluated.
8450 =item C<isl_ast_op_and_then>
8452 Logical I<and> of two arguments.
8453 The second argument can only be evaluated if the first evaluates to true.
8455 =item C<isl_ast_op_or>
8457 Logical I<or> of two arguments.
8458 Both arguments can be evaluated.
8460 =item C<isl_ast_op_or_else>
8462 Logical I<or> of two arguments.
8463 The second argument can only be evaluated if the first evaluates to false.
8465 =item C<isl_ast_op_max>
8467 Maximum of two or more arguments.
8469 =item C<isl_ast_op_min>
8471 Minimum of two or more arguments.
8473 =item C<isl_ast_op_minus>
8475 Change sign.
8477 =item C<isl_ast_op_add>
8479 Sum of two arguments.
8481 =item C<isl_ast_op_sub>
8483 Difference of two arguments.
8485 =item C<isl_ast_op_mul>
8487 Product of two arguments.
8489 =item C<isl_ast_op_div>
8491 Exact division.  That is, the result is known to be an integer.
8493 =item C<isl_ast_op_fdiv_q>
8495 Result of integer division, rounded towards negative
8496 infinity.
8498 =item C<isl_ast_op_pdiv_q>
8500 Result of integer division, where dividend is known to be non-negative.
8502 =item C<isl_ast_op_pdiv_r>
8504 Remainder of integer division, where dividend is known to be non-negative.
8506 =item C<isl_ast_op_zdiv_r>
8508 Equal to zero iff the remainder on integer division is zero.
8510 =item C<isl_ast_op_cond>
8512 Conditional operator defined on three arguments.
8513 If the first argument evaluates to true, then the result
8514 is equal to the second argument.  Otherwise, the result
8515 is equal to the third argument.
8516 The second and third argument may only be evaluated if
8517 the first argument evaluates to true and false, respectively.
8518 Corresponds to C<a ? b : c> in C.
8520 =item C<isl_ast_op_select>
8522 Conditional operator defined on three arguments.
8523 If the first argument evaluates to true, then the result
8524 is equal to the second argument.  Otherwise, the result
8525 is equal to the third argument.
8526 The second and third argument may be evaluated independently
8527 of the value of the first argument.
8528 Corresponds to C<a * b + (1 - a) * c> in C.
8530 =item C<isl_ast_op_eq>
8532 Equality relation.
8534 =item C<isl_ast_op_le>
8536 Less than or equal relation.
8538 =item C<isl_ast_op_lt>
8540 Less than relation.
8542 =item C<isl_ast_op_ge>
8544 Greater than or equal relation.
8546 =item C<isl_ast_op_gt>
8548 Greater than relation.
8550 =item C<isl_ast_op_call>
8552 A function call.
8553 The number of arguments of the C<isl_ast_expr> is one more than
8554 the number of arguments in the function call, the first argument
8555 representing the function being called.
8557 =item C<isl_ast_op_access>
8559 An array access.
8560 The number of arguments of the C<isl_ast_expr> is one more than
8561 the number of index expressions in the array access, the first argument
8562 representing the array being accessed.
8564 =item C<isl_ast_op_member>
8566 A member access.
8567 This operation has two arguments, a structure and the name of
8568 the member of the structure being accessed.
8570 =back
8572         #include <isl/ast.h>
8573         __isl_give isl_id *isl_ast_expr_get_id(
8574                 __isl_keep isl_ast_expr *expr);
8576 Return the identifier represented by the AST expression.
8578         #include <isl/ast.h>
8579         __isl_give isl_val *isl_ast_expr_get_val(
8580                 __isl_keep isl_ast_expr *expr);
8582 Return the integer represented by the AST expression.
8584 =head3 Properties of ASTs
8586         #include <isl/ast.h>
8587         int isl_ast_expr_is_equal(__isl_keep isl_ast_expr *expr1,
8588                 __isl_keep isl_ast_expr *expr2);
8590 Check if two C<isl_ast_expr>s are equal to each other.
8592 =head3 Manipulating and printing the AST
8594 AST nodes can be copied and freed using the following functions.
8596         #include <isl/ast.h>
8597         __isl_give isl_ast_node *isl_ast_node_copy(
8598                 __isl_keep isl_ast_node *node);
8599         __isl_null isl_ast_node *isl_ast_node_free(
8600                 __isl_take isl_ast_node *node);
8602 AST expressions can be copied and freed using the following functions.
8604         #include <isl/ast.h>
8605         __isl_give isl_ast_expr *isl_ast_expr_copy(
8606                 __isl_keep isl_ast_expr *expr);
8607         __isl_null isl_ast_expr *isl_ast_expr_free(
8608                 __isl_take isl_ast_expr *expr);
8610 New AST expressions can be created either directly or within
8611 the context of an C<isl_ast_build>.
8613         #include <isl/ast.h>
8614         __isl_give isl_ast_expr *isl_ast_expr_from_val(
8615                 __isl_take isl_val *v);
8616         __isl_give isl_ast_expr *isl_ast_expr_from_id(
8617                 __isl_take isl_id *id);
8618         __isl_give isl_ast_expr *isl_ast_expr_neg(
8619                 __isl_take isl_ast_expr *expr);
8620         __isl_give isl_ast_expr *isl_ast_expr_address_of(
8621                 __isl_take isl_ast_expr *expr);
8622         __isl_give isl_ast_expr *isl_ast_expr_add(
8623                 __isl_take isl_ast_expr *expr1,
8624                 __isl_take isl_ast_expr *expr2);
8625         __isl_give isl_ast_expr *isl_ast_expr_sub(
8626                 __isl_take isl_ast_expr *expr1,
8627                 __isl_take isl_ast_expr *expr2);
8628         __isl_give isl_ast_expr *isl_ast_expr_mul(
8629                 __isl_take isl_ast_expr *expr1,
8630                 __isl_take isl_ast_expr *expr2);
8631         __isl_give isl_ast_expr *isl_ast_expr_div(
8632                 __isl_take isl_ast_expr *expr1,
8633                 __isl_take isl_ast_expr *expr2);
8634         __isl_give isl_ast_expr *isl_ast_expr_pdiv_q(
8635                 __isl_take isl_ast_expr *expr1,
8636                 __isl_take isl_ast_expr *expr2);
8637         __isl_give isl_ast_expr *isl_ast_expr_pdiv_r(
8638                 __isl_take isl_ast_expr *expr1,
8639                 __isl_take isl_ast_expr *expr2);
8640         __isl_give isl_ast_expr *isl_ast_expr_and(
8641                 __isl_take isl_ast_expr *expr1,
8642                 __isl_take isl_ast_expr *expr2)
8643         __isl_give isl_ast_expr *isl_ast_expr_and_then(
8644                 __isl_take isl_ast_expr *expr1,
8645                 __isl_take isl_ast_expr *expr2)
8646         __isl_give isl_ast_expr *isl_ast_expr_or(
8647                 __isl_take isl_ast_expr *expr1,
8648                 __isl_take isl_ast_expr *expr2)
8649         __isl_give isl_ast_expr *isl_ast_expr_or_else(
8650                 __isl_take isl_ast_expr *expr1,
8651                 __isl_take isl_ast_expr *expr2)
8652         __isl_give isl_ast_expr *isl_ast_expr_eq(
8653                 __isl_take isl_ast_expr *expr1,
8654                 __isl_take isl_ast_expr *expr2);
8655         __isl_give isl_ast_expr *isl_ast_expr_le(
8656                 __isl_take isl_ast_expr *expr1,
8657                 __isl_take isl_ast_expr *expr2);
8658         __isl_give isl_ast_expr *isl_ast_expr_lt(
8659                 __isl_take isl_ast_expr *expr1,
8660                 __isl_take isl_ast_expr *expr2);
8661         __isl_give isl_ast_expr *isl_ast_expr_ge(
8662                 __isl_take isl_ast_expr *expr1,
8663                 __isl_take isl_ast_expr *expr2);
8664         __isl_give isl_ast_expr *isl_ast_expr_gt(
8665                 __isl_take isl_ast_expr *expr1,
8666                 __isl_take isl_ast_expr *expr2);
8667         __isl_give isl_ast_expr *isl_ast_expr_access(
8668                 __isl_take isl_ast_expr *array,
8669                 __isl_take isl_ast_expr_list *indices);
8670         __isl_give isl_ast_expr *isl_ast_expr_call(
8671                 __isl_take isl_ast_expr *function,
8672                 __isl_take isl_ast_expr_list *arguments);
8674 The function C<isl_ast_expr_address_of> can be applied to an
8675 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
8676 to represent the address of the C<isl_ast_expr_access>. The function
8677 C<isl_ast_expr_and_then> as well as C<isl_ast_expr_or_else> are short-circuit
8678 versions of C<isl_ast_expr_and> and C<isl_ast_expr_or>, respectively.
8680         #include <isl/ast_build.h>
8681         __isl_give isl_ast_expr *isl_ast_build_expr_from_set(
8682                 __isl_keep isl_ast_build *build,
8683                 __isl_take isl_set *set);
8684         __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
8685                 __isl_keep isl_ast_build *build,
8686                 __isl_take isl_pw_aff *pa);
8687         __isl_give isl_ast_expr *
8688         isl_ast_build_access_from_pw_multi_aff(
8689                 __isl_keep isl_ast_build *build,
8690                 __isl_take isl_pw_multi_aff *pma);
8691         __isl_give isl_ast_expr *
8692         isl_ast_build_access_from_multi_pw_aff(
8693                 __isl_keep isl_ast_build *build,
8694                 __isl_take isl_multi_pw_aff *mpa);
8695         __isl_give isl_ast_expr *
8696         isl_ast_build_call_from_pw_multi_aff(
8697                 __isl_keep isl_ast_build *build,
8698                 __isl_take isl_pw_multi_aff *pma);
8699         __isl_give isl_ast_expr *
8700         isl_ast_build_call_from_multi_pw_aff(
8701                 __isl_keep isl_ast_build *build,
8702                 __isl_take isl_multi_pw_aff *mpa);
8704 The set <set> and
8705 the domains of C<pa>, C<mpa> and C<pma> should correspond
8706 to the schedule space of C<build>.
8707 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
8708 the function being called.
8709 If the accessed space is a nested relation, then it is taken
8710 to represent an access of the member specified by the range
8711 of this nested relation of the structure specified by the domain
8712 of the nested relation.
8714 The following functions can be used to modify an C<isl_ast_expr>.
8716         #include <isl/ast.h>
8717         __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
8718                 __isl_take isl_ast_expr *expr, int pos,
8719                 __isl_take isl_ast_expr *arg);
8721 Replace the argument of C<expr> at position C<pos> by C<arg>.
8723         #include <isl/ast.h>
8724         __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
8725                 __isl_take isl_ast_expr *expr,
8726                 __isl_take isl_id_to_ast_expr *id2expr);
8728 The function C<isl_ast_expr_substitute_ids> replaces the
8729 subexpressions of C<expr> of type C<isl_ast_expr_id>
8730 by the corresponding expression in C<id2expr>, if there is any.
8733 User specified data can be attached to an C<isl_ast_node> and obtained
8734 from the same C<isl_ast_node> using the following functions.
8736         #include <isl/ast.h>
8737         __isl_give isl_ast_node *isl_ast_node_set_annotation(
8738                 __isl_take isl_ast_node *node,
8739                 __isl_take isl_id *annotation);
8740         __isl_give isl_id *isl_ast_node_get_annotation(
8741                 __isl_keep isl_ast_node *node);
8743 Basic printing can be performed using the following functions.
8745         #include <isl/ast.h>
8746         __isl_give isl_printer *isl_printer_print_ast_expr(
8747                 __isl_take isl_printer *p,
8748                 __isl_keep isl_ast_expr *expr);
8749         __isl_give isl_printer *isl_printer_print_ast_node(
8750                 __isl_take isl_printer *p,
8751                 __isl_keep isl_ast_node *node);
8752         __isl_give char *isl_ast_expr_to_str(
8753                 __isl_keep isl_ast_expr *expr);
8755 More advanced printing can be performed using the following functions.
8757         #include <isl/ast.h>
8758         __isl_give isl_printer *isl_ast_op_type_print_macro(
8759                 enum isl_ast_op_type type,
8760                 __isl_take isl_printer *p);
8761         __isl_give isl_printer *isl_ast_node_print_macros(
8762                 __isl_keep isl_ast_node *node,
8763                 __isl_take isl_printer *p);
8764         __isl_give isl_printer *isl_ast_node_print(
8765                 __isl_keep isl_ast_node *node,
8766                 __isl_take isl_printer *p,
8767                 __isl_take isl_ast_print_options *options);
8768         __isl_give isl_printer *isl_ast_node_for_print(
8769                 __isl_keep isl_ast_node *node,
8770                 __isl_take isl_printer *p,
8771                 __isl_take isl_ast_print_options *options);
8772         __isl_give isl_printer *isl_ast_node_if_print(
8773                 __isl_keep isl_ast_node *node,
8774                 __isl_take isl_printer *p,
8775                 __isl_take isl_ast_print_options *options);
8777 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
8778 C<isl> may print out an AST that makes use of macros such
8779 as C<floord>, C<min> and C<max>.
8780 C<isl_ast_op_type_print_macro> prints out the macro
8781 corresponding to a specific C<isl_ast_op_type>.
8782 C<isl_ast_node_print_macros> scans the C<isl_ast_node>
8783 for expressions where these macros would be used and prints
8784 out the required macro definitions.
8785 Essentially, C<isl_ast_node_print_macros> calls
8786 C<isl_ast_node_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
8787 as function argument.
8788 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
8789 C<isl_ast_node_if_print> print an C<isl_ast_node>
8790 in C<ISL_FORMAT_C>, but allow for some extra control
8791 through an C<isl_ast_print_options> object.
8792 This object can be created using the following functions.
8794         #include <isl/ast.h>
8795         __isl_give isl_ast_print_options *
8796         isl_ast_print_options_alloc(isl_ctx *ctx);
8797         __isl_give isl_ast_print_options *
8798         isl_ast_print_options_copy(
8799                 __isl_keep isl_ast_print_options *options);
8800         __isl_null isl_ast_print_options *
8801         isl_ast_print_options_free(
8802                 __isl_take isl_ast_print_options *options);
8804         __isl_give isl_ast_print_options *
8805         isl_ast_print_options_set_print_user(
8806                 __isl_take isl_ast_print_options *options,
8807                 __isl_give isl_printer *(*print_user)(
8808                         __isl_take isl_printer *p,
8809                         __isl_take isl_ast_print_options *options,
8810                         __isl_keep isl_ast_node *node, void *user),
8811                 void *user);
8812         __isl_give isl_ast_print_options *
8813         isl_ast_print_options_set_print_for(
8814                 __isl_take isl_ast_print_options *options,
8815                 __isl_give isl_printer *(*print_for)(
8816                         __isl_take isl_printer *p,
8817                         __isl_take isl_ast_print_options *options,
8818                         __isl_keep isl_ast_node *node, void *user),
8819                 void *user);
8821 The callback set by C<isl_ast_print_options_set_print_user>
8822 is called whenever a node of type C<isl_ast_node_user> needs to
8823 be printed.
8824 The callback set by C<isl_ast_print_options_set_print_for>
8825 is called whenever a node of type C<isl_ast_node_for> needs to
8826 be printed.
8827 Note that C<isl_ast_node_for_print> will I<not> call the
8828 callback set by C<isl_ast_print_options_set_print_for> on the node
8829 on which C<isl_ast_node_for_print> is called, but only on nested
8830 nodes of type C<isl_ast_node_for>.  It is therefore safe to
8831 call C<isl_ast_node_for_print> from within the callback set by
8832 C<isl_ast_print_options_set_print_for>.
8834 The following option determines the type to be used for iterators
8835 while printing the AST.
8837         int isl_options_set_ast_iterator_type(
8838                 isl_ctx *ctx, const char *val);
8839         const char *isl_options_get_ast_iterator_type(
8840                 isl_ctx *ctx);
8842 The AST printer only prints body nodes as blocks if these
8843 blocks cannot be safely omitted.
8844 For example, a C<for> node with one body node will not be
8845 surrounded with braces in C<ISL_FORMAT_C>.
8846 A block will always be printed by setting the following option.
8848         int isl_options_set_ast_always_print_block(isl_ctx *ctx,
8849                 int val);
8850         int isl_options_get_ast_always_print_block(isl_ctx *ctx);
8852 =head3 Options
8854         #include <isl/ast_build.h>
8855         int isl_options_set_ast_build_atomic_upper_bound(
8856                 isl_ctx *ctx, int val);
8857         int isl_options_get_ast_build_atomic_upper_bound(
8858                 isl_ctx *ctx);
8859         int isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
8860                 int val);
8861         int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
8862         int isl_options_set_ast_build_exploit_nested_bounds(
8863                 isl_ctx *ctx, int val);
8864         int isl_options_get_ast_build_exploit_nested_bounds(
8865                 isl_ctx *ctx);
8866         int isl_options_set_ast_build_group_coscheduled(
8867                 isl_ctx *ctx, int val);
8868         int isl_options_get_ast_build_group_coscheduled(
8869                 isl_ctx *ctx);
8870         int isl_options_set_ast_build_scale_strides(
8871                 isl_ctx *ctx, int val);
8872         int isl_options_get_ast_build_scale_strides(
8873                 isl_ctx *ctx);
8874         int isl_options_set_ast_build_allow_else(isl_ctx *ctx,
8875                 int val);
8876         int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
8877         int isl_options_set_ast_build_allow_or(isl_ctx *ctx,
8878                 int val);
8879         int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
8881 =over
8883 =item * ast_build_atomic_upper_bound
8885 Generate loop upper bounds that consist of the current loop iterator,
8886 an operator and an expression not involving the iterator.
8887 If this option is not set, then the current loop iterator may appear
8888 several times in the upper bound.
8889 For example, when this option is turned off, AST generation
8890 for the schedule
8892         [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
8894 produces
8896         for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
8897           A(c0);
8899 When the option is turned on, the following AST is generated
8901         for (int c0 = 0; c0 <= min(100, n); c0 += 1)
8902           A(c0);
8904 =item * ast_build_prefer_pdiv
8906 If this option is turned off, then the AST generation will
8907 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
8908 operators, but no C<isl_ast_op_pdiv_q> or
8909 C<isl_ast_op_pdiv_r> operators.
8910 If this options is turned on, then C<isl> will try to convert
8911 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
8912 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
8914 =item * ast_build_exploit_nested_bounds
8916 Simplify conditions based on bounds of nested for loops.
8917 In particular, remove conditions that are implied by the fact
8918 that one or more nested loops have at least one iteration,
8919 meaning that the upper bound is at least as large as the lower bound.
8920 For example, when this option is turned off, AST generation
8921 for the schedule
8923         [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
8924                                         0 <= j <= M }
8926 produces
8928         if (M >= 0)
8929           for (int c0 = 0; c0 <= N; c0 += 1)
8930             for (int c1 = 0; c1 <= M; c1 += 1)
8931               A(c0, c1);
8933 When the option is turned on, the following AST is generated
8935         for (int c0 = 0; c0 <= N; c0 += 1)
8936           for (int c1 = 0; c1 <= M; c1 += 1)
8937             A(c0, c1);
8939 =item * ast_build_group_coscheduled
8941 If two domain elements are assigned the same schedule point, then
8942 they may be executed in any order and they may even appear in different
8943 loops.  If this options is set, then the AST generator will make
8944 sure that coscheduled domain elements do not appear in separate parts
8945 of the AST.  This is useful in case of nested AST generation
8946 if the outer AST generation is given only part of a schedule
8947 and the inner AST generation should handle the domains that are
8948 coscheduled by this initial part of the schedule together.
8949 For example if an AST is generated for a schedule
8951         { A[i] -> [0]; B[i] -> [0] }
8953 then the C<isl_ast_build_set_create_leaf> callback described
8954 below may get called twice, once for each domain.
8955 Setting this option ensures that the callback is only called once
8956 on both domains together.
8958 =item * ast_build_separation_bounds
8960 This option specifies which bounds to use during separation.
8961 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
8962 then all (possibly implicit) bounds on the current dimension will
8963 be used during separation.
8964 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
8965 then only those bounds that are explicitly available will
8966 be used during separation.
8968 =item * ast_build_scale_strides
8970 This option specifies whether the AST generator is allowed
8971 to scale down iterators of strided loops.
8973 =item * ast_build_allow_else
8975 This option specifies whether the AST generator is allowed
8976 to construct if statements with else branches.
8978 =item * ast_build_allow_or
8980 This option specifies whether the AST generator is allowed
8981 to construct if conditions with disjunctions.
8983 =back
8985 =head3 Fine-grained Control over AST Generation
8987 Besides specifying the constraints on the parameters,
8988 an C<isl_ast_build> object can be used to control
8989 various aspects of the AST generation process.
8990 The most prominent way of control is through ``options'',
8991 which can be set using the following function.
8993         #include <isl/ast_build.h>
8994         __isl_give isl_ast_build *
8995         isl_ast_build_set_options(
8996                 __isl_take isl_ast_build *control,
8997                 __isl_take isl_union_map *options);
8999 The options are encoded in an C<isl_union_map>.
9000 The domain of this union relation refers to the schedule domain,
9001 i.e., the range of the schedule passed
9002 to C<isl_ast_build_node_from_schedule_map>.
9003 In the case of nested AST generation (see L</"Nested AST Generation">),
9004 the domain of C<options> should refer to the extra piece of the schedule.
9005 That is, it should be equal to the range of the wrapped relation in the
9006 range of the schedule.
9007 The range of the options can consist of elements in one or more spaces,
9008 the names of which determine the effect of the option.
9009 The values of the range typically also refer to the schedule dimension
9010 to which the option applies.  In case of nested AST generation
9011 (see L</"Nested AST Generation">), these values refer to the position
9012 of the schedule dimension within the innermost AST generation.
9013 The constraints on the domain elements of
9014 the option should only refer to this dimension and earlier dimensions.
9015 We consider the following spaces.
9017 =over
9019 =item C<separation_class>
9021 This space is a wrapped relation between two one dimensional spaces.
9022 The input space represents the schedule dimension to which the option
9023 applies and the output space represents the separation class.
9024 While constructing a loop corresponding to the specified schedule
9025 dimension(s), the AST generator will try to generate separate loops
9026 for domain elements that are assigned different classes.
9027 If only some of the elements are assigned a class, then those elements
9028 that are not assigned any class will be treated as belonging to a class
9029 that is separate from the explicitly assigned classes.
9030 The typical use case for this option is to separate full tiles from
9031 partial tiles.
9032 The other options, described below, are applied after the separation
9033 into classes.
9035 As an example, consider the separation into full and partial tiles
9036 of a tiling of a triangular domain.
9037 Take, for example, the domain
9039         { A[i,j] : 0 <= i,j and i + j <= 100 }
9041 and a tiling into tiles of 10 by 10.  The input to the AST generator
9042 is then the schedule
9044         { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
9045                                                 i + j <= 100 }
9047 Without any options, the following AST is generated
9049         for (int c0 = 0; c0 <= 10; c0 += 1)
9050           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9051             for (int c2 = 10 * c0;
9052                  c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
9053                  c2 += 1)
9054               for (int c3 = 10 * c1;
9055                    c3 <= min(10 * c1 + 9, -c2 + 100);
9056                    c3 += 1)
9057                 A(c2, c3);
9059 Separation into full and partial tiles can be obtained by assigning
9060 a class, say C<0>, to the full tiles.  The full tiles are represented by those
9061 values of the first and second schedule dimensions for which there are
9062 values of the third and fourth dimensions to cover an entire tile.
9063 That is, we need to specify the following option
9065         { [a,b,c,d] -> separation_class[[0]->[0]] :
9066                 exists b': 0 <= 10a,10b' and
9067                            10a+9+10b'+9 <= 100;
9068           [a,b,c,d] -> separation_class[[1]->[0]] :
9069                 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
9071 which simplifies to
9073         { [a, b, c, d] -> separation_class[[1] -> [0]] :
9074                 a >= 0 and b >= 0 and b <= 8 - a;
9075           [a, b, c, d] -> separation_class[[0] -> [0]] :
9076                 a >= 0 and a <= 8 }
9078 With this option, the generated AST is as follows
9080         {
9081           for (int c0 = 0; c0 <= 8; c0 += 1) {
9082             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
9083               for (int c2 = 10 * c0;
9084                    c2 <= 10 * c0 + 9; c2 += 1)
9085                 for (int c3 = 10 * c1;
9086                      c3 <= 10 * c1 + 9; c3 += 1)
9087                   A(c2, c3);
9088             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
9089               for (int c2 = 10 * c0;
9090                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
9091                    c2 += 1)
9092                 for (int c3 = 10 * c1;
9093                      c3 <= min(-c2 + 100, 10 * c1 + 9);
9094                      c3 += 1)
9095                   A(c2, c3);
9096           }
9097           for (int c0 = 9; c0 <= 10; c0 += 1)
9098             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9099               for (int c2 = 10 * c0;
9100                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
9101                    c2 += 1)
9102                 for (int c3 = 10 * c1;
9103                      c3 <= min(10 * c1 + 9, -c2 + 100);
9104                      c3 += 1)
9105                   A(c2, c3);
9106         }
9108 =item C<separate>
9110 This is a single-dimensional space representing the schedule dimension(s)
9111 to which ``separation'' should be applied.  Separation tries to split
9112 a loop into several pieces if this can avoid the generation of guards
9113 inside the loop.
9114 See also the C<atomic> option.
9116 =item C<atomic>
9118 This is a single-dimensional space representing the schedule dimension(s)
9119 for which the domains should be considered ``atomic''.  That is, the
9120 AST generator will make sure that any given domain space will only appear
9121 in a single loop at the specified level.
9123 Consider the following schedule
9125         { a[i] -> [i] : 0 <= i < 10;
9126           b[i] -> [i+1] : 0 <= i < 10 }
9128 If the following option is specified
9130         { [i] -> separate[x] }
9132 then the following AST will be generated
9134         {
9135           a(0);
9136           for (int c0 = 1; c0 <= 9; c0 += 1) {
9137             a(c0);
9138             b(c0 - 1);
9139           }
9140           b(9);
9141         }
9143 If, on the other hand, the following option is specified
9145         { [i] -> atomic[x] }
9147 then the following AST will be generated
9149         for (int c0 = 0; c0 <= 10; c0 += 1) {
9150           if (c0 <= 9)
9151             a(c0);
9152           if (c0 >= 1)
9153             b(c0 - 1);
9154         }
9156 If neither C<atomic> nor C<separate> is specified, then the AST generator
9157 may produce either of these two results or some intermediate form.
9159 =item C<unroll>
9161 This is a single-dimensional space representing the schedule dimension(s)
9162 that should be I<completely> unrolled.
9163 To obtain a partial unrolling, the user should apply an additional
9164 strip-mining to the schedule and fully unroll the inner loop.
9166 =back
9168 Additional control is available through the following functions.
9170         #include <isl/ast_build.h>
9171         __isl_give isl_ast_build *
9172         isl_ast_build_set_iterators(
9173                 __isl_take isl_ast_build *control,
9174                 __isl_take isl_id_list *iterators);
9176 The function C<isl_ast_build_set_iterators> allows the user to
9177 specify a list of iterator C<isl_id>s to be used as iterators.
9178 If the input schedule is injective, then
9179 the number of elements in this list should be as large as the dimension
9180 of the schedule space, but no direct correspondence should be assumed
9181 between dimensions and elements.
9182 If the input schedule is not injective, then an additional number
9183 of C<isl_id>s equal to the largest dimension of the input domains
9184 may be required.
9185 If the number of provided C<isl_id>s is insufficient, then additional
9186 names are automatically generated.
9188         #include <isl/ast_build.h>
9189         __isl_give isl_ast_build *
9190         isl_ast_build_set_create_leaf(
9191                 __isl_take isl_ast_build *control,
9192                 __isl_give isl_ast_node *(*fn)(
9193                         __isl_take isl_ast_build *build,
9194                         void *user), void *user);
9197 C<isl_ast_build_set_create_leaf> function allows for the
9198 specification of a callback that should be called whenever the AST
9199 generator arrives at an element of the schedule domain.
9200 The callback should return an AST node that should be inserted
9201 at the corresponding position of the AST.  The default action (when
9202 the callback is not set) is to continue generating parts of the AST to scan
9203 all the domain elements associated to the schedule domain element
9204 and to insert user nodes, ``calling'' the domain element, for each of them.
9205 The C<build> argument contains the current state of the C<isl_ast_build>.
9206 To ease nested AST generation (see L</"Nested AST Generation">),
9207 all control information that is
9208 specific to the current AST generation such as the options and
9209 the callbacks has been removed from this C<isl_ast_build>.
9210 The callback would typically return the result of a nested
9211 AST generation or a
9212 user defined node created using the following function.
9214         #include <isl/ast.h>
9215         __isl_give isl_ast_node *isl_ast_node_alloc_user(
9216                 __isl_take isl_ast_expr *expr);
9218         #include <isl/ast_build.h>
9219         __isl_give isl_ast_build *
9220         isl_ast_build_set_at_each_domain(
9221                 __isl_take isl_ast_build *build,
9222                 __isl_give isl_ast_node *(*fn)(
9223                         __isl_take isl_ast_node *node,
9224                         __isl_keep isl_ast_build *build,
9225                         void *user), void *user);
9226         __isl_give isl_ast_build *
9227         isl_ast_build_set_before_each_for(
9228                 __isl_take isl_ast_build *build,
9229                 __isl_give isl_id *(*fn)(
9230                         __isl_keep isl_ast_build *build,
9231                         void *user), void *user);
9232         __isl_give isl_ast_build *
9233         isl_ast_build_set_after_each_for(
9234                 __isl_take isl_ast_build *build,
9235                 __isl_give isl_ast_node *(*fn)(
9236                         __isl_take isl_ast_node *node,
9237                         __isl_keep isl_ast_build *build,
9238                         void *user), void *user);
9240 The callback set by C<isl_ast_build_set_at_each_domain> will
9241 be called for each domain AST node.
9242 The callbacks set by C<isl_ast_build_set_before_each_for>
9243 and C<isl_ast_build_set_after_each_for> will be called
9244 for each for AST node.  The first will be called in depth-first
9245 pre-order, while the second will be called in depth-first post-order.
9246 Since C<isl_ast_build_set_before_each_for> is called before the for
9247 node is actually constructed, it is only passed an C<isl_ast_build>.
9248 The returned C<isl_id> will be added as an annotation (using
9249 C<isl_ast_node_set_annotation>) to the constructed for node.
9250 In particular, if the user has also specified an C<after_each_for>
9251 callback, then the annotation can be retrieved from the node passed to
9252 that callback using C<isl_ast_node_get_annotation>.
9253 All callbacks should C<NULL> on failure.
9254 The given C<isl_ast_build> can be used to create new
9255 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
9256 or C<isl_ast_build_call_from_pw_multi_aff>.
9258 =head3 Nested AST Generation
9260 C<isl> allows the user to create an AST within the context
9261 of another AST.  These nested ASTs are created using the
9262 same C<isl_ast_build_node_from_schedule_map> function that is used to create
9263 the outer AST.  The C<build> argument should be an C<isl_ast_build>
9264 passed to a callback set by
9265 C<isl_ast_build_set_create_leaf>.
9266 The space of the range of the C<schedule> argument should refer
9267 to this build.  In particular, the space should be a wrapped
9268 relation and the domain of this wrapped relation should be the
9269 same as that of the range of the schedule returned by
9270 C<isl_ast_build_get_schedule> below.
9271 In practice, the new schedule is typically
9272 created by calling C<isl_union_map_range_product> on the old schedule
9273 and some extra piece of the schedule.
9274 The space of the schedule domain is also available from
9275 the C<isl_ast_build>.
9277         #include <isl/ast_build.h>
9278         __isl_give isl_union_map *isl_ast_build_get_schedule(
9279                 __isl_keep isl_ast_build *build);
9280         __isl_give isl_space *isl_ast_build_get_schedule_space(
9281                 __isl_keep isl_ast_build *build);
9282         __isl_give isl_ast_build *isl_ast_build_restrict(
9283                 __isl_take isl_ast_build *build,
9284                 __isl_take isl_set *set);
9286 The C<isl_ast_build_get_schedule> function returns a (partial)
9287 schedule for the domains elements for which part of the AST still needs to
9288 be generated in the current build.
9289 In particular, the domain elements are mapped to those iterations of the loops
9290 enclosing the current point of the AST generation inside which
9291 the domain elements are executed.
9292 No direct correspondence between
9293 the input schedule and this schedule should be assumed.
9294 The space obtained from C<isl_ast_build_get_schedule_space> can be used
9295 to create a set for C<isl_ast_build_restrict> to intersect
9296 with the current build.  In particular, the set passed to
9297 C<isl_ast_build_restrict> can have additional parameters.
9298 The ids of the set dimensions in the space returned by
9299 C<isl_ast_build_get_schedule_space> correspond to the
9300 iterators of the already generated loops.
9301 The user should not rely on the ids of the output dimensions
9302 of the relations in the union relation returned by
9303 C<isl_ast_build_get_schedule> having any particular value.
9305 =head1 Applications
9307 Although C<isl> is mainly meant to be used as a library,
9308 it also contains some basic applications that use some
9309 of the functionality of C<isl>.
9310 The input may be specified in either the L<isl format>
9311 or the L<PolyLib format>.
9313 =head2 C<isl_polyhedron_sample>
9315 C<isl_polyhedron_sample> takes a polyhedron as input and prints
9316 an integer element of the polyhedron, if there is any.
9317 The first column in the output is the denominator and is always
9318 equal to 1.  If the polyhedron contains no integer points,
9319 then a vector of length zero is printed.
9321 =head2 C<isl_pip>
9323 C<isl_pip> takes the same input as the C<example> program
9324 from the C<piplib> distribution, i.e., a set of constraints
9325 on the parameters, a line containing only -1 and finally a set
9326 of constraints on a parametric polyhedron.
9327 The coefficients of the parameters appear in the last columns
9328 (but before the final constant column).
9329 The output is the lexicographic minimum of the parametric polyhedron.
9330 As C<isl> currently does not have its own output format, the output
9331 is just a dump of the internal state.
9333 =head2 C<isl_polyhedron_minimize>
9335 C<isl_polyhedron_minimize> computes the minimum of some linear
9336 or affine objective function over the integer points in a polyhedron.
9337 If an affine objective function
9338 is given, then the constant should appear in the last column.
9340 =head2 C<isl_polytope_scan>
9342 Given a polytope, C<isl_polytope_scan> prints
9343 all integer points in the polytope.
9345 =head2 C<isl_codegen>
9347 Given a schedule, a context set and an options relation,
9348 C<isl_codegen> prints out an AST that scans the domain elements
9349 of the schedule in the order of their image(s) taking into account
9350 the constraints in the context set.