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