add isl_schedule_node_extension
[isl.git] / doc / user.pod
blobd3c44e5e1376548d29666a8825a2e513495c931c
1 =head1 Introduction
3 C<isl> is a thread-safe C library for manipulating
4 sets and relations of integer points bounded by affine constraints.
5 The descriptions of the sets and relations may involve
6 both parameters and existentially quantified variables.
7 All computations are performed in exact integer arithmetic
8 using C<GMP> or C<imath>.
9 The C<isl> library offers functionality that is similar
10 to that offered by the C<Omega> and C<Omega+> libraries,
11 but the underlying algorithms are in most cases completely different.
13 The library is by no means complete and some fairly basic
14 functionality is still missing.
15 Still, even in its current form, the library has been successfully
16 used as a backend polyhedral library for the polyhedral
17 scanner C<CLooG> and as part of an equivalence checker of
18 static affine programs.
19 For bug reports, feature requests and questions,
20 visit the discussion group at
21 L<http://groups.google.com/group/isl-development>.
23 =head2 Backward Incompatible Changes
25 =head3 Changes since isl-0.02
27 =over
29 =item * The old printing functions have been deprecated
30 and replaced by C<isl_printer> functions, see L<Input and Output>.
32 =item * Most functions related to dependence analysis have acquired
33 an extra C<must> argument.  To obtain the old behavior, this argument
34 should be given the value 1.  See L<Dependence Analysis>.
36 =back
38 =head3 Changes since isl-0.03
40 =over
42 =item * The function C<isl_pw_qpolynomial_fold_add> has been
43 renamed to C<isl_pw_qpolynomial_fold_fold>.
44 Similarly, C<isl_union_pw_qpolynomial_fold_add> has been
45 renamed to C<isl_union_pw_qpolynomial_fold_fold>.
47 =back
49 =head3 Changes since isl-0.04
51 =over
53 =item * All header files have been renamed from C<isl_header.h>
54 to C<isl/header.h>.
56 =back
58 =head3 Changes since isl-0.05
60 =over
62 =item * The functions C<isl_printer_print_basic_set> and
63 C<isl_printer_print_basic_map> no longer print a newline.
65 =item * The functions C<isl_flow_get_no_source>
66 and C<isl_union_map_compute_flow> now return
67 the accesses for which no source could be found instead of
68 the iterations where those accesses occur.
70 =item * The functions C<isl_basic_map_identity> and
71 C<isl_map_identity> now take a B<map> space as input.  An old call
72 C<isl_map_identity(space)> can be rewritten to
73 C<isl_map_identity(isl_space_map_from_set(space))>.
75 =item * The function C<isl_map_power> no longer takes
76 a parameter position as input.  Instead, the exponent
77 is now expressed as the domain of the resulting relation.
79 =back
81 =head3 Changes since isl-0.06
83 =over
85 =item * The format of C<isl_printer_print_qpolynomial>'s
86 C<ISL_FORMAT_ISL> output has changed.
87 Use C<ISL_FORMAT_C> to obtain the old output.
89 =item * The C<*_fast_*> functions have been renamed to C<*_plain_*>.
90 Some of the old names have been kept for backward compatibility,
91 but they will be removed in the future.
93 =back
95 =head3 Changes since isl-0.07
97 =over
99 =item * The function C<isl_pw_aff_max> has been renamed to
100 C<isl_pw_aff_union_max>.
101 Similarly, the function C<isl_pw_aff_add> has been renamed to
102 C<isl_pw_aff_union_add>.
104 =item * The C<isl_dim> type has been renamed to C<isl_space>
105 along with the associated functions.
106 Some of the old names have been kept for backward compatibility,
107 but they will be removed in the future.
109 =item * Spaces of maps, sets and parameter domains are now
110 treated differently.  The distinction between map spaces and set spaces
111 has always been made on a conceptual level, but proper use of such spaces
112 was never checked.  Furthermore, up until isl-0.07 there was no way
113 of explicitly creating a parameter space.  These can now be created
114 directly using C<isl_space_params_alloc> or from other spaces using
115 C<isl_space_params>.
117 =item * The space in which C<isl_aff>, C<isl_pw_aff>, C<isl_qpolynomial>,
118 C<isl_pw_qpolynomial>, C<isl_qpolynomial_fold> and C<isl_pw_qpolynomial_fold>
119 objects live is now a map space
120 instead of a set space.  This means, for example, that the dimensions
121 of the domain of an C<isl_aff> are now considered to be of type
122 C<isl_dim_in> instead of C<isl_dim_set>.  Extra functions have been
123 added to obtain the domain space.  Some of the constructors still
124 take a domain space and have therefore been renamed.
126 =item * The functions C<isl_equality_alloc> and C<isl_inequality_alloc>
127 now take an C<isl_local_space> instead of an C<isl_space>.
128 An C<isl_local_space> can be created from an C<isl_space>
129 using C<isl_local_space_from_space>.
131 =item * The C<isl_div> type has been removed.  Functions that used
132 to return an C<isl_div> now return an C<isl_aff>.
133 Note that the space of an C<isl_aff> is that of relation.
134 When replacing a call to C<isl_div_get_coefficient> by a call to
135 C<isl_aff_get_coefficient> any C<isl_dim_set> argument needs
136 to be replaced by C<isl_dim_in>.
137 A call to C<isl_aff_from_div> can be replaced by a call
138 to C<isl_aff_floor>.
139 A call to C<isl_qpolynomial_div(div)> call be replaced by
140 the nested call
142         isl_qpolynomial_from_aff(isl_aff_floor(div))
144 The function C<isl_constraint_div> has also been renamed
145 to C<isl_constraint_get_div>.
147 =item * The C<nparam> argument has been removed from
148 C<isl_map_read_from_str> and similar functions.
149 When reading input in the original PolyLib format,
150 the result will have no parameters.
151 If parameters are expected, the caller may want to perform
152 dimension manipulation on the result.
154 =back
156 =head3 Changes since isl-0.09
158 =over
160 =item * The C<schedule_split_parallel> option has been replaced
161 by the C<schedule_split_scaled> option.
163 =item * The first argument of C<isl_pw_aff_cond> is now
164 an C<isl_pw_aff> instead of an C<isl_set>.
165 A call C<isl_pw_aff_cond(a, b, c)> can be replaced by
167         isl_pw_aff_cond(isl_set_indicator_function(a), b, c)
169 =back
171 =head3 Changes since isl-0.10
173 =over
175 =item * The functions C<isl_set_dim_has_lower_bound> and
176 C<isl_set_dim_has_upper_bound> have been renamed to
177 C<isl_set_dim_has_any_lower_bound> and
178 C<isl_set_dim_has_any_upper_bound>.
179 The new C<isl_set_dim_has_lower_bound> and
180 C<isl_set_dim_has_upper_bound> have slightly different meanings.
182 =back
184 =head3 Changes since isl-0.12
186 =over
188 =item * C<isl_int> has been replaced by C<isl_val>.
189 Some of the old functions are still available in C<isl/deprecated/*.h>
190 but they will be removed in the future.
192 =item * The functions C<isl_pw_qpolynomial_eval>,
193 C<isl_union_pw_qpolynomial_eval>, C<isl_pw_qpolynomial_fold_eval>
194 and C<isl_union_pw_qpolynomial_fold_eval> have been changed to return
195 an C<isl_val> instead of an C<isl_qpolynomial>.
197 =item * The function C<isl_band_member_is_zero_distance>
198 has been removed.  Essentially the same functionality is available
199 through C<isl_band_member_is_coincident>, except that is requires
200 setting up coincidence constraints.
201 The option C<schedule_outer_zero_distance> has accordingly been
202 replaced by the option C<schedule_outer_coincidence>.
204 =item * The function C<isl_vertex_get_expr> has been changed
205 to return an C<isl_multi_aff> instead of a rational C<isl_basic_set>.
206 The function C<isl_vertex_get_domain> has been changed to return
207 a regular basic set, rather than a rational basic set.
209 =back
211 =head3 Changes since isl-0.14
213 =over
215 =item * Objects of type C<isl_union_pw_multi_aff> can no longer contain
216 two or more C<isl_pw_multi_aff> objects with the same domain space.
218 =item * The function C<isl_union_pw_multi_aff_add> now consistently
219 computes the sum on the shared definition domain.
220 The function C<isl_union_pw_multi_aff_union_add> has been added
221 to compute the sum on the union of definition domains.
222 The original behavior of C<isl_union_pw_multi_aff_add> was
223 confused and is no longer available.
225 =item * Band forests have been replaced by schedule trees.
227 =item * The function C<isl_union_map_compute_flow> has been
228 replaced by the function C<isl_union_access_info_compute_flow>.
229 Note that the may dependence relation returned by
230 C<isl_union_flow_get_may_dependence> is the union of
231 the two dependence relations returned by
232 C<isl_union_map_compute_flow>.  Similarly for the no source relations.
233 The function C<isl_union_map_compute_flow> is still available
234 for backward compatibility, but it will be removed in the future.
236 =item * The function C<isl_basic_set_drop_constraint> has been
237 deprecated.
239 =item * The function C<isl_ast_build_ast_from_schedule> has been
240 renamed to C<isl_ast_build_node_from_schedule_map>.
241 The original name is still available
242 for backward compatibility, but it will be removed in the future.
244 =item * The C<separation_class> AST generation option has been
245 deprecated.
247 =back
249 =head1 License
251 C<isl> is released under the MIT license.
253 =over
255 Permission is hereby granted, free of charge, to any person obtaining a copy of
256 this software and associated documentation files (the "Software"), to deal in
257 the Software without restriction, including without limitation the rights to
258 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
259 of the Software, and to permit persons to whom the Software is furnished to do
260 so, subject to the following conditions:
262 The above copyright notice and this permission notice shall be included in all
263 copies or substantial portions of the Software.
265 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
266 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
267 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
268 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
269 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
270 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
271 SOFTWARE.
273 =back
275 Note that by default C<isl> requires C<GMP>, which is released
276 under the GNU Lesser General Public License (LGPL).  This means
277 that code linked against C<isl> is also linked against LGPL code.
279 When configuring with C<--with-int=imath>, C<isl> will link against C<imath>, a
280 library for exact integer arithmetic released under the MIT license.
282 =head1 Installation
284 The source of C<isl> can be obtained either as a tarball
285 or from the git repository.  Both are available from
286 L<http://freshmeat.net/projects/isl/>.
287 The installation process depends on how you obtained
288 the source.
290 =head2 Installation from the git repository
292 =over
294 =item 1 Clone or update the repository
296 The first time the source is obtained, you need to clone
297 the repository.
299         git clone git://repo.or.cz/isl.git
301 To obtain updates, you need to pull in the latest changes
303         git pull
305 =item 2 Optionally get C<imath> submodule
307 To build C<isl> with C<imath>, you need to obtain the C<imath>
308 submodule by running in the git source tree of C<isl>
310        git submodule init
311        git submodule update
313 This will fetch the required version of C<imath> in a subdirectory of C<isl>.
315 =item 2 Generate C<configure>
317         ./autogen.sh
319 =back
321 After performing the above steps, continue
322 with the L<Common installation instructions>.
324 =head2 Common installation instructions
326 =over
328 =item 1 Obtain C<GMP>
330 By default, building C<isl> requires C<GMP>, including its headers files.
331 Your distribution may not provide these header files by default
332 and you may need to install a package called C<gmp-devel> or something
333 similar.  Alternatively, C<GMP> can be built from
334 source, available from L<http://gmplib.org/>.
335 C<GMP> is not needed if you build C<isl> with C<imath>.
337 =item 2 Configure
339 C<isl> uses the standard C<autoconf> C<configure> script.
340 To run it, just type
342         ./configure
344 optionally followed by some configure options.
345 A complete list of options can be obtained by running
347         ./configure --help
349 Below we discuss some of the more common options.
351 =over
353 =item C<--prefix>
355 Installation prefix for C<isl>
357 =item C<--with-int=[gmp|imath]>
359 Select the integer library to be used by C<isl>, the default is C<gmp>.
360 Note that C<isl> may run significantly slower if you use C<imath>.
362 =item C<--with-gmp-prefix>
364 Installation prefix for C<GMP> (architecture-independent files).
366 =item C<--with-gmp-exec-prefix>
368 Installation prefix for C<GMP> (architecture-dependent files).
370 =back
372 =item 3 Compile
374         make
376 =item 4 Install (optional)
378         make install
380 =back
382 =head1 Integer Set Library
384 =head2 Memory Management
386 Since a high-level operation on isl objects usually involves
387 several substeps and since the user is usually not interested in
388 the intermediate results, most functions that return a new object
389 will also release all the objects passed as arguments.
390 If the user still wants to use one or more of these arguments
391 after the function call, she should pass along a copy of the
392 object rather than the object itself.
393 The user is then responsible for making sure that the original
394 object gets used somewhere else or is explicitly freed.
396 The arguments and return values of all documented functions are
397 annotated to make clear which arguments are released and which
398 arguments are preserved.  In particular, the following annotations
399 are used
401 =over
403 =item C<__isl_give>
405 C<__isl_give> means that a new object is returned.
406 The user should make sure that the returned pointer is
407 used exactly once as a value for an C<__isl_take> argument.
408 In between, it can be used as a value for as many
409 C<__isl_keep> arguments as the user likes.
410 There is one exception, and that is the case where the
411 pointer returned is C<NULL>.  Is this case, the user
412 is free to use it as an C<__isl_take> argument or not.
413 When applied to a C<char *>, the returned pointer needs to be
414 freed using C<free>.
416 =item C<__isl_null>
418 C<__isl_null> means that a C<NULL> value is returned.
420 =item C<__isl_take>
422 C<__isl_take> means that the object the argument points to
423 is taken over by the function and may no longer be used
424 by the user as an argument to any other function.
425 The pointer value must be one returned by a function
426 returning an C<__isl_give> pointer.
427 If the user passes in a C<NULL> value, then this will
428 be treated as an error in the sense that the function will
429 not perform its usual operation.  However, it will still
430 make sure that all the other C<__isl_take> arguments
431 are released.
433 =item C<__isl_keep>
435 C<__isl_keep> means that the function will only use the object
436 temporarily.  After the function has finished, the user
437 can still use it as an argument to other functions.
438 A C<NULL> value will be treated in the same way as
439 a C<NULL> value for an C<__isl_take> argument.
440 This annotation may also be used on return values of
441 type C<const char *>, in which case the returned pointer should
442 not be freed by the user and is only valid until the object
443 from which it was derived is updated or freed.
445 =back
447 =head2 Initialization
449 All manipulations of integer sets and relations occur within
450 the context of an C<isl_ctx>.
451 A given C<isl_ctx> can only be used within a single thread.
452 All arguments of a function are required to have been allocated
453 within the same context.
454 There are currently no functions available for moving an object
455 from one C<isl_ctx> to another C<isl_ctx>.  This means that
456 there is currently no way of safely moving an object from one
457 thread to another, unless the whole C<isl_ctx> is moved.
459 An C<isl_ctx> can be allocated using C<isl_ctx_alloc> and
460 freed using C<isl_ctx_free>.
461 All objects allocated within an C<isl_ctx> should be freed
462 before the C<isl_ctx> itself is freed.
464         isl_ctx *isl_ctx_alloc();
465         void isl_ctx_free(isl_ctx *ctx);
467 The user can impose a bound on the number of low-level I<operations>
468 that can be performed by an C<isl_ctx>.  This bound can be set and
469 retrieved using the following functions.  A bound of zero means that
470 no bound is imposed.  The number of operations performed can be
471 reset using C<isl_ctx_reset_operations>.  Note that the number
472 of low-level operations needed to perform a high-level computation
473 may differ significantly across different versions
474 of C<isl>, but it should be the same across different platforms
475 for the same version of C<isl>.
477 Warning: This feature is experimental.  C<isl> has good support to abort and
478 bail out during the computation, but this feature may exercise error code paths
479 that are normally not used that much. Consequently, it is not unlikely that
480 hidden bugs will be exposed.
482         void isl_ctx_set_max_operations(isl_ctx *ctx,
483                 unsigned long max_operations);
484         unsigned long isl_ctx_get_max_operations(isl_ctx *ctx);
485         void isl_ctx_reset_operations(isl_ctx *ctx);
487 In order to be able to create an object in the same context
488 as another object, most object types (described later in
489 this document) provide a function to obtain the context
490 in which the object was created.
492         #include <isl/val.h>
493         isl_ctx *isl_val_get_ctx(__isl_keep isl_val *val);
494         isl_ctx *isl_multi_val_get_ctx(
495                 __isl_keep isl_multi_val *mv);
497         #include <isl/id.h>
498         isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
500         #include <isl/local_space.h>
501         isl_ctx *isl_local_space_get_ctx(
502                 __isl_keep isl_local_space *ls);
504         #include <isl/set.h>
505         isl_ctx *isl_set_list_get_ctx(
506                 __isl_keep isl_set_list *list);
508         #include <isl/aff.h>
509         isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
510         isl_ctx *isl_multi_aff_get_ctx(
511                 __isl_keep isl_multi_aff *maff);
512         isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pa);
513         isl_ctx *isl_pw_multi_aff_get_ctx(
514                 __isl_keep isl_pw_multi_aff *pma);
515         isl_ctx *isl_multi_pw_aff_get_ctx(
516                 __isl_keep isl_multi_pw_aff *mpa);
517         isl_ctx *isl_union_pw_aff_get_ctx(
518                 __isl_keep isl_union_pw_aff *upa);
519         isl_ctx *isl_union_pw_multi_aff_get_ctx(
520                 __isl_keep isl_union_pw_multi_aff *upma);
521         isl_ctx *isl_multi_union_pw_aff_get_ctx(
522                 __isl_keep isl_multi_union_pw_aff *mupa);
524         #include <isl/id_to_ast_expr.h>
525         isl_ctx *isl_id_to_ast_expr_get_ctx(
526                 __isl_keep isl_id_to_ast_expr *id2expr);
528         #include <isl/point.h>
529         isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
531         #include <isl/vec.h>
532         isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
534         #include <isl/mat.h>
535         isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
537         #include <isl/vertices.h>
538         isl_ctx *isl_vertices_get_ctx(
539                 __isl_keep isl_vertices *vertices);
540         isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
541         isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
543         #include <isl/flow.h>
544         isl_ctx *isl_restriction_get_ctx(
545                 __isl_keep isl_restriction *restr);
547         #include <isl/schedule.h>
548         isl_ctx *isl_schedule_get_ctx(
549                 __isl_keep isl_schedule *sched);
550         isl_ctx *isl_schedule_constraints_get_ctx(
551                 __isl_keep isl_schedule_constraints *sc);
553         #include <isl/schedule_node.h>
554         isl_ctx *isl_schedule_node_get_ctx(
555                 __isl_keep isl_schedule_node *node);
557         #include <isl/band.h>
558         isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band);
560         #include <isl/ast_build.h>
561         isl_ctx *isl_ast_build_get_ctx(
562                 __isl_keep isl_ast_build *build);
564         #include <isl/ast.h>
565         isl_ctx *isl_ast_expr_get_ctx(
566                 __isl_keep isl_ast_expr *expr);
567         isl_ctx *isl_ast_node_get_ctx(
568                 __isl_keep isl_ast_node *node);
570 =head2 Values
572 An C<isl_val> represents an integer value, a rational value
573 or one of three special values, infinity, negative infinity and NaN.
574 Some predefined values can be created using the following functions.
576         #include <isl/val.h>
577         __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
578         __isl_give isl_val *isl_val_one(isl_ctx *ctx);
579         __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
580         __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
581         __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
582         __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
584 Specific integer values can be created using the following functions.
586         #include <isl/val.h>
587         __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
588                 long i);
589         __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
590                 unsigned long u);
591         __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
592                 size_t n, size_t size, const void *chunks);
594 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
595 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
596 The least significant digit is assumed to be stored first.
598 Value objects can be copied and freed using the following functions.
600         #include <isl/val.h>
601         __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
602         __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
604 They can be inspected using the following functions.
606         #include <isl/val.h>
607         long isl_val_get_num_si(__isl_keep isl_val *v);
608         long isl_val_get_den_si(__isl_keep isl_val *v);
609         double isl_val_get_d(__isl_keep isl_val *v);
610         size_t isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
611                 size_t size);
612         int isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
613                 size_t size, void *chunks);
615 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
616 of C<size> bytes needed to store the absolute value of the
617 numerator of C<v>.
618 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
619 which is assumed to have been preallocated by the caller.
620 The least significant digit is stored first.
621 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
622 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
623 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
625 An C<isl_val> can be modified using the following function.
627         #include <isl/val.h>
628         __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
629                 long i);
631 The following unary properties are defined on C<isl_val>s.
633         #include <isl/val.h>
634         int isl_val_sgn(__isl_keep isl_val *v);
635         int isl_val_is_zero(__isl_keep isl_val *v);
636         int isl_val_is_one(__isl_keep isl_val *v);
637         int isl_val_is_negone(__isl_keep isl_val *v);
638         int isl_val_is_nonneg(__isl_keep isl_val *v);
639         int isl_val_is_nonpos(__isl_keep isl_val *v);
640         int isl_val_is_pos(__isl_keep isl_val *v);
641         int isl_val_is_neg(__isl_keep isl_val *v);
642         int isl_val_is_int(__isl_keep isl_val *v);
643         int isl_val_is_rat(__isl_keep isl_val *v);
644         int isl_val_is_nan(__isl_keep isl_val *v);
645         int isl_val_is_infty(__isl_keep isl_val *v);
646         int isl_val_is_neginfty(__isl_keep isl_val *v);
648 Note that the sign of NaN is undefined.
650 The following binary properties are defined on pairs of C<isl_val>s.
652         #include <isl/val.h>
653         int isl_val_lt(__isl_keep isl_val *v1,
654                 __isl_keep isl_val *v2);
655         int isl_val_le(__isl_keep isl_val *v1,
656                 __isl_keep isl_val *v2);
657         int isl_val_gt(__isl_keep isl_val *v1,
658                 __isl_keep isl_val *v2);
659         int isl_val_ge(__isl_keep isl_val *v1,
660                 __isl_keep isl_val *v2);
661         int isl_val_eq(__isl_keep isl_val *v1,
662                 __isl_keep isl_val *v2);
663         int isl_val_ne(__isl_keep isl_val *v1,
664                 __isl_keep isl_val *v2);
665         int isl_val_abs_eq(__isl_keep isl_val *v1,
666                 __isl_keep isl_val *v2);
668 The function C<isl_val_abs_eq> checks whether its two arguments
669 are equal in absolute value.
671 For integer C<isl_val>s we additionally have the following binary property.
673         #include <isl/val.h>
674         int isl_val_is_divisible_by(__isl_keep isl_val *v1,
675                 __isl_keep isl_val *v2);
677 An C<isl_val> can also be compared to an integer using the following
678 function.  The result is undefined for NaN.
680         #include <isl/val.h>
681         int isl_val_cmp_si(__isl_keep isl_val *v, long i);
683 The following unary operations are available on C<isl_val>s.
685         #include <isl/val.h>
686         __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
687         __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
688         __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
689         __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
690         __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
691         __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
692         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
694 The following binary operations are available on C<isl_val>s.
696         #include <isl/val.h>
697         __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
698                 __isl_take isl_val *v2);
699         __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
700                 __isl_take isl_val *v2);
701         __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
702                 __isl_take isl_val *v2);
703         __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
704                 unsigned long v2);
705         __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
706                 __isl_take isl_val *v2);
707         __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
708                 unsigned long v2);
709         __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
710                 __isl_take isl_val *v2);
711         __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
712                 unsigned long v2);
713         __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
714                 __isl_take isl_val *v2);
716 On integer values, we additionally have the following operations.
718         #include <isl/val.h>
719         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
720         __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
721                 __isl_take isl_val *v2);
722         __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
723                 __isl_take isl_val *v2);
724         __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
725                 __isl_take isl_val *v2, __isl_give isl_val **x,
726                 __isl_give isl_val **y);
728 The function C<isl_val_gcdext> returns the greatest common divisor g
729 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
730 that C<*x> * C<v1> + C<*y> * C<v2> = g.
732 =head3 GMP specific functions
734 These functions are only available if C<isl> has been compiled with C<GMP>
735 support.
737 Specific integer and rational values can be created from C<GMP> values using
738 the following functions.
740         #include <isl/val_gmp.h>
741         __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
742                 mpz_t z);
743         __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
744                 const mpz_t n, const mpz_t d);
746 The numerator and denominator of a rational value can be extracted as
747 C<GMP> values using the following functions.
749         #include <isl/val_gmp.h>
750         int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
751         int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
753 =head2 Sets and Relations
755 C<isl> uses six types of objects for representing sets and relations,
756 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
757 C<isl_union_set> and C<isl_union_map>.
758 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
759 can be described as a conjunction of affine constraints, while
760 C<isl_set> and C<isl_map> represent unions of
761 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
762 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
763 to live in the same space.  C<isl_union_set>s and C<isl_union_map>s
764 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
765 where spaces are considered different if they have a different number
766 of dimensions and/or different names (see L<"Spaces">).
767 The difference between sets and relations (maps) is that sets have
768 one set of variables, while relations have two sets of variables,
769 input variables and output variables.
771 =head2 Error Handling
773 C<isl> supports different ways to react in case a runtime error is triggered.
774 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
775 with two maps that have incompatible spaces. There are three possible ways
776 to react on error: to warn, to continue or to abort.
778 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
779 the last error in the corresponding C<isl_ctx> and the function in which the
780 error was triggered returns C<NULL>. An error does not corrupt internal state,
781 such that isl can continue to be used. C<isl> also provides functions to
782 read the last error and to reset the memory that stores the last error. The
783 last error is only stored for information purposes. Its presence does not
784 change the behavior of C<isl>. Hence, resetting an error is not required to
785 continue to use isl, but only to observe new errors.
787         #include <isl/ctx.h>
788         enum isl_error isl_ctx_last_error(isl_ctx *ctx);
789         void isl_ctx_reset_error(isl_ctx *ctx);
791 Another option is to continue on error. This is similar to warn on error mode,
792 except that C<isl> does not print any warning. This allows a program to
793 implement its own error reporting.
795 The last option is to directly abort the execution of the program from within
796 the isl library. This makes it obviously impossible to recover from an error,
797 but it allows to directly spot the error location. By aborting on error,
798 debuggers break at the location the error occurred and can provide a stack
799 trace. Other tools that automatically provide stack traces on abort or that do
800 not want to continue execution after an error was triggered may also prefer to
801 abort on error.
803 The on error behavior of isl can be specified by calling
804 C<isl_options_set_on_error> or by setting the command line option
805 C<--isl-on-error>. Valid arguments for the function call are
806 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
807 choices for the command line option are C<warn>, C<continue> and C<abort>.
808 It is also possible to query the current error mode.
810         #include <isl/options.h>
811         int isl_options_set_on_error(isl_ctx *ctx, int val);
812         int isl_options_get_on_error(isl_ctx *ctx);
814 =head2 Identifiers
816 Identifiers are used to identify both individual dimensions
817 and tuples of dimensions.  They consist of an optional name and an optional
818 user pointer.  The name and the user pointer cannot both be C<NULL>, however.
819 Identifiers with the same name but different pointer values
820 are considered to be distinct.
821 Similarly, identifiers with different names but the same pointer value
822 are also considered to be distinct.
823 Equal identifiers are represented using the same object.
824 Pairs of identifiers can therefore be tested for equality using the
825 C<==> operator.
826 Identifiers can be constructed, copied, freed, inspected and printed
827 using the following functions.
829         #include <isl/id.h>
830         __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
831                 __isl_keep const char *name, void *user);
832         __isl_give isl_id *isl_id_set_free_user(
833                 __isl_take isl_id *id,
834                 __isl_give void (*free_user)(void *user));
835         __isl_give isl_id *isl_id_copy(isl_id *id);
836         __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
838         void *isl_id_get_user(__isl_keep isl_id *id);
839         __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
841         __isl_give isl_printer *isl_printer_print_id(
842                 __isl_take isl_printer *p, __isl_keep isl_id *id);
844 The callback set by C<isl_id_set_free_user> is called on the user
845 pointer when the last reference to the C<isl_id> is freed.
846 Note that C<isl_id_get_name> returns a pointer to some internal
847 data structure, so the result can only be used while the
848 corresponding C<isl_id> is alive.
850 =head2 Spaces
852 Whenever a new set, relation or similar object is created from scratch,
853 the space in which it lives needs to be specified using an C<isl_space>.
854 Each space involves zero or more parameters and zero, one or two
855 tuples of set or input/output dimensions.  The parameters and dimensions
856 are identified by an C<isl_dim_type> and a position.
857 The type C<isl_dim_param> refers to parameters,
858 the type C<isl_dim_set> refers to set dimensions (for spaces
859 with a single tuple of dimensions) and the types C<isl_dim_in>
860 and C<isl_dim_out> refer to input and output dimensions
861 (for spaces with two tuples of dimensions).
862 Local spaces (see L</"Local Spaces">) also contain dimensions
863 of type C<isl_dim_div>.
864 Note that parameters are only identified by their position within
865 a given object.  Across different objects, parameters are (usually)
866 identified by their names or identifiers.  Only unnamed parameters
867 are identified by their positions across objects.  The use of unnamed
868 parameters is discouraged.
870         #include <isl/space.h>
871         __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
872                 unsigned nparam, unsigned n_in, unsigned n_out);
873         __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
874                 unsigned nparam);
875         __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
876                 unsigned nparam, unsigned dim);
877         __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
878         __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
880 The space used for creating a parameter domain
881 needs to be created using C<isl_space_params_alloc>.
882 For other sets, the space
883 needs to be created using C<isl_space_set_alloc>, while
884 for a relation, the space
885 needs to be created using C<isl_space_alloc>.
887 To check whether a given space is that of a set or a map
888 or whether it is a parameter space, use these functions:
890         #include <isl/space.h>
891         int isl_space_is_params(__isl_keep isl_space *space);
892         int isl_space_is_set(__isl_keep isl_space *space);
893         int isl_space_is_map(__isl_keep isl_space *space);
895 Spaces can be compared using the following functions:
897         #include <isl/space.h>
898         int isl_space_is_equal(__isl_keep isl_space *space1,
899                 __isl_keep isl_space *space2);
900         int isl_space_is_domain(__isl_keep isl_space *space1,
901                 __isl_keep isl_space *space2);
902         int isl_space_is_range(__isl_keep isl_space *space1,
903                 __isl_keep isl_space *space2);
904         int isl_space_tuple_is_equal(
905                 __isl_keep isl_space *space1,
906                 enum isl_dim_type type1,
907                 __isl_keep isl_space *space2,
908                 enum isl_dim_type type2);
910 C<isl_space_is_domain> checks whether the first argument is equal
911 to the domain of the second argument.  This requires in particular that
912 the first argument is a set space and that the second argument
913 is a map space.  C<isl_space_tuple_is_equal> checks whether the given
914 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
915 spaces are the same.  That is, it checks if they have the same
916 identifier (if any), the same dimension and the same internal structure
917 (if any).
919 It is often useful to create objects that live in the
920 same space as some other object.  This can be accomplished
921 by creating the new objects
922 (see L</"Creating New Sets and Relations"> or
923 L</"Functions">) based on the space
924 of the original object.
926         #include <isl/set.h>
927         __isl_give isl_space *isl_basic_set_get_space(
928                 __isl_keep isl_basic_set *bset);
929         __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
931         #include <isl/union_set.h>
932         __isl_give isl_space *isl_union_set_get_space(
933                 __isl_keep isl_union_set *uset);
935         #include <isl/map.h>
936         __isl_give isl_space *isl_basic_map_get_space(
937                 __isl_keep isl_basic_map *bmap);
938         __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
940         #include <isl/union_map.h>
941         __isl_give isl_space *isl_union_map_get_space(
942                 __isl_keep isl_union_map *umap);
944         #include <isl/constraint.h>
945         __isl_give isl_space *isl_constraint_get_space(
946                 __isl_keep isl_constraint *constraint);
948         #include <isl/polynomial.h>
949         __isl_give isl_space *isl_qpolynomial_get_domain_space(
950                 __isl_keep isl_qpolynomial *qp);
951         __isl_give isl_space *isl_qpolynomial_get_space(
952                 __isl_keep isl_qpolynomial *qp);
953         __isl_give isl_space *isl_qpolynomial_fold_get_space(
954                 __isl_keep isl_qpolynomial_fold *fold);
955         __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
956                 __isl_keep isl_pw_qpolynomial *pwqp);
957         __isl_give isl_space *isl_pw_qpolynomial_get_space(
958                 __isl_keep isl_pw_qpolynomial *pwqp);
959         __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
960                 __isl_keep isl_pw_qpolynomial_fold *pwf);
961         __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
962                 __isl_keep isl_pw_qpolynomial_fold *pwf);
963         __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
964                 __isl_keep isl_union_pw_qpolynomial *upwqp);
965         __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
966                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
968         #include <isl/val.h>
969         __isl_give isl_space *isl_multi_val_get_space(
970                 __isl_keep isl_multi_val *mv);
972         #include <isl/aff.h>
973         __isl_give isl_space *isl_aff_get_domain_space(
974                 __isl_keep isl_aff *aff);
975         __isl_give isl_space *isl_aff_get_space(
976                 __isl_keep isl_aff *aff);
977         __isl_give isl_space *isl_pw_aff_get_domain_space(
978                 __isl_keep isl_pw_aff *pwaff);
979         __isl_give isl_space *isl_pw_aff_get_space(
980                 __isl_keep isl_pw_aff *pwaff);
981         __isl_give isl_space *isl_multi_aff_get_domain_space(
982                 __isl_keep isl_multi_aff *maff);
983         __isl_give isl_space *isl_multi_aff_get_space(
984                 __isl_keep isl_multi_aff *maff);
985         __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
986                 __isl_keep isl_pw_multi_aff *pma);
987         __isl_give isl_space *isl_pw_multi_aff_get_space(
988                 __isl_keep isl_pw_multi_aff *pma);
989         __isl_give isl_space *isl_union_pw_aff_get_space(
990                 __isl_keep isl_union_pw_aff *upa);
991         __isl_give isl_space *isl_union_pw_multi_aff_get_space(
992                 __isl_keep isl_union_pw_multi_aff *upma);
993         __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
994                 __isl_keep isl_multi_pw_aff *mpa);
995         __isl_give isl_space *isl_multi_pw_aff_get_space(
996                 __isl_keep isl_multi_pw_aff *mpa);
997         __isl_give isl_space *
998         isl_multi_union_pw_aff_get_domain_space(
999                 __isl_keep isl_multi_union_pw_aff *mupa);
1000         __isl_give isl_space *
1001         isl_multi_union_pw_aff_get_space(
1002                 __isl_keep isl_multi_union_pw_aff *mupa);
1004         #include <isl/point.h>
1005         __isl_give isl_space *isl_point_get_space(
1006                 __isl_keep isl_point *pnt);
1008 The number of dimensions of a given type of space
1009 may be read off from a space or an object that lives
1010 in a space using the following functions.
1011 In case of C<isl_space_dim>, type may be
1012 C<isl_dim_param>, C<isl_dim_in> (only for relations),
1013 C<isl_dim_out> (only for relations), C<isl_dim_set>
1014 (only for sets) or C<isl_dim_all>.
1016         #include <isl/space.h>
1017         unsigned isl_space_dim(__isl_keep isl_space *space,
1018                 enum isl_dim_type type);
1020         #include <isl/local_space.h>
1021         int isl_local_space_dim(__isl_keep isl_local_space *ls,
1022                 enum isl_dim_type type);
1024         #include <isl/set.h>
1025         unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1026                 enum isl_dim_type type);
1027         unsigned isl_set_dim(__isl_keep isl_set *set,
1028                 enum isl_dim_type type);
1030         #include <isl/union_set.h>
1031         unsigned isl_union_set_dim(__isl_keep isl_union_set *uset,
1032                 enum isl_dim_type type);
1034         #include <isl/map.h>
1035         unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1036                 enum isl_dim_type type);
1037         unsigned isl_map_dim(__isl_keep isl_map *map,
1038                 enum isl_dim_type type);
1040         #include <isl/union_map.h>
1041         unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
1042                 enum isl_dim_type type);
1044         #include <isl/val.h>
1045         unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1046                 enum isl_dim_type type);
1048         #include <isl/aff.h>
1049         int isl_aff_dim(__isl_keep isl_aff *aff,
1050                 enum isl_dim_type type);
1051         unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1052                 enum isl_dim_type type);
1053         unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1054                 enum isl_dim_type type);
1055         unsigned isl_pw_multi_aff_dim(
1056                 __isl_keep isl_pw_multi_aff *pma,
1057                 enum isl_dim_type type);
1058         unsigned isl_multi_pw_aff_dim(
1059                 __isl_keep isl_multi_pw_aff *mpa,
1060                 enum isl_dim_type type);
1061         unsigned isl_union_pw_aff_dim(
1062                 __isl_keep isl_union_pw_aff *upa,
1063                 enum isl_dim_type type);
1064         unsigned isl_union_pw_multi_aff_dim(
1065                 __isl_keep isl_union_pw_multi_aff *upma,
1066                 enum isl_dim_type type);
1067         unsigned isl_multi_union_pw_aff_dim(
1068                 __isl_keep isl_multi_union_pw_aff *mupa,
1069                 enum isl_dim_type type);
1071         #include <isl/polynomial.h>
1072         unsigned isl_union_pw_qpolynomial_dim(
1073                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1074                 enum isl_dim_type type);
1075         unsigned isl_union_pw_qpolynomial_fold_dim(
1076                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1077                 enum isl_dim_type type);
1079 Note that an C<isl_union_set>, an C<isl_union_map>,
1080 an C<isl_union_pw_multi_aff>,
1081 an C<isl_union_pw_qpolynomial> and
1082 an C<isl_union_pw_qpolynomial_fold>
1083 only have parameters.
1085 The identifiers or names of the individual dimensions of spaces
1086 may be set or read off using the following functions on spaces
1087 or objects that live in spaces.
1088 These functions are mostly useful to obtain the identifiers, positions
1089 or names of the parameters.  Identifiers of individual dimensions are
1090 essentially only useful for printing.  They are ignored by all other
1091 operations and may not be preserved across those operations.
1093         #include <isl/space.h>
1094         __isl_give isl_space *isl_space_set_dim_id(
1095                 __isl_take isl_space *space,
1096                 enum isl_dim_type type, unsigned pos,
1097                 __isl_take isl_id *id);
1098         int isl_space_has_dim_id(__isl_keep isl_space *space,
1099                 enum isl_dim_type type, unsigned pos);
1100         __isl_give isl_id *isl_space_get_dim_id(
1101                 __isl_keep isl_space *space,
1102                 enum isl_dim_type type, unsigned pos);
1103         __isl_give isl_space *isl_space_set_dim_name(
1104                 __isl_take isl_space *space,
1105                  enum isl_dim_type type, unsigned pos,
1106                  __isl_keep const char *name);
1107         int isl_space_has_dim_name(__isl_keep isl_space *space,
1108                 enum isl_dim_type type, unsigned pos);
1109         __isl_keep const char *isl_space_get_dim_name(
1110                 __isl_keep isl_space *space,
1111                 enum isl_dim_type type, unsigned pos);
1113         #include <isl/local_space.h>
1114         __isl_give isl_local_space *isl_local_space_set_dim_id(
1115                 __isl_take isl_local_space *ls,
1116                 enum isl_dim_type type, unsigned pos,
1117                 __isl_take isl_id *id);
1118         int isl_local_space_has_dim_id(
1119                 __isl_keep isl_local_space *ls,
1120                 enum isl_dim_type type, unsigned pos);
1121         __isl_give isl_id *isl_local_space_get_dim_id(
1122                 __isl_keep isl_local_space *ls,
1123                 enum isl_dim_type type, unsigned pos);
1124         __isl_give isl_local_space *isl_local_space_set_dim_name(
1125                 __isl_take isl_local_space *ls,
1126                 enum isl_dim_type type, unsigned pos, const char *s);
1127         int isl_local_space_has_dim_name(
1128                 __isl_keep isl_local_space *ls,
1129                 enum isl_dim_type type, unsigned pos)
1130         const char *isl_local_space_get_dim_name(
1131                 __isl_keep isl_local_space *ls,
1132                 enum isl_dim_type type, unsigned pos);
1134         #include <isl/constraint.h>
1135         const char *isl_constraint_get_dim_name(
1136                 __isl_keep isl_constraint *constraint,
1137                 enum isl_dim_type type, unsigned pos);
1139         #include <isl/set.h>
1140         __isl_give isl_id *isl_basic_set_get_dim_id(
1141                 __isl_keep isl_basic_set *bset,
1142                 enum isl_dim_type type, unsigned pos);
1143         __isl_give isl_set *isl_set_set_dim_id(
1144                 __isl_take isl_set *set, enum isl_dim_type type,
1145                 unsigned pos, __isl_take isl_id *id);
1146         int isl_set_has_dim_id(__isl_keep isl_set *set,
1147                 enum isl_dim_type type, unsigned pos);
1148         __isl_give isl_id *isl_set_get_dim_id(
1149                 __isl_keep isl_set *set, enum isl_dim_type type,
1150                 unsigned pos);
1151         const char *isl_basic_set_get_dim_name(
1152                 __isl_keep isl_basic_set *bset,
1153                 enum isl_dim_type type, unsigned pos);
1154         int isl_set_has_dim_name(__isl_keep isl_set *set,
1155                 enum isl_dim_type type, unsigned pos);
1156         const char *isl_set_get_dim_name(
1157                 __isl_keep isl_set *set,
1158                 enum isl_dim_type type, unsigned pos);
1160         #include <isl/map.h>
1161         __isl_give isl_map *isl_map_set_dim_id(
1162                 __isl_take isl_map *map, enum isl_dim_type type,
1163                 unsigned pos, __isl_take isl_id *id);
1164         int isl_basic_map_has_dim_id(
1165                 __isl_keep isl_basic_map *bmap,
1166                 enum isl_dim_type type, unsigned pos);
1167         int isl_map_has_dim_id(__isl_keep isl_map *map,
1168                 enum isl_dim_type type, unsigned pos);
1169         __isl_give isl_id *isl_map_get_dim_id(
1170                 __isl_keep isl_map *map, enum isl_dim_type type,
1171                 unsigned pos);
1172         __isl_give isl_id *isl_union_map_get_dim_id(
1173                 __isl_keep isl_union_map *umap,
1174                 enum isl_dim_type type, unsigned pos);
1175         const char *isl_basic_map_get_dim_name(
1176                 __isl_keep isl_basic_map *bmap,
1177                 enum isl_dim_type type, unsigned pos);
1178         int isl_map_has_dim_name(__isl_keep isl_map *map,
1179                 enum isl_dim_type type, unsigned pos);
1180         const char *isl_map_get_dim_name(
1181                 __isl_keep isl_map *map,
1182                 enum isl_dim_type type, unsigned pos);
1184         #include <isl/val.h>
1185         __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1186                 __isl_take isl_multi_val *mv,
1187                 enum isl_dim_type type, unsigned pos,
1188                 __isl_take isl_id *id);
1189         __isl_give isl_id *isl_multi_val_get_dim_id(
1190                 __isl_keep isl_multi_val *mv,
1191                 enum isl_dim_type type, unsigned pos);
1192         __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1193                 __isl_take isl_multi_val *mv,
1194                 enum isl_dim_type type, unsigned pos, const char *s);
1196         #include <isl/aff.h>
1197         __isl_give isl_aff *isl_aff_set_dim_id(
1198                 __isl_take isl_aff *aff, enum isl_dim_type type,
1199                 unsigned pos, __isl_take isl_id *id);
1200         __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1201                 __isl_take isl_multi_aff *maff,
1202                 enum isl_dim_type type, unsigned pos,
1203                 __isl_take isl_id *id);
1204         __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1205                 __isl_take isl_pw_aff *pma,
1206                 enum isl_dim_type type, unsigned pos,
1207                 __isl_take isl_id *id);
1208         __isl_give isl_multi_pw_aff *
1209         isl_multi_pw_aff_set_dim_id(
1210                 __isl_take isl_multi_pw_aff *mpa,
1211                 enum isl_dim_type type, unsigned pos,
1212                 __isl_take isl_id *id);
1213         __isl_give isl_multi_union_pw_aff *
1214         isl_multi_union_pw_aff_set_dim_id(
1215                 __isl_take isl_multi_union_pw_aff *mupa,
1216                 enum isl_dim_type type, unsigned pos,
1217                 __isl_take isl_id *id);
1218         __isl_give isl_id *isl_multi_aff_get_dim_id(
1219                 __isl_keep isl_multi_aff *ma,
1220                 enum isl_dim_type type, unsigned pos);
1221         int isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1222                 enum isl_dim_type type, unsigned pos);
1223         __isl_give isl_id *isl_pw_aff_get_dim_id(
1224                 __isl_keep isl_pw_aff *pa,
1225                 enum isl_dim_type type, unsigned pos);
1226         __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1227                 __isl_keep isl_pw_multi_aff *pma,
1228                 enum isl_dim_type type, unsigned pos);
1229         __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1230                 __isl_keep isl_multi_pw_aff *mpa,
1231                 enum isl_dim_type type, unsigned pos);
1232         __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1233                 __isl_keep isl_multi_union_pw_aff *mupa,
1234                 enum isl_dim_type type, unsigned pos);
1235         __isl_give isl_aff *isl_aff_set_dim_name(
1236                 __isl_take isl_aff *aff, enum isl_dim_type type,
1237                 unsigned pos, const char *s);
1238         __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1239                 __isl_take isl_multi_aff *maff,
1240                 enum isl_dim_type type, unsigned pos, const char *s);
1241         __isl_give isl_multi_pw_aff *
1242         isl_multi_pw_aff_set_dim_name(
1243                 __isl_take isl_multi_pw_aff *mpa,
1244                 enum isl_dim_type type, unsigned pos, const char *s);
1245         __isl_give isl_union_pw_aff *
1246         isl_union_pw_aff_set_dim_name(
1247                 __isl_take isl_union_pw_aff *upa,
1248                 enum isl_dim_type type, unsigned pos,
1249                 const char *s);
1250         __isl_give isl_union_pw_multi_aff *
1251         isl_union_pw_multi_aff_set_dim_name(
1252                 __isl_take isl_union_pw_multi_aff *upma,
1253                 enum isl_dim_type type, unsigned pos,
1254                 const char *s);
1255         __isl_give isl_multi_union_pw_aff *
1256         isl_multi_union_pw_aff_set_dim_name(
1257                 __isl_take isl_multi_union_pw_aff *mupa,
1258                 enum isl_dim_type type, unsigned pos,
1259         const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1260                 enum isl_dim_type type, unsigned pos);
1261         const char *isl_pw_aff_get_dim_name(
1262                 __isl_keep isl_pw_aff *pa,
1263                 enum isl_dim_type type, unsigned pos);
1264         const char *isl_pw_multi_aff_get_dim_name(
1265                 __isl_keep isl_pw_multi_aff *pma,
1266                 enum isl_dim_type type, unsigned pos);
1268         #include <isl/polynomial.h>
1269         __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1270                 __isl_take isl_qpolynomial *qp,
1271                 enum isl_dim_type type, unsigned pos,
1272                 const char *s);
1273         __isl_give isl_pw_qpolynomial *
1274         isl_pw_qpolynomial_set_dim_name(
1275                 __isl_take isl_pw_qpolynomial *pwqp,
1276                 enum isl_dim_type type, unsigned pos,
1277                 const char *s);
1278         __isl_give isl_pw_qpolynomial_fold *
1279         isl_pw_qpolynomial_fold_set_dim_name(
1280                 __isl_take isl_pw_qpolynomial_fold *pwf,
1281                 enum isl_dim_type type, unsigned pos,
1282                 const char *s);
1283         __isl_give isl_union_pw_qpolynomial *
1284         isl_union_pw_qpolynomial_set_dim_name(
1285                 __isl_take isl_union_pw_qpolynomial *upwqp,
1286                 enum isl_dim_type type, unsigned pos,
1287                 const char *s);
1288         __isl_give isl_union_pw_qpolynomial_fold *
1289         isl_union_pw_qpolynomial_fold_set_dim_name(
1290                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1291                 enum isl_dim_type type, unsigned pos,
1292                 const char *s);
1294 Note that C<isl_space_get_name> returns a pointer to some internal
1295 data structure, so the result can only be used while the
1296 corresponding C<isl_space> is alive.
1297 Also note that every function that operates on two sets or relations
1298 requires that both arguments have the same parameters.  This also
1299 means that if one of the arguments has named parameters, then the
1300 other needs to have named parameters too and the names need to match.
1301 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1302 arguments may have different parameters (as long as they are named),
1303 in which case the result will have as parameters the union of the parameters of
1304 the arguments.
1306 Given the identifier or name of a dimension (typically a parameter),
1307 its position can be obtained from the following functions.
1309         #include <isl/space.h>
1310         int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1311                 enum isl_dim_type type, __isl_keep isl_id *id);
1312         int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1313                 enum isl_dim_type type, const char *name);
1315         #include <isl/local_space.h>
1316         int isl_local_space_find_dim_by_name(
1317                 __isl_keep isl_local_space *ls,
1318                 enum isl_dim_type type, const char *name);
1320         #include <isl/val.h>
1321         int isl_multi_val_find_dim_by_id(
1322                 __isl_keep isl_multi_val *mv,
1323                 enum isl_dim_type type, __isl_keep isl_id *id);
1324         int isl_multi_val_find_dim_by_name(
1325                 __isl_keep isl_multi_val *mv,
1326                 enum isl_dim_type type, const char *name);
1328         #include <isl/set.h>
1329         int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1330                 enum isl_dim_type type, __isl_keep isl_id *id);
1331         int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1332                 enum isl_dim_type type, const char *name);
1334         #include <isl/map.h>
1335         int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1336                 enum isl_dim_type type, __isl_keep isl_id *id);
1337         int isl_basic_map_find_dim_by_name(
1338                 __isl_keep isl_basic_map *bmap,
1339                 enum isl_dim_type type, const char *name);
1340         int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1341                 enum isl_dim_type type, const char *name);
1342         int isl_union_map_find_dim_by_name(
1343                 __isl_keep isl_union_map *umap,
1344                 enum isl_dim_type type, const char *name);
1346         #include <isl/aff.h>
1347         int isl_multi_aff_find_dim_by_id(
1348                 __isl_keep isl_multi_aff *ma,
1349                 enum isl_dim_type type, __isl_keep isl_id *id);
1350         int isl_multi_pw_aff_find_dim_by_id(
1351                 __isl_keep isl_multi_pw_aff *mpa,
1352                 enum isl_dim_type type, __isl_keep isl_id *id);
1353         int isl_multi_union_pw_aff_find_dim_by_id(
1354                 __isl_keep isl_union_multi_pw_aff *mupa,
1355                 enum isl_dim_type type, __isl_keep isl_id *id);
1356         int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1357                 enum isl_dim_type type, const char *name);
1358         int isl_multi_aff_find_dim_by_name(
1359                 __isl_keep isl_multi_aff *ma,
1360                 enum isl_dim_type type, const char *name);
1361         int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1362                 enum isl_dim_type type, const char *name);
1363         int isl_multi_pw_aff_find_dim_by_name(
1364                 __isl_keep isl_multi_pw_aff *mpa,
1365                 enum isl_dim_type type, const char *name);
1366         int isl_pw_multi_aff_find_dim_by_name(
1367                 __isl_keep isl_pw_multi_aff *pma,
1368                 enum isl_dim_type type, const char *name);
1369         int isl_union_pw_aff_find_dim_by_name(
1370                 __isl_keep isl_union_pw_aff *upa,
1371                 enum isl_dim_type type, const char *name);
1372         int isl_union_pw_multi_aff_find_dim_by_name(
1373                 __isl_keep isl_union_pw_multi_aff *upma,
1374                 enum isl_dim_type type, const char *name);
1375         int isl_multi_union_pw_aff_find_dim_by_name(
1376                 __isl_keep isl_multi_union_pw_aff *mupa,
1377                 enum isl_dim_type type, const char *name);
1379         #include <isl/polynomial.h>
1380         int isl_pw_qpolynomial_find_dim_by_name(
1381                 __isl_keep isl_pw_qpolynomial *pwqp,
1382                 enum isl_dim_type type, const char *name);
1383         int isl_pw_qpolynomial_fold_find_dim_by_name(
1384                 __isl_keep isl_pw_qpolynomial_fold *pwf,
1385                 enum isl_dim_type type, const char *name);
1386         int isl_union_pw_qpolynomial_find_dim_by_name(
1387                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1388                 enum isl_dim_type type, const char *name);
1389         int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1390                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1391                 enum isl_dim_type type, const char *name);
1393 The identifiers or names of entire spaces may be set or read off
1394 using the following functions.
1396         #include <isl/space.h>
1397         __isl_give isl_space *isl_space_set_tuple_id(
1398                 __isl_take isl_space *space,
1399                 enum isl_dim_type type, __isl_take isl_id *id);
1400         __isl_give isl_space *isl_space_reset_tuple_id(
1401                 __isl_take isl_space *space, enum isl_dim_type type);
1402         int isl_space_has_tuple_id(__isl_keep isl_space *space,
1403                 enum isl_dim_type type);
1404         __isl_give isl_id *isl_space_get_tuple_id(
1405                 __isl_keep isl_space *space, enum isl_dim_type type);
1406         __isl_give isl_space *isl_space_set_tuple_name(
1407                 __isl_take isl_space *space,
1408                 enum isl_dim_type type, const char *s);
1409         int isl_space_has_tuple_name(__isl_keep isl_space *space,
1410                 enum isl_dim_type type);
1411         const char *isl_space_get_tuple_name(__isl_keep isl_space *space,
1412                 enum isl_dim_type type);
1414         #include <isl/local_space.h>
1415         __isl_give isl_local_space *isl_local_space_set_tuple_id(
1416                 __isl_take isl_local_space *ls,
1417                 enum isl_dim_type type, __isl_take isl_id *id);
1419         #include <isl/set.h>
1420         __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1421                 __isl_take isl_basic_set *bset,
1422                 __isl_take isl_id *id);
1423         __isl_give isl_set *isl_set_set_tuple_id(
1424                 __isl_take isl_set *set, __isl_take isl_id *id);
1425         __isl_give isl_set *isl_set_reset_tuple_id(
1426                 __isl_take isl_set *set);
1427         int isl_set_has_tuple_id(__isl_keep isl_set *set);
1428         __isl_give isl_id *isl_set_get_tuple_id(
1429                 __isl_keep isl_set *set);
1430         __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1431                 __isl_take isl_basic_set *set, const char *s);
1432         __isl_give isl_set *isl_set_set_tuple_name(
1433                 __isl_take isl_set *set, const char *s);
1434         const char *isl_basic_set_get_tuple_name(
1435                 __isl_keep isl_basic_set *bset);
1436         int isl_set_has_tuple_name(__isl_keep isl_set *set);
1437         const char *isl_set_get_tuple_name(
1438                 __isl_keep isl_set *set);
1440         #include <isl/map.h>
1441         __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1442                 __isl_take isl_basic_map *bmap,
1443                 enum isl_dim_type type, __isl_take isl_id *id);
1444         __isl_give isl_map *isl_map_set_tuple_id(
1445                 __isl_take isl_map *map, enum isl_dim_type type,
1446                 __isl_take isl_id *id);
1447         __isl_give isl_map *isl_map_reset_tuple_id(
1448                 __isl_take isl_map *map, enum isl_dim_type type);
1449         int isl_map_has_tuple_id(__isl_keep isl_map *map,
1450                 enum isl_dim_type type);
1451         __isl_give isl_id *isl_map_get_tuple_id(
1452                 __isl_keep isl_map *map, enum isl_dim_type type);
1453         __isl_give isl_map *isl_map_set_tuple_name(
1454                 __isl_take isl_map *map,
1455                 enum isl_dim_type type, const char *s);
1456         const char *isl_basic_map_get_tuple_name(
1457                 __isl_keep isl_basic_map *bmap,
1458                 enum isl_dim_type type);
1459         __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1460                 __isl_take isl_basic_map *bmap,
1461                 enum isl_dim_type type, const char *s);
1462         int isl_map_has_tuple_name(__isl_keep isl_map *map,
1463                 enum isl_dim_type type);
1464         const char *isl_map_get_tuple_name(
1465                 __isl_keep isl_map *map,
1466                 enum isl_dim_type type);
1468         #include <isl/val.h>
1469         __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1470                 __isl_take isl_multi_val *mv,
1471                 enum isl_dim_type type, __isl_take isl_id *id);
1472         __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1473                 __isl_take isl_multi_val *mv,
1474                 enum isl_dim_type type);
1475         int isl_multi_val_has_tuple_id(__isl_keep isl_multi_val *mv,
1476                 enum isl_dim_type type);
1477         __isl_give isl_id *isl_multi_val_get_tuple_id(
1478                 __isl_keep isl_multi_val *mv,
1479                 enum isl_dim_type type);
1480         __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1481                 __isl_take isl_multi_val *mv,
1482                 enum isl_dim_type type, const char *s);
1483         const char *isl_multi_val_get_tuple_name(
1484                 __isl_keep isl_multi_val *mv,
1485                 enum isl_dim_type type);
1487         #include <isl/aff.h>
1488         __isl_give isl_aff *isl_aff_set_tuple_id(
1489                 __isl_take isl_aff *aff,
1490                 enum isl_dim_type type, __isl_take isl_id *id);
1491         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1492                 __isl_take isl_multi_aff *maff,
1493                 enum isl_dim_type type, __isl_take isl_id *id);
1494         __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1495                 __isl_take isl_pw_aff *pwaff,
1496                 enum isl_dim_type type, __isl_take isl_id *id);
1497         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1498                 __isl_take isl_pw_multi_aff *pma,
1499                 enum isl_dim_type type, __isl_take isl_id *id);
1500         __isl_give isl_multi_union_pw_aff *
1501         isl_multi_union_pw_aff_set_tuple_id(
1502                 __isl_take isl_multi_union_pw_aff *mupa,
1503                 enum isl_dim_type type, __isl_take isl_id *id);
1504         __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1505                 __isl_take isl_multi_aff *ma,
1506                 enum isl_dim_type type);
1507         __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1508                 __isl_take isl_pw_aff *pa,
1509                 enum isl_dim_type type);
1510         __isl_give isl_multi_pw_aff *
1511         isl_multi_pw_aff_reset_tuple_id(
1512                 __isl_take isl_multi_pw_aff *mpa,
1513                 enum isl_dim_type type);
1514         __isl_give isl_pw_multi_aff *
1515         isl_pw_multi_aff_reset_tuple_id(
1516                 __isl_take isl_pw_multi_aff *pma,
1517                 enum isl_dim_type type);
1518         __isl_give isl_multi_union_pw_aff *
1519         isl_multi_union_pw_aff_reset_tuple_id(
1520                 __isl_take isl_multi_union_pw_aff *mupa,
1521                 enum isl_dim_type type);
1522         int isl_multi_aff_has_tuple_id(__isl_keep isl_multi_aff *ma,
1523                 enum isl_dim_type type);
1524         __isl_give isl_id *isl_multi_aff_get_tuple_id(
1525                 __isl_keep isl_multi_aff *ma,
1526                 enum isl_dim_type type);
1527         int isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1528                 enum isl_dim_type type);
1529         __isl_give isl_id *isl_pw_aff_get_tuple_id(
1530                 __isl_keep isl_pw_aff *pa,
1531                 enum isl_dim_type type);
1532         int isl_pw_multi_aff_has_tuple_id(
1533                 __isl_keep isl_pw_multi_aff *pma,
1534                 enum isl_dim_type type);
1535         __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1536                 __isl_keep isl_pw_multi_aff *pma,
1537                 enum isl_dim_type type);
1538         int isl_multi_pw_aff_has_tuple_id(
1539                 __isl_keep isl_multi_pw_aff *mpa,
1540                 enum isl_dim_type type);
1541         __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1542                 __isl_keep isl_multi_pw_aff *mpa,
1543                 enum isl_dim_type type);
1544         int isl_multi_union_pw_aff_has_tuple_id(
1545                 __isl_keep isl_multi_union_pw_aff *mupa,
1546                 enum isl_dim_type type);
1547         __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1548                 __isl_keep isl_multi_union_pw_aff *mupa,
1549                 enum isl_dim_type type);
1550         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1551                 __isl_take isl_multi_aff *maff,
1552                 enum isl_dim_type type, const char *s);
1553         __isl_give isl_multi_pw_aff *
1554         isl_multi_pw_aff_set_tuple_name(
1555                 __isl_take isl_multi_pw_aff *mpa,
1556                 enum isl_dim_type type, const char *s);
1557         __isl_give isl_multi_union_pw_aff *
1558         isl_multi_union_pw_aff_set_tuple_name(
1559                 __isl_take isl_multi_union_pw_aff *mupa,
1560                 enum isl_dim_type type, const char *s);
1561         const char *isl_multi_aff_get_tuple_name(
1562                 __isl_keep isl_multi_aff *multi,
1563                 enum isl_dim_type type);
1564         int isl_pw_multi_aff_has_tuple_name(
1565                 __isl_keep isl_pw_multi_aff *pma,
1566                 enum isl_dim_type type);
1567         const char *isl_pw_multi_aff_get_tuple_name(
1568                 __isl_keep isl_pw_multi_aff *pma,
1569                 enum isl_dim_type type);
1570         const char *isl_multi_union_pw_aff_get_tuple_name(
1571                 __isl_keep isl_multi_union_pw_aff *mupa,
1572                 enum isl_dim_type type);
1574 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1575 or C<isl_dim_set>.  As with C<isl_space_get_name>,
1576 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1577 data structure.
1578 Binary operations require the corresponding spaces of their arguments
1579 to have the same name.
1581 To keep the names of all parameters and tuples, but reset the user pointers
1582 of all the corresponding identifiers, use the following function.
1584         #include <isl/space.h>
1585         __isl_give isl_space *isl_space_reset_user(
1586                 __isl_take isl_space *space);
1588         #include <isl/set.h>
1589         __isl_give isl_set *isl_set_reset_user(
1590                 __isl_take isl_set *set);
1592         #include <isl/map.h>
1593         __isl_give isl_map *isl_map_reset_user(
1594                 __isl_take isl_map *map);
1596         #include <isl/union_set.h>
1597         __isl_give isl_union_set *isl_union_set_reset_user(
1598                 __isl_take isl_union_set *uset);
1600         #include <isl/union_map.h>
1601         __isl_give isl_union_map *isl_union_map_reset_user(
1602                 __isl_take isl_union_map *umap);
1604         #include <isl/val.h>
1605         __isl_give isl_multi_val *isl_multi_val_reset_user(
1606                 __isl_take isl_multi_val *mv);
1608         #include <isl/aff.h>
1609         __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1610                 __isl_take isl_multi_aff *ma);
1611         __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1612                 __isl_take isl_pw_aff *pa);
1613         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1614                 __isl_take isl_multi_pw_aff *mpa);
1615         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1616                 __isl_take isl_pw_multi_aff *pma);
1617         __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1618                 __isl_take isl_union_pw_aff *upa);
1619         __isl_give isl_multi_union_pw_aff *
1620         isl_multi_union_pw_aff_reset_user(
1621                 __isl_take isl_multi_union_pw_aff *mupa);
1622         __isl_give isl_union_pw_multi_aff *
1623         isl_union_pw_multi_aff_reset_user(
1624                 __isl_take isl_union_pw_multi_aff *upma);
1626         #include <isl/polynomial.h>
1627         __isl_give isl_pw_qpolynomial *
1628         isl_pw_qpolynomial_reset_user(
1629                 __isl_take isl_pw_qpolynomial *pwqp);
1630         __isl_give isl_union_pw_qpolynomial *
1631         isl_union_pw_qpolynomial_reset_user(
1632                 __isl_take isl_union_pw_qpolynomial *upwqp);
1633         __isl_give isl_pw_qpolynomial_fold *
1634         isl_pw_qpolynomial_fold_reset_user(
1635                 __isl_take isl_pw_qpolynomial_fold *pwf);
1636         __isl_give isl_union_pw_qpolynomial_fold *
1637         isl_union_pw_qpolynomial_fold_reset_user(
1638                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1640 Spaces can be nested.  In particular, the domain of a set or
1641 the domain or range of a relation can be a nested relation.
1642 This process is also called I<wrapping>.
1643 The functions for detecting, constructing and deconstructing
1644 such nested spaces can be found in the wrapping properties
1645 of L</"Unary Properties">, the wrapping operations
1646 of L</"Unary Operations"> and the Cartesian product operations
1647 of L</"Basic Operations">.
1649 Spaces can be created from other spaces
1650 using the functions described in L</"Unary Operations">
1651 and L</"Binary Operations">.
1653 =head2 Local Spaces
1655 A local space is essentially a space with
1656 zero or more existentially quantified variables.
1657 The local space of various objects can be obtained
1658 using the following functions.
1660         #include <isl/constraint.h>
1661         __isl_give isl_local_space *isl_constraint_get_local_space(
1662                 __isl_keep isl_constraint *constraint);
1664         #include <isl/set.h>
1665         __isl_give isl_local_space *isl_basic_set_get_local_space(
1666                 __isl_keep isl_basic_set *bset);
1668         #include <isl/map.h>
1669         __isl_give isl_local_space *isl_basic_map_get_local_space(
1670                 __isl_keep isl_basic_map *bmap);
1672         #include <isl/aff.h>
1673         __isl_give isl_local_space *isl_aff_get_domain_local_space(
1674                 __isl_keep isl_aff *aff);
1675         __isl_give isl_local_space *isl_aff_get_local_space(
1676                 __isl_keep isl_aff *aff);
1678 A new local space can be created from a space using
1680         #include <isl/local_space.h>
1681         __isl_give isl_local_space *isl_local_space_from_space(
1682                 __isl_take isl_space *space);
1684 They can be inspected, modified, copied and freed using the following functions.
1686         #include <isl/local_space.h>
1687         int isl_local_space_is_params(
1688                 __isl_keep isl_local_space *ls);
1689         int isl_local_space_is_set(__isl_keep isl_local_space *ls);
1690         __isl_give isl_space *isl_local_space_get_space(
1691                 __isl_keep isl_local_space *ls);
1692         __isl_give isl_aff *isl_local_space_get_div(
1693                 __isl_keep isl_local_space *ls, int pos);
1694         __isl_give isl_local_space *isl_local_space_copy(
1695                 __isl_keep isl_local_space *ls);
1696         __isl_null isl_local_space *isl_local_space_free(
1697                 __isl_take isl_local_space *ls);
1699 Note that C<isl_local_space_get_div> can only be used on local spaces
1700 of sets.
1702 Two local spaces can be compared using
1704         int isl_local_space_is_equal(__isl_keep isl_local_space *ls1,
1705                 __isl_keep isl_local_space *ls2);
1707 Local spaces can be created from other local spaces
1708 using the functions described in L</"Unary Operations">
1709 and L</"Binary Operations">.
1711 =head2 Creating New Sets and Relations
1713 C<isl> has functions for creating some standard sets and relations.
1715 =over
1717 =item * Empty sets and relations
1719         __isl_give isl_basic_set *isl_basic_set_empty(
1720                 __isl_take isl_space *space);
1721         __isl_give isl_basic_map *isl_basic_map_empty(
1722                 __isl_take isl_space *space);
1723         __isl_give isl_set *isl_set_empty(
1724                 __isl_take isl_space *space);
1725         __isl_give isl_map *isl_map_empty(
1726                 __isl_take isl_space *space);
1727         __isl_give isl_union_set *isl_union_set_empty(
1728                 __isl_take isl_space *space);
1729         __isl_give isl_union_map *isl_union_map_empty(
1730                 __isl_take isl_space *space);
1732 For C<isl_union_set>s and C<isl_union_map>s, the space
1733 is only used to specify the parameters.
1735 =item * Universe sets and relations
1737         __isl_give isl_basic_set *isl_basic_set_universe(
1738                 __isl_take isl_space *space);
1739         __isl_give isl_basic_map *isl_basic_map_universe(
1740                 __isl_take isl_space *space);
1741         __isl_give isl_set *isl_set_universe(
1742                 __isl_take isl_space *space);
1743         __isl_give isl_map *isl_map_universe(
1744                 __isl_take isl_space *space);
1745         __isl_give isl_union_set *isl_union_set_universe(
1746                 __isl_take isl_union_set *uset);
1747         __isl_give isl_union_map *isl_union_map_universe(
1748                 __isl_take isl_union_map *umap);
1750 The sets and relations constructed by the functions above
1751 contain all integer values, while those constructed by the
1752 functions below only contain non-negative values.
1754         __isl_give isl_basic_set *isl_basic_set_nat_universe(
1755                 __isl_take isl_space *space);
1756         __isl_give isl_basic_map *isl_basic_map_nat_universe(
1757                 __isl_take isl_space *space);
1758         __isl_give isl_set *isl_set_nat_universe(
1759                 __isl_take isl_space *space);
1760         __isl_give isl_map *isl_map_nat_universe(
1761                 __isl_take isl_space *space);
1763 =item * Identity relations
1765         __isl_give isl_basic_map *isl_basic_map_identity(
1766                 __isl_take isl_space *space);
1767         __isl_give isl_map *isl_map_identity(
1768                 __isl_take isl_space *space);
1770 The number of input and output dimensions in C<space> needs
1771 to be the same.
1773 =item * Lexicographic order
1775         __isl_give isl_map *isl_map_lex_lt(
1776                 __isl_take isl_space *set_space);
1777         __isl_give isl_map *isl_map_lex_le(
1778                 __isl_take isl_space *set_space);
1779         __isl_give isl_map *isl_map_lex_gt(
1780                 __isl_take isl_space *set_space);
1781         __isl_give isl_map *isl_map_lex_ge(
1782                 __isl_take isl_space *set_space);
1783         __isl_give isl_map *isl_map_lex_lt_first(
1784                 __isl_take isl_space *space, unsigned n);
1785         __isl_give isl_map *isl_map_lex_le_first(
1786                 __isl_take isl_space *space, unsigned n);
1787         __isl_give isl_map *isl_map_lex_gt_first(
1788                 __isl_take isl_space *space, unsigned n);
1789         __isl_give isl_map *isl_map_lex_ge_first(
1790                 __isl_take isl_space *space, unsigned n);
1792 The first four functions take a space for a B<set>
1793 and return relations that express that the elements in the domain
1794 are lexicographically less
1795 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1796 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1797 than the elements in the range.
1798 The last four functions take a space for a map
1799 and return relations that express that the first C<n> dimensions
1800 in the domain are lexicographically less
1801 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1802 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1803 than the first C<n> dimensions in the range.
1805 =back
1807 A basic set or relation can be converted to a set or relation
1808 using the following functions.
1810         __isl_give isl_set *isl_set_from_basic_set(
1811                 __isl_take isl_basic_set *bset);
1812         __isl_give isl_map *isl_map_from_basic_map(
1813                 __isl_take isl_basic_map *bmap);
1815 Sets and relations can be converted to union sets and relations
1816 using the following functions.
1818         __isl_give isl_union_set *isl_union_set_from_basic_set(
1819                 __isl_take isl_basic_set *bset);
1820         __isl_give isl_union_map *isl_union_map_from_basic_map(
1821                 __isl_take isl_basic_map *bmap);
1822         __isl_give isl_union_set *isl_union_set_from_set(
1823                 __isl_take isl_set *set);
1824         __isl_give isl_union_map *isl_union_map_from_map(
1825                 __isl_take isl_map *map);
1827 The inverse conversions below can only be used if the input
1828 union set or relation is known to contain elements in exactly one
1829 space.
1831         __isl_give isl_set *isl_set_from_union_set(
1832                 __isl_take isl_union_set *uset);
1833         __isl_give isl_map *isl_map_from_union_map(
1834                 __isl_take isl_union_map *umap);
1836 Sets and relations can be copied and freed again using the following
1837 functions.
1839         __isl_give isl_basic_set *isl_basic_set_copy(
1840                 __isl_keep isl_basic_set *bset);
1841         __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1842         __isl_give isl_union_set *isl_union_set_copy(
1843                 __isl_keep isl_union_set *uset);
1844         __isl_give isl_basic_map *isl_basic_map_copy(
1845                 __isl_keep isl_basic_map *bmap);
1846         __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1847         __isl_give isl_union_map *isl_union_map_copy(
1848                 __isl_keep isl_union_map *umap);
1849         __isl_null isl_basic_set *isl_basic_set_free(
1850                 __isl_take isl_basic_set *bset);
1851         __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1852         __isl_null isl_union_set *isl_union_set_free(
1853                 __isl_take isl_union_set *uset);
1854         __isl_null isl_basic_map *isl_basic_map_free(
1855                 __isl_take isl_basic_map *bmap);
1856         __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1857         __isl_null isl_union_map *isl_union_map_free(
1858                 __isl_take isl_union_map *umap);
1860 Other sets and relations can be constructed by starting
1861 from a universe set or relation, adding equality and/or
1862 inequality constraints and then projecting out the
1863 existentially quantified variables, if any.
1864 Constraints can be constructed, manipulated and
1865 added to (or removed from) (basic) sets and relations
1866 using the following functions.
1868         #include <isl/constraint.h>
1869         __isl_give isl_constraint *isl_equality_alloc(
1870                 __isl_take isl_local_space *ls);
1871         __isl_give isl_constraint *isl_inequality_alloc(
1872                 __isl_take isl_local_space *ls);
1873         __isl_give isl_constraint *isl_constraint_set_constant_si(
1874                 __isl_take isl_constraint *constraint, int v);
1875         __isl_give isl_constraint *isl_constraint_set_constant_val(
1876                 __isl_take isl_constraint *constraint,
1877                 __isl_take isl_val *v);
1878         __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1879                 __isl_take isl_constraint *constraint,
1880                 enum isl_dim_type type, int pos, int v);
1881         __isl_give isl_constraint *
1882         isl_constraint_set_coefficient_val(
1883                 __isl_take isl_constraint *constraint,
1884                 enum isl_dim_type type, int pos,
1885                 __isl_take isl_val *v);
1886         __isl_give isl_basic_map *isl_basic_map_add_constraint(
1887                 __isl_take isl_basic_map *bmap,
1888                 __isl_take isl_constraint *constraint);
1889         __isl_give isl_basic_set *isl_basic_set_add_constraint(
1890                 __isl_take isl_basic_set *bset,
1891                 __isl_take isl_constraint *constraint);
1892         __isl_give isl_map *isl_map_add_constraint(
1893                 __isl_take isl_map *map,
1894                 __isl_take isl_constraint *constraint);
1895         __isl_give isl_set *isl_set_add_constraint(
1896                 __isl_take isl_set *set,
1897                 __isl_take isl_constraint *constraint);
1899 For example, to create a set containing the even integers
1900 between 10 and 42, you would use the following code.
1902         isl_space *space;
1903         isl_local_space *ls;
1904         isl_constraint *c;
1905         isl_basic_set *bset;
1907         space = isl_space_set_alloc(ctx, 0, 2);
1908         bset = isl_basic_set_universe(isl_space_copy(space));
1909         ls = isl_local_space_from_space(space);
1911         c = isl_equality_alloc(isl_local_space_copy(ls));
1912         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1913         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
1914         bset = isl_basic_set_add_constraint(bset, c);
1916         c = isl_inequality_alloc(isl_local_space_copy(ls));
1917         c = isl_constraint_set_constant_si(c, -10);
1918         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
1919         bset = isl_basic_set_add_constraint(bset, c);
1921         c = isl_inequality_alloc(ls);
1922         c = isl_constraint_set_constant_si(c, 42);
1923         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1924         bset = isl_basic_set_add_constraint(bset, c);
1926         bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
1928 Or, alternatively,
1930         isl_basic_set *bset;
1931         bset = isl_basic_set_read_from_str(ctx,
1932                 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
1934 A basic set or relation can also be constructed from two matrices
1935 describing the equalities and the inequalities.
1937         __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
1938                 __isl_take isl_space *space,
1939                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1940                 enum isl_dim_type c1,
1941                 enum isl_dim_type c2, enum isl_dim_type c3,
1942                 enum isl_dim_type c4);
1943         __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
1944                 __isl_take isl_space *space,
1945                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1946                 enum isl_dim_type c1,
1947                 enum isl_dim_type c2, enum isl_dim_type c3,
1948                 enum isl_dim_type c4, enum isl_dim_type c5);
1950 The C<isl_dim_type> arguments indicate the order in which
1951 different kinds of variables appear in the input matrices
1952 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
1953 C<isl_dim_set> and C<isl_dim_div> for sets and
1954 of C<isl_dim_cst>, C<isl_dim_param>,
1955 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
1957 A (basic or union) set or relation can also be constructed from a
1958 (union) (piecewise) (multiple) affine expression
1959 or a list of affine expressions
1960 (See L</"Functions">).
1962         __isl_give isl_basic_map *isl_basic_map_from_aff(
1963                 __isl_take isl_aff *aff);
1964         __isl_give isl_map *isl_map_from_aff(
1965                 __isl_take isl_aff *aff);
1966         __isl_give isl_set *isl_set_from_pw_aff(
1967                 __isl_take isl_pw_aff *pwaff);
1968         __isl_give isl_map *isl_map_from_pw_aff(
1969                 __isl_take isl_pw_aff *pwaff);
1970         __isl_give isl_basic_map *isl_basic_map_from_aff_list(
1971                 __isl_take isl_space *domain_space,
1972                 __isl_take isl_aff_list *list);
1973         __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
1974                 __isl_take isl_multi_aff *maff)
1975         __isl_give isl_map *isl_map_from_multi_aff(
1976                 __isl_take isl_multi_aff *maff)
1977         __isl_give isl_set *isl_set_from_pw_multi_aff(
1978                 __isl_take isl_pw_multi_aff *pma);
1979         __isl_give isl_map *isl_map_from_pw_multi_aff(
1980                 __isl_take isl_pw_multi_aff *pma);
1981         __isl_give isl_set *isl_set_from_multi_pw_aff(
1982                 __isl_take isl_multi_pw_aff *mpa);
1983         __isl_give isl_map *isl_map_from_multi_pw_aff(
1984                 __isl_take isl_multi_pw_aff *mpa);
1985         __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
1986                 __isl_take isl_union_pw_aff *upa);
1987         __isl_give isl_union_map *
1988         isl_union_map_from_union_pw_multi_aff(
1989                 __isl_take isl_union_pw_multi_aff *upma);
1990         __isl_give isl_union_map *
1991         isl_union_map_from_multi_union_pw_aff(
1992                 __isl_take isl_multi_union_pw_aff *mupa);
1994 The C<domain_space> argument describes the domain of the resulting
1995 basic relation.  It is required because the C<list> may consist
1996 of zero affine expressions.
1997 The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
1998 is not allowed to be zero-dimensional.  The domain of the result
1999 is the shared domain of the union piecewise affine elements.
2001 =head2 Inspecting Sets and Relations
2003 Usually, the user should not have to care about the actual constraints
2004 of the sets and maps, but should instead apply the abstract operations
2005 explained in the following sections.
2006 Occasionally, however, it may be required to inspect the individual
2007 coefficients of the constraints.  This section explains how to do so.
2008 In these cases, it may also be useful to have C<isl> compute
2009 an explicit representation of the existentially quantified variables.
2011         __isl_give isl_set *isl_set_compute_divs(
2012                 __isl_take isl_set *set);
2013         __isl_give isl_map *isl_map_compute_divs(
2014                 __isl_take isl_map *map);
2015         __isl_give isl_union_set *isl_union_set_compute_divs(
2016                 __isl_take isl_union_set *uset);
2017         __isl_give isl_union_map *isl_union_map_compute_divs(
2018                 __isl_take isl_union_map *umap);
2020 This explicit representation defines the existentially quantified
2021 variables as integer divisions of the other variables, possibly
2022 including earlier existentially quantified variables.
2023 An explicitly represented existentially quantified variable therefore
2024 has a unique value when the values of the other variables are known.
2025 If, furthermore, the same existentials, i.e., existentials
2026 with the same explicit representations, should appear in the
2027 same order in each of the disjuncts of a set or map, then the user should call
2028 either of the following functions.
2030         __isl_give isl_set *isl_set_align_divs(
2031                 __isl_take isl_set *set);
2032         __isl_give isl_map *isl_map_align_divs(
2033                 __isl_take isl_map *map);
2035 Alternatively, the existentially quantified variables can be removed
2036 using the following functions, which compute an overapproximation.
2038         __isl_give isl_basic_set *isl_basic_set_remove_divs(
2039                 __isl_take isl_basic_set *bset);
2040         __isl_give isl_basic_map *isl_basic_map_remove_divs(
2041                 __isl_take isl_basic_map *bmap);
2042         __isl_give isl_set *isl_set_remove_divs(
2043                 __isl_take isl_set *set);
2044         __isl_give isl_map *isl_map_remove_divs(
2045                 __isl_take isl_map *map);
2047 It is also possible to only remove those divs that are defined
2048 in terms of a given range of dimensions or only those for which
2049 no explicit representation is known.
2051         __isl_give isl_basic_set *
2052         isl_basic_set_remove_divs_involving_dims(
2053                 __isl_take isl_basic_set *bset,
2054                 enum isl_dim_type type,
2055                 unsigned first, unsigned n);
2056         __isl_give isl_basic_map *
2057         isl_basic_map_remove_divs_involving_dims(
2058                 __isl_take isl_basic_map *bmap,
2059                 enum isl_dim_type type,
2060                 unsigned first, unsigned n);
2061         __isl_give isl_set *isl_set_remove_divs_involving_dims(
2062                 __isl_take isl_set *set, enum isl_dim_type type,
2063                 unsigned first, unsigned n);
2064         __isl_give isl_map *isl_map_remove_divs_involving_dims(
2065                 __isl_take isl_map *map, enum isl_dim_type type,
2066                 unsigned first, unsigned n);
2068         __isl_give isl_basic_set *
2069         isl_basic_set_remove_unknown_divs(
2070                 __isl_take isl_basic_set *bset);
2071         __isl_give isl_set *isl_set_remove_unknown_divs(
2072                 __isl_take isl_set *set);
2073         __isl_give isl_map *isl_map_remove_unknown_divs(
2074                 __isl_take isl_map *map);
2076 To iterate over all the sets or maps in a union set or map, use
2078         int isl_union_set_foreach_set(__isl_keep isl_union_set *uset,
2079                 int (*fn)(__isl_take isl_set *set, void *user),
2080                 void *user);
2081         int isl_union_map_foreach_map(__isl_keep isl_union_map *umap,
2082                 int (*fn)(__isl_take isl_map *map, void *user),
2083                 void *user);
2085 The number of sets or maps in a union set or map can be obtained
2086 from
2088         int isl_union_set_n_set(__isl_keep isl_union_set *uset);
2089         int isl_union_map_n_map(__isl_keep isl_union_map *umap);
2091 To extract the set or map in a given space from a union, use
2093         __isl_give isl_set *isl_union_set_extract_set(
2094                 __isl_keep isl_union_set *uset,
2095                 __isl_take isl_space *space);
2096         __isl_give isl_map *isl_union_map_extract_map(
2097                 __isl_keep isl_union_map *umap,
2098                 __isl_take isl_space *space);
2100 To iterate over all the basic sets or maps in a set or map, use
2102         int isl_set_foreach_basic_set(__isl_keep isl_set *set,
2103                 int (*fn)(__isl_take isl_basic_set *bset, void *user),
2104                 void *user);
2105         int isl_map_foreach_basic_map(__isl_keep isl_map *map,
2106                 int (*fn)(__isl_take isl_basic_map *bmap, void *user),
2107                 void *user);
2109 The callback function C<fn> should return 0 if successful and
2110 -1 if an error occurs.  In the latter case, or if any other error
2111 occurs, the above functions will return -1.
2113 It should be noted that C<isl> does not guarantee that
2114 the basic sets or maps passed to C<fn> are disjoint.
2115 If this is required, then the user should call one of
2116 the following functions first.
2118         __isl_give isl_set *isl_set_make_disjoint(
2119                 __isl_take isl_set *set);
2120         __isl_give isl_map *isl_map_make_disjoint(
2121                 __isl_take isl_map *map);
2123 The number of basic sets in a set can be obtained
2124 or the number of basic maps in a map can be obtained
2125 from
2127         #include <isl/set.h>
2128         int isl_set_n_basic_set(__isl_keep isl_set *set);
2130         #include <isl/map.h>
2131         int isl_map_n_basic_map(__isl_keep isl_map *map);
2133 To iterate over the constraints of a basic set or map, use
2135         #include <isl/constraint.h>
2137         int isl_basic_set_n_constraint(
2138                 __isl_keep isl_basic_set *bset);
2139         int isl_basic_set_foreach_constraint(
2140                 __isl_keep isl_basic_set *bset,
2141                 int (*fn)(__isl_take isl_constraint *c, void *user),
2142                 void *user);
2143         int isl_basic_map_n_constraint(
2144                 __isl_keep isl_basic_map *bmap);
2145         int isl_basic_map_foreach_constraint(
2146                 __isl_keep isl_basic_map *bmap,
2147                 int (*fn)(__isl_take isl_constraint *c, void *user),
2148                 void *user);
2149         __isl_null isl_constraint *isl_constraint_free(
2150                 __isl_take isl_constraint *c);
2152 Again, the callback function C<fn> should return 0 if successful and
2153 -1 if an error occurs.  In the latter case, or if any other error
2154 occurs, the above functions will return -1.
2155 The constraint C<c> represents either an equality or an inequality.
2156 Use the following function to find out whether a constraint
2157 represents an equality.  If not, it represents an inequality.
2159         int isl_constraint_is_equality(
2160                 __isl_keep isl_constraint *constraint);
2162 It is also possible to obtain a list of constraints from a basic
2163 map or set
2165         #include <isl/constraint.h>
2166         __isl_give isl_constraint_list *
2167         isl_basic_map_get_constraint_list(
2168                 __isl_keep isl_basic_map *bmap);
2169         __isl_give isl_constraint_list *
2170         isl_basic_set_get_constraint_list(
2171                 __isl_keep isl_basic_set *bset);
2173 These functions require that all existentially quantified variables
2174 have an explicit representation.
2175 The returned list can be manipulated using the functions in L<"Lists">.
2177 The coefficients of the constraints can be inspected using
2178 the following functions.
2180         int isl_constraint_is_lower_bound(
2181                 __isl_keep isl_constraint *constraint,
2182                 enum isl_dim_type type, unsigned pos);
2183         int isl_constraint_is_upper_bound(
2184                 __isl_keep isl_constraint *constraint,
2185                 enum isl_dim_type type, unsigned pos);
2186         __isl_give isl_val *isl_constraint_get_constant_val(
2187                 __isl_keep isl_constraint *constraint);
2188         __isl_give isl_val *isl_constraint_get_coefficient_val(
2189                 __isl_keep isl_constraint *constraint,
2190                 enum isl_dim_type type, int pos);
2192 The explicit representations of the existentially quantified
2193 variables can be inspected using the following function.
2194 Note that the user is only allowed to use this function
2195 if the inspected set or map is the result of a call
2196 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2197 The existentially quantified variable is equal to the floor
2198 of the returned affine expression.  The affine expression
2199 itself can be inspected using the functions in
2200 L</"Functions">.
2202         __isl_give isl_aff *isl_constraint_get_div(
2203                 __isl_keep isl_constraint *constraint, int pos);
2205 To obtain the constraints of a basic set or map in matrix
2206 form, use the following functions.
2208         __isl_give isl_mat *isl_basic_set_equalities_matrix(
2209                 __isl_keep isl_basic_set *bset,
2210                 enum isl_dim_type c1, enum isl_dim_type c2,
2211                 enum isl_dim_type c3, enum isl_dim_type c4);
2212         __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2213                 __isl_keep isl_basic_set *bset,
2214                 enum isl_dim_type c1, enum isl_dim_type c2,
2215                 enum isl_dim_type c3, enum isl_dim_type c4);
2216         __isl_give isl_mat *isl_basic_map_equalities_matrix(
2217                 __isl_keep isl_basic_map *bmap,
2218                 enum isl_dim_type c1,
2219                 enum isl_dim_type c2, enum isl_dim_type c3,
2220                 enum isl_dim_type c4, enum isl_dim_type c5);
2221         __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2222                 __isl_keep isl_basic_map *bmap,
2223                 enum isl_dim_type c1,
2224                 enum isl_dim_type c2, enum isl_dim_type c3,
2225                 enum isl_dim_type c4, enum isl_dim_type c5);
2227 The C<isl_dim_type> arguments dictate the order in which
2228 different kinds of variables appear in the resulting matrix.
2229 For set inputs, they should be a permutation of
2230 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2231 For map inputs, they should be a permutation of
2232 C<isl_dim_cst>, C<isl_dim_param>,
2233 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2235 =head2 Points
2237 Points are elements of a set.  They can be used to construct
2238 simple sets (boxes) or they can be used to represent the
2239 individual elements of a set.
2240 The zero point (the origin) can be created using
2242         __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2244 The coordinates of a point can be inspected, set and changed
2245 using
2247         __isl_give isl_val *isl_point_get_coordinate_val(
2248                 __isl_keep isl_point *pnt,
2249                 enum isl_dim_type type, int pos);
2250         __isl_give isl_point *isl_point_set_coordinate_val(
2251                 __isl_take isl_point *pnt,
2252                 enum isl_dim_type type, int pos,
2253                 __isl_take isl_val *v);
2255         __isl_give isl_point *isl_point_add_ui(
2256                 __isl_take isl_point *pnt,
2257                 enum isl_dim_type type, int pos, unsigned val);
2258         __isl_give isl_point *isl_point_sub_ui(
2259                 __isl_take isl_point *pnt,
2260                 enum isl_dim_type type, int pos, unsigned val);
2262 Points can be copied or freed using
2264         __isl_give isl_point *isl_point_copy(
2265                 __isl_keep isl_point *pnt);
2266         void isl_point_free(__isl_take isl_point *pnt);
2268 A singleton set can be created from a point using
2270         __isl_give isl_basic_set *isl_basic_set_from_point(
2271                 __isl_take isl_point *pnt);
2272         __isl_give isl_set *isl_set_from_point(
2273                 __isl_take isl_point *pnt);
2275 and a box can be created from two opposite extremal points using
2277         __isl_give isl_basic_set *isl_basic_set_box_from_points(
2278                 __isl_take isl_point *pnt1,
2279                 __isl_take isl_point *pnt2);
2280         __isl_give isl_set *isl_set_box_from_points(
2281                 __isl_take isl_point *pnt1,
2282                 __isl_take isl_point *pnt2);
2284 All elements of a B<bounded> (union) set can be enumerated using
2285 the following functions.
2287         int isl_set_foreach_point(__isl_keep isl_set *set,
2288                 int (*fn)(__isl_take isl_point *pnt, void *user),
2289                 void *user);
2290         int isl_union_set_foreach_point(__isl_keep isl_union_set *uset,
2291                 int (*fn)(__isl_take isl_point *pnt, void *user),
2292                 void *user);
2294 The function C<fn> is called for each integer point in
2295 C<set> with as second argument the last argument of
2296 the C<isl_set_foreach_point> call.  The function C<fn>
2297 should return C<0> on success and C<-1> on failure.
2298 In the latter case, C<isl_set_foreach_point> will stop
2299 enumerating and return C<-1> as well.
2300 If the enumeration is performed successfully and to completion,
2301 then C<isl_set_foreach_point> returns C<0>.
2303 To obtain a single point of a (basic) set, use
2305         __isl_give isl_point *isl_basic_set_sample_point(
2306                 __isl_take isl_basic_set *bset);
2307         __isl_give isl_point *isl_set_sample_point(
2308                 __isl_take isl_set *set);
2310 If C<set> does not contain any (integer) points, then the
2311 resulting point will be ``void'', a property that can be
2312 tested using
2314         int isl_point_is_void(__isl_keep isl_point *pnt);
2316 =head2 Functions
2318 Besides sets and relation, C<isl> also supports various types of functions.
2319 Each of these types is derived from the value type (see L</"Values">)
2320 or from one of two primitive function types
2321 through the application of zero or more type constructors.
2322 We first describe the primitive type and then we describe
2323 the types derived from these primitive types.
2325 =head3 Primitive Functions
2327 C<isl> support two primitive function types, quasi-affine
2328 expressions and quasipolynomials.
2329 A quasi-affine expression is defined either over a parameter
2330 space or over a set and is composed of integer constants,
2331 parameters and set variables, addition, subtraction and
2332 integer division by an integer constant.
2333 For example, the quasi-affine expression
2335         [n] -> { [x] -> [2*floor((4 n + x)/9] }
2337 maps C<x> to C<2*floor((4 n + x)/9>.
2338 A quasipolynomial is a polynomial expression in quasi-affine
2339 expression.  That is, it additionally allows for multiplication.
2340 Note, though, that it is not allowed to construct an integer
2341 division of an expression involving multiplications.
2342 Here is an example of a quasipolynomial that is not
2343 quasi-affine expression
2345         [n] -> { [x] -> (n*floor((4 n + x)/9) }
2347 Note that the external representations of quasi-affine expressions
2348 and quasipolynomials are different.  Quasi-affine expressions
2349 use a notation with square brackets just like binary relations,
2350 while quasipolynomials do not.  This might change at some point.
2352 If a primitive function is defined over a parameter space,
2353 then the space of the function itself is that of a set.
2354 If it is defined over a set, then the space of the function
2355 is that of a relation.  In both cases, the set space (or
2356 the output space) is single-dimensional, anonymous and unstructured.
2357 To create functions with multiple dimensions or with other kinds
2358 of set or output spaces, use multiple expressions
2359 (see L</"Multiple Expressions">).
2361 =over
2363 =item * Quasi-affine Expressions
2365 Besides the expressions described above, a quasi-affine
2366 expression can also be set to NaN.  Such expressions
2367 typically represent a failure to represent a result
2368 as a quasi-affine expression.
2370 The zero quasi affine expression or the quasi affine expression
2371 that is equal to a given value or
2372 a specified dimension on a given domain can be created using
2374         #include <isl/aff.h>
2375         __isl_give isl_aff *isl_aff_zero_on_domain(
2376                 __isl_take isl_local_space *ls);
2377         __isl_give isl_aff *isl_aff_val_on_domain(
2378                 __isl_take isl_local_space *ls,
2379                 __isl_take isl_val *val);
2380         __isl_give isl_aff *isl_aff_var_on_domain(
2381                 __isl_take isl_local_space *ls,
2382                 enum isl_dim_type type, unsigned pos);
2383         __isl_give isl_aff *isl_aff_nan_on_domain(
2384                 __isl_take isl_local_space *ls);
2386 Quasi affine expressions can be copied and freed using
2388         #include <isl/aff.h>
2389         __isl_give isl_aff *isl_aff_copy(
2390                 __isl_keep isl_aff *aff);
2391         __isl_null isl_aff *isl_aff_free(
2392                 __isl_take isl_aff *aff);
2394 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2395 using the following function.  The constraint is required to have
2396 a non-zero coefficient for the specified dimension.
2398         #include <isl/constraint.h>
2399         __isl_give isl_aff *isl_constraint_get_bound(
2400                 __isl_keep isl_constraint *constraint,
2401                 enum isl_dim_type type, int pos);
2403 The entire affine expression of the constraint can also be extracted
2404 using the following function.
2406         #include <isl/constraint.h>
2407         __isl_give isl_aff *isl_constraint_get_aff(
2408                 __isl_keep isl_constraint *constraint);
2410 Conversely, an equality constraint equating
2411 the affine expression to zero or an inequality constraint enforcing
2412 the affine expression to be non-negative, can be constructed using
2414         __isl_give isl_constraint *isl_equality_from_aff(
2415                 __isl_take isl_aff *aff);
2416         __isl_give isl_constraint *isl_inequality_from_aff(
2417                 __isl_take isl_aff *aff);
2419 The coefficients and the integer divisions of an affine expression
2420 can be inspected using the following functions.
2422         #include <isl/aff.h>
2423         __isl_give isl_val *isl_aff_get_constant_val(
2424                 __isl_keep isl_aff *aff);
2425         __isl_give isl_val *isl_aff_get_coefficient_val(
2426                 __isl_keep isl_aff *aff,
2427                 enum isl_dim_type type, int pos);
2428         int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2429                 enum isl_dim_type type, int pos);
2430         __isl_give isl_val *isl_aff_get_denominator_val(
2431                 __isl_keep isl_aff *aff);
2432         __isl_give isl_aff *isl_aff_get_div(
2433                 __isl_keep isl_aff *aff, int pos);
2435 They can be modified using the following functions.
2437         #include <isl/aff.h>
2438         __isl_give isl_aff *isl_aff_set_constant_si(
2439                 __isl_take isl_aff *aff, int v);
2440         __isl_give isl_aff *isl_aff_set_constant_val(
2441                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2442         __isl_give isl_aff *isl_aff_set_coefficient_si(
2443                 __isl_take isl_aff *aff,
2444                 enum isl_dim_type type, int pos, int v);
2445         __isl_give isl_aff *isl_aff_set_coefficient_val(
2446                 __isl_take isl_aff *aff,
2447                 enum isl_dim_type type, int pos,
2448                 __isl_take isl_val *v);
2450         __isl_give isl_aff *isl_aff_add_constant_si(
2451                 __isl_take isl_aff *aff, int v);
2452         __isl_give isl_aff *isl_aff_add_constant_val(
2453                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2454         __isl_give isl_aff *isl_aff_add_constant_num_si(
2455                 __isl_take isl_aff *aff, int v);
2456         __isl_give isl_aff *isl_aff_add_coefficient_si(
2457                 __isl_take isl_aff *aff,
2458                 enum isl_dim_type type, int pos, int v);
2459         __isl_give isl_aff *isl_aff_add_coefficient_val(
2460                 __isl_take isl_aff *aff,
2461                 enum isl_dim_type type, int pos,
2462                 __isl_take isl_val *v);
2464 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2465 set the I<numerator> of the constant or coefficient, while
2466 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2467 the constant or coefficient as a whole.
2468 The C<add_constant> and C<add_coefficient> functions add an integer
2469 or rational value to
2470 the possibly rational constant or coefficient.
2471 The C<add_constant_num> functions add an integer value to
2472 the numerator.
2474 =item * Quasipolynomials
2476 Some simple quasipolynomials can be created using the following functions.
2478         #include <isl/polynomial.h>
2479         __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2480                 __isl_take isl_space *domain);
2481         __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2482                 __isl_take isl_space *domain);
2483         __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2484                 __isl_take isl_space *domain);
2485         __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2486                 __isl_take isl_space *domain);
2487         __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2488                 __isl_take isl_space *domain);
2489         __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2490                 __isl_take isl_space *domain,
2491                 __isl_take isl_val *val);
2492         __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2493                 __isl_take isl_space *domain,
2494                 enum isl_dim_type type, unsigned pos);
2495         __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2496                 __isl_take isl_aff *aff);
2498 Recall that the space in which a quasipolynomial lives is a map space
2499 with a one-dimensional range.  The C<domain> argument in some of
2500 the functions above corresponds to the domain of this map space.
2502 Quasipolynomials can be copied and freed again using the following
2503 functions.
2505         #include <isl/polynomial.h>
2506         __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2507                 __isl_keep isl_qpolynomial *qp);
2508         __isl_null isl_qpolynomial *isl_qpolynomial_free(
2509                 __isl_take isl_qpolynomial *qp);
2511 The constant term of a quasipolynomial can be extracted using
2513         __isl_give isl_val *isl_qpolynomial_get_constant_val(
2514                 __isl_keep isl_qpolynomial *qp);
2516 To iterate over all terms in a quasipolynomial,
2519         int isl_qpolynomial_foreach_term(
2520                 __isl_keep isl_qpolynomial *qp,
2521                 int (*fn)(__isl_take isl_term *term,
2522                           void *user), void *user);
2524 The terms themselves can be inspected and freed using
2525 these functions
2527         unsigned isl_term_dim(__isl_keep isl_term *term,
2528                 enum isl_dim_type type);
2529         __isl_give isl_val *isl_term_get_coefficient_val(
2530                 __isl_keep isl_term *term);
2531         int isl_term_get_exp(__isl_keep isl_term *term,
2532                 enum isl_dim_type type, unsigned pos);
2533         __isl_give isl_aff *isl_term_get_div(
2534                 __isl_keep isl_term *term, unsigned pos);
2535         void isl_term_free(__isl_take isl_term *term);
2537 Each term is a product of parameters, set variables and
2538 integer divisions.  The function C<isl_term_get_exp>
2539 returns the exponent of a given dimensions in the given term.
2541 =back
2543 =head3 Reductions
2545 A reduction represents a maximum or a minimum of its
2546 base expressions.
2547 The only reduction type defined by C<isl> is
2548 C<isl_qpolynomial_fold>.
2550 There are currently no functions to directly create such
2551 objects, but they do appear in the piecewise quasipolynomial
2552 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2554 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2556 Reductions can be copied and freed using
2557 the following functions.
2559         #include <isl/polynomial.h>
2560         __isl_give isl_qpolynomial_fold *
2561         isl_qpolynomial_fold_copy(
2562                 __isl_keep isl_qpolynomial_fold *fold);
2563         void isl_qpolynomial_fold_free(
2564                 __isl_take isl_qpolynomial_fold *fold);
2566 To iterate over all quasipolynomials in a reduction, use
2568         int isl_qpolynomial_fold_foreach_qpolynomial(
2569                 __isl_keep isl_qpolynomial_fold *fold,
2570                 int (*fn)(__isl_take isl_qpolynomial *qp,
2571                           void *user), void *user);
2573 =head3 Multiple Expressions
2575 A multiple expression represents a sequence of zero or
2576 more base expressions, all defined on the same domain space.
2577 The domain space of the multiple expression is the same
2578 as that of the base expressions, but the range space
2579 can be any space.  In case the base expressions have
2580 a set space, the corresponding multiple expression
2581 also has a set space.
2582 Objects of the value type do not have an associated space.
2583 The space of a multiple value is therefore always a set space.
2584 Similarly, the space of a multiple union piecewise
2585 affine expression is always a set space.
2587 The multiple expression types defined by C<isl>
2588 are C<isl_multi_val>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
2589 C<isl_multi_union_pw_aff>.
2591 A multiple expression with the value zero for
2592 each output (or set) dimension can be created
2593 using the following functions.
2595         #include <isl/val.h>
2596         __isl_give isl_multi_val *isl_multi_val_zero(
2597                 __isl_take isl_space *space);
2599         #include <isl/aff.h>
2600         __isl_give isl_multi_aff *isl_multi_aff_zero(
2601                 __isl_take isl_space *space);
2602         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2603                 __isl_take isl_space *space);
2604         __isl_give isl_multi_union_pw_aff *
2605         isl_multi_union_pw_aff_zero(
2606                 __isl_take isl_space *space);
2608 Since there is no canonical way of representing a zero
2609 value of type C<isl_union_pw_aff>, the space passed
2610 to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
2612 An identity function can be created using the following
2613 functions.  The space needs to be that of a relation
2614 with the same number of input and output dimensions.
2616         #include <isl/aff.h>
2617         __isl_give isl_multi_aff *isl_multi_aff_identity(
2618                 __isl_take isl_space *space);
2619         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2620                 __isl_take isl_space *space);
2622 A function that performs a projection on a universe
2623 relation or set can be created using the following functions.
2624 See also the corresponding
2625 projection operations in L</"Unary Operations">.
2627         #include <isl/aff.h>
2628         __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2629                 __isl_take isl_space *space);
2630         __isl_give isl_multi_aff *isl_multi_aff_range_map(
2631                 __isl_take isl_space *space);
2632         __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2633                 __isl_take isl_space *space,
2634                 enum isl_dim_type type,
2635                 unsigned first, unsigned n);
2637 A multiple expression can be created from a single
2638 base expression using the following functions.
2639 The space of the created multiple expression is the same
2640 as that of the base expression, except for
2641 C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
2642 lives in a parameter space and the output lives
2643 in a single-dimensional set space.
2645         #include <isl/aff.h>
2646         __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2647                 __isl_take isl_aff *aff);
2648         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2649                 __isl_take isl_pw_aff *pa);
2650         __isl_give isl_multi_union_pw_aff *
2651         isl_multi_union_pw_aff_from_union_pw_aff(
2652                 __isl_take isl_union_pw_aff *upa);
2654 A multiple expression can be created from a list
2655 of base expression in a specified space.
2656 The domain of this space needs to be the same
2657 as the domains of the base expressions in the list.
2658 If the base expressions have a set space (or no associated space),
2659 then this space also needs to be a set space.
2661         #include <isl/val.h>
2662         __isl_give isl_multi_val *isl_multi_val_from_val_list(
2663                 __isl_take isl_space *space,
2664                 __isl_take isl_val_list *list);
2666         #include <isl/aff.h>
2667         __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2668                 __isl_take isl_space *space,
2669                 __isl_take isl_aff_list *list);
2670         __isl_give isl_multi_union_pw_aff *
2671         isl_multi_union_pw_aff_from_union_pw_aff_list(
2672                 __isl_take isl_space *space,
2673                 __isl_take isl_union_pw_aff_list *list);
2675 As a convenience, a multiple piecewise expression can
2676 also be created from a multiple expression.
2677 Each piecewise expression in the result has a single
2678 universe cell.
2680         #include <isl/aff.h>
2681         __isl_give isl_multi_pw_aff *
2682         isl_multi_pw_aff_from_multi_aff(
2683                 __isl_take isl_multi_aff *ma);
2685 Similarly, a multiple union expression can be
2686 created from a multiple expression.
2688         #include <isl/aff.h>
2689         __isl_give isl_multi_union_pw_aff *
2690         isl_multi_union_pw_aff_from_multi_aff(
2691                 __isl_take isl_multi_aff *ma);
2692         __isl_give isl_multi_union_pw_aff *
2693         isl_multi_union_pw_aff_from_multi_pw_aff(
2694                 __isl_take isl_multi_pw_aff *mpa);
2696 A multiple quasi-affine expression can be created from
2697 a multiple value with a given domain space using the following
2698 function.
2700         #include <isl/aff.h>
2701         __isl_give isl_multi_aff *
2702         isl_multi_aff_multi_val_on_space(
2703                 __isl_take isl_space *space,
2704                 __isl_take isl_multi_val *mv);
2706 Similarly,
2707 a multiple union piecewise affine expression can be created from
2708 a multiple value with a given domain or
2709 a multiple affine expression with a given domain
2710 using the following functions.
2712         #include <isl/aff.h>
2713         __isl_give isl_multi_union_pw_aff *
2714         isl_multi_union_pw_aff_multi_val_on_domain(
2715                 __isl_take isl_union_set *domain,
2716                 __isl_take isl_multi_val *mv);
2717         __isl_give isl_multi_union_pw_aff *
2718         isl_multi_union_pw_aff_multi_aff_on_domain(
2719                 __isl_take isl_union_set *domain,
2720                 __isl_take isl_multi_aff *ma);
2722 Multiple expressions can be copied and freed using
2723 the following functions.
2725         #include <isl/val.h>
2726         __isl_give isl_multi_val *isl_multi_val_copy(
2727                 __isl_keep isl_multi_val *mv);
2728         __isl_null isl_multi_val *isl_multi_val_free(
2729                 __isl_take isl_multi_val *mv);
2731         #include <isl/aff.h>
2732         __isl_give isl_multi_aff *isl_multi_aff_copy(
2733                 __isl_keep isl_multi_aff *maff);
2734         __isl_null isl_multi_aff *isl_multi_aff_free(
2735                 __isl_take isl_multi_aff *maff);
2736         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2737                 __isl_keep isl_multi_pw_aff *mpa);
2738         __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2739                 __isl_take isl_multi_pw_aff *mpa);
2740         __isl_give isl_multi_union_pw_aff *
2741         isl_multi_union_pw_aff_copy(
2742                 __isl_keep isl_multi_union_pw_aff *mupa);
2743         __isl_null isl_multi_union_pw_aff *
2744         isl_multi_union_pw_aff_free(
2745                 __isl_take isl_multi_union_pw_aff *mupa);
2747 The base expression at a given position of a multiple
2748 expression can be extracted using the following functions.
2750         #include <isl/val.h>
2751         __isl_give isl_val *isl_multi_val_get_val(
2752                 __isl_keep isl_multi_val *mv, int pos);
2754         #include <isl/aff.h>
2755         __isl_give isl_aff *isl_multi_aff_get_aff(
2756                 __isl_keep isl_multi_aff *multi, int pos);
2757         __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2758                 __isl_keep isl_multi_pw_aff *mpa, int pos);
2759         __isl_give isl_union_pw_aff *
2760         isl_multi_union_pw_aff_get_union_pw_aff(
2761                 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
2763 It can be replaced using the following functions.
2765         #include <isl/val.h>
2766         __isl_give isl_multi_val *isl_multi_val_set_val(
2767                 __isl_take isl_multi_val *mv, int pos,
2768                 __isl_take isl_val *val);
2770         #include <isl/aff.h>
2771         __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2772                 __isl_take isl_multi_aff *multi, int pos,
2773                 __isl_take isl_aff *aff);
2774         __isl_give isl_multi_union_pw_aff *
2775         isl_multi_union_pw_aff_set_union_pw_aff(
2776                 __isl_take isl_multi_union_pw_aff *mupa, int pos,
2777                 __isl_take isl_union_pw_aff *upa);
2779 As a convenience, a sequence of base expressions that have
2780 their domains in a given space can be extracted from a sequence
2781 of union expressions using the following function.
2783         #include <isl/aff.h>
2784         __isl_give isl_multi_pw_aff *
2785         isl_multi_union_pw_aff_extract_multi_pw_aff(
2786                 __isl_keep isl_multi_union_pw_aff *mupa,
2787                 __isl_take isl_space *space);
2789 Note that there is a difference between C<isl_multi_union_pw_aff>
2790 and C<isl_union_pw_multi_aff> objects.  The first is a sequence
2791 of unions of piecewise expressions, while the second is a union
2792 of piecewise sequences.  In particular, multiple affine expressions
2793 in an C<isl_union_pw_multi_aff> may live in different spaces,
2794 while there is only a single multiple expression in
2795 an C<isl_multi_union_pw_aff>, which can therefore only live
2796 in a single space.  This means that not every
2797 C<isl_union_pw_multi_aff> can be converted to
2798 an C<isl_multi_union_pw_aff>.  Conversely, a zero-dimensional
2799 C<isl_multi_union_pw_aff> carries no information
2800 about any possible domain and therefore cannot be converted
2801 to an C<isl_union_pw_multi_aff>.  Moreover, the elements
2802 of an C<isl_multi_union_pw_aff> may be defined over different domains,
2803 while each multiple expression inside an C<isl_union_pw_multi_aff>
2804 has a single domain.  The conversion of an C<isl_union_pw_multi_aff>
2805 of dimension greater than one may therefore not be exact.
2806 The following functions can
2807 be used to perform these conversions when they are possible.
2809         #include <isl/aff.h>
2810         __isl_give isl_multi_union_pw_aff *
2811         isl_multi_union_pw_aff_from_union_pw_multi_aff(
2812                 __isl_take isl_union_pw_multi_aff *upma);
2813         __isl_give isl_union_pw_multi_aff *
2814         isl_union_pw_multi_aff_from_multi_union_pw_aff(
2815                 __isl_take isl_multi_union_pw_aff *mupa);
2817 =head3 Piecewise Expressions
2819 A piecewise expression is an expression that is described
2820 using zero or more base expression defined over the same
2821 number of cells in the domain space of the base expressions.
2822 All base expressions are defined over the same
2823 domain space and the cells are disjoint.
2824 The space of a piecewise expression is the same as
2825 that of the base expressions.
2826 If the union of the cells is a strict subset of the domain
2827 space, then the value of the piecewise expression outside
2828 this union is different for types derived from quasi-affine
2829 expressions and those derived from quasipolynomials.
2830 Piecewise expressions derived from quasi-affine expressions
2831 are considered to be undefined outside the union of their cells.
2832 Piecewise expressions derived from quasipolynomials
2833 are considered to be zero outside the union of their cells.
2835 Piecewise quasipolynomials are mainly used by the C<barvinok>
2836 library for representing the number of elements in a parametric set or map.
2837 For example, the piecewise quasipolynomial
2839         [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
2841 represents the number of points in the map
2843         [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
2845 The piecewise expression types defined by C<isl>
2846 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
2847 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
2849 A piecewise expression with no cells can be created using
2850 the following functions.
2852         #include <isl/aff.h>
2853         __isl_give isl_pw_aff *isl_pw_aff_empty(
2854                 __isl_take isl_space *space);
2855         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
2856                 __isl_take isl_space *space);
2858 A piecewise expression with a single universe cell can be
2859 created using the following functions.
2861         #include <isl/aff.h>
2862         __isl_give isl_pw_aff *isl_pw_aff_from_aff(
2863                 __isl_take isl_aff *aff);
2864         __isl_give isl_pw_multi_aff *
2865         isl_pw_multi_aff_from_multi_aff(
2866                 __isl_take isl_multi_aff *ma);
2868         #include <isl/polynomial.h>
2869         __isl_give isl_pw_qpolynomial *
2870         isl_pw_qpolynomial_from_qpolynomial(
2871                 __isl_take isl_qpolynomial *qp);
2873 A piecewise expression with a single specified cell can be
2874 created using the following functions.
2876         #include <isl/aff.h>
2877         __isl_give isl_pw_aff *isl_pw_aff_alloc(
2878                 __isl_take isl_set *set, __isl_take isl_aff *aff);
2879         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
2880                 __isl_take isl_set *set,
2881                 __isl_take isl_multi_aff *maff);
2883         #include <isl/polynomial.h>
2884         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
2885                 __isl_take isl_set *set,
2886                 __isl_take isl_qpolynomial *qp);
2888 The following convenience functions first create a base expression and
2889 then create a piecewise expression over a universe domain.
2891         #include <isl/aff.h>
2892         __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
2893                 __isl_take isl_local_space *ls);
2894         __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
2895                 __isl_take isl_local_space *ls,
2896                 enum isl_dim_type type, unsigned pos);
2897         __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
2898                 __isl_take isl_local_space *ls);
2899         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
2900                 __isl_take isl_space *space);
2901         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
2902                 __isl_take isl_space *space);
2903         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
2904                 __isl_take isl_space *space);
2905         __isl_give isl_pw_multi_aff *
2906         isl_pw_multi_aff_project_out_map(
2907                 __isl_take isl_space *space,
2908                 enum isl_dim_type type,
2909                 unsigned first, unsigned n);
2911         #include <isl/polynomial.h>
2912         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
2913                 __isl_take isl_space *space);
2915 The following convenience functions first create a base expression and
2916 then create a piecewise expression over a given domain.
2918         #include <isl/aff.h>
2919         __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
2920                 __isl_take isl_set *domain,
2921                 __isl_take isl_val *v);
2922         __isl_give isl_pw_multi_aff *
2923         isl_pw_multi_aff_multi_val_on_domain(
2924                 __isl_take isl_set *domain,
2925                 __isl_take isl_multi_val *mv);
2927 As a convenience, a piecewise multiple expression can
2928 also be created from a piecewise expression.
2929 Each multiple expression in the result is derived
2930 from the corresponding base expression.
2932         #include <isl/aff.h>
2933         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
2934                 __isl_take isl_pw_aff *pa);
2936 Similarly, a piecewise quasipolynomial can be
2937 created from a piecewise quasi-affine expression using
2938 the following function.
2940         #include <isl/polynomial.h>
2941         __isl_give isl_pw_qpolynomial *
2942         isl_pw_qpolynomial_from_pw_aff(
2943                 __isl_take isl_pw_aff *pwaff);
2945 Piecewise expressions can be copied and freed using the following functions.
2947         #include <isl/aff.h>
2948         __isl_give isl_pw_aff *isl_pw_aff_copy(
2949                 __isl_keep isl_pw_aff *pwaff);
2950         __isl_null isl_pw_aff *isl_pw_aff_free(
2951                 __isl_take isl_pw_aff *pwaff);
2952         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
2953                 __isl_keep isl_pw_multi_aff *pma);
2954         __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
2955                 __isl_take isl_pw_multi_aff *pma);
2957         #include <isl/polynomial.h>
2958         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
2959                 __isl_keep isl_pw_qpolynomial *pwqp);
2960         __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
2961                 __isl_take isl_pw_qpolynomial *pwqp);
2962         __isl_give isl_pw_qpolynomial_fold *
2963         isl_pw_qpolynomial_fold_copy(
2964                 __isl_keep isl_pw_qpolynomial_fold *pwf);
2965         __isl_null isl_pw_qpolynomial_fold *
2966         isl_pw_qpolynomial_fold_free(
2967                 __isl_take isl_pw_qpolynomial_fold *pwf);
2969 To iterate over the different cells of a piecewise expression,
2970 use the following functions.
2972         #include <isl/aff.h>
2973         int isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
2974         int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
2975         int isl_pw_aff_foreach_piece(__isl_keep isl_pw_aff *pwaff,
2976                 int (*fn)(__isl_take isl_set *set,
2977                           __isl_take isl_aff *aff,
2978                           void *user), void *user);
2979         int isl_pw_multi_aff_foreach_piece(
2980                 __isl_keep isl_pw_multi_aff *pma,
2981                 int (*fn)(__isl_take isl_set *set,
2982                             __isl_take isl_multi_aff *maff,
2983                             void *user), void *user);
2985         #include <isl/polynomial.h>
2986         int isl_pw_qpolynomial_foreach_piece(
2987                 __isl_keep isl_pw_qpolynomial *pwqp,
2988                 int (*fn)(__isl_take isl_set *set,
2989                           __isl_take isl_qpolynomial *qp,
2990                           void *user), void *user);
2991         int isl_pw_qpolynomial_foreach_lifted_piece(
2992                 __isl_keep isl_pw_qpolynomial *pwqp,
2993                 int (*fn)(__isl_take isl_set *set,
2994                           __isl_take isl_qpolynomial *qp,
2995                           void *user), void *user);
2996         int isl_pw_qpolynomial_fold_foreach_piece(
2997                 __isl_keep isl_pw_qpolynomial_fold *pwf,
2998                 int (*fn)(__isl_take isl_set *set,
2999                           __isl_take isl_qpolynomial_fold *fold,
3000                           void *user), void *user);
3001         int isl_pw_qpolynomial_fold_foreach_lifted_piece(
3002                 __isl_keep isl_pw_qpolynomial_fold *pwf,
3003                 int (*fn)(__isl_take isl_set *set,
3004                           __isl_take isl_qpolynomial_fold *fold,
3005                           void *user), void *user);
3007 As usual, the function C<fn> should return C<0> on success
3008 and C<-1> on failure.  The difference between
3009 C<isl_pw_qpolynomial_foreach_piece> and
3010 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
3011 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
3012 compute unique representations for all existentially quantified
3013 variables and then turn these existentially quantified variables
3014 into extra set variables, adapting the associated quasipolynomial
3015 accordingly.  This means that the C<set> passed to C<fn>
3016 will not have any existentially quantified variables, but that
3017 the dimensions of the sets may be different for different
3018 invocations of C<fn>.
3019 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
3020 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
3022 A piecewise expression consisting of the expressions at a given
3023 position of a piecewise multiple expression can be extracted
3024 using the following function.
3026         #include <isl/aff.h>
3027         __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3028                 __isl_keep isl_pw_multi_aff *pma, int pos);
3030 These expressions can be replaced using the following function.
3032         #include <isl/aff.h>
3033         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3034                 __isl_take isl_pw_multi_aff *pma, unsigned pos,
3035                 __isl_take isl_pw_aff *pa);
3037 Note that there is a difference between C<isl_multi_pw_aff> and
3038 C<isl_pw_multi_aff> objects.  The first is a sequence of piecewise
3039 affine expressions, while the second is a piecewise sequence
3040 of affine expressions.  In particular, each of the piecewise
3041 affine expressions in an C<isl_multi_pw_aff> may have a different
3042 domain, while all multiple expressions associated to a cell
3043 in an C<isl_pw_multi_aff> have the same domain.
3044 It is possible to convert between the two, but when converting
3045 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3046 of the result is the intersection of the domains of the input.
3047 The reverse conversion is exact.
3049         #include <isl/aff.h>
3050         __isl_give isl_pw_multi_aff *
3051         isl_pw_multi_aff_from_multi_pw_aff(
3052                 __isl_take isl_multi_pw_aff *mpa);
3053         __isl_give isl_multi_pw_aff *
3054         isl_multi_pw_aff_from_pw_multi_aff(
3055                 __isl_take isl_pw_multi_aff *pma);
3057 =head3 Union Expressions
3059 A union expression collects base expressions defined
3060 over different domains.  The space of a union expression
3061 is that of the shared parameter space.
3063 The union expression types defined by C<isl>
3064 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3065 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3067 An empty union expression can be created using the following functions.
3069         #include <isl/aff.h>
3070         __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
3071                 __isl_take isl_space *space);
3072         __isl_give isl_union_pw_multi_aff *
3073         isl_union_pw_multi_aff_empty(
3074                 __isl_take isl_space *space);
3076         #include <isl/polynomial.h>
3077         __isl_give isl_union_pw_qpolynomial *
3078         isl_union_pw_qpolynomial_zero(
3079                 __isl_take isl_space *space);
3081 A union expression containing a single base expression
3082 can be created using the following functions.
3084         #include <isl/aff.h>
3085         __isl_give isl_union_pw_aff *
3086         isl_union_pw_aff_from_pw_aff(
3087                 __isl_take isl_pw_aff *pa);
3088         __isl_give isl_union_pw_multi_aff *
3089         isl_union_pw_multi_aff_from_aff(
3090                 __isl_take isl_aff *aff);
3091         __isl_give isl_union_pw_multi_aff *
3092         isl_union_pw_multi_aff_from_pw_multi_aff(
3093                 __isl_take isl_pw_multi_aff *pma);
3095         #include <isl/polynomial.h>
3096         __isl_give isl_union_pw_qpolynomial *
3097         isl_union_pw_qpolynomial_from_pw_qpolynomial(
3098                 __isl_take isl_pw_qpolynomial *pwqp);
3100 The following functions create a base expression on each
3101 of the sets in the union set and collect the results.
3103         #include <isl/aff.h>
3104         __isl_give isl_union_pw_multi_aff *
3105         isl_union_pw_multi_aff_from_union_pw_aff(
3106                 __isl_take isl_union_pw_aff *upa);
3107         __isl_give isl_union_pw_aff *
3108         isl_union_pw_multi_aff_get_union_pw_aff(
3109                 __isl_keep isl_union_pw_multi_aff *upma, int pos);
3110         __isl_give isl_union_pw_aff *
3111         isl_union_pw_aff_val_on_domain(
3112                 __isl_take isl_union_set *domain,
3113                 __isl_take isl_val *v);
3114         __isl_give isl_union_pw_multi_aff *
3115         isl_union_pw_multi_aff_multi_val_on_domain(
3116                 __isl_take isl_union_set *domain,
3117                 __isl_take isl_multi_val *mv);
3119 An C<isl_union_pw_aff> that is equal to a (parametric) affine
3120 expression on a given domain can be created using the following
3121 function.
3123         #include <isl/aff.h>
3124         __isl_give isl_union_pw_aff *
3125         isl_union_pw_aff_aff_on_domain(
3126                 __isl_take isl_union_set *domain,
3127                 __isl_take isl_aff *aff);
3129 A base expression can be added to a union expression using
3130 the following functions.
3132         #include <isl/aff.h>
3133         __isl_give isl_union_pw_aff *
3134         isl_union_pw_aff_add_pw_aff(
3135                 __isl_take isl_union_pw_aff *upa,
3136                 __isl_take isl_pw_aff *pa);
3137         __isl_give isl_union_pw_multi_aff *
3138         isl_union_pw_multi_aff_add_pw_multi_aff(
3139                 __isl_take isl_union_pw_multi_aff *upma,
3140                 __isl_take isl_pw_multi_aff *pma);
3142         #include <isl/polynomial.h>
3143         __isl_give isl_union_pw_qpolynomial *
3144         isl_union_pw_qpolynomial_add_pw_qpolynomial(
3145                 __isl_take isl_union_pw_qpolynomial *upwqp,
3146                 __isl_take isl_pw_qpolynomial *pwqp);
3148 Union expressions can be copied and freed using
3149 the following functions.
3151         #include <isl/aff.h>
3152         __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
3153                 __isl_keep isl_union_pw_aff *upa);
3154         __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
3155                 __isl_take isl_union_pw_aff *upa);
3156         __isl_give isl_union_pw_multi_aff *
3157         isl_union_pw_multi_aff_copy(
3158                 __isl_keep isl_union_pw_multi_aff *upma);
3159         __isl_null isl_union_pw_multi_aff *
3160         isl_union_pw_multi_aff_free(
3161                 __isl_take isl_union_pw_multi_aff *upma);
3163         #include <isl/polynomial.h>
3164         __isl_give isl_union_pw_qpolynomial *
3165         isl_union_pw_qpolynomial_copy(
3166                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3167         __isl_null isl_union_pw_qpolynomial *
3168         isl_union_pw_qpolynomial_free(
3169                 __isl_take isl_union_pw_qpolynomial *upwqp);
3170         __isl_give isl_union_pw_qpolynomial_fold *
3171         isl_union_pw_qpolynomial_fold_copy(
3172                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3173         __isl_null isl_union_pw_qpolynomial_fold *
3174         isl_union_pw_qpolynomial_fold_free(
3175                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3177 To iterate over the base expressions in a union expression,
3178 use the following functions.
3180         #include <isl/aff.h>
3181         int isl_union_pw_aff_n_pw_aff(
3182                 __isl_keep isl_union_pw_aff *upa);
3183         int isl_union_pw_aff_foreach_pw_aff(
3184                 __isl_keep isl_union_pw_aff *upa,
3185                 int (*fn)(__isl_take isl_pw_aff *ma, void *user),
3186                         void *user);
3187         int isl_union_pw_multi_aff_n_pw_multi_aff(
3188                 __isl_keep isl_union_pw_multi_aff *upma);
3189         int isl_union_pw_multi_aff_foreach_pw_multi_aff(
3190                 __isl_keep isl_union_pw_multi_aff *upma,
3191                 int (*fn)(__isl_take isl_pw_multi_aff *pma,
3192                             void *user), void *user);
3194         #include <isl/polynomial.h>
3195         int isl_union_pw_qpolynomial_n_pw_qpolynomial(
3196                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3197         int isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3198                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3199                 int (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3200                             void *user), void *user);
3201         int isl_union_pw_qpolynomial_fold_n_pw_qpolynomial_fold(
3202                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3203         int isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3204                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3205                 int (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3206                             void *user), void *user);
3208 To extract the base expression in a given space from a union, use
3209 the following functions.
3211         #include <isl/aff.h>
3212         __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3213                 __isl_keep isl_union_pw_aff *upa,
3214                 __isl_take isl_space *space);
3215         __isl_give isl_pw_multi_aff *
3216         isl_union_pw_multi_aff_extract_pw_multi_aff(
3217                 __isl_keep isl_union_pw_multi_aff *upma,
3218                 __isl_take isl_space *space);
3220         #include <isl/polynomial.h>
3221         __isl_give isl_pw_qpolynomial *
3222         isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3223                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3224                 __isl_take isl_space *space);
3226 =head2 Input and Output
3228 For set and relation,
3229 C<isl> supports its own input/output format, which is similar
3230 to the C<Omega> format, but also supports the C<PolyLib> format
3231 in some cases.
3232 For other object types, typically only an C<isl> format is supported.
3234 =head3 C<isl> format
3236 The C<isl> format is similar to that of C<Omega>, but has a different
3237 syntax for describing the parameters and allows for the definition
3238 of an existentially quantified variable as the integer division
3239 of an affine expression.
3240 For example, the set of integers C<i> between C<0> and C<n>
3241 such that C<i % 10 <= 6> can be described as
3243         [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3244                                 i - 10 a <= 6) }
3246 A set or relation can have several disjuncts, separated
3247 by the keyword C<or>.  Each disjunct is either a conjunction
3248 of constraints or a projection (C<exists>) of a conjunction
3249 of constraints.  The constraints are separated by the keyword
3250 C<and>.
3252 =head3 C<PolyLib> format
3254 If the represented set is a union, then the first line
3255 contains a single number representing the number of disjuncts.
3256 Otherwise, a line containing the number C<1> is optional.
3258 Each disjunct is represented by a matrix of constraints.
3259 The first line contains two numbers representing
3260 the number of rows and columns,
3261 where the number of rows is equal to the number of constraints
3262 and the number of columns is equal to two plus the number of variables.
3263 The following lines contain the actual rows of the constraint matrix.
3264 In each row, the first column indicates whether the constraint
3265 is an equality (C<0>) or inequality (C<1>).  The final column
3266 corresponds to the constant term.
3268 If the set is parametric, then the coefficients of the parameters
3269 appear in the last columns before the constant column.
3270 The coefficients of any existentially quantified variables appear
3271 between those of the set variables and those of the parameters.
3273 =head3 Extended C<PolyLib> format
3275 The extended C<PolyLib> format is nearly identical to the
3276 C<PolyLib> format.  The only difference is that the line
3277 containing the number of rows and columns of a constraint matrix
3278 also contains four additional numbers:
3279 the number of output dimensions, the number of input dimensions,
3280 the number of local dimensions (i.e., the number of existentially
3281 quantified variables) and the number of parameters.
3282 For sets, the number of ``output'' dimensions is equal
3283 to the number of set dimensions, while the number of ``input''
3284 dimensions is zero.
3286 =head3 Input
3288 Objects can be read from input using the following functions.
3290         #include <isl/val.h>
3291         __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3292                 const char *str);
3293         __isl_give isl_multi_val *isl_multi_val_read_from_str(
3294                 isl_ctx *ctx, const char *str);
3296         #include <isl/set.h>
3297         __isl_give isl_basic_set *isl_basic_set_read_from_file(
3298                 isl_ctx *ctx, FILE *input);
3299         __isl_give isl_basic_set *isl_basic_set_read_from_str(
3300                 isl_ctx *ctx, const char *str);
3301         __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3302                 FILE *input);
3303         __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3304                 const char *str);
3306         #include <isl/map.h>
3307         __isl_give isl_basic_map *isl_basic_map_read_from_file(
3308                 isl_ctx *ctx, FILE *input);
3309         __isl_give isl_basic_map *isl_basic_map_read_from_str(
3310                 isl_ctx *ctx, const char *str);
3311         __isl_give isl_map *isl_map_read_from_file(
3312                 isl_ctx *ctx, FILE *input);
3313         __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3314                 const char *str);
3316         #include <isl/union_set.h>
3317         __isl_give isl_union_set *isl_union_set_read_from_file(
3318                 isl_ctx *ctx, FILE *input);
3319         __isl_give isl_union_set *isl_union_set_read_from_str(
3320                 isl_ctx *ctx, const char *str);
3322         #include <isl/union_map.h>
3323         __isl_give isl_union_map *isl_union_map_read_from_file(
3324                 isl_ctx *ctx, FILE *input);
3325         __isl_give isl_union_map *isl_union_map_read_from_str(
3326                 isl_ctx *ctx, const char *str);
3328         #include <isl/aff.h>
3329         __isl_give isl_aff *isl_aff_read_from_str(
3330                 isl_ctx *ctx, const char *str);
3331         __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3332                 isl_ctx *ctx, const char *str);
3333         __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3334                 isl_ctx *ctx, const char *str);
3335         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3336                 isl_ctx *ctx, const char *str);
3337         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3338                 isl_ctx *ctx, const char *str);
3339         __isl_give isl_union_pw_multi_aff *
3340         isl_union_pw_multi_aff_read_from_str(
3341                 isl_ctx *ctx, const char *str);
3342         __isl_give isl_multi_union_pw_aff *
3343         isl_multi_union_pw_aff_read_from_str(
3344                 isl_ctx *ctx, const char *str);
3346         #include <isl/polynomial.h>
3347         __isl_give isl_union_pw_qpolynomial *
3348         isl_union_pw_qpolynomial_read_from_str(
3349                 isl_ctx *ctx, const char *str);
3351 For sets and relations,
3352 the input format is autodetected and may be either the C<PolyLib> format
3353 or the C<isl> format.
3355 =head3 Output
3357 Before anything can be printed, an C<isl_printer> needs to
3358 be created.
3360         __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3361                 FILE *file);
3362         __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3363         __isl_null isl_printer *isl_printer_free(
3364                 __isl_take isl_printer *printer);
3365         __isl_give char *isl_printer_get_str(
3366                 __isl_keep isl_printer *printer);
3368 The printer can be inspected using the following functions.
3370         FILE *isl_printer_get_file(
3371                 __isl_keep isl_printer *printer);
3372         int isl_printer_get_output_format(
3373                 __isl_keep isl_printer *p);
3374         int isl_printer_get_yaml_style(__isl_keep isl_printer *p);
3376 The behavior of the printer can be modified in various ways
3378         __isl_give isl_printer *isl_printer_set_output_format(
3379                 __isl_take isl_printer *p, int output_format);
3380         __isl_give isl_printer *isl_printer_set_indent(
3381                 __isl_take isl_printer *p, int indent);
3382         __isl_give isl_printer *isl_printer_set_indent_prefix(
3383                 __isl_take isl_printer *p, const char *prefix);
3384         __isl_give isl_printer *isl_printer_indent(
3385                 __isl_take isl_printer *p, int indent);
3386         __isl_give isl_printer *isl_printer_set_prefix(
3387                 __isl_take isl_printer *p, const char *prefix);
3388         __isl_give isl_printer *isl_printer_set_suffix(
3389                 __isl_take isl_printer *p, const char *suffix);
3390         __isl_give isl_printer *isl_printer_set_yaml_style(
3391                 __isl_take isl_printer *p, int yaml_style);
3393 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3394 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3395 and defaults to C<ISL_FORMAT_ISL>.
3396 Each line in the output is prefixed by C<indent_prefix>,
3397 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3398 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3399 In the C<PolyLib> format output,
3400 the coefficients of the existentially quantified variables
3401 appear between those of the set variables and those
3402 of the parameters.
3403 The function C<isl_printer_indent> increases the indentation
3404 by the specified amount (which may be negative).
3405 The YAML style may be either C<ISL_YAML_STYLE_BLOCK> or
3406 C<ISL_YAML_STYLE_FLOW> and when we are printing something
3407 in YAML format.
3409 To actually print something, use
3411         #include <isl/printer.h>
3412         __isl_give isl_printer *isl_printer_print_double(
3413                 __isl_take isl_printer *p, double d);
3415         #include <isl/val.h>
3416         __isl_give isl_printer *isl_printer_print_val(
3417                 __isl_take isl_printer *p, __isl_keep isl_val *v);
3419         #include <isl/set.h>
3420         __isl_give isl_printer *isl_printer_print_basic_set(
3421                 __isl_take isl_printer *printer,
3422                 __isl_keep isl_basic_set *bset);
3423         __isl_give isl_printer *isl_printer_print_set(
3424                 __isl_take isl_printer *printer,
3425                 __isl_keep isl_set *set);
3427         #include <isl/map.h>
3428         __isl_give isl_printer *isl_printer_print_basic_map(
3429                 __isl_take isl_printer *printer,
3430                 __isl_keep isl_basic_map *bmap);
3431         __isl_give isl_printer *isl_printer_print_map(
3432                 __isl_take isl_printer *printer,
3433                 __isl_keep isl_map *map);
3435         #include <isl/union_set.h>
3436         __isl_give isl_printer *isl_printer_print_union_set(
3437                 __isl_take isl_printer *p,
3438                 __isl_keep isl_union_set *uset);
3440         #include <isl/union_map.h>
3441         __isl_give isl_printer *isl_printer_print_union_map(
3442                 __isl_take isl_printer *p,
3443                 __isl_keep isl_union_map *umap);
3445         #include <isl/val.h>
3446         __isl_give isl_printer *isl_printer_print_multi_val(
3447                 __isl_take isl_printer *p,
3448                 __isl_keep isl_multi_val *mv);
3450         #include <isl/aff.h>
3451         __isl_give isl_printer *isl_printer_print_aff(
3452                 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3453         __isl_give isl_printer *isl_printer_print_multi_aff(
3454                 __isl_take isl_printer *p,
3455                 __isl_keep isl_multi_aff *maff);
3456         __isl_give isl_printer *isl_printer_print_pw_aff(
3457                 __isl_take isl_printer *p,
3458                 __isl_keep isl_pw_aff *pwaff);
3459         __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3460                 __isl_take isl_printer *p,
3461                 __isl_keep isl_pw_multi_aff *pma);
3462         __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3463                 __isl_take isl_printer *p,
3464                 __isl_keep isl_multi_pw_aff *mpa);
3465         __isl_give isl_printer *isl_printer_print_union_pw_aff(
3466                 __isl_take isl_printer *p,
3467                 __isl_keep isl_union_pw_aff *upa);
3468         __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3469                 __isl_take isl_printer *p,
3470                 __isl_keep isl_union_pw_multi_aff *upma);
3471         __isl_give isl_printer *
3472         isl_printer_print_multi_union_pw_aff(
3473                 __isl_take isl_printer *p,
3474                 __isl_keep isl_multi_union_pw_aff *mupa);
3476         #include <isl/polynomial.h>
3477         __isl_give isl_printer *isl_printer_print_qpolynomial(
3478                 __isl_take isl_printer *p,
3479                 __isl_keep isl_qpolynomial *qp);
3480         __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3481                 __isl_take isl_printer *p,
3482                 __isl_keep isl_pw_qpolynomial *pwqp);
3483         __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3484                 __isl_take isl_printer *p,
3485                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3487         __isl_give isl_printer *
3488         isl_printer_print_pw_qpolynomial_fold(
3489                 __isl_take isl_printer *p,
3490                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3491         __isl_give isl_printer *
3492         isl_printer_print_union_pw_qpolynomial_fold(
3493                 __isl_take isl_printer *p,
3494                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3496 For C<isl_printer_print_qpolynomial>,
3497 C<isl_printer_print_pw_qpolynomial> and
3498 C<isl_printer_print_pw_qpolynomial_fold>,
3499 the output format of the printer
3500 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3501 For C<isl_printer_print_union_pw_qpolynomial> and
3502 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3503 is supported.
3504 In case of printing in C<ISL_FORMAT_C>, the user may want
3505 to set the names of all dimensions first.
3507 C<isl> also provides limited support for printing YAML documents,
3508 just enough for the internal use for printing such documents.
3510         #include <isl/printer.h>
3511         __isl_give isl_printer *isl_printer_yaml_start_mapping(
3512                 __isl_take isl_printer *p);
3513         __isl_give isl_printer *isl_printer_yaml_end_mapping(
3514                 __isl_take isl_printer *p);
3515         __isl_give isl_printer *isl_printer_yaml_start_sequence(
3516                 __isl_take isl_printer *p);
3517         __isl_give isl_printer *isl_printer_yaml_end_sequence(
3518                 __isl_take isl_printer *p);
3519         __isl_give isl_printer *isl_printer_yaml_next(
3520                 __isl_take isl_printer *p);
3522 A document is started by a call to either
3523 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3524 Anything printed to the printer after such a call belong to the
3525 first key of the mapping or the first element in the sequence.
3526 The function C<isl_printer_yaml_next> moves to the value if
3527 we are currently printing a mapping key, the next key if we
3528 are printing a value or the next element if we are printing
3529 an element in a sequence.
3530 Nested mappings and sequences are initiated by the same
3531 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3532 Each call to these functions needs to have a corresponding call to
3533 C<isl_printer_yaml_end_mapping> or C<isl_printer_yaml_end_sequence>.
3535 When called on a file printer, the following function flushes
3536 the file.  When called on a string printer, the buffer is cleared.
3538         __isl_give isl_printer *isl_printer_flush(
3539                 __isl_take isl_printer *p);
3541 Alternatively, a string representation can be obtained
3542 directly using the following functions, which always print
3543 in isl format.
3545         #include <isl/space.h>
3546         __isl_give char *isl_space_to_str(
3547                 __isl_keep isl_space *space);
3549         #include <isl/val.h>
3550         __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3551         __isl_give char *isl_multi_val_to_str(
3552                 __isl_keep isl_multi_val *mv);
3554         #include <isl/set.h>
3555         __isl_give char *isl_set_to_str(
3556                 __isl_keep isl_set *set);
3558         #include <isl/union_set.h>
3559         __isl_give char *isl_union_set_to_str(
3560                 __isl_keep isl_union_set *uset);
3562         #include <isl/map.h>
3563         __isl_give char *isl_map_to_str(
3564                 __isl_keep isl_map *map);
3566         #include <isl/union_map.h>
3567         __isl_give char *isl_union_map_to_str(
3568                 __isl_keep isl_union_map *umap);
3570         #include <isl/aff.h>
3571         __isl_give char *isl_multi_aff_to_str(
3572                 __isl_keep isl_multi_aff *aff);
3573         __isl_give char *isl_union_pw_aff_to_str(
3574                 __isl_keep isl_union_pw_aff *upa);
3575         __isl_give char *isl_union_pw_multi_aff_to_str(
3576                 __isl_keep isl_union_pw_multi_aff *upma);
3577         __isl_give char *isl_multi_union_pw_aff_to_str(
3578                 __isl_keep isl_multi_union_pw_aff *mupa);
3580 =head2 Properties
3582 =head3 Unary Properties
3584 =over
3586 =item * Emptiness
3588 The following functions test whether the given set or relation
3589 contains any integer points.  The ``plain'' variants do not perform
3590 any computations, but simply check if the given set or relation
3591 is already known to be empty.
3593         int isl_basic_set_plain_is_empty(__isl_keep isl_basic_set *bset);
3594         int isl_basic_set_is_empty(__isl_keep isl_basic_set *bset);
3595         int isl_set_plain_is_empty(__isl_keep isl_set *set);
3596         int isl_set_is_empty(__isl_keep isl_set *set);
3597         int isl_union_set_is_empty(__isl_keep isl_union_set *uset);
3598         int isl_basic_map_plain_is_empty(__isl_keep isl_basic_map *bmap);
3599         int isl_basic_map_is_empty(__isl_keep isl_basic_map *bmap);
3600         int isl_map_plain_is_empty(__isl_keep isl_map *map);
3601         int isl_map_is_empty(__isl_keep isl_map *map);
3602         int isl_union_map_is_empty(__isl_keep isl_union_map *umap);
3604 =item * Universality
3606         int isl_basic_set_is_universe(__isl_keep isl_basic_set *bset);
3607         int isl_basic_map_is_universe(__isl_keep isl_basic_map *bmap);
3608         int isl_set_plain_is_universe(__isl_keep isl_set *set);
3610 =item * Single-valuedness
3612         #include <isl/set.h>
3613         int isl_set_is_singleton(__isl_keep isl_set *set);
3615         #include <isl/map.h>
3616         int isl_basic_map_is_single_valued(
3617                 __isl_keep isl_basic_map *bmap);
3618         int isl_map_plain_is_single_valued(
3619                 __isl_keep isl_map *map);
3620         int isl_map_is_single_valued(__isl_keep isl_map *map);
3622         #include <isl/union_map.h>
3623         int isl_union_map_is_single_valued(__isl_keep isl_union_map *umap);
3625 =item * Injectivity
3627         int isl_map_plain_is_injective(__isl_keep isl_map *map);
3628         int isl_map_is_injective(__isl_keep isl_map *map);
3629         int isl_union_map_plain_is_injective(
3630                 __isl_keep isl_union_map *umap);
3631         int isl_union_map_is_injective(
3632                 __isl_keep isl_union_map *umap);
3634 =item * Bijectivity
3636         int isl_map_is_bijective(__isl_keep isl_map *map);
3637         int isl_union_map_is_bijective(__isl_keep isl_union_map *umap);
3639 =item * Position
3641         __isl_give isl_val *
3642         isl_basic_map_plain_get_val_if_fixed(
3643                 __isl_keep isl_basic_map *bmap,
3644                 enum isl_dim_type type, unsigned pos);
3645         __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3646                 __isl_keep isl_set *set,
3647                 enum isl_dim_type type, unsigned pos);
3648         __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3649                 __isl_keep isl_map *map,
3650                 enum isl_dim_type type, unsigned pos);
3652 If the set or relation obviously lies on a hyperplane where the given dimension
3653 has a fixed value, then return that value.
3654 Otherwise return NaN.
3656 =item * Stride
3658         int isl_set_dim_residue_class_val(
3659                 __isl_keep isl_set *set,
3660                 int pos, __isl_give isl_val **modulo,
3661                 __isl_give isl_val **residue);
3663 Check if the values of the given set dimension are equal to a fixed
3664 value modulo some integer value.  If so, assign the modulo to C<*modulo>
3665 and the fixed value to C<*residue>.  If the given dimension attains only
3666 a single value, then assign C<0> to C<*modulo> and the fixed value to
3667 C<*residue>.
3668 If the dimension does not attain only a single value and if no modulo
3669 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3671 =item * Dependence
3673 To check whether the description of a set, relation or function depends
3674 on one or more given dimensions,
3675 the following functions can be used.
3677         #include <isl/constraint.h>
3678         int isl_constraint_involves_dims(
3679                 __isl_keep isl_constraint *constraint,
3680                 enum isl_dim_type type, unsigned first, unsigned n);
3682         #include <isl/set.h>
3683         int isl_basic_set_involves_dims(
3684                 __isl_keep isl_basic_set *bset,
3685                 enum isl_dim_type type, unsigned first, unsigned n);
3686         int isl_set_involves_dims(__isl_keep isl_set *set,
3687                 enum isl_dim_type type, unsigned first, unsigned n);
3689         #include <isl/map.h>
3690         int isl_basic_map_involves_dims(
3691                 __isl_keep isl_basic_map *bmap,
3692                 enum isl_dim_type type, unsigned first, unsigned n);
3693         int isl_map_involves_dims(__isl_keep isl_map *map,
3694                 enum isl_dim_type type, unsigned first, unsigned n);
3696         #include <isl/union_map.h>
3697         int isl_union_map_involves_dims(
3698                 __isl_keep isl_union_map *umap,
3699                 enum isl_dim_type type, unsigned first, unsigned n);
3701         #include <isl/aff.h>
3702         int isl_aff_involves_dims(__isl_keep isl_aff *aff,
3703                 enum isl_dim_type type, unsigned first, unsigned n);
3704         int isl_pw_aff_involves_dims(__isl_keep isl_pw_aff *pwaff,
3705                 enum isl_dim_type type, unsigned first, unsigned n);
3706         int isl_multi_aff_involves_dims(
3707                 __isl_keep isl_multi_aff *ma,
3708                 enum isl_dim_type type, unsigned first, unsigned n);
3709         int isl_multi_pw_aff_involves_dims(
3710                 __isl_keep isl_multi_pw_aff *mpa,
3711                 enum isl_dim_type type, unsigned first, unsigned n);
3713 Similarly, the following functions can be used to check whether
3714 a given dimension is involved in any lower or upper bound.
3716         #include <isl/set.h>
3717         int isl_set_dim_has_any_lower_bound(__isl_keep isl_set *set,
3718                 enum isl_dim_type type, unsigned pos);
3719         int isl_set_dim_has_any_upper_bound(__isl_keep isl_set *set,
3720                 enum isl_dim_type type, unsigned pos);
3722 Note that these functions return true even if there is a bound on
3723 the dimension on only some of the basic sets of C<set>.
3724 To check if they have a bound for all of the basic sets in C<set>,
3725 use the following functions instead.
3727         #include <isl/set.h>
3728         int isl_set_dim_has_lower_bound(__isl_keep isl_set *set,
3729                 enum isl_dim_type type, unsigned pos);
3730         int isl_set_dim_has_upper_bound(__isl_keep isl_set *set,
3731                 enum isl_dim_type type, unsigned pos);
3733 =item * Space
3735 To check whether a set is a parameter domain, use this function:
3737         int isl_set_is_params(__isl_keep isl_set *set);
3738         int isl_union_set_is_params(
3739                 __isl_keep isl_union_set *uset);
3741 =item * Wrapping
3743 The following functions check whether the space of the given
3744 (basic) set or relation range is a wrapped relation.
3746         #include <isl/space.h>
3747         int isl_space_is_wrapping(
3748                 __isl_keep isl_space *space);
3749         int isl_space_domain_is_wrapping(
3750                 __isl_keep isl_space *space);
3751         int isl_space_range_is_wrapping(
3752                 __isl_keep isl_space *space);
3754         #include <isl/set.h>
3755         int isl_basic_set_is_wrapping(
3756                 __isl_keep isl_basic_set *bset);
3757         int isl_set_is_wrapping(__isl_keep isl_set *set);
3759         #include <isl/map.h>
3760         int isl_map_domain_is_wrapping(
3761                 __isl_keep isl_map *map);
3762         int isl_map_range_is_wrapping(
3763                 __isl_keep isl_map *map);
3765         #include <isl/val.h>
3766         int isl_multi_val_range_is_wrapping(
3767                 __isl_keep isl_multi_val *mv);
3769         #include <isl/aff.h>
3770         int isl_multi_aff_range_is_wrapping(
3771                 __isl_keep isl_multi_aff *ma);
3772         int isl_multi_pw_aff_range_is_wrapping(
3773                 __isl_keep isl_multi_pw_aff *mpa);
3774         int isl_multi_union_pw_aff_range_is_wrapping(
3775                 __isl_keep isl_multi_union_pw_aff *mupa);
3777 The input to C<isl_space_is_wrapping> should
3778 be the space of a set, while that of
3779 C<isl_space_domain_is_wrapping> and
3780 C<isl_space_range_is_wrapping> should be the space of a relation.
3782 =item * Internal Product
3784         int isl_basic_map_can_zip(
3785                 __isl_keep isl_basic_map *bmap);
3786         int isl_map_can_zip(__isl_keep isl_map *map);
3788 Check whether the product of domain and range of the given relation
3789 can be computed,
3790 i.e., whether both domain and range are nested relations.
3792 =item * Currying
3794         int isl_basic_map_can_curry(
3795                 __isl_keep isl_basic_map *bmap);
3796         int isl_map_can_curry(__isl_keep isl_map *map);
3798 Check whether the domain of the (basic) relation is a wrapped relation.
3800         int isl_basic_map_can_uncurry(
3801                 __isl_keep isl_basic_map *bmap);
3802         int isl_map_can_uncurry(__isl_keep isl_map *map);
3804 Check whether the range of the (basic) relation is a wrapped relation.
3806 =item * Special Values
3808         #include <isl/aff.h>
3809         int isl_aff_is_cst(__isl_keep isl_aff *aff);
3810         int isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
3812 Check whether the given expression is a constant.
3814         #include <isl/aff.h>
3815         int isl_aff_is_nan(__isl_keep isl_aff *aff);
3816         int isl_pw_aff_involves_nan(__isl_keep isl_pw_aff *pa);
3818 Check whether the given expression is equal to or involves NaN.
3820         #include <isl/aff.h>
3821         int isl_aff_plain_is_zero(__isl_keep isl_aff *aff);
3823 Check whether the affine expression is obviously zero.
3825 =back
3827 =head3 Binary Properties
3829 =over
3831 =item * Equality
3833 The following functions check whether two objects
3834 represent the same set, relation or function.
3835 The C<plain> variants only return true if the objects
3836 are obviously the same.  That is, they may return false
3837 even if the objects are the same, but they will never
3838 return true if the objects are not the same.
3840         #include <isl/set.h>
3841         int isl_basic_set_plain_is_equal(
3842                 __isl_keep isl_basic_set *bset1,
3843                 __isl_keep isl_basic_set *bset2);
3844         int isl_set_plain_is_equal(__isl_keep isl_set *set1,
3845                 __isl_keep isl_set *set2);
3846         int isl_set_is_equal(__isl_keep isl_set *set1,
3847                 __isl_keep isl_set *set2);
3849         #include <isl/map.h>
3850         int isl_basic_map_is_equal(
3851                 __isl_keep isl_basic_map *bmap1,
3852                 __isl_keep isl_basic_map *bmap2);
3853         int isl_map_is_equal(__isl_keep isl_map *map1,
3854                 __isl_keep isl_map *map2);
3855         int isl_map_plain_is_equal(__isl_keep isl_map *map1,
3856                 __isl_keep isl_map *map2);
3858         #include <isl/union_set.h>
3859         int isl_union_set_is_equal(
3860                 __isl_keep isl_union_set *uset1,
3861                 __isl_keep isl_union_set *uset2);
3863         #include <isl/union_map.h>
3864         int isl_union_map_is_equal(
3865                 __isl_keep isl_union_map *umap1,
3866                 __isl_keep isl_union_map *umap2);
3868         #include <isl/aff.h>
3869         int isl_aff_plain_is_equal(__isl_keep isl_aff *aff1,
3870                 __isl_keep isl_aff *aff2);
3871         int isl_multi_aff_plain_is_equal(
3872                 __isl_keep isl_multi_aff *maff1,
3873                 __isl_keep isl_multi_aff *maff2);
3874         int isl_pw_aff_plain_is_equal(
3875                 __isl_keep isl_pw_aff *pwaff1,
3876                 __isl_keep isl_pw_aff *pwaff2);
3877         int isl_pw_multi_aff_plain_is_equal(
3878                 __isl_keep isl_pw_multi_aff *pma1,
3879                 __isl_keep isl_pw_multi_aff *pma2);
3880         int isl_multi_pw_aff_plain_is_equal(
3881                 __isl_keep isl_multi_pw_aff *mpa1,
3882                 __isl_keep isl_multi_pw_aff *mpa2);
3883         int isl_multi_pw_aff_is_equal(
3884                 __isl_keep isl_multi_pw_aff *mpa1,
3885                 __isl_keep isl_multi_pw_aff *mpa2);
3886         int isl_union_pw_aff_plain_is_equal(
3887                 __isl_keep isl_union_pw_aff *upa1,
3888                 __isl_keep isl_union_pw_aff *upa2);
3889         int isl_union_pw_multi_aff_plain_is_equal(
3890                 __isl_keep isl_union_pw_multi_aff *upma1,
3891                 __isl_keep isl_union_pw_multi_aff *upma2);
3892         int isl_multi_union_pw_aff_plain_is_equal(
3893                 __isl_keep isl_multi_union_pw_aff *mupa1,
3894                 __isl_keep isl_multi_union_pw_aff *mupa2);
3896         #include <isl/polynomial.h>
3897         int isl_union_pw_qpolynomial_plain_is_equal(
3898                 __isl_keep isl_union_pw_qpolynomial *upwqp1,
3899                 __isl_keep isl_union_pw_qpolynomial *upwqp2);
3900         int isl_union_pw_qpolynomial_fold_plain_is_equal(
3901                 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
3902                 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
3904 =item * Disjointness
3906         #include <isl/set.h>
3907         int isl_basic_set_is_disjoint(
3908                 __isl_keep isl_basic_set *bset1,
3909                 __isl_keep isl_basic_set *bset2);
3910         int isl_set_plain_is_disjoint(__isl_keep isl_set *set1,
3911                 __isl_keep isl_set *set2);
3912         int isl_set_is_disjoint(__isl_keep isl_set *set1,
3913                 __isl_keep isl_set *set2);
3915         #include <isl/map.h>
3916         int isl_basic_map_is_disjoint(
3917                 __isl_keep isl_basic_map *bmap1,
3918                 __isl_keep isl_basic_map *bmap2);
3919         int isl_map_is_disjoint(__isl_keep isl_map *map1,
3920                 __isl_keep isl_map *map2);
3922         #include <isl/union_set.h>
3923         int isl_union_set_is_disjoint(
3924                 __isl_keep isl_union_set *uset1,
3925                 __isl_keep isl_union_set *uset2);
3927         #include <isl/union_map.h>
3928         int isl_union_map_is_disjoint(
3929                 __isl_keep isl_union_map *umap1,
3930                 __isl_keep isl_union_map *umap2);
3932 =item * Subset
3934         int isl_basic_set_is_subset(
3935                 __isl_keep isl_basic_set *bset1,
3936                 __isl_keep isl_basic_set *bset2);
3937         int isl_set_is_subset(__isl_keep isl_set *set1,
3938                 __isl_keep isl_set *set2);
3939         int isl_set_is_strict_subset(
3940                 __isl_keep isl_set *set1,
3941                 __isl_keep isl_set *set2);
3942         int isl_union_set_is_subset(
3943                 __isl_keep isl_union_set *uset1,
3944                 __isl_keep isl_union_set *uset2);
3945         int isl_union_set_is_strict_subset(
3946                 __isl_keep isl_union_set *uset1,
3947                 __isl_keep isl_union_set *uset2);
3948         int isl_basic_map_is_subset(
3949                 __isl_keep isl_basic_map *bmap1,
3950                 __isl_keep isl_basic_map *bmap2);
3951         int isl_basic_map_is_strict_subset(
3952                 __isl_keep isl_basic_map *bmap1,
3953                 __isl_keep isl_basic_map *bmap2);
3954         int isl_map_is_subset(
3955                 __isl_keep isl_map *map1,
3956                 __isl_keep isl_map *map2);
3957         int isl_map_is_strict_subset(
3958                 __isl_keep isl_map *map1,
3959                 __isl_keep isl_map *map2);
3960         int isl_union_map_is_subset(
3961                 __isl_keep isl_union_map *umap1,
3962                 __isl_keep isl_union_map *umap2);
3963         int isl_union_map_is_strict_subset(
3964                 __isl_keep isl_union_map *umap1,
3965                 __isl_keep isl_union_map *umap2);
3967 Check whether the first argument is a (strict) subset of the
3968 second argument.
3970 =item * Order
3972 Every comparison function returns a negative value if the first
3973 argument is considered smaller than the second, a positive value
3974 if the first argument is considered greater and zero if the two
3975 constraints are considered the same by the comparison criterion.
3977         #include <isl/constraint.h>
3978         int isl_constraint_plain_cmp(
3979                 __isl_keep isl_constraint *c1,
3980                 __isl_keep isl_constraint *c2);
3982 This function is useful for sorting C<isl_constraint>s.
3983 The order depends on the internal representation of the inputs.
3984 The order is fixed over different calls to the function (assuming
3985 the internal representation of the inputs has not changed), but may
3986 change over different versions of C<isl>.
3988         #include <isl/constraint.h>
3989         int isl_constraint_cmp_last_non_zero(
3990                 __isl_keep isl_constraint *c1,
3991                 __isl_keep isl_constraint *c2);
3993 This function can be used to sort constraints that live in the same
3994 local space.  Constraints that involve ``earlier'' dimensions or
3995 that have a smaller coefficient for the shared latest dimension
3996 are considered smaller than other constraints.
3997 This function only defines a B<partial> order.
3999         #include <isl/set.h>
4000         int isl_set_plain_cmp(__isl_keep isl_set *set1,
4001                 __isl_keep isl_set *set2);
4003 This function is useful for sorting C<isl_set>s.
4004 The order depends on the internal representation of the inputs.
4005 The order is fixed over different calls to the function (assuming
4006 the internal representation of the inputs has not changed), but may
4007 change over different versions of C<isl>.
4009         #include <isl/aff.h>
4010         int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
4011                 __isl_keep isl_pw_aff *pa2);
4013 The function C<isl_pw_aff_plain_cmp> can be used to sort
4014 C<isl_pw_aff>s.  The order is not strictly defined.
4015 The current order sorts expressions that only involve
4016 earlier dimensions before those that involve later dimensions.
4018 =back
4020 =head2 Unary Operations
4022 =over
4024 =item * Complement
4026         __isl_give isl_set *isl_set_complement(
4027                 __isl_take isl_set *set);
4028         __isl_give isl_map *isl_map_complement(
4029                 __isl_take isl_map *map);
4031 =item * Inverse map
4033         #include <isl/space.h>
4034         __isl_give isl_space *isl_space_reverse(
4035                 __isl_take isl_space *space);
4037         #include <isl/map.h>
4038         __isl_give isl_basic_map *isl_basic_map_reverse(
4039                 __isl_take isl_basic_map *bmap);
4040         __isl_give isl_map *isl_map_reverse(
4041                 __isl_take isl_map *map);
4043         #include <isl/union_map.h>
4044         __isl_give isl_union_map *isl_union_map_reverse(
4045                 __isl_take isl_union_map *umap);
4047 =item * Projection
4049         #include <isl/space.h>
4050         __isl_give isl_space *isl_space_domain(
4051                 __isl_take isl_space *space);
4052         __isl_give isl_space *isl_space_range(
4053                 __isl_take isl_space *space);
4054         __isl_give isl_space *isl_space_params(
4055                 __isl_take isl_space *space);
4057         #include <isl/local_space.h>
4058         __isl_give isl_local_space *isl_local_space_domain(
4059                 __isl_take isl_local_space *ls);
4060         __isl_give isl_local_space *isl_local_space_range(
4061                 __isl_take isl_local_space *ls);
4063         #include <isl/set.h>
4064         __isl_give isl_basic_set *isl_basic_set_project_out(
4065                 __isl_take isl_basic_set *bset,
4066                 enum isl_dim_type type, unsigned first, unsigned n);
4067         __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
4068                 enum isl_dim_type type, unsigned first, unsigned n);
4069         __isl_give isl_basic_set *isl_basic_set_params(
4070                 __isl_take isl_basic_set *bset);
4071         __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
4073         #include <isl/map.h>
4074         __isl_give isl_basic_map *isl_basic_map_project_out(
4075                 __isl_take isl_basic_map *bmap,
4076                 enum isl_dim_type type, unsigned first, unsigned n);
4077         __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
4078                 enum isl_dim_type type, unsigned first, unsigned n);
4079         __isl_give isl_basic_set *isl_basic_map_domain(
4080                 __isl_take isl_basic_map *bmap);
4081         __isl_give isl_basic_set *isl_basic_map_range(
4082                 __isl_take isl_basic_map *bmap);
4083         __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
4084         __isl_give isl_set *isl_map_domain(
4085                 __isl_take isl_map *bmap);
4086         __isl_give isl_set *isl_map_range(
4087                 __isl_take isl_map *map);
4089         #include <isl/union_set.h>
4090         __isl_give isl_union_set *isl_union_set_project_out(
4091                 __isl_take isl_union_set *uset,
4092                 enum isl_dim_type type,
4093                 unsigned first, unsigned n);
4094         __isl_give isl_set *isl_union_set_params(
4095                 __isl_take isl_union_set *uset);
4097 The function C<isl_union_set_project_out> can only project out
4098 parameters.
4100         #include <isl/union_map.h>
4101         __isl_give isl_union_map *isl_union_map_project_out(
4102                 __isl_take isl_union_map *umap,
4103                 enum isl_dim_type type, unsigned first, unsigned n);
4104         __isl_give isl_set *isl_union_map_params(
4105                 __isl_take isl_union_map *umap);
4106         __isl_give isl_union_set *isl_union_map_domain(
4107                 __isl_take isl_union_map *umap);
4108         __isl_give isl_union_set *isl_union_map_range(
4109                 __isl_take isl_union_map *umap);
4111 The function C<isl_union_map_project_out> can only project out
4112 parameters.
4114         #include <isl/aff.h>
4115         __isl_give isl_aff *isl_aff_project_domain_on_params(
4116                 __isl_take isl_aff *aff);
4117         __isl_give isl_pw_multi_aff *
4118         isl_pw_multi_aff_project_domain_on_params(
4119                 __isl_take isl_pw_multi_aff *pma);
4120         __isl_give isl_set *isl_pw_aff_domain(
4121                 __isl_take isl_pw_aff *pwaff);
4122         __isl_give isl_set *isl_pw_multi_aff_domain(
4123                 __isl_take isl_pw_multi_aff *pma);
4124         __isl_give isl_set *isl_multi_pw_aff_domain(
4125                 __isl_take isl_multi_pw_aff *mpa);
4126         __isl_give isl_union_set *isl_union_pw_aff_domain(
4127                 __isl_take isl_union_pw_aff *upa);
4128         __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
4129                 __isl_take isl_union_pw_multi_aff *upma);
4130         __isl_give isl_union_set *
4131         isl_multi_union_pw_aff_domain(
4132                 __isl_take isl_multi_union_pw_aff *mupa);
4133         __isl_give isl_set *isl_pw_aff_params(
4134                 __isl_take isl_pw_aff *pwa);
4136 The function C<isl_multi_union_pw_aff_domain> requires its
4137 input to have at least one set dimension.
4139         #include <isl/polynomial.h>
4140         __isl_give isl_qpolynomial *
4141         isl_qpolynomial_project_domain_on_params(
4142                 __isl_take isl_qpolynomial *qp);
4143         __isl_give isl_pw_qpolynomial *
4144         isl_pw_qpolynomial_project_domain_on_params(
4145                 __isl_take isl_pw_qpolynomial *pwqp);
4146         __isl_give isl_pw_qpolynomial_fold *
4147         isl_pw_qpolynomial_fold_project_domain_on_params(
4148                 __isl_take isl_pw_qpolynomial_fold *pwf);
4149         __isl_give isl_set *isl_pw_qpolynomial_domain(
4150                 __isl_take isl_pw_qpolynomial *pwqp);
4151         __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
4152                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4153         __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
4154                 __isl_take isl_union_pw_qpolynomial *upwqp);
4156         #include <isl/space.h>
4157         __isl_give isl_space *isl_space_domain_map(
4158                 __isl_take isl_space *space);
4159         __isl_give isl_space *isl_space_range_map(
4160                 __isl_take isl_space *space);
4162         #include <isl/map.h>
4163         __isl_give isl_map *isl_set_wrapped_domain_map(
4164                 __isl_take isl_set *set);
4165         __isl_give isl_basic_map *isl_basic_map_domain_map(
4166                 __isl_take isl_basic_map *bmap);
4167         __isl_give isl_basic_map *isl_basic_map_range_map(
4168                 __isl_take isl_basic_map *bmap);
4169         __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
4170         __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
4172         #include <isl/union_map.h>
4173         __isl_give isl_union_map *isl_union_map_domain_map(
4174                 __isl_take isl_union_map *umap);
4175         __isl_give isl_union_pw_multi_aff *
4176         isl_union_map_domain_map_union_pw_multi_aff(
4177                 __isl_take isl_union_map *umap);
4178         __isl_give isl_union_map *isl_union_map_range_map(
4179                 __isl_take isl_union_map *umap);
4180         __isl_give isl_union_map *
4181         isl_union_set_wrapped_domain_map(
4182                 __isl_take isl_union_set *uset);
4184 The functions above construct a (basic, regular or union) relation
4185 that maps (a wrapped version of) the input relation to its domain or range.
4186 C<isl_set_wrapped_domain_map> maps the input set to the domain
4187 of its wrapped relation.
4189 =item * Elimination
4191         __isl_give isl_basic_set *isl_basic_set_eliminate(
4192                 __isl_take isl_basic_set *bset,
4193                 enum isl_dim_type type,
4194                 unsigned first, unsigned n);
4195         __isl_give isl_set *isl_set_eliminate(
4196                 __isl_take isl_set *set, enum isl_dim_type type,
4197                 unsigned first, unsigned n);
4198         __isl_give isl_basic_map *isl_basic_map_eliminate(
4199                 __isl_take isl_basic_map *bmap,
4200                 enum isl_dim_type type,
4201                 unsigned first, unsigned n);
4202         __isl_give isl_map *isl_map_eliminate(
4203                 __isl_take isl_map *map, enum isl_dim_type type,
4204                 unsigned first, unsigned n);
4206 Eliminate the coefficients for the given dimensions from the constraints,
4207 without removing the dimensions.
4209 =item * Constructing a set from a parameter domain
4211 A zero-dimensional space or (basic) set can be constructed
4212 on a given parameter domain using the following functions.
4214         #include <isl/space.h>
4215         __isl_give isl_space *isl_space_set_from_params(
4216                 __isl_take isl_space *space);
4218         #include <isl/set.h>
4219         __isl_give isl_basic_set *isl_basic_set_from_params(
4220                 __isl_take isl_basic_set *bset);
4221         __isl_give isl_set *isl_set_from_params(
4222                 __isl_take isl_set *set);
4224 =item * Constructing a relation from a set
4226 Create a relation with the given set as domain or range.
4227 The range or domain of the created relation is a zero-dimensional
4228 flat anonymous space.
4230         #include <isl/space.h>
4231         __isl_give isl_space *isl_space_from_domain(
4232                 __isl_take isl_space *space);
4233         __isl_give isl_space *isl_space_from_range(
4234                 __isl_take isl_space *space);
4235         __isl_give isl_space *isl_space_map_from_set(
4236                 __isl_take isl_space *space);
4237         __isl_give isl_space *isl_space_map_from_domain_and_range(
4238                 __isl_take isl_space *domain,
4239                 __isl_take isl_space *range);
4241         #include <isl/local_space.h>
4242         __isl_give isl_local_space *isl_local_space_from_domain(
4243                 __isl_take isl_local_space *ls);
4245         #include <isl/map.h>
4246         __isl_give isl_map *isl_map_from_domain(
4247                 __isl_take isl_set *set);
4248         __isl_give isl_map *isl_map_from_range(
4249                 __isl_take isl_set *set);
4251         #include <isl/val.h>
4252         __isl_give isl_multi_val *isl_multi_val_from_range(
4253                 __isl_take isl_multi_val *mv);
4255         #include <isl/aff.h>
4256         __isl_give isl_multi_aff *isl_multi_aff_from_range(
4257                 __isl_take isl_multi_aff *ma);
4258         __isl_give isl_pw_aff *isl_pw_aff_from_range(
4259                 __isl_take isl_pw_aff *pwa);
4260         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
4261                 __isl_take isl_multi_pw_aff *mpa);
4262         __isl_give isl_multi_union_pw_aff *
4263         isl_multi_union_pw_aff_from_range(
4264                 __isl_take isl_multi_union_pw_aff *mupa);
4265         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
4266                 __isl_take isl_set *set);
4267         __isl_give isl_union_pw_multi_aff *
4268         isl_union_pw_multi_aff_from_domain(
4269                 __isl_take isl_union_set *uset);
4271 =item * Slicing
4273         #include <isl/set.h>
4274         __isl_give isl_basic_set *isl_basic_set_fix_si(
4275                 __isl_take isl_basic_set *bset,
4276                 enum isl_dim_type type, unsigned pos, int value);
4277         __isl_give isl_basic_set *isl_basic_set_fix_val(
4278                 __isl_take isl_basic_set *bset,
4279                 enum isl_dim_type type, unsigned pos,
4280                 __isl_take isl_val *v);
4281         __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
4282                 enum isl_dim_type type, unsigned pos, int value);
4283         __isl_give isl_set *isl_set_fix_val(
4284                 __isl_take isl_set *set,
4285                 enum isl_dim_type type, unsigned pos,
4286                 __isl_take isl_val *v);
4288         #include <isl/map.h>
4289         __isl_give isl_basic_map *isl_basic_map_fix_si(
4290                 __isl_take isl_basic_map *bmap,
4291                 enum isl_dim_type type, unsigned pos, int value);
4292         __isl_give isl_basic_map *isl_basic_map_fix_val(
4293                 __isl_take isl_basic_map *bmap,
4294                 enum isl_dim_type type, unsigned pos,
4295                 __isl_take isl_val *v);
4296         __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
4297                 enum isl_dim_type type, unsigned pos, int value);
4298         __isl_give isl_map *isl_map_fix_val(
4299                 __isl_take isl_map *map,
4300                 enum isl_dim_type type, unsigned pos,
4301                 __isl_take isl_val *v);
4303         #include <isl/aff.h>
4304         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
4305                 __isl_take isl_pw_multi_aff *pma,
4306                 enum isl_dim_type type, unsigned pos, int value);
4308         #include <isl/polynomial.h>
4309         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
4310                 __isl_take isl_pw_qpolynomial *pwqp,
4311                 enum isl_dim_type type, unsigned n,
4312                 __isl_take isl_val *v);
4314 Intersect the set, relation or function domain
4315 with the hyperplane where the given
4316 dimension has the fixed given value.
4318         __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
4319                 __isl_take isl_basic_map *bmap,
4320                 enum isl_dim_type type, unsigned pos, int value);
4321         __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
4322                 __isl_take isl_basic_map *bmap,
4323                 enum isl_dim_type type, unsigned pos, int value);
4324         __isl_give isl_set *isl_set_lower_bound_si(
4325                 __isl_take isl_set *set,
4326                 enum isl_dim_type type, unsigned pos, int value);
4327         __isl_give isl_set *isl_set_lower_bound_val(
4328                 __isl_take isl_set *set,
4329                 enum isl_dim_type type, unsigned pos,
4330                 __isl_take isl_val *value);
4331         __isl_give isl_map *isl_map_lower_bound_si(
4332                 __isl_take isl_map *map,
4333                 enum isl_dim_type type, unsigned pos, int value);
4334         __isl_give isl_set *isl_set_upper_bound_si(
4335                 __isl_take isl_set *set,
4336                 enum isl_dim_type type, unsigned pos, int value);
4337         __isl_give isl_set *isl_set_upper_bound_val(
4338                 __isl_take isl_set *set,
4339                 enum isl_dim_type type, unsigned pos,
4340                 __isl_take isl_val *value);
4341         __isl_give isl_map *isl_map_upper_bound_si(
4342                 __isl_take isl_map *map,
4343                 enum isl_dim_type type, unsigned pos, int value);
4345 Intersect the set or relation with the half-space where the given
4346 dimension has a value bounded by the fixed given integer value.
4348         __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
4349                 enum isl_dim_type type1, int pos1,
4350                 enum isl_dim_type type2, int pos2);
4351         __isl_give isl_basic_map *isl_basic_map_equate(
4352                 __isl_take isl_basic_map *bmap,
4353                 enum isl_dim_type type1, int pos1,
4354                 enum isl_dim_type type2, int pos2);
4355         __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
4356                 enum isl_dim_type type1, int pos1,
4357                 enum isl_dim_type type2, int pos2);
4359 Intersect the set or relation with the hyperplane where the given
4360 dimensions are equal to each other.
4362         __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4363                 enum isl_dim_type type1, int pos1,
4364                 enum isl_dim_type type2, int pos2);
4366 Intersect the relation with the hyperplane where the given
4367 dimensions have opposite values.
4369         __isl_give isl_map *isl_map_order_le(
4370                 __isl_take isl_map *map,
4371                 enum isl_dim_type type1, int pos1,
4372                 enum isl_dim_type type2, int pos2);
4373         __isl_give isl_basic_map *isl_basic_map_order_ge(
4374                 __isl_take isl_basic_map *bmap,
4375                 enum isl_dim_type type1, int pos1,
4376                 enum isl_dim_type type2, int pos2);
4377         __isl_give isl_map *isl_map_order_ge(
4378                 __isl_take isl_map *map,
4379                 enum isl_dim_type type1, int pos1,
4380                 enum isl_dim_type type2, int pos2);
4381         __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4382                 enum isl_dim_type type1, int pos1,
4383                 enum isl_dim_type type2, int pos2);
4384         __isl_give isl_basic_map *isl_basic_map_order_gt(
4385                 __isl_take isl_basic_map *bmap,
4386                 enum isl_dim_type type1, int pos1,
4387                 enum isl_dim_type type2, int pos2);
4388         __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4389                 enum isl_dim_type type1, int pos1,
4390                 enum isl_dim_type type2, int pos2);
4392 Intersect the relation with the half-space where the given
4393 dimensions satisfy the given ordering.
4395 =item * Locus
4397         #include <isl/aff.h>
4398         __isl_give isl_basic_set *isl_aff_zero_basic_set(
4399                 __isl_take isl_aff *aff);
4400         __isl_give isl_basic_set *isl_aff_neg_basic_set(
4401                 __isl_take isl_aff *aff);
4402         __isl_give isl_set *isl_pw_aff_pos_set(
4403                 __isl_take isl_pw_aff *pa);
4404         __isl_give isl_set *isl_pw_aff_nonneg_set(
4405                 __isl_take isl_pw_aff *pwaff);
4406         __isl_give isl_set *isl_pw_aff_zero_set(
4407                 __isl_take isl_pw_aff *pwaff);
4408         __isl_give isl_set *isl_pw_aff_non_zero_set(
4409                 __isl_take isl_pw_aff *pwaff);
4410         __isl_give isl_union_set *
4411         isl_union_pw_aff_zero_union_set(
4412                 __isl_take isl_union_pw_aff *upa);
4413         __isl_give isl_union_set *
4414         isl_multi_union_pw_aff_zero_union_set(
4415                 __isl_take isl_multi_union_pw_aff *mupa);
4417 The function C<isl_aff_neg_basic_set> returns a basic set
4418 containing those elements in the domain space
4419 of C<aff> where C<aff> is negative.
4420 The function C<isl_pw_aff_nonneg_set> returns a set
4421 containing those elements in the domain
4422 of C<pwaff> where C<pwaff> is non-negative.
4423 The function C<isl_multi_union_pw_aff_zero_union_set>
4424 returns a union set containing those elements
4425 in the domains of its elements where they are all zero.
4427 =item * Identity
4429         __isl_give isl_map *isl_set_identity(
4430                 __isl_take isl_set *set);
4431         __isl_give isl_union_map *isl_union_set_identity(
4432                 __isl_take isl_union_set *uset);
4433         __isl_give isl_union_pw_multi_aff *
4434         isl_union_set_identity_union_pw_multi_aff(
4435                 __isl_take isl_union_set *uset);
4437 Construct an identity relation on the given (union) set.
4439 =item * Function Extraction
4441 A piecewise quasi affine expression that is equal to 1 on a set
4442 and 0 outside the set can be created using the following function.
4444         #include <isl/aff.h>
4445         __isl_give isl_pw_aff *isl_set_indicator_function(
4446                 __isl_take isl_set *set);
4448 A piecewise multiple quasi affine expression can be extracted
4449 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4450 and the C<isl_map> is single-valued.
4451 In case of a conversion from an C<isl_union_map>
4452 to an C<isl_union_pw_multi_aff>, these properties need to hold
4453 in each domain space.
4454 A conversion to a C<isl_multi_union_pw_aff> additionally
4455 requires that the input is non-empty and involves only a single
4456 range space.
4458         #include <isl/aff.h>
4459         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4460                 __isl_take isl_set *set);
4461         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4462                 __isl_take isl_map *map);
4464         __isl_give isl_union_pw_multi_aff *
4465         isl_union_pw_multi_aff_from_union_set(
4466                 __isl_take isl_union_set *uset);
4467         __isl_give isl_union_pw_multi_aff *
4468         isl_union_pw_multi_aff_from_union_map(
4469                 __isl_take isl_union_map *umap);
4471         __isl_give isl_multi_union_pw_aff *
4472         isl_multi_union_pw_aff_from_union_map(
4473                 __isl_take isl_union_map *umap);
4475 =item * Deltas
4477         __isl_give isl_basic_set *isl_basic_map_deltas(
4478                 __isl_take isl_basic_map *bmap);
4479         __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
4480         __isl_give isl_union_set *isl_union_map_deltas(
4481                 __isl_take isl_union_map *umap);
4483 These functions return a (basic) set containing the differences
4484 between image elements and corresponding domain elements in the input.
4486         __isl_give isl_basic_map *isl_basic_map_deltas_map(
4487                 __isl_take isl_basic_map *bmap);
4488         __isl_give isl_map *isl_map_deltas_map(
4489                 __isl_take isl_map *map);
4490         __isl_give isl_union_map *isl_union_map_deltas_map(
4491                 __isl_take isl_union_map *umap);
4493 The functions above construct a (basic, regular or union) relation
4494 that maps (a wrapped version of) the input relation to its delta set.
4496 =item * Coalescing
4498 Simplify the representation of a set, relation or functions by trying
4499 to combine pairs of basic sets or relations into a single
4500 basic set or relation.
4502         #include <isl/set.h>
4503         __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
4505         #include <isl/map.h>
4506         __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
4508         #include <isl/union_set.h>
4509         __isl_give isl_union_set *isl_union_set_coalesce(
4510                 __isl_take isl_union_set *uset);
4512         #include <isl/union_map.h>
4513         __isl_give isl_union_map *isl_union_map_coalesce(
4514                 __isl_take isl_union_map *umap);
4516         #include <isl/aff.h>
4517         __isl_give isl_pw_aff *isl_pw_aff_coalesce(
4518                 __isl_take isl_pw_aff *pwqp);
4519         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
4520                 __isl_take isl_pw_multi_aff *pma);
4521         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
4522                 __isl_take isl_multi_pw_aff *mpa);
4523         __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
4524                 __isl_take isl_union_pw_aff *upa);
4525         __isl_give isl_union_pw_multi_aff *
4526         isl_union_pw_multi_aff_coalesce(
4527                 __isl_take isl_union_pw_multi_aff *upma);
4529         #include <isl/polynomial.h>
4530         __isl_give isl_pw_qpolynomial_fold *
4531         isl_pw_qpolynomial_fold_coalesce(
4532                 __isl_take isl_pw_qpolynomial_fold *pwf);
4533         __isl_give isl_union_pw_qpolynomial *
4534         isl_union_pw_qpolynomial_coalesce(
4535                 __isl_take isl_union_pw_qpolynomial *upwqp);
4536         __isl_give isl_union_pw_qpolynomial_fold *
4537         isl_union_pw_qpolynomial_fold_coalesce(
4538                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4540 One of the methods for combining pairs of basic sets or relations
4541 can result in coefficients that are much larger than those that appear
4542 in the constraints of the input.  By default, the coefficients are
4543 not allowed to grow larger, but this can be changed by unsetting
4544 the following option.
4546         int isl_options_set_coalesce_bounded_wrapping(
4547                 isl_ctx *ctx, int val);
4548         int isl_options_get_coalesce_bounded_wrapping(
4549                 isl_ctx *ctx);
4551 =item * Detecting equalities
4553         __isl_give isl_basic_set *isl_basic_set_detect_equalities(
4554                 __isl_take isl_basic_set *bset);
4555         __isl_give isl_basic_map *isl_basic_map_detect_equalities(
4556                 __isl_take isl_basic_map *bmap);
4557         __isl_give isl_set *isl_set_detect_equalities(
4558                 __isl_take isl_set *set);
4559         __isl_give isl_map *isl_map_detect_equalities(
4560                 __isl_take isl_map *map);
4561         __isl_give isl_union_set *isl_union_set_detect_equalities(
4562                 __isl_take isl_union_set *uset);
4563         __isl_give isl_union_map *isl_union_map_detect_equalities(
4564                 __isl_take isl_union_map *umap);
4566 Simplify the representation of a set or relation by detecting implicit
4567 equalities.
4569 =item * Removing redundant constraints
4571         #include <isl/set.h>
4572         __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
4573                 __isl_take isl_basic_set *bset);
4574         __isl_give isl_set *isl_set_remove_redundancies(
4575                 __isl_take isl_set *set);
4577         #include <isl/union_set.h>
4578         __isl_give isl_union_set *
4579         isl_union_set_remove_redundancies(
4580                 __isl_take isl_union_set *uset);
4582         #include <isl/map.h>
4583         __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
4584                 __isl_take isl_basic_map *bmap);
4585         __isl_give isl_map *isl_map_remove_redundancies(
4586                 __isl_take isl_map *map);
4588         #include <isl/union_map.h>
4589         __isl_give isl_union_map *
4590         isl_union_map_remove_redundancies(
4591                 __isl_take isl_union_map *umap);
4593 =item * Convex hull
4595         __isl_give isl_basic_set *isl_set_convex_hull(
4596                 __isl_take isl_set *set);
4597         __isl_give isl_basic_map *isl_map_convex_hull(
4598                 __isl_take isl_map *map);
4600 If the input set or relation has any existentially quantified
4601 variables, then the result of these operations is currently undefined.
4603 =item * Simple hull
4605         #include <isl/set.h>
4606         __isl_give isl_basic_set *
4607         isl_set_unshifted_simple_hull(
4608                 __isl_take isl_set *set);
4609         __isl_give isl_basic_set *isl_set_simple_hull(
4610                 __isl_take isl_set *set);
4611         __isl_give isl_basic_set *
4612         isl_set_unshifted_simple_hull_from_set_list(
4613                 __isl_take isl_set *set,
4614                 __isl_take isl_set_list *list);
4616         #include <isl/map.h>
4617         __isl_give isl_basic_map *
4618         isl_map_unshifted_simple_hull(
4619                 __isl_take isl_map *map);
4620         __isl_give isl_basic_map *isl_map_simple_hull(
4621                 __isl_take isl_map *map);
4622         __isl_give isl_basic_map *
4623         isl_map_unshifted_simple_hull_from_map_list(
4624                 __isl_take isl_map *map,
4625                 __isl_take isl_map_list *list);
4627         #include <isl/union_map.h>
4628         __isl_give isl_union_map *isl_union_map_simple_hull(
4629                 __isl_take isl_union_map *umap);
4631 These functions compute a single basic set or relation
4632 that contains the whole input set or relation.
4633 In particular, the output is described by translates
4634 of the constraints describing the basic sets or relations in the input.
4635 In case of C<isl_set_unshifted_simple_hull>, only the original
4636 constraints are used, without any translation.
4637 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
4638 C<isl_map_unshifted_simple_hull_from_map_list>, the
4639 constraints are taken from the elements of the second argument.
4641 =begin latex
4643 (See \autoref{s:simple hull}.)
4645 =end latex
4647 =item * Affine hull
4649         __isl_give isl_basic_set *isl_basic_set_affine_hull(
4650                 __isl_take isl_basic_set *bset);
4651         __isl_give isl_basic_set *isl_set_affine_hull(
4652                 __isl_take isl_set *set);
4653         __isl_give isl_union_set *isl_union_set_affine_hull(
4654                 __isl_take isl_union_set *uset);
4655         __isl_give isl_basic_map *isl_basic_map_affine_hull(
4656                 __isl_take isl_basic_map *bmap);
4657         __isl_give isl_basic_map *isl_map_affine_hull(
4658                 __isl_take isl_map *map);
4659         __isl_give isl_union_map *isl_union_map_affine_hull(
4660                 __isl_take isl_union_map *umap);
4662 In case of union sets and relations, the affine hull is computed
4663 per space.
4665 =item * Polyhedral hull
4667         __isl_give isl_basic_set *isl_set_polyhedral_hull(
4668                 __isl_take isl_set *set);
4669         __isl_give isl_basic_map *isl_map_polyhedral_hull(
4670                 __isl_take isl_map *map);
4671         __isl_give isl_union_set *isl_union_set_polyhedral_hull(
4672                 __isl_take isl_union_set *uset);
4673         __isl_give isl_union_map *isl_union_map_polyhedral_hull(
4674                 __isl_take isl_union_map *umap);
4676 These functions compute a single basic set or relation
4677 not involving any existentially quantified variables
4678 that contains the whole input set or relation.
4679 In case of union sets and relations, the polyhedral hull is computed
4680 per space.
4682 =item * Other approximations
4684         #include <isl/set.h>
4685         __isl_give isl_basic_set *
4686         isl_basic_set_drop_constraints_involving_dims(
4687                 __isl_take isl_basic_set *bset,
4688                 enum isl_dim_type type,
4689                 unsigned first, unsigned n);
4690         __isl_give isl_basic_set *
4691         isl_basic_set_drop_constraints_not_involving_dims(
4692                 __isl_take isl_basic_set *bset,
4693                 enum isl_dim_type type,
4694                 unsigned first, unsigned n);
4695         __isl_give isl_set *
4696         isl_set_drop_constraints_involving_dims(
4697                 __isl_take isl_set *set,
4698                 enum isl_dim_type type,
4699                 unsigned first, unsigned n);
4701         #include <isl/map.h>
4702         __isl_give isl_basic_map *
4703         isl_basic_map_drop_constraints_involving_dims(
4704                 __isl_take isl_basic_map *bmap,
4705                 enum isl_dim_type type,
4706                 unsigned first, unsigned n);
4707         __isl_give isl_map *
4708         isl_map_drop_constraints_involving_dims(
4709                 __isl_take isl_map *map,
4710                 enum isl_dim_type type,
4711                 unsigned first, unsigned n);
4713 These functions drop any constraints (not) involving the specified dimensions.
4714 Note that the result depends on the representation of the input.
4716         #include <isl/polynomial.h>
4717         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
4718                 __isl_take isl_pw_qpolynomial *pwqp, int sign);
4719         __isl_give isl_union_pw_qpolynomial *
4720         isl_union_pw_qpolynomial_to_polynomial(
4721                 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
4723 Approximate each quasipolynomial by a polynomial.  If C<sign> is positive,
4724 the polynomial will be an overapproximation.  If C<sign> is negative,
4725 it will be an underapproximation.  If C<sign> is zero, the approximation
4726 will lie somewhere in between.
4728 =item * Feasibility
4730         __isl_give isl_basic_set *isl_basic_set_sample(
4731                 __isl_take isl_basic_set *bset);
4732         __isl_give isl_basic_set *isl_set_sample(
4733                 __isl_take isl_set *set);
4734         __isl_give isl_basic_map *isl_basic_map_sample(
4735                 __isl_take isl_basic_map *bmap);
4736         __isl_give isl_basic_map *isl_map_sample(
4737                 __isl_take isl_map *map);
4739 If the input (basic) set or relation is non-empty, then return
4740 a singleton subset of the input.  Otherwise, return an empty set.
4742 =item * Optimization
4744         #include <isl/ilp.h>
4745         __isl_give isl_val *isl_basic_set_max_val(
4746                 __isl_keep isl_basic_set *bset,
4747                 __isl_keep isl_aff *obj);
4748         __isl_give isl_val *isl_set_min_val(
4749                 __isl_keep isl_set *set,
4750                 __isl_keep isl_aff *obj);
4751         __isl_give isl_val *isl_set_max_val(
4752                 __isl_keep isl_set *set,
4753                 __isl_keep isl_aff *obj);
4755 Compute the minimum or maximum of the integer affine expression C<obj>
4756 over the points in C<set>, returning the result in C<opt>.
4757 The result is C<NULL> in case of an error, the optimal value in case
4758 there is one, negative infinity or infinity if the problem is unbounded and
4759 NaN if the problem is empty.
4761 =item * Parametric optimization
4763         __isl_give isl_pw_aff *isl_set_dim_min(
4764                 __isl_take isl_set *set, int pos);
4765         __isl_give isl_pw_aff *isl_set_dim_max(
4766                 __isl_take isl_set *set, int pos);
4767         __isl_give isl_pw_aff *isl_map_dim_max(
4768                 __isl_take isl_map *map, int pos);
4770 Compute the minimum or maximum of the given set or output dimension
4771 as a function of the parameters (and input dimensions), but independently
4772 of the other set or output dimensions.
4773 For lexicographic optimization, see L<"Lexicographic Optimization">.
4775 =item * Dual
4777 The following functions compute either the set of (rational) coefficient
4778 values of valid constraints for the given set or the set of (rational)
4779 values satisfying the constraints with coefficients from the given set.
4780 Internally, these two sets of functions perform essentially the
4781 same operations, except that the set of coefficients is assumed to
4782 be a cone, while the set of values may be any polyhedron.
4783 The current implementation is based on the Farkas lemma and
4784 Fourier-Motzkin elimination, but this may change or be made optional
4785 in future.  In particular, future implementations may use different
4786 dualization algorithms or skip the elimination step.
4788         __isl_give isl_basic_set *isl_basic_set_coefficients(
4789                 __isl_take isl_basic_set *bset);
4790         __isl_give isl_basic_set *isl_set_coefficients(
4791                 __isl_take isl_set *set);
4792         __isl_give isl_union_set *isl_union_set_coefficients(
4793                 __isl_take isl_union_set *bset);
4794         __isl_give isl_basic_set *isl_basic_set_solutions(
4795                 __isl_take isl_basic_set *bset);
4796         __isl_give isl_basic_set *isl_set_solutions(
4797                 __isl_take isl_set *set);
4798         __isl_give isl_union_set *isl_union_set_solutions(
4799                 __isl_take isl_union_set *bset);
4801 =item * Power
4803         __isl_give isl_map *isl_map_fixed_power_val(
4804                 __isl_take isl_map *map,
4805                 __isl_take isl_val *exp);
4806         __isl_give isl_union_map *
4807         isl_union_map_fixed_power_val(
4808                 __isl_take isl_union_map *umap,
4809                 __isl_take isl_val *exp);
4811 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
4812 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
4813 of C<map> is computed.
4815         __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
4816                 int *exact);
4817         __isl_give isl_union_map *isl_union_map_power(
4818                 __isl_take isl_union_map *umap, int *exact);
4820 Compute a parametric representation for all positive powers I<k> of C<map>.
4821 The result maps I<k> to a nested relation corresponding to the
4822 I<k>th power of C<map>.
4823 The result may be an overapproximation.  If the result is known to be exact,
4824 then C<*exact> is set to C<1>.
4826 =item * Transitive closure
4828         __isl_give isl_map *isl_map_transitive_closure(
4829                 __isl_take isl_map *map, int *exact);
4830         __isl_give isl_union_map *isl_union_map_transitive_closure(
4831                 __isl_take isl_union_map *umap, int *exact);
4833 Compute the transitive closure of C<map>.
4834 The result may be an overapproximation.  If the result is known to be exact,
4835 then C<*exact> is set to C<1>.
4837 =item * Reaching path lengths
4839         __isl_give isl_map *isl_map_reaching_path_lengths(
4840                 __isl_take isl_map *map, int *exact);
4842 Compute a relation that maps each element in the range of C<map>
4843 to the lengths of all paths composed of edges in C<map> that
4844 end up in the given element.
4845 The result may be an overapproximation.  If the result is known to be exact,
4846 then C<*exact> is set to C<1>.
4847 To compute the I<maximal> path length, the resulting relation
4848 should be postprocessed by C<isl_map_lexmax>.
4849 In particular, if the input relation is a dependence relation
4850 (mapping sources to sinks), then the maximal path length corresponds
4851 to the free schedule.
4852 Note, however, that C<isl_map_lexmax> expects the maximum to be
4853 finite, so if the path lengths are unbounded (possibly due to
4854 the overapproximation), then you will get an error message.
4856 =item * Wrapping
4858         #include <isl/space.h>
4859         __isl_give isl_space *isl_space_wrap(
4860                 __isl_take isl_space *space);
4861         __isl_give isl_space *isl_space_unwrap(
4862                 __isl_take isl_space *space);
4864         #include <isl/local_space.h>
4865         __isl_give isl_local_space *isl_local_space_wrap(
4866                 __isl_take isl_local_space *ls);
4868         #include <isl/set.h>
4869         __isl_give isl_basic_map *isl_basic_set_unwrap(
4870                 __isl_take isl_basic_set *bset);
4871         __isl_give isl_map *isl_set_unwrap(
4872                 __isl_take isl_set *set);
4874         #include <isl/map.h>
4875         __isl_give isl_basic_set *isl_basic_map_wrap(
4876                 __isl_take isl_basic_map *bmap);
4877         __isl_give isl_set *isl_map_wrap(
4878                 __isl_take isl_map *map);
4880         #include <isl/union_set.h>
4881         __isl_give isl_union_map *isl_union_set_unwrap(
4882                 __isl_take isl_union_set *uset);
4884         #include <isl/union_map.h>
4885         __isl_give isl_union_set *isl_union_map_wrap(
4886                 __isl_take isl_union_map *umap);
4888 The input to C<isl_space_unwrap> should
4889 be the space of a set, while that of
4890 C<isl_space_wrap> should be the space of a relation.
4891 Conversely, the output of C<isl_space_unwrap> is the space
4892 of a relation, while that of C<isl_space_wrap> is the space of a set.
4894 =item * Flattening
4896 Remove any internal structure of domain (and range) of the given
4897 set or relation.  If there is any such internal structure in the input,
4898 then the name of the space is also removed.
4900         #include <isl/local_space.h>
4901         __isl_give isl_local_space *
4902         isl_local_space_flatten_domain(
4903                 __isl_take isl_local_space *ls);
4904         __isl_give isl_local_space *
4905         isl_local_space_flatten_range(
4906                 __isl_take isl_local_space *ls);
4908         #include <isl/set.h>
4909         __isl_give isl_basic_set *isl_basic_set_flatten(
4910                 __isl_take isl_basic_set *bset);
4911         __isl_give isl_set *isl_set_flatten(
4912                 __isl_take isl_set *set);
4914         #include <isl/map.h>
4915         __isl_give isl_basic_map *isl_basic_map_flatten_domain(
4916                 __isl_take isl_basic_map *bmap);
4917         __isl_give isl_basic_map *isl_basic_map_flatten_range(
4918                 __isl_take isl_basic_map *bmap);
4919         __isl_give isl_map *isl_map_flatten_range(
4920                 __isl_take isl_map *map);
4921         __isl_give isl_map *isl_map_flatten_domain(
4922                 __isl_take isl_map *map);
4923         __isl_give isl_basic_map *isl_basic_map_flatten(
4924                 __isl_take isl_basic_map *bmap);
4925         __isl_give isl_map *isl_map_flatten(
4926                 __isl_take isl_map *map);
4928         #include <isl/val.h>
4929         __isl_give isl_multi_val *isl_multi_val_flatten_range(
4930                 __isl_take isl_multi_val *mv);
4932         #include <isl/aff.h>
4933         __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
4934                 __isl_take isl_multi_aff *ma);
4935         __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
4936                 __isl_take isl_multi_aff *ma);
4937         __isl_give isl_multi_pw_aff *
4938         isl_multi_pw_aff_flatten_range(
4939                 __isl_take isl_multi_pw_aff *mpa);
4940         __isl_give isl_multi_union_pw_aff *
4941         isl_multi_union_pw_aff_flatten_range(
4942                 __isl_take isl_multi_union_pw_aff *mupa);
4944         #include <isl/map.h>
4945         __isl_give isl_map *isl_set_flatten_map(
4946                 __isl_take isl_set *set);
4948 The function above constructs a relation
4949 that maps the input set to a flattened version of the set.
4951 =item * Lifting
4953 Lift the input set to a space with extra dimensions corresponding
4954 to the existentially quantified variables in the input.
4955 In particular, the result lives in a wrapped map where the domain
4956 is the original space and the range corresponds to the original
4957 existentially quantified variables.
4959         #include <isl/set.h>
4960         __isl_give isl_basic_set *isl_basic_set_lift(
4961                 __isl_take isl_basic_set *bset);
4962         __isl_give isl_set *isl_set_lift(
4963                 __isl_take isl_set *set);
4964         __isl_give isl_union_set *isl_union_set_lift(
4965                 __isl_take isl_union_set *uset);
4967 Given a local space that contains the existentially quantified
4968 variables of a set, a basic relation that, when applied to
4969 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
4970 can be constructed using the following function.
4972         #include <isl/local_space.h>
4973         __isl_give isl_basic_map *isl_local_space_lifting(
4974                 __isl_take isl_local_space *ls);
4976         #include <isl/aff.h>
4977         __isl_give isl_multi_aff *isl_multi_aff_lift(
4978                 __isl_take isl_multi_aff *maff,
4979                 __isl_give isl_local_space **ls);
4981 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
4982 then it is assigned the local space that lies at the basis of
4983 the lifting applied.
4985 =item * Internal Product
4987         #include <isl/space.h>
4988         __isl_give isl_space *isl_space_zip(
4989                 __isl_take isl_space *space);
4991         #include <isl/map.h>
4992         __isl_give isl_basic_map *isl_basic_map_zip(
4993                 __isl_take isl_basic_map *bmap);
4994         __isl_give isl_map *isl_map_zip(
4995                 __isl_take isl_map *map);
4997         #include <isl/union_map.h>
4998         __isl_give isl_union_map *isl_union_map_zip(
4999                 __isl_take isl_union_map *umap);
5001 Given a relation with nested relations for domain and range,
5002 interchange the range of the domain with the domain of the range.
5004 =item * Currying
5006         #include <isl/space.h>
5007         __isl_give isl_space *isl_space_curry(
5008                 __isl_take isl_space *space);
5009         __isl_give isl_space *isl_space_uncurry(
5010                 __isl_take isl_space *space);
5012         #include <isl/map.h>
5013         __isl_give isl_basic_map *isl_basic_map_curry(
5014                 __isl_take isl_basic_map *bmap);
5015         __isl_give isl_basic_map *isl_basic_map_uncurry(
5016                 __isl_take isl_basic_map *bmap);
5017         __isl_give isl_map *isl_map_curry(
5018                 __isl_take isl_map *map);
5019         __isl_give isl_map *isl_map_uncurry(
5020                 __isl_take isl_map *map);
5022         #include <isl/union_map.h>
5023         __isl_give isl_union_map *isl_union_map_curry(
5024                 __isl_take isl_union_map *umap);
5025         __isl_give isl_union_map *isl_union_map_uncurry(
5026                 __isl_take isl_union_map *umap);
5028 Given a relation with a nested relation for domain,
5029 the C<curry> functions
5030 move the range of the nested relation out of the domain
5031 and use it as the domain of a nested relation in the range,
5032 with the original range as range of this nested relation.
5033 The C<uncurry> functions perform the inverse operation.
5035 =item * Aligning parameters
5037 Change the order of the parameters of the given set, relation
5038 or function
5039 such that the first parameters match those of C<model>.
5040 This may involve the introduction of extra parameters.
5041 All parameters need to be named.
5043         #include <isl/space.h>
5044         __isl_give isl_space *isl_space_align_params(
5045                 __isl_take isl_space *space1,
5046                 __isl_take isl_space *space2)
5048         #include <isl/set.h>
5049         __isl_give isl_basic_set *isl_basic_set_align_params(
5050                 __isl_take isl_basic_set *bset,
5051                 __isl_take isl_space *model);
5052         __isl_give isl_set *isl_set_align_params(
5053                 __isl_take isl_set *set,
5054                 __isl_take isl_space *model);
5056         #include <isl/map.h>
5057         __isl_give isl_basic_map *isl_basic_map_align_params(
5058                 __isl_take isl_basic_map *bmap,
5059                 __isl_take isl_space *model);
5060         __isl_give isl_map *isl_map_align_params(
5061                 __isl_take isl_map *map,
5062                 __isl_take isl_space *model);
5064         #include <isl/val.h>
5065         __isl_give isl_multi_val *isl_multi_val_align_params(
5066                 __isl_take isl_multi_val *mv,
5067                 __isl_take isl_space *model);
5069         #include <isl/aff.h>
5070         __isl_give isl_aff *isl_aff_align_params(
5071                 __isl_take isl_aff *aff,
5072                 __isl_take isl_space *model);
5073         __isl_give isl_multi_aff *isl_multi_aff_align_params(
5074                 __isl_take isl_multi_aff *multi,
5075                 __isl_take isl_space *model);
5076         __isl_give isl_pw_aff *isl_pw_aff_align_params(
5077                 __isl_take isl_pw_aff *pwaff,
5078                 __isl_take isl_space *model);
5079         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
5080                 __isl_take isl_pw_multi_aff *pma,
5081                 __isl_take isl_space *model);
5082         __isl_give isl_union_pw_aff *
5083         isl_union_pw_aff_align_params(
5084                 __isl_take isl_union_pw_aff *upa,
5085                 __isl_take isl_space *model);
5086         __isl_give isl_union_pw_multi_aff *
5087         isl_union_pw_multi_aff_align_params(
5088                 __isl_take isl_union_pw_multi_aff *upma,
5089                 __isl_take isl_space *model);
5090         __isl_give isl_multi_union_pw_aff *
5091         isl_multi_union_pw_aff_align_params(
5092                 __isl_take isl_multi_union_pw_aff *mupa,
5093                 __isl_take isl_space *model);
5095         #include <isl/polynomial.h>
5096         __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
5097                 __isl_take isl_qpolynomial *qp,
5098                 __isl_take isl_space *model);
5100 =item * Unary Arithmethic Operations
5102         #include <isl/val.h>
5103         __isl_give isl_multi_val *isl_multi_val_neg(
5104                 __isl_take isl_multi_val *mv);
5106         #include <isl/aff.h>
5107         __isl_give isl_aff *isl_aff_neg(
5108                 __isl_take isl_aff *aff);
5109         __isl_give isl_multi_aff *isl_multi_aff_neg(
5110                 __isl_take isl_multi_aff *ma);
5111         __isl_give isl_pw_aff *isl_pw_aff_neg(
5112                 __isl_take isl_pw_aff *pwaff);
5113         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
5114                 __isl_take isl_pw_multi_aff *pma);
5115         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
5116                 __isl_take isl_multi_pw_aff *mpa);
5117         __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
5118                 __isl_take isl_union_pw_aff *upa);
5119         __isl_give isl_union_pw_multi_aff *
5120         isl_union_pw_multi_aff_neg(
5121                 __isl_take isl_union_pw_multi_aff *upma);
5122         __isl_give isl_multi_union_pw_aff *
5123         isl_multi_union_pw_aff_neg(
5124                 __isl_take isl_multi_union_pw_aff *mupa);
5125         __isl_give isl_aff *isl_aff_ceil(
5126                 __isl_take isl_aff *aff);
5127         __isl_give isl_pw_aff *isl_pw_aff_ceil(
5128                 __isl_take isl_pw_aff *pwaff);
5129         __isl_give isl_aff *isl_aff_floor(
5130                 __isl_take isl_aff *aff);
5131         __isl_give isl_multi_aff *isl_multi_aff_floor(
5132                 __isl_take isl_multi_aff *ma);
5133         __isl_give isl_pw_aff *isl_pw_aff_floor(
5134                 __isl_take isl_pw_aff *pwaff);
5135         __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
5136                 __isl_take isl_union_pw_aff *upa);
5137         __isl_give isl_multi_union_pw_aff *
5138         isl_multi_union_pw_aff_floor(
5139                 __isl_take isl_multi_union_pw_aff *mupa);
5141         #include <isl/aff.h>
5142         __isl_give isl_pw_aff *isl_pw_aff_list_min(
5143                 __isl_take isl_pw_aff_list *list);
5144         __isl_give isl_pw_aff *isl_pw_aff_list_max(
5145                 __isl_take isl_pw_aff_list *list);
5147         #include <isl/polynomial.h>
5148         __isl_give isl_qpolynomial *isl_qpolynomial_neg(
5149                 __isl_take isl_qpolynomial *qp);
5150         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
5151                 __isl_take isl_pw_qpolynomial *pwqp);
5152         __isl_give isl_union_pw_qpolynomial *
5153         isl_union_pw_qpolynomial_neg(
5154                 __isl_take isl_union_pw_qpolynomial *upwqp);
5155         __isl_give isl_qpolynomial *isl_qpolynomial_pow(
5156                 __isl_take isl_qpolynomial *qp,
5157                 unsigned exponent);
5158         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
5159                 __isl_take isl_pw_qpolynomial *pwqp,
5160                 unsigned exponent);
5162 =item * Evaluation
5164 The following functions evaluate a function in a point.
5166         #include <isl/polynomial.h>
5167         __isl_give isl_val *isl_pw_qpolynomial_eval(
5168                 __isl_take isl_pw_qpolynomial *pwqp,
5169                 __isl_take isl_point *pnt);
5170         __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
5171                 __isl_take isl_pw_qpolynomial_fold *pwf,
5172                 __isl_take isl_point *pnt);
5173         __isl_give isl_val *isl_union_pw_qpolynomial_eval(
5174                 __isl_take isl_union_pw_qpolynomial *upwqp,
5175                 __isl_take isl_point *pnt);
5176         __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
5177                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5178                 __isl_take isl_point *pnt);
5180 =item * Dimension manipulation
5182 It is usually not advisable to directly change the (input or output)
5183 space of a set or a relation as this removes the name and the internal
5184 structure of the space.  However, the functions below can be useful
5185 to add new parameters, assuming
5186 C<isl_set_align_params> and C<isl_map_align_params>
5187 are not sufficient.
5189         #include <isl/space.h>
5190         __isl_give isl_space *isl_space_add_dims(
5191                 __isl_take isl_space *space,
5192                 enum isl_dim_type type, unsigned n);
5193         __isl_give isl_space *isl_space_insert_dims(
5194                 __isl_take isl_space *space,
5195                 enum isl_dim_type type, unsigned pos, unsigned n);
5196         __isl_give isl_space *isl_space_drop_dims(
5197                 __isl_take isl_space *space,
5198                 enum isl_dim_type type, unsigned first, unsigned n);
5199         __isl_give isl_space *isl_space_move_dims(
5200                 __isl_take isl_space *space,
5201                 enum isl_dim_type dst_type, unsigned dst_pos,
5202                 enum isl_dim_type src_type, unsigned src_pos,
5203                 unsigned n);
5205         #include <isl/local_space.h>
5206         __isl_give isl_local_space *isl_local_space_add_dims(
5207                 __isl_take isl_local_space *ls,
5208                 enum isl_dim_type type, unsigned n);
5209         __isl_give isl_local_space *isl_local_space_insert_dims(
5210                 __isl_take isl_local_space *ls,
5211                 enum isl_dim_type type, unsigned first, unsigned n);
5212         __isl_give isl_local_space *isl_local_space_drop_dims(
5213                 __isl_take isl_local_space *ls,
5214                 enum isl_dim_type type, unsigned first, unsigned n);
5216         #include <isl/set.h>
5217         __isl_give isl_basic_set *isl_basic_set_add_dims(
5218                 __isl_take isl_basic_set *bset,
5219                 enum isl_dim_type type, unsigned n);
5220         __isl_give isl_set *isl_set_add_dims(
5221                 __isl_take isl_set *set,
5222                 enum isl_dim_type type, unsigned n);
5223         __isl_give isl_basic_set *isl_basic_set_insert_dims(
5224                 __isl_take isl_basic_set *bset,
5225                 enum isl_dim_type type, unsigned pos,
5226                 unsigned n);
5227         __isl_give isl_set *isl_set_insert_dims(
5228                 __isl_take isl_set *set,
5229                 enum isl_dim_type type, unsigned pos, unsigned n);
5230         __isl_give isl_basic_set *isl_basic_set_move_dims(
5231                 __isl_take isl_basic_set *bset,
5232                 enum isl_dim_type dst_type, unsigned dst_pos,
5233                 enum isl_dim_type src_type, unsigned src_pos,
5234                 unsigned n);
5235         __isl_give isl_set *isl_set_move_dims(
5236                 __isl_take isl_set *set,
5237                 enum isl_dim_type dst_type, unsigned dst_pos,
5238                 enum isl_dim_type src_type, unsigned src_pos,
5239                 unsigned n);
5241         #include <isl/map.h>
5242         __isl_give isl_map *isl_map_add_dims(
5243                 __isl_take isl_map *map,
5244                 enum isl_dim_type type, unsigned n);
5245         __isl_give isl_basic_map *isl_basic_map_insert_dims(
5246                 __isl_take isl_basic_map *bmap,
5247                 enum isl_dim_type type, unsigned pos,
5248                 unsigned n);
5249         __isl_give isl_map *isl_map_insert_dims(
5250                 __isl_take isl_map *map,
5251                 enum isl_dim_type type, unsigned pos, unsigned n);
5252         __isl_give isl_basic_map *isl_basic_map_move_dims(
5253                 __isl_take isl_basic_map *bmap,
5254                 enum isl_dim_type dst_type, unsigned dst_pos,
5255                 enum isl_dim_type src_type, unsigned src_pos,
5256                 unsigned n);
5257         __isl_give isl_map *isl_map_move_dims(
5258                 __isl_take isl_map *map,
5259                 enum isl_dim_type dst_type, unsigned dst_pos,
5260                 enum isl_dim_type src_type, unsigned src_pos,
5261                 unsigned n);
5263         #include <isl/val.h>
5264         __isl_give isl_multi_val *isl_multi_val_insert_dims(
5265                 __isl_take isl_multi_val *mv,
5266                 enum isl_dim_type type, unsigned first, unsigned n);
5267         __isl_give isl_multi_val *isl_multi_val_add_dims(
5268                 __isl_take isl_multi_val *mv,
5269                 enum isl_dim_type type, unsigned n);
5270         __isl_give isl_multi_val *isl_multi_val_drop_dims(
5271                 __isl_take isl_multi_val *mv,
5272                 enum isl_dim_type type, unsigned first, unsigned n);
5274         #include <isl/aff.h>
5275         __isl_give isl_aff *isl_aff_insert_dims(
5276                 __isl_take isl_aff *aff,
5277                 enum isl_dim_type type, unsigned first, unsigned n);
5278         __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
5279                 __isl_take isl_multi_aff *ma,
5280                 enum isl_dim_type type, unsigned first, unsigned n);
5281         __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
5282                 __isl_take isl_pw_aff *pwaff,
5283                 enum isl_dim_type type, unsigned first, unsigned n);
5284         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
5285                 __isl_take isl_multi_pw_aff *mpa,
5286                 enum isl_dim_type type, unsigned first, unsigned n);
5287         __isl_give isl_aff *isl_aff_add_dims(
5288                 __isl_take isl_aff *aff,
5289                 enum isl_dim_type type, unsigned n);
5290         __isl_give isl_multi_aff *isl_multi_aff_add_dims(
5291                 __isl_take isl_multi_aff *ma,
5292                 enum isl_dim_type type, unsigned n);
5293         __isl_give isl_pw_aff *isl_pw_aff_add_dims(
5294                 __isl_take isl_pw_aff *pwaff,
5295                 enum isl_dim_type type, unsigned n);
5296         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
5297                 __isl_take isl_multi_pw_aff *mpa,
5298                 enum isl_dim_type type, unsigned n);
5299         __isl_give isl_aff *isl_aff_drop_dims(
5300                 __isl_take isl_aff *aff,
5301                 enum isl_dim_type type, unsigned first, unsigned n);
5302         __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
5303                 __isl_take isl_multi_aff *maff,
5304                 enum isl_dim_type type, unsigned first, unsigned n);
5305         __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
5306                 __isl_take isl_pw_aff *pwaff,
5307                 enum isl_dim_type type, unsigned first, unsigned n);
5308         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
5309                 __isl_take isl_pw_multi_aff *pma,
5310                 enum isl_dim_type type, unsigned first, unsigned n);
5311         __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
5312                 __isl_take isl_union_pw_aff *upa,
5313                 enum isl_dim_type type, unsigned first, unsigned n);
5314         __isl_give isl_union_pw_multi_aff *
5315                 isl_union_pw_multi_aff_drop_dims(
5316                 __isl_take isl_union_pw_multi_aff *upma,
5317                 enum isl_dim_type type,
5318                 unsigned first, unsigned n);
5319         __isl_give isl_multi_union_pw_aff *
5320         isl_multi_union_pw_aff_drop_dims(
5321                 __isl_take isl_multi_union_pw_aff *mupa,
5322                 enum isl_dim_type type, unsigned first,
5323                 unsigned n);
5324         __isl_give isl_aff *isl_aff_move_dims(
5325                 __isl_take isl_aff *aff,
5326                 enum isl_dim_type dst_type, unsigned dst_pos,
5327                 enum isl_dim_type src_type, unsigned src_pos,
5328                 unsigned n);
5329         __isl_give isl_multi_aff *isl_multi_aff_move_dims(
5330                 __isl_take isl_multi_aff *ma,
5331                 enum isl_dim_type dst_type, unsigned dst_pos,
5332                 enum isl_dim_type src_type, unsigned src_pos,
5333                 unsigned n);
5334         __isl_give isl_pw_aff *isl_pw_aff_move_dims(
5335                 __isl_take isl_pw_aff *pa,
5336                 enum isl_dim_type dst_type, unsigned dst_pos,
5337                 enum isl_dim_type src_type, unsigned src_pos,
5338                 unsigned n);
5339         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
5340                 __isl_take isl_multi_pw_aff *pma,
5341                 enum isl_dim_type dst_type, unsigned dst_pos,
5342                 enum isl_dim_type src_type, unsigned src_pos,
5343                 unsigned n);
5345         #include <isl/polynomial.h>
5346         __isl_give isl_union_pw_qpolynomial *
5347         isl_union_pw_qpolynomial_drop_dims(
5348                 __isl_take isl_union_pw_qpolynomial *upwqp,
5349                 enum isl_dim_type type,
5350                 unsigned first, unsigned n);
5351         __isl_give isl_union_pw_qpolynomial_fold *
5352                 isl_union_pw_qpolynomial_fold_drop_dims(
5353                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5354                 enum isl_dim_type type,
5355                 unsigned first, unsigned n);
5357 The operations on union expressions can only manipulate parameters.
5359 =back
5361 =head2 Binary Operations
5363 The two arguments of a binary operation not only need to live
5364 in the same C<isl_ctx>, they currently also need to have
5365 the same (number of) parameters.
5367 =head3 Basic Operations
5369 =over
5371 =item * Intersection
5373         #include <isl/local_space.h>
5374         __isl_give isl_local_space *isl_local_space_intersect(
5375                 __isl_take isl_local_space *ls1,
5376                 __isl_take isl_local_space *ls2);
5378         #include <isl/set.h>
5379         __isl_give isl_basic_set *isl_basic_set_intersect_params(
5380                 __isl_take isl_basic_set *bset1,
5381                 __isl_take isl_basic_set *bset2);
5382         __isl_give isl_basic_set *isl_basic_set_intersect(
5383                 __isl_take isl_basic_set *bset1,
5384                 __isl_take isl_basic_set *bset2);
5385         __isl_give isl_basic_set *isl_basic_set_list_intersect(
5386                 __isl_take struct isl_basic_set_list *list);
5387         __isl_give isl_set *isl_set_intersect_params(
5388                 __isl_take isl_set *set,
5389                 __isl_take isl_set *params);
5390         __isl_give isl_set *isl_set_intersect(
5391                 __isl_take isl_set *set1,
5392                 __isl_take isl_set *set2);
5394         #include <isl/map.h>
5395         __isl_give isl_basic_map *isl_basic_map_intersect_domain(
5396                 __isl_take isl_basic_map *bmap,
5397                 __isl_take isl_basic_set *bset);
5398         __isl_give isl_basic_map *isl_basic_map_intersect_range(
5399                 __isl_take isl_basic_map *bmap,
5400                 __isl_take isl_basic_set *bset);
5401         __isl_give isl_basic_map *isl_basic_map_intersect(
5402                 __isl_take isl_basic_map *bmap1,
5403                 __isl_take isl_basic_map *bmap2);
5404         __isl_give isl_basic_map *isl_basic_map_list_intersect(
5405                 __isl_take isl_basic_map_list *list);
5406         __isl_give isl_map *isl_map_intersect_params(
5407                 __isl_take isl_map *map,
5408                 __isl_take isl_set *params);
5409         __isl_give isl_map *isl_map_intersect_domain(
5410                 __isl_take isl_map *map,
5411                 __isl_take isl_set *set);
5412         __isl_give isl_map *isl_map_intersect_range(
5413                 __isl_take isl_map *map,
5414                 __isl_take isl_set *set);
5415         __isl_give isl_map *isl_map_intersect(
5416                 __isl_take isl_map *map1,
5417                 __isl_take isl_map *map2);
5419         #include <isl/union_set.h>
5420         __isl_give isl_union_set *isl_union_set_intersect_params(
5421                 __isl_take isl_union_set *uset,
5422                 __isl_take isl_set *set);
5423         __isl_give isl_union_set *isl_union_set_intersect(
5424                 __isl_take isl_union_set *uset1,
5425                 __isl_take isl_union_set *uset2);
5427         #include <isl/union_map.h>
5428         __isl_give isl_union_map *isl_union_map_intersect_params(
5429                 __isl_take isl_union_map *umap,
5430                 __isl_take isl_set *set);
5431         __isl_give isl_union_map *isl_union_map_intersect_domain(
5432                 __isl_take isl_union_map *umap,
5433                 __isl_take isl_union_set *uset);
5434         __isl_give isl_union_map *isl_union_map_intersect_range(
5435                 __isl_take isl_union_map *umap,
5436                 __isl_take isl_union_set *uset);
5437         __isl_give isl_union_map *isl_union_map_intersect(
5438                 __isl_take isl_union_map *umap1,
5439                 __isl_take isl_union_map *umap2);
5441         #include <isl/aff.h>
5442         __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
5443                 __isl_take isl_pw_aff *pa,
5444                 __isl_take isl_set *set);
5445         __isl_give isl_multi_pw_aff *
5446         isl_multi_pw_aff_intersect_domain(
5447                 __isl_take isl_multi_pw_aff *mpa,
5448                 __isl_take isl_set *domain);
5449         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
5450                 __isl_take isl_pw_multi_aff *pma,
5451                 __isl_take isl_set *set);
5452         __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
5453                 __isl_take isl_union_pw_aff *upa,
5454                 __isl_take isl_union_set *uset);
5455         __isl_give isl_union_pw_multi_aff *
5456         isl_union_pw_multi_aff_intersect_domain(
5457                 __isl_take isl_union_pw_multi_aff *upma,
5458                 __isl_take isl_union_set *uset);
5459         __isl_give isl_multi_union_pw_aff *
5460         isl_multi_union_pw_aff_intersect_domain(
5461                 __isl_take isl_multi_union_pw_aff *mupa,
5462                 __isl_take isl_union_set *uset);
5463         __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
5464                 __isl_take isl_pw_aff *pa,
5465                 __isl_take isl_set *set);
5466         __isl_give isl_multi_pw_aff *
5467         isl_multi_pw_aff_intersect_params(
5468                 __isl_take isl_multi_pw_aff *mpa,
5469                 __isl_take isl_set *set);
5470         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
5471                 __isl_take isl_pw_multi_aff *pma,
5472                 __isl_take isl_set *set);
5473         __isl_give isl_union_pw_aff *
5474         isl_union_pw_aff_intersect_params(
5475                 __isl_take isl_union_pw_aff *upa,
5476         __isl_give isl_union_pw_multi_aff *
5477         isl_union_pw_multi_aff_intersect_params(
5478                 __isl_take isl_union_pw_multi_aff *upma,
5479                 __isl_take isl_set *set);
5480         __isl_give isl_multi_union_pw_aff *
5481         isl_multi_union_pw_aff_intersect_params(
5482                 __isl_take isl_multi_union_pw_aff *mupa,
5483                 __isl_take isl_set *params);
5484         isl_multi_union_pw_aff_intersect_range(
5485                 __isl_take isl_multi_union_pw_aff *mupa,
5486                 __isl_take isl_set *set);
5488         #include <isl/polynomial.h>
5489         __isl_give isl_pw_qpolynomial *
5490         isl_pw_qpolynomial_intersect_domain(
5491                 __isl_take isl_pw_qpolynomial *pwpq,
5492                 __isl_take isl_set *set);
5493         __isl_give isl_union_pw_qpolynomial *
5494         isl_union_pw_qpolynomial_intersect_domain(
5495                 __isl_take isl_union_pw_qpolynomial *upwpq,
5496                 __isl_take isl_union_set *uset);
5497         __isl_give isl_union_pw_qpolynomial_fold *
5498         isl_union_pw_qpolynomial_fold_intersect_domain(
5499                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5500                 __isl_take isl_union_set *uset);
5501         __isl_give isl_pw_qpolynomial *
5502         isl_pw_qpolynomial_intersect_params(
5503                 __isl_take isl_pw_qpolynomial *pwpq,
5504                 __isl_take isl_set *set);
5505         __isl_give isl_pw_qpolynomial_fold *
5506         isl_pw_qpolynomial_fold_intersect_params(
5507                 __isl_take isl_pw_qpolynomial_fold *pwf,
5508                 __isl_take isl_set *set);
5509         __isl_give isl_union_pw_qpolynomial *
5510         isl_union_pw_qpolynomial_intersect_params(
5511                 __isl_take isl_union_pw_qpolynomial *upwpq,
5512                 __isl_take isl_set *set);
5513         __isl_give isl_union_pw_qpolynomial_fold *
5514         isl_union_pw_qpolynomial_fold_intersect_params(
5515                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5516                 __isl_take isl_set *set);
5518 The second argument to the C<_params> functions needs to be
5519 a parametric (basic) set.  For the other functions, a parametric set
5520 for either argument is only allowed if the other argument is
5521 a parametric set as well.
5522 The list passed to C<isl_basic_set_list_intersect> needs to have
5523 at least one element and all elements need to live in the same space.
5524 The function C<isl_multi_union_pw_aff_intersect_range>
5525 restricts the input function to those shared domain elements
5526 that map to the specified range.
5528 =item * Union
5530         #include <isl/set.h>
5531         __isl_give isl_set *isl_basic_set_union(
5532                 __isl_take isl_basic_set *bset1,
5533                 __isl_take isl_basic_set *bset2);
5534         __isl_give isl_set *isl_set_union(
5535                 __isl_take isl_set *set1,
5536                 __isl_take isl_set *set2);
5538         #include <isl/map.h>
5539         __isl_give isl_map *isl_basic_map_union(
5540                 __isl_take isl_basic_map *bmap1,
5541                 __isl_take isl_basic_map *bmap2);
5542         __isl_give isl_map *isl_map_union(
5543                 __isl_take isl_map *map1,
5544                 __isl_take isl_map *map2);
5546         #include <isl/union_set.h>
5547         __isl_give isl_union_set *isl_union_set_union(
5548                 __isl_take isl_union_set *uset1,
5549                 __isl_take isl_union_set *uset2);
5550         __isl_give isl_union_set *isl_union_set_list_union(
5551                 __isl_take isl_union_set_list *list);
5553         #include <isl/union_map.h>
5554         __isl_give isl_union_map *isl_union_map_union(
5555                 __isl_take isl_union_map *umap1,
5556                 __isl_take isl_union_map *umap2);
5558 =item * Set difference
5560         #include <isl/set.h>
5561         __isl_give isl_set *isl_set_subtract(
5562                 __isl_take isl_set *set1,
5563                 __isl_take isl_set *set2);
5565         #include <isl/map.h>
5566         __isl_give isl_map *isl_map_subtract(
5567                 __isl_take isl_map *map1,
5568                 __isl_take isl_map *map2);
5569         __isl_give isl_map *isl_map_subtract_domain(
5570                 __isl_take isl_map *map,
5571                 __isl_take isl_set *dom);
5572         __isl_give isl_map *isl_map_subtract_range(
5573                 __isl_take isl_map *map,
5574                 __isl_take isl_set *dom);
5576         #include <isl/union_set.h>
5577         __isl_give isl_union_set *isl_union_set_subtract(
5578                 __isl_take isl_union_set *uset1,
5579                 __isl_take isl_union_set *uset2);
5581         #include <isl/union_map.h>
5582         __isl_give isl_union_map *isl_union_map_subtract(
5583                 __isl_take isl_union_map *umap1,
5584                 __isl_take isl_union_map *umap2);
5585         __isl_give isl_union_map *isl_union_map_subtract_domain(
5586                 __isl_take isl_union_map *umap,
5587                 __isl_take isl_union_set *dom);
5588         __isl_give isl_union_map *isl_union_map_subtract_range(
5589                 __isl_take isl_union_map *umap,
5590                 __isl_take isl_union_set *dom);
5592         #include <isl/aff.h>
5593         __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
5594                 __isl_take isl_pw_aff *pa,
5595                 __isl_take isl_set *set);
5596         __isl_give isl_pw_multi_aff *
5597         isl_pw_multi_aff_subtract_domain(
5598                 __isl_take isl_pw_multi_aff *pma,
5599                 __isl_take isl_set *set);
5600         __isl_give isl_union_pw_aff *
5601         isl_union_pw_aff_subtract_domain(
5602                 __isl_take isl_union_pw_aff *upa,
5603                 __isl_take isl_union_set *uset);
5604         __isl_give isl_union_pw_multi_aff *
5605         isl_union_pw_multi_aff_subtract_domain(
5606                 __isl_take isl_union_pw_multi_aff *upma,
5607                 __isl_take isl_set *set);
5609         #include <isl/polynomial.h>
5610         __isl_give isl_pw_qpolynomial *
5611         isl_pw_qpolynomial_subtract_domain(
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_subtract_domain(
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_subtract_domain(
5620                 __isl_take isl_union_pw_qpolynomial *upwpq,
5621                 __isl_take isl_union_set *uset);
5622         __isl_give isl_union_pw_qpolynomial_fold *
5623         isl_union_pw_qpolynomial_fold_subtract_domain(
5624                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5625                 __isl_take isl_union_set *uset);
5627 =item * Application
5629         #include <isl/space.h>
5630         __isl_give isl_space *isl_space_join(
5631                 __isl_take isl_space *left,
5632                 __isl_take isl_space *right);
5634         #include <isl/map.h>
5635         __isl_give isl_basic_set *isl_basic_set_apply(
5636                 __isl_take isl_basic_set *bset,
5637                 __isl_take isl_basic_map *bmap);
5638         __isl_give isl_set *isl_set_apply(
5639                 __isl_take isl_set *set,
5640                 __isl_take isl_map *map);
5641         __isl_give isl_union_set *isl_union_set_apply(
5642                 __isl_take isl_union_set *uset,
5643                 __isl_take isl_union_map *umap);
5644         __isl_give isl_basic_map *isl_basic_map_apply_domain(
5645                 __isl_take isl_basic_map *bmap1,
5646                 __isl_take isl_basic_map *bmap2);
5647         __isl_give isl_basic_map *isl_basic_map_apply_range(
5648                 __isl_take isl_basic_map *bmap1,
5649                 __isl_take isl_basic_map *bmap2);
5650         __isl_give isl_map *isl_map_apply_domain(
5651                 __isl_take isl_map *map1,
5652                 __isl_take isl_map *map2);
5653         __isl_give isl_map *isl_map_apply_range(
5654                 __isl_take isl_map *map1,
5655                 __isl_take isl_map *map2);
5657         #include <isl/union_map.h>
5658         __isl_give isl_union_map *isl_union_map_apply_domain(
5659                 __isl_take isl_union_map *umap1,
5660                 __isl_take isl_union_map *umap2);
5661         __isl_give isl_union_map *isl_union_map_apply_range(
5662                 __isl_take isl_union_map *umap1,
5663                 __isl_take isl_union_map *umap2);
5665         #include <isl/aff.h>
5666         __isl_give isl_union_pw_aff *
5667         isl_multi_union_pw_aff_apply_aff(
5668                 __isl_take isl_multi_union_pw_aff *mupa,
5669                 __isl_take isl_aff *aff);
5670         __isl_give isl_union_pw_aff *
5671         isl_multi_union_pw_aff_apply_pw_aff(
5672                 __isl_take isl_multi_union_pw_aff *mupa,
5673                 __isl_take isl_pw_aff *pa);
5674         __isl_give isl_multi_union_pw_aff *
5675         isl_multi_union_pw_aff_apply_multi_aff(
5676                 __isl_take isl_multi_union_pw_aff *mupa,
5677                 __isl_take isl_multi_aff *ma);
5678         __isl_give isl_multi_union_pw_aff *
5679         isl_multi_union_pw_aff_apply_pw_multi_aff(
5680                 __isl_take isl_multi_union_pw_aff *mupa,
5681                 __isl_take isl_pw_multi_aff *pma);
5683 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
5684 over the shared domain of the elements of the input.  The dimension is
5685 required to be greater than zero.
5686 The C<isl_multi_union_pw_aff> argument of
5687 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
5688 but only if the range of the C<isl_multi_aff> argument
5689 is also zero-dimensional.
5690 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
5692         #include <isl/polynomial.h>
5693         __isl_give isl_pw_qpolynomial_fold *
5694         isl_set_apply_pw_qpolynomial_fold(
5695                 __isl_take isl_set *set,
5696                 __isl_take isl_pw_qpolynomial_fold *pwf,
5697                 int *tight);
5698         __isl_give isl_pw_qpolynomial_fold *
5699         isl_map_apply_pw_qpolynomial_fold(
5700                 __isl_take isl_map *map,
5701                 __isl_take isl_pw_qpolynomial_fold *pwf,
5702                 int *tight);
5703         __isl_give isl_union_pw_qpolynomial_fold *
5704         isl_union_set_apply_union_pw_qpolynomial_fold(
5705                 __isl_take isl_union_set *uset,
5706                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5707                 int *tight);
5708         __isl_give isl_union_pw_qpolynomial_fold *
5709         isl_union_map_apply_union_pw_qpolynomial_fold(
5710                 __isl_take isl_union_map *umap,
5711                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5712                 int *tight);
5714 The functions taking a map
5715 compose the given map with the given piecewise quasipolynomial reduction.
5716 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
5717 over all elements in the intersection of the range of the map
5718 and the domain of the piecewise quasipolynomial reduction
5719 as a function of an element in the domain of the map.
5720 The functions taking a set compute a bound over all elements in the
5721 intersection of the set and the domain of the
5722 piecewise quasipolynomial reduction.
5724 =item * Preimage
5726         #include <isl/set.h>
5727         __isl_give isl_basic_set *
5728         isl_basic_set_preimage_multi_aff(
5729                 __isl_take isl_basic_set *bset,
5730                 __isl_take isl_multi_aff *ma);
5731         __isl_give isl_set *isl_set_preimage_multi_aff(
5732                 __isl_take isl_set *set,
5733                 __isl_take isl_multi_aff *ma);
5734         __isl_give isl_set *isl_set_preimage_pw_multi_aff(
5735                 __isl_take isl_set *set,
5736                 __isl_take isl_pw_multi_aff *pma);
5737         __isl_give isl_set *isl_set_preimage_multi_pw_aff(
5738                 __isl_take isl_set *set,
5739                 __isl_take isl_multi_pw_aff *mpa);
5741         #include <isl/union_set.h>
5742         __isl_give isl_union_set *
5743         isl_union_set_preimage_multi_aff(
5744                 __isl_take isl_union_set *uset,
5745                 __isl_take isl_multi_aff *ma);
5746         __isl_give isl_union_set *
5747         isl_union_set_preimage_pw_multi_aff(
5748                 __isl_take isl_union_set *uset,
5749                 __isl_take isl_pw_multi_aff *pma);
5750         __isl_give isl_union_set *
5751         isl_union_set_preimage_union_pw_multi_aff(
5752                 __isl_take isl_union_set *uset,
5753                 __isl_take isl_union_pw_multi_aff *upma);
5755         #include <isl/map.h>
5756         __isl_give isl_basic_map *
5757         isl_basic_map_preimage_domain_multi_aff(
5758                 __isl_take isl_basic_map *bmap,
5759                 __isl_take isl_multi_aff *ma);
5760         __isl_give isl_map *isl_map_preimage_domain_multi_aff(
5761                 __isl_take isl_map *map,
5762                 __isl_take isl_multi_aff *ma);
5763         __isl_give isl_map *isl_map_preimage_range_multi_aff(
5764                 __isl_take isl_map *map,
5765                 __isl_take isl_multi_aff *ma);
5766         __isl_give isl_map *
5767         isl_map_preimage_domain_pw_multi_aff(
5768                 __isl_take isl_map *map,
5769                 __isl_take isl_pw_multi_aff *pma);
5770         __isl_give isl_map *
5771         isl_map_preimage_range_pw_multi_aff(
5772                 __isl_take isl_map *map,
5773                 __isl_take isl_pw_multi_aff *pma);
5774         __isl_give isl_map *
5775         isl_map_preimage_domain_multi_pw_aff(
5776                 __isl_take isl_map *map,
5777                 __isl_take isl_multi_pw_aff *mpa);
5778         __isl_give isl_basic_map *
5779         isl_basic_map_preimage_range_multi_aff(
5780                 __isl_take isl_basic_map *bmap,
5781                 __isl_take isl_multi_aff *ma);
5783         #include <isl/union_map.h>
5784         __isl_give isl_union_map *
5785         isl_union_map_preimage_domain_multi_aff(
5786                 __isl_take isl_union_map *umap,
5787                 __isl_take isl_multi_aff *ma);
5788         __isl_give isl_union_map *
5789         isl_union_map_preimage_range_multi_aff(
5790                 __isl_take isl_union_map *umap,
5791                 __isl_take isl_multi_aff *ma);
5792         __isl_give isl_union_map *
5793         isl_union_map_preimage_domain_pw_multi_aff(
5794                 __isl_take isl_union_map *umap,
5795                 __isl_take isl_pw_multi_aff *pma);
5796         __isl_give isl_union_map *
5797         isl_union_map_preimage_range_pw_multi_aff(
5798                 __isl_take isl_union_map *umap,
5799                 __isl_take isl_pw_multi_aff *pma);
5800         __isl_give isl_union_map *
5801         isl_union_map_preimage_domain_union_pw_multi_aff(
5802                 __isl_take isl_union_map *umap,
5803                 __isl_take isl_union_pw_multi_aff *upma);
5804         __isl_give isl_union_map *
5805         isl_union_map_preimage_range_union_pw_multi_aff(
5806                 __isl_take isl_union_map *umap,
5807                 __isl_take isl_union_pw_multi_aff *upma);
5809 These functions compute the preimage of the given set or map domain/range under
5810 the given function.  In other words, the expression is plugged
5811 into the set description or into the domain/range of the map.
5813 =item * Pullback
5815         #include <isl/aff.h>
5816         __isl_give isl_aff *isl_aff_pullback_aff(
5817                 __isl_take isl_aff *aff1,
5818                 __isl_take isl_aff *aff2);
5819         __isl_give isl_aff *isl_aff_pullback_multi_aff(
5820                 __isl_take isl_aff *aff,
5821                 __isl_take isl_multi_aff *ma);
5822         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
5823                 __isl_take isl_pw_aff *pa,
5824                 __isl_take isl_multi_aff *ma);
5825         __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
5826                 __isl_take isl_pw_aff *pa,
5827                 __isl_take isl_pw_multi_aff *pma);
5828         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
5829                 __isl_take isl_pw_aff *pa,
5830                 __isl_take isl_multi_pw_aff *mpa);
5831         __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
5832                 __isl_take isl_multi_aff *ma1,
5833                 __isl_take isl_multi_aff *ma2);
5834         __isl_give isl_pw_multi_aff *
5835         isl_pw_multi_aff_pullback_multi_aff(
5836                 __isl_take isl_pw_multi_aff *pma,
5837                 __isl_take isl_multi_aff *ma);
5838         __isl_give isl_multi_pw_aff *
5839         isl_multi_pw_aff_pullback_multi_aff(
5840                 __isl_take isl_multi_pw_aff *mpa,
5841                 __isl_take isl_multi_aff *ma);
5842         __isl_give isl_pw_multi_aff *
5843         isl_pw_multi_aff_pullback_pw_multi_aff(
5844                 __isl_take isl_pw_multi_aff *pma1,
5845                 __isl_take isl_pw_multi_aff *pma2);
5846         __isl_give isl_multi_pw_aff *
5847         isl_multi_pw_aff_pullback_pw_multi_aff(
5848                 __isl_take isl_multi_pw_aff *mpa,
5849                 __isl_take isl_pw_multi_aff *pma);
5850         __isl_give isl_multi_pw_aff *
5851         isl_multi_pw_aff_pullback_multi_pw_aff(
5852                 __isl_take isl_multi_pw_aff *mpa1,
5853                 __isl_take isl_multi_pw_aff *mpa2);
5854         __isl_give isl_union_pw_aff *
5855         isl_union_pw_aff_pullback_union_pw_multi_aff(
5856                 __isl_take isl_union_pw_aff *upa,
5857                 __isl_take isl_union_pw_multi_aff *upma);
5858         __isl_give isl_union_pw_multi_aff *
5859         isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
5860                 __isl_take isl_union_pw_multi_aff *upma1,
5861                 __isl_take isl_union_pw_multi_aff *upma2);
5862         __isl_give isl_multi_union_pw_aff *
5863         isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
5864                 __isl_take isl_multi_union_pw_aff *mupa,
5865                 __isl_take isl_union_pw_multi_aff *upma);
5867 These functions precompose the first expression by the second function.
5868 In other words, the second function is plugged
5869 into the first expression.
5871 =item * Locus
5873         #include <isl/aff.h>
5874         __isl_give isl_basic_set *isl_aff_le_basic_set(
5875                 __isl_take isl_aff *aff1,
5876                 __isl_take isl_aff *aff2);
5877         __isl_give isl_basic_set *isl_aff_ge_basic_set(
5878                 __isl_take isl_aff *aff1,
5879                 __isl_take isl_aff *aff2);
5880         __isl_give isl_set *isl_pw_aff_eq_set(
5881                 __isl_take isl_pw_aff *pwaff1,
5882                 __isl_take isl_pw_aff *pwaff2);
5883         __isl_give isl_set *isl_pw_aff_ne_set(
5884                 __isl_take isl_pw_aff *pwaff1,
5885                 __isl_take isl_pw_aff *pwaff2);
5886         __isl_give isl_set *isl_pw_aff_le_set(
5887                 __isl_take isl_pw_aff *pwaff1,
5888                 __isl_take isl_pw_aff *pwaff2);
5889         __isl_give isl_set *isl_pw_aff_lt_set(
5890                 __isl_take isl_pw_aff *pwaff1,
5891                 __isl_take isl_pw_aff *pwaff2);
5892         __isl_give isl_set *isl_pw_aff_ge_set(
5893                 __isl_take isl_pw_aff *pwaff1,
5894                 __isl_take isl_pw_aff *pwaff2);
5895         __isl_give isl_set *isl_pw_aff_gt_set(
5896                 __isl_take isl_pw_aff *pwaff1,
5897                 __isl_take isl_pw_aff *pwaff2);
5899         __isl_give isl_set *isl_multi_aff_lex_le_set(
5900                 __isl_take isl_multi_aff *ma1,
5901                 __isl_take isl_multi_aff *ma2);
5902         __isl_give isl_set *isl_multi_aff_lex_ge_set(
5903                 __isl_take isl_multi_aff *ma1,
5904                 __isl_take isl_multi_aff *ma2);
5906         __isl_give isl_set *isl_pw_aff_list_eq_set(
5907                 __isl_take isl_pw_aff_list *list1,
5908                 __isl_take isl_pw_aff_list *list2);
5909         __isl_give isl_set *isl_pw_aff_list_ne_set(
5910                 __isl_take isl_pw_aff_list *list1,
5911                 __isl_take isl_pw_aff_list *list2);
5912         __isl_give isl_set *isl_pw_aff_list_le_set(
5913                 __isl_take isl_pw_aff_list *list1,
5914                 __isl_take isl_pw_aff_list *list2);
5915         __isl_give isl_set *isl_pw_aff_list_lt_set(
5916                 __isl_take isl_pw_aff_list *list1,
5917                 __isl_take isl_pw_aff_list *list2);
5918         __isl_give isl_set *isl_pw_aff_list_ge_set(
5919                 __isl_take isl_pw_aff_list *list1,
5920                 __isl_take isl_pw_aff_list *list2);
5921         __isl_give isl_set *isl_pw_aff_list_gt_set(
5922                 __isl_take isl_pw_aff_list *list1,
5923                 __isl_take isl_pw_aff_list *list2);
5925 The function C<isl_aff_ge_basic_set> returns a basic set
5926 containing those elements in the shared space
5927 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
5928 The function C<isl_pw_aff_ge_set> returns a set
5929 containing those elements in the shared domain
5930 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
5931 greater than or equal to C<pwaff2>.
5932 The function C<isl_multi_aff_lex_le_set> returns a set
5933 containing those elements in the shared domain space
5934 where C<ma1> is lexicographically smaller than or
5935 equal to C<ma2>.
5936 The functions operating on C<isl_pw_aff_list> apply the corresponding
5937 C<isl_pw_aff> function to each pair of elements in the two lists.
5939         #include <isl/aff.h>
5940         __isl_give isl_map *isl_pw_aff_eq_map(
5941                 __isl_take isl_pw_aff *pa1,
5942                 __isl_take isl_pw_aff *pa2);
5943         __isl_give isl_map *isl_pw_aff_lt_map(
5944                 __isl_take isl_pw_aff *pa1,
5945                 __isl_take isl_pw_aff *pa2);
5946         __isl_give isl_map *isl_pw_aff_gt_map(
5947                 __isl_take isl_pw_aff *pa1,
5948                 __isl_take isl_pw_aff *pa2);
5950         __isl_give isl_map *isl_multi_pw_aff_eq_map(
5951                 __isl_take isl_multi_pw_aff *mpa1,
5952                 __isl_take isl_multi_pw_aff *mpa2);
5953         __isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
5954                 __isl_take isl_multi_pw_aff *mpa1,
5955                 __isl_take isl_multi_pw_aff *mpa2);
5956         __isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
5957                 __isl_take isl_multi_pw_aff *mpa1,
5958                 __isl_take isl_multi_pw_aff *mpa2);
5960 These functions return a map between domain elements of the arguments
5961 where the function values satisfy the given relation.
5963         #include <isl/union_map.h>
5964         __isl_give isl_union_map *
5965         isl_union_map_eq_at_multi_union_pw_aff(
5966                 __isl_take isl_union_map *umap,
5967                 __isl_take isl_multi_union_pw_aff *mupa);
5968         __isl_give isl_union_map *
5969         isl_union_map_lex_lt_at_multi_union_pw_aff(
5970                 __isl_take isl_union_map *umap,
5971                 __isl_take isl_multi_union_pw_aff *mupa);
5972         __isl_give isl_union_map *
5973         isl_union_map_lex_gt_at_multi_union_pw_aff(
5974                 __isl_take isl_union_map *umap,
5975                 __isl_take isl_multi_union_pw_aff *mupa);
5977 These functions select the subset of elements in the union map
5978 that have an equal or lexicographically smaller function value.
5980 =item * Cartesian Product
5982         #include <isl/space.h>
5983         __isl_give isl_space *isl_space_product(
5984                 __isl_take isl_space *space1,
5985                 __isl_take isl_space *space2);
5986         __isl_give isl_space *isl_space_domain_product(
5987                 __isl_take isl_space *space1,
5988                 __isl_take isl_space *space2);
5989         __isl_give isl_space *isl_space_range_product(
5990                 __isl_take isl_space *space1,
5991                 __isl_take isl_space *space2);
5993 The functions
5994 C<isl_space_product>, C<isl_space_domain_product>
5995 and C<isl_space_range_product> take pairs or relation spaces and
5996 produce a single relations space, where either the domain, the range
5997 or both domain and range are wrapped spaces of relations between
5998 the domains and/or ranges of the input spaces.
5999 If the product is only constructed over the domain or the range
6000 then the ranges or the domains of the inputs should be the same.
6001 The function C<isl_space_product> also accepts a pair of set spaces,
6002 in which case it returns a wrapped space of a relation between the
6003 two input spaces.
6005         #include <isl/set.h>
6006         __isl_give isl_set *isl_set_product(
6007                 __isl_take isl_set *set1,
6008                 __isl_take isl_set *set2);
6010         #include <isl/map.h>
6011         __isl_give isl_basic_map *isl_basic_map_domain_product(
6012                 __isl_take isl_basic_map *bmap1,
6013                 __isl_take isl_basic_map *bmap2);
6014         __isl_give isl_basic_map *isl_basic_map_range_product(
6015                 __isl_take isl_basic_map *bmap1,
6016                 __isl_take isl_basic_map *bmap2);
6017         __isl_give isl_basic_map *isl_basic_map_product(
6018                 __isl_take isl_basic_map *bmap1,
6019                 __isl_take isl_basic_map *bmap2);
6020         __isl_give isl_map *isl_map_domain_product(
6021                 __isl_take isl_map *map1,
6022                 __isl_take isl_map *map2);
6023         __isl_give isl_map *isl_map_range_product(
6024                 __isl_take isl_map *map1,
6025                 __isl_take isl_map *map2);
6026         __isl_give isl_map *isl_map_product(
6027                 __isl_take isl_map *map1,
6028                 __isl_take isl_map *map2);
6030         #include <isl/union_set.h>
6031         __isl_give isl_union_set *isl_union_set_product(
6032                 __isl_take isl_union_set *uset1,
6033                 __isl_take isl_union_set *uset2);
6035         #include <isl/union_map.h>
6036         __isl_give isl_union_map *isl_union_map_domain_product(
6037                 __isl_take isl_union_map *umap1,
6038                 __isl_take isl_union_map *umap2);
6039         __isl_give isl_union_map *isl_union_map_range_product(
6040                 __isl_take isl_union_map *umap1,
6041                 __isl_take isl_union_map *umap2);
6042         __isl_give isl_union_map *isl_union_map_product(
6043                 __isl_take isl_union_map *umap1,
6044                 __isl_take isl_union_map *umap2);
6046         #include <isl/val.h>
6047         __isl_give isl_multi_val *isl_multi_val_range_product(
6048                 __isl_take isl_multi_val *mv1,
6049                 __isl_take isl_multi_val *mv2);
6050         __isl_give isl_multi_val *isl_multi_val_product(
6051                 __isl_take isl_multi_val *mv1,
6052                 __isl_take isl_multi_val *mv2);
6054         #include <isl/aff.h>
6055         __isl_give isl_multi_aff *isl_multi_aff_range_product(
6056                 __isl_take isl_multi_aff *ma1,
6057                 __isl_take isl_multi_aff *ma2);
6058         __isl_give isl_multi_aff *isl_multi_aff_product(
6059                 __isl_take isl_multi_aff *ma1,
6060                 __isl_take isl_multi_aff *ma2);
6061         __isl_give isl_multi_pw_aff *
6062         isl_multi_pw_aff_range_product(
6063                 __isl_take isl_multi_pw_aff *mpa1,
6064                 __isl_take isl_multi_pw_aff *mpa2);
6065         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
6066                 __isl_take isl_multi_pw_aff *mpa1,
6067                 __isl_take isl_multi_pw_aff *mpa2);
6068         __isl_give isl_pw_multi_aff *
6069         isl_pw_multi_aff_range_product(
6070                 __isl_take isl_pw_multi_aff *pma1,
6071                 __isl_take isl_pw_multi_aff *pma2);
6072         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
6073                 __isl_take isl_pw_multi_aff *pma1,
6074                 __isl_take isl_pw_multi_aff *pma2);
6075         __isl_give isl_multi_union_pw_aff *
6076         isl_multi_union_pw_aff_range_product(
6077                 __isl_take isl_multi_union_pw_aff *mupa1,
6078                 __isl_take isl_multi_union_pw_aff *mupa2);
6080 The above functions compute the cross product of the given
6081 sets, relations or functions.  The domains and ranges of the results
6082 are wrapped maps between domains and ranges of the inputs.
6083 To obtain a ``flat'' product, use the following functions
6084 instead.
6086         #include <isl/set.h>
6087         __isl_give isl_basic_set *isl_basic_set_flat_product(
6088                 __isl_take isl_basic_set *bset1,
6089                 __isl_take isl_basic_set *bset2);
6090         __isl_give isl_set *isl_set_flat_product(
6091                 __isl_take isl_set *set1,
6092                 __isl_take isl_set *set2);
6094         #include <isl/map.h>
6095         __isl_give isl_basic_map *isl_basic_map_flat_range_product(
6096                 __isl_take isl_basic_map *bmap1,
6097                 __isl_take isl_basic_map *bmap2);
6098         __isl_give isl_map *isl_map_flat_domain_product(
6099                 __isl_take isl_map *map1,
6100                 __isl_take isl_map *map2);
6101         __isl_give isl_map *isl_map_flat_range_product(
6102                 __isl_take isl_map *map1,
6103                 __isl_take isl_map *map2);
6104         __isl_give isl_basic_map *isl_basic_map_flat_product(
6105                 __isl_take isl_basic_map *bmap1,
6106                 __isl_take isl_basic_map *bmap2);
6107         __isl_give isl_map *isl_map_flat_product(
6108                 __isl_take isl_map *map1,
6109                 __isl_take isl_map *map2);
6111         #include <isl/union_map.h>
6112         __isl_give isl_union_map *
6113         isl_union_map_flat_domain_product(
6114                 __isl_take isl_union_map *umap1,
6115                 __isl_take isl_union_map *umap2);
6116         __isl_give isl_union_map *
6117         isl_union_map_flat_range_product(
6118                 __isl_take isl_union_map *umap1,
6119                 __isl_take isl_union_map *umap2);
6121         #include <isl/val.h>
6122         __isl_give isl_multi_val *isl_multi_val_flat_range_product(
6123                 __isl_take isl_multi_val *mv1,
6124                 __isl_take isl_multi_aff *mv2);
6126         #include <isl/aff.h>
6127         __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
6128                 __isl_take isl_multi_aff *ma1,
6129                 __isl_take isl_multi_aff *ma2);
6130         __isl_give isl_pw_multi_aff *
6131         isl_pw_multi_aff_flat_range_product(
6132                 __isl_take isl_pw_multi_aff *pma1,
6133                 __isl_take isl_pw_multi_aff *pma2);
6134         __isl_give isl_multi_pw_aff *
6135         isl_multi_pw_aff_flat_range_product(
6136                 __isl_take isl_multi_pw_aff *mpa1,
6137                 __isl_take isl_multi_pw_aff *mpa2);
6138         __isl_give isl_union_pw_multi_aff *
6139         isl_union_pw_multi_aff_flat_range_product(
6140                 __isl_take isl_union_pw_multi_aff *upma1,
6141                 __isl_take isl_union_pw_multi_aff *upma2);
6142         __isl_give isl_multi_union_pw_aff *
6143         isl_multi_union_pw_aff_flat_range_product(
6144                 __isl_take isl_multi_union_pw_aff *mupa1,
6145                 __isl_take isl_multi_union_pw_aff *mupa2);
6147         #include <isl/space.h>
6148         __isl_give isl_space *isl_space_factor_domain(
6149                 __isl_take isl_space *space);
6150         __isl_give isl_space *isl_space_factor_range(
6151                 __isl_take isl_space *space);
6152         __isl_give isl_space *isl_space_domain_factor_domain(
6153                 __isl_take isl_space *space);
6154         __isl_give isl_space *isl_space_domain_factor_range(
6155                 __isl_take isl_space *space);
6156         __isl_give isl_space *isl_space_range_factor_domain(
6157                 __isl_take isl_space *space);
6158         __isl_give isl_space *isl_space_range_factor_range(
6159                 __isl_take isl_space *space);
6161 The functions C<isl_space_range_factor_domain> and
6162 C<isl_space_range_factor_range> extract the two arguments from
6163 the result of a call to C<isl_space_range_product>.
6165 The arguments of a call to C<isl_map_range_product> can be extracted
6166 from the result using the following functions.
6168         #include <isl/map.h>
6169         __isl_give isl_map *isl_map_factor_domain(
6170                 __isl_take isl_map *map);
6171         __isl_give isl_map *isl_map_factor_range(
6172                 __isl_take isl_map *map);
6173         __isl_give isl_map *isl_map_domain_factor_domain(
6174                 __isl_take isl_map *map);
6175         __isl_give isl_map *isl_map_domain_factor_range(
6176                 __isl_take isl_map *map);
6177         __isl_give isl_map *isl_map_range_factor_domain(
6178                 __isl_take isl_map *map);
6179         __isl_give isl_map *isl_map_range_factor_range(
6180                 __isl_take isl_map *map);
6182         #include <isl/union_map.h>
6183         __isl_give isl_union_map *isl_union_map_factor_domain(
6184                 __isl_take isl_union_map *umap);
6185         __isl_give isl_union_map *isl_union_map_factor_range(
6186                 __isl_take isl_union_map *umap);
6187         __isl_give isl_union_map *
6188         isl_union_map_domain_factor_domain(
6189                 __isl_take isl_union_map *umap);
6190         __isl_give isl_union_map *
6191         isl_union_map_domain_factor_range(
6192                 __isl_take isl_union_map *umap);
6193         __isl_give isl_union_map *
6194         isl_union_map_range_factor_range(
6195                 __isl_take isl_union_map *umap);
6197         #include <isl/val.h>
6198         __isl_give isl_multi_val *
6199         isl_multi_val_range_factor_domain(
6200                 __isl_take isl_multi_val *mv);
6201         __isl_give isl_multi_val *
6202         isl_multi_val_range_factor_range(
6203                 __isl_take isl_multi_val *mv);
6205         #include <isl/aff.h>
6206         __isl_give isl_multi_aff *
6207         isl_multi_aff_range_factor_domain(
6208                 __isl_take isl_multi_aff *ma);
6209         __isl_give isl_multi_aff *
6210         isl_multi_aff_range_factor_range(
6211                 __isl_take isl_multi_aff *ma);
6212         __isl_give isl_multi_pw_aff *
6213         isl_multi_pw_aff_range_factor_domain(
6214                 __isl_take isl_multi_pw_aff *mpa);
6215         __isl_give isl_multi_pw_aff *
6216         isl_multi_pw_aff_range_factor_range(
6217                 __isl_take isl_multi_pw_aff *mpa);
6218         __isl_give isl_multi_union_pw_aff *
6219         isl_multi_union_pw_aff_range_factor_domain(
6220                 __isl_take isl_multi_union_pw_aff *mupa);
6221         __isl_give isl_multi_union_pw_aff *
6222         isl_multi_union_pw_aff_range_factor_range(
6223                 __isl_take isl_multi_union_pw_aff *mupa);
6225 The splice functions are a generalization of the flat product functions,
6226 where the second argument may be inserted at any position inside
6227 the first argument rather than being placed at the end.
6229         #include <isl/val.h>
6230         __isl_give isl_multi_val *isl_multi_val_range_splice(
6231                 __isl_take isl_multi_val *mv1, unsigned pos,
6232                 __isl_take isl_multi_val *mv2);
6234         #include <isl/aff.h>
6235         __isl_give isl_multi_aff *isl_multi_aff_range_splice(
6236                 __isl_take isl_multi_aff *ma1, unsigned pos,
6237                 __isl_take isl_multi_aff *ma2);
6238         __isl_give isl_multi_aff *isl_multi_aff_splice(
6239                 __isl_take isl_multi_aff *ma1,
6240                 unsigned in_pos, unsigned out_pos,
6241                 __isl_take isl_multi_aff *ma2);
6242         __isl_give isl_multi_pw_aff *
6243         isl_multi_pw_aff_range_splice(
6244                 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
6245                 __isl_take isl_multi_pw_aff *mpa2);
6246         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
6247                 __isl_take isl_multi_pw_aff *mpa1,
6248                 unsigned in_pos, unsigned out_pos,
6249                 __isl_take isl_multi_pw_aff *mpa2);
6250         __isl_give isl_multi_union_pw_aff *
6251         isl_multi_union_pw_aff_range_splice(
6252                 __isl_take isl_multi_union_pw_aff *mupa1,
6253                 unsigned pos,
6254                 __isl_take isl_multi_union_pw_aff *mupa2);
6256 =item * Simplification
6258 When applied to a set or relation,
6259 the gist operation returns a set or relation that has the
6260 same intersection with the context as the input set or relation.
6261 Any implicit equality in the intersection is made explicit in the result,
6262 while all inequalities that are redundant with respect to the intersection
6263 are removed.
6264 In case of union sets and relations, the gist operation is performed
6265 per space.
6267 When applied to a function,
6268 the gist operation applies the set gist operation to each of
6269 the cells in the domain of the input piecewise expression.
6270 The context is also exploited
6271 to simplify the expression associated to each cell.
6273         #include <isl/set.h>
6274         __isl_give isl_basic_set *isl_basic_set_gist(
6275                 __isl_take isl_basic_set *bset,
6276                 __isl_take isl_basic_set *context);
6277         __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
6278                 __isl_take isl_set *context);
6279         __isl_give isl_set *isl_set_gist_params(
6280                 __isl_take isl_set *set,
6281                 __isl_take isl_set *context);
6283         #include <isl/map.h>
6284         __isl_give isl_basic_map *isl_basic_map_gist(
6285                 __isl_take isl_basic_map *bmap,
6286                 __isl_take isl_basic_map *context);
6287         __isl_give isl_basic_map *isl_basic_map_gist_domain(
6288                 __isl_take isl_basic_map *bmap,
6289                 __isl_take isl_basic_set *context);
6290         __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
6291                 __isl_take isl_map *context);
6292         __isl_give isl_map *isl_map_gist_params(
6293                 __isl_take isl_map *map,
6294                 __isl_take isl_set *context);
6295         __isl_give isl_map *isl_map_gist_domain(
6296                 __isl_take isl_map *map,
6297                 __isl_take isl_set *context);
6298         __isl_give isl_map *isl_map_gist_range(
6299                 __isl_take isl_map *map,
6300                 __isl_take isl_set *context);
6302         #include <isl/union_set.h>
6303         __isl_give isl_union_set *isl_union_set_gist(
6304                 __isl_take isl_union_set *uset,
6305                 __isl_take isl_union_set *context);
6306         __isl_give isl_union_set *isl_union_set_gist_params(
6307                 __isl_take isl_union_set *uset,
6308                 __isl_take isl_set *set);
6310         #include <isl/union_map.h>
6311         __isl_give isl_union_map *isl_union_map_gist(
6312                 __isl_take isl_union_map *umap,
6313                 __isl_take isl_union_map *context);
6314         __isl_give isl_union_map *isl_union_map_gist_params(
6315                 __isl_take isl_union_map *umap,
6316                 __isl_take isl_set *set);
6317         __isl_give isl_union_map *isl_union_map_gist_domain(
6318                 __isl_take isl_union_map *umap,
6319                 __isl_take isl_union_set *uset);
6320         __isl_give isl_union_map *isl_union_map_gist_range(
6321                 __isl_take isl_union_map *umap,
6322                 __isl_take isl_union_set *uset);
6324         #include <isl/aff.h>
6325         __isl_give isl_aff *isl_aff_gist_params(
6326                 __isl_take isl_aff *aff,
6327                 __isl_take isl_set *context);
6328         __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
6329                 __isl_take isl_set *context);
6330         __isl_give isl_multi_aff *isl_multi_aff_gist_params(
6331                 __isl_take isl_multi_aff *maff,
6332                 __isl_take isl_set *context);
6333         __isl_give isl_multi_aff *isl_multi_aff_gist(
6334                 __isl_take isl_multi_aff *maff,
6335                 __isl_take isl_set *context);
6336         __isl_give isl_pw_aff *isl_pw_aff_gist_params(
6337                 __isl_take isl_pw_aff *pwaff,
6338                 __isl_take isl_set *context);
6339         __isl_give isl_pw_aff *isl_pw_aff_gist(
6340                 __isl_take isl_pw_aff *pwaff,
6341                 __isl_take isl_set *context);
6342         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
6343                 __isl_take isl_pw_multi_aff *pma,
6344                 __isl_take isl_set *set);
6345         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
6346                 __isl_take isl_pw_multi_aff *pma,
6347                 __isl_take isl_set *set);
6348         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
6349                 __isl_take isl_multi_pw_aff *mpa,
6350                 __isl_take isl_set *set);
6351         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
6352                 __isl_take isl_multi_pw_aff *mpa,
6353                 __isl_take isl_set *set);
6354         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
6355                 __isl_take isl_union_pw_aff *upa,
6356                 __isl_take isl_union_set *context);
6357         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
6358                 __isl_take isl_union_pw_aff *upa,
6359                 __isl_take isl_set *context);
6360         __isl_give isl_union_pw_multi_aff *
6361         isl_union_pw_multi_aff_gist_params(
6362                 __isl_take isl_union_pw_multi_aff *upma,
6363                 __isl_take isl_set *context);
6364         __isl_give isl_union_pw_multi_aff *
6365         isl_union_pw_multi_aff_gist(
6366                 __isl_take isl_union_pw_multi_aff *upma,
6367                 __isl_take isl_union_set *context);
6368         __isl_give isl_multi_union_pw_aff *
6369         isl_multi_union_pw_aff_gist_params(
6370                 __isl_take isl_multi_union_pw_aff *aff,
6371                 __isl_take isl_set *context);
6372         __isl_give isl_multi_union_pw_aff *
6373         isl_multi_union_pw_aff_gist(
6374                 __isl_take isl_multi_union_pw_aff *aff,
6375                 __isl_take isl_union_set *context);
6377         #include <isl/polynomial.h>
6378         __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
6379                 __isl_take isl_qpolynomial *qp,
6380                 __isl_take isl_set *context);
6381         __isl_give isl_qpolynomial *isl_qpolynomial_gist(
6382                 __isl_take isl_qpolynomial *qp,
6383                 __isl_take isl_set *context);
6384         __isl_give isl_qpolynomial_fold *
6385         isl_qpolynomial_fold_gist_params(
6386                 __isl_take isl_qpolynomial_fold *fold,
6387                 __isl_take isl_set *context);
6388         __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
6389                 __isl_take isl_qpolynomial_fold *fold,
6390                 __isl_take isl_set *context);
6391         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
6392                 __isl_take isl_pw_qpolynomial *pwqp,
6393                 __isl_take isl_set *context);
6394         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
6395                 __isl_take isl_pw_qpolynomial *pwqp,
6396                 __isl_take isl_set *context);
6397         __isl_give isl_pw_qpolynomial_fold *
6398         isl_pw_qpolynomial_fold_gist(
6399                 __isl_take isl_pw_qpolynomial_fold *pwf,
6400                 __isl_take isl_set *context);
6401         __isl_give isl_pw_qpolynomial_fold *
6402         isl_pw_qpolynomial_fold_gist_params(
6403                 __isl_take isl_pw_qpolynomial_fold *pwf,
6404                 __isl_take isl_set *context);
6405         __isl_give isl_union_pw_qpolynomial *
6406         isl_union_pw_qpolynomial_gist_params(
6407                 __isl_take isl_union_pw_qpolynomial *upwqp,
6408                 __isl_take isl_set *context);
6409         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
6410                 __isl_take isl_union_pw_qpolynomial *upwqp,
6411                 __isl_take isl_union_set *context);
6412         __isl_give isl_union_pw_qpolynomial_fold *
6413         isl_union_pw_qpolynomial_fold_gist(
6414                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6415                 __isl_take isl_union_set *context);
6416         __isl_give isl_union_pw_qpolynomial_fold *
6417         isl_union_pw_qpolynomial_fold_gist_params(
6418                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6419                 __isl_take isl_set *context);
6421 =item * Binary Arithmethic Operations
6423         #include <isl/val.h>
6424         __isl_give isl_multi_val *isl_multi_val_sub(
6425                 __isl_take isl_multi_val *mv1,
6426                 __isl_take isl_multi_val *mv2);
6428         #include <isl/aff.h>
6429         __isl_give isl_aff *isl_aff_add(
6430                 __isl_take isl_aff *aff1,
6431                 __isl_take isl_aff *aff2);
6432         __isl_give isl_multi_aff *isl_multi_aff_add(
6433                 __isl_take isl_multi_aff *maff1,
6434                 __isl_take isl_multi_aff *maff2);
6435         __isl_give isl_pw_aff *isl_pw_aff_add(
6436                 __isl_take isl_pw_aff *pwaff1,
6437                 __isl_take isl_pw_aff *pwaff2);
6438         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
6439                 __isl_take isl_pw_multi_aff *pma1,
6440                 __isl_take isl_pw_multi_aff *pma2);
6441         __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
6442                 __isl_take isl_union_pw_aff *upa1,
6443                 __isl_take isl_union_pw_aff *upa2);
6444         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
6445                 __isl_take isl_union_pw_multi_aff *upma1,
6446                 __isl_take isl_union_pw_multi_aff *upma2);
6447         __isl_give isl_pw_aff *isl_pw_aff_min(
6448                 __isl_take isl_pw_aff *pwaff1,
6449                 __isl_take isl_pw_aff *pwaff2);
6450         __isl_give isl_pw_aff *isl_pw_aff_max(
6451                 __isl_take isl_pw_aff *pwaff1,
6452                 __isl_take isl_pw_aff *pwaff2);
6453         __isl_give isl_aff *isl_aff_sub(
6454                 __isl_take isl_aff *aff1,
6455                 __isl_take isl_aff *aff2);
6456         __isl_give isl_multi_aff *isl_multi_aff_sub(
6457                 __isl_take isl_multi_aff *ma1,
6458                 __isl_take isl_multi_aff *ma2);
6459         __isl_give isl_pw_aff *isl_pw_aff_sub(
6460                 __isl_take isl_pw_aff *pwaff1,
6461                 __isl_take isl_pw_aff *pwaff2);
6462         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
6463                 __isl_take isl_multi_pw_aff *mpa1,
6464                 __isl_take isl_multi_pw_aff *mpa2);
6465         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
6466                 __isl_take isl_pw_multi_aff *pma1,
6467                 __isl_take isl_pw_multi_aff *pma2);
6468         __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
6469                 __isl_take isl_union_pw_aff *upa1,
6470                 __isl_take isl_union_pw_aff *upa2);
6471         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
6472                 __isl_take isl_union_pw_multi_aff *upma1,
6473                 __isl_take isl_union_pw_multi_aff *upma2);
6474         __isl_give isl_multi_union_pw_aff *
6475         isl_multi_union_pw_aff_sub(
6476                 __isl_take isl_multi_union_pw_aff *mupa1,
6477                 __isl_take isl_multi_union_pw_aff *mupa2);
6479 C<isl_aff_sub> subtracts the second argument from the first.
6481         #include <isl/polynomial.h>
6482         __isl_give isl_qpolynomial *isl_qpolynomial_add(
6483                 __isl_take isl_qpolynomial *qp1,
6484                 __isl_take isl_qpolynomial *qp2);
6485         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
6486                 __isl_take isl_pw_qpolynomial *pwqp1,
6487                 __isl_take isl_pw_qpolynomial *pwqp2);
6488         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
6489                 __isl_take isl_pw_qpolynomial *pwqp1,
6490                 __isl_take isl_pw_qpolynomial *pwqp2);
6491         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
6492                 __isl_take isl_pw_qpolynomial_fold *pwf1,
6493                 __isl_take isl_pw_qpolynomial_fold *pwf2);
6494         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
6495                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6496                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6497         __isl_give isl_qpolynomial *isl_qpolynomial_sub(
6498                 __isl_take isl_qpolynomial *qp1,
6499                 __isl_take isl_qpolynomial *qp2);
6500         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
6501                 __isl_take isl_pw_qpolynomial *pwqp1,
6502                 __isl_take isl_pw_qpolynomial *pwqp2);
6503         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
6504                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6505                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6506         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
6507                 __isl_take isl_pw_qpolynomial_fold *pwf1,
6508                 __isl_take isl_pw_qpolynomial_fold *pwf2);
6509         __isl_give isl_union_pw_qpolynomial_fold *
6510         isl_union_pw_qpolynomial_fold_fold(
6511                 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
6512                 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
6514         #include <isl/aff.h>
6515         __isl_give isl_pw_aff *isl_pw_aff_union_add(
6516                 __isl_take isl_pw_aff *pwaff1,
6517                 __isl_take isl_pw_aff *pwaff2);
6518         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
6519                 __isl_take isl_pw_multi_aff *pma1,
6520                 __isl_take isl_pw_multi_aff *pma2);
6521         __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
6522                 __isl_take isl_union_pw_aff *upa1,
6523                 __isl_take isl_union_pw_aff *upa2);
6524         __isl_give isl_union_pw_multi_aff *
6525         isl_union_pw_multi_aff_union_add(
6526                 __isl_take isl_union_pw_multi_aff *upma1,
6527                 __isl_take isl_union_pw_multi_aff *upma2);
6528         __isl_give isl_multi_union_pw_aff *
6529         isl_multi_union_pw_aff_union_add(
6530                 __isl_take isl_multi_union_pw_aff *mupa1,
6531                 __isl_take isl_multi_union_pw_aff *mupa2);
6532         __isl_give isl_pw_aff *isl_pw_aff_union_min(
6533                 __isl_take isl_pw_aff *pwaff1,
6534                 __isl_take isl_pw_aff *pwaff2);
6535         __isl_give isl_pw_aff *isl_pw_aff_union_max(
6536                 __isl_take isl_pw_aff *pwaff1,
6537                 __isl_take isl_pw_aff *pwaff2);
6539 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
6540 expression with a domain that is the union of those of C<pwaff1> and
6541 C<pwaff2> and such that on each cell, the quasi-affine expression is
6542 the maximum of those of C<pwaff1> and C<pwaff2>.  If only one of
6543 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
6544 associated expression is the defined one.
6545 This in contrast to the C<isl_pw_aff_max> function, which is
6546 only defined on the shared definition domain of the arguments.
6548         #include <isl/val.h>
6549         __isl_give isl_multi_val *isl_multi_val_add_val(
6550                 __isl_take isl_multi_val *mv,
6551                 __isl_take isl_val *v);
6552         __isl_give isl_multi_val *isl_multi_val_mod_val(
6553                 __isl_take isl_multi_val *mv,
6554                 __isl_take isl_val *v);
6555         __isl_give isl_multi_val *isl_multi_val_scale_val(
6556                 __isl_take isl_multi_val *mv,
6557                 __isl_take isl_val *v);
6558         __isl_give isl_multi_val *isl_multi_val_scale_down_val(
6559                 __isl_take isl_multi_val *mv,
6560                 __isl_take isl_val *v);
6562         #include <isl/aff.h>
6563         __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
6564                 __isl_take isl_val *mod);
6565         __isl_give isl_pw_aff *isl_pw_aff_mod_val(
6566                 __isl_take isl_pw_aff *pa,
6567                 __isl_take isl_val *mod);
6568         __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
6569                 __isl_take isl_union_pw_aff *upa,
6570                 __isl_take isl_val *f);
6571         __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
6572                 __isl_take isl_val *v);
6573         __isl_give isl_multi_aff *isl_multi_aff_scale_val(
6574                 __isl_take isl_multi_aff *ma,
6575                 __isl_take isl_val *v);
6576         __isl_give isl_pw_aff *isl_pw_aff_scale_val(
6577                 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
6578         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
6579                 __isl_take isl_multi_pw_aff *mpa,
6580                 __isl_take isl_val *v);
6581         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
6582                 __isl_take isl_pw_multi_aff *pma,
6583                 __isl_take isl_val *v);
6584         __isl_give isl_union_pw_multi_aff *
6585         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
6586                 __isl_take isl_union_pw_aff *upa,
6587                 __isl_take isl_val *f);
6588         isl_union_pw_multi_aff_scale_val(
6589                 __isl_take isl_union_pw_multi_aff *upma,
6590                 __isl_take isl_val *val);
6591         __isl_give isl_multi_union_pw_aff *
6592         isl_multi_union_pw_aff_scale_val(
6593                 __isl_take isl_multi_union_pw_aff *mupa,
6594                 __isl_take isl_val *v);
6595         __isl_give isl_aff *isl_aff_scale_down_ui(
6596                 __isl_take isl_aff *aff, unsigned f);
6597         __isl_give isl_aff *isl_aff_scale_down_val(
6598                 __isl_take isl_aff *aff, __isl_take isl_val *v);
6599         __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
6600                 __isl_take isl_multi_aff *ma,
6601                 __isl_take isl_val *v);
6602         __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
6603                 __isl_take isl_pw_aff *pa,
6604                 __isl_take isl_val *f);
6605         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
6606                 __isl_take isl_multi_pw_aff *mpa,
6607                 __isl_take isl_val *v);
6608         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
6609                 __isl_take isl_pw_multi_aff *pma,
6610                 __isl_take isl_val *v);
6611         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
6612                 __isl_take isl_union_pw_aff *upa,
6613                 __isl_take isl_val *v);
6614         __isl_give isl_union_pw_multi_aff *
6615         isl_union_pw_multi_aff_scale_down_val(
6616                 __isl_take isl_union_pw_multi_aff *upma,
6617                 __isl_take isl_val *val);
6618         __isl_give isl_multi_union_pw_aff *
6619         isl_multi_union_pw_aff_scale_down_val(
6620                 __isl_take isl_multi_union_pw_aff *mupa,
6621                 __isl_take isl_val *v);
6623         #include <isl/polynomial.h>
6624         __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
6625                 __isl_take isl_qpolynomial *qp,
6626                 __isl_take isl_val *v);
6627         __isl_give isl_qpolynomial_fold *
6628         isl_qpolynomial_fold_scale_val(
6629                 __isl_take isl_qpolynomial_fold *fold,
6630                 __isl_take isl_val *v);
6631         __isl_give isl_pw_qpolynomial *
6632         isl_pw_qpolynomial_scale_val(
6633                 __isl_take isl_pw_qpolynomial *pwqp,
6634                 __isl_take isl_val *v);
6635         __isl_give isl_pw_qpolynomial_fold *
6636         isl_pw_qpolynomial_fold_scale_val(
6637                 __isl_take isl_pw_qpolynomial_fold *pwf,
6638                 __isl_take isl_val *v);
6639         __isl_give isl_union_pw_qpolynomial *
6640         isl_union_pw_qpolynomial_scale_val(
6641                 __isl_take isl_union_pw_qpolynomial *upwqp,
6642                 __isl_take isl_val *v);
6643         __isl_give isl_union_pw_qpolynomial_fold *
6644         isl_union_pw_qpolynomial_fold_scale_val(
6645                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6646                 __isl_take isl_val *v);
6647         __isl_give isl_qpolynomial *
6648         isl_qpolynomial_scale_down_val(
6649                 __isl_take isl_qpolynomial *qp,
6650                 __isl_take isl_val *v);
6651         __isl_give isl_qpolynomial_fold *
6652         isl_qpolynomial_fold_scale_down_val(
6653                 __isl_take isl_qpolynomial_fold *fold,
6654                 __isl_take isl_val *v);
6655         __isl_give isl_pw_qpolynomial *
6656         isl_pw_qpolynomial_scale_down_val(
6657                 __isl_take isl_pw_qpolynomial *pwqp,
6658                 __isl_take isl_val *v);
6659         __isl_give isl_pw_qpolynomial_fold *
6660         isl_pw_qpolynomial_fold_scale_down_val(
6661                 __isl_take isl_pw_qpolynomial_fold *pwf,
6662                 __isl_take isl_val *v);
6663         __isl_give isl_union_pw_qpolynomial *
6664         isl_union_pw_qpolynomial_scale_down_val(
6665                 __isl_take isl_union_pw_qpolynomial *upwqp,
6666                 __isl_take isl_val *v);
6667         __isl_give isl_union_pw_qpolynomial_fold *
6668         isl_union_pw_qpolynomial_fold_scale_down_val(
6669                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6670                 __isl_take isl_val *v);
6672         #include <isl/val.h>
6673         __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
6674                 __isl_take isl_multi_val *mv1,
6675                 __isl_take isl_multi_val *mv2);
6676         __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
6677                 __isl_take isl_multi_val *mv1,
6678                 __isl_take isl_multi_val *mv2);
6679         __isl_give isl_multi_val *
6680         isl_multi_val_scale_down_multi_val(
6681                 __isl_take isl_multi_val *mv1,
6682                 __isl_take isl_multi_val *mv2);
6684         #include <isl/aff.h>
6685         __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
6686                 __isl_take isl_multi_aff *ma,
6687                 __isl_take isl_multi_val *mv);
6688         __isl_give isl_multi_union_pw_aff *
6689         isl_multi_union_pw_aff_mod_multi_val(
6690                 __isl_take isl_multi_union_pw_aff *upma,
6691                 __isl_take isl_multi_val *mv);
6692         __isl_give isl_multi_pw_aff *
6693         isl_multi_pw_aff_mod_multi_val(
6694                 __isl_take isl_multi_pw_aff *mpa,
6695                 __isl_take isl_multi_val *mv);
6696         __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
6697                 __isl_take isl_multi_aff *ma,
6698                 __isl_take isl_multi_val *mv);
6699         __isl_give isl_pw_multi_aff *
6700         isl_pw_multi_aff_scale_multi_val(
6701                 __isl_take isl_pw_multi_aff *pma,
6702                 __isl_take isl_multi_val *mv);
6703         __isl_give isl_multi_pw_aff *
6704         isl_multi_pw_aff_scale_multi_val(
6705                 __isl_take isl_multi_pw_aff *mpa,
6706                 __isl_take isl_multi_val *mv);
6707         __isl_give isl_multi_union_pw_aff *
6708         isl_multi_union_pw_aff_scale_multi_val(
6709                 __isl_take isl_multi_union_pw_aff *mupa,
6710                 __isl_take isl_multi_val *mv);
6711         __isl_give isl_union_pw_multi_aff *
6712         isl_union_pw_multi_aff_scale_multi_val(
6713                 __isl_take isl_union_pw_multi_aff *upma,
6714                 __isl_take isl_multi_val *mv);
6715         __isl_give isl_multi_aff *
6716         isl_multi_aff_scale_down_multi_val(
6717                 __isl_take isl_multi_aff *ma,
6718                 __isl_take isl_multi_val *mv);
6719         __isl_give isl_multi_pw_aff *
6720         isl_multi_pw_aff_scale_down_multi_val(
6721                 __isl_take isl_multi_pw_aff *mpa,
6722                 __isl_take isl_multi_val *mv);
6723         __isl_give isl_multi_union_pw_aff *
6724         isl_multi_union_pw_aff_scale_down_multi_val(
6725                 __isl_take isl_multi_union_pw_aff *mupa,
6726                 __isl_take isl_multi_val *mv);
6728 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
6729 by the corresponding elements of C<mv>.
6731         #include <isl/aff.h>
6732         __isl_give isl_aff *isl_aff_mul(
6733                 __isl_take isl_aff *aff1,
6734                 __isl_take isl_aff *aff2);
6735         __isl_give isl_aff *isl_aff_div(
6736                 __isl_take isl_aff *aff1,
6737                 __isl_take isl_aff *aff2);
6738         __isl_give isl_pw_aff *isl_pw_aff_mul(
6739                 __isl_take isl_pw_aff *pwaff1,
6740                 __isl_take isl_pw_aff *pwaff2);
6741         __isl_give isl_pw_aff *isl_pw_aff_div(
6742                 __isl_take isl_pw_aff *pa1,
6743                 __isl_take isl_pw_aff *pa2);
6744         __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
6745                 __isl_take isl_pw_aff *pa1,
6746                 __isl_take isl_pw_aff *pa2);
6747         __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
6748                 __isl_take isl_pw_aff *pa1,
6749                 __isl_take isl_pw_aff *pa2);
6751 When multiplying two affine expressions, at least one of the two needs
6752 to be a constant.  Similarly, when dividing an affine expression by another,
6753 the second expression needs to be a constant.
6754 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
6755 rounding towards zero.  C<isl_pw_aff_tdiv_r> computes the corresponding
6756 remainder.
6758         #include <isl/polynomial.h>
6759         __isl_give isl_qpolynomial *isl_qpolynomial_mul(
6760                 __isl_take isl_qpolynomial *qp1,
6761                 __isl_take isl_qpolynomial *qp2);
6762         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
6763                 __isl_take isl_pw_qpolynomial *pwqp1,
6764                 __isl_take isl_pw_qpolynomial *pwqp2);
6765         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
6766                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6767                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6769 =back
6771 =head3 Lexicographic Optimization
6773 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
6774 the following functions
6775 compute a set that contains the lexicographic minimum or maximum
6776 of the elements in C<set> (or C<bset>) for those values of the parameters
6777 that satisfy C<dom>.
6778 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6779 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
6780 has no elements.
6781 In other words, the union of the parameter values
6782 for which the result is non-empty and of C<*empty>
6783 is equal to C<dom>.
6785         #include <isl/set.h>
6786         __isl_give isl_set *isl_basic_set_partial_lexmin(
6787                 __isl_take isl_basic_set *bset,
6788                 __isl_take isl_basic_set *dom,
6789                 __isl_give isl_set **empty);
6790         __isl_give isl_set *isl_basic_set_partial_lexmax(
6791                 __isl_take isl_basic_set *bset,
6792                 __isl_take isl_basic_set *dom,
6793                 __isl_give isl_set **empty);
6794         __isl_give isl_set *isl_set_partial_lexmin(
6795                 __isl_take isl_set *set, __isl_take isl_set *dom,
6796                 __isl_give isl_set **empty);
6797         __isl_give isl_set *isl_set_partial_lexmax(
6798                 __isl_take isl_set *set, __isl_take isl_set *dom,
6799                 __isl_give isl_set **empty);
6801 Given a (basic) set C<set> (or C<bset>), the following functions simply
6802 return a set containing the lexicographic minimum or maximum
6803 of the elements in C<set> (or C<bset>).
6804 In case of union sets, the optimum is computed per space.
6806         #include <isl/set.h>
6807         __isl_give isl_set *isl_basic_set_lexmin(
6808                 __isl_take isl_basic_set *bset);
6809         __isl_give isl_set *isl_basic_set_lexmax(
6810                 __isl_take isl_basic_set *bset);
6811         __isl_give isl_set *isl_set_lexmin(
6812                 __isl_take isl_set *set);
6813         __isl_give isl_set *isl_set_lexmax(
6814                 __isl_take isl_set *set);
6815         __isl_give isl_union_set *isl_union_set_lexmin(
6816                 __isl_take isl_union_set *uset);
6817         __isl_give isl_union_set *isl_union_set_lexmax(
6818                 __isl_take isl_union_set *uset);
6820 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
6821 the following functions
6822 compute a relation that maps each element of C<dom>
6823 to the single lexicographic minimum or maximum
6824 of the elements that are associated to that same
6825 element in C<map> (or C<bmap>).
6826 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6827 that contains the elements in C<dom> that do not map
6828 to any elements in C<map> (or C<bmap>).
6829 In other words, the union of the domain of the result and of C<*empty>
6830 is equal to C<dom>.
6832         #include <isl/map.h>
6833         __isl_give isl_map *isl_basic_map_partial_lexmax(
6834                 __isl_take isl_basic_map *bmap,
6835                 __isl_take isl_basic_set *dom,
6836                 __isl_give isl_set **empty);
6837         __isl_give isl_map *isl_basic_map_partial_lexmin(
6838                 __isl_take isl_basic_map *bmap,
6839                 __isl_take isl_basic_set *dom,
6840                 __isl_give isl_set **empty);
6841         __isl_give isl_map *isl_map_partial_lexmax(
6842                 __isl_take isl_map *map, __isl_take isl_set *dom,
6843                 __isl_give isl_set **empty);
6844         __isl_give isl_map *isl_map_partial_lexmin(
6845                 __isl_take isl_map *map, __isl_take isl_set *dom,
6846                 __isl_give isl_set **empty);
6848 Given a (basic) map C<map> (or C<bmap>), the following functions simply
6849 return a map mapping each element in the domain of
6850 C<map> (or C<bmap>) to the lexicographic minimum or maximum
6851 of all elements associated to that element.
6852 In case of union relations, the optimum is computed per space.
6854         #include <isl/map.h>
6855         __isl_give isl_map *isl_basic_map_lexmin(
6856                 __isl_take isl_basic_map *bmap);
6857         __isl_give isl_map *isl_basic_map_lexmax(
6858                 __isl_take isl_basic_map *bmap);
6859         __isl_give isl_map *isl_map_lexmin(
6860                 __isl_take isl_map *map);
6861         __isl_give isl_map *isl_map_lexmax(
6862                 __isl_take isl_map *map);
6863         __isl_give isl_union_map *isl_union_map_lexmin(
6864                 __isl_take isl_union_map *umap);
6865         __isl_give isl_union_map *isl_union_map_lexmax(
6866                 __isl_take isl_union_map *umap);
6868 The following functions return their result in the form of
6869 a piecewise multi-affine expression,
6870 but are otherwise equivalent to the corresponding functions
6871 returning a basic set or relation.
6873         #include <isl/set.h>
6874         __isl_give isl_pw_multi_aff *
6875         isl_basic_set_partial_lexmin_pw_multi_aff(
6876                 __isl_take isl_basic_set *bset,
6877                 __isl_take isl_basic_set *dom,
6878                 __isl_give isl_set **empty);
6879         __isl_give isl_pw_multi_aff *
6880         isl_basic_set_partial_lexmax_pw_multi_aff(
6881                 __isl_take isl_basic_set *bset,
6882                 __isl_take isl_basic_set *dom,
6883                 __isl_give isl_set **empty);
6884         __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
6885                 __isl_take isl_set *set);
6886         __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
6887                 __isl_take isl_set *set);
6889         #include <isl/map.h>
6890         __isl_give isl_pw_multi_aff *
6891         isl_basic_map_lexmin_pw_multi_aff(
6892                 __isl_take isl_basic_map *bmap);
6893         __isl_give isl_pw_multi_aff *
6894         isl_basic_map_partial_lexmin_pw_multi_aff(
6895                 __isl_take isl_basic_map *bmap,
6896                 __isl_take isl_basic_set *dom,
6897                 __isl_give isl_set **empty);
6898         __isl_give isl_pw_multi_aff *
6899         isl_basic_map_partial_lexmax_pw_multi_aff(
6900                 __isl_take isl_basic_map *bmap,
6901                 __isl_take isl_basic_set *dom,
6902                 __isl_give isl_set **empty);
6903         __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
6904                 __isl_take isl_map *map);
6905         __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
6906                 __isl_take isl_map *map);
6908 The following functions return the lexicographic minimum or maximum
6909 on the shared domain of the inputs and the single defined function
6910 on those parts of the domain where only a single function is defined.
6912         #include <isl/aff.h>
6913         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
6914                 __isl_take isl_pw_multi_aff *pma1,
6915                 __isl_take isl_pw_multi_aff *pma2);
6916         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
6917                 __isl_take isl_pw_multi_aff *pma1,
6918                 __isl_take isl_pw_multi_aff *pma2);
6920 =head2 Ternary Operations
6922         #include <isl/aff.h>
6923         __isl_give isl_pw_aff *isl_pw_aff_cond(
6924                 __isl_take isl_pw_aff *cond,
6925                 __isl_take isl_pw_aff *pwaff_true,
6926                 __isl_take isl_pw_aff *pwaff_false);
6928 The function C<isl_pw_aff_cond> performs a conditional operator
6929 and returns an expression that is equal to C<pwaff_true>
6930 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
6931 where C<cond> is zero.
6933 =head2 Lists
6935 Lists are defined over several element types, including
6936 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_union_pw_aff>,
6937 C<isl_union_pw_multi_aff>, C<isl_constraint>,
6938 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
6939 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
6940 Here we take lists of C<isl_set>s as an example.
6941 Lists can be created, copied, modified and freed using the following functions.
6943         #include <isl/set.h>
6944         __isl_give isl_set_list *isl_set_list_from_set(
6945                 __isl_take isl_set *el);
6946         __isl_give isl_set_list *isl_set_list_alloc(
6947                 isl_ctx *ctx, int n);
6948         __isl_give isl_set_list *isl_set_list_copy(
6949                 __isl_keep isl_set_list *list);
6950         __isl_give isl_set_list *isl_set_list_insert(
6951                 __isl_take isl_set_list *list, unsigned pos,
6952                 __isl_take isl_set *el);
6953         __isl_give isl_set_list *isl_set_list_add(
6954                 __isl_take isl_set_list *list,
6955                 __isl_take isl_set *el);
6956         __isl_give isl_set_list *isl_set_list_drop(
6957                 __isl_take isl_set_list *list,
6958                 unsigned first, unsigned n);
6959         __isl_give isl_set_list *isl_set_list_set_set(
6960                 __isl_take isl_set_list *list, int index,
6961                 __isl_take isl_set *set);
6962         __isl_give isl_set_list *isl_set_list_concat(
6963                 __isl_take isl_set_list *list1,
6964                 __isl_take isl_set_list *list2);
6965         __isl_give isl_set_list *isl_set_list_sort(
6966                 __isl_take isl_set_list *list,
6967                 int (*cmp)(__isl_keep isl_set *a,
6968                         __isl_keep isl_set *b, void *user),
6969                 void *user);
6970         __isl_null isl_set_list *isl_set_list_free(
6971                 __isl_take isl_set_list *list);
6973 C<isl_set_list_alloc> creates an empty list with an initial capacity
6974 for C<n> elements.  C<isl_set_list_insert> and C<isl_set_list_add>
6975 add elements to a list, increasing its capacity as needed.
6976 C<isl_set_list_from_set> creates a list with a single element.
6978 Lists can be inspected using the following functions.
6980         #include <isl/set.h>
6981         int isl_set_list_n_set(__isl_keep isl_set_list *list);
6982         __isl_give isl_set *isl_set_list_get_set(
6983                 __isl_keep isl_set_list *list, int index);
6984         int isl_set_list_foreach(__isl_keep isl_set_list *list,
6985                 int (*fn)(__isl_take isl_set *el, void *user),
6986                 void *user);
6987         int isl_set_list_foreach_scc(__isl_keep isl_set_list *list,
6988                 int (*follows)(__isl_keep isl_set *a,
6989                         __isl_keep isl_set *b, void *user),
6990                 void *follows_user
6991                 int (*fn)(__isl_take isl_set *el, void *user),
6992                 void *fn_user);
6994 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
6995 strongly connected components of the graph with as vertices the elements
6996 of C<list> and a directed edge from vertex C<b> to vertex C<a>
6997 iff C<follows(a, b)> returns C<1>.  The callbacks C<follows> and C<fn>
6998 should return C<-1> on error.
7000 Lists can be printed using
7002         #include <isl/set.h>
7003         __isl_give isl_printer *isl_printer_print_set_list(
7004                 __isl_take isl_printer *p,
7005                 __isl_keep isl_set_list *list);
7007 =head2 Associative arrays
7009 Associative arrays map isl objects of a specific type to isl objects
7010 of some (other) specific type.  They are defined for several pairs
7011 of types, including (C<isl_map>, C<isl_basic_set>),
7012 (C<isl_id>, C<isl_ast_expr>) and.
7013 (C<isl_id>, C<isl_pw_aff>).
7014 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
7015 as an example.
7017 Associative arrays can be created, copied and freed using
7018 the following functions.
7020         #include <isl/id_to_ast_expr.h>
7021         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
7022                 isl_ctx *ctx, int min_size);
7023         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
7024                 __isl_keep isl_id_to_ast_expr *id2expr);
7025         __isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
7026                 __isl_take isl_id_to_ast_expr *id2expr);
7028 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
7029 to specify the expected size of the associative array.
7030 The associative array will be grown automatically as needed.
7032 Associative arrays can be inspected using the following functions.
7034         #include <isl/id_to_ast_expr.h>
7035         int isl_id_to_ast_expr_has(
7036                 __isl_keep isl_id_to_ast_expr *id2expr,
7037                 __isl_keep isl_id *key);
7038         __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
7039                 __isl_keep isl_id_to_ast_expr *id2expr,
7040                 __isl_take isl_id *key);
7041         int isl_id_to_ast_expr_foreach(
7042                 __isl_keep isl_id_to_ast_expr *id2expr,
7043                 int (*fn)(__isl_take isl_id *key,
7044                         __isl_take isl_ast_expr *val, void *user),
7045                 void *user);
7047 They can be modified using the following function.
7049         #include <isl/id_to_ast_expr.h>
7050         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
7051                 __isl_take isl_id_to_ast_expr *id2expr,
7052                 __isl_take isl_id *key,
7053                 __isl_take isl_ast_expr *val);
7054         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
7055                 __isl_take isl_id_to_ast_expr *id2expr,
7056                 __isl_take isl_id *key);
7058 Associative arrays can be printed using the following function.
7060         #include <isl/id_to_ast_expr.h>
7061         __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
7062                 __isl_take isl_printer *p,
7063                 __isl_keep isl_id_to_ast_expr *id2expr);
7065 =head2 Vectors
7067 Vectors can be created, copied and freed using the following functions.
7069         #include <isl/vec.h>
7070         __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
7071                 unsigned size);
7072         __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
7073         __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
7075 Note that the elements of a newly created vector may have arbitrary values.
7076 The elements can be changed and inspected using the following functions.
7078         int isl_vec_size(__isl_keep isl_vec *vec);
7079         __isl_give isl_val *isl_vec_get_element_val(
7080                 __isl_keep isl_vec *vec, int pos);
7081         __isl_give isl_vec *isl_vec_set_element_si(
7082                 __isl_take isl_vec *vec, int pos, int v);
7083         __isl_give isl_vec *isl_vec_set_element_val(
7084                 __isl_take isl_vec *vec, int pos,
7085                 __isl_take isl_val *v);
7086         __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
7087                 int v);
7088         __isl_give isl_vec *isl_vec_set_val(
7089                 __isl_take isl_vec *vec, __isl_take isl_val *v);
7090         int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
7091                 __isl_keep isl_vec *vec2, int pos);
7093 C<isl_vec_get_element> will return a negative value if anything went wrong.
7094 In that case, the value of C<*v> is undefined.
7096 The following function can be used to concatenate two vectors.
7098         __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
7099                 __isl_take isl_vec *vec2);
7101 =head2 Matrices
7103 Matrices can be created, copied and freed using the following functions.
7105         #include <isl/mat.h>
7106         __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
7107                 unsigned n_row, unsigned n_col);
7108         __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
7109         __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
7111 Note that the elements of a newly created matrix may have arbitrary values.
7112 The elements can be changed and inspected using the following functions.
7114         int isl_mat_rows(__isl_keep isl_mat *mat);
7115         int isl_mat_cols(__isl_keep isl_mat *mat);
7116         __isl_give isl_val *isl_mat_get_element_val(
7117                 __isl_keep isl_mat *mat, int row, int col);
7118         __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
7119                 int row, int col, int v);
7120         __isl_give isl_mat *isl_mat_set_element_val(
7121                 __isl_take isl_mat *mat, int row, int col,
7122                 __isl_take isl_val *v);
7124 C<isl_mat_get_element> will return a negative value if anything went wrong.
7125 In that case, the value of C<*v> is undefined.
7127 The following function can be used to compute the (right) inverse
7128 of a matrix, i.e., a matrix such that the product of the original
7129 and the inverse (in that order) is a multiple of the identity matrix.
7130 The input matrix is assumed to be of full row-rank.
7132         __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
7134 The following function can be used to compute the (right) kernel
7135 (or null space) of a matrix, i.e., a matrix such that the product of
7136 the original and the kernel (in that order) is the zero matrix.
7138         __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
7140 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
7142 The following functions determine
7143 an upper or lower bound on a quasipolynomial over its domain.
7145         __isl_give isl_pw_qpolynomial_fold *
7146         isl_pw_qpolynomial_bound(
7147                 __isl_take isl_pw_qpolynomial *pwqp,
7148                 enum isl_fold type, int *tight);
7150         __isl_give isl_union_pw_qpolynomial_fold *
7151         isl_union_pw_qpolynomial_bound(
7152                 __isl_take isl_union_pw_qpolynomial *upwqp,
7153                 enum isl_fold type, int *tight);
7155 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
7156 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
7157 is the returned bound is known be tight, i.e., for each value
7158 of the parameters there is at least
7159 one element in the domain that reaches the bound.
7160 If the domain of C<pwqp> is not wrapping, then the bound is computed
7161 over all elements in that domain and the result has a purely parametric
7162 domain.  If the domain of C<pwqp> is wrapping, then the bound is
7163 computed over the range of the wrapped relation.  The domain of the
7164 wrapped relation becomes the domain of the result.
7166 =head2 Parametric Vertex Enumeration
7168 The parametric vertex enumeration described in this section
7169 is mainly intended to be used internally and by the C<barvinok>
7170 library.
7172         #include <isl/vertices.h>
7173         __isl_give isl_vertices *isl_basic_set_compute_vertices(
7174                 __isl_keep isl_basic_set *bset);
7176 The function C<isl_basic_set_compute_vertices> performs the
7177 actual computation of the parametric vertices and the chamber
7178 decomposition and store the result in an C<isl_vertices> object.
7179 This information can be queried by either iterating over all
7180 the vertices or iterating over all the chambers or cells
7181 and then iterating over all vertices that are active on the chamber.
7183         int isl_vertices_foreach_vertex(
7184                 __isl_keep isl_vertices *vertices,
7185                 int (*fn)(__isl_take isl_vertex *vertex, void *user),
7186                 void *user);
7188         int isl_vertices_foreach_cell(
7189                 __isl_keep isl_vertices *vertices,
7190                 int (*fn)(__isl_take isl_cell *cell, void *user),
7191                 void *user);
7192         int isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
7193                 int (*fn)(__isl_take isl_vertex *vertex, void *user),
7194                 void *user);
7196 Other operations that can be performed on an C<isl_vertices> object are
7197 the following.
7199         int isl_vertices_get_n_vertices(
7200                 __isl_keep isl_vertices *vertices);
7201         void isl_vertices_free(__isl_take isl_vertices *vertices);
7203 Vertices can be inspected and destroyed using the following functions.
7205         int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
7206         __isl_give isl_basic_set *isl_vertex_get_domain(
7207                 __isl_keep isl_vertex *vertex);
7208         __isl_give isl_multi_aff *isl_vertex_get_expr(
7209                 __isl_keep isl_vertex *vertex);
7210         void isl_vertex_free(__isl_take isl_vertex *vertex);
7212 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
7213 describing the vertex in terms of the parameters,
7214 while C<isl_vertex_get_domain> returns the activity domain
7215 of the vertex.
7217 Chambers can be inspected and destroyed using the following functions.
7219         __isl_give isl_basic_set *isl_cell_get_domain(
7220                 __isl_keep isl_cell *cell);
7221         void isl_cell_free(__isl_take isl_cell *cell);
7223 =head1 Polyhedral Compilation Library
7225 This section collects functionality in C<isl> that has been specifically
7226 designed for use during polyhedral compilation.
7228 =head2 Schedule Trees
7230 A schedule tree is a structured representation of a schedule,
7231 assigning a relative order to a set of domain elements.
7232 The relative order expressed by the schedule tree is
7233 defined recursively.  In particular, the order between
7234 two domain elements is determined by the node that is closest
7235 to the root that refers to both elements and that orders them apart.
7236 Each node in the tree is of one of several types.
7237 The root node is always of type C<isl_schedule_node_domain>
7238 (or C<isl_schedule_node_extension>)
7239 and it describes the (extra) domain elements to which the schedule applies.
7240 The other types of nodes are as follows.
7242 =over
7244 =item C<isl_schedule_node_band>
7246 A band of schedule dimensions.  Each schedule dimension is represented
7247 by a union piecewise quasi-affine expression.  If this expression
7248 assigns a different value to two domain elements, while all previous
7249 schedule dimensions in the same band assign them the same value,
7250 then the two domain elements are ordered according to these two
7251 different values.
7253 =item C<isl_schedule_node_expansion>
7255 An expansion node maps each of the domain elements that reach the node
7256 to one or more domain elements.  The image of this mapping forms
7257 the set of domain elements that reach the child of the expansion node.
7258 The function that maps each of the expanded domain elements
7259 to the original domain element from which it was expanded
7260 is called the contraction.
7262 =item C<isl_schedule_node_filter>
7264 A filter node does not impose any ordering, but rather intersects
7265 the set of domain elements that the current subtree refers to
7266 with a given union set.  The subtree of the filter node only
7267 refers to domain elements in the intersection.
7268 A filter node is typically only used a child of a sequence or
7269 set node.
7271 =item C<isl_schedule_node_leaf>
7273 A leaf of the schedule tree.  Leaf nodes do not impose any ordering.
7275 =item C<isl_schedule_node_mark>
7277 A mark node can be used to attach any kind of information to a subtree
7278 of the schedule tree.
7280 =item C<isl_schedule_node_sequence>
7282 A sequence node has one or more children, each of which is a filter node.
7283 The filters on these filter nodes form a partition of
7284 the domain elements that the current subtree refers to.
7285 If two domain elements appear in distinct filters then the sequence
7286 node orders them according to the child positions of the corresponding
7287 filter nodes.
7289 =item C<isl_schedule_node_set>
7291 A set node is similar to a sequence node, except that
7292 it expresses that domain elements appearing in distinct filters
7293 may have any order.  The order of the children of a set node
7294 is therefore also immaterial.
7296 =back
7298 The following node types are only supported by the AST generator.
7300 =over
7302 =item C<isl_schedule_node_context>
7304 The context describes constraints on the parameters and
7305 the schedule dimensions of outer
7306 bands that the AST generator may assume to hold.  It is also the only
7307 kind of node that may introduce additional parameters.
7308 The space of the context is that of the flat product of the outer
7309 band nodes.  In particular, if there are no outer band nodes, then
7310 this space is the unnamed zero-dimensional space.
7311 Since a context node references the outer band nodes, any tree
7312 containing a context node is considered to be anchored.
7314 =item C<isl_schedule_node_extension>
7316 An extension node instructs the AST generator to add additional
7317 domain elements that need to be scheduled.
7318 The additional domain elements are described by the range of
7319 the extension map in terms of the outer schedule dimensions,
7320 i.e., the flat product of the outer band nodes.
7321 Note that domain elements are added whenever the AST generator
7322 reaches the extension node, meaning that there are still some
7323 active domain elements for which an AST needs to be generated.
7324 The conditions under which some domain elements are still active
7325 may however not be completely described by the outer AST nodes
7326 generated at that point.
7328 An extension node may also appear as the root of a schedule tree,
7329 when it is intended to be inserted into another tree.
7330 In this case, the domain of the extension node should
7331 correspond to the flat product of the outer band nodes
7332 in this other schedule tree at the point where the extension tree
7333 will be inserted.
7335 =item C<isl_schedule_node_guard>
7337 The guard describes constraints on the parameters and
7338 the schedule dimensions of outer
7339 bands that need to be enforced by the outer nodes
7340 in the generated AST.
7341 The space of the guard is that of the flat product of the outer
7342 band nodes.  In particular, if there are no outer band nodes, then
7343 this space is the unnamed zero-dimensional space.
7344 Since a guard node references the outer band nodes, any tree
7345 containing a guard node is considered to be anchored.
7347 =back
7349 Except for the C<isl_schedule_node_context> nodes,
7350 none of the nodes may introduce any parameters that were not
7351 already present in the root domain node.
7353 A schedule tree is encapsulated in an C<isl_schedule> object.
7354 The simplest such objects, those with a tree consisting of single domain node,
7355 can be created using the following functions with either an empty
7356 domain or a given domain.
7358         #include <isl/schedule.h>
7359         __isl_give isl_schedule *isl_schedule_empty(
7360                 __isl_take isl_space *space);
7361         __isl_give isl_schedule *isl_schedule_from_domain(
7362                 __isl_take isl_union_set *domain);
7364 The function C<isl_schedule_constraints_compute_schedule> described
7365 in L</"Scheduling"> can also be used to construct schedules.
7367 C<isl_schedule> objects may be copied and freed using the following functions.
7369         #include <isl/schedule.h>
7370         __isl_give isl_schedule *isl_schedule_copy(
7371                 __isl_keep isl_schedule *sched);
7372         __isl_null isl_schedule *isl_schedule_free(
7373                 __isl_take isl_schedule *sched);
7375 The following functions checks whether two C<isl_schedule> objects
7376 are obviously the same.
7378         #include <isl/schedule.h>
7379         int isl_schedule_plain_is_equal(
7380                 __isl_keep isl_schedule *schedule1,
7381                 __isl_keep isl_schedule *schedule2);
7383 The domain of the schedule, i.e., the domain described by the root node,
7384 can be obtained using the following function.
7386         #include <isl/schedule.h>
7387         __isl_give isl_union_set *isl_schedule_get_domain(
7388                 __isl_keep isl_schedule *schedule);
7390 An extra top-level band node (right underneath the domain node) can
7391 be introduced into the schedule using the following function.
7392 The schedule tree is assumed not to have any anchored nodes.
7394         #include <isl/schedule.h>
7395         __isl_give isl_schedule *
7396         isl_schedule_insert_partial_schedule(
7397                 __isl_take isl_schedule *schedule,
7398                 __isl_take isl_multi_union_pw_aff *partial);
7400 A top-level context node (right underneath the domain node) can
7401 be introduced into the schedule using the following function.
7403         #include <isl/schedule.h>
7404         __isl_give isl_schedule *isl_schedule_insert_context(
7405                 __isl_take isl_schedule *schedule,
7406                 __isl_take isl_set *context)
7408 A top-level guard node (right underneath the domain node) can
7409 be introduced into the schedule using the following function.
7411         #include <isl/schedule.h>
7412         __isl_give isl_schedule *isl_schedule_insert_guard(
7413                 __isl_take isl_schedule *schedule,
7414                 __isl_take isl_set *guard)
7416 A schedule that combines two schedules either in the given
7417 order or in an arbitrary order, i.e., with an C<isl_schedule_node_sequence>
7418 or an C<isl_schedule_node_set> node,
7419 can be created using the following functions.
7421         #include <isl/schedule.h>
7422         __isl_give isl_schedule *isl_schedule_sequence(
7423                 __isl_take isl_schedule *schedule1,
7424                 __isl_take isl_schedule *schedule2);
7425         __isl_give isl_schedule *isl_schedule_set(
7426                 __isl_take isl_schedule *schedule1,
7427                 __isl_take isl_schedule *schedule2);
7429 The domains of the two input schedules need to be disjoint.
7431 The following function can be used to restrict the domain
7432 of a schedule with a domain node as root to be a subset of the given union set.
7433 This operation may remove nodes in the tree that have become
7434 redundant.
7436         #include <isl/schedule.h>
7437         __isl_give isl_schedule *isl_schedule_intersect_domain(
7438                 __isl_take isl_schedule *schedule,
7439                 __isl_take isl_union_set *domain);
7441 The following function resets the user pointers on all parameter
7442 and tuple identifiers referenced by the nodes of the given schedule.
7444         #include <isl/schedule.h>
7445         __isl_give isl_schedule *isl_schedule_reset_user(
7446                 __isl_take isl_schedule *schedule);
7448 The following function aligns the parameters of all nodes
7449 in the given schedule to the given space.
7451         #include <isl/schedule.h>
7452         __isl_give isl_schedule *isl_schedule_align_params(
7453                 __isl_take isl_schedule *schedule,
7454                 __isl_take isl_space *space);
7456 The following function allows the user to plug in a given function
7457 in the iteration domains.  The input schedule is not allowed to contain
7458 any expansion nodes.
7460         #include <isl/schedule.h>
7461         __isl_give isl_schedule *
7462         isl_schedule_pullback_union_pw_multi_aff(
7463                 __isl_take isl_schedule *schedule,
7464                 __isl_take isl_union_pw_multi_aff *upma);
7466 An C<isl_union_map> representation of the schedule can be obtained
7467 from an C<isl_schedule> using the following function.
7469         #include <isl/schedule.h>
7470         __isl_give isl_union_map *isl_schedule_get_map(
7471                 __isl_keep isl_schedule *sched);
7473 The resulting relation encodes the same relative ordering as
7474 the schedule by mapping the domain elements to a common schedule space.
7475 If the schedule_separate_components option is set, then the order
7476 of the children of a set node is explicitly encoded in the result.
7477 If the tree contains any expansion nodes, then the relation
7478 is formulated in terms of the expanded domain elements.
7480 Schedules can be read from input using the following functions.
7482         #include <isl/schedule.h>
7483         __isl_give isl_schedule *isl_schedule_read_from_file(
7484                 isl_ctx *ctx, FILE *input);
7485         __isl_give isl_schedule *isl_schedule_read_from_str(
7486                 isl_ctx *ctx, const char *str);
7488 A representation of the schedule can be printed using
7490         #include <isl/schedule.h>
7491         __isl_give isl_printer *isl_printer_print_schedule(
7492                 __isl_take isl_printer *p,
7493                 __isl_keep isl_schedule *schedule);
7495 The schedule tree can be traversed through the use of
7496 C<isl_schedule_node> objects that point to a particular
7497 position in the schedule tree.  Whenever a C<isl_schedule_node>
7498 is use to modify a node in the schedule tree, the original schedule
7499 tree is left untouched and the modifications are performed to a copy
7500 of the tree.  The returned C<isl_schedule_node> then points to
7501 this modified copy of the tree.
7503 The root of the schedule tree can be obtained using the following function.
7505         #include <isl/schedule.h>
7506         __isl_give isl_schedule_node *isl_schedule_get_root(
7507                 __isl_keep isl_schedule *schedule);
7509 A pointer to a newly created schedule tree with a single domain
7510 node can be created using the following functions.
7512         #include <isl/schedule_node.h>
7513         __isl_give isl_schedule_node *
7514         isl_schedule_node_from_domain(
7515                 __isl_take isl_union_set *domain);
7516         __isl_give isl_schedule_node *
7517         isl_schedule_node_from_extension(
7518                 __isl_take isl_union_map *extension);
7520 C<isl_schedule_node_from_extension> creates a tree with an extension
7521 node as root.
7523 Schedule nodes can be copied and freed using the following functions.
7525         #include <isl/schedule_node.h>
7526         __isl_give isl_schedule_node *isl_schedule_node_copy(
7527                 __isl_keep isl_schedule_node *node);
7528         __isl_null isl_schedule_node *isl_schedule_node_free(
7529                 __isl_take isl_schedule_node *node);
7531 The following functions can be used to check if two schedule
7532 nodes point to the same position in the same schedule.
7534         #include <isl/schedule_node.h>
7535         int isl_schedule_node_is_equal(
7536                 __isl_keep isl_schedule_node *node1,
7537                 __isl_keep isl_schedule_node *node2);
7539 The following properties can be obtained from a schedule node.
7541         #include <isl/schedule_node.h>
7542         enum isl_schedule_node_type isl_schedule_node_get_type(
7543                 __isl_keep isl_schedule_node *node);
7544         enum isl_schedule_node_type
7545         isl_schedule_node_get_parent_type(
7546                 __isl_keep isl_schedule_node *node);
7547         __isl_give isl_schedule *isl_schedule_node_get_schedule(
7548                 __isl_keep isl_schedule_node *node);
7550 The function C<isl_schedule_node_get_type> returns the type of
7551 the node, while C<isl_schedule_node_get_parent_type> returns
7552 type of the parent of the node, which is required to exist.
7553 The function C<isl_schedule_node_get_schedule> returns a copy
7554 to the schedule to which the node belongs.
7556 The following functions can be used to move the schedule node
7557 to a different position in the tree or to check if such a position
7558 exists.
7560         #include <isl/schedule_node.h>
7561         int isl_schedule_node_has_parent(
7562                 __isl_keep isl_schedule_node *node);
7563         __isl_give isl_schedule_node *isl_schedule_node_parent(
7564                 __isl_take isl_schedule_node *node);
7565         __isl_give isl_schedule_node *isl_schedule_node_root(
7566                 __isl_take isl_schedule_node *node);
7567         __isl_give isl_schedule_node *isl_schedule_node_ancestor(
7568                 __isl_take isl_schedule_node *node,
7569                 int generation);
7570         int isl_schedule_node_n_children(
7571                 __isl_keep isl_schedule_node *node);
7572         __isl_give isl_schedule_node *isl_schedule_node_child(
7573                 __isl_take isl_schedule_node *node, int pos);
7574         int isl_schedule_node_has_children(
7575                 __isl_keep isl_schedule_node *node);
7576         __isl_give isl_schedule_node *isl_schedule_node_first_child(
7577                 __isl_take isl_schedule_node *node);
7578         int isl_schedule_node_has_previous_sibling(
7579                 __isl_keep isl_schedule_node *node);
7580         __isl_give isl_schedule_node *
7581         isl_schedule_node_previous_sibling(
7582                 __isl_take isl_schedule_node *node);
7583         int isl_schedule_node_has_next_sibling(
7584                 __isl_keep isl_schedule_node *node);
7585         __isl_give isl_schedule_node *
7586         isl_schedule_node_next_sibling(
7587                 __isl_take isl_schedule_node *node);
7589 For C<isl_schedule_node_ancestor>, the ancestor of generation 0
7590 is the node itself, the ancestor of generation 1 is its parent and so on.
7592 It is also possible to query the number of ancestors of a node,
7593 the position of the current node
7594 within the children of its parent, the position of the subtree
7595 containing a node within the children of an ancestor
7596 or to obtain a copy of a given
7597 child without destroying the current node.
7598 Given two nodes that point to the same schedule, their closest
7599 shared ancestor can be obtained using
7600 C<isl_schedule_node_get_shared_ancestor>.
7602         #include <isl/schedule_node.h>
7603         int isl_schedule_node_get_tree_depth(
7604                 __isl_keep isl_schedule_node *node);
7605         int isl_schedule_node_get_child_position(
7606                 __isl_keep isl_schedule_node *node);
7607         int isl_schedule_node_get_ancestor_child_position(
7608                 __isl_keep isl_schedule_node *node,
7609                 __isl_keep isl_schedule_node *ancestor);
7610         __isl_give isl_schedule_node *isl_schedule_node_get_child(
7611                 __isl_keep isl_schedule_node *node, int pos);
7612         __isl_give isl_schedule_node *
7613         isl_schedule_node_get_shared_ancestor(
7614                 __isl_keep isl_schedule_node *node1,
7615                 __isl_keep isl_schedule_node *node2);
7617 All nodes in a schedule tree or
7618 all descendants of a specific node (including the node) can be visited
7619 in depth-first pre-order using the following functions.
7621         #include <isl/schedule.h>
7622         int isl_schedule_foreach_schedule_node(
7623                 __isl_keep isl_schedule *sched,
7624                 int (*fn)(__isl_keep isl_schedule_node *node,
7625                         void *user), void *user);
7627         #include <isl/schedule_node.h>
7628         int isl_schedule_node_foreach_descendant(
7629                 __isl_keep isl_schedule_node *node,
7630                 int (*fn)(__isl_keep isl_schedule_node *node,
7631                         void *user), void *user);
7633 The callback function is slightly different from the usual
7634 callbacks in that it not only indicates success (non-negative result)
7635 or failure (negative result), but also indicates whether the children
7636 of the given node should be visited.  In particular, if the callback
7637 returns a positive value, then the children are visited, but if
7638 the callback returns zero, then the children are not visited.
7640 The ancestors of a node in a schedule tree can be visited from
7641 the root down to and including the parent of the node using
7642 the following function.
7644         #include <isl/schedule_node.h>
7645         int isl_schedule_node_foreach_ancestor_top_down(
7646                 __isl_keep isl_schedule_node *node,
7647                 int (*fn)(__isl_keep isl_schedule_node *node,
7648                         void *user), void *user);
7650 The following functions allows for a depth-first post-order
7651 traversal of the nodes in a schedule tree or
7652 of the descendants of a specific node (including the node
7653 itself), where the user callback is allowed to modify the
7654 visited node.
7656         #include <isl/schedule.h>
7657         __isl_give isl_schedule *isl_schedule_map_schedule_node(
7658                 __isl_take isl_schedule *schedule,
7659                 __isl_give isl_schedule_node *(*fn)(
7660                         __isl_take isl_schedule_node *node,
7661                         void *user), void *user);
7663         #include <isl/schedule_node.h>
7664         __isl_give isl_schedule_node *
7665         isl_schedule_node_map_descendant(
7666                 __isl_take isl_schedule_node *node,
7667                 __isl_give isl_schedule_node *(*fn)(
7668                         __isl_take isl_schedule_node *node,
7669                         void *user), void *user);
7671 The traversal continues from the node returned by the callback function.
7672 It is the responsibility of the user to ensure that this does not
7673 lead to an infinite loop.  It is safest to always return a pointer
7674 to the same position (same ancestors and child positions) as the input node.
7676 The following function removes a node (along with its descendants)
7677 from a schedule tree and returns a pointer to the leaf at the
7678 same position in the updated tree.
7679 It is not allowed to remove the root of a schedule tree or
7680 a child of a set or sequence node.
7682         #include <isl/schedule_node.h>
7683         __isl_give isl_schedule_node *isl_schedule_node_cut(
7684                 __isl_take isl_schedule_node *node);
7686 The following function removes a single node
7687 from a schedule tree and returns a pointer to the child
7688 of the node, now located at the position of the original node
7689 or to a leaf node at that position if there was no child.
7690 It is not allowed to remove the root of a schedule tree,
7691 a set or sequence node, a child of a set or sequence node or
7692 a band node with an anchored subtree.
7694         #include <isl/schedule_node.h>
7695         __isl_give isl_schedule_node *isl_schedule_node_delete(
7696                 __isl_take isl_schedule_node *node);
7698 Most nodes in a schedule tree only contain local information.
7699 In some cases, however, a node may also refer to outer band nodes.
7700 This means that the position of the node within the tree should
7701 not be changed, or at least that no changes are performed to the
7702 outer band nodes.  The following function can be used to test
7703 whether the subtree rooted at a given node contains any such nodes.
7705         #include <isl/schedule_node.h>
7706         int isl_schedule_node_is_subtree_anchored(
7707                 __isl_keep isl_schedule_node *node);
7709 The following function resets the user pointers on all parameter
7710 and tuple identifiers referenced by the given schedule node.
7712         #include <isl/schedule_node.h>
7713         __isl_give isl_schedule_node *isl_schedule_node_reset_user(
7714                 __isl_take isl_schedule_node *node);
7716 The following function aligns the parameters of the given schedule
7717 node to the given space.
7719         #include <isl/schedule_node.h>
7720         __isl_give isl_schedule_node *
7721         isl_schedule_node_align_params(
7722                 __isl_take isl_schedule_node *node,
7723                 __isl_take isl_space *space);
7725 Several node types have their own functions for querying
7726 (and in some cases setting) some node type specific properties.
7728         #include <isl/schedule_node.h>
7729         __isl_give isl_space *isl_schedule_node_band_get_space(
7730                 __isl_keep isl_schedule_node *node);
7731         __isl_give isl_multi_union_pw_aff *
7732         isl_schedule_node_band_get_partial_schedule(
7733                 __isl_keep isl_schedule_node *node);
7734         __isl_give isl_union_map *
7735         isl_schedule_node_band_get_partial_schedule_union_map(
7736                 __isl_keep isl_schedule_node *node);
7737         unsigned isl_schedule_node_band_n_member(
7738                 __isl_keep isl_schedule_node *node);
7739         int isl_schedule_node_band_member_get_coincident(
7740                 __isl_keep isl_schedule_node *node, int pos);
7741         __isl_give isl_schedule_node *
7742         isl_schedule_node_band_member_set_coincident(
7743                 __isl_take isl_schedule_node *node, int pos,
7744                 int coincident);
7745         int isl_schedule_node_band_get_permutable(
7746                 __isl_keep isl_schedule_node *node);
7747         __isl_give isl_schedule_node *
7748         isl_schedule_node_band_set_permutable(
7749                 __isl_take isl_schedule_node *node, int permutable);
7750         enum isl_ast_loop_type
7751         isl_schedule_node_band_member_get_ast_loop_type(
7752                 __isl_keep isl_schedule_node *node, int pos);
7753         __isl_give isl_schedule_node *
7754         isl_schedule_node_band_member_set_ast_loop_type(
7755                 __isl_take isl_schedule_node *node, int pos,
7756                 enum isl_ast_loop_type type);
7757         __isl_give isl_union_set *
7758         enum isl_ast_loop_type
7759         isl_schedule_node_band_member_get_isolate_ast_loop_type(
7760                 __isl_keep isl_schedule_node *node, int pos);
7761         __isl_give isl_schedule_node *
7762         isl_schedule_node_band_member_set_isolate_ast_loop_type(
7763                 __isl_take isl_schedule_node *node, int pos,
7764                 enum isl_ast_loop_type type);
7765         isl_schedule_node_band_get_ast_build_options(
7766                 __isl_keep isl_schedule_node *node);
7767         __isl_give isl_schedule_node *
7768         isl_schedule_node_band_set_ast_build_options(
7769                 __isl_take isl_schedule_node *node,
7770                 __isl_take isl_union_set *options);
7772 The function C<isl_schedule_node_band_get_space> returns the space
7773 of the partial schedule of the band.
7774 The function C<isl_schedule_node_band_get_partial_schedule_union_map>
7775 returns a representation of the partial schedule of the band node
7776 in the form of an C<isl_union_map>.
7777 The coincident and permutable properties are set by
7778 C<isl_schedule_constraints_compute_schedule> on the schedule tree
7779 it produces.
7780 A scheduling dimension is considered to be ``coincident''
7781 if it satisfies the coincidence constraints within its band.
7782 That is, if the dependence distances of the coincidence
7783 constraints are all zero in that direction (for fixed
7784 iterations of outer bands).
7785 A band is marked permutable if it was produced using the Pluto-like scheduler.
7786 Note that the scheduler may have to resort to a Feautrier style scheduling
7787 step even if the default scheduler is used.
7788 An C<isl_ast_loop_type> is one of C<isl_ast_loop_default>,
7789 C<isl_ast_loop_atomic>, C<isl_ast_loop_unroll> or C<isl_ast_loop_separate>.
7790 For the meaning of these loop AST generation types and the difference
7791 between the regular loop AST generation type and the isolate
7792 loop AST generation type, see L</"AST Generation Options (Schedule Tree)">.
7793 The functions C<isl_schedule_node_band_member_get_ast_loop_type>
7794 and C<isl_schedule_node_band_member_get_isolate_ast_loop_type>
7795 may return C<isl_ast_loop_error> if an error occurs.
7796 The AST build options govern how an AST is generated for
7797 the individual schedule dimensions during AST generation.
7798 See L</"AST Generation Options (Schedule Tree)">.
7800         #include <isl/schedule_node.h>
7801         __isl_give isl_set *
7802         isl_schedule_node_context_get_context(
7803                 __isl_keep isl_schedule_node *node);
7805         #include <isl/schedule_node.h>
7806         __isl_give isl_union_set *
7807         isl_schedule_node_domain_get_domain(
7808                 __isl_keep isl_schedule_node *node);
7810         #include <isl/schedule_node.h>
7811         __isl_give isl_union_map *
7812         isl_schedule_node_expansion_get_expansion(
7813                 __isl_keep isl_schedule_node *node);
7814         __isl_give isl_union_pw_multi_aff *
7815         isl_schedule_node_expansion_get_contraction(
7816                 __isl_keep isl_schedule_node *node);
7818         #include <isl/schedule_node.h>
7819         __isl_give isl_union_map *
7820         isl_schedule_node_extension_get_extension(
7821                 __isl_keep isl_schedule_node *node);
7823         #include <isl/schedule_node.h>
7824         __isl_give isl_union_set *
7825         isl_schedule_node_filter_get_filter(
7826                 __isl_keep isl_schedule_node *node);
7828         #include <isl/schedule_node.h>
7829         __isl_give isl_set *isl_schedule_node_guard_get_guard(
7830                 __isl_keep isl_schedule_node *node);
7832         #include <isl/schedule_node.h>
7833         __isl_give isl_id *isl_schedule_node_mark_get_id(
7834                 __isl_keep isl_schedule_node *node);
7836 The following functions can be used to obtain an C<isl_multi_union_pw_aff>,
7837 an C<isl_union_pw_multi_aff> or C<isl_union_map> representation of
7838 partial schedules related to the node.
7840         #include <isl/schedule_node.h>
7841         __isl_give isl_multi_union_pw_aff *
7842         isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(
7843                 __isl_keep isl_schedule_node *node);
7844         __isl_give isl_union_pw_multi_aff *
7845         isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(
7846                 __isl_keep isl_schedule_node *node);
7847         __isl_give isl_union_map *
7848         isl_schedule_node_get_prefix_schedule_union_map(
7849                 __isl_keep isl_schedule_node *node);
7850         __isl_give isl_union_map *
7851         isl_schedule_node_get_prefix_schedule_relation(
7852                 __isl_keep isl_schedule_node *node);
7853         __isl_give isl_union_map *
7854         isl_schedule_node_get_subtree_schedule_union_map(
7855                 __isl_keep isl_schedule_node *node);
7857 In particular, the functions
7858 C<isl_schedule_node_get_prefix_schedule_multi_union_pw_aff>,
7859 C<isl_schedule_node_get_prefix_schedule_union_pw_multi_aff>
7860 and C<isl_schedule_node_get_prefix_schedule_union_map>
7861 return a relative ordering on the domain elements that reach the given
7862 node determined by its ancestors.
7863 The function C<isl_schedule_node_get_prefix_schedule_relation>
7864 additionally includes the domain constraints in the result.
7865 The function C<isl_schedule_node_get_subtree_schedule_union_map>
7866 returns a representation of the partial schedule defined by the
7867 subtree rooted at the given node.
7868 If the tree contains any expansion nodes, then the subtree schedule
7869 is formulated in terms of the expanded domain elements.
7870 The tree passed to functions returning a prefix schedule
7871 may only contain extension nodes if these would not affect
7872 the result of these functions.  That is, if one of the ancestors
7873 is an extension node, then all of the domain elements that were
7874 added by the extension node need to have been filtered out
7875 by filter nodes between the extension node and the input node.
7876 The tree passed to C<isl_schedule_node_get_subtree_schedule_union_map>
7877 may not contain in extension nodes in the selected subtree.
7879 The expansion/contraction defined by an entire subtree, combining
7880 the expansions/contractions
7881 on the expansion nodes in the subtree, can be obtained using
7882 the following functions.
7884         #include <isl/schedule_node.h>
7885         __isl_give isl_union_map *
7886         isl_schedule_node_get_subtree_expansion(
7887                 __isl_keep isl_schedule_node *node);
7888         __isl_give isl_union_pw_multi_aff *
7889         isl_schedule_node_get_subtree_contraction(
7890                 __isl_keep isl_schedule_node *node);
7892 The total number of outer band members of given node, i.e.,
7893 the shared output dimension of the maps in the result
7894 of C<isl_schedule_node_get_prefix_schedule_union_map> can be obtained
7895 using the following function.
7897         #include <isl/schedule_node.h>
7898         int isl_schedule_node_get_schedule_depth(
7899                 __isl_keep isl_schedule_node *node);
7901 The following functions return the elements that reach the given node
7902 or the union of universes in the spaces that contain these elements.
7904         #include <isl/schedule_node.h>
7905         __isl_give isl_union_set *
7906         isl_schedule_node_get_domain(
7907                 __isl_keep isl_schedule_node *node);
7908         __isl_give isl_union_set *
7909         isl_schedule_node_get_universe_domain(
7910                 __isl_keep isl_schedule_node *node);
7912 The input tree of C<isl_schedule_node_get_domain>
7913 may only contain extension nodes if these would not affect
7914 the result of this function.  That is, if one of the ancestors
7915 is an extension node, then all of the domain elements that were
7916 added by the extension node need to have been filtered out
7917 by filter nodes between the extension node and the input node.
7919 The following functions can be used to introduce additional nodes
7920 in the schedule tree.  The new node is introduced at the point
7921 in the tree where the C<isl_schedule_node> points to and
7922 the results points to the new node.
7924         #include <isl/schedule_node.h>
7925         __isl_give isl_schedule_node *
7926         isl_schedule_node_insert_partial_schedule(
7927                 __isl_take isl_schedule_node *node,
7928                 __isl_take isl_multi_union_pw_aff *schedule);
7930 This function inserts a new band node with (the greatest integer
7931 part of) the given partial schedule.
7932 The subtree rooted at the given node is assumed not to have
7933 any anchored nodes.
7935         #include <isl/schedule_node.h>
7936         __isl_give isl_schedule_node *
7937         isl_schedule_node_insert_context(
7938                 __isl_take isl_schedule_node *node,
7939                 __isl_take isl_set *context);
7941 This function inserts a new context node with the given context constraints.
7943         #include <isl/schedule_node.h>
7944         __isl_give isl_schedule_node *
7945         isl_schedule_node_insert_filter(
7946                 __isl_take isl_schedule_node *node,
7947                 __isl_take isl_union_set *filter);
7949 This function inserts a new filter node with the given filter.
7950 If the original node already pointed to a filter node, then the
7951 two filter nodes are merged into one.
7953         #include <isl/schedule_node.h>
7954         __isl_give isl_schedule_node *
7955         isl_schedule_node_insert_guard(
7956                 __isl_take isl_schedule_node *node,
7957                 __isl_take isl_set *guard);
7959 This function inserts a new guard node with the given guard constraints.
7961         #include <isl/schedule_node.h>
7962         __isl_give isl_schedule_node *
7963         isl_schedule_node_insert_mark(
7964                 __isl_take isl_schedule_node *node,
7965                 __isl_take isl_id *mark);
7967 This function inserts a new mark node with the give mark identifier.
7969         #include <isl/schedule_node.h>
7970         __isl_give isl_schedule_node *
7971         isl_schedule_node_insert_sequence(
7972                 __isl_take isl_schedule_node *node,
7973                 __isl_take isl_union_set_list *filters);
7974         __isl_give isl_schedule_node *
7975         isl_schedule_node_insert_set(
7976                 __isl_take isl_schedule_node *node,
7977                 __isl_take isl_union_set_list *filters);
7979 These functions insert a new sequence or set node with the given
7980 filters as children.
7982         #include <isl/schedule_node.h>
7983         __isl_give isl_schedule_node *isl_schedule_node_group(
7984                 __isl_take isl_schedule_node *node,
7985                 __isl_take isl_id *group_id);
7987 This function introduces an expansion node in between the current
7988 node and its parent that expands instances of a space with tuple
7989 identifier C<group_id> to the original domain elements that reach
7990 the node.  The group instances are identified by the prefix schedule
7991 of those domain elements.  The ancestors of the node are adjusted
7992 to refer to the group instances instead of the original domain
7993 elements.  The return value points to the same node in the updated
7994 schedule tree as the input node, i.e., to the child of the newly
7995 introduced expansion node.  Grouping instances of different statements
7996 ensures that they will be treated as a single statement by the
7997 AST generator up to the point of the expansion node.
7999 The partial schedule of a band node can be scaled (down) using
8000 the following functions.
8002         #include <isl/schedule_node.h>
8003         __isl_give isl_schedule_node *
8004         isl_schedule_node_band_scale(
8005                 __isl_take isl_schedule_node *node,
8006                 __isl_take isl_multi_val *mv);
8007         __isl_give isl_schedule_node *
8008         isl_schedule_node_band_scale_down(
8009                 __isl_take isl_schedule_node *node,
8010                 __isl_take isl_multi_val *mv);
8012 The spaces of the two arguments need to match.
8013 After scaling, the partial schedule is replaced by its greatest
8014 integer part to ensure that the schedule remains integral.
8016 A band node can be tiled using the following function.
8018         #include <isl/schedule_node.h>
8019         __isl_give isl_schedule_node *isl_schedule_node_band_tile(
8020                 __isl_take isl_schedule_node *node,
8021                 __isl_take isl_multi_val *sizes);
8023         int isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
8024                 int val);
8025         int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
8026         int isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
8027                 int val);
8028         int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
8030 The C<isl_schedule_node_band_tile> function tiles
8031 the band using the given tile sizes inside its schedule.
8032 A new child band node is created to represent the point loops and it is
8033 inserted between the modified band and its children.
8034 The subtree rooted at the given node is assumed not to have
8035 any anchored nodes.
8036 The C<tile_scale_tile_loops> option specifies whether the tile
8037 loops iterators should be scaled by the tile sizes.
8038 If the C<tile_shift_point_loops> option is set, then the point loops
8039 are shifted to start at zero.
8041 A band node can be split into two nested band nodes
8042 using the following function.
8044         #include <isl/schedule_node.h>
8045         __isl_give isl_schedule_node *isl_schedule_node_band_split(
8046                 __isl_take isl_schedule_node *node, int pos);
8048 The resulting outer band node contains the first C<pos> dimensions of
8049 the schedule of C<node> while the inner band contains the remaining dimensions.
8050 The schedules of the two band nodes live in anonymous spaces.
8052 A band node can be moved down to the leaves of the subtree rooted
8053 at the band node using the following function.
8055         #include <isl/schedule_node.h>
8056         __isl_give isl_schedule_node *isl_schedule_node_band_sink(
8057                 __isl_take isl_schedule_node *node);
8059 The subtree rooted at the given node is assumed not to have
8060 any anchored nodes.
8061 The result points to the node in the resulting tree that is in the same
8062 position as the node pointed to by C<node> in the original tree.
8064 A representation of the schedule node can be printed using
8066         #include <isl/schedule_node.h>
8067         __isl_give isl_printer *isl_printer_print_schedule_node(
8068                 __isl_take isl_printer *p,
8069                 __isl_keep isl_schedule_node *node);
8071 =head2 Dependence Analysis
8073 C<isl> contains specialized functionality for performing
8074 array dataflow analysis.  That is, given a I<sink> access relation
8075 and a collection of possible I<source> access relations,
8076 C<isl> can compute relations that describe
8077 for each iteration of the sink access, which iteration
8078 of which of the source access relations was the last
8079 to access the same data element before the given iteration
8080 of the sink access.
8081 The resulting dependence relations map source iterations
8082 to the corresponding sink iterations.
8083 To compute standard flow dependences, the sink should be
8084 a read, while the sources should be writes.
8085 If any of the source accesses are marked as being I<may>
8086 accesses, then there will be a dependence from the last
8087 I<must> access B<and> from any I<may> access that follows
8088 this last I<must> access.
8089 In particular, if I<all> sources are I<may> accesses,
8090 then memory based dependence analysis is performed.
8091 If, on the other hand, all sources are I<must> accesses,
8092 then value based dependence analysis is performed.
8094 =head3 High-level Interface
8096 A high-level interface to dependence analysis is provided
8097 by the following function.
8099         #include <isl/flow.h>
8100         __isl_give isl_union_flow *
8101         isl_union_access_info_compute_flow(
8102                 __isl_take isl_union_access_info *access);
8104 The input C<isl_union_access_info> object describes the sink
8105 access relations, the source access relations and a schedule,
8106 while the output C<isl_union_flow> object describes
8107 the resulting dependence relations and the subsets of the
8108 sink relations for which no source was found.
8110 An C<isl_union_access_info> is created, modified and freed using
8111 the following functions.
8113         #include <isl/flow.h>
8114         __isl_give isl_union_access_info *
8115         isl_union_access_info_from_sink(
8116                 __isl_take isl_union_map *sink);
8117         __isl_give isl_union_access_info *
8118         isl_union_access_info_set_must_source(
8119                 __isl_take isl_union_access_info *access,
8120                 __isl_take isl_union_map *must_source);
8121         __isl_give isl_union_access_info *
8122         isl_union_access_info_set_may_source(
8123                 __isl_take isl_union_access_info *access,
8124                 __isl_take isl_union_map *may_source);
8125         __isl_give isl_union_access_info *
8126         isl_union_access_info_set_schedule(
8127                 __isl_take isl_union_access_info *access,
8128                 __isl_take isl_schedule *schedule);
8129         __isl_give isl_union_access_info *
8130         isl_union_access_info_set_schedule_map(
8131                 __isl_take isl_union_access_info *access,
8132                 __isl_take isl_union_map *schedule_map);
8133         __isl_null isl_union_access_info *
8134         isl_union_access_info_free(
8135                 __isl_take isl_union_access_info *access);
8137 The may sources set by C<isl_union_access_info_set_may_source>
8138 do not need to include the must sources set by
8139 C<isl_union_access_info_set_must_source> as a subset.
8140 The user is free not to call one (or both) of these functions,
8141 in which case the corresponding set is kept to its empty default.
8142 Similarly, the default schedule initialized by
8143 C<isl_union_access_info_from_sink> is empty.
8144 The current schedule is determined by the last call to either
8145 C<isl_union_access_info_set_schedule> or
8146 C<isl_union_access_info_set_schedule_map>.
8147 The domain of the schedule corresponds to the domains of
8148 the access relations.  In particular, the domains of the access
8149 relations are effectively intersected with the domain of the schedule
8150 and only the resulting accesses are considered by the dependence analysis.
8152 The output of C<isl_union_access_info_compute_flow> can be examined
8153 and freed using the following functions.
8155         #include <isl/flow.h>
8156         __isl_give isl_union_map *isl_union_flow_get_must_dependence(
8157                 __isl_keep isl_union_flow *flow);
8158         __isl_give isl_union_map *isl_union_flow_get_may_dependence(
8159                 __isl_keep isl_union_flow *flow);
8160         __isl_give isl_union_map *isl_union_flow_get_must_no_source(
8161                 __isl_keep isl_union_flow *flow);
8162         __isl_give isl_union_map *isl_union_flow_get_may_no_source(
8163                 __isl_keep isl_union_flow *flow);
8164         __isl_null isl_union_flow *isl_union_flow_free(
8165                 __isl_take isl_union_flow *flow);
8167 The relation returned by C<isl_union_flow_get_must_dependence>
8168 relates domain elements of must sources to domain elements of the sink.
8169 The relation returned by C<isl_union_flow_get_may_dependence>
8170 relates domain elements of must or may sources to domain elements of the sink
8171 and includes the previous relation as a subset.
8172 The relation returned by C<isl_union_flow_get_must_no_source> is the subset
8173 of the sink relation for which no dependences have been found.
8174 The relation returned by C<isl_union_flow_get_may_no_source> is the subset
8175 of the sink relation for which no definite dependences have been found.
8176 That is, it contains those sink access that do not contribute to any
8177 of the elements in the relation returned
8178 by C<isl_union_flow_get_must_dependence>.
8180 =head3 Low-level Interface
8182 A lower-level interface is provided by the following functions.
8184         #include <isl/flow.h>
8186         typedef int (*isl_access_level_before)(void *first, void *second);
8188         __isl_give isl_access_info *isl_access_info_alloc(
8189                 __isl_take isl_map *sink,
8190                 void *sink_user, isl_access_level_before fn,
8191                 int max_source);
8192         __isl_give isl_access_info *isl_access_info_add_source(
8193                 __isl_take isl_access_info *acc,
8194                 __isl_take isl_map *source, int must,
8195                 void *source_user);
8196         __isl_null isl_access_info *isl_access_info_free(
8197                 __isl_take isl_access_info *acc);
8199         __isl_give isl_flow *isl_access_info_compute_flow(
8200                 __isl_take isl_access_info *acc);
8202         int isl_flow_foreach(__isl_keep isl_flow *deps,
8203                 int (*fn)(__isl_take isl_map *dep, int must,
8204                           void *dep_user, void *user),
8205                 void *user);
8206         __isl_give isl_map *isl_flow_get_no_source(
8207                 __isl_keep isl_flow *deps, int must);
8208         void isl_flow_free(__isl_take isl_flow *deps);
8210 The function C<isl_access_info_compute_flow> performs the actual
8211 dependence analysis.  The other functions are used to construct
8212 the input for this function or to read off the output.
8214 The input is collected in an C<isl_access_info>, which can
8215 be created through a call to C<isl_access_info_alloc>.
8216 The arguments to this functions are the sink access relation
8217 C<sink>, a token C<sink_user> used to identify the sink
8218 access to the user, a callback function for specifying the
8219 relative order of source and sink accesses, and the number
8220 of source access relations that will be added.
8221 The callback function has type C<int (*)(void *first, void *second)>.
8222 The function is called with two user supplied tokens identifying
8223 either a source or the sink and it should return the shared nesting
8224 level and the relative order of the two accesses.
8225 In particular, let I<n> be the number of loops shared by
8226 the two accesses.  If C<first> precedes C<second> textually,
8227 then the function should return I<2 * n + 1>; otherwise,
8228 it should return I<2 * n>.
8229 The sources can be added to the C<isl_access_info> by performing
8230 (at most) C<max_source> calls to C<isl_access_info_add_source>.
8231 C<must> indicates whether the source is a I<must> access
8232 or a I<may> access.  Note that a multi-valued access relation
8233 should only be marked I<must> if every iteration in the domain
8234 of the relation accesses I<all> elements in its image.
8235 The C<source_user> token is again used to identify
8236 the source access.  The range of the source access relation
8237 C<source> should have the same dimension as the range
8238 of the sink access relation.
8239 The C<isl_access_info_free> function should usually not be
8240 called explicitly, because it is called implicitly by
8241 C<isl_access_info_compute_flow>.
8243 The result of the dependence analysis is collected in an
8244 C<isl_flow>.  There may be elements of
8245 the sink access for which no preceding source access could be
8246 found or for which all preceding sources are I<may> accesses.
8247 The relations containing these elements can be obtained through
8248 calls to C<isl_flow_get_no_source>, the first with C<must> set
8249 and the second with C<must> unset.
8250 In the case of standard flow dependence analysis,
8251 with the sink a read and the sources I<must> writes,
8252 the first relation corresponds to the reads from uninitialized
8253 array elements and the second relation is empty.
8254 The actual flow dependences can be extracted using
8255 C<isl_flow_foreach>.  This function will call the user-specified
8256 callback function C<fn> for each B<non-empty> dependence between
8257 a source and the sink.  The callback function is called
8258 with four arguments, the actual flow dependence relation
8259 mapping source iterations to sink iterations, a boolean that
8260 indicates whether it is a I<must> or I<may> dependence, a token
8261 identifying the source and an additional C<void *> with value
8262 equal to the third argument of the C<isl_flow_foreach> call.
8263 A dependence is marked I<must> if it originates from a I<must>
8264 source and if it is not followed by any I<may> sources.
8266 After finishing with an C<isl_flow>, the user should call
8267 C<isl_flow_free> to free all associated memory.
8269 =head3 Interaction with the Low-level Interface
8271 During the dependence analysis, we frequently need to perform
8272 the following operation.  Given a relation between sink iterations
8273 and potential source iterations from a particular source domain,
8274 what is the last potential source iteration corresponding to each
8275 sink iteration.  It can sometimes be convenient to adjust
8276 the set of potential source iterations before or after each such operation.
8277 The prototypical example is fuzzy array dataflow analysis,
8278 where we need to analyze if, based on data-dependent constraints,
8279 the sink iteration can ever be executed without one or more of
8280 the corresponding potential source iterations being executed.
8281 If so, we can introduce extra parameters and select an unknown
8282 but fixed source iteration from the potential source iterations.
8283 To be able to perform such manipulations, C<isl> provides the following
8284 function.
8286         #include <isl/flow.h>
8288         typedef __isl_give isl_restriction *(*isl_access_restrict)(
8289                 __isl_keep isl_map *source_map,
8290                 __isl_keep isl_set *sink, void *source_user,
8291                 void *user);
8292         __isl_give isl_access_info *isl_access_info_set_restrict(
8293                 __isl_take isl_access_info *acc,
8294                 isl_access_restrict fn, void *user);
8296 The function C<isl_access_info_set_restrict> should be called
8297 before calling C<isl_access_info_compute_flow> and registers a callback function
8298 that will be called any time C<isl> is about to compute the last
8299 potential source.  The first argument is the (reverse) proto-dependence,
8300 mapping sink iterations to potential source iterations.
8301 The second argument represents the sink iterations for which
8302 we want to compute the last source iteration.
8303 The third argument is the token corresponding to the source
8304 and the final argument is the token passed to C<isl_access_info_set_restrict>.
8305 The callback is expected to return a restriction on either the input or
8306 the output of the operation computing the last potential source.
8307 If the input needs to be restricted then restrictions are needed
8308 for both the source and the sink iterations.  The sink iterations
8309 and the potential source iterations will be intersected with these sets.
8310 If the output needs to be restricted then only a restriction on the source
8311 iterations is required.
8312 If any error occurs, the callback should return C<NULL>.
8313 An C<isl_restriction> object can be created, freed and inspected
8314 using the following functions.
8316         #include <isl/flow.h>
8318         __isl_give isl_restriction *isl_restriction_input(
8319                 __isl_take isl_set *source_restr,
8320                 __isl_take isl_set *sink_restr);
8321         __isl_give isl_restriction *isl_restriction_output(
8322                 __isl_take isl_set *source_restr);
8323         __isl_give isl_restriction *isl_restriction_none(
8324                 __isl_take isl_map *source_map);
8325         __isl_give isl_restriction *isl_restriction_empty(
8326                 __isl_take isl_map *source_map);
8327         __isl_null isl_restriction *isl_restriction_free(
8328                 __isl_take isl_restriction *restr);
8330 C<isl_restriction_none> and C<isl_restriction_empty> are special
8331 cases of C<isl_restriction_input>.  C<isl_restriction_none>
8332 is essentially equivalent to
8334         isl_restriction_input(isl_set_universe(
8335             isl_space_range(isl_map_get_space(source_map))),
8336                             isl_set_universe(
8337             isl_space_domain(isl_map_get_space(source_map))));
8339 whereas C<isl_restriction_empty> is essentially equivalent to
8341         isl_restriction_input(isl_set_empty(
8342             isl_space_range(isl_map_get_space(source_map))),
8343                             isl_set_universe(
8344             isl_space_domain(isl_map_get_space(source_map))));
8346 =head2 Scheduling
8348 B<The functionality described in this section is fairly new
8349 and may be subject to change.>
8351         #include <isl/schedule.h>
8352         __isl_give isl_schedule *
8353         isl_schedule_constraints_compute_schedule(
8354                 __isl_take isl_schedule_constraints *sc);
8356 The function C<isl_schedule_constraints_compute_schedule> can be
8357 used to compute a schedule that satisfies the given schedule constraints.
8358 These schedule constraints include the iteration domain for which
8359 a schedule should be computed and dependences between pairs of
8360 iterations.  In particular, these dependences include
8361 I<validity> dependences and I<proximity> dependences.
8362 By default, the algorithm used to construct the schedule is similar
8363 to that of C<Pluto>.
8364 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
8365 be selected.
8366 The generated schedule respects all validity dependences.
8367 That is, all dependence distances over these dependences in the
8368 scheduled space are lexicographically positive.
8369 The default algorithm tries to ensure that the dependence distances
8370 over coincidence constraints are zero and to minimize the
8371 dependence distances over proximity dependences.
8372 Moreover, it tries to obtain sequences (bands) of schedule dimensions
8373 for groups of domains where the dependence distances over validity
8374 dependences have only non-negative values.
8375 When using Feautrier's algorithm, the coincidence and proximity constraints
8376 are only taken into account during the extension to a
8377 full-dimensional schedule.
8379 An C<isl_schedule_constraints> object can be constructed
8380 and manipulated using the following functions.
8382         #include <isl/schedule.h>
8383         __isl_give isl_schedule_constraints *
8384         isl_schedule_constraints_copy(
8385                 __isl_keep isl_schedule_constraints *sc);
8386         __isl_give isl_schedule_constraints *
8387         isl_schedule_constraints_on_domain(
8388                 __isl_take isl_union_set *domain);
8389         __isl_give isl_schedule_constraints *
8390         isl_schedule_constraints_set_context(
8391                 __isl_take isl_schedule_constraints *sc,
8392                 __isl_take isl_set *context);
8393         __isl_give isl_schedule_constraints *
8394         isl_schedule_constraints_set_validity(
8395                 __isl_take isl_schedule_constraints *sc,
8396                 __isl_take isl_union_map *validity);
8397         __isl_give isl_schedule_constraints *
8398         isl_schedule_constraints_set_coincidence(
8399                 __isl_take isl_schedule_constraints *sc,
8400                 __isl_take isl_union_map *coincidence);
8401         __isl_give isl_schedule_constraints *
8402         isl_schedule_constraints_set_proximity(
8403                 __isl_take isl_schedule_constraints *sc,
8404                 __isl_take isl_union_map *proximity);
8405         __isl_give isl_schedule_constraints *
8406         isl_schedule_constraints_set_conditional_validity(
8407                 __isl_take isl_schedule_constraints *sc,
8408                 __isl_take isl_union_map *condition,
8409                 __isl_take isl_union_map *validity);
8410         __isl_null isl_schedule_constraints *
8411         isl_schedule_constraints_free(
8412                 __isl_take isl_schedule_constraints *sc);
8414 The initial C<isl_schedule_constraints> object created by
8415 C<isl_schedule_constraints_on_domain> does not impose any constraints.
8416 That is, it has an empty set of dependences.
8417 The function C<isl_schedule_constraints_set_context> allows the user
8418 to specify additional constraints on the parameters that may
8419 be assumed to hold during the construction of the schedule.
8420 The function C<isl_schedule_constraints_set_validity> replaces the
8421 validity dependences, mapping domain elements I<i> to domain
8422 elements that should be scheduled after I<i>.
8423 The function C<isl_schedule_constraints_set_coincidence> replaces the
8424 coincidence dependences, mapping domain elements I<i> to domain
8425 elements that should be scheduled together with I<I>, if possible.
8426 The function C<isl_schedule_constraints_set_proximity> replaces the
8427 proximity dependences, mapping domain elements I<i> to domain
8428 elements that should be scheduled either before I<I>
8429 or as early as possible after I<i>.
8431 The function C<isl_schedule_constraints_set_conditional_validity>
8432 replaces the conditional validity constraints.
8433 A conditional validity constraint is only imposed when any of the corresponding
8434 conditions is satisfied, i.e., when any of them is non-zero.
8435 That is, the scheduler ensures that within each band if the dependence
8436 distances over the condition constraints are not all zero
8437 then all corresponding conditional validity constraints are respected.
8438 A conditional validity constraint corresponds to a condition
8439 if the two are adjacent, i.e., if the domain of one relation intersect
8440 the range of the other relation.
8441 The typical use case of conditional validity constraints is
8442 to allow order constraints between live ranges to be violated
8443 as long as the live ranges themselves are local to the band.
8444 To allow more fine-grained control over which conditions correspond
8445 to which conditional validity constraints, the domains and ranges
8446 of these relations may include I<tags>.  That is, the domains and
8447 ranges of those relation may themselves be wrapped relations
8448 where the iteration domain appears in the domain of those wrapped relations
8449 and the range of the wrapped relations can be arbitrarily chosen
8450 by the user.  Conditions and conditional validity constraints are only
8451 considered adjacent to each other if the entire wrapped relation matches.
8452 In particular, a relation with a tag will never be considered adjacent
8453 to a relation without a tag.
8455 The following function computes a schedule directly from
8456 an iteration domain and validity and proximity dependences
8457 and is implemented in terms of the functions described above.
8458 The use of C<isl_union_set_compute_schedule> is discouraged.
8460         #include <isl/schedule.h>
8461         __isl_give isl_schedule *isl_union_set_compute_schedule(
8462                 __isl_take isl_union_set *domain,
8463                 __isl_take isl_union_map *validity,
8464                 __isl_take isl_union_map *proximity);
8466 The generated schedule represents a schedule tree.
8467 For more information on schedule trees, see
8468 L</"Schedule Trees">.
8470 =head3 Options
8472         #include <isl/schedule.h>
8473         int isl_options_set_schedule_max_coefficient(
8474                 isl_ctx *ctx, int val);
8475         int isl_options_get_schedule_max_coefficient(
8476                 isl_ctx *ctx);
8477         int isl_options_set_schedule_max_constant_term(
8478                 isl_ctx *ctx, int val);
8479         int isl_options_get_schedule_max_constant_term(
8480                 isl_ctx *ctx);
8481         int isl_options_set_schedule_fuse(isl_ctx *ctx, int val);
8482         int isl_options_get_schedule_fuse(isl_ctx *ctx);
8483         int isl_options_set_schedule_maximize_band_depth(
8484                 isl_ctx *ctx, int val);
8485         int isl_options_get_schedule_maximize_band_depth(
8486                 isl_ctx *ctx);
8487         int isl_options_set_schedule_outer_coincidence(
8488                 isl_ctx *ctx, int val);
8489         int isl_options_get_schedule_outer_coincidence(
8490                 isl_ctx *ctx);
8491         int isl_options_set_schedule_split_scaled(
8492                 isl_ctx *ctx, int val);
8493         int isl_options_get_schedule_split_scaled(
8494                 isl_ctx *ctx);
8495         int isl_options_set_schedule_algorithm(
8496                 isl_ctx *ctx, int val);
8497         int isl_options_get_schedule_algorithm(
8498                 isl_ctx *ctx);
8499         int isl_options_set_schedule_separate_components(
8500                 isl_ctx *ctx, int val);
8501         int isl_options_get_schedule_separate_components(
8502                 isl_ctx *ctx);
8504 =over
8506 =item * schedule_max_coefficient
8508 This option enforces that the coefficients for variable and parameter
8509 dimensions in the calculated schedule are not larger than the specified value.
8510 This option can significantly increase the speed of the scheduling calculation
8511 and may also prevent fusing of unrelated dimensions. A value of -1 means that
8512 this option does not introduce bounds on the variable or parameter
8513 coefficients.
8515 =item * schedule_max_constant_term
8517 This option enforces that the constant coefficients in the calculated schedule
8518 are not larger than the maximal constant term. This option can significantly
8519 increase the speed of the scheduling calculation and may also prevent fusing of
8520 unrelated dimensions. A value of -1 means that this option does not introduce
8521 bounds on the constant coefficients.
8523 =item * schedule_fuse
8525 This option controls the level of fusion.
8526 If this option is set to C<ISL_SCHEDULE_FUSE_MIN>, then loops in the
8527 resulting schedule will be distributed as much as possible.
8528 If this option is set to C<ISL_SCHEDULE_FUSE_MAX>, then C<isl> will
8529 try to fuse loops in the resulting schedule.
8531 =item * schedule_maximize_band_depth
8533 If this option is set, we do not split bands at the point
8534 where we detect splitting is necessary. Instead, we
8535 backtrack and split bands as early as possible. This
8536 reduces the number of splits and maximizes the width of
8537 the bands. Wider bands give more possibilities for tiling.
8538 Note that if the C<schedule_fuse> option is set to C<ISL_SCHEDULE_FUSE_MIN>,
8539 then bands will be split as early as possible, even if there is no need.
8540 The C<schedule_maximize_band_depth> option therefore has no effect in this case.
8542 =item * schedule_outer_coincidence
8544 If this option is set, then we try to construct schedules
8545 where the outermost scheduling dimension in each band
8546 satisfies the coincidence constraints.
8548 =item * schedule_split_scaled
8550 If this option is set, then we try to construct schedules in which the
8551 constant term is split off from the linear part if the linear parts of
8552 the scheduling rows for all nodes in the graphs have a common non-trivial
8553 divisor.
8554 The constant term is then placed in a separate band and the linear
8555 part is reduced.
8557 =item * schedule_algorithm
8559 Selects the scheduling algorithm to be used.
8560 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
8561 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
8563 =item * schedule_separate_components
8565 If this option is set then the function C<isl_schedule_get_map>
8566 will treat set nodes in the same way as sequence nodes.
8568 =back
8570 =head2 AST Generation
8572 This section describes the C<isl> functionality for generating
8573 ASTs that visit all the elements
8574 in a domain in an order specified by a schedule tree or
8575 a schedule map.
8576 In case the schedule given as a C<isl_union_map>, an AST is generated
8577 that visits all the elements in the domain of the C<isl_union_map>
8578 according to the lexicographic order of the corresponding image
8579 element(s).  If the range of the C<isl_union_map> consists of
8580 elements in more than one space, then each of these spaces is handled
8581 separately in an arbitrary order.
8582 It should be noted that the schedule tree or the image elements
8583 in a schedule map only specify the I<order>
8584 in which the corresponding domain elements should be visited.
8585 No direct relation between the partial schedule values
8586 or the image elements on the one hand and the loop iterators
8587 in the generated AST on the other hand should be assumed.
8589 Each AST is generated within a build.  The initial build
8590 simply specifies the constraints on the parameters (if any)
8591 and can be created, inspected, copied and freed using the following functions.
8593         #include <isl/ast_build.h>
8594         __isl_give isl_ast_build *isl_ast_build_alloc(
8595                 isl_ctx *ctx);
8596         __isl_give isl_ast_build *isl_ast_build_from_context(
8597                 __isl_take isl_set *set);
8598         __isl_give isl_ast_build *isl_ast_build_copy(
8599                 __isl_keep isl_ast_build *build);
8600         __isl_null isl_ast_build *isl_ast_build_free(
8601                 __isl_take isl_ast_build *build);
8603 The C<set> argument is usually a parameter set with zero or more parameters.
8604 In fact, when creating an AST using C<isl_ast_build_node_from_schedule>,
8605 this set is required to be a parameter set.
8606 An C<isl_ast_build> created using C<isl_ast_build_alloc> does not
8607 specify any parameter constraints.
8608 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
8609 and L</"Fine-grained Control over AST Generation">.
8610 Finally, the AST itself can be constructed using one of the following
8611 functions.
8613         #include <isl/ast_build.h>
8614         __isl_give isl_ast_node *isl_ast_build_node_from_schedule(
8615                 __isl_keep isl_ast_build *build,
8616                 __isl_take isl_schedule *schedule);
8617         __isl_give isl_ast_node *
8618         isl_ast_build_node_from_schedule_map(
8619                 __isl_keep isl_ast_build *build,
8620                 __isl_take isl_union_map *schedule);
8622 =head3 Inspecting the AST
8624 The basic properties of an AST node can be obtained as follows.
8626         #include <isl/ast.h>
8627         enum isl_ast_node_type isl_ast_node_get_type(
8628                 __isl_keep isl_ast_node *node);
8630 The type of an AST node is one of
8631 C<isl_ast_node_for>,
8632 C<isl_ast_node_if>,
8633 C<isl_ast_node_block>,
8634 C<isl_ast_node_mark> or
8635 C<isl_ast_node_user>.
8636 An C<isl_ast_node_for> represents a for node.
8637 An C<isl_ast_node_if> represents an if node.
8638 An C<isl_ast_node_block> represents a compound node.
8639 An C<isl_ast_node_mark> introduces a mark in the AST.
8640 An C<isl_ast_node_user> represents an expression statement.
8641 An expression statement typically corresponds to a domain element, i.e.,
8642 one of the elements that is visited by the AST.
8644 Each type of node has its own additional properties.
8646         #include <isl/ast.h>
8647         __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
8648                 __isl_keep isl_ast_node *node);
8649         __isl_give isl_ast_expr *isl_ast_node_for_get_init(
8650                 __isl_keep isl_ast_node *node);
8651         __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
8652                 __isl_keep isl_ast_node *node);
8653         __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
8654                 __isl_keep isl_ast_node *node);
8655         __isl_give isl_ast_node *isl_ast_node_for_get_body(
8656                 __isl_keep isl_ast_node *node);
8657         int isl_ast_node_for_is_degenerate(
8658                 __isl_keep isl_ast_node *node);
8660 An C<isl_ast_for> is considered degenerate if it is known to execute
8661 exactly once.
8663         #include <isl/ast.h>
8664         __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
8665                 __isl_keep isl_ast_node *node);
8666         __isl_give isl_ast_node *isl_ast_node_if_get_then(
8667                 __isl_keep isl_ast_node *node);
8668         int isl_ast_node_if_has_else(
8669                 __isl_keep isl_ast_node *node);
8670         __isl_give isl_ast_node *isl_ast_node_if_get_else(
8671                 __isl_keep isl_ast_node *node);
8673         __isl_give isl_ast_node_list *
8674         isl_ast_node_block_get_children(
8675                 __isl_keep isl_ast_node *node);
8677         __isl_give isl_id *isl_ast_node_mark_get_id(
8678                 __isl_keep isl_ast_node *node);
8679         __isl_give isl_ast_node *isl_ast_node_mark_get_node(
8680                 __isl_keep isl_ast_node *node);
8682 C<isl_ast_node_mark_get_id> returns the identifier of the mark.
8683 C<isl_ast_node_mark_get_node> returns the child node that is being marked.
8685         #include <isl/ast.h>
8686         __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
8687                 __isl_keep isl_ast_node *node);
8689 Each of the returned C<isl_ast_expr>s can in turn be inspected using
8690 the following functions.
8692         #include <isl/ast.h>
8693         enum isl_ast_expr_type isl_ast_expr_get_type(
8694                 __isl_keep isl_ast_expr *expr);
8696 The type of an AST expression is one of
8697 C<isl_ast_expr_op>,
8698 C<isl_ast_expr_id> or
8699 C<isl_ast_expr_int>.
8700 An C<isl_ast_expr_op> represents the result of an operation.
8701 An C<isl_ast_expr_id> represents an identifier.
8702 An C<isl_ast_expr_int> represents an integer value.
8704 Each type of expression has its own additional properties.
8706         #include <isl/ast.h>
8707         enum isl_ast_op_type isl_ast_expr_get_op_type(
8708                 __isl_keep isl_ast_expr *expr);
8709         int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
8710         __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
8711                 __isl_keep isl_ast_expr *expr, int pos);
8712         int isl_ast_node_foreach_ast_op_type(
8713                 __isl_keep isl_ast_node *node,
8714                 int (*fn)(enum isl_ast_op_type type, void *user),
8715                 void *user);
8717 C<isl_ast_expr_get_op_type> returns the type of the operation
8718 performed.  C<isl_ast_expr_get_op_n_arg> returns the number of
8719 arguments.  C<isl_ast_expr_get_op_arg> returns the specified
8720 argument.
8721 C<isl_ast_node_foreach_ast_op_type> calls C<fn> for each distinct
8722 C<isl_ast_op_type> that appears in C<node>.
8723 The operation type is one of the following.
8725 =over
8727 =item C<isl_ast_op_and>
8729 Logical I<and> of two arguments.
8730 Both arguments can be evaluated.
8732 =item C<isl_ast_op_and_then>
8734 Logical I<and> of two arguments.
8735 The second argument can only be evaluated if the first evaluates to true.
8737 =item C<isl_ast_op_or>
8739 Logical I<or> of two arguments.
8740 Both arguments can be evaluated.
8742 =item C<isl_ast_op_or_else>
8744 Logical I<or> of two arguments.
8745 The second argument can only be evaluated if the first evaluates to false.
8747 =item C<isl_ast_op_max>
8749 Maximum of two or more arguments.
8751 =item C<isl_ast_op_min>
8753 Minimum of two or more arguments.
8755 =item C<isl_ast_op_minus>
8757 Change sign.
8759 =item C<isl_ast_op_add>
8761 Sum of two arguments.
8763 =item C<isl_ast_op_sub>
8765 Difference of two arguments.
8767 =item C<isl_ast_op_mul>
8769 Product of two arguments.
8771 =item C<isl_ast_op_div>
8773 Exact division.  That is, the result is known to be an integer.
8775 =item C<isl_ast_op_fdiv_q>
8777 Result of integer division, rounded towards negative
8778 infinity.
8780 =item C<isl_ast_op_pdiv_q>
8782 Result of integer division, where dividend is known to be non-negative.
8784 =item C<isl_ast_op_pdiv_r>
8786 Remainder of integer division, where dividend is known to be non-negative.
8788 =item C<isl_ast_op_zdiv_r>
8790 Equal to zero iff the remainder on integer division is zero.
8792 =item C<isl_ast_op_cond>
8794 Conditional operator defined on three arguments.
8795 If the first argument evaluates to true, then the result
8796 is equal to the second argument.  Otherwise, the result
8797 is equal to the third argument.
8798 The second and third argument may only be evaluated if
8799 the first argument evaluates to true and false, respectively.
8800 Corresponds to C<a ? b : c> in C.
8802 =item C<isl_ast_op_select>
8804 Conditional operator defined on three arguments.
8805 If the first argument evaluates to true, then the result
8806 is equal to the second argument.  Otherwise, the result
8807 is equal to the third argument.
8808 The second and third argument may be evaluated independently
8809 of the value of the first argument.
8810 Corresponds to C<a * b + (1 - a) * c> in C.
8812 =item C<isl_ast_op_eq>
8814 Equality relation.
8816 =item C<isl_ast_op_le>
8818 Less than or equal relation.
8820 =item C<isl_ast_op_lt>
8822 Less than relation.
8824 =item C<isl_ast_op_ge>
8826 Greater than or equal relation.
8828 =item C<isl_ast_op_gt>
8830 Greater than relation.
8832 =item C<isl_ast_op_call>
8834 A function call.
8835 The number of arguments of the C<isl_ast_expr> is one more than
8836 the number of arguments in the function call, the first argument
8837 representing the function being called.
8839 =item C<isl_ast_op_access>
8841 An array access.
8842 The number of arguments of the C<isl_ast_expr> is one more than
8843 the number of index expressions in the array access, the first argument
8844 representing the array being accessed.
8846 =item C<isl_ast_op_member>
8848 A member access.
8849 This operation has two arguments, a structure and the name of
8850 the member of the structure being accessed.
8852 =back
8854         #include <isl/ast.h>
8855         __isl_give isl_id *isl_ast_expr_get_id(
8856                 __isl_keep isl_ast_expr *expr);
8858 Return the identifier represented by the AST expression.
8860         #include <isl/ast.h>
8861         __isl_give isl_val *isl_ast_expr_get_val(
8862                 __isl_keep isl_ast_expr *expr);
8864 Return the integer represented by the AST expression.
8866 =head3 Properties of ASTs
8868         #include <isl/ast.h>
8869         int isl_ast_expr_is_equal(__isl_keep isl_ast_expr *expr1,
8870                 __isl_keep isl_ast_expr *expr2);
8872 Check if two C<isl_ast_expr>s are equal to each other.
8874 =head3 Manipulating and printing the AST
8876 AST nodes can be copied and freed using the following functions.
8878         #include <isl/ast.h>
8879         __isl_give isl_ast_node *isl_ast_node_copy(
8880                 __isl_keep isl_ast_node *node);
8881         __isl_null isl_ast_node *isl_ast_node_free(
8882                 __isl_take isl_ast_node *node);
8884 AST expressions can be copied and freed using the following functions.
8886         #include <isl/ast.h>
8887         __isl_give isl_ast_expr *isl_ast_expr_copy(
8888                 __isl_keep isl_ast_expr *expr);
8889         __isl_null isl_ast_expr *isl_ast_expr_free(
8890                 __isl_take isl_ast_expr *expr);
8892 New AST expressions can be created either directly or within
8893 the context of an C<isl_ast_build>.
8895         #include <isl/ast.h>
8896         __isl_give isl_ast_expr *isl_ast_expr_from_val(
8897                 __isl_take isl_val *v);
8898         __isl_give isl_ast_expr *isl_ast_expr_from_id(
8899                 __isl_take isl_id *id);
8900         __isl_give isl_ast_expr *isl_ast_expr_neg(
8901                 __isl_take isl_ast_expr *expr);
8902         __isl_give isl_ast_expr *isl_ast_expr_address_of(
8903                 __isl_take isl_ast_expr *expr);
8904         __isl_give isl_ast_expr *isl_ast_expr_add(
8905                 __isl_take isl_ast_expr *expr1,
8906                 __isl_take isl_ast_expr *expr2);
8907         __isl_give isl_ast_expr *isl_ast_expr_sub(
8908                 __isl_take isl_ast_expr *expr1,
8909                 __isl_take isl_ast_expr *expr2);
8910         __isl_give isl_ast_expr *isl_ast_expr_mul(
8911                 __isl_take isl_ast_expr *expr1,
8912                 __isl_take isl_ast_expr *expr2);
8913         __isl_give isl_ast_expr *isl_ast_expr_div(
8914                 __isl_take isl_ast_expr *expr1,
8915                 __isl_take isl_ast_expr *expr2);
8916         __isl_give isl_ast_expr *isl_ast_expr_pdiv_q(
8917                 __isl_take isl_ast_expr *expr1,
8918                 __isl_take isl_ast_expr *expr2);
8919         __isl_give isl_ast_expr *isl_ast_expr_pdiv_r(
8920                 __isl_take isl_ast_expr *expr1,
8921                 __isl_take isl_ast_expr *expr2);
8922         __isl_give isl_ast_expr *isl_ast_expr_and(
8923                 __isl_take isl_ast_expr *expr1,
8924                 __isl_take isl_ast_expr *expr2)
8925         __isl_give isl_ast_expr *isl_ast_expr_and_then(
8926                 __isl_take isl_ast_expr *expr1,
8927                 __isl_take isl_ast_expr *expr2)
8928         __isl_give isl_ast_expr *isl_ast_expr_or(
8929                 __isl_take isl_ast_expr *expr1,
8930                 __isl_take isl_ast_expr *expr2)
8931         __isl_give isl_ast_expr *isl_ast_expr_or_else(
8932                 __isl_take isl_ast_expr *expr1,
8933                 __isl_take isl_ast_expr *expr2)
8934         __isl_give isl_ast_expr *isl_ast_expr_eq(
8935                 __isl_take isl_ast_expr *expr1,
8936                 __isl_take isl_ast_expr *expr2);
8937         __isl_give isl_ast_expr *isl_ast_expr_le(
8938                 __isl_take isl_ast_expr *expr1,
8939                 __isl_take isl_ast_expr *expr2);
8940         __isl_give isl_ast_expr *isl_ast_expr_lt(
8941                 __isl_take isl_ast_expr *expr1,
8942                 __isl_take isl_ast_expr *expr2);
8943         __isl_give isl_ast_expr *isl_ast_expr_ge(
8944                 __isl_take isl_ast_expr *expr1,
8945                 __isl_take isl_ast_expr *expr2);
8946         __isl_give isl_ast_expr *isl_ast_expr_gt(
8947                 __isl_take isl_ast_expr *expr1,
8948                 __isl_take isl_ast_expr *expr2);
8949         __isl_give isl_ast_expr *isl_ast_expr_access(
8950                 __isl_take isl_ast_expr *array,
8951                 __isl_take isl_ast_expr_list *indices);
8952         __isl_give isl_ast_expr *isl_ast_expr_call(
8953                 __isl_take isl_ast_expr *function,
8954                 __isl_take isl_ast_expr_list *arguments);
8956 The function C<isl_ast_expr_address_of> can be applied to an
8957 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
8958 to represent the address of the C<isl_ast_expr_access>. The function
8959 C<isl_ast_expr_and_then> as well as C<isl_ast_expr_or_else> are short-circuit
8960 versions of C<isl_ast_expr_and> and C<isl_ast_expr_or>, respectively.
8962         #include <isl/ast_build.h>
8963         __isl_give isl_ast_expr *isl_ast_build_expr_from_set(
8964                 __isl_keep isl_ast_build *build,
8965                 __isl_take isl_set *set);
8966         __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
8967                 __isl_keep isl_ast_build *build,
8968                 __isl_take isl_pw_aff *pa);
8969         __isl_give isl_ast_expr *
8970         isl_ast_build_access_from_pw_multi_aff(
8971                 __isl_keep isl_ast_build *build,
8972                 __isl_take isl_pw_multi_aff *pma);
8973         __isl_give isl_ast_expr *
8974         isl_ast_build_access_from_multi_pw_aff(
8975                 __isl_keep isl_ast_build *build,
8976                 __isl_take isl_multi_pw_aff *mpa);
8977         __isl_give isl_ast_expr *
8978         isl_ast_build_call_from_pw_multi_aff(
8979                 __isl_keep isl_ast_build *build,
8980                 __isl_take isl_pw_multi_aff *pma);
8981         __isl_give isl_ast_expr *
8982         isl_ast_build_call_from_multi_pw_aff(
8983                 __isl_keep isl_ast_build *build,
8984                 __isl_take isl_multi_pw_aff *mpa);
8986 The set <set> and
8987 the domains of C<pa>, C<mpa> and C<pma> should correspond
8988 to the schedule space of C<build>.
8989 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
8990 the function being called.
8991 If the accessed space is a nested relation, then it is taken
8992 to represent an access of the member specified by the range
8993 of this nested relation of the structure specified by the domain
8994 of the nested relation.
8996 The following functions can be used to modify an C<isl_ast_expr>.
8998         #include <isl/ast.h>
8999         __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
9000                 __isl_take isl_ast_expr *expr, int pos,
9001                 __isl_take isl_ast_expr *arg);
9003 Replace the argument of C<expr> at position C<pos> by C<arg>.
9005         #include <isl/ast.h>
9006         __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
9007                 __isl_take isl_ast_expr *expr,
9008                 __isl_take isl_id_to_ast_expr *id2expr);
9010 The function C<isl_ast_expr_substitute_ids> replaces the
9011 subexpressions of C<expr> of type C<isl_ast_expr_id>
9012 by the corresponding expression in C<id2expr>, if there is any.
9015 User specified data can be attached to an C<isl_ast_node> and obtained
9016 from the same C<isl_ast_node> using the following functions.
9018         #include <isl/ast.h>
9019         __isl_give isl_ast_node *isl_ast_node_set_annotation(
9020                 __isl_take isl_ast_node *node,
9021                 __isl_take isl_id *annotation);
9022         __isl_give isl_id *isl_ast_node_get_annotation(
9023                 __isl_keep isl_ast_node *node);
9025 Basic printing can be performed using the following functions.
9027         #include <isl/ast.h>
9028         __isl_give isl_printer *isl_printer_print_ast_expr(
9029                 __isl_take isl_printer *p,
9030                 __isl_keep isl_ast_expr *expr);
9031         __isl_give isl_printer *isl_printer_print_ast_node(
9032                 __isl_take isl_printer *p,
9033                 __isl_keep isl_ast_node *node);
9034         __isl_give char *isl_ast_expr_to_str(
9035                 __isl_keep isl_ast_expr *expr);
9037 More advanced printing can be performed using the following functions.
9039         #include <isl/ast.h>
9040         __isl_give isl_printer *isl_ast_op_type_print_macro(
9041                 enum isl_ast_op_type type,
9042                 __isl_take isl_printer *p);
9043         __isl_give isl_printer *isl_ast_node_print_macros(
9044                 __isl_keep isl_ast_node *node,
9045                 __isl_take isl_printer *p);
9046         __isl_give isl_printer *isl_ast_node_print(
9047                 __isl_keep isl_ast_node *node,
9048                 __isl_take isl_printer *p,
9049                 __isl_take isl_ast_print_options *options);
9050         __isl_give isl_printer *isl_ast_node_for_print(
9051                 __isl_keep isl_ast_node *node,
9052                 __isl_take isl_printer *p,
9053                 __isl_take isl_ast_print_options *options);
9054         __isl_give isl_printer *isl_ast_node_if_print(
9055                 __isl_keep isl_ast_node *node,
9056                 __isl_take isl_printer *p,
9057                 __isl_take isl_ast_print_options *options);
9059 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
9060 C<isl> may print out an AST that makes use of macros such
9061 as C<floord>, C<min> and C<max>.
9062 C<isl_ast_op_type_print_macro> prints out the macro
9063 corresponding to a specific C<isl_ast_op_type>.
9064 C<isl_ast_node_print_macros> scans the C<isl_ast_node>
9065 for expressions where these macros would be used and prints
9066 out the required macro definitions.
9067 Essentially, C<isl_ast_node_print_macros> calls
9068 C<isl_ast_node_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
9069 as function argument.
9070 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
9071 C<isl_ast_node_if_print> print an C<isl_ast_node>
9072 in C<ISL_FORMAT_C>, but allow for some extra control
9073 through an C<isl_ast_print_options> object.
9074 This object can be created using the following functions.
9076         #include <isl/ast.h>
9077         __isl_give isl_ast_print_options *
9078         isl_ast_print_options_alloc(isl_ctx *ctx);
9079         __isl_give isl_ast_print_options *
9080         isl_ast_print_options_copy(
9081                 __isl_keep isl_ast_print_options *options);
9082         __isl_null isl_ast_print_options *
9083         isl_ast_print_options_free(
9084                 __isl_take isl_ast_print_options *options);
9086         __isl_give isl_ast_print_options *
9087         isl_ast_print_options_set_print_user(
9088                 __isl_take isl_ast_print_options *options,
9089                 __isl_give isl_printer *(*print_user)(
9090                         __isl_take isl_printer *p,
9091                         __isl_take isl_ast_print_options *options,
9092                         __isl_keep isl_ast_node *node, void *user),
9093                 void *user);
9094         __isl_give isl_ast_print_options *
9095         isl_ast_print_options_set_print_for(
9096                 __isl_take isl_ast_print_options *options,
9097                 __isl_give isl_printer *(*print_for)(
9098                         __isl_take isl_printer *p,
9099                         __isl_take isl_ast_print_options *options,
9100                         __isl_keep isl_ast_node *node, void *user),
9101                 void *user);
9103 The callback set by C<isl_ast_print_options_set_print_user>
9104 is called whenever a node of type C<isl_ast_node_user> needs to
9105 be printed.
9106 The callback set by C<isl_ast_print_options_set_print_for>
9107 is called whenever a node of type C<isl_ast_node_for> needs to
9108 be printed.
9109 Note that C<isl_ast_node_for_print> will I<not> call the
9110 callback set by C<isl_ast_print_options_set_print_for> on the node
9111 on which C<isl_ast_node_for_print> is called, but only on nested
9112 nodes of type C<isl_ast_node_for>.  It is therefore safe to
9113 call C<isl_ast_node_for_print> from within the callback set by
9114 C<isl_ast_print_options_set_print_for>.
9116 The following option determines the type to be used for iterators
9117 while printing the AST.
9119         int isl_options_set_ast_iterator_type(
9120                 isl_ctx *ctx, const char *val);
9121         const char *isl_options_get_ast_iterator_type(
9122                 isl_ctx *ctx);
9124 The AST printer only prints body nodes as blocks if these
9125 blocks cannot be safely omitted.
9126 For example, a C<for> node with one body node will not be
9127 surrounded with braces in C<ISL_FORMAT_C>.
9128 A block will always be printed by setting the following option.
9130         int isl_options_set_ast_always_print_block(isl_ctx *ctx,
9131                 int val);
9132         int isl_options_get_ast_always_print_block(isl_ctx *ctx);
9134 =head3 Options
9136         #include <isl/ast_build.h>
9137         int isl_options_set_ast_build_atomic_upper_bound(
9138                 isl_ctx *ctx, int val);
9139         int isl_options_get_ast_build_atomic_upper_bound(
9140                 isl_ctx *ctx);
9141         int isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
9142                 int val);
9143         int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
9144         int isl_options_set_ast_build_exploit_nested_bounds(
9145                 isl_ctx *ctx, int val);
9146         int isl_options_get_ast_build_exploit_nested_bounds(
9147                 isl_ctx *ctx);
9148         int isl_options_set_ast_build_group_coscheduled(
9149                 isl_ctx *ctx, int val);
9150         int isl_options_get_ast_build_group_coscheduled(
9151                 isl_ctx *ctx);
9152         int isl_options_set_ast_build_scale_strides(
9153                 isl_ctx *ctx, int val);
9154         int isl_options_get_ast_build_scale_strides(
9155                 isl_ctx *ctx);
9156         int isl_options_set_ast_build_allow_else(isl_ctx *ctx,
9157                 int val);
9158         int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
9159         int isl_options_set_ast_build_allow_or(isl_ctx *ctx,
9160                 int val);
9161         int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
9163 =over
9165 =item * ast_build_atomic_upper_bound
9167 Generate loop upper bounds that consist of the current loop iterator,
9168 an operator and an expression not involving the iterator.
9169 If this option is not set, then the current loop iterator may appear
9170 several times in the upper bound.
9171 For example, when this option is turned off, AST generation
9172 for the schedule
9174         [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
9176 produces
9178         for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
9179           A(c0);
9181 When the option is turned on, the following AST is generated
9183         for (int c0 = 0; c0 <= min(100, n); c0 += 1)
9184           A(c0);
9186 =item * ast_build_prefer_pdiv
9188 If this option is turned off, then the AST generation will
9189 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
9190 operators, but no C<isl_ast_op_pdiv_q> or
9191 C<isl_ast_op_pdiv_r> operators.
9192 If this options is turned on, then C<isl> will try to convert
9193 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
9194 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
9196 =item * ast_build_exploit_nested_bounds
9198 Simplify conditions based on bounds of nested for loops.
9199 In particular, remove conditions that are implied by the fact
9200 that one or more nested loops have at least one iteration,
9201 meaning that the upper bound is at least as large as the lower bound.
9202 For example, when this option is turned off, AST generation
9203 for the schedule
9205         [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
9206                                         0 <= j <= M }
9208 produces
9210         if (M >= 0)
9211           for (int c0 = 0; c0 <= N; c0 += 1)
9212             for (int c1 = 0; c1 <= M; c1 += 1)
9213               A(c0, c1);
9215 When the option is turned on, the following AST is generated
9217         for (int c0 = 0; c0 <= N; c0 += 1)
9218           for (int c1 = 0; c1 <= M; c1 += 1)
9219             A(c0, c1);
9221 =item * ast_build_group_coscheduled
9223 If two domain elements are assigned the same schedule point, then
9224 they may be executed in any order and they may even appear in different
9225 loops.  If this options is set, then the AST generator will make
9226 sure that coscheduled domain elements do not appear in separate parts
9227 of the AST.  This is useful in case of nested AST generation
9228 if the outer AST generation is given only part of a schedule
9229 and the inner AST generation should handle the domains that are
9230 coscheduled by this initial part of the schedule together.
9231 For example if an AST is generated for a schedule
9233         { A[i] -> [0]; B[i] -> [0] }
9235 then the C<isl_ast_build_set_create_leaf> callback described
9236 below may get called twice, once for each domain.
9237 Setting this option ensures that the callback is only called once
9238 on both domains together.
9240 =item * ast_build_separation_bounds
9242 This option specifies which bounds to use during separation.
9243 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
9244 then all (possibly implicit) bounds on the current dimension will
9245 be used during separation.
9246 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
9247 then only those bounds that are explicitly available will
9248 be used during separation.
9250 =item * ast_build_scale_strides
9252 This option specifies whether the AST generator is allowed
9253 to scale down iterators of strided loops.
9255 =item * ast_build_allow_else
9257 This option specifies whether the AST generator is allowed
9258 to construct if statements with else branches.
9260 =item * ast_build_allow_or
9262 This option specifies whether the AST generator is allowed
9263 to construct if conditions with disjunctions.
9265 =back
9267 =head3 AST Generation Options (Schedule Tree)
9269 In case of AST construction from a schedule tree, the options
9270 that control how an AST is created from the individual schedule
9271 dimensions are stored in the band nodes of the tree
9272 (see L</"Schedule Trees">).
9274 In particular, a schedule dimension can be handled in four
9275 different ways, atomic, separate, unroll or the default.
9276 This loop AST generation type can be set using
9277 C<isl_schedule_node_band_member_set_ast_loop_type>.
9278 Alternatively,
9279 the first three can be selected by including a one-dimensional
9280 element with as value the position of the schedule dimension
9281 within the band and as name one of C<atomic>, C<separate>
9282 or C<unroll> in the options
9283 set by C<isl_schedule_node_band_set_ast_build_options>.
9284 Only one of these three may be specified for
9285 any given schedule dimension within a band node.
9286 If none of these is specified, then the default
9287 is used.  The meaning of the options is as follows.
9289 =over
9291 =item C<atomic>
9293 When this option is specified, the AST generator will make
9294 sure that a given domains space only appears in a single
9295 loop at the specified level.
9297 For example, for the schedule tree
9299         domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
9300         child:
9301           schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
9302           options: "{ atomic[x] }"
9304 the following AST will be generated
9306         for (int c0 = 0; c0 <= 10; c0 += 1) {
9307           if (c0 >= 1)
9308             b(c0 - 1);
9309           if (c0 <= 9)
9310             a(c0);
9311         }
9313 On the other hand, for the schedule tree
9315         domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
9316         child:
9317           schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
9318           options: "{ separate[x] }"
9320 the following AST will be generated
9322         {
9323           a(0);
9324           for (int c0 = 1; c0 <= 9; c0 += 1) {
9325             b(c0 - 1);
9326             a(c0);
9327           }
9328           b(9);
9329         }
9331 If neither C<atomic> nor C<separate> is specified, then the AST generator
9332 may produce either of these two results or some intermediate form.
9334 =item C<separate>
9336 When this option is specified, the AST generator will
9337 split the domain of the specified schedule dimension
9338 into pieces with a fixed set of statements for which
9339 instances need to be executed by the iterations in
9340 the schedule domain part.  This option tends to avoid
9341 the generation of guards inside the corresponding loops.
9342 See also the C<atomic> option.
9344 =item C<unroll>
9346 When this option is specified, the AST generator will
9347 I<completely> unroll the corresponding schedule dimension.
9348 It is the responsibility of the user to ensure that such
9349 unrolling is possible.
9350 To obtain a partial unrolling, the user should apply an additional
9351 strip-mining to the schedule and fully unroll the inner schedule
9352 dimension.
9354 =back
9356 The C<isolate> option is a bit more involved.  It allows the user
9357 to isolate a range of schedule dimension values from smaller and
9358 greater values.  Additionally, the user may specify a different
9359 atomic/separate/unroll choice for the isolated part and the remaining
9360 parts.  The typical use case of the C<isolate> option is to isolate
9361 full tiles from partial tiles.
9362 The part that needs to be isolated may depend on outer schedule dimensions.
9363 The option therefore needs to be able to reference those outer schedule
9364 dimensions.  In particular, the space of the C<isolate> option is that
9365 of a wrapped map with as domain the flat product of all outer band nodes
9366 and as range the space of the current band node.
9367 The atomic/separate/unroll choice for the isolated part is determined
9368 by an option that lives in an unnamed wrapped space with as domain
9369 a zero-dimensional C<isolate> space and as range the regular
9370 C<atomic>, C<separate> or C<unroll> space.
9371 This option may also be set directly using
9372 C<isl_schedule_node_band_member_set_isolate_ast_loop_type>.
9373 The atomic/separate/unroll choice for the remaining part is determined
9374 by the regular C<atomic>, C<separate> or C<unroll> option.
9375 The use of the C<isolate> option causes any tree containing the node
9376 to be considered anchored.
9378 As an example, consider the isolation of full tiles from partial tiles
9379 in a tiling of a triangular domain.  The original schedule is as follows.
9381         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
9382         child:
9383           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
9384                 { A[i,j] -> [floor(j/10)] }, \
9385                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
9387 The output is
9389         for (int c0 = 0; c0 <= 10; c0 += 1)
9390           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9391             for (int c2 = 10 * c0;
9392                  c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9393               for (int c3 = 10 * c1;
9394                    c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9395                 A(c2, c3);
9397 Isolating the full tiles, we have the following input
9399         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
9400         child:
9401           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
9402                 { A[i,j] -> [floor(j/10)] }, \
9403                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
9404           options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
9405                 10a+9+10b+9 <= 100 }"
9407 and output
9409         {
9410           for (int c0 = 0; c0 <= 8; c0 += 1) {
9411             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
9412               for (int c2 = 10 * c0;
9413                    c2 <= 10 * c0 + 9; c2 += 1)
9414                 for (int c3 = 10 * c1;
9415                      c3 <= 10 * c1 + 9; c3 += 1)
9416                   A(c2, c3);
9417             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
9418               for (int c2 = 10 * c0;
9419                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9420                 for (int c3 = 10 * c1;
9421                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9422                   A(c2, c3);
9423           }
9424           for (int c0 = 9; c0 <= 10; c0 += 1)
9425             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9426               for (int c2 = 10 * c0;
9427                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9428                 for (int c3 = 10 * c1;
9429                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9430                   A(c2, c3);
9431         }
9433 We may then additionally unroll the innermost loop of the isolated part
9435         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
9436         child:
9437           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
9438                 { A[i,j] -> [floor(j/10)] }, \
9439                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
9440           options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
9441                 10a+9+10b+9 <= 100; [isolate[] -> unroll[3]] }"
9443 to obtain
9445         {
9446           for (int c0 = 0; c0 <= 8; c0 += 1) {
9447             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
9448               for (int c2 = 10 * c0; c2 <= 10 * c0 + 9; c2 += 1) {
9449                 A(c2, 10 * c1);
9450                 A(c2, 10 * c1 + 1);
9451                 A(c2, 10 * c1 + 2);
9452                 A(c2, 10 * c1 + 3);
9453                 A(c2, 10 * c1 + 4);
9454                 A(c2, 10 * c1 + 5);
9455                 A(c2, 10 * c1 + 6);
9456                 A(c2, 10 * c1 + 7);
9457                 A(c2, 10 * c1 + 8);
9458                 A(c2, 10 * c1 + 9);
9459               }
9460             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
9461               for (int c2 = 10 * c0;
9462                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9463                 for (int c3 = 10 * c1;
9464                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9465                   A(c2, c3);
9466           }
9467           for (int c0 = 9; c0 <= 10; c0 += 1)
9468             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9469               for (int c2 = 10 * c0;
9470                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9471                 for (int c3 = 10 * c1;
9472                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9473                   A(c2, c3);
9474         }
9477 =head3 AST Generation Options (Schedule Map)
9479 In case of AST construction using
9480 C<isl_ast_build_node_from_schedule_map>, the options
9481 that control how an AST is created from the individual schedule
9482 dimensions are stored in the C<isl_ast_build>.
9483 They can be set using the following function.
9485         #include <isl/ast_build.h>
9486         __isl_give isl_ast_build *
9487         isl_ast_build_set_options(
9488                 __isl_take isl_ast_build *control,
9489                 __isl_take isl_union_map *options);
9491 The options are encoded in an C<isl_union_map>.
9492 The domain of this union relation refers to the schedule domain,
9493 i.e., the range of the schedule passed
9494 to C<isl_ast_build_node_from_schedule_map>.
9495 In the case of nested AST generation (see L</"Nested AST Generation">),
9496 the domain of C<options> should refer to the extra piece of the schedule.
9497 That is, it should be equal to the range of the wrapped relation in the
9498 range of the schedule.
9499 The range of the options can consist of elements in one or more spaces,
9500 the names of which determine the effect of the option.
9501 The values of the range typically also refer to the schedule dimension
9502 to which the option applies.  In case of nested AST generation
9503 (see L</"Nested AST Generation">), these values refer to the position
9504 of the schedule dimension within the innermost AST generation.
9505 The constraints on the domain elements of
9506 the option should only refer to this dimension and earlier dimensions.
9507 We consider the following spaces.
9509 =over
9511 =item C<separation_class>
9513 B<This option has been deprecated.  Use the isolate option on
9514 schedule trees instead.>
9516 This space is a wrapped relation between two one dimensional spaces.
9517 The input space represents the schedule dimension to which the option
9518 applies and the output space represents the separation class.
9519 While constructing a loop corresponding to the specified schedule
9520 dimension(s), the AST generator will try to generate separate loops
9521 for domain elements that are assigned different classes.
9522 If only some of the elements are assigned a class, then those elements
9523 that are not assigned any class will be treated as belonging to a class
9524 that is separate from the explicitly assigned classes.
9525 The typical use case for this option is to separate full tiles from
9526 partial tiles.
9527 The other options, described below, are applied after the separation
9528 into classes.
9530 As an example, consider the separation into full and partial tiles
9531 of a tiling of a triangular domain.
9532 Take, for example, the domain
9534         { A[i,j] : 0 <= i,j and i + j <= 100 }
9536 and a tiling into tiles of 10 by 10.  The input to the AST generator
9537 is then the schedule
9539         { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
9540                                                 i + j <= 100 }
9542 Without any options, the following AST is generated
9544         for (int c0 = 0; c0 <= 10; c0 += 1)
9545           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9546             for (int c2 = 10 * c0;
9547                  c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
9548                  c2 += 1)
9549               for (int c3 = 10 * c1;
9550                    c3 <= min(10 * c1 + 9, -c2 + 100);
9551                    c3 += 1)
9552                 A(c2, c3);
9554 Separation into full and partial tiles can be obtained by assigning
9555 a class, say C<0>, to the full tiles.  The full tiles are represented by those
9556 values of the first and second schedule dimensions for which there are
9557 values of the third and fourth dimensions to cover an entire tile.
9558 That is, we need to specify the following option
9560         { [a,b,c,d] -> separation_class[[0]->[0]] :
9561                 exists b': 0 <= 10a,10b' and
9562                            10a+9+10b'+9 <= 100;
9563           [a,b,c,d] -> separation_class[[1]->[0]] :
9564                 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
9566 which simplifies to
9568         { [a, b, c, d] -> separation_class[[1] -> [0]] :
9569                 a >= 0 and b >= 0 and b <= 8 - a;
9570           [a, b, c, d] -> separation_class[[0] -> [0]] :
9571                 a >= 0 and a <= 8 }
9573 With this option, the generated AST is as follows
9575         {
9576           for (int c0 = 0; c0 <= 8; c0 += 1) {
9577             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
9578               for (int c2 = 10 * c0;
9579                    c2 <= 10 * c0 + 9; c2 += 1)
9580                 for (int c3 = 10 * c1;
9581                      c3 <= 10 * c1 + 9; c3 += 1)
9582                   A(c2, c3);
9583             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
9584               for (int c2 = 10 * c0;
9585                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
9586                    c2 += 1)
9587                 for (int c3 = 10 * c1;
9588                      c3 <= min(-c2 + 100, 10 * c1 + 9);
9589                      c3 += 1)
9590                   A(c2, c3);
9591           }
9592           for (int c0 = 9; c0 <= 10; c0 += 1)
9593             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9594               for (int c2 = 10 * c0;
9595                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
9596                    c2 += 1)
9597                 for (int c3 = 10 * c1;
9598                      c3 <= min(10 * c1 + 9, -c2 + 100);
9599                      c3 += 1)
9600                   A(c2, c3);
9601         }
9603 =item C<separate>
9605 This is a single-dimensional space representing the schedule dimension(s)
9606 to which ``separation'' should be applied.  Separation tries to split
9607 a loop into several pieces if this can avoid the generation of guards
9608 inside the loop.
9609 See also the C<atomic> option.
9611 =item C<atomic>
9613 This is a single-dimensional space representing the schedule dimension(s)
9614 for which the domains should be considered ``atomic''.  That is, the
9615 AST generator will make sure that any given domain space will only appear
9616 in a single loop at the specified level.
9618 Consider the following schedule
9620         { a[i] -> [i] : 0 <= i < 10;
9621           b[i] -> [i+1] : 0 <= i < 10 }
9623 If the following option is specified
9625         { [i] -> separate[x] }
9627 then the following AST will be generated
9629         {
9630           a(0);
9631           for (int c0 = 1; c0 <= 9; c0 += 1) {
9632             a(c0);
9633             b(c0 - 1);
9634           }
9635           b(9);
9636         }
9638 If, on the other hand, the following option is specified
9640         { [i] -> atomic[x] }
9642 then the following AST will be generated
9644         for (int c0 = 0; c0 <= 10; c0 += 1) {
9645           if (c0 <= 9)
9646             a(c0);
9647           if (c0 >= 1)
9648             b(c0 - 1);
9649         }
9651 If neither C<atomic> nor C<separate> is specified, then the AST generator
9652 may produce either of these two results or some intermediate form.
9654 =item C<unroll>
9656 This is a single-dimensional space representing the schedule dimension(s)
9657 that should be I<completely> unrolled.
9658 To obtain a partial unrolling, the user should apply an additional
9659 strip-mining to the schedule and fully unroll the inner loop.
9661 =back
9663 =head3 Fine-grained Control over AST Generation
9665 Besides specifying the constraints on the parameters,
9666 an C<isl_ast_build> object can be used to control
9667 various aspects of the AST generation process.
9668 In case of AST construction using
9669 C<isl_ast_build_node_from_schedule_map>,
9670 the most prominent way of control is through ``options'',
9671 as explained above.
9673 Additional control is available through the following functions.
9675         #include <isl/ast_build.h>
9676         __isl_give isl_ast_build *
9677         isl_ast_build_set_iterators(
9678                 __isl_take isl_ast_build *control,
9679                 __isl_take isl_id_list *iterators);
9681 The function C<isl_ast_build_set_iterators> allows the user to
9682 specify a list of iterator C<isl_id>s to be used as iterators.
9683 If the input schedule is injective, then
9684 the number of elements in this list should be as large as the dimension
9685 of the schedule space, but no direct correspondence should be assumed
9686 between dimensions and elements.
9687 If the input schedule is not injective, then an additional number
9688 of C<isl_id>s equal to the largest dimension of the input domains
9689 may be required.
9690 If the number of provided C<isl_id>s is insufficient, then additional
9691 names are automatically generated.
9693         #include <isl/ast_build.h>
9694         __isl_give isl_ast_build *
9695         isl_ast_build_set_create_leaf(
9696                 __isl_take isl_ast_build *control,
9697                 __isl_give isl_ast_node *(*fn)(
9698                         __isl_take isl_ast_build *build,
9699                         void *user), void *user);
9702 C<isl_ast_build_set_create_leaf> function allows for the
9703 specification of a callback that should be called whenever the AST
9704 generator arrives at an element of the schedule domain.
9705 The callback should return an AST node that should be inserted
9706 at the corresponding position of the AST.  The default action (when
9707 the callback is not set) is to continue generating parts of the AST to scan
9708 all the domain elements associated to the schedule domain element
9709 and to insert user nodes, ``calling'' the domain element, for each of them.
9710 The C<build> argument contains the current state of the C<isl_ast_build>.
9711 To ease nested AST generation (see L</"Nested AST Generation">),
9712 all control information that is
9713 specific to the current AST generation such as the options and
9714 the callbacks has been removed from this C<isl_ast_build>.
9715 The callback would typically return the result of a nested
9716 AST generation or a
9717 user defined node created using the following function.
9719         #include <isl/ast.h>
9720         __isl_give isl_ast_node *isl_ast_node_alloc_user(
9721                 __isl_take isl_ast_expr *expr);
9723         #include <isl/ast_build.h>
9724         __isl_give isl_ast_build *
9725         isl_ast_build_set_at_each_domain(
9726                 __isl_take isl_ast_build *build,
9727                 __isl_give isl_ast_node *(*fn)(
9728                         __isl_take isl_ast_node *node,
9729                         __isl_keep isl_ast_build *build,
9730                         void *user), void *user);
9731         __isl_give isl_ast_build *
9732         isl_ast_build_set_before_each_for(
9733                 __isl_take isl_ast_build *build,
9734                 __isl_give isl_id *(*fn)(
9735                         __isl_keep isl_ast_build *build,
9736                         void *user), void *user);
9737         __isl_give isl_ast_build *
9738         isl_ast_build_set_after_each_for(
9739                 __isl_take isl_ast_build *build,
9740                 __isl_give isl_ast_node *(*fn)(
9741                         __isl_take isl_ast_node *node,
9742                         __isl_keep isl_ast_build *build,
9743                         void *user), void *user);
9744         __isl_give isl_ast_build *
9745         isl_ast_build_set_before_each_mark(
9746                 __isl_take isl_ast_build *build,
9747                 int (*fn)(__isl_keep isl_id *mark,
9748                         __isl_keep isl_ast_build *build,
9749                         void *user), void *user);
9750         __isl_give isl_ast_build *
9751         isl_ast_build_set_after_each_mark(
9752                 __isl_take isl_ast_build *build,
9753                 __isl_give isl_ast_node *(*fn)(
9754                         __isl_take isl_ast_node *node,
9755                         __isl_keep isl_ast_build *build,
9756                         void *user), void *user);
9758 The callback set by C<isl_ast_build_set_at_each_domain> will
9759 be called for each domain AST node.
9760 The callbacks set by C<isl_ast_build_set_before_each_for>
9761 and C<isl_ast_build_set_after_each_for> will be called
9762 for each for AST node.  The first will be called in depth-first
9763 pre-order, while the second will be called in depth-first post-order.
9764 Since C<isl_ast_build_set_before_each_for> is called before the for
9765 node is actually constructed, it is only passed an C<isl_ast_build>.
9766 The returned C<isl_id> will be added as an annotation (using
9767 C<isl_ast_node_set_annotation>) to the constructed for node.
9768 In particular, if the user has also specified an C<after_each_for>
9769 callback, then the annotation can be retrieved from the node passed to
9770 that callback using C<isl_ast_node_get_annotation>.
9771 The callbacks set by C<isl_ast_build_set_before_each_mark>
9772 and C<isl_ast_build_set_after_each_mark> will be called for each
9773 mark AST node that is created, i.e., for each mark schedule node
9774 in the input schedule tree.  The first will be called in depth-first
9775 pre-order, while the second will be called in depth-first post-order.
9776 Since the callback set by C<isl_ast_build_set_before_each_mark>
9777 is called before the mark AST node is actually constructed, it is passed
9778 the identifier of the mark node.
9779 All callbacks should C<NULL> (or -1) on failure.
9780 The given C<isl_ast_build> can be used to create new
9781 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
9782 or C<isl_ast_build_call_from_pw_multi_aff>.
9784 =head3 Nested AST Generation
9786 C<isl> allows the user to create an AST within the context
9787 of another AST.  These nested ASTs are created using the
9788 same C<isl_ast_build_node_from_schedule_map> function that is used to create
9789 the outer AST.  The C<build> argument should be an C<isl_ast_build>
9790 passed to a callback set by
9791 C<isl_ast_build_set_create_leaf>.
9792 The space of the range of the C<schedule> argument should refer
9793 to this build.  In particular, the space should be a wrapped
9794 relation and the domain of this wrapped relation should be the
9795 same as that of the range of the schedule returned by
9796 C<isl_ast_build_get_schedule> below.
9797 In practice, the new schedule is typically
9798 created by calling C<isl_union_map_range_product> on the old schedule
9799 and some extra piece of the schedule.
9800 The space of the schedule domain is also available from
9801 the C<isl_ast_build>.
9803         #include <isl/ast_build.h>
9804         __isl_give isl_union_map *isl_ast_build_get_schedule(
9805                 __isl_keep isl_ast_build *build);
9806         __isl_give isl_space *isl_ast_build_get_schedule_space(
9807                 __isl_keep isl_ast_build *build);
9808         __isl_give isl_ast_build *isl_ast_build_restrict(
9809                 __isl_take isl_ast_build *build,
9810                 __isl_take isl_set *set);
9812 The C<isl_ast_build_get_schedule> function returns a (partial)
9813 schedule for the domains elements for which part of the AST still needs to
9814 be generated in the current build.
9815 In particular, the domain elements are mapped to those iterations of the loops
9816 enclosing the current point of the AST generation inside which
9817 the domain elements are executed.
9818 No direct correspondence between
9819 the input schedule and this schedule should be assumed.
9820 The space obtained from C<isl_ast_build_get_schedule_space> can be used
9821 to create a set for C<isl_ast_build_restrict> to intersect
9822 with the current build.  In particular, the set passed to
9823 C<isl_ast_build_restrict> can have additional parameters.
9824 The ids of the set dimensions in the space returned by
9825 C<isl_ast_build_get_schedule_space> correspond to the
9826 iterators of the already generated loops.
9827 The user should not rely on the ids of the output dimensions
9828 of the relations in the union relation returned by
9829 C<isl_ast_build_get_schedule> having any particular value.
9831 =head1 Applications
9833 Although C<isl> is mainly meant to be used as a library,
9834 it also contains some basic applications that use some
9835 of the functionality of C<isl>.
9836 The input may be specified in either the L<isl format>
9837 or the L<PolyLib format>.
9839 =head2 C<isl_polyhedron_sample>
9841 C<isl_polyhedron_sample> takes a polyhedron as input and prints
9842 an integer element of the polyhedron, if there is any.
9843 The first column in the output is the denominator and is always
9844 equal to 1.  If the polyhedron contains no integer points,
9845 then a vector of length zero is printed.
9847 =head2 C<isl_pip>
9849 C<isl_pip> takes the same input as the C<example> program
9850 from the C<piplib> distribution, i.e., a set of constraints
9851 on the parameters, a line containing only -1 and finally a set
9852 of constraints on a parametric polyhedron.
9853 The coefficients of the parameters appear in the last columns
9854 (but before the final constant column).
9855 The output is the lexicographic minimum of the parametric polyhedron.
9856 As C<isl> currently does not have its own output format, the output
9857 is just a dump of the internal state.
9859 =head2 C<isl_polyhedron_minimize>
9861 C<isl_polyhedron_minimize> computes the minimum of some linear
9862 or affine objective function over the integer points in a polyhedron.
9863 If an affine objective function
9864 is given, then the constant should appear in the last column.
9866 =head2 C<isl_polytope_scan>
9868 Given a polytope, C<isl_polytope_scan> prints
9869 all integer points in the polytope.
9871 =head2 C<isl_codegen>
9873 Given a schedule, a context set and an options relation,
9874 C<isl_codegen> prints out an AST that scans the domain elements
9875 of the schedule in the order of their image(s) taking into account
9876 the constraints in the context set.