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