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