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