Update ISL to isl-0.15-3-g532568a
[polly-mirror.git] / lib / External / isl / doc / user.pod
blob8fbc7fc92ae6529931125bf3643239fd7aac8397
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 =item * The C<separation_class> AST generation option has been
245 deprecated.
247 =item * The functions C<isl_equality_alloc> and C<isl_inequality_alloc>
248 have been renamed to C<isl_constraint_alloc_equality> and
249 C<isl_constraint_alloc_inequality>.  The original names have been
250 kept for backward compatibility, but they will be removed in the future.
252 =item * The C<schedule_fuse> option has been replaced
253 by the C<schedule_serialize_sccs> option.  The effect
254 of setting the C<schedule_fuse> option to C<ISL_SCHEDULE_FUSE_MIN>
255 is now obtained by turning on the C<schedule_serialize_sccs> option.
257 =back
259 =head1 License
261 C<isl> is released under the MIT license.
263 =over
265 Permission is hereby granted, free of charge, to any person obtaining a copy of
266 this software and associated documentation files (the "Software"), to deal in
267 the Software without restriction, including without limitation the rights to
268 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
269 of the Software, and to permit persons to whom the Software is furnished to do
270 so, subject to the following conditions:
272 The above copyright notice and this permission notice shall be included in all
273 copies or substantial portions of the Software.
275 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
276 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
277 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
278 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
279 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
280 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
281 SOFTWARE.
283 =back
285 Note that by default C<isl> requires C<GMP>, which is released
286 under the GNU Lesser General Public License (LGPL).  This means
287 that code linked against C<isl> is also linked against LGPL code.
289 When configuring with C<--with-int=imath> or C<--with-int=imath-32>, C<isl>
290 will link against C<imath>, a library for exact integer arithmetic released
291 under the MIT license.
293 =head1 Installation
295 The source of C<isl> can be obtained either as a tarball
296 or from the git repository.  Both are available from
297 L<http://freshmeat.net/projects/isl/>.
298 The installation process depends on how you obtained
299 the source.
301 =head2 Installation from the git repository
303 =over
305 =item 1 Clone or update the repository
307 The first time the source is obtained, you need to clone
308 the repository.
310         git clone git://repo.or.cz/isl.git
312 To obtain updates, you need to pull in the latest changes
314         git pull
316 =item 2 Optionally get C<imath> submodule
318 To build C<isl> with C<imath>, you need to obtain the C<imath>
319 submodule by running in the git source tree of C<isl>
321        git submodule init
322        git submodule update
324 This will fetch the required version of C<imath> in a subdirectory of C<isl>.
326 =item 2 Generate C<configure>
328         ./autogen.sh
330 =back
332 After performing the above steps, continue
333 with the L<Common installation instructions>.
335 =head2 Common installation instructions
337 =over
339 =item 1 Obtain C<GMP>
341 By default, building C<isl> requires C<GMP>, including its headers files.
342 Your distribution may not provide these header files by default
343 and you may need to install a package called C<gmp-devel> or something
344 similar.  Alternatively, C<GMP> can be built from
345 source, available from L<http://gmplib.org/>.
346 C<GMP> is not needed if you build C<isl> with C<imath>.
348 =item 2 Configure
350 C<isl> uses the standard C<autoconf> C<configure> script.
351 To run it, just type
353         ./configure
355 optionally followed by some configure options.
356 A complete list of options can be obtained by running
358         ./configure --help
360 Below we discuss some of the more common options.
362 =over
364 =item C<--prefix>
366 Installation prefix for C<isl>
368 =item C<--with-int=[gmp|imath|imath-32]>
370 Select the integer library to be used by C<isl>, the default is C<gmp>.
371 With C<imath-32>, C<isl> will use 32 bit integers, but fall back to C<imath>
372 for values out of the 32 bit range. In most applications, C<isl> will run
373 fastest with the C<imath-32> option, followed by C<gmp> and C<imath>, the
374 slowest.
376 =item C<--with-gmp-prefix>
378 Installation prefix for C<GMP> (architecture-independent files).
380 =item C<--with-gmp-exec-prefix>
382 Installation prefix for C<GMP> (architecture-dependent files).
384 =back
386 =item 3 Compile
388         make
390 =item 4 Install (optional)
392         make install
394 =back
396 =head1 Integer Set Library
398 =head2 Memory Management
400 Since a high-level operation on isl objects usually involves
401 several substeps and since the user is usually not interested in
402 the intermediate results, most functions that return a new object
403 will also release all the objects passed as arguments.
404 If the user still wants to use one or more of these arguments
405 after the function call, she should pass along a copy of the
406 object rather than the object itself.
407 The user is then responsible for making sure that the original
408 object gets used somewhere else or is explicitly freed.
410 The arguments and return values of all documented functions are
411 annotated to make clear which arguments are released and which
412 arguments are preserved.  In particular, the following annotations
413 are used
415 =over
417 =item C<__isl_give>
419 C<__isl_give> means that a new object is returned.
420 The user should make sure that the returned pointer is
421 used exactly once as a value for an C<__isl_take> argument.
422 In between, it can be used as a value for as many
423 C<__isl_keep> arguments as the user likes.
424 There is one exception, and that is the case where the
425 pointer returned is C<NULL>.  Is this case, the user
426 is free to use it as an C<__isl_take> argument or not.
427 When applied to a C<char *>, the returned pointer needs to be
428 freed using C<free>.
430 =item C<__isl_null>
432 C<__isl_null> means that a C<NULL> value is returned.
434 =item C<__isl_take>
436 C<__isl_take> means that the object the argument points to
437 is taken over by the function and may no longer be used
438 by the user as an argument to any other function.
439 The pointer value must be one returned by a function
440 returning an C<__isl_give> pointer.
441 If the user passes in a C<NULL> value, then this will
442 be treated as an error in the sense that the function will
443 not perform its usual operation.  However, it will still
444 make sure that all the other C<__isl_take> arguments
445 are released.
447 =item C<__isl_keep>
449 C<__isl_keep> means that the function will only use the object
450 temporarily.  After the function has finished, the user
451 can still use it as an argument to other functions.
452 A C<NULL> value will be treated in the same way as
453 a C<NULL> value for an C<__isl_take> argument.
454 This annotation may also be used on return values of
455 type C<const char *>, in which case the returned pointer should
456 not be freed by the user and is only valid until the object
457 from which it was derived is updated or freed.
459 =back
461 =head2 Initialization
463 All manipulations of integer sets and relations occur within
464 the context of an C<isl_ctx>.
465 A given C<isl_ctx> can only be used within a single thread.
466 All arguments of a function are required to have been allocated
467 within the same context.
468 There are currently no functions available for moving an object
469 from one C<isl_ctx> to another C<isl_ctx>.  This means that
470 there is currently no way of safely moving an object from one
471 thread to another, unless the whole C<isl_ctx> is moved.
473 An C<isl_ctx> can be allocated using C<isl_ctx_alloc> and
474 freed using C<isl_ctx_free>.
475 All objects allocated within an C<isl_ctx> should be freed
476 before the C<isl_ctx> itself is freed.
478         isl_ctx *isl_ctx_alloc();
479         void isl_ctx_free(isl_ctx *ctx);
481 The user can impose a bound on the number of low-level I<operations>
482 that can be performed by an C<isl_ctx>.  This bound can be set and
483 retrieved using the following functions.  A bound of zero means that
484 no bound is imposed.  The number of operations performed can be
485 reset using C<isl_ctx_reset_operations>.  Note that the number
486 of low-level operations needed to perform a high-level computation
487 may differ significantly across different versions
488 of C<isl>, but it should be the same across different platforms
489 for the same version of C<isl>.
491 Warning: This feature is experimental.  C<isl> has good support to abort and
492 bail out during the computation, but this feature may exercise error code paths
493 that are normally not used that much. Consequently, it is not unlikely that
494 hidden bugs will be exposed.
496         void isl_ctx_set_max_operations(isl_ctx *ctx,
497                 unsigned long max_operations);
498         unsigned long isl_ctx_get_max_operations(isl_ctx *ctx);
499         void isl_ctx_reset_operations(isl_ctx *ctx);
501 In order to be able to create an object in the same context
502 as another object, most object types (described later in
503 this document) provide a function to obtain the context
504 in which the object was created.
506         #include <isl/val.h>
507         isl_ctx *isl_val_get_ctx(__isl_keep isl_val *val);
508         isl_ctx *isl_multi_val_get_ctx(
509                 __isl_keep isl_multi_val *mv);
511         #include <isl/id.h>
512         isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
514         #include <isl/local_space.h>
515         isl_ctx *isl_local_space_get_ctx(
516                 __isl_keep isl_local_space *ls);
518         #include <isl/set.h>
519         isl_ctx *isl_set_list_get_ctx(
520                 __isl_keep isl_set_list *list);
522         #include <isl/aff.h>
523         isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
524         isl_ctx *isl_multi_aff_get_ctx(
525                 __isl_keep isl_multi_aff *maff);
526         isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pa);
527         isl_ctx *isl_pw_multi_aff_get_ctx(
528                 __isl_keep isl_pw_multi_aff *pma);
529         isl_ctx *isl_multi_pw_aff_get_ctx(
530                 __isl_keep isl_multi_pw_aff *mpa);
531         isl_ctx *isl_union_pw_aff_get_ctx(
532                 __isl_keep isl_union_pw_aff *upa);
533         isl_ctx *isl_union_pw_multi_aff_get_ctx(
534                 __isl_keep isl_union_pw_multi_aff *upma);
535         isl_ctx *isl_multi_union_pw_aff_get_ctx(
536                 __isl_keep isl_multi_union_pw_aff *mupa);
538         #include <isl/id_to_ast_expr.h>
539         isl_ctx *isl_id_to_ast_expr_get_ctx(
540                 __isl_keep isl_id_to_ast_expr *id2expr);
542         #include <isl/point.h>
543         isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
545         #include <isl/vec.h>
546         isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
548         #include <isl/mat.h>
549         isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
551         #include <isl/vertices.h>
552         isl_ctx *isl_vertices_get_ctx(
553                 __isl_keep isl_vertices *vertices);
554         isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
555         isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
557         #include <isl/flow.h>
558         isl_ctx *isl_restriction_get_ctx(
559                 __isl_keep isl_restriction *restr);
560         isl_ctx *isl_union_access_info_get_ctx(
561                 __isl_keep isl_union_access_info *access);
562         isl_ctx *isl_union_flow_get_ctx(
563                 __isl_keep isl_union_flow *flow);
565         #include <isl/schedule.h>
566         isl_ctx *isl_schedule_get_ctx(
567                 __isl_keep isl_schedule *sched);
568         isl_ctx *isl_schedule_constraints_get_ctx(
569                 __isl_keep isl_schedule_constraints *sc);
571         #include <isl/schedule_node.h>
572         isl_ctx *isl_schedule_node_get_ctx(
573                 __isl_keep isl_schedule_node *node);
575         #include <isl/band.h>
576         isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band);
578         #include <isl/ast_build.h>
579         isl_ctx *isl_ast_build_get_ctx(
580                 __isl_keep isl_ast_build *build);
582         #include <isl/ast.h>
583         isl_ctx *isl_ast_expr_get_ctx(
584                 __isl_keep isl_ast_expr *expr);
585         isl_ctx *isl_ast_node_get_ctx(
586                 __isl_keep isl_ast_node *node);
588 =head2 Return Types
590 C<isl> uses two special return types for functions that either return
591 a boolean or that in principle do not return anything.
592 In particular, the C<isl_bool> type has three possible values:
593 C<isl_bool_true> (a positive integer value), indicating I<true> or I<yes>;
594 C<isl_bool_false> (the integer value zero), indicating I<false> or I<no>; and
595 C<isl_bool_error> (a negative integer value), indicating that something
596 went wrong.
597 The C<isl_stat> type has two possible values:
598 C<isl_stat_ok> (the integer value zero), indicating a successful
599 operation; and
600 C<isl_stat_error> (a negative integer value), indicating that something
601 went wrong.
602 See L</"Error Handling"> for more information on
603 C<isl_bool_error> and C<isl_stat_error>.
605 =head2 Values
607 An C<isl_val> represents an integer value, a rational value
608 or one of three special values, infinity, negative infinity and NaN.
609 Some predefined values can be created using the following functions.
611         #include <isl/val.h>
612         __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
613         __isl_give isl_val *isl_val_one(isl_ctx *ctx);
614         __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
615         __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
616         __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
617         __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
619 Specific integer values can be created using the following functions.
621         #include <isl/val.h>
622         __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
623                 long i);
624         __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
625                 unsigned long u);
626         __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
627                 size_t n, size_t size, const void *chunks);
629 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
630 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
631 The least significant digit is assumed to be stored first.
633 Value objects can be copied and freed using the following functions.
635         #include <isl/val.h>
636         __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
637         __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
639 They can be inspected using the following functions.
641         #include <isl/val.h>
642         long isl_val_get_num_si(__isl_keep isl_val *v);
643         long isl_val_get_den_si(__isl_keep isl_val *v);
644         double isl_val_get_d(__isl_keep isl_val *v);
645         size_t isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
646                 size_t size);
647         int isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
648                 size_t size, void *chunks);
650 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
651 of C<size> bytes needed to store the absolute value of the
652 numerator of C<v>.
653 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
654 which is assumed to have been preallocated by the caller.
655 The least significant digit is stored first.
656 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
657 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
658 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
660 An C<isl_val> can be modified using the following function.
662         #include <isl/val.h>
663         __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
664                 long i);
666 The following unary properties are defined on C<isl_val>s.
668         #include <isl/val.h>
669         int isl_val_sgn(__isl_keep isl_val *v);
670         isl_bool isl_val_is_zero(__isl_keep isl_val *v);
671         isl_bool isl_val_is_one(__isl_keep isl_val *v);
672         isl_bool isl_val_is_negone(__isl_keep isl_val *v);
673         isl_bool isl_val_is_nonneg(__isl_keep isl_val *v);
674         isl_bool isl_val_is_nonpos(__isl_keep isl_val *v);
675         isl_bool isl_val_is_pos(__isl_keep isl_val *v);
676         isl_bool isl_val_is_neg(__isl_keep isl_val *v);
677         isl_bool isl_val_is_int(__isl_keep isl_val *v);
678         isl_bool isl_val_is_rat(__isl_keep isl_val *v);
679         isl_bool isl_val_is_nan(__isl_keep isl_val *v);
680         isl_bool isl_val_is_infty(__isl_keep isl_val *v);
681         isl_bool isl_val_is_neginfty(__isl_keep isl_val *v);
683 Note that the sign of NaN is undefined.
685 The following binary properties are defined on pairs of C<isl_val>s.
687         #include <isl/val.h>
688         isl_bool isl_val_lt(__isl_keep isl_val *v1,
689                 __isl_keep isl_val *v2);
690         isl_bool isl_val_le(__isl_keep isl_val *v1,
691                 __isl_keep isl_val *v2);
692         isl_bool isl_val_gt(__isl_keep isl_val *v1,
693                 __isl_keep isl_val *v2);
694         isl_bool isl_val_ge(__isl_keep isl_val *v1,
695                 __isl_keep isl_val *v2);
696         isl_bool isl_val_eq(__isl_keep isl_val *v1,
697                 __isl_keep isl_val *v2);
698         isl_bool isl_val_ne(__isl_keep isl_val *v1,
699                 __isl_keep isl_val *v2);
700         isl_bool isl_val_abs_eq(__isl_keep isl_val *v1,
701                 __isl_keep isl_val *v2);
703 The function C<isl_val_abs_eq> checks whether its two arguments
704 are equal in absolute value.
706 For integer C<isl_val>s we additionally have the following binary property.
708         #include <isl/val.h>
709         isl_bool isl_val_is_divisible_by(__isl_keep isl_val *v1,
710                 __isl_keep isl_val *v2);
712 An C<isl_val> can also be compared to an integer using the following
713 function.  The result is undefined for NaN.
715         #include <isl/val.h>
716         int isl_val_cmp_si(__isl_keep isl_val *v, long i);
718 The following unary operations are available on C<isl_val>s.
720         #include <isl/val.h>
721         __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
722         __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
723         __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
724         __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
725         __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
726         __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
727         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
729 The following binary operations are available on C<isl_val>s.
731         #include <isl/val.h>
732         __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
733                 __isl_take isl_val *v2);
734         __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
735                 __isl_take isl_val *v2);
736         __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
737                 __isl_take isl_val *v2);
738         __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
739                 unsigned long v2);
740         __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
741                 __isl_take isl_val *v2);
742         __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
743                 unsigned long v2);
744         __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
745                 __isl_take isl_val *v2);
746         __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
747                 unsigned long v2);
748         __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
749                 __isl_take isl_val *v2);
751 On integer values, we additionally have the following operations.
753         #include <isl/val.h>
754         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
755         __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
756                 __isl_take isl_val *v2);
757         __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
758                 __isl_take isl_val *v2);
759         __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
760                 __isl_take isl_val *v2, __isl_give isl_val **x,
761                 __isl_give isl_val **y);
763 The function C<isl_val_gcdext> returns the greatest common divisor g
764 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
765 that C<*x> * C<v1> + C<*y> * C<v2> = g.
767 =head3 GMP specific functions
769 These functions are only available if C<isl> has been compiled with C<GMP>
770 support.
772 Specific integer and rational values can be created from C<GMP> values using
773 the following functions.
775         #include <isl/val_gmp.h>
776         __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
777                 mpz_t z);
778         __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
779                 const mpz_t n, const mpz_t d);
781 The numerator and denominator of a rational value can be extracted as
782 C<GMP> values using the following functions.
784         #include <isl/val_gmp.h>
785         int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
786         int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
788 =head2 Sets and Relations
790 C<isl> uses six types of objects for representing sets and relations,
791 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
792 C<isl_union_set> and C<isl_union_map>.
793 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
794 can be described as a conjunction of affine constraints, while
795 C<isl_set> and C<isl_map> represent unions of
796 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
797 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
798 to live in the same space.  C<isl_union_set>s and C<isl_union_map>s
799 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
800 where spaces are considered different if they have a different number
801 of dimensions and/or different names (see L<"Spaces">).
802 The difference between sets and relations (maps) is that sets have
803 one set of variables, while relations have two sets of variables,
804 input variables and output variables.
806 =head2 Error Handling
808 C<isl> supports different ways to react in case a runtime error is triggered.
809 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
810 with two maps that have incompatible spaces. There are three possible ways
811 to react on error: to warn, to continue or to abort.
813 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
814 the last error in the corresponding C<isl_ctx> and the function in which the
815 error was triggered returns a value indicating that some error has
816 occurred.  In case of functions returning a pointer, this value is
817 C<NULL>.  In case of functions returning an C<isl_bool> or an
818 C<isl_stat>, this valus is C<isl_bool_error> or C<isl_stat_error>.
819 An error does not corrupt internal state,
820 such that isl can continue to be used. C<isl> also provides functions to
821 read the last error and to reset the memory that stores the last error. The
822 last error is only stored for information purposes. Its presence does not
823 change the behavior of C<isl>. Hence, resetting an error is not required to
824 continue to use isl, but only to observe new errors.
826         #include <isl/ctx.h>
827         enum isl_error isl_ctx_last_error(isl_ctx *ctx);
828         void isl_ctx_reset_error(isl_ctx *ctx);
830 Another option is to continue on error. This is similar to warn on error mode,
831 except that C<isl> does not print any warning. This allows a program to
832 implement its own error reporting.
834 The last option is to directly abort the execution of the program from within
835 the isl library. This makes it obviously impossible to recover from an error,
836 but it allows to directly spot the error location. By aborting on error,
837 debuggers break at the location the error occurred and can provide a stack
838 trace. Other tools that automatically provide stack traces on abort or that do
839 not want to continue execution after an error was triggered may also prefer to
840 abort on error.
842 The on error behavior of isl can be specified by calling
843 C<isl_options_set_on_error> or by setting the command line option
844 C<--isl-on-error>. Valid arguments for the function call are
845 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
846 choices for the command line option are C<warn>, C<continue> and C<abort>.
847 It is also possible to query the current error mode.
849         #include <isl/options.h>
850         isl_stat isl_options_set_on_error(isl_ctx *ctx, int val);
851         int isl_options_get_on_error(isl_ctx *ctx);
853 =head2 Identifiers
855 Identifiers are used to identify both individual dimensions
856 and tuples of dimensions.  They consist of an optional name and an optional
857 user pointer.  The name and the user pointer cannot both be C<NULL>, however.
858 Identifiers with the same name but different pointer values
859 are considered to be distinct.
860 Similarly, identifiers with different names but the same pointer value
861 are also considered to be distinct.
862 Equal identifiers are represented using the same object.
863 Pairs of identifiers can therefore be tested for equality using the
864 C<==> operator.
865 Identifiers can be constructed, copied, freed, inspected and printed
866 using the following functions.
868         #include <isl/id.h>
869         __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
870                 __isl_keep const char *name, void *user);
871         __isl_give isl_id *isl_id_set_free_user(
872                 __isl_take isl_id *id,
873                 __isl_give void (*free_user)(void *user));
874         __isl_give isl_id *isl_id_copy(isl_id *id);
875         __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
877         void *isl_id_get_user(__isl_keep isl_id *id);
878         __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
880         __isl_give isl_printer *isl_printer_print_id(
881                 __isl_take isl_printer *p, __isl_keep isl_id *id);
883 The callback set by C<isl_id_set_free_user> is called on the user
884 pointer when the last reference to the C<isl_id> is freed.
885 Note that C<isl_id_get_name> returns a pointer to some internal
886 data structure, so the result can only be used while the
887 corresponding C<isl_id> is alive.
889 =head2 Spaces
891 Whenever a new set, relation or similar object is created from scratch,
892 the space in which it lives needs to be specified using an C<isl_space>.
893 Each space involves zero or more parameters and zero, one or two
894 tuples of set or input/output dimensions.  The parameters and dimensions
895 are identified by an C<isl_dim_type> and a position.
896 The type C<isl_dim_param> refers to parameters,
897 the type C<isl_dim_set> refers to set dimensions (for spaces
898 with a single tuple of dimensions) and the types C<isl_dim_in>
899 and C<isl_dim_out> refer to input and output dimensions
900 (for spaces with two tuples of dimensions).
901 Local spaces (see L</"Local Spaces">) also contain dimensions
902 of type C<isl_dim_div>.
903 Note that parameters are only identified by their position within
904 a given object.  Across different objects, parameters are (usually)
905 identified by their names or identifiers.  Only unnamed parameters
906 are identified by their positions across objects.  The use of unnamed
907 parameters is discouraged.
909         #include <isl/space.h>
910         __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
911                 unsigned nparam, unsigned n_in, unsigned n_out);
912         __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
913                 unsigned nparam);
914         __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
915                 unsigned nparam, unsigned dim);
916         __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
917         __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
919 The space used for creating a parameter domain
920 needs to be created using C<isl_space_params_alloc>.
921 For other sets, the space
922 needs to be created using C<isl_space_set_alloc>, while
923 for a relation, the space
924 needs to be created using C<isl_space_alloc>.
926 To check whether a given space is that of a set or a map
927 or whether it is a parameter space, use these functions:
929         #include <isl/space.h>
930         isl_bool isl_space_is_params(__isl_keep isl_space *space);
931         isl_bool isl_space_is_set(__isl_keep isl_space *space);
932         isl_bool isl_space_is_map(__isl_keep isl_space *space);
934 Spaces can be compared using the following functions:
936         #include <isl/space.h>
937         isl_bool isl_space_is_equal(__isl_keep isl_space *space1,
938                 __isl_keep isl_space *space2);
939         isl_bool isl_space_is_domain(__isl_keep isl_space *space1,
940                 __isl_keep isl_space *space2);
941         isl_bool isl_space_is_range(__isl_keep isl_space *space1,
942                 __isl_keep isl_space *space2);
943         isl_bool isl_space_tuple_is_equal(
944                 __isl_keep isl_space *space1,
945                 enum isl_dim_type type1,
946                 __isl_keep isl_space *space2,
947                 enum isl_dim_type type2);
949 C<isl_space_is_domain> checks whether the first argument is equal
950 to the domain of the second argument.  This requires in particular that
951 the first argument is a set space and that the second argument
952 is a map space.  C<isl_space_tuple_is_equal> checks whether the given
953 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
954 spaces are the same.  That is, it checks if they have the same
955 identifier (if any), the same dimension and the same internal structure
956 (if any).
958 It is often useful to create objects that live in the
959 same space as some other object.  This can be accomplished
960 by creating the new objects
961 (see L</"Creating New Sets and Relations"> or
962 L</"Functions">) based on the space
963 of the original object.
965         #include <isl/set.h>
966         __isl_give isl_space *isl_basic_set_get_space(
967                 __isl_keep isl_basic_set *bset);
968         __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
970         #include <isl/union_set.h>
971         __isl_give isl_space *isl_union_set_get_space(
972                 __isl_keep isl_union_set *uset);
974         #include <isl/map.h>
975         __isl_give isl_space *isl_basic_map_get_space(
976                 __isl_keep isl_basic_map *bmap);
977         __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
979         #include <isl/union_map.h>
980         __isl_give isl_space *isl_union_map_get_space(
981                 __isl_keep isl_union_map *umap);
983         #include <isl/constraint.h>
984         __isl_give isl_space *isl_constraint_get_space(
985                 __isl_keep isl_constraint *constraint);
987         #include <isl/polynomial.h>
988         __isl_give isl_space *isl_qpolynomial_get_domain_space(
989                 __isl_keep isl_qpolynomial *qp);
990         __isl_give isl_space *isl_qpolynomial_get_space(
991                 __isl_keep isl_qpolynomial *qp);
992         __isl_give isl_space *isl_qpolynomial_fold_get_space(
993                 __isl_keep isl_qpolynomial_fold *fold);
994         __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
995                 __isl_keep isl_pw_qpolynomial *pwqp);
996         __isl_give isl_space *isl_pw_qpolynomial_get_space(
997                 __isl_keep isl_pw_qpolynomial *pwqp);
998         __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
999                 __isl_keep isl_pw_qpolynomial_fold *pwf);
1000         __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
1001                 __isl_keep isl_pw_qpolynomial_fold *pwf);
1002         __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
1003                 __isl_keep isl_union_pw_qpolynomial *upwqp);
1004         __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
1005                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
1007         #include <isl/val.h>
1008         __isl_give isl_space *isl_multi_val_get_space(
1009                 __isl_keep isl_multi_val *mv);
1011         #include <isl/aff.h>
1012         __isl_give isl_space *isl_aff_get_domain_space(
1013                 __isl_keep isl_aff *aff);
1014         __isl_give isl_space *isl_aff_get_space(
1015                 __isl_keep isl_aff *aff);
1016         __isl_give isl_space *isl_pw_aff_get_domain_space(
1017                 __isl_keep isl_pw_aff *pwaff);
1018         __isl_give isl_space *isl_pw_aff_get_space(
1019                 __isl_keep isl_pw_aff *pwaff);
1020         __isl_give isl_space *isl_multi_aff_get_domain_space(
1021                 __isl_keep isl_multi_aff *maff);
1022         __isl_give isl_space *isl_multi_aff_get_space(
1023                 __isl_keep isl_multi_aff *maff);
1024         __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
1025                 __isl_keep isl_pw_multi_aff *pma);
1026         __isl_give isl_space *isl_pw_multi_aff_get_space(
1027                 __isl_keep isl_pw_multi_aff *pma);
1028         __isl_give isl_space *isl_union_pw_aff_get_space(
1029                 __isl_keep isl_union_pw_aff *upa);
1030         __isl_give isl_space *isl_union_pw_multi_aff_get_space(
1031                 __isl_keep isl_union_pw_multi_aff *upma);
1032         __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
1033                 __isl_keep isl_multi_pw_aff *mpa);
1034         __isl_give isl_space *isl_multi_pw_aff_get_space(
1035                 __isl_keep isl_multi_pw_aff *mpa);
1036         __isl_give isl_space *
1037         isl_multi_union_pw_aff_get_domain_space(
1038                 __isl_keep isl_multi_union_pw_aff *mupa);
1039         __isl_give isl_space *
1040         isl_multi_union_pw_aff_get_space(
1041                 __isl_keep isl_multi_union_pw_aff *mupa);
1043         #include <isl/point.h>
1044         __isl_give isl_space *isl_point_get_space(
1045                 __isl_keep isl_point *pnt);
1047 The number of dimensions of a given type of space
1048 may be read off from a space or an object that lives
1049 in a space using the following functions.
1050 In case of C<isl_space_dim>, type may be
1051 C<isl_dim_param>, C<isl_dim_in> (only for relations),
1052 C<isl_dim_out> (only for relations), C<isl_dim_set>
1053 (only for sets) or C<isl_dim_all>.
1055         #include <isl/space.h>
1056         unsigned isl_space_dim(__isl_keep isl_space *space,
1057                 enum isl_dim_type type);
1059         #include <isl/local_space.h>
1060         int isl_local_space_dim(__isl_keep isl_local_space *ls,
1061                 enum isl_dim_type type);
1063         #include <isl/set.h>
1064         unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1065                 enum isl_dim_type type);
1066         unsigned isl_set_dim(__isl_keep isl_set *set,
1067                 enum isl_dim_type type);
1069         #include <isl/union_set.h>
1070         unsigned isl_union_set_dim(__isl_keep isl_union_set *uset,
1071                 enum isl_dim_type type);
1073         #include <isl/map.h>
1074         unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1075                 enum isl_dim_type type);
1076         unsigned isl_map_dim(__isl_keep isl_map *map,
1077                 enum isl_dim_type type);
1079         #include <isl/union_map.h>
1080         unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
1081                 enum isl_dim_type type);
1083         #include <isl/val.h>
1084         unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1085                 enum isl_dim_type type);
1087         #include <isl/aff.h>
1088         int isl_aff_dim(__isl_keep isl_aff *aff,
1089                 enum isl_dim_type type);
1090         unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1091                 enum isl_dim_type type);
1092         unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1093                 enum isl_dim_type type);
1094         unsigned isl_pw_multi_aff_dim(
1095                 __isl_keep isl_pw_multi_aff *pma,
1096                 enum isl_dim_type type);
1097         unsigned isl_multi_pw_aff_dim(
1098                 __isl_keep isl_multi_pw_aff *mpa,
1099                 enum isl_dim_type type);
1100         unsigned isl_union_pw_aff_dim(
1101                 __isl_keep isl_union_pw_aff *upa,
1102                 enum isl_dim_type type);
1103         unsigned isl_union_pw_multi_aff_dim(
1104                 __isl_keep isl_union_pw_multi_aff *upma,
1105                 enum isl_dim_type type);
1106         unsigned isl_multi_union_pw_aff_dim(
1107                 __isl_keep isl_multi_union_pw_aff *mupa,
1108                 enum isl_dim_type type);
1110         #include <isl/polynomial.h>
1111         unsigned isl_union_pw_qpolynomial_dim(
1112                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1113                 enum isl_dim_type type);
1114         unsigned isl_union_pw_qpolynomial_fold_dim(
1115                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1116                 enum isl_dim_type type);
1118 Note that an C<isl_union_set>, an C<isl_union_map>,
1119 an C<isl_union_pw_multi_aff>,
1120 an C<isl_union_pw_qpolynomial> and
1121 an C<isl_union_pw_qpolynomial_fold>
1122 only have parameters.
1124 The identifiers or names of the individual dimensions of spaces
1125 may be set or read off using the following functions on spaces
1126 or objects that live in spaces.
1127 These functions are mostly useful to obtain the identifiers, positions
1128 or names of the parameters.  Identifiers of individual dimensions are
1129 essentially only useful for printing.  They are ignored by all other
1130 operations and may not be preserved across those operations.
1132         #include <isl/space.h>
1133         __isl_give isl_space *isl_space_set_dim_id(
1134                 __isl_take isl_space *space,
1135                 enum isl_dim_type type, unsigned pos,
1136                 __isl_take isl_id *id);
1137         isl_bool isl_space_has_dim_id(__isl_keep isl_space *space,
1138                 enum isl_dim_type type, unsigned pos);
1139         __isl_give isl_id *isl_space_get_dim_id(
1140                 __isl_keep isl_space *space,
1141                 enum isl_dim_type type, unsigned pos);
1142         __isl_give isl_space *isl_space_set_dim_name(
1143                 __isl_take isl_space *space,
1144                  enum isl_dim_type type, unsigned pos,
1145                  __isl_keep const char *name);
1146         isl_bool isl_space_has_dim_name(__isl_keep isl_space *space,
1147                 enum isl_dim_type type, unsigned pos);
1148         __isl_keep const char *isl_space_get_dim_name(
1149                 __isl_keep isl_space *space,
1150                 enum isl_dim_type type, unsigned pos);
1152         #include <isl/local_space.h>
1153         __isl_give isl_local_space *isl_local_space_set_dim_id(
1154                 __isl_take isl_local_space *ls,
1155                 enum isl_dim_type type, unsigned pos,
1156                 __isl_take isl_id *id);
1157         isl_bool isl_local_space_has_dim_id(
1158                 __isl_keep isl_local_space *ls,
1159                 enum isl_dim_type type, unsigned pos);
1160         __isl_give isl_id *isl_local_space_get_dim_id(
1161                 __isl_keep isl_local_space *ls,
1162                 enum isl_dim_type type, unsigned pos);
1163         __isl_give isl_local_space *isl_local_space_set_dim_name(
1164                 __isl_take isl_local_space *ls,
1165                 enum isl_dim_type type, unsigned pos, const char *s);
1166         isl_bool isl_local_space_has_dim_name(
1167                 __isl_keep isl_local_space *ls,
1168                 enum isl_dim_type type, unsigned pos)
1169         const char *isl_local_space_get_dim_name(
1170                 __isl_keep isl_local_space *ls,
1171                 enum isl_dim_type type, unsigned pos);
1173         #include <isl/constraint.h>
1174         const char *isl_constraint_get_dim_name(
1175                 __isl_keep isl_constraint *constraint,
1176                 enum isl_dim_type type, unsigned pos);
1178         #include <isl/set.h>
1179         __isl_give isl_id *isl_basic_set_get_dim_id(
1180                 __isl_keep isl_basic_set *bset,
1181                 enum isl_dim_type type, unsigned pos);
1182         __isl_give isl_set *isl_set_set_dim_id(
1183                 __isl_take isl_set *set, enum isl_dim_type type,
1184                 unsigned pos, __isl_take isl_id *id);
1185         isl_bool isl_set_has_dim_id(__isl_keep isl_set *set,
1186                 enum isl_dim_type type, unsigned pos);
1187         __isl_give isl_id *isl_set_get_dim_id(
1188                 __isl_keep isl_set *set, enum isl_dim_type type,
1189                 unsigned pos);
1190         const char *isl_basic_set_get_dim_name(
1191                 __isl_keep isl_basic_set *bset,
1192                 enum isl_dim_type type, unsigned pos);
1193         isl_bool isl_set_has_dim_name(__isl_keep isl_set *set,
1194                 enum isl_dim_type type, unsigned pos);
1195         const char *isl_set_get_dim_name(
1196                 __isl_keep isl_set *set,
1197                 enum isl_dim_type type, unsigned pos);
1199         #include <isl/map.h>
1200         __isl_give isl_map *isl_map_set_dim_id(
1201                 __isl_take isl_map *map, enum isl_dim_type type,
1202                 unsigned pos, __isl_take isl_id *id);
1203         isl_bool isl_basic_map_has_dim_id(
1204                 __isl_keep isl_basic_map *bmap,
1205                 enum isl_dim_type type, unsigned pos);
1206         isl_bool isl_map_has_dim_id(__isl_keep isl_map *map,
1207                 enum isl_dim_type type, unsigned pos);
1208         __isl_give isl_id *isl_map_get_dim_id(
1209                 __isl_keep isl_map *map, enum isl_dim_type type,
1210                 unsigned pos);
1211         __isl_give isl_id *isl_union_map_get_dim_id(
1212                 __isl_keep isl_union_map *umap,
1213                 enum isl_dim_type type, unsigned pos);
1214         const char *isl_basic_map_get_dim_name(
1215                 __isl_keep isl_basic_map *bmap,
1216                 enum isl_dim_type type, unsigned pos);
1217         isl_bool isl_map_has_dim_name(__isl_keep isl_map *map,
1218                 enum isl_dim_type type, unsigned pos);
1219         const char *isl_map_get_dim_name(
1220                 __isl_keep isl_map *map,
1221                 enum isl_dim_type type, unsigned pos);
1223         #include <isl/val.h>
1224         __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1225                 __isl_take isl_multi_val *mv,
1226                 enum isl_dim_type type, unsigned pos,
1227                 __isl_take isl_id *id);
1228         __isl_give isl_id *isl_multi_val_get_dim_id(
1229                 __isl_keep isl_multi_val *mv,
1230                 enum isl_dim_type type, unsigned pos);
1231         __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1232                 __isl_take isl_multi_val *mv,
1233                 enum isl_dim_type type, unsigned pos, const char *s);
1235         #include <isl/aff.h>
1236         __isl_give isl_aff *isl_aff_set_dim_id(
1237                 __isl_take isl_aff *aff, enum isl_dim_type type,
1238                 unsigned pos, __isl_take isl_id *id);
1239         __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1240                 __isl_take isl_multi_aff *maff,
1241                 enum isl_dim_type type, unsigned pos,
1242                 __isl_take isl_id *id);
1243         __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1244                 __isl_take isl_pw_aff *pma,
1245                 enum isl_dim_type type, unsigned pos,
1246                 __isl_take isl_id *id);
1247         __isl_give isl_multi_pw_aff *
1248         isl_multi_pw_aff_set_dim_id(
1249                 __isl_take isl_multi_pw_aff *mpa,
1250                 enum isl_dim_type type, unsigned pos,
1251                 __isl_take isl_id *id);
1252         __isl_give isl_multi_union_pw_aff *
1253         isl_multi_union_pw_aff_set_dim_id(
1254                 __isl_take isl_multi_union_pw_aff *mupa,
1255                 enum isl_dim_type type, unsigned pos,
1256                 __isl_take isl_id *id);
1257         __isl_give isl_id *isl_multi_aff_get_dim_id(
1258                 __isl_keep isl_multi_aff *ma,
1259                 enum isl_dim_type type, unsigned pos);
1260         isl_bool isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1261                 enum isl_dim_type type, unsigned pos);
1262         __isl_give isl_id *isl_pw_aff_get_dim_id(
1263                 __isl_keep isl_pw_aff *pa,
1264                 enum isl_dim_type type, unsigned pos);
1265         __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1266                 __isl_keep isl_pw_multi_aff *pma,
1267                 enum isl_dim_type type, unsigned pos);
1268         __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1269                 __isl_keep isl_multi_pw_aff *mpa,
1270                 enum isl_dim_type type, unsigned pos);
1271         __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1272                 __isl_keep isl_multi_union_pw_aff *mupa,
1273                 enum isl_dim_type type, unsigned pos);
1274         __isl_give isl_aff *isl_aff_set_dim_name(
1275                 __isl_take isl_aff *aff, enum isl_dim_type type,
1276                 unsigned pos, const char *s);
1277         __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1278                 __isl_take isl_multi_aff *maff,
1279                 enum isl_dim_type type, unsigned pos, const char *s);
1280         __isl_give isl_multi_pw_aff *
1281         isl_multi_pw_aff_set_dim_name(
1282                 __isl_take isl_multi_pw_aff *mpa,
1283                 enum isl_dim_type type, unsigned pos, const char *s);
1284         __isl_give isl_union_pw_aff *
1285         isl_union_pw_aff_set_dim_name(
1286                 __isl_take isl_union_pw_aff *upa,
1287                 enum isl_dim_type type, unsigned pos,
1288                 const char *s);
1289         __isl_give isl_union_pw_multi_aff *
1290         isl_union_pw_multi_aff_set_dim_name(
1291                 __isl_take isl_union_pw_multi_aff *upma,
1292                 enum isl_dim_type type, unsigned pos,
1293                 const char *s);
1294         __isl_give isl_multi_union_pw_aff *
1295         isl_multi_union_pw_aff_set_dim_name(
1296                 __isl_take isl_multi_union_pw_aff *mupa,
1297                 enum isl_dim_type type, unsigned pos,
1298         const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1299                 enum isl_dim_type type, unsigned pos);
1300         const char *isl_pw_aff_get_dim_name(
1301                 __isl_keep isl_pw_aff *pa,
1302                 enum isl_dim_type type, unsigned pos);
1303         const char *isl_pw_multi_aff_get_dim_name(
1304                 __isl_keep isl_pw_multi_aff *pma,
1305                 enum isl_dim_type type, unsigned pos);
1307         #include <isl/polynomial.h>
1308         __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1309                 __isl_take isl_qpolynomial *qp,
1310                 enum isl_dim_type type, unsigned pos,
1311                 const char *s);
1312         __isl_give isl_pw_qpolynomial *
1313         isl_pw_qpolynomial_set_dim_name(
1314                 __isl_take isl_pw_qpolynomial *pwqp,
1315                 enum isl_dim_type type, unsigned pos,
1316                 const char *s);
1317         __isl_give isl_pw_qpolynomial_fold *
1318         isl_pw_qpolynomial_fold_set_dim_name(
1319                 __isl_take isl_pw_qpolynomial_fold *pwf,
1320                 enum isl_dim_type type, unsigned pos,
1321                 const char *s);
1322         __isl_give isl_union_pw_qpolynomial *
1323         isl_union_pw_qpolynomial_set_dim_name(
1324                 __isl_take isl_union_pw_qpolynomial *upwqp,
1325                 enum isl_dim_type type, unsigned pos,
1326                 const char *s);
1327         __isl_give isl_union_pw_qpolynomial_fold *
1328         isl_union_pw_qpolynomial_fold_set_dim_name(
1329                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1330                 enum isl_dim_type type, unsigned pos,
1331                 const char *s);
1333 Note that C<isl_space_get_name> returns a pointer to some internal
1334 data structure, so the result can only be used while the
1335 corresponding C<isl_space> is alive.
1336 Also note that every function that operates on two sets or relations
1337 requires that both arguments have the same parameters.  This also
1338 means that if one of the arguments has named parameters, then the
1339 other needs to have named parameters too and the names need to match.
1340 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1341 arguments may have different parameters (as long as they are named),
1342 in which case the result will have as parameters the union of the parameters of
1343 the arguments.
1345 Given the identifier or name of a dimension (typically a parameter),
1346 its position can be obtained from the following functions.
1348         #include <isl/space.h>
1349         int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1350                 enum isl_dim_type type, __isl_keep isl_id *id);
1351         int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1352                 enum isl_dim_type type, const char *name);
1354         #include <isl/local_space.h>
1355         int isl_local_space_find_dim_by_name(
1356                 __isl_keep isl_local_space *ls,
1357                 enum isl_dim_type type, const char *name);
1359         #include <isl/val.h>
1360         int isl_multi_val_find_dim_by_id(
1361                 __isl_keep isl_multi_val *mv,
1362                 enum isl_dim_type type, __isl_keep isl_id *id);
1363         int isl_multi_val_find_dim_by_name(
1364                 __isl_keep isl_multi_val *mv,
1365                 enum isl_dim_type type, const char *name);
1367         #include <isl/set.h>
1368         int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1369                 enum isl_dim_type type, __isl_keep isl_id *id);
1370         int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1371                 enum isl_dim_type type, const char *name);
1373         #include <isl/map.h>
1374         int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1375                 enum isl_dim_type type, __isl_keep isl_id *id);
1376         int isl_basic_map_find_dim_by_name(
1377                 __isl_keep isl_basic_map *bmap,
1378                 enum isl_dim_type type, const char *name);
1379         int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1380                 enum isl_dim_type type, const char *name);
1381         int isl_union_map_find_dim_by_name(
1382                 __isl_keep isl_union_map *umap,
1383                 enum isl_dim_type type, const char *name);
1385         #include <isl/aff.h>
1386         int isl_multi_aff_find_dim_by_id(
1387                 __isl_keep isl_multi_aff *ma,
1388                 enum isl_dim_type type, __isl_keep isl_id *id);
1389         int isl_multi_pw_aff_find_dim_by_id(
1390                 __isl_keep isl_multi_pw_aff *mpa,
1391                 enum isl_dim_type type, __isl_keep isl_id *id);
1392         int isl_multi_union_pw_aff_find_dim_by_id(
1393                 __isl_keep isl_union_multi_pw_aff *mupa,
1394                 enum isl_dim_type type, __isl_keep isl_id *id);
1395         int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1396                 enum isl_dim_type type, const char *name);
1397         int isl_multi_aff_find_dim_by_name(
1398                 __isl_keep isl_multi_aff *ma,
1399                 enum isl_dim_type type, const char *name);
1400         int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1401                 enum isl_dim_type type, const char *name);
1402         int isl_multi_pw_aff_find_dim_by_name(
1403                 __isl_keep isl_multi_pw_aff *mpa,
1404                 enum isl_dim_type type, const char *name);
1405         int isl_pw_multi_aff_find_dim_by_name(
1406                 __isl_keep isl_pw_multi_aff *pma,
1407                 enum isl_dim_type type, const char *name);
1408         int isl_union_pw_aff_find_dim_by_name(
1409                 __isl_keep isl_union_pw_aff *upa,
1410                 enum isl_dim_type type, const char *name);
1411         int isl_union_pw_multi_aff_find_dim_by_name(
1412                 __isl_keep isl_union_pw_multi_aff *upma,
1413                 enum isl_dim_type type, const char *name);
1414         int isl_multi_union_pw_aff_find_dim_by_name(
1415                 __isl_keep isl_multi_union_pw_aff *mupa,
1416                 enum isl_dim_type type, const char *name);
1418         #include <isl/polynomial.h>
1419         int isl_pw_qpolynomial_find_dim_by_name(
1420                 __isl_keep isl_pw_qpolynomial *pwqp,
1421                 enum isl_dim_type type, const char *name);
1422         int isl_pw_qpolynomial_fold_find_dim_by_name(
1423                 __isl_keep isl_pw_qpolynomial_fold *pwf,
1424                 enum isl_dim_type type, const char *name);
1425         int isl_union_pw_qpolynomial_find_dim_by_name(
1426                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1427                 enum isl_dim_type type, const char *name);
1428         int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1429                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1430                 enum isl_dim_type type, const char *name);
1432 The identifiers or names of entire spaces may be set or read off
1433 using the following functions.
1435         #include <isl/space.h>
1436         __isl_give isl_space *isl_space_set_tuple_id(
1437                 __isl_take isl_space *space,
1438                 enum isl_dim_type type, __isl_take isl_id *id);
1439         __isl_give isl_space *isl_space_reset_tuple_id(
1440                 __isl_take isl_space *space, enum isl_dim_type type);
1441         isl_bool isl_space_has_tuple_id(
1442                 __isl_keep isl_space *space,
1443                 enum isl_dim_type type);
1444         __isl_give isl_id *isl_space_get_tuple_id(
1445                 __isl_keep isl_space *space, enum isl_dim_type type);
1446         __isl_give isl_space *isl_space_set_tuple_name(
1447                 __isl_take isl_space *space,
1448                 enum isl_dim_type type, const char *s);
1449         isl_bool isl_space_has_tuple_name(
1450                 __isl_keep isl_space *space,
1451                 enum isl_dim_type type);
1452         const char *isl_space_get_tuple_name(__isl_keep isl_space *space,
1453                 enum isl_dim_type type);
1455         #include <isl/local_space.h>
1456         __isl_give isl_local_space *isl_local_space_set_tuple_id(
1457                 __isl_take isl_local_space *ls,
1458                 enum isl_dim_type type, __isl_take isl_id *id);
1460         #include <isl/set.h>
1461         __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1462                 __isl_take isl_basic_set *bset,
1463                 __isl_take isl_id *id);
1464         __isl_give isl_set *isl_set_set_tuple_id(
1465                 __isl_take isl_set *set, __isl_take isl_id *id);
1466         __isl_give isl_set *isl_set_reset_tuple_id(
1467                 __isl_take isl_set *set);
1468         isl_bool isl_set_has_tuple_id(__isl_keep isl_set *set);
1469         __isl_give isl_id *isl_set_get_tuple_id(
1470                 __isl_keep isl_set *set);
1471         __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1472                 __isl_take isl_basic_set *set, const char *s);
1473         __isl_give isl_set *isl_set_set_tuple_name(
1474                 __isl_take isl_set *set, const char *s);
1475         const char *isl_basic_set_get_tuple_name(
1476                 __isl_keep isl_basic_set *bset);
1477         isl_bool isl_set_has_tuple_name(__isl_keep isl_set *set);
1478         const char *isl_set_get_tuple_name(
1479                 __isl_keep isl_set *set);
1481         #include <isl/map.h>
1482         __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1483                 __isl_take isl_basic_map *bmap,
1484                 enum isl_dim_type type, __isl_take isl_id *id);
1485         __isl_give isl_map *isl_map_set_tuple_id(
1486                 __isl_take isl_map *map, enum isl_dim_type type,
1487                 __isl_take isl_id *id);
1488         __isl_give isl_map *isl_map_reset_tuple_id(
1489                 __isl_take isl_map *map, enum isl_dim_type type);
1490         isl_bool isl_map_has_tuple_id(__isl_keep isl_map *map,
1491                 enum isl_dim_type type);
1492         __isl_give isl_id *isl_map_get_tuple_id(
1493                 __isl_keep isl_map *map, enum isl_dim_type type);
1494         __isl_give isl_map *isl_map_set_tuple_name(
1495                 __isl_take isl_map *map,
1496                 enum isl_dim_type type, const char *s);
1497         const char *isl_basic_map_get_tuple_name(
1498                 __isl_keep isl_basic_map *bmap,
1499                 enum isl_dim_type type);
1500         __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1501                 __isl_take isl_basic_map *bmap,
1502                 enum isl_dim_type type, const char *s);
1503         isl_bool isl_map_has_tuple_name(__isl_keep isl_map *map,
1504                 enum isl_dim_type type);
1505         const char *isl_map_get_tuple_name(
1506                 __isl_keep isl_map *map,
1507                 enum isl_dim_type type);
1509         #include <isl/val.h>
1510         __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1511                 __isl_take isl_multi_val *mv,
1512                 enum isl_dim_type type, __isl_take isl_id *id);
1513         __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1514                 __isl_take isl_multi_val *mv,
1515                 enum isl_dim_type type);
1516         isl_bool isl_multi_val_has_tuple_id(
1517                 __isl_keep isl_multi_val *mv,
1518                 enum isl_dim_type type);
1519         __isl_give isl_id *isl_multi_val_get_tuple_id(
1520                 __isl_keep isl_multi_val *mv,
1521                 enum isl_dim_type type);
1522         __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1523                 __isl_take isl_multi_val *mv,
1524                 enum isl_dim_type type, const char *s);
1525         const char *isl_multi_val_get_tuple_name(
1526                 __isl_keep isl_multi_val *mv,
1527                 enum isl_dim_type type);
1529         #include <isl/aff.h>
1530         __isl_give isl_aff *isl_aff_set_tuple_id(
1531                 __isl_take isl_aff *aff,
1532                 enum isl_dim_type type, __isl_take isl_id *id);
1533         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1534                 __isl_take isl_multi_aff *maff,
1535                 enum isl_dim_type type, __isl_take isl_id *id);
1536         __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1537                 __isl_take isl_pw_aff *pwaff,
1538                 enum isl_dim_type type, __isl_take isl_id *id);
1539         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1540                 __isl_take isl_pw_multi_aff *pma,
1541                 enum isl_dim_type type, __isl_take isl_id *id);
1542         __isl_give isl_multi_union_pw_aff *
1543         isl_multi_union_pw_aff_set_tuple_id(
1544                 __isl_take isl_multi_union_pw_aff *mupa,
1545                 enum isl_dim_type type, __isl_take isl_id *id);
1546         __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1547                 __isl_take isl_multi_aff *ma,
1548                 enum isl_dim_type type);
1549         __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1550                 __isl_take isl_pw_aff *pa,
1551                 enum isl_dim_type type);
1552         __isl_give isl_multi_pw_aff *
1553         isl_multi_pw_aff_reset_tuple_id(
1554                 __isl_take isl_multi_pw_aff *mpa,
1555                 enum isl_dim_type type);
1556         __isl_give isl_pw_multi_aff *
1557         isl_pw_multi_aff_reset_tuple_id(
1558                 __isl_take isl_pw_multi_aff *pma,
1559                 enum isl_dim_type type);
1560         __isl_give isl_multi_union_pw_aff *
1561         isl_multi_union_pw_aff_reset_tuple_id(
1562                 __isl_take isl_multi_union_pw_aff *mupa,
1563                 enum isl_dim_type type);
1564         isl_bool isl_multi_aff_has_tuple_id(
1565                 __isl_keep isl_multi_aff *ma,
1566                 enum isl_dim_type type);
1567         __isl_give isl_id *isl_multi_aff_get_tuple_id(
1568                 __isl_keep isl_multi_aff *ma,
1569                 enum isl_dim_type type);
1570         isl_bool isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1571                 enum isl_dim_type type);
1572         __isl_give isl_id *isl_pw_aff_get_tuple_id(
1573                 __isl_keep isl_pw_aff *pa,
1574                 enum isl_dim_type type);
1575         isl_bool isl_pw_multi_aff_has_tuple_id(
1576                 __isl_keep isl_pw_multi_aff *pma,
1577                 enum isl_dim_type type);
1578         __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1579                 __isl_keep isl_pw_multi_aff *pma,
1580                 enum isl_dim_type type);
1581         isl_bool isl_multi_pw_aff_has_tuple_id(
1582                 __isl_keep isl_multi_pw_aff *mpa,
1583                 enum isl_dim_type type);
1584         __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1585                 __isl_keep isl_multi_pw_aff *mpa,
1586                 enum isl_dim_type type);
1587         isl_bool isl_multi_union_pw_aff_has_tuple_id(
1588                 __isl_keep isl_multi_union_pw_aff *mupa,
1589                 enum isl_dim_type type);
1590         __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1591                 __isl_keep isl_multi_union_pw_aff *mupa,
1592                 enum isl_dim_type type);
1593         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1594                 __isl_take isl_multi_aff *maff,
1595                 enum isl_dim_type type, const char *s);
1596         __isl_give isl_multi_pw_aff *
1597         isl_multi_pw_aff_set_tuple_name(
1598                 __isl_take isl_multi_pw_aff *mpa,
1599                 enum isl_dim_type type, const char *s);
1600         __isl_give isl_multi_union_pw_aff *
1601         isl_multi_union_pw_aff_set_tuple_name(
1602                 __isl_take isl_multi_union_pw_aff *mupa,
1603                 enum isl_dim_type type, const char *s);
1604         const char *isl_multi_aff_get_tuple_name(
1605                 __isl_keep isl_multi_aff *multi,
1606                 enum isl_dim_type type);
1607         isl_bool isl_pw_multi_aff_has_tuple_name(
1608                 __isl_keep isl_pw_multi_aff *pma,
1609                 enum isl_dim_type type);
1610         const char *isl_pw_multi_aff_get_tuple_name(
1611                 __isl_keep isl_pw_multi_aff *pma,
1612                 enum isl_dim_type type);
1613         const char *isl_multi_union_pw_aff_get_tuple_name(
1614                 __isl_keep isl_multi_union_pw_aff *mupa,
1615                 enum isl_dim_type type);
1617 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1618 or C<isl_dim_set>.  As with C<isl_space_get_name>,
1619 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1620 data structure.
1621 Binary operations require the corresponding spaces of their arguments
1622 to have the same name.
1624 To keep the names of all parameters and tuples, but reset the user pointers
1625 of all the corresponding identifiers, use the following function.
1627         #include <isl/space.h>
1628         __isl_give isl_space *isl_space_reset_user(
1629                 __isl_take isl_space *space);
1631         #include <isl/set.h>
1632         __isl_give isl_set *isl_set_reset_user(
1633                 __isl_take isl_set *set);
1635         #include <isl/map.h>
1636         __isl_give isl_map *isl_map_reset_user(
1637                 __isl_take isl_map *map);
1639         #include <isl/union_set.h>
1640         __isl_give isl_union_set *isl_union_set_reset_user(
1641                 __isl_take isl_union_set *uset);
1643         #include <isl/union_map.h>
1644         __isl_give isl_union_map *isl_union_map_reset_user(
1645                 __isl_take isl_union_map *umap);
1647         #include <isl/val.h>
1648         __isl_give isl_multi_val *isl_multi_val_reset_user(
1649                 __isl_take isl_multi_val *mv);
1651         #include <isl/aff.h>
1652         __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1653                 __isl_take isl_multi_aff *ma);
1654         __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1655                 __isl_take isl_pw_aff *pa);
1656         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1657                 __isl_take isl_multi_pw_aff *mpa);
1658         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1659                 __isl_take isl_pw_multi_aff *pma);
1660         __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1661                 __isl_take isl_union_pw_aff *upa);
1662         __isl_give isl_multi_union_pw_aff *
1663         isl_multi_union_pw_aff_reset_user(
1664                 __isl_take isl_multi_union_pw_aff *mupa);
1665         __isl_give isl_union_pw_multi_aff *
1666         isl_union_pw_multi_aff_reset_user(
1667                 __isl_take isl_union_pw_multi_aff *upma);
1669         #include <isl/polynomial.h>
1670         __isl_give isl_pw_qpolynomial *
1671         isl_pw_qpolynomial_reset_user(
1672                 __isl_take isl_pw_qpolynomial *pwqp);
1673         __isl_give isl_union_pw_qpolynomial *
1674         isl_union_pw_qpolynomial_reset_user(
1675                 __isl_take isl_union_pw_qpolynomial *upwqp);
1676         __isl_give isl_pw_qpolynomial_fold *
1677         isl_pw_qpolynomial_fold_reset_user(
1678                 __isl_take isl_pw_qpolynomial_fold *pwf);
1679         __isl_give isl_union_pw_qpolynomial_fold *
1680         isl_union_pw_qpolynomial_fold_reset_user(
1681                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1683 Spaces can be nested.  In particular, the domain of a set or
1684 the domain or range of a relation can be a nested relation.
1685 This process is also called I<wrapping>.
1686 The functions for detecting, constructing and deconstructing
1687 such nested spaces can be found in the wrapping properties
1688 of L</"Unary Properties">, the wrapping operations
1689 of L</"Unary Operations"> and the Cartesian product operations
1690 of L</"Basic Operations">.
1692 Spaces can be created from other spaces
1693 using the functions described in L</"Unary Operations">
1694 and L</"Binary Operations">.
1696 =head2 Local Spaces
1698 A local space is essentially a space with
1699 zero or more existentially quantified variables.
1700 The local space of various objects can be obtained
1701 using the following functions.
1703         #include <isl/constraint.h>
1704         __isl_give isl_local_space *isl_constraint_get_local_space(
1705                 __isl_keep isl_constraint *constraint);
1707         #include <isl/set.h>
1708         __isl_give isl_local_space *isl_basic_set_get_local_space(
1709                 __isl_keep isl_basic_set *bset);
1711         #include <isl/map.h>
1712         __isl_give isl_local_space *isl_basic_map_get_local_space(
1713                 __isl_keep isl_basic_map *bmap);
1715         #include <isl/aff.h>
1716         __isl_give isl_local_space *isl_aff_get_domain_local_space(
1717                 __isl_keep isl_aff *aff);
1718         __isl_give isl_local_space *isl_aff_get_local_space(
1719                 __isl_keep isl_aff *aff);
1721 A new local space can be created from a space using
1723         #include <isl/local_space.h>
1724         __isl_give isl_local_space *isl_local_space_from_space(
1725                 __isl_take isl_space *space);
1727 They can be inspected, modified, copied and freed using the following functions.
1729         #include <isl/local_space.h>
1730         isl_bool isl_local_space_is_params(
1731                 __isl_keep isl_local_space *ls);
1732         isl_bool isl_local_space_is_set(
1733                 __isl_keep isl_local_space *ls);
1734         __isl_give isl_space *isl_local_space_get_space(
1735                 __isl_keep isl_local_space *ls);
1736         __isl_give isl_aff *isl_local_space_get_div(
1737                 __isl_keep isl_local_space *ls, int pos);
1738         __isl_give isl_local_space *isl_local_space_copy(
1739                 __isl_keep isl_local_space *ls);
1740         __isl_null isl_local_space *isl_local_space_free(
1741                 __isl_take isl_local_space *ls);
1743 Note that C<isl_local_space_get_div> can only be used on local spaces
1744 of sets.
1746 Two local spaces can be compared using
1748         isl_bool isl_local_space_is_equal(
1749                 __isl_keep isl_local_space *ls1,
1750                 __isl_keep isl_local_space *ls2);
1752 Local spaces can be created from other local spaces
1753 using the functions described in L</"Unary Operations">
1754 and L</"Binary Operations">.
1756 =head2 Creating New Sets and Relations
1758 C<isl> has functions for creating some standard sets and relations.
1760 =over
1762 =item * Empty sets and relations
1764         __isl_give isl_basic_set *isl_basic_set_empty(
1765                 __isl_take isl_space *space);
1766         __isl_give isl_basic_map *isl_basic_map_empty(
1767                 __isl_take isl_space *space);
1768         __isl_give isl_set *isl_set_empty(
1769                 __isl_take isl_space *space);
1770         __isl_give isl_map *isl_map_empty(
1771                 __isl_take isl_space *space);
1772         __isl_give isl_union_set *isl_union_set_empty(
1773                 __isl_take isl_space *space);
1774         __isl_give isl_union_map *isl_union_map_empty(
1775                 __isl_take isl_space *space);
1777 For C<isl_union_set>s and C<isl_union_map>s, the space
1778 is only used to specify the parameters.
1780 =item * Universe sets and relations
1782         __isl_give isl_basic_set *isl_basic_set_universe(
1783                 __isl_take isl_space *space);
1784         __isl_give isl_basic_map *isl_basic_map_universe(
1785                 __isl_take isl_space *space);
1786         __isl_give isl_set *isl_set_universe(
1787                 __isl_take isl_space *space);
1788         __isl_give isl_map *isl_map_universe(
1789                 __isl_take isl_space *space);
1790         __isl_give isl_union_set *isl_union_set_universe(
1791                 __isl_take isl_union_set *uset);
1792         __isl_give isl_union_map *isl_union_map_universe(
1793                 __isl_take isl_union_map *umap);
1795 The sets and relations constructed by the functions above
1796 contain all integer values, while those constructed by the
1797 functions below only contain non-negative values.
1799         __isl_give isl_basic_set *isl_basic_set_nat_universe(
1800                 __isl_take isl_space *space);
1801         __isl_give isl_basic_map *isl_basic_map_nat_universe(
1802                 __isl_take isl_space *space);
1803         __isl_give isl_set *isl_set_nat_universe(
1804                 __isl_take isl_space *space);
1805         __isl_give isl_map *isl_map_nat_universe(
1806                 __isl_take isl_space *space);
1808 =item * Identity relations
1810         __isl_give isl_basic_map *isl_basic_map_identity(
1811                 __isl_take isl_space *space);
1812         __isl_give isl_map *isl_map_identity(
1813                 __isl_take isl_space *space);
1815 The number of input and output dimensions in C<space> needs
1816 to be the same.
1818 =item * Lexicographic order
1820         __isl_give isl_map *isl_map_lex_lt(
1821                 __isl_take isl_space *set_space);
1822         __isl_give isl_map *isl_map_lex_le(
1823                 __isl_take isl_space *set_space);
1824         __isl_give isl_map *isl_map_lex_gt(
1825                 __isl_take isl_space *set_space);
1826         __isl_give isl_map *isl_map_lex_ge(
1827                 __isl_take isl_space *set_space);
1828         __isl_give isl_map *isl_map_lex_lt_first(
1829                 __isl_take isl_space *space, unsigned n);
1830         __isl_give isl_map *isl_map_lex_le_first(
1831                 __isl_take isl_space *space, unsigned n);
1832         __isl_give isl_map *isl_map_lex_gt_first(
1833                 __isl_take isl_space *space, unsigned n);
1834         __isl_give isl_map *isl_map_lex_ge_first(
1835                 __isl_take isl_space *space, unsigned n);
1837 The first four functions take a space for a B<set>
1838 and return relations that express that the elements in the domain
1839 are lexicographically less
1840 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1841 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1842 than the elements in the range.
1843 The last four functions take a space for a map
1844 and return relations that express that the first C<n> dimensions
1845 in the domain are lexicographically less
1846 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1847 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1848 than the first C<n> dimensions in the range.
1850 =back
1852 A basic set or relation can be converted to a set or relation
1853 using the following functions.
1855         __isl_give isl_set *isl_set_from_basic_set(
1856                 __isl_take isl_basic_set *bset);
1857         __isl_give isl_map *isl_map_from_basic_map(
1858                 __isl_take isl_basic_map *bmap);
1860 Sets and relations can be converted to union sets and relations
1861 using the following functions.
1863         __isl_give isl_union_set *isl_union_set_from_basic_set(
1864                 __isl_take isl_basic_set *bset);
1865         __isl_give isl_union_map *isl_union_map_from_basic_map(
1866                 __isl_take isl_basic_map *bmap);
1867         __isl_give isl_union_set *isl_union_set_from_set(
1868                 __isl_take isl_set *set);
1869         __isl_give isl_union_map *isl_union_map_from_map(
1870                 __isl_take isl_map *map);
1872 The inverse conversions below can only be used if the input
1873 union set or relation is known to contain elements in exactly one
1874 space.
1876         __isl_give isl_set *isl_set_from_union_set(
1877                 __isl_take isl_union_set *uset);
1878         __isl_give isl_map *isl_map_from_union_map(
1879                 __isl_take isl_union_map *umap);
1881 Sets and relations can be copied and freed again using the following
1882 functions.
1884         __isl_give isl_basic_set *isl_basic_set_copy(
1885                 __isl_keep isl_basic_set *bset);
1886         __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1887         __isl_give isl_union_set *isl_union_set_copy(
1888                 __isl_keep isl_union_set *uset);
1889         __isl_give isl_basic_map *isl_basic_map_copy(
1890                 __isl_keep isl_basic_map *bmap);
1891         __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1892         __isl_give isl_union_map *isl_union_map_copy(
1893                 __isl_keep isl_union_map *umap);
1894         __isl_null isl_basic_set *isl_basic_set_free(
1895                 __isl_take isl_basic_set *bset);
1896         __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1897         __isl_null isl_union_set *isl_union_set_free(
1898                 __isl_take isl_union_set *uset);
1899         __isl_null isl_basic_map *isl_basic_map_free(
1900                 __isl_take isl_basic_map *bmap);
1901         __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1902         __isl_null isl_union_map *isl_union_map_free(
1903                 __isl_take isl_union_map *umap);
1905 Other sets and relations can be constructed by starting
1906 from a universe set or relation, adding equality and/or
1907 inequality constraints and then projecting out the
1908 existentially quantified variables, if any.
1909 Constraints can be constructed, manipulated and
1910 added to (or removed from) (basic) sets and relations
1911 using the following functions.
1913         #include <isl/constraint.h>
1914         __isl_give isl_constraint *isl_constraint_alloc_equality(
1915                 __isl_take isl_local_space *ls);
1916         __isl_give isl_constraint *isl_constraint_alloc_inequality(
1917                 __isl_take isl_local_space *ls);
1918         __isl_give isl_constraint *isl_constraint_set_constant_si(
1919                 __isl_take isl_constraint *constraint, int v);
1920         __isl_give isl_constraint *isl_constraint_set_constant_val(
1921                 __isl_take isl_constraint *constraint,
1922                 __isl_take isl_val *v);
1923         __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1924                 __isl_take isl_constraint *constraint,
1925                 enum isl_dim_type type, int pos, int v);
1926         __isl_give isl_constraint *
1927         isl_constraint_set_coefficient_val(
1928                 __isl_take isl_constraint *constraint,
1929                 enum isl_dim_type type, int pos,
1930                 __isl_take isl_val *v);
1931         __isl_give isl_basic_map *isl_basic_map_add_constraint(
1932                 __isl_take isl_basic_map *bmap,
1933                 __isl_take isl_constraint *constraint);
1934         __isl_give isl_basic_set *isl_basic_set_add_constraint(
1935                 __isl_take isl_basic_set *bset,
1936                 __isl_take isl_constraint *constraint);
1937         __isl_give isl_map *isl_map_add_constraint(
1938                 __isl_take isl_map *map,
1939                 __isl_take isl_constraint *constraint);
1940         __isl_give isl_set *isl_set_add_constraint(
1941                 __isl_take isl_set *set,
1942                 __isl_take isl_constraint *constraint);
1944 For example, to create a set containing the even integers
1945 between 10 and 42, you would use the following code.
1947         isl_space *space;
1948         isl_local_space *ls;
1949         isl_constraint *c;
1950         isl_basic_set *bset;
1952         space = isl_space_set_alloc(ctx, 0, 2);
1953         bset = isl_basic_set_universe(isl_space_copy(space));
1954         ls = isl_local_space_from_space(space);
1956         c = isl_constraint_alloc_equality(isl_local_space_copy(ls));
1957         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1958         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
1959         bset = isl_basic_set_add_constraint(bset, c);
1961         c = isl_constraint_alloc_inequality(isl_local_space_copy(ls));
1962         c = isl_constraint_set_constant_si(c, -10);
1963         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
1964         bset = isl_basic_set_add_constraint(bset, c);
1966         c = isl_constraint_alloc_inequality(ls);
1967         c = isl_constraint_set_constant_si(c, 42);
1968         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1969         bset = isl_basic_set_add_constraint(bset, c);
1971         bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
1973 Or, alternatively,
1975         isl_basic_set *bset;
1976         bset = isl_basic_set_read_from_str(ctx,
1977                 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
1979 A basic set or relation can also be constructed from two matrices
1980 describing the equalities and the inequalities.
1982         __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
1983                 __isl_take isl_space *space,
1984                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1985                 enum isl_dim_type c1,
1986                 enum isl_dim_type c2, enum isl_dim_type c3,
1987                 enum isl_dim_type c4);
1988         __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
1989                 __isl_take isl_space *space,
1990                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1991                 enum isl_dim_type c1,
1992                 enum isl_dim_type c2, enum isl_dim_type c3,
1993                 enum isl_dim_type c4, enum isl_dim_type c5);
1995 The C<isl_dim_type> arguments indicate the order in which
1996 different kinds of variables appear in the input matrices
1997 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
1998 C<isl_dim_set> and C<isl_dim_div> for sets and
1999 of C<isl_dim_cst>, C<isl_dim_param>,
2000 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
2002 A (basic or union) set or relation can also be constructed from a
2003 (union) (piecewise) (multiple) affine expression
2004 or a list of affine expressions
2005 (See L</"Functions">).
2007         __isl_give isl_basic_map *isl_basic_map_from_aff(
2008                 __isl_take isl_aff *aff);
2009         __isl_give isl_map *isl_map_from_aff(
2010                 __isl_take isl_aff *aff);
2011         __isl_give isl_set *isl_set_from_pw_aff(
2012                 __isl_take isl_pw_aff *pwaff);
2013         __isl_give isl_map *isl_map_from_pw_aff(
2014                 __isl_take isl_pw_aff *pwaff);
2015         __isl_give isl_basic_map *isl_basic_map_from_aff_list(
2016                 __isl_take isl_space *domain_space,
2017                 __isl_take isl_aff_list *list);
2018         __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
2019                 __isl_take isl_multi_aff *maff)
2020         __isl_give isl_map *isl_map_from_multi_aff(
2021                 __isl_take isl_multi_aff *maff)
2022         __isl_give isl_set *isl_set_from_pw_multi_aff(
2023                 __isl_take isl_pw_multi_aff *pma);
2024         __isl_give isl_map *isl_map_from_pw_multi_aff(
2025                 __isl_take isl_pw_multi_aff *pma);
2026         __isl_give isl_set *isl_set_from_multi_pw_aff(
2027                 __isl_take isl_multi_pw_aff *mpa);
2028         __isl_give isl_map *isl_map_from_multi_pw_aff(
2029                 __isl_take isl_multi_pw_aff *mpa);
2030         __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
2031                 __isl_take isl_union_pw_aff *upa);
2032         __isl_give isl_union_map *
2033         isl_union_map_from_union_pw_multi_aff(
2034                 __isl_take isl_union_pw_multi_aff *upma);
2035         __isl_give isl_union_map *
2036         isl_union_map_from_multi_union_pw_aff(
2037                 __isl_take isl_multi_union_pw_aff *mupa);
2039 The C<domain_space> argument describes the domain of the resulting
2040 basic relation.  It is required because the C<list> may consist
2041 of zero affine expressions.
2042 The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
2043 is not allowed to be zero-dimensional.  The domain of the result
2044 is the shared domain of the union piecewise affine elements.
2046 =head2 Inspecting Sets and Relations
2048 Usually, the user should not have to care about the actual constraints
2049 of the sets and maps, but should instead apply the abstract operations
2050 explained in the following sections.
2051 Occasionally, however, it may be required to inspect the individual
2052 coefficients of the constraints.  This section explains how to do so.
2053 In these cases, it may also be useful to have C<isl> compute
2054 an explicit representation of the existentially quantified variables.
2056         __isl_give isl_set *isl_set_compute_divs(
2057                 __isl_take isl_set *set);
2058         __isl_give isl_map *isl_map_compute_divs(
2059                 __isl_take isl_map *map);
2060         __isl_give isl_union_set *isl_union_set_compute_divs(
2061                 __isl_take isl_union_set *uset);
2062         __isl_give isl_union_map *isl_union_map_compute_divs(
2063                 __isl_take isl_union_map *umap);
2065 This explicit representation defines the existentially quantified
2066 variables as integer divisions of the other variables, possibly
2067 including earlier existentially quantified variables.
2068 An explicitly represented existentially quantified variable therefore
2069 has a unique value when the values of the other variables are known.
2070 If, furthermore, the same existentials, i.e., existentials
2071 with the same explicit representations, should appear in the
2072 same order in each of the disjuncts of a set or map, then the user should call
2073 either of the following functions.
2075         __isl_give isl_set *isl_set_align_divs(
2076                 __isl_take isl_set *set);
2077         __isl_give isl_map *isl_map_align_divs(
2078                 __isl_take isl_map *map);
2080 Alternatively, the existentially quantified variables can be removed
2081 using the following functions, which compute an overapproximation.
2083         __isl_give isl_basic_set *isl_basic_set_remove_divs(
2084                 __isl_take isl_basic_set *bset);
2085         __isl_give isl_basic_map *isl_basic_map_remove_divs(
2086                 __isl_take isl_basic_map *bmap);
2087         __isl_give isl_set *isl_set_remove_divs(
2088                 __isl_take isl_set *set);
2089         __isl_give isl_map *isl_map_remove_divs(
2090                 __isl_take isl_map *map);
2092 It is also possible to only remove those divs that are defined
2093 in terms of a given range of dimensions or only those for which
2094 no explicit representation is known.
2096         __isl_give isl_basic_set *
2097         isl_basic_set_remove_divs_involving_dims(
2098                 __isl_take isl_basic_set *bset,
2099                 enum isl_dim_type type,
2100                 unsigned first, unsigned n);
2101         __isl_give isl_basic_map *
2102         isl_basic_map_remove_divs_involving_dims(
2103                 __isl_take isl_basic_map *bmap,
2104                 enum isl_dim_type type,
2105                 unsigned first, unsigned n);
2106         __isl_give isl_set *isl_set_remove_divs_involving_dims(
2107                 __isl_take isl_set *set, enum isl_dim_type type,
2108                 unsigned first, unsigned n);
2109         __isl_give isl_map *isl_map_remove_divs_involving_dims(
2110                 __isl_take isl_map *map, enum isl_dim_type type,
2111                 unsigned first, unsigned n);
2113         __isl_give isl_basic_set *
2114         isl_basic_set_remove_unknown_divs(
2115                 __isl_take isl_basic_set *bset);
2116         __isl_give isl_set *isl_set_remove_unknown_divs(
2117                 __isl_take isl_set *set);
2118         __isl_give isl_map *isl_map_remove_unknown_divs(
2119                 __isl_take isl_map *map);
2121 To iterate over all the sets or maps in a union set or map, use
2123         isl_stat isl_union_set_foreach_set(
2124                 __isl_keep isl_union_set *uset,
2125                 isl_stat (*fn)(__isl_take isl_set *set, void *user),
2126                 void *user);
2127         isl_stat isl_union_map_foreach_map(
2128                 __isl_keep isl_union_map *umap,
2129                 isl_stat (*fn)(__isl_take isl_map *map, void *user),
2130                 void *user);
2132 The number of sets or maps in a union set or map can be obtained
2133 from
2135         int isl_union_set_n_set(__isl_keep isl_union_set *uset);
2136         int isl_union_map_n_map(__isl_keep isl_union_map *umap);
2138 To extract the set or map in a given space from a union, use
2140         __isl_give isl_set *isl_union_set_extract_set(
2141                 __isl_keep isl_union_set *uset,
2142                 __isl_take isl_space *space);
2143         __isl_give isl_map *isl_union_map_extract_map(
2144                 __isl_keep isl_union_map *umap,
2145                 __isl_take isl_space *space);
2147 To iterate over all the basic sets or maps in a set or map, use
2149         isl_stat isl_set_foreach_basic_set(__isl_keep isl_set *set,
2150                 isl_stat (*fn)(__isl_take isl_basic_set *bset,
2151                         void *user),
2152                 void *user);
2153         isl_stat isl_map_foreach_basic_map(__isl_keep isl_map *map,
2154                 isl_stat (*fn)(__isl_take isl_basic_map *bmap,
2155                         void *user),
2156                 void *user);
2158 The callback function C<fn> should return 0 if successful and
2159 -1 if an error occurs.  In the latter case, or if any other error
2160 occurs, the above functions will return -1.
2162 It should be noted that C<isl> does not guarantee that
2163 the basic sets or maps passed to C<fn> are disjoint.
2164 If this is required, then the user should call one of
2165 the following functions first.
2167         __isl_give isl_set *isl_set_make_disjoint(
2168                 __isl_take isl_set *set);
2169         __isl_give isl_map *isl_map_make_disjoint(
2170                 __isl_take isl_map *map);
2172 The number of basic sets in a set can be obtained
2173 or the number of basic maps in a map can be obtained
2174 from
2176         #include <isl/set.h>
2177         int isl_set_n_basic_set(__isl_keep isl_set *set);
2179         #include <isl/map.h>
2180         int isl_map_n_basic_map(__isl_keep isl_map *map);
2182 To iterate over the constraints of a basic set or map, use
2184         #include <isl/constraint.h>
2186         int isl_basic_set_n_constraint(
2187                 __isl_keep isl_basic_set *bset);
2188         isl_stat isl_basic_set_foreach_constraint(
2189                 __isl_keep isl_basic_set *bset,
2190                 isl_stat (*fn)(__isl_take isl_constraint *c,
2191                         void *user),
2192                 void *user);
2193         int isl_basic_map_n_constraint(
2194                 __isl_keep isl_basic_map *bmap);
2195         isl_stat isl_basic_map_foreach_constraint(
2196                 __isl_keep isl_basic_map *bmap,
2197                 isl_stat (*fn)(__isl_take isl_constraint *c,
2198                         void *user),
2199                 void *user);
2200         __isl_null isl_constraint *isl_constraint_free(
2201                 __isl_take isl_constraint *c);
2203 Again, the callback function C<fn> should return 0 if successful and
2204 -1 if an error occurs.  In the latter case, or if any other error
2205 occurs, the above functions will return -1.
2206 The constraint C<c> represents either an equality or an inequality.
2207 Use the following function to find out whether a constraint
2208 represents an equality.  If not, it represents an inequality.
2210         isl_bool isl_constraint_is_equality(
2211                 __isl_keep isl_constraint *constraint);
2213 It is also possible to obtain a list of constraints from a basic
2214 map or set
2216         #include <isl/constraint.h>
2217         __isl_give isl_constraint_list *
2218         isl_basic_map_get_constraint_list(
2219                 __isl_keep isl_basic_map *bmap);
2220         __isl_give isl_constraint_list *
2221         isl_basic_set_get_constraint_list(
2222                 __isl_keep isl_basic_set *bset);
2224 These functions require that all existentially quantified variables
2225 have an explicit representation.
2226 The returned list can be manipulated using the functions in L<"Lists">.
2228 The coefficients of the constraints can be inspected using
2229 the following functions.
2231         isl_bool isl_constraint_is_lower_bound(
2232                 __isl_keep isl_constraint *constraint,
2233                 enum isl_dim_type type, unsigned pos);
2234         isl_bool isl_constraint_is_upper_bound(
2235                 __isl_keep isl_constraint *constraint,
2236                 enum isl_dim_type type, unsigned pos);
2237         __isl_give isl_val *isl_constraint_get_constant_val(
2238                 __isl_keep isl_constraint *constraint);
2239         __isl_give isl_val *isl_constraint_get_coefficient_val(
2240                 __isl_keep isl_constraint *constraint,
2241                 enum isl_dim_type type, int pos);
2243 The explicit representations of the existentially quantified
2244 variables can be inspected using the following function.
2245 Note that the user is only allowed to use this function
2246 if the inspected set or map is the result of a call
2247 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2248 The existentially quantified variable is equal to the floor
2249 of the returned affine expression.  The affine expression
2250 itself can be inspected using the functions in
2251 L</"Functions">.
2253         __isl_give isl_aff *isl_constraint_get_div(
2254                 __isl_keep isl_constraint *constraint, int pos);
2256 To obtain the constraints of a basic set or map in matrix
2257 form, use the following functions.
2259         __isl_give isl_mat *isl_basic_set_equalities_matrix(
2260                 __isl_keep isl_basic_set *bset,
2261                 enum isl_dim_type c1, enum isl_dim_type c2,
2262                 enum isl_dim_type c3, enum isl_dim_type c4);
2263         __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2264                 __isl_keep isl_basic_set *bset,
2265                 enum isl_dim_type c1, enum isl_dim_type c2,
2266                 enum isl_dim_type c3, enum isl_dim_type c4);
2267         __isl_give isl_mat *isl_basic_map_equalities_matrix(
2268                 __isl_keep isl_basic_map *bmap,
2269                 enum isl_dim_type c1,
2270                 enum isl_dim_type c2, enum isl_dim_type c3,
2271                 enum isl_dim_type c4, enum isl_dim_type c5);
2272         __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2273                 __isl_keep isl_basic_map *bmap,
2274                 enum isl_dim_type c1,
2275                 enum isl_dim_type c2, enum isl_dim_type c3,
2276                 enum isl_dim_type c4, enum isl_dim_type c5);
2278 The C<isl_dim_type> arguments dictate the order in which
2279 different kinds of variables appear in the resulting matrix.
2280 For set inputs, they should be a permutation of
2281 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2282 For map inputs, they should be a permutation of
2283 C<isl_dim_cst>, C<isl_dim_param>,
2284 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2286 =head2 Points
2288 Points are elements of a set.  They can be used to construct
2289 simple sets (boxes) or they can be used to represent the
2290 individual elements of a set.
2291 The zero point (the origin) can be created using
2293         __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2295 The coordinates of a point can be inspected, set and changed
2296 using
2298         __isl_give isl_val *isl_point_get_coordinate_val(
2299                 __isl_keep isl_point *pnt,
2300                 enum isl_dim_type type, int pos);
2301         __isl_give isl_point *isl_point_set_coordinate_val(
2302                 __isl_take isl_point *pnt,
2303                 enum isl_dim_type type, int pos,
2304                 __isl_take isl_val *v);
2306         __isl_give isl_point *isl_point_add_ui(
2307                 __isl_take isl_point *pnt,
2308                 enum isl_dim_type type, int pos, unsigned val);
2309         __isl_give isl_point *isl_point_sub_ui(
2310                 __isl_take isl_point *pnt,
2311                 enum isl_dim_type type, int pos, unsigned val);
2313 Points can be copied or freed using
2315         __isl_give isl_point *isl_point_copy(
2316                 __isl_keep isl_point *pnt);
2317         void isl_point_free(__isl_take isl_point *pnt);
2319 A singleton set can be created from a point using
2321         __isl_give isl_basic_set *isl_basic_set_from_point(
2322                 __isl_take isl_point *pnt);
2323         __isl_give isl_set *isl_set_from_point(
2324                 __isl_take isl_point *pnt);
2326 and a box can be created from two opposite extremal points using
2328         __isl_give isl_basic_set *isl_basic_set_box_from_points(
2329                 __isl_take isl_point *pnt1,
2330                 __isl_take isl_point *pnt2);
2331         __isl_give isl_set *isl_set_box_from_points(
2332                 __isl_take isl_point *pnt1,
2333                 __isl_take isl_point *pnt2);
2335 All elements of a B<bounded> (union) set can be enumerated using
2336 the following functions.
2338         isl_stat isl_set_foreach_point(__isl_keep isl_set *set,
2339                 isl_stat (*fn)(__isl_take isl_point *pnt,
2340                         void *user),
2341                 void *user);
2342         isl_stat isl_union_set_foreach_point(
2343                 __isl_keep isl_union_set *uset,
2344                 isl_stat (*fn)(__isl_take isl_point *pnt,
2345                         void *user),
2346                 void *user);
2348 The function C<fn> is called for each integer point in
2349 C<set> with as second argument the last argument of
2350 the C<isl_set_foreach_point> call.  The function C<fn>
2351 should return C<0> on success and C<-1> on failure.
2352 In the latter case, C<isl_set_foreach_point> will stop
2353 enumerating and return C<-1> as well.
2354 If the enumeration is performed successfully and to completion,
2355 then C<isl_set_foreach_point> returns C<0>.
2357 To obtain a single point of a (basic) set, use
2359         __isl_give isl_point *isl_basic_set_sample_point(
2360                 __isl_take isl_basic_set *bset);
2361         __isl_give isl_point *isl_set_sample_point(
2362                 __isl_take isl_set *set);
2364 If C<set> does not contain any (integer) points, then the
2365 resulting point will be ``void'', a property that can be
2366 tested using
2368         isl_bool isl_point_is_void(__isl_keep isl_point *pnt);
2370 =head2 Functions
2372 Besides sets and relation, C<isl> also supports various types of functions.
2373 Each of these types is derived from the value type (see L</"Values">)
2374 or from one of two primitive function types
2375 through the application of zero or more type constructors.
2376 We first describe the primitive type and then we describe
2377 the types derived from these primitive types.
2379 =head3 Primitive Functions
2381 C<isl> support two primitive function types, quasi-affine
2382 expressions and quasipolynomials.
2383 A quasi-affine expression is defined either over a parameter
2384 space or over a set and is composed of integer constants,
2385 parameters and set variables, addition, subtraction and
2386 integer division by an integer constant.
2387 For example, the quasi-affine expression
2389         [n] -> { [x] -> [2*floor((4 n + x)/9] }
2391 maps C<x> to C<2*floor((4 n + x)/9>.
2392 A quasipolynomial is a polynomial expression in quasi-affine
2393 expression.  That is, it additionally allows for multiplication.
2394 Note, though, that it is not allowed to construct an integer
2395 division of an expression involving multiplications.
2396 Here is an example of a quasipolynomial that is not
2397 quasi-affine expression
2399         [n] -> { [x] -> (n*floor((4 n + x)/9) }
2401 Note that the external representations of quasi-affine expressions
2402 and quasipolynomials are different.  Quasi-affine expressions
2403 use a notation with square brackets just like binary relations,
2404 while quasipolynomials do not.  This might change at some point.
2406 If a primitive function is defined over a parameter space,
2407 then the space of the function itself is that of a set.
2408 If it is defined over a set, then the space of the function
2409 is that of a relation.  In both cases, the set space (or
2410 the output space) is single-dimensional, anonymous and unstructured.
2411 To create functions with multiple dimensions or with other kinds
2412 of set or output spaces, use multiple expressions
2413 (see L</"Multiple Expressions">).
2415 =over
2417 =item * Quasi-affine Expressions
2419 Besides the expressions described above, a quasi-affine
2420 expression can also be set to NaN.  Such expressions
2421 typically represent a failure to represent a result
2422 as a quasi-affine expression.
2424 The zero quasi affine expression or the quasi affine expression
2425 that is equal to a given value or
2426 a specified dimension on a given domain can be created using
2428         #include <isl/aff.h>
2429         __isl_give isl_aff *isl_aff_zero_on_domain(
2430                 __isl_take isl_local_space *ls);
2431         __isl_give isl_aff *isl_aff_val_on_domain(
2432                 __isl_take isl_local_space *ls,
2433                 __isl_take isl_val *val);
2434         __isl_give isl_aff *isl_aff_var_on_domain(
2435                 __isl_take isl_local_space *ls,
2436                 enum isl_dim_type type, unsigned pos);
2437         __isl_give isl_aff *isl_aff_nan_on_domain(
2438                 __isl_take isl_local_space *ls);
2440 Quasi affine expressions can be copied and freed using
2442         #include <isl/aff.h>
2443         __isl_give isl_aff *isl_aff_copy(
2444                 __isl_keep isl_aff *aff);
2445         __isl_null isl_aff *isl_aff_free(
2446                 __isl_take isl_aff *aff);
2448 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2449 using the following function.  The constraint is required to have
2450 a non-zero coefficient for the specified dimension.
2452         #include <isl/constraint.h>
2453         __isl_give isl_aff *isl_constraint_get_bound(
2454                 __isl_keep isl_constraint *constraint,
2455                 enum isl_dim_type type, int pos);
2457 The entire affine expression of the constraint can also be extracted
2458 using the following function.
2460         #include <isl/constraint.h>
2461         __isl_give isl_aff *isl_constraint_get_aff(
2462                 __isl_keep isl_constraint *constraint);
2464 Conversely, an equality constraint equating
2465 the affine expression to zero or an inequality constraint enforcing
2466 the affine expression to be non-negative, can be constructed using
2468         __isl_give isl_constraint *isl_equality_from_aff(
2469                 __isl_take isl_aff *aff);
2470         __isl_give isl_constraint *isl_inequality_from_aff(
2471                 __isl_take isl_aff *aff);
2473 The coefficients and the integer divisions of an affine expression
2474 can be inspected using the following functions.
2476         #include <isl/aff.h>
2477         __isl_give isl_val *isl_aff_get_constant_val(
2478                 __isl_keep isl_aff *aff);
2479         __isl_give isl_val *isl_aff_get_coefficient_val(
2480                 __isl_keep isl_aff *aff,
2481                 enum isl_dim_type type, int pos);
2482         int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2483                 enum isl_dim_type type, int pos);
2484         __isl_give isl_val *isl_aff_get_denominator_val(
2485                 __isl_keep isl_aff *aff);
2486         __isl_give isl_aff *isl_aff_get_div(
2487                 __isl_keep isl_aff *aff, int pos);
2489 They can be modified using the following functions.
2491         #include <isl/aff.h>
2492         __isl_give isl_aff *isl_aff_set_constant_si(
2493                 __isl_take isl_aff *aff, int v);
2494         __isl_give isl_aff *isl_aff_set_constant_val(
2495                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2496         __isl_give isl_aff *isl_aff_set_coefficient_si(
2497                 __isl_take isl_aff *aff,
2498                 enum isl_dim_type type, int pos, int v);
2499         __isl_give isl_aff *isl_aff_set_coefficient_val(
2500                 __isl_take isl_aff *aff,
2501                 enum isl_dim_type type, int pos,
2502                 __isl_take isl_val *v);
2504         __isl_give isl_aff *isl_aff_add_constant_si(
2505                 __isl_take isl_aff *aff, int v);
2506         __isl_give isl_aff *isl_aff_add_constant_val(
2507                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2508         __isl_give isl_aff *isl_aff_add_constant_num_si(
2509                 __isl_take isl_aff *aff, int v);
2510         __isl_give isl_aff *isl_aff_add_coefficient_si(
2511                 __isl_take isl_aff *aff,
2512                 enum isl_dim_type type, int pos, int v);
2513         __isl_give isl_aff *isl_aff_add_coefficient_val(
2514                 __isl_take isl_aff *aff,
2515                 enum isl_dim_type type, int pos,
2516                 __isl_take isl_val *v);
2518 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2519 set the I<numerator> of the constant or coefficient, while
2520 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2521 the constant or coefficient as a whole.
2522 The C<add_constant> and C<add_coefficient> functions add an integer
2523 or rational value to
2524 the possibly rational constant or coefficient.
2525 The C<add_constant_num> functions add an integer value to
2526 the numerator.
2528 =item * Quasipolynomials
2530 Some simple quasipolynomials can be created using the following functions.
2532         #include <isl/polynomial.h>
2533         __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2534                 __isl_take isl_space *domain);
2535         __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2536                 __isl_take isl_space *domain);
2537         __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2538                 __isl_take isl_space *domain);
2539         __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2540                 __isl_take isl_space *domain);
2541         __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2542                 __isl_take isl_space *domain);
2543         __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2544                 __isl_take isl_space *domain,
2545                 __isl_take isl_val *val);
2546         __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2547                 __isl_take isl_space *domain,
2548                 enum isl_dim_type type, unsigned pos);
2549         __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2550                 __isl_take isl_aff *aff);
2552 Recall that the space in which a quasipolynomial lives is a map space
2553 with a one-dimensional range.  The C<domain> argument in some of
2554 the functions above corresponds to the domain of this map space.
2556 Quasipolynomials can be copied and freed again using the following
2557 functions.
2559         #include <isl/polynomial.h>
2560         __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2561                 __isl_keep isl_qpolynomial *qp);
2562         __isl_null isl_qpolynomial *isl_qpolynomial_free(
2563                 __isl_take isl_qpolynomial *qp);
2565 The constant term of a quasipolynomial can be extracted using
2567         __isl_give isl_val *isl_qpolynomial_get_constant_val(
2568                 __isl_keep isl_qpolynomial *qp);
2570 To iterate over all terms in a quasipolynomial,
2573         isl_stat isl_qpolynomial_foreach_term(
2574                 __isl_keep isl_qpolynomial *qp,
2575                 isl_stat (*fn)(__isl_take isl_term *term,
2576                           void *user), void *user);
2578 The terms themselves can be inspected and freed using
2579 these functions
2581         unsigned isl_term_dim(__isl_keep isl_term *term,
2582                 enum isl_dim_type type);
2583         __isl_give isl_val *isl_term_get_coefficient_val(
2584                 __isl_keep isl_term *term);
2585         int isl_term_get_exp(__isl_keep isl_term *term,
2586                 enum isl_dim_type type, unsigned pos);
2587         __isl_give isl_aff *isl_term_get_div(
2588                 __isl_keep isl_term *term, unsigned pos);
2589         void isl_term_free(__isl_take isl_term *term);
2591 Each term is a product of parameters, set variables and
2592 integer divisions.  The function C<isl_term_get_exp>
2593 returns the exponent of a given dimensions in the given term.
2595 =back
2597 =head3 Reductions
2599 A reduction represents a maximum or a minimum of its
2600 base expressions.
2601 The only reduction type defined by C<isl> is
2602 C<isl_qpolynomial_fold>.
2604 There are currently no functions to directly create such
2605 objects, but they do appear in the piecewise quasipolynomial
2606 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2608 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2610 Reductions can be copied and freed using
2611 the following functions.
2613         #include <isl/polynomial.h>
2614         __isl_give isl_qpolynomial_fold *
2615         isl_qpolynomial_fold_copy(
2616                 __isl_keep isl_qpolynomial_fold *fold);
2617         void isl_qpolynomial_fold_free(
2618                 __isl_take isl_qpolynomial_fold *fold);
2620 To iterate over all quasipolynomials in a reduction, use
2622         isl_stat isl_qpolynomial_fold_foreach_qpolynomial(
2623                 __isl_keep isl_qpolynomial_fold *fold,
2624                 isl_stat (*fn)(__isl_take isl_qpolynomial *qp,
2625                           void *user), void *user);
2627 =head3 Multiple Expressions
2629 A multiple expression represents a sequence of zero or
2630 more base expressions, all defined on the same domain space.
2631 The domain space of the multiple expression is the same
2632 as that of the base expressions, but the range space
2633 can be any space.  In case the base expressions have
2634 a set space, the corresponding multiple expression
2635 also has a set space.
2636 Objects of the value type do not have an associated space.
2637 The space of a multiple value is therefore always a set space.
2638 Similarly, the space of a multiple union piecewise
2639 affine expression is always a set space.
2641 The multiple expression types defined by C<isl>
2642 are C<isl_multi_val>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
2643 C<isl_multi_union_pw_aff>.
2645 A multiple expression with the value zero for
2646 each output (or set) dimension can be created
2647 using the following functions.
2649         #include <isl/val.h>
2650         __isl_give isl_multi_val *isl_multi_val_zero(
2651                 __isl_take isl_space *space);
2653         #include <isl/aff.h>
2654         __isl_give isl_multi_aff *isl_multi_aff_zero(
2655                 __isl_take isl_space *space);
2656         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2657                 __isl_take isl_space *space);
2658         __isl_give isl_multi_union_pw_aff *
2659         isl_multi_union_pw_aff_zero(
2660                 __isl_take isl_space *space);
2662 Since there is no canonical way of representing a zero
2663 value of type C<isl_union_pw_aff>, the space passed
2664 to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
2666 An identity function can be created using the following
2667 functions.  The space needs to be that of a relation
2668 with the same number of input and output dimensions.
2670         #include <isl/aff.h>
2671         __isl_give isl_multi_aff *isl_multi_aff_identity(
2672                 __isl_take isl_space *space);
2673         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2674                 __isl_take isl_space *space);
2676 A function that performs a projection on a universe
2677 relation or set can be created using the following functions.
2678 See also the corresponding
2679 projection operations in L</"Unary Operations">.
2681         #include <isl/aff.h>
2682         __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2683                 __isl_take isl_space *space);
2684         __isl_give isl_multi_aff *isl_multi_aff_range_map(
2685                 __isl_take isl_space *space);
2686         __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2687                 __isl_take isl_space *space,
2688                 enum isl_dim_type type,
2689                 unsigned first, unsigned n);
2691 A multiple expression can be created from a single
2692 base expression using the following functions.
2693 The space of the created multiple expression is the same
2694 as that of the base expression, except for
2695 C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
2696 lives in a parameter space and the output lives
2697 in a single-dimensional set space.
2699         #include <isl/aff.h>
2700         __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2701                 __isl_take isl_aff *aff);
2702         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2703                 __isl_take isl_pw_aff *pa);
2704         __isl_give isl_multi_union_pw_aff *
2705         isl_multi_union_pw_aff_from_union_pw_aff(
2706                 __isl_take isl_union_pw_aff *upa);
2708 A multiple expression can be created from a list
2709 of base expression in a specified space.
2710 The domain of this space needs to be the same
2711 as the domains of the base expressions in the list.
2712 If the base expressions have a set space (or no associated space),
2713 then this space also needs to be a set space.
2715         #include <isl/val.h>
2716         __isl_give isl_multi_val *isl_multi_val_from_val_list(
2717                 __isl_take isl_space *space,
2718                 __isl_take isl_val_list *list);
2720         #include <isl/aff.h>
2721         __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2722                 __isl_take isl_space *space,
2723                 __isl_take isl_aff_list *list);
2724         __isl_give isl_multi_union_pw_aff *
2725         isl_multi_union_pw_aff_from_union_pw_aff_list(
2726                 __isl_take isl_space *space,
2727                 __isl_take isl_union_pw_aff_list *list);
2729 As a convenience, a multiple piecewise expression can
2730 also be created from a multiple expression.
2731 Each piecewise expression in the result has a single
2732 universe cell.
2734         #include <isl/aff.h>
2735         __isl_give isl_multi_pw_aff *
2736         isl_multi_pw_aff_from_multi_aff(
2737                 __isl_take isl_multi_aff *ma);
2739 Similarly, a multiple union expression can be
2740 created from a multiple expression.
2742         #include <isl/aff.h>
2743         __isl_give isl_multi_union_pw_aff *
2744         isl_multi_union_pw_aff_from_multi_aff(
2745                 __isl_take isl_multi_aff *ma);
2746         __isl_give isl_multi_union_pw_aff *
2747         isl_multi_union_pw_aff_from_multi_pw_aff(
2748                 __isl_take isl_multi_pw_aff *mpa);
2750 A multiple quasi-affine expression can be created from
2751 a multiple value with a given domain space using the following
2752 function.
2754         #include <isl/aff.h>
2755         __isl_give isl_multi_aff *
2756         isl_multi_aff_multi_val_on_space(
2757                 __isl_take isl_space *space,
2758                 __isl_take isl_multi_val *mv);
2760 Similarly,
2761 a multiple union piecewise affine expression can be created from
2762 a multiple value with a given domain or
2763 a multiple affine expression with a given domain
2764 using the following functions.
2766         #include <isl/aff.h>
2767         __isl_give isl_multi_union_pw_aff *
2768         isl_multi_union_pw_aff_multi_val_on_domain(
2769                 __isl_take isl_union_set *domain,
2770                 __isl_take isl_multi_val *mv);
2771         __isl_give isl_multi_union_pw_aff *
2772         isl_multi_union_pw_aff_multi_aff_on_domain(
2773                 __isl_take isl_union_set *domain,
2774                 __isl_take isl_multi_aff *ma);
2776 Multiple expressions can be copied and freed using
2777 the following functions.
2779         #include <isl/val.h>
2780         __isl_give isl_multi_val *isl_multi_val_copy(
2781                 __isl_keep isl_multi_val *mv);
2782         __isl_null isl_multi_val *isl_multi_val_free(
2783                 __isl_take isl_multi_val *mv);
2785         #include <isl/aff.h>
2786         __isl_give isl_multi_aff *isl_multi_aff_copy(
2787                 __isl_keep isl_multi_aff *maff);
2788         __isl_null isl_multi_aff *isl_multi_aff_free(
2789                 __isl_take isl_multi_aff *maff);
2790         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2791                 __isl_keep isl_multi_pw_aff *mpa);
2792         __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2793                 __isl_take isl_multi_pw_aff *mpa);
2794         __isl_give isl_multi_union_pw_aff *
2795         isl_multi_union_pw_aff_copy(
2796                 __isl_keep isl_multi_union_pw_aff *mupa);
2797         __isl_null isl_multi_union_pw_aff *
2798         isl_multi_union_pw_aff_free(
2799                 __isl_take isl_multi_union_pw_aff *mupa);
2801 The base expression at a given position of a multiple
2802 expression can be extracted using the following functions.
2804         #include <isl/val.h>
2805         __isl_give isl_val *isl_multi_val_get_val(
2806                 __isl_keep isl_multi_val *mv, int pos);
2808         #include <isl/aff.h>
2809         __isl_give isl_aff *isl_multi_aff_get_aff(
2810                 __isl_keep isl_multi_aff *multi, int pos);
2811         __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2812                 __isl_keep isl_multi_pw_aff *mpa, int pos);
2813         __isl_give isl_union_pw_aff *
2814         isl_multi_union_pw_aff_get_union_pw_aff(
2815                 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
2817 It can be replaced using the following functions.
2819         #include <isl/val.h>
2820         __isl_give isl_multi_val *isl_multi_val_set_val(
2821                 __isl_take isl_multi_val *mv, int pos,
2822                 __isl_take isl_val *val);
2824         #include <isl/aff.h>
2825         __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2826                 __isl_take isl_multi_aff *multi, int pos,
2827                 __isl_take isl_aff *aff);
2828         __isl_give isl_multi_union_pw_aff *
2829         isl_multi_union_pw_aff_set_union_pw_aff(
2830                 __isl_take isl_multi_union_pw_aff *mupa, int pos,
2831                 __isl_take isl_union_pw_aff *upa);
2833 As a convenience, a sequence of base expressions that have
2834 their domains in a given space can be extracted from a sequence
2835 of union expressions using the following function.
2837         #include <isl/aff.h>
2838         __isl_give isl_multi_pw_aff *
2839         isl_multi_union_pw_aff_extract_multi_pw_aff(
2840                 __isl_keep isl_multi_union_pw_aff *mupa,
2841                 __isl_take isl_space *space);
2843 Note that there is a difference between C<isl_multi_union_pw_aff>
2844 and C<isl_union_pw_multi_aff> objects.  The first is a sequence
2845 of unions of piecewise expressions, while the second is a union
2846 of piecewise sequences.  In particular, multiple affine expressions
2847 in an C<isl_union_pw_multi_aff> may live in different spaces,
2848 while there is only a single multiple expression in
2849 an C<isl_multi_union_pw_aff>, which can therefore only live
2850 in a single space.  This means that not every
2851 C<isl_union_pw_multi_aff> can be converted to
2852 an C<isl_multi_union_pw_aff>.  Conversely, a zero-dimensional
2853 C<isl_multi_union_pw_aff> carries no information
2854 about any possible domain and therefore cannot be converted
2855 to an C<isl_union_pw_multi_aff>.  Moreover, the elements
2856 of an C<isl_multi_union_pw_aff> may be defined over different domains,
2857 while each multiple expression inside an C<isl_union_pw_multi_aff>
2858 has a single domain.  The conversion of an C<isl_union_pw_multi_aff>
2859 of dimension greater than one may therefore not be exact.
2860 The following functions can
2861 be used to perform these conversions when they are possible.
2863         #include <isl/aff.h>
2864         __isl_give isl_multi_union_pw_aff *
2865         isl_multi_union_pw_aff_from_union_pw_multi_aff(
2866                 __isl_take isl_union_pw_multi_aff *upma);
2867         __isl_give isl_union_pw_multi_aff *
2868         isl_union_pw_multi_aff_from_multi_union_pw_aff(
2869                 __isl_take isl_multi_union_pw_aff *mupa);
2871 =head3 Piecewise Expressions
2873 A piecewise expression is an expression that is described
2874 using zero or more base expression defined over the same
2875 number of cells in the domain space of the base expressions.
2876 All base expressions are defined over the same
2877 domain space and the cells are disjoint.
2878 The space of a piecewise expression is the same as
2879 that of the base expressions.
2880 If the union of the cells is a strict subset of the domain
2881 space, then the value of the piecewise expression outside
2882 this union is different for types derived from quasi-affine
2883 expressions and those derived from quasipolynomials.
2884 Piecewise expressions derived from quasi-affine expressions
2885 are considered to be undefined outside the union of their cells.
2886 Piecewise expressions derived from quasipolynomials
2887 are considered to be zero outside the union of their cells.
2889 Piecewise quasipolynomials are mainly used by the C<barvinok>
2890 library for representing the number of elements in a parametric set or map.
2891 For example, the piecewise quasipolynomial
2893         [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
2895 represents the number of points in the map
2897         [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
2899 The piecewise expression types defined by C<isl>
2900 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
2901 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
2903 A piecewise expression with no cells can be created using
2904 the following functions.
2906         #include <isl/aff.h>
2907         __isl_give isl_pw_aff *isl_pw_aff_empty(
2908                 __isl_take isl_space *space);
2909         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
2910                 __isl_take isl_space *space);
2912 A piecewise expression with a single universe cell can be
2913 created using the following functions.
2915         #include <isl/aff.h>
2916         __isl_give isl_pw_aff *isl_pw_aff_from_aff(
2917                 __isl_take isl_aff *aff);
2918         __isl_give isl_pw_multi_aff *
2919         isl_pw_multi_aff_from_multi_aff(
2920                 __isl_take isl_multi_aff *ma);
2922         #include <isl/polynomial.h>
2923         __isl_give isl_pw_qpolynomial *
2924         isl_pw_qpolynomial_from_qpolynomial(
2925                 __isl_take isl_qpolynomial *qp);
2927 A piecewise expression with a single specified cell can be
2928 created using the following functions.
2930         #include <isl/aff.h>
2931         __isl_give isl_pw_aff *isl_pw_aff_alloc(
2932                 __isl_take isl_set *set, __isl_take isl_aff *aff);
2933         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
2934                 __isl_take isl_set *set,
2935                 __isl_take isl_multi_aff *maff);
2937         #include <isl/polynomial.h>
2938         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
2939                 __isl_take isl_set *set,
2940                 __isl_take isl_qpolynomial *qp);
2942 The following convenience functions first create a base expression and
2943 then create a piecewise expression over a universe domain.
2945         #include <isl/aff.h>
2946         __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
2947                 __isl_take isl_local_space *ls);
2948         __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
2949                 __isl_take isl_local_space *ls,
2950                 enum isl_dim_type type, unsigned pos);
2951         __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
2952                 __isl_take isl_local_space *ls);
2953         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
2954                 __isl_take isl_space *space);
2955         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
2956                 __isl_take isl_space *space);
2957         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
2958                 __isl_take isl_space *space);
2959         __isl_give isl_pw_multi_aff *
2960         isl_pw_multi_aff_project_out_map(
2961                 __isl_take isl_space *space,
2962                 enum isl_dim_type type,
2963                 unsigned first, unsigned n);
2965         #include <isl/polynomial.h>
2966         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
2967                 __isl_take isl_space *space);
2969 The following convenience functions first create a base expression and
2970 then create a piecewise expression over a given domain.
2972         #include <isl/aff.h>
2973         __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
2974                 __isl_take isl_set *domain,
2975                 __isl_take isl_val *v);
2976         __isl_give isl_pw_multi_aff *
2977         isl_pw_multi_aff_multi_val_on_domain(
2978                 __isl_take isl_set *domain,
2979                 __isl_take isl_multi_val *mv);
2981 As a convenience, a piecewise multiple expression can
2982 also be created from a piecewise expression.
2983 Each multiple expression in the result is derived
2984 from the corresponding base expression.
2986         #include <isl/aff.h>
2987         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
2988                 __isl_take isl_pw_aff *pa);
2990 Similarly, a piecewise quasipolynomial can be
2991 created from a piecewise quasi-affine expression using
2992 the following function.
2994         #include <isl/polynomial.h>
2995         __isl_give isl_pw_qpolynomial *
2996         isl_pw_qpolynomial_from_pw_aff(
2997                 __isl_take isl_pw_aff *pwaff);
2999 Piecewise expressions can be copied and freed using the following functions.
3001         #include <isl/aff.h>
3002         __isl_give isl_pw_aff *isl_pw_aff_copy(
3003                 __isl_keep isl_pw_aff *pwaff);
3004         __isl_null isl_pw_aff *isl_pw_aff_free(
3005                 __isl_take isl_pw_aff *pwaff);
3006         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
3007                 __isl_keep isl_pw_multi_aff *pma);
3008         __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
3009                 __isl_take isl_pw_multi_aff *pma);
3011         #include <isl/polynomial.h>
3012         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
3013                 __isl_keep isl_pw_qpolynomial *pwqp);
3014         __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
3015                 __isl_take isl_pw_qpolynomial *pwqp);
3016         __isl_give isl_pw_qpolynomial_fold *
3017         isl_pw_qpolynomial_fold_copy(
3018                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3019         __isl_null isl_pw_qpolynomial_fold *
3020         isl_pw_qpolynomial_fold_free(
3021                 __isl_take isl_pw_qpolynomial_fold *pwf);
3023 To iterate over the different cells of a piecewise expression,
3024 use the following functions.
3026         #include <isl/aff.h>
3027         isl_bool isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
3028         int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
3029         isl_stat isl_pw_aff_foreach_piece(
3030                 __isl_keep isl_pw_aff *pwaff,
3031                 isl_stat (*fn)(__isl_take isl_set *set,
3032                           __isl_take isl_aff *aff,
3033                           void *user), void *user);
3034         isl_stat isl_pw_multi_aff_foreach_piece(
3035                 __isl_keep isl_pw_multi_aff *pma,
3036                 isl_stat (*fn)(__isl_take isl_set *set,
3037                             __isl_take isl_multi_aff *maff,
3038                             void *user), void *user);
3040         #include <isl/polynomial.h>
3041         isl_stat isl_pw_qpolynomial_foreach_piece(
3042                 __isl_keep isl_pw_qpolynomial *pwqp,
3043                 isl_stat (*fn)(__isl_take isl_set *set,
3044                           __isl_take isl_qpolynomial *qp,
3045                           void *user), void *user);
3046         isl_stat isl_pw_qpolynomial_foreach_lifted_piece(
3047                 __isl_keep isl_pw_qpolynomial *pwqp,
3048                 isl_stat (*fn)(__isl_take isl_set *set,
3049                           __isl_take isl_qpolynomial *qp,
3050                           void *user), void *user);
3051         isl_stat isl_pw_qpolynomial_fold_foreach_piece(
3052                 __isl_keep isl_pw_qpolynomial_fold *pwf,
3053                 isl_stat (*fn)(__isl_take isl_set *set,
3054                           __isl_take isl_qpolynomial_fold *fold,
3055                           void *user), void *user);
3056         isl_stat isl_pw_qpolynomial_fold_foreach_lifted_piece(
3057                 __isl_keep isl_pw_qpolynomial_fold *pwf,
3058                 isl_stat (*fn)(__isl_take isl_set *set,
3059                           __isl_take isl_qpolynomial_fold *fold,
3060                           void *user), void *user);
3062 As usual, the function C<fn> should return C<0> on success
3063 and C<-1> on failure.  The difference between
3064 C<isl_pw_qpolynomial_foreach_piece> and
3065 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
3066 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
3067 compute unique representations for all existentially quantified
3068 variables and then turn these existentially quantified variables
3069 into extra set variables, adapting the associated quasipolynomial
3070 accordingly.  This means that the C<set> passed to C<fn>
3071 will not have any existentially quantified variables, but that
3072 the dimensions of the sets may be different for different
3073 invocations of C<fn>.
3074 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
3075 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
3077 A piecewise expression consisting of the expressions at a given
3078 position of a piecewise multiple expression can be extracted
3079 using the following function.
3081         #include <isl/aff.h>
3082         __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3083                 __isl_keep isl_pw_multi_aff *pma, int pos);
3085 These expressions can be replaced using the following function.
3087         #include <isl/aff.h>
3088         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3089                 __isl_take isl_pw_multi_aff *pma, unsigned pos,
3090                 __isl_take isl_pw_aff *pa);
3092 Note that there is a difference between C<isl_multi_pw_aff> and
3093 C<isl_pw_multi_aff> objects.  The first is a sequence of piecewise
3094 affine expressions, while the second is a piecewise sequence
3095 of affine expressions.  In particular, each of the piecewise
3096 affine expressions in an C<isl_multi_pw_aff> may have a different
3097 domain, while all multiple expressions associated to a cell
3098 in an C<isl_pw_multi_aff> have the same domain.
3099 It is possible to convert between the two, but when converting
3100 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3101 of the result is the intersection of the domains of the input.
3102 The reverse conversion is exact.
3104         #include <isl/aff.h>
3105         __isl_give isl_pw_multi_aff *
3106         isl_pw_multi_aff_from_multi_pw_aff(
3107                 __isl_take isl_multi_pw_aff *mpa);
3108         __isl_give isl_multi_pw_aff *
3109         isl_multi_pw_aff_from_pw_multi_aff(
3110                 __isl_take isl_pw_multi_aff *pma);
3112 =head3 Union Expressions
3114 A union expression collects base expressions defined
3115 over different domains.  The space of a union expression
3116 is that of the shared parameter space.
3118 The union expression types defined by C<isl>
3119 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3120 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3122 An empty union expression can be created using the following functions.
3124         #include <isl/aff.h>
3125         __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
3126                 __isl_take isl_space *space);
3127         __isl_give isl_union_pw_multi_aff *
3128         isl_union_pw_multi_aff_empty(
3129                 __isl_take isl_space *space);
3131         #include <isl/polynomial.h>
3132         __isl_give isl_union_pw_qpolynomial *
3133         isl_union_pw_qpolynomial_zero(
3134                 __isl_take isl_space *space);
3136 A union expression containing a single base expression
3137 can be created using the following functions.
3139         #include <isl/aff.h>
3140         __isl_give isl_union_pw_aff *
3141         isl_union_pw_aff_from_pw_aff(
3142                 __isl_take isl_pw_aff *pa);
3143         __isl_give isl_union_pw_multi_aff *
3144         isl_union_pw_multi_aff_from_aff(
3145                 __isl_take isl_aff *aff);
3146         __isl_give isl_union_pw_multi_aff *
3147         isl_union_pw_multi_aff_from_pw_multi_aff(
3148                 __isl_take isl_pw_multi_aff *pma);
3150         #include <isl/polynomial.h>
3151         __isl_give isl_union_pw_qpolynomial *
3152         isl_union_pw_qpolynomial_from_pw_qpolynomial(
3153                 __isl_take isl_pw_qpolynomial *pwqp);
3155 The following functions create a base expression on each
3156 of the sets in the union set and collect the results.
3158         #include <isl/aff.h>
3159         __isl_give isl_union_pw_multi_aff *
3160         isl_union_pw_multi_aff_from_union_pw_aff(
3161                 __isl_take isl_union_pw_aff *upa);
3162         __isl_give isl_union_pw_aff *
3163         isl_union_pw_multi_aff_get_union_pw_aff(
3164                 __isl_keep isl_union_pw_multi_aff *upma, int pos);
3165         __isl_give isl_union_pw_aff *
3166         isl_union_pw_aff_val_on_domain(
3167                 __isl_take isl_union_set *domain,
3168                 __isl_take isl_val *v);
3169         __isl_give isl_union_pw_multi_aff *
3170         isl_union_pw_multi_aff_multi_val_on_domain(
3171                 __isl_take isl_union_set *domain,
3172                 __isl_take isl_multi_val *mv);
3174 An C<isl_union_pw_aff> that is equal to a (parametric) affine
3175 expression on a given domain can be created using the following
3176 function.
3178         #include <isl/aff.h>
3179         __isl_give isl_union_pw_aff *
3180         isl_union_pw_aff_aff_on_domain(
3181                 __isl_take isl_union_set *domain,
3182                 __isl_take isl_aff *aff);
3184 A base expression can be added to a union expression using
3185 the following functions.
3187         #include <isl/aff.h>
3188         __isl_give isl_union_pw_aff *
3189         isl_union_pw_aff_add_pw_aff(
3190                 __isl_take isl_union_pw_aff *upa,
3191                 __isl_take isl_pw_aff *pa);
3192         __isl_give isl_union_pw_multi_aff *
3193         isl_union_pw_multi_aff_add_pw_multi_aff(
3194                 __isl_take isl_union_pw_multi_aff *upma,
3195                 __isl_take isl_pw_multi_aff *pma);
3197         #include <isl/polynomial.h>
3198         __isl_give isl_union_pw_qpolynomial *
3199         isl_union_pw_qpolynomial_add_pw_qpolynomial(
3200                 __isl_take isl_union_pw_qpolynomial *upwqp,
3201                 __isl_take isl_pw_qpolynomial *pwqp);
3203 Union expressions can be copied and freed using
3204 the following functions.
3206         #include <isl/aff.h>
3207         __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
3208                 __isl_keep isl_union_pw_aff *upa);
3209         __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
3210                 __isl_take isl_union_pw_aff *upa);
3211         __isl_give isl_union_pw_multi_aff *
3212         isl_union_pw_multi_aff_copy(
3213                 __isl_keep isl_union_pw_multi_aff *upma);
3214         __isl_null isl_union_pw_multi_aff *
3215         isl_union_pw_multi_aff_free(
3216                 __isl_take isl_union_pw_multi_aff *upma);
3218         #include <isl/polynomial.h>
3219         __isl_give isl_union_pw_qpolynomial *
3220         isl_union_pw_qpolynomial_copy(
3221                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3222         __isl_null isl_union_pw_qpolynomial *
3223         isl_union_pw_qpolynomial_free(
3224                 __isl_take isl_union_pw_qpolynomial *upwqp);
3225         __isl_give isl_union_pw_qpolynomial_fold *
3226         isl_union_pw_qpolynomial_fold_copy(
3227                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3228         __isl_null isl_union_pw_qpolynomial_fold *
3229         isl_union_pw_qpolynomial_fold_free(
3230                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3232 To iterate over the base expressions in a union expression,
3233 use the following functions.
3235         #include <isl/aff.h>
3236         int isl_union_pw_aff_n_pw_aff(
3237                 __isl_keep isl_union_pw_aff *upa);
3238         isl_stat isl_union_pw_aff_foreach_pw_aff(
3239                 __isl_keep isl_union_pw_aff *upa,
3240                 isl_stat (*fn)(__isl_take isl_pw_aff *ma,
3241                         void *user), void *user);
3242         int isl_union_pw_multi_aff_n_pw_multi_aff(
3243                 __isl_keep isl_union_pw_multi_aff *upma);
3244         isl_stat isl_union_pw_multi_aff_foreach_pw_multi_aff(
3245                 __isl_keep isl_union_pw_multi_aff *upma,
3246                 isl_stat (*fn)(__isl_take isl_pw_multi_aff *pma,
3247                             void *user), void *user);
3249         #include <isl/polynomial.h>
3250         int isl_union_pw_qpolynomial_n_pw_qpolynomial(
3251                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3252         isl_stat isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3253                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3254                 isl_stat (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3255                             void *user), void *user);
3256         int isl_union_pw_qpolynomial_fold_n_pw_qpolynomial_fold(
3257                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3258         isl_stat isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3259                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3260                 isl_stat (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3261                             void *user), void *user);
3263 To extract the base expression in a given space from a union, use
3264 the following functions.
3266         #include <isl/aff.h>
3267         __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3268                 __isl_keep isl_union_pw_aff *upa,
3269                 __isl_take isl_space *space);
3270         __isl_give isl_pw_multi_aff *
3271         isl_union_pw_multi_aff_extract_pw_multi_aff(
3272                 __isl_keep isl_union_pw_multi_aff *upma,
3273                 __isl_take isl_space *space);
3275         #include <isl/polynomial.h>
3276         __isl_give isl_pw_qpolynomial *
3277         isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3278                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3279                 __isl_take isl_space *space);
3281 =head2 Input and Output
3283 For set and relation,
3284 C<isl> supports its own input/output format, which is similar
3285 to the C<Omega> format, but also supports the C<PolyLib> format
3286 in some cases.
3287 For other object types, typically only an C<isl> format is supported.
3289 =head3 C<isl> format
3291 The C<isl> format is similar to that of C<Omega>, but has a different
3292 syntax for describing the parameters and allows for the definition
3293 of an existentially quantified variable as the integer division
3294 of an affine expression.
3295 For example, the set of integers C<i> between C<0> and C<n>
3296 such that C<i % 10 <= 6> can be described as
3298         [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3299                                 i - 10 a <= 6) }
3301 A set or relation can have several disjuncts, separated
3302 by the keyword C<or>.  Each disjunct is either a conjunction
3303 of constraints or a projection (C<exists>) of a conjunction
3304 of constraints.  The constraints are separated by the keyword
3305 C<and>.
3307 =head3 C<PolyLib> format
3309 If the represented set is a union, then the first line
3310 contains a single number representing the number of disjuncts.
3311 Otherwise, a line containing the number C<1> is optional.
3313 Each disjunct is represented by a matrix of constraints.
3314 The first line contains two numbers representing
3315 the number of rows and columns,
3316 where the number of rows is equal to the number of constraints
3317 and the number of columns is equal to two plus the number of variables.
3318 The following lines contain the actual rows of the constraint matrix.
3319 In each row, the first column indicates whether the constraint
3320 is an equality (C<0>) or inequality (C<1>).  The final column
3321 corresponds to the constant term.
3323 If the set is parametric, then the coefficients of the parameters
3324 appear in the last columns before the constant column.
3325 The coefficients of any existentially quantified variables appear
3326 between those of the set variables and those of the parameters.
3328 =head3 Extended C<PolyLib> format
3330 The extended C<PolyLib> format is nearly identical to the
3331 C<PolyLib> format.  The only difference is that the line
3332 containing the number of rows and columns of a constraint matrix
3333 also contains four additional numbers:
3334 the number of output dimensions, the number of input dimensions,
3335 the number of local dimensions (i.e., the number of existentially
3336 quantified variables) and the number of parameters.
3337 For sets, the number of ``output'' dimensions is equal
3338 to the number of set dimensions, while the number of ``input''
3339 dimensions is zero.
3341 =head3 Input
3343 Objects can be read from input using the following functions.
3345         #include <isl/val.h>
3346         __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3347                 const char *str);
3348         __isl_give isl_multi_val *isl_multi_val_read_from_str(
3349                 isl_ctx *ctx, const char *str);
3351         #include <isl/set.h>
3352         __isl_give isl_basic_set *isl_basic_set_read_from_file(
3353                 isl_ctx *ctx, FILE *input);
3354         __isl_give isl_basic_set *isl_basic_set_read_from_str(
3355                 isl_ctx *ctx, const char *str);
3356         __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3357                 FILE *input);
3358         __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3359                 const char *str);
3361         #include <isl/map.h>
3362         __isl_give isl_basic_map *isl_basic_map_read_from_file(
3363                 isl_ctx *ctx, FILE *input);
3364         __isl_give isl_basic_map *isl_basic_map_read_from_str(
3365                 isl_ctx *ctx, const char *str);
3366         __isl_give isl_map *isl_map_read_from_file(
3367                 isl_ctx *ctx, FILE *input);
3368         __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3369                 const char *str);
3371         #include <isl/union_set.h>
3372         __isl_give isl_union_set *isl_union_set_read_from_file(
3373                 isl_ctx *ctx, FILE *input);
3374         __isl_give isl_union_set *isl_union_set_read_from_str(
3375                 isl_ctx *ctx, const char *str);
3377         #include <isl/union_map.h>
3378         __isl_give isl_union_map *isl_union_map_read_from_file(
3379                 isl_ctx *ctx, FILE *input);
3380         __isl_give isl_union_map *isl_union_map_read_from_str(
3381                 isl_ctx *ctx, const char *str);
3383         #include <isl/aff.h>
3384         __isl_give isl_aff *isl_aff_read_from_str(
3385                 isl_ctx *ctx, const char *str);
3386         __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3387                 isl_ctx *ctx, const char *str);
3388         __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3389                 isl_ctx *ctx, const char *str);
3390         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3391                 isl_ctx *ctx, const char *str);
3392         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3393                 isl_ctx *ctx, const char *str);
3394         __isl_give isl_union_pw_multi_aff *
3395         isl_union_pw_multi_aff_read_from_str(
3396                 isl_ctx *ctx, const char *str);
3397         __isl_give isl_multi_union_pw_aff *
3398         isl_multi_union_pw_aff_read_from_str(
3399                 isl_ctx *ctx, const char *str);
3401         #include <isl/polynomial.h>
3402         __isl_give isl_union_pw_qpolynomial *
3403         isl_union_pw_qpolynomial_read_from_str(
3404                 isl_ctx *ctx, const char *str);
3406 For sets and relations,
3407 the input format is autodetected and may be either the C<PolyLib> format
3408 or the C<isl> format.
3410 =head3 Output
3412 Before anything can be printed, an C<isl_printer> needs to
3413 be created.
3415         __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3416                 FILE *file);
3417         __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3418         __isl_null isl_printer *isl_printer_free(
3419                 __isl_take isl_printer *printer);
3420         __isl_give char *isl_printer_get_str(
3421                 __isl_keep isl_printer *printer);
3423 The printer can be inspected using the following functions.
3425         FILE *isl_printer_get_file(
3426                 __isl_keep isl_printer *printer);
3427         int isl_printer_get_output_format(
3428                 __isl_keep isl_printer *p);
3429         int isl_printer_get_yaml_style(__isl_keep isl_printer *p);
3431 The behavior of the printer can be modified in various ways
3433         __isl_give isl_printer *isl_printer_set_output_format(
3434                 __isl_take isl_printer *p, int output_format);
3435         __isl_give isl_printer *isl_printer_set_indent(
3436                 __isl_take isl_printer *p, int indent);
3437         __isl_give isl_printer *isl_printer_set_indent_prefix(
3438                 __isl_take isl_printer *p, const char *prefix);
3439         __isl_give isl_printer *isl_printer_indent(
3440                 __isl_take isl_printer *p, int indent);
3441         __isl_give isl_printer *isl_printer_set_prefix(
3442                 __isl_take isl_printer *p, const char *prefix);
3443         __isl_give isl_printer *isl_printer_set_suffix(
3444                 __isl_take isl_printer *p, const char *suffix);
3445         __isl_give isl_printer *isl_printer_set_yaml_style(
3446                 __isl_take isl_printer *p, int yaml_style);
3448 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3449 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3450 and defaults to C<ISL_FORMAT_ISL>.
3451 Each line in the output is prefixed by C<indent_prefix>,
3452 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3453 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3454 In the C<PolyLib> format output,
3455 the coefficients of the existentially quantified variables
3456 appear between those of the set variables and those
3457 of the parameters.
3458 The function C<isl_printer_indent> increases the indentation
3459 by the specified amount (which may be negative).
3460 The YAML style may be either C<ISL_YAML_STYLE_BLOCK> or
3461 C<ISL_YAML_STYLE_FLOW> and when we are printing something
3462 in YAML format.
3464 To actually print something, use
3466         #include <isl/printer.h>
3467         __isl_give isl_printer *isl_printer_print_double(
3468                 __isl_take isl_printer *p, double d);
3470         #include <isl/val.h>
3471         __isl_give isl_printer *isl_printer_print_val(
3472                 __isl_take isl_printer *p, __isl_keep isl_val *v);
3474         #include <isl/set.h>
3475         __isl_give isl_printer *isl_printer_print_basic_set(
3476                 __isl_take isl_printer *printer,
3477                 __isl_keep isl_basic_set *bset);
3478         __isl_give isl_printer *isl_printer_print_set(
3479                 __isl_take isl_printer *printer,
3480                 __isl_keep isl_set *set);
3482         #include <isl/map.h>
3483         __isl_give isl_printer *isl_printer_print_basic_map(
3484                 __isl_take isl_printer *printer,
3485                 __isl_keep isl_basic_map *bmap);
3486         __isl_give isl_printer *isl_printer_print_map(
3487                 __isl_take isl_printer *printer,
3488                 __isl_keep isl_map *map);
3490         #include <isl/union_set.h>
3491         __isl_give isl_printer *isl_printer_print_union_set(
3492                 __isl_take isl_printer *p,
3493                 __isl_keep isl_union_set *uset);
3495         #include <isl/union_map.h>
3496         __isl_give isl_printer *isl_printer_print_union_map(
3497                 __isl_take isl_printer *p,
3498                 __isl_keep isl_union_map *umap);
3500         #include <isl/val.h>
3501         __isl_give isl_printer *isl_printer_print_multi_val(
3502                 __isl_take isl_printer *p,
3503                 __isl_keep isl_multi_val *mv);
3505         #include <isl/aff.h>
3506         __isl_give isl_printer *isl_printer_print_aff(
3507                 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3508         __isl_give isl_printer *isl_printer_print_multi_aff(
3509                 __isl_take isl_printer *p,
3510                 __isl_keep isl_multi_aff *maff);
3511         __isl_give isl_printer *isl_printer_print_pw_aff(
3512                 __isl_take isl_printer *p,
3513                 __isl_keep isl_pw_aff *pwaff);
3514         __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3515                 __isl_take isl_printer *p,
3516                 __isl_keep isl_pw_multi_aff *pma);
3517         __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3518                 __isl_take isl_printer *p,
3519                 __isl_keep isl_multi_pw_aff *mpa);
3520         __isl_give isl_printer *isl_printer_print_union_pw_aff(
3521                 __isl_take isl_printer *p,
3522                 __isl_keep isl_union_pw_aff *upa);
3523         __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3524                 __isl_take isl_printer *p,
3525                 __isl_keep isl_union_pw_multi_aff *upma);
3526         __isl_give isl_printer *
3527         isl_printer_print_multi_union_pw_aff(
3528                 __isl_take isl_printer *p,
3529                 __isl_keep isl_multi_union_pw_aff *mupa);
3531         #include <isl/polynomial.h>
3532         __isl_give isl_printer *isl_printer_print_qpolynomial(
3533                 __isl_take isl_printer *p,
3534                 __isl_keep isl_qpolynomial *qp);
3535         __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3536                 __isl_take isl_printer *p,
3537                 __isl_keep isl_pw_qpolynomial *pwqp);
3538         __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3539                 __isl_take isl_printer *p,
3540                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3542         __isl_give isl_printer *
3543         isl_printer_print_pw_qpolynomial_fold(
3544                 __isl_take isl_printer *p,
3545                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3546         __isl_give isl_printer *
3547         isl_printer_print_union_pw_qpolynomial_fold(
3548                 __isl_take isl_printer *p,
3549                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3551 For C<isl_printer_print_qpolynomial>,
3552 C<isl_printer_print_pw_qpolynomial> and
3553 C<isl_printer_print_pw_qpolynomial_fold>,
3554 the output format of the printer
3555 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3556 For C<isl_printer_print_union_pw_qpolynomial> and
3557 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3558 is supported.
3559 In case of printing in C<ISL_FORMAT_C>, the user may want
3560 to set the names of all dimensions first.
3562 C<isl> also provides limited support for printing YAML documents,
3563 just enough for the internal use for printing such documents.
3565         #include <isl/printer.h>
3566         __isl_give isl_printer *isl_printer_yaml_start_mapping(
3567                 __isl_take isl_printer *p);
3568         __isl_give isl_printer *isl_printer_yaml_end_mapping(
3569                 __isl_take isl_printer *p);
3570         __isl_give isl_printer *isl_printer_yaml_start_sequence(
3571                 __isl_take isl_printer *p);
3572         __isl_give isl_printer *isl_printer_yaml_end_sequence(
3573                 __isl_take isl_printer *p);
3574         __isl_give isl_printer *isl_printer_yaml_next(
3575                 __isl_take isl_printer *p);
3577 A document is started by a call to either
3578 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3579 Anything printed to the printer after such a call belong to the
3580 first key of the mapping or the first element in the sequence.
3581 The function C<isl_printer_yaml_next> moves to the value if
3582 we are currently printing a mapping key, the next key if we
3583 are printing a value or the next element if we are printing
3584 an element in a sequence.
3585 Nested mappings and sequences are initiated by the same
3586 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3587 Each call to these functions needs to have a corresponding call to
3588 C<isl_printer_yaml_end_mapping> or C<isl_printer_yaml_end_sequence>.
3590 When called on a file printer, the following function flushes
3591 the file.  When called on a string printer, the buffer is cleared.
3593         __isl_give isl_printer *isl_printer_flush(
3594                 __isl_take isl_printer *p);
3596 Alternatively, a string representation can be obtained
3597 directly using the following functions, which always print
3598 in isl format.
3600         #include <isl/space.h>
3601         __isl_give char *isl_space_to_str(
3602                 __isl_keep isl_space *space);
3604         #include <isl/val.h>
3605         __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3606         __isl_give char *isl_multi_val_to_str(
3607                 __isl_keep isl_multi_val *mv);
3609         #include <isl/set.h>
3610         __isl_give char *isl_set_to_str(
3611                 __isl_keep isl_set *set);
3613         #include <isl/union_set.h>
3614         __isl_give char *isl_union_set_to_str(
3615                 __isl_keep isl_union_set *uset);
3617         #include <isl/map.h>
3618         __isl_give char *isl_map_to_str(
3619                 __isl_keep isl_map *map);
3621         #include <isl/union_map.h>
3622         __isl_give char *isl_union_map_to_str(
3623                 __isl_keep isl_union_map *umap);
3625         #include <isl/aff.h>
3626         __isl_give char *isl_multi_aff_to_str(
3627                 __isl_keep isl_multi_aff *aff);
3628         __isl_give char *isl_union_pw_aff_to_str(
3629                 __isl_keep isl_union_pw_aff *upa);
3630         __isl_give char *isl_union_pw_multi_aff_to_str(
3631                 __isl_keep isl_union_pw_multi_aff *upma);
3632         __isl_give char *isl_multi_union_pw_aff_to_str(
3633                 __isl_keep isl_multi_union_pw_aff *mupa);
3635 =head2 Properties
3637 =head3 Unary Properties
3639 =over
3641 =item * Emptiness
3643 The following functions test whether the given set or relation
3644 contains any integer points.  The ``plain'' variants do not perform
3645 any computations, but simply check if the given set or relation
3646 is already known to be empty.
3648         isl_bool isl_basic_set_plain_is_empty(
3649                 __isl_keep isl_basic_set *bset);
3650         isl_bool isl_basic_set_is_empty(
3651                 __isl_keep isl_basic_set *bset);
3652         isl_bool isl_set_plain_is_empty(
3653                 __isl_keep isl_set *set);
3654         isl_bool isl_set_is_empty(__isl_keep isl_set *set);
3655         isl_bool isl_union_set_is_empty(
3656                 __isl_keep isl_union_set *uset);
3657         isl_bool isl_basic_map_plain_is_empty(
3658                 __isl_keep isl_basic_map *bmap);
3659         isl_bool isl_basic_map_is_empty(
3660                 __isl_keep isl_basic_map *bmap);
3661         isl_bool isl_map_plain_is_empty(
3662                 __isl_keep isl_map *map);
3663         isl_bool isl_map_is_empty(__isl_keep isl_map *map);
3664         isl_bool isl_union_map_is_empty(
3665                 __isl_keep isl_union_map *umap);
3667 =item * Universality
3669         isl_bool isl_basic_set_is_universe(
3670                 __isl_keep isl_basic_set *bset);
3671         isl_bool isl_basic_map_is_universe(
3672                 __isl_keep isl_basic_map *bmap);
3673         isl_bool isl_set_plain_is_universe(
3674                 __isl_keep isl_set *set);
3675         isl_bool isl_map_plain_is_universe(
3676                 __isl_keep isl_map *map);
3678 =item * Single-valuedness
3680         #include <isl/set.h>
3681         isl_bool isl_set_is_singleton(__isl_keep isl_set *set);
3683         #include <isl/map.h>
3684         isl_bool isl_basic_map_is_single_valued(
3685                 __isl_keep isl_basic_map *bmap);
3686         isl_bool isl_map_plain_is_single_valued(
3687                 __isl_keep isl_map *map);
3688         isl_bool isl_map_is_single_valued(__isl_keep isl_map *map);
3690         #include <isl/union_map.h>
3691         isl_bool isl_union_map_is_single_valued(
3692                 __isl_keep isl_union_map *umap);
3694 =item * Injectivity
3696         isl_bool isl_map_plain_is_injective(
3697                 __isl_keep isl_map *map);
3698         isl_bool isl_map_is_injective(
3699                 __isl_keep isl_map *map);
3700         isl_bool isl_union_map_plain_is_injective(
3701                 __isl_keep isl_union_map *umap);
3702         isl_bool isl_union_map_is_injective(
3703                 __isl_keep isl_union_map *umap);
3705 =item * Bijectivity
3707         isl_bool isl_map_is_bijective(
3708                 __isl_keep isl_map *map);
3709         isl_bool isl_union_map_is_bijective(
3710                 __isl_keep isl_union_map *umap);
3712 =item * Position
3714         __isl_give isl_val *
3715         isl_basic_map_plain_get_val_if_fixed(
3716                 __isl_keep isl_basic_map *bmap,
3717                 enum isl_dim_type type, unsigned pos);
3718         __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3719                 __isl_keep isl_set *set,
3720                 enum isl_dim_type type, unsigned pos);
3721         __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3722                 __isl_keep isl_map *map,
3723                 enum isl_dim_type type, unsigned pos);
3725 If the set or relation obviously lies on a hyperplane where the given dimension
3726 has a fixed value, then return that value.
3727 Otherwise return NaN.
3729 =item * Stride
3731         isl_stat isl_set_dim_residue_class_val(
3732                 __isl_keep isl_set *set,
3733                 int pos, __isl_give isl_val **modulo,
3734                 __isl_give isl_val **residue);
3736 Check if the values of the given set dimension are equal to a fixed
3737 value modulo some integer value.  If so, assign the modulo to C<*modulo>
3738 and the fixed value to C<*residue>.  If the given dimension attains only
3739 a single value, then assign C<0> to C<*modulo> and the fixed value to
3740 C<*residue>.
3741 If the dimension does not attain only a single value and if no modulo
3742 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3744 =item * Dependence
3746 To check whether the description of a set, relation or function depends
3747 on one or more given dimensions,
3748 the following functions can be used.
3750         #include <isl/constraint.h>
3751         isl_bool isl_constraint_involves_dims(
3752                 __isl_keep isl_constraint *constraint,
3753                 enum isl_dim_type type, unsigned first, unsigned n);
3755         #include <isl/set.h>
3756         isl_bool isl_basic_set_involves_dims(
3757                 __isl_keep isl_basic_set *bset,
3758                 enum isl_dim_type type, unsigned first, unsigned n);
3759         isl_bool isl_set_involves_dims(__isl_keep isl_set *set,
3760                 enum isl_dim_type type, unsigned first, unsigned n);
3762         #include <isl/map.h>
3763         isl_bool isl_basic_map_involves_dims(
3764                 __isl_keep isl_basic_map *bmap,
3765                 enum isl_dim_type type, unsigned first, unsigned n);
3766         isl_bool isl_map_involves_dims(__isl_keep isl_map *map,
3767                 enum isl_dim_type type, unsigned first, unsigned n);
3769         #include <isl/union_map.h>
3770         isl_bool isl_union_map_involves_dims(
3771                 __isl_keep isl_union_map *umap,
3772                 enum isl_dim_type type, unsigned first, unsigned n);
3774         #include <isl/aff.h>
3775         isl_bool isl_aff_involves_dims(__isl_keep isl_aff *aff,
3776                 enum isl_dim_type type, unsigned first, unsigned n);
3777         isl_bool isl_pw_aff_involves_dims(
3778                 __isl_keep isl_pw_aff *pwaff,
3779                 enum isl_dim_type type, unsigned first, unsigned n);
3780         isl_bool isl_multi_aff_involves_dims(
3781                 __isl_keep isl_multi_aff *ma,
3782                 enum isl_dim_type type, unsigned first, unsigned n);
3783         isl_bool isl_multi_pw_aff_involves_dims(
3784                 __isl_keep isl_multi_pw_aff *mpa,
3785                 enum isl_dim_type type, unsigned first, unsigned n);
3787         #include <isl/polynomial.h>
3788         isl_bool isl_qpolynomial_involves_dims(
3789                 __isl_keep isl_qpolynomial *qp,
3790                 enum isl_dim_type type, unsigned first, unsigned n);
3792 Similarly, the following functions can be used to check whether
3793 a given dimension is involved in any lower or upper bound.
3795         #include <isl/set.h>
3796         isl_bool isl_set_dim_has_any_lower_bound(
3797                 __isl_keep isl_set *set,
3798                 enum isl_dim_type type, unsigned pos);
3799         isl_bool isl_set_dim_has_any_upper_bound(
3800                 __isl_keep isl_set *set,
3801                 enum isl_dim_type type, unsigned pos);
3803 Note that these functions return true even if there is a bound on
3804 the dimension on only some of the basic sets of C<set>.
3805 To check if they have a bound for all of the basic sets in C<set>,
3806 use the following functions instead.
3808         #include <isl/set.h>
3809         isl_bool isl_set_dim_has_lower_bound(
3810                 __isl_keep isl_set *set,
3811                 enum isl_dim_type type, unsigned pos);
3812         isl_bool isl_set_dim_has_upper_bound(
3813                 __isl_keep isl_set *set,
3814                 enum isl_dim_type type, unsigned pos);
3816 =item * Space
3818 To check whether a set is a parameter domain, use this function:
3820         isl_bool isl_set_is_params(__isl_keep isl_set *set);
3821         isl_bool isl_union_set_is_params(
3822                 __isl_keep isl_union_set *uset);
3824 =item * Wrapping
3826 The following functions check whether the space of the given
3827 (basic) set or relation range is a wrapped relation.
3829         #include <isl/space.h>
3830         isl_bool isl_space_is_wrapping(
3831                 __isl_keep isl_space *space);
3832         isl_bool isl_space_domain_is_wrapping(
3833                 __isl_keep isl_space *space);
3834         isl_bool isl_space_range_is_wrapping(
3835                 __isl_keep isl_space *space);
3837         #include <isl/set.h>
3838         isl_bool isl_basic_set_is_wrapping(
3839                 __isl_keep isl_basic_set *bset);
3840         isl_bool isl_set_is_wrapping(__isl_keep isl_set *set);
3842         #include <isl/map.h>
3843         isl_bool isl_map_domain_is_wrapping(
3844                 __isl_keep isl_map *map);
3845         isl_bool isl_map_range_is_wrapping(
3846                 __isl_keep isl_map *map);
3848         #include <isl/val.h>
3849         isl_bool isl_multi_val_range_is_wrapping(
3850                 __isl_keep isl_multi_val *mv);
3852         #include <isl/aff.h>
3853         isl_bool isl_multi_aff_range_is_wrapping(
3854                 __isl_keep isl_multi_aff *ma);
3855         isl_bool isl_multi_pw_aff_range_is_wrapping(
3856                 __isl_keep isl_multi_pw_aff *mpa);
3857         isl_bool isl_multi_union_pw_aff_range_is_wrapping(
3858                 __isl_keep isl_multi_union_pw_aff *mupa);
3860 The input to C<isl_space_is_wrapping> should
3861 be the space of a set, while that of
3862 C<isl_space_domain_is_wrapping> and
3863 C<isl_space_range_is_wrapping> should be the space of a relation.
3865 =item * Internal Product
3867         isl_bool isl_basic_map_can_zip(
3868                 __isl_keep isl_basic_map *bmap);
3869         isl_bool isl_map_can_zip(__isl_keep isl_map *map);
3871 Check whether the product of domain and range of the given relation
3872 can be computed,
3873 i.e., whether both domain and range are nested relations.
3875 =item * Currying
3877         isl_bool isl_basic_map_can_curry(
3878                 __isl_keep isl_basic_map *bmap);
3879         isl_bool isl_map_can_curry(__isl_keep isl_map *map);
3881 Check whether the domain of the (basic) relation is a wrapped relation.
3883         isl_bool isl_basic_map_can_uncurry(
3884                 __isl_keep isl_basic_map *bmap);
3885         isl_bool isl_map_can_uncurry(__isl_keep isl_map *map);
3887 Check whether the range of the (basic) relation is a wrapped relation.
3889 =item * Special Values
3891         #include <isl/aff.h>
3892         isl_bool isl_aff_is_cst(__isl_keep isl_aff *aff);
3893         isl_bool isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
3895 Check whether the given expression is a constant.
3897         #include <isl/aff.h>
3898         isl_bool isl_aff_is_nan(__isl_keep isl_aff *aff);
3899         isl_bool isl_pw_aff_involves_nan(
3900                 __isl_keep isl_pw_aff *pa);
3902         #include <isl/polynomial.h>
3903         isl_bool isl_qpolynomial_fold_is_nan(
3904                 __isl_keep isl_qpolynomial_fold *fold);
3906 Check whether the given expression is equal to or involves NaN.
3908         #include <isl/aff.h>
3909         isl_bool isl_aff_plain_is_zero(
3910                 __isl_keep isl_aff *aff);
3912 Check whether the affine expression is obviously zero.
3914 =back
3916 =head3 Binary Properties
3918 =over
3920 =item * Equality
3922 The following functions check whether two objects
3923 represent the same set, relation or function.
3924 The C<plain> variants only return true if the objects
3925 are obviously the same.  That is, they may return false
3926 even if the objects are the same, but they will never
3927 return true if the objects are not the same.
3929         #include <isl/set.h>
3930         isl_bool isl_basic_set_plain_is_equal(
3931                 __isl_keep isl_basic_set *bset1,
3932                 __isl_keep isl_basic_set *bset2);
3933         isl_bool isl_basic_set_is_equal(
3934                 __isl_keep isl_basic_set *bset1,
3935                 __isl_keep isl_basic_set *bset2);
3936         isl_bool isl_set_plain_is_equal(
3937                 __isl_keep isl_set *set1,
3938                 __isl_keep isl_set *set2);
3939         isl_bool isl_set_is_equal(__isl_keep isl_set *set1,
3940                 __isl_keep isl_set *set2);
3942         #include <isl/map.h>
3943         isl_bool isl_basic_map_is_equal(
3944                 __isl_keep isl_basic_map *bmap1,
3945                 __isl_keep isl_basic_map *bmap2);
3946         isl_bool isl_map_is_equal(__isl_keep isl_map *map1,
3947                 __isl_keep isl_map *map2);
3948         isl_bool isl_map_plain_is_equal(
3949                 __isl_keep isl_map *map1,
3950                 __isl_keep isl_map *map2);
3952         #include <isl/union_set.h>
3953         isl_bool isl_union_set_is_equal(
3954                 __isl_keep isl_union_set *uset1,
3955                 __isl_keep isl_union_set *uset2);
3957         #include <isl/union_map.h>
3958         isl_bool isl_union_map_is_equal(
3959                 __isl_keep isl_union_map *umap1,
3960                 __isl_keep isl_union_map *umap2);
3962         #include <isl/aff.h>
3963         isl_bool isl_aff_plain_is_equal(
3964                 __isl_keep isl_aff *aff1,
3965                 __isl_keep isl_aff *aff2);
3966         isl_bool isl_multi_aff_plain_is_equal(
3967                 __isl_keep isl_multi_aff *maff1,
3968                 __isl_keep isl_multi_aff *maff2);
3969         isl_bool isl_pw_aff_plain_is_equal(
3970                 __isl_keep isl_pw_aff *pwaff1,
3971                 __isl_keep isl_pw_aff *pwaff2);
3972         isl_bool isl_pw_multi_aff_plain_is_equal(
3973                 __isl_keep isl_pw_multi_aff *pma1,
3974                 __isl_keep isl_pw_multi_aff *pma2);
3975         isl_bool isl_multi_pw_aff_plain_is_equal(
3976                 __isl_keep isl_multi_pw_aff *mpa1,
3977                 __isl_keep isl_multi_pw_aff *mpa2);
3978         isl_bool isl_multi_pw_aff_is_equal(
3979                 __isl_keep isl_multi_pw_aff *mpa1,
3980                 __isl_keep isl_multi_pw_aff *mpa2);
3981         isl_bool isl_union_pw_aff_plain_is_equal(
3982                 __isl_keep isl_union_pw_aff *upa1,
3983                 __isl_keep isl_union_pw_aff *upa2);
3984         isl_bool isl_union_pw_multi_aff_plain_is_equal(
3985                 __isl_keep isl_union_pw_multi_aff *upma1,
3986                 __isl_keep isl_union_pw_multi_aff *upma2);
3987         isl_bool isl_multi_union_pw_aff_plain_is_equal(
3988                 __isl_keep isl_multi_union_pw_aff *mupa1,
3989                 __isl_keep isl_multi_union_pw_aff *mupa2);
3991         #include <isl/polynomial.h>
3992         isl_bool isl_union_pw_qpolynomial_plain_is_equal(
3993                 __isl_keep isl_union_pw_qpolynomial *upwqp1,
3994                 __isl_keep isl_union_pw_qpolynomial *upwqp2);
3995         isl_bool isl_union_pw_qpolynomial_fold_plain_is_equal(
3996                 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
3997                 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
3999 =item * Disjointness
4001         #include <isl/set.h>
4002         isl_bool isl_basic_set_is_disjoint(
4003                 __isl_keep isl_basic_set *bset1,
4004                 __isl_keep isl_basic_set *bset2);
4005         isl_bool isl_set_plain_is_disjoint(
4006                 __isl_keep isl_set *set1,
4007                 __isl_keep isl_set *set2);
4008         isl_bool isl_set_is_disjoint(__isl_keep isl_set *set1,
4009                 __isl_keep isl_set *set2);
4011         #include <isl/map.h>
4012         isl_bool isl_basic_map_is_disjoint(
4013                 __isl_keep isl_basic_map *bmap1,
4014                 __isl_keep isl_basic_map *bmap2);
4015         isl_bool isl_map_is_disjoint(__isl_keep isl_map *map1,
4016                 __isl_keep isl_map *map2);
4018         #include <isl/union_set.h>
4019         isl_bool isl_union_set_is_disjoint(
4020                 __isl_keep isl_union_set *uset1,
4021                 __isl_keep isl_union_set *uset2);
4023         #include <isl/union_map.h>
4024         isl_bool isl_union_map_is_disjoint(
4025                 __isl_keep isl_union_map *umap1,
4026                 __isl_keep isl_union_map *umap2);
4028 =item * Subset
4030         isl_bool isl_basic_set_is_subset(
4031                 __isl_keep isl_basic_set *bset1,
4032                 __isl_keep isl_basic_set *bset2);
4033         isl_bool isl_set_is_subset(__isl_keep isl_set *set1,
4034                 __isl_keep isl_set *set2);
4035         isl_bool isl_set_is_strict_subset(
4036                 __isl_keep isl_set *set1,
4037                 __isl_keep isl_set *set2);
4038         isl_bool isl_union_set_is_subset(
4039                 __isl_keep isl_union_set *uset1,
4040                 __isl_keep isl_union_set *uset2);
4041         isl_bool isl_union_set_is_strict_subset(
4042                 __isl_keep isl_union_set *uset1,
4043                 __isl_keep isl_union_set *uset2);
4044         isl_bool isl_basic_map_is_subset(
4045                 __isl_keep isl_basic_map *bmap1,
4046                 __isl_keep isl_basic_map *bmap2);
4047         isl_bool isl_basic_map_is_strict_subset(
4048                 __isl_keep isl_basic_map *bmap1,
4049                 __isl_keep isl_basic_map *bmap2);
4050         isl_bool isl_map_is_subset(
4051                 __isl_keep isl_map *map1,
4052                 __isl_keep isl_map *map2);
4053         isl_bool isl_map_is_strict_subset(
4054                 __isl_keep isl_map *map1,
4055                 __isl_keep isl_map *map2);
4056         isl_bool isl_union_map_is_subset(
4057                 __isl_keep isl_union_map *umap1,
4058                 __isl_keep isl_union_map *umap2);
4059         isl_bool isl_union_map_is_strict_subset(
4060                 __isl_keep isl_union_map *umap1,
4061                 __isl_keep isl_union_map *umap2);
4063 Check whether the first argument is a (strict) subset of the
4064 second argument.
4066 =item * Order
4068 Every comparison function returns a negative value if the first
4069 argument is considered smaller than the second, a positive value
4070 if the first argument is considered greater and zero if the two
4071 constraints are considered the same by the comparison criterion.
4073         #include <isl/constraint.h>
4074         int isl_constraint_plain_cmp(
4075                 __isl_keep isl_constraint *c1,
4076                 __isl_keep isl_constraint *c2);
4078 This function is useful for sorting C<isl_constraint>s.
4079 The order depends on the internal representation of the inputs.
4080 The order is fixed over different calls to the function (assuming
4081 the internal representation of the inputs has not changed), but may
4082 change over different versions of C<isl>.
4084         #include <isl/constraint.h>
4085         int isl_constraint_cmp_last_non_zero(
4086                 __isl_keep isl_constraint *c1,
4087                 __isl_keep isl_constraint *c2);
4089 This function can be used to sort constraints that live in the same
4090 local space.  Constraints that involve ``earlier'' dimensions or
4091 that have a smaller coefficient for the shared latest dimension
4092 are considered smaller than other constraints.
4093 This function only defines a B<partial> order.
4095         #include <isl/set.h>
4096         int isl_set_plain_cmp(__isl_keep isl_set *set1,
4097                 __isl_keep isl_set *set2);
4099 This function is useful for sorting C<isl_set>s.
4100 The order depends on the internal representation of the inputs.
4101 The order is fixed over different calls to the function (assuming
4102 the internal representation of the inputs has not changed), but may
4103 change over different versions of C<isl>.
4105         #include <isl/aff.h>
4106         int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
4107                 __isl_keep isl_pw_aff *pa2);
4109 The function C<isl_pw_aff_plain_cmp> can be used to sort
4110 C<isl_pw_aff>s.  The order is not strictly defined.
4111 The current order sorts expressions that only involve
4112 earlier dimensions before those that involve later dimensions.
4114 =back
4116 =head2 Unary Operations
4118 =over
4120 =item * Complement
4122         __isl_give isl_set *isl_set_complement(
4123                 __isl_take isl_set *set);
4124         __isl_give isl_map *isl_map_complement(
4125                 __isl_take isl_map *map);
4127 =item * Inverse map
4129         #include <isl/space.h>
4130         __isl_give isl_space *isl_space_reverse(
4131                 __isl_take isl_space *space);
4133         #include <isl/map.h>
4134         __isl_give isl_basic_map *isl_basic_map_reverse(
4135                 __isl_take isl_basic_map *bmap);
4136         __isl_give isl_map *isl_map_reverse(
4137                 __isl_take isl_map *map);
4139         #include <isl/union_map.h>
4140         __isl_give isl_union_map *isl_union_map_reverse(
4141                 __isl_take isl_union_map *umap);
4143 =item * Projection
4145         #include <isl/space.h>
4146         __isl_give isl_space *isl_space_domain(
4147                 __isl_take isl_space *space);
4148         __isl_give isl_space *isl_space_range(
4149                 __isl_take isl_space *space);
4150         __isl_give isl_space *isl_space_params(
4151                 __isl_take isl_space *space);
4153         #include <isl/local_space.h>
4154         __isl_give isl_local_space *isl_local_space_domain(
4155                 __isl_take isl_local_space *ls);
4156         __isl_give isl_local_space *isl_local_space_range(
4157                 __isl_take isl_local_space *ls);
4159         #include <isl/set.h>
4160         __isl_give isl_basic_set *isl_basic_set_project_out(
4161                 __isl_take isl_basic_set *bset,
4162                 enum isl_dim_type type, unsigned first, unsigned n);
4163         __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
4164                 enum isl_dim_type type, unsigned first, unsigned n);
4165         __isl_give isl_basic_set *isl_basic_set_params(
4166                 __isl_take isl_basic_set *bset);
4167         __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
4169         #include <isl/map.h>
4170         __isl_give isl_basic_map *isl_basic_map_project_out(
4171                 __isl_take isl_basic_map *bmap,
4172                 enum isl_dim_type type, unsigned first, unsigned n);
4173         __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
4174                 enum isl_dim_type type, unsigned first, unsigned n);
4175         __isl_give isl_basic_set *isl_basic_map_domain(
4176                 __isl_take isl_basic_map *bmap);
4177         __isl_give isl_basic_set *isl_basic_map_range(
4178                 __isl_take isl_basic_map *bmap);
4179         __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
4180         __isl_give isl_set *isl_map_domain(
4181                 __isl_take isl_map *bmap);
4182         __isl_give isl_set *isl_map_range(
4183                 __isl_take isl_map *map);
4185         #include <isl/union_set.h>
4186         __isl_give isl_union_set *isl_union_set_project_out(
4187                 __isl_take isl_union_set *uset,
4188                 enum isl_dim_type type,
4189                 unsigned first, unsigned n);
4190         __isl_give isl_set *isl_union_set_params(
4191                 __isl_take isl_union_set *uset);
4193 The function C<isl_union_set_project_out> can only project out
4194 parameters.
4196         #include <isl/union_map.h>
4197         __isl_give isl_union_map *isl_union_map_project_out(
4198                 __isl_take isl_union_map *umap,
4199                 enum isl_dim_type type, unsigned first, unsigned n);
4200         __isl_give isl_set *isl_union_map_params(
4201                 __isl_take isl_union_map *umap);
4202         __isl_give isl_union_set *isl_union_map_domain(
4203                 __isl_take isl_union_map *umap);
4204         __isl_give isl_union_set *isl_union_map_range(
4205                 __isl_take isl_union_map *umap);
4207 The function C<isl_union_map_project_out> can only project out
4208 parameters.
4210         #include <isl/aff.h>
4211         __isl_give isl_aff *isl_aff_project_domain_on_params(
4212                 __isl_take isl_aff *aff);
4213         __isl_give isl_pw_multi_aff *
4214         isl_pw_multi_aff_project_domain_on_params(
4215                 __isl_take isl_pw_multi_aff *pma);
4216         __isl_give isl_set *isl_pw_aff_domain(
4217                 __isl_take isl_pw_aff *pwaff);
4218         __isl_give isl_set *isl_pw_multi_aff_domain(
4219                 __isl_take isl_pw_multi_aff *pma);
4220         __isl_give isl_set *isl_multi_pw_aff_domain(
4221                 __isl_take isl_multi_pw_aff *mpa);
4222         __isl_give isl_union_set *isl_union_pw_aff_domain(
4223                 __isl_take isl_union_pw_aff *upa);
4224         __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
4225                 __isl_take isl_union_pw_multi_aff *upma);
4226         __isl_give isl_union_set *
4227         isl_multi_union_pw_aff_domain(
4228                 __isl_take isl_multi_union_pw_aff *mupa);
4229         __isl_give isl_set *isl_pw_aff_params(
4230                 __isl_take isl_pw_aff *pwa);
4232 The function C<isl_multi_union_pw_aff_domain> requires its
4233 input to have at least one set dimension.
4235         #include <isl/polynomial.h>
4236         __isl_give isl_qpolynomial *
4237         isl_qpolynomial_project_domain_on_params(
4238                 __isl_take isl_qpolynomial *qp);
4239         __isl_give isl_pw_qpolynomial *
4240         isl_pw_qpolynomial_project_domain_on_params(
4241                 __isl_take isl_pw_qpolynomial *pwqp);
4242         __isl_give isl_pw_qpolynomial_fold *
4243         isl_pw_qpolynomial_fold_project_domain_on_params(
4244                 __isl_take isl_pw_qpolynomial_fold *pwf);
4245         __isl_give isl_set *isl_pw_qpolynomial_domain(
4246                 __isl_take isl_pw_qpolynomial *pwqp);
4247         __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
4248                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4249         __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
4250                 __isl_take isl_union_pw_qpolynomial *upwqp);
4252         #include <isl/space.h>
4253         __isl_give isl_space *isl_space_domain_map(
4254                 __isl_take isl_space *space);
4255         __isl_give isl_space *isl_space_range_map(
4256                 __isl_take isl_space *space);
4258         #include <isl/map.h>
4259         __isl_give isl_map *isl_set_wrapped_domain_map(
4260                 __isl_take isl_set *set);
4261         __isl_give isl_basic_map *isl_basic_map_domain_map(
4262                 __isl_take isl_basic_map *bmap);
4263         __isl_give isl_basic_map *isl_basic_map_range_map(
4264                 __isl_take isl_basic_map *bmap);
4265         __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
4266         __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
4268         #include <isl/union_map.h>
4269         __isl_give isl_union_map *isl_union_map_domain_map(
4270                 __isl_take isl_union_map *umap);
4271         __isl_give isl_union_pw_multi_aff *
4272         isl_union_map_domain_map_union_pw_multi_aff(
4273                 __isl_take isl_union_map *umap);
4274         __isl_give isl_union_map *isl_union_map_range_map(
4275                 __isl_take isl_union_map *umap);
4276         __isl_give isl_union_map *
4277         isl_union_set_wrapped_domain_map(
4278                 __isl_take isl_union_set *uset);
4280 The functions above construct a (basic, regular or union) relation
4281 that maps (a wrapped version of) the input relation to its domain or range.
4282 C<isl_set_wrapped_domain_map> maps the input set to the domain
4283 of its wrapped relation.
4285 =item * Elimination
4287         __isl_give isl_basic_set *isl_basic_set_eliminate(
4288                 __isl_take isl_basic_set *bset,
4289                 enum isl_dim_type type,
4290                 unsigned first, unsigned n);
4291         __isl_give isl_set *isl_set_eliminate(
4292                 __isl_take isl_set *set, enum isl_dim_type type,
4293                 unsigned first, unsigned n);
4294         __isl_give isl_basic_map *isl_basic_map_eliminate(
4295                 __isl_take isl_basic_map *bmap,
4296                 enum isl_dim_type type,
4297                 unsigned first, unsigned n);
4298         __isl_give isl_map *isl_map_eliminate(
4299                 __isl_take isl_map *map, enum isl_dim_type type,
4300                 unsigned first, unsigned n);
4302 Eliminate the coefficients for the given dimensions from the constraints,
4303 without removing the dimensions.
4305 =item * Constructing a set from a parameter domain
4307 A zero-dimensional space or (basic) set can be constructed
4308 on a given parameter domain using the following functions.
4310         #include <isl/space.h>
4311         __isl_give isl_space *isl_space_set_from_params(
4312                 __isl_take isl_space *space);
4314         #include <isl/set.h>
4315         __isl_give isl_basic_set *isl_basic_set_from_params(
4316                 __isl_take isl_basic_set *bset);
4317         __isl_give isl_set *isl_set_from_params(
4318                 __isl_take isl_set *set);
4320 =item * Constructing a relation from a set
4322 Create a relation with the given set as domain or range.
4323 The range or domain of the created relation is a zero-dimensional
4324 flat anonymous space.
4326         #include <isl/space.h>
4327         __isl_give isl_space *isl_space_from_domain(
4328                 __isl_take isl_space *space);
4329         __isl_give isl_space *isl_space_from_range(
4330                 __isl_take isl_space *space);
4331         __isl_give isl_space *isl_space_map_from_set(
4332                 __isl_take isl_space *space);
4333         __isl_give isl_space *isl_space_map_from_domain_and_range(
4334                 __isl_take isl_space *domain,
4335                 __isl_take isl_space *range);
4337         #include <isl/local_space.h>
4338         __isl_give isl_local_space *isl_local_space_from_domain(
4339                 __isl_take isl_local_space *ls);
4341         #include <isl/map.h>
4342         __isl_give isl_map *isl_map_from_domain(
4343                 __isl_take isl_set *set);
4344         __isl_give isl_map *isl_map_from_range(
4345                 __isl_take isl_set *set);
4347         #include <isl/val.h>
4348         __isl_give isl_multi_val *isl_multi_val_from_range(
4349                 __isl_take isl_multi_val *mv);
4351         #include <isl/aff.h>
4352         __isl_give isl_multi_aff *isl_multi_aff_from_range(
4353                 __isl_take isl_multi_aff *ma);
4354         __isl_give isl_pw_aff *isl_pw_aff_from_range(
4355                 __isl_take isl_pw_aff *pwa);
4356         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
4357                 __isl_take isl_multi_pw_aff *mpa);
4358         __isl_give isl_multi_union_pw_aff *
4359         isl_multi_union_pw_aff_from_range(
4360                 __isl_take isl_multi_union_pw_aff *mupa);
4361         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
4362                 __isl_take isl_set *set);
4363         __isl_give isl_union_pw_multi_aff *
4364         isl_union_pw_multi_aff_from_domain(
4365                 __isl_take isl_union_set *uset);
4367 =item * Slicing
4369         #include <isl/set.h>
4370         __isl_give isl_basic_set *isl_basic_set_fix_si(
4371                 __isl_take isl_basic_set *bset,
4372                 enum isl_dim_type type, unsigned pos, int value);
4373         __isl_give isl_basic_set *isl_basic_set_fix_val(
4374                 __isl_take isl_basic_set *bset,
4375                 enum isl_dim_type type, unsigned pos,
4376                 __isl_take isl_val *v);
4377         __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
4378                 enum isl_dim_type type, unsigned pos, int value);
4379         __isl_give isl_set *isl_set_fix_val(
4380                 __isl_take isl_set *set,
4381                 enum isl_dim_type type, unsigned pos,
4382                 __isl_take isl_val *v);
4384         #include <isl/map.h>
4385         __isl_give isl_basic_map *isl_basic_map_fix_si(
4386                 __isl_take isl_basic_map *bmap,
4387                 enum isl_dim_type type, unsigned pos, int value);
4388         __isl_give isl_basic_map *isl_basic_map_fix_val(
4389                 __isl_take isl_basic_map *bmap,
4390                 enum isl_dim_type type, unsigned pos,
4391                 __isl_take isl_val *v);
4392         __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
4393                 enum isl_dim_type type, unsigned pos, int value);
4394         __isl_give isl_map *isl_map_fix_val(
4395                 __isl_take isl_map *map,
4396                 enum isl_dim_type type, unsigned pos,
4397                 __isl_take isl_val *v);
4399         #include <isl/aff.h>
4400         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
4401                 __isl_take isl_pw_multi_aff *pma,
4402                 enum isl_dim_type type, unsigned pos, int value);
4404         #include <isl/polynomial.h>
4405         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
4406                 __isl_take isl_pw_qpolynomial *pwqp,
4407                 enum isl_dim_type type, unsigned n,
4408                 __isl_take isl_val *v);
4410 Intersect the set, relation or function domain
4411 with the hyperplane where the given
4412 dimension has the fixed given value.
4414         __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
4415                 __isl_take isl_basic_map *bmap,
4416                 enum isl_dim_type type, unsigned pos, int value);
4417         __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
4418                 __isl_take isl_basic_map *bmap,
4419                 enum isl_dim_type type, unsigned pos, int value);
4420         __isl_give isl_set *isl_set_lower_bound_si(
4421                 __isl_take isl_set *set,
4422                 enum isl_dim_type type, unsigned pos, int value);
4423         __isl_give isl_set *isl_set_lower_bound_val(
4424                 __isl_take isl_set *set,
4425                 enum isl_dim_type type, unsigned pos,
4426                 __isl_take isl_val *value);
4427         __isl_give isl_map *isl_map_lower_bound_si(
4428                 __isl_take isl_map *map,
4429                 enum isl_dim_type type, unsigned pos, int value);
4430         __isl_give isl_set *isl_set_upper_bound_si(
4431                 __isl_take isl_set *set,
4432                 enum isl_dim_type type, unsigned pos, int value);
4433         __isl_give isl_set *isl_set_upper_bound_val(
4434                 __isl_take isl_set *set,
4435                 enum isl_dim_type type, unsigned pos,
4436                 __isl_take isl_val *value);
4437         __isl_give isl_map *isl_map_upper_bound_si(
4438                 __isl_take isl_map *map,
4439                 enum isl_dim_type type, unsigned pos, int value);
4441 Intersect the set or relation with the half-space where the given
4442 dimension has a value bounded by the fixed given integer value.
4444         __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
4445                 enum isl_dim_type type1, int pos1,
4446                 enum isl_dim_type type2, int pos2);
4447         __isl_give isl_basic_map *isl_basic_map_equate(
4448                 __isl_take isl_basic_map *bmap,
4449                 enum isl_dim_type type1, int pos1,
4450                 enum isl_dim_type type2, int pos2);
4451         __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
4452                 enum isl_dim_type type1, int pos1,
4453                 enum isl_dim_type type2, int pos2);
4455 Intersect the set or relation with the hyperplane where the given
4456 dimensions are equal to each other.
4458         __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4459                 enum isl_dim_type type1, int pos1,
4460                 enum isl_dim_type type2, int pos2);
4462 Intersect the relation with the hyperplane where the given
4463 dimensions have opposite values.
4465         __isl_give isl_map *isl_map_order_le(
4466                 __isl_take isl_map *map,
4467                 enum isl_dim_type type1, int pos1,
4468                 enum isl_dim_type type2, int pos2);
4469         __isl_give isl_basic_map *isl_basic_map_order_ge(
4470                 __isl_take isl_basic_map *bmap,
4471                 enum isl_dim_type type1, int pos1,
4472                 enum isl_dim_type type2, int pos2);
4473         __isl_give isl_map *isl_map_order_ge(
4474                 __isl_take isl_map *map,
4475                 enum isl_dim_type type1, int pos1,
4476                 enum isl_dim_type type2, int pos2);
4477         __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4478                 enum isl_dim_type type1, int pos1,
4479                 enum isl_dim_type type2, int pos2);
4480         __isl_give isl_basic_map *isl_basic_map_order_gt(
4481                 __isl_take isl_basic_map *bmap,
4482                 enum isl_dim_type type1, int pos1,
4483                 enum isl_dim_type type2, int pos2);
4484         __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4485                 enum isl_dim_type type1, int pos1,
4486                 enum isl_dim_type type2, int pos2);
4488 Intersect the relation with the half-space where the given
4489 dimensions satisfy the given ordering.
4491 =item * Locus
4493         #include <isl/aff.h>
4494         __isl_give isl_basic_set *isl_aff_zero_basic_set(
4495                 __isl_take isl_aff *aff);
4496         __isl_give isl_basic_set *isl_aff_neg_basic_set(
4497                 __isl_take isl_aff *aff);
4498         __isl_give isl_set *isl_pw_aff_pos_set(
4499                 __isl_take isl_pw_aff *pa);
4500         __isl_give isl_set *isl_pw_aff_nonneg_set(
4501                 __isl_take isl_pw_aff *pwaff);
4502         __isl_give isl_set *isl_pw_aff_zero_set(
4503                 __isl_take isl_pw_aff *pwaff);
4504         __isl_give isl_set *isl_pw_aff_non_zero_set(
4505                 __isl_take isl_pw_aff *pwaff);
4506         __isl_give isl_union_set *
4507         isl_union_pw_aff_zero_union_set(
4508                 __isl_take isl_union_pw_aff *upa);
4509         __isl_give isl_union_set *
4510         isl_multi_union_pw_aff_zero_union_set(
4511                 __isl_take isl_multi_union_pw_aff *mupa);
4513 The function C<isl_aff_neg_basic_set> returns a basic set
4514 containing those elements in the domain space
4515 of C<aff> where C<aff> is negative.
4516 The function C<isl_pw_aff_nonneg_set> returns a set
4517 containing those elements in the domain
4518 of C<pwaff> where C<pwaff> is non-negative.
4519 The function C<isl_multi_union_pw_aff_zero_union_set>
4520 returns a union set containing those elements
4521 in the domains of its elements where they are all zero.
4523 =item * Identity
4525         __isl_give isl_map *isl_set_identity(
4526                 __isl_take isl_set *set);
4527         __isl_give isl_union_map *isl_union_set_identity(
4528                 __isl_take isl_union_set *uset);
4529         __isl_give isl_union_pw_multi_aff *
4530         isl_union_set_identity_union_pw_multi_aff(
4531                 __isl_take isl_union_set *uset);
4533 Construct an identity relation on the given (union) set.
4535 =item * Function Extraction
4537 A piecewise quasi affine expression that is equal to 1 on a set
4538 and 0 outside the set can be created using the following function.
4540         #include <isl/aff.h>
4541         __isl_give isl_pw_aff *isl_set_indicator_function(
4542                 __isl_take isl_set *set);
4544 A piecewise multiple quasi affine expression can be extracted
4545 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4546 and the C<isl_map> is single-valued.
4547 In case of a conversion from an C<isl_union_map>
4548 to an C<isl_union_pw_multi_aff>, these properties need to hold
4549 in each domain space.
4550 A conversion to a C<isl_multi_union_pw_aff> additionally
4551 requires that the input is non-empty and involves only a single
4552 range space.
4554         #include <isl/aff.h>
4555         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4556                 __isl_take isl_set *set);
4557         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4558                 __isl_take isl_map *map);
4560         __isl_give isl_union_pw_multi_aff *
4561         isl_union_pw_multi_aff_from_union_set(
4562                 __isl_take isl_union_set *uset);
4563         __isl_give isl_union_pw_multi_aff *
4564         isl_union_pw_multi_aff_from_union_map(
4565                 __isl_take isl_union_map *umap);
4567         __isl_give isl_multi_union_pw_aff *
4568         isl_multi_union_pw_aff_from_union_map(
4569                 __isl_take isl_union_map *umap);
4571 =item * Deltas
4573         __isl_give isl_basic_set *isl_basic_map_deltas(
4574                 __isl_take isl_basic_map *bmap);
4575         __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
4576         __isl_give isl_union_set *isl_union_map_deltas(
4577                 __isl_take isl_union_map *umap);
4579 These functions return a (basic) set containing the differences
4580 between image elements and corresponding domain elements in the input.
4582         __isl_give isl_basic_map *isl_basic_map_deltas_map(
4583                 __isl_take isl_basic_map *bmap);
4584         __isl_give isl_map *isl_map_deltas_map(
4585                 __isl_take isl_map *map);
4586         __isl_give isl_union_map *isl_union_map_deltas_map(
4587                 __isl_take isl_union_map *umap);
4589 The functions above construct a (basic, regular or union) relation
4590 that maps (a wrapped version of) the input relation to its delta set.
4592 =item * Coalescing
4594 Simplify the representation of a set, relation or functions by trying
4595 to combine pairs of basic sets or relations into a single
4596 basic set or relation.
4598         #include <isl/set.h>
4599         __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
4601         #include <isl/map.h>
4602         __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
4604         #include <isl/union_set.h>
4605         __isl_give isl_union_set *isl_union_set_coalesce(
4606                 __isl_take isl_union_set *uset);
4608         #include <isl/union_map.h>
4609         __isl_give isl_union_map *isl_union_map_coalesce(
4610                 __isl_take isl_union_map *umap);
4612         #include <isl/aff.h>
4613         __isl_give isl_pw_aff *isl_pw_aff_coalesce(
4614                 __isl_take isl_pw_aff *pwqp);
4615         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
4616                 __isl_take isl_pw_multi_aff *pma);
4617         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
4618                 __isl_take isl_multi_pw_aff *mpa);
4619         __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
4620                 __isl_take isl_union_pw_aff *upa);
4621         __isl_give isl_union_pw_multi_aff *
4622         isl_union_pw_multi_aff_coalesce(
4623                 __isl_take isl_union_pw_multi_aff *upma);
4625         #include <isl/polynomial.h>
4626         __isl_give isl_pw_qpolynomial_fold *
4627         isl_pw_qpolynomial_fold_coalesce(
4628                 __isl_take isl_pw_qpolynomial_fold *pwf);
4629         __isl_give isl_union_pw_qpolynomial *
4630         isl_union_pw_qpolynomial_coalesce(
4631                 __isl_take isl_union_pw_qpolynomial *upwqp);
4632         __isl_give isl_union_pw_qpolynomial_fold *
4633         isl_union_pw_qpolynomial_fold_coalesce(
4634                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4636 One of the methods for combining pairs of basic sets or relations
4637 can result in coefficients that are much larger than those that appear
4638 in the constraints of the input.  By default, the coefficients are
4639 not allowed to grow larger, but this can be changed by unsetting
4640 the following option.
4642         isl_stat isl_options_set_coalesce_bounded_wrapping(
4643                 isl_ctx *ctx, int val);
4644         int isl_options_get_coalesce_bounded_wrapping(
4645                 isl_ctx *ctx);
4647 =item * Detecting equalities
4649         __isl_give isl_basic_set *isl_basic_set_detect_equalities(
4650                 __isl_take isl_basic_set *bset);
4651         __isl_give isl_basic_map *isl_basic_map_detect_equalities(
4652                 __isl_take isl_basic_map *bmap);
4653         __isl_give isl_set *isl_set_detect_equalities(
4654                 __isl_take isl_set *set);
4655         __isl_give isl_map *isl_map_detect_equalities(
4656                 __isl_take isl_map *map);
4657         __isl_give isl_union_set *isl_union_set_detect_equalities(
4658                 __isl_take isl_union_set *uset);
4659         __isl_give isl_union_map *isl_union_map_detect_equalities(
4660                 __isl_take isl_union_map *umap);
4662 Simplify the representation of a set or relation by detecting implicit
4663 equalities.
4665 =item * Removing redundant constraints
4667         #include <isl/set.h>
4668         __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
4669                 __isl_take isl_basic_set *bset);
4670         __isl_give isl_set *isl_set_remove_redundancies(
4671                 __isl_take isl_set *set);
4673         #include <isl/union_set.h>
4674         __isl_give isl_union_set *
4675         isl_union_set_remove_redundancies(
4676                 __isl_take isl_union_set *uset);
4678         #include <isl/map.h>
4679         __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
4680                 __isl_take isl_basic_map *bmap);
4681         __isl_give isl_map *isl_map_remove_redundancies(
4682                 __isl_take isl_map *map);
4684         #include <isl/union_map.h>
4685         __isl_give isl_union_map *
4686         isl_union_map_remove_redundancies(
4687                 __isl_take isl_union_map *umap);
4689 =item * Convex hull
4691         __isl_give isl_basic_set *isl_set_convex_hull(
4692                 __isl_take isl_set *set);
4693         __isl_give isl_basic_map *isl_map_convex_hull(
4694                 __isl_take isl_map *map);
4696 If the input set or relation has any existentially quantified
4697 variables, then the result of these operations is currently undefined.
4699 =item * Simple hull
4701         #include <isl/set.h>
4702         __isl_give isl_basic_set *
4703         isl_set_unshifted_simple_hull(
4704                 __isl_take isl_set *set);
4705         __isl_give isl_basic_set *isl_set_simple_hull(
4706                 __isl_take isl_set *set);
4707         __isl_give isl_basic_set *
4708         isl_set_unshifted_simple_hull_from_set_list(
4709                 __isl_take isl_set *set,
4710                 __isl_take isl_set_list *list);
4712         #include <isl/map.h>
4713         __isl_give isl_basic_map *
4714         isl_map_unshifted_simple_hull(
4715                 __isl_take isl_map *map);
4716         __isl_give isl_basic_map *isl_map_simple_hull(
4717                 __isl_take isl_map *map);
4718         __isl_give isl_basic_map *
4719         isl_map_unshifted_simple_hull_from_map_list(
4720                 __isl_take isl_map *map,
4721                 __isl_take isl_map_list *list);
4723         #include <isl/union_map.h>
4724         __isl_give isl_union_map *isl_union_map_simple_hull(
4725                 __isl_take isl_union_map *umap);
4727 These functions compute a single basic set or relation
4728 that contains the whole input set or relation.
4729 In particular, the output is described by translates
4730 of the constraints describing the basic sets or relations in the input.
4731 In case of C<isl_set_unshifted_simple_hull>, only the original
4732 constraints are used, without any translation.
4733 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
4734 C<isl_map_unshifted_simple_hull_from_map_list>, the
4735 constraints are taken from the elements of the second argument.
4737 =begin latex
4739 (See \autoref{s:simple hull}.)
4741 =end latex
4743 =item * Affine hull
4745         __isl_give isl_basic_set *isl_basic_set_affine_hull(
4746                 __isl_take isl_basic_set *bset);
4747         __isl_give isl_basic_set *isl_set_affine_hull(
4748                 __isl_take isl_set *set);
4749         __isl_give isl_union_set *isl_union_set_affine_hull(
4750                 __isl_take isl_union_set *uset);
4751         __isl_give isl_basic_map *isl_basic_map_affine_hull(
4752                 __isl_take isl_basic_map *bmap);
4753         __isl_give isl_basic_map *isl_map_affine_hull(
4754                 __isl_take isl_map *map);
4755         __isl_give isl_union_map *isl_union_map_affine_hull(
4756                 __isl_take isl_union_map *umap);
4758 In case of union sets and relations, the affine hull is computed
4759 per space.
4761 =item * Polyhedral hull
4763         __isl_give isl_basic_set *isl_set_polyhedral_hull(
4764                 __isl_take isl_set *set);
4765         __isl_give isl_basic_map *isl_map_polyhedral_hull(
4766                 __isl_take isl_map *map);
4767         __isl_give isl_union_set *isl_union_set_polyhedral_hull(
4768                 __isl_take isl_union_set *uset);
4769         __isl_give isl_union_map *isl_union_map_polyhedral_hull(
4770                 __isl_take isl_union_map *umap);
4772 These functions compute a single basic set or relation
4773 not involving any existentially quantified variables
4774 that contains the whole input set or relation.
4775 In case of union sets and relations, the polyhedral hull is computed
4776 per space.
4778 =item * Other approximations
4780         #include <isl/set.h>
4781         __isl_give isl_basic_set *
4782         isl_basic_set_drop_constraints_involving_dims(
4783                 __isl_take isl_basic_set *bset,
4784                 enum isl_dim_type type,
4785                 unsigned first, unsigned n);
4786         __isl_give isl_basic_set *
4787         isl_basic_set_drop_constraints_not_involving_dims(
4788                 __isl_take isl_basic_set *bset,
4789                 enum isl_dim_type type,
4790                 unsigned first, unsigned n);
4791         __isl_give isl_set *
4792         isl_set_drop_constraints_involving_dims(
4793                 __isl_take isl_set *set,
4794                 enum isl_dim_type type,
4795                 unsigned first, unsigned n);
4797         #include <isl/map.h>
4798         __isl_give isl_basic_map *
4799         isl_basic_map_drop_constraints_involving_dims(
4800                 __isl_take isl_basic_map *bmap,
4801                 enum isl_dim_type type,
4802                 unsigned first, unsigned n);
4803         __isl_give isl_map *
4804         isl_map_drop_constraints_involving_dims(
4805                 __isl_take isl_map *map,
4806                 enum isl_dim_type type,
4807                 unsigned first, unsigned n);
4809 These functions drop any constraints (not) involving the specified dimensions.
4810 Note that the result depends on the representation of the input.
4812         #include <isl/polynomial.h>
4813         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
4814                 __isl_take isl_pw_qpolynomial *pwqp, int sign);
4815         __isl_give isl_union_pw_qpolynomial *
4816         isl_union_pw_qpolynomial_to_polynomial(
4817                 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
4819 Approximate each quasipolynomial by a polynomial.  If C<sign> is positive,
4820 the polynomial will be an overapproximation.  If C<sign> is negative,
4821 it will be an underapproximation.  If C<sign> is zero, the approximation
4822 will lie somewhere in between.
4824 =item * Feasibility
4826         __isl_give isl_basic_set *isl_basic_set_sample(
4827                 __isl_take isl_basic_set *bset);
4828         __isl_give isl_basic_set *isl_set_sample(
4829                 __isl_take isl_set *set);
4830         __isl_give isl_basic_map *isl_basic_map_sample(
4831                 __isl_take isl_basic_map *bmap);
4832         __isl_give isl_basic_map *isl_map_sample(
4833                 __isl_take isl_map *map);
4835 If the input (basic) set or relation is non-empty, then return
4836 a singleton subset of the input.  Otherwise, return an empty set.
4838 =item * Optimization
4840         #include <isl/ilp.h>
4841         __isl_give isl_val *isl_basic_set_max_val(
4842                 __isl_keep isl_basic_set *bset,
4843                 __isl_keep isl_aff *obj);
4844         __isl_give isl_val *isl_set_min_val(
4845                 __isl_keep isl_set *set,
4846                 __isl_keep isl_aff *obj);
4847         __isl_give isl_val *isl_set_max_val(
4848                 __isl_keep isl_set *set,
4849                 __isl_keep isl_aff *obj);
4851 Compute the minimum or maximum of the integer affine expression C<obj>
4852 over the points in C<set>, returning the result in C<opt>.
4853 The result is C<NULL> in case of an error, the optimal value in case
4854 there is one, negative infinity or infinity if the problem is unbounded and
4855 NaN if the problem is empty.
4857 =item * Parametric optimization
4859         __isl_give isl_pw_aff *isl_set_dim_min(
4860                 __isl_take isl_set *set, int pos);
4861         __isl_give isl_pw_aff *isl_set_dim_max(
4862                 __isl_take isl_set *set, int pos);
4863         __isl_give isl_pw_aff *isl_map_dim_max(
4864                 __isl_take isl_map *map, int pos);
4866 Compute the minimum or maximum of the given set or output dimension
4867 as a function of the parameters (and input dimensions), but independently
4868 of the other set or output dimensions.
4869 For lexicographic optimization, see L<"Lexicographic Optimization">.
4871 =item * Dual
4873 The following functions compute either the set of (rational) coefficient
4874 values of valid constraints for the given set or the set of (rational)
4875 values satisfying the constraints with coefficients from the given set.
4876 Internally, these two sets of functions perform essentially the
4877 same operations, except that the set of coefficients is assumed to
4878 be a cone, while the set of values may be any polyhedron.
4879 The current implementation is based on the Farkas lemma and
4880 Fourier-Motzkin elimination, but this may change or be made optional
4881 in future.  In particular, future implementations may use different
4882 dualization algorithms or skip the elimination step.
4884         __isl_give isl_basic_set *isl_basic_set_coefficients(
4885                 __isl_take isl_basic_set *bset);
4886         __isl_give isl_basic_set *isl_set_coefficients(
4887                 __isl_take isl_set *set);
4888         __isl_give isl_union_set *isl_union_set_coefficients(
4889                 __isl_take isl_union_set *bset);
4890         __isl_give isl_basic_set *isl_basic_set_solutions(
4891                 __isl_take isl_basic_set *bset);
4892         __isl_give isl_basic_set *isl_set_solutions(
4893                 __isl_take isl_set *set);
4894         __isl_give isl_union_set *isl_union_set_solutions(
4895                 __isl_take isl_union_set *bset);
4897 =item * Power
4899         __isl_give isl_map *isl_map_fixed_power_val(
4900                 __isl_take isl_map *map,
4901                 __isl_take isl_val *exp);
4902         __isl_give isl_union_map *
4903         isl_union_map_fixed_power_val(
4904                 __isl_take isl_union_map *umap,
4905                 __isl_take isl_val *exp);
4907 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
4908 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
4909 of C<map> is computed.
4911         __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
4912                 int *exact);
4913         __isl_give isl_union_map *isl_union_map_power(
4914                 __isl_take isl_union_map *umap, int *exact);
4916 Compute a parametric representation for all positive powers I<k> of C<map>.
4917 The result maps I<k> to a nested relation corresponding to the
4918 I<k>th power of C<map>.
4919 The result may be an overapproximation.  If the result is known to be exact,
4920 then C<*exact> is set to C<1>.
4922 =item * Transitive closure
4924         __isl_give isl_map *isl_map_transitive_closure(
4925                 __isl_take isl_map *map, int *exact);
4926         __isl_give isl_union_map *isl_union_map_transitive_closure(
4927                 __isl_take isl_union_map *umap, int *exact);
4929 Compute the transitive closure of C<map>.
4930 The result may be an overapproximation.  If the result is known to be exact,
4931 then C<*exact> is set to C<1>.
4933 =item * Reaching path lengths
4935         __isl_give isl_map *isl_map_reaching_path_lengths(
4936                 __isl_take isl_map *map, int *exact);
4938 Compute a relation that maps each element in the range of C<map>
4939 to the lengths of all paths composed of edges in C<map> that
4940 end up in the given element.
4941 The result may be an overapproximation.  If the result is known to be exact,
4942 then C<*exact> is set to C<1>.
4943 To compute the I<maximal> path length, the resulting relation
4944 should be postprocessed by C<isl_map_lexmax>.
4945 In particular, if the input relation is a dependence relation
4946 (mapping sources to sinks), then the maximal path length corresponds
4947 to the free schedule.
4948 Note, however, that C<isl_map_lexmax> expects the maximum to be
4949 finite, so if the path lengths are unbounded (possibly due to
4950 the overapproximation), then you will get an error message.
4952 =item * Wrapping
4954         #include <isl/space.h>
4955         __isl_give isl_space *isl_space_wrap(
4956                 __isl_take isl_space *space);
4957         __isl_give isl_space *isl_space_unwrap(
4958                 __isl_take isl_space *space);
4960         #include <isl/local_space.h>
4961         __isl_give isl_local_space *isl_local_space_wrap(
4962                 __isl_take isl_local_space *ls);
4964         #include <isl/set.h>
4965         __isl_give isl_basic_map *isl_basic_set_unwrap(
4966                 __isl_take isl_basic_set *bset);
4967         __isl_give isl_map *isl_set_unwrap(
4968                 __isl_take isl_set *set);
4970         #include <isl/map.h>
4971         __isl_give isl_basic_set *isl_basic_map_wrap(
4972                 __isl_take isl_basic_map *bmap);
4973         __isl_give isl_set *isl_map_wrap(
4974                 __isl_take isl_map *map);
4976         #include <isl/union_set.h>
4977         __isl_give isl_union_map *isl_union_set_unwrap(
4978                 __isl_take isl_union_set *uset);
4980         #include <isl/union_map.h>
4981         __isl_give isl_union_set *isl_union_map_wrap(
4982                 __isl_take isl_union_map *umap);
4984 The input to C<isl_space_unwrap> should
4985 be the space of a set, while that of
4986 C<isl_space_wrap> should be the space of a relation.
4987 Conversely, the output of C<isl_space_unwrap> is the space
4988 of a relation, while that of C<isl_space_wrap> is the space of a set.
4990 =item * Flattening
4992 Remove any internal structure of domain (and range) of the given
4993 set or relation.  If there is any such internal structure in the input,
4994 then the name of the space is also removed.
4996         #include <isl/local_space.h>
4997         __isl_give isl_local_space *
4998         isl_local_space_flatten_domain(
4999                 __isl_take isl_local_space *ls);
5000         __isl_give isl_local_space *
5001         isl_local_space_flatten_range(
5002                 __isl_take isl_local_space *ls);
5004         #include <isl/set.h>
5005         __isl_give isl_basic_set *isl_basic_set_flatten(
5006                 __isl_take isl_basic_set *bset);
5007         __isl_give isl_set *isl_set_flatten(
5008                 __isl_take isl_set *set);
5010         #include <isl/map.h>
5011         __isl_give isl_basic_map *isl_basic_map_flatten_domain(
5012                 __isl_take isl_basic_map *bmap);
5013         __isl_give isl_basic_map *isl_basic_map_flatten_range(
5014                 __isl_take isl_basic_map *bmap);
5015         __isl_give isl_map *isl_map_flatten_range(
5016                 __isl_take isl_map *map);
5017         __isl_give isl_map *isl_map_flatten_domain(
5018                 __isl_take isl_map *map);
5019         __isl_give isl_basic_map *isl_basic_map_flatten(
5020                 __isl_take isl_basic_map *bmap);
5021         __isl_give isl_map *isl_map_flatten(
5022                 __isl_take isl_map *map);
5024         #include <isl/val.h>
5025         __isl_give isl_multi_val *isl_multi_val_flatten_range(
5026                 __isl_take isl_multi_val *mv);
5028         #include <isl/aff.h>
5029         __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
5030                 __isl_take isl_multi_aff *ma);
5031         __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
5032                 __isl_take isl_multi_aff *ma);
5033         __isl_give isl_multi_pw_aff *
5034         isl_multi_pw_aff_flatten_range(
5035                 __isl_take isl_multi_pw_aff *mpa);
5036         __isl_give isl_multi_union_pw_aff *
5037         isl_multi_union_pw_aff_flatten_range(
5038                 __isl_take isl_multi_union_pw_aff *mupa);
5040         #include <isl/map.h>
5041         __isl_give isl_map *isl_set_flatten_map(
5042                 __isl_take isl_set *set);
5044 The function above constructs a relation
5045 that maps the input set to a flattened version of the set.
5047 =item * Lifting
5049 Lift the input set to a space with extra dimensions corresponding
5050 to the existentially quantified variables in the input.
5051 In particular, the result lives in a wrapped map where the domain
5052 is the original space and the range corresponds to the original
5053 existentially quantified variables.
5055         #include <isl/set.h>
5056         __isl_give isl_basic_set *isl_basic_set_lift(
5057                 __isl_take isl_basic_set *bset);
5058         __isl_give isl_set *isl_set_lift(
5059                 __isl_take isl_set *set);
5060         __isl_give isl_union_set *isl_union_set_lift(
5061                 __isl_take isl_union_set *uset);
5063 Given a local space that contains the existentially quantified
5064 variables of a set, a basic relation that, when applied to
5065 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
5066 can be constructed using the following function.
5068         #include <isl/local_space.h>
5069         __isl_give isl_basic_map *isl_local_space_lifting(
5070                 __isl_take isl_local_space *ls);
5072         #include <isl/aff.h>
5073         __isl_give isl_multi_aff *isl_multi_aff_lift(
5074                 __isl_take isl_multi_aff *maff,
5075                 __isl_give isl_local_space **ls);
5077 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
5078 then it is assigned the local space that lies at the basis of
5079 the lifting applied.
5081 =item * Internal Product
5083         #include <isl/space.h>
5084         __isl_give isl_space *isl_space_zip(
5085                 __isl_take isl_space *space);
5087         #include <isl/map.h>
5088         __isl_give isl_basic_map *isl_basic_map_zip(
5089                 __isl_take isl_basic_map *bmap);
5090         __isl_give isl_map *isl_map_zip(
5091                 __isl_take isl_map *map);
5093         #include <isl/union_map.h>
5094         __isl_give isl_union_map *isl_union_map_zip(
5095                 __isl_take isl_union_map *umap);
5097 Given a relation with nested relations for domain and range,
5098 interchange the range of the domain with the domain of the range.
5100 =item * Currying
5102         #include <isl/space.h>
5103         __isl_give isl_space *isl_space_curry(
5104                 __isl_take isl_space *space);
5105         __isl_give isl_space *isl_space_uncurry(
5106                 __isl_take isl_space *space);
5108         #include <isl/map.h>
5109         __isl_give isl_basic_map *isl_basic_map_curry(
5110                 __isl_take isl_basic_map *bmap);
5111         __isl_give isl_basic_map *isl_basic_map_uncurry(
5112                 __isl_take isl_basic_map *bmap);
5113         __isl_give isl_map *isl_map_curry(
5114                 __isl_take isl_map *map);
5115         __isl_give isl_map *isl_map_uncurry(
5116                 __isl_take isl_map *map);
5118         #include <isl/union_map.h>
5119         __isl_give isl_union_map *isl_union_map_curry(
5120                 __isl_take isl_union_map *umap);
5121         __isl_give isl_union_map *isl_union_map_uncurry(
5122                 __isl_take isl_union_map *umap);
5124 Given a relation with a nested relation for domain,
5125 the C<curry> functions
5126 move the range of the nested relation out of the domain
5127 and use it as the domain of a nested relation in the range,
5128 with the original range as range of this nested relation.
5129 The C<uncurry> functions perform the inverse operation.
5131 =item * Aligning parameters
5133 Change the order of the parameters of the given set, relation
5134 or function
5135 such that the first parameters match those of C<model>.
5136 This may involve the introduction of extra parameters.
5137 All parameters need to be named.
5139         #include <isl/space.h>
5140         __isl_give isl_space *isl_space_align_params(
5141                 __isl_take isl_space *space1,
5142                 __isl_take isl_space *space2)
5144         #include <isl/set.h>
5145         __isl_give isl_basic_set *isl_basic_set_align_params(
5146                 __isl_take isl_basic_set *bset,
5147                 __isl_take isl_space *model);
5148         __isl_give isl_set *isl_set_align_params(
5149                 __isl_take isl_set *set,
5150                 __isl_take isl_space *model);
5152         #include <isl/map.h>
5153         __isl_give isl_basic_map *isl_basic_map_align_params(
5154                 __isl_take isl_basic_map *bmap,
5155                 __isl_take isl_space *model);
5156         __isl_give isl_map *isl_map_align_params(
5157                 __isl_take isl_map *map,
5158                 __isl_take isl_space *model);
5160         #include <isl/val.h>
5161         __isl_give isl_multi_val *isl_multi_val_align_params(
5162                 __isl_take isl_multi_val *mv,
5163                 __isl_take isl_space *model);
5165         #include <isl/aff.h>
5166         __isl_give isl_aff *isl_aff_align_params(
5167                 __isl_take isl_aff *aff,
5168                 __isl_take isl_space *model);
5169         __isl_give isl_multi_aff *isl_multi_aff_align_params(
5170                 __isl_take isl_multi_aff *multi,
5171                 __isl_take isl_space *model);
5172         __isl_give isl_pw_aff *isl_pw_aff_align_params(
5173                 __isl_take isl_pw_aff *pwaff,
5174                 __isl_take isl_space *model);
5175         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
5176                 __isl_take isl_pw_multi_aff *pma,
5177                 __isl_take isl_space *model);
5178         __isl_give isl_union_pw_aff *
5179         isl_union_pw_aff_align_params(
5180                 __isl_take isl_union_pw_aff *upa,
5181                 __isl_take isl_space *model);
5182         __isl_give isl_union_pw_multi_aff *
5183         isl_union_pw_multi_aff_align_params(
5184                 __isl_take isl_union_pw_multi_aff *upma,
5185                 __isl_take isl_space *model);
5186         __isl_give isl_multi_union_pw_aff *
5187         isl_multi_union_pw_aff_align_params(
5188                 __isl_take isl_multi_union_pw_aff *mupa,
5189                 __isl_take isl_space *model);
5191         #include <isl/polynomial.h>
5192         __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
5193                 __isl_take isl_qpolynomial *qp,
5194                 __isl_take isl_space *model);
5196 =item * Unary Arithmethic Operations
5198         #include <isl/val.h>
5199         __isl_give isl_multi_val *isl_multi_val_neg(
5200                 __isl_take isl_multi_val *mv);
5202         #include <isl/aff.h>
5203         __isl_give isl_aff *isl_aff_neg(
5204                 __isl_take isl_aff *aff);
5205         __isl_give isl_multi_aff *isl_multi_aff_neg(
5206                 __isl_take isl_multi_aff *ma);
5207         __isl_give isl_pw_aff *isl_pw_aff_neg(
5208                 __isl_take isl_pw_aff *pwaff);
5209         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
5210                 __isl_take isl_pw_multi_aff *pma);
5211         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
5212                 __isl_take isl_multi_pw_aff *mpa);
5213         __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
5214                 __isl_take isl_union_pw_aff *upa);
5215         __isl_give isl_union_pw_multi_aff *
5216         isl_union_pw_multi_aff_neg(
5217                 __isl_take isl_union_pw_multi_aff *upma);
5218         __isl_give isl_multi_union_pw_aff *
5219         isl_multi_union_pw_aff_neg(
5220                 __isl_take isl_multi_union_pw_aff *mupa);
5221         __isl_give isl_aff *isl_aff_ceil(
5222                 __isl_take isl_aff *aff);
5223         __isl_give isl_pw_aff *isl_pw_aff_ceil(
5224                 __isl_take isl_pw_aff *pwaff);
5225         __isl_give isl_aff *isl_aff_floor(
5226                 __isl_take isl_aff *aff);
5227         __isl_give isl_multi_aff *isl_multi_aff_floor(
5228                 __isl_take isl_multi_aff *ma);
5229         __isl_give isl_pw_aff *isl_pw_aff_floor(
5230                 __isl_take isl_pw_aff *pwaff);
5231         __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
5232                 __isl_take isl_union_pw_aff *upa);
5233         __isl_give isl_multi_union_pw_aff *
5234         isl_multi_union_pw_aff_floor(
5235                 __isl_take isl_multi_union_pw_aff *mupa);
5237         #include <isl/aff.h>
5238         __isl_give isl_pw_aff *isl_pw_aff_list_min(
5239                 __isl_take isl_pw_aff_list *list);
5240         __isl_give isl_pw_aff *isl_pw_aff_list_max(
5241                 __isl_take isl_pw_aff_list *list);
5243         #include <isl/polynomial.h>
5244         __isl_give isl_qpolynomial *isl_qpolynomial_neg(
5245                 __isl_take isl_qpolynomial *qp);
5246         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
5247                 __isl_take isl_pw_qpolynomial *pwqp);
5248         __isl_give isl_union_pw_qpolynomial *
5249         isl_union_pw_qpolynomial_neg(
5250                 __isl_take isl_union_pw_qpolynomial *upwqp);
5251         __isl_give isl_qpolynomial *isl_qpolynomial_pow(
5252                 __isl_take isl_qpolynomial *qp,
5253                 unsigned exponent);
5254         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
5255                 __isl_take isl_pw_qpolynomial *pwqp,
5256                 unsigned exponent);
5258 =item * Evaluation
5260 The following functions evaluate a function in a point.
5262         #include <isl/polynomial.h>
5263         __isl_give isl_val *isl_pw_qpolynomial_eval(
5264                 __isl_take isl_pw_qpolynomial *pwqp,
5265                 __isl_take isl_point *pnt);
5266         __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
5267                 __isl_take isl_pw_qpolynomial_fold *pwf,
5268                 __isl_take isl_point *pnt);
5269         __isl_give isl_val *isl_union_pw_qpolynomial_eval(
5270                 __isl_take isl_union_pw_qpolynomial *upwqp,
5271                 __isl_take isl_point *pnt);
5272         __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
5273                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5274                 __isl_take isl_point *pnt);
5276 =item * Dimension manipulation
5278 It is usually not advisable to directly change the (input or output)
5279 space of a set or a relation as this removes the name and the internal
5280 structure of the space.  However, the functions below can be useful
5281 to add new parameters, assuming
5282 C<isl_set_align_params> and C<isl_map_align_params>
5283 are not sufficient.
5285         #include <isl/space.h>
5286         __isl_give isl_space *isl_space_add_dims(
5287                 __isl_take isl_space *space,
5288                 enum isl_dim_type type, unsigned n);
5289         __isl_give isl_space *isl_space_insert_dims(
5290                 __isl_take isl_space *space,
5291                 enum isl_dim_type type, unsigned pos, unsigned n);
5292         __isl_give isl_space *isl_space_drop_dims(
5293                 __isl_take isl_space *space,
5294                 enum isl_dim_type type, unsigned first, unsigned n);
5295         __isl_give isl_space *isl_space_move_dims(
5296                 __isl_take isl_space *space,
5297                 enum isl_dim_type dst_type, unsigned dst_pos,
5298                 enum isl_dim_type src_type, unsigned src_pos,
5299                 unsigned n);
5301         #include <isl/local_space.h>
5302         __isl_give isl_local_space *isl_local_space_add_dims(
5303                 __isl_take isl_local_space *ls,
5304                 enum isl_dim_type type, unsigned n);
5305         __isl_give isl_local_space *isl_local_space_insert_dims(
5306                 __isl_take isl_local_space *ls,
5307                 enum isl_dim_type type, unsigned first, unsigned n);
5308         __isl_give isl_local_space *isl_local_space_drop_dims(
5309                 __isl_take isl_local_space *ls,
5310                 enum isl_dim_type type, unsigned first, unsigned n);
5312         #include <isl/set.h>
5313         __isl_give isl_basic_set *isl_basic_set_add_dims(
5314                 __isl_take isl_basic_set *bset,
5315                 enum isl_dim_type type, unsigned n);
5316         __isl_give isl_set *isl_set_add_dims(
5317                 __isl_take isl_set *set,
5318                 enum isl_dim_type type, unsigned n);
5319         __isl_give isl_basic_set *isl_basic_set_insert_dims(
5320                 __isl_take isl_basic_set *bset,
5321                 enum isl_dim_type type, unsigned pos,
5322                 unsigned n);
5323         __isl_give isl_set *isl_set_insert_dims(
5324                 __isl_take isl_set *set,
5325                 enum isl_dim_type type, unsigned pos, unsigned n);
5326         __isl_give isl_basic_set *isl_basic_set_move_dims(
5327                 __isl_take isl_basic_set *bset,
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_set *isl_set_move_dims(
5332                 __isl_take isl_set *set,
5333                 enum isl_dim_type dst_type, unsigned dst_pos,
5334                 enum isl_dim_type src_type, unsigned src_pos,
5335                 unsigned n);
5337         #include <isl/map.h>
5338         __isl_give isl_basic_map *isl_basic_map_add_dims(
5339                 __isl_take isl_basic_map *bmap,
5340                 enum isl_dim_type type, unsigned n);
5341         __isl_give isl_map *isl_map_add_dims(
5342                 __isl_take isl_map *map,
5343                 enum isl_dim_type type, unsigned n);
5344         __isl_give isl_basic_map *isl_basic_map_insert_dims(
5345                 __isl_take isl_basic_map *bmap,
5346                 enum isl_dim_type type, unsigned pos,
5347                 unsigned n);
5348         __isl_give isl_map *isl_map_insert_dims(
5349                 __isl_take isl_map *map,
5350                 enum isl_dim_type type, unsigned pos, unsigned n);
5351         __isl_give isl_basic_map *isl_basic_map_move_dims(
5352                 __isl_take isl_basic_map *bmap,
5353                 enum isl_dim_type dst_type, unsigned dst_pos,
5354                 enum isl_dim_type src_type, unsigned src_pos,
5355                 unsigned n);
5356         __isl_give isl_map *isl_map_move_dims(
5357                 __isl_take isl_map *map,
5358                 enum isl_dim_type dst_type, unsigned dst_pos,
5359                 enum isl_dim_type src_type, unsigned src_pos,
5360                 unsigned n);
5362         #include <isl/val.h>
5363         __isl_give isl_multi_val *isl_multi_val_insert_dims(
5364                 __isl_take isl_multi_val *mv,
5365                 enum isl_dim_type type, unsigned first, unsigned n);
5366         __isl_give isl_multi_val *isl_multi_val_add_dims(
5367                 __isl_take isl_multi_val *mv,
5368                 enum isl_dim_type type, unsigned n);
5369         __isl_give isl_multi_val *isl_multi_val_drop_dims(
5370                 __isl_take isl_multi_val *mv,
5371                 enum isl_dim_type type, unsigned first, unsigned n);
5373         #include <isl/aff.h>
5374         __isl_give isl_aff *isl_aff_insert_dims(
5375                 __isl_take isl_aff *aff,
5376                 enum isl_dim_type type, unsigned first, unsigned n);
5377         __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
5378                 __isl_take isl_multi_aff *ma,
5379                 enum isl_dim_type type, unsigned first, unsigned n);
5380         __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
5381                 __isl_take isl_pw_aff *pwaff,
5382                 enum isl_dim_type type, unsigned first, unsigned n);
5383         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
5384                 __isl_take isl_multi_pw_aff *mpa,
5385                 enum isl_dim_type type, unsigned first, unsigned n);
5386         __isl_give isl_aff *isl_aff_add_dims(
5387                 __isl_take isl_aff *aff,
5388                 enum isl_dim_type type, unsigned n);
5389         __isl_give isl_multi_aff *isl_multi_aff_add_dims(
5390                 __isl_take isl_multi_aff *ma,
5391                 enum isl_dim_type type, unsigned n);
5392         __isl_give isl_pw_aff *isl_pw_aff_add_dims(
5393                 __isl_take isl_pw_aff *pwaff,
5394                 enum isl_dim_type type, unsigned n);
5395         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
5396                 __isl_take isl_multi_pw_aff *mpa,
5397                 enum isl_dim_type type, unsigned n);
5398         __isl_give isl_aff *isl_aff_drop_dims(
5399                 __isl_take isl_aff *aff,
5400                 enum isl_dim_type type, unsigned first, unsigned n);
5401         __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
5402                 __isl_take isl_multi_aff *maff,
5403                 enum isl_dim_type type, unsigned first, unsigned n);
5404         __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
5405                 __isl_take isl_pw_aff *pwaff,
5406                 enum isl_dim_type type, unsigned first, unsigned n);
5407         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
5408                 __isl_take isl_pw_multi_aff *pma,
5409                 enum isl_dim_type type, unsigned first, unsigned n);
5410         __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
5411                 __isl_take isl_union_pw_aff *upa,
5412                 enum isl_dim_type type, unsigned first, unsigned n);
5413         __isl_give isl_union_pw_multi_aff *
5414                 isl_union_pw_multi_aff_drop_dims(
5415                 __isl_take isl_union_pw_multi_aff *upma,
5416                 enum isl_dim_type type,
5417                 unsigned first, unsigned n);
5418         __isl_give isl_multi_union_pw_aff *
5419         isl_multi_union_pw_aff_drop_dims(
5420                 __isl_take isl_multi_union_pw_aff *mupa,
5421                 enum isl_dim_type type, unsigned first,
5422                 unsigned n);
5423         __isl_give isl_aff *isl_aff_move_dims(
5424                 __isl_take isl_aff *aff,
5425                 enum isl_dim_type dst_type, unsigned dst_pos,
5426                 enum isl_dim_type src_type, unsigned src_pos,
5427                 unsigned n);
5428         __isl_give isl_multi_aff *isl_multi_aff_move_dims(
5429                 __isl_take isl_multi_aff *ma,
5430                 enum isl_dim_type dst_type, unsigned dst_pos,
5431                 enum isl_dim_type src_type, unsigned src_pos,
5432                 unsigned n);
5433         __isl_give isl_pw_aff *isl_pw_aff_move_dims(
5434                 __isl_take isl_pw_aff *pa,
5435                 enum isl_dim_type dst_type, unsigned dst_pos,
5436                 enum isl_dim_type src_type, unsigned src_pos,
5437                 unsigned n);
5438         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
5439                 __isl_take isl_multi_pw_aff *pma,
5440                 enum isl_dim_type dst_type, unsigned dst_pos,
5441                 enum isl_dim_type src_type, unsigned src_pos,
5442                 unsigned n);
5444         #include <isl/polynomial.h>
5445         __isl_give isl_union_pw_qpolynomial *
5446         isl_union_pw_qpolynomial_drop_dims(
5447                 __isl_take isl_union_pw_qpolynomial *upwqp,
5448                 enum isl_dim_type type,
5449                 unsigned first, unsigned n);
5450         __isl_give isl_union_pw_qpolynomial_fold *
5451                 isl_union_pw_qpolynomial_fold_drop_dims(
5452                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5453                 enum isl_dim_type type,
5454                 unsigned first, unsigned n);
5456 The operations on union expressions can only manipulate parameters.
5458 =back
5460 =head2 Binary Operations
5462 The two arguments of a binary operation not only need to live
5463 in the same C<isl_ctx>, they currently also need to have
5464 the same (number of) parameters.
5466 =head3 Basic Operations
5468 =over
5470 =item * Intersection
5472         #include <isl/local_space.h>
5473         __isl_give isl_local_space *isl_local_space_intersect(
5474                 __isl_take isl_local_space *ls1,
5475                 __isl_take isl_local_space *ls2);
5477         #include <isl/set.h>
5478         __isl_give isl_basic_set *isl_basic_set_intersect_params(
5479                 __isl_take isl_basic_set *bset1,
5480                 __isl_take isl_basic_set *bset2);
5481         __isl_give isl_basic_set *isl_basic_set_intersect(
5482                 __isl_take isl_basic_set *bset1,
5483                 __isl_take isl_basic_set *bset2);
5484         __isl_give isl_basic_set *isl_basic_set_list_intersect(
5485                 __isl_take struct isl_basic_set_list *list);
5486         __isl_give isl_set *isl_set_intersect_params(
5487                 __isl_take isl_set *set,
5488                 __isl_take isl_set *params);
5489         __isl_give isl_set *isl_set_intersect(
5490                 __isl_take isl_set *set1,
5491                 __isl_take isl_set *set2);
5493         #include <isl/map.h>
5494         __isl_give isl_basic_map *isl_basic_map_intersect_domain(
5495                 __isl_take isl_basic_map *bmap,
5496                 __isl_take isl_basic_set *bset);
5497         __isl_give isl_basic_map *isl_basic_map_intersect_range(
5498                 __isl_take isl_basic_map *bmap,
5499                 __isl_take isl_basic_set *bset);
5500         __isl_give isl_basic_map *isl_basic_map_intersect(
5501                 __isl_take isl_basic_map *bmap1,
5502                 __isl_take isl_basic_map *bmap2);
5503         __isl_give isl_basic_map *isl_basic_map_list_intersect(
5504                 __isl_take isl_basic_map_list *list);
5505         __isl_give isl_map *isl_map_intersect_params(
5506                 __isl_take isl_map *map,
5507                 __isl_take isl_set *params);
5508         __isl_give isl_map *isl_map_intersect_domain(
5509                 __isl_take isl_map *map,
5510                 __isl_take isl_set *set);
5511         __isl_give isl_map *isl_map_intersect_range(
5512                 __isl_take isl_map *map,
5513                 __isl_take isl_set *set);
5514         __isl_give isl_map *isl_map_intersect(
5515                 __isl_take isl_map *map1,
5516                 __isl_take isl_map *map2);
5518         #include <isl/union_set.h>
5519         __isl_give isl_union_set *isl_union_set_intersect_params(
5520                 __isl_take isl_union_set *uset,
5521                 __isl_take isl_set *set);
5522         __isl_give isl_union_set *isl_union_set_intersect(
5523                 __isl_take isl_union_set *uset1,
5524                 __isl_take isl_union_set *uset2);
5526         #include <isl/union_map.h>
5527         __isl_give isl_union_map *isl_union_map_intersect_params(
5528                 __isl_take isl_union_map *umap,
5529                 __isl_take isl_set *set);
5530         __isl_give isl_union_map *isl_union_map_intersect_domain(
5531                 __isl_take isl_union_map *umap,
5532                 __isl_take isl_union_set *uset);
5533         __isl_give isl_union_map *isl_union_map_intersect_range(
5534                 __isl_take isl_union_map *umap,
5535                 __isl_take isl_union_set *uset);
5536         __isl_give isl_union_map *isl_union_map_intersect(
5537                 __isl_take isl_union_map *umap1,
5538                 __isl_take isl_union_map *umap2);
5540         #include <isl/aff.h>
5541         __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
5542                 __isl_take isl_pw_aff *pa,
5543                 __isl_take isl_set *set);
5544         __isl_give isl_multi_pw_aff *
5545         isl_multi_pw_aff_intersect_domain(
5546                 __isl_take isl_multi_pw_aff *mpa,
5547                 __isl_take isl_set *domain);
5548         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
5549                 __isl_take isl_pw_multi_aff *pma,
5550                 __isl_take isl_set *set);
5551         __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
5552                 __isl_take isl_union_pw_aff *upa,
5553                 __isl_take isl_union_set *uset);
5554         __isl_give isl_union_pw_multi_aff *
5555         isl_union_pw_multi_aff_intersect_domain(
5556                 __isl_take isl_union_pw_multi_aff *upma,
5557                 __isl_take isl_union_set *uset);
5558         __isl_give isl_multi_union_pw_aff *
5559         isl_multi_union_pw_aff_intersect_domain(
5560                 __isl_take isl_multi_union_pw_aff *mupa,
5561                 __isl_take isl_union_set *uset);
5562         __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
5563                 __isl_take isl_pw_aff *pa,
5564                 __isl_take isl_set *set);
5565         __isl_give isl_multi_pw_aff *
5566         isl_multi_pw_aff_intersect_params(
5567                 __isl_take isl_multi_pw_aff *mpa,
5568                 __isl_take isl_set *set);
5569         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
5570                 __isl_take isl_pw_multi_aff *pma,
5571                 __isl_take isl_set *set);
5572         __isl_give isl_union_pw_aff *
5573         isl_union_pw_aff_intersect_params(
5574                 __isl_take isl_union_pw_aff *upa,
5575         __isl_give isl_union_pw_multi_aff *
5576         isl_union_pw_multi_aff_intersect_params(
5577                 __isl_take isl_union_pw_multi_aff *upma,
5578                 __isl_take isl_set *set);
5579         __isl_give isl_multi_union_pw_aff *
5580         isl_multi_union_pw_aff_intersect_params(
5581                 __isl_take isl_multi_union_pw_aff *mupa,
5582                 __isl_take isl_set *params);
5583         isl_multi_union_pw_aff_intersect_range(
5584                 __isl_take isl_multi_union_pw_aff *mupa,
5585                 __isl_take isl_set *set);
5587         #include <isl/polynomial.h>
5588         __isl_give isl_pw_qpolynomial *
5589         isl_pw_qpolynomial_intersect_domain(
5590                 __isl_take isl_pw_qpolynomial *pwpq,
5591                 __isl_take isl_set *set);
5592         __isl_give isl_union_pw_qpolynomial *
5593         isl_union_pw_qpolynomial_intersect_domain(
5594                 __isl_take isl_union_pw_qpolynomial *upwpq,
5595                 __isl_take isl_union_set *uset);
5596         __isl_give isl_union_pw_qpolynomial_fold *
5597         isl_union_pw_qpolynomial_fold_intersect_domain(
5598                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5599                 __isl_take isl_union_set *uset);
5600         __isl_give isl_pw_qpolynomial *
5601         isl_pw_qpolynomial_intersect_params(
5602                 __isl_take isl_pw_qpolynomial *pwpq,
5603                 __isl_take isl_set *set);
5604         __isl_give isl_pw_qpolynomial_fold *
5605         isl_pw_qpolynomial_fold_intersect_params(
5606                 __isl_take isl_pw_qpolynomial_fold *pwf,
5607                 __isl_take isl_set *set);
5608         __isl_give isl_union_pw_qpolynomial *
5609         isl_union_pw_qpolynomial_intersect_params(
5610                 __isl_take isl_union_pw_qpolynomial *upwpq,
5611                 __isl_take isl_set *set);
5612         __isl_give isl_union_pw_qpolynomial_fold *
5613         isl_union_pw_qpolynomial_fold_intersect_params(
5614                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5615                 __isl_take isl_set *set);
5617 The second argument to the C<_params> functions needs to be
5618 a parametric (basic) set.  For the other functions, a parametric set
5619 for either argument is only allowed if the other argument is
5620 a parametric set as well.
5621 The list passed to C<isl_basic_set_list_intersect> needs to have
5622 at least one element and all elements need to live in the same space.
5623 The function C<isl_multi_union_pw_aff_intersect_range>
5624 restricts the input function to those shared domain elements
5625 that map to the specified range.
5627 =item * Union
5629         #include <isl/set.h>
5630         __isl_give isl_set *isl_basic_set_union(
5631                 __isl_take isl_basic_set *bset1,
5632                 __isl_take isl_basic_set *bset2);
5633         __isl_give isl_set *isl_set_union(
5634                 __isl_take isl_set *set1,
5635                 __isl_take isl_set *set2);
5637         #include <isl/map.h>
5638         __isl_give isl_map *isl_basic_map_union(
5639                 __isl_take isl_basic_map *bmap1,
5640                 __isl_take isl_basic_map *bmap2);
5641         __isl_give isl_map *isl_map_union(
5642                 __isl_take isl_map *map1,
5643                 __isl_take isl_map *map2);
5645         #include <isl/union_set.h>
5646         __isl_give isl_union_set *isl_union_set_union(
5647                 __isl_take isl_union_set *uset1,
5648                 __isl_take isl_union_set *uset2);
5649         __isl_give isl_union_set *isl_union_set_list_union(
5650                 __isl_take isl_union_set_list *list);
5652         #include <isl/union_map.h>
5653         __isl_give isl_union_map *isl_union_map_union(
5654                 __isl_take isl_union_map *umap1,
5655                 __isl_take isl_union_map *umap2);
5657 =item * Set difference
5659         #include <isl/set.h>
5660         __isl_give isl_set *isl_set_subtract(
5661                 __isl_take isl_set *set1,
5662                 __isl_take isl_set *set2);
5664         #include <isl/map.h>
5665         __isl_give isl_map *isl_map_subtract(
5666                 __isl_take isl_map *map1,
5667                 __isl_take isl_map *map2);
5668         __isl_give isl_map *isl_map_subtract_domain(
5669                 __isl_take isl_map *map,
5670                 __isl_take isl_set *dom);
5671         __isl_give isl_map *isl_map_subtract_range(
5672                 __isl_take isl_map *map,
5673                 __isl_take isl_set *dom);
5675         #include <isl/union_set.h>
5676         __isl_give isl_union_set *isl_union_set_subtract(
5677                 __isl_take isl_union_set *uset1,
5678                 __isl_take isl_union_set *uset2);
5680         #include <isl/union_map.h>
5681         __isl_give isl_union_map *isl_union_map_subtract(
5682                 __isl_take isl_union_map *umap1,
5683                 __isl_take isl_union_map *umap2);
5684         __isl_give isl_union_map *isl_union_map_subtract_domain(
5685                 __isl_take isl_union_map *umap,
5686                 __isl_take isl_union_set *dom);
5687         __isl_give isl_union_map *isl_union_map_subtract_range(
5688                 __isl_take isl_union_map *umap,
5689                 __isl_take isl_union_set *dom);
5691         #include <isl/aff.h>
5692         __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
5693                 __isl_take isl_pw_aff *pa,
5694                 __isl_take isl_set *set);
5695         __isl_give isl_pw_multi_aff *
5696         isl_pw_multi_aff_subtract_domain(
5697                 __isl_take isl_pw_multi_aff *pma,
5698                 __isl_take isl_set *set);
5699         __isl_give isl_union_pw_aff *
5700         isl_union_pw_aff_subtract_domain(
5701                 __isl_take isl_union_pw_aff *upa,
5702                 __isl_take isl_union_set *uset);
5703         __isl_give isl_union_pw_multi_aff *
5704         isl_union_pw_multi_aff_subtract_domain(
5705                 __isl_take isl_union_pw_multi_aff *upma,
5706                 __isl_take isl_set *set);
5708         #include <isl/polynomial.h>
5709         __isl_give isl_pw_qpolynomial *
5710         isl_pw_qpolynomial_subtract_domain(
5711                 __isl_take isl_pw_qpolynomial *pwpq,
5712                 __isl_take isl_set *set);
5713         __isl_give isl_pw_qpolynomial_fold *
5714         isl_pw_qpolynomial_fold_subtract_domain(
5715                 __isl_take isl_pw_qpolynomial_fold *pwf,
5716                 __isl_take isl_set *set);
5717         __isl_give isl_union_pw_qpolynomial *
5718         isl_union_pw_qpolynomial_subtract_domain(
5719                 __isl_take isl_union_pw_qpolynomial *upwpq,
5720                 __isl_take isl_union_set *uset);
5721         __isl_give isl_union_pw_qpolynomial_fold *
5722         isl_union_pw_qpolynomial_fold_subtract_domain(
5723                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5724                 __isl_take isl_union_set *uset);
5726 =item * Application
5728         #include <isl/space.h>
5729         __isl_give isl_space *isl_space_join(
5730                 __isl_take isl_space *left,
5731                 __isl_take isl_space *right);
5733         #include <isl/map.h>
5734         __isl_give isl_basic_set *isl_basic_set_apply(
5735                 __isl_take isl_basic_set *bset,
5736                 __isl_take isl_basic_map *bmap);
5737         __isl_give isl_set *isl_set_apply(
5738                 __isl_take isl_set *set,
5739                 __isl_take isl_map *map);
5740         __isl_give isl_union_set *isl_union_set_apply(
5741                 __isl_take isl_union_set *uset,
5742                 __isl_take isl_union_map *umap);
5743         __isl_give isl_basic_map *isl_basic_map_apply_domain(
5744                 __isl_take isl_basic_map *bmap1,
5745                 __isl_take isl_basic_map *bmap2);
5746         __isl_give isl_basic_map *isl_basic_map_apply_range(
5747                 __isl_take isl_basic_map *bmap1,
5748                 __isl_take isl_basic_map *bmap2);
5749         __isl_give isl_map *isl_map_apply_domain(
5750                 __isl_take isl_map *map1,
5751                 __isl_take isl_map *map2);
5752         __isl_give isl_map *isl_map_apply_range(
5753                 __isl_take isl_map *map1,
5754                 __isl_take isl_map *map2);
5756         #include <isl/union_map.h>
5757         __isl_give isl_union_map *isl_union_map_apply_domain(
5758                 __isl_take isl_union_map *umap1,
5759                 __isl_take isl_union_map *umap2);
5760         __isl_give isl_union_map *isl_union_map_apply_range(
5761                 __isl_take isl_union_map *umap1,
5762                 __isl_take isl_union_map *umap2);
5764         #include <isl/aff.h>
5765         __isl_give isl_union_pw_aff *
5766         isl_multi_union_pw_aff_apply_aff(
5767                 __isl_take isl_multi_union_pw_aff *mupa,
5768                 __isl_take isl_aff *aff);
5769         __isl_give isl_union_pw_aff *
5770         isl_multi_union_pw_aff_apply_pw_aff(
5771                 __isl_take isl_multi_union_pw_aff *mupa,
5772                 __isl_take isl_pw_aff *pa);
5773         __isl_give isl_multi_union_pw_aff *
5774         isl_multi_union_pw_aff_apply_multi_aff(
5775                 __isl_take isl_multi_union_pw_aff *mupa,
5776                 __isl_take isl_multi_aff *ma);
5777         __isl_give isl_multi_union_pw_aff *
5778         isl_multi_union_pw_aff_apply_pw_multi_aff(
5779                 __isl_take isl_multi_union_pw_aff *mupa,
5780                 __isl_take isl_pw_multi_aff *pma);
5782 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
5783 over the shared domain of the elements of the input.  The dimension is
5784 required to be greater than zero.
5785 The C<isl_multi_union_pw_aff> argument of
5786 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
5787 but only if the range of the C<isl_multi_aff> argument
5788 is also zero-dimensional.
5789 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
5791         #include <isl/polynomial.h>
5792         __isl_give isl_pw_qpolynomial_fold *
5793         isl_set_apply_pw_qpolynomial_fold(
5794                 __isl_take isl_set *set,
5795                 __isl_take isl_pw_qpolynomial_fold *pwf,
5796                 int *tight);
5797         __isl_give isl_pw_qpolynomial_fold *
5798         isl_map_apply_pw_qpolynomial_fold(
5799                 __isl_take isl_map *map,
5800                 __isl_take isl_pw_qpolynomial_fold *pwf,
5801                 int *tight);
5802         __isl_give isl_union_pw_qpolynomial_fold *
5803         isl_union_set_apply_union_pw_qpolynomial_fold(
5804                 __isl_take isl_union_set *uset,
5805                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5806                 int *tight);
5807         __isl_give isl_union_pw_qpolynomial_fold *
5808         isl_union_map_apply_union_pw_qpolynomial_fold(
5809                 __isl_take isl_union_map *umap,
5810                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5811                 int *tight);
5813 The functions taking a map
5814 compose the given map with the given piecewise quasipolynomial reduction.
5815 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
5816 over all elements in the intersection of the range of the map
5817 and the domain of the piecewise quasipolynomial reduction
5818 as a function of an element in the domain of the map.
5819 The functions taking a set compute a bound over all elements in the
5820 intersection of the set and the domain of the
5821 piecewise quasipolynomial reduction.
5823 =item * Preimage
5825         #include <isl/set.h>
5826         __isl_give isl_basic_set *
5827         isl_basic_set_preimage_multi_aff(
5828                 __isl_take isl_basic_set *bset,
5829                 __isl_take isl_multi_aff *ma);
5830         __isl_give isl_set *isl_set_preimage_multi_aff(
5831                 __isl_take isl_set *set,
5832                 __isl_take isl_multi_aff *ma);
5833         __isl_give isl_set *isl_set_preimage_pw_multi_aff(
5834                 __isl_take isl_set *set,
5835                 __isl_take isl_pw_multi_aff *pma);
5836         __isl_give isl_set *isl_set_preimage_multi_pw_aff(
5837                 __isl_take isl_set *set,
5838                 __isl_take isl_multi_pw_aff *mpa);
5840         #include <isl/union_set.h>
5841         __isl_give isl_union_set *
5842         isl_union_set_preimage_multi_aff(
5843                 __isl_take isl_union_set *uset,
5844                 __isl_take isl_multi_aff *ma);
5845         __isl_give isl_union_set *
5846         isl_union_set_preimage_pw_multi_aff(
5847                 __isl_take isl_union_set *uset,
5848                 __isl_take isl_pw_multi_aff *pma);
5849         __isl_give isl_union_set *
5850         isl_union_set_preimage_union_pw_multi_aff(
5851                 __isl_take isl_union_set *uset,
5852                 __isl_take isl_union_pw_multi_aff *upma);
5854         #include <isl/map.h>
5855         __isl_give isl_basic_map *
5856         isl_basic_map_preimage_domain_multi_aff(
5857                 __isl_take isl_basic_map *bmap,
5858                 __isl_take isl_multi_aff *ma);
5859         __isl_give isl_map *isl_map_preimage_domain_multi_aff(
5860                 __isl_take isl_map *map,
5861                 __isl_take isl_multi_aff *ma);
5862         __isl_give isl_map *isl_map_preimage_range_multi_aff(
5863                 __isl_take isl_map *map,
5864                 __isl_take isl_multi_aff *ma);
5865         __isl_give isl_map *
5866         isl_map_preimage_domain_pw_multi_aff(
5867                 __isl_take isl_map *map,
5868                 __isl_take isl_pw_multi_aff *pma);
5869         __isl_give isl_map *
5870         isl_map_preimage_range_pw_multi_aff(
5871                 __isl_take isl_map *map,
5872                 __isl_take isl_pw_multi_aff *pma);
5873         __isl_give isl_map *
5874         isl_map_preimage_domain_multi_pw_aff(
5875                 __isl_take isl_map *map,
5876                 __isl_take isl_multi_pw_aff *mpa);
5877         __isl_give isl_basic_map *
5878         isl_basic_map_preimage_range_multi_aff(
5879                 __isl_take isl_basic_map *bmap,
5880                 __isl_take isl_multi_aff *ma);
5882         #include <isl/union_map.h>
5883         __isl_give isl_union_map *
5884         isl_union_map_preimage_domain_multi_aff(
5885                 __isl_take isl_union_map *umap,
5886                 __isl_take isl_multi_aff *ma);
5887         __isl_give isl_union_map *
5888         isl_union_map_preimage_range_multi_aff(
5889                 __isl_take isl_union_map *umap,
5890                 __isl_take isl_multi_aff *ma);
5891         __isl_give isl_union_map *
5892         isl_union_map_preimage_domain_pw_multi_aff(
5893                 __isl_take isl_union_map *umap,
5894                 __isl_take isl_pw_multi_aff *pma);
5895         __isl_give isl_union_map *
5896         isl_union_map_preimage_range_pw_multi_aff(
5897                 __isl_take isl_union_map *umap,
5898                 __isl_take isl_pw_multi_aff *pma);
5899         __isl_give isl_union_map *
5900         isl_union_map_preimage_domain_union_pw_multi_aff(
5901                 __isl_take isl_union_map *umap,
5902                 __isl_take isl_union_pw_multi_aff *upma);
5903         __isl_give isl_union_map *
5904         isl_union_map_preimage_range_union_pw_multi_aff(
5905                 __isl_take isl_union_map *umap,
5906                 __isl_take isl_union_pw_multi_aff *upma);
5908 These functions compute the preimage of the given set or map domain/range under
5909 the given function.  In other words, the expression is plugged
5910 into the set description or into the domain/range of the map.
5912 =item * Pullback
5914         #include <isl/aff.h>
5915         __isl_give isl_aff *isl_aff_pullback_aff(
5916                 __isl_take isl_aff *aff1,
5917                 __isl_take isl_aff *aff2);
5918         __isl_give isl_aff *isl_aff_pullback_multi_aff(
5919                 __isl_take isl_aff *aff,
5920                 __isl_take isl_multi_aff *ma);
5921         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
5922                 __isl_take isl_pw_aff *pa,
5923                 __isl_take isl_multi_aff *ma);
5924         __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
5925                 __isl_take isl_pw_aff *pa,
5926                 __isl_take isl_pw_multi_aff *pma);
5927         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
5928                 __isl_take isl_pw_aff *pa,
5929                 __isl_take isl_multi_pw_aff *mpa);
5930         __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
5931                 __isl_take isl_multi_aff *ma1,
5932                 __isl_take isl_multi_aff *ma2);
5933         __isl_give isl_pw_multi_aff *
5934         isl_pw_multi_aff_pullback_multi_aff(
5935                 __isl_take isl_pw_multi_aff *pma,
5936                 __isl_take isl_multi_aff *ma);
5937         __isl_give isl_multi_pw_aff *
5938         isl_multi_pw_aff_pullback_multi_aff(
5939                 __isl_take isl_multi_pw_aff *mpa,
5940                 __isl_take isl_multi_aff *ma);
5941         __isl_give isl_pw_multi_aff *
5942         isl_pw_multi_aff_pullback_pw_multi_aff(
5943                 __isl_take isl_pw_multi_aff *pma1,
5944                 __isl_take isl_pw_multi_aff *pma2);
5945         __isl_give isl_multi_pw_aff *
5946         isl_multi_pw_aff_pullback_pw_multi_aff(
5947                 __isl_take isl_multi_pw_aff *mpa,
5948                 __isl_take isl_pw_multi_aff *pma);
5949         __isl_give isl_multi_pw_aff *
5950         isl_multi_pw_aff_pullback_multi_pw_aff(
5951                 __isl_take isl_multi_pw_aff *mpa1,
5952                 __isl_take isl_multi_pw_aff *mpa2);
5953         __isl_give isl_union_pw_aff *
5954         isl_union_pw_aff_pullback_union_pw_multi_aff(
5955                 __isl_take isl_union_pw_aff *upa,
5956                 __isl_take isl_union_pw_multi_aff *upma);
5957         __isl_give isl_union_pw_multi_aff *
5958         isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
5959                 __isl_take isl_union_pw_multi_aff *upma1,
5960                 __isl_take isl_union_pw_multi_aff *upma2);
5961         __isl_give isl_multi_union_pw_aff *
5962         isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
5963                 __isl_take isl_multi_union_pw_aff *mupa,
5964                 __isl_take isl_union_pw_multi_aff *upma);
5966 These functions precompose the first expression by the second function.
5967 In other words, the second function is plugged
5968 into the first expression.
5970 =item * Locus
5972         #include <isl/aff.h>
5973         __isl_give isl_basic_set *isl_aff_le_basic_set(
5974                 __isl_take isl_aff *aff1,
5975                 __isl_take isl_aff *aff2);
5976         __isl_give isl_basic_set *isl_aff_ge_basic_set(
5977                 __isl_take isl_aff *aff1,
5978                 __isl_take isl_aff *aff2);
5979         __isl_give isl_set *isl_pw_aff_eq_set(
5980                 __isl_take isl_pw_aff *pwaff1,
5981                 __isl_take isl_pw_aff *pwaff2);
5982         __isl_give isl_set *isl_pw_aff_ne_set(
5983                 __isl_take isl_pw_aff *pwaff1,
5984                 __isl_take isl_pw_aff *pwaff2);
5985         __isl_give isl_set *isl_pw_aff_le_set(
5986                 __isl_take isl_pw_aff *pwaff1,
5987                 __isl_take isl_pw_aff *pwaff2);
5988         __isl_give isl_set *isl_pw_aff_lt_set(
5989                 __isl_take isl_pw_aff *pwaff1,
5990                 __isl_take isl_pw_aff *pwaff2);
5991         __isl_give isl_set *isl_pw_aff_ge_set(
5992                 __isl_take isl_pw_aff *pwaff1,
5993                 __isl_take isl_pw_aff *pwaff2);
5994         __isl_give isl_set *isl_pw_aff_gt_set(
5995                 __isl_take isl_pw_aff *pwaff1,
5996                 __isl_take isl_pw_aff *pwaff2);
5998         __isl_give isl_set *isl_multi_aff_lex_le_set(
5999                 __isl_take isl_multi_aff *ma1,
6000                 __isl_take isl_multi_aff *ma2);
6001         __isl_give isl_set *isl_multi_aff_lex_ge_set(
6002                 __isl_take isl_multi_aff *ma1,
6003                 __isl_take isl_multi_aff *ma2);
6005         __isl_give isl_set *isl_pw_aff_list_eq_set(
6006                 __isl_take isl_pw_aff_list *list1,
6007                 __isl_take isl_pw_aff_list *list2);
6008         __isl_give isl_set *isl_pw_aff_list_ne_set(
6009                 __isl_take isl_pw_aff_list *list1,
6010                 __isl_take isl_pw_aff_list *list2);
6011         __isl_give isl_set *isl_pw_aff_list_le_set(
6012                 __isl_take isl_pw_aff_list *list1,
6013                 __isl_take isl_pw_aff_list *list2);
6014         __isl_give isl_set *isl_pw_aff_list_lt_set(
6015                 __isl_take isl_pw_aff_list *list1,
6016                 __isl_take isl_pw_aff_list *list2);
6017         __isl_give isl_set *isl_pw_aff_list_ge_set(
6018                 __isl_take isl_pw_aff_list *list1,
6019                 __isl_take isl_pw_aff_list *list2);
6020         __isl_give isl_set *isl_pw_aff_list_gt_set(
6021                 __isl_take isl_pw_aff_list *list1,
6022                 __isl_take isl_pw_aff_list *list2);
6024 The function C<isl_aff_ge_basic_set> returns a basic set
6025 containing those elements in the shared space
6026 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
6027 The function C<isl_pw_aff_ge_set> returns a set
6028 containing those elements in the shared domain
6029 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
6030 greater than or equal to C<pwaff2>.
6031 The function C<isl_multi_aff_lex_le_set> returns a set
6032 containing those elements in the shared domain space
6033 where C<ma1> is lexicographically smaller than or
6034 equal to C<ma2>.
6035 The functions operating on C<isl_pw_aff_list> apply the corresponding
6036 C<isl_pw_aff> function to each pair of elements in the two lists.
6038         #include <isl/aff.h>
6039         __isl_give isl_map *isl_pw_aff_eq_map(
6040                 __isl_take isl_pw_aff *pa1,
6041                 __isl_take isl_pw_aff *pa2);
6042         __isl_give isl_map *isl_pw_aff_lt_map(
6043                 __isl_take isl_pw_aff *pa1,
6044                 __isl_take isl_pw_aff *pa2);
6045         __isl_give isl_map *isl_pw_aff_gt_map(
6046                 __isl_take isl_pw_aff *pa1,
6047                 __isl_take isl_pw_aff *pa2);
6049         __isl_give isl_map *isl_multi_pw_aff_eq_map(
6050                 __isl_take isl_multi_pw_aff *mpa1,
6051                 __isl_take isl_multi_pw_aff *mpa2);
6052         __isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
6053                 __isl_take isl_multi_pw_aff *mpa1,
6054                 __isl_take isl_multi_pw_aff *mpa2);
6055         __isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
6056                 __isl_take isl_multi_pw_aff *mpa1,
6057                 __isl_take isl_multi_pw_aff *mpa2);
6059 These functions return a map between domain elements of the arguments
6060 where the function values satisfy the given relation.
6062         #include <isl/union_map.h>
6063         __isl_give isl_union_map *
6064         isl_union_map_eq_at_multi_union_pw_aff(
6065                 __isl_take isl_union_map *umap,
6066                 __isl_take isl_multi_union_pw_aff *mupa);
6067         __isl_give isl_union_map *
6068         isl_union_map_lex_lt_at_multi_union_pw_aff(
6069                 __isl_take isl_union_map *umap,
6070                 __isl_take isl_multi_union_pw_aff *mupa);
6071         __isl_give isl_union_map *
6072         isl_union_map_lex_gt_at_multi_union_pw_aff(
6073                 __isl_take isl_union_map *umap,
6074                 __isl_take isl_multi_union_pw_aff *mupa);
6076 These functions select the subset of elements in the union map
6077 that have an equal or lexicographically smaller function value.
6079 =item * Cartesian Product
6081         #include <isl/space.h>
6082         __isl_give isl_space *isl_space_product(
6083                 __isl_take isl_space *space1,
6084                 __isl_take isl_space *space2);
6085         __isl_give isl_space *isl_space_domain_product(
6086                 __isl_take isl_space *space1,
6087                 __isl_take isl_space *space2);
6088         __isl_give isl_space *isl_space_range_product(
6089                 __isl_take isl_space *space1,
6090                 __isl_take isl_space *space2);
6092 The functions
6093 C<isl_space_product>, C<isl_space_domain_product>
6094 and C<isl_space_range_product> take pairs or relation spaces and
6095 produce a single relations space, where either the domain, the range
6096 or both domain and range are wrapped spaces of relations between
6097 the domains and/or ranges of the input spaces.
6098 If the product is only constructed over the domain or the range
6099 then the ranges or the domains of the inputs should be the same.
6100 The function C<isl_space_product> also accepts a pair of set spaces,
6101 in which case it returns a wrapped space of a relation between the
6102 two input spaces.
6104         #include <isl/set.h>
6105         __isl_give isl_set *isl_set_product(
6106                 __isl_take isl_set *set1,
6107                 __isl_take isl_set *set2);
6109         #include <isl/map.h>
6110         __isl_give isl_basic_map *isl_basic_map_domain_product(
6111                 __isl_take isl_basic_map *bmap1,
6112                 __isl_take isl_basic_map *bmap2);
6113         __isl_give isl_basic_map *isl_basic_map_range_product(
6114                 __isl_take isl_basic_map *bmap1,
6115                 __isl_take isl_basic_map *bmap2);
6116         __isl_give isl_basic_map *isl_basic_map_product(
6117                 __isl_take isl_basic_map *bmap1,
6118                 __isl_take isl_basic_map *bmap2);
6119         __isl_give isl_map *isl_map_domain_product(
6120                 __isl_take isl_map *map1,
6121                 __isl_take isl_map *map2);
6122         __isl_give isl_map *isl_map_range_product(
6123                 __isl_take isl_map *map1,
6124                 __isl_take isl_map *map2);
6125         __isl_give isl_map *isl_map_product(
6126                 __isl_take isl_map *map1,
6127                 __isl_take isl_map *map2);
6129         #include <isl/union_set.h>
6130         __isl_give isl_union_set *isl_union_set_product(
6131                 __isl_take isl_union_set *uset1,
6132                 __isl_take isl_union_set *uset2);
6134         #include <isl/union_map.h>
6135         __isl_give isl_union_map *isl_union_map_domain_product(
6136                 __isl_take isl_union_map *umap1,
6137                 __isl_take isl_union_map *umap2);
6138         __isl_give isl_union_map *isl_union_map_range_product(
6139                 __isl_take isl_union_map *umap1,
6140                 __isl_take isl_union_map *umap2);
6141         __isl_give isl_union_map *isl_union_map_product(
6142                 __isl_take isl_union_map *umap1,
6143                 __isl_take isl_union_map *umap2);
6145         #include <isl/val.h>
6146         __isl_give isl_multi_val *isl_multi_val_range_product(
6147                 __isl_take isl_multi_val *mv1,
6148                 __isl_take isl_multi_val *mv2);
6149         __isl_give isl_multi_val *isl_multi_val_product(
6150                 __isl_take isl_multi_val *mv1,
6151                 __isl_take isl_multi_val *mv2);
6153         #include <isl/aff.h>
6154         __isl_give isl_multi_aff *isl_multi_aff_range_product(
6155                 __isl_take isl_multi_aff *ma1,
6156                 __isl_take isl_multi_aff *ma2);
6157         __isl_give isl_multi_aff *isl_multi_aff_product(
6158                 __isl_take isl_multi_aff *ma1,
6159                 __isl_take isl_multi_aff *ma2);
6160         __isl_give isl_multi_pw_aff *
6161         isl_multi_pw_aff_range_product(
6162                 __isl_take isl_multi_pw_aff *mpa1,
6163                 __isl_take isl_multi_pw_aff *mpa2);
6164         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
6165                 __isl_take isl_multi_pw_aff *mpa1,
6166                 __isl_take isl_multi_pw_aff *mpa2);
6167         __isl_give isl_pw_multi_aff *
6168         isl_pw_multi_aff_range_product(
6169                 __isl_take isl_pw_multi_aff *pma1,
6170                 __isl_take isl_pw_multi_aff *pma2);
6171         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
6172                 __isl_take isl_pw_multi_aff *pma1,
6173                 __isl_take isl_pw_multi_aff *pma2);
6174         __isl_give isl_multi_union_pw_aff *
6175         isl_multi_union_pw_aff_range_product(
6176                 __isl_take isl_multi_union_pw_aff *mupa1,
6177                 __isl_take isl_multi_union_pw_aff *mupa2);
6179 The above functions compute the cross product of the given
6180 sets, relations or functions.  The domains and ranges of the results
6181 are wrapped maps between domains and ranges of the inputs.
6182 To obtain a ``flat'' product, use the following functions
6183 instead.
6185         #include <isl/set.h>
6186         __isl_give isl_basic_set *isl_basic_set_flat_product(
6187                 __isl_take isl_basic_set *bset1,
6188                 __isl_take isl_basic_set *bset2);
6189         __isl_give isl_set *isl_set_flat_product(
6190                 __isl_take isl_set *set1,
6191                 __isl_take isl_set *set2);
6193         #include <isl/map.h>
6194         __isl_give isl_basic_map *isl_basic_map_flat_range_product(
6195                 __isl_take isl_basic_map *bmap1,
6196                 __isl_take isl_basic_map *bmap2);
6197         __isl_give isl_map *isl_map_flat_domain_product(
6198                 __isl_take isl_map *map1,
6199                 __isl_take isl_map *map2);
6200         __isl_give isl_map *isl_map_flat_range_product(
6201                 __isl_take isl_map *map1,
6202                 __isl_take isl_map *map2);
6203         __isl_give isl_basic_map *isl_basic_map_flat_product(
6204                 __isl_take isl_basic_map *bmap1,
6205                 __isl_take isl_basic_map *bmap2);
6206         __isl_give isl_map *isl_map_flat_product(
6207                 __isl_take isl_map *map1,
6208                 __isl_take isl_map *map2);
6210         #include <isl/union_map.h>
6211         __isl_give isl_union_map *
6212         isl_union_map_flat_domain_product(
6213                 __isl_take isl_union_map *umap1,
6214                 __isl_take isl_union_map *umap2);
6215         __isl_give isl_union_map *
6216         isl_union_map_flat_range_product(
6217                 __isl_take isl_union_map *umap1,
6218                 __isl_take isl_union_map *umap2);
6220         #include <isl/val.h>
6221         __isl_give isl_multi_val *isl_multi_val_flat_range_product(
6222                 __isl_take isl_multi_val *mv1,
6223                 __isl_take isl_multi_aff *mv2);
6225         #include <isl/aff.h>
6226         __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
6227                 __isl_take isl_multi_aff *ma1,
6228                 __isl_take isl_multi_aff *ma2);
6229         __isl_give isl_pw_multi_aff *
6230         isl_pw_multi_aff_flat_range_product(
6231                 __isl_take isl_pw_multi_aff *pma1,
6232                 __isl_take isl_pw_multi_aff *pma2);
6233         __isl_give isl_multi_pw_aff *
6234         isl_multi_pw_aff_flat_range_product(
6235                 __isl_take isl_multi_pw_aff *mpa1,
6236                 __isl_take isl_multi_pw_aff *mpa2);
6237         __isl_give isl_union_pw_multi_aff *
6238         isl_union_pw_multi_aff_flat_range_product(
6239                 __isl_take isl_union_pw_multi_aff *upma1,
6240                 __isl_take isl_union_pw_multi_aff *upma2);
6241         __isl_give isl_multi_union_pw_aff *
6242         isl_multi_union_pw_aff_flat_range_product(
6243                 __isl_take isl_multi_union_pw_aff *mupa1,
6244                 __isl_take isl_multi_union_pw_aff *mupa2);
6246         #include <isl/space.h>
6247         __isl_give isl_space *isl_space_factor_domain(
6248                 __isl_take isl_space *space);
6249         __isl_give isl_space *isl_space_factor_range(
6250                 __isl_take isl_space *space);
6251         __isl_give isl_space *isl_space_domain_factor_domain(
6252                 __isl_take isl_space *space);
6253         __isl_give isl_space *isl_space_domain_factor_range(
6254                 __isl_take isl_space *space);
6255         __isl_give isl_space *isl_space_range_factor_domain(
6256                 __isl_take isl_space *space);
6257         __isl_give isl_space *isl_space_range_factor_range(
6258                 __isl_take isl_space *space);
6260 The functions C<isl_space_range_factor_domain> and
6261 C<isl_space_range_factor_range> extract the two arguments from
6262 the result of a call to C<isl_space_range_product>.
6264 The arguments of a call to C<isl_map_range_product> can be extracted
6265 from the result using the following functions.
6267         #include <isl/map.h>
6268         __isl_give isl_map *isl_map_factor_domain(
6269                 __isl_take isl_map *map);
6270         __isl_give isl_map *isl_map_factor_range(
6271                 __isl_take isl_map *map);
6272         __isl_give isl_map *isl_map_domain_factor_domain(
6273                 __isl_take isl_map *map);
6274         __isl_give isl_map *isl_map_domain_factor_range(
6275                 __isl_take isl_map *map);
6276         __isl_give isl_map *isl_map_range_factor_domain(
6277                 __isl_take isl_map *map);
6278         __isl_give isl_map *isl_map_range_factor_range(
6279                 __isl_take isl_map *map);
6281         #include <isl/union_map.h>
6282         __isl_give isl_union_map *isl_union_map_factor_domain(
6283                 __isl_take isl_union_map *umap);
6284         __isl_give isl_union_map *isl_union_map_factor_range(
6285                 __isl_take isl_union_map *umap);
6286         __isl_give isl_union_map *
6287         isl_union_map_domain_factor_domain(
6288                 __isl_take isl_union_map *umap);
6289         __isl_give isl_union_map *
6290         isl_union_map_domain_factor_range(
6291                 __isl_take isl_union_map *umap);
6292         __isl_give isl_union_map *
6293         isl_union_map_range_factor_range(
6294                 __isl_take isl_union_map *umap);
6296         #include <isl/val.h>
6297         __isl_give isl_multi_val *
6298         isl_multi_val_range_factor_domain(
6299                 __isl_take isl_multi_val *mv);
6300         __isl_give isl_multi_val *
6301         isl_multi_val_range_factor_range(
6302                 __isl_take isl_multi_val *mv);
6304         #include <isl/aff.h>
6305         __isl_give isl_multi_aff *
6306         isl_multi_aff_range_factor_domain(
6307                 __isl_take isl_multi_aff *ma);
6308         __isl_give isl_multi_aff *
6309         isl_multi_aff_range_factor_range(
6310                 __isl_take isl_multi_aff *ma);
6311         __isl_give isl_multi_pw_aff *
6312         isl_multi_pw_aff_range_factor_domain(
6313                 __isl_take isl_multi_pw_aff *mpa);
6314         __isl_give isl_multi_pw_aff *
6315         isl_multi_pw_aff_range_factor_range(
6316                 __isl_take isl_multi_pw_aff *mpa);
6317         __isl_give isl_multi_union_pw_aff *
6318         isl_multi_union_pw_aff_range_factor_domain(
6319                 __isl_take isl_multi_union_pw_aff *mupa);
6320         __isl_give isl_multi_union_pw_aff *
6321         isl_multi_union_pw_aff_range_factor_range(
6322                 __isl_take isl_multi_union_pw_aff *mupa);
6324 The splice functions are a generalization of the flat product functions,
6325 where the second argument may be inserted at any position inside
6326 the first argument rather than being placed at the end.
6328         #include <isl/val.h>
6329         __isl_give isl_multi_val *isl_multi_val_range_splice(
6330                 __isl_take isl_multi_val *mv1, unsigned pos,
6331                 __isl_take isl_multi_val *mv2);
6333         #include <isl/aff.h>
6334         __isl_give isl_multi_aff *isl_multi_aff_range_splice(
6335                 __isl_take isl_multi_aff *ma1, unsigned pos,
6336                 __isl_take isl_multi_aff *ma2);
6337         __isl_give isl_multi_aff *isl_multi_aff_splice(
6338                 __isl_take isl_multi_aff *ma1,
6339                 unsigned in_pos, unsigned out_pos,
6340                 __isl_take isl_multi_aff *ma2);
6341         __isl_give isl_multi_pw_aff *
6342         isl_multi_pw_aff_range_splice(
6343                 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
6344                 __isl_take isl_multi_pw_aff *mpa2);
6345         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
6346                 __isl_take isl_multi_pw_aff *mpa1,
6347                 unsigned in_pos, unsigned out_pos,
6348                 __isl_take isl_multi_pw_aff *mpa2);
6349         __isl_give isl_multi_union_pw_aff *
6350         isl_multi_union_pw_aff_range_splice(
6351                 __isl_take isl_multi_union_pw_aff *mupa1,
6352                 unsigned pos,
6353                 __isl_take isl_multi_union_pw_aff *mupa2);
6355 =item * Simplification
6357 When applied to a set or relation,
6358 the gist operation returns a set or relation that has the
6359 same intersection with the context as the input set or relation.
6360 Any implicit equality in the intersection is made explicit in the result,
6361 while all inequalities that are redundant with respect to the intersection
6362 are removed.
6363 In case of union sets and relations, the gist operation is performed
6364 per space.
6366 When applied to a function,
6367 the gist operation applies the set gist operation to each of
6368 the cells in the domain of the input piecewise expression.
6369 The context is also exploited
6370 to simplify the expression associated to each cell.
6372         #include <isl/set.h>
6373         __isl_give isl_basic_set *isl_basic_set_gist(
6374                 __isl_take isl_basic_set *bset,
6375                 __isl_take isl_basic_set *context);
6376         __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
6377                 __isl_take isl_set *context);
6378         __isl_give isl_set *isl_set_gist_params(
6379                 __isl_take isl_set *set,
6380                 __isl_take isl_set *context);
6382         #include <isl/map.h>
6383         __isl_give isl_basic_map *isl_basic_map_gist(
6384                 __isl_take isl_basic_map *bmap,
6385                 __isl_take isl_basic_map *context);
6386         __isl_give isl_basic_map *isl_basic_map_gist_domain(
6387                 __isl_take isl_basic_map *bmap,
6388                 __isl_take isl_basic_set *context);
6389         __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
6390                 __isl_take isl_map *context);
6391         __isl_give isl_map *isl_map_gist_params(
6392                 __isl_take isl_map *map,
6393                 __isl_take isl_set *context);
6394         __isl_give isl_map *isl_map_gist_domain(
6395                 __isl_take isl_map *map,
6396                 __isl_take isl_set *context);
6397         __isl_give isl_map *isl_map_gist_range(
6398                 __isl_take isl_map *map,
6399                 __isl_take isl_set *context);
6401         #include <isl/union_set.h>
6402         __isl_give isl_union_set *isl_union_set_gist(
6403                 __isl_take isl_union_set *uset,
6404                 __isl_take isl_union_set *context);
6405         __isl_give isl_union_set *isl_union_set_gist_params(
6406                 __isl_take isl_union_set *uset,
6407                 __isl_take isl_set *set);
6409         #include <isl/union_map.h>
6410         __isl_give isl_union_map *isl_union_map_gist(
6411                 __isl_take isl_union_map *umap,
6412                 __isl_take isl_union_map *context);
6413         __isl_give isl_union_map *isl_union_map_gist_params(
6414                 __isl_take isl_union_map *umap,
6415                 __isl_take isl_set *set);
6416         __isl_give isl_union_map *isl_union_map_gist_domain(
6417                 __isl_take isl_union_map *umap,
6418                 __isl_take isl_union_set *uset);
6419         __isl_give isl_union_map *isl_union_map_gist_range(
6420                 __isl_take isl_union_map *umap,
6421                 __isl_take isl_union_set *uset);
6423         #include <isl/aff.h>
6424         __isl_give isl_aff *isl_aff_gist_params(
6425                 __isl_take isl_aff *aff,
6426                 __isl_take isl_set *context);
6427         __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
6428                 __isl_take isl_set *context);
6429         __isl_give isl_multi_aff *isl_multi_aff_gist_params(
6430                 __isl_take isl_multi_aff *maff,
6431                 __isl_take isl_set *context);
6432         __isl_give isl_multi_aff *isl_multi_aff_gist(
6433                 __isl_take isl_multi_aff *maff,
6434                 __isl_take isl_set *context);
6435         __isl_give isl_pw_aff *isl_pw_aff_gist_params(
6436                 __isl_take isl_pw_aff *pwaff,
6437                 __isl_take isl_set *context);
6438         __isl_give isl_pw_aff *isl_pw_aff_gist(
6439                 __isl_take isl_pw_aff *pwaff,
6440                 __isl_take isl_set *context);
6441         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
6442                 __isl_take isl_pw_multi_aff *pma,
6443                 __isl_take isl_set *set);
6444         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
6445                 __isl_take isl_pw_multi_aff *pma,
6446                 __isl_take isl_set *set);
6447         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
6448                 __isl_take isl_multi_pw_aff *mpa,
6449                 __isl_take isl_set *set);
6450         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
6451                 __isl_take isl_multi_pw_aff *mpa,
6452                 __isl_take isl_set *set);
6453         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
6454                 __isl_take isl_union_pw_aff *upa,
6455                 __isl_take isl_union_set *context);
6456         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
6457                 __isl_take isl_union_pw_aff *upa,
6458                 __isl_take isl_set *context);
6459         __isl_give isl_union_pw_multi_aff *
6460         isl_union_pw_multi_aff_gist_params(
6461                 __isl_take isl_union_pw_multi_aff *upma,
6462                 __isl_take isl_set *context);
6463         __isl_give isl_union_pw_multi_aff *
6464         isl_union_pw_multi_aff_gist(
6465                 __isl_take isl_union_pw_multi_aff *upma,
6466                 __isl_take isl_union_set *context);
6467         __isl_give isl_multi_union_pw_aff *
6468         isl_multi_union_pw_aff_gist_params(
6469                 __isl_take isl_multi_union_pw_aff *aff,
6470                 __isl_take isl_set *context);
6471         __isl_give isl_multi_union_pw_aff *
6472         isl_multi_union_pw_aff_gist(
6473                 __isl_take isl_multi_union_pw_aff *aff,
6474                 __isl_take isl_union_set *context);
6476         #include <isl/polynomial.h>
6477         __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
6478                 __isl_take isl_qpolynomial *qp,
6479                 __isl_take isl_set *context);
6480         __isl_give isl_qpolynomial *isl_qpolynomial_gist(
6481                 __isl_take isl_qpolynomial *qp,
6482                 __isl_take isl_set *context);
6483         __isl_give isl_qpolynomial_fold *
6484         isl_qpolynomial_fold_gist_params(
6485                 __isl_take isl_qpolynomial_fold *fold,
6486                 __isl_take isl_set *context);
6487         __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
6488                 __isl_take isl_qpolynomial_fold *fold,
6489                 __isl_take isl_set *context);
6490         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
6491                 __isl_take isl_pw_qpolynomial *pwqp,
6492                 __isl_take isl_set *context);
6493         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
6494                 __isl_take isl_pw_qpolynomial *pwqp,
6495                 __isl_take isl_set *context);
6496         __isl_give isl_pw_qpolynomial_fold *
6497         isl_pw_qpolynomial_fold_gist(
6498                 __isl_take isl_pw_qpolynomial_fold *pwf,
6499                 __isl_take isl_set *context);
6500         __isl_give isl_pw_qpolynomial_fold *
6501         isl_pw_qpolynomial_fold_gist_params(
6502                 __isl_take isl_pw_qpolynomial_fold *pwf,
6503                 __isl_take isl_set *context);
6504         __isl_give isl_union_pw_qpolynomial *
6505         isl_union_pw_qpolynomial_gist_params(
6506                 __isl_take isl_union_pw_qpolynomial *upwqp,
6507                 __isl_take isl_set *context);
6508         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
6509                 __isl_take isl_union_pw_qpolynomial *upwqp,
6510                 __isl_take isl_union_set *context);
6511         __isl_give isl_union_pw_qpolynomial_fold *
6512         isl_union_pw_qpolynomial_fold_gist(
6513                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6514                 __isl_take isl_union_set *context);
6515         __isl_give isl_union_pw_qpolynomial_fold *
6516         isl_union_pw_qpolynomial_fold_gist_params(
6517                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6518                 __isl_take isl_set *context);
6520 =item * Binary Arithmethic Operations
6522         #include <isl/val.h>
6523         __isl_give isl_multi_val *isl_multi_val_sub(
6524                 __isl_take isl_multi_val *mv1,
6525                 __isl_take isl_multi_val *mv2);
6527         #include <isl/aff.h>
6528         __isl_give isl_aff *isl_aff_add(
6529                 __isl_take isl_aff *aff1,
6530                 __isl_take isl_aff *aff2);
6531         __isl_give isl_multi_aff *isl_multi_aff_add(
6532                 __isl_take isl_multi_aff *maff1,
6533                 __isl_take isl_multi_aff *maff2);
6534         __isl_give isl_pw_aff *isl_pw_aff_add(
6535                 __isl_take isl_pw_aff *pwaff1,
6536                 __isl_take isl_pw_aff *pwaff2);
6537         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
6538                 __isl_take isl_pw_multi_aff *pma1,
6539                 __isl_take isl_pw_multi_aff *pma2);
6540         __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
6541                 __isl_take isl_union_pw_aff *upa1,
6542                 __isl_take isl_union_pw_aff *upa2);
6543         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
6544                 __isl_take isl_union_pw_multi_aff *upma1,
6545                 __isl_take isl_union_pw_multi_aff *upma2);
6546         __isl_give isl_pw_aff *isl_pw_aff_min(
6547                 __isl_take isl_pw_aff *pwaff1,
6548                 __isl_take isl_pw_aff *pwaff2);
6549         __isl_give isl_pw_aff *isl_pw_aff_max(
6550                 __isl_take isl_pw_aff *pwaff1,
6551                 __isl_take isl_pw_aff *pwaff2);
6552         __isl_give isl_aff *isl_aff_sub(
6553                 __isl_take isl_aff *aff1,
6554                 __isl_take isl_aff *aff2);
6555         __isl_give isl_multi_aff *isl_multi_aff_sub(
6556                 __isl_take isl_multi_aff *ma1,
6557                 __isl_take isl_multi_aff *ma2);
6558         __isl_give isl_pw_aff *isl_pw_aff_sub(
6559                 __isl_take isl_pw_aff *pwaff1,
6560                 __isl_take isl_pw_aff *pwaff2);
6561         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
6562                 __isl_take isl_multi_pw_aff *mpa1,
6563                 __isl_take isl_multi_pw_aff *mpa2);
6564         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
6565                 __isl_take isl_pw_multi_aff *pma1,
6566                 __isl_take isl_pw_multi_aff *pma2);
6567         __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
6568                 __isl_take isl_union_pw_aff *upa1,
6569                 __isl_take isl_union_pw_aff *upa2);
6570         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
6571                 __isl_take isl_union_pw_multi_aff *upma1,
6572                 __isl_take isl_union_pw_multi_aff *upma2);
6573         __isl_give isl_multi_union_pw_aff *
6574         isl_multi_union_pw_aff_sub(
6575                 __isl_take isl_multi_union_pw_aff *mupa1,
6576                 __isl_take isl_multi_union_pw_aff *mupa2);
6578 C<isl_aff_sub> subtracts the second argument from the first.
6580         #include <isl/polynomial.h>
6581         __isl_give isl_qpolynomial *isl_qpolynomial_add(
6582                 __isl_take isl_qpolynomial *qp1,
6583                 __isl_take isl_qpolynomial *qp2);
6584         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
6585                 __isl_take isl_pw_qpolynomial *pwqp1,
6586                 __isl_take isl_pw_qpolynomial *pwqp2);
6587         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
6588                 __isl_take isl_pw_qpolynomial *pwqp1,
6589                 __isl_take isl_pw_qpolynomial *pwqp2);
6590         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
6591                 __isl_take isl_pw_qpolynomial_fold *pwf1,
6592                 __isl_take isl_pw_qpolynomial_fold *pwf2);
6593         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
6594                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6595                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6596         __isl_give isl_qpolynomial *isl_qpolynomial_sub(
6597                 __isl_take isl_qpolynomial *qp1,
6598                 __isl_take isl_qpolynomial *qp2);
6599         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
6600                 __isl_take isl_pw_qpolynomial *pwqp1,
6601                 __isl_take isl_pw_qpolynomial *pwqp2);
6602         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
6603                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6604                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6605         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
6606                 __isl_take isl_pw_qpolynomial_fold *pwf1,
6607                 __isl_take isl_pw_qpolynomial_fold *pwf2);
6608         __isl_give isl_union_pw_qpolynomial_fold *
6609         isl_union_pw_qpolynomial_fold_fold(
6610                 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
6611                 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
6613         #include <isl/aff.h>
6614         __isl_give isl_pw_aff *isl_pw_aff_union_add(
6615                 __isl_take isl_pw_aff *pwaff1,
6616                 __isl_take isl_pw_aff *pwaff2);
6617         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
6618                 __isl_take isl_pw_multi_aff *pma1,
6619                 __isl_take isl_pw_multi_aff *pma2);
6620         __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
6621                 __isl_take isl_union_pw_aff *upa1,
6622                 __isl_take isl_union_pw_aff *upa2);
6623         __isl_give isl_union_pw_multi_aff *
6624         isl_union_pw_multi_aff_union_add(
6625                 __isl_take isl_union_pw_multi_aff *upma1,
6626                 __isl_take isl_union_pw_multi_aff *upma2);
6627         __isl_give isl_multi_union_pw_aff *
6628         isl_multi_union_pw_aff_union_add(
6629                 __isl_take isl_multi_union_pw_aff *mupa1,
6630                 __isl_take isl_multi_union_pw_aff *mupa2);
6631         __isl_give isl_pw_aff *isl_pw_aff_union_min(
6632                 __isl_take isl_pw_aff *pwaff1,
6633                 __isl_take isl_pw_aff *pwaff2);
6634         __isl_give isl_pw_aff *isl_pw_aff_union_max(
6635                 __isl_take isl_pw_aff *pwaff1,
6636                 __isl_take isl_pw_aff *pwaff2);
6638 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
6639 expression with a domain that is the union of those of C<pwaff1> and
6640 C<pwaff2> and such that on each cell, the quasi-affine expression is
6641 the maximum of those of C<pwaff1> and C<pwaff2>.  If only one of
6642 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
6643 associated expression is the defined one.
6644 This in contrast to the C<isl_pw_aff_max> function, which is
6645 only defined on the shared definition domain of the arguments.
6647         #include <isl/val.h>
6648         __isl_give isl_multi_val *isl_multi_val_add_val(
6649                 __isl_take isl_multi_val *mv,
6650                 __isl_take isl_val *v);
6651         __isl_give isl_multi_val *isl_multi_val_mod_val(
6652                 __isl_take isl_multi_val *mv,
6653                 __isl_take isl_val *v);
6654         __isl_give isl_multi_val *isl_multi_val_scale_val(
6655                 __isl_take isl_multi_val *mv,
6656                 __isl_take isl_val *v);
6657         __isl_give isl_multi_val *isl_multi_val_scale_down_val(
6658                 __isl_take isl_multi_val *mv,
6659                 __isl_take isl_val *v);
6661         #include <isl/aff.h>
6662         __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
6663                 __isl_take isl_val *mod);
6664         __isl_give isl_pw_aff *isl_pw_aff_mod_val(
6665                 __isl_take isl_pw_aff *pa,
6666                 __isl_take isl_val *mod);
6667         __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
6668                 __isl_take isl_union_pw_aff *upa,
6669                 __isl_take isl_val *f);
6670         __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
6671                 __isl_take isl_val *v);
6672         __isl_give isl_multi_aff *isl_multi_aff_scale_val(
6673                 __isl_take isl_multi_aff *ma,
6674                 __isl_take isl_val *v);
6675         __isl_give isl_pw_aff *isl_pw_aff_scale_val(
6676                 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
6677         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
6678                 __isl_take isl_multi_pw_aff *mpa,
6679                 __isl_take isl_val *v);
6680         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
6681                 __isl_take isl_pw_multi_aff *pma,
6682                 __isl_take isl_val *v);
6683         __isl_give isl_union_pw_multi_aff *
6684         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
6685                 __isl_take isl_union_pw_aff *upa,
6686                 __isl_take isl_val *f);
6687         isl_union_pw_multi_aff_scale_val(
6688                 __isl_take isl_union_pw_multi_aff *upma,
6689                 __isl_take isl_val *val);
6690         __isl_give isl_multi_union_pw_aff *
6691         isl_multi_union_pw_aff_scale_val(
6692                 __isl_take isl_multi_union_pw_aff *mupa,
6693                 __isl_take isl_val *v);
6694         __isl_give isl_aff *isl_aff_scale_down_ui(
6695                 __isl_take isl_aff *aff, unsigned f);
6696         __isl_give isl_aff *isl_aff_scale_down_val(
6697                 __isl_take isl_aff *aff, __isl_take isl_val *v);
6698         __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
6699                 __isl_take isl_multi_aff *ma,
6700                 __isl_take isl_val *v);
6701         __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
6702                 __isl_take isl_pw_aff *pa,
6703                 __isl_take isl_val *f);
6704         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
6705                 __isl_take isl_multi_pw_aff *mpa,
6706                 __isl_take isl_val *v);
6707         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
6708                 __isl_take isl_pw_multi_aff *pma,
6709                 __isl_take isl_val *v);
6710         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
6711                 __isl_take isl_union_pw_aff *upa,
6712                 __isl_take isl_val *v);
6713         __isl_give isl_union_pw_multi_aff *
6714         isl_union_pw_multi_aff_scale_down_val(
6715                 __isl_take isl_union_pw_multi_aff *upma,
6716                 __isl_take isl_val *val);
6717         __isl_give isl_multi_union_pw_aff *
6718         isl_multi_union_pw_aff_scale_down_val(
6719                 __isl_take isl_multi_union_pw_aff *mupa,
6720                 __isl_take isl_val *v);
6722         #include <isl/polynomial.h>
6723         __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
6724                 __isl_take isl_qpolynomial *qp,
6725                 __isl_take isl_val *v);
6726         __isl_give isl_qpolynomial_fold *
6727         isl_qpolynomial_fold_scale_val(
6728                 __isl_take isl_qpolynomial_fold *fold,
6729                 __isl_take isl_val *v);
6730         __isl_give isl_pw_qpolynomial *
6731         isl_pw_qpolynomial_scale_val(
6732                 __isl_take isl_pw_qpolynomial *pwqp,
6733                 __isl_take isl_val *v);
6734         __isl_give isl_pw_qpolynomial_fold *
6735         isl_pw_qpolynomial_fold_scale_val(
6736                 __isl_take isl_pw_qpolynomial_fold *pwf,
6737                 __isl_take isl_val *v);
6738         __isl_give isl_union_pw_qpolynomial *
6739         isl_union_pw_qpolynomial_scale_val(
6740                 __isl_take isl_union_pw_qpolynomial *upwqp,
6741                 __isl_take isl_val *v);
6742         __isl_give isl_union_pw_qpolynomial_fold *
6743         isl_union_pw_qpolynomial_fold_scale_val(
6744                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6745                 __isl_take isl_val *v);
6746         __isl_give isl_qpolynomial *
6747         isl_qpolynomial_scale_down_val(
6748                 __isl_take isl_qpolynomial *qp,
6749                 __isl_take isl_val *v);
6750         __isl_give isl_qpolynomial_fold *
6751         isl_qpolynomial_fold_scale_down_val(
6752                 __isl_take isl_qpolynomial_fold *fold,
6753                 __isl_take isl_val *v);
6754         __isl_give isl_pw_qpolynomial *
6755         isl_pw_qpolynomial_scale_down_val(
6756                 __isl_take isl_pw_qpolynomial *pwqp,
6757                 __isl_take isl_val *v);
6758         __isl_give isl_pw_qpolynomial_fold *
6759         isl_pw_qpolynomial_fold_scale_down_val(
6760                 __isl_take isl_pw_qpolynomial_fold *pwf,
6761                 __isl_take isl_val *v);
6762         __isl_give isl_union_pw_qpolynomial *
6763         isl_union_pw_qpolynomial_scale_down_val(
6764                 __isl_take isl_union_pw_qpolynomial *upwqp,
6765                 __isl_take isl_val *v);
6766         __isl_give isl_union_pw_qpolynomial_fold *
6767         isl_union_pw_qpolynomial_fold_scale_down_val(
6768                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6769                 __isl_take isl_val *v);
6771         #include <isl/val.h>
6772         __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
6773                 __isl_take isl_multi_val *mv1,
6774                 __isl_take isl_multi_val *mv2);
6775         __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
6776                 __isl_take isl_multi_val *mv1,
6777                 __isl_take isl_multi_val *mv2);
6778         __isl_give isl_multi_val *
6779         isl_multi_val_scale_down_multi_val(
6780                 __isl_take isl_multi_val *mv1,
6781                 __isl_take isl_multi_val *mv2);
6783         #include <isl/aff.h>
6784         __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
6785                 __isl_take isl_multi_aff *ma,
6786                 __isl_take isl_multi_val *mv);
6787         __isl_give isl_multi_union_pw_aff *
6788         isl_multi_union_pw_aff_mod_multi_val(
6789                 __isl_take isl_multi_union_pw_aff *upma,
6790                 __isl_take isl_multi_val *mv);
6791         __isl_give isl_multi_pw_aff *
6792         isl_multi_pw_aff_mod_multi_val(
6793                 __isl_take isl_multi_pw_aff *mpa,
6794                 __isl_take isl_multi_val *mv);
6795         __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
6796                 __isl_take isl_multi_aff *ma,
6797                 __isl_take isl_multi_val *mv);
6798         __isl_give isl_pw_multi_aff *
6799         isl_pw_multi_aff_scale_multi_val(
6800                 __isl_take isl_pw_multi_aff *pma,
6801                 __isl_take isl_multi_val *mv);
6802         __isl_give isl_multi_pw_aff *
6803         isl_multi_pw_aff_scale_multi_val(
6804                 __isl_take isl_multi_pw_aff *mpa,
6805                 __isl_take isl_multi_val *mv);
6806         __isl_give isl_multi_union_pw_aff *
6807         isl_multi_union_pw_aff_scale_multi_val(
6808                 __isl_take isl_multi_union_pw_aff *mupa,
6809                 __isl_take isl_multi_val *mv);
6810         __isl_give isl_union_pw_multi_aff *
6811         isl_union_pw_multi_aff_scale_multi_val(
6812                 __isl_take isl_union_pw_multi_aff *upma,
6813                 __isl_take isl_multi_val *mv);
6814         __isl_give isl_multi_aff *
6815         isl_multi_aff_scale_down_multi_val(
6816                 __isl_take isl_multi_aff *ma,
6817                 __isl_take isl_multi_val *mv);
6818         __isl_give isl_multi_pw_aff *
6819         isl_multi_pw_aff_scale_down_multi_val(
6820                 __isl_take isl_multi_pw_aff *mpa,
6821                 __isl_take isl_multi_val *mv);
6822         __isl_give isl_multi_union_pw_aff *
6823         isl_multi_union_pw_aff_scale_down_multi_val(
6824                 __isl_take isl_multi_union_pw_aff *mupa,
6825                 __isl_take isl_multi_val *mv);
6827 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
6828 by the corresponding elements of C<mv>.
6830         #include <isl/aff.h>
6831         __isl_give isl_aff *isl_aff_mul(
6832                 __isl_take isl_aff *aff1,
6833                 __isl_take isl_aff *aff2);
6834         __isl_give isl_aff *isl_aff_div(
6835                 __isl_take isl_aff *aff1,
6836                 __isl_take isl_aff *aff2);
6837         __isl_give isl_pw_aff *isl_pw_aff_mul(
6838                 __isl_take isl_pw_aff *pwaff1,
6839                 __isl_take isl_pw_aff *pwaff2);
6840         __isl_give isl_pw_aff *isl_pw_aff_div(
6841                 __isl_take isl_pw_aff *pa1,
6842                 __isl_take isl_pw_aff *pa2);
6843         __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
6844                 __isl_take isl_pw_aff *pa1,
6845                 __isl_take isl_pw_aff *pa2);
6846         __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
6847                 __isl_take isl_pw_aff *pa1,
6848                 __isl_take isl_pw_aff *pa2);
6850 When multiplying two affine expressions, at least one of the two needs
6851 to be a constant.  Similarly, when dividing an affine expression by another,
6852 the second expression needs to be a constant.
6853 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
6854 rounding towards zero.  C<isl_pw_aff_tdiv_r> computes the corresponding
6855 remainder.
6857         #include <isl/polynomial.h>
6858         __isl_give isl_qpolynomial *isl_qpolynomial_mul(
6859                 __isl_take isl_qpolynomial *qp1,
6860                 __isl_take isl_qpolynomial *qp2);
6861         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
6862                 __isl_take isl_pw_qpolynomial *pwqp1,
6863                 __isl_take isl_pw_qpolynomial *pwqp2);
6864         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
6865                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6866                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6868 =back
6870 =head3 Lexicographic Optimization
6872 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
6873 the following functions
6874 compute a set that contains the lexicographic minimum or maximum
6875 of the elements in C<set> (or C<bset>) for those values of the parameters
6876 that satisfy C<dom>.
6877 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6878 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
6879 has no elements.
6880 In other words, the union of the parameter values
6881 for which the result is non-empty and of C<*empty>
6882 is equal to C<dom>.
6884         #include <isl/set.h>
6885         __isl_give isl_set *isl_basic_set_partial_lexmin(
6886                 __isl_take isl_basic_set *bset,
6887                 __isl_take isl_basic_set *dom,
6888                 __isl_give isl_set **empty);
6889         __isl_give isl_set *isl_basic_set_partial_lexmax(
6890                 __isl_take isl_basic_set *bset,
6891                 __isl_take isl_basic_set *dom,
6892                 __isl_give isl_set **empty);
6893         __isl_give isl_set *isl_set_partial_lexmin(
6894                 __isl_take isl_set *set, __isl_take isl_set *dom,
6895                 __isl_give isl_set **empty);
6896         __isl_give isl_set *isl_set_partial_lexmax(
6897                 __isl_take isl_set *set, __isl_take isl_set *dom,
6898                 __isl_give isl_set **empty);
6900 Given a (basic) set C<set> (or C<bset>), the following functions simply
6901 return a set containing the lexicographic minimum or maximum
6902 of the elements in C<set> (or C<bset>).
6903 In case of union sets, the optimum is computed per space.
6905         #include <isl/set.h>
6906         __isl_give isl_set *isl_basic_set_lexmin(
6907                 __isl_take isl_basic_set *bset);
6908         __isl_give isl_set *isl_basic_set_lexmax(
6909                 __isl_take isl_basic_set *bset);
6910         __isl_give isl_set *isl_set_lexmin(
6911                 __isl_take isl_set *set);
6912         __isl_give isl_set *isl_set_lexmax(
6913                 __isl_take isl_set *set);
6914         __isl_give isl_union_set *isl_union_set_lexmin(
6915                 __isl_take isl_union_set *uset);
6916         __isl_give isl_union_set *isl_union_set_lexmax(
6917                 __isl_take isl_union_set *uset);
6919 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
6920 the following functions
6921 compute a relation that maps each element of C<dom>
6922 to the single lexicographic minimum or maximum
6923 of the elements that are associated to that same
6924 element in C<map> (or C<bmap>).
6925 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6926 that contains the elements in C<dom> that do not map
6927 to any elements in C<map> (or C<bmap>).
6928 In other words, the union of the domain of the result and of C<*empty>
6929 is equal to C<dom>.
6931         #include <isl/map.h>
6932         __isl_give isl_map *isl_basic_map_partial_lexmax(
6933                 __isl_take isl_basic_map *bmap,
6934                 __isl_take isl_basic_set *dom,
6935                 __isl_give isl_set **empty);
6936         __isl_give isl_map *isl_basic_map_partial_lexmin(
6937                 __isl_take isl_basic_map *bmap,
6938                 __isl_take isl_basic_set *dom,
6939                 __isl_give isl_set **empty);
6940         __isl_give isl_map *isl_map_partial_lexmax(
6941                 __isl_take isl_map *map, __isl_take isl_set *dom,
6942                 __isl_give isl_set **empty);
6943         __isl_give isl_map *isl_map_partial_lexmin(
6944                 __isl_take isl_map *map, __isl_take isl_set *dom,
6945                 __isl_give isl_set **empty);
6947 Given a (basic) map C<map> (or C<bmap>), the following functions simply
6948 return a map mapping each element in the domain of
6949 C<map> (or C<bmap>) to the lexicographic minimum or maximum
6950 of all elements associated to that element.
6951 In case of union relations, the optimum is computed per space.
6953         #include <isl/map.h>
6954         __isl_give isl_map *isl_basic_map_lexmin(
6955                 __isl_take isl_basic_map *bmap);
6956         __isl_give isl_map *isl_basic_map_lexmax(
6957                 __isl_take isl_basic_map *bmap);
6958         __isl_give isl_map *isl_map_lexmin(
6959                 __isl_take isl_map *map);
6960         __isl_give isl_map *isl_map_lexmax(
6961                 __isl_take isl_map *map);
6962         __isl_give isl_union_map *isl_union_map_lexmin(
6963                 __isl_take isl_union_map *umap);
6964         __isl_give isl_union_map *isl_union_map_lexmax(
6965                 __isl_take isl_union_map *umap);
6967 The following functions return their result in the form of
6968 a piecewise multi-affine expression,
6969 but are otherwise equivalent to the corresponding functions
6970 returning a basic set or relation.
6972         #include <isl/set.h>
6973         __isl_give isl_pw_multi_aff *
6974         isl_basic_set_partial_lexmin_pw_multi_aff(
6975                 __isl_take isl_basic_set *bset,
6976                 __isl_take isl_basic_set *dom,
6977                 __isl_give isl_set **empty);
6978         __isl_give isl_pw_multi_aff *
6979         isl_basic_set_partial_lexmax_pw_multi_aff(
6980                 __isl_take isl_basic_set *bset,
6981                 __isl_take isl_basic_set *dom,
6982                 __isl_give isl_set **empty);
6983         __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
6984                 __isl_take isl_set *set);
6985         __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
6986                 __isl_take isl_set *set);
6988         #include <isl/map.h>
6989         __isl_give isl_pw_multi_aff *
6990         isl_basic_map_lexmin_pw_multi_aff(
6991                 __isl_take isl_basic_map *bmap);
6992         __isl_give isl_pw_multi_aff *
6993         isl_basic_map_partial_lexmin_pw_multi_aff(
6994                 __isl_take isl_basic_map *bmap,
6995                 __isl_take isl_basic_set *dom,
6996                 __isl_give isl_set **empty);
6997         __isl_give isl_pw_multi_aff *
6998         isl_basic_map_partial_lexmax_pw_multi_aff(
6999                 __isl_take isl_basic_map *bmap,
7000                 __isl_take isl_basic_set *dom,
7001                 __isl_give isl_set **empty);
7002         __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
7003                 __isl_take isl_map *map);
7004         __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
7005                 __isl_take isl_map *map);
7007 The following functions return the lexicographic minimum or maximum
7008 on the shared domain of the inputs and the single defined function
7009 on those parts of the domain where only a single function is defined.
7011         #include <isl/aff.h>
7012         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
7013                 __isl_take isl_pw_multi_aff *pma1,
7014                 __isl_take isl_pw_multi_aff *pma2);
7015         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
7016                 __isl_take isl_pw_multi_aff *pma1,
7017                 __isl_take isl_pw_multi_aff *pma2);
7019 =head2 Ternary Operations
7021         #include <isl/aff.h>
7022         __isl_give isl_pw_aff *isl_pw_aff_cond(
7023                 __isl_take isl_pw_aff *cond,
7024                 __isl_take isl_pw_aff *pwaff_true,
7025                 __isl_take isl_pw_aff *pwaff_false);
7027 The function C<isl_pw_aff_cond> performs a conditional operator
7028 and returns an expression that is equal to C<pwaff_true>
7029 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
7030 where C<cond> is zero.
7032 =head2 Lists
7034 Lists are defined over several element types, including
7035 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_union_pw_aff>,
7036 C<isl_union_pw_multi_aff>, C<isl_constraint>,
7037 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
7038 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
7039 Here we take lists of C<isl_set>s as an example.
7040 Lists can be created, copied, modified and freed using the following functions.
7042         #include <isl/set.h>
7043         __isl_give isl_set_list *isl_set_list_from_set(
7044                 __isl_take isl_set *el);
7045         __isl_give isl_set_list *isl_set_list_alloc(
7046                 isl_ctx *ctx, int n);
7047         __isl_give isl_set_list *isl_set_list_copy(
7048                 __isl_keep isl_set_list *list);
7049         __isl_give isl_set_list *isl_set_list_insert(
7050                 __isl_take isl_set_list *list, unsigned pos,
7051                 __isl_take isl_set *el);
7052         __isl_give isl_set_list *isl_set_list_add(
7053                 __isl_take isl_set_list *list,
7054                 __isl_take isl_set *el);
7055         __isl_give isl_set_list *isl_set_list_drop(
7056                 __isl_take isl_set_list *list,
7057                 unsigned first, unsigned n);
7058         __isl_give isl_set_list *isl_set_list_set_set(
7059                 __isl_take isl_set_list *list, int index,
7060                 __isl_take isl_set *set);
7061         __isl_give isl_set_list *isl_set_list_concat(
7062                 __isl_take isl_set_list *list1,
7063                 __isl_take isl_set_list *list2);
7064         __isl_give isl_set_list *isl_set_list_sort(
7065                 __isl_take isl_set_list *list,
7066                 int (*cmp)(__isl_keep isl_set *a,
7067                         __isl_keep isl_set *b, void *user),
7068                 void *user);
7069         __isl_null isl_set_list *isl_set_list_free(
7070                 __isl_take isl_set_list *list);
7072 C<isl_set_list_alloc> creates an empty list with an initial capacity
7073 for C<n> elements.  C<isl_set_list_insert> and C<isl_set_list_add>
7074 add elements to a list, increasing its capacity as needed.
7075 C<isl_set_list_from_set> creates a list with a single element.
7077 Lists can be inspected using the following functions.
7079         #include <isl/set.h>
7080         int isl_set_list_n_set(__isl_keep isl_set_list *list);
7081         __isl_give isl_set *isl_set_list_get_set(
7082                 __isl_keep isl_set_list *list, int index);
7083         isl_stat isl_set_list_foreach(__isl_keep isl_set_list *list,
7084                 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7085                 void *user);
7086         isl_stat isl_set_list_foreach_scc(
7087                 __isl_keep isl_set_list *list,
7088                 isl_bool (*follows)(__isl_keep isl_set *a,
7089                         __isl_keep isl_set *b, void *user),
7090                 void *follows_user
7091                 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7092                 void *fn_user);
7094 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
7095 strongly connected components of the graph with as vertices the elements
7096 of C<list> and a directed edge from vertex C<b> to vertex C<a>
7097 iff C<follows(a, b)> returns C<1>.  The callbacks C<follows> and C<fn>
7098 should return C<-1> on error.
7100 Lists can be printed using
7102         #include <isl/set.h>
7103         __isl_give isl_printer *isl_printer_print_set_list(
7104                 __isl_take isl_printer *p,
7105                 __isl_keep isl_set_list *list);
7107 =head2 Associative arrays
7109 Associative arrays map isl objects of a specific type to isl objects
7110 of some (other) specific type.  They are defined for several pairs
7111 of types, including (C<isl_map>, C<isl_basic_set>),
7112 (C<isl_id>, C<isl_ast_expr>) and.
7113 (C<isl_id>, C<isl_pw_aff>).
7114 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
7115 as an example.
7117 Associative arrays can be created, copied and freed using
7118 the following functions.
7120         #include <isl/id_to_ast_expr.h>
7121         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
7122                 isl_ctx *ctx, int min_size);
7123         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
7124                 __isl_keep isl_id_to_ast_expr *id2expr);
7125         __isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
7126                 __isl_take isl_id_to_ast_expr *id2expr);
7128 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
7129 to specify the expected size of the associative array.
7130 The associative array will be grown automatically as needed.
7132 Associative arrays can be inspected using the following functions.
7134         #include <isl/id_to_ast_expr.h>
7135         isl_bool isl_id_to_ast_expr_has(
7136                 __isl_keep isl_id_to_ast_expr *id2expr,
7137                 __isl_keep isl_id *key);
7138         __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
7139                 __isl_keep isl_id_to_ast_expr *id2expr,
7140                 __isl_take isl_id *key);
7141         isl_stat isl_id_to_ast_expr_foreach(
7142                 __isl_keep isl_id_to_ast_expr *id2expr,
7143                 isl_stat (*fn)(__isl_take isl_id *key,
7144                         __isl_take isl_ast_expr *val, void *user),
7145                 void *user);
7147 They can be modified using the following function.
7149         #include <isl/id_to_ast_expr.h>
7150         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
7151                 __isl_take isl_id_to_ast_expr *id2expr,
7152                 __isl_take isl_id *key,
7153                 __isl_take isl_ast_expr *val);
7154         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
7155                 __isl_take isl_id_to_ast_expr *id2expr,
7156                 __isl_take isl_id *key);
7158 Associative arrays can be printed using the following function.
7160         #include <isl/id_to_ast_expr.h>
7161         __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
7162                 __isl_take isl_printer *p,
7163                 __isl_keep isl_id_to_ast_expr *id2expr);
7165 =head2 Vectors
7167 Vectors can be created, copied and freed using the following functions.
7169         #include <isl/vec.h>
7170         __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
7171                 unsigned size);
7172         __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
7173         __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
7175 Note that the elements of a newly created vector may have arbitrary values.
7176 The elements can be changed and inspected using the following functions.
7178         int isl_vec_size(__isl_keep isl_vec *vec);
7179         __isl_give isl_val *isl_vec_get_element_val(
7180                 __isl_keep isl_vec *vec, int pos);
7181         __isl_give isl_vec *isl_vec_set_element_si(
7182                 __isl_take isl_vec *vec, int pos, int v);
7183         __isl_give isl_vec *isl_vec_set_element_val(
7184                 __isl_take isl_vec *vec, int pos,
7185                 __isl_take isl_val *v);
7186         __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
7187                 int v);
7188         __isl_give isl_vec *isl_vec_set_val(
7189                 __isl_take isl_vec *vec, __isl_take isl_val *v);
7190         int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
7191                 __isl_keep isl_vec *vec2, int pos);
7193 C<isl_vec_get_element> will return a negative value if anything went wrong.
7194 In that case, the value of C<*v> is undefined.
7196 The following function can be used to concatenate two vectors.
7198         __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
7199                 __isl_take isl_vec *vec2);
7201 =head2 Matrices
7203 Matrices can be created, copied and freed using the following functions.
7205         #include <isl/mat.h>
7206         __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
7207                 unsigned n_row, unsigned n_col);
7208         __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
7209         __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
7211 Note that the elements of a newly created matrix may have arbitrary values.
7212 The elements can be changed and inspected using the following functions.
7214         int isl_mat_rows(__isl_keep isl_mat *mat);
7215         int isl_mat_cols(__isl_keep isl_mat *mat);
7216         __isl_give isl_val *isl_mat_get_element_val(
7217                 __isl_keep isl_mat *mat, int row, int col);
7218         __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
7219                 int row, int col, int v);
7220         __isl_give isl_mat *isl_mat_set_element_val(
7221                 __isl_take isl_mat *mat, int row, int col,
7222                 __isl_take isl_val *v);
7224 C<isl_mat_get_element> will return a negative value if anything went wrong.
7225 In that case, the value of C<*v> is undefined.
7227 The following function can be used to compute the (right) inverse
7228 of a matrix, i.e., a matrix such that the product of the original
7229 and the inverse (in that order) is a multiple of the identity matrix.
7230 The input matrix is assumed to be of full row-rank.
7232         __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
7234 The following function can be used to compute the (right) kernel
7235 (or null space) of a matrix, i.e., a matrix such that the product of
7236 the original and the kernel (in that order) is the zero matrix.
7238         __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
7240 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
7242 The following functions determine
7243 an upper or lower bound on a quasipolynomial over its domain.
7245         __isl_give isl_pw_qpolynomial_fold *
7246         isl_pw_qpolynomial_bound(
7247                 __isl_take isl_pw_qpolynomial *pwqp,
7248                 enum isl_fold type, int *tight);
7250         __isl_give isl_union_pw_qpolynomial_fold *
7251         isl_union_pw_qpolynomial_bound(
7252                 __isl_take isl_union_pw_qpolynomial *upwqp,
7253                 enum isl_fold type, int *tight);
7255 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
7256 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
7257 is the returned bound is known be tight, i.e., for each value
7258 of the parameters there is at least
7259 one element in the domain that reaches the bound.
7260 If the domain of C<pwqp> is not wrapping, then the bound is computed
7261 over all elements in that domain and the result has a purely parametric
7262 domain.  If the domain of C<pwqp> is wrapping, then the bound is
7263 computed over the range of the wrapped relation.  The domain of the
7264 wrapped relation becomes the domain of the result.
7266 =head2 Parametric Vertex Enumeration
7268 The parametric vertex enumeration described in this section
7269 is mainly intended to be used internally and by the C<barvinok>
7270 library.
7272         #include <isl/vertices.h>
7273         __isl_give isl_vertices *isl_basic_set_compute_vertices(
7274                 __isl_keep isl_basic_set *bset);
7276 The function C<isl_basic_set_compute_vertices> performs the
7277 actual computation of the parametric vertices and the chamber
7278 decomposition and store the result in an C<isl_vertices> object.
7279 This information can be queried by either iterating over all
7280 the vertices or iterating over all the chambers or cells
7281 and then iterating over all vertices that are active on the chamber.
7283         isl_stat isl_vertices_foreach_vertex(
7284                 __isl_keep isl_vertices *vertices,
7285                 isl_stat (*fn)(__isl_take isl_vertex *vertex,
7286                         void *user), void *user);
7288         isl_stat isl_vertices_foreach_cell(
7289                 __isl_keep isl_vertices *vertices,
7290                 isl_stat (*fn)(__isl_take isl_cell *cell,
7291                         void *user), void *user);
7292         isl_stat isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
7293                 isl_stat (*fn)(__isl_take isl_vertex *vertex,
7294                         void *user), void *user);
7296 Other operations that can be performed on an C<isl_vertices> object are
7297 the following.
7299         int isl_vertices_get_n_vertices(
7300                 __isl_keep isl_vertices *vertices);
7301         void isl_vertices_free(__isl_take isl_vertices *vertices);
7303 Vertices can be inspected and destroyed using the following functions.
7305         int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
7306         __isl_give isl_basic_set *isl_vertex_get_domain(
7307                 __isl_keep isl_vertex *vertex);
7308         __isl_give isl_multi_aff *isl_vertex_get_expr(
7309                 __isl_keep isl_vertex *vertex);
7310         void isl_vertex_free(__isl_take isl_vertex *vertex);
7312 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
7313 describing the vertex in terms of the parameters,
7314 while C<isl_vertex_get_domain> returns the activity domain
7315 of the vertex.
7317 Chambers can be inspected and destroyed using the following functions.
7319         __isl_give isl_basic_set *isl_cell_get_domain(
7320                 __isl_keep isl_cell *cell);
7321         void isl_cell_free(__isl_take isl_cell *cell);
7323 =head1 Polyhedral Compilation Library
7325 This section collects functionality in C<isl> that has been specifically
7326 designed for use during polyhedral compilation.
7328 =head2 Schedule Trees
7330 A schedule tree is a structured representation of a schedule,
7331 assigning a relative order to a set of domain elements.
7332 The relative order expressed by the schedule tree is
7333 defined recursively.  In particular, the order between
7334 two domain elements is determined by the node that is closest
7335 to the root that refers to both elements and that orders them apart.
7336 Each node in the tree is of one of several types.
7337 The root node is always of type C<isl_schedule_node_domain>
7338 (or C<isl_schedule_node_extension>)
7339 and it describes the (extra) domain elements to which the schedule applies.
7340 The other types of nodes are as follows.
7342 =over
7344 =item C<isl_schedule_node_band>
7346 A band of schedule dimensions.  Each schedule dimension is represented
7347 by a union piecewise quasi-affine expression.  If this expression
7348 assigns a different value to two domain elements, while all previous
7349 schedule dimensions in the same band assign them the same value,
7350 then the two domain elements are ordered according to these two
7351 different values.
7353 =item C<isl_schedule_node_expansion>
7355 An expansion node maps each of the domain elements that reach the node
7356 to one or more domain elements.  The image of this mapping forms
7357 the set of domain elements that reach the child of the expansion node.
7358 The function that maps each of the expanded domain elements
7359 to the original domain element from which it was expanded
7360 is called the contraction.
7362 =item C<isl_schedule_node_filter>
7364 A filter node does not impose any ordering, but rather intersects
7365 the set of domain elements that the current subtree refers to
7366 with a given union set.  The subtree of the filter node only
7367 refers to domain elements in the intersection.
7368 A filter node is typically only used a child of a sequence or
7369 set node.
7371 =item C<isl_schedule_node_leaf>
7373 A leaf of the schedule tree.  Leaf nodes do not impose any ordering.
7375 =item C<isl_schedule_node_mark>
7377 A mark node can be used to attach any kind of information to a subtree
7378 of the schedule tree.
7380 =item C<isl_schedule_node_sequence>
7382 A sequence node has one or more children, each of which is a filter node.
7383 The filters on these filter nodes form a partition of
7384 the domain elements that the current subtree refers to.
7385 If two domain elements appear in distinct filters then the sequence
7386 node orders them according to the child positions of the corresponding
7387 filter nodes.
7389 =item C<isl_schedule_node_set>
7391 A set node is similar to a sequence node, except that
7392 it expresses that domain elements appearing in distinct filters
7393 may have any order.  The order of the children of a set node
7394 is therefore also immaterial.
7396 =back
7398 The following node types are only supported by the AST generator.
7400 =over
7402 =item C<isl_schedule_node_context>
7404 The context describes constraints on the parameters and
7405 the schedule dimensions of outer
7406 bands that the AST generator may assume to hold.  It is also the only
7407 kind of node that may introduce additional parameters.
7408 The space of the context is that of the flat product of the outer
7409 band nodes.  In particular, if there are no outer band nodes, then
7410 this space is the unnamed zero-dimensional space.
7411 Since a context node references the outer band nodes, any tree
7412 containing a context node is considered to be anchored.
7414 =item C<isl_schedule_node_extension>
7416 An extension node instructs the AST generator to add additional
7417 domain elements that need to be scheduled.
7418 The additional domain elements are described by the range of
7419 the extension map in terms of the outer schedule dimensions,
7420 i.e., the flat product of the outer band nodes.
7421 Note that domain elements are added whenever the AST generator
7422 reaches the extension node, meaning that there are still some
7423 active domain elements for which an AST needs to be generated.
7424 The conditions under which some domain elements are still active
7425 may however not be completely described by the outer AST nodes
7426 generated at that point.
7428 An extension node may also appear as the root of a schedule tree,
7429 when it is intended to be inserted into another tree
7430 using C<isl_schedule_node_graft_before> or C<isl_schedule_node_graft_after>.
7431 In this case, the domain of the extension node should
7432 correspond to the flat product of the outer band nodes
7433 in this other schedule tree at the point where the extension tree
7434 will be inserted.
7436 =item C<isl_schedule_node_guard>
7438 The guard describes constraints on the parameters and
7439 the schedule dimensions of outer
7440 bands that need to be enforced by the outer nodes
7441 in the generated AST.
7442 The space of the guard is that of the flat product of the outer
7443 band nodes.  In particular, if there are no outer band nodes, then
7444 this space is the unnamed zero-dimensional space.
7445 Since a guard node references the outer band nodes, any tree
7446 containing a guard node is considered to be anchored.
7448 =back
7450 Except for the C<isl_schedule_node_context> nodes,
7451 none of the nodes may introduce any parameters that were not
7452 already present in the root domain node.
7454 A schedule tree is encapsulated in an C<isl_schedule> object.
7455 The simplest such objects, those with a tree consisting of single domain node,
7456 can be created using the following functions with either an empty
7457 domain or a given domain.
7459         #include <isl/schedule.h>
7460         __isl_give isl_schedule *isl_schedule_empty(
7461                 __isl_take isl_space *space);
7462         __isl_give isl_schedule *isl_schedule_from_domain(
7463                 __isl_take isl_union_set *domain);
7465 The function C<isl_schedule_constraints_compute_schedule> described
7466 in L</"Scheduling"> can also be used to construct schedules.
7468 C<isl_schedule> objects may be copied and freed using the following functions.
7470         #include <isl/schedule.h>
7471         __isl_give isl_schedule *isl_schedule_copy(
7472                 __isl_keep isl_schedule *sched);
7473         __isl_null isl_schedule *isl_schedule_free(
7474                 __isl_take isl_schedule *sched);
7476 The following functions checks whether two C<isl_schedule> objects
7477 are obviously the same.
7479         #include <isl/schedule.h>
7480         isl_bool isl_schedule_plain_is_equal(
7481                 __isl_keep isl_schedule *schedule1,
7482                 __isl_keep isl_schedule *schedule2);
7484 The domain of the schedule, i.e., the domain described by the root node,
7485 can be obtained using the following function.
7487         #include <isl/schedule.h>
7488         __isl_give isl_union_set *isl_schedule_get_domain(
7489                 __isl_keep isl_schedule *schedule);
7491 An extra top-level band node (right underneath the domain node) can
7492 be introduced into the schedule using the following function.
7493 The schedule tree is assumed not to have any anchored nodes.
7495         #include <isl/schedule.h>
7496         __isl_give isl_schedule *
7497         isl_schedule_insert_partial_schedule(
7498                 __isl_take isl_schedule *schedule,
7499                 __isl_take isl_multi_union_pw_aff *partial);
7501 A top-level context node (right underneath the domain node) can
7502 be introduced into the schedule using the following function.
7504         #include <isl/schedule.h>
7505         __isl_give isl_schedule *isl_schedule_insert_context(
7506                 __isl_take isl_schedule *schedule,
7507                 __isl_take isl_set *context)
7509 A top-level guard node (right underneath the domain node) can
7510 be introduced into the schedule using the following function.
7512         #include <isl/schedule.h>
7513         __isl_give isl_schedule *isl_schedule_insert_guard(
7514                 __isl_take isl_schedule *schedule,
7515                 __isl_take isl_set *guard)
7517 A schedule that combines two schedules either in the given
7518 order or in an arbitrary order, i.e., with an C<isl_schedule_node_sequence>
7519 or an C<isl_schedule_node_set> node,
7520 can be created using the following functions.
7522         #include <isl/schedule.h>
7523         __isl_give isl_schedule *isl_schedule_sequence(
7524                 __isl_take isl_schedule *schedule1,
7525                 __isl_take isl_schedule *schedule2);
7526         __isl_give isl_schedule *isl_schedule_set(
7527                 __isl_take isl_schedule *schedule1,
7528                 __isl_take isl_schedule *schedule2);
7530 The domains of the two input schedules need to be disjoint.
7532 The following function can be used to restrict the domain
7533 of a schedule with a domain node as root to be a subset of the given union set.
7534 This operation may remove nodes in the tree that have become
7535 redundant.
7537         #include <isl/schedule.h>
7538         __isl_give isl_schedule *isl_schedule_intersect_domain(
7539                 __isl_take isl_schedule *schedule,
7540                 __isl_take isl_union_set *domain);
7542 The following function resets the user pointers on all parameter
7543 and tuple identifiers referenced by the nodes of the given schedule.
7545         #include <isl/schedule.h>
7546         __isl_give isl_schedule *isl_schedule_reset_user(
7547                 __isl_take isl_schedule *schedule);
7549 The following function aligns the parameters of all nodes
7550 in the given schedule to the given space.
7552         #include <isl/schedule.h>
7553         __isl_give isl_schedule *isl_schedule_align_params(
7554                 __isl_take isl_schedule *schedule,
7555                 __isl_take isl_space *space);
7557 The following function allows the user to plug in a given function
7558 in the iteration domains.  The input schedule is not allowed to contain
7559 any expansion nodes.
7561         #include <isl/schedule.h>
7562         __isl_give isl_schedule *
7563         isl_schedule_pullback_union_pw_multi_aff(
7564                 __isl_take isl_schedule *schedule,
7565                 __isl_take isl_union_pw_multi_aff *upma);
7567 An C<isl_union_map> representation of the schedule can be obtained
7568 from an C<isl_schedule> using the following function.
7570         #include <isl/schedule.h>
7571         __isl_give isl_union_map *isl_schedule_get_map(
7572                 __isl_keep isl_schedule *sched);
7574 The resulting relation encodes the same relative ordering as
7575 the schedule by mapping the domain elements to a common schedule space.
7576 If the schedule_separate_components option is set, then the order
7577 of the children of a set node is explicitly encoded in the result.
7578 If the tree contains any expansion nodes, then the relation
7579 is formulated in terms of the expanded domain elements.
7581 Schedules can be read from input using the following functions.
7583         #include <isl/schedule.h>
7584         __isl_give isl_schedule *isl_schedule_read_from_file(
7585                 isl_ctx *ctx, FILE *input);
7586         __isl_give isl_schedule *isl_schedule_read_from_str(
7587                 isl_ctx *ctx, const char *str);
7589 A representation of the schedule can be printed using
7591         #include <isl/schedule.h>
7592         __isl_give isl_printer *isl_printer_print_schedule(
7593                 __isl_take isl_printer *p,
7594                 __isl_keep isl_schedule *schedule);
7596 The schedule tree can be traversed through the use of
7597 C<isl_schedule_node> objects that point to a particular
7598 position in the schedule tree.  Whenever a C<isl_schedule_node>
7599 is use to modify a node in the schedule tree, the original schedule
7600 tree is left untouched and the modifications are performed to a copy
7601 of the tree.  The returned C<isl_schedule_node> then points to
7602 this modified copy of the tree.
7604 The root of the schedule tree can be obtained using the following function.
7606         #include <isl/schedule.h>
7607         __isl_give isl_schedule_node *isl_schedule_get_root(
7608                 __isl_keep isl_schedule *schedule);
7610 A pointer to a newly created schedule tree with a single domain
7611 node can be created using the following functions.
7613         #include <isl/schedule_node.h>
7614         __isl_give isl_schedule_node *
7615         isl_schedule_node_from_domain(
7616                 __isl_take isl_union_set *domain);
7617         __isl_give isl_schedule_node *
7618         isl_schedule_node_from_extension(
7619                 __isl_take isl_union_map *extension);
7621 C<isl_schedule_node_from_extension> creates a tree with an extension
7622 node as root.
7624 Schedule nodes can be copied and freed using the following functions.
7626         #include <isl/schedule_node.h>
7627         __isl_give isl_schedule_node *isl_schedule_node_copy(
7628                 __isl_keep isl_schedule_node *node);
7629         __isl_null isl_schedule_node *isl_schedule_node_free(
7630                 __isl_take isl_schedule_node *node);
7632 The following functions can be used to check if two schedule
7633 nodes point to the same position in the same schedule.
7635         #include <isl/schedule_node.h>
7636         isl_bool isl_schedule_node_is_equal(
7637                 __isl_keep isl_schedule_node *node1,
7638                 __isl_keep isl_schedule_node *node2);
7640 The following properties can be obtained from a schedule node.
7642         #include <isl/schedule_node.h>
7643         enum isl_schedule_node_type isl_schedule_node_get_type(
7644                 __isl_keep isl_schedule_node *node);
7645         enum isl_schedule_node_type
7646         isl_schedule_node_get_parent_type(
7647                 __isl_keep isl_schedule_node *node);
7648         __isl_give isl_schedule *isl_schedule_node_get_schedule(
7649                 __isl_keep isl_schedule_node *node);
7651 The function C<isl_schedule_node_get_type> returns the type of
7652 the node, while C<isl_schedule_node_get_parent_type> returns
7653 type of the parent of the node, which is required to exist.
7654 The function C<isl_schedule_node_get_schedule> returns a copy
7655 to the schedule to which the node belongs.
7657 The following functions can be used to move the schedule node
7658 to a different position in the tree or to check if such a position
7659 exists.
7661         #include <isl/schedule_node.h>
7662         isl_bool isl_schedule_node_has_parent(
7663                 __isl_keep isl_schedule_node *node);
7664         __isl_give isl_schedule_node *isl_schedule_node_parent(
7665                 __isl_take isl_schedule_node *node);
7666         __isl_give isl_schedule_node *isl_schedule_node_root(
7667                 __isl_take isl_schedule_node *node);
7668         __isl_give isl_schedule_node *isl_schedule_node_ancestor(
7669                 __isl_take isl_schedule_node *node,
7670                 int generation);
7671         int isl_schedule_node_n_children(
7672                 __isl_keep isl_schedule_node *node);
7673         __isl_give isl_schedule_node *isl_schedule_node_child(
7674                 __isl_take isl_schedule_node *node, int pos);
7675         isl_bool isl_schedule_node_has_children(
7676                 __isl_keep isl_schedule_node *node);
7677         __isl_give isl_schedule_node *isl_schedule_node_first_child(
7678                 __isl_take isl_schedule_node *node);
7679         isl_bool isl_schedule_node_has_previous_sibling(
7680                 __isl_keep isl_schedule_node *node);
7681         __isl_give isl_schedule_node *
7682         isl_schedule_node_previous_sibling(
7683                 __isl_take isl_schedule_node *node);
7684         isl_bool isl_schedule_node_has_next_sibling(
7685                 __isl_keep isl_schedule_node *node);
7686         __isl_give isl_schedule_node *
7687         isl_schedule_node_next_sibling(
7688                 __isl_take isl_schedule_node *node);
7690 For C<isl_schedule_node_ancestor>, the ancestor of generation 0
7691 is the node itself, the ancestor of generation 1 is its parent and so on.
7693 It is also possible to query the number of ancestors of a node,
7694 the position of the current node
7695 within the children of its parent, the position of the subtree
7696 containing a node within the children of an ancestor
7697 or to obtain a copy of a given
7698 child without destroying the current node.
7699 Given two nodes that point to the same schedule, their closest
7700 shared ancestor can be obtained using
7701 C<isl_schedule_node_get_shared_ancestor>.
7703         #include <isl/schedule_node.h>
7704         int isl_schedule_node_get_tree_depth(
7705                 __isl_keep isl_schedule_node *node);
7706         int isl_schedule_node_get_child_position(
7707                 __isl_keep isl_schedule_node *node);
7708         int isl_schedule_node_get_ancestor_child_position(
7709                 __isl_keep isl_schedule_node *node,
7710                 __isl_keep isl_schedule_node *ancestor);
7711         __isl_give isl_schedule_node *isl_schedule_node_get_child(
7712                 __isl_keep isl_schedule_node *node, int pos);
7713         __isl_give isl_schedule_node *
7714         isl_schedule_node_get_shared_ancestor(
7715                 __isl_keep isl_schedule_node *node1,
7716                 __isl_keep isl_schedule_node *node2);
7718 All nodes in a schedule tree or
7719 all descendants of a specific node (including the node) can be visited
7720 in depth-first pre-order using the following functions.
7722         #include <isl/schedule.h>
7723         isl_stat isl_schedule_foreach_schedule_node_top_down(
7724                 __isl_keep isl_schedule *sched,
7725                 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
7726                         void *user), void *user);
7728         #include <isl/schedule_node.h>
7729         isl_stat isl_schedule_node_foreach_descendant_top_down(
7730                 __isl_keep isl_schedule_node *node,
7731                 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
7732                         void *user), void *user);
7734 The callback function is slightly different from the usual
7735 callbacks in that it not only indicates success (non-negative result)
7736 or failure (negative result), but also indicates whether the children
7737 of the given node should be visited.  In particular, if the callback
7738 returns a positive value, then the children are visited, but if
7739 the callback returns zero, then the children are not visited.
7741 The ancestors of a node in a schedule tree can be visited from
7742 the root down to and including the parent of the node using
7743 the following function.
7745         #include <isl/schedule_node.h>
7746         isl_stat isl_schedule_node_foreach_ancestor_top_down(
7747                 __isl_keep isl_schedule_node *node,
7748                 isl_stat (*fn)(__isl_keep isl_schedule_node *node,
7749                         void *user), void *user);
7751 The following functions allows for a depth-first post-order
7752 traversal of the nodes in a schedule tree or
7753 of the descendants of a specific node (including the node
7754 itself), where the user callback is allowed to modify the
7755 visited node.
7757         #include <isl/schedule.h>
7758         __isl_give isl_schedule *
7759         isl_schedule_map_schedule_node_bottom_up(
7760                 __isl_take isl_schedule *schedule,
7761                 __isl_give isl_schedule_node *(*fn)(
7762                         __isl_take isl_schedule_node *node,
7763                         void *user), void *user);
7765         #include <isl/schedule_node.h>
7766         __isl_give isl_schedule_node *
7767         isl_schedule_node_map_descendant_bottom_up(
7768                 __isl_take isl_schedule_node *node,
7769                 __isl_give isl_schedule_node *(*fn)(
7770                         __isl_take isl_schedule_node *node,
7771                         void *user), void *user);
7773 The traversal continues from the node returned by the callback function.
7774 It is the responsibility of the user to ensure that this does not
7775 lead to an infinite loop.  It is safest to always return a pointer
7776 to the same position (same ancestors and child positions) as the input node.
7778 The following function removes a node (along with its descendants)
7779 from a schedule tree and returns a pointer to the leaf at the
7780 same position in the updated tree.
7781 It is not allowed to remove the root of a schedule tree or
7782 a child of a set or sequence node.
7784         #include <isl/schedule_node.h>
7785         __isl_give isl_schedule_node *isl_schedule_node_cut(
7786                 __isl_take isl_schedule_node *node);
7788 The following function removes a single node
7789 from a schedule tree and returns a pointer to the child
7790 of the node, now located at the position of the original node
7791 or to a leaf node at that position if there was no child.
7792 It is not allowed to remove the root of a schedule tree,
7793 a set or sequence node, a child of a set or sequence node or
7794 a band node with an anchored subtree.
7796         #include <isl/schedule_node.h>
7797         __isl_give isl_schedule_node *isl_schedule_node_delete(
7798                 __isl_take isl_schedule_node *node);
7800 Most nodes in a schedule tree only contain local information.
7801 In some cases, however, a node may also refer to outer band nodes.
7802 This means that the position of the node within the tree should
7803 not be changed, or at least that no changes are performed to the
7804 outer band nodes.  The following function can be used to test
7805 whether the subtree rooted at a given node contains any such nodes.
7807         #include <isl/schedule_node.h>
7808         isl_bool isl_schedule_node_is_subtree_anchored(
7809                 __isl_keep isl_schedule_node *node);
7811 The following function resets the user pointers on all parameter
7812 and tuple identifiers referenced by the given schedule node.
7814         #include <isl/schedule_node.h>
7815         __isl_give isl_schedule_node *isl_schedule_node_reset_user(
7816                 __isl_take isl_schedule_node *node);
7818 The following function aligns the parameters of the given schedule
7819 node to the given space.
7821         #include <isl/schedule_node.h>
7822         __isl_give isl_schedule_node *
7823         isl_schedule_node_align_params(
7824                 __isl_take isl_schedule_node *node,
7825                 __isl_take isl_space *space);
7827 Several node types have their own functions for querying
7828 (and in some cases setting) some node type specific properties.
7830         #include <isl/schedule_node.h>
7831         __isl_give isl_space *isl_schedule_node_band_get_space(
7832                 __isl_keep isl_schedule_node *node);
7833         __isl_give isl_multi_union_pw_aff *
7834         isl_schedule_node_band_get_partial_schedule(
7835                 __isl_keep isl_schedule_node *node);
7836         __isl_give isl_union_map *
7837         isl_schedule_node_band_get_partial_schedule_union_map(
7838                 __isl_keep isl_schedule_node *node);
7839         unsigned isl_schedule_node_band_n_member(
7840                 __isl_keep isl_schedule_node *node);
7841         isl_bool isl_schedule_node_band_member_get_coincident(
7842                 __isl_keep isl_schedule_node *node, int pos);
7843         __isl_give isl_schedule_node *
7844         isl_schedule_node_band_member_set_coincident(
7845                 __isl_take isl_schedule_node *node, int pos,
7846                 int coincident);
7847         isl_bool isl_schedule_node_band_get_permutable(
7848                 __isl_keep isl_schedule_node *node);
7849         __isl_give isl_schedule_node *
7850         isl_schedule_node_band_set_permutable(
7851                 __isl_take isl_schedule_node *node, int permutable);
7852         enum isl_ast_loop_type
7853         isl_schedule_node_band_member_get_ast_loop_type(
7854                 __isl_keep isl_schedule_node *node, int pos);
7855         __isl_give isl_schedule_node *
7856         isl_schedule_node_band_member_set_ast_loop_type(
7857                 __isl_take isl_schedule_node *node, int pos,
7858                 enum isl_ast_loop_type type);
7859         __isl_give isl_union_set *
7860         enum isl_ast_loop_type
7861         isl_schedule_node_band_member_get_isolate_ast_loop_type(
7862                 __isl_keep isl_schedule_node *node, int pos);
7863         __isl_give isl_schedule_node *
7864         isl_schedule_node_band_member_set_isolate_ast_loop_type(
7865                 __isl_take isl_schedule_node *node, int pos,
7866                 enum isl_ast_loop_type type);
7867         isl_schedule_node_band_get_ast_build_options(
7868                 __isl_keep isl_schedule_node *node);
7869         __isl_give isl_schedule_node *
7870         isl_schedule_node_band_set_ast_build_options(
7871                 __isl_take isl_schedule_node *node,
7872                 __isl_take isl_union_set *options);
7874 The function C<isl_schedule_node_band_get_space> returns the space
7875 of the partial schedule of the band.
7876 The function C<isl_schedule_node_band_get_partial_schedule_union_map>
7877 returns a representation of the partial schedule of the band node
7878 in the form of an C<isl_union_map>.
7879 The coincident and permutable properties are set by
7880 C<isl_schedule_constraints_compute_schedule> on the schedule tree
7881 it produces.
7882 A scheduling dimension is considered to be ``coincident''
7883 if it satisfies the coincidence constraints within its band.
7884 That is, if the dependence distances of the coincidence
7885 constraints are all zero in that direction (for fixed
7886 iterations of outer bands).
7887 A band is marked permutable if it was produced using the Pluto-like scheduler.
7888 Note that the scheduler may have to resort to a Feautrier style scheduling
7889 step even if the default scheduler is used.
7890 An C<isl_ast_loop_type> is one of C<isl_ast_loop_default>,
7891 C<isl_ast_loop_atomic>, C<isl_ast_loop_unroll> or C<isl_ast_loop_separate>.
7892 For the meaning of these loop AST generation types and the difference
7893 between the regular loop AST generation type and the isolate
7894 loop AST generation type, see L</"AST Generation Options (Schedule Tree)">.
7895 The functions C<isl_schedule_node_band_member_get_ast_loop_type>
7896 and C<isl_schedule_node_band_member_get_isolate_ast_loop_type>
7897 may return C<isl_ast_loop_error> if an error occurs.
7898 The AST build options govern how an AST is generated for
7899 the individual schedule dimensions during AST generation.
7900 See L</"AST Generation Options (Schedule Tree)">.
7902         #include <isl/schedule_node.h>
7903         __isl_give isl_set *
7904         isl_schedule_node_context_get_context(
7905                 __isl_keep isl_schedule_node *node);
7907         #include <isl/schedule_node.h>
7908         __isl_give isl_union_set *
7909         isl_schedule_node_domain_get_domain(
7910                 __isl_keep isl_schedule_node *node);
7912         #include <isl/schedule_node.h>
7913         __isl_give isl_union_map *
7914         isl_schedule_node_expansion_get_expansion(
7915                 __isl_keep isl_schedule_node *node);
7916         __isl_give isl_union_pw_multi_aff *
7917         isl_schedule_node_expansion_get_contraction(
7918                 __isl_keep isl_schedule_node *node);
7920         #include <isl/schedule_node.h>
7921         __isl_give isl_union_map *
7922         isl_schedule_node_extension_get_extension(
7923                 __isl_keep isl_schedule_node *node);
7925         #include <isl/schedule_node.h>
7926         __isl_give isl_union_set *
7927         isl_schedule_node_filter_get_filter(
7928                 __isl_keep isl_schedule_node *node);
7930         #include <isl/schedule_node.h>
7931         __isl_give isl_set *isl_schedule_node_guard_get_guard(
7932                 __isl_keep isl_schedule_node *node);
7934         #include <isl/schedule_node.h>
7935         __isl_give isl_id *isl_schedule_node_mark_get_id(
7936                 __isl_keep isl_schedule_node *node);
7938 The following functions can be used to obtain an C<isl_multi_union_pw_aff>,
7939 an C<isl_union_pw_multi_aff> or C<isl_union_map> representation of
7940 partial schedules related to the node.
7942         #include <isl/schedule_node.h>
7943         __isl_give isl_multi_union_pw_aff *
7944         isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(
7945                 __isl_keep isl_schedule_node *node);
7946         __isl_give isl_union_pw_multi_aff *
7947         isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(
7948                 __isl_keep isl_schedule_node *node);
7949         __isl_give isl_union_map *
7950         isl_schedule_node_get_prefix_schedule_union_map(
7951                 __isl_keep isl_schedule_node *node);
7952         __isl_give isl_union_map *
7953         isl_schedule_node_get_prefix_schedule_relation(
7954                 __isl_keep isl_schedule_node *node);
7955         __isl_give isl_union_map *
7956         isl_schedule_node_get_subtree_schedule_union_map(
7957                 __isl_keep isl_schedule_node *node);
7959 In particular, the functions
7960 C<isl_schedule_node_get_prefix_schedule_multi_union_pw_aff>,
7961 C<isl_schedule_node_get_prefix_schedule_union_pw_multi_aff>
7962 and C<isl_schedule_node_get_prefix_schedule_union_map>
7963 return a relative ordering on the domain elements that reach the given
7964 node determined by its ancestors.
7965 The function C<isl_schedule_node_get_prefix_schedule_relation>
7966 additionally includes the domain constraints in the result.
7967 The function C<isl_schedule_node_get_subtree_schedule_union_map>
7968 returns a representation of the partial schedule defined by the
7969 subtree rooted at the given node.
7970 If the tree contains any expansion nodes, then the subtree schedule
7971 is formulated in terms of the expanded domain elements.
7972 The tree passed to functions returning a prefix schedule
7973 may only contain extension nodes if these would not affect
7974 the result of these functions.  That is, if one of the ancestors
7975 is an extension node, then all of the domain elements that were
7976 added by the extension node need to have been filtered out
7977 by filter nodes between the extension node and the input node.
7978 The tree passed to C<isl_schedule_node_get_subtree_schedule_union_map>
7979 may not contain in extension nodes in the selected subtree.
7981 The expansion/contraction defined by an entire subtree, combining
7982 the expansions/contractions
7983 on the expansion nodes in the subtree, can be obtained using
7984 the following functions.
7986         #include <isl/schedule_node.h>
7987         __isl_give isl_union_map *
7988         isl_schedule_node_get_subtree_expansion(
7989                 __isl_keep isl_schedule_node *node);
7990         __isl_give isl_union_pw_multi_aff *
7991         isl_schedule_node_get_subtree_contraction(
7992                 __isl_keep isl_schedule_node *node);
7994 The total number of outer band members of given node, i.e.,
7995 the shared output dimension of the maps in the result
7996 of C<isl_schedule_node_get_prefix_schedule_union_map> can be obtained
7997 using the following function.
7999         #include <isl/schedule_node.h>
8000         int isl_schedule_node_get_schedule_depth(
8001                 __isl_keep isl_schedule_node *node);
8003 The following functions return the elements that reach the given node
8004 or the union of universes in the spaces that contain these elements.
8006         #include <isl/schedule_node.h>
8007         __isl_give isl_union_set *
8008         isl_schedule_node_get_domain(
8009                 __isl_keep isl_schedule_node *node);
8010         __isl_give isl_union_set *
8011         isl_schedule_node_get_universe_domain(
8012                 __isl_keep isl_schedule_node *node);
8014 The input tree of C<isl_schedule_node_get_domain>
8015 may only contain extension nodes if these would not affect
8016 the result of this function.  That is, if one of the ancestors
8017 is an extension node, then all of the domain elements that were
8018 added by the extension node need to have been filtered out
8019 by filter nodes between the extension node and the input node.
8021 The following functions can be used to introduce additional nodes
8022 in the schedule tree.  The new node is introduced at the point
8023 in the tree where the C<isl_schedule_node> points to and
8024 the results points to the new node.
8026         #include <isl/schedule_node.h>
8027         __isl_give isl_schedule_node *
8028         isl_schedule_node_insert_partial_schedule(
8029                 __isl_take isl_schedule_node *node,
8030                 __isl_take isl_multi_union_pw_aff *schedule);
8032 This function inserts a new band node with (the greatest integer
8033 part of) the given partial schedule.
8034 The subtree rooted at the given node is assumed not to have
8035 any anchored nodes.
8037         #include <isl/schedule_node.h>
8038         __isl_give isl_schedule_node *
8039         isl_schedule_node_insert_context(
8040                 __isl_take isl_schedule_node *node,
8041                 __isl_take isl_set *context);
8043 This function inserts a new context node with the given context constraints.
8045         #include <isl/schedule_node.h>
8046         __isl_give isl_schedule_node *
8047         isl_schedule_node_insert_filter(
8048                 __isl_take isl_schedule_node *node,
8049                 __isl_take isl_union_set *filter);
8051 This function inserts a new filter node with the given filter.
8052 If the original node already pointed to a filter node, then the
8053 two filter nodes are merged into one.
8055         #include <isl/schedule_node.h>
8056         __isl_give isl_schedule_node *
8057         isl_schedule_node_insert_guard(
8058                 __isl_take isl_schedule_node *node,
8059                 __isl_take isl_set *guard);
8061 This function inserts a new guard node with the given guard constraints.
8063         #include <isl/schedule_node.h>
8064         __isl_give isl_schedule_node *
8065         isl_schedule_node_insert_mark(
8066                 __isl_take isl_schedule_node *node,
8067                 __isl_take isl_id *mark);
8069 This function inserts a new mark node with the give mark identifier.
8071         #include <isl/schedule_node.h>
8072         __isl_give isl_schedule_node *
8073         isl_schedule_node_insert_sequence(
8074                 __isl_take isl_schedule_node *node,
8075                 __isl_take isl_union_set_list *filters);
8076         __isl_give isl_schedule_node *
8077         isl_schedule_node_insert_set(
8078                 __isl_take isl_schedule_node *node,
8079                 __isl_take isl_union_set_list *filters);
8081 These functions insert a new sequence or set node with the given
8082 filters as children.
8084         #include <isl/schedule_node.h>
8085         __isl_give isl_schedule_node *isl_schedule_node_group(
8086                 __isl_take isl_schedule_node *node,
8087                 __isl_take isl_id *group_id);
8089 This function introduces an expansion node in between the current
8090 node and its parent that expands instances of a space with tuple
8091 identifier C<group_id> to the original domain elements that reach
8092 the node.  The group instances are identified by the prefix schedule
8093 of those domain elements.  The ancestors of the node are adjusted
8094 to refer to the group instances instead of the original domain
8095 elements.  The return value points to the same node in the updated
8096 schedule tree as the input node, i.e., to the child of the newly
8097 introduced expansion node.  Grouping instances of different statements
8098 ensures that they will be treated as a single statement by the
8099 AST generator up to the point of the expansion node.
8101 The partial schedule of a band node can be scaled (down) using
8102 the following functions.
8104         #include <isl/schedule_node.h>
8105         __isl_give isl_schedule_node *
8106         isl_schedule_node_band_scale(
8107                 __isl_take isl_schedule_node *node,
8108                 __isl_take isl_multi_val *mv);
8109         __isl_give isl_schedule_node *
8110         isl_schedule_node_band_scale_down(
8111                 __isl_take isl_schedule_node *node,
8112                 __isl_take isl_multi_val *mv);
8114 The spaces of the two arguments need to match.
8115 After scaling, the partial schedule is replaced by its greatest
8116 integer part to ensure that the schedule remains integral.
8118 A band node can be tiled using the following function.
8120         #include <isl/schedule_node.h>
8121         __isl_give isl_schedule_node *isl_schedule_node_band_tile(
8122                 __isl_take isl_schedule_node *node,
8123                 __isl_take isl_multi_val *sizes);
8125         isl_stat isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
8126                 int val);
8127         int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
8128         isl_stat isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
8129                 int val);
8130         int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
8132 The C<isl_schedule_node_band_tile> function tiles
8133 the band using the given tile sizes inside its schedule.
8134 A new child band node is created to represent the point loops and it is
8135 inserted between the modified band and its children.
8136 The subtree rooted at the given node is assumed not to have
8137 any anchored nodes.
8138 The C<tile_scale_tile_loops> option specifies whether the tile
8139 loops iterators should be scaled by the tile sizes.
8140 If the C<tile_shift_point_loops> option is set, then the point loops
8141 are shifted to start at zero.
8143 A band node can be split into two nested band nodes
8144 using the following function.
8146         #include <isl/schedule_node.h>
8147         __isl_give isl_schedule_node *isl_schedule_node_band_split(
8148                 __isl_take isl_schedule_node *node, int pos);
8150 The resulting outer band node contains the first C<pos> dimensions of
8151 the schedule of C<node> while the inner band contains the remaining dimensions.
8152 The schedules of the two band nodes live in anonymous spaces.
8154 A band node can be moved down to the leaves of the subtree rooted
8155 at the band node using the following function.
8157         #include <isl/schedule_node.h>
8158         __isl_give isl_schedule_node *isl_schedule_node_band_sink(
8159                 __isl_take isl_schedule_node *node);
8161 The subtree rooted at the given node is assumed not to have
8162 any anchored nodes.
8163 The result points to the node in the resulting tree that is in the same
8164 position as the node pointed to by C<node> in the original tree.
8166         #include <isl/schedule_node.h>
8167         __isl_give isl_schedule_node *
8168         isl_schedule_node_order_after(
8169                 __isl_take isl_schedule_node *node,
8170                 __isl_take isl_union_set *filter);
8172 This function splits the domain elements that reach C<node>
8173 into those that satisfy C<filter> and those that do not and
8174 arranges for the elements that do satisfy the filter to be
8175 executed after those that do not.  The order is imposed by
8176 a sequence node, possibly reusing the grandparent of C<node>
8177 on two copies of the subtree attached to the original C<node>.
8178 Both copies are simplified with respect to their filter.
8180 Return a pointer to the copy of the subtree that does not
8181 satisfy C<filter>.  If there is no such copy (because all
8182 reaching domain elements satisfy the filter), then return
8183 the original pointer.
8185         #include <isl/schedule_node.h>
8186         __isl_give isl_schedule_node *
8187         isl_schedule_node_graft_before(
8188                 __isl_take isl_schedule_node *node,
8189                 __isl_take isl_schedule_node *graft);
8190         __isl_give isl_schedule_node *
8191         isl_schedule_node_graft_after(
8192                 __isl_take isl_schedule_node *node,
8193                 __isl_take isl_schedule_node *graft);
8195 This function inserts the C<graft> tree into the tree containing C<node>
8196 such that it is executed before (in case of C<isl_schedule_node_graft_before>)
8197 or after (in case of C<isl_schedule_node_graft_after>) C<node>.
8198 The root node of C<graft>
8199 should be an extension node where the domain of the extension
8200 is the flat product of all outer band nodes of C<node>.
8201 The root node may also be a domain node.
8202 The elements of the domain or the range of the extension may not
8203 intersect with the domain elements that reach "node".
8204 The schedule tree of C<graft> may not be anchored.
8206 The schedule tree of C<node> is modified to include an extension node
8207 corresponding to the root node of C<graft> as a child of the original
8208 parent of C<node>.  The original node that C<node> points to and the
8209 child of the root node of C<graft> are attached to this extension node
8210 through a sequence, with appropriate filters and with the child
8211 of C<graft> appearing before or after the original C<node>.
8213 If C<node> already appears inside a sequence that is the child of
8214 an extension node and if the spaces of the new domain elements
8215 do not overlap with those of the original domain elements,
8216 then that extension node is extended with the new extension
8217 rather than introducing a new segment of extension and sequence nodes.
8219 Return a pointer to the same node in the modified tree that
8220 C<node> pointed to in the original tree.
8222 A representation of the schedule node can be printed using
8224         #include <isl/schedule_node.h>
8225         __isl_give isl_printer *isl_printer_print_schedule_node(
8226                 __isl_take isl_printer *p,
8227                 __isl_keep isl_schedule_node *node);
8229 =head2 Dependence Analysis
8231 C<isl> contains specialized functionality for performing
8232 array dataflow analysis.  That is, given a I<sink> access relation
8233 and a collection of possible I<source> access relations,
8234 C<isl> can compute relations that describe
8235 for each iteration of the sink access, which iteration
8236 of which of the source access relations was the last
8237 to access the same data element before the given iteration
8238 of the sink access.
8239 The resulting dependence relations map source iterations
8240 to the corresponding sink iterations.
8241 To compute standard flow dependences, the sink should be
8242 a read, while the sources should be writes.
8243 If any of the source accesses are marked as being I<may>
8244 accesses, then there will be a dependence from the last
8245 I<must> access B<and> from any I<may> access that follows
8246 this last I<must> access.
8247 In particular, if I<all> sources are I<may> accesses,
8248 then memory based dependence analysis is performed.
8249 If, on the other hand, all sources are I<must> accesses,
8250 then value based dependence analysis is performed.
8252 =head3 High-level Interface
8254 A high-level interface to dependence analysis is provided
8255 by the following function.
8257         #include <isl/flow.h>
8258         __isl_give isl_union_flow *
8259         isl_union_access_info_compute_flow(
8260                 __isl_take isl_union_access_info *access);
8262 The input C<isl_union_access_info> object describes the sink
8263 access relations, the source access relations and a schedule,
8264 while the output C<isl_union_flow> object describes
8265 the resulting dependence relations and the subsets of the
8266 sink relations for which no source was found.
8268 An C<isl_union_access_info> is created, modified, copied and freed using
8269 the following functions.
8271         #include <isl/flow.h>
8272         __isl_give isl_union_access_info *
8273         isl_union_access_info_from_sink(
8274                 __isl_take isl_union_map *sink);
8275         __isl_give isl_union_access_info *
8276         isl_union_access_info_set_must_source(
8277                 __isl_take isl_union_access_info *access,
8278                 __isl_take isl_union_map *must_source);
8279         __isl_give isl_union_access_info *
8280         isl_union_access_info_set_may_source(
8281                 __isl_take isl_union_access_info *access,
8282                 __isl_take isl_union_map *may_source);
8283         __isl_give isl_union_access_info *
8284         isl_union_access_info_set_schedule(
8285                 __isl_take isl_union_access_info *access,
8286                 __isl_take isl_schedule *schedule);
8287         __isl_give isl_union_access_info *
8288         isl_union_access_info_set_schedule_map(
8289                 __isl_take isl_union_access_info *access,
8290                 __isl_take isl_union_map *schedule_map);
8291         __isl_give isl_union_access_info *
8292         isl_union_access_info_copy(
8293                 __isl_keep isl_union_access_info *access);
8294         __isl_null isl_union_access_info *
8295         isl_union_access_info_free(
8296                 __isl_take isl_union_access_info *access);
8298 The may sources set by C<isl_union_access_info_set_may_source>
8299 do not need to include the must sources set by
8300 C<isl_union_access_info_set_must_source> as a subset.
8301 The user is free not to call one (or both) of these functions,
8302 in which case the corresponding set is kept to its empty default.
8303 Similarly, the default schedule initialized by
8304 C<isl_union_access_info_from_sink> is empty.
8305 The current schedule is determined by the last call to either
8306 C<isl_union_access_info_set_schedule> or
8307 C<isl_union_access_info_set_schedule_map>.
8308 The domain of the schedule corresponds to the domains of
8309 the access relations.  In particular, the domains of the access
8310 relations are effectively intersected with the domain of the schedule
8311 and only the resulting accesses are considered by the dependence analysis.
8313 The output of C<isl_union_access_info_compute_flow> can be examined
8314 and freed using the following functions.
8316         #include <isl/flow.h>
8317         __isl_give isl_union_map *isl_union_flow_get_must_dependence(
8318                 __isl_keep isl_union_flow *flow);
8319         __isl_give isl_union_map *isl_union_flow_get_may_dependence(
8320                 __isl_keep isl_union_flow *flow);
8321         __isl_give isl_union_map *isl_union_flow_get_must_no_source(
8322                 __isl_keep isl_union_flow *flow);
8323         __isl_give isl_union_map *isl_union_flow_get_may_no_source(
8324                 __isl_keep isl_union_flow *flow);
8325         __isl_null isl_union_flow *isl_union_flow_free(
8326                 __isl_take isl_union_flow *flow);
8328 The relation returned by C<isl_union_flow_get_must_dependence>
8329 relates domain elements of must sources to domain elements of the sink.
8330 The relation returned by C<isl_union_flow_get_may_dependence>
8331 relates domain elements of must or may sources to domain elements of the sink
8332 and includes the previous relation as a subset.
8333 The relation returned by C<isl_union_flow_get_must_no_source> is the subset
8334 of the sink relation for which no dependences have been found.
8335 The relation returned by C<isl_union_flow_get_may_no_source> is the subset
8336 of the sink relation for which no definite dependences have been found.
8337 That is, it contains those sink access that do not contribute to any
8338 of the elements in the relation returned
8339 by C<isl_union_flow_get_must_dependence>.
8341 =head3 Low-level Interface
8343 A lower-level interface is provided by the following functions.
8345         #include <isl/flow.h>
8347         typedef int (*isl_access_level_before)(void *first, void *second);
8349         __isl_give isl_access_info *isl_access_info_alloc(
8350                 __isl_take isl_map *sink,
8351                 void *sink_user, isl_access_level_before fn,
8352                 int max_source);
8353         __isl_give isl_access_info *isl_access_info_add_source(
8354                 __isl_take isl_access_info *acc,
8355                 __isl_take isl_map *source, int must,
8356                 void *source_user);
8357         __isl_null isl_access_info *isl_access_info_free(
8358                 __isl_take isl_access_info *acc);
8360         __isl_give isl_flow *isl_access_info_compute_flow(
8361                 __isl_take isl_access_info *acc);
8363         isl_stat isl_flow_foreach(__isl_keep isl_flow *deps,
8364                 isl_stat (*fn)(__isl_take isl_map *dep, int must,
8365                           void *dep_user, void *user),
8366                 void *user);
8367         __isl_give isl_map *isl_flow_get_no_source(
8368                 __isl_keep isl_flow *deps, int must);
8369         void isl_flow_free(__isl_take isl_flow *deps);
8371 The function C<isl_access_info_compute_flow> performs the actual
8372 dependence analysis.  The other functions are used to construct
8373 the input for this function or to read off the output.
8375 The input is collected in an C<isl_access_info>, which can
8376 be created through a call to C<isl_access_info_alloc>.
8377 The arguments to this functions are the sink access relation
8378 C<sink>, a token C<sink_user> used to identify the sink
8379 access to the user, a callback function for specifying the
8380 relative order of source and sink accesses, and the number
8381 of source access relations that will be added.
8382 The callback function has type C<int (*)(void *first, void *second)>.
8383 The function is called with two user supplied tokens identifying
8384 either a source or the sink and it should return the shared nesting
8385 level and the relative order of the two accesses.
8386 In particular, let I<n> be the number of loops shared by
8387 the two accesses.  If C<first> precedes C<second> textually,
8388 then the function should return I<2 * n + 1>; otherwise,
8389 it should return I<2 * n>.
8390 The sources can be added to the C<isl_access_info> by performing
8391 (at most) C<max_source> calls to C<isl_access_info_add_source>.
8392 C<must> indicates whether the source is a I<must> access
8393 or a I<may> access.  Note that a multi-valued access relation
8394 should only be marked I<must> if every iteration in the domain
8395 of the relation accesses I<all> elements in its image.
8396 The C<source_user> token is again used to identify
8397 the source access.  The range of the source access relation
8398 C<source> should have the same dimension as the range
8399 of the sink access relation.
8400 The C<isl_access_info_free> function should usually not be
8401 called explicitly, because it is called implicitly by
8402 C<isl_access_info_compute_flow>.
8404 The result of the dependence analysis is collected in an
8405 C<isl_flow>.  There may be elements of
8406 the sink access for which no preceding source access could be
8407 found or for which all preceding sources are I<may> accesses.
8408 The relations containing these elements can be obtained through
8409 calls to C<isl_flow_get_no_source>, the first with C<must> set
8410 and the second with C<must> unset.
8411 In the case of standard flow dependence analysis,
8412 with the sink a read and the sources I<must> writes,
8413 the first relation corresponds to the reads from uninitialized
8414 array elements and the second relation is empty.
8415 The actual flow dependences can be extracted using
8416 C<isl_flow_foreach>.  This function will call the user-specified
8417 callback function C<fn> for each B<non-empty> dependence between
8418 a source and the sink.  The callback function is called
8419 with four arguments, the actual flow dependence relation
8420 mapping source iterations to sink iterations, a boolean that
8421 indicates whether it is a I<must> or I<may> dependence, a token
8422 identifying the source and an additional C<void *> with value
8423 equal to the third argument of the C<isl_flow_foreach> call.
8424 A dependence is marked I<must> if it originates from a I<must>
8425 source and if it is not followed by any I<may> sources.
8427 After finishing with an C<isl_flow>, the user should call
8428 C<isl_flow_free> to free all associated memory.
8430 =head3 Interaction with the Low-level Interface
8432 During the dependence analysis, we frequently need to perform
8433 the following operation.  Given a relation between sink iterations
8434 and potential source iterations from a particular source domain,
8435 what is the last potential source iteration corresponding to each
8436 sink iteration.  It can sometimes be convenient to adjust
8437 the set of potential source iterations before or after each such operation.
8438 The prototypical example is fuzzy array dataflow analysis,
8439 where we need to analyze if, based on data-dependent constraints,
8440 the sink iteration can ever be executed without one or more of
8441 the corresponding potential source iterations being executed.
8442 If so, we can introduce extra parameters and select an unknown
8443 but fixed source iteration from the potential source iterations.
8444 To be able to perform such manipulations, C<isl> provides the following
8445 function.
8447         #include <isl/flow.h>
8449         typedef __isl_give isl_restriction *(*isl_access_restrict)(
8450                 __isl_keep isl_map *source_map,
8451                 __isl_keep isl_set *sink, void *source_user,
8452                 void *user);
8453         __isl_give isl_access_info *isl_access_info_set_restrict(
8454                 __isl_take isl_access_info *acc,
8455                 isl_access_restrict fn, void *user);
8457 The function C<isl_access_info_set_restrict> should be called
8458 before calling C<isl_access_info_compute_flow> and registers a callback function
8459 that will be called any time C<isl> is about to compute the last
8460 potential source.  The first argument is the (reverse) proto-dependence,
8461 mapping sink iterations to potential source iterations.
8462 The second argument represents the sink iterations for which
8463 we want to compute the last source iteration.
8464 The third argument is the token corresponding to the source
8465 and the final argument is the token passed to C<isl_access_info_set_restrict>.
8466 The callback is expected to return a restriction on either the input or
8467 the output of the operation computing the last potential source.
8468 If the input needs to be restricted then restrictions are needed
8469 for both the source and the sink iterations.  The sink iterations
8470 and the potential source iterations will be intersected with these sets.
8471 If the output needs to be restricted then only a restriction on the source
8472 iterations is required.
8473 If any error occurs, the callback should return C<NULL>.
8474 An C<isl_restriction> object can be created, freed and inspected
8475 using the following functions.
8477         #include <isl/flow.h>
8479         __isl_give isl_restriction *isl_restriction_input(
8480                 __isl_take isl_set *source_restr,
8481                 __isl_take isl_set *sink_restr);
8482         __isl_give isl_restriction *isl_restriction_output(
8483                 __isl_take isl_set *source_restr);
8484         __isl_give isl_restriction *isl_restriction_none(
8485                 __isl_take isl_map *source_map);
8486         __isl_give isl_restriction *isl_restriction_empty(
8487                 __isl_take isl_map *source_map);
8488         __isl_null isl_restriction *isl_restriction_free(
8489                 __isl_take isl_restriction *restr);
8491 C<isl_restriction_none> and C<isl_restriction_empty> are special
8492 cases of C<isl_restriction_input>.  C<isl_restriction_none>
8493 is essentially equivalent to
8495         isl_restriction_input(isl_set_universe(
8496             isl_space_range(isl_map_get_space(source_map))),
8497                             isl_set_universe(
8498             isl_space_domain(isl_map_get_space(source_map))));
8500 whereas C<isl_restriction_empty> is essentially equivalent to
8502         isl_restriction_input(isl_set_empty(
8503             isl_space_range(isl_map_get_space(source_map))),
8504                             isl_set_universe(
8505             isl_space_domain(isl_map_get_space(source_map))));
8507 =head2 Scheduling
8509 B<The functionality described in this section is fairly new
8510 and may be subject to change.>
8512         #include <isl/schedule.h>
8513         __isl_give isl_schedule *
8514         isl_schedule_constraints_compute_schedule(
8515                 __isl_take isl_schedule_constraints *sc);
8517 The function C<isl_schedule_constraints_compute_schedule> can be
8518 used to compute a schedule that satisfies the given schedule constraints.
8519 These schedule constraints include the iteration domain for which
8520 a schedule should be computed and dependences between pairs of
8521 iterations.  In particular, these dependences include
8522 I<validity> dependences and I<proximity> dependences.
8523 By default, the algorithm used to construct the schedule is similar
8524 to that of C<Pluto>.
8525 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
8526 be selected.
8527 The generated schedule respects all validity dependences.
8528 That is, all dependence distances over these dependences in the
8529 scheduled space are lexicographically positive.
8531 The default algorithm tries to ensure that the dependence distances
8532 over coincidence constraints are zero and to minimize the
8533 dependence distances over proximity dependences.
8534 Moreover, it tries to obtain sequences (bands) of schedule dimensions
8535 for groups of domains where the dependence distances over validity
8536 dependences have only non-negative values.
8537 Note that when minimizing the maximal dependence distance
8538 over proximity dependences, a single affine expression in the parameters
8539 is constructed that bounds all dependence distances.  If no such expression
8540 exists, then the algorithm will fail and resort to an alternative
8541 scheduling algorithm.  In particular, this means that adding proximity
8542 dependences may eliminate valid solutions.  A typical example where this
8543 phenomenon may occur is when some subset of the proximity dependences
8544 has no restriction on some parameter, forcing the coefficient of that
8545 parameter to be zero, while some other subset forces the dependence
8546 distance to depend on that parameter, requiring the same coefficient
8547 to be non-zero.
8548 When using Feautrier's algorithm, the coincidence and proximity constraints
8549 are only taken into account during the extension to a
8550 full-dimensional schedule.
8552 An C<isl_schedule_constraints> object can be constructed
8553 and manipulated using the following functions.
8555         #include <isl/schedule.h>
8556         __isl_give isl_schedule_constraints *
8557         isl_schedule_constraints_copy(
8558                 __isl_keep isl_schedule_constraints *sc);
8559         __isl_give isl_schedule_constraints *
8560         isl_schedule_constraints_on_domain(
8561                 __isl_take isl_union_set *domain);
8562         __isl_give isl_schedule_constraints *
8563         isl_schedule_constraints_set_context(
8564                 __isl_take isl_schedule_constraints *sc,
8565                 __isl_take isl_set *context);
8566         __isl_give isl_schedule_constraints *
8567         isl_schedule_constraints_set_validity(
8568                 __isl_take isl_schedule_constraints *sc,
8569                 __isl_take isl_union_map *validity);
8570         __isl_give isl_schedule_constraints *
8571         isl_schedule_constraints_set_coincidence(
8572                 __isl_take isl_schedule_constraints *sc,
8573                 __isl_take isl_union_map *coincidence);
8574         __isl_give isl_schedule_constraints *
8575         isl_schedule_constraints_set_proximity(
8576                 __isl_take isl_schedule_constraints *sc,
8577                 __isl_take isl_union_map *proximity);
8578         __isl_give isl_schedule_constraints *
8579         isl_schedule_constraints_set_conditional_validity(
8580                 __isl_take isl_schedule_constraints *sc,
8581                 __isl_take isl_union_map *condition,
8582                 __isl_take isl_union_map *validity);
8583         __isl_null isl_schedule_constraints *
8584         isl_schedule_constraints_free(
8585                 __isl_take isl_schedule_constraints *sc);
8587 The initial C<isl_schedule_constraints> object created by
8588 C<isl_schedule_constraints_on_domain> does not impose any constraints.
8589 That is, it has an empty set of dependences.
8590 The function C<isl_schedule_constraints_set_context> allows the user
8591 to specify additional constraints on the parameters that may
8592 be assumed to hold during the construction of the schedule.
8593 The function C<isl_schedule_constraints_set_validity> replaces the
8594 validity dependences, mapping domain elements I<i> to domain
8595 elements that should be scheduled after I<i>.
8596 The function C<isl_schedule_constraints_set_coincidence> replaces the
8597 coincidence dependences, mapping domain elements I<i> to domain
8598 elements that should be scheduled together with I<I>, if possible.
8599 The function C<isl_schedule_constraints_set_proximity> replaces the
8600 proximity dependences, mapping domain elements I<i> to domain
8601 elements that should be scheduled either before I<I>
8602 or as early as possible after I<i>.
8604 The function C<isl_schedule_constraints_set_conditional_validity>
8605 replaces the conditional validity constraints.
8606 A conditional validity constraint is only imposed when any of the corresponding
8607 conditions is satisfied, i.e., when any of them is non-zero.
8608 That is, the scheduler ensures that within each band if the dependence
8609 distances over the condition constraints are not all zero
8610 then all corresponding conditional validity constraints are respected.
8611 A conditional validity constraint corresponds to a condition
8612 if the two are adjacent, i.e., if the domain of one relation intersect
8613 the range of the other relation.
8614 The typical use case of conditional validity constraints is
8615 to allow order constraints between live ranges to be violated
8616 as long as the live ranges themselves are local to the band.
8617 To allow more fine-grained control over which conditions correspond
8618 to which conditional validity constraints, the domains and ranges
8619 of these relations may include I<tags>.  That is, the domains and
8620 ranges of those relation may themselves be wrapped relations
8621 where the iteration domain appears in the domain of those wrapped relations
8622 and the range of the wrapped relations can be arbitrarily chosen
8623 by the user.  Conditions and conditional validity constraints are only
8624 considered adjacent to each other if the entire wrapped relation matches.
8625 In particular, a relation with a tag will never be considered adjacent
8626 to a relation without a tag.
8628 An C<isl_schedule_constraints> object can be inspected
8629 using the following functions.
8631         #include <isl/schedule.h>
8632         __isl_give isl_union_map *
8633         isl_schedule_constraints_get_validity(
8634                 __isl_keep isl_schedule_constraints *sc);
8635         __isl_give isl_union_map *
8636         isl_schedule_constraints_get_coincidence(
8637                 __isl_keep isl_schedule_constraints *sc);
8638         __isl_give isl_union_map *
8639         isl_schedule_constraints_get_conditional_validity(
8640                 __isl_keep isl_schedule_constraints *sc);
8641         __isl_give isl_union_map *
8642         isl_schedule_constraints_get_conditional_validity_condition(
8643                 __isl_keep isl_schedule_constraints *sc);
8645 The following function computes a schedule directly from
8646 an iteration domain and validity and proximity dependences
8647 and is implemented in terms of the functions described above.
8648 The use of C<isl_union_set_compute_schedule> is discouraged.
8650         #include <isl/schedule.h>
8651         __isl_give isl_schedule *isl_union_set_compute_schedule(
8652                 __isl_take isl_union_set *domain,
8653                 __isl_take isl_union_map *validity,
8654                 __isl_take isl_union_map *proximity);
8656 The generated schedule represents a schedule tree.
8657 For more information on schedule trees, see
8658 L</"Schedule Trees">.
8660 =head3 Options
8662         #include <isl/schedule.h>
8663         isl_stat isl_options_set_schedule_max_coefficient(
8664                 isl_ctx *ctx, int val);
8665         int isl_options_get_schedule_max_coefficient(
8666                 isl_ctx *ctx);
8667         isl_stat isl_options_set_schedule_max_constant_term(
8668                 isl_ctx *ctx, int val);
8669         int isl_options_get_schedule_max_constant_term(
8670                 isl_ctx *ctx);
8671         isl_stat isl_options_set_schedule_serialize_sccs(
8672                 isl_ctx *ctx, int val);
8673         int isl_options_get_schedule_serialize_sccs(isl_ctx *ctx);
8674         isl_stat isl_options_set_schedule_maximize_band_depth(
8675                 isl_ctx *ctx, int val);
8676         int isl_options_get_schedule_maximize_band_depth(
8677                 isl_ctx *ctx);
8678         isl_stat isl_options_set_schedule_outer_coincidence(
8679                 isl_ctx *ctx, int val);
8680         int isl_options_get_schedule_outer_coincidence(
8681                 isl_ctx *ctx);
8682         isl_stat isl_options_set_schedule_split_scaled(
8683                 isl_ctx *ctx, int val);
8684         int isl_options_get_schedule_split_scaled(
8685                 isl_ctx *ctx);
8686         isl_stat isl_options_set_schedule_algorithm(
8687                 isl_ctx *ctx, int val);
8688         int isl_options_get_schedule_algorithm(
8689                 isl_ctx *ctx);
8690         isl_stat isl_options_set_schedule_separate_components(
8691                 isl_ctx *ctx, int val);
8692         int isl_options_get_schedule_separate_components(
8693                 isl_ctx *ctx);
8695 =over
8697 =item * schedule_max_coefficient
8699 This option enforces that the coefficients for variable and parameter
8700 dimensions in the calculated schedule are not larger than the specified value.
8701 This option can significantly increase the speed of the scheduling calculation
8702 and may also prevent fusing of unrelated dimensions. A value of -1 means that
8703 this option does not introduce bounds on the variable or parameter
8704 coefficients.
8706 =item * schedule_max_constant_term
8708 This option enforces that the constant coefficients in the calculated schedule
8709 are not larger than the maximal constant term. This option can significantly
8710 increase the speed of the scheduling calculation and may also prevent fusing of
8711 unrelated dimensions. A value of -1 means that this option does not introduce
8712 bounds on the constant coefficients.
8714 =item * schedule_serialize_sccs
8716 If this option is set, then all strongly connected components
8717 in the dependence graph are serialized as soon as they are detected.
8718 This means in particular that instances of statements will only
8719 appear in the same band node if these statements belong
8720 to the same strongly connected component at the point where
8721 the band node is constructed.
8723 =item * schedule_maximize_band_depth
8725 If this option is set, we do not split bands at the point
8726 where we detect splitting is necessary. Instead, we
8727 backtrack and split bands as early as possible. This
8728 reduces the number of splits and maximizes the width of
8729 the bands. Wider bands give more possibilities for tiling.
8730 Note that if the C<schedule_serialize_sccs> options is set,
8731 then bands will be split as early as possible, even if there is no need.
8732 The C<schedule_maximize_band_depth> option therefore has no effect in this case.
8734 =item * schedule_outer_coincidence
8736 If this option is set, then we try to construct schedules
8737 where the outermost scheduling dimension in each band
8738 satisfies the coincidence constraints.
8740 =item * schedule_split_scaled
8742 If this option is set, then we try to construct schedules in which the
8743 constant term is split off from the linear part if the linear parts of
8744 the scheduling rows for all nodes in the graphs have a common non-trivial
8745 divisor.
8746 The constant term is then placed in a separate band and the linear
8747 part is reduced.
8749 =item * schedule_algorithm
8751 Selects the scheduling algorithm to be used.
8752 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
8753 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
8755 =item * schedule_separate_components
8757 If this option is set then the function C<isl_schedule_get_map>
8758 will treat set nodes in the same way as sequence nodes.
8760 =back
8762 =head2 AST Generation
8764 This section describes the C<isl> functionality for generating
8765 ASTs that visit all the elements
8766 in a domain in an order specified by a schedule tree or
8767 a schedule map.
8768 In case the schedule given as a C<isl_union_map>, an AST is generated
8769 that visits all the elements in the domain of the C<isl_union_map>
8770 according to the lexicographic order of the corresponding image
8771 element(s).  If the range of the C<isl_union_map> consists of
8772 elements in more than one space, then each of these spaces is handled
8773 separately in an arbitrary order.
8774 It should be noted that the schedule tree or the image elements
8775 in a schedule map only specify the I<order>
8776 in which the corresponding domain elements should be visited.
8777 No direct relation between the partial schedule values
8778 or the image elements on the one hand and the loop iterators
8779 in the generated AST on the other hand should be assumed.
8781 Each AST is generated within a build.  The initial build
8782 simply specifies the constraints on the parameters (if any)
8783 and can be created, inspected, copied and freed using the following functions.
8785         #include <isl/ast_build.h>
8786         __isl_give isl_ast_build *isl_ast_build_alloc(
8787                 isl_ctx *ctx);
8788         __isl_give isl_ast_build *isl_ast_build_from_context(
8789                 __isl_take isl_set *set);
8790         __isl_give isl_ast_build *isl_ast_build_copy(
8791                 __isl_keep isl_ast_build *build);
8792         __isl_null isl_ast_build *isl_ast_build_free(
8793                 __isl_take isl_ast_build *build);
8795 The C<set> argument is usually a parameter set with zero or more parameters.
8796 In fact, when creating an AST using C<isl_ast_build_node_from_schedule>,
8797 this set is required to be a parameter set.
8798 An C<isl_ast_build> created using C<isl_ast_build_alloc> does not
8799 specify any parameter constraints.
8800 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
8801 and L</"Fine-grained Control over AST Generation">.
8802 Finally, the AST itself can be constructed using one of the following
8803 functions.
8805         #include <isl/ast_build.h>
8806         __isl_give isl_ast_node *isl_ast_build_node_from_schedule(
8807                 __isl_keep isl_ast_build *build,
8808                 __isl_take isl_schedule *schedule);
8809         __isl_give isl_ast_node *
8810         isl_ast_build_node_from_schedule_map(
8811                 __isl_keep isl_ast_build *build,
8812                 __isl_take isl_union_map *schedule);
8814 =head3 Inspecting the AST
8816 The basic properties of an AST node can be obtained as follows.
8818         #include <isl/ast.h>
8819         enum isl_ast_node_type isl_ast_node_get_type(
8820                 __isl_keep isl_ast_node *node);
8822 The type of an AST node is one of
8823 C<isl_ast_node_for>,
8824 C<isl_ast_node_if>,
8825 C<isl_ast_node_block>,
8826 C<isl_ast_node_mark> or
8827 C<isl_ast_node_user>.
8828 An C<isl_ast_node_for> represents a for node.
8829 An C<isl_ast_node_if> represents an if node.
8830 An C<isl_ast_node_block> represents a compound node.
8831 An C<isl_ast_node_mark> introduces a mark in the AST.
8832 An C<isl_ast_node_user> represents an expression statement.
8833 An expression statement typically corresponds to a domain element, i.e.,
8834 one of the elements that is visited by the AST.
8836 Each type of node has its own additional properties.
8838         #include <isl/ast.h>
8839         __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
8840                 __isl_keep isl_ast_node *node);
8841         __isl_give isl_ast_expr *isl_ast_node_for_get_init(
8842                 __isl_keep isl_ast_node *node);
8843         __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
8844                 __isl_keep isl_ast_node *node);
8845         __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
8846                 __isl_keep isl_ast_node *node);
8847         __isl_give isl_ast_node *isl_ast_node_for_get_body(
8848                 __isl_keep isl_ast_node *node);
8849         isl_bool isl_ast_node_for_is_degenerate(
8850                 __isl_keep isl_ast_node *node);
8852 An C<isl_ast_for> is considered degenerate if it is known to execute
8853 exactly once.
8855         #include <isl/ast.h>
8856         __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
8857                 __isl_keep isl_ast_node *node);
8858         __isl_give isl_ast_node *isl_ast_node_if_get_then(
8859                 __isl_keep isl_ast_node *node);
8860         isl_bool isl_ast_node_if_has_else(
8861                 __isl_keep isl_ast_node *node);
8862         __isl_give isl_ast_node *isl_ast_node_if_get_else(
8863                 __isl_keep isl_ast_node *node);
8865         __isl_give isl_ast_node_list *
8866         isl_ast_node_block_get_children(
8867                 __isl_keep isl_ast_node *node);
8869         __isl_give isl_id *isl_ast_node_mark_get_id(
8870                 __isl_keep isl_ast_node *node);
8871         __isl_give isl_ast_node *isl_ast_node_mark_get_node(
8872                 __isl_keep isl_ast_node *node);
8874 C<isl_ast_node_mark_get_id> returns the identifier of the mark.
8875 C<isl_ast_node_mark_get_node> returns the child node that is being marked.
8877         #include <isl/ast.h>
8878         __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
8879                 __isl_keep isl_ast_node *node);
8881 Each of the returned C<isl_ast_expr>s can in turn be inspected using
8882 the following functions.
8884         #include <isl/ast.h>
8885         enum isl_ast_expr_type isl_ast_expr_get_type(
8886                 __isl_keep isl_ast_expr *expr);
8888 The type of an AST expression is one of
8889 C<isl_ast_expr_op>,
8890 C<isl_ast_expr_id> or
8891 C<isl_ast_expr_int>.
8892 An C<isl_ast_expr_op> represents the result of an operation.
8893 An C<isl_ast_expr_id> represents an identifier.
8894 An C<isl_ast_expr_int> represents an integer value.
8896 Each type of expression has its own additional properties.
8898         #include <isl/ast.h>
8899         enum isl_ast_op_type isl_ast_expr_get_op_type(
8900                 __isl_keep isl_ast_expr *expr);
8901         int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
8902         __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
8903                 __isl_keep isl_ast_expr *expr, int pos);
8904         isl_stat isl_ast_node_foreach_ast_op_type(
8905                 __isl_keep isl_ast_node *node,
8906                 isl_stat (*fn)(enum isl_ast_op_type type,
8907                         void *user), void *user);
8909 C<isl_ast_expr_get_op_type> returns the type of the operation
8910 performed.  C<isl_ast_expr_get_op_n_arg> returns the number of
8911 arguments.  C<isl_ast_expr_get_op_arg> returns the specified
8912 argument.
8913 C<isl_ast_node_foreach_ast_op_type> calls C<fn> for each distinct
8914 C<isl_ast_op_type> that appears in C<node>.
8915 The operation type is one of the following.
8917 =over
8919 =item C<isl_ast_op_and>
8921 Logical I<and> of two arguments.
8922 Both arguments can be evaluated.
8924 =item C<isl_ast_op_and_then>
8926 Logical I<and> of two arguments.
8927 The second argument can only be evaluated if the first evaluates to true.
8929 =item C<isl_ast_op_or>
8931 Logical I<or> of two arguments.
8932 Both arguments can be evaluated.
8934 =item C<isl_ast_op_or_else>
8936 Logical I<or> of two arguments.
8937 The second argument can only be evaluated if the first evaluates to false.
8939 =item C<isl_ast_op_max>
8941 Maximum of two or more arguments.
8943 =item C<isl_ast_op_min>
8945 Minimum of two or more arguments.
8947 =item C<isl_ast_op_minus>
8949 Change sign.
8951 =item C<isl_ast_op_add>
8953 Sum of two arguments.
8955 =item C<isl_ast_op_sub>
8957 Difference of two arguments.
8959 =item C<isl_ast_op_mul>
8961 Product of two arguments.
8963 =item C<isl_ast_op_div>
8965 Exact division.  That is, the result is known to be an integer.
8967 =item C<isl_ast_op_fdiv_q>
8969 Result of integer division, rounded towards negative
8970 infinity.
8972 =item C<isl_ast_op_pdiv_q>
8974 Result of integer division, where dividend is known to be non-negative.
8976 =item C<isl_ast_op_pdiv_r>
8978 Remainder of integer division, where dividend is known to be non-negative.
8980 =item C<isl_ast_op_zdiv_r>
8982 Equal to zero iff the remainder on integer division is zero.
8984 =item C<isl_ast_op_cond>
8986 Conditional operator defined on three arguments.
8987 If the first argument evaluates to true, then the result
8988 is equal to the second argument.  Otherwise, the result
8989 is equal to the third argument.
8990 The second and third argument may only be evaluated if
8991 the first argument evaluates to true and false, respectively.
8992 Corresponds to C<a ? b : c> in C.
8994 =item C<isl_ast_op_select>
8996 Conditional operator defined on three arguments.
8997 If the first argument evaluates to true, then the result
8998 is equal to the second argument.  Otherwise, the result
8999 is equal to the third argument.
9000 The second and third argument may be evaluated independently
9001 of the value of the first argument.
9002 Corresponds to C<a * b + (1 - a) * c> in C.
9004 =item C<isl_ast_op_eq>
9006 Equality relation.
9008 =item C<isl_ast_op_le>
9010 Less than or equal relation.
9012 =item C<isl_ast_op_lt>
9014 Less than relation.
9016 =item C<isl_ast_op_ge>
9018 Greater than or equal relation.
9020 =item C<isl_ast_op_gt>
9022 Greater than relation.
9024 =item C<isl_ast_op_call>
9026 A function call.
9027 The number of arguments of the C<isl_ast_expr> is one more than
9028 the number of arguments in the function call, the first argument
9029 representing the function being called.
9031 =item C<isl_ast_op_access>
9033 An array access.
9034 The number of arguments of the C<isl_ast_expr> is one more than
9035 the number of index expressions in the array access, the first argument
9036 representing the array being accessed.
9038 =item C<isl_ast_op_member>
9040 A member access.
9041 This operation has two arguments, a structure and the name of
9042 the member of the structure being accessed.
9044 =back
9046         #include <isl/ast.h>
9047         __isl_give isl_id *isl_ast_expr_get_id(
9048                 __isl_keep isl_ast_expr *expr);
9050 Return the identifier represented by the AST expression.
9052         #include <isl/ast.h>
9053         __isl_give isl_val *isl_ast_expr_get_val(
9054                 __isl_keep isl_ast_expr *expr);
9056 Return the integer represented by the AST expression.
9058 =head3 Properties of ASTs
9060         #include <isl/ast.h>
9061         isl_bool isl_ast_expr_is_equal(
9062                 __isl_keep isl_ast_expr *expr1,
9063                 __isl_keep isl_ast_expr *expr2);
9065 Check if two C<isl_ast_expr>s are equal to each other.
9067 =head3 Manipulating and printing the AST
9069 AST nodes can be copied and freed using the following functions.
9071         #include <isl/ast.h>
9072         __isl_give isl_ast_node *isl_ast_node_copy(
9073                 __isl_keep isl_ast_node *node);
9074         __isl_null isl_ast_node *isl_ast_node_free(
9075                 __isl_take isl_ast_node *node);
9077 AST expressions can be copied and freed using the following functions.
9079         #include <isl/ast.h>
9080         __isl_give isl_ast_expr *isl_ast_expr_copy(
9081                 __isl_keep isl_ast_expr *expr);
9082         __isl_null isl_ast_expr *isl_ast_expr_free(
9083                 __isl_take isl_ast_expr *expr);
9085 New AST expressions can be created either directly or within
9086 the context of an C<isl_ast_build>.
9088         #include <isl/ast.h>
9089         __isl_give isl_ast_expr *isl_ast_expr_from_val(
9090                 __isl_take isl_val *v);
9091         __isl_give isl_ast_expr *isl_ast_expr_from_id(
9092                 __isl_take isl_id *id);
9093         __isl_give isl_ast_expr *isl_ast_expr_neg(
9094                 __isl_take isl_ast_expr *expr);
9095         __isl_give isl_ast_expr *isl_ast_expr_address_of(
9096                 __isl_take isl_ast_expr *expr);
9097         __isl_give isl_ast_expr *isl_ast_expr_add(
9098                 __isl_take isl_ast_expr *expr1,
9099                 __isl_take isl_ast_expr *expr2);
9100         __isl_give isl_ast_expr *isl_ast_expr_sub(
9101                 __isl_take isl_ast_expr *expr1,
9102                 __isl_take isl_ast_expr *expr2);
9103         __isl_give isl_ast_expr *isl_ast_expr_mul(
9104                 __isl_take isl_ast_expr *expr1,
9105                 __isl_take isl_ast_expr *expr2);
9106         __isl_give isl_ast_expr *isl_ast_expr_div(
9107                 __isl_take isl_ast_expr *expr1,
9108                 __isl_take isl_ast_expr *expr2);
9109         __isl_give isl_ast_expr *isl_ast_expr_pdiv_q(
9110                 __isl_take isl_ast_expr *expr1,
9111                 __isl_take isl_ast_expr *expr2);
9112         __isl_give isl_ast_expr *isl_ast_expr_pdiv_r(
9113                 __isl_take isl_ast_expr *expr1,
9114                 __isl_take isl_ast_expr *expr2);
9115         __isl_give isl_ast_expr *isl_ast_expr_and(
9116                 __isl_take isl_ast_expr *expr1,
9117                 __isl_take isl_ast_expr *expr2)
9118         __isl_give isl_ast_expr *isl_ast_expr_and_then(
9119                 __isl_take isl_ast_expr *expr1,
9120                 __isl_take isl_ast_expr *expr2)
9121         __isl_give isl_ast_expr *isl_ast_expr_or(
9122                 __isl_take isl_ast_expr *expr1,
9123                 __isl_take isl_ast_expr *expr2)
9124         __isl_give isl_ast_expr *isl_ast_expr_or_else(
9125                 __isl_take isl_ast_expr *expr1,
9126                 __isl_take isl_ast_expr *expr2)
9127         __isl_give isl_ast_expr *isl_ast_expr_eq(
9128                 __isl_take isl_ast_expr *expr1,
9129                 __isl_take isl_ast_expr *expr2);
9130         __isl_give isl_ast_expr *isl_ast_expr_le(
9131                 __isl_take isl_ast_expr *expr1,
9132                 __isl_take isl_ast_expr *expr2);
9133         __isl_give isl_ast_expr *isl_ast_expr_lt(
9134                 __isl_take isl_ast_expr *expr1,
9135                 __isl_take isl_ast_expr *expr2);
9136         __isl_give isl_ast_expr *isl_ast_expr_ge(
9137                 __isl_take isl_ast_expr *expr1,
9138                 __isl_take isl_ast_expr *expr2);
9139         __isl_give isl_ast_expr *isl_ast_expr_gt(
9140                 __isl_take isl_ast_expr *expr1,
9141                 __isl_take isl_ast_expr *expr2);
9142         __isl_give isl_ast_expr *isl_ast_expr_access(
9143                 __isl_take isl_ast_expr *array,
9144                 __isl_take isl_ast_expr_list *indices);
9145         __isl_give isl_ast_expr *isl_ast_expr_call(
9146                 __isl_take isl_ast_expr *function,
9147                 __isl_take isl_ast_expr_list *arguments);
9149 The function C<isl_ast_expr_address_of> can be applied to an
9150 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
9151 to represent the address of the C<isl_ast_expr_access>. The function
9152 C<isl_ast_expr_and_then> as well as C<isl_ast_expr_or_else> are short-circuit
9153 versions of C<isl_ast_expr_and> and C<isl_ast_expr_or>, respectively.
9155         #include <isl/ast_build.h>
9156         __isl_give isl_ast_expr *isl_ast_build_expr_from_set(
9157                 __isl_keep isl_ast_build *build,
9158                 __isl_take isl_set *set);
9159         __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
9160                 __isl_keep isl_ast_build *build,
9161                 __isl_take isl_pw_aff *pa);
9162         __isl_give isl_ast_expr *
9163         isl_ast_build_access_from_pw_multi_aff(
9164                 __isl_keep isl_ast_build *build,
9165                 __isl_take isl_pw_multi_aff *pma);
9166         __isl_give isl_ast_expr *
9167         isl_ast_build_access_from_multi_pw_aff(
9168                 __isl_keep isl_ast_build *build,
9169                 __isl_take isl_multi_pw_aff *mpa);
9170         __isl_give isl_ast_expr *
9171         isl_ast_build_call_from_pw_multi_aff(
9172                 __isl_keep isl_ast_build *build,
9173                 __isl_take isl_pw_multi_aff *pma);
9174         __isl_give isl_ast_expr *
9175         isl_ast_build_call_from_multi_pw_aff(
9176                 __isl_keep isl_ast_build *build,
9177                 __isl_take isl_multi_pw_aff *mpa);
9179 The set <set> and
9180 the domains of C<pa>, C<mpa> and C<pma> should correspond
9181 to the schedule space of C<build>.
9182 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
9183 the function being called.
9184 If the accessed space is a nested relation, then it is taken
9185 to represent an access of the member specified by the range
9186 of this nested relation of the structure specified by the domain
9187 of the nested relation.
9189 The following functions can be used to modify an C<isl_ast_expr>.
9191         #include <isl/ast.h>
9192         __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
9193                 __isl_take isl_ast_expr *expr, int pos,
9194                 __isl_take isl_ast_expr *arg);
9196 Replace the argument of C<expr> at position C<pos> by C<arg>.
9198         #include <isl/ast.h>
9199         __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
9200                 __isl_take isl_ast_expr *expr,
9201                 __isl_take isl_id_to_ast_expr *id2expr);
9203 The function C<isl_ast_expr_substitute_ids> replaces the
9204 subexpressions of C<expr> of type C<isl_ast_expr_id>
9205 by the corresponding expression in C<id2expr>, if there is any.
9208 User specified data can be attached to an C<isl_ast_node> and obtained
9209 from the same C<isl_ast_node> using the following functions.
9211         #include <isl/ast.h>
9212         __isl_give isl_ast_node *isl_ast_node_set_annotation(
9213                 __isl_take isl_ast_node *node,
9214                 __isl_take isl_id *annotation);
9215         __isl_give isl_id *isl_ast_node_get_annotation(
9216                 __isl_keep isl_ast_node *node);
9218 Basic printing can be performed using the following functions.
9220         #include <isl/ast.h>
9221         __isl_give isl_printer *isl_printer_print_ast_expr(
9222                 __isl_take isl_printer *p,
9223                 __isl_keep isl_ast_expr *expr);
9224         __isl_give isl_printer *isl_printer_print_ast_node(
9225                 __isl_take isl_printer *p,
9226                 __isl_keep isl_ast_node *node);
9227         __isl_give char *isl_ast_expr_to_str(
9228                 __isl_keep isl_ast_expr *expr);
9230 More advanced printing can be performed using the following functions.
9232         #include <isl/ast.h>
9233         __isl_give isl_printer *isl_ast_op_type_print_macro(
9234                 enum isl_ast_op_type type,
9235                 __isl_take isl_printer *p);
9236         __isl_give isl_printer *isl_ast_node_print_macros(
9237                 __isl_keep isl_ast_node *node,
9238                 __isl_take isl_printer *p);
9239         __isl_give isl_printer *isl_ast_node_print(
9240                 __isl_keep isl_ast_node *node,
9241                 __isl_take isl_printer *p,
9242                 __isl_take isl_ast_print_options *options);
9243         __isl_give isl_printer *isl_ast_node_for_print(
9244                 __isl_keep isl_ast_node *node,
9245                 __isl_take isl_printer *p,
9246                 __isl_take isl_ast_print_options *options);
9247         __isl_give isl_printer *isl_ast_node_if_print(
9248                 __isl_keep isl_ast_node *node,
9249                 __isl_take isl_printer *p,
9250                 __isl_take isl_ast_print_options *options);
9252 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
9253 C<isl> may print out an AST that makes use of macros such
9254 as C<floord>, C<min> and C<max>.
9255 C<isl_ast_op_type_print_macro> prints out the macro
9256 corresponding to a specific C<isl_ast_op_type>.
9257 C<isl_ast_node_print_macros> scans the C<isl_ast_node>
9258 for expressions where these macros would be used and prints
9259 out the required macro definitions.
9260 Essentially, C<isl_ast_node_print_macros> calls
9261 C<isl_ast_node_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
9262 as function argument.
9263 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
9264 C<isl_ast_node_if_print> print an C<isl_ast_node>
9265 in C<ISL_FORMAT_C>, but allow for some extra control
9266 through an C<isl_ast_print_options> object.
9267 This object can be created using the following functions.
9269         #include <isl/ast.h>
9270         __isl_give isl_ast_print_options *
9271         isl_ast_print_options_alloc(isl_ctx *ctx);
9272         __isl_give isl_ast_print_options *
9273         isl_ast_print_options_copy(
9274                 __isl_keep isl_ast_print_options *options);
9275         __isl_null isl_ast_print_options *
9276         isl_ast_print_options_free(
9277                 __isl_take isl_ast_print_options *options);
9279         __isl_give isl_ast_print_options *
9280         isl_ast_print_options_set_print_user(
9281                 __isl_take isl_ast_print_options *options,
9282                 __isl_give isl_printer *(*print_user)(
9283                         __isl_take isl_printer *p,
9284                         __isl_take isl_ast_print_options *options,
9285                         __isl_keep isl_ast_node *node, void *user),
9286                 void *user);
9287         __isl_give isl_ast_print_options *
9288         isl_ast_print_options_set_print_for(
9289                 __isl_take isl_ast_print_options *options,
9290                 __isl_give isl_printer *(*print_for)(
9291                         __isl_take isl_printer *p,
9292                         __isl_take isl_ast_print_options *options,
9293                         __isl_keep isl_ast_node *node, void *user),
9294                 void *user);
9296 The callback set by C<isl_ast_print_options_set_print_user>
9297 is called whenever a node of type C<isl_ast_node_user> needs to
9298 be printed.
9299 The callback set by C<isl_ast_print_options_set_print_for>
9300 is called whenever a node of type C<isl_ast_node_for> needs to
9301 be printed.
9302 Note that C<isl_ast_node_for_print> will I<not> call the
9303 callback set by C<isl_ast_print_options_set_print_for> on the node
9304 on which C<isl_ast_node_for_print> is called, but only on nested
9305 nodes of type C<isl_ast_node_for>.  It is therefore safe to
9306 call C<isl_ast_node_for_print> from within the callback set by
9307 C<isl_ast_print_options_set_print_for>.
9309 The following option determines the type to be used for iterators
9310 while printing the AST.
9312         isl_stat isl_options_set_ast_iterator_type(
9313                 isl_ctx *ctx, const char *val);
9314         const char *isl_options_get_ast_iterator_type(
9315                 isl_ctx *ctx);
9317 The AST printer only prints body nodes as blocks if these
9318 blocks cannot be safely omitted.
9319 For example, a C<for> node with one body node will not be
9320 surrounded with braces in C<ISL_FORMAT_C>.
9321 A block will always be printed by setting the following option.
9323         isl_stat isl_options_set_ast_always_print_block(isl_ctx *ctx,
9324                 int val);
9325         int isl_options_get_ast_always_print_block(isl_ctx *ctx);
9327 =head3 Options
9329         #include <isl/ast_build.h>
9330         isl_stat isl_options_set_ast_build_atomic_upper_bound(
9331                 isl_ctx *ctx, int val);
9332         int isl_options_get_ast_build_atomic_upper_bound(
9333                 isl_ctx *ctx);
9334         isl_stat isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
9335                 int val);
9336         int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
9337         isl_stat isl_options_set_ast_build_exploit_nested_bounds(
9338                 isl_ctx *ctx, int val);
9339         int isl_options_get_ast_build_exploit_nested_bounds(
9340                 isl_ctx *ctx);
9341         isl_stat isl_options_set_ast_build_group_coscheduled(
9342                 isl_ctx *ctx, int val);
9343         int isl_options_get_ast_build_group_coscheduled(
9344                 isl_ctx *ctx);
9345         isl_stat isl_options_set_ast_build_scale_strides(
9346                 isl_ctx *ctx, int val);
9347         int isl_options_get_ast_build_scale_strides(
9348                 isl_ctx *ctx);
9349         isl_stat isl_options_set_ast_build_allow_else(isl_ctx *ctx,
9350                 int val);
9351         int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
9352         isl_stat isl_options_set_ast_build_allow_or(isl_ctx *ctx,
9353                 int val);
9354         int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
9356 =over
9358 =item * ast_build_atomic_upper_bound
9360 Generate loop upper bounds that consist of the current loop iterator,
9361 an operator and an expression not involving the iterator.
9362 If this option is not set, then the current loop iterator may appear
9363 several times in the upper bound.
9364 For example, when this option is turned off, AST generation
9365 for the schedule
9367         [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
9369 produces
9371         for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
9372           A(c0);
9374 When the option is turned on, the following AST is generated
9376         for (int c0 = 0; c0 <= min(100, n); c0 += 1)
9377           A(c0);
9379 =item * ast_build_prefer_pdiv
9381 If this option is turned off, then the AST generation will
9382 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
9383 operators, but no C<isl_ast_op_pdiv_q> or
9384 C<isl_ast_op_pdiv_r> operators.
9385 If this options is turned on, then C<isl> will try to convert
9386 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
9387 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
9389 =item * ast_build_exploit_nested_bounds
9391 Simplify conditions based on bounds of nested for loops.
9392 In particular, remove conditions that are implied by the fact
9393 that one or more nested loops have at least one iteration,
9394 meaning that the upper bound is at least as large as the lower bound.
9395 For example, when this option is turned off, AST generation
9396 for the schedule
9398         [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
9399                                         0 <= j <= M }
9401 produces
9403         if (M >= 0)
9404           for (int c0 = 0; c0 <= N; c0 += 1)
9405             for (int c1 = 0; c1 <= M; c1 += 1)
9406               A(c0, c1);
9408 When the option is turned on, the following AST is generated
9410         for (int c0 = 0; c0 <= N; c0 += 1)
9411           for (int c1 = 0; c1 <= M; c1 += 1)
9412             A(c0, c1);
9414 =item * ast_build_group_coscheduled
9416 If two domain elements are assigned the same schedule point, then
9417 they may be executed in any order and they may even appear in different
9418 loops.  If this options is set, then the AST generator will make
9419 sure that coscheduled domain elements do not appear in separate parts
9420 of the AST.  This is useful in case of nested AST generation
9421 if the outer AST generation is given only part of a schedule
9422 and the inner AST generation should handle the domains that are
9423 coscheduled by this initial part of the schedule together.
9424 For example if an AST is generated for a schedule
9426         { A[i] -> [0]; B[i] -> [0] }
9428 then the C<isl_ast_build_set_create_leaf> callback described
9429 below may get called twice, once for each domain.
9430 Setting this option ensures that the callback is only called once
9431 on both domains together.
9433 =item * ast_build_separation_bounds
9435 This option specifies which bounds to use during separation.
9436 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
9437 then all (possibly implicit) bounds on the current dimension will
9438 be used during separation.
9439 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
9440 then only those bounds that are explicitly available will
9441 be used during separation.
9443 =item * ast_build_scale_strides
9445 This option specifies whether the AST generator is allowed
9446 to scale down iterators of strided loops.
9448 =item * ast_build_allow_else
9450 This option specifies whether the AST generator is allowed
9451 to construct if statements with else branches.
9453 =item * ast_build_allow_or
9455 This option specifies whether the AST generator is allowed
9456 to construct if conditions with disjunctions.
9458 =back
9460 =head3 AST Generation Options (Schedule Tree)
9462 In case of AST construction from a schedule tree, the options
9463 that control how an AST is created from the individual schedule
9464 dimensions are stored in the band nodes of the tree
9465 (see L</"Schedule Trees">).
9467 In particular, a schedule dimension can be handled in four
9468 different ways, atomic, separate, unroll or the default.
9469 This loop AST generation type can be set using
9470 C<isl_schedule_node_band_member_set_ast_loop_type>.
9471 Alternatively,
9472 the first three can be selected by including a one-dimensional
9473 element with as value the position of the schedule dimension
9474 within the band and as name one of C<atomic>, C<separate>
9475 or C<unroll> in the options
9476 set by C<isl_schedule_node_band_set_ast_build_options>.
9477 Only one of these three may be specified for
9478 any given schedule dimension within a band node.
9479 If none of these is specified, then the default
9480 is used.  The meaning of the options is as follows.
9482 =over
9484 =item C<atomic>
9486 When this option is specified, the AST generator will make
9487 sure that a given domains space only appears in a single
9488 loop at the specified level.
9490 For example, for the schedule tree
9492         domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
9493         child:
9494           schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
9495           options: "{ atomic[x] }"
9497 the following AST will be generated
9499         for (int c0 = 0; c0 <= 10; c0 += 1) {
9500           if (c0 >= 1)
9501             b(c0 - 1);
9502           if (c0 <= 9)
9503             a(c0);
9504         }
9506 On the other hand, for the schedule tree
9508         domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
9509         child:
9510           schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
9511           options: "{ separate[x] }"
9513 the following AST will be generated
9515         {
9516           a(0);
9517           for (int c0 = 1; c0 <= 9; c0 += 1) {
9518             b(c0 - 1);
9519             a(c0);
9520           }
9521           b(9);
9522         }
9524 If neither C<atomic> nor C<separate> is specified, then the AST generator
9525 may produce either of these two results or some intermediate form.
9527 =item C<separate>
9529 When this option is specified, the AST generator will
9530 split the domain of the specified schedule dimension
9531 into pieces with a fixed set of statements for which
9532 instances need to be executed by the iterations in
9533 the schedule domain part.  This option tends to avoid
9534 the generation of guards inside the corresponding loops.
9535 See also the C<atomic> option.
9537 =item C<unroll>
9539 When this option is specified, the AST generator will
9540 I<completely> unroll the corresponding schedule dimension.
9541 It is the responsibility of the user to ensure that such
9542 unrolling is possible.
9543 To obtain a partial unrolling, the user should apply an additional
9544 strip-mining to the schedule and fully unroll the inner schedule
9545 dimension.
9547 =back
9549 The C<isolate> option is a bit more involved.  It allows the user
9550 to isolate a range of schedule dimension values from smaller and
9551 greater values.  Additionally, the user may specify a different
9552 atomic/separate/unroll choice for the isolated part and the remaining
9553 parts.  The typical use case of the C<isolate> option is to isolate
9554 full tiles from partial tiles.
9555 The part that needs to be isolated may depend on outer schedule dimensions.
9556 The option therefore needs to be able to reference those outer schedule
9557 dimensions.  In particular, the space of the C<isolate> option is that
9558 of a wrapped map with as domain the flat product of all outer band nodes
9559 and as range the space of the current band node.
9560 The atomic/separate/unroll choice for the isolated part is determined
9561 by an option that lives in an unnamed wrapped space with as domain
9562 a zero-dimensional C<isolate> space and as range the regular
9563 C<atomic>, C<separate> or C<unroll> space.
9564 This option may also be set directly using
9565 C<isl_schedule_node_band_member_set_isolate_ast_loop_type>.
9566 The atomic/separate/unroll choice for the remaining part is determined
9567 by the regular C<atomic>, C<separate> or C<unroll> option.
9568 The use of the C<isolate> option causes any tree containing the node
9569 to be considered anchored.
9571 As an example, consider the isolation of full tiles from partial tiles
9572 in a tiling of a triangular domain.  The original schedule is as follows.
9574         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
9575         child:
9576           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
9577                 { A[i,j] -> [floor(j/10)] }, \
9578                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
9580 The output is
9582         for (int c0 = 0; c0 <= 10; c0 += 1)
9583           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9584             for (int c2 = 10 * c0;
9585                  c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9586               for (int c3 = 10 * c1;
9587                    c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9588                 A(c2, c3);
9590 Isolating the full tiles, we have the following input
9592         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
9593         child:
9594           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
9595                 { A[i,j] -> [floor(j/10)] }, \
9596                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
9597           options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
9598                 10a+9+10b+9 <= 100 }"
9600 and output
9602         {
9603           for (int c0 = 0; c0 <= 8; c0 += 1) {
9604             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
9605               for (int c2 = 10 * c0;
9606                    c2 <= 10 * c0 + 9; c2 += 1)
9607                 for (int c3 = 10 * c1;
9608                      c3 <= 10 * c1 + 9; c3 += 1)
9609                   A(c2, c3);
9610             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
9611               for (int c2 = 10 * c0;
9612                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9613                 for (int c3 = 10 * c1;
9614                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9615                   A(c2, c3);
9616           }
9617           for (int c0 = 9; c0 <= 10; c0 += 1)
9618             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9619               for (int c2 = 10 * c0;
9620                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9621                 for (int c3 = 10 * c1;
9622                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9623                   A(c2, c3);
9624         }
9626 We may then additionally unroll the innermost loop of the isolated part
9628         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
9629         child:
9630           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
9631                 { A[i,j] -> [floor(j/10)] }, \
9632                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
9633           options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
9634                 10a+9+10b+9 <= 100; [isolate[] -> unroll[3]] }"
9636 to obtain
9638         {
9639           for (int c0 = 0; c0 <= 8; c0 += 1) {
9640             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
9641               for (int c2 = 10 * c0; c2 <= 10 * c0 + 9; c2 += 1) {
9642                 A(c2, 10 * c1);
9643                 A(c2, 10 * c1 + 1);
9644                 A(c2, 10 * c1 + 2);
9645                 A(c2, 10 * c1 + 3);
9646                 A(c2, 10 * c1 + 4);
9647                 A(c2, 10 * c1 + 5);
9648                 A(c2, 10 * c1 + 6);
9649                 A(c2, 10 * c1 + 7);
9650                 A(c2, 10 * c1 + 8);
9651                 A(c2, 10 * c1 + 9);
9652               }
9653             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
9654               for (int c2 = 10 * c0;
9655                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9656                 for (int c3 = 10 * c1;
9657                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9658                   A(c2, c3);
9659           }
9660           for (int c0 = 9; c0 <= 10; c0 += 1)
9661             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9662               for (int c2 = 10 * c0;
9663                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9664                 for (int c3 = 10 * c1;
9665                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9666                   A(c2, c3);
9667         }
9670 =head3 AST Generation Options (Schedule Map)
9672 In case of AST construction using
9673 C<isl_ast_build_node_from_schedule_map>, the options
9674 that control how an AST is created from the individual schedule
9675 dimensions are stored in the C<isl_ast_build>.
9676 They can be set using the following function.
9678         #include <isl/ast_build.h>
9679         __isl_give isl_ast_build *
9680         isl_ast_build_set_options(
9681                 __isl_take isl_ast_build *control,
9682                 __isl_take isl_union_map *options);
9684 The options are encoded in an C<isl_union_map>.
9685 The domain of this union relation refers to the schedule domain,
9686 i.e., the range of the schedule passed
9687 to C<isl_ast_build_node_from_schedule_map>.
9688 In the case of nested AST generation (see L</"Nested AST Generation">),
9689 the domain of C<options> should refer to the extra piece of the schedule.
9690 That is, it should be equal to the range of the wrapped relation in the
9691 range of the schedule.
9692 The range of the options can consist of elements in one or more spaces,
9693 the names of which determine the effect of the option.
9694 The values of the range typically also refer to the schedule dimension
9695 to which the option applies.  In case of nested AST generation
9696 (see L</"Nested AST Generation">), these values refer to the position
9697 of the schedule dimension within the innermost AST generation.
9698 The constraints on the domain elements of
9699 the option should only refer to this dimension and earlier dimensions.
9700 We consider the following spaces.
9702 =over
9704 =item C<separation_class>
9706 B<This option has been deprecated.  Use the isolate option on
9707 schedule trees instead.>
9709 This space is a wrapped relation between two one dimensional spaces.
9710 The input space represents the schedule dimension to which the option
9711 applies and the output space represents the separation class.
9712 While constructing a loop corresponding to the specified schedule
9713 dimension(s), the AST generator will try to generate separate loops
9714 for domain elements that are assigned different classes.
9715 If only some of the elements are assigned a class, then those elements
9716 that are not assigned any class will be treated as belonging to a class
9717 that is separate from the explicitly assigned classes.
9718 The typical use case for this option is to separate full tiles from
9719 partial tiles.
9720 The other options, described below, are applied after the separation
9721 into classes.
9723 As an example, consider the separation into full and partial tiles
9724 of a tiling of a triangular domain.
9725 Take, for example, the domain
9727         { A[i,j] : 0 <= i,j and i + j <= 100 }
9729 and a tiling into tiles of 10 by 10.  The input to the AST generator
9730 is then the schedule
9732         { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
9733                                                 i + j <= 100 }
9735 Without any options, the following AST is generated
9737         for (int c0 = 0; c0 <= 10; c0 += 1)
9738           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9739             for (int c2 = 10 * c0;
9740                  c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
9741                  c2 += 1)
9742               for (int c3 = 10 * c1;
9743                    c3 <= min(10 * c1 + 9, -c2 + 100);
9744                    c3 += 1)
9745                 A(c2, c3);
9747 Separation into full and partial tiles can be obtained by assigning
9748 a class, say C<0>, to the full tiles.  The full tiles are represented by those
9749 values of the first and second schedule dimensions for which there are
9750 values of the third and fourth dimensions to cover an entire tile.
9751 That is, we need to specify the following option
9753         { [a,b,c,d] -> separation_class[[0]->[0]] :
9754                 exists b': 0 <= 10a,10b' and
9755                            10a+9+10b'+9 <= 100;
9756           [a,b,c,d] -> separation_class[[1]->[0]] :
9757                 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
9759 which simplifies to
9761         { [a, b, c, d] -> separation_class[[1] -> [0]] :
9762                 a >= 0 and b >= 0 and b <= 8 - a;
9763           [a, b, c, d] -> separation_class[[0] -> [0]] :
9764                 a >= 0 and a <= 8 }
9766 With this option, the generated AST is as follows
9768         {
9769           for (int c0 = 0; c0 <= 8; c0 += 1) {
9770             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
9771               for (int c2 = 10 * c0;
9772                    c2 <= 10 * c0 + 9; c2 += 1)
9773                 for (int c3 = 10 * c1;
9774                      c3 <= 10 * c1 + 9; c3 += 1)
9775                   A(c2, c3);
9776             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
9777               for (int c2 = 10 * c0;
9778                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
9779                    c2 += 1)
9780                 for (int c3 = 10 * c1;
9781                      c3 <= min(-c2 + 100, 10 * c1 + 9);
9782                      c3 += 1)
9783                   A(c2, c3);
9784           }
9785           for (int c0 = 9; c0 <= 10; c0 += 1)
9786             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9787               for (int c2 = 10 * c0;
9788                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
9789                    c2 += 1)
9790                 for (int c3 = 10 * c1;
9791                      c3 <= min(10 * c1 + 9, -c2 + 100);
9792                      c3 += 1)
9793                   A(c2, c3);
9794         }
9796 =item C<separate>
9798 This is a single-dimensional space representing the schedule dimension(s)
9799 to which ``separation'' should be applied.  Separation tries to split
9800 a loop into several pieces if this can avoid the generation of guards
9801 inside the loop.
9802 See also the C<atomic> option.
9804 =item C<atomic>
9806 This is a single-dimensional space representing the schedule dimension(s)
9807 for which the domains should be considered ``atomic''.  That is, the
9808 AST generator will make sure that any given domain space will only appear
9809 in a single loop at the specified level.
9811 Consider the following schedule
9813         { a[i] -> [i] : 0 <= i < 10;
9814           b[i] -> [i+1] : 0 <= i < 10 }
9816 If the following option is specified
9818         { [i] -> separate[x] }
9820 then the following AST will be generated
9822         {
9823           a(0);
9824           for (int c0 = 1; c0 <= 9; c0 += 1) {
9825             a(c0);
9826             b(c0 - 1);
9827           }
9828           b(9);
9829         }
9831 If, on the other hand, the following option is specified
9833         { [i] -> atomic[x] }
9835 then the following AST will be generated
9837         for (int c0 = 0; c0 <= 10; c0 += 1) {
9838           if (c0 <= 9)
9839             a(c0);
9840           if (c0 >= 1)
9841             b(c0 - 1);
9842         }
9844 If neither C<atomic> nor C<separate> is specified, then the AST generator
9845 may produce either of these two results or some intermediate form.
9847 =item C<unroll>
9849 This is a single-dimensional space representing the schedule dimension(s)
9850 that should be I<completely> unrolled.
9851 To obtain a partial unrolling, the user should apply an additional
9852 strip-mining to the schedule and fully unroll the inner loop.
9854 =back
9856 =head3 Fine-grained Control over AST Generation
9858 Besides specifying the constraints on the parameters,
9859 an C<isl_ast_build> object can be used to control
9860 various aspects of the AST generation process.
9861 In case of AST construction using
9862 C<isl_ast_build_node_from_schedule_map>,
9863 the most prominent way of control is through ``options'',
9864 as explained above.
9866 Additional control is available through the following functions.
9868         #include <isl/ast_build.h>
9869         __isl_give isl_ast_build *
9870         isl_ast_build_set_iterators(
9871                 __isl_take isl_ast_build *control,
9872                 __isl_take isl_id_list *iterators);
9874 The function C<isl_ast_build_set_iterators> allows the user to
9875 specify a list of iterator C<isl_id>s to be used as iterators.
9876 If the input schedule is injective, then
9877 the number of elements in this list should be as large as the dimension
9878 of the schedule space, but no direct correspondence should be assumed
9879 between dimensions and elements.
9880 If the input schedule is not injective, then an additional number
9881 of C<isl_id>s equal to the largest dimension of the input domains
9882 may be required.
9883 If the number of provided C<isl_id>s is insufficient, then additional
9884 names are automatically generated.
9886         #include <isl/ast_build.h>
9887         __isl_give isl_ast_build *
9888         isl_ast_build_set_create_leaf(
9889                 __isl_take isl_ast_build *control,
9890                 __isl_give isl_ast_node *(*fn)(
9891                         __isl_take isl_ast_build *build,
9892                         void *user), void *user);
9895 C<isl_ast_build_set_create_leaf> function allows for the
9896 specification of a callback that should be called whenever the AST
9897 generator arrives at an element of the schedule domain.
9898 The callback should return an AST node that should be inserted
9899 at the corresponding position of the AST.  The default action (when
9900 the callback is not set) is to continue generating parts of the AST to scan
9901 all the domain elements associated to the schedule domain element
9902 and to insert user nodes, ``calling'' the domain element, for each of them.
9903 The C<build> argument contains the current state of the C<isl_ast_build>.
9904 To ease nested AST generation (see L</"Nested AST Generation">),
9905 all control information that is
9906 specific to the current AST generation such as the options and
9907 the callbacks has been removed from this C<isl_ast_build>.
9908 The callback would typically return the result of a nested
9909 AST generation or a
9910 user defined node created using the following function.
9912         #include <isl/ast.h>
9913         __isl_give isl_ast_node *isl_ast_node_alloc_user(
9914                 __isl_take isl_ast_expr *expr);
9916         #include <isl/ast_build.h>
9917         __isl_give isl_ast_build *
9918         isl_ast_build_set_at_each_domain(
9919                 __isl_take isl_ast_build *build,
9920                 __isl_give isl_ast_node *(*fn)(
9921                         __isl_take isl_ast_node *node,
9922                         __isl_keep isl_ast_build *build,
9923                         void *user), void *user);
9924         __isl_give isl_ast_build *
9925         isl_ast_build_set_before_each_for(
9926                 __isl_take isl_ast_build *build,
9927                 __isl_give isl_id *(*fn)(
9928                         __isl_keep isl_ast_build *build,
9929                         void *user), void *user);
9930         __isl_give isl_ast_build *
9931         isl_ast_build_set_after_each_for(
9932                 __isl_take isl_ast_build *build,
9933                 __isl_give isl_ast_node *(*fn)(
9934                         __isl_take isl_ast_node *node,
9935                         __isl_keep isl_ast_build *build,
9936                         void *user), void *user);
9937         __isl_give isl_ast_build *
9938         isl_ast_build_set_before_each_mark(
9939                 __isl_take isl_ast_build *build,
9940                 isl_stat (*fn)(__isl_keep isl_id *mark,
9941                         __isl_keep isl_ast_build *build,
9942                         void *user), void *user);
9943         __isl_give isl_ast_build *
9944         isl_ast_build_set_after_each_mark(
9945                 __isl_take isl_ast_build *build,
9946                 __isl_give isl_ast_node *(*fn)(
9947                         __isl_take isl_ast_node *node,
9948                         __isl_keep isl_ast_build *build,
9949                         void *user), void *user);
9951 The callback set by C<isl_ast_build_set_at_each_domain> will
9952 be called for each domain AST node.
9953 The callbacks set by C<isl_ast_build_set_before_each_for>
9954 and C<isl_ast_build_set_after_each_for> will be called
9955 for each for AST node.  The first will be called in depth-first
9956 pre-order, while the second will be called in depth-first post-order.
9957 Since C<isl_ast_build_set_before_each_for> is called before the for
9958 node is actually constructed, it is only passed an C<isl_ast_build>.
9959 The returned C<isl_id> will be added as an annotation (using
9960 C<isl_ast_node_set_annotation>) to the constructed for node.
9961 In particular, if the user has also specified an C<after_each_for>
9962 callback, then the annotation can be retrieved from the node passed to
9963 that callback using C<isl_ast_node_get_annotation>.
9964 The callbacks set by C<isl_ast_build_set_before_each_mark>
9965 and C<isl_ast_build_set_after_each_mark> will be called for each
9966 mark AST node that is created, i.e., for each mark schedule node
9967 in the input schedule tree.  The first will be called in depth-first
9968 pre-order, while the second will be called in depth-first post-order.
9969 Since the callback set by C<isl_ast_build_set_before_each_mark>
9970 is called before the mark AST node is actually constructed, it is passed
9971 the identifier of the mark node.
9972 All callbacks should C<NULL> (or -1) on failure.
9973 The given C<isl_ast_build> can be used to create new
9974 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
9975 or C<isl_ast_build_call_from_pw_multi_aff>.
9977 =head3 Nested AST Generation
9979 C<isl> allows the user to create an AST within the context
9980 of another AST.  These nested ASTs are created using the
9981 same C<isl_ast_build_node_from_schedule_map> function that is used to create
9982 the outer AST.  The C<build> argument should be an C<isl_ast_build>
9983 passed to a callback set by
9984 C<isl_ast_build_set_create_leaf>.
9985 The space of the range of the C<schedule> argument should refer
9986 to this build.  In particular, the space should be a wrapped
9987 relation and the domain of this wrapped relation should be the
9988 same as that of the range of the schedule returned by
9989 C<isl_ast_build_get_schedule> below.
9990 In practice, the new schedule is typically
9991 created by calling C<isl_union_map_range_product> on the old schedule
9992 and some extra piece of the schedule.
9993 The space of the schedule domain is also available from
9994 the C<isl_ast_build>.
9996         #include <isl/ast_build.h>
9997         __isl_give isl_union_map *isl_ast_build_get_schedule(
9998                 __isl_keep isl_ast_build *build);
9999         __isl_give isl_space *isl_ast_build_get_schedule_space(
10000                 __isl_keep isl_ast_build *build);
10001         __isl_give isl_ast_build *isl_ast_build_restrict(
10002                 __isl_take isl_ast_build *build,
10003                 __isl_take isl_set *set);
10005 The C<isl_ast_build_get_schedule> function returns a (partial)
10006 schedule for the domains elements for which part of the AST still needs to
10007 be generated in the current build.
10008 In particular, the domain elements are mapped to those iterations of the loops
10009 enclosing the current point of the AST generation inside which
10010 the domain elements are executed.
10011 No direct correspondence between
10012 the input schedule and this schedule should be assumed.
10013 The space obtained from C<isl_ast_build_get_schedule_space> can be used
10014 to create a set for C<isl_ast_build_restrict> to intersect
10015 with the current build.  In particular, the set passed to
10016 C<isl_ast_build_restrict> can have additional parameters.
10017 The ids of the set dimensions in the space returned by
10018 C<isl_ast_build_get_schedule_space> correspond to the
10019 iterators of the already generated loops.
10020 The user should not rely on the ids of the output dimensions
10021 of the relations in the union relation returned by
10022 C<isl_ast_build_get_schedule> having any particular value.
10024 =head1 Applications
10026 Although C<isl> is mainly meant to be used as a library,
10027 it also contains some basic applications that use some
10028 of the functionality of C<isl>.
10029 The input may be specified in either the L<isl format>
10030 or the L<PolyLib format>.
10032 =head2 C<isl_polyhedron_sample>
10034 C<isl_polyhedron_sample> takes a polyhedron as input and prints
10035 an integer element of the polyhedron, if there is any.
10036 The first column in the output is the denominator and is always
10037 equal to 1.  If the polyhedron contains no integer points,
10038 then a vector of length zero is printed.
10040 =head2 C<isl_pip>
10042 C<isl_pip> takes the same input as the C<example> program
10043 from the C<piplib> distribution, i.e., a set of constraints
10044 on the parameters, a line containing only -1 and finally a set
10045 of constraints on a parametric polyhedron.
10046 The coefficients of the parameters appear in the last columns
10047 (but before the final constant column).
10048 The output is the lexicographic minimum of the parametric polyhedron.
10049 As C<isl> currently does not have its own output format, the output
10050 is just a dump of the internal state.
10052 =head2 C<isl_polyhedron_minimize>
10054 C<isl_polyhedron_minimize> computes the minimum of some linear
10055 or affine objective function over the integer points in a polyhedron.
10056 If an affine objective function
10057 is given, then the constant should appear in the last column.
10059 =head2 C<isl_polytope_scan>
10061 Given a polytope, C<isl_polytope_scan> prints
10062 all integer points in the polytope.
10064 =head2 C<isl_codegen>
10066 Given a schedule, a context set and an options relation,
10067 C<isl_codegen> prints out an AST that scans the domain elements
10068 of the schedule in the order of their image(s) taking into account
10069 the constraints in the context set.