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