Expose, document and test isl_map_get_basic_map_list
[isl.git] / doc / user.pod
blob8a1f7e45f960f1e43b52df53f08b47e5b6b42357
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 =head2 Return Types
612 C<isl> uses two special return types for functions that either return
613 a boolean or that in principle do not return anything.
614 In particular, the C<isl_bool> type has three possible values:
615 C<isl_bool_true> (a positive integer value), indicating I<true> or I<yes>;
616 C<isl_bool_false> (the integer value zero), indicating I<false> or I<no>; and
617 C<isl_bool_error> (a negative integer value), indicating that something
618 went wrong.  The following function can be used to negate an C<isl_bool>,
619 where the negation of C<isl_bool_error> is C<isl_bool_error> again.
621         #include <isl/val.h>
622         isl_bool isl_bool_not(isl_bool b);
624 The C<isl_stat> type has two possible values:
625 C<isl_stat_ok> (the integer value zero), indicating a successful
626 operation; and
627 C<isl_stat_error> (a negative integer value), indicating that something
628 went wrong.
629 See L</"Error Handling"> for more information on
630 C<isl_bool_error> and C<isl_stat_error>.
632 =head2 Values
634 An C<isl_val> represents an integer value, a rational value
635 or one of three special values, infinity, negative infinity and NaN.
636 Some predefined values can be created using the following functions.
638         #include <isl/val.h>
639         __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
640         __isl_give isl_val *isl_val_one(isl_ctx *ctx);
641         __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
642         __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
643         __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
644         __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
646 Specific integer values can be created using the following functions.
648         #include <isl/val.h>
649         __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
650                 long i);
651         __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
652                 unsigned long u);
653         __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
654                 size_t n, size_t size, const void *chunks);
656 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
657 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
658 The least significant digit is assumed to be stored first.
660 Value objects can be copied and freed using the following functions.
662         #include <isl/val.h>
663         __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
664         __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
666 They can be inspected using the following functions.
668         #include <isl/val.h>
669         long isl_val_get_num_si(__isl_keep isl_val *v);
670         long isl_val_get_den_si(__isl_keep isl_val *v);
671         __isl_give isl_val *isl_val_get_den_val(
672                 __isl_keep isl_val *v);
673         double isl_val_get_d(__isl_keep isl_val *v);
674         size_t isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
675                 size_t size);
676         int isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
677                 size_t size, void *chunks);
679 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
680 of C<size> bytes needed to store the absolute value of the
681 numerator of C<v>.
682 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
683 which is assumed to have been preallocated by the caller.
684 The least significant digit is stored first.
685 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
686 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
687 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
689 An C<isl_val> can be modified using the following function.
691         #include <isl/val.h>
692         __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
693                 long i);
695 The following unary properties are defined on C<isl_val>s.
697         #include <isl/val.h>
698         int isl_val_sgn(__isl_keep isl_val *v);
699         isl_bool isl_val_is_zero(__isl_keep isl_val *v);
700         isl_bool isl_val_is_one(__isl_keep isl_val *v);
701         isl_bool isl_val_is_negone(__isl_keep isl_val *v);
702         isl_bool isl_val_is_nonneg(__isl_keep isl_val *v);
703         isl_bool isl_val_is_nonpos(__isl_keep isl_val *v);
704         isl_bool isl_val_is_pos(__isl_keep isl_val *v);
705         isl_bool isl_val_is_neg(__isl_keep isl_val *v);
706         isl_bool isl_val_is_int(__isl_keep isl_val *v);
707         isl_bool isl_val_is_rat(__isl_keep isl_val *v);
708         isl_bool isl_val_is_nan(__isl_keep isl_val *v);
709         isl_bool isl_val_is_infty(__isl_keep isl_val *v);
710         isl_bool isl_val_is_neginfty(__isl_keep isl_val *v);
712 Note that the sign of NaN is undefined.
714 The following binary properties are defined on pairs of C<isl_val>s.
716         #include <isl/val.h>
717         isl_bool isl_val_lt(__isl_keep isl_val *v1,
718                 __isl_keep isl_val *v2);
719         isl_bool isl_val_le(__isl_keep isl_val *v1,
720                 __isl_keep isl_val *v2);
721         isl_bool isl_val_gt(__isl_keep isl_val *v1,
722                 __isl_keep isl_val *v2);
723         isl_bool isl_val_ge(__isl_keep isl_val *v1,
724                 __isl_keep isl_val *v2);
725         isl_bool isl_val_eq(__isl_keep isl_val *v1,
726                 __isl_keep isl_val *v2);
727         isl_bool isl_val_ne(__isl_keep isl_val *v1,
728                 __isl_keep isl_val *v2);
729         isl_bool isl_val_abs_eq(__isl_keep isl_val *v1,
730                 __isl_keep isl_val *v2);
732 Comparisons to NaN always return false.
733 That is, a NaN is not considered to hold any relative position
734 with respect to any value.  In particular, a NaN
735 is neither considered to be equal to nor to be different from
736 any value (including another NaN).
737 The function C<isl_val_abs_eq> checks whether its two arguments
738 are equal in absolute value.
740 For integer C<isl_val>s we additionally have the following binary property.
742         #include <isl/val.h>
743         isl_bool isl_val_is_divisible_by(__isl_keep isl_val *v1,
744                 __isl_keep isl_val *v2);
746 An C<isl_val> can also be compared to an integer using the following
747 functions.  The result of C<isl_val_cmp_si> undefined for NaN.
749         #include <isl/val.h>
750         isl_bool isl_val_gt_si(__isl_keep isl_val *v, long i);
751         int isl_val_cmp_si(__isl_keep isl_val *v, long i);
753 The following unary operations are available on C<isl_val>s.
755         #include <isl/val.h>
756         __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
757         __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
758         __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
759         __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
760         __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
761         __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
762         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
764 The following binary operations are available on C<isl_val>s.
766         #include <isl/val.h>
767         __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
768                 __isl_take isl_val *v2);
769         __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
770                 __isl_take isl_val *v2);
771         __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
772                 __isl_take isl_val *v2);
773         __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
774                 unsigned long v2);
775         __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
776                 __isl_take isl_val *v2);
777         __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
778                 unsigned long v2);
779         __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
780                 __isl_take isl_val *v2);
781         __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
782                 unsigned long v2);
783         __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
784                 __isl_take isl_val *v2);
785         __isl_give isl_val *isl_val_div_ui(__isl_take isl_val *v1,
786                 unsigned long v2);
788 On integer values, we additionally have the following operations.
790         #include <isl/val.h>
791         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
792         __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
793                 __isl_take isl_val *v2);
794         __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
795                 __isl_take isl_val *v2);
796         __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
797                 __isl_take isl_val *v2, __isl_give isl_val **x,
798                 __isl_give isl_val **y);
800 The function C<isl_val_gcdext> returns the greatest common divisor g
801 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
802 that C<*x> * C<v1> + C<*y> * C<v2> = g.
804 =head3 GMP specific functions
806 These functions are only available if C<isl> has been compiled with C<GMP>
807 support.
809 Specific integer and rational values can be created from C<GMP> values using
810 the following functions.
812         #include <isl/val_gmp.h>
813         __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
814                 mpz_t z);
815         __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
816                 const mpz_t n, const mpz_t d);
818 The numerator and denominator of a rational value can be extracted as
819 C<GMP> values using the following functions.
821         #include <isl/val_gmp.h>
822         int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
823         int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
825 =head2 Sets and Relations
827 C<isl> uses six types of objects for representing sets and relations,
828 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
829 C<isl_union_set> and C<isl_union_map>.
830 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
831 can be described as a conjunction of affine constraints, while
832 C<isl_set> and C<isl_map> represent unions of
833 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
834 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
835 to live in the same space.  C<isl_union_set>s and C<isl_union_map>s
836 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
837 where spaces are considered different if they have a different number
838 of dimensions and/or different names (see L<"Spaces">).
839 The difference between sets and relations (maps) is that sets have
840 one set of variables, while relations have two sets of variables,
841 input variables and output variables.
843 =head2 Error Handling
845 C<isl> supports different ways to react in case a runtime error is triggered.
846 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
847 with two maps that have incompatible spaces. There are three possible ways
848 to react on error: to warn, to continue or to abort.
850 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
851 the last error in the corresponding C<isl_ctx> and the function in which the
852 error was triggered returns a value indicating that some error has
853 occurred.  In case of functions returning a pointer, this value is
854 C<NULL>.  In case of functions returning an C<isl_bool> or an
855 C<isl_stat>, this value is C<isl_bool_error> or C<isl_stat_error>.
856 An error does not corrupt internal state,
857 such that isl can continue to be used. C<isl> also provides functions to
858 read the last error, including the specific error message,
859 the isl source file where the error occurred and the line number,
860 and to reset all information about the last error. The
861 last error is only stored for information purposes. Its presence does not
862 change the behavior of C<isl>. Hence, resetting an error is not required to
863 continue to use isl, but only to observe new errors.
865         #include <isl/ctx.h>
866         enum isl_error isl_ctx_last_error(isl_ctx *ctx);
867         const char *isl_ctx_last_error_msg(isl_ctx *ctx);
868         const char *isl_ctx_last_error_file(isl_ctx *ctx);
869         int isl_ctx_last_error_line(isl_ctx *ctx);
870         void isl_ctx_reset_error(isl_ctx *ctx);
872 If no error has occurred since the last call to C<isl_ctx_reset_error>,
873 then the functions C<isl_ctx_last_error_msg> and
874 C<isl_ctx_last_error_file> return C<NULL>.
876 Another option is to continue on error. This is similar to warn on error mode,
877 except that C<isl> does not print any warning. This allows a program to
878 implement its own error reporting.
880 The last option is to directly abort the execution of the program from within
881 the isl library. This makes it obviously impossible to recover from an error,
882 but it allows to directly spot the error location. By aborting on error,
883 debuggers break at the location the error occurred and can provide a stack
884 trace. Other tools that automatically provide stack traces on abort or that do
885 not want to continue execution after an error was triggered may also prefer to
886 abort on error.
888 The on error behavior of isl can be specified by calling
889 C<isl_options_set_on_error> or by setting the command line option
890 C<--isl-on-error>. Valid arguments for the function call are
891 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
892 choices for the command line option are C<warn>, C<continue> and C<abort>.
893 It is also possible to query the current error mode.
895         #include <isl/options.h>
896         isl_stat isl_options_set_on_error(isl_ctx *ctx, int val);
897         int isl_options_get_on_error(isl_ctx *ctx);
899 =head2 Identifiers
901 Identifiers are used to identify both individual dimensions
902 and tuples of dimensions.  They consist of an optional name and an optional
903 user pointer.  The name and the user pointer cannot both be C<NULL>, however.
904 Identifiers with the same name but different pointer values
905 are considered to be distinct.
906 Similarly, identifiers with different names but the same pointer value
907 are also considered to be distinct.
908 Equal identifiers are represented using the same object.
909 Pairs of identifiers can therefore be tested for equality using the
910 C<==> operator.
911 Identifiers can be constructed, copied, freed, inspected and printed
912 using the following functions.
914         #include <isl/id.h>
915         __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
916                 __isl_keep const char *name, void *user);
917         __isl_give isl_id *isl_id_set_free_user(
918                 __isl_take isl_id *id,
919                 void (*free_user)(void *user));
920         __isl_give isl_id *isl_id_copy(isl_id *id);
921         __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
923         void *isl_id_get_user(__isl_keep isl_id *id);
924         __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
926         __isl_give isl_printer *isl_printer_print_id(
927                 __isl_take isl_printer *p, __isl_keep isl_id *id);
929 The callback set by C<isl_id_set_free_user> is called on the user
930 pointer when the last reference to the C<isl_id> is freed.
931 Note that C<isl_id_get_name> returns a pointer to some internal
932 data structure, so the result can only be used while the
933 corresponding C<isl_id> is alive.
935 =head2 Spaces
937 Whenever a new set, relation or similar object is created from scratch,
938 the space in which it lives needs to be specified using an C<isl_space>.
939 Each space involves zero or more parameters and zero, one or two
940 tuples of set or input/output dimensions.  The parameters and dimensions
941 are identified by an C<isl_dim_type> and a position.
942 The type C<isl_dim_param> refers to parameters,
943 the type C<isl_dim_set> refers to set dimensions (for spaces
944 with a single tuple of dimensions) and the types C<isl_dim_in>
945 and C<isl_dim_out> refer to input and output dimensions
946 (for spaces with two tuples of dimensions).
947 Local spaces (see L</"Local Spaces">) also contain dimensions
948 of type C<isl_dim_div>.
949 Note that parameters are only identified by their position within
950 a given object.  Across different objects, parameters are (usually)
951 identified by their names or identifiers.  Only unnamed parameters
952 are identified by their positions across objects.  The use of unnamed
953 parameters is discouraged.
955         #include <isl/space.h>
956         __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
957                 unsigned nparam, unsigned n_in, unsigned n_out);
958         __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
959                 unsigned nparam);
960         __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
961                 unsigned nparam, unsigned dim);
962         __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
963         __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
965 The space used for creating a parameter domain
966 needs to be created using C<isl_space_params_alloc>.
967 For other sets, the space
968 needs to be created using C<isl_space_set_alloc>, while
969 for a relation, the space
970 needs to be created using C<isl_space_alloc>.
972 To check whether a given space is that of a set or a map
973 or whether it is a parameter space, use these functions:
975         #include <isl/space.h>
976         isl_bool isl_space_is_params(__isl_keep isl_space *space);
977         isl_bool isl_space_is_set(__isl_keep isl_space *space);
978         isl_bool isl_space_is_map(__isl_keep isl_space *space);
980 Spaces can be compared using the following functions:
982         #include <isl/space.h>
983         isl_bool isl_space_is_equal(__isl_keep isl_space *space1,
984                 __isl_keep isl_space *space2);
985         isl_bool isl_space_has_equal_params(
986                 __isl_keep isl_space *space1,
987                 __isl_keep isl_space *space2);
988         isl_bool isl_space_has_equal_tuples(
989                 __isl_keep isl_space *space1,
990                 __isl_keep isl_space *space2);
991         isl_bool isl_space_is_domain(__isl_keep isl_space *space1,
992                 __isl_keep isl_space *space2);
993         isl_bool isl_space_is_range(__isl_keep isl_space *space1,
994                 __isl_keep isl_space *space2);
995         isl_bool isl_space_tuple_is_equal(
996                 __isl_keep isl_space *space1,
997                 enum isl_dim_type type1,
998                 __isl_keep isl_space *space2,
999                 enum isl_dim_type type2);
1001 C<isl_space_is_domain> checks whether the first argument is equal
1002 to the domain of the second argument.  This requires in particular that
1003 the first argument is a set space and that the second argument
1004 is a map space.  C<isl_space_tuple_is_equal> checks whether the given
1005 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
1006 spaces are the same.  That is, it checks if they have the same
1007 identifier (if any), the same dimension and the same internal structure
1008 (if any).
1009 The function
1010 C<isl_space_has_equal_params> checks whether two spaces
1011 have the same parameters in the same order.
1012 C<isl_space_has_equal_tuples> check whether two spaces have
1013 the same tuples.  In contrast to C<isl_space_is_equal> below,
1014 it does not check the
1015 parameters.  This is useful because many C<isl> functions align the
1016 parameters before they perform their operations, such that equivalence
1017 is not necessary.
1018 C<isl_space_is_equal> checks whether two spaces are identical,
1019 meaning that they have the same parameters and the same tuples.
1020 That is, it checks whether both C<isl_space_has_equal_params> and
1021 C<isl_space_has_equal_tuples> hold.
1023 It is often useful to create objects that live in the
1024 same space as some other object.  This can be accomplished
1025 by creating the new objects
1026 (see L</"Creating New Sets and Relations"> or
1027 L</"Functions">) based on the space
1028 of the original object.
1030         #include <isl/set.h>
1031         __isl_give isl_space *isl_basic_set_get_space(
1032                 __isl_keep isl_basic_set *bset);
1033         __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
1035         #include <isl/union_set.h>
1036         __isl_give isl_space *isl_union_set_get_space(
1037                 __isl_keep isl_union_set *uset);
1039         #include <isl/map.h>
1040         __isl_give isl_space *isl_basic_map_get_space(
1041                 __isl_keep isl_basic_map *bmap);
1042         __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
1044         #include <isl/union_map.h>
1045         __isl_give isl_space *isl_union_map_get_space(
1046                 __isl_keep isl_union_map *umap);
1048         #include <isl/constraint.h>
1049         __isl_give isl_space *isl_constraint_get_space(
1050                 __isl_keep isl_constraint *constraint);
1052         #include <isl/polynomial.h>
1053         __isl_give isl_space *isl_qpolynomial_get_domain_space(
1054                 __isl_keep isl_qpolynomial *qp);
1055         __isl_give isl_space *isl_qpolynomial_get_space(
1056                 __isl_keep isl_qpolynomial *qp);
1057         __isl_give isl_space *
1058         isl_qpolynomial_fold_get_domain_space(
1059                 __isl_keep isl_qpolynomial_fold *fold);
1060         __isl_give isl_space *isl_qpolynomial_fold_get_space(
1061                 __isl_keep isl_qpolynomial_fold *fold);
1062         __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
1063                 __isl_keep isl_pw_qpolynomial *pwqp);
1064         __isl_give isl_space *isl_pw_qpolynomial_get_space(
1065                 __isl_keep isl_pw_qpolynomial *pwqp);
1066         __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
1067                 __isl_keep isl_pw_qpolynomial_fold *pwf);
1068         __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
1069                 __isl_keep isl_pw_qpolynomial_fold *pwf);
1070         __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
1071                 __isl_keep isl_union_pw_qpolynomial *upwqp);
1072         __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
1073                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
1075         #include <isl/val.h>
1076         __isl_give isl_space *isl_multi_val_get_space(
1077                 __isl_keep isl_multi_val *mv);
1079         #include <isl/aff.h>
1080         __isl_give isl_space *isl_aff_get_domain_space(
1081                 __isl_keep isl_aff *aff);
1082         __isl_give isl_space *isl_aff_get_space(
1083                 __isl_keep isl_aff *aff);
1084         __isl_give isl_space *isl_pw_aff_get_domain_space(
1085                 __isl_keep isl_pw_aff *pwaff);
1086         __isl_give isl_space *isl_pw_aff_get_space(
1087                 __isl_keep isl_pw_aff *pwaff);
1088         __isl_give isl_space *isl_multi_aff_get_domain_space(
1089                 __isl_keep isl_multi_aff *maff);
1090         __isl_give isl_space *isl_multi_aff_get_space(
1091                 __isl_keep isl_multi_aff *maff);
1092         __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
1093                 __isl_keep isl_pw_multi_aff *pma);
1094         __isl_give isl_space *isl_pw_multi_aff_get_space(
1095                 __isl_keep isl_pw_multi_aff *pma);
1096         __isl_give isl_space *isl_union_pw_aff_get_space(
1097                 __isl_keep isl_union_pw_aff *upa);
1098         __isl_give isl_space *isl_union_pw_multi_aff_get_space(
1099                 __isl_keep isl_union_pw_multi_aff *upma);
1100         __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
1101                 __isl_keep isl_multi_pw_aff *mpa);
1102         __isl_give isl_space *isl_multi_pw_aff_get_space(
1103                 __isl_keep isl_multi_pw_aff *mpa);
1104         __isl_give isl_space *
1105         isl_multi_union_pw_aff_get_domain_space(
1106                 __isl_keep isl_multi_union_pw_aff *mupa);
1107         __isl_give isl_space *
1108         isl_multi_union_pw_aff_get_space(
1109                 __isl_keep isl_multi_union_pw_aff *mupa);
1111         #include <isl/point.h>
1112         __isl_give isl_space *isl_point_get_space(
1113                 __isl_keep isl_point *pnt);
1115 The number of dimensions of a given type of space
1116 may be read off from a space or an object that lives
1117 in a space using the following functions.
1118 In case of C<isl_space_dim>, type may be
1119 C<isl_dim_param>, C<isl_dim_in> (only for relations),
1120 C<isl_dim_out> (only for relations), C<isl_dim_set>
1121 (only for sets) or C<isl_dim_all>.
1123         #include <isl/space.h>
1124         unsigned isl_space_dim(__isl_keep isl_space *space,
1125                 enum isl_dim_type type);
1127         #include <isl/local_space.h>
1128         int isl_local_space_dim(__isl_keep isl_local_space *ls,
1129                 enum isl_dim_type type);
1131         #include <isl/set.h>
1132         unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1133                 enum isl_dim_type type);
1134         unsigned isl_set_dim(__isl_keep isl_set *set,
1135                 enum isl_dim_type type);
1137         #include <isl/union_set.h>
1138         unsigned isl_union_set_dim(__isl_keep isl_union_set *uset,
1139                 enum isl_dim_type type);
1141         #include <isl/map.h>
1142         unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1143                 enum isl_dim_type type);
1144         unsigned isl_map_dim(__isl_keep isl_map *map,
1145                 enum isl_dim_type type);
1147         #include <isl/union_map.h>
1148         unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
1149                 enum isl_dim_type type);
1151         #include <isl/val.h>
1152         unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1153                 enum isl_dim_type type);
1155         #include <isl/aff.h>
1156         int isl_aff_dim(__isl_keep isl_aff *aff,
1157                 enum isl_dim_type type);
1158         unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1159                 enum isl_dim_type type);
1160         unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1161                 enum isl_dim_type type);
1162         unsigned isl_pw_multi_aff_dim(
1163                 __isl_keep isl_pw_multi_aff *pma,
1164                 enum isl_dim_type type);
1165         unsigned isl_multi_pw_aff_dim(
1166                 __isl_keep isl_multi_pw_aff *mpa,
1167                 enum isl_dim_type type);
1168         unsigned isl_union_pw_aff_dim(
1169                 __isl_keep isl_union_pw_aff *upa,
1170                 enum isl_dim_type type);
1171         unsigned isl_union_pw_multi_aff_dim(
1172                 __isl_keep isl_union_pw_multi_aff *upma,
1173                 enum isl_dim_type type);
1174         unsigned isl_multi_union_pw_aff_dim(
1175                 __isl_keep isl_multi_union_pw_aff *mupa,
1176                 enum isl_dim_type type);
1178         #include <isl/polynomial.h>
1179         unsigned isl_union_pw_qpolynomial_dim(
1180                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1181                 enum isl_dim_type type);
1182         unsigned isl_union_pw_qpolynomial_fold_dim(
1183                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1184                 enum isl_dim_type type);
1186 Note that an C<isl_union_set>, an C<isl_union_map>,
1187 an C<isl_union_pw_multi_aff>,
1188 an C<isl_union_pw_qpolynomial> and
1189 an C<isl_union_pw_qpolynomial_fold>
1190 only have parameters.
1192 Additional parameters can be added to a space using the following function.
1194         #include <isl/space.h>
1195         __isl_give isl_space *isl_space_add_param_id(
1196                 __isl_take isl_space *space,
1197                 __isl_take isl_id *id);
1199 If a parameter with the given identifier already appears in the space,
1200 then it is not added again.
1202 The identifiers or names of the individual dimensions of spaces
1203 may be set or read off using the following functions on spaces
1204 or objects that live in spaces.
1205 These functions are mostly useful to obtain the identifiers, positions
1206 or names of the parameters.  Identifiers of individual dimensions are
1207 essentially only useful for printing.  They are ignored by all other
1208 operations and may not be preserved across those operations.
1210         #include <isl/space.h>
1211         __isl_give isl_space *isl_space_set_dim_id(
1212                 __isl_take isl_space *space,
1213                 enum isl_dim_type type, unsigned pos,
1214                 __isl_take isl_id *id);
1215         isl_bool isl_space_has_dim_id(__isl_keep isl_space *space,
1216                 enum isl_dim_type type, unsigned pos);
1217         __isl_give isl_id *isl_space_get_dim_id(
1218                 __isl_keep isl_space *space,
1219                 enum isl_dim_type type, unsigned pos);
1220         __isl_give isl_space *isl_space_set_dim_name(
1221                 __isl_take isl_space *space,
1222                  enum isl_dim_type type, unsigned pos,
1223                  __isl_keep const char *name);
1224         isl_bool isl_space_has_dim_name(__isl_keep isl_space *space,
1225                 enum isl_dim_type type, unsigned pos);
1226         __isl_keep const char *isl_space_get_dim_name(
1227                 __isl_keep isl_space *space,
1228                 enum isl_dim_type type, unsigned pos);
1230         #include <isl/local_space.h>
1231         __isl_give isl_local_space *isl_local_space_set_dim_id(
1232                 __isl_take isl_local_space *ls,
1233                 enum isl_dim_type type, unsigned pos,
1234                 __isl_take isl_id *id);
1235         isl_bool isl_local_space_has_dim_id(
1236                 __isl_keep isl_local_space *ls,
1237                 enum isl_dim_type type, unsigned pos);
1238         __isl_give isl_id *isl_local_space_get_dim_id(
1239                 __isl_keep isl_local_space *ls,
1240                 enum isl_dim_type type, unsigned pos);
1241         __isl_give isl_local_space *isl_local_space_set_dim_name(
1242                 __isl_take isl_local_space *ls,
1243                 enum isl_dim_type type, unsigned pos, const char *s);
1244         isl_bool isl_local_space_has_dim_name(
1245                 __isl_keep isl_local_space *ls,
1246                 enum isl_dim_type type, unsigned pos)
1247         const char *isl_local_space_get_dim_name(
1248                 __isl_keep isl_local_space *ls,
1249                 enum isl_dim_type type, unsigned pos);
1251         #include <isl/constraint.h>
1252         const char *isl_constraint_get_dim_name(
1253                 __isl_keep isl_constraint *constraint,
1254                 enum isl_dim_type type, unsigned pos);
1256         #include <isl/set.h>
1257         __isl_give isl_id *isl_basic_set_get_dim_id(
1258                 __isl_keep isl_basic_set *bset,
1259                 enum isl_dim_type type, unsigned pos);
1260         __isl_give isl_set *isl_set_set_dim_id(
1261                 __isl_take isl_set *set, enum isl_dim_type type,
1262                 unsigned pos, __isl_take isl_id *id);
1263         isl_bool isl_set_has_dim_id(__isl_keep isl_set *set,
1264                 enum isl_dim_type type, unsigned pos);
1265         __isl_give isl_id *isl_set_get_dim_id(
1266                 __isl_keep isl_set *set, enum isl_dim_type type,
1267                 unsigned pos);
1268         const char *isl_basic_set_get_dim_name(
1269                 __isl_keep isl_basic_set *bset,
1270                 enum isl_dim_type type, unsigned pos);
1271         isl_bool isl_set_has_dim_name(__isl_keep isl_set *set,
1272                 enum isl_dim_type type, unsigned pos);
1273         const char *isl_set_get_dim_name(
1274                 __isl_keep isl_set *set,
1275                 enum isl_dim_type type, unsigned pos);
1277         #include <isl/map.h>
1278         __isl_give isl_map *isl_map_set_dim_id(
1279                 __isl_take isl_map *map, enum isl_dim_type type,
1280                 unsigned pos, __isl_take isl_id *id);
1281         isl_bool isl_basic_map_has_dim_id(
1282                 __isl_keep isl_basic_map *bmap,
1283                 enum isl_dim_type type, unsigned pos);
1284         isl_bool isl_map_has_dim_id(__isl_keep isl_map *map,
1285                 enum isl_dim_type type, unsigned pos);
1286         __isl_give isl_id *isl_map_get_dim_id(
1287                 __isl_keep isl_map *map, enum isl_dim_type type,
1288                 unsigned pos);
1289         __isl_give isl_id *isl_union_map_get_dim_id(
1290                 __isl_keep isl_union_map *umap,
1291                 enum isl_dim_type type, unsigned pos);
1292         const char *isl_basic_map_get_dim_name(
1293                 __isl_keep isl_basic_map *bmap,
1294                 enum isl_dim_type type, unsigned pos);
1295         isl_bool isl_map_has_dim_name(__isl_keep isl_map *map,
1296                 enum isl_dim_type type, unsigned pos);
1297         const char *isl_map_get_dim_name(
1298                 __isl_keep isl_map *map,
1299                 enum isl_dim_type type, unsigned pos);
1301         #include <isl/val.h>
1302         __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1303                 __isl_take isl_multi_val *mv,
1304                 enum isl_dim_type type, unsigned pos,
1305                 __isl_take isl_id *id);
1306         __isl_give isl_id *isl_multi_val_get_dim_id(
1307                 __isl_keep isl_multi_val *mv,
1308                 enum isl_dim_type type, unsigned pos);
1309         __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1310                 __isl_take isl_multi_val *mv,
1311                 enum isl_dim_type type, unsigned pos, const char *s);
1313         #include <isl/aff.h>
1314         __isl_give isl_aff *isl_aff_set_dim_id(
1315                 __isl_take isl_aff *aff, enum isl_dim_type type,
1316                 unsigned pos, __isl_take isl_id *id);
1317         __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1318                 __isl_take isl_multi_aff *maff,
1319                 enum isl_dim_type type, unsigned pos,
1320                 __isl_take isl_id *id);
1321         __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1322                 __isl_take isl_pw_aff *pma,
1323                 enum isl_dim_type type, unsigned pos,
1324                 __isl_take isl_id *id);
1325         __isl_give isl_multi_pw_aff *
1326         isl_multi_pw_aff_set_dim_id(
1327                 __isl_take isl_multi_pw_aff *mpa,
1328                 enum isl_dim_type type, unsigned pos,
1329                 __isl_take isl_id *id);
1330         __isl_give isl_multi_union_pw_aff *
1331         isl_multi_union_pw_aff_set_dim_id(
1332                 __isl_take isl_multi_union_pw_aff *mupa,
1333                 enum isl_dim_type type, unsigned pos,
1334                 __isl_take isl_id *id);
1335         __isl_give isl_id *isl_multi_aff_get_dim_id(
1336                 __isl_keep isl_multi_aff *ma,
1337                 enum isl_dim_type type, unsigned pos);
1338         isl_bool isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1339                 enum isl_dim_type type, unsigned pos);
1340         __isl_give isl_id *isl_pw_aff_get_dim_id(
1341                 __isl_keep isl_pw_aff *pa,
1342                 enum isl_dim_type type, unsigned pos);
1343         __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1344                 __isl_keep isl_pw_multi_aff *pma,
1345                 enum isl_dim_type type, unsigned pos);
1346         __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1347                 __isl_keep isl_multi_pw_aff *mpa,
1348                 enum isl_dim_type type, unsigned pos);
1349         __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1350                 __isl_keep isl_multi_union_pw_aff *mupa,
1351                 enum isl_dim_type type, unsigned pos);
1352         __isl_give isl_aff *isl_aff_set_dim_name(
1353                 __isl_take isl_aff *aff, enum isl_dim_type type,
1354                 unsigned pos, const char *s);
1355         __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1356                 __isl_take isl_multi_aff *maff,
1357                 enum isl_dim_type type, unsigned pos, const char *s);
1358         __isl_give isl_multi_pw_aff *
1359         isl_multi_pw_aff_set_dim_name(
1360                 __isl_take isl_multi_pw_aff *mpa,
1361                 enum isl_dim_type type, unsigned pos, const char *s);
1362         __isl_give isl_union_pw_aff *
1363         isl_union_pw_aff_set_dim_name(
1364                 __isl_take isl_union_pw_aff *upa,
1365                 enum isl_dim_type type, unsigned pos,
1366                 const char *s);
1367         __isl_give isl_union_pw_multi_aff *
1368         isl_union_pw_multi_aff_set_dim_name(
1369                 __isl_take isl_union_pw_multi_aff *upma,
1370                 enum isl_dim_type type, unsigned pos,
1371                 const char *s);
1372         __isl_give isl_multi_union_pw_aff *
1373         isl_multi_union_pw_aff_set_dim_name(
1374                 __isl_take isl_multi_union_pw_aff *mupa,
1375                 enum isl_dim_type type, unsigned pos,
1376         const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1377                 enum isl_dim_type type, unsigned pos);
1378         const char *isl_pw_aff_get_dim_name(
1379                 __isl_keep isl_pw_aff *pa,
1380                 enum isl_dim_type type, unsigned pos);
1381         const char *isl_pw_multi_aff_get_dim_name(
1382                 __isl_keep isl_pw_multi_aff *pma,
1383                 enum isl_dim_type type, unsigned pos);
1385         #include <isl/polynomial.h>
1386         __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1387                 __isl_take isl_qpolynomial *qp,
1388                 enum isl_dim_type type, unsigned pos,
1389                 const char *s);
1390         __isl_give isl_pw_qpolynomial *
1391         isl_pw_qpolynomial_set_dim_name(
1392                 __isl_take isl_pw_qpolynomial *pwqp,
1393                 enum isl_dim_type type, unsigned pos,
1394                 const char *s);
1395         __isl_give isl_pw_qpolynomial_fold *
1396         isl_pw_qpolynomial_fold_set_dim_name(
1397                 __isl_take isl_pw_qpolynomial_fold *pwf,
1398                 enum isl_dim_type type, unsigned pos,
1399                 const char *s);
1400         __isl_give isl_union_pw_qpolynomial *
1401         isl_union_pw_qpolynomial_set_dim_name(
1402                 __isl_take isl_union_pw_qpolynomial *upwqp,
1403                 enum isl_dim_type type, unsigned pos,
1404                 const char *s);
1405         __isl_give isl_union_pw_qpolynomial_fold *
1406         isl_union_pw_qpolynomial_fold_set_dim_name(
1407                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1408                 enum isl_dim_type type, unsigned pos,
1409                 const char *s);
1411 Note that C<isl_space_get_name> returns a pointer to some internal
1412 data structure, so the result can only be used while the
1413 corresponding C<isl_space> is alive.
1414 Also note that every function that operates on two sets or relations
1415 requires that both arguments have the same parameters.  This also
1416 means that if one of the arguments has named parameters, then the
1417 other needs to have named parameters too and the names need to match.
1418 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1419 arguments may have different parameters (as long as they are named),
1420 in which case the result will have as parameters the union of the parameters of
1421 the arguments.
1423 Given the identifier or name of a dimension (typically a parameter),
1424 its position can be obtained from the following functions.
1426         #include <isl/space.h>
1427         int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1428                 enum isl_dim_type type, __isl_keep isl_id *id);
1429         int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1430                 enum isl_dim_type type, const char *name);
1432         #include <isl/local_space.h>
1433         int isl_local_space_find_dim_by_name(
1434                 __isl_keep isl_local_space *ls,
1435                 enum isl_dim_type type, const char *name);
1437         #include <isl/val.h>
1438         int isl_multi_val_find_dim_by_id(
1439                 __isl_keep isl_multi_val *mv,
1440                 enum isl_dim_type type, __isl_keep isl_id *id);
1441         int isl_multi_val_find_dim_by_name(
1442                 __isl_keep isl_multi_val *mv,
1443                 enum isl_dim_type type, const char *name);
1445         #include <isl/set.h>
1446         int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1447                 enum isl_dim_type type, __isl_keep isl_id *id);
1448         int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1449                 enum isl_dim_type type, const char *name);
1451         #include <isl/map.h>
1452         int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1453                 enum isl_dim_type type, __isl_keep isl_id *id);
1454         int isl_basic_map_find_dim_by_name(
1455                 __isl_keep isl_basic_map *bmap,
1456                 enum isl_dim_type type, const char *name);
1457         int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1458                 enum isl_dim_type type, const char *name);
1459         int isl_union_map_find_dim_by_name(
1460                 __isl_keep isl_union_map *umap,
1461                 enum isl_dim_type type, const char *name);
1463         #include <isl/aff.h>
1464         int isl_multi_aff_find_dim_by_id(
1465                 __isl_keep isl_multi_aff *ma,
1466                 enum isl_dim_type type, __isl_keep isl_id *id);
1467         int isl_multi_pw_aff_find_dim_by_id(
1468                 __isl_keep isl_multi_pw_aff *mpa,
1469                 enum isl_dim_type type, __isl_keep isl_id *id);
1470         int isl_multi_union_pw_aff_find_dim_by_id(
1471                 __isl_keep isl_union_multi_pw_aff *mupa,
1472                 enum isl_dim_type type, __isl_keep isl_id *id);
1473         int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1474                 enum isl_dim_type type, const char *name);
1475         int isl_multi_aff_find_dim_by_name(
1476                 __isl_keep isl_multi_aff *ma,
1477                 enum isl_dim_type type, const char *name);
1478         int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1479                 enum isl_dim_type type, const char *name);
1480         int isl_multi_pw_aff_find_dim_by_name(
1481                 __isl_keep isl_multi_pw_aff *mpa,
1482                 enum isl_dim_type type, const char *name);
1483         int isl_pw_multi_aff_find_dim_by_name(
1484                 __isl_keep isl_pw_multi_aff *pma,
1485                 enum isl_dim_type type, const char *name);
1486         int isl_union_pw_aff_find_dim_by_name(
1487                 __isl_keep isl_union_pw_aff *upa,
1488                 enum isl_dim_type type, const char *name);
1489         int isl_union_pw_multi_aff_find_dim_by_name(
1490                 __isl_keep isl_union_pw_multi_aff *upma,
1491                 enum isl_dim_type type, const char *name);
1492         int isl_multi_union_pw_aff_find_dim_by_name(
1493                 __isl_keep isl_multi_union_pw_aff *mupa,
1494                 enum isl_dim_type type, const char *name);
1496         #include <isl/polynomial.h>
1497         int isl_pw_qpolynomial_find_dim_by_name(
1498                 __isl_keep isl_pw_qpolynomial *pwqp,
1499                 enum isl_dim_type type, const char *name);
1500         int isl_pw_qpolynomial_fold_find_dim_by_name(
1501                 __isl_keep isl_pw_qpolynomial_fold *pwf,
1502                 enum isl_dim_type type, const char *name);
1503         int isl_union_pw_qpolynomial_find_dim_by_name(
1504                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1505                 enum isl_dim_type type, const char *name);
1506         int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1507                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1508                 enum isl_dim_type type, const char *name);
1510 The identifiers or names of entire spaces may be set or read off
1511 using the following functions.
1513         #include <isl/space.h>
1514         __isl_give isl_space *isl_space_set_tuple_id(
1515                 __isl_take isl_space *space,
1516                 enum isl_dim_type type, __isl_take isl_id *id);
1517         __isl_give isl_space *isl_space_reset_tuple_id(
1518                 __isl_take isl_space *space, enum isl_dim_type type);
1519         isl_bool isl_space_has_tuple_id(
1520                 __isl_keep isl_space *space,
1521                 enum isl_dim_type type);
1522         __isl_give isl_id *isl_space_get_tuple_id(
1523                 __isl_keep isl_space *space, enum isl_dim_type type);
1524         __isl_give isl_space *isl_space_set_tuple_name(
1525                 __isl_take isl_space *space,
1526                 enum isl_dim_type type, const char *s);
1527         isl_bool isl_space_has_tuple_name(
1528                 __isl_keep isl_space *space,
1529                 enum isl_dim_type type);
1530         __isl_keep const char *isl_space_get_tuple_name(
1531                 __isl_keep isl_space *space,
1532                 enum isl_dim_type type);
1534         #include <isl/local_space.h>
1535         __isl_give isl_local_space *isl_local_space_set_tuple_id(
1536                 __isl_take isl_local_space *ls,
1537                 enum isl_dim_type type, __isl_take isl_id *id);
1539         #include <isl/set.h>
1540         __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1541                 __isl_take isl_basic_set *bset,
1542                 __isl_take isl_id *id);
1543         __isl_give isl_set *isl_set_set_tuple_id(
1544                 __isl_take isl_set *set, __isl_take isl_id *id);
1545         __isl_give isl_set *isl_set_reset_tuple_id(
1546                 __isl_take isl_set *set);
1547         isl_bool isl_set_has_tuple_id(__isl_keep isl_set *set);
1548         __isl_give isl_id *isl_set_get_tuple_id(
1549                 __isl_keep isl_set *set);
1550         __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1551                 __isl_take isl_basic_set *set, const char *s);
1552         __isl_give isl_set *isl_set_set_tuple_name(
1553                 __isl_take isl_set *set, const char *s);
1554         const char *isl_basic_set_get_tuple_name(
1555                 __isl_keep isl_basic_set *bset);
1556         isl_bool isl_set_has_tuple_name(__isl_keep isl_set *set);
1557         const char *isl_set_get_tuple_name(
1558                 __isl_keep isl_set *set);
1560         #include <isl/map.h>
1561         __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1562                 __isl_take isl_basic_map *bmap,
1563                 enum isl_dim_type type, __isl_take isl_id *id);
1564         __isl_give isl_map *isl_map_set_tuple_id(
1565                 __isl_take isl_map *map, enum isl_dim_type type,
1566                 __isl_take isl_id *id);
1567         __isl_give isl_map *isl_map_reset_tuple_id(
1568                 __isl_take isl_map *map, enum isl_dim_type type);
1569         isl_bool isl_map_has_tuple_id(__isl_keep isl_map *map,
1570                 enum isl_dim_type type);
1571         __isl_give isl_id *isl_map_get_tuple_id(
1572                 __isl_keep isl_map *map, enum isl_dim_type type);
1573         __isl_give isl_map *isl_map_set_tuple_name(
1574                 __isl_take isl_map *map,
1575                 enum isl_dim_type type, const char *s);
1576         const char *isl_basic_map_get_tuple_name(
1577                 __isl_keep isl_basic_map *bmap,
1578                 enum isl_dim_type type);
1579         __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1580                 __isl_take isl_basic_map *bmap,
1581                 enum isl_dim_type type, const char *s);
1582         isl_bool isl_map_has_tuple_name(__isl_keep isl_map *map,
1583                 enum isl_dim_type type);
1584         const char *isl_map_get_tuple_name(
1585                 __isl_keep isl_map *map,
1586                 enum isl_dim_type type);
1588         #include <isl/val.h>
1589         __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1590                 __isl_take isl_multi_val *mv,
1591                 enum isl_dim_type type, __isl_take isl_id *id);
1592         __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1593                 __isl_take isl_multi_val *mv,
1594                 enum isl_dim_type type);
1595         isl_bool isl_multi_val_has_tuple_id(
1596                 __isl_keep isl_multi_val *mv,
1597                 enum isl_dim_type type);
1598         __isl_give isl_id *isl_multi_val_get_tuple_id(
1599                 __isl_keep isl_multi_val *mv,
1600                 enum isl_dim_type type);
1601         __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1602                 __isl_take isl_multi_val *mv,
1603                 enum isl_dim_type type, const char *s);
1604         const char *isl_multi_val_get_tuple_name(
1605                 __isl_keep isl_multi_val *mv,
1606                 enum isl_dim_type type);
1608         #include <isl/aff.h>
1609         __isl_give isl_aff *isl_aff_set_tuple_id(
1610                 __isl_take isl_aff *aff,
1611                 enum isl_dim_type type, __isl_take isl_id *id);
1612         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1613                 __isl_take isl_multi_aff *maff,
1614                 enum isl_dim_type type, __isl_take isl_id *id);
1615         __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1616                 __isl_take isl_pw_aff *pwaff,
1617                 enum isl_dim_type type, __isl_take isl_id *id);
1618         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1619                 __isl_take isl_pw_multi_aff *pma,
1620                 enum isl_dim_type type, __isl_take isl_id *id);
1621         __isl_give isl_multi_union_pw_aff *
1622         isl_multi_union_pw_aff_set_tuple_id(
1623                 __isl_take isl_multi_union_pw_aff *mupa,
1624                 enum isl_dim_type type, __isl_take isl_id *id);
1625         __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1626                 __isl_take isl_multi_aff *ma,
1627                 enum isl_dim_type type);
1628         __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1629                 __isl_take isl_pw_aff *pa,
1630                 enum isl_dim_type type);
1631         __isl_give isl_multi_pw_aff *
1632         isl_multi_pw_aff_reset_tuple_id(
1633                 __isl_take isl_multi_pw_aff *mpa,
1634                 enum isl_dim_type type);
1635         __isl_give isl_pw_multi_aff *
1636         isl_pw_multi_aff_reset_tuple_id(
1637                 __isl_take isl_pw_multi_aff *pma,
1638                 enum isl_dim_type type);
1639         __isl_give isl_multi_union_pw_aff *
1640         isl_multi_union_pw_aff_reset_tuple_id(
1641                 __isl_take isl_multi_union_pw_aff *mupa,
1642                 enum isl_dim_type type);
1643         isl_bool isl_multi_aff_has_tuple_id(
1644                 __isl_keep isl_multi_aff *ma,
1645                 enum isl_dim_type type);
1646         __isl_give isl_id *isl_multi_aff_get_tuple_id(
1647                 __isl_keep isl_multi_aff *ma,
1648                 enum isl_dim_type type);
1649         isl_bool isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1650                 enum isl_dim_type type);
1651         __isl_give isl_id *isl_pw_aff_get_tuple_id(
1652                 __isl_keep isl_pw_aff *pa,
1653                 enum isl_dim_type type);
1654         isl_bool isl_pw_multi_aff_has_tuple_id(
1655                 __isl_keep isl_pw_multi_aff *pma,
1656                 enum isl_dim_type type);
1657         __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1658                 __isl_keep isl_pw_multi_aff *pma,
1659                 enum isl_dim_type type);
1660         isl_bool isl_multi_pw_aff_has_tuple_id(
1661                 __isl_keep isl_multi_pw_aff *mpa,
1662                 enum isl_dim_type type);
1663         __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1664                 __isl_keep isl_multi_pw_aff *mpa,
1665                 enum isl_dim_type type);
1666         isl_bool isl_multi_union_pw_aff_has_tuple_id(
1667                 __isl_keep isl_multi_union_pw_aff *mupa,
1668                 enum isl_dim_type type);
1669         __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1670                 __isl_keep isl_multi_union_pw_aff *mupa,
1671                 enum isl_dim_type type);
1672         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1673                 __isl_take isl_multi_aff *maff,
1674                 enum isl_dim_type type, const char *s);
1675         __isl_give isl_multi_pw_aff *
1676         isl_multi_pw_aff_set_tuple_name(
1677                 __isl_take isl_multi_pw_aff *mpa,
1678                 enum isl_dim_type type, const char *s);
1679         __isl_give isl_multi_union_pw_aff *
1680         isl_multi_union_pw_aff_set_tuple_name(
1681                 __isl_take isl_multi_union_pw_aff *mupa,
1682                 enum isl_dim_type type, const char *s);
1683         const char *isl_multi_aff_get_tuple_name(
1684                 __isl_keep isl_multi_aff *multi,
1685                 enum isl_dim_type type);
1686         isl_bool isl_pw_multi_aff_has_tuple_name(
1687                 __isl_keep isl_pw_multi_aff *pma,
1688                 enum isl_dim_type type);
1689         const char *isl_pw_multi_aff_get_tuple_name(
1690                 __isl_keep isl_pw_multi_aff *pma,
1691                 enum isl_dim_type type);
1692         const char *isl_multi_union_pw_aff_get_tuple_name(
1693                 __isl_keep isl_multi_union_pw_aff *mupa,
1694                 enum isl_dim_type type);
1696 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1697 or C<isl_dim_set>.  As with C<isl_space_get_name>,
1698 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1699 data structure.
1700 Binary operations require the corresponding spaces of their arguments
1701 to have the same name.
1703 To keep the names of all parameters and tuples, but reset the user pointers
1704 of all the corresponding identifiers, use the following function.
1706         #include <isl/space.h>
1707         __isl_give isl_space *isl_space_reset_user(
1708                 __isl_take isl_space *space);
1710         #include <isl/set.h>
1711         __isl_give isl_set *isl_set_reset_user(
1712                 __isl_take isl_set *set);
1714         #include <isl/map.h>
1715         __isl_give isl_map *isl_map_reset_user(
1716                 __isl_take isl_map *map);
1718         #include <isl/union_set.h>
1719         __isl_give isl_union_set *isl_union_set_reset_user(
1720                 __isl_take isl_union_set *uset);
1722         #include <isl/union_map.h>
1723         __isl_give isl_union_map *isl_union_map_reset_user(
1724                 __isl_take isl_union_map *umap);
1726         #include <isl/val.h>
1727         __isl_give isl_multi_val *isl_multi_val_reset_user(
1728                 __isl_take isl_multi_val *mv);
1730         #include <isl/aff.h>
1731         __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1732                 __isl_take isl_multi_aff *ma);
1733         __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1734                 __isl_take isl_pw_aff *pa);
1735         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1736                 __isl_take isl_multi_pw_aff *mpa);
1737         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1738                 __isl_take isl_pw_multi_aff *pma);
1739         __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1740                 __isl_take isl_union_pw_aff *upa);
1741         __isl_give isl_multi_union_pw_aff *
1742         isl_multi_union_pw_aff_reset_user(
1743                 __isl_take isl_multi_union_pw_aff *mupa);
1744         __isl_give isl_union_pw_multi_aff *
1745         isl_union_pw_multi_aff_reset_user(
1746                 __isl_take isl_union_pw_multi_aff *upma);
1748         #include <isl/polynomial.h>
1749         __isl_give isl_pw_qpolynomial *
1750         isl_pw_qpolynomial_reset_user(
1751                 __isl_take isl_pw_qpolynomial *pwqp);
1752         __isl_give isl_union_pw_qpolynomial *
1753         isl_union_pw_qpolynomial_reset_user(
1754                 __isl_take isl_union_pw_qpolynomial *upwqp);
1755         __isl_give isl_pw_qpolynomial_fold *
1756         isl_pw_qpolynomial_fold_reset_user(
1757                 __isl_take isl_pw_qpolynomial_fold *pwf);
1758         __isl_give isl_union_pw_qpolynomial_fold *
1759         isl_union_pw_qpolynomial_fold_reset_user(
1760                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1762 Spaces can be nested.  In particular, the domain of a set or
1763 the domain or range of a relation can be a nested relation.
1764 This process is also called I<wrapping>.
1765 The functions for detecting, constructing and deconstructing
1766 such nested spaces can be found in the wrapping properties
1767 of L</"Unary Properties">, the wrapping operations
1768 of L</"Unary Operations"> and the Cartesian product operations
1769 of L</"Basic Operations">.
1771 Spaces can be created from other spaces
1772 using the functions described in L</"Unary Operations">
1773 and L</"Binary Operations">.
1775 =head2 Local Spaces
1777 A local space is essentially a space with
1778 zero or more existentially quantified variables.
1779 The local space of various objects can be obtained
1780 using the following functions.
1782         #include <isl/constraint.h>
1783         __isl_give isl_local_space *isl_constraint_get_local_space(
1784                 __isl_keep isl_constraint *constraint);
1786         #include <isl/set.h>
1787         __isl_give isl_local_space *isl_basic_set_get_local_space(
1788                 __isl_keep isl_basic_set *bset);
1790         #include <isl/map.h>
1791         __isl_give isl_local_space *isl_basic_map_get_local_space(
1792                 __isl_keep isl_basic_map *bmap);
1794         #include <isl/aff.h>
1795         __isl_give isl_local_space *isl_aff_get_domain_local_space(
1796                 __isl_keep isl_aff *aff);
1797         __isl_give isl_local_space *isl_aff_get_local_space(
1798                 __isl_keep isl_aff *aff);
1800 A new local space can be created from a space using
1802         #include <isl/local_space.h>
1803         __isl_give isl_local_space *isl_local_space_from_space(
1804                 __isl_take isl_space *space);
1806 They can be inspected, modified, copied and freed using the following functions.
1808         #include <isl/local_space.h>
1809         isl_bool isl_local_space_is_params(
1810                 __isl_keep isl_local_space *ls);
1811         isl_bool isl_local_space_is_set(
1812                 __isl_keep isl_local_space *ls);
1813         __isl_give isl_space *isl_local_space_get_space(
1814                 __isl_keep isl_local_space *ls);
1815         __isl_give isl_aff *isl_local_space_get_div(
1816                 __isl_keep isl_local_space *ls, int pos);
1817         __isl_give isl_local_space *isl_local_space_copy(
1818                 __isl_keep isl_local_space *ls);
1819         __isl_null isl_local_space *isl_local_space_free(
1820                 __isl_take isl_local_space *ls);
1822 Note that C<isl_local_space_get_div> can only be used on local spaces
1823 of sets.
1825 Two local spaces can be compared using
1827         isl_bool isl_local_space_is_equal(
1828                 __isl_keep isl_local_space *ls1,
1829                 __isl_keep isl_local_space *ls2);
1831 Local spaces can be created from other local spaces
1832 using the functions described in L</"Unary Operations">
1833 and L</"Binary Operations">.
1835 =head2 Creating New Sets and Relations
1837 C<isl> has functions for creating some standard sets and relations.
1839 =over
1841 =item * Empty sets and relations
1843         __isl_give isl_basic_set *isl_basic_set_empty(
1844                 __isl_take isl_space *space);
1845         __isl_give isl_basic_map *isl_basic_map_empty(
1846                 __isl_take isl_space *space);
1847         __isl_give isl_set *isl_set_empty(
1848                 __isl_take isl_space *space);
1849         __isl_give isl_map *isl_map_empty(
1850                 __isl_take isl_space *space);
1851         __isl_give isl_union_set *isl_union_set_empty(
1852                 __isl_take isl_space *space);
1853         __isl_give isl_union_map *isl_union_map_empty(
1854                 __isl_take isl_space *space);
1856 For C<isl_union_set>s and C<isl_union_map>s, the space
1857 is only used to specify the parameters.
1859 =item * Universe sets and relations
1861         __isl_give isl_basic_set *isl_basic_set_universe(
1862                 __isl_take isl_space *space);
1863         __isl_give isl_basic_map *isl_basic_map_universe(
1864                 __isl_take isl_space *space);
1865         __isl_give isl_set *isl_set_universe(
1866                 __isl_take isl_space *space);
1867         __isl_give isl_map *isl_map_universe(
1868                 __isl_take isl_space *space);
1869         __isl_give isl_union_set *isl_union_set_universe(
1870                 __isl_take isl_union_set *uset);
1871         __isl_give isl_union_map *isl_union_map_universe(
1872                 __isl_take isl_union_map *umap);
1874 The sets and relations constructed by the functions above
1875 contain all integer values, while those constructed by the
1876 functions below only contain non-negative values.
1878         __isl_give isl_basic_set *isl_basic_set_nat_universe(
1879                 __isl_take isl_space *space);
1880         __isl_give isl_basic_map *isl_basic_map_nat_universe(
1881                 __isl_take isl_space *space);
1882         __isl_give isl_set *isl_set_nat_universe(
1883                 __isl_take isl_space *space);
1884         __isl_give isl_map *isl_map_nat_universe(
1885                 __isl_take isl_space *space);
1887 =item * Identity relations
1889         __isl_give isl_basic_map *isl_basic_map_identity(
1890                 __isl_take isl_space *space);
1891         __isl_give isl_map *isl_map_identity(
1892                 __isl_take isl_space *space);
1894 The number of input and output dimensions in C<space> needs
1895 to be the same.
1897 =item * Lexicographic order
1899         __isl_give isl_map *isl_map_lex_lt(
1900                 __isl_take isl_space *set_space);
1901         __isl_give isl_map *isl_map_lex_le(
1902                 __isl_take isl_space *set_space);
1903         __isl_give isl_map *isl_map_lex_gt(
1904                 __isl_take isl_space *set_space);
1905         __isl_give isl_map *isl_map_lex_ge(
1906                 __isl_take isl_space *set_space);
1907         __isl_give isl_map *isl_map_lex_lt_first(
1908                 __isl_take isl_space *space, unsigned n);
1909         __isl_give isl_map *isl_map_lex_le_first(
1910                 __isl_take isl_space *space, unsigned n);
1911         __isl_give isl_map *isl_map_lex_gt_first(
1912                 __isl_take isl_space *space, unsigned n);
1913         __isl_give isl_map *isl_map_lex_ge_first(
1914                 __isl_take isl_space *space, unsigned n);
1916 The first four functions take a space for a B<set>
1917 and return relations that express that the elements in the domain
1918 are lexicographically less
1919 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1920 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1921 than the elements in the range.
1922 The last four functions take a space for a map
1923 and return relations that express that the first C<n> dimensions
1924 in the domain are lexicographically less
1925 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1926 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1927 than the first C<n> dimensions in the range.
1929 =back
1931 A basic set or relation can be converted to a set or relation
1932 using the following functions.
1934         __isl_give isl_set *isl_set_from_basic_set(
1935                 __isl_take isl_basic_set *bset);
1936         __isl_give isl_map *isl_map_from_basic_map(
1937                 __isl_take isl_basic_map *bmap);
1939 Sets and relations can be converted to union sets and relations
1940 using the following functions.
1942         __isl_give isl_union_set *isl_union_set_from_basic_set(
1943                 __isl_take isl_basic_set *bset);
1944         __isl_give isl_union_map *isl_union_map_from_basic_map(
1945                 __isl_take isl_basic_map *bmap);
1946         __isl_give isl_union_set *isl_union_set_from_set(
1947                 __isl_take isl_set *set);
1948         __isl_give isl_union_map *isl_union_map_from_map(
1949                 __isl_take isl_map *map);
1951 The inverse conversions below can only be used if the input
1952 union set or relation is known to contain elements in exactly one
1953 space.
1955         __isl_give isl_set *isl_set_from_union_set(
1956                 __isl_take isl_union_set *uset);
1957         __isl_give isl_map *isl_map_from_union_map(
1958                 __isl_take isl_union_map *umap);
1960 Sets and relations can be copied and freed again using the following
1961 functions.
1963         __isl_give isl_basic_set *isl_basic_set_copy(
1964                 __isl_keep isl_basic_set *bset);
1965         __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1966         __isl_give isl_union_set *isl_union_set_copy(
1967                 __isl_keep isl_union_set *uset);
1968         __isl_give isl_basic_map *isl_basic_map_copy(
1969                 __isl_keep isl_basic_map *bmap);
1970         __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1971         __isl_give isl_union_map *isl_union_map_copy(
1972                 __isl_keep isl_union_map *umap);
1973         __isl_null isl_basic_set *isl_basic_set_free(
1974                 __isl_take isl_basic_set *bset);
1975         __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1976         __isl_null isl_union_set *isl_union_set_free(
1977                 __isl_take isl_union_set *uset);
1978         __isl_null isl_basic_map *isl_basic_map_free(
1979                 __isl_take isl_basic_map *bmap);
1980         __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1981         __isl_null isl_union_map *isl_union_map_free(
1982                 __isl_take isl_union_map *umap);
1984 Other sets and relations can be constructed by starting
1985 from a universe set or relation, adding equality and/or
1986 inequality constraints and then projecting out the
1987 existentially quantified variables, if any.
1988 Constraints can be constructed, manipulated and
1989 added to (or removed from) (basic) sets and relations
1990 using the following functions.
1992         #include <isl/constraint.h>
1993         __isl_give isl_constraint *isl_constraint_alloc_equality(
1994                 __isl_take isl_local_space *ls);
1995         __isl_give isl_constraint *isl_constraint_alloc_inequality(
1996                 __isl_take isl_local_space *ls);
1997         __isl_give isl_constraint *isl_constraint_set_constant_si(
1998                 __isl_take isl_constraint *constraint, int v);
1999         __isl_give isl_constraint *isl_constraint_set_constant_val(
2000                 __isl_take isl_constraint *constraint,
2001                 __isl_take isl_val *v);
2002         __isl_give isl_constraint *isl_constraint_set_coefficient_si(
2003                 __isl_take isl_constraint *constraint,
2004                 enum isl_dim_type type, int pos, int v);
2005         __isl_give isl_constraint *
2006         isl_constraint_set_coefficient_val(
2007                 __isl_take isl_constraint *constraint,
2008                 enum isl_dim_type type, int pos,
2009                 __isl_take isl_val *v);
2010         __isl_give isl_basic_map *isl_basic_map_add_constraint(
2011                 __isl_take isl_basic_map *bmap,
2012                 __isl_take isl_constraint *constraint);
2013         __isl_give isl_basic_set *isl_basic_set_add_constraint(
2014                 __isl_take isl_basic_set *bset,
2015                 __isl_take isl_constraint *constraint);
2016         __isl_give isl_map *isl_map_add_constraint(
2017                 __isl_take isl_map *map,
2018                 __isl_take isl_constraint *constraint);
2019         __isl_give isl_set *isl_set_add_constraint(
2020                 __isl_take isl_set *set,
2021                 __isl_take isl_constraint *constraint);
2023 For example, to create a set containing the even integers
2024 between 10 and 42, you would use the following code.
2026         isl_space *space;
2027         isl_local_space *ls;
2028         isl_constraint *c;
2029         isl_basic_set *bset;
2031         space = isl_space_set_alloc(ctx, 0, 2);
2032         bset = isl_basic_set_universe(isl_space_copy(space));
2033         ls = isl_local_space_from_space(space);
2035         c = isl_constraint_alloc_equality(isl_local_space_copy(ls));
2036         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
2037         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
2038         bset = isl_basic_set_add_constraint(bset, c);
2040         c = isl_constraint_alloc_inequality(isl_local_space_copy(ls));
2041         c = isl_constraint_set_constant_si(c, -10);
2042         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
2043         bset = isl_basic_set_add_constraint(bset, c);
2045         c = isl_constraint_alloc_inequality(ls);
2046         c = isl_constraint_set_constant_si(c, 42);
2047         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
2048         bset = isl_basic_set_add_constraint(bset, c);
2050         bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
2052 Or, alternatively,
2054         isl_basic_set *bset;
2055         bset = isl_basic_set_read_from_str(ctx,
2056                 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
2058 A basic set or relation can also be constructed from two matrices
2059 describing the equalities and the inequalities.
2061         __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
2062                 __isl_take isl_space *space,
2063                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
2064                 enum isl_dim_type c1,
2065                 enum isl_dim_type c2, enum isl_dim_type c3,
2066                 enum isl_dim_type c4);
2067         __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
2068                 __isl_take isl_space *space,
2069                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
2070                 enum isl_dim_type c1,
2071                 enum isl_dim_type c2, enum isl_dim_type c3,
2072                 enum isl_dim_type c4, enum isl_dim_type c5);
2074 The C<isl_dim_type> arguments indicate the order in which
2075 different kinds of variables appear in the input matrices
2076 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
2077 C<isl_dim_set> and C<isl_dim_div> for sets and
2078 of C<isl_dim_cst>, C<isl_dim_param>,
2079 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
2081 A (basic or union) set or relation can also be constructed from a
2082 (union) (piecewise) (multiple) affine expression
2083 or a list of affine expressions
2084 (See L</"Functions">), provided these affine expressions do not
2085 involve any NaN.
2087         __isl_give isl_basic_map *isl_basic_map_from_aff(
2088                 __isl_take isl_aff *aff);
2089         __isl_give isl_map *isl_map_from_aff(
2090                 __isl_take isl_aff *aff);
2091         __isl_give isl_set *isl_set_from_pw_aff(
2092                 __isl_take isl_pw_aff *pwaff);
2093         __isl_give isl_map *isl_map_from_pw_aff(
2094                 __isl_take isl_pw_aff *pwaff);
2095         __isl_give isl_basic_map *isl_basic_map_from_aff_list(
2096                 __isl_take isl_space *domain_space,
2097                 __isl_take isl_aff_list *list);
2098         __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
2099                 __isl_take isl_multi_aff *maff)
2100         __isl_give isl_map *isl_map_from_multi_aff(
2101                 __isl_take isl_multi_aff *maff)
2102         __isl_give isl_set *isl_set_from_pw_multi_aff(
2103                 __isl_take isl_pw_multi_aff *pma);
2104         __isl_give isl_map *isl_map_from_pw_multi_aff(
2105                 __isl_take isl_pw_multi_aff *pma);
2106         __isl_give isl_set *isl_set_from_multi_pw_aff(
2107                 __isl_take isl_multi_pw_aff *mpa);
2108         __isl_give isl_map *isl_map_from_multi_pw_aff(
2109                 __isl_take isl_multi_pw_aff *mpa);
2110         __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
2111                 __isl_take isl_union_pw_aff *upa);
2112         __isl_give isl_union_map *
2113         isl_union_map_from_union_pw_multi_aff(
2114                 __isl_take isl_union_pw_multi_aff *upma);
2115         __isl_give isl_union_map *
2116         isl_union_map_from_multi_union_pw_aff(
2117                 __isl_take isl_multi_union_pw_aff *mupa);
2119 The C<domain_space> argument describes the domain of the resulting
2120 basic relation.  It is required because the C<list> may consist
2121 of zero affine expressions.
2122 The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
2123 is not allowed to be zero-dimensional.  The domain of the result
2124 is the shared domain of the union piecewise affine elements.
2126 =head2 Inspecting Sets and Relations
2128 Usually, the user should not have to care about the actual constraints
2129 of the sets and maps, but should instead apply the abstract operations
2130 explained in the following sections.
2131 Occasionally, however, it may be required to inspect the individual
2132 coefficients of the constraints.  This section explains how to do so.
2133 In these cases, it may also be useful to have C<isl> compute
2134 an explicit representation of the existentially quantified variables.
2136         __isl_give isl_set *isl_set_compute_divs(
2137                 __isl_take isl_set *set);
2138         __isl_give isl_map *isl_map_compute_divs(
2139                 __isl_take isl_map *map);
2140         __isl_give isl_union_set *isl_union_set_compute_divs(
2141                 __isl_take isl_union_set *uset);
2142         __isl_give isl_union_map *isl_union_map_compute_divs(
2143                 __isl_take isl_union_map *umap);
2145 This explicit representation defines the existentially quantified
2146 variables as integer divisions of the other variables, possibly
2147 including earlier existentially quantified variables.
2148 An explicitly represented existentially quantified variable therefore
2149 has a unique value when the values of the other variables are known.
2151 Alternatively, the existentially quantified variables can be removed
2152 using the following functions, which compute an overapproximation.
2154         #include <isl/set.h>
2155         __isl_give isl_basic_set *isl_basic_set_remove_divs(
2156                 __isl_take isl_basic_set *bset);
2157         __isl_give isl_set *isl_set_remove_divs(
2158                 __isl_take isl_set *set);
2160         #include <isl/map.h>
2161         __isl_give isl_basic_map *isl_basic_map_remove_divs(
2162                 __isl_take isl_basic_map *bmap);
2163         __isl_give isl_map *isl_map_remove_divs(
2164                 __isl_take isl_map *map);
2166         #include <isl/union_set.h>
2167         __isl_give isl_union_set *isl_union_set_remove_divs(
2168                 __isl_take isl_union_set *bset);
2170         #include <isl/union_map.h>
2171         __isl_give isl_union_map *isl_union_map_remove_divs(
2172                 __isl_take isl_union_map *bmap);
2174 It is also possible to only remove those divs that are defined
2175 in terms of a given range of dimensions or only those for which
2176 no explicit representation is known.
2178         __isl_give isl_basic_set *
2179         isl_basic_set_remove_divs_involving_dims(
2180                 __isl_take isl_basic_set *bset,
2181                 enum isl_dim_type type,
2182                 unsigned first, unsigned n);
2183         __isl_give isl_basic_map *
2184         isl_basic_map_remove_divs_involving_dims(
2185                 __isl_take isl_basic_map *bmap,
2186                 enum isl_dim_type type,
2187                 unsigned first, unsigned n);
2188         __isl_give isl_set *isl_set_remove_divs_involving_dims(
2189                 __isl_take isl_set *set, enum isl_dim_type type,
2190                 unsigned first, unsigned n);
2191         __isl_give isl_map *isl_map_remove_divs_involving_dims(
2192                 __isl_take isl_map *map, enum isl_dim_type type,
2193                 unsigned first, unsigned n);
2195         __isl_give isl_basic_set *
2196         isl_basic_set_remove_unknown_divs(
2197                 __isl_take isl_basic_set *bset);
2198         __isl_give isl_set *isl_set_remove_unknown_divs(
2199                 __isl_take isl_set *set);
2200         __isl_give isl_map *isl_map_remove_unknown_divs(
2201                 __isl_take isl_map *map);
2203 To iterate over all the sets or maps in a union set or map, use
2205         #include <isl/union_set.h>
2206         isl_stat isl_union_set_foreach_set(
2207                 __isl_keep isl_union_set *uset,
2208                 isl_stat (*fn)(__isl_take isl_set *set, void *user),
2209                 void *user);
2211         #include <isl/union_map.h>
2212         isl_stat isl_union_map_foreach_map(
2213                 __isl_keep isl_union_map *umap,
2214                 isl_stat (*fn)(__isl_take isl_map *map, void *user),
2215                 void *user);
2216         isl_bool isl_union_map_every_map(
2217                 __isl_keep isl_union_map *umap,
2218                 isl_bool (*test)(__isl_keep isl_map *map,
2219                         void *user),
2220                 void *user);
2222 These functions call the callback function once for each
2223 (pair of) space(s) for which there are elements in the input.
2224 The argument to the callback contains all elements in the input
2225 with that (pair of) space(s).
2226 The C<isl_union_map_every_map> variant check whether each
2227 call to the callback returns true and stops checking as soon as one
2228 of these calls returns false.
2230 The number of sets or maps in a union set or map can be obtained
2231 from
2233         int isl_union_set_n_set(__isl_keep isl_union_set *uset);
2234         int isl_union_map_n_map(__isl_keep isl_union_map *umap);
2236 To extract the set or map in a given space from a union, use
2238         __isl_give isl_set *isl_union_set_extract_set(
2239                 __isl_keep isl_union_set *uset,
2240                 __isl_take isl_space *space);
2241         __isl_give isl_map *isl_union_map_extract_map(
2242                 __isl_keep isl_union_map *umap,
2243                 __isl_take isl_space *space);
2245 To iterate over all the basic sets or maps in a set or map, use
2247         isl_stat isl_set_foreach_basic_set(__isl_keep isl_set *set,
2248                 isl_stat (*fn)(__isl_take isl_basic_set *bset,
2249                         void *user),
2250                 void *user);
2251         isl_stat isl_map_foreach_basic_map(__isl_keep isl_map *map,
2252                 isl_stat (*fn)(__isl_take isl_basic_map *bmap,
2253                         void *user),
2254                 void *user);
2256 The callback function C<fn> should return C<isl_stat_ok> if successful and
2257 C<isl_stat_error> if an error occurs.  In the latter case, or if any other error
2258 occurs, the above functions will return C<isl_stat_error>.
2260 It should be noted that C<isl> does not guarantee that
2261 the basic sets or maps passed to C<fn> are disjoint.
2262 If this is required, then the user should call one of
2263 the following functions first.
2265         __isl_give isl_set *isl_set_make_disjoint(
2266                 __isl_take isl_set *set);
2267         __isl_give isl_map *isl_map_make_disjoint(
2268                 __isl_take isl_map *map);
2270 The number of basic sets in a set can be obtained
2271 or the number of basic maps in a map can be obtained
2272 from
2274         #include <isl/set.h>
2275         int isl_set_n_basic_set(__isl_keep isl_set *set);
2277         #include <isl/map.h>
2278         int isl_map_n_basic_map(__isl_keep isl_map *map);
2280 It is also possible to obtain a list of basic sets from a set
2281 or union set and a list of basic maps from a map.
2283         #include <isl/set.h>
2284         __isl_give isl_basic_set_list *isl_set_get_basic_set_list(
2285                 __isl_keep isl_set *set);
2287         #include <isl/union_set.h>
2288         __isl_give isl_basic_set_list *
2289         isl_union_set_get_basic_set_list(
2290                 __isl_keep isl_union_set *uset);
2292         #include <isl/map.h>
2293         __isl_give isl_basic_map_list *isl_map_get_basic_map_list(
2294                 __isl_keep isl_map *map);
2296 The returned list can be manipulated using the functions in L<"Lists">.
2298 To iterate over the constraints of a basic set or map, use
2300         #include <isl/constraint.h>
2302         int isl_basic_set_n_constraint(
2303                 __isl_keep isl_basic_set *bset);
2304         isl_stat isl_basic_set_foreach_constraint(
2305                 __isl_keep isl_basic_set *bset,
2306                 isl_stat (*fn)(__isl_take isl_constraint *c,
2307                         void *user),
2308                 void *user);
2309         int isl_basic_map_n_constraint(
2310                 __isl_keep isl_basic_map *bmap);
2311         isl_stat isl_basic_map_foreach_constraint(
2312                 __isl_keep isl_basic_map *bmap,
2313                 isl_stat (*fn)(__isl_take isl_constraint *c,
2314                         void *user),
2315                 void *user);
2316         __isl_null isl_constraint *isl_constraint_free(
2317                 __isl_take isl_constraint *c);
2319 Again, the callback function C<fn> should return C<isl_stat_ok>
2320 if successful and
2321 C<isl_stat_error> if an error occurs.  In the latter case, or if any other error
2322 occurs, the above functions will return C<isl_stat_error>.
2323 The constraint C<c> represents either an equality or an inequality.
2324 Use the following function to find out whether a constraint
2325 represents an equality.  If not, it represents an inequality.
2327         isl_bool isl_constraint_is_equality(
2328                 __isl_keep isl_constraint *constraint);
2330 It is also possible to obtain a list of constraints from a basic
2331 map or set
2333         #include <isl/constraint.h>
2334         __isl_give isl_constraint_list *
2335         isl_basic_map_get_constraint_list(
2336                 __isl_keep isl_basic_map *bmap);
2337         __isl_give isl_constraint_list *
2338         isl_basic_set_get_constraint_list(
2339                 __isl_keep isl_basic_set *bset);
2341 These functions require that all existentially quantified variables
2342 have an explicit representation.
2343 The returned list can be manipulated using the functions in L<"Lists">.
2345 The coefficients of the constraints can be inspected using
2346 the following functions.
2348         isl_bool isl_constraint_is_lower_bound(
2349                 __isl_keep isl_constraint *constraint,
2350                 enum isl_dim_type type, unsigned pos);
2351         isl_bool isl_constraint_is_upper_bound(
2352                 __isl_keep isl_constraint *constraint,
2353                 enum isl_dim_type type, unsigned pos);
2354         __isl_give isl_val *isl_constraint_get_constant_val(
2355                 __isl_keep isl_constraint *constraint);
2356         __isl_give isl_val *isl_constraint_get_coefficient_val(
2357                 __isl_keep isl_constraint *constraint,
2358                 enum isl_dim_type type, int pos);
2360 The explicit representations of the existentially quantified
2361 variables can be inspected using the following function.
2362 Note that the user is only allowed to use this function
2363 if the inspected set or map is the result of a call
2364 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2365 The existentially quantified variable is equal to the floor
2366 of the returned affine expression.  The affine expression
2367 itself can be inspected using the functions in
2368 L</"Functions">.
2370         __isl_give isl_aff *isl_constraint_get_div(
2371                 __isl_keep isl_constraint *constraint, int pos);
2373 To obtain the constraints of a basic set or map in matrix
2374 form, use the following functions.
2376         __isl_give isl_mat *isl_basic_set_equalities_matrix(
2377                 __isl_keep isl_basic_set *bset,
2378                 enum isl_dim_type c1, enum isl_dim_type c2,
2379                 enum isl_dim_type c3, enum isl_dim_type c4);
2380         __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2381                 __isl_keep isl_basic_set *bset,
2382                 enum isl_dim_type c1, enum isl_dim_type c2,
2383                 enum isl_dim_type c3, enum isl_dim_type c4);
2384         __isl_give isl_mat *isl_basic_map_equalities_matrix(
2385                 __isl_keep isl_basic_map *bmap,
2386                 enum isl_dim_type c1,
2387                 enum isl_dim_type c2, enum isl_dim_type c3,
2388                 enum isl_dim_type c4, enum isl_dim_type c5);
2389         __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2390                 __isl_keep isl_basic_map *bmap,
2391                 enum isl_dim_type c1,
2392                 enum isl_dim_type c2, enum isl_dim_type c3,
2393                 enum isl_dim_type c4, enum isl_dim_type c5);
2395 The C<isl_dim_type> arguments dictate the order in which
2396 different kinds of variables appear in the resulting matrix.
2397 For set inputs, they should be a permutation of
2398 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2399 For map inputs, they should be a permutation of
2400 C<isl_dim_cst>, C<isl_dim_param>,
2401 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2403 =head2 Points
2405 Points are elements of a set.  They can be used to construct
2406 simple sets (boxes) or they can be used to represent the
2407 individual elements of a set.
2408 The zero point (the origin) can be created using
2410         __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2412 The coordinates of a point can be inspected, set and changed
2413 using
2415         __isl_give isl_val *isl_point_get_coordinate_val(
2416                 __isl_keep isl_point *pnt,
2417                 enum isl_dim_type type, int pos);
2418         __isl_give isl_point *isl_point_set_coordinate_val(
2419                 __isl_take isl_point *pnt,
2420                 enum isl_dim_type type, int pos,
2421                 __isl_take isl_val *v);
2423         __isl_give isl_point *isl_point_add_ui(
2424                 __isl_take isl_point *pnt,
2425                 enum isl_dim_type type, int pos, unsigned val);
2426         __isl_give isl_point *isl_point_sub_ui(
2427                 __isl_take isl_point *pnt,
2428                 enum isl_dim_type type, int pos, unsigned val);
2430 Points can be copied or freed using
2432         __isl_give isl_point *isl_point_copy(
2433                 __isl_keep isl_point *pnt);
2434         __isl_null isl_point *isl_point_free(
2435                 __isl_take isl_point *pnt);
2437 A singleton set can be created from a point using
2439         __isl_give isl_basic_set *isl_basic_set_from_point(
2440                 __isl_take isl_point *pnt);
2441         __isl_give isl_set *isl_set_from_point(
2442                 __isl_take isl_point *pnt);
2443         __isl_give isl_union_set *isl_union_set_from_point(
2444                 __isl_take isl_point *pnt);
2446 and a box can be created from two opposite extremal points using
2448         __isl_give isl_basic_set *isl_basic_set_box_from_points(
2449                 __isl_take isl_point *pnt1,
2450                 __isl_take isl_point *pnt2);
2451         __isl_give isl_set *isl_set_box_from_points(
2452                 __isl_take isl_point *pnt1,
2453                 __isl_take isl_point *pnt2);
2455 All elements of a B<bounded> (union) set can be enumerated using
2456 the following functions.
2458         isl_stat isl_set_foreach_point(__isl_keep isl_set *set,
2459                 isl_stat (*fn)(__isl_take isl_point *pnt,
2460                         void *user),
2461                 void *user);
2462         isl_stat isl_union_set_foreach_point(
2463                 __isl_keep isl_union_set *uset,
2464                 isl_stat (*fn)(__isl_take isl_point *pnt,
2465                         void *user),
2466                 void *user);
2468 The function C<fn> is called for each integer point in
2469 C<set> with as second argument the last argument of
2470 the C<isl_set_foreach_point> call.  The function C<fn>
2471 should return C<isl_stat_ok> on success and C<isl_stat_error> on failure.
2472 In the latter case, C<isl_set_foreach_point> will stop
2473 enumerating and return C<isl_stat_error> as well.
2474 If the enumeration is performed successfully and to completion,
2475 then C<isl_set_foreach_point> returns C<isl_stat_ok>.
2477 To obtain a single point of a (basic or union) set, use
2479         __isl_give isl_point *isl_basic_set_sample_point(
2480                 __isl_take isl_basic_set *bset);
2481         __isl_give isl_point *isl_set_sample_point(
2482                 __isl_take isl_set *set);
2483         __isl_give isl_point *isl_union_set_sample_point(
2484                 __isl_take isl_union_set *uset);
2486 If C<set> does not contain any (integer) points, then the
2487 resulting point will be ``void'', a property that can be
2488 tested using
2490         isl_bool isl_point_is_void(__isl_keep isl_point *pnt);
2492 =head2 Functions
2494 Besides sets and relation, C<isl> also supports various types of functions.
2495 Each of these types is derived from the value type (see L</"Values">)
2496 or from one of two primitive function types
2497 through the application of zero or more type constructors.
2498 We first describe the primitive type and then we describe
2499 the types derived from these primitive types.
2501 =head3 Primitive Functions
2503 C<isl> support two primitive function types, quasi-affine
2504 expressions and quasipolynomials.
2505 A quasi-affine expression is defined either over a parameter
2506 space or over a set and is composed of integer constants,
2507 parameters and set variables, addition, subtraction and
2508 integer division by an integer constant.
2509 For example, the quasi-affine expression
2511         [n] -> { [x] -> [2*floor((4 n + x)/9)] }
2513 maps C<x> to C<2*floor((4 n + x)/9>.
2514 A quasipolynomial is a polynomial expression in quasi-affine
2515 expression.  That is, it additionally allows for multiplication.
2516 Note, though, that it is not allowed to construct an integer
2517 division of an expression involving multiplications.
2518 Here is an example of a quasipolynomial that is not
2519 quasi-affine expression
2521         [n] -> { [x] -> (n*floor((4 n + x)/9)) }
2523 Note that the external representations of quasi-affine expressions
2524 and quasipolynomials are different.  Quasi-affine expressions
2525 use a notation with square brackets just like binary relations,
2526 while quasipolynomials do not.  This might change at some point.
2528 If a primitive function is defined over a parameter space,
2529 then the space of the function itself is that of a set.
2530 If it is defined over a set, then the space of the function
2531 is that of a relation.  In both cases, the set space (or
2532 the output space) is single-dimensional, anonymous and unstructured.
2533 To create functions with multiple dimensions or with other kinds
2534 of set or output spaces, use multiple expressions
2535 (see L</"Multiple Expressions">).
2537 =over
2539 =item * Quasi-affine Expressions
2541 Besides the expressions described above, a quasi-affine
2542 expression can also be set to NaN.  Such expressions
2543 typically represent a failure to represent a result
2544 as a quasi-affine expression.
2546 The zero quasi affine expression or the quasi affine expression
2547 that is equal to a given value, parameter or
2548 a specified dimension on a given domain can be created using
2550         #include <isl/aff.h>
2551         __isl_give isl_aff *isl_aff_zero_on_domain(
2552                 __isl_take isl_local_space *ls);
2553         __isl_give isl_aff *isl_aff_val_on_domain(
2554                 __isl_take isl_local_space *ls,
2555                 __isl_take isl_val *val);
2556         __isl_give isl_aff *isl_aff_param_on_domain_space_id(
2557                 __isl_take isl_space *space,
2558                 __isl_take isl_id *id);
2559         __isl_give isl_aff *isl_aff_var_on_domain(
2560                 __isl_take isl_local_space *ls,
2561                 enum isl_dim_type type, unsigned pos);
2562         __isl_give isl_aff *isl_aff_nan_on_domain(
2563                 __isl_take isl_local_space *ls);
2565 The space passed to C<isl_aff_param_on_domain_space_id>
2566 is required to have a parameter with the given identifier.
2568 Quasi affine expressions can be copied and freed using
2570         #include <isl/aff.h>
2571         __isl_give isl_aff *isl_aff_copy(
2572                 __isl_keep isl_aff *aff);
2573         __isl_null isl_aff *isl_aff_free(
2574                 __isl_take isl_aff *aff);
2576 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2577 using the following function.  The constraint is required to have
2578 a non-zero coefficient for the specified dimension.
2580         #include <isl/constraint.h>
2581         __isl_give isl_aff *isl_constraint_get_bound(
2582                 __isl_keep isl_constraint *constraint,
2583                 enum isl_dim_type type, int pos);
2585 The entire affine expression of the constraint can also be extracted
2586 using the following function.
2588         #include <isl/constraint.h>
2589         __isl_give isl_aff *isl_constraint_get_aff(
2590                 __isl_keep isl_constraint *constraint);
2592 Conversely, an equality constraint equating
2593 the affine expression to zero or an inequality constraint enforcing
2594 the affine expression to be non-negative, can be constructed using
2596         __isl_give isl_constraint *isl_equality_from_aff(
2597                 __isl_take isl_aff *aff);
2598         __isl_give isl_constraint *isl_inequality_from_aff(
2599                 __isl_take isl_aff *aff);
2601 The coefficients and the integer divisions of an affine expression
2602 can be inspected using the following functions.
2604         #include <isl/aff.h>
2605         __isl_give isl_val *isl_aff_get_constant_val(
2606                 __isl_keep isl_aff *aff);
2607         __isl_give isl_val *isl_aff_get_coefficient_val(
2608                 __isl_keep isl_aff *aff,
2609                 enum isl_dim_type type, int pos);
2610         int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2611                 enum isl_dim_type type, int pos);
2612         __isl_give isl_val *isl_aff_get_denominator_val(
2613                 __isl_keep isl_aff *aff);
2614         __isl_give isl_aff *isl_aff_get_div(
2615                 __isl_keep isl_aff *aff, int pos);
2617 They can be modified using the following functions.
2619         #include <isl/aff.h>
2620         __isl_give isl_aff *isl_aff_set_constant_si(
2621                 __isl_take isl_aff *aff, int v);
2622         __isl_give isl_aff *isl_aff_set_constant_val(
2623                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2624         __isl_give isl_aff *isl_aff_set_coefficient_si(
2625                 __isl_take isl_aff *aff,
2626                 enum isl_dim_type type, int pos, int v);
2627         __isl_give isl_aff *isl_aff_set_coefficient_val(
2628                 __isl_take isl_aff *aff,
2629                 enum isl_dim_type type, int pos,
2630                 __isl_take isl_val *v);
2632         __isl_give isl_aff *isl_aff_add_constant_si(
2633                 __isl_take isl_aff *aff, int v);
2634         __isl_give isl_aff *isl_aff_add_constant_val(
2635                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2636         __isl_give isl_aff *isl_aff_add_constant_num_si(
2637                 __isl_take isl_aff *aff, int v);
2638         __isl_give isl_aff *isl_aff_add_coefficient_si(
2639                 __isl_take isl_aff *aff,
2640                 enum isl_dim_type type, int pos, int v);
2641         __isl_give isl_aff *isl_aff_add_coefficient_val(
2642                 __isl_take isl_aff *aff,
2643                 enum isl_dim_type type, int pos,
2644                 __isl_take isl_val *v);
2646 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2647 set the I<numerator> of the constant or coefficient, while
2648 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2649 the constant or coefficient as a whole.
2650 The C<add_constant> and C<add_coefficient> functions add an integer
2651 or rational value to
2652 the possibly rational constant or coefficient.
2653 The C<add_constant_num> functions add an integer value to
2654 the numerator.
2656 =item * Quasipolynomials
2658 Some simple quasipolynomials can be created using the following functions.
2660         #include <isl/polynomial.h>
2661         __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2662                 __isl_take isl_space *domain);
2663         __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2664                 __isl_take isl_space *domain);
2665         __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2666                 __isl_take isl_space *domain);
2667         __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2668                 __isl_take isl_space *domain);
2669         __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2670                 __isl_take isl_space *domain);
2671         __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2672                 __isl_take isl_space *domain,
2673                 __isl_take isl_val *val);
2674         __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2675                 __isl_take isl_space *domain,
2676                 enum isl_dim_type type, unsigned pos);
2677         __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2678                 __isl_take isl_aff *aff);
2680 Recall that the space in which a quasipolynomial lives is a map space
2681 with a one-dimensional range.  The C<domain> argument in some of
2682 the functions above corresponds to the domain of this map space.
2684 Quasipolynomials can be copied and freed again using the following
2685 functions.
2687         #include <isl/polynomial.h>
2688         __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2689                 __isl_keep isl_qpolynomial *qp);
2690         __isl_null isl_qpolynomial *isl_qpolynomial_free(
2691                 __isl_take isl_qpolynomial *qp);
2693 The constant term of a quasipolynomial can be extracted using
2695         __isl_give isl_val *isl_qpolynomial_get_constant_val(
2696                 __isl_keep isl_qpolynomial *qp);
2698 To iterate over all terms in a quasipolynomial,
2701         isl_stat isl_qpolynomial_foreach_term(
2702                 __isl_keep isl_qpolynomial *qp,
2703                 isl_stat (*fn)(__isl_take isl_term *term,
2704                           void *user), void *user);
2706 The terms themselves can be inspected and freed using
2707 these functions
2709         unsigned isl_term_dim(__isl_keep isl_term *term,
2710                 enum isl_dim_type type);
2711         __isl_give isl_val *isl_term_get_coefficient_val(
2712                 __isl_keep isl_term *term);
2713         int isl_term_get_exp(__isl_keep isl_term *term,
2714                 enum isl_dim_type type, unsigned pos);
2715         __isl_give isl_aff *isl_term_get_div(
2716                 __isl_keep isl_term *term, unsigned pos);
2717         void isl_term_free(__isl_take isl_term *term);
2719 Each term is a product of parameters, set variables and
2720 integer divisions.  The function C<isl_term_get_exp>
2721 returns the exponent of a given dimensions in the given term.
2723 =back
2725 =head3 Reductions
2727 A reduction represents a maximum or a minimum of its
2728 base expressions.
2729 The only reduction type defined by C<isl> is
2730 C<isl_qpolynomial_fold>.
2732 There are currently no functions to directly create such
2733 objects, but they do appear in the piecewise quasipolynomial
2734 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2736 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2738 Reductions can be copied and freed using
2739 the following functions.
2741         #include <isl/polynomial.h>
2742         __isl_give isl_qpolynomial_fold *
2743         isl_qpolynomial_fold_copy(
2744                 __isl_keep isl_qpolynomial_fold *fold);
2745         void isl_qpolynomial_fold_free(
2746                 __isl_take isl_qpolynomial_fold *fold);
2748 To iterate over all quasipolynomials in a reduction, use
2750         isl_stat isl_qpolynomial_fold_foreach_qpolynomial(
2751                 __isl_keep isl_qpolynomial_fold *fold,
2752                 isl_stat (*fn)(__isl_take isl_qpolynomial *qp,
2753                           void *user), void *user);
2755 =head3 Multiple Expressions
2757 A multiple expression represents a sequence of zero or
2758 more base expressions, all defined on the same domain space.
2759 The domain space of the multiple expression is the same
2760 as that of the base expressions, but the range space
2761 can be any space.  In case the base expressions have
2762 a set space, the corresponding multiple expression
2763 also has a set space.
2764 Objects of the value type do not have an associated space.
2765 The space of a multiple value is therefore always a set space.
2766 Similarly, the space of a multiple union piecewise
2767 affine expression is always a set space.
2768 If the base expressions are not total, then
2769 a corresponding zero-dimensional multiple expression may
2770 have an explicit domain that keeps track of the domain
2771 outside of any base expressions.
2773 The multiple expression types defined by C<isl>
2774 are C<isl_multi_val>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
2775 C<isl_multi_union_pw_aff>.
2777 A multiple expression with the value zero for
2778 each output (or set) dimension can be created
2779 using the following functions.
2781         #include <isl/val.h>
2782         __isl_give isl_multi_val *isl_multi_val_zero(
2783                 __isl_take isl_space *space);
2785         #include <isl/aff.h>
2786         __isl_give isl_multi_aff *isl_multi_aff_zero(
2787                 __isl_take isl_space *space);
2788         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2789                 __isl_take isl_space *space);
2790         __isl_give isl_multi_union_pw_aff *
2791         isl_multi_union_pw_aff_zero(
2792                 __isl_take isl_space *space);
2794 Since there is no canonical way of representing a zero
2795 value of type C<isl_union_pw_aff>, the space passed
2796 to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
2798 An identity function can be created using the following
2799 functions.  The space needs to be that of a relation
2800 with the same number of input and output dimensions.
2802         #include <isl/aff.h>
2803         __isl_give isl_multi_aff *isl_multi_aff_identity(
2804                 __isl_take isl_space *space);
2805         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2806                 __isl_take isl_space *space);
2808 A function that performs a projection on a universe
2809 relation or set can be created using the following functions.
2810 See also the corresponding
2811 projection operations in L</"Unary Operations">.
2813         #include <isl/aff.h>
2814         __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2815                 __isl_take isl_space *space);
2816         __isl_give isl_multi_aff *isl_multi_aff_range_map(
2817                 __isl_take isl_space *space);
2818         __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2819                 __isl_take isl_space *space,
2820                 enum isl_dim_type type,
2821                 unsigned first, unsigned n);
2823 A multiple expression can be created from a single
2824 base expression using the following functions.
2825 The space of the created multiple expression is the same
2826 as that of the base expression, except for
2827 C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
2828 lives in a parameter space and the output lives
2829 in a single-dimensional set space.
2831         #include <isl/aff.h>
2832         __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2833                 __isl_take isl_aff *aff);
2834         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2835                 __isl_take isl_pw_aff *pa);
2836         __isl_give isl_multi_union_pw_aff *
2837         isl_multi_union_pw_aff_from_union_pw_aff(
2838                 __isl_take isl_union_pw_aff *upa);
2840 A multiple expression can be created from a list
2841 of base expression in a specified space.
2842 The domain of this space needs to be the same
2843 as the domains of the base expressions in the list.
2844 If the base expressions have a set space (or no associated space),
2845 then this space also needs to be a set space.
2847         #include <isl/val.h>
2848         __isl_give isl_multi_val *isl_multi_val_from_val_list(
2849                 __isl_take isl_space *space,
2850                 __isl_take isl_val_list *list);
2852         #include <isl/aff.h>
2853         __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2854                 __isl_take isl_space *space,
2855                 __isl_take isl_aff_list *list);
2856         __isl_give isl_multi_pw_aff *
2857         isl_multi_pw_aff_from_pw_aff_list(
2858                 __isl_take isl_space *space,
2859                 __isl_take isl_pw_aff_list *list);
2860         __isl_give isl_multi_union_pw_aff *
2861         isl_multi_union_pw_aff_from_union_pw_aff_list(
2862                 __isl_take isl_space *space,
2863                 __isl_take isl_union_pw_aff_list *list);
2865 As a convenience, a multiple piecewise expression can
2866 also be created from a multiple expression.
2867 Each piecewise expression in the result has a single
2868 universe cell.
2870         #include <isl/aff.h>
2871         __isl_give isl_multi_pw_aff *
2872         isl_multi_pw_aff_from_multi_aff(
2873                 __isl_take isl_multi_aff *ma);
2875 Similarly, a multiple union expression can be
2876 created from a multiple expression.
2878         #include <isl/aff.h>
2879         __isl_give isl_multi_union_pw_aff *
2880         isl_multi_union_pw_aff_from_multi_aff(
2881                 __isl_take isl_multi_aff *ma);
2882         __isl_give isl_multi_union_pw_aff *
2883         isl_multi_union_pw_aff_from_multi_pw_aff(
2884                 __isl_take isl_multi_pw_aff *mpa);
2886 A multiple quasi-affine expression can be created from
2887 a multiple value with a given domain space using the following
2888 function.
2890         #include <isl/aff.h>
2891         __isl_give isl_multi_aff *
2892         isl_multi_aff_multi_val_on_space(
2893                 __isl_take isl_space *space,
2894                 __isl_take isl_multi_val *mv);
2896 Similarly,
2897 a multiple union piecewise affine expression can be created from
2898 a multiple value with a given domain or
2899 a (piecewise) multiple affine expression with a given domain
2900 using the following functions.
2902         #include <isl/aff.h>
2903         __isl_give isl_multi_union_pw_aff *
2904         isl_multi_union_pw_aff_multi_val_on_domain(
2905                 __isl_take isl_union_set *domain,
2906                 __isl_take isl_multi_val *mv);
2907         __isl_give isl_multi_union_pw_aff *
2908         isl_multi_union_pw_aff_multi_aff_on_domain(
2909                 __isl_take isl_union_set *domain,
2910                 __isl_take isl_multi_aff *ma);
2911         __isl_give isl_multi_union_pw_aff *
2912         isl_multi_union_pw_aff_pw_multi_aff_on_domain(
2913                 __isl_take isl_union_set *domain,
2914                 __isl_take isl_pw_multi_aff *pma);
2916 Multiple expressions can be copied and freed using
2917 the following functions.
2919         #include <isl/val.h>
2920         __isl_give isl_multi_val *isl_multi_val_copy(
2921                 __isl_keep isl_multi_val *mv);
2922         __isl_null isl_multi_val *isl_multi_val_free(
2923                 __isl_take isl_multi_val *mv);
2925         #include <isl/aff.h>
2926         __isl_give isl_multi_aff *isl_multi_aff_copy(
2927                 __isl_keep isl_multi_aff *maff);
2928         __isl_null isl_multi_aff *isl_multi_aff_free(
2929                 __isl_take isl_multi_aff *maff);
2930         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2931                 __isl_keep isl_multi_pw_aff *mpa);
2932         __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2933                 __isl_take isl_multi_pw_aff *mpa);
2934         __isl_give isl_multi_union_pw_aff *
2935         isl_multi_union_pw_aff_copy(
2936                 __isl_keep isl_multi_union_pw_aff *mupa);
2937         __isl_null isl_multi_union_pw_aff *
2938         isl_multi_union_pw_aff_free(
2939                 __isl_take isl_multi_union_pw_aff *mupa);
2941 The base expression at a given position of a multiple
2942 expression can be extracted using the following functions.
2944         #include <isl/val.h>
2945         __isl_give isl_val *isl_multi_val_get_val(
2946                 __isl_keep isl_multi_val *mv, int pos);
2948         #include <isl/aff.h>
2949         __isl_give isl_aff *isl_multi_aff_get_aff(
2950                 __isl_keep isl_multi_aff *multi, int pos);
2951         __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2952                 __isl_keep isl_multi_pw_aff *mpa, int pos);
2953         __isl_give isl_union_pw_aff *
2954         isl_multi_union_pw_aff_get_union_pw_aff(
2955                 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
2957 It can be replaced using the following functions.
2959         #include <isl/val.h>
2960         __isl_give isl_multi_val *isl_multi_val_set_val(
2961                 __isl_take isl_multi_val *mv, int pos,
2962                 __isl_take isl_val *val);
2964         #include <isl/aff.h>
2965         __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2966                 __isl_take isl_multi_aff *multi, int pos,
2967                 __isl_take isl_aff *aff);
2968         __isl_give isl_multi_union_pw_aff *
2969         isl_multi_union_pw_aff_set_union_pw_aff(
2970                 __isl_take isl_multi_union_pw_aff *mupa, int pos,
2971                 __isl_take isl_union_pw_aff *upa);
2973 As a convenience, a sequence of base expressions that have
2974 their domains in a given space can be extracted from a sequence
2975 of union expressions using the following function.
2977         #include <isl/aff.h>
2978         __isl_give isl_multi_pw_aff *
2979         isl_multi_union_pw_aff_extract_multi_pw_aff(
2980                 __isl_keep isl_multi_union_pw_aff *mupa,
2981                 __isl_take isl_space *space);
2983 Note that there is a difference between C<isl_multi_union_pw_aff>
2984 and C<isl_union_pw_multi_aff> objects.  The first is a sequence
2985 of unions of piecewise expressions, while the second is a union
2986 of piecewise sequences.  In particular, multiple affine expressions
2987 in an C<isl_union_pw_multi_aff> may live in different spaces,
2988 while there is only a single multiple expression in
2989 an C<isl_multi_union_pw_aff>, which can therefore only live
2990 in a single space.  This means that not every
2991 C<isl_union_pw_multi_aff> can be converted to
2992 an C<isl_multi_union_pw_aff>.  Conversely, the elements
2993 of an C<isl_multi_union_pw_aff> may be defined over different domains,
2994 while each multiple expression inside an C<isl_union_pw_multi_aff>
2995 has a single domain.  The conversion of an C<isl_union_pw_multi_aff>
2996 of dimension greater than one may therefore not be exact.
2997 The following functions can
2998 be used to perform these conversions when they are possible.
3000         #include <isl/aff.h>
3001         __isl_give isl_multi_union_pw_aff *
3002         isl_multi_union_pw_aff_from_union_pw_multi_aff(
3003                 __isl_take isl_union_pw_multi_aff *upma);
3004         __isl_give isl_union_pw_multi_aff *
3005         isl_union_pw_multi_aff_from_multi_union_pw_aff(
3006                 __isl_take isl_multi_union_pw_aff *mupa);
3008 =head3 Piecewise Expressions
3010 A piecewise expression is an expression that is described
3011 using zero or more base expression defined over the same
3012 number of cells in the domain space of the base expressions.
3013 All base expressions are defined over the same
3014 domain space and the cells are disjoint.
3015 The space of a piecewise expression is the same as
3016 that of the base expressions.
3017 If the union of the cells is a strict subset of the domain
3018 space, then the value of the piecewise expression outside
3019 this union is different for types derived from quasi-affine
3020 expressions and those derived from quasipolynomials.
3021 Piecewise expressions derived from quasi-affine expressions
3022 are considered to be undefined outside the union of their cells.
3023 Piecewise expressions derived from quasipolynomials
3024 are considered to be zero outside the union of their cells.
3026 Piecewise quasipolynomials are mainly used by the C<barvinok>
3027 library for representing the number of elements in a parametric set or map.
3028 For example, the piecewise quasipolynomial
3030         [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
3032 represents the number of points in the map
3034         [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
3036 The piecewise expression types defined by C<isl>
3037 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
3038 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
3040 A piecewise expression with no cells can be created using
3041 the following functions.
3043         #include <isl/aff.h>
3044         __isl_give isl_pw_aff *isl_pw_aff_empty(
3045                 __isl_take isl_space *space);
3046         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
3047                 __isl_take isl_space *space);
3049 A piecewise expression with a single universe cell can be
3050 created using the following functions.
3052         #include <isl/aff.h>
3053         __isl_give isl_pw_aff *isl_pw_aff_from_aff(
3054                 __isl_take isl_aff *aff);
3055         __isl_give isl_pw_multi_aff *
3056         isl_pw_multi_aff_from_multi_aff(
3057                 __isl_take isl_multi_aff *ma);
3059         #include <isl/polynomial.h>
3060         __isl_give isl_pw_qpolynomial *
3061         isl_pw_qpolynomial_from_qpolynomial(
3062                 __isl_take isl_qpolynomial *qp);
3064 A piecewise expression with a single specified cell can be
3065 created using the following functions.
3067         #include <isl/aff.h>
3068         __isl_give isl_pw_aff *isl_pw_aff_alloc(
3069                 __isl_take isl_set *set, __isl_take isl_aff *aff);
3070         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
3071                 __isl_take isl_set *set,
3072                 __isl_take isl_multi_aff *maff);
3074         #include <isl/polynomial.h>
3075         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
3076                 __isl_take isl_set *set,
3077                 __isl_take isl_qpolynomial *qp);
3079 The following convenience functions first create a base expression and
3080 then create a piecewise expression over a universe domain.
3082         #include <isl/aff.h>
3083         __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
3084                 __isl_take isl_local_space *ls);
3085         __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
3086                 __isl_take isl_local_space *ls,
3087                 enum isl_dim_type type, unsigned pos);
3088         __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
3089                 __isl_take isl_local_space *ls);
3090         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
3091                 __isl_take isl_space *space);
3092         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
3093                 __isl_take isl_space *space);
3094         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
3095                 __isl_take isl_space *space);
3096         __isl_give isl_pw_multi_aff *
3097         isl_pw_multi_aff_project_out_map(
3098                 __isl_take isl_space *space,
3099                 enum isl_dim_type type,
3100                 unsigned first, unsigned n);
3102         #include <isl/polynomial.h>
3103         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
3104                 __isl_take isl_space *space);
3106 The following convenience functions first create a base expression and
3107 then create a piecewise expression over a given domain.
3109         #include <isl/aff.h>
3110         __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
3111                 __isl_take isl_set *domain,
3112                 __isl_take isl_val *v);
3113         __isl_give isl_pw_multi_aff *
3114         isl_pw_multi_aff_multi_val_on_domain(
3115                 __isl_take isl_set *domain,
3116                 __isl_take isl_multi_val *mv);
3118 As a convenience, a piecewise multiple expression can
3119 also be created from a piecewise expression.
3120 Each multiple expression in the result is derived
3121 from the corresponding base expression.
3123         #include <isl/aff.h>
3124         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
3125                 __isl_take isl_pw_aff *pa);
3127 Similarly, a piecewise quasipolynomial can be
3128 created from a piecewise quasi-affine expression using
3129 the following function.
3131         #include <isl/polynomial.h>
3132         __isl_give isl_pw_qpolynomial *
3133         isl_pw_qpolynomial_from_pw_aff(
3134                 __isl_take isl_pw_aff *pwaff);
3136 Piecewise expressions can be copied and freed using the following functions.
3138         #include <isl/aff.h>
3139         __isl_give isl_pw_aff *isl_pw_aff_copy(
3140                 __isl_keep isl_pw_aff *pwaff);
3141         __isl_null isl_pw_aff *isl_pw_aff_free(
3142                 __isl_take isl_pw_aff *pwaff);
3143         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
3144                 __isl_keep isl_pw_multi_aff *pma);
3145         __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
3146                 __isl_take isl_pw_multi_aff *pma);
3148         #include <isl/polynomial.h>
3149         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
3150                 __isl_keep isl_pw_qpolynomial *pwqp);
3151         __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
3152                 __isl_take isl_pw_qpolynomial *pwqp);
3153         __isl_give isl_pw_qpolynomial_fold *
3154         isl_pw_qpolynomial_fold_copy(
3155                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3156         __isl_null isl_pw_qpolynomial_fold *
3157         isl_pw_qpolynomial_fold_free(
3158                 __isl_take isl_pw_qpolynomial_fold *pwf);
3160 To iterate over the different cells of a piecewise expression,
3161 use the following functions.
3163         #include <isl/aff.h>
3164         isl_bool isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
3165         int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
3166         isl_stat isl_pw_aff_foreach_piece(
3167                 __isl_keep isl_pw_aff *pwaff,
3168                 isl_stat (*fn)(__isl_take isl_set *set,
3169                           __isl_take isl_aff *aff,
3170                           void *user), void *user);
3171         int isl_pw_multi_aff_n_piece(
3172                 __isl_keep isl_pw_multi_aff *pma);
3173         isl_stat isl_pw_multi_aff_foreach_piece(
3174                 __isl_keep isl_pw_multi_aff *pma,
3175                 isl_stat (*fn)(__isl_take isl_set *set,
3176                             __isl_take isl_multi_aff *maff,
3177                             void *user), void *user);
3179         #include <isl/polynomial.h>
3180         int isl_pw_qpolynomial_n_piece(
3181                 __isl_keep isl_pw_qpolynomial *pwqp);
3182         isl_stat isl_pw_qpolynomial_foreach_piece(
3183                 __isl_keep isl_pw_qpolynomial *pwqp,
3184                 isl_stat (*fn)(__isl_take isl_set *set,
3185                           __isl_take isl_qpolynomial *qp,
3186                           void *user), void *user);
3187         isl_stat isl_pw_qpolynomial_foreach_lifted_piece(
3188                 __isl_keep isl_pw_qpolynomial *pwqp,
3189                 isl_stat (*fn)(__isl_take isl_set *set,
3190                           __isl_take isl_qpolynomial *qp,
3191                           void *user), void *user);
3192         int isl_pw_qpolynomial_fold_n_piece(
3193                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3194         isl_stat isl_pw_qpolynomial_fold_foreach_piece(
3195                 __isl_keep isl_pw_qpolynomial_fold *pwf,
3196                 isl_stat (*fn)(__isl_take isl_set *set,
3197                           __isl_take isl_qpolynomial_fold *fold,
3198                           void *user), void *user);
3199         isl_stat isl_pw_qpolynomial_fold_foreach_lifted_piece(
3200                 __isl_keep isl_pw_qpolynomial_fold *pwf,
3201                 isl_stat (*fn)(__isl_take isl_set *set,
3202                           __isl_take isl_qpolynomial_fold *fold,
3203                           void *user), void *user);
3205 As usual, the function C<fn> should return C<isl_stat_ok> on success
3206 and C<isl_stat_error> on failure.  The difference between
3207 C<isl_pw_qpolynomial_foreach_piece> and
3208 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
3209 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
3210 compute unique representations for all existentially quantified
3211 variables and then turn these existentially quantified variables
3212 into extra set variables, adapting the associated quasipolynomial
3213 accordingly.  This means that the C<set> passed to C<fn>
3214 will not have any existentially quantified variables, but that
3215 the dimensions of the sets may be different for different
3216 invocations of C<fn>.
3217 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
3218 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
3220 A piecewise expression consisting of the expressions at a given
3221 position of a piecewise multiple expression can be extracted
3222 using the following function.
3224         #include <isl/aff.h>
3225         __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3226                 __isl_keep isl_pw_multi_aff *pma, int pos);
3228 These expressions can be replaced using the following function.
3230         #include <isl/aff.h>
3231         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3232                 __isl_take isl_pw_multi_aff *pma, unsigned pos,
3233                 __isl_take isl_pw_aff *pa);
3235 Note that there is a difference between C<isl_multi_pw_aff> and
3236 C<isl_pw_multi_aff> objects.  The first is a sequence of piecewise
3237 affine expressions, while the second is a piecewise sequence
3238 of affine expressions.  In particular, each of the piecewise
3239 affine expressions in an C<isl_multi_pw_aff> may have a different
3240 domain, while all multiple expressions associated to a cell
3241 in an C<isl_pw_multi_aff> have the same domain.
3242 It is possible to convert between the two, but when converting
3243 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3244 of the result is the intersection of the domains of the input.
3245 The reverse conversion is exact.
3247         #include <isl/aff.h>
3248         __isl_give isl_pw_multi_aff *
3249         isl_pw_multi_aff_from_multi_pw_aff(
3250                 __isl_take isl_multi_pw_aff *mpa);
3251         __isl_give isl_multi_pw_aff *
3252         isl_multi_pw_aff_from_pw_multi_aff(
3253                 __isl_take isl_pw_multi_aff *pma);
3255 =head3 Union Expressions
3257 A union expression collects base expressions defined
3258 over different domains.  The space of a union expression
3259 is that of the shared parameter space.
3261 The union expression types defined by C<isl>
3262 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3263 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3264 In case of
3265 C<isl_union_pw_aff>,
3266 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>,
3267 there can be at most one base expression for a given domain space.
3268 In case of
3269 C<isl_union_pw_multi_aff>,
3270 there can be multiple such expressions for a given domain space,
3271 but the domains of these expressions need to be disjoint.
3273 An empty union expression can be created using the following functions.
3275         #include <isl/aff.h>
3276         __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
3277                 __isl_take isl_space *space);
3278         __isl_give isl_union_pw_multi_aff *
3279         isl_union_pw_multi_aff_empty(
3280                 __isl_take isl_space *space);
3282         #include <isl/polynomial.h>
3283         __isl_give isl_union_pw_qpolynomial *
3284         isl_union_pw_qpolynomial_zero(
3285                 __isl_take isl_space *space);
3287 A union expression containing a single base expression
3288 can be created using the following functions.
3290         #include <isl/aff.h>
3291         __isl_give isl_union_pw_aff *
3292         isl_union_pw_aff_from_pw_aff(
3293                 __isl_take isl_pw_aff *pa);
3294         __isl_give isl_union_pw_multi_aff *
3295         isl_union_pw_multi_aff_from_aff(
3296                 __isl_take isl_aff *aff);
3297         __isl_give isl_union_pw_multi_aff *
3298         isl_union_pw_multi_aff_from_pw_multi_aff(
3299                 __isl_take isl_pw_multi_aff *pma);
3301         #include <isl/polynomial.h>
3302         __isl_give isl_union_pw_qpolynomial *
3303         isl_union_pw_qpolynomial_from_pw_qpolynomial(
3304                 __isl_take isl_pw_qpolynomial *pwqp);
3306 The following functions create a base expression on each
3307 of the sets in the union set and collect the results.
3309         #include <isl/aff.h>
3310         __isl_give isl_union_pw_multi_aff *
3311         isl_union_pw_multi_aff_from_union_pw_aff(
3312                 __isl_take isl_union_pw_aff *upa);
3313         __isl_give isl_union_pw_aff *
3314         isl_union_pw_multi_aff_get_union_pw_aff(
3315                 __isl_keep isl_union_pw_multi_aff *upma, int pos);
3316         __isl_give isl_union_pw_aff *
3317         isl_union_pw_aff_val_on_domain(
3318                 __isl_take isl_union_set *domain,
3319                 __isl_take isl_val *v);
3320         __isl_give isl_union_pw_multi_aff *
3321         isl_union_pw_multi_aff_multi_val_on_domain(
3322                 __isl_take isl_union_set *domain,
3323                 __isl_take isl_multi_val *mv);
3324         __isl_give isl_union_pw_aff *
3325         isl_union_pw_aff_param_on_domain_id(
3326                 __isl_take isl_union_set *domain,
3327                 __isl_take isl_id *id);
3329 The C<id> argument of C<isl_union_pw_aff_param_on_domain_id>
3330 is the identifier of a parameter that may or may not already
3331 be present in C<domain>.
3333 An C<isl_union_pw_aff> that is equal to a (parametric) affine
3334 or piecewise affine
3335 expression on a given domain can be created using the following
3336 functions.
3338         #include <isl/aff.h>
3339         __isl_give isl_union_pw_aff *
3340         isl_union_pw_aff_aff_on_domain(
3341                 __isl_take isl_union_set *domain,
3342                 __isl_take isl_aff *aff);
3343         __isl_give isl_union_pw_aff *
3344         isl_union_pw_aff_pw_aff_on_domain(
3345                 __isl_take isl_union_set *domain,
3346                 __isl_take isl_pw_aff *pa);
3348 A base expression can be added to a union expression using
3349 the following functions.
3351         #include <isl/aff.h>
3352         __isl_give isl_union_pw_aff *
3353         isl_union_pw_aff_add_pw_aff(
3354                 __isl_take isl_union_pw_aff *upa,
3355                 __isl_take isl_pw_aff *pa);
3356         __isl_give isl_union_pw_multi_aff *
3357         isl_union_pw_multi_aff_add_pw_multi_aff(
3358                 __isl_take isl_union_pw_multi_aff *upma,
3359                 __isl_take isl_pw_multi_aff *pma);
3361         #include <isl/polynomial.h>
3362         __isl_give isl_union_pw_qpolynomial *
3363         isl_union_pw_qpolynomial_add_pw_qpolynomial(
3364                 __isl_take isl_union_pw_qpolynomial *upwqp,
3365                 __isl_take isl_pw_qpolynomial *pwqp);
3367 Union expressions can be copied and freed using
3368 the following functions.
3370         #include <isl/aff.h>
3371         __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
3372                 __isl_keep isl_union_pw_aff *upa);
3373         __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
3374                 __isl_take isl_union_pw_aff *upa);
3375         __isl_give isl_union_pw_multi_aff *
3376         isl_union_pw_multi_aff_copy(
3377                 __isl_keep isl_union_pw_multi_aff *upma);
3378         __isl_null isl_union_pw_multi_aff *
3379         isl_union_pw_multi_aff_free(
3380                 __isl_take isl_union_pw_multi_aff *upma);
3382         #include <isl/polynomial.h>
3383         __isl_give isl_union_pw_qpolynomial *
3384         isl_union_pw_qpolynomial_copy(
3385                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3386         __isl_null isl_union_pw_qpolynomial *
3387         isl_union_pw_qpolynomial_free(
3388                 __isl_take isl_union_pw_qpolynomial *upwqp);
3389         __isl_give isl_union_pw_qpolynomial_fold *
3390         isl_union_pw_qpolynomial_fold_copy(
3391                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3392         __isl_null isl_union_pw_qpolynomial_fold *
3393         isl_union_pw_qpolynomial_fold_free(
3394                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3396 To iterate over the base expressions in a union expression,
3397 use the following functions.
3399         #include <isl/aff.h>
3400         int isl_union_pw_aff_n_pw_aff(
3401                 __isl_keep isl_union_pw_aff *upa);
3402         isl_stat isl_union_pw_aff_foreach_pw_aff(
3403                 __isl_keep isl_union_pw_aff *upa,
3404                 isl_stat (*fn)(__isl_take isl_pw_aff *pa,
3405                         void *user), void *user);
3406         int isl_union_pw_multi_aff_n_pw_multi_aff(
3407                 __isl_keep isl_union_pw_multi_aff *upma);
3408         isl_stat isl_union_pw_multi_aff_foreach_pw_multi_aff(
3409                 __isl_keep isl_union_pw_multi_aff *upma,
3410                 isl_stat (*fn)(__isl_take isl_pw_multi_aff *pma,
3411                             void *user), void *user);
3413         #include <isl/polynomial.h>
3414         int isl_union_pw_qpolynomial_n_pw_qpolynomial(
3415                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3416         isl_stat isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3417                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3418                 isl_stat (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3419                             void *user), void *user);
3420         int isl_union_pw_qpolynomial_fold_n_pw_qpolynomial_fold(
3421                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3422         isl_stat isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3423                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3424                 isl_stat (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3425                             void *user), void *user);
3427 To extract the base expression in a given space from a union, use
3428 the following functions.
3430         #include <isl/aff.h>
3431         __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3432                 __isl_keep isl_union_pw_aff *upa,
3433                 __isl_take isl_space *space);
3434         __isl_give isl_pw_multi_aff *
3435         isl_union_pw_multi_aff_extract_pw_multi_aff(
3436                 __isl_keep isl_union_pw_multi_aff *upma,
3437                 __isl_take isl_space *space);
3439         #include <isl/polynomial.h>
3440         __isl_give isl_pw_qpolynomial *
3441         isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3442                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3443                 __isl_take isl_space *space);
3445 =head2 Input and Output
3447 For set and relation,
3448 C<isl> supports its own input/output format, which is similar
3449 to the C<Omega> format, but also supports the C<PolyLib> format
3450 in some cases.
3451 For other object types, typically only an C<isl> format is supported.
3453 =head3 C<isl> format
3455 The C<isl> format is similar to that of C<Omega>, but has a different
3456 syntax for describing the parameters and allows for the definition
3457 of an existentially quantified variable as the integer division
3458 of an affine expression.
3459 For example, the set of integers C<i> between C<0> and C<n>
3460 such that C<i % 10 <= 6> can be described as
3462         [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3463                                 i - 10 a <= 6) }
3465 A set or relation can have several disjuncts, separated
3466 by the keyword C<or>.  Each disjunct is either a conjunction
3467 of constraints or a projection (C<exists>) of a conjunction
3468 of constraints.  The constraints are separated by the keyword
3469 C<and>.
3471 =head3 C<PolyLib> format
3473 If the represented set is a union, then the first line
3474 contains a single number representing the number of disjuncts.
3475 Otherwise, a line containing the number C<1> is optional.
3477 Each disjunct is represented by a matrix of constraints.
3478 The first line contains two numbers representing
3479 the number of rows and columns,
3480 where the number of rows is equal to the number of constraints
3481 and the number of columns is equal to two plus the number of variables.
3482 The following lines contain the actual rows of the constraint matrix.
3483 In each row, the first column indicates whether the constraint
3484 is an equality (C<0>) or inequality (C<1>).  The final column
3485 corresponds to the constant term.
3487 If the set is parametric, then the coefficients of the parameters
3488 appear in the last columns before the constant column.
3489 The coefficients of any existentially quantified variables appear
3490 between those of the set variables and those of the parameters.
3492 =head3 Extended C<PolyLib> format
3494 The extended C<PolyLib> format is nearly identical to the
3495 C<PolyLib> format.  The only difference is that the line
3496 containing the number of rows and columns of a constraint matrix
3497 also contains four additional numbers:
3498 the number of output dimensions, the number of input dimensions,
3499 the number of local dimensions (i.e., the number of existentially
3500 quantified variables) and the number of parameters.
3501 For sets, the number of ``output'' dimensions is equal
3502 to the number of set dimensions, while the number of ``input''
3503 dimensions is zero.
3505 =head3 Input
3507 Objects can be read from input using the following functions.
3509         #include <isl/val.h>
3510         __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3511                 const char *str);
3512         __isl_give isl_multi_val *isl_multi_val_read_from_str(
3513                 isl_ctx *ctx, const char *str);
3515         #include <isl/set.h>
3516         __isl_give isl_basic_set *isl_basic_set_read_from_file(
3517                 isl_ctx *ctx, FILE *input);
3518         __isl_give isl_basic_set *isl_basic_set_read_from_str(
3519                 isl_ctx *ctx, const char *str);
3520         __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3521                 FILE *input);
3522         __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3523                 const char *str);
3525         #include <isl/map.h>
3526         __isl_give isl_basic_map *isl_basic_map_read_from_file(
3527                 isl_ctx *ctx, FILE *input);
3528         __isl_give isl_basic_map *isl_basic_map_read_from_str(
3529                 isl_ctx *ctx, const char *str);
3530         __isl_give isl_map *isl_map_read_from_file(
3531                 isl_ctx *ctx, FILE *input);
3532         __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3533                 const char *str);
3535         #include <isl/union_set.h>
3536         __isl_give isl_union_set *isl_union_set_read_from_file(
3537                 isl_ctx *ctx, FILE *input);
3538         __isl_give isl_union_set *isl_union_set_read_from_str(
3539                 isl_ctx *ctx, const char *str);
3541         #include <isl/union_map.h>
3542         __isl_give isl_union_map *isl_union_map_read_from_file(
3543                 isl_ctx *ctx, FILE *input);
3544         __isl_give isl_union_map *isl_union_map_read_from_str(
3545                 isl_ctx *ctx, const char *str);
3547         #include <isl/aff.h>
3548         __isl_give isl_aff *isl_aff_read_from_str(
3549                 isl_ctx *ctx, const char *str);
3550         __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3551                 isl_ctx *ctx, const char *str);
3552         __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3553                 isl_ctx *ctx, const char *str);
3554         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3555                 isl_ctx *ctx, const char *str);
3556         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3557                 isl_ctx *ctx, const char *str);
3558         __isl_give isl_union_pw_aff *
3559         isl_union_pw_aff_read_from_str(
3560                 isl_ctx *ctx, const char *str);
3561         __isl_give isl_union_pw_multi_aff *
3562         isl_union_pw_multi_aff_read_from_str(
3563                 isl_ctx *ctx, const char *str);
3564         __isl_give isl_multi_union_pw_aff *
3565         isl_multi_union_pw_aff_read_from_str(
3566                 isl_ctx *ctx, const char *str);
3568         #include <isl/polynomial.h>
3569         __isl_give isl_union_pw_qpolynomial *
3570         isl_union_pw_qpolynomial_read_from_str(
3571                 isl_ctx *ctx, const char *str);
3573 For sets and relations,
3574 the input format is autodetected and may be either the C<PolyLib> format
3575 or the C<isl> format.
3577 =head3 Output
3579 Before anything can be printed, an C<isl_printer> needs to
3580 be created.
3582         __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3583                 FILE *file);
3584         __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3585         __isl_null isl_printer *isl_printer_free(
3586                 __isl_take isl_printer *printer);
3588 C<isl_printer_to_file> prints to the given file, while
3589 C<isl_printer_to_str> prints to a string that can be extracted
3590 using the following function.
3592         #include <isl/printer.h>
3593         __isl_give char *isl_printer_get_str(
3594                 __isl_keep isl_printer *printer);
3596 The printer can be inspected using the following functions.
3598         FILE *isl_printer_get_file(
3599                 __isl_keep isl_printer *printer);
3600         int isl_printer_get_output_format(
3601                 __isl_keep isl_printer *p);
3602         int isl_printer_get_yaml_style(__isl_keep isl_printer *p);
3604 The behavior of the printer can be modified in various ways
3606         __isl_give isl_printer *isl_printer_set_output_format(
3607                 __isl_take isl_printer *p, int output_format);
3608         __isl_give isl_printer *isl_printer_set_indent(
3609                 __isl_take isl_printer *p, int indent);
3610         __isl_give isl_printer *isl_printer_set_indent_prefix(
3611                 __isl_take isl_printer *p, const char *prefix);
3612         __isl_give isl_printer *isl_printer_indent(
3613                 __isl_take isl_printer *p, int indent);
3614         __isl_give isl_printer *isl_printer_set_prefix(
3615                 __isl_take isl_printer *p, const char *prefix);
3616         __isl_give isl_printer *isl_printer_set_suffix(
3617                 __isl_take isl_printer *p, const char *suffix);
3618         __isl_give isl_printer *isl_printer_set_yaml_style(
3619                 __isl_take isl_printer *p, int yaml_style);
3621 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3622 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3623 and defaults to C<ISL_FORMAT_ISL>.
3624 Each line in the output is prefixed by C<indent_prefix>,
3625 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3626 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3627 In the C<PolyLib> format output,
3628 the coefficients of the existentially quantified variables
3629 appear between those of the set variables and those
3630 of the parameters.
3631 The function C<isl_printer_indent> increases the indentation
3632 by the specified amount (which may be negative).
3633 The YAML style may be either C<ISL_YAML_STYLE_BLOCK> or
3634 C<ISL_YAML_STYLE_FLOW> and when we are printing something
3635 in YAML format.
3637 To actually print something, use
3639         #include <isl/printer.h>
3640         __isl_give isl_printer *isl_printer_print_double(
3641                 __isl_take isl_printer *p, double d);
3643         #include <isl/val.h>
3644         __isl_give isl_printer *isl_printer_print_val(
3645                 __isl_take isl_printer *p, __isl_keep isl_val *v);
3647         #include <isl/set.h>
3648         __isl_give isl_printer *isl_printer_print_basic_set(
3649                 __isl_take isl_printer *printer,
3650                 __isl_keep isl_basic_set *bset);
3651         __isl_give isl_printer *isl_printer_print_set(
3652                 __isl_take isl_printer *printer,
3653                 __isl_keep isl_set *set);
3655         #include <isl/map.h>
3656         __isl_give isl_printer *isl_printer_print_basic_map(
3657                 __isl_take isl_printer *printer,
3658                 __isl_keep isl_basic_map *bmap);
3659         __isl_give isl_printer *isl_printer_print_map(
3660                 __isl_take isl_printer *printer,
3661                 __isl_keep isl_map *map);
3663         #include <isl/union_set.h>
3664         __isl_give isl_printer *isl_printer_print_union_set(
3665                 __isl_take isl_printer *p,
3666                 __isl_keep isl_union_set *uset);
3668         #include <isl/union_map.h>
3669         __isl_give isl_printer *isl_printer_print_union_map(
3670                 __isl_take isl_printer *p,
3671                 __isl_keep isl_union_map *umap);
3673         #include <isl/val.h>
3674         __isl_give isl_printer *isl_printer_print_multi_val(
3675                 __isl_take isl_printer *p,
3676                 __isl_keep isl_multi_val *mv);
3678         #include <isl/aff.h>
3679         __isl_give isl_printer *isl_printer_print_aff(
3680                 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3681         __isl_give isl_printer *isl_printer_print_multi_aff(
3682                 __isl_take isl_printer *p,
3683                 __isl_keep isl_multi_aff *maff);
3684         __isl_give isl_printer *isl_printer_print_pw_aff(
3685                 __isl_take isl_printer *p,
3686                 __isl_keep isl_pw_aff *pwaff);
3687         __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3688                 __isl_take isl_printer *p,
3689                 __isl_keep isl_pw_multi_aff *pma);
3690         __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3691                 __isl_take isl_printer *p,
3692                 __isl_keep isl_multi_pw_aff *mpa);
3693         __isl_give isl_printer *isl_printer_print_union_pw_aff(
3694                 __isl_take isl_printer *p,
3695                 __isl_keep isl_union_pw_aff *upa);
3696         __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3697                 __isl_take isl_printer *p,
3698                 __isl_keep isl_union_pw_multi_aff *upma);
3699         __isl_give isl_printer *
3700         isl_printer_print_multi_union_pw_aff(
3701                 __isl_take isl_printer *p,
3702                 __isl_keep isl_multi_union_pw_aff *mupa);
3704         #include <isl/polynomial.h>
3705         __isl_give isl_printer *isl_printer_print_qpolynomial(
3706                 __isl_take isl_printer *p,
3707                 __isl_keep isl_qpolynomial *qp);
3708         __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3709                 __isl_take isl_printer *p,
3710                 __isl_keep isl_pw_qpolynomial *pwqp);
3711         __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3712                 __isl_take isl_printer *p,
3713                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3715         __isl_give isl_printer *
3716         isl_printer_print_pw_qpolynomial_fold(
3717                 __isl_take isl_printer *p,
3718                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3719         __isl_give isl_printer *
3720         isl_printer_print_union_pw_qpolynomial_fold(
3721                 __isl_take isl_printer *p,
3722                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3724 For C<isl_printer_print_qpolynomial>,
3725 C<isl_printer_print_pw_qpolynomial> and
3726 C<isl_printer_print_pw_qpolynomial_fold>,
3727 the output format of the printer
3728 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3729 For C<isl_printer_print_union_pw_qpolynomial> and
3730 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3731 is supported.
3732 In case of printing in C<ISL_FORMAT_C>, the user may want
3733 to set the names of all dimensions first.
3735 C<isl> also provides limited support for printing YAML documents,
3736 just enough for the internal use for printing such documents.
3738         #include <isl/printer.h>
3739         __isl_give isl_printer *isl_printer_yaml_start_mapping(
3740                 __isl_take isl_printer *p);
3741         __isl_give isl_printer *isl_printer_yaml_end_mapping(
3742                 __isl_take isl_printer *p);
3743         __isl_give isl_printer *isl_printer_yaml_start_sequence(
3744                 __isl_take isl_printer *p);
3745         __isl_give isl_printer *isl_printer_yaml_end_sequence(
3746                 __isl_take isl_printer *p);
3747         __isl_give isl_printer *isl_printer_yaml_next(
3748                 __isl_take isl_printer *p);
3750 A document is started by a call to either
3751 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3752 Anything printed to the printer after such a call belong to the
3753 first key of the mapping or the first element in the sequence.
3754 The function C<isl_printer_yaml_next> moves to the value if
3755 we are currently printing a mapping key, the next key if we
3756 are printing a value or the next element if we are printing
3757 an element in a sequence.
3758 Nested mappings and sequences are initiated by the same
3759 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3760 Each call to these functions needs to have a corresponding call to
3761 C<isl_printer_yaml_end_mapping> or C<isl_printer_yaml_end_sequence>.
3763 When called on a file printer, the following function flushes
3764 the file.  When called on a string printer, the buffer is cleared.
3766         __isl_give isl_printer *isl_printer_flush(
3767                 __isl_take isl_printer *p);
3769 The following functions allow the user to attach
3770 notes to a printer in order to keep track of additional state.
3772         #include <isl/printer.h>
3773         isl_bool isl_printer_has_note(__isl_keep isl_printer *p,
3774                 __isl_keep isl_id *id);
3775         __isl_give isl_id *isl_printer_get_note(
3776                 __isl_keep isl_printer *p, __isl_take isl_id *id);
3777         __isl_give isl_printer *isl_printer_set_note(
3778                 __isl_take isl_printer *p,
3779                 __isl_take isl_id *id, __isl_take isl_id *note);
3781 C<isl_printer_set_note> associates the given note to the given
3782 identifier in the printer.
3783 C<isl_printer_get_note> retrieves a note associated to an
3784 identifier, while
3785 C<isl_printer_has_note> checks if there is such a note.
3786 C<isl_printer_get_note> fails if the requested note does not exist.
3788 Alternatively, a string representation can be obtained
3789 directly using the following functions, which always print
3790 in isl format.
3792         #include <isl/id.h>
3793         __isl_give char *isl_id_to_str(
3794                 __isl_keep isl_id *id);
3796         #include <isl/space.h>
3797         __isl_give char *isl_space_to_str(
3798                 __isl_keep isl_space *space);
3800         #include <isl/val.h>
3801         __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3802         __isl_give char *isl_multi_val_to_str(
3803                 __isl_keep isl_multi_val *mv);
3805         #include <isl/set.h>
3806         __isl_give char *isl_basic_set_to_str(
3807                 __isl_keep isl_basic_set *bset);
3808         __isl_give char *isl_set_to_str(
3809                 __isl_keep isl_set *set);
3811         #include <isl/union_set.h>
3812         __isl_give char *isl_union_set_to_str(
3813                 __isl_keep isl_union_set *uset);
3815         #include <isl/map.h>
3816         __isl_give char *isl_basic_map_to_str(
3817                 __isl_keep isl_basic_map *bmap);
3818         __isl_give char *isl_map_to_str(
3819                 __isl_keep isl_map *map);
3821         #include <isl/union_map.h>
3822         __isl_give char *isl_union_map_to_str(
3823                 __isl_keep isl_union_map *umap);
3825         #include <isl/aff.h>
3826         __isl_give char *isl_aff_to_str(__isl_keep isl_aff *aff);
3827         __isl_give char *isl_pw_aff_to_str(
3828                 __isl_keep isl_pw_aff *pa);
3829         __isl_give char *isl_multi_aff_to_str(
3830                 __isl_keep isl_multi_aff *ma);
3831         __isl_give char *isl_pw_multi_aff_to_str(
3832                 __isl_keep isl_pw_multi_aff *pma);
3833         __isl_give char *isl_multi_pw_aff_to_str(
3834                 __isl_keep isl_multi_pw_aff *mpa);
3835         __isl_give char *isl_union_pw_aff_to_str(
3836                 __isl_keep isl_union_pw_aff *upa);
3837         __isl_give char *isl_union_pw_multi_aff_to_str(
3838                 __isl_keep isl_union_pw_multi_aff *upma);
3839         __isl_give char *isl_multi_union_pw_aff_to_str(
3840                 __isl_keep isl_multi_union_pw_aff *mupa);
3842         #include <isl/point.h>
3843         __isl_give char *isl_point_to_str(
3844                 __isl_keep isl_point *pnt);
3846         #include <isl/polynomial.h>
3847         __isl_give char *isl_pw_qpolynomial_to_str(
3848                 __isl_keep isl_pw_qpolynomial *pwqp);
3849         __isl_give char *isl_union_pw_qpolynomial_to_str(
3850                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3852 =head2 Properties
3854 =head3 Unary Properties
3856 =over
3858 =item * Emptiness
3860 The following functions test whether the given set or relation
3861 contains any integer points.  The ``plain'' variants do not perform
3862 any computations, but simply check if the given set or relation
3863 is already known to be empty.
3865         #include <isl/set.h>
3866         isl_bool isl_basic_set_plain_is_empty(
3867                 __isl_keep isl_basic_set *bset);
3868         isl_bool isl_basic_set_is_empty(
3869                 __isl_keep isl_basic_set *bset);
3870         isl_bool isl_set_plain_is_empty(
3871                 __isl_keep isl_set *set);
3872         isl_bool isl_set_is_empty(__isl_keep isl_set *set);
3874         #include <isl/union_set.h>
3875         isl_bool isl_union_set_is_empty(
3876                 __isl_keep isl_union_set *uset);
3878         #include <isl/map.h>
3879         isl_bool isl_basic_map_plain_is_empty(
3880                 __isl_keep isl_basic_map *bmap);
3881         isl_bool isl_basic_map_is_empty(
3882                 __isl_keep isl_basic_map *bmap);
3883         isl_bool isl_map_plain_is_empty(
3884                 __isl_keep isl_map *map);
3885         isl_bool isl_map_is_empty(__isl_keep isl_map *map);
3887         #include <isl/union_map.h>
3888         isl_bool isl_union_map_plain_is_empty(
3889                 __isl_keep isl_union_map *umap);
3890         isl_bool isl_union_map_is_empty(
3891                 __isl_keep isl_union_map *umap);
3893 =item * Universality
3895         isl_bool isl_basic_set_plain_is_universe(
3896                 __isl_keep isl_basic_set *bset);
3897         isl_bool isl_basic_set_is_universe(
3898                 __isl_keep isl_basic_set *bset);
3899         isl_bool isl_basic_map_plain_is_universe(
3900                 __isl_keep isl_basic_map *bmap);
3901         isl_bool isl_basic_map_is_universe(
3902                 __isl_keep isl_basic_map *bmap);
3903         isl_bool isl_set_plain_is_universe(
3904                 __isl_keep isl_set *set);
3905         isl_bool isl_map_plain_is_universe(
3906                 __isl_keep isl_map *map);
3908 =item * Single-valuedness
3910         #include <isl/set.h>
3911         isl_bool isl_set_is_singleton(__isl_keep isl_set *set);
3913         #include <isl/map.h>
3914         isl_bool isl_basic_map_is_single_valued(
3915                 __isl_keep isl_basic_map *bmap);
3916         isl_bool isl_map_plain_is_single_valued(
3917                 __isl_keep isl_map *map);
3918         isl_bool isl_map_is_single_valued(__isl_keep isl_map *map);
3920         #include <isl/union_map.h>
3921         isl_bool isl_union_map_is_single_valued(
3922                 __isl_keep isl_union_map *umap);
3924 =item * Injectivity
3926         isl_bool isl_map_plain_is_injective(
3927                 __isl_keep isl_map *map);
3928         isl_bool isl_map_is_injective(
3929                 __isl_keep isl_map *map);
3930         isl_bool isl_union_map_plain_is_injective(
3931                 __isl_keep isl_union_map *umap);
3932         isl_bool isl_union_map_is_injective(
3933                 __isl_keep isl_union_map *umap);
3935 =item * Bijectivity
3937         isl_bool isl_map_is_bijective(
3938                 __isl_keep isl_map *map);
3939         isl_bool isl_union_map_is_bijective(
3940                 __isl_keep isl_union_map *umap);
3942 =item * Identity
3944 The following functions test whether the given relation
3945 only maps elements to themselves.
3947         #include <isl/map.h>
3948         isl_bool isl_map_is_identity(
3949                 __isl_keep isl_map *map);
3951         #include <isl/union_map.h>
3952         isl_bool isl_union_map_is_identity(
3953                 __isl_keep isl_union_map *umap);
3955 =item * Position
3957         __isl_give isl_val *
3958         isl_basic_map_plain_get_val_if_fixed(
3959                 __isl_keep isl_basic_map *bmap,
3960                 enum isl_dim_type type, unsigned pos);
3961         __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3962                 __isl_keep isl_set *set,
3963                 enum isl_dim_type type, unsigned pos);
3964         __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3965                 __isl_keep isl_map *map,
3966                 enum isl_dim_type type, unsigned pos);
3968 If the set or relation obviously lies on a hyperplane where the given dimension
3969 has a fixed value, then return that value.
3970 Otherwise return NaN.
3972 =item * Stride
3974         isl_stat isl_set_dim_residue_class_val(
3975                 __isl_keep isl_set *set,
3976                 int pos, __isl_give isl_val **modulo,
3977                 __isl_give isl_val **residue);
3979 Check if the values of the given set dimension are equal to a fixed
3980 value modulo some integer value.  If so, assign the modulo to C<*modulo>
3981 and the fixed value to C<*residue>.  If the given dimension attains only
3982 a single value, then assign C<0> to C<*modulo> and the fixed value to
3983 C<*residue>.
3984 If the dimension does not attain only a single value and if no modulo
3985 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3987         #include <isl/set.h>
3988         __isl_give isl_stride_info *isl_set_get_stride_info(
3989                 __isl_keep isl_set *set, int pos);
3990         __isl_give isl_val *isl_set_get_stride(
3991                 __isl_keep isl_set *set, int pos);
3993         #include <isl/map.h>
3994         __isl_give isl_stride_info *
3995         isl_map_get_range_stride_info(
3996                 __isl_keep isl_map *map, int pos);
3998 Check if the values of the given set dimension are equal to
3999 some affine expression of the other dimensions (the offset)
4000 modulo some integer stride or
4001 check if the values of the given output dimensions are equal to
4002 some affine expression of the input dimensions (the offset)
4003 modulo some integer stride.
4004 If no more specific information can be found, then the stride
4005 is taken to be one and the offset is taken to be the zero expression.
4006 The function C<isl_set_get_stride> performs the same
4007 computation as C<isl_set_get_stride_info> but only returns the stride.
4008 For the other functions,
4009 the stride and offset can be extracted from the returned object
4010 using the following functions.
4012         #include <isl/stride_info.h>
4013         __isl_give isl_val *isl_stride_info_get_stride(
4014                 __isl_keep isl_stride_info *si);
4015         __isl_give isl_aff *isl_stride_info_get_offset(
4016                 __isl_keep isl_stride_info *si);
4018 The stride info object can be released using the following function.
4020         #include <isl/stride_info.h>
4021         __isl_null isl_stride_info *isl_stride_info_free(
4022                 __isl_take isl_stride_info *si);
4024 =item * Dependence
4026 To check whether the description of a set, relation or function depends
4027 on one or more given dimensions,
4028 the following functions can be used.
4030         #include <isl/constraint.h>
4031         isl_bool isl_constraint_involves_dims(
4032                 __isl_keep isl_constraint *constraint,
4033                 enum isl_dim_type type, unsigned first, unsigned n);
4035         #include <isl/set.h>
4036         isl_bool isl_basic_set_involves_dims(
4037                 __isl_keep isl_basic_set *bset,
4038                 enum isl_dim_type type, unsigned first, unsigned n);
4039         isl_bool isl_set_involves_dims(__isl_keep isl_set *set,
4040                 enum isl_dim_type type, unsigned first, unsigned n);
4042         #include <isl/map.h>
4043         isl_bool isl_basic_map_involves_dims(
4044                 __isl_keep isl_basic_map *bmap,
4045                 enum isl_dim_type type, unsigned first, unsigned n);
4046         isl_bool isl_map_involves_dims(__isl_keep isl_map *map,
4047                 enum isl_dim_type type, unsigned first, unsigned n);
4049         #include <isl/union_map.h>
4050         isl_bool isl_union_map_involves_dims(
4051                 __isl_keep isl_union_map *umap,
4052                 enum isl_dim_type type, unsigned first, unsigned n);
4054         #include <isl/aff.h>
4055         isl_bool isl_aff_involves_dims(__isl_keep isl_aff *aff,
4056                 enum isl_dim_type type, unsigned first, unsigned n);
4057         isl_bool isl_pw_aff_involves_dims(
4058                 __isl_keep isl_pw_aff *pwaff,
4059                 enum isl_dim_type type, unsigned first, unsigned n);
4060         isl_bool isl_multi_aff_involves_dims(
4061                 __isl_keep isl_multi_aff *ma,
4062                 enum isl_dim_type type, unsigned first, unsigned n);
4063         isl_bool isl_pw_multi_aff_involves_dims(
4064                 __isl_keep isl_pw_multi_aff *pma,
4065                 enum isl_dim_type type, unsigned first, unsigned n);
4066         isl_bool isl_multi_pw_aff_involves_dims(
4067                 __isl_keep isl_multi_pw_aff *mpa,
4068                 enum isl_dim_type type, unsigned first, unsigned n);
4070         #include <isl/polynomial.h>
4071         isl_bool isl_qpolynomial_involves_dims(
4072                 __isl_keep isl_qpolynomial *qp,
4073                 enum isl_dim_type type, unsigned first, unsigned n);
4075 Similarly, the following functions can be used to check whether
4076 a given dimension is involved in any lower or upper bound.
4078         #include <isl/set.h>
4079         isl_bool isl_set_dim_has_any_lower_bound(
4080                 __isl_keep isl_set *set,
4081                 enum isl_dim_type type, unsigned pos);
4082         isl_bool isl_set_dim_has_any_upper_bound(
4083                 __isl_keep isl_set *set,
4084                 enum isl_dim_type type, unsigned pos);
4086 Note that these functions return true even if there is a bound on
4087 the dimension on only some of the basic sets of C<set>.
4088 To check if they have a bound for all of the basic sets in C<set>,
4089 use the following functions instead.
4091         #include <isl/set.h>
4092         isl_bool isl_set_dim_has_lower_bound(
4093                 __isl_keep isl_set *set,
4094                 enum isl_dim_type type, unsigned pos);
4095         isl_bool isl_set_dim_has_upper_bound(
4096                 __isl_keep isl_set *set,
4097                 enum isl_dim_type type, unsigned pos);
4099 =item * Space
4101 To check whether a set is a parameter domain, use this function:
4103         isl_bool isl_set_is_params(__isl_keep isl_set *set);
4104         isl_bool isl_union_set_is_params(
4105                 __isl_keep isl_union_set *uset);
4107 =item * Wrapping
4109 The following functions check whether the space of the given
4110 (basic) set or relation domain and/or range is a wrapped relation.
4112         #include <isl/space.h>
4113         isl_bool isl_space_is_wrapping(
4114                 __isl_keep isl_space *space);
4115         isl_bool isl_space_domain_is_wrapping(
4116                 __isl_keep isl_space *space);
4117         isl_bool isl_space_range_is_wrapping(
4118                 __isl_keep isl_space *space);
4119         isl_bool isl_space_is_product(
4120                 __isl_keep isl_space *space);
4122         #include <isl/set.h>
4123         isl_bool isl_basic_set_is_wrapping(
4124                 __isl_keep isl_basic_set *bset);
4125         isl_bool isl_set_is_wrapping(__isl_keep isl_set *set);
4127         #include <isl/map.h>
4128         isl_bool isl_map_domain_is_wrapping(
4129                 __isl_keep isl_map *map);
4130         isl_bool isl_map_range_is_wrapping(
4131                 __isl_keep isl_map *map);
4132         isl_bool isl_map_is_product(__isl_keep isl_map *map);
4134         #include <isl/val.h>
4135         isl_bool isl_multi_val_range_is_wrapping(
4136                 __isl_keep isl_multi_val *mv);
4138         #include <isl/aff.h>
4139         isl_bool isl_multi_aff_range_is_wrapping(
4140                 __isl_keep isl_multi_aff *ma);
4141         isl_bool isl_multi_pw_aff_range_is_wrapping(
4142                 __isl_keep isl_multi_pw_aff *mpa);
4143         isl_bool isl_multi_union_pw_aff_range_is_wrapping(
4144                 __isl_keep isl_multi_union_pw_aff *mupa);
4146 The input to C<isl_space_is_wrapping> should
4147 be the space of a set, while that of
4148 C<isl_space_domain_is_wrapping> and
4149 C<isl_space_range_is_wrapping> should be the space of a relation.
4150 The input to C<isl_space_is_product> can be either the space
4151 of a set or that of a binary relation.
4152 In case the input is the space of a binary relation, it checks
4153 whether both domain and range are wrapping.
4155 =item * Internal Product
4157         isl_bool isl_basic_map_can_zip(
4158                 __isl_keep isl_basic_map *bmap);
4159         isl_bool isl_map_can_zip(__isl_keep isl_map *map);
4161 Check whether the product of domain and range of the given relation
4162 can be computed,
4163 i.e., whether both domain and range are nested relations.
4165 =item * Currying
4167         #include <isl/space.h>
4168         isl_bool isl_space_can_curry(
4169                 __isl_keep isl_space *space);
4171         #include <isl/map.h>
4172         isl_bool isl_basic_map_can_curry(
4173                 __isl_keep isl_basic_map *bmap);
4174         isl_bool isl_map_can_curry(__isl_keep isl_map *map);
4176 Check whether the domain of the (basic) relation is a wrapped relation.
4178         #include <isl/space.h>
4179         __isl_give isl_space *isl_space_uncurry(
4180                 __isl_take isl_space *space);
4182         #include <isl/map.h>
4183         isl_bool isl_basic_map_can_uncurry(
4184                 __isl_keep isl_basic_map *bmap);
4185         isl_bool isl_map_can_uncurry(__isl_keep isl_map *map);
4187 Check whether the range of the (basic) relation is a wrapped relation.
4189         #include <isl/space.h>
4190         isl_bool isl_space_can_range_curry(
4191                 __isl_keep isl_space *space);
4193         #include <isl/map.h>
4194         isl_bool isl_map_can_range_curry(
4195                 __isl_keep isl_map *map);
4197 Check whether the domain of the relation wrapped in the range of
4198 the input is itself a wrapped relation.
4200 =item * Special Values
4202         #include <isl/aff.h>
4203         isl_bool isl_aff_is_cst(__isl_keep isl_aff *aff);
4204         isl_bool isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
4205         isl_bool isl_multi_pw_aff_is_cst(
4206                 __isl_keep isl_multi_pw_aff *mpa);
4208 Check whether the given expression is a constant.
4210         #include <isl/val.h>
4211         isl_bool isl_multi_val_involves_nan(
4212                 __isl_keep isl_multi_val *mv);
4214         #include <isl/aff.h>
4215         isl_bool isl_aff_is_nan(__isl_keep isl_aff *aff);
4216         isl_bool isl_multi_aff_involves_nan(
4217                 __isl_keep isl_multi_aff *ma);
4218         isl_bool isl_pw_aff_involves_nan(
4219                 __isl_keep isl_pw_aff *pa);
4220         isl_bool isl_pw_multi_aff_involves_nan(
4221                 __isl_keep isl_pw_multi_aff *pma);
4222         isl_bool isl_multi_pw_aff_involves_nan(
4223                 __isl_keep isl_multi_pw_aff *mpa);
4224         isl_bool isl_union_pw_aff_involves_nan(
4225                 __isl_keep isl_union_pw_aff *upa);
4226         isl_bool isl_union_pw_multi_aff_involves_nan(
4227                 __isl_keep isl_union_pw_multi_aff *upma);
4228         isl_bool isl_multi_union_pw_aff_involves_nan(
4229                 __isl_keep isl_multi_union_pw_aff *mupa);
4231         #include <isl/polynomial.h>
4232         isl_bool isl_qpolynomial_is_nan(
4233                 __isl_keep isl_qpolynomial *qp);
4234         isl_bool isl_qpolynomial_fold_is_nan(
4235                 __isl_keep isl_qpolynomial_fold *fold);
4236         isl_bool isl_pw_qpolynomial_involves_nan(
4237                 __isl_keep isl_pw_qpolynomial *pwqp);
4238         isl_bool isl_pw_qpolynomial_fold_involves_nan(
4239                 __isl_keep isl_pw_qpolynomial_fold *pwf);
4240         isl_bool isl_union_pw_qpolynomial_involves_nan(
4241                 __isl_keep isl_union_pw_qpolynomial *upwqp);
4242         isl_bool isl_union_pw_qpolynomial_fold_involves_nan(
4243                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
4245 Check whether the given expression is equal to or involves NaN.
4247         #include <isl/aff.h>
4248         isl_bool isl_aff_plain_is_zero(
4249                 __isl_keep isl_aff *aff);
4251 Check whether the affine expression is obviously zero.
4253 =back
4255 =head3 Binary Properties
4257 =over
4259 =item * Equality
4261 The following functions check whether two objects
4262 represent the same set, relation or function.
4263 The C<plain> variants only return true if the objects
4264 are obviously the same.  That is, they may return false
4265 even if the objects are the same, but they will never
4266 return true if the objects are not the same.
4268         #include <isl/set.h>
4269         isl_bool isl_basic_set_plain_is_equal(
4270                 __isl_keep isl_basic_set *bset1,
4271                 __isl_keep isl_basic_set *bset2);
4272         isl_bool isl_basic_set_is_equal(
4273                 __isl_keep isl_basic_set *bset1,
4274                 __isl_keep isl_basic_set *bset2);
4275         isl_bool isl_set_plain_is_equal(
4276                 __isl_keep isl_set *set1,
4277                 __isl_keep isl_set *set2);
4278         isl_bool isl_set_is_equal(__isl_keep isl_set *set1,
4279                 __isl_keep isl_set *set2);
4281         #include <isl/map.h>
4282         isl_bool isl_basic_map_is_equal(
4283                 __isl_keep isl_basic_map *bmap1,
4284                 __isl_keep isl_basic_map *bmap2);
4285         isl_bool isl_map_is_equal(__isl_keep isl_map *map1,
4286                 __isl_keep isl_map *map2);
4287         isl_bool isl_map_plain_is_equal(
4288                 __isl_keep isl_map *map1,
4289                 __isl_keep isl_map *map2);
4291         #include <isl/union_set.h>
4292         isl_bool isl_union_set_is_equal(
4293                 __isl_keep isl_union_set *uset1,
4294                 __isl_keep isl_union_set *uset2);
4296         #include <isl/union_map.h>
4297         isl_bool isl_union_map_is_equal(
4298                 __isl_keep isl_union_map *umap1,
4299                 __isl_keep isl_union_map *umap2);
4301         #include <isl/aff.h>
4302         isl_bool isl_aff_plain_is_equal(
4303                 __isl_keep isl_aff *aff1,
4304                 __isl_keep isl_aff *aff2);
4305         isl_bool isl_multi_aff_plain_is_equal(
4306                 __isl_keep isl_multi_aff *maff1,
4307                 __isl_keep isl_multi_aff *maff2);
4308         isl_bool isl_pw_aff_plain_is_equal(
4309                 __isl_keep isl_pw_aff *pwaff1,
4310                 __isl_keep isl_pw_aff *pwaff2);
4311         isl_bool isl_pw_aff_is_equal(
4312                 __isl_keep isl_pw_aff *pa1,
4313                 __isl_keep isl_pw_aff *pa2);
4314         isl_bool isl_pw_multi_aff_plain_is_equal(
4315                 __isl_keep isl_pw_multi_aff *pma1,
4316                 __isl_keep isl_pw_multi_aff *pma2);
4317         isl_bool isl_pw_multi_aff_is_equal(
4318                 __isl_keep isl_pw_multi_aff *pma1,
4319                 __isl_keep isl_pw_multi_aff *pma2);
4320         isl_bool isl_multi_pw_aff_plain_is_equal(
4321                 __isl_keep isl_multi_pw_aff *mpa1,
4322                 __isl_keep isl_multi_pw_aff *mpa2);
4323         isl_bool isl_multi_pw_aff_is_equal(
4324                 __isl_keep isl_multi_pw_aff *mpa1,
4325                 __isl_keep isl_multi_pw_aff *mpa2);
4326         isl_bool isl_union_pw_aff_plain_is_equal(
4327                 __isl_keep isl_union_pw_aff *upa1,
4328                 __isl_keep isl_union_pw_aff *upa2);
4329         isl_bool isl_union_pw_multi_aff_plain_is_equal(
4330                 __isl_keep isl_union_pw_multi_aff *upma1,
4331                 __isl_keep isl_union_pw_multi_aff *upma2);
4332         isl_bool isl_multi_union_pw_aff_plain_is_equal(
4333                 __isl_keep isl_multi_union_pw_aff *mupa1,
4334                 __isl_keep isl_multi_union_pw_aff *mupa2);
4336         #include <isl/polynomial.h>
4337         isl_bool isl_union_pw_qpolynomial_plain_is_equal(
4338                 __isl_keep isl_union_pw_qpolynomial *upwqp1,
4339                 __isl_keep isl_union_pw_qpolynomial *upwqp2);
4340         isl_bool isl_union_pw_qpolynomial_fold_plain_is_equal(
4341                 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
4342                 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
4344 =item * Disjointness
4346         #include <isl/set.h>
4347         isl_bool isl_basic_set_is_disjoint(
4348                 __isl_keep isl_basic_set *bset1,
4349                 __isl_keep isl_basic_set *bset2);
4350         isl_bool isl_set_plain_is_disjoint(
4351                 __isl_keep isl_set *set1,
4352                 __isl_keep isl_set *set2);
4353         isl_bool isl_set_is_disjoint(__isl_keep isl_set *set1,
4354                 __isl_keep isl_set *set2);
4356         #include <isl/map.h>
4357         isl_bool isl_basic_map_is_disjoint(
4358                 __isl_keep isl_basic_map *bmap1,
4359                 __isl_keep isl_basic_map *bmap2);
4360         isl_bool isl_map_is_disjoint(__isl_keep isl_map *map1,
4361                 __isl_keep isl_map *map2);
4363         #include <isl/union_set.h>
4364         isl_bool isl_union_set_is_disjoint(
4365                 __isl_keep isl_union_set *uset1,
4366                 __isl_keep isl_union_set *uset2);
4368         #include <isl/union_map.h>
4369         isl_bool isl_union_map_is_disjoint(
4370                 __isl_keep isl_union_map *umap1,
4371                 __isl_keep isl_union_map *umap2);
4373 =item * Subset
4375         isl_bool isl_basic_set_is_subset(
4376                 __isl_keep isl_basic_set *bset1,
4377                 __isl_keep isl_basic_set *bset2);
4378         isl_bool isl_set_is_subset(__isl_keep isl_set *set1,
4379                 __isl_keep isl_set *set2);
4380         isl_bool isl_set_is_strict_subset(
4381                 __isl_keep isl_set *set1,
4382                 __isl_keep isl_set *set2);
4383         isl_bool isl_union_set_is_subset(
4384                 __isl_keep isl_union_set *uset1,
4385                 __isl_keep isl_union_set *uset2);
4386         isl_bool isl_union_set_is_strict_subset(
4387                 __isl_keep isl_union_set *uset1,
4388                 __isl_keep isl_union_set *uset2);
4389         isl_bool isl_basic_map_is_subset(
4390                 __isl_keep isl_basic_map *bmap1,
4391                 __isl_keep isl_basic_map *bmap2);
4392         isl_bool isl_basic_map_is_strict_subset(
4393                 __isl_keep isl_basic_map *bmap1,
4394                 __isl_keep isl_basic_map *bmap2);
4395         isl_bool isl_map_is_subset(
4396                 __isl_keep isl_map *map1,
4397                 __isl_keep isl_map *map2);
4398         isl_bool isl_map_is_strict_subset(
4399                 __isl_keep isl_map *map1,
4400                 __isl_keep isl_map *map2);
4401         isl_bool isl_union_map_is_subset(
4402                 __isl_keep isl_union_map *umap1,
4403                 __isl_keep isl_union_map *umap2);
4404         isl_bool isl_union_map_is_strict_subset(
4405                 __isl_keep isl_union_map *umap1,
4406                 __isl_keep isl_union_map *umap2);
4408 Check whether the first argument is a (strict) subset of the
4409 second argument.
4411 =item * Order
4413 Every comparison function returns a negative value if the first
4414 argument is considered smaller than the second, a positive value
4415 if the first argument is considered greater and zero if the two
4416 constraints are considered the same by the comparison criterion.
4418         #include <isl/constraint.h>
4419         int isl_constraint_plain_cmp(
4420                 __isl_keep isl_constraint *c1,
4421                 __isl_keep isl_constraint *c2);
4423 This function is useful for sorting C<isl_constraint>s.
4424 The order depends on the internal representation of the inputs.
4425 The order is fixed over different calls to the function (assuming
4426 the internal representation of the inputs has not changed), but may
4427 change over different versions of C<isl>.
4429         #include <isl/constraint.h>
4430         int isl_constraint_cmp_last_non_zero(
4431                 __isl_keep isl_constraint *c1,
4432                 __isl_keep isl_constraint *c2);
4434 This function can be used to sort constraints that live in the same
4435 local space.  Constraints that involve ``earlier'' dimensions or
4436 that have a smaller coefficient for the shared latest dimension
4437 are considered smaller than other constraints.
4438 This function only defines a B<partial> order.
4440         #include <isl/set.h>
4441         int isl_set_plain_cmp(__isl_keep isl_set *set1,
4442                 __isl_keep isl_set *set2);
4444 This function is useful for sorting C<isl_set>s.
4445 The order depends on the internal representation of the inputs.
4446 The order is fixed over different calls to the function (assuming
4447 the internal representation of the inputs has not changed), but may
4448 change over different versions of C<isl>.
4450         #include <isl/aff.h>
4451         int isl_multi_aff_plain_cmp(
4452                 __isl_keep isl_multi_aff *ma1,
4453                 __isl_keep isl_multi_aff *ma2);
4454         int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
4455                 __isl_keep isl_pw_aff *pa2);
4457 The functions C<isl_multi_aff_plain_cmp> and
4458 C<isl_pw_aff_plain_cmp> can be used to sort C<isl_multi_aff>s and
4459 C<isl_pw_aff>s.  The order is not strictly defined.
4460 The current order sorts expressions that only involve
4461 earlier dimensions before those that involve later dimensions.
4463 =back
4465 =head2 Unary Operations
4467 =over
4469 =item * Complement
4471         __isl_give isl_set *isl_set_complement(
4472                 __isl_take isl_set *set);
4473         __isl_give isl_map *isl_map_complement(
4474                 __isl_take isl_map *map);
4476 =item * Inverse map
4478         #include <isl/space.h>
4479         __isl_give isl_space *isl_space_reverse(
4480                 __isl_take isl_space *space);
4482         #include <isl/map.h>
4483         __isl_give isl_basic_map *isl_basic_map_reverse(
4484                 __isl_take isl_basic_map *bmap);
4485         __isl_give isl_map *isl_map_reverse(
4486                 __isl_take isl_map *map);
4488         #include <isl/union_map.h>
4489         __isl_give isl_union_map *isl_union_map_reverse(
4490                 __isl_take isl_union_map *umap);
4492 =item * Projection
4494         #include <isl/space.h>
4495         __isl_give isl_space *isl_space_domain(
4496                 __isl_take isl_space *space);
4497         __isl_give isl_space *isl_space_range(
4498                 __isl_take isl_space *space);
4499         __isl_give isl_space *isl_space_params(
4500                 __isl_take isl_space *space);
4502         #include <isl/local_space.h>
4503         __isl_give isl_local_space *isl_local_space_domain(
4504                 __isl_take isl_local_space *ls);
4505         __isl_give isl_local_space *isl_local_space_range(
4506                 __isl_take isl_local_space *ls);
4508         #include <isl/set.h>
4509         __isl_give isl_basic_set *isl_basic_set_project_out(
4510                 __isl_take isl_basic_set *bset,
4511                 enum isl_dim_type type, unsigned first, unsigned n);
4512         __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
4513                 enum isl_dim_type type, unsigned first, unsigned n);
4514         __isl_give isl_map *isl_set_project_onto_map(
4515                 __isl_take isl_set *set,
4516                 enum isl_dim_type type, unsigned first,
4517                 unsigned n);
4518         __isl_give isl_basic_set *isl_basic_set_params(
4519                 __isl_take isl_basic_set *bset);
4520         __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
4522 The function C<isl_set_project_onto_map> returns a relation
4523 that projects the input set onto the given set dimensions.
4525         #include <isl/map.h>
4526         __isl_give isl_basic_map *isl_basic_map_project_out(
4527                 __isl_take isl_basic_map *bmap,
4528                 enum isl_dim_type type, unsigned first, unsigned n);
4529         __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
4530                 enum isl_dim_type type, unsigned first, unsigned n);
4531         __isl_give isl_basic_set *isl_basic_map_domain(
4532                 __isl_take isl_basic_map *bmap);
4533         __isl_give isl_basic_set *isl_basic_map_range(
4534                 __isl_take isl_basic_map *bmap);
4535         __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
4536         __isl_give isl_set *isl_map_domain(
4537                 __isl_take isl_map *bmap);
4538         __isl_give isl_set *isl_map_range(
4539                 __isl_take isl_map *map);
4541         #include <isl/union_set.h>
4542         __isl_give isl_union_set *isl_union_set_project_out(
4543                 __isl_take isl_union_set *uset,
4544                 enum isl_dim_type type,
4545                 unsigned first, unsigned n);
4546         __isl_give isl_set *isl_union_set_params(
4547                 __isl_take isl_union_set *uset);
4549 The function C<isl_union_set_project_out> can only project out
4550 parameters.
4552         #include <isl/union_map.h>
4553         __isl_give isl_union_map *isl_union_map_project_out(
4554                 __isl_take isl_union_map *umap,
4555                 enum isl_dim_type type, unsigned first, unsigned n);
4556         __isl_give isl_union_map *
4557         isl_union_map_project_out_all_params(
4558                 __isl_take isl_union_map *umap);
4559         __isl_give isl_set *isl_union_map_params(
4560                 __isl_take isl_union_map *umap);
4561         __isl_give isl_union_set *isl_union_map_domain(
4562                 __isl_take isl_union_map *umap);
4563         __isl_give isl_union_set *isl_union_map_range(
4564                 __isl_take isl_union_map *umap);
4566 The function C<isl_union_map_project_out> can only project out
4567 parameters.
4569         #include <isl/aff.h>
4570         __isl_give isl_aff *isl_aff_project_domain_on_params(
4571                 __isl_take isl_aff *aff);
4572         __isl_give isl_multi_aff *
4573         isl_multi_aff_project_domain_on_params(
4574                 __isl_take isl_multi_aff *ma);
4575         __isl_give isl_pw_aff *
4576         isl_pw_aff_project_domain_on_params(
4577                 __isl_take isl_pw_aff *pa);
4578         __isl_give isl_multi_pw_aff *
4579         isl_multi_pw_aff_project_domain_on_params(
4580                 __isl_take isl_multi_pw_aff *mpa);
4581         __isl_give isl_pw_multi_aff *
4582         isl_pw_multi_aff_project_domain_on_params(
4583                 __isl_take isl_pw_multi_aff *pma);
4584         __isl_give isl_set *isl_pw_aff_domain(
4585                 __isl_take isl_pw_aff *pwaff);
4586         __isl_give isl_set *isl_pw_multi_aff_domain(
4587                 __isl_take isl_pw_multi_aff *pma);
4588         __isl_give isl_set *isl_multi_pw_aff_domain(
4589                 __isl_take isl_multi_pw_aff *mpa);
4590         __isl_give isl_union_set *isl_union_pw_aff_domain(
4591                 __isl_take isl_union_pw_aff *upa);
4592         __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
4593                 __isl_take isl_union_pw_multi_aff *upma);
4594         __isl_give isl_union_set *
4595         isl_multi_union_pw_aff_domain(
4596                 __isl_take isl_multi_union_pw_aff *mupa);
4597         __isl_give isl_set *isl_pw_aff_params(
4598                 __isl_take isl_pw_aff *pwa);
4600 If no explicit domain was set on a zero-dimensional input to
4601 C<isl_multi_union_pw_aff_domain>, then this function will
4602 return a parameter set.
4604         #include <isl/polynomial.h>
4605         __isl_give isl_qpolynomial *
4606         isl_qpolynomial_project_domain_on_params(
4607                 __isl_take isl_qpolynomial *qp);
4608         __isl_give isl_pw_qpolynomial *
4609         isl_pw_qpolynomial_project_domain_on_params(
4610                 __isl_take isl_pw_qpolynomial *pwqp);
4611         __isl_give isl_pw_qpolynomial_fold *
4612         isl_pw_qpolynomial_fold_project_domain_on_params(
4613                 __isl_take isl_pw_qpolynomial_fold *pwf);
4614         __isl_give isl_set *isl_pw_qpolynomial_domain(
4615                 __isl_take isl_pw_qpolynomial *pwqp);
4616         __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
4617                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4618         __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
4619                 __isl_take isl_union_pw_qpolynomial *upwqp);
4621         #include <isl/space.h>
4622         __isl_give isl_space *isl_space_domain_map(
4623                 __isl_take isl_space *space);
4624         __isl_give isl_space *isl_space_range_map(
4625                 __isl_take isl_space *space);
4627         #include <isl/map.h>
4628         __isl_give isl_map *isl_set_wrapped_domain_map(
4629                 __isl_take isl_set *set);
4630         __isl_give isl_basic_map *isl_basic_map_domain_map(
4631                 __isl_take isl_basic_map *bmap);
4632         __isl_give isl_basic_map *isl_basic_map_range_map(
4633                 __isl_take isl_basic_map *bmap);
4634         __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
4635         __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
4637         #include <isl/union_map.h>
4638         __isl_give isl_union_map *isl_union_map_domain_map(
4639                 __isl_take isl_union_map *umap);
4640         __isl_give isl_union_pw_multi_aff *
4641         isl_union_map_domain_map_union_pw_multi_aff(
4642                 __isl_take isl_union_map *umap);
4643         __isl_give isl_union_map *isl_union_map_range_map(
4644                 __isl_take isl_union_map *umap);
4645         __isl_give isl_union_map *
4646         isl_union_set_wrapped_domain_map(
4647                 __isl_take isl_union_set *uset);
4649 The functions above construct a (basic, regular or union) relation
4650 that maps (a wrapped version of) the input relation to its domain or range.
4651 C<isl_set_wrapped_domain_map> maps the input set to the domain
4652 of its wrapped relation.
4654 =item * Elimination
4656         __isl_give isl_basic_set *isl_basic_set_eliminate(
4657                 __isl_take isl_basic_set *bset,
4658                 enum isl_dim_type type,
4659                 unsigned first, unsigned n);
4660         __isl_give isl_set *isl_set_eliminate(
4661                 __isl_take isl_set *set, enum isl_dim_type type,
4662                 unsigned first, unsigned n);
4663         __isl_give isl_basic_map *isl_basic_map_eliminate(
4664                 __isl_take isl_basic_map *bmap,
4665                 enum isl_dim_type type,
4666                 unsigned first, unsigned n);
4667         __isl_give isl_map *isl_map_eliminate(
4668                 __isl_take isl_map *map, enum isl_dim_type type,
4669                 unsigned first, unsigned n);
4671 Eliminate the coefficients for the given dimensions from the constraints,
4672 without removing the dimensions.
4674 =item * Constructing a set from a parameter domain
4676 A zero-dimensional (local) space or (basic) set can be constructed
4677 on a given parameter domain using the following functions.
4679         #include <isl/space.h>
4680         __isl_give isl_space *isl_space_set_from_params(
4681                 __isl_take isl_space *space);
4683         #include <isl/local_space.h>
4684         __isl_give isl_local_space *
4685         isl_local_space_set_from_params(
4686                 __isl_take isl_local_space *ls);
4688         #include <isl/set.h>
4689         __isl_give isl_basic_set *isl_basic_set_from_params(
4690                 __isl_take isl_basic_set *bset);
4691         __isl_give isl_set *isl_set_from_params(
4692                 __isl_take isl_set *set);
4694 =item * Constructing a relation from one or two sets
4696 Create a relation with the given set(s) as domain and/or range.
4697 If only the domain or the range is specified, then
4698 the range or domain of the created relation is a zero-dimensional
4699 flat anonymous space.
4701         #include <isl/space.h>
4702         __isl_give isl_space *isl_space_from_domain(
4703                 __isl_take isl_space *space);
4704         __isl_give isl_space *isl_space_from_range(
4705                 __isl_take isl_space *space);
4706         __isl_give isl_space *isl_space_map_from_set(
4707                 __isl_take isl_space *space);
4708         __isl_give isl_space *isl_space_map_from_domain_and_range(
4709                 __isl_take isl_space *domain,
4710                 __isl_take isl_space *range);
4712         #include <isl/local_space.h>
4713         __isl_give isl_local_space *isl_local_space_from_domain(
4714                 __isl_take isl_local_space *ls);
4716         #include <isl/map.h>
4717         __isl_give isl_map *isl_map_from_domain(
4718                 __isl_take isl_set *set);
4719         __isl_give isl_map *isl_map_from_range(
4720                 __isl_take isl_set *set);
4722         #include <isl/union_map.h>
4723         __isl_give isl_union_map *isl_union_map_from_domain(
4724                 __isl_take isl_union_set *uset);
4725         __isl_give isl_union_map *isl_union_map_from_range(
4726                 __isl_take isl_union_set *uset);
4727         __isl_give isl_union_map *
4728         isl_union_map_from_domain_and_range(
4729                 __isl_take isl_union_set *domain,
4730                 __isl_take isl_union_set *range);
4732         #include <isl/val.h>
4733         __isl_give isl_multi_val *isl_multi_val_from_range(
4734                 __isl_take isl_multi_val *mv);
4736         #include <isl/aff.h>
4737         __isl_give isl_aff *isl_aff_from_range(
4738                 __isl_take isl_aff *aff);
4739         __isl_give isl_multi_aff *isl_multi_aff_from_range(
4740                 __isl_take isl_multi_aff *ma);
4741         __isl_give isl_pw_aff *isl_pw_aff_from_range(
4742                 __isl_take isl_pw_aff *pwa);
4743         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
4744                 __isl_take isl_multi_pw_aff *mpa);
4745         __isl_give isl_multi_union_pw_aff *
4746         isl_multi_union_pw_aff_from_range(
4747                 __isl_take isl_multi_union_pw_aff *mupa);
4748         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
4749                 __isl_take isl_set *set);
4750         __isl_give isl_union_pw_multi_aff *
4751         isl_union_pw_multi_aff_from_domain(
4752                 __isl_take isl_union_set *uset);
4754         #include <isl/polynomial.h>
4755         __isl_give isl_pw_qpolynomial *
4756         isl_pw_qpolynomial_from_range(
4757                 __isl_take isl_pw_qpolynomial *pwqp);
4758         __isl_give isl_pw_qpolynomial_fold *
4759         isl_pw_qpolynomial_fold_from_range(
4760                 __isl_take isl_pw_qpolynomial_fold *pwf);
4762 =item * Slicing
4764         #include <isl/set.h>
4765         __isl_give isl_basic_set *isl_basic_set_fix_si(
4766                 __isl_take isl_basic_set *bset,
4767                 enum isl_dim_type type, unsigned pos, int value);
4768         __isl_give isl_basic_set *isl_basic_set_fix_val(
4769                 __isl_take isl_basic_set *bset,
4770                 enum isl_dim_type type, unsigned pos,
4771                 __isl_take isl_val *v);
4772         __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
4773                 enum isl_dim_type type, unsigned pos, int value);
4774         __isl_give isl_set *isl_set_fix_val(
4775                 __isl_take isl_set *set,
4776                 enum isl_dim_type type, unsigned pos,
4777                 __isl_take isl_val *v);
4779         #include <isl/map.h>
4780         __isl_give isl_basic_map *isl_basic_map_fix_si(
4781                 __isl_take isl_basic_map *bmap,
4782                 enum isl_dim_type type, unsigned pos, int value);
4783         __isl_give isl_basic_map *isl_basic_map_fix_val(
4784                 __isl_take isl_basic_map *bmap,
4785                 enum isl_dim_type type, unsigned pos,
4786                 __isl_take isl_val *v);
4787         __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
4788                 enum isl_dim_type type, unsigned pos, int value);
4789         __isl_give isl_map *isl_map_fix_val(
4790                 __isl_take isl_map *map,
4791                 enum isl_dim_type type, unsigned pos,
4792                 __isl_take isl_val *v);
4794         #include <isl/aff.h>
4795         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
4796                 __isl_take isl_pw_multi_aff *pma,
4797                 enum isl_dim_type type, unsigned pos, int value);
4799         #include <isl/polynomial.h>
4800         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
4801                 __isl_take isl_pw_qpolynomial *pwqp,
4802                 enum isl_dim_type type, unsigned n,
4803                 __isl_take isl_val *v);
4804         __isl_give isl_pw_qpolynomial_fold *
4805         isl_pw_qpolynomial_fold_fix_val(
4806                 __isl_take isl_pw_qpolynomial_fold *pwf,
4807                 enum isl_dim_type type, unsigned n,
4808                 __isl_take isl_val *v);
4810 Intersect the set, relation or function domain
4811 with the hyperplane where the given
4812 dimension has the fixed given value.
4814         #include <isl/set.h>
4815         __isl_give isl_basic_set *
4816         isl_basic_set_lower_bound_val(
4817                 __isl_take isl_basic_set *bset,
4818                 enum isl_dim_type type, unsigned pos,
4819                 __isl_take isl_val *value);
4820         __isl_give isl_basic_set *
4821         isl_basic_set_upper_bound_val(
4822                 __isl_take isl_basic_set *bset,
4823                 enum isl_dim_type type, unsigned pos,
4824                 __isl_take isl_val *value);
4825         __isl_give isl_set *isl_set_lower_bound_si(
4826                 __isl_take isl_set *set,
4827                 enum isl_dim_type type, unsigned pos, int value);
4828         __isl_give isl_set *isl_set_lower_bound_val(
4829                 __isl_take isl_set *set,
4830                 enum isl_dim_type type, unsigned pos,
4831                 __isl_take isl_val *value);
4832         __isl_give isl_set *isl_set_upper_bound_si(
4833                 __isl_take isl_set *set,
4834                 enum isl_dim_type type, unsigned pos, int value);
4835         __isl_give isl_set *isl_set_upper_bound_val(
4836                 __isl_take isl_set *set,
4837                 enum isl_dim_type type, unsigned pos,
4838                 __isl_take isl_val *value);
4840         #include <isl/map.h>
4841         __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
4842                 __isl_take isl_basic_map *bmap,
4843                 enum isl_dim_type type, unsigned pos, int value);
4844         __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
4845                 __isl_take isl_basic_map *bmap,
4846                 enum isl_dim_type type, unsigned pos, int value);
4847         __isl_give isl_map *isl_map_lower_bound_si(
4848                 __isl_take isl_map *map,
4849                 enum isl_dim_type type, unsigned pos, int value);
4850         __isl_give isl_map *isl_map_upper_bound_si(
4851                 __isl_take isl_map *map,
4852                 enum isl_dim_type type, unsigned pos, int value);
4854 Intersect the set or relation with the half-space where the given
4855 dimension has a value bounded by the fixed given integer value.
4857         __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
4858                 enum isl_dim_type type1, int pos1,
4859                 enum isl_dim_type type2, int pos2);
4860         __isl_give isl_basic_map *isl_basic_map_equate(
4861                 __isl_take isl_basic_map *bmap,
4862                 enum isl_dim_type type1, int pos1,
4863                 enum isl_dim_type type2, int pos2);
4864         __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
4865                 enum isl_dim_type type1, int pos1,
4866                 enum isl_dim_type type2, int pos2);
4868 Intersect the set or relation with the hyperplane where the given
4869 dimensions are equal to each other.
4871         __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4872                 enum isl_dim_type type1, int pos1,
4873                 enum isl_dim_type type2, int pos2);
4875 Intersect the relation with the hyperplane where the given
4876 dimensions have opposite values.
4878         __isl_give isl_map *isl_map_order_le(
4879                 __isl_take isl_map *map,
4880                 enum isl_dim_type type1, int pos1,
4881                 enum isl_dim_type type2, int pos2);
4882         __isl_give isl_basic_map *isl_basic_map_order_ge(
4883                 __isl_take isl_basic_map *bmap,
4884                 enum isl_dim_type type1, int pos1,
4885                 enum isl_dim_type type2, int pos2);
4886         __isl_give isl_map *isl_map_order_ge(
4887                 __isl_take isl_map *map,
4888                 enum isl_dim_type type1, int pos1,
4889                 enum isl_dim_type type2, int pos2);
4890         __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4891                 enum isl_dim_type type1, int pos1,
4892                 enum isl_dim_type type2, int pos2);
4893         __isl_give isl_basic_map *isl_basic_map_order_gt(
4894                 __isl_take isl_basic_map *bmap,
4895                 enum isl_dim_type type1, int pos1,
4896                 enum isl_dim_type type2, int pos2);
4897         __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4898                 enum isl_dim_type type1, int pos1,
4899                 enum isl_dim_type type2, int pos2);
4901 Intersect the relation with the half-space where the given
4902 dimensions satisfy the given ordering.
4904         #include <isl/union_set.h>
4905         __isl_give isl_union_map *isl_union_map_remove_map_if(
4906                 __isl_take isl_union_map *umap,
4907                 isl_bool (*fn)(__isl_keep isl_map *map,
4908                         void *user), void *user);
4910 This function calls the callback function once for each
4911 pair of spaces for which there are elements in the input.
4912 If the callback returns C<isl_bool_true>, then all those elements
4913 are removed from the result.  The only remaining elements in the output
4914 are then those for which the callback returns C<isl_bool_false>.
4916 =item * Locus
4918         #include <isl/aff.h>
4919         __isl_give isl_basic_set *isl_aff_zero_basic_set(
4920                 __isl_take isl_aff *aff);
4921         __isl_give isl_basic_set *isl_aff_neg_basic_set(
4922                 __isl_take isl_aff *aff);
4923         __isl_give isl_set *isl_pw_aff_pos_set(
4924                 __isl_take isl_pw_aff *pa);
4925         __isl_give isl_set *isl_pw_aff_nonneg_set(
4926                 __isl_take isl_pw_aff *pwaff);
4927         __isl_give isl_set *isl_pw_aff_zero_set(
4928                 __isl_take isl_pw_aff *pwaff);
4929         __isl_give isl_set *isl_pw_aff_non_zero_set(
4930                 __isl_take isl_pw_aff *pwaff);
4931         __isl_give isl_union_set *
4932         isl_union_pw_aff_zero_union_set(
4933                 __isl_take isl_union_pw_aff *upa);
4934         __isl_give isl_union_set *
4935         isl_multi_union_pw_aff_zero_union_set(
4936                 __isl_take isl_multi_union_pw_aff *mupa);
4938 The function C<isl_aff_neg_basic_set> returns a basic set
4939 containing those elements in the domain space
4940 of C<aff> where C<aff> is negative.
4941 The function C<isl_pw_aff_nonneg_set> returns a set
4942 containing those elements in the domain
4943 of C<pwaff> where C<pwaff> is non-negative.
4944 The function C<isl_multi_union_pw_aff_zero_union_set>
4945 returns a union set containing those elements
4946 in the domains of its elements where they are all zero.
4948 =item * Identity
4950         __isl_give isl_map *isl_set_identity(
4951                 __isl_take isl_set *set);
4952         __isl_give isl_union_map *isl_union_set_identity(
4953                 __isl_take isl_union_set *uset);
4954         __isl_give isl_union_pw_multi_aff *
4955         isl_union_set_identity_union_pw_multi_aff(
4956                 __isl_take isl_union_set *uset);
4958 Construct an identity relation on the given (union) set.
4960 =item * Function Extraction
4962 A piecewise quasi affine expression that is equal to 1 on a set
4963 and 0 outside the set can be created using the following function.
4965         #include <isl/aff.h>
4966         __isl_give isl_pw_aff *isl_set_indicator_function(
4967                 __isl_take isl_set *set);
4969 A piecewise multiple quasi affine expression can be extracted
4970 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4971 and the C<isl_map> is single-valued.
4972 In case of a conversion from an C<isl_union_map>
4973 to an C<isl_union_pw_multi_aff>, these properties need to hold
4974 in each domain space.
4975 A conversion to a C<isl_multi_union_pw_aff> additionally
4976 requires that the input is non-empty and involves only a single
4977 range space.
4979         #include <isl/aff.h>
4980         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4981                 __isl_take isl_set *set);
4982         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4983                 __isl_take isl_map *map);
4985         __isl_give isl_union_pw_multi_aff *
4986         isl_union_pw_multi_aff_from_union_set(
4987                 __isl_take isl_union_set *uset);
4988         __isl_give isl_union_pw_multi_aff *
4989         isl_union_pw_multi_aff_from_union_map(
4990                 __isl_take isl_union_map *umap);
4992         __isl_give isl_multi_union_pw_aff *
4993         isl_multi_union_pw_aff_from_union_map(
4994                 __isl_take isl_union_map *umap);
4996 =item * Deltas
4998         __isl_give isl_basic_set *isl_basic_map_deltas(
4999                 __isl_take isl_basic_map *bmap);
5000         __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
5001         __isl_give isl_union_set *isl_union_map_deltas(
5002                 __isl_take isl_union_map *umap);
5004 These functions return a (basic) set containing the differences
5005 between image elements and corresponding domain elements in the input.
5007         __isl_give isl_basic_map *isl_basic_map_deltas_map(
5008                 __isl_take isl_basic_map *bmap);
5009         __isl_give isl_map *isl_map_deltas_map(
5010                 __isl_take isl_map *map);
5011         __isl_give isl_union_map *isl_union_map_deltas_map(
5012                 __isl_take isl_union_map *umap);
5014 The functions above construct a (basic, regular or union) relation
5015 that maps (a wrapped version of) the input relation to its delta set.
5017 =item * Coalescing
5019 Simplify the representation of a set, relation or functions by trying
5020 to combine pairs of basic sets or relations into a single
5021 basic set or relation.
5023         #include <isl/set.h>
5024         __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
5026         #include <isl/map.h>
5027         __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
5029         #include <isl/union_set.h>
5030         __isl_give isl_union_set *isl_union_set_coalesce(
5031                 __isl_take isl_union_set *uset);
5033         #include <isl/union_map.h>
5034         __isl_give isl_union_map *isl_union_map_coalesce(
5035                 __isl_take isl_union_map *umap);
5037         #include <isl/aff.h>
5038         __isl_give isl_pw_aff *isl_pw_aff_coalesce(
5039                 __isl_take isl_pw_aff *pwqp);
5040         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
5041                 __isl_take isl_pw_multi_aff *pma);
5042         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
5043                 __isl_take isl_multi_pw_aff *mpa);
5044         __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
5045                 __isl_take isl_union_pw_aff *upa);
5046         __isl_give isl_union_pw_multi_aff *
5047         isl_union_pw_multi_aff_coalesce(
5048                 __isl_take isl_union_pw_multi_aff *upma);
5049         __isl_give isl_multi_union_pw_aff *
5050         isl_multi_union_pw_aff_coalesce(
5051                 __isl_take isl_multi_union_pw_aff *aff);
5053         #include <isl/polynomial.h>
5054         __isl_give isl_pw_qpolynomial_fold *
5055         isl_pw_qpolynomial_fold_coalesce(
5056                 __isl_take isl_pw_qpolynomial_fold *pwf);
5057         __isl_give isl_union_pw_qpolynomial *
5058         isl_union_pw_qpolynomial_coalesce(
5059                 __isl_take isl_union_pw_qpolynomial *upwqp);
5060         __isl_give isl_union_pw_qpolynomial_fold *
5061         isl_union_pw_qpolynomial_fold_coalesce(
5062                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
5064 One of the methods for combining pairs of basic sets or relations
5065 can result in coefficients that are much larger than those that appear
5066 in the constraints of the input.  By default, the coefficients are
5067 not allowed to grow larger, but this can be changed by unsetting
5068 the following option.
5070         isl_stat isl_options_set_coalesce_bounded_wrapping(
5071                 isl_ctx *ctx, int val);
5072         int isl_options_get_coalesce_bounded_wrapping(
5073                 isl_ctx *ctx);
5075 =item * Detecting equalities
5077         __isl_give isl_basic_set *isl_basic_set_detect_equalities(
5078                 __isl_take isl_basic_set *bset);
5079         __isl_give isl_basic_map *isl_basic_map_detect_equalities(
5080                 __isl_take isl_basic_map *bmap);
5081         __isl_give isl_set *isl_set_detect_equalities(
5082                 __isl_take isl_set *set);
5083         __isl_give isl_map *isl_map_detect_equalities(
5084                 __isl_take isl_map *map);
5085         __isl_give isl_union_set *isl_union_set_detect_equalities(
5086                 __isl_take isl_union_set *uset);
5087         __isl_give isl_union_map *isl_union_map_detect_equalities(
5088                 __isl_take isl_union_map *umap);
5090 Simplify the representation of a set or relation by detecting implicit
5091 equalities.
5093 =item * Removing redundant constraints
5095         #include <isl/set.h>
5096         __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
5097                 __isl_take isl_basic_set *bset);
5098         __isl_give isl_set *isl_set_remove_redundancies(
5099                 __isl_take isl_set *set);
5101         #include <isl/union_set.h>
5102         __isl_give isl_union_set *
5103         isl_union_set_remove_redundancies(
5104                 __isl_take isl_union_set *uset);
5106         #include <isl/map.h>
5107         __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
5108                 __isl_take isl_basic_map *bmap);
5109         __isl_give isl_map *isl_map_remove_redundancies(
5110                 __isl_take isl_map *map);
5112         #include <isl/union_map.h>
5113         __isl_give isl_union_map *
5114         isl_union_map_remove_redundancies(
5115                 __isl_take isl_union_map *umap);
5117 =item * Convex hull
5119         __isl_give isl_basic_set *isl_set_convex_hull(
5120                 __isl_take isl_set *set);
5121         __isl_give isl_basic_map *isl_map_convex_hull(
5122                 __isl_take isl_map *map);
5124 If the input set or relation has any existentially quantified
5125 variables, then the result of these operations is currently undefined.
5127 =item * Simple hull
5129         #include <isl/set.h>
5130         __isl_give isl_basic_set *
5131         isl_set_unshifted_simple_hull(
5132                 __isl_take isl_set *set);
5133         __isl_give isl_basic_set *isl_set_simple_hull(
5134                 __isl_take isl_set *set);
5135         __isl_give isl_basic_set *
5136         isl_set_plain_unshifted_simple_hull(
5137                 __isl_take isl_set *set);
5138         __isl_give isl_basic_set *
5139         isl_set_unshifted_simple_hull_from_set_list(
5140                 __isl_take isl_set *set,
5141                 __isl_take isl_set_list *list);
5143         #include <isl/map.h>
5144         __isl_give isl_basic_map *
5145         isl_map_unshifted_simple_hull(
5146                 __isl_take isl_map *map);
5147         __isl_give isl_basic_map *isl_map_simple_hull(
5148                 __isl_take isl_map *map);
5149         __isl_give isl_basic_map *
5150         isl_map_plain_unshifted_simple_hull(
5151                 __isl_take isl_map *map);
5152                 __isl_give isl_basic_map *
5153         isl_map_unshifted_simple_hull_from_map_list(
5154                 __isl_take isl_map *map,
5155                 __isl_take isl_map_list *list);
5157         #include <isl/union_map.h>
5158         __isl_give isl_union_map *isl_union_map_simple_hull(
5159                 __isl_take isl_union_map *umap);
5161 These functions compute a single basic set or relation
5162 that contains the whole input set or relation.
5163 In particular, the output is described by translates
5164 of the constraints describing the basic sets or relations in the input.
5165 In case of C<isl_set_unshifted_simple_hull>, only the original
5166 constraints are used, without any translation.
5167 In case of C<isl_set_plain_unshifted_simple_hull> and
5168 C<isl_map_plain_unshifted_simple_hull>, the result is described
5169 by original constraints that are obviously satisfied
5170 by the entire input set or relation.
5171 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
5172 C<isl_map_unshifted_simple_hull_from_map_list>, the
5173 constraints are taken from the elements of the second argument.
5175 =begin latex
5177 (See \autoref{s:simple hull}.)
5179 =end latex
5181 =item * Affine hull
5183         __isl_give isl_basic_set *isl_basic_set_affine_hull(
5184                 __isl_take isl_basic_set *bset);
5185         __isl_give isl_basic_set *isl_set_affine_hull(
5186                 __isl_take isl_set *set);
5187         __isl_give isl_union_set *isl_union_set_affine_hull(
5188                 __isl_take isl_union_set *uset);
5189         __isl_give isl_basic_map *isl_basic_map_affine_hull(
5190                 __isl_take isl_basic_map *bmap);
5191         __isl_give isl_basic_map *isl_map_affine_hull(
5192                 __isl_take isl_map *map);
5193         __isl_give isl_union_map *isl_union_map_affine_hull(
5194                 __isl_take isl_union_map *umap);
5196 In case of union sets and relations, the affine hull is computed
5197 per space.
5199 =item * Polyhedral hull
5201         __isl_give isl_basic_set *isl_set_polyhedral_hull(
5202                 __isl_take isl_set *set);
5203         __isl_give isl_basic_map *isl_map_polyhedral_hull(
5204                 __isl_take isl_map *map);
5205         __isl_give isl_union_set *isl_union_set_polyhedral_hull(
5206                 __isl_take isl_union_set *uset);
5207         __isl_give isl_union_map *isl_union_map_polyhedral_hull(
5208                 __isl_take isl_union_map *umap);
5210 These functions compute a single basic set or relation
5211 not involving any existentially quantified variables
5212 that contains the whole input set or relation.
5213 In case of union sets and relations, the polyhedral hull is computed
5214 per space.
5216 =item * Other approximations
5218         #include <isl/set.h>
5219         __isl_give isl_basic_set *
5220         isl_basic_set_drop_constraints_involving_dims(
5221                 __isl_take isl_basic_set *bset,
5222                 enum isl_dim_type type,
5223                 unsigned first, unsigned n);
5224         __isl_give isl_basic_set *
5225         isl_basic_set_drop_constraints_not_involving_dims(
5226                 __isl_take isl_basic_set *bset,
5227                 enum isl_dim_type type,
5228                 unsigned first, unsigned n);
5229         __isl_give isl_set *
5230         isl_set_drop_constraints_involving_dims(
5231                 __isl_take isl_set *set,
5232                 enum isl_dim_type type,
5233                 unsigned first, unsigned n);
5234         __isl_give isl_set *
5235         isl_set_drop_constraints_not_involving_dims(
5236                 __isl_take isl_set *set,
5237                 enum isl_dim_type type,
5238                 unsigned first, unsigned n);
5240         #include <isl/map.h>
5241         __isl_give isl_basic_map *
5242         isl_basic_map_drop_constraints_involving_dims(
5243                 __isl_take isl_basic_map *bmap,
5244                 enum isl_dim_type type,
5245                 unsigned first, unsigned n);
5246         __isl_give isl_basic_map *
5247         isl_basic_map_drop_constraints_not_involving_dims(
5248                 __isl_take isl_basic_map *bmap,
5249                 enum isl_dim_type type,
5250                 unsigned first, unsigned n);
5251         __isl_give isl_map *
5252         isl_map_drop_constraints_involving_dims(
5253                 __isl_take isl_map *map,
5254                 enum isl_dim_type type,
5255                 unsigned first, unsigned n);
5256         __isl_give isl_map *
5257         isl_map_drop_constraints_not_involving_dims(
5258                 __isl_take isl_map *map,
5259                 enum isl_dim_type type,
5260                 unsigned first, unsigned n);
5262 These functions drop any constraints (not) involving the specified dimensions.
5263 Note that the result depends on the representation of the input.
5265         #include <isl/polynomial.h>
5266         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
5267                 __isl_take isl_pw_qpolynomial *pwqp, int sign);
5268         __isl_give isl_union_pw_qpolynomial *
5269         isl_union_pw_qpolynomial_to_polynomial(
5270                 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
5272 Approximate each quasipolynomial by a polynomial.  If C<sign> is positive,
5273 the polynomial will be an overapproximation.  If C<sign> is negative,
5274 it will be an underapproximation.  If C<sign> is zero, the approximation
5275 will lie somewhere in between.
5277 =item * Feasibility
5279         __isl_give isl_basic_set *isl_basic_set_sample(
5280                 __isl_take isl_basic_set *bset);
5281         __isl_give isl_basic_set *isl_set_sample(
5282                 __isl_take isl_set *set);
5283         __isl_give isl_basic_map *isl_basic_map_sample(
5284                 __isl_take isl_basic_map *bmap);
5285         __isl_give isl_basic_map *isl_map_sample(
5286                 __isl_take isl_map *map);
5288 If the input (basic) set or relation is non-empty, then return
5289 a singleton subset of the input.  Otherwise, return an empty set.
5291 =item * Optimization
5293         #include <isl/ilp.h>
5294         __isl_give isl_val *isl_basic_set_max_val(
5295                 __isl_keep isl_basic_set *bset,
5296                 __isl_keep isl_aff *obj);
5297         __isl_give isl_val *isl_set_min_val(
5298                 __isl_keep isl_set *set,
5299                 __isl_keep isl_aff *obj);
5300         __isl_give isl_val *isl_set_max_val(
5301                 __isl_keep isl_set *set,
5302                 __isl_keep isl_aff *obj);
5303         __isl_give isl_multi_val *
5304         isl_union_set_min_multi_union_pw_aff(
5305                 __isl_keep isl_union_set *set,
5306                 __isl_keep isl_multi_union_pw_aff *obj);
5308 Compute the minimum or maximum of the integer affine expression C<obj>
5309 over the points in C<set>, returning the result in C<opt>.
5310 The result is C<NULL> in case of an error, the optimal value in case
5311 there is one, negative infinity or infinity if the problem is unbounded and
5312 NaN if the problem is empty.
5314         #include <isl/ilp.h>
5315         __isl_give isl_val *isl_basic_set_dim_max_val(
5316                 __isl_take isl_basic_set *bset, int pos);
5318 Return the maximal value attained by the given set dimension,
5319 independently of the parameter values and of any other dimensions.
5320 The result is C<NULL> in case of an error, the optimal value in case
5321 there is one, infinity if the problem is unbounded and
5322 NaN if the input is empty.
5324 =item * Parametric optimization
5326         __isl_give isl_pw_aff *isl_set_dim_min(
5327                 __isl_take isl_set *set, int pos);
5328         __isl_give isl_pw_aff *isl_set_dim_max(
5329                 __isl_take isl_set *set, int pos);
5330         __isl_give isl_pw_aff *isl_map_dim_min(
5331                 __isl_take isl_map *map, int pos);
5332         __isl_give isl_pw_aff *isl_map_dim_max(
5333                 __isl_take isl_map *map, int pos);
5335 Compute the minimum or maximum of the given set or output dimension
5336 as a function of the parameters (and input dimensions), but independently
5337 of the other set or output dimensions.
5338 For lexicographic optimization, see L<"Lexicographic Optimization">.
5340 =item * Dual
5342 The following functions compute either the set of (rational) coefficient
5343 values of valid constraints for the given set or the set of (rational)
5344 values satisfying the constraints with coefficients from the given set.
5345 Internally, these two sets of functions perform essentially the
5346 same operations, except that the set of coefficients is assumed to
5347 be a cone, while the set of values may be any polyhedron.
5348 The current implementation is based on the Farkas lemma and
5349 Fourier-Motzkin elimination, but this may change or be made optional
5350 in future.  In particular, future implementations may use different
5351 dualization algorithms or skip the elimination step.
5353         #include <isl/set.h>
5354         __isl_give isl_basic_set *isl_basic_set_coefficients(
5355                 __isl_take isl_basic_set *bset);
5356         __isl_give isl_basic_set_list *
5357         isl_basic_set_list_coefficients(
5358                 __isl_take isl_basic_set_list *list);
5359         __isl_give isl_basic_set *isl_set_coefficients(
5360                 __isl_take isl_set *set);
5361         __isl_give isl_union_set *isl_union_set_coefficients(
5362                 __isl_take isl_union_set *bset);
5363         __isl_give isl_basic_set *isl_basic_set_solutions(
5364                 __isl_take isl_basic_set *bset);
5365         __isl_give isl_basic_set *isl_set_solutions(
5366                 __isl_take isl_set *set);
5367         __isl_give isl_union_set *isl_union_set_solutions(
5368                 __isl_take isl_union_set *bset);
5370 =item * Power
5372         __isl_give isl_map *isl_map_fixed_power_val(
5373                 __isl_take isl_map *map,
5374                 __isl_take isl_val *exp);
5375         __isl_give isl_union_map *
5376         isl_union_map_fixed_power_val(
5377                 __isl_take isl_union_map *umap,
5378                 __isl_take isl_val *exp);
5380 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
5381 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
5382 of C<map> is computed.
5384         __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
5385                 int *exact);
5386         __isl_give isl_union_map *isl_union_map_power(
5387                 __isl_take isl_union_map *umap, int *exact);
5389 Compute a parametric representation for all positive powers I<k> of C<map>.
5390 The result maps I<k> to a nested relation corresponding to the
5391 I<k>th power of C<map>.
5392 The result may be an overapproximation.  If the result is known to be exact,
5393 then C<*exact> is set to C<1>.
5395 =item * Transitive closure
5397         __isl_give isl_map *isl_map_transitive_closure(
5398                 __isl_take isl_map *map, int *exact);
5399         __isl_give isl_union_map *isl_union_map_transitive_closure(
5400                 __isl_take isl_union_map *umap, int *exact);
5402 Compute the transitive closure of C<map>.
5403 The result may be an overapproximation.  If the result is known to be exact,
5404 then C<*exact> is set to C<1>.
5406 =item * Reaching path lengths
5408         __isl_give isl_map *isl_map_reaching_path_lengths(
5409                 __isl_take isl_map *map, int *exact);
5411 Compute a relation that maps each element in the range of C<map>
5412 to the lengths of all paths composed of edges in C<map> that
5413 end up in the given element.
5414 The result may be an overapproximation.  If the result is known to be exact,
5415 then C<*exact> is set to C<1>.
5416 To compute the I<maximal> path length, the resulting relation
5417 should be postprocessed by C<isl_map_lexmax>.
5418 In particular, if the input relation is a dependence relation
5419 (mapping sources to sinks), then the maximal path length corresponds
5420 to the free schedule.
5421 Note, however, that C<isl_map_lexmax> expects the maximum to be
5422 finite, so if the path lengths are unbounded (possibly due to
5423 the overapproximation), then you will get an error message.
5425 =item * Wrapping
5427         #include <isl/space.h>
5428         __isl_give isl_space *isl_space_wrap(
5429                 __isl_take isl_space *space);
5430         __isl_give isl_space *isl_space_unwrap(
5431                 __isl_take isl_space *space);
5433         #include <isl/local_space.h>
5434         __isl_give isl_local_space *isl_local_space_wrap(
5435                 __isl_take isl_local_space *ls);
5437         #include <isl/set.h>
5438         __isl_give isl_basic_map *isl_basic_set_unwrap(
5439                 __isl_take isl_basic_set *bset);
5440         __isl_give isl_map *isl_set_unwrap(
5441                 __isl_take isl_set *set);
5443         #include <isl/map.h>
5444         __isl_give isl_basic_set *isl_basic_map_wrap(
5445                 __isl_take isl_basic_map *bmap);
5446         __isl_give isl_set *isl_map_wrap(
5447                 __isl_take isl_map *map);
5449         #include <isl/union_set.h>
5450         __isl_give isl_union_map *isl_union_set_unwrap(
5451                 __isl_take isl_union_set *uset);
5453         #include <isl/union_map.h>
5454         __isl_give isl_union_set *isl_union_map_wrap(
5455                 __isl_take isl_union_map *umap);
5457 The input to C<isl_space_unwrap> should
5458 be the space of a set, while that of
5459 C<isl_space_wrap> should be the space of a relation.
5460 Conversely, the output of C<isl_space_unwrap> is the space
5461 of a relation, while that of C<isl_space_wrap> is the space of a set.
5463 =item * Flattening
5465 Remove any internal structure of domain (and range) of the given
5466 set or relation.  If there is any such internal structure in the input,
5467 then the name of the space is also removed.
5469         #include <isl/space.h>
5470         __isl_give isl_space *isl_space_flatten_domain(
5471                 __isl_take isl_space *space);
5472         __isl_give isl_space *isl_space_flatten_range(
5473                 __isl_take isl_space *space);
5475         #include <isl/local_space.h>
5476         __isl_give isl_local_space *
5477         isl_local_space_flatten_domain(
5478                 __isl_take isl_local_space *ls);
5479         __isl_give isl_local_space *
5480         isl_local_space_flatten_range(
5481                 __isl_take isl_local_space *ls);
5483         #include <isl/set.h>
5484         __isl_give isl_basic_set *isl_basic_set_flatten(
5485                 __isl_take isl_basic_set *bset);
5486         __isl_give isl_set *isl_set_flatten(
5487                 __isl_take isl_set *set);
5489         #include <isl/map.h>
5490         __isl_give isl_basic_map *isl_basic_map_flatten_domain(
5491                 __isl_take isl_basic_map *bmap);
5492         __isl_give isl_basic_map *isl_basic_map_flatten_range(
5493                 __isl_take isl_basic_map *bmap);
5494         __isl_give isl_map *isl_map_flatten_range(
5495                 __isl_take isl_map *map);
5496         __isl_give isl_map *isl_map_flatten_domain(
5497                 __isl_take isl_map *map);
5498         __isl_give isl_basic_map *isl_basic_map_flatten(
5499                 __isl_take isl_basic_map *bmap);
5500         __isl_give isl_map *isl_map_flatten(
5501                 __isl_take isl_map *map);
5503         #include <isl/val.h>
5504         __isl_give isl_multi_val *isl_multi_val_flatten_range(
5505                 __isl_take isl_multi_val *mv);
5507         #include <isl/aff.h>
5508         __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
5509                 __isl_take isl_multi_aff *ma);
5510         __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
5511                 __isl_take isl_multi_aff *ma);
5512         __isl_give isl_multi_pw_aff *
5513         isl_multi_pw_aff_flatten_range(
5514                 __isl_take isl_multi_pw_aff *mpa);
5515         __isl_give isl_multi_union_pw_aff *
5516         isl_multi_union_pw_aff_flatten_range(
5517                 __isl_take isl_multi_union_pw_aff *mupa);
5519         #include <isl/map.h>
5520         __isl_give isl_map *isl_set_flatten_map(
5521                 __isl_take isl_set *set);
5523 The function above constructs a relation
5524 that maps the input set to a flattened version of the set.
5526 =item * Lifting
5528 Lift the input set to a space with extra dimensions corresponding
5529 to the existentially quantified variables in the input.
5530 In particular, the result lives in a wrapped map where the domain
5531 is the original space and the range corresponds to the original
5532 existentially quantified variables.
5534         #include <isl/set.h>
5535         __isl_give isl_basic_set *isl_basic_set_lift(
5536                 __isl_take isl_basic_set *bset);
5537         __isl_give isl_set *isl_set_lift(
5538                 __isl_take isl_set *set);
5539         __isl_give isl_union_set *isl_union_set_lift(
5540                 __isl_take isl_union_set *uset);
5542 Given a local space that contains the existentially quantified
5543 variables of a set, a basic relation that, when applied to
5544 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
5545 can be constructed using the following function.
5547         #include <isl/local_space.h>
5548         __isl_give isl_basic_map *isl_local_space_lifting(
5549                 __isl_take isl_local_space *ls);
5551         #include <isl/aff.h>
5552         __isl_give isl_multi_aff *isl_multi_aff_lift(
5553                 __isl_take isl_multi_aff *maff,
5554                 __isl_give isl_local_space **ls);
5556 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
5557 then it is assigned the local space that lies at the basis of
5558 the lifting applied.
5560 =item * Internal Product
5562         #include <isl/space.h>
5563         __isl_give isl_space *isl_space_zip(
5564                 __isl_take isl_space *space);
5566         #include <isl/map.h>
5567         __isl_give isl_basic_map *isl_basic_map_zip(
5568                 __isl_take isl_basic_map *bmap);
5569         __isl_give isl_map *isl_map_zip(
5570                 __isl_take isl_map *map);
5572         #include <isl/union_map.h>
5573         __isl_give isl_union_map *isl_union_map_zip(
5574                 __isl_take isl_union_map *umap);
5576 Given a relation with nested relations for domain and range,
5577 interchange the range of the domain with the domain of the range.
5579 =item * Currying
5581         #include <isl/space.h>
5582         __isl_give isl_space *isl_space_curry(
5583                 __isl_take isl_space *space);
5584         __isl_give isl_space *isl_space_uncurry(
5585                 __isl_take isl_space *space);
5587         #include <isl/map.h>
5588         __isl_give isl_basic_map *isl_basic_map_curry(
5589                 __isl_take isl_basic_map *bmap);
5590         __isl_give isl_basic_map *isl_basic_map_uncurry(
5591                 __isl_take isl_basic_map *bmap);
5592         __isl_give isl_map *isl_map_curry(
5593                 __isl_take isl_map *map);
5594         __isl_give isl_map *isl_map_uncurry(
5595                 __isl_take isl_map *map);
5597         #include <isl/union_map.h>
5598         __isl_give isl_union_map *isl_union_map_curry(
5599                 __isl_take isl_union_map *umap);
5600         __isl_give isl_union_map *isl_union_map_uncurry(
5601                 __isl_take isl_union_map *umap);
5603 Given a relation with a nested relation for domain,
5604 the C<curry> functions
5605 move the range of the nested relation out of the domain
5606 and use it as the domain of a nested relation in the range,
5607 with the original range as range of this nested relation.
5608 The C<uncurry> functions perform the inverse operation.
5610         #include <isl/space.h>
5611         __isl_give isl_space *isl_space_range_curry(
5612                 __isl_take isl_space *space);
5614         #include <isl/map.h>
5615         __isl_give isl_map *isl_map_range_curry(
5616                 __isl_take isl_map *map);
5618         #include <isl/union_map.h>
5619         __isl_give isl_union_map *isl_union_map_range_curry(
5620                 __isl_take isl_union_map *umap);
5622 These functions apply the currying to the relation that
5623 is nested inside the range of the input.
5625 =item * Aligning parameters
5627 Change the order of the parameters of the given set, relation
5628 or function
5629 such that the first parameters match those of C<model>.
5630 This may involve the introduction of extra parameters.
5631 All parameters need to be named.
5633         #include <isl/space.h>
5634         __isl_give isl_space *isl_space_align_params(
5635                 __isl_take isl_space *space1,
5636                 __isl_take isl_space *space2)
5638         #include <isl/set.h>
5639         __isl_give isl_basic_set *isl_basic_set_align_params(
5640                 __isl_take isl_basic_set *bset,
5641                 __isl_take isl_space *model);
5642         __isl_give isl_set *isl_set_align_params(
5643                 __isl_take isl_set *set,
5644                 __isl_take isl_space *model);
5646         #include <isl/map.h>
5647         __isl_give isl_basic_map *isl_basic_map_align_params(
5648                 __isl_take isl_basic_map *bmap,
5649                 __isl_take isl_space *model);
5650         __isl_give isl_map *isl_map_align_params(
5651                 __isl_take isl_map *map,
5652                 __isl_take isl_space *model);
5654         #include <isl/val.h>
5655         __isl_give isl_multi_val *isl_multi_val_align_params(
5656                 __isl_take isl_multi_val *mv,
5657                 __isl_take isl_space *model);
5659         #include <isl/aff.h>
5660         __isl_give isl_aff *isl_aff_align_params(
5661                 __isl_take isl_aff *aff,
5662                 __isl_take isl_space *model);
5663         __isl_give isl_multi_aff *isl_multi_aff_align_params(
5664                 __isl_take isl_multi_aff *multi,
5665                 __isl_take isl_space *model);
5666         __isl_give isl_pw_aff *isl_pw_aff_align_params(
5667                 __isl_take isl_pw_aff *pwaff,
5668                 __isl_take isl_space *model);
5669         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
5670                 __isl_take isl_pw_multi_aff *pma,
5671                 __isl_take isl_space *model);
5672         __isl_give isl_union_pw_aff *
5673         isl_union_pw_aff_align_params(
5674                 __isl_take isl_union_pw_aff *upa,
5675                 __isl_take isl_space *model);
5676         __isl_give isl_union_pw_multi_aff *
5677         isl_union_pw_multi_aff_align_params(
5678                 __isl_take isl_union_pw_multi_aff *upma,
5679                 __isl_take isl_space *model);
5680         __isl_give isl_multi_union_pw_aff *
5681         isl_multi_union_pw_aff_align_params(
5682                 __isl_take isl_multi_union_pw_aff *mupa,
5683                 __isl_take isl_space *model);
5685         #include <isl/polynomial.h>
5686         __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
5687                 __isl_take isl_qpolynomial *qp,
5688                 __isl_take isl_space *model);
5690 =item * Drop unused parameters
5692 Drop parameters that are not referenced by the isl object.
5693 All parameters need to be named.
5695         #include <isl/set.h>
5696         __isl_give isl_basic_set *
5697         isl_basic_set_drop_unused_params(
5698                 __isl_take isl_basic_set *bset);
5699         __isl_give isl_set *isl_set_drop_unused_params(
5700                 __isl_take isl_set *set);
5702         #include <isl/map.h>
5703         __isl_give isl_basic_map *
5704         isl_basic_map_drop_unused_params(
5705                 __isl_take isl_basic_map *bmap);
5706         __isl_give isl_map *isl_map_drop_unused_params(
5707                 __isl_take isl_map *map);
5709         #include <isl/aff.h>
5710         __isl_give isl_pw_aff *isl_pw_aff_drop_unused_params(
5711                 __isl_take isl_pw_aff *pa);
5712         __isl_give isl_pw_multi_aff *
5713         isl_pw_multi_aff_drop_unused_params(
5714                 __isl_take isl_pw_multi_aff *pma);
5716         #include <isl/polynomial.h>
5717         __isl_give isl_pw_qpolynomial *
5718         isl_pw_qpolynomial_drop_unused_params(
5719                 __isl_take isl_pw_qpolynomial *pwqp);
5720         __isl_give isl_pw_qpolynomial_fold *
5721         isl_pw_qpolynomial_fold_drop_unused_params(
5722                 __isl_take isl_pw_qpolynomial_fold *pwf);
5724 =item * Unary Arithmetic Operations
5726         #include <isl/set.h>
5727         __isl_give isl_set *isl_set_neg(
5728                 __isl_take isl_set *set);
5729         #include <isl/map.h>
5730         __isl_give isl_map *isl_map_neg(
5731                 __isl_take isl_map *map);
5733 C<isl_set_neg> constructs a set containing the opposites of
5734 the elements in its argument.
5735 The domain of the result of C<isl_map_neg> is the same
5736 as the domain of its argument.  The corresponding range
5737 elements are the opposites of the corresponding range
5738 elements in the argument.
5740         #include <isl/val.h>
5741         __isl_give isl_multi_val *isl_multi_val_neg(
5742                 __isl_take isl_multi_val *mv);
5744         #include <isl/aff.h>
5745         __isl_give isl_aff *isl_aff_neg(
5746                 __isl_take isl_aff *aff);
5747         __isl_give isl_multi_aff *isl_multi_aff_neg(
5748                 __isl_take isl_multi_aff *ma);
5749         __isl_give isl_pw_aff *isl_pw_aff_neg(
5750                 __isl_take isl_pw_aff *pwaff);
5751         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
5752                 __isl_take isl_pw_multi_aff *pma);
5753         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
5754                 __isl_take isl_multi_pw_aff *mpa);
5755         __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
5756                 __isl_take isl_union_pw_aff *upa);
5757         __isl_give isl_union_pw_multi_aff *
5758         isl_union_pw_multi_aff_neg(
5759                 __isl_take isl_union_pw_multi_aff *upma);
5760         __isl_give isl_multi_union_pw_aff *
5761         isl_multi_union_pw_aff_neg(
5762                 __isl_take isl_multi_union_pw_aff *mupa);
5763         __isl_give isl_aff *isl_aff_ceil(
5764                 __isl_take isl_aff *aff);
5765         __isl_give isl_pw_aff *isl_pw_aff_ceil(
5766                 __isl_take isl_pw_aff *pwaff);
5767         __isl_give isl_aff *isl_aff_floor(
5768                 __isl_take isl_aff *aff);
5769         __isl_give isl_multi_aff *isl_multi_aff_floor(
5770                 __isl_take isl_multi_aff *ma);
5771         __isl_give isl_pw_aff *isl_pw_aff_floor(
5772                 __isl_take isl_pw_aff *pwaff);
5773         __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
5774                 __isl_take isl_union_pw_aff *upa);
5775         __isl_give isl_multi_union_pw_aff *
5776         isl_multi_union_pw_aff_floor(
5777                 __isl_take isl_multi_union_pw_aff *mupa);
5779         #include <isl/aff.h>
5780         __isl_give isl_pw_aff *isl_pw_aff_list_min(
5781                 __isl_take isl_pw_aff_list *list);
5782         __isl_give isl_pw_aff *isl_pw_aff_list_max(
5783                 __isl_take isl_pw_aff_list *list);
5785         #include <isl/polynomial.h>
5786         __isl_give isl_qpolynomial *isl_qpolynomial_neg(
5787                 __isl_take isl_qpolynomial *qp);
5788         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
5789                 __isl_take isl_pw_qpolynomial *pwqp);
5790         __isl_give isl_union_pw_qpolynomial *
5791         isl_union_pw_qpolynomial_neg(
5792                 __isl_take isl_union_pw_qpolynomial *upwqp);
5793         __isl_give isl_qpolynomial *isl_qpolynomial_pow(
5794                 __isl_take isl_qpolynomial *qp,
5795                 unsigned exponent);
5796         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
5797                 __isl_take isl_pw_qpolynomial *pwqp,
5798                 unsigned exponent);
5800 =item * Evaluation
5802 The following functions evaluate a function in a point.
5804         #include <isl/aff.h>
5805         __isl_give isl_val *isl_aff_eval(
5806                 __isl_take isl_aff *aff,
5807                 __isl_take isl_point *pnt);
5808         __isl_give isl_val *isl_pw_aff_eval(
5809                 __isl_take isl_pw_aff *pa,
5810                 __isl_take isl_point *pnt);
5812         #include <isl/polynomial.h>
5813         __isl_give isl_val *isl_pw_qpolynomial_eval(
5814                 __isl_take isl_pw_qpolynomial *pwqp,
5815                 __isl_take isl_point *pnt);
5816         __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
5817                 __isl_take isl_pw_qpolynomial_fold *pwf,
5818                 __isl_take isl_point *pnt);
5819         __isl_give isl_val *isl_union_pw_qpolynomial_eval(
5820                 __isl_take isl_union_pw_qpolynomial *upwqp,
5821                 __isl_take isl_point *pnt);
5822         __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
5823                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5824                 __isl_take isl_point *pnt);
5826 These functions return NaN when evaluated at a void point.
5827 Note that C<isl_pw_aff_eval> returns NaN when the function is evaluated outside
5828 its definition domain, while C<isl_pw_qpolynomial_eval> returns zero
5829 when the function is evaluated outside its explicit domain.
5831 =item * Dimension manipulation
5833 It is usually not advisable to directly change the (input or output)
5834 space of a set or a relation as this removes the name and the internal
5835 structure of the space.  However, the functions below can be useful
5836 to add new parameters, assuming
5837 C<isl_set_align_params> and C<isl_map_align_params>
5838 are not sufficient.
5840         #include <isl/space.h>
5841         __isl_give isl_space *isl_space_add_dims(
5842                 __isl_take isl_space *space,
5843                 enum isl_dim_type type, unsigned n);
5844         __isl_give isl_space *isl_space_insert_dims(
5845                 __isl_take isl_space *space,
5846                 enum isl_dim_type type, unsigned pos, unsigned n);
5847         __isl_give isl_space *isl_space_drop_dims(
5848                 __isl_take isl_space *space,
5849                 enum isl_dim_type type, unsigned first, unsigned n);
5850         __isl_give isl_space *isl_space_move_dims(
5851                 __isl_take isl_space *space,
5852                 enum isl_dim_type dst_type, unsigned dst_pos,
5853                 enum isl_dim_type src_type, unsigned src_pos,
5854                 unsigned n);
5856         #include <isl/local_space.h>
5857         __isl_give isl_local_space *isl_local_space_add_dims(
5858                 __isl_take isl_local_space *ls,
5859                 enum isl_dim_type type, unsigned n);
5860         __isl_give isl_local_space *isl_local_space_insert_dims(
5861                 __isl_take isl_local_space *ls,
5862                 enum isl_dim_type type, unsigned first, unsigned n);
5863         __isl_give isl_local_space *isl_local_space_drop_dims(
5864                 __isl_take isl_local_space *ls,
5865                 enum isl_dim_type type, unsigned first, unsigned n);
5867         #include <isl/set.h>
5868         __isl_give isl_basic_set *isl_basic_set_add_dims(
5869                 __isl_take isl_basic_set *bset,
5870                 enum isl_dim_type type, unsigned n);
5871         __isl_give isl_set *isl_set_add_dims(
5872                 __isl_take isl_set *set,
5873                 enum isl_dim_type type, unsigned n);
5874         __isl_give isl_basic_set *isl_basic_set_insert_dims(
5875                 __isl_take isl_basic_set *bset,
5876                 enum isl_dim_type type, unsigned pos,
5877                 unsigned n);
5878         __isl_give isl_set *isl_set_insert_dims(
5879                 __isl_take isl_set *set,
5880                 enum isl_dim_type type, unsigned pos, unsigned n);
5881         __isl_give isl_basic_set *isl_basic_set_move_dims(
5882                 __isl_take isl_basic_set *bset,
5883                 enum isl_dim_type dst_type, unsigned dst_pos,
5884                 enum isl_dim_type src_type, unsigned src_pos,
5885                 unsigned n);
5886         __isl_give isl_set *isl_set_move_dims(
5887                 __isl_take isl_set *set,
5888                 enum isl_dim_type dst_type, unsigned dst_pos,
5889                 enum isl_dim_type src_type, unsigned src_pos,
5890                 unsigned n);
5892         #include <isl/map.h>
5893         __isl_give isl_basic_map *isl_basic_map_add_dims(
5894                 __isl_take isl_basic_map *bmap,
5895                 enum isl_dim_type type, unsigned n);
5896         __isl_give isl_map *isl_map_add_dims(
5897                 __isl_take isl_map *map,
5898                 enum isl_dim_type type, unsigned n);
5899         __isl_give isl_basic_map *isl_basic_map_insert_dims(
5900                 __isl_take isl_basic_map *bmap,
5901                 enum isl_dim_type type, unsigned pos,
5902                 unsigned n);
5903         __isl_give isl_map *isl_map_insert_dims(
5904                 __isl_take isl_map *map,
5905                 enum isl_dim_type type, unsigned pos, unsigned n);
5906         __isl_give isl_basic_map *isl_basic_map_move_dims(
5907                 __isl_take isl_basic_map *bmap,
5908                 enum isl_dim_type dst_type, unsigned dst_pos,
5909                 enum isl_dim_type src_type, unsigned src_pos,
5910                 unsigned n);
5911         __isl_give isl_map *isl_map_move_dims(
5912                 __isl_take isl_map *map,
5913                 enum isl_dim_type dst_type, unsigned dst_pos,
5914                 enum isl_dim_type src_type, unsigned src_pos,
5915                 unsigned n);
5917         #include <isl/val.h>
5918         __isl_give isl_multi_val *isl_multi_val_insert_dims(
5919                 __isl_take isl_multi_val *mv,
5920                 enum isl_dim_type type, unsigned first, unsigned n);
5921         __isl_give isl_multi_val *isl_multi_val_add_dims(
5922                 __isl_take isl_multi_val *mv,
5923                 enum isl_dim_type type, unsigned n);
5924         __isl_give isl_multi_val *isl_multi_val_drop_dims(
5925                 __isl_take isl_multi_val *mv,
5926                 enum isl_dim_type type, unsigned first, unsigned n);
5928         #include <isl/aff.h>
5929         __isl_give isl_aff *isl_aff_insert_dims(
5930                 __isl_take isl_aff *aff,
5931                 enum isl_dim_type type, unsigned first, unsigned n);
5932         __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
5933                 __isl_take isl_multi_aff *ma,
5934                 enum isl_dim_type type, unsigned first, unsigned n);
5935         __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
5936                 __isl_take isl_pw_aff *pwaff,
5937                 enum isl_dim_type type, unsigned first, unsigned n);
5938         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
5939                 __isl_take isl_multi_pw_aff *mpa,
5940                 enum isl_dim_type type, unsigned first, unsigned n);
5941         __isl_give isl_aff *isl_aff_add_dims(
5942                 __isl_take isl_aff *aff,
5943                 enum isl_dim_type type, unsigned n);
5944         __isl_give isl_multi_aff *isl_multi_aff_add_dims(
5945                 __isl_take isl_multi_aff *ma,
5946                 enum isl_dim_type type, unsigned n);
5947         __isl_give isl_pw_aff *isl_pw_aff_add_dims(
5948                 __isl_take isl_pw_aff *pwaff,
5949                 enum isl_dim_type type, unsigned n);
5950         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
5951                 __isl_take isl_multi_pw_aff *mpa,
5952                 enum isl_dim_type type, unsigned n);
5953         __isl_give isl_aff *isl_aff_drop_dims(
5954                 __isl_take isl_aff *aff,
5955                 enum isl_dim_type type, unsigned first, unsigned n);
5956         __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
5957                 __isl_take isl_multi_aff *maff,
5958                 enum isl_dim_type type, unsigned first, unsigned n);
5959         __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
5960                 __isl_take isl_pw_aff *pwaff,
5961                 enum isl_dim_type type, unsigned first, unsigned n);
5962         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
5963                 __isl_take isl_pw_multi_aff *pma,
5964                 enum isl_dim_type type, unsigned first, unsigned n);
5965         __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
5966                 __isl_take isl_union_pw_aff *upa,
5967                 enum isl_dim_type type, unsigned first, unsigned n);
5968         __isl_give isl_union_pw_multi_aff *
5969                 isl_union_pw_multi_aff_drop_dims(
5970                 __isl_take isl_union_pw_multi_aff *upma,
5971                 enum isl_dim_type type,
5972                 unsigned first, unsigned n);
5973         __isl_give isl_multi_union_pw_aff *
5974         isl_multi_union_pw_aff_drop_dims(
5975                 __isl_take isl_multi_union_pw_aff *mupa,
5976                 enum isl_dim_type type, unsigned first,
5977                 unsigned n);
5978         __isl_give isl_aff *isl_aff_move_dims(
5979                 __isl_take isl_aff *aff,
5980                 enum isl_dim_type dst_type, unsigned dst_pos,
5981                 enum isl_dim_type src_type, unsigned src_pos,
5982                 unsigned n);
5983         __isl_give isl_multi_aff *isl_multi_aff_move_dims(
5984                 __isl_take isl_multi_aff *ma,
5985                 enum isl_dim_type dst_type, unsigned dst_pos,
5986                 enum isl_dim_type src_type, unsigned src_pos,
5987                 unsigned n);
5988         __isl_give isl_pw_aff *isl_pw_aff_move_dims(
5989                 __isl_take isl_pw_aff *pa,
5990                 enum isl_dim_type dst_type, unsigned dst_pos,
5991                 enum isl_dim_type src_type, unsigned src_pos,
5992                 unsigned n);
5993         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
5994                 __isl_take isl_multi_pw_aff *pma,
5995                 enum isl_dim_type dst_type, unsigned dst_pos,
5996                 enum isl_dim_type src_type, unsigned src_pos,
5997                 unsigned n);
5999         #include <isl/polynomial.h>
6000         __isl_give isl_union_pw_qpolynomial *
6001         isl_union_pw_qpolynomial_drop_dims(
6002                 __isl_take isl_union_pw_qpolynomial *upwqp,
6003                 enum isl_dim_type type,
6004                 unsigned first, unsigned n);
6005         __isl_give isl_union_pw_qpolynomial_fold *
6006                 isl_union_pw_qpolynomial_fold_drop_dims(
6007                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6008                 enum isl_dim_type type,
6009                 unsigned first, unsigned n);
6011 The operations on union expressions can only manipulate parameters.
6013 =back
6015 =head2 Binary Operations
6017 The two arguments of a binary operation not only need to live
6018 in the same C<isl_ctx>, they currently also need to have
6019 the same (number of) parameters.
6021 =head3 Basic Operations
6023 =over
6025 =item * Intersection
6027         #include <isl/local_space.h>
6028         __isl_give isl_local_space *isl_local_space_intersect(
6029                 __isl_take isl_local_space *ls1,
6030                 __isl_take isl_local_space *ls2);
6032         #include <isl/set.h>
6033         __isl_give isl_basic_set *isl_basic_set_intersect_params(
6034                 __isl_take isl_basic_set *bset1,
6035                 __isl_take isl_basic_set *bset2);
6036         __isl_give isl_basic_set *isl_basic_set_intersect(
6037                 __isl_take isl_basic_set *bset1,
6038                 __isl_take isl_basic_set *bset2);
6039         __isl_give isl_basic_set *isl_basic_set_list_intersect(
6040                 __isl_take struct isl_basic_set_list *list);
6041         __isl_give isl_set *isl_set_intersect_params(
6042                 __isl_take isl_set *set,
6043                 __isl_take isl_set *params);
6044         __isl_give isl_set *isl_set_intersect(
6045                 __isl_take isl_set *set1,
6046                 __isl_take isl_set *set2);
6048         #include <isl/map.h>
6049         __isl_give isl_basic_map *isl_basic_map_intersect_domain(
6050                 __isl_take isl_basic_map *bmap,
6051                 __isl_take isl_basic_set *bset);
6052         __isl_give isl_basic_map *isl_basic_map_intersect_range(
6053                 __isl_take isl_basic_map *bmap,
6054                 __isl_take isl_basic_set *bset);
6055         __isl_give isl_basic_map *isl_basic_map_intersect(
6056                 __isl_take isl_basic_map *bmap1,
6057                 __isl_take isl_basic_map *bmap2);
6058         __isl_give isl_basic_map *isl_basic_map_list_intersect(
6059                 __isl_take isl_basic_map_list *list);
6060         __isl_give isl_map *isl_map_intersect_params(
6061                 __isl_take isl_map *map,
6062                 __isl_take isl_set *params);
6063         __isl_give isl_map *isl_map_intersect_domain(
6064                 __isl_take isl_map *map,
6065                 __isl_take isl_set *set);
6066         __isl_give isl_map *isl_map_intersect_range(
6067                 __isl_take isl_map *map,
6068                 __isl_take isl_set *set);
6069         __isl_give isl_map *isl_map_intersect(
6070                 __isl_take isl_map *map1,
6071                 __isl_take isl_map *map2);
6072         __isl_give isl_map *
6073         isl_map_intersect_domain_factor_range(
6074                 __isl_take isl_map *map,
6075                 __isl_take isl_map *factor);
6076         __isl_give isl_map *
6077         isl_map_intersect_range_factor_range(
6078                 __isl_take isl_map *map,
6079                 __isl_take isl_map *factor);
6081         #include <isl/union_set.h>
6082         __isl_give isl_union_set *isl_union_set_intersect_params(
6083                 __isl_take isl_union_set *uset,
6084                 __isl_take isl_set *set);
6085         __isl_give isl_union_set *isl_union_set_intersect(
6086                 __isl_take isl_union_set *uset1,
6087                 __isl_take isl_union_set *uset2);
6089         #include <isl/union_map.h>
6090         __isl_give isl_union_map *isl_union_map_intersect_params(
6091                 __isl_take isl_union_map *umap,
6092                 __isl_take isl_set *set);
6093         __isl_give isl_union_map *isl_union_map_intersect_domain(
6094                 __isl_take isl_union_map *umap,
6095                 __isl_take isl_union_set *uset);
6096         __isl_give isl_union_map *isl_union_map_intersect_range(
6097                 __isl_take isl_union_map *umap,
6098                 __isl_take isl_union_set *uset);
6099         __isl_give isl_union_map *isl_union_map_intersect(
6100                 __isl_take isl_union_map *umap1,
6101                 __isl_take isl_union_map *umap2);
6102         __isl_give isl_union_map *
6103         isl_union_map_intersect_range_factor_range(
6104                 __isl_take isl_union_map *umap,
6105                 __isl_take isl_union_map *factor);
6107         #include <isl/aff.h>
6108         __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
6109                 __isl_take isl_pw_aff *pa,
6110                 __isl_take isl_set *set);
6111         __isl_give isl_multi_pw_aff *
6112         isl_multi_pw_aff_intersect_domain(
6113                 __isl_take isl_multi_pw_aff *mpa,
6114                 __isl_take isl_set *domain);
6115         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
6116                 __isl_take isl_pw_multi_aff *pma,
6117                 __isl_take isl_set *set);
6118         __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
6119                 __isl_take isl_union_pw_aff *upa,
6120                 __isl_take isl_union_set *uset);
6121         __isl_give isl_union_pw_multi_aff *
6122         isl_union_pw_multi_aff_intersect_domain(
6123                 __isl_take isl_union_pw_multi_aff *upma,
6124                 __isl_take isl_union_set *uset);
6125         __isl_give isl_multi_union_pw_aff *
6126         isl_multi_union_pw_aff_intersect_domain(
6127                 __isl_take isl_multi_union_pw_aff *mupa,
6128                 __isl_take isl_union_set *uset);
6129         __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
6130                 __isl_take isl_pw_aff *pa,
6131                 __isl_take isl_set *set);
6132         __isl_give isl_multi_pw_aff *
6133         isl_multi_pw_aff_intersect_params(
6134                 __isl_take isl_multi_pw_aff *mpa,
6135                 __isl_take isl_set *set);
6136         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
6137                 __isl_take isl_pw_multi_aff *pma,
6138                 __isl_take isl_set *set);
6139         __isl_give isl_union_pw_aff *
6140         isl_union_pw_aff_intersect_params(
6141                 __isl_take isl_union_pw_aff *upa,
6142         __isl_give isl_union_pw_multi_aff *
6143         isl_union_pw_multi_aff_intersect_params(
6144                 __isl_take isl_union_pw_multi_aff *upma,
6145                 __isl_take isl_set *set);
6146         __isl_give isl_multi_union_pw_aff *
6147         isl_multi_union_pw_aff_intersect_params(
6148                 __isl_take isl_multi_union_pw_aff *mupa,
6149                 __isl_take isl_set *params);
6150         isl_multi_union_pw_aff_intersect_range(
6151                 __isl_take isl_multi_union_pw_aff *mupa,
6152                 __isl_take isl_set *set);
6154         #include <isl/polynomial.h>
6155         __isl_give isl_pw_qpolynomial *
6156         isl_pw_qpolynomial_intersect_domain(
6157                 __isl_take isl_pw_qpolynomial *pwpq,
6158                 __isl_take isl_set *set);
6159         __isl_give isl_union_pw_qpolynomial *
6160         isl_union_pw_qpolynomial_intersect_domain(
6161                 __isl_take isl_union_pw_qpolynomial *upwpq,
6162                 __isl_take isl_union_set *uset);
6163         __isl_give isl_union_pw_qpolynomial_fold *
6164         isl_union_pw_qpolynomial_fold_intersect_domain(
6165                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6166                 __isl_take isl_union_set *uset);
6167         __isl_give isl_pw_qpolynomial *
6168         isl_pw_qpolynomial_intersect_params(
6169                 __isl_take isl_pw_qpolynomial *pwpq,
6170                 __isl_take isl_set *set);
6171         __isl_give isl_pw_qpolynomial_fold *
6172         isl_pw_qpolynomial_fold_intersect_params(
6173                 __isl_take isl_pw_qpolynomial_fold *pwf,
6174                 __isl_take isl_set *set);
6175         __isl_give isl_union_pw_qpolynomial *
6176         isl_union_pw_qpolynomial_intersect_params(
6177                 __isl_take isl_union_pw_qpolynomial *upwpq,
6178                 __isl_take isl_set *set);
6179         __isl_give isl_union_pw_qpolynomial_fold *
6180         isl_union_pw_qpolynomial_fold_intersect_params(
6181                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6182                 __isl_take isl_set *set);
6184 The second argument to the C<_params> functions needs to be
6185 a parametric (basic) set.  For the other functions, a parametric set
6186 for either argument is only allowed if the other argument is
6187 a parametric set as well.
6188 The list passed to C<isl_basic_set_list_intersect> needs to have
6189 at least one element and all elements need to live in the same space.
6190 The function C<isl_multi_union_pw_aff_intersect_range>
6191 restricts the input function to those shared domain elements
6192 that map to the specified range.
6194 =item * Union
6196         #include <isl/set.h>
6197         __isl_give isl_set *isl_basic_set_union(
6198                 __isl_take isl_basic_set *bset1,
6199                 __isl_take isl_basic_set *bset2);
6200         __isl_give isl_set *isl_set_union(
6201                 __isl_take isl_set *set1,
6202                 __isl_take isl_set *set2);
6203         __isl_give isl_set *isl_set_list_union(
6204                 __isl_take isl_set_list *list);
6206         #include <isl/map.h>
6207         __isl_give isl_map *isl_basic_map_union(
6208                 __isl_take isl_basic_map *bmap1,
6209                 __isl_take isl_basic_map *bmap2);
6210         __isl_give isl_map *isl_map_union(
6211                 __isl_take isl_map *map1,
6212                 __isl_take isl_map *map2);
6214         #include <isl/union_set.h>
6215         __isl_give isl_union_set *isl_union_set_union(
6216                 __isl_take isl_union_set *uset1,
6217                 __isl_take isl_union_set *uset2);
6218         __isl_give isl_union_set *isl_union_set_list_union(
6219                 __isl_take isl_union_set_list *list);
6221         #include <isl/union_map.h>
6222         __isl_give isl_union_map *isl_union_map_union(
6223                 __isl_take isl_union_map *umap1,
6224                 __isl_take isl_union_map *umap2);
6226 The list passed to C<isl_set_list_union> needs to have
6227 at least one element and all elements need to live in the same space.
6229 =item * Set difference
6231         #include <isl/set.h>
6232         __isl_give isl_set *isl_set_subtract(
6233                 __isl_take isl_set *set1,
6234                 __isl_take isl_set *set2);
6236         #include <isl/map.h>
6237         __isl_give isl_map *isl_map_subtract(
6238                 __isl_take isl_map *map1,
6239                 __isl_take isl_map *map2);
6240         __isl_give isl_map *isl_map_subtract_domain(
6241                 __isl_take isl_map *map,
6242                 __isl_take isl_set *dom);
6243         __isl_give isl_map *isl_map_subtract_range(
6244                 __isl_take isl_map *map,
6245                 __isl_take isl_set *dom);
6247         #include <isl/union_set.h>
6248         __isl_give isl_union_set *isl_union_set_subtract(
6249                 __isl_take isl_union_set *uset1,
6250                 __isl_take isl_union_set *uset2);
6252         #include <isl/union_map.h>
6253         __isl_give isl_union_map *isl_union_map_subtract(
6254                 __isl_take isl_union_map *umap1,
6255                 __isl_take isl_union_map *umap2);
6256         __isl_give isl_union_map *isl_union_map_subtract_domain(
6257                 __isl_take isl_union_map *umap,
6258                 __isl_take isl_union_set *dom);
6259         __isl_give isl_union_map *isl_union_map_subtract_range(
6260                 __isl_take isl_union_map *umap,
6261                 __isl_take isl_union_set *dom);
6263         #include <isl/aff.h>
6264         __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
6265                 __isl_take isl_pw_aff *pa,
6266                 __isl_take isl_set *set);
6267         __isl_give isl_pw_multi_aff *
6268         isl_pw_multi_aff_subtract_domain(
6269                 __isl_take isl_pw_multi_aff *pma,
6270                 __isl_take isl_set *set);
6271         __isl_give isl_union_pw_aff *
6272         isl_union_pw_aff_subtract_domain(
6273                 __isl_take isl_union_pw_aff *upa,
6274                 __isl_take isl_union_set *uset);
6275         __isl_give isl_union_pw_multi_aff *
6276         isl_union_pw_multi_aff_subtract_domain(
6277                 __isl_take isl_union_pw_multi_aff *upma,
6278                 __isl_take isl_set *set);
6280         #include <isl/polynomial.h>
6281         __isl_give isl_pw_qpolynomial *
6282         isl_pw_qpolynomial_subtract_domain(
6283                 __isl_take isl_pw_qpolynomial *pwpq,
6284                 __isl_take isl_set *set);
6285         __isl_give isl_pw_qpolynomial_fold *
6286         isl_pw_qpolynomial_fold_subtract_domain(
6287                 __isl_take isl_pw_qpolynomial_fold *pwf,
6288                 __isl_take isl_set *set);
6289         __isl_give isl_union_pw_qpolynomial *
6290         isl_union_pw_qpolynomial_subtract_domain(
6291                 __isl_take isl_union_pw_qpolynomial *upwpq,
6292                 __isl_take isl_union_set *uset);
6293         __isl_give isl_union_pw_qpolynomial_fold *
6294         isl_union_pw_qpolynomial_fold_subtract_domain(
6295                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6296                 __isl_take isl_union_set *uset);
6298 =item * Application
6300         #include <isl/space.h>
6301         __isl_give isl_space *isl_space_join(
6302                 __isl_take isl_space *left,
6303                 __isl_take isl_space *right);
6305         #include <isl/map.h>
6306         __isl_give isl_basic_set *isl_basic_set_apply(
6307                 __isl_take isl_basic_set *bset,
6308                 __isl_take isl_basic_map *bmap);
6309         __isl_give isl_set *isl_set_apply(
6310                 __isl_take isl_set *set,
6311                 __isl_take isl_map *map);
6312         __isl_give isl_union_set *isl_union_set_apply(
6313                 __isl_take isl_union_set *uset,
6314                 __isl_take isl_union_map *umap);
6315         __isl_give isl_basic_map *isl_basic_map_apply_domain(
6316                 __isl_take isl_basic_map *bmap1,
6317                 __isl_take isl_basic_map *bmap2);
6318         __isl_give isl_basic_map *isl_basic_map_apply_range(
6319                 __isl_take isl_basic_map *bmap1,
6320                 __isl_take isl_basic_map *bmap2);
6321         __isl_give isl_map *isl_map_apply_domain(
6322                 __isl_take isl_map *map1,
6323                 __isl_take isl_map *map2);
6324         __isl_give isl_map *isl_map_apply_range(
6325                 __isl_take isl_map *map1,
6326                 __isl_take isl_map *map2);
6328         #include <isl/union_map.h>
6329         __isl_give isl_union_map *isl_union_map_apply_domain(
6330                 __isl_take isl_union_map *umap1,
6331                 __isl_take isl_union_map *umap2);
6332         __isl_give isl_union_map *isl_union_map_apply_range(
6333                 __isl_take isl_union_map *umap1,
6334                 __isl_take isl_union_map *umap2);
6336         #include <isl/aff.h>
6337         __isl_give isl_union_pw_aff *
6338         isl_multi_union_pw_aff_apply_aff(
6339                 __isl_take isl_multi_union_pw_aff *mupa,
6340                 __isl_take isl_aff *aff);
6341         __isl_give isl_union_pw_aff *
6342         isl_multi_union_pw_aff_apply_pw_aff(
6343                 __isl_take isl_multi_union_pw_aff *mupa,
6344                 __isl_take isl_pw_aff *pa);
6345         __isl_give isl_multi_union_pw_aff *
6346         isl_multi_union_pw_aff_apply_multi_aff(
6347                 __isl_take isl_multi_union_pw_aff *mupa,
6348                 __isl_take isl_multi_aff *ma);
6349         __isl_give isl_multi_union_pw_aff *
6350         isl_multi_union_pw_aff_apply_pw_multi_aff(
6351                 __isl_take isl_multi_union_pw_aff *mupa,
6352                 __isl_take isl_pw_multi_aff *pma);
6354 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
6355 over the shared domain of the elements of the input.  The dimension is
6356 required to be greater than zero.
6357 The C<isl_multi_union_pw_aff> argument of
6358 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
6359 but only if the range of the C<isl_multi_aff> argument
6360 is also zero-dimensional.
6361 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
6363         #include <isl/polynomial.h>
6364         __isl_give isl_pw_qpolynomial_fold *
6365         isl_set_apply_pw_qpolynomial_fold(
6366                 __isl_take isl_set *set,
6367                 __isl_take isl_pw_qpolynomial_fold *pwf,
6368                 int *tight);
6369         __isl_give isl_pw_qpolynomial_fold *
6370         isl_map_apply_pw_qpolynomial_fold(
6371                 __isl_take isl_map *map,
6372                 __isl_take isl_pw_qpolynomial_fold *pwf,
6373                 int *tight);
6374         __isl_give isl_union_pw_qpolynomial_fold *
6375         isl_union_set_apply_union_pw_qpolynomial_fold(
6376                 __isl_take isl_union_set *uset,
6377                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6378                 int *tight);
6379         __isl_give isl_union_pw_qpolynomial_fold *
6380         isl_union_map_apply_union_pw_qpolynomial_fold(
6381                 __isl_take isl_union_map *umap,
6382                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6383                 int *tight);
6385 The functions taking a map
6386 compose the given map with the given piecewise quasipolynomial reduction.
6387 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
6388 over all elements in the intersection of the range of the map
6389 and the domain of the piecewise quasipolynomial reduction
6390 as a function of an element in the domain of the map.
6391 The functions taking a set compute a bound over all elements in the
6392 intersection of the set and the domain of the
6393 piecewise quasipolynomial reduction.
6395 =item * Preimage
6397         #include <isl/set.h>
6398         __isl_give isl_basic_set *
6399         isl_basic_set_preimage_multi_aff(
6400                 __isl_take isl_basic_set *bset,
6401                 __isl_take isl_multi_aff *ma);
6402         __isl_give isl_set *isl_set_preimage_multi_aff(
6403                 __isl_take isl_set *set,
6404                 __isl_take isl_multi_aff *ma);
6405         __isl_give isl_set *isl_set_preimage_pw_multi_aff(
6406                 __isl_take isl_set *set,
6407                 __isl_take isl_pw_multi_aff *pma);
6408         __isl_give isl_set *isl_set_preimage_multi_pw_aff(
6409                 __isl_take isl_set *set,
6410                 __isl_take isl_multi_pw_aff *mpa);
6412         #include <isl/union_set.h>
6413         __isl_give isl_union_set *
6414         isl_union_set_preimage_multi_aff(
6415                 __isl_take isl_union_set *uset,
6416                 __isl_take isl_multi_aff *ma);
6417         __isl_give isl_union_set *
6418         isl_union_set_preimage_pw_multi_aff(
6419                 __isl_take isl_union_set *uset,
6420                 __isl_take isl_pw_multi_aff *pma);
6421         __isl_give isl_union_set *
6422         isl_union_set_preimage_union_pw_multi_aff(
6423                 __isl_take isl_union_set *uset,
6424                 __isl_take isl_union_pw_multi_aff *upma);
6426         #include <isl/map.h>
6427         __isl_give isl_basic_map *
6428         isl_basic_map_preimage_domain_multi_aff(
6429                 __isl_take isl_basic_map *bmap,
6430                 __isl_take isl_multi_aff *ma);
6431         __isl_give isl_map *isl_map_preimage_domain_multi_aff(
6432                 __isl_take isl_map *map,
6433                 __isl_take isl_multi_aff *ma);
6434         __isl_give isl_map *isl_map_preimage_range_multi_aff(
6435                 __isl_take isl_map *map,
6436                 __isl_take isl_multi_aff *ma);
6437         __isl_give isl_map *
6438         isl_map_preimage_domain_pw_multi_aff(
6439                 __isl_take isl_map *map,
6440                 __isl_take isl_pw_multi_aff *pma);
6441         __isl_give isl_map *
6442         isl_map_preimage_range_pw_multi_aff(
6443                 __isl_take isl_map *map,
6444                 __isl_take isl_pw_multi_aff *pma);
6445         __isl_give isl_map *
6446         isl_map_preimage_domain_multi_pw_aff(
6447                 __isl_take isl_map *map,
6448                 __isl_take isl_multi_pw_aff *mpa);
6449         __isl_give isl_basic_map *
6450         isl_basic_map_preimage_range_multi_aff(
6451                 __isl_take isl_basic_map *bmap,
6452                 __isl_take isl_multi_aff *ma);
6454         #include <isl/union_map.h>
6455         __isl_give isl_union_map *
6456         isl_union_map_preimage_domain_multi_aff(
6457                 __isl_take isl_union_map *umap,
6458                 __isl_take isl_multi_aff *ma);
6459         __isl_give isl_union_map *
6460         isl_union_map_preimage_range_multi_aff(
6461                 __isl_take isl_union_map *umap,
6462                 __isl_take isl_multi_aff *ma);
6463         __isl_give isl_union_map *
6464         isl_union_map_preimage_domain_pw_multi_aff(
6465                 __isl_take isl_union_map *umap,
6466                 __isl_take isl_pw_multi_aff *pma);
6467         __isl_give isl_union_map *
6468         isl_union_map_preimage_range_pw_multi_aff(
6469                 __isl_take isl_union_map *umap,
6470                 __isl_take isl_pw_multi_aff *pma);
6471         __isl_give isl_union_map *
6472         isl_union_map_preimage_domain_union_pw_multi_aff(
6473                 __isl_take isl_union_map *umap,
6474                 __isl_take isl_union_pw_multi_aff *upma);
6475         __isl_give isl_union_map *
6476         isl_union_map_preimage_range_union_pw_multi_aff(
6477                 __isl_take isl_union_map *umap,
6478                 __isl_take isl_union_pw_multi_aff *upma);
6480 These functions compute the preimage of the given set or map domain/range under
6481 the given function.  In other words, the expression is plugged
6482 into the set description or into the domain/range of the map.
6484 =item * Pullback
6486         #include <isl/aff.h>
6487         __isl_give isl_aff *isl_aff_pullback_aff(
6488                 __isl_take isl_aff *aff1,
6489                 __isl_take isl_aff *aff2);
6490         __isl_give isl_aff *isl_aff_pullback_multi_aff(
6491                 __isl_take isl_aff *aff,
6492                 __isl_take isl_multi_aff *ma);
6493         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
6494                 __isl_take isl_pw_aff *pa,
6495                 __isl_take isl_multi_aff *ma);
6496         __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
6497                 __isl_take isl_pw_aff *pa,
6498                 __isl_take isl_pw_multi_aff *pma);
6499         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
6500                 __isl_take isl_pw_aff *pa,
6501                 __isl_take isl_multi_pw_aff *mpa);
6502         __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
6503                 __isl_take isl_multi_aff *ma1,
6504                 __isl_take isl_multi_aff *ma2);
6505         __isl_give isl_pw_multi_aff *
6506         isl_pw_multi_aff_pullback_multi_aff(
6507                 __isl_take isl_pw_multi_aff *pma,
6508                 __isl_take isl_multi_aff *ma);
6509         __isl_give isl_multi_pw_aff *
6510         isl_multi_pw_aff_pullback_multi_aff(
6511                 __isl_take isl_multi_pw_aff *mpa,
6512                 __isl_take isl_multi_aff *ma);
6513         __isl_give isl_pw_multi_aff *
6514         isl_pw_multi_aff_pullback_pw_multi_aff(
6515                 __isl_take isl_pw_multi_aff *pma1,
6516                 __isl_take isl_pw_multi_aff *pma2);
6517         __isl_give isl_multi_pw_aff *
6518         isl_multi_pw_aff_pullback_pw_multi_aff(
6519                 __isl_take isl_multi_pw_aff *mpa,
6520                 __isl_take isl_pw_multi_aff *pma);
6521         __isl_give isl_multi_pw_aff *
6522         isl_multi_pw_aff_pullback_multi_pw_aff(
6523                 __isl_take isl_multi_pw_aff *mpa1,
6524                 __isl_take isl_multi_pw_aff *mpa2);
6525         __isl_give isl_union_pw_aff *
6526         isl_union_pw_aff_pullback_union_pw_multi_aff(
6527                 __isl_take isl_union_pw_aff *upa,
6528                 __isl_take isl_union_pw_multi_aff *upma);
6529         __isl_give isl_union_pw_multi_aff *
6530         isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
6531                 __isl_take isl_union_pw_multi_aff *upma1,
6532                 __isl_take isl_union_pw_multi_aff *upma2);
6533         __isl_give isl_multi_union_pw_aff *
6534         isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
6535                 __isl_take isl_multi_union_pw_aff *mupa,
6536                 __isl_take isl_union_pw_multi_aff *upma);
6538 These functions precompose the first expression by the second function.
6539 In other words, the second function is plugged
6540 into the first expression.
6542 =item * Locus
6544         #include <isl/aff.h>
6545         __isl_give isl_basic_set *isl_aff_eq_basic_set(
6546                 __isl_take isl_aff *aff1,
6547                 __isl_take isl_aff *aff2);
6548         __isl_give isl_set *isl_aff_eq_set(
6549                 __isl_take isl_aff *aff1,
6550                 __isl_take isl_aff *aff2);
6551         __isl_give isl_set *isl_aff_ne_set(
6552                 __isl_take isl_aff *aff1,
6553                 __isl_take isl_aff *aff2);
6554         __isl_give isl_basic_set *isl_aff_le_basic_set(
6555                 __isl_take isl_aff *aff1,
6556                 __isl_take isl_aff *aff2);
6557         __isl_give isl_set *isl_aff_le_set(
6558                 __isl_take isl_aff *aff1,
6559                 __isl_take isl_aff *aff2);
6560         __isl_give isl_basic_set *isl_aff_lt_basic_set(
6561                 __isl_take isl_aff *aff1,
6562                 __isl_take isl_aff *aff2);
6563         __isl_give isl_set *isl_aff_lt_set(
6564                 __isl_take isl_aff *aff1,
6565                 __isl_take isl_aff *aff2);
6566         __isl_give isl_basic_set *isl_aff_ge_basic_set(
6567                 __isl_take isl_aff *aff1,
6568                 __isl_take isl_aff *aff2);
6569         __isl_give isl_set *isl_aff_ge_set(
6570                 __isl_take isl_aff *aff1,
6571                 __isl_take isl_aff *aff2);
6572         __isl_give isl_basic_set *isl_aff_gt_basic_set(
6573                 __isl_take isl_aff *aff1,
6574                 __isl_take isl_aff *aff2);
6575         __isl_give isl_set *isl_aff_gt_set(
6576                 __isl_take isl_aff *aff1,
6577                 __isl_take isl_aff *aff2);
6578         __isl_give isl_set *isl_pw_aff_eq_set(
6579                 __isl_take isl_pw_aff *pwaff1,
6580                 __isl_take isl_pw_aff *pwaff2);
6581         __isl_give isl_set *isl_pw_aff_ne_set(
6582                 __isl_take isl_pw_aff *pwaff1,
6583                 __isl_take isl_pw_aff *pwaff2);
6584         __isl_give isl_set *isl_pw_aff_le_set(
6585                 __isl_take isl_pw_aff *pwaff1,
6586                 __isl_take isl_pw_aff *pwaff2);
6587         __isl_give isl_set *isl_pw_aff_lt_set(
6588                 __isl_take isl_pw_aff *pwaff1,
6589                 __isl_take isl_pw_aff *pwaff2);
6590         __isl_give isl_set *isl_pw_aff_ge_set(
6591                 __isl_take isl_pw_aff *pwaff1,
6592                 __isl_take isl_pw_aff *pwaff2);
6593         __isl_give isl_set *isl_pw_aff_gt_set(
6594                 __isl_take isl_pw_aff *pwaff1,
6595                 __isl_take isl_pw_aff *pwaff2);
6597         __isl_give isl_set *isl_multi_aff_lex_le_set(
6598                 __isl_take isl_multi_aff *ma1,
6599                 __isl_take isl_multi_aff *ma2);
6600         __isl_give isl_set *isl_multi_aff_lex_lt_set(
6601                 __isl_take isl_multi_aff *ma1,
6602                 __isl_take isl_multi_aff *ma2);
6603         __isl_give isl_set *isl_multi_aff_lex_ge_set(
6604                 __isl_take isl_multi_aff *ma1,
6605                 __isl_take isl_multi_aff *ma2);
6606         __isl_give isl_set *isl_multi_aff_lex_gt_set(
6607                 __isl_take isl_multi_aff *ma1,
6608                 __isl_take isl_multi_aff *ma2);
6610         __isl_give isl_set *isl_pw_aff_list_eq_set(
6611                 __isl_take isl_pw_aff_list *list1,
6612                 __isl_take isl_pw_aff_list *list2);
6613         __isl_give isl_set *isl_pw_aff_list_ne_set(
6614                 __isl_take isl_pw_aff_list *list1,
6615                 __isl_take isl_pw_aff_list *list2);
6616         __isl_give isl_set *isl_pw_aff_list_le_set(
6617                 __isl_take isl_pw_aff_list *list1,
6618                 __isl_take isl_pw_aff_list *list2);
6619         __isl_give isl_set *isl_pw_aff_list_lt_set(
6620                 __isl_take isl_pw_aff_list *list1,
6621                 __isl_take isl_pw_aff_list *list2);
6622         __isl_give isl_set *isl_pw_aff_list_ge_set(
6623                 __isl_take isl_pw_aff_list *list1,
6624                 __isl_take isl_pw_aff_list *list2);
6625         __isl_give isl_set *isl_pw_aff_list_gt_set(
6626                 __isl_take isl_pw_aff_list *list1,
6627                 __isl_take isl_pw_aff_list *list2);
6629 The function C<isl_aff_ge_basic_set> returns a basic set
6630 containing those elements in the shared space
6631 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
6632 The function C<isl_pw_aff_ge_set> returns a set
6633 containing those elements in the shared domain
6634 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
6635 greater than or equal to C<pwaff2>.
6636 The function C<isl_multi_aff_lex_le_set> returns a set
6637 containing those elements in the shared domain space
6638 where C<ma1> is lexicographically smaller than or
6639 equal to C<ma2>.
6640 The functions operating on C<isl_pw_aff_list> apply the corresponding
6641 C<isl_pw_aff> function to each pair of elements in the two lists.
6643         #include <isl/aff.h>
6644         __isl_give isl_map *isl_pw_aff_eq_map(
6645                 __isl_take isl_pw_aff *pa1,
6646                 __isl_take isl_pw_aff *pa2);
6647         __isl_give isl_map *isl_pw_aff_lt_map(
6648                 __isl_take isl_pw_aff *pa1,
6649                 __isl_take isl_pw_aff *pa2);
6650         __isl_give isl_map *isl_pw_aff_gt_map(
6651                 __isl_take isl_pw_aff *pa1,
6652                 __isl_take isl_pw_aff *pa2);
6654         __isl_give isl_map *isl_multi_pw_aff_eq_map(
6655                 __isl_take isl_multi_pw_aff *mpa1,
6656                 __isl_take isl_multi_pw_aff *mpa2);
6657         __isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
6658                 __isl_take isl_multi_pw_aff *mpa1,
6659                 __isl_take isl_multi_pw_aff *mpa2);
6660         __isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
6661                 __isl_take isl_multi_pw_aff *mpa1,
6662                 __isl_take isl_multi_pw_aff *mpa2);
6664 These functions return a map between domain elements of the arguments
6665 where the function values satisfy the given relation.
6667         #include <isl/union_map.h>
6668         __isl_give isl_union_map *
6669         isl_union_map_eq_at_multi_union_pw_aff(
6670                 __isl_take isl_union_map *umap,
6671                 __isl_take isl_multi_union_pw_aff *mupa);
6672         __isl_give isl_union_map *
6673         isl_union_map_lex_lt_at_multi_union_pw_aff(
6674                 __isl_take isl_union_map *umap,
6675                 __isl_take isl_multi_union_pw_aff *mupa);
6676         __isl_give isl_union_map *
6677         isl_union_map_lex_gt_at_multi_union_pw_aff(
6678                 __isl_take isl_union_map *umap,
6679                 __isl_take isl_multi_union_pw_aff *mupa);
6681 These functions select the subset of elements in the union map
6682 that have an equal or lexicographically smaller function value.
6684 =item * Cartesian Product
6686         #include <isl/space.h>
6687         __isl_give isl_space *isl_space_product(
6688                 __isl_take isl_space *space1,
6689                 __isl_take isl_space *space2);
6690         __isl_give isl_space *isl_space_domain_product(
6691                 __isl_take isl_space *space1,
6692                 __isl_take isl_space *space2);
6693         __isl_give isl_space *isl_space_range_product(
6694                 __isl_take isl_space *space1,
6695                 __isl_take isl_space *space2);
6697 The functions
6698 C<isl_space_product>, C<isl_space_domain_product>
6699 and C<isl_space_range_product> take pairs or relation spaces and
6700 produce a single relations space, where either the domain, the range
6701 or both domain and range are wrapped spaces of relations between
6702 the domains and/or ranges of the input spaces.
6703 If the product is only constructed over the domain or the range
6704 then the ranges or the domains of the inputs should be the same.
6705 The function C<isl_space_product> also accepts a pair of set spaces,
6706 in which case it returns a wrapped space of a relation between the
6707 two input spaces.
6709         #include <isl/set.h>
6710         __isl_give isl_set *isl_set_product(
6711                 __isl_take isl_set *set1,
6712                 __isl_take isl_set *set2);
6714         #include <isl/map.h>
6715         __isl_give isl_basic_map *isl_basic_map_domain_product(
6716                 __isl_take isl_basic_map *bmap1,
6717                 __isl_take isl_basic_map *bmap2);
6718         __isl_give isl_basic_map *isl_basic_map_range_product(
6719                 __isl_take isl_basic_map *bmap1,
6720                 __isl_take isl_basic_map *bmap2);
6721         __isl_give isl_basic_map *isl_basic_map_product(
6722                 __isl_take isl_basic_map *bmap1,
6723                 __isl_take isl_basic_map *bmap2);
6724         __isl_give isl_map *isl_map_domain_product(
6725                 __isl_take isl_map *map1,
6726                 __isl_take isl_map *map2);
6727         __isl_give isl_map *isl_map_range_product(
6728                 __isl_take isl_map *map1,
6729                 __isl_take isl_map *map2);
6730         __isl_give isl_map *isl_map_product(
6731                 __isl_take isl_map *map1,
6732                 __isl_take isl_map *map2);
6734         #include <isl/union_set.h>
6735         __isl_give isl_union_set *isl_union_set_product(
6736                 __isl_take isl_union_set *uset1,
6737                 __isl_take isl_union_set *uset2);
6739         #include <isl/union_map.h>
6740         __isl_give isl_union_map *isl_union_map_domain_product(
6741                 __isl_take isl_union_map *umap1,
6742                 __isl_take isl_union_map *umap2);
6743         __isl_give isl_union_map *isl_union_map_range_product(
6744                 __isl_take isl_union_map *umap1,
6745                 __isl_take isl_union_map *umap2);
6746         __isl_give isl_union_map *isl_union_map_product(
6747                 __isl_take isl_union_map *umap1,
6748                 __isl_take isl_union_map *umap2);
6750         #include <isl/val.h>
6751         __isl_give isl_multi_val *isl_multi_val_range_product(
6752                 __isl_take isl_multi_val *mv1,
6753                 __isl_take isl_multi_val *mv2);
6754         __isl_give isl_multi_val *isl_multi_val_product(
6755                 __isl_take isl_multi_val *mv1,
6756                 __isl_take isl_multi_val *mv2);
6758         #include <isl/aff.h>
6759         __isl_give isl_multi_aff *isl_multi_aff_range_product(
6760                 __isl_take isl_multi_aff *ma1,
6761                 __isl_take isl_multi_aff *ma2);
6762         __isl_give isl_multi_aff *isl_multi_aff_product(
6763                 __isl_take isl_multi_aff *ma1,
6764                 __isl_take isl_multi_aff *ma2);
6765         __isl_give isl_multi_pw_aff *
6766         isl_multi_pw_aff_range_product(
6767                 __isl_take isl_multi_pw_aff *mpa1,
6768                 __isl_take isl_multi_pw_aff *mpa2);
6769         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
6770                 __isl_take isl_multi_pw_aff *mpa1,
6771                 __isl_take isl_multi_pw_aff *mpa2);
6772         __isl_give isl_pw_multi_aff *
6773         isl_pw_multi_aff_range_product(
6774                 __isl_take isl_pw_multi_aff *pma1,
6775                 __isl_take isl_pw_multi_aff *pma2);
6776         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
6777                 __isl_take isl_pw_multi_aff *pma1,
6778                 __isl_take isl_pw_multi_aff *pma2);
6779         __isl_give isl_multi_union_pw_aff *
6780         isl_multi_union_pw_aff_range_product(
6781                 __isl_take isl_multi_union_pw_aff *mupa1,
6782                 __isl_take isl_multi_union_pw_aff *mupa2);
6784 The above functions compute the cross product of the given
6785 sets, relations or functions.  The domains and ranges of the results
6786 are wrapped maps between domains and ranges of the inputs.
6787 To obtain a ``flat'' product, use the following functions
6788 instead.
6790         #include <isl/set.h>
6791         __isl_give isl_basic_set *isl_basic_set_flat_product(
6792                 __isl_take isl_basic_set *bset1,
6793                 __isl_take isl_basic_set *bset2);
6794         __isl_give isl_set *isl_set_flat_product(
6795                 __isl_take isl_set *set1,
6796                 __isl_take isl_set *set2);
6798         #include <isl/map.h>
6799         __isl_give isl_basic_map *isl_basic_map_flat_range_product(
6800                 __isl_take isl_basic_map *bmap1,
6801                 __isl_take isl_basic_map *bmap2);
6802         __isl_give isl_map *isl_map_flat_domain_product(
6803                 __isl_take isl_map *map1,
6804                 __isl_take isl_map *map2);
6805         __isl_give isl_map *isl_map_flat_range_product(
6806                 __isl_take isl_map *map1,
6807                 __isl_take isl_map *map2);
6808         __isl_give isl_basic_map *isl_basic_map_flat_product(
6809                 __isl_take isl_basic_map *bmap1,
6810                 __isl_take isl_basic_map *bmap2);
6811         __isl_give isl_map *isl_map_flat_product(
6812                 __isl_take isl_map *map1,
6813                 __isl_take isl_map *map2);
6815         #include <isl/union_map.h>
6816         __isl_give isl_union_map *
6817         isl_union_map_flat_domain_product(
6818                 __isl_take isl_union_map *umap1,
6819                 __isl_take isl_union_map *umap2);
6820         __isl_give isl_union_map *
6821         isl_union_map_flat_range_product(
6822                 __isl_take isl_union_map *umap1,
6823                 __isl_take isl_union_map *umap2);
6825         #include <isl/val.h>
6826         __isl_give isl_multi_val *isl_multi_val_flat_range_product(
6827                 __isl_take isl_multi_val *mv1,
6828                 __isl_take isl_multi_aff *mv2);
6830         #include <isl/aff.h>
6831         __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
6832                 __isl_take isl_multi_aff *ma1,
6833                 __isl_take isl_multi_aff *ma2);
6834         __isl_give isl_pw_multi_aff *
6835         isl_pw_multi_aff_flat_range_product(
6836                 __isl_take isl_pw_multi_aff *pma1,
6837                 __isl_take isl_pw_multi_aff *pma2);
6838         __isl_give isl_multi_pw_aff *
6839         isl_multi_pw_aff_flat_range_product(
6840                 __isl_take isl_multi_pw_aff *mpa1,
6841                 __isl_take isl_multi_pw_aff *mpa2);
6842         __isl_give isl_union_pw_multi_aff *
6843         isl_union_pw_multi_aff_flat_range_product(
6844                 __isl_take isl_union_pw_multi_aff *upma1,
6845                 __isl_take isl_union_pw_multi_aff *upma2);
6846         __isl_give isl_multi_union_pw_aff *
6847         isl_multi_union_pw_aff_flat_range_product(
6848                 __isl_take isl_multi_union_pw_aff *mupa1,
6849                 __isl_take isl_multi_union_pw_aff *mupa2);
6851         #include <isl/space.h>
6852         __isl_give isl_space *isl_space_factor_domain(
6853                 __isl_take isl_space *space);
6854         __isl_give isl_space *isl_space_factor_range(
6855                 __isl_take isl_space *space);
6856         __isl_give isl_space *isl_space_domain_factor_domain(
6857                 __isl_take isl_space *space);
6858         __isl_give isl_space *isl_space_domain_factor_range(
6859                 __isl_take isl_space *space);
6860         __isl_give isl_space *isl_space_range_factor_domain(
6861                 __isl_take isl_space *space);
6862         __isl_give isl_space *isl_space_range_factor_range(
6863                 __isl_take isl_space *space);
6865 The functions C<isl_space_range_factor_domain> and
6866 C<isl_space_range_factor_range> extract the two arguments from
6867 the result of a call to C<isl_space_range_product>.
6869 The arguments of a call to a product can be extracted
6870 from the result using the following functions.
6872         #include <isl/map.h>
6873         __isl_give isl_map *isl_map_factor_domain(
6874                 __isl_take isl_map *map);
6875         __isl_give isl_map *isl_map_factor_range(
6876                 __isl_take isl_map *map);
6877         __isl_give isl_map *isl_map_domain_factor_domain(
6878                 __isl_take isl_map *map);
6879         __isl_give isl_map *isl_map_domain_factor_range(
6880                 __isl_take isl_map *map);
6881         __isl_give isl_map *isl_map_range_factor_domain(
6882                 __isl_take isl_map *map);
6883         __isl_give isl_map *isl_map_range_factor_range(
6884                 __isl_take isl_map *map);
6886         #include <isl/union_map.h>
6887         __isl_give isl_union_map *isl_union_map_factor_domain(
6888                 __isl_take isl_union_map *umap);
6889         __isl_give isl_union_map *isl_union_map_factor_range(
6890                 __isl_take isl_union_map *umap);
6891         __isl_give isl_union_map *
6892         isl_union_map_domain_factor_domain(
6893                 __isl_take isl_union_map *umap);
6894         __isl_give isl_union_map *
6895         isl_union_map_domain_factor_range(
6896                 __isl_take isl_union_map *umap);
6897         __isl_give isl_union_map *
6898         isl_union_map_range_factor_domain(
6899                 __isl_take isl_union_map *umap);
6900         __isl_give isl_union_map *
6901         isl_union_map_range_factor_range(
6902                 __isl_take isl_union_map *umap);
6904         #include <isl/val.h>
6905         __isl_give isl_multi_val *isl_multi_val_factor_range(
6906                 __isl_take isl_multi_val *mv);
6907         __isl_give isl_multi_val *
6908         isl_multi_val_range_factor_domain(
6909                 __isl_take isl_multi_val *mv);
6910         __isl_give isl_multi_val *
6911         isl_multi_val_range_factor_range(
6912                 __isl_take isl_multi_val *mv);
6914         #include <isl/aff.h>
6915         __isl_give isl_multi_aff *isl_multi_aff_factor_range(
6916                 __isl_take isl_multi_aff *ma);
6917         __isl_give isl_multi_aff *
6918         isl_multi_aff_range_factor_domain(
6919                 __isl_take isl_multi_aff *ma);
6920         __isl_give isl_multi_aff *
6921         isl_multi_aff_range_factor_range(
6922                 __isl_take isl_multi_aff *ma);
6923         __isl_give isl_multi_pw_aff *
6924         isl_multi_pw_aff_factor_range(
6925                 __isl_take isl_multi_pw_aff *mpa);
6926         __isl_give isl_multi_pw_aff *
6927         isl_multi_pw_aff_range_factor_domain(
6928                 __isl_take isl_multi_pw_aff *mpa);
6929         __isl_give isl_multi_pw_aff *
6930         isl_multi_pw_aff_range_factor_range(
6931                 __isl_take isl_multi_pw_aff *mpa);
6932         __isl_give isl_multi_union_pw_aff *
6933         isl_multi_union_pw_aff_factor_range(
6934                 __isl_take isl_multi_union_pw_aff *mupa);
6935         __isl_give isl_multi_union_pw_aff *
6936         isl_multi_union_pw_aff_range_factor_domain(
6937                 __isl_take isl_multi_union_pw_aff *mupa);
6938         __isl_give isl_multi_union_pw_aff *
6939         isl_multi_union_pw_aff_range_factor_range(
6940                 __isl_take isl_multi_union_pw_aff *mupa);
6942 The splice functions are a generalization of the flat product functions,
6943 where the second argument may be inserted at any position inside
6944 the first argument rather than being placed at the end.
6945 The functions C<isl_multi_val_factor_range>,
6946 C<isl_multi_aff_factor_range>,
6947 C<isl_multi_pw_aff_factor_range> and
6948 C<isl_multi_union_pw_aff_factor_range>
6949 take functions that live in a set space.
6951         #include <isl/val.h>
6952         __isl_give isl_multi_val *isl_multi_val_range_splice(
6953                 __isl_take isl_multi_val *mv1, unsigned pos,
6954                 __isl_take isl_multi_val *mv2);
6956         #include <isl/aff.h>
6957         __isl_give isl_multi_aff *isl_multi_aff_range_splice(
6958                 __isl_take isl_multi_aff *ma1, unsigned pos,
6959                 __isl_take isl_multi_aff *ma2);
6960         __isl_give isl_multi_aff *isl_multi_aff_splice(
6961                 __isl_take isl_multi_aff *ma1,
6962                 unsigned in_pos, unsigned out_pos,
6963                 __isl_take isl_multi_aff *ma2);
6964         __isl_give isl_multi_pw_aff *
6965         isl_multi_pw_aff_range_splice(
6966                 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
6967                 __isl_take isl_multi_pw_aff *mpa2);
6968         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
6969                 __isl_take isl_multi_pw_aff *mpa1,
6970                 unsigned in_pos, unsigned out_pos,
6971                 __isl_take isl_multi_pw_aff *mpa2);
6972         __isl_give isl_multi_union_pw_aff *
6973         isl_multi_union_pw_aff_range_splice(
6974                 __isl_take isl_multi_union_pw_aff *mupa1,
6975                 unsigned pos,
6976                 __isl_take isl_multi_union_pw_aff *mupa2);
6978 =item * Simplification
6980 When applied to a set or relation,
6981 the gist operation returns a set or relation that has the
6982 same intersection with the context as the input set or relation.
6983 Any implicit equality in the intersection is made explicit in the result,
6984 while all inequalities that are redundant with respect to the intersection
6985 are removed.
6986 In case of union sets and relations, the gist operation is performed
6987 per space.
6989 When applied to a function,
6990 the gist operation applies the set gist operation to each of
6991 the cells in the domain of the input piecewise expression.
6992 The context is also exploited
6993 to simplify the expression associated to each cell.
6995         #include <isl/set.h>
6996         __isl_give isl_basic_set *isl_basic_set_gist(
6997                 __isl_take isl_basic_set *bset,
6998                 __isl_take isl_basic_set *context);
6999         __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
7000                 __isl_take isl_set *context);
7001         __isl_give isl_set *isl_set_gist_params(
7002                 __isl_take isl_set *set,
7003                 __isl_take isl_set *context);
7005         #include <isl/map.h>
7006         __isl_give isl_basic_map *isl_basic_map_gist(
7007                 __isl_take isl_basic_map *bmap,
7008                 __isl_take isl_basic_map *context);
7009         __isl_give isl_basic_map *isl_basic_map_gist_domain(
7010                 __isl_take isl_basic_map *bmap,
7011                 __isl_take isl_basic_set *context);
7012         __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
7013                 __isl_take isl_map *context);
7014         __isl_give isl_map *isl_map_gist_params(
7015                 __isl_take isl_map *map,
7016                 __isl_take isl_set *context);
7017         __isl_give isl_map *isl_map_gist_domain(
7018                 __isl_take isl_map *map,
7019                 __isl_take isl_set *context);
7020         __isl_give isl_map *isl_map_gist_range(
7021                 __isl_take isl_map *map,
7022                 __isl_take isl_set *context);
7024         #include <isl/union_set.h>
7025         __isl_give isl_union_set *isl_union_set_gist(
7026                 __isl_take isl_union_set *uset,
7027                 __isl_take isl_union_set *context);
7028         __isl_give isl_union_set *isl_union_set_gist_params(
7029                 __isl_take isl_union_set *uset,
7030                 __isl_take isl_set *set);
7032         #include <isl/union_map.h>
7033         __isl_give isl_union_map *isl_union_map_gist(
7034                 __isl_take isl_union_map *umap,
7035                 __isl_take isl_union_map *context);
7036         __isl_give isl_union_map *isl_union_map_gist_params(
7037                 __isl_take isl_union_map *umap,
7038                 __isl_take isl_set *set);
7039         __isl_give isl_union_map *isl_union_map_gist_domain(
7040                 __isl_take isl_union_map *umap,
7041                 __isl_take isl_union_set *uset);
7042         __isl_give isl_union_map *isl_union_map_gist_range(
7043                 __isl_take isl_union_map *umap,
7044                 __isl_take isl_union_set *uset);
7046         #include <isl/aff.h>
7047         __isl_give isl_aff *isl_aff_gist_params(
7048                 __isl_take isl_aff *aff,
7049                 __isl_take isl_set *context);
7050         __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
7051                 __isl_take isl_set *context);
7052         __isl_give isl_multi_aff *isl_multi_aff_gist_params(
7053                 __isl_take isl_multi_aff *maff,
7054                 __isl_take isl_set *context);
7055         __isl_give isl_multi_aff *isl_multi_aff_gist(
7056                 __isl_take isl_multi_aff *maff,
7057                 __isl_take isl_set *context);
7058         __isl_give isl_pw_aff *isl_pw_aff_gist_params(
7059                 __isl_take isl_pw_aff *pwaff,
7060                 __isl_take isl_set *context);
7061         __isl_give isl_pw_aff *isl_pw_aff_gist(
7062                 __isl_take isl_pw_aff *pwaff,
7063                 __isl_take isl_set *context);
7064         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
7065                 __isl_take isl_pw_multi_aff *pma,
7066                 __isl_take isl_set *set);
7067         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
7068                 __isl_take isl_pw_multi_aff *pma,
7069                 __isl_take isl_set *set);
7070         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
7071                 __isl_take isl_multi_pw_aff *mpa,
7072                 __isl_take isl_set *set);
7073         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
7074                 __isl_take isl_multi_pw_aff *mpa,
7075                 __isl_take isl_set *set);
7076         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
7077                 __isl_take isl_union_pw_aff *upa,
7078                 __isl_take isl_union_set *context);
7079         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
7080                 __isl_take isl_union_pw_aff *upa,
7081                 __isl_take isl_set *context);
7082         __isl_give isl_union_pw_multi_aff *
7083         isl_union_pw_multi_aff_gist_params(
7084                 __isl_take isl_union_pw_multi_aff *upma,
7085                 __isl_take isl_set *context);
7086         __isl_give isl_union_pw_multi_aff *
7087         isl_union_pw_multi_aff_gist(
7088                 __isl_take isl_union_pw_multi_aff *upma,
7089                 __isl_take isl_union_set *context);
7090         __isl_give isl_multi_union_pw_aff *
7091         isl_multi_union_pw_aff_gist_params(
7092                 __isl_take isl_multi_union_pw_aff *aff,
7093                 __isl_take isl_set *context);
7094         __isl_give isl_multi_union_pw_aff *
7095         isl_multi_union_pw_aff_gist(
7096                 __isl_take isl_multi_union_pw_aff *aff,
7097                 __isl_take isl_union_set *context);
7099         #include <isl/polynomial.h>
7100         __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
7101                 __isl_take isl_qpolynomial *qp,
7102                 __isl_take isl_set *context);
7103         __isl_give isl_qpolynomial *isl_qpolynomial_gist(
7104                 __isl_take isl_qpolynomial *qp,
7105                 __isl_take isl_set *context);
7106         __isl_give isl_qpolynomial_fold *
7107         isl_qpolynomial_fold_gist_params(
7108                 __isl_take isl_qpolynomial_fold *fold,
7109                 __isl_take isl_set *context);
7110         __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
7111                 __isl_take isl_qpolynomial_fold *fold,
7112                 __isl_take isl_set *context);
7113         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
7114                 __isl_take isl_pw_qpolynomial *pwqp,
7115                 __isl_take isl_set *context);
7116         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
7117                 __isl_take isl_pw_qpolynomial *pwqp,
7118                 __isl_take isl_set *context);
7119         __isl_give isl_pw_qpolynomial_fold *
7120         isl_pw_qpolynomial_fold_gist(
7121                 __isl_take isl_pw_qpolynomial_fold *pwf,
7122                 __isl_take isl_set *context);
7123         __isl_give isl_pw_qpolynomial_fold *
7124         isl_pw_qpolynomial_fold_gist_params(
7125                 __isl_take isl_pw_qpolynomial_fold *pwf,
7126                 __isl_take isl_set *context);
7127         __isl_give isl_union_pw_qpolynomial *
7128         isl_union_pw_qpolynomial_gist_params(
7129                 __isl_take isl_union_pw_qpolynomial *upwqp,
7130                 __isl_take isl_set *context);
7131         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
7132                 __isl_take isl_union_pw_qpolynomial *upwqp,
7133                 __isl_take isl_union_set *context);
7134         __isl_give isl_union_pw_qpolynomial_fold *
7135         isl_union_pw_qpolynomial_fold_gist(
7136                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7137                 __isl_take isl_union_set *context);
7138         __isl_give isl_union_pw_qpolynomial_fold *
7139         isl_union_pw_qpolynomial_fold_gist_params(
7140                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7141                 __isl_take isl_set *context);
7143 =item * Binary Arithmetic Operations
7145         #include <isl/set.h>
7146         __isl_give isl_set *isl_set_sum(
7147                 __isl_take isl_set *set1,
7148                 __isl_take isl_set *set2);
7149         #include <isl/map.h>
7150         __isl_give isl_map *isl_map_sum(
7151                 __isl_take isl_map *map1,
7152                 __isl_take isl_map *map2);
7154 C<isl_set_sum> computes the Minkowski sum of its two arguments,
7155 i.e., the set containing the sums of pairs of elements from
7156 C<set1> and C<set2>.
7157 The domain of the result of C<isl_map_sum> is the intersection
7158 of the domains of its two arguments.  The corresponding range
7159 elements are the sums of the corresponding range elements
7160 in the two arguments.
7162         #include <isl/val.h>
7163         __isl_give isl_multi_val *isl_multi_val_add(
7164                 __isl_take isl_multi_val *mv1,
7165                 __isl_take isl_multi_val *mv2);
7166         __isl_give isl_multi_val *isl_multi_val_sub(
7167                 __isl_take isl_multi_val *mv1,
7168                 __isl_take isl_multi_val *mv2);
7170         #include <isl/aff.h>
7171         __isl_give isl_aff *isl_aff_add(
7172                 __isl_take isl_aff *aff1,
7173                 __isl_take isl_aff *aff2);
7174         __isl_give isl_multi_aff *isl_multi_aff_add(
7175                 __isl_take isl_multi_aff *maff1,
7176                 __isl_take isl_multi_aff *maff2);
7177         __isl_give isl_pw_aff *isl_pw_aff_add(
7178                 __isl_take isl_pw_aff *pwaff1,
7179                 __isl_take isl_pw_aff *pwaff2);
7180         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add(
7181                 __isl_take isl_multi_pw_aff *mpa1,
7182                 __isl_take isl_multi_pw_aff *mpa2);
7183         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
7184                 __isl_take isl_pw_multi_aff *pma1,
7185                 __isl_take isl_pw_multi_aff *pma2);
7186         __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
7187                 __isl_take isl_union_pw_aff *upa1,
7188                 __isl_take isl_union_pw_aff *upa2);
7189         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
7190                 __isl_take isl_union_pw_multi_aff *upma1,
7191                 __isl_take isl_union_pw_multi_aff *upma2);
7192         __isl_give isl_multi_union_pw_aff *
7193         isl_multi_union_pw_aff_add(
7194                 __isl_take isl_multi_union_pw_aff *mupa1,
7195                 __isl_take isl_multi_union_pw_aff *mupa2);
7196         __isl_give isl_pw_aff *isl_pw_aff_min(
7197                 __isl_take isl_pw_aff *pwaff1,
7198                 __isl_take isl_pw_aff *pwaff2);
7199         __isl_give isl_pw_aff *isl_pw_aff_max(
7200                 __isl_take isl_pw_aff *pwaff1,
7201                 __isl_take isl_pw_aff *pwaff2);
7202         __isl_give isl_aff *isl_aff_sub(
7203                 __isl_take isl_aff *aff1,
7204                 __isl_take isl_aff *aff2);
7205         __isl_give isl_multi_aff *isl_multi_aff_sub(
7206                 __isl_take isl_multi_aff *ma1,
7207                 __isl_take isl_multi_aff *ma2);
7208         __isl_give isl_pw_aff *isl_pw_aff_sub(
7209                 __isl_take isl_pw_aff *pwaff1,
7210                 __isl_take isl_pw_aff *pwaff2);
7211         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
7212                 __isl_take isl_multi_pw_aff *mpa1,
7213                 __isl_take isl_multi_pw_aff *mpa2);
7214         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
7215                 __isl_take isl_pw_multi_aff *pma1,
7216                 __isl_take isl_pw_multi_aff *pma2);
7217         __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
7218                 __isl_take isl_union_pw_aff *upa1,
7219                 __isl_take isl_union_pw_aff *upa2);
7220         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
7221                 __isl_take isl_union_pw_multi_aff *upma1,
7222                 __isl_take isl_union_pw_multi_aff *upma2);
7223         __isl_give isl_multi_union_pw_aff *
7224         isl_multi_union_pw_aff_sub(
7225                 __isl_take isl_multi_union_pw_aff *mupa1,
7226                 __isl_take isl_multi_union_pw_aff *mupa2);
7228 C<isl_aff_sub> subtracts the second argument from the first.
7230         #include <isl/polynomial.h>
7231         __isl_give isl_qpolynomial *isl_qpolynomial_add(
7232                 __isl_take isl_qpolynomial *qp1,
7233                 __isl_take isl_qpolynomial *qp2);
7234         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
7235                 __isl_take isl_pw_qpolynomial *pwqp1,
7236                 __isl_take isl_pw_qpolynomial *pwqp2);
7237         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
7238                 __isl_take isl_pw_qpolynomial *pwqp1,
7239                 __isl_take isl_pw_qpolynomial *pwqp2);
7240         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
7241                 __isl_take isl_pw_qpolynomial_fold *pwf1,
7242                 __isl_take isl_pw_qpolynomial_fold *pwf2);
7243         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
7244                 __isl_take isl_union_pw_qpolynomial *upwqp1,
7245                 __isl_take isl_union_pw_qpolynomial *upwqp2);
7246         __isl_give isl_qpolynomial *isl_qpolynomial_sub(
7247                 __isl_take isl_qpolynomial *qp1,
7248                 __isl_take isl_qpolynomial *qp2);
7249         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
7250                 __isl_take isl_pw_qpolynomial *pwqp1,
7251                 __isl_take isl_pw_qpolynomial *pwqp2);
7252         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
7253                 __isl_take isl_union_pw_qpolynomial *upwqp1,
7254                 __isl_take isl_union_pw_qpolynomial *upwqp2);
7255         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
7256                 __isl_take isl_pw_qpolynomial_fold *pwf1,
7257                 __isl_take isl_pw_qpolynomial_fold *pwf2);
7258         __isl_give isl_union_pw_qpolynomial_fold *
7259         isl_union_pw_qpolynomial_fold_fold(
7260                 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
7261                 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
7263         #include <isl/aff.h>
7264         __isl_give isl_pw_aff *isl_pw_aff_union_add(
7265                 __isl_take isl_pw_aff *pwaff1,
7266                 __isl_take isl_pw_aff *pwaff2);
7267         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
7268                 __isl_take isl_pw_multi_aff *pma1,
7269                 __isl_take isl_pw_multi_aff *pma2);
7270         __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
7271                 __isl_take isl_union_pw_aff *upa1,
7272                 __isl_take isl_union_pw_aff *upa2);
7273         __isl_give isl_union_pw_multi_aff *
7274         isl_union_pw_multi_aff_union_add(
7275                 __isl_take isl_union_pw_multi_aff *upma1,
7276                 __isl_take isl_union_pw_multi_aff *upma2);
7277         __isl_give isl_multi_union_pw_aff *
7278         isl_multi_union_pw_aff_union_add(
7279                 __isl_take isl_multi_union_pw_aff *mupa1,
7280                 __isl_take isl_multi_union_pw_aff *mupa2);
7281         __isl_give isl_pw_aff *isl_pw_aff_union_min(
7282                 __isl_take isl_pw_aff *pwaff1,
7283                 __isl_take isl_pw_aff *pwaff2);
7284         __isl_give isl_pw_aff *isl_pw_aff_union_max(
7285                 __isl_take isl_pw_aff *pwaff1,
7286                 __isl_take isl_pw_aff *pwaff2);
7288 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
7289 expression with a domain that is the union of those of C<pwaff1> and
7290 C<pwaff2> and such that on each cell, the quasi-affine expression is
7291 the maximum of those of C<pwaff1> and C<pwaff2>.  If only one of
7292 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
7293 associated expression is the defined one.
7294 This in contrast to the C<isl_pw_aff_max> function, which is
7295 only defined on the shared definition domain of the arguments.
7297         #include <isl/val.h>
7298         __isl_give isl_multi_val *isl_multi_val_add_val(
7299                 __isl_take isl_multi_val *mv,
7300                 __isl_take isl_val *v);
7301         __isl_give isl_multi_val *isl_multi_val_mod_val(
7302                 __isl_take isl_multi_val *mv,
7303                 __isl_take isl_val *v);
7304         __isl_give isl_multi_val *isl_multi_val_scale_val(
7305                 __isl_take isl_multi_val *mv,
7306                 __isl_take isl_val *v);
7307         __isl_give isl_multi_val *isl_multi_val_scale_down_val(
7308                 __isl_take isl_multi_val *mv,
7309                 __isl_take isl_val *v);
7311         #include <isl/aff.h>
7312         __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
7313                 __isl_take isl_val *mod);
7314         __isl_give isl_pw_aff *isl_pw_aff_mod_val(
7315                 __isl_take isl_pw_aff *pa,
7316                 __isl_take isl_val *mod);
7317         __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
7318                 __isl_take isl_union_pw_aff *upa,
7319                 __isl_take isl_val *f);
7320         __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
7321                 __isl_take isl_val *v);
7322         __isl_give isl_multi_aff *isl_multi_aff_scale_val(
7323                 __isl_take isl_multi_aff *ma,
7324                 __isl_take isl_val *v);
7325         __isl_give isl_pw_aff *isl_pw_aff_scale_val(
7326                 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
7327         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
7328                 __isl_take isl_multi_pw_aff *mpa,
7329                 __isl_take isl_val *v);
7330         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
7331                 __isl_take isl_pw_multi_aff *pma,
7332                 __isl_take isl_val *v);
7333         __isl_give isl_union_pw_multi_aff *
7334         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
7335                 __isl_take isl_union_pw_aff *upa,
7336                 __isl_take isl_val *f);
7337         isl_union_pw_multi_aff_scale_val(
7338                 __isl_take isl_union_pw_multi_aff *upma,
7339                 __isl_take isl_val *val);
7340         __isl_give isl_multi_union_pw_aff *
7341         isl_multi_union_pw_aff_scale_val(
7342                 __isl_take isl_multi_union_pw_aff *mupa,
7343                 __isl_take isl_val *v);
7344         __isl_give isl_aff *isl_aff_scale_down_ui(
7345                 __isl_take isl_aff *aff, unsigned f);
7346         __isl_give isl_aff *isl_aff_scale_down_val(
7347                 __isl_take isl_aff *aff, __isl_take isl_val *v);
7348         __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
7349                 __isl_take isl_multi_aff *ma,
7350                 __isl_take isl_val *v);
7351         __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
7352                 __isl_take isl_pw_aff *pa,
7353                 __isl_take isl_val *f);
7354         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
7355                 __isl_take isl_multi_pw_aff *mpa,
7356                 __isl_take isl_val *v);
7357         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
7358                 __isl_take isl_pw_multi_aff *pma,
7359                 __isl_take isl_val *v);
7360         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
7361                 __isl_take isl_union_pw_aff *upa,
7362                 __isl_take isl_val *v);
7363         __isl_give isl_union_pw_multi_aff *
7364         isl_union_pw_multi_aff_scale_down_val(
7365                 __isl_take isl_union_pw_multi_aff *upma,
7366                 __isl_take isl_val *val);
7367         __isl_give isl_multi_union_pw_aff *
7368         isl_multi_union_pw_aff_scale_down_val(
7369                 __isl_take isl_multi_union_pw_aff *mupa,
7370                 __isl_take isl_val *v);
7372         #include <isl/polynomial.h>
7373         __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
7374                 __isl_take isl_qpolynomial *qp,
7375                 __isl_take isl_val *v);
7376         __isl_give isl_qpolynomial_fold *
7377         isl_qpolynomial_fold_scale_val(
7378                 __isl_take isl_qpolynomial_fold *fold,
7379                 __isl_take isl_val *v);
7380         __isl_give isl_pw_qpolynomial *
7381         isl_pw_qpolynomial_scale_val(
7382                 __isl_take isl_pw_qpolynomial *pwqp,
7383                 __isl_take isl_val *v);
7384         __isl_give isl_pw_qpolynomial_fold *
7385         isl_pw_qpolynomial_fold_scale_val(
7386                 __isl_take isl_pw_qpolynomial_fold *pwf,
7387                 __isl_take isl_val *v);
7388         __isl_give isl_union_pw_qpolynomial *
7389         isl_union_pw_qpolynomial_scale_val(
7390                 __isl_take isl_union_pw_qpolynomial *upwqp,
7391                 __isl_take isl_val *v);
7392         __isl_give isl_union_pw_qpolynomial_fold *
7393         isl_union_pw_qpolynomial_fold_scale_val(
7394                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7395                 __isl_take isl_val *v);
7396         __isl_give isl_qpolynomial *
7397         isl_qpolynomial_scale_down_val(
7398                 __isl_take isl_qpolynomial *qp,
7399                 __isl_take isl_val *v);
7400         __isl_give isl_qpolynomial_fold *
7401         isl_qpolynomial_fold_scale_down_val(
7402                 __isl_take isl_qpolynomial_fold *fold,
7403                 __isl_take isl_val *v);
7404         __isl_give isl_pw_qpolynomial *
7405         isl_pw_qpolynomial_scale_down_val(
7406                 __isl_take isl_pw_qpolynomial *pwqp,
7407                 __isl_take isl_val *v);
7408         __isl_give isl_pw_qpolynomial_fold *
7409         isl_pw_qpolynomial_fold_scale_down_val(
7410                 __isl_take isl_pw_qpolynomial_fold *pwf,
7411                 __isl_take isl_val *v);
7412         __isl_give isl_union_pw_qpolynomial *
7413         isl_union_pw_qpolynomial_scale_down_val(
7414                 __isl_take isl_union_pw_qpolynomial *upwqp,
7415                 __isl_take isl_val *v);
7416         __isl_give isl_union_pw_qpolynomial_fold *
7417         isl_union_pw_qpolynomial_fold_scale_down_val(
7418                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7419                 __isl_take isl_val *v);
7421         #include <isl/val.h>
7422         __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
7423                 __isl_take isl_multi_val *mv1,
7424                 __isl_take isl_multi_val *mv2);
7425         __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
7426                 __isl_take isl_multi_val *mv1,
7427                 __isl_take isl_multi_val *mv2);
7428         __isl_give isl_multi_val *
7429         isl_multi_val_scale_down_multi_val(
7430                 __isl_take isl_multi_val *mv1,
7431                 __isl_take isl_multi_val *mv2);
7433         #include <isl/aff.h>
7434         __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
7435                 __isl_take isl_multi_aff *ma,
7436                 __isl_take isl_multi_val *mv);
7437         __isl_give isl_multi_union_pw_aff *
7438         isl_multi_union_pw_aff_mod_multi_val(
7439                 __isl_take isl_multi_union_pw_aff *upma,
7440                 __isl_take isl_multi_val *mv);
7441         __isl_give isl_multi_pw_aff *
7442         isl_multi_pw_aff_mod_multi_val(
7443                 __isl_take isl_multi_pw_aff *mpa,
7444                 __isl_take isl_multi_val *mv);
7445         __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
7446                 __isl_take isl_multi_aff *ma,
7447                 __isl_take isl_multi_val *mv);
7448         __isl_give isl_pw_multi_aff *
7449         isl_pw_multi_aff_scale_multi_val(
7450                 __isl_take isl_pw_multi_aff *pma,
7451                 __isl_take isl_multi_val *mv);
7452         __isl_give isl_multi_pw_aff *
7453         isl_multi_pw_aff_scale_multi_val(
7454                 __isl_take isl_multi_pw_aff *mpa,
7455                 __isl_take isl_multi_val *mv);
7456         __isl_give isl_multi_union_pw_aff *
7457         isl_multi_union_pw_aff_scale_multi_val(
7458                 __isl_take isl_multi_union_pw_aff *mupa,
7459                 __isl_take isl_multi_val *mv);
7460         __isl_give isl_union_pw_multi_aff *
7461         isl_union_pw_multi_aff_scale_multi_val(
7462                 __isl_take isl_union_pw_multi_aff *upma,
7463                 __isl_take isl_multi_val *mv);
7464         __isl_give isl_multi_aff *
7465         isl_multi_aff_scale_down_multi_val(
7466                 __isl_take isl_multi_aff *ma,
7467                 __isl_take isl_multi_val *mv);
7468         __isl_give isl_multi_pw_aff *
7469         isl_multi_pw_aff_scale_down_multi_val(
7470                 __isl_take isl_multi_pw_aff *mpa,
7471                 __isl_take isl_multi_val *mv);
7472         __isl_give isl_multi_union_pw_aff *
7473         isl_multi_union_pw_aff_scale_down_multi_val(
7474                 __isl_take isl_multi_union_pw_aff *mupa,
7475                 __isl_take isl_multi_val *mv);
7477 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
7478 by the corresponding elements of C<mv>.
7480         #include <isl/aff.h>
7481         __isl_give isl_aff *isl_aff_mul(
7482                 __isl_take isl_aff *aff1,
7483                 __isl_take isl_aff *aff2);
7484         __isl_give isl_aff *isl_aff_div(
7485                 __isl_take isl_aff *aff1,
7486                 __isl_take isl_aff *aff2);
7487         __isl_give isl_pw_aff *isl_pw_aff_mul(
7488                 __isl_take isl_pw_aff *pwaff1,
7489                 __isl_take isl_pw_aff *pwaff2);
7490         __isl_give isl_pw_aff *isl_pw_aff_div(
7491                 __isl_take isl_pw_aff *pa1,
7492                 __isl_take isl_pw_aff *pa2);
7493         __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
7494                 __isl_take isl_pw_aff *pa1,
7495                 __isl_take isl_pw_aff *pa2);
7496         __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
7497                 __isl_take isl_pw_aff *pa1,
7498                 __isl_take isl_pw_aff *pa2);
7500 When multiplying two affine expressions, at least one of the two needs
7501 to be a constant.  Similarly, when dividing an affine expression by another,
7502 the second expression needs to be a constant.
7503 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
7504 rounding towards zero.  C<isl_pw_aff_tdiv_r> computes the corresponding
7505 remainder.
7507         #include <isl/polynomial.h>
7508         __isl_give isl_qpolynomial *isl_qpolynomial_mul(
7509                 __isl_take isl_qpolynomial *qp1,
7510                 __isl_take isl_qpolynomial *qp2);
7511         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
7512                 __isl_take isl_pw_qpolynomial *pwqp1,
7513                 __isl_take isl_pw_qpolynomial *pwqp2);
7514         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
7515                 __isl_take isl_union_pw_qpolynomial *upwqp1,
7516                 __isl_take isl_union_pw_qpolynomial *upwqp2);
7518 =back
7520 =head3 Lexicographic Optimization
7522 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
7523 the following functions
7524 compute a set that contains the lexicographic minimum or maximum
7525 of the elements in C<set> (or C<bset>) for those values of the parameters
7526 that satisfy C<dom>.
7527 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
7528 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
7529 has no elements.
7530 In other words, the union of the parameter values
7531 for which the result is non-empty and of C<*empty>
7532 is equal to C<dom>.
7534         #include <isl/set.h>
7535         __isl_give isl_set *isl_basic_set_partial_lexmin(
7536                 __isl_take isl_basic_set *bset,
7537                 __isl_take isl_basic_set *dom,
7538                 __isl_give isl_set **empty);
7539         __isl_give isl_set *isl_basic_set_partial_lexmax(
7540                 __isl_take isl_basic_set *bset,
7541                 __isl_take isl_basic_set *dom,
7542                 __isl_give isl_set **empty);
7543         __isl_give isl_set *isl_set_partial_lexmin(
7544                 __isl_take isl_set *set, __isl_take isl_set *dom,
7545                 __isl_give isl_set **empty);
7546         __isl_give isl_set *isl_set_partial_lexmax(
7547                 __isl_take isl_set *set, __isl_take isl_set *dom,
7548                 __isl_give isl_set **empty);
7550 Given a (basic) set C<set> (or C<bset>), the following functions simply
7551 return a set containing the lexicographic minimum or maximum
7552 of the elements in C<set> (or C<bset>).
7553 In case of union sets, the optimum is computed per space.
7555         #include <isl/set.h>
7556         __isl_give isl_set *isl_basic_set_lexmin(
7557                 __isl_take isl_basic_set *bset);
7558         __isl_give isl_set *isl_basic_set_lexmax(
7559                 __isl_take isl_basic_set *bset);
7560         __isl_give isl_set *isl_set_lexmin(
7561                 __isl_take isl_set *set);
7562         __isl_give isl_set *isl_set_lexmax(
7563                 __isl_take isl_set *set);
7564         __isl_give isl_union_set *isl_union_set_lexmin(
7565                 __isl_take isl_union_set *uset);
7566         __isl_give isl_union_set *isl_union_set_lexmax(
7567                 __isl_take isl_union_set *uset);
7569 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
7570 the following functions
7571 compute a relation that maps each element of C<dom>
7572 to the single lexicographic minimum or maximum
7573 of the elements that are associated to that same
7574 element in C<map> (or C<bmap>).
7575 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
7576 that contains the elements in C<dom> that do not map
7577 to any elements in C<map> (or C<bmap>).
7578 In other words, the union of the domain of the result and of C<*empty>
7579 is equal to C<dom>.
7581         #include <isl/map.h>
7582         __isl_give isl_map *isl_basic_map_partial_lexmax(
7583                 __isl_take isl_basic_map *bmap,
7584                 __isl_take isl_basic_set *dom,
7585                 __isl_give isl_set **empty);
7586         __isl_give isl_map *isl_basic_map_partial_lexmin(
7587                 __isl_take isl_basic_map *bmap,
7588                 __isl_take isl_basic_set *dom,
7589                 __isl_give isl_set **empty);
7590         __isl_give isl_map *isl_map_partial_lexmax(
7591                 __isl_take isl_map *map, __isl_take isl_set *dom,
7592                 __isl_give isl_set **empty);
7593         __isl_give isl_map *isl_map_partial_lexmin(
7594                 __isl_take isl_map *map, __isl_take isl_set *dom,
7595                 __isl_give isl_set **empty);
7597 Given a (basic) map C<map> (or C<bmap>), the following functions simply
7598 return a map mapping each element in the domain of
7599 C<map> (or C<bmap>) to the lexicographic minimum or maximum
7600 of all elements associated to that element.
7601 In case of union relations, the optimum is computed per space.
7603         #include <isl/map.h>
7604         __isl_give isl_map *isl_basic_map_lexmin(
7605                 __isl_take isl_basic_map *bmap);
7606         __isl_give isl_map *isl_basic_map_lexmax(
7607                 __isl_take isl_basic_map *bmap);
7608         __isl_give isl_map *isl_map_lexmin(
7609                 __isl_take isl_map *map);
7610         __isl_give isl_map *isl_map_lexmax(
7611                 __isl_take isl_map *map);
7612         __isl_give isl_union_map *isl_union_map_lexmin(
7613                 __isl_take isl_union_map *umap);
7614         __isl_give isl_union_map *isl_union_map_lexmax(
7615                 __isl_take isl_union_map *umap);
7617 The following functions return their result in the form of
7618 a piecewise multi-affine expression,
7619 but are otherwise equivalent to the corresponding functions
7620 returning a basic set or relation.
7622         #include <isl/set.h>
7623         __isl_give isl_pw_multi_aff *
7624         isl_basic_set_partial_lexmin_pw_multi_aff(
7625                 __isl_take isl_basic_set *bset,
7626                 __isl_take isl_basic_set *dom,
7627                 __isl_give isl_set **empty);
7628         __isl_give isl_pw_multi_aff *
7629         isl_basic_set_partial_lexmax_pw_multi_aff(
7630                 __isl_take isl_basic_set *bset,
7631                 __isl_take isl_basic_set *dom,
7632                 __isl_give isl_set **empty);
7633         __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
7634                 __isl_take isl_set *set);
7635         __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
7636                 __isl_take isl_set *set);
7638         #include <isl/map.h>
7639         __isl_give isl_pw_multi_aff *
7640         isl_basic_map_lexmin_pw_multi_aff(
7641                 __isl_take isl_basic_map *bmap);
7642         __isl_give isl_pw_multi_aff *
7643         isl_basic_map_partial_lexmin_pw_multi_aff(
7644                 __isl_take isl_basic_map *bmap,
7645                 __isl_take isl_basic_set *dom,
7646                 __isl_give isl_set **empty);
7647         __isl_give isl_pw_multi_aff *
7648         isl_basic_map_partial_lexmax_pw_multi_aff(
7649                 __isl_take isl_basic_map *bmap,
7650                 __isl_take isl_basic_set *dom,
7651                 __isl_give isl_set **empty);
7652         __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
7653                 __isl_take isl_map *map);
7654         __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
7655                 __isl_take isl_map *map);
7657 The following functions return the lexicographic minimum or maximum
7658 on the shared domain of the inputs and the single defined function
7659 on those parts of the domain where only a single function is defined.
7661         #include <isl/aff.h>
7662         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
7663                 __isl_take isl_pw_multi_aff *pma1,
7664                 __isl_take isl_pw_multi_aff *pma2);
7665         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
7666                 __isl_take isl_pw_multi_aff *pma1,
7667                 __isl_take isl_pw_multi_aff *pma2);
7669 If the input to a lexicographic optimization problem has
7670 multiple constraints with the same coefficients for the optimized
7671 variables, then, by default, this symmetry is exploited by
7672 replacing those constraints by a single constraint with
7673 an abstract bound, which is in turn bounded by the corresponding terms
7674 in the original constraints.
7675 Without this optimization, the solver would typically consider
7676 all possible orderings of those original bounds, resulting in a needless
7677 decomposition of the domain.
7678 However, the optimization can also result in slowdowns since
7679 an extra parameter is introduced that may get used in additional
7680 integer divisions.
7681 The following option determines whether symmetry detection is applied
7682 during lexicographic optimization.
7684         #include <isl/options.h>
7685         isl_stat isl_options_set_pip_symmetry(isl_ctx *ctx,
7686                 int val);
7687         int isl_options_get_pip_symmetry(isl_ctx *ctx);
7689 =begin latex
7691 See also \autoref{s:offline}.
7693 =end latex
7695 =head2 Ternary Operations
7697         #include <isl/aff.h>
7698         __isl_give isl_pw_aff *isl_pw_aff_cond(
7699                 __isl_take isl_pw_aff *cond,
7700                 __isl_take isl_pw_aff *pwaff_true,
7701                 __isl_take isl_pw_aff *pwaff_false);
7703 The function C<isl_pw_aff_cond> performs a conditional operator
7704 and returns an expression that is equal to C<pwaff_true>
7705 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
7706 where C<cond> is zero.
7708 =head2 Lists
7710 Lists are defined over several element types, including
7711 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_union_pw_aff>,
7712 C<isl_union_pw_multi_aff>, C<isl_constraint>,
7713 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
7714 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
7715 Here we take lists of C<isl_set>s as an example.
7716 Lists can be created, copied, modified and freed using the following functions.
7718         #include <isl/set.h>
7719         __isl_give isl_set_list *isl_set_list_from_set(
7720                 __isl_take isl_set *el);
7721         __isl_give isl_set_list *isl_set_list_alloc(
7722                 isl_ctx *ctx, int n);
7723         __isl_give isl_set_list *isl_set_list_copy(
7724                 __isl_keep isl_set_list *list);
7725         __isl_give isl_set_list *isl_set_list_insert(
7726                 __isl_take isl_set_list *list, unsigned pos,
7727                 __isl_take isl_set *el);
7728         __isl_give isl_set_list *isl_set_list_add(
7729                 __isl_take isl_set_list *list,
7730                 __isl_take isl_set *el);
7731         __isl_give isl_set_list *isl_set_list_drop(
7732                 __isl_take isl_set_list *list,
7733                 unsigned first, unsigned n);
7734         __isl_give isl_set_list *isl_set_list_set_set(
7735                 __isl_take isl_set_list *list, int index,
7736                 __isl_take isl_set *set);
7737         __isl_give isl_set_list *isl_set_list_concat(
7738                 __isl_take isl_set_list *list1,
7739                 __isl_take isl_set_list *list2);
7740         __isl_give isl_set_list *isl_set_list_map(
7741                 __isl_take isl_set_list *list,
7742                 __isl_give isl_set *(*fn)(__isl_take isl_set *el,
7743                         void *user),
7744                 void *user);
7745         __isl_give isl_set_list *isl_set_list_sort(
7746                 __isl_take isl_set_list *list,
7747                 int (*cmp)(__isl_keep isl_set *a,
7748                         __isl_keep isl_set *b, void *user),
7749                 void *user);
7750         __isl_null isl_set_list *isl_set_list_free(
7751                 __isl_take isl_set_list *list);
7753 C<isl_set_list_alloc> creates an empty list with an initial capacity
7754 for C<n> elements.  C<isl_set_list_insert> and C<isl_set_list_add>
7755 add elements to a list, increasing its capacity as needed.
7756 C<isl_set_list_from_set> creates a list with a single element.
7758 Lists can be inspected using the following functions.
7760         #include <isl/set.h>
7761         int isl_set_list_n_set(__isl_keep isl_set_list *list);
7762         __isl_give isl_set *isl_set_list_get_set(
7763                 __isl_keep isl_set_list *list, int index);
7764         isl_stat isl_set_list_foreach(__isl_keep isl_set_list *list,
7765                 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7766                 void *user);
7767         isl_stat isl_set_list_foreach_scc(
7768                 __isl_keep isl_set_list *list,
7769                 isl_bool (*follows)(__isl_keep isl_set *a,
7770                         __isl_keep isl_set *b, void *user),
7771                 void *follows_user,
7772                 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7773                 void *fn_user);
7775 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
7776 strongly connected components of the graph with as vertices the elements
7777 of C<list> and a directed edge from vertex C<b> to vertex C<a>
7778 iff C<follows(a, b)> returns C<isl_bool_true>.  The callbacks C<follows> and
7779 C<fn> should return C<isl_bool_error> or C<isl_stat_error> on error.
7781 Lists can be printed using
7783         #include <isl/set.h>
7784         __isl_give isl_printer *isl_printer_print_set_list(
7785                 __isl_take isl_printer *p,
7786                 __isl_keep isl_set_list *list);
7788 =head2 Associative arrays
7790 Associative arrays map isl objects of a specific type to isl objects
7791 of some (other) specific type.  They are defined for several pairs
7792 of types, including (C<isl_map>, C<isl_basic_set>),
7793 (C<isl_id>, C<isl_ast_expr>),
7794 (C<isl_id>, C<isl_id>) and
7795 (C<isl_id>, C<isl_pw_aff>).
7796 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
7797 as an example.
7799 Associative arrays can be created, copied and freed using
7800 the following functions.
7802         #include <isl/id_to_ast_expr.h>
7803         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
7804                 isl_ctx *ctx, int min_size);
7805         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
7806                 __isl_keep isl_id_to_ast_expr *id2expr);
7807         __isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
7808                 __isl_take isl_id_to_ast_expr *id2expr);
7810 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
7811 to specify the expected size of the associative array.
7812 The associative array will be grown automatically as needed.
7814 Associative arrays can be inspected using the following functions.
7816         #include <isl/id_to_ast_expr.h>
7817         __isl_give isl_maybe_isl_ast_expr
7818         isl_id_to_ast_expr_try_get(
7819                 __isl_keep isl_id_to_ast_expr *id2expr,
7820                 __isl_keep isl_id *key);
7821         isl_bool isl_id_to_ast_expr_has(
7822                 __isl_keep isl_id_to_ast_expr *id2expr,
7823                 __isl_keep isl_id *key);
7824         __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
7825                 __isl_keep isl_id_to_ast_expr *id2expr,
7826                 __isl_take isl_id *key);
7827         isl_stat isl_id_to_ast_expr_foreach(
7828                 __isl_keep isl_id_to_ast_expr *id2expr,
7829                 isl_stat (*fn)(__isl_take isl_id *key,
7830                         __isl_take isl_ast_expr *val, void *user),
7831                 void *user);
7833 The function C<isl_id_to_ast_expr_try_get> returns a structure
7834 containing two elements, C<valid> and C<value>.
7835 If there is a value associated to the key, then C<valid>
7836 is set to C<isl_bool_true> and C<value> contains a copy of
7837 the associated value.  Otherwise C<value> is C<NULL> and
7838 C<valid> may be C<isl_bool_error> or C<isl_bool_false> depending
7839 on whether some error has occurred or there simply is no associated value.
7840 The function C<isl_id_to_ast_expr_has> returns the C<valid> field
7841 in the structure and
7842 the function C<isl_id_to_ast_expr_get> returns the C<value> field.
7844 Associative arrays can be modified using the following functions.
7846         #include <isl/id_to_ast_expr.h>
7847         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
7848                 __isl_take isl_id_to_ast_expr *id2expr,
7849                 __isl_take isl_id *key,
7850                 __isl_take isl_ast_expr *val);
7851         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
7852                 __isl_take isl_id_to_ast_expr *id2expr,
7853                 __isl_take isl_id *key);
7855 Associative arrays can be printed using the following function.
7857         #include <isl/id_to_ast_expr.h>
7858         __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
7859                 __isl_take isl_printer *p,
7860                 __isl_keep isl_id_to_ast_expr *id2expr);
7862 =head2 Vectors
7864 Vectors can be created, copied and freed using the following functions.
7866         #include <isl/vec.h>
7867         __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
7868                 unsigned size);
7869         __isl_give isl_vec *isl_vec_zero(isl_ctx *ctx,
7870                 unsigned size);
7871         __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
7872         __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
7874 Note that the elements of a vector created by C<isl_vec_alloc>
7875 may have arbitrary values.
7876 A vector created by C<isl_vec_zero> has elements with value zero.
7877 The elements can be changed and inspected using the following functions.
7879         int isl_vec_size(__isl_keep isl_vec *vec);
7880         __isl_give isl_val *isl_vec_get_element_val(
7881                 __isl_keep isl_vec *vec, int pos);
7882         __isl_give isl_vec *isl_vec_set_element_si(
7883                 __isl_take isl_vec *vec, int pos, int v);
7884         __isl_give isl_vec *isl_vec_set_element_val(
7885                 __isl_take isl_vec *vec, int pos,
7886                 __isl_take isl_val *v);
7887         __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
7888                 int v);
7889         __isl_give isl_vec *isl_vec_set_val(
7890                 __isl_take isl_vec *vec, __isl_take isl_val *v);
7891         int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
7892                 __isl_keep isl_vec *vec2, int pos);
7894 C<isl_vec_get_element> will return a negative value if anything went wrong.
7895 In that case, the value of C<*v> is undefined.
7897 The following function can be used to concatenate two vectors.
7899         __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
7900                 __isl_take isl_vec *vec2);
7902 =head2 Matrices
7904 Matrices can be created, copied and freed using the following functions.
7906         #include <isl/mat.h>
7907         __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
7908                 unsigned n_row, unsigned n_col);
7909         __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
7910         __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
7912 Note that the elements of a newly created matrix may have arbitrary values.
7913 The elements can be changed and inspected using the following functions.
7915         int isl_mat_rows(__isl_keep isl_mat *mat);
7916         int isl_mat_cols(__isl_keep isl_mat *mat);
7917         __isl_give isl_val *isl_mat_get_element_val(
7918                 __isl_keep isl_mat *mat, int row, int col);
7919         __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
7920                 int row, int col, int v);
7921         __isl_give isl_mat *isl_mat_set_element_val(
7922                 __isl_take isl_mat *mat, int row, int col,
7923                 __isl_take isl_val *v);
7925 The following function computes the rank of a matrix.
7926 The return value may be -1 if some error occurred.
7928         #include <isl/mat.h>
7929         int isl_mat_rank(__isl_keep isl_mat *mat);
7931 The following function can be used to compute the (right) inverse
7932 of a matrix, i.e., a matrix such that the product of the original
7933 and the inverse (in that order) is a multiple of the identity matrix.
7934 The input matrix is assumed to be of full row-rank.
7936         __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
7938 The following function can be used to compute the (right) kernel
7939 (or null space) of a matrix, i.e., a matrix such that the product of
7940 the original and the kernel (in that order) is the zero matrix.
7942         __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
7944 The following function computes a basis for the space spanned
7945 by the rows of a matrix.
7947         __isl_give isl_mat *isl_mat_row_basis(
7948                 __isl_take isl_mat *mat);
7950 The following function computes rows that extend a basis of C<mat1>
7951 to a basis that also covers C<mat2>.
7953         __isl_give isl_mat *isl_mat_row_basis_extension(
7954                 __isl_take isl_mat *mat1,
7955                 __isl_take isl_mat *mat2);
7957 The following function checks whether there is no linear dependence
7958 among the combined rows of "mat1" and "mat2" that is not already present
7959 in "mat1" or "mat2" individually.
7960 If "mat1" and "mat2" have linearly independent rows by themselves,
7961 then this means that there is no linear dependence among all rows together.
7963         isl_bool isl_mat_has_linearly_independent_rows(
7964                 __isl_keep isl_mat *mat1,
7965                 __isl_keep isl_mat *mat2);
7967 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
7969 The following functions determine
7970 an upper or lower bound on a quasipolynomial over its domain.
7972         __isl_give isl_pw_qpolynomial_fold *
7973         isl_pw_qpolynomial_bound(
7974                 __isl_take isl_pw_qpolynomial *pwqp,
7975                 enum isl_fold type, int *tight);
7977         __isl_give isl_union_pw_qpolynomial_fold *
7978         isl_union_pw_qpolynomial_bound(
7979                 __isl_take isl_union_pw_qpolynomial *upwqp,
7980                 enum isl_fold type, int *tight);
7982 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
7983 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
7984 is the returned bound is known be tight, i.e., for each value
7985 of the parameters there is at least
7986 one element in the domain that reaches the bound.
7987 If the domain of C<pwqp> is not wrapping, then the bound is computed
7988 over all elements in that domain and the result has a purely parametric
7989 domain.  If the domain of C<pwqp> is wrapping, then the bound is
7990 computed over the range of the wrapped relation.  The domain of the
7991 wrapped relation becomes the domain of the result.
7993 =head2 Parametric Vertex Enumeration
7995 The parametric vertex enumeration described in this section
7996 is mainly intended to be used internally and by the C<barvinok>
7997 library.
7999         #include <isl/vertices.h>
8000         __isl_give isl_vertices *isl_basic_set_compute_vertices(
8001                 __isl_keep isl_basic_set *bset);
8003 The function C<isl_basic_set_compute_vertices> performs the
8004 actual computation of the parametric vertices and the chamber
8005 decomposition and stores the result in an C<isl_vertices> object.
8006 This information can be queried by either iterating over all
8007 the vertices or iterating over all the chambers or cells
8008 and then iterating over all vertices that are active on the chamber.
8010         isl_stat isl_vertices_foreach_vertex(
8011                 __isl_keep isl_vertices *vertices,
8012                 isl_stat (*fn)(__isl_take isl_vertex *vertex,
8013                         void *user), void *user);
8015         isl_stat isl_vertices_foreach_cell(
8016                 __isl_keep isl_vertices *vertices,
8017                 isl_stat (*fn)(__isl_take isl_cell *cell,
8018                         void *user), void *user);
8019         isl_stat isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
8020                 isl_stat (*fn)(__isl_take isl_vertex *vertex,
8021                         void *user), void *user);
8023 Other operations that can be performed on an C<isl_vertices> object are
8024 the following.
8026         int isl_vertices_get_n_vertices(
8027                 __isl_keep isl_vertices *vertices);
8028         __isl_null isl_vertices *isl_vertices_free(
8029                 __isl_take isl_vertices *vertices);
8031 Vertices can be inspected and destroyed using the following functions.
8033         int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
8034         __isl_give isl_basic_set *isl_vertex_get_domain(
8035                 __isl_keep isl_vertex *vertex);
8036         __isl_give isl_multi_aff *isl_vertex_get_expr(
8037                 __isl_keep isl_vertex *vertex);
8038         void isl_vertex_free(__isl_take isl_vertex *vertex);
8040 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
8041 describing the vertex in terms of the parameters,
8042 while C<isl_vertex_get_domain> returns the activity domain
8043 of the vertex.
8045 Chambers can be inspected and destroyed using the following functions.
8047         __isl_give isl_basic_set *isl_cell_get_domain(
8048                 __isl_keep isl_cell *cell);
8049         void isl_cell_free(__isl_take isl_cell *cell);
8051 =head1 Polyhedral Compilation Library
8053 This section collects functionality in C<isl> that has been specifically
8054 designed for use during polyhedral compilation.
8056 =head2 Schedule Trees
8058 A schedule tree is a structured representation of a schedule,
8059 assigning a relative order to a set of domain elements.
8060 The relative order expressed by the schedule tree is
8061 defined recursively.  In particular, the order between
8062 two domain elements is determined by the node that is closest
8063 to the root that refers to both elements and that orders them apart.
8064 Each node in the tree is of one of several types.
8065 The root node is always of type C<isl_schedule_node_domain>
8066 (or C<isl_schedule_node_extension>)
8067 and it describes the (extra) domain elements to which the schedule applies.
8068 The other types of nodes are as follows.
8070 =over
8072 =item C<isl_schedule_node_band>
8074 A band of schedule dimensions.  Each schedule dimension is represented
8075 by a union piecewise quasi-affine expression.  If this expression
8076 assigns a different value to two domain elements, while all previous
8077 schedule dimensions in the same band assign them the same value,
8078 then the two domain elements are ordered according to these two
8079 different values.
8080 Each expression is required to be total in the domain elements
8081 that reach the band node.
8083 =item C<isl_schedule_node_expansion>
8085 An expansion node maps each of the domain elements that reach the node
8086 to one or more domain elements.  The image of this mapping forms
8087 the set of domain elements that reach the child of the expansion node.
8088 The function that maps each of the expanded domain elements
8089 to the original domain element from which it was expanded
8090 is called the contraction.
8092 =item C<isl_schedule_node_filter>
8094 A filter node does not impose any ordering, but rather intersects
8095 the set of domain elements that the current subtree refers to
8096 with a given union set.  The subtree of the filter node only
8097 refers to domain elements in the intersection.
8098 A filter node is typically only used as a child of a sequence or
8099 set node.
8101 =item C<isl_schedule_node_leaf>
8103 A leaf of the schedule tree.  Leaf nodes do not impose any ordering.
8105 =item C<isl_schedule_node_mark>
8107 A mark node can be used to attach any kind of information to a subtree
8108 of the schedule tree.
8110 =item C<isl_schedule_node_sequence>
8112 A sequence node has one or more children, each of which is a filter node.
8113 The filters on these filter nodes form a partition of
8114 the domain elements that the current subtree refers to.
8115 If two domain elements appear in distinct filters then the sequence
8116 node orders them according to the child positions of the corresponding
8117 filter nodes.
8119 =item C<isl_schedule_node_set>
8121 A set node is similar to a sequence node, except that
8122 it expresses that domain elements appearing in distinct filters
8123 may have any order.  The order of the children of a set node
8124 is therefore also immaterial.
8126 =back
8128 The following node types are only supported by the AST generator.
8130 =over
8132 =item C<isl_schedule_node_context>
8134 The context describes constraints on the parameters and
8135 the schedule dimensions of outer
8136 bands that the AST generator may assume to hold.  It is also the only
8137 kind of node that may introduce additional parameters.
8138 The space of the context is that of the flat product of the outer
8139 band nodes.  In particular, if there are no outer band nodes, then
8140 this space is the unnamed zero-dimensional space.
8141 Since a context node references the outer band nodes, any tree
8142 containing a context node is considered to be anchored.
8144 =item C<isl_schedule_node_extension>
8146 An extension node instructs the AST generator to add additional
8147 domain elements that need to be scheduled.
8148 The additional domain elements are described by the range of
8149 the extension map in terms of the outer schedule dimensions,
8150 i.e., the flat product of the outer band nodes.
8151 Note that domain elements are added whenever the AST generator
8152 reaches the extension node, meaning that there are still some
8153 active domain elements for which an AST needs to be generated.
8154 The conditions under which some domain elements are still active
8155 may however not be completely described by the outer AST nodes
8156 generated at that point.
8157 Since an extension node references the outer band nodes, any tree
8158 containing an extension node is considered to be anchored.
8160 An extension node may also appear as the root of a schedule tree,
8161 when it is intended to be inserted into another tree
8162 using C<isl_schedule_node_graft_before> or C<isl_schedule_node_graft_after>.
8163 In this case, the domain of the extension node should
8164 correspond to the flat product of the outer band nodes
8165 in this other schedule tree at the point where the extension tree
8166 will be inserted.
8168 =item C<isl_schedule_node_guard>
8170 The guard describes constraints on the parameters and
8171 the schedule dimensions of outer
8172 bands that need to be enforced by the outer nodes
8173 in the generated AST.
8174 That is, the part of the AST that is generated from descendants
8175 of the guard node can assume that these constraints are satisfied.
8176 The space of the guard is that of the flat product of the outer
8177 band nodes.  In particular, if there are no outer band nodes, then
8178 this space is the unnamed zero-dimensional space.
8179 Since a guard node references the outer band nodes, any tree
8180 containing a guard node is considered to be anchored.
8182 =back
8184 Except for the C<isl_schedule_node_context> nodes,
8185 none of the nodes may introduce any parameters that were not
8186 already present in the root domain node.
8188 A schedule tree is encapsulated in an C<isl_schedule> object.
8189 The simplest such objects, those with a tree consisting of single domain node,
8190 can be created using the following functions with either an empty
8191 domain or a given domain.
8193         #include <isl/schedule.h>
8194         __isl_give isl_schedule *isl_schedule_empty(
8195                 __isl_take isl_space *space);
8196         __isl_give isl_schedule *isl_schedule_from_domain(
8197                 __isl_take isl_union_set *domain);
8199 The function C<isl_schedule_constraints_compute_schedule> described
8200 in L</"Scheduling"> can also be used to construct schedules.
8202 C<isl_schedule> objects may be copied and freed using the following functions.
8204         #include <isl/schedule.h>
8205         __isl_give isl_schedule *isl_schedule_copy(
8206                 __isl_keep isl_schedule *sched);
8207         __isl_null isl_schedule *isl_schedule_free(
8208                 __isl_take isl_schedule *sched);
8210 The following functions checks whether two C<isl_schedule> objects
8211 are obviously the same.
8213         #include <isl/schedule.h>
8214         isl_bool isl_schedule_plain_is_equal(
8215                 __isl_keep isl_schedule *schedule1,
8216                 __isl_keep isl_schedule *schedule2);
8218 The domain of the schedule, i.e., the domain described by the root node,
8219 can be obtained using the following function.
8221         #include <isl/schedule.h>
8222         __isl_give isl_union_set *isl_schedule_get_domain(
8223                 __isl_keep isl_schedule *schedule);
8225 An extra top-level band node (right underneath the domain node) can
8226 be introduced into the schedule using the following function.
8227 The schedule tree is assumed not to have any anchored nodes.
8229         #include <isl/schedule.h>
8230         __isl_give isl_schedule *
8231         isl_schedule_insert_partial_schedule(
8232                 __isl_take isl_schedule *schedule,
8233                 __isl_take isl_multi_union_pw_aff *partial);
8235 A top-level context node (right underneath the domain node) can
8236 be introduced into the schedule using the following function.
8238         #include <isl/schedule.h>
8239         __isl_give isl_schedule *isl_schedule_insert_context(
8240                 __isl_take isl_schedule *schedule,
8241                 __isl_take isl_set *context)
8243 A top-level guard node (right underneath the domain node) can
8244 be introduced into the schedule using the following function.
8246         #include <isl/schedule.h>
8247         __isl_give isl_schedule *isl_schedule_insert_guard(
8248                 __isl_take isl_schedule *schedule,
8249                 __isl_take isl_set *guard)
8251 A schedule that combines two schedules either in the given
8252 order or in an arbitrary order, i.e., with an C<isl_schedule_node_sequence>
8253 or an C<isl_schedule_node_set> node,
8254 can be created using the following functions.
8256         #include <isl/schedule.h>
8257         __isl_give isl_schedule *isl_schedule_sequence(
8258                 __isl_take isl_schedule *schedule1,
8259                 __isl_take isl_schedule *schedule2);
8260         __isl_give isl_schedule *isl_schedule_set(
8261                 __isl_take isl_schedule *schedule1,
8262                 __isl_take isl_schedule *schedule2);
8264 The domains of the two input schedules need to be disjoint.
8266 The following function can be used to restrict the domain
8267 of a schedule with a domain node as root to be a subset of the given union set.
8268 This operation may remove nodes in the tree that have become
8269 redundant.
8271         #include <isl/schedule.h>
8272         __isl_give isl_schedule *isl_schedule_intersect_domain(
8273                 __isl_take isl_schedule *schedule,
8274                 __isl_take isl_union_set *domain);
8276 The following function can be used to simplify the domain
8277 of a schedule with a domain node as root with respect to the given
8278 parameter domain.
8280         #include <isl/schedule.h>
8281         __isl_give isl_schedule *isl_schedule_gist_domain_params(
8282                 __isl_take isl_schedule *schedule,
8283                 __isl_take isl_set *context);
8285 The following function resets the user pointers on all parameter
8286 and tuple identifiers referenced by the nodes of the given schedule.
8288         #include <isl/schedule.h>
8289         __isl_give isl_schedule *isl_schedule_reset_user(
8290                 __isl_take isl_schedule *schedule);
8292 The following function aligns the parameters of all nodes
8293 in the given schedule to the given space.
8295         #include <isl/schedule.h>
8296         __isl_give isl_schedule *isl_schedule_align_params(
8297                 __isl_take isl_schedule *schedule,
8298                 __isl_take isl_space *space);
8300 The following function allows the user to plug in a given function
8301 in the iteration domains.  The input schedule is not allowed to contain
8302 any expansion nodes.
8304         #include <isl/schedule.h>
8305         __isl_give isl_schedule *
8306         isl_schedule_pullback_union_pw_multi_aff(
8307                 __isl_take isl_schedule *schedule,
8308                 __isl_take isl_union_pw_multi_aff *upma);
8310 The following function can be used to plug in the schedule C<expansion>
8311 in the leaves of C<schedule>, where C<contraction> describes how
8312 the domain elements of C<expansion> map to the domain elements
8313 at the original leaves of C<schedule>.
8314 The resulting schedule will contain expansion nodes, unless
8315 C<contraction> is an identity function.
8317         #include <isl/schedule.h>
8318         __isl_give isl_schedule *isl_schedule_expand(
8319                 __isl_take isl_schedule *schedule,
8320                 __isl_take isl_union_pw_multi_aff *contraction,
8321                 __isl_take isl_schedule *expansion);
8323 An C<isl_union_map> representation of the schedule can be obtained
8324 from an C<isl_schedule> using the following function.
8326         #include <isl/schedule.h>
8327         __isl_give isl_union_map *isl_schedule_get_map(
8328                 __isl_keep isl_schedule *sched);
8330 The resulting relation encodes the same relative ordering as
8331 the schedule by mapping the domain elements to a common schedule space.
8332 If the schedule_separate_components option is set, then the order
8333 of the children of a set node is explicitly encoded in the result.
8334 If the tree contains any expansion nodes, then the relation
8335 is formulated in terms of the expanded domain elements.
8337 Schedules can be read from input using the following functions.
8339         #include <isl/schedule.h>
8340         __isl_give isl_schedule *isl_schedule_read_from_file(
8341                 isl_ctx *ctx, FILE *input);
8342         __isl_give isl_schedule *isl_schedule_read_from_str(
8343                 isl_ctx *ctx, const char *str);
8345 A representation of the schedule can be printed using
8347         #include <isl/schedule.h>
8348         __isl_give isl_printer *isl_printer_print_schedule(
8349                 __isl_take isl_printer *p,
8350                 __isl_keep isl_schedule *schedule);
8351         __isl_give char *isl_schedule_to_str(
8352                 __isl_keep isl_schedule *schedule);
8354 C<isl_schedule_to_str> prints the schedule in flow format.
8356 The schedule tree can be traversed through the use of
8357 C<isl_schedule_node> objects that point to a particular
8358 position in the schedule tree.  Whenever a C<isl_schedule_node>
8359 is used to modify a node in the schedule tree, the original schedule
8360 tree is left untouched and the modifications are performed to a copy
8361 of the tree.  The returned C<isl_schedule_node> then points to
8362 this modified copy of the tree.
8364 The root of the schedule tree can be obtained using the following function.
8366         #include <isl/schedule.h>
8367         __isl_give isl_schedule_node *isl_schedule_get_root(
8368                 __isl_keep isl_schedule *schedule);
8370 A pointer to a newly created schedule tree with a single domain
8371 node can be created using the following functions.
8373         #include <isl/schedule_node.h>
8374         __isl_give isl_schedule_node *
8375         isl_schedule_node_from_domain(
8376                 __isl_take isl_union_set *domain);
8377         __isl_give isl_schedule_node *
8378         isl_schedule_node_from_extension(
8379                 __isl_take isl_union_map *extension);
8381 C<isl_schedule_node_from_extension> creates a tree with an extension
8382 node as root.
8384 Schedule nodes can be copied and freed using the following functions.
8386         #include <isl/schedule_node.h>
8387         __isl_give isl_schedule_node *isl_schedule_node_copy(
8388                 __isl_keep isl_schedule_node *node);
8389         __isl_null isl_schedule_node *isl_schedule_node_free(
8390                 __isl_take isl_schedule_node *node);
8392 The following functions can be used to check if two schedule
8393 nodes point to the same position in the same schedule.
8395         #include <isl/schedule_node.h>
8396         isl_bool isl_schedule_node_is_equal(
8397                 __isl_keep isl_schedule_node *node1,
8398                 __isl_keep isl_schedule_node *node2);
8400 The following properties can be obtained from a schedule node.
8402         #include <isl/schedule_node.h>
8403         enum isl_schedule_node_type isl_schedule_node_get_type(
8404                 __isl_keep isl_schedule_node *node);
8405         enum isl_schedule_node_type
8406         isl_schedule_node_get_parent_type(
8407                 __isl_keep isl_schedule_node *node);
8408         __isl_give isl_schedule *isl_schedule_node_get_schedule(
8409                 __isl_keep isl_schedule_node *node);
8411 The function C<isl_schedule_node_get_type> returns the type of
8412 the node, while C<isl_schedule_node_get_parent_type> returns
8413 type of the parent of the node, which is required to exist.
8414 The function C<isl_schedule_node_get_schedule> returns a copy
8415 to the schedule to which the node belongs.
8417 The following functions can be used to move the schedule node
8418 to a different position in the tree or to check if such a position
8419 exists.
8421         #include <isl/schedule_node.h>
8422         isl_bool isl_schedule_node_has_parent(
8423                 __isl_keep isl_schedule_node *node);
8424         __isl_give isl_schedule_node *isl_schedule_node_parent(
8425                 __isl_take isl_schedule_node *node);
8426         __isl_give isl_schedule_node *isl_schedule_node_root(
8427                 __isl_take isl_schedule_node *node);
8428         __isl_give isl_schedule_node *isl_schedule_node_ancestor(
8429                 __isl_take isl_schedule_node *node,
8430                 int generation);
8431         int isl_schedule_node_n_children(
8432                 __isl_keep isl_schedule_node *node);
8433         __isl_give isl_schedule_node *isl_schedule_node_child(
8434                 __isl_take isl_schedule_node *node, int pos);
8435         isl_bool isl_schedule_node_has_children(
8436                 __isl_keep isl_schedule_node *node);
8437         __isl_give isl_schedule_node *isl_schedule_node_first_child(
8438                 __isl_take isl_schedule_node *node);
8439         isl_bool isl_schedule_node_has_previous_sibling(
8440                 __isl_keep isl_schedule_node *node);
8441         __isl_give isl_schedule_node *
8442         isl_schedule_node_previous_sibling(
8443                 __isl_take isl_schedule_node *node);
8444         isl_bool isl_schedule_node_has_next_sibling(
8445                 __isl_keep isl_schedule_node *node);
8446         __isl_give isl_schedule_node *
8447         isl_schedule_node_next_sibling(
8448                 __isl_take isl_schedule_node *node);
8450 For C<isl_schedule_node_ancestor>, the ancestor of generation 0
8451 is the node itself, the ancestor of generation 1 is its parent and so on.
8453 It is also possible to query the number of ancestors of a node,
8454 the position of the current node
8455 within the children of its parent, the position of the subtree
8456 containing a node within the children of an ancestor
8457 or to obtain a copy of a given
8458 child without destroying the current node.
8459 Given two nodes that point to the same schedule, their closest
8460 shared ancestor can be obtained using
8461 C<isl_schedule_node_get_shared_ancestor>.
8463         #include <isl/schedule_node.h>
8464         int isl_schedule_node_get_tree_depth(
8465                 __isl_keep isl_schedule_node *node);
8466         int isl_schedule_node_get_child_position(
8467                 __isl_keep isl_schedule_node *node);
8468         int isl_schedule_node_get_ancestor_child_position(
8469                 __isl_keep isl_schedule_node *node,
8470                 __isl_keep isl_schedule_node *ancestor);
8471         __isl_give isl_schedule_node *isl_schedule_node_get_child(
8472                 __isl_keep isl_schedule_node *node, int pos);
8473         __isl_give isl_schedule_node *
8474         isl_schedule_node_get_shared_ancestor(
8475                 __isl_keep isl_schedule_node *node1,
8476                 __isl_keep isl_schedule_node *node2);
8478 All nodes in a schedule tree or
8479 all descendants of a specific node (including the node) can be visited
8480 in depth-first pre-order using the following functions.
8482         #include <isl/schedule.h>
8483         isl_stat isl_schedule_foreach_schedule_node_top_down(
8484                 __isl_keep isl_schedule *sched,
8485                 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
8486                         void *user), void *user);
8488         #include <isl/schedule_node.h>
8489         isl_stat isl_schedule_node_foreach_descendant_top_down(
8490                 __isl_keep isl_schedule_node *node,
8491                 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
8492                         void *user), void *user);
8494 The callback function is slightly different from the usual
8495 callbacks in that it not only indicates success (non-negative result)
8496 or failure (negative result), but also indicates whether the children
8497 of the given node should be visited.  In particular, if the callback
8498 returns a positive value, then the children are visited, but if
8499 the callback returns zero, then the children are not visited.
8501 The following functions checks whether
8502 all descendants of a specific node (including the node itself)
8503 satisfy a user-specified test.
8505         #include <isl/schedule_node.h>
8506         isl_bool isl_schedule_node_every_descendant(
8507                 __isl_keep isl_schedule_node *node,
8508                 isl_bool (*test)(__isl_keep isl_schedule_node *node,
8509                         void *user), void *user)
8511 The ancestors of a node in a schedule tree can be visited from
8512 the root down to and including the parent of the node using
8513 the following function.
8515         #include <isl/schedule_node.h>
8516         isl_stat isl_schedule_node_foreach_ancestor_top_down(
8517                 __isl_keep isl_schedule_node *node,
8518                 isl_stat (*fn)(__isl_keep isl_schedule_node *node,
8519                         void *user), void *user);
8521 The following functions allows for a depth-first post-order
8522 traversal of the nodes in a schedule tree or
8523 of the descendants of a specific node (including the node
8524 itself), where the user callback is allowed to modify the
8525 visited node.
8527         #include <isl/schedule.h>
8528         __isl_give isl_schedule *
8529         isl_schedule_map_schedule_node_bottom_up(
8530                 __isl_take isl_schedule *schedule,
8531                 __isl_give isl_schedule_node *(*fn)(
8532                         __isl_take isl_schedule_node *node,
8533                         void *user), void *user);
8535         #include <isl/schedule_node.h>
8536         __isl_give isl_schedule_node *
8537         isl_schedule_node_map_descendant_bottom_up(
8538                 __isl_take isl_schedule_node *node,
8539                 __isl_give isl_schedule_node *(*fn)(
8540                         __isl_take isl_schedule_node *node,
8541                         void *user), void *user);
8543 The traversal continues from the node returned by the callback function.
8544 It is the responsibility of the user to ensure that this does not
8545 lead to an infinite loop.  It is safest to always return a pointer
8546 to the same position (same ancestors and child positions) as the input node.
8548 The following function removes a node (along with its descendants)
8549 from a schedule tree and returns a pointer to the leaf at the
8550 same position in the updated tree.
8551 It is not allowed to remove the root of a schedule tree or
8552 a child of a set or sequence node.
8554         #include <isl/schedule_node.h>
8555         __isl_give isl_schedule_node *isl_schedule_node_cut(
8556                 __isl_take isl_schedule_node *node);
8558 The following function removes a single node
8559 from a schedule tree and returns a pointer to the child
8560 of the node, now located at the position of the original node
8561 or to a leaf node at that position if there was no child.
8562 It is not allowed to remove the root of a schedule tree,
8563 a set or sequence node, a child of a set or sequence node or
8564 a band node with an anchored subtree.
8566         #include <isl/schedule_node.h>
8567         __isl_give isl_schedule_node *isl_schedule_node_delete(
8568                 __isl_take isl_schedule_node *node);
8570 Most nodes in a schedule tree only contain local information.
8571 In some cases, however, a node may also refer to the schedule dimensions
8572 of its outer band nodes.
8573 This means that the position of the node within the tree should
8574 not be changed, or at least that no changes are performed to the
8575 outer band nodes.  The following function can be used to test
8576 whether the subtree rooted at a given node contains any such nodes.
8578         #include <isl/schedule_node.h>
8579         isl_bool isl_schedule_node_is_subtree_anchored(
8580                 __isl_keep isl_schedule_node *node);
8582 The following function resets the user pointers on all parameter
8583 and tuple identifiers referenced by the given schedule node.
8585         #include <isl/schedule_node.h>
8586         __isl_give isl_schedule_node *isl_schedule_node_reset_user(
8587                 __isl_take isl_schedule_node *node);
8589 The following function aligns the parameters of the given schedule
8590 node to the given space.
8592         #include <isl/schedule_node.h>
8593         __isl_give isl_schedule_node *
8594         isl_schedule_node_align_params(
8595                 __isl_take isl_schedule_node *node,
8596                 __isl_take isl_space *space);
8598 Several node types have their own functions for querying
8599 (and in some cases setting) some node type specific properties.
8601         #include <isl/schedule_node.h>
8602         __isl_give isl_space *isl_schedule_node_band_get_space(
8603                 __isl_keep isl_schedule_node *node);
8604         __isl_give isl_multi_union_pw_aff *
8605         isl_schedule_node_band_get_partial_schedule(
8606                 __isl_keep isl_schedule_node *node);
8607         __isl_give isl_union_map *
8608         isl_schedule_node_band_get_partial_schedule_union_map(
8609                 __isl_keep isl_schedule_node *node);
8610         unsigned isl_schedule_node_band_n_member(
8611                 __isl_keep isl_schedule_node *node);
8612         isl_bool isl_schedule_node_band_member_get_coincident(
8613                 __isl_keep isl_schedule_node *node, int pos);
8614         __isl_give isl_schedule_node *
8615         isl_schedule_node_band_member_set_coincident(
8616                 __isl_take isl_schedule_node *node, int pos,
8617                 int coincident);
8618         isl_bool isl_schedule_node_band_get_permutable(
8619                 __isl_keep isl_schedule_node *node);
8620         __isl_give isl_schedule_node *
8621         isl_schedule_node_band_set_permutable(
8622                 __isl_take isl_schedule_node *node, int permutable);
8623         enum isl_ast_loop_type
8624         isl_schedule_node_band_member_get_ast_loop_type(
8625                 __isl_keep isl_schedule_node *node, int pos);
8626         __isl_give isl_schedule_node *
8627         isl_schedule_node_band_member_set_ast_loop_type(
8628                 __isl_take isl_schedule_node *node, int pos,
8629                 enum isl_ast_loop_type type);
8630         __isl_give isl_union_set *
8631         enum isl_ast_loop_type
8632         isl_schedule_node_band_member_get_isolate_ast_loop_type(
8633                 __isl_keep isl_schedule_node *node, int pos);
8634         __isl_give isl_schedule_node *
8635         isl_schedule_node_band_member_set_isolate_ast_loop_type(
8636                 __isl_take isl_schedule_node *node, int pos,
8637                 enum isl_ast_loop_type type);
8638         isl_schedule_node_band_get_ast_build_options(
8639                 __isl_keep isl_schedule_node *node);
8640         __isl_give isl_schedule_node *
8641         isl_schedule_node_band_set_ast_build_options(
8642                 __isl_take isl_schedule_node *node,
8643                 __isl_take isl_union_set *options);
8644         __isl_give isl_set *
8645         isl_schedule_node_band_get_ast_isolate_option(
8646                 __isl_keep isl_schedule_node *node);
8648 The function C<isl_schedule_node_band_get_space> returns the space
8649 of the partial schedule of the band.
8650 The function C<isl_schedule_node_band_get_partial_schedule_union_map>
8651 returns a representation of the partial schedule of the band node
8652 in the form of an C<isl_union_map>.
8653 The coincident and permutable properties are set by
8654 C<isl_schedule_constraints_compute_schedule> on the schedule tree
8655 it produces.
8656 A scheduling dimension is considered to be ``coincident''
8657 if it satisfies the coincidence constraints within its band.
8658 That is, if the dependence distances of the coincidence
8659 constraints are all zero in that direction (for fixed
8660 iterations of outer bands).
8661 A band is marked permutable if it was produced using the Pluto-like scheduler.
8662 Note that the scheduler may have to resort to a Feautrier style scheduling
8663 step even if the default scheduler is used.
8664 An C<isl_ast_loop_type> is one of C<isl_ast_loop_default>,
8665 C<isl_ast_loop_atomic>, C<isl_ast_loop_unroll> or C<isl_ast_loop_separate>.
8666 For the meaning of these loop AST generation types and the difference
8667 between the regular loop AST generation type and the isolate
8668 loop AST generation type, see L</"AST Generation Options (Schedule Tree)">.
8669 The functions C<isl_schedule_node_band_member_get_ast_loop_type>
8670 and C<isl_schedule_node_band_member_get_isolate_ast_loop_type>
8671 may return C<isl_ast_loop_error> if an error occurs.
8672 The AST build options govern how an AST is generated for
8673 the individual schedule dimensions during AST generation.
8674 See L</"AST Generation Options (Schedule Tree)">.
8675 The isolate option for the given node can be extracted from these
8676 AST build options using the function
8677 C<isl_schedule_node_band_get_ast_isolate_option>.
8679         #include <isl/schedule_node.h>
8680         __isl_give isl_set *
8681         isl_schedule_node_context_get_context(
8682                 __isl_keep isl_schedule_node *node);
8684         #include <isl/schedule_node.h>
8685         __isl_give isl_union_set *
8686         isl_schedule_node_domain_get_domain(
8687                 __isl_keep isl_schedule_node *node);
8689         #include <isl/schedule_node.h>
8690         __isl_give isl_union_map *
8691         isl_schedule_node_expansion_get_expansion(
8692                 __isl_keep isl_schedule_node *node);
8693         __isl_give isl_union_pw_multi_aff *
8694         isl_schedule_node_expansion_get_contraction(
8695                 __isl_keep isl_schedule_node *node);
8697         #include <isl/schedule_node.h>
8698         __isl_give isl_union_map *
8699         isl_schedule_node_extension_get_extension(
8700                 __isl_keep isl_schedule_node *node);
8702         #include <isl/schedule_node.h>
8703         __isl_give isl_union_set *
8704         isl_schedule_node_filter_get_filter(
8705                 __isl_keep isl_schedule_node *node);
8707         #include <isl/schedule_node.h>
8708         __isl_give isl_set *isl_schedule_node_guard_get_guard(
8709                 __isl_keep isl_schedule_node *node);
8711         #include <isl/schedule_node.h>
8712         __isl_give isl_id *isl_schedule_node_mark_get_id(
8713                 __isl_keep isl_schedule_node *node);
8715 The following functions can be used to obtain an C<isl_multi_union_pw_aff>,
8716 an C<isl_union_pw_multi_aff> or C<isl_union_map> representation of
8717 partial schedules related to the node.
8719         #include <isl/schedule_node.h>
8720         __isl_give isl_multi_union_pw_aff *
8721         isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(
8722                 __isl_keep isl_schedule_node *node);
8723         __isl_give isl_union_pw_multi_aff *
8724         isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(
8725                 __isl_keep isl_schedule_node *node);
8726         __isl_give isl_union_map *
8727         isl_schedule_node_get_prefix_schedule_union_map(
8728                 __isl_keep isl_schedule_node *node);
8729         __isl_give isl_union_map *
8730         isl_schedule_node_get_prefix_schedule_relation(
8731                 __isl_keep isl_schedule_node *node);
8732         __isl_give isl_union_map *
8733         isl_schedule_node_get_subtree_schedule_union_map(
8734                 __isl_keep isl_schedule_node *node);
8736 In particular, the functions
8737 C<isl_schedule_node_get_prefix_schedule_multi_union_pw_aff>,
8738 C<isl_schedule_node_get_prefix_schedule_union_pw_multi_aff>
8739 and C<isl_schedule_node_get_prefix_schedule_union_map>
8740 return a relative ordering on the domain elements that reach the given
8741 node determined by its ancestors.
8742 The function C<isl_schedule_node_get_prefix_schedule_relation>
8743 additionally includes the domain constraints in the result.
8744 The function C<isl_schedule_node_get_subtree_schedule_union_map>
8745 returns a representation of the partial schedule defined by the
8746 subtree rooted at the given node.
8747 If the tree contains any expansion nodes, then the subtree schedule
8748 is formulated in terms of the expanded domain elements.
8749 The tree passed to functions returning a prefix schedule
8750 may only contain extension nodes if these would not affect
8751 the result of these functions.  That is, if one of the ancestors
8752 is an extension node, then all of the domain elements that were
8753 added by the extension node need to have been filtered out
8754 by filter nodes between the extension node and the input node.
8755 The tree passed to C<isl_schedule_node_get_subtree_schedule_union_map>
8756 may not contain in extension nodes in the selected subtree.
8758 The expansion/contraction defined by an entire subtree, combining
8759 the expansions/contractions
8760 on the expansion nodes in the subtree, can be obtained using
8761 the following functions.
8763         #include <isl/schedule_node.h>
8764         __isl_give isl_union_map *
8765         isl_schedule_node_get_subtree_expansion(
8766                 __isl_keep isl_schedule_node *node);
8767         __isl_give isl_union_pw_multi_aff *
8768         isl_schedule_node_get_subtree_contraction(
8769                 __isl_keep isl_schedule_node *node);
8771 The total number of outer band members of given node, i.e.,
8772 the shared output dimension of the maps in the result
8773 of C<isl_schedule_node_get_prefix_schedule_union_map> can be obtained
8774 using the following function.
8776         #include <isl/schedule_node.h>
8777         int isl_schedule_node_get_schedule_depth(
8778                 __isl_keep isl_schedule_node *node);
8780 The following functions return the elements that reach the given node
8781 or the union of universes in the spaces that contain these elements.
8783         #include <isl/schedule_node.h>
8784         __isl_give isl_union_set *
8785         isl_schedule_node_get_domain(
8786                 __isl_keep isl_schedule_node *node);
8787         __isl_give isl_union_set *
8788         isl_schedule_node_get_universe_domain(
8789                 __isl_keep isl_schedule_node *node);
8791 The input tree of C<isl_schedule_node_get_domain>
8792 may only contain extension nodes if these would not affect
8793 the result of this function.  That is, if one of the ancestors
8794 is an extension node, then all of the domain elements that were
8795 added by the extension node need to have been filtered out
8796 by filter nodes between the extension node and the input node.
8798 The following functions can be used to introduce additional nodes
8799 in the schedule tree.  The new node is introduced at the point
8800 in the tree where the C<isl_schedule_node> points to and
8801 the results points to the new node.
8803         #include <isl/schedule_node.h>
8804         __isl_give isl_schedule_node *
8805         isl_schedule_node_insert_partial_schedule(
8806                 __isl_take isl_schedule_node *node,
8807                 __isl_take isl_multi_union_pw_aff *schedule);
8809 This function inserts a new band node with (the greatest integer
8810 part of) the given partial schedule.
8811 The subtree rooted at the given node is assumed not to have
8812 any anchored nodes.
8814         #include <isl/schedule_node.h>
8815         __isl_give isl_schedule_node *
8816         isl_schedule_node_insert_context(
8817                 __isl_take isl_schedule_node *node,
8818                 __isl_take isl_set *context);
8820 This function inserts a new context node with the given context constraints.
8822         #include <isl/schedule_node.h>
8823         __isl_give isl_schedule_node *
8824         isl_schedule_node_insert_filter(
8825                 __isl_take isl_schedule_node *node,
8826                 __isl_take isl_union_set *filter);
8828 This function inserts a new filter node with the given filter.
8829 If the original node already pointed to a filter node, then the
8830 two filter nodes are merged into one.
8832         #include <isl/schedule_node.h>
8833         __isl_give isl_schedule_node *
8834         isl_schedule_node_insert_guard(
8835                 __isl_take isl_schedule_node *node,
8836                 __isl_take isl_set *guard);
8838 This function inserts a new guard node with the given guard constraints.
8840         #include <isl/schedule_node.h>
8841         __isl_give isl_schedule_node *
8842         isl_schedule_node_insert_mark(
8843                 __isl_take isl_schedule_node *node,
8844                 __isl_take isl_id *mark);
8846 This function inserts a new mark node with the give mark identifier.
8848         #include <isl/schedule_node.h>
8849         __isl_give isl_schedule_node *
8850         isl_schedule_node_insert_sequence(
8851                 __isl_take isl_schedule_node *node,
8852                 __isl_take isl_union_set_list *filters);
8853         __isl_give isl_schedule_node *
8854         isl_schedule_node_insert_set(
8855                 __isl_take isl_schedule_node *node,
8856                 __isl_take isl_union_set_list *filters);
8858 These functions insert a new sequence or set node with the given
8859 filters as children.
8861         #include <isl/schedule_node.h>
8862         __isl_give isl_schedule_node *isl_schedule_node_group(
8863                 __isl_take isl_schedule_node *node,
8864                 __isl_take isl_id *group_id);
8866 This function introduces an expansion node in between the current
8867 node and its parent that expands instances of a space with tuple
8868 identifier C<group_id> to the original domain elements that reach
8869 the node.  The group instances are identified by the prefix schedule
8870 of those domain elements.  The ancestors of the node are adjusted
8871 to refer to the group instances instead of the original domain
8872 elements.  The return value points to the same node in the updated
8873 schedule tree as the input node, i.e., to the child of the newly
8874 introduced expansion node.  Grouping instances of different statements
8875 ensures that they will be treated as a single statement by the
8876 AST generator up to the point of the expansion node.
8878 The following function can be used to flatten a nested
8879 sequence.
8881         #include <isl/schedule_node.h>
8882         __isl_give isl_schedule_node *
8883         isl_schedule_node_sequence_splice_child(
8884                 __isl_take isl_schedule_node *node, int pos);
8886 That is, given a sequence node C<node> that has another sequence node
8887 in its child at position C<pos> (in particular, the child of that filter
8888 node is a sequence node), attach the children of that other sequence
8889 node as children of C<node>, replacing the original child at position
8890 C<pos>.
8892 The partial schedule of a band node can be scaled (down) or reduced using
8893 the following functions.
8895         #include <isl/schedule_node.h>
8896         __isl_give isl_schedule_node *
8897         isl_schedule_node_band_scale(
8898                 __isl_take isl_schedule_node *node,
8899                 __isl_take isl_multi_val *mv);
8900         __isl_give isl_schedule_node *
8901         isl_schedule_node_band_scale_down(
8902                 __isl_take isl_schedule_node *node,
8903                 __isl_take isl_multi_val *mv);
8904         __isl_give isl_schedule_node *
8905         isl_schedule_node_band_mod(
8906                 __isl_take isl_schedule_node *node,
8907                 __isl_take isl_multi_val *mv);
8909 The spaces of the two arguments need to match.
8910 After scaling, the partial schedule is replaced by its greatest
8911 integer part to ensure that the schedule remains integral.
8913 The partial schedule of a band node can be shifted by an
8914 C<isl_multi_union_pw_aff> with a domain that is a superset
8915 of the domain of the partial schedule using
8916 the following function.
8918         #include <isl/schedule_node.h>
8919         __isl_give isl_schedule_node *
8920         isl_schedule_node_band_shift(
8921                 __isl_take isl_schedule_node *node,
8922                 __isl_take isl_multi_union_pw_aff *shift);
8924 A band node can be tiled using the following function.
8926         #include <isl/schedule_node.h>
8927         __isl_give isl_schedule_node *isl_schedule_node_band_tile(
8928                 __isl_take isl_schedule_node *node,
8929                 __isl_take isl_multi_val *sizes);
8931         isl_stat isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
8932                 int val);
8933         int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
8934         isl_stat isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
8935                 int val);
8936         int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
8938 The C<isl_schedule_node_band_tile> function tiles
8939 the band using the given tile sizes inside its schedule.
8940 A new child band node is created to represent the point loops and it is
8941 inserted between the modified band and its children.
8942 The subtree rooted at the given node is assumed not to have
8943 any anchored nodes.
8944 The C<tile_scale_tile_loops> option specifies whether the tile
8945 loops iterators should be scaled by the tile sizes.
8946 If the C<tile_shift_point_loops> option is set, then the point loops
8947 are shifted to start at zero.
8949 A band node can be split into two nested band nodes
8950 using the following function.
8952         #include <isl/schedule_node.h>
8953         __isl_give isl_schedule_node *isl_schedule_node_band_split(
8954                 __isl_take isl_schedule_node *node, int pos);
8956 The resulting outer band node contains the first C<pos> dimensions of
8957 the schedule of C<node> while the inner band contains the remaining dimensions.
8958 The schedules of the two band nodes live in anonymous spaces.
8959 The loop AST generation type options and the isolate option
8960 are split over the two band nodes.
8962 A band node can be moved down to the leaves of the subtree rooted
8963 at the band node using the following function.
8965         #include <isl/schedule_node.h>
8966         __isl_give isl_schedule_node *isl_schedule_node_band_sink(
8967                 __isl_take isl_schedule_node *node);
8969 The subtree rooted at the given node is assumed not to have
8970 any anchored nodes.
8971 The result points to the node in the resulting tree that is in the same
8972 position as the node pointed to by C<node> in the original tree.
8974         #include <isl/schedule_node.h>
8975         __isl_give isl_schedule_node *
8976         isl_schedule_node_order_before(
8977                 __isl_take isl_schedule_node *node,
8978                 __isl_take isl_union_set *filter);
8979         __isl_give isl_schedule_node *
8980         isl_schedule_node_order_after(
8981                 __isl_take isl_schedule_node *node,
8982                 __isl_take isl_union_set *filter);
8984 These functions split the domain elements that reach C<node>
8985 into those that satisfy C<filter> and those that do not and
8986 arranges for the elements that do satisfy the filter to be
8987 executed before (in case of C<isl_schedule_node_order_before>)
8988 or after (in case of C<isl_schedule_node_order_after>)
8989 those that do not.  The order is imposed by
8990 a sequence node, possibly reusing the grandparent of C<node>
8991 on two copies of the subtree attached to the original C<node>.
8992 Both copies are simplified with respect to their filter.
8994 Return a pointer to the copy of the subtree that does not
8995 satisfy C<filter>.  If there is no such copy (because all
8996 reaching domain elements satisfy the filter), then return
8997 the original pointer.
8999         #include <isl/schedule_node.h>
9000         __isl_give isl_schedule_node *
9001         isl_schedule_node_graft_before(
9002                 __isl_take isl_schedule_node *node,
9003                 __isl_take isl_schedule_node *graft);
9004         __isl_give isl_schedule_node *
9005         isl_schedule_node_graft_after(
9006                 __isl_take isl_schedule_node *node,
9007                 __isl_take isl_schedule_node *graft);
9009 This function inserts the C<graft> tree into the tree containing C<node>
9010 such that it is executed before (in case of C<isl_schedule_node_graft_before>)
9011 or after (in case of C<isl_schedule_node_graft_after>) C<node>.
9012 The root node of C<graft>
9013 should be an extension node where the domain of the extension
9014 is the flat product of all outer band nodes of C<node>.
9015 The root node may also be a domain node.
9016 The elements of the domain or the range of the extension may not
9017 intersect with the domain elements that reach "node".
9018 The schedule tree of C<graft> may not be anchored.
9020 The schedule tree of C<node> is modified to include an extension node
9021 corresponding to the root node of C<graft> as a child of the original
9022 parent of C<node>.  The original node that C<node> points to and the
9023 child of the root node of C<graft> are attached to this extension node
9024 through a sequence, with appropriate filters and with the child
9025 of C<graft> appearing before or after the original C<node>.
9027 If C<node> already appears inside a sequence that is the child of
9028 an extension node and if the spaces of the new domain elements
9029 do not overlap with those of the original domain elements,
9030 then that extension node is extended with the new extension
9031 rather than introducing a new segment of extension and sequence nodes.
9033 Return a pointer to the same node in the modified tree that
9034 C<node> pointed to in the original tree.
9036 A representation of the schedule node can be printed using
9038         #include <isl/schedule_node.h>
9039         __isl_give isl_printer *isl_printer_print_schedule_node(
9040                 __isl_take isl_printer *p,
9041                 __isl_keep isl_schedule_node *node);
9042         __isl_give char *isl_schedule_node_to_str(
9043                 __isl_keep isl_schedule_node *node);
9045 C<isl_schedule_node_to_str> prints the schedule node in block format.
9047 =head2 Dependence Analysis
9049 C<isl> contains specialized functionality for performing
9050 array dataflow analysis.  That is, given a I<sink> access relation,
9051 a collection of possible I<source> accesses and
9052 a collection of I<kill> accesses,
9053 C<isl> can compute relations that describe
9054 for each iteration of the sink access, which iterations
9055 of which of the source access relations may have
9056 accessed the same data element before the given iteration
9057 of the sink access without any intermediate kill of that data element.
9058 The resulting dependence relations map source iterations
9059 to either the corresponding sink iterations or
9060 pairs of corresponding sink iterations and accessed data elements.
9061 To compute standard flow dependences, the sink should be
9062 a read, while the sources should be writes.
9063 If no kills are specified,
9064 then memory based dependence analysis is performed.
9065 If, on the other hand, all sources are also kills,
9066 then value based dependence analysis is performed.
9067 If any of the source accesses are marked as being I<must>
9068 accesses, then they are also treated as kills.
9069 Furthermore, the specification of must-sources results
9070 in the computation of must-dependences.
9071 Only dependences originating in a must access not coscheduled
9072 with any other access to the same element and without
9073 any may accesses between the must access and the sink access
9074 are considered to be must dependences.
9076 =head3 High-level Interface
9078 A high-level interface to dependence analysis is provided
9079 by the following function.
9081         #include <isl/flow.h>
9082         __isl_give isl_union_flow *
9083         isl_union_access_info_compute_flow(
9084                 __isl_take isl_union_access_info *access);
9086 The input C<isl_union_access_info> object describes the sink
9087 access relations, the source access relations and a schedule,
9088 while the output C<isl_union_flow> object describes
9089 the resulting dependence relations and the subsets of the
9090 sink relations for which no source was found.
9092 An C<isl_union_access_info> is created, modified, copied and freed using
9093 the following functions.
9095         #include <isl/flow.h>
9096         __isl_give isl_union_access_info *
9097         isl_union_access_info_from_sink(
9098                 __isl_take isl_union_map *sink);
9099         __isl_give isl_union_access_info *
9100         isl_union_access_info_set_kill(
9101                 __isl_take isl_union_access_info *access,
9102                 __isl_take isl_union_map *kill);
9103         __isl_give isl_union_access_info *
9104         isl_union_access_info_set_may_source(
9105                 __isl_take isl_union_access_info *access,
9106                 __isl_take isl_union_map *may_source);
9107         __isl_give isl_union_access_info *
9108         isl_union_access_info_set_must_source(
9109                 __isl_take isl_union_access_info *access,
9110                 __isl_take isl_union_map *must_source);
9111         __isl_give isl_union_access_info *
9112         isl_union_access_info_set_schedule(
9113                 __isl_take isl_union_access_info *access,
9114                 __isl_take isl_schedule *schedule);
9115         __isl_give isl_union_access_info *
9116         isl_union_access_info_set_schedule_map(
9117                 __isl_take isl_union_access_info *access,
9118                 __isl_take isl_union_map *schedule_map);
9119         __isl_give isl_union_access_info *
9120         isl_union_access_info_copy(
9121                 __isl_keep isl_union_access_info *access);
9122         __isl_null isl_union_access_info *
9123         isl_union_access_info_free(
9124                 __isl_take isl_union_access_info *access);
9126 The may sources set by C<isl_union_access_info_set_may_source>
9127 do not need to include the must sources set by
9128 C<isl_union_access_info_set_must_source> as a subset.
9129 The kills set by C<isl_union_access_info_set_kill> may overlap
9130 with the may-sources and/or must-sources.
9131 The user is free not to call one (or more) of these functions,
9132 in which case the corresponding set is kept to its empty default.
9133 Similarly, the default schedule initialized by
9134 C<isl_union_access_info_from_sink> is empty.
9135 The current schedule is determined by the last call to either
9136 C<isl_union_access_info_set_schedule> or
9137 C<isl_union_access_info_set_schedule_map>.
9138 The domain of the schedule corresponds to the domains of
9139 the access relations.  In particular, the domains of the access
9140 relations are effectively intersected with the domain of the schedule
9141 and only the resulting accesses are considered by the dependence analysis.
9143 An C<isl_union_access_info> object can be read from input
9144 using the following function.
9146         #include <isl/flow.h>
9147         __isl_give isl_union_access_info *
9148         isl_union_access_info_read_from_file(isl_ctx *ctx,
9149                 FILE *input);
9151 A representation of the information contained in an object
9152 of type C<isl_union_access_info> can be obtained using
9154         #include <isl/flow.h>
9155         __isl_give isl_printer *
9156         isl_printer_print_union_access_info(
9157                 __isl_take isl_printer *p,
9158                 __isl_keep isl_union_access_info *access);
9159         __isl_give char *isl_union_access_info_to_str(
9160                 __isl_keep isl_union_access_info *access);
9162 C<isl_union_access_info_to_str> prints the information in flow format.
9164 The output of C<isl_union_access_info_compute_flow> can be examined,
9165 copied, and freed using the following functions.
9167         #include <isl/flow.h>
9168         __isl_give isl_union_map *isl_union_flow_get_must_dependence(
9169                 __isl_keep isl_union_flow *flow);
9170         __isl_give isl_union_map *isl_union_flow_get_may_dependence(
9171                 __isl_keep isl_union_flow *flow);
9172         __isl_give isl_union_map *
9173         isl_union_flow_get_full_must_dependence(
9174                 __isl_keep isl_union_flow *flow);
9175         __isl_give isl_union_map *
9176         isl_union_flow_get_full_may_dependence(
9177                 __isl_keep isl_union_flow *flow);
9178         __isl_give isl_union_map *isl_union_flow_get_must_no_source(
9179                 __isl_keep isl_union_flow *flow);
9180         __isl_give isl_union_map *isl_union_flow_get_may_no_source(
9181                 __isl_keep isl_union_flow *flow);
9182         __isl_give isl_union_flow *isl_union_flow_copy(
9183                 __isl_keep isl_union_flow *flow);
9184         __isl_null isl_union_flow *isl_union_flow_free(
9185                 __isl_take isl_union_flow *flow);
9187 The relation returned by C<isl_union_flow_get_must_dependence>
9188 relates domain elements of must sources to domain elements of the sink.
9189 The relation returned by C<isl_union_flow_get_may_dependence>
9190 relates domain elements of must or may sources to domain elements of the sink
9191 and includes the previous relation as a subset.
9192 The relation returned by C<isl_union_flow_get_full_must_dependence>
9193 relates domain elements of must sources to pairs of domain elements of the sink
9194 and accessed data elements.
9195 The relation returned by C<isl_union_flow_get_full_may_dependence>
9196 relates domain elements of must or may sources to pairs of
9197 domain elements of the sink and accessed data elements.
9198 This relation includes the previous relation as a subset.
9199 The relation returned by C<isl_union_flow_get_must_no_source> is the subset
9200 of the sink relation for which no dependences have been found.
9201 The relation returned by C<isl_union_flow_get_may_no_source> is the subset
9202 of the sink relation for which no definite dependences have been found.
9203 That is, it contains those sink access that do not contribute to any
9204 of the elements in the relation returned
9205 by C<isl_union_flow_get_must_dependence>.
9207 A representation of the information contained in an object
9208 of type C<isl_union_flow> can be obtained using
9210         #include <isl/flow.h>
9211         __isl_give isl_printer *isl_printer_print_union_flow(
9212                 __isl_take isl_printer *p,
9213                 __isl_keep isl_union_flow *flow);
9214         __isl_give char *isl_union_flow_to_str(
9215                 __isl_keep isl_union_flow *flow);
9217 C<isl_union_flow_to_str> prints the information in flow format.
9219 =head3 Low-level Interface
9221 A lower-level interface is provided by the following functions.
9223         #include <isl/flow.h>
9225         typedef int (*isl_access_level_before)(void *first, void *second);
9227         __isl_give isl_access_info *isl_access_info_alloc(
9228                 __isl_take isl_map *sink,
9229                 void *sink_user, isl_access_level_before fn,
9230                 int max_source);
9231         __isl_give isl_access_info *isl_access_info_add_source(
9232                 __isl_take isl_access_info *acc,
9233                 __isl_take isl_map *source, int must,
9234                 void *source_user);
9235         __isl_null isl_access_info *isl_access_info_free(
9236                 __isl_take isl_access_info *acc);
9238         __isl_give isl_flow *isl_access_info_compute_flow(
9239                 __isl_take isl_access_info *acc);
9241         isl_stat isl_flow_foreach(__isl_keep isl_flow *deps,
9242                 isl_stat (*fn)(__isl_take isl_map *dep, int must,
9243                           void *dep_user, void *user),
9244                 void *user);
9245         __isl_give isl_map *isl_flow_get_no_source(
9246                 __isl_keep isl_flow *deps, int must);
9247         void isl_flow_free(__isl_take isl_flow *deps);
9249 The function C<isl_access_info_compute_flow> performs the actual
9250 dependence analysis.  The other functions are used to construct
9251 the input for this function or to read off the output.
9253 The input is collected in an C<isl_access_info>, which can
9254 be created through a call to C<isl_access_info_alloc>.
9255 The arguments to this functions are the sink access relation
9256 C<sink>, a token C<sink_user> used to identify the sink
9257 access to the user, a callback function for specifying the
9258 relative order of source and sink accesses, and the number
9259 of source access relations that will be added.
9261 The callback function has type C<int (*)(void *first, void *second)>.
9262 The function is called with two user supplied tokens identifying
9263 either a source or the sink and it should return the shared nesting
9264 level and the relative order of the two accesses.
9265 In particular, let I<n> be the number of loops shared by
9266 the two accesses.  If C<first> precedes C<second> textually,
9267 then the function should return I<2 * n + 1>; otherwise,
9268 it should return I<2 * n>.
9269 The low-level interface assumes that no sources are coscheduled.
9270 If the information returned by the callback does not allow
9271 the relative order to be determined, then one of the sources
9272 is arbitrarily taken to be executed after the other(s).
9274 The sources can be added to the C<isl_access_info> object by performing
9275 (at most) C<max_source> calls to C<isl_access_info_add_source>.
9276 C<must> indicates whether the source is a I<must> access
9277 or a I<may> access.  Note that a multi-valued access relation
9278 should only be marked I<must> if every iteration in the domain
9279 of the relation accesses I<all> elements in its image.
9280 The C<source_user> token is again used to identify
9281 the source access.  The range of the source access relation
9282 C<source> should have the same dimension as the range
9283 of the sink access relation.
9284 The C<isl_access_info_free> function should usually not be
9285 called explicitly, because it is already called implicitly by
9286 C<isl_access_info_compute_flow>.
9288 The result of the dependence analysis is collected in an
9289 C<isl_flow>.  There may be elements of
9290 the sink access for which no preceding source access could be
9291 found or for which all preceding sources are I<may> accesses.
9292 The relations containing these elements can be obtained through
9293 calls to C<isl_flow_get_no_source>, the first with C<must> set
9294 and the second with C<must> unset.
9295 In the case of standard flow dependence analysis,
9296 with the sink a read and the sources I<must> writes,
9297 the first relation corresponds to the reads from uninitialized
9298 array elements and the second relation is empty.
9299 The actual flow dependences can be extracted using
9300 C<isl_flow_foreach>.  This function will call the user-specified
9301 callback function C<fn> for each B<non-empty> dependence between
9302 a source and the sink.  The callback function is called
9303 with four arguments, the actual flow dependence relation
9304 mapping source iterations to sink iterations, a boolean that
9305 indicates whether it is a I<must> or I<may> dependence, a token
9306 identifying the source and an additional C<void *> with value
9307 equal to the third argument of the C<isl_flow_foreach> call.
9308 A dependence is marked I<must> if it originates from a I<must>
9309 source and if it is not followed by any I<may> sources.
9311 After finishing with an C<isl_flow>, the user should call
9312 C<isl_flow_free> to free all associated memory.
9314 =head3 Interaction with the Low-level Interface
9316 During the dependence analysis, we frequently need to perform
9317 the following operation.  Given a relation between sink iterations
9318 and potential source iterations from a particular source domain,
9319 what is the last potential source iteration corresponding to each
9320 sink iteration.  It can sometimes be convenient to adjust
9321 the set of potential source iterations before or after each such operation.
9322 The prototypical example is fuzzy array dataflow analysis,
9323 where we need to analyze if, based on data-dependent constraints,
9324 the sink iteration can ever be executed without one or more of
9325 the corresponding potential source iterations being executed.
9326 If so, we can introduce extra parameters and select an unknown
9327 but fixed source iteration from the potential source iterations.
9328 To be able to perform such manipulations, C<isl> provides the following
9329 function.
9331         #include <isl/flow.h>
9333         typedef __isl_give isl_restriction *(*isl_access_restrict)(
9334                 __isl_keep isl_map *source_map,
9335                 __isl_keep isl_set *sink, void *source_user,
9336                 void *user);
9337         __isl_give isl_access_info *isl_access_info_set_restrict(
9338                 __isl_take isl_access_info *acc,
9339                 isl_access_restrict fn, void *user);
9341 The function C<isl_access_info_set_restrict> should be called
9342 before calling C<isl_access_info_compute_flow> and registers a callback function
9343 that will be called any time C<isl> is about to compute the last
9344 potential source.  The first argument is the (reverse) proto-dependence,
9345 mapping sink iterations to potential source iterations.
9346 The second argument represents the sink iterations for which
9347 we want to compute the last source iteration.
9348 The third argument is the token corresponding to the source
9349 and the final argument is the token passed to C<isl_access_info_set_restrict>.
9350 The callback is expected to return a restriction on either the input or
9351 the output of the operation computing the last potential source.
9352 If the input needs to be restricted then restrictions are needed
9353 for both the source and the sink iterations.  The sink iterations
9354 and the potential source iterations will be intersected with these sets.
9355 If the output needs to be restricted then only a restriction on the source
9356 iterations is required.
9357 If any error occurs, the callback should return C<NULL>.
9358 An C<isl_restriction> object can be created, freed and inspected
9359 using the following functions.
9361         #include <isl/flow.h>
9363         __isl_give isl_restriction *isl_restriction_input(
9364                 __isl_take isl_set *source_restr,
9365                 __isl_take isl_set *sink_restr);
9366         __isl_give isl_restriction *isl_restriction_output(
9367                 __isl_take isl_set *source_restr);
9368         __isl_give isl_restriction *isl_restriction_none(
9369                 __isl_take isl_map *source_map);
9370         __isl_give isl_restriction *isl_restriction_empty(
9371                 __isl_take isl_map *source_map);
9372         __isl_null isl_restriction *isl_restriction_free(
9373                 __isl_take isl_restriction *restr);
9375 C<isl_restriction_none> and C<isl_restriction_empty> are special
9376 cases of C<isl_restriction_input>.  C<isl_restriction_none>
9377 is essentially equivalent to
9379         isl_restriction_input(isl_set_universe(
9380             isl_space_range(isl_map_get_space(source_map))),
9381                             isl_set_universe(
9382             isl_space_domain(isl_map_get_space(source_map))));
9384 whereas C<isl_restriction_empty> is essentially equivalent to
9386         isl_restriction_input(isl_set_empty(
9387             isl_space_range(isl_map_get_space(source_map))),
9388                             isl_set_universe(
9389             isl_space_domain(isl_map_get_space(source_map))));
9391 =head2 Scheduling
9393         #include <isl/schedule.h>
9394         __isl_give isl_schedule *
9395         isl_schedule_constraints_compute_schedule(
9396                 __isl_take isl_schedule_constraints *sc);
9398 The function C<isl_schedule_constraints_compute_schedule> can be
9399 used to compute a schedule that satisfies the given schedule constraints.
9400 These schedule constraints include the iteration domain for which
9401 a schedule should be computed and dependences between pairs of
9402 iterations.  In particular, these dependences include
9403 I<validity> dependences and I<proximity> dependences.
9404 By default, the algorithm used to construct the schedule is similar
9405 to that of C<Pluto>.
9406 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
9407 be selected.
9408 The generated schedule respects all validity dependences.
9409 That is, all dependence distances over these dependences in the
9410 scheduled space are lexicographically positive.
9412 The default algorithm tries to ensure that the dependence distances
9413 over coincidence constraints are zero and to minimize the
9414 dependence distances over proximity dependences.
9415 Moreover, it tries to obtain sequences (bands) of schedule dimensions
9416 for groups of domains where the dependence distances over validity
9417 dependences have only non-negative values.
9418 Note that when minimizing the maximal dependence distance
9419 over proximity dependences, a single affine expression in the parameters
9420 is constructed that bounds all dependence distances.  If no such expression
9421 exists, then the algorithm will fail and resort to an alternative
9422 scheduling algorithm.  In particular, this means that adding proximity
9423 dependences may eliminate valid solutions.  A typical example where this
9424 phenomenon may occur is when some subset of the proximity dependences
9425 has no restriction on some parameter, forcing the coefficient of that
9426 parameter to be zero, while some other subset forces the dependence
9427 distance to depend on that parameter, requiring the same coefficient
9428 to be non-zero.
9429 When using Feautrier's algorithm, the coincidence and proximity constraints
9430 are only taken into account during the extension to a
9431 full-dimensional schedule.
9433 An C<isl_schedule_constraints> object can be constructed
9434 and manipulated using the following functions.
9436         #include <isl/schedule.h>
9437         __isl_give isl_schedule_constraints *
9438         isl_schedule_constraints_copy(
9439                 __isl_keep isl_schedule_constraints *sc);
9440         __isl_give isl_schedule_constraints *
9441         isl_schedule_constraints_on_domain(
9442                 __isl_take isl_union_set *domain);
9443         __isl_give isl_schedule_constraints *
9444         isl_schedule_constraints_set_context(
9445                 __isl_take isl_schedule_constraints *sc,
9446                 __isl_take isl_set *context);
9447         __isl_give isl_schedule_constraints *
9448         isl_schedule_constraints_set_validity(
9449                 __isl_take isl_schedule_constraints *sc,
9450                 __isl_take isl_union_map *validity);
9451         __isl_give isl_schedule_constraints *
9452         isl_schedule_constraints_set_coincidence(
9453                 __isl_take isl_schedule_constraints *sc,
9454                 __isl_take isl_union_map *coincidence);
9455         __isl_give isl_schedule_constraints *
9456         isl_schedule_constraints_set_proximity(
9457                 __isl_take isl_schedule_constraints *sc,
9458                 __isl_take isl_union_map *proximity);
9459         __isl_give isl_schedule_constraints *
9460         isl_schedule_constraints_set_conditional_validity(
9461                 __isl_take isl_schedule_constraints *sc,
9462                 __isl_take isl_union_map *condition,
9463                 __isl_take isl_union_map *validity);
9464         __isl_give isl_schedule_constraints *
9465         isl_schedule_constraints_apply(
9466                 __isl_take isl_schedule_constraints *sc,
9467                 __isl_take isl_union_map *umap);
9468         __isl_null isl_schedule_constraints *
9469         isl_schedule_constraints_free(
9470                 __isl_take isl_schedule_constraints *sc);
9472 The initial C<isl_schedule_constraints> object created by
9473 C<isl_schedule_constraints_on_domain> does not impose any constraints.
9474 That is, it has an empty set of dependences.
9475 The function C<isl_schedule_constraints_set_context> allows the user
9476 to specify additional constraints on the parameters that may
9477 be assumed to hold during the construction of the schedule.
9478 The function C<isl_schedule_constraints_set_validity> replaces the
9479 validity dependences, mapping domain elements I<i> to domain
9480 elements that should be scheduled after I<i>.
9481 The function C<isl_schedule_constraints_set_coincidence> replaces the
9482 coincidence dependences, mapping domain elements I<i> to domain
9483 elements that should be scheduled together with I<I>, if possible.
9484 The function C<isl_schedule_constraints_set_proximity> replaces the
9485 proximity dependences, mapping domain elements I<i> to domain
9486 elements that should be scheduled either before I<I>
9487 or as early as possible after I<i>.
9489 The function C<isl_schedule_constraints_set_conditional_validity>
9490 replaces the conditional validity constraints.
9491 A conditional validity constraint is only imposed when any of the corresponding
9492 conditions is satisfied, i.e., when any of them is non-zero.
9493 That is, the scheduler ensures that within each band if the dependence
9494 distances over the condition constraints are not all zero
9495 then all corresponding conditional validity constraints are respected.
9496 A conditional validity constraint corresponds to a condition
9497 if the two are adjacent, i.e., if the domain of one relation intersect
9498 the range of the other relation.
9499 The typical use case of conditional validity constraints is
9500 to allow order constraints between live ranges to be violated
9501 as long as the live ranges themselves are local to the band.
9502 To allow more fine-grained control over which conditions correspond
9503 to which conditional validity constraints, the domains and ranges
9504 of these relations may include I<tags>.  That is, the domains and
9505 ranges of those relation may themselves be wrapped relations
9506 where the iteration domain appears in the domain of those wrapped relations
9507 and the range of the wrapped relations can be arbitrarily chosen
9508 by the user.  Conditions and conditional validity constraints are only
9509 considered adjacent to each other if the entire wrapped relation matches.
9510 In particular, a relation with a tag will never be considered adjacent
9511 to a relation without a tag.
9513 The function C<isl_schedule_constraints_apply> takes
9514 schedule constraints that are defined on some set of domain elements
9515 and transforms them to schedule constraints on the elements
9516 to which these domain elements are mapped by the given transformation.
9518 An C<isl_schedule_constraints> object can be inspected
9519 using the following functions.
9521         #include <isl/schedule.h>
9522         __isl_give isl_union_set *
9523         isl_schedule_constraints_get_domain(
9524                 __isl_keep isl_schedule_constraints *sc);
9525         __isl_give isl_set *isl_schedule_constraints_get_context(
9526                 __isl_keep isl_schedule_constraints *sc);
9527         __isl_give isl_union_map *
9528         isl_schedule_constraints_get_validity(
9529                 __isl_keep isl_schedule_constraints *sc);
9530         __isl_give isl_union_map *
9531         isl_schedule_constraints_get_coincidence(
9532                 __isl_keep isl_schedule_constraints *sc);
9533         __isl_give isl_union_map *
9534         isl_schedule_constraints_get_proximity(
9535                 __isl_keep isl_schedule_constraints *sc);
9536         __isl_give isl_union_map *
9537         isl_schedule_constraints_get_conditional_validity(
9538                 __isl_keep isl_schedule_constraints *sc);
9539         __isl_give isl_union_map *
9540         isl_schedule_constraints_get_conditional_validity_condition(
9541                 __isl_keep isl_schedule_constraints *sc);
9543 An C<isl_schedule_constraints> object can be read from input
9544 using the following functions.
9546         #include <isl/schedule.h>
9547         __isl_give isl_schedule_constraints *
9548         isl_schedule_constraints_read_from_str(isl_ctx *ctx,
9549                 const char *str);
9550         __isl_give isl_schedule_constraints *
9551         isl_schedule_constraints_read_from_file(isl_ctx *ctx,
9552                 FILE *input);
9554 The contents of an C<isl_schedule_constraints> object can be printed
9555 using the following functions.
9557         #include <isl/schedule.h>
9558         __isl_give isl_printer *
9559         isl_printer_print_schedule_constraints(
9560                 __isl_take isl_printer *p,
9561                 __isl_keep isl_schedule_constraints *sc);
9562         __isl_give char *isl_schedule_constraints_to_str(
9563                 __isl_keep isl_schedule_constraints *sc);
9565 The following function computes a schedule directly from
9566 an iteration domain and validity and proximity dependences
9567 and is implemented in terms of the functions described above.
9568 The use of C<isl_union_set_compute_schedule> is discouraged.
9570         #include <isl/schedule.h>
9571         __isl_give isl_schedule *isl_union_set_compute_schedule(
9572                 __isl_take isl_union_set *domain,
9573                 __isl_take isl_union_map *validity,
9574                 __isl_take isl_union_map *proximity);
9576 The generated schedule represents a schedule tree.
9577 For more information on schedule trees, see
9578 L</"Schedule Trees">.
9580 =head3 Options
9582         #include <isl/schedule.h>
9583         isl_stat isl_options_set_schedule_max_coefficient(
9584                 isl_ctx *ctx, int val);
9585         int isl_options_get_schedule_max_coefficient(
9586                 isl_ctx *ctx);
9587         isl_stat isl_options_set_schedule_max_constant_term(
9588                 isl_ctx *ctx, int val);
9589         int isl_options_get_schedule_max_constant_term(
9590                 isl_ctx *ctx);
9591         isl_stat isl_options_set_schedule_serialize_sccs(
9592                 isl_ctx *ctx, int val);
9593         int isl_options_get_schedule_serialize_sccs(isl_ctx *ctx);
9594         isl_stat isl_options_set_schedule_whole_component(
9595                 isl_ctx *ctx, int val);
9596         int isl_options_get_schedule_whole_component(
9597                 isl_ctx *ctx);
9598         isl_stat isl_options_set_schedule_maximize_band_depth(
9599                 isl_ctx *ctx, int val);
9600         int isl_options_get_schedule_maximize_band_depth(
9601                 isl_ctx *ctx);
9602         isl_stat isl_options_set_schedule_maximize_coincidence(
9603                 isl_ctx *ctx, int val);
9604         int isl_options_get_schedule_maximize_coincidence(
9605                 isl_ctx *ctx);
9606         isl_stat isl_options_set_schedule_outer_coincidence(
9607                 isl_ctx *ctx, int val);
9608         int isl_options_get_schedule_outer_coincidence(
9609                 isl_ctx *ctx);
9610         isl_stat isl_options_set_schedule_split_scaled(
9611                 isl_ctx *ctx, int val);
9612         int isl_options_get_schedule_split_scaled(
9613                 isl_ctx *ctx);
9614         isl_stat isl_options_set_schedule_treat_coalescing(
9615                 isl_ctx *ctx, int val);
9616         int isl_options_get_schedule_treat_coalescing(
9617                 isl_ctx *ctx);
9618         isl_stat isl_options_set_schedule_algorithm(
9619                 isl_ctx *ctx, int val);
9620         int isl_options_get_schedule_algorithm(
9621                 isl_ctx *ctx);
9622         isl_stat isl_options_set_schedule_carry_self_first(
9623                 isl_ctx *ctx, int val);
9624         int isl_options_get_schedule_carry_self_first(
9625                 isl_ctx *ctx);
9626         isl_stat isl_options_set_schedule_separate_components(
9627                 isl_ctx *ctx, int val);
9628         int isl_options_get_schedule_separate_components(
9629                 isl_ctx *ctx);
9631 =over
9633 =item * schedule_max_coefficient
9635 This option enforces that the coefficients for variable and parameter
9636 dimensions in the calculated schedule are not larger than the specified value.
9637 This option can significantly increase the speed of the scheduling calculation
9638 and may also prevent fusing of unrelated dimensions. A value of -1 means that
9639 this option does not introduce bounds on the variable or parameter
9640 coefficients.
9642 =item * schedule_max_constant_term
9644 This option enforces that the constant coefficients in the calculated schedule
9645 are not larger than the maximal constant term. This option can significantly
9646 increase the speed of the scheduling calculation and may also prevent fusing of
9647 unrelated dimensions. A value of -1 means that this option does not introduce
9648 bounds on the constant coefficients.
9650 =item * schedule_serialize_sccs
9652 If this option is set, then all strongly connected components
9653 in the dependence graph are serialized as soon as they are detected.
9654 This means in particular that instances of statements will only
9655 appear in the same band node if these statements belong
9656 to the same strongly connected component at the point where
9657 the band node is constructed.
9659 =item * schedule_whole_component
9661 If this option is set, then entire (weakly) connected
9662 components in the dependence graph are scheduled together
9663 as a whole.
9664 Otherwise, each strongly connected component within
9665 such a weakly connected component is first scheduled separately
9666 and then combined with other strongly connected components.
9667 This option has no effect if C<schedule_serialize_sccs> is set.
9669 =item * schedule_maximize_band_depth
9671 If this option is set, then the scheduler tries to maximize
9672 the width of the bands.  Wider bands give more possibilities for tiling.
9673 In particular, if the C<schedule_whole_component> option is set,
9674 then bands are split if this might result in wider bands.
9675 Otherwise, the effect of this option is to only allow
9676 strongly connected components to be combined if this does
9677 not reduce the width of the bands.
9678 Note that if the C<schedule_serialize_sccs> options is set, then
9679 the C<schedule_maximize_band_depth> option therefore has no effect.
9681 =item * schedule_maximize_coincidence
9683 This option is only effective if the C<schedule_whole_component>
9684 option is turned off.
9685 If the C<schedule_maximize_coincidence> option is set, then (clusters of)
9686 strongly connected components are only combined with each other
9687 if this does not reduce the number of coincident band members.
9689 =item * schedule_outer_coincidence
9691 If this option is set, then we try to construct schedules
9692 where the outermost scheduling dimension in each band
9693 satisfies the coincidence constraints.
9695 =item * schedule_algorithm
9697 Selects the scheduling algorithm to be used.
9698 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
9699 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
9701 =item * schedule_split_scaled
9703 If this option is set, then we try to construct schedules in which the
9704 constant term is split off from the linear part if the linear parts of
9705 the scheduling rows for all nodes in the graph have a common non-trivial
9706 divisor.
9707 The constant term is then dropped and the linear
9708 part is reduced.
9709 This option is only effective when the Feautrier style scheduler is
9710 being used, either as the main scheduler or as a fallback for the
9711 Pluto-like scheduler.
9713 =item * schedule_treat_coalescing
9715 If this option is set, then the scheduler will try and avoid
9716 producing schedules that perform loop coalescing.
9717 In particular, for the Pluto-like scheduler, this option places
9718 bounds on the schedule coefficients based on the sizes of the instance sets.
9719 For the Feautrier style scheduler, this option detects potentially
9720 coalescing schedules and then tries to adjust the schedule to avoid
9721 the coalescing.
9723 =item * schedule_carry_self_first
9725 If this option is set, then the Feautrier style scheduler
9726 (when used as a fallback for the Pluto-like scheduler) will
9727 first try to only carry self-dependences.
9729 =item * schedule_separate_components
9731 If this option is set then the function C<isl_schedule_get_map>
9732 will treat set nodes in the same way as sequence nodes.
9734 =back
9736 =head2 AST Generation
9738 This section describes the C<isl> functionality for generating
9739 ASTs that visit all the elements
9740 in a domain in an order specified by a schedule tree or
9741 a schedule map.
9742 In case the schedule given as a C<isl_union_map>, an AST is generated
9743 that visits all the elements in the domain of the C<isl_union_map>
9744 according to the lexicographic order of the corresponding image
9745 element(s).  If the range of the C<isl_union_map> consists of
9746 elements in more than one space, then each of these spaces is handled
9747 separately in an arbitrary order.
9748 It should be noted that the schedule tree or the image elements
9749 in a schedule map only specify the I<order>
9750 in which the corresponding domain elements should be visited.
9751 No direct relation between the partial schedule values
9752 or the image elements on the one hand and the loop iterators
9753 in the generated AST on the other hand should be assumed.
9755 Each AST is generated within a build.  The initial build
9756 simply specifies the constraints on the parameters (if any)
9757 and can be created, inspected, copied and freed using the following functions.
9759         #include <isl/ast_build.h>
9760         __isl_give isl_ast_build *isl_ast_build_alloc(
9761                 isl_ctx *ctx);
9762         __isl_give isl_ast_build *isl_ast_build_from_context(
9763                 __isl_take isl_set *set);
9764         __isl_give isl_ast_build *isl_ast_build_copy(
9765                 __isl_keep isl_ast_build *build);
9766         __isl_null isl_ast_build *isl_ast_build_free(
9767                 __isl_take isl_ast_build *build);
9769 The C<set> argument is usually a parameter set with zero or more parameters.
9770 In fact, when creating an AST using C<isl_ast_build_node_from_schedule>,
9771 this set is required to be a parameter set.
9772 An C<isl_ast_build> created using C<isl_ast_build_alloc> does not
9773 specify any parameter constraints.
9774 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
9775 and L</"Fine-grained Control over AST Generation">.
9776 Finally, the AST itself can be constructed using one of the following
9777 functions.
9779         #include <isl/ast_build.h>
9780         __isl_give isl_ast_node *isl_ast_build_node_from_schedule(
9781                 __isl_keep isl_ast_build *build,
9782                 __isl_take isl_schedule *schedule);
9783         __isl_give isl_ast_node *
9784         isl_ast_build_node_from_schedule_map(
9785                 __isl_keep isl_ast_build *build,
9786                 __isl_take isl_union_map *schedule);
9788 =head3 Inspecting the AST
9790 The basic properties of an AST node can be obtained as follows.
9792         #include <isl/ast.h>
9793         enum isl_ast_node_type isl_ast_node_get_type(
9794                 __isl_keep isl_ast_node *node);
9796 The type of an AST node is one of
9797 C<isl_ast_node_for>,
9798 C<isl_ast_node_if>,
9799 C<isl_ast_node_block>,
9800 C<isl_ast_node_mark> or
9801 C<isl_ast_node_user>.
9802 An C<isl_ast_node_for> represents a for node.
9803 An C<isl_ast_node_if> represents an if node.
9804 An C<isl_ast_node_block> represents a compound node.
9805 An C<isl_ast_node_mark> introduces a mark in the AST.
9806 An C<isl_ast_node_user> represents an expression statement.
9807 An expression statement typically corresponds to a domain element, i.e.,
9808 one of the elements that is visited by the AST.
9810 Each type of node has its own additional properties.
9812         #include <isl/ast.h>
9813         __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
9814                 __isl_keep isl_ast_node *node);
9815         __isl_give isl_ast_expr *isl_ast_node_for_get_init(
9816                 __isl_keep isl_ast_node *node);
9817         __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
9818                 __isl_keep isl_ast_node *node);
9819         __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
9820                 __isl_keep isl_ast_node *node);
9821         __isl_give isl_ast_node *isl_ast_node_for_get_body(
9822                 __isl_keep isl_ast_node *node);
9823         isl_bool isl_ast_node_for_is_degenerate(
9824                 __isl_keep isl_ast_node *node);
9826 An C<isl_ast_for> is considered degenerate if it is known to execute
9827 exactly once.
9829         #include <isl/ast.h>
9830         __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
9831                 __isl_keep isl_ast_node *node);
9832         __isl_give isl_ast_node *isl_ast_node_if_get_then(
9833                 __isl_keep isl_ast_node *node);
9834         isl_bool isl_ast_node_if_has_else(
9835                 __isl_keep isl_ast_node *node);
9836         __isl_give isl_ast_node *isl_ast_node_if_get_else(
9837                 __isl_keep isl_ast_node *node);
9839         __isl_give isl_ast_node_list *
9840         isl_ast_node_block_get_children(
9841                 __isl_keep isl_ast_node *node);
9843         __isl_give isl_id *isl_ast_node_mark_get_id(
9844                 __isl_keep isl_ast_node *node);
9845         __isl_give isl_ast_node *isl_ast_node_mark_get_node(
9846                 __isl_keep isl_ast_node *node);
9848 C<isl_ast_node_mark_get_id> returns the identifier of the mark.
9849 C<isl_ast_node_mark_get_node> returns the child node that is being marked.
9851         #include <isl/ast.h>
9852         __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
9853                 __isl_keep isl_ast_node *node);
9855 All descendants of a specific node in the AST (including the node itself)
9856 can be visited
9857 in depth-first pre-order using the following function.
9859         #include <isl/ast.h>
9860         isl_stat isl_ast_node_foreach_descendant_top_down(
9861                 __isl_keep isl_ast_node *node,
9862                 isl_bool (*fn)(__isl_keep isl_ast_node *node,
9863                         void *user), void *user);
9865 The callback function should return C<isl_bool_true> if the children
9866 of the given node should be visited and C<isl_bool_false> if they should not.
9867 It should return C<isl_bool_error> in case of failure, in which case
9868 the entire traversal is aborted.
9870 Each of the returned C<isl_ast_expr>s can in turn be inspected using
9871 the following functions.
9873         #include <isl/ast.h>
9874         enum isl_ast_expr_type isl_ast_expr_get_type(
9875                 __isl_keep isl_ast_expr *expr);
9877 The type of an AST expression is one of
9878 C<isl_ast_expr_op>,
9879 C<isl_ast_expr_id> or
9880 C<isl_ast_expr_int>.
9881 An C<isl_ast_expr_op> represents the result of an operation.
9882 An C<isl_ast_expr_id> represents an identifier.
9883 An C<isl_ast_expr_int> represents an integer value.
9885 Each type of expression has its own additional properties.
9887         #include <isl/ast.h>
9888         enum isl_ast_op_type isl_ast_expr_get_op_type(
9889                 __isl_keep isl_ast_expr *expr);
9890         int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
9891         __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
9892                 __isl_keep isl_ast_expr *expr, int pos);
9893         isl_stat isl_ast_expr_foreach_ast_op_type(
9894                 __isl_keep isl_ast_expr *expr,
9895                 isl_stat (*fn)(enum isl_ast_op_type type,
9896                         void *user), void *user);
9897         isl_stat isl_ast_node_foreach_ast_op_type(
9898                 __isl_keep isl_ast_node *node,
9899                 isl_stat (*fn)(enum isl_ast_op_type type,
9900                         void *user), void *user);
9902 C<isl_ast_expr_get_op_type> returns the type of the operation
9903 performed.  C<isl_ast_expr_get_op_n_arg> returns the number of
9904 arguments.  C<isl_ast_expr_get_op_arg> returns the specified
9905 argument.
9906 C<isl_ast_expr_foreach_ast_op_type> calls C<fn> for each distinct
9907 C<isl_ast_op_type> that appears in C<expr>.
9908 C<isl_ast_node_foreach_ast_op_type> does the same for each distinct
9909 C<isl_ast_op_type> that appears in C<node>.
9910 The operation type is one of the following.
9912 =over
9914 =item C<isl_ast_op_and>
9916 Logical I<and> of two arguments.
9917 Both arguments can be evaluated.
9919 =item C<isl_ast_op_and_then>
9921 Logical I<and> of two arguments.
9922 The second argument can only be evaluated if the first evaluates to true.
9924 =item C<isl_ast_op_or>
9926 Logical I<or> of two arguments.
9927 Both arguments can be evaluated.
9929 =item C<isl_ast_op_or_else>
9931 Logical I<or> of two arguments.
9932 The second argument can only be evaluated if the first evaluates to false.
9934 =item C<isl_ast_op_max>
9936 Maximum of two or more arguments.
9938 =item C<isl_ast_op_min>
9940 Minimum of two or more arguments.
9942 =item C<isl_ast_op_minus>
9944 Change sign.
9946 =item C<isl_ast_op_add>
9948 Sum of two arguments.
9950 =item C<isl_ast_op_sub>
9952 Difference of two arguments.
9954 =item C<isl_ast_op_mul>
9956 Product of two arguments.
9958 =item C<isl_ast_op_div>
9960 Exact division.  That is, the result is known to be an integer.
9962 =item C<isl_ast_op_fdiv_q>
9964 Result of integer division, rounded towards negative
9965 infinity.
9966 The divisor is known to be positive.
9968 =item C<isl_ast_op_pdiv_q>
9970 Result of integer division, where dividend is known to be non-negative.
9971 The divisor is known to be positive.
9973 =item C<isl_ast_op_pdiv_r>
9975 Remainder of integer division, where dividend is known to be non-negative.
9976 The divisor is known to be positive.
9978 =item C<isl_ast_op_zdiv_r>
9980 Equal to zero iff the remainder on integer division is zero.
9981 The divisor is known to be positive.
9983 =item C<isl_ast_op_cond>
9985 Conditional operator defined on three arguments.
9986 If the first argument evaluates to true, then the result
9987 is equal to the second argument.  Otherwise, the result
9988 is equal to the third argument.
9989 The second and third argument may only be evaluated if
9990 the first argument evaluates to true and false, respectively.
9991 Corresponds to C<a ? b : c> in C.
9993 =item C<isl_ast_op_select>
9995 Conditional operator defined on three arguments.
9996 If the first argument evaluates to true, then the result
9997 is equal to the second argument.  Otherwise, the result
9998 is equal to the third argument.
9999 The second and third argument may be evaluated independently
10000 of the value of the first argument.
10001 Corresponds to C<a * b + (1 - a) * c> in C.
10003 =item C<isl_ast_op_eq>
10005 Equality relation.
10007 =item C<isl_ast_op_le>
10009 Less than or equal relation.
10011 =item C<isl_ast_op_lt>
10013 Less than relation.
10015 =item C<isl_ast_op_ge>
10017 Greater than or equal relation.
10019 =item C<isl_ast_op_gt>
10021 Greater than relation.
10023 =item C<isl_ast_op_call>
10025 A function call.
10026 The number of arguments of the C<isl_ast_expr> is one more than
10027 the number of arguments in the function call, the first argument
10028 representing the function being called.
10030 =item C<isl_ast_op_access>
10032 An array access.
10033 The number of arguments of the C<isl_ast_expr> is one more than
10034 the number of index expressions in the array access, the first argument
10035 representing the array being accessed.
10037 =item C<isl_ast_op_member>
10039 A member access.
10040 This operation has two arguments, a structure and the name of
10041 the member of the structure being accessed.
10043 =back
10045         #include <isl/ast.h>
10046         __isl_give isl_id *isl_ast_expr_get_id(
10047                 __isl_keep isl_ast_expr *expr);
10049 Return the identifier represented by the AST expression.
10051         #include <isl/ast.h>
10052         __isl_give isl_val *isl_ast_expr_get_val(
10053                 __isl_keep isl_ast_expr *expr);
10055 Return the integer represented by the AST expression.
10057 =head3 Properties of ASTs
10059         #include <isl/ast.h>
10060         isl_bool isl_ast_expr_is_equal(
10061                 __isl_keep isl_ast_expr *expr1,
10062                 __isl_keep isl_ast_expr *expr2);
10064 Check if two C<isl_ast_expr>s are equal to each other.
10066 =head3 Manipulating and printing the AST
10068 AST nodes can be copied and freed using the following functions.
10070         #include <isl/ast.h>
10071         __isl_give isl_ast_node *isl_ast_node_copy(
10072                 __isl_keep isl_ast_node *node);
10073         __isl_null isl_ast_node *isl_ast_node_free(
10074                 __isl_take isl_ast_node *node);
10076 AST expressions can be copied and freed using the following functions.
10078         #include <isl/ast.h>
10079         __isl_give isl_ast_expr *isl_ast_expr_copy(
10080                 __isl_keep isl_ast_expr *expr);
10081         __isl_null isl_ast_expr *isl_ast_expr_free(
10082                 __isl_take isl_ast_expr *expr);
10084 New AST expressions can be created either directly or within
10085 the context of an C<isl_ast_build>.
10087         #include <isl/ast.h>
10088         __isl_give isl_ast_expr *isl_ast_expr_from_val(
10089                 __isl_take isl_val *v);
10090         __isl_give isl_ast_expr *isl_ast_expr_from_id(
10091                 __isl_take isl_id *id);
10092         __isl_give isl_ast_expr *isl_ast_expr_neg(
10093                 __isl_take isl_ast_expr *expr);
10094         __isl_give isl_ast_expr *isl_ast_expr_address_of(
10095                 __isl_take isl_ast_expr *expr);
10096         __isl_give isl_ast_expr *isl_ast_expr_add(
10097                 __isl_take isl_ast_expr *expr1,
10098                 __isl_take isl_ast_expr *expr2);
10099         __isl_give isl_ast_expr *isl_ast_expr_sub(
10100                 __isl_take isl_ast_expr *expr1,
10101                 __isl_take isl_ast_expr *expr2);
10102         __isl_give isl_ast_expr *isl_ast_expr_mul(
10103                 __isl_take isl_ast_expr *expr1,
10104                 __isl_take isl_ast_expr *expr2);
10105         __isl_give isl_ast_expr *isl_ast_expr_div(
10106                 __isl_take isl_ast_expr *expr1,
10107                 __isl_take isl_ast_expr *expr2);
10108         __isl_give isl_ast_expr *isl_ast_expr_pdiv_q(
10109                 __isl_take isl_ast_expr *expr1,
10110                 __isl_take isl_ast_expr *expr2);
10111         __isl_give isl_ast_expr *isl_ast_expr_pdiv_r(
10112                 __isl_take isl_ast_expr *expr1,
10113                 __isl_take isl_ast_expr *expr2);
10114         __isl_give isl_ast_expr *isl_ast_expr_and(
10115                 __isl_take isl_ast_expr *expr1,
10116                 __isl_take isl_ast_expr *expr2)
10117         __isl_give isl_ast_expr *isl_ast_expr_and_then(
10118                 __isl_take isl_ast_expr *expr1,
10119                 __isl_take isl_ast_expr *expr2)
10120         __isl_give isl_ast_expr *isl_ast_expr_or(
10121                 __isl_take isl_ast_expr *expr1,
10122                 __isl_take isl_ast_expr *expr2)
10123         __isl_give isl_ast_expr *isl_ast_expr_or_else(
10124                 __isl_take isl_ast_expr *expr1,
10125                 __isl_take isl_ast_expr *expr2)
10126         __isl_give isl_ast_expr *isl_ast_expr_eq(
10127                 __isl_take isl_ast_expr *expr1,
10128                 __isl_take isl_ast_expr *expr2);
10129         __isl_give isl_ast_expr *isl_ast_expr_le(
10130                 __isl_take isl_ast_expr *expr1,
10131                 __isl_take isl_ast_expr *expr2);
10132         __isl_give isl_ast_expr *isl_ast_expr_lt(
10133                 __isl_take isl_ast_expr *expr1,
10134                 __isl_take isl_ast_expr *expr2);
10135         __isl_give isl_ast_expr *isl_ast_expr_ge(
10136                 __isl_take isl_ast_expr *expr1,
10137                 __isl_take isl_ast_expr *expr2);
10138         __isl_give isl_ast_expr *isl_ast_expr_gt(
10139                 __isl_take isl_ast_expr *expr1,
10140                 __isl_take isl_ast_expr *expr2);
10141         __isl_give isl_ast_expr *isl_ast_expr_access(
10142                 __isl_take isl_ast_expr *array,
10143                 __isl_take isl_ast_expr_list *indices);
10144         __isl_give isl_ast_expr *isl_ast_expr_call(
10145                 __isl_take isl_ast_expr *function,
10146                 __isl_take isl_ast_expr_list *arguments);
10148 The function C<isl_ast_expr_address_of> can be applied to an
10149 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
10150 to represent the address of the C<isl_ast_expr_access>.
10151 The second argument of the functions C<isl_ast_expr_pdiv_q> and
10152 C<isl_ast_expr_pdiv_r> should always evaluate to a positive number.
10153 The function
10154 C<isl_ast_expr_and_then> as well as C<isl_ast_expr_or_else> are short-circuit
10155 versions of C<isl_ast_expr_and> and C<isl_ast_expr_or>, respectively.
10157         #include <isl/ast_build.h>
10158         __isl_give isl_ast_expr *isl_ast_build_expr_from_set(
10159                 __isl_keep isl_ast_build *build,
10160                 __isl_take isl_set *set);
10161         __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
10162                 __isl_keep isl_ast_build *build,
10163                 __isl_take isl_pw_aff *pa);
10164         __isl_give isl_ast_expr *
10165         isl_ast_build_access_from_pw_multi_aff(
10166                 __isl_keep isl_ast_build *build,
10167                 __isl_take isl_pw_multi_aff *pma);
10168         __isl_give isl_ast_expr *
10169         isl_ast_build_access_from_multi_pw_aff(
10170                 __isl_keep isl_ast_build *build,
10171                 __isl_take isl_multi_pw_aff *mpa);
10172         __isl_give isl_ast_expr *
10173         isl_ast_build_call_from_pw_multi_aff(
10174                 __isl_keep isl_ast_build *build,
10175                 __isl_take isl_pw_multi_aff *pma);
10176         __isl_give isl_ast_expr *
10177         isl_ast_build_call_from_multi_pw_aff(
10178                 __isl_keep isl_ast_build *build,
10179                 __isl_take isl_multi_pw_aff *mpa);
10181 The set C<set> and
10182 the domains of C<pa>, C<mpa> and C<pma> should correspond
10183 to the schedule space of C<build>.
10184 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
10185 the function being called.
10186 If the accessed space is a nested relation, then it is taken
10187 to represent an access of the member specified by the range
10188 of this nested relation of the structure specified by the domain
10189 of the nested relation.
10191 The following functions can be used to modify an C<isl_ast_expr>.
10193         #include <isl/ast.h>
10194         __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
10195                 __isl_take isl_ast_expr *expr, int pos,
10196                 __isl_take isl_ast_expr *arg);
10198 Replace the argument of C<expr> at position C<pos> by C<arg>.
10200         #include <isl/ast.h>
10201         __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
10202                 __isl_take isl_ast_expr *expr,
10203                 __isl_take isl_id_to_ast_expr *id2expr);
10205 The function C<isl_ast_expr_substitute_ids> replaces the
10206 subexpressions of C<expr> of type C<isl_ast_expr_id>
10207 by the corresponding expression in C<id2expr>, if there is any.
10210 User specified data can be attached to an C<isl_ast_node> and obtained
10211 from the same C<isl_ast_node> using the following functions.
10213         #include <isl/ast.h>
10214         __isl_give isl_ast_node *isl_ast_node_set_annotation(
10215                 __isl_take isl_ast_node *node,
10216                 __isl_take isl_id *annotation);
10217         __isl_give isl_id *isl_ast_node_get_annotation(
10218                 __isl_keep isl_ast_node *node);
10220 Basic printing can be performed using the following functions.
10222         #include <isl/ast.h>
10223         __isl_give isl_printer *isl_printer_print_ast_expr(
10224                 __isl_take isl_printer *p,
10225                 __isl_keep isl_ast_expr *expr);
10226         __isl_give isl_printer *isl_printer_print_ast_node(
10227                 __isl_take isl_printer *p,
10228                 __isl_keep isl_ast_node *node);
10229         __isl_give char *isl_ast_expr_to_str(
10230                 __isl_keep isl_ast_expr *expr);
10231         __isl_give char *isl_ast_node_to_str(
10232                 __isl_keep isl_ast_node *node);
10233         __isl_give char *isl_ast_expr_to_C_str(
10234                 __isl_keep isl_ast_expr *expr);
10235         __isl_give char *isl_ast_node_to_C_str(
10236                 __isl_keep isl_ast_node *node);
10238 The functions C<isl_ast_expr_to_C_str> and
10239 C<isl_ast_node_to_C_str> are convenience functions
10240 that return a string representation of the input in C format.
10242 More advanced printing can be performed using the following functions.
10244         #include <isl/ast.h>
10245         __isl_give isl_printer *isl_ast_op_type_set_print_name(
10246                 __isl_take isl_printer *p,
10247                 enum isl_ast_op_type type,
10248                 __isl_keep const char *name);
10249         isl_stat isl_options_set_ast_print_macro_once(
10250                 isl_ctx *ctx, int val);
10251         int isl_options_get_ast_print_macro_once(isl_ctx *ctx);
10252         __isl_give isl_printer *isl_ast_op_type_print_macro(
10253                 enum isl_ast_op_type type,
10254                 __isl_take isl_printer *p);
10255         __isl_give isl_printer *isl_ast_expr_print_macros(
10256                 __isl_keep isl_ast_expr *expr,
10257                 __isl_take isl_printer *p);
10258         __isl_give isl_printer *isl_ast_node_print_macros(
10259                 __isl_keep isl_ast_node *node,
10260                 __isl_take isl_printer *p);
10261         __isl_give isl_printer *isl_ast_node_print(
10262                 __isl_keep isl_ast_node *node,
10263                 __isl_take isl_printer *p,
10264                 __isl_take isl_ast_print_options *options);
10265         __isl_give isl_printer *isl_ast_node_for_print(
10266                 __isl_keep isl_ast_node *node,
10267                 __isl_take isl_printer *p,
10268                 __isl_take isl_ast_print_options *options);
10269         __isl_give isl_printer *isl_ast_node_if_print(
10270                 __isl_keep isl_ast_node *node,
10271                 __isl_take isl_printer *p,
10272                 __isl_take isl_ast_print_options *options);
10274 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
10275 C<isl> may print out an AST that makes use of macros such
10276 as C<floord>, C<min> and C<max>.
10277 The names of these macros may be modified by a call
10278 to C<isl_ast_op_type_set_print_name>.  The user-specified
10279 names are associated to the printer object.
10280 C<isl_ast_op_type_print_macro> prints out the macro
10281 corresponding to a specific C<isl_ast_op_type>.
10282 If the print-macro-once option is set, then a given macro definition
10283 is only printed once to any given printer object.
10284 C<isl_ast_expr_print_macros> scans the C<isl_ast_expr>
10285 for subexpressions where these macros would be used and prints
10286 out the required macro definitions.
10287 Essentially, C<isl_ast_expr_print_macros> calls
10288 C<isl_ast_expr_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
10289 as function argument.
10290 C<isl_ast_node_print_macros> does the same
10291 for expressions in its C<isl_ast_node> argument.
10292 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
10293 C<isl_ast_node_if_print> print an C<isl_ast_node>
10294 in C<ISL_FORMAT_C>, but allow for some extra control
10295 through an C<isl_ast_print_options> object.
10296 This object can be created using the following functions.
10298         #include <isl/ast.h>
10299         __isl_give isl_ast_print_options *
10300         isl_ast_print_options_alloc(isl_ctx *ctx);
10301         __isl_give isl_ast_print_options *
10302         isl_ast_print_options_copy(
10303                 __isl_keep isl_ast_print_options *options);
10304         __isl_null isl_ast_print_options *
10305         isl_ast_print_options_free(
10306                 __isl_take isl_ast_print_options *options);
10308         __isl_give isl_ast_print_options *
10309         isl_ast_print_options_set_print_user(
10310                 __isl_take isl_ast_print_options *options,
10311                 __isl_give isl_printer *(*print_user)(
10312                         __isl_take isl_printer *p,
10313                         __isl_take isl_ast_print_options *options,
10314                         __isl_keep isl_ast_node *node, void *user),
10315                 void *user);
10316         __isl_give isl_ast_print_options *
10317         isl_ast_print_options_set_print_for(
10318                 __isl_take isl_ast_print_options *options,
10319                 __isl_give isl_printer *(*print_for)(
10320                         __isl_take isl_printer *p,
10321                         __isl_take isl_ast_print_options *options,
10322                         __isl_keep isl_ast_node *node, void *user),
10323                 void *user);
10325 The callback set by C<isl_ast_print_options_set_print_user>
10326 is called whenever a node of type C<isl_ast_node_user> needs to
10327 be printed.
10328 The callback set by C<isl_ast_print_options_set_print_for>
10329 is called whenever a node of type C<isl_ast_node_for> needs to
10330 be printed.
10331 Note that C<isl_ast_node_for_print> will I<not> call the
10332 callback set by C<isl_ast_print_options_set_print_for> on the node
10333 on which C<isl_ast_node_for_print> is called, but only on nested
10334 nodes of type C<isl_ast_node_for>.  It is therefore safe to
10335 call C<isl_ast_node_for_print> from within the callback set by
10336 C<isl_ast_print_options_set_print_for>.
10338 The following option determines the type to be used for iterators
10339 while printing the AST.
10341         isl_stat isl_options_set_ast_iterator_type(
10342                 isl_ctx *ctx, const char *val);
10343         const char *isl_options_get_ast_iterator_type(
10344                 isl_ctx *ctx);
10346 The AST printer only prints body nodes as blocks if these
10347 blocks cannot be safely omitted.
10348 For example, a C<for> node with one body node will not be
10349 surrounded with braces in C<ISL_FORMAT_C>.
10350 A block will always be printed by setting the following option.
10352         isl_stat isl_options_set_ast_always_print_block(isl_ctx *ctx,
10353                 int val);
10354         int isl_options_get_ast_always_print_block(isl_ctx *ctx);
10356 =head3 Options
10358         #include <isl/ast_build.h>
10359         isl_stat isl_options_set_ast_build_atomic_upper_bound(
10360                 isl_ctx *ctx, int val);
10361         int isl_options_get_ast_build_atomic_upper_bound(
10362                 isl_ctx *ctx);
10363         isl_stat isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
10364                 int val);
10365         int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
10366         isl_stat isl_options_set_ast_build_detect_min_max(
10367                 isl_ctx *ctx, int val);
10368         int isl_options_get_ast_build_detect_min_max(
10369                 isl_ctx *ctx);
10370         isl_stat isl_options_set_ast_build_exploit_nested_bounds(
10371                 isl_ctx *ctx, int val);
10372         int isl_options_get_ast_build_exploit_nested_bounds(
10373                 isl_ctx *ctx);
10374         isl_stat isl_options_set_ast_build_group_coscheduled(
10375                 isl_ctx *ctx, int val);
10376         int isl_options_get_ast_build_group_coscheduled(
10377                 isl_ctx *ctx);
10378         isl_stat isl_options_set_ast_build_separation_bounds(
10379                 isl_ctx *ctx, int val);
10380         int isl_options_get_ast_build_separation_bounds(
10381                 isl_ctx *ctx);
10382         isl_stat isl_options_set_ast_build_scale_strides(
10383                 isl_ctx *ctx, int val);
10384         int isl_options_get_ast_build_scale_strides(
10385                 isl_ctx *ctx);
10386         isl_stat isl_options_set_ast_build_allow_else(isl_ctx *ctx,
10387                 int val);
10388         int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
10389         isl_stat isl_options_set_ast_build_allow_or(isl_ctx *ctx,
10390                 int val);
10391         int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
10393 =over
10395 =item * ast_build_atomic_upper_bound
10397 Generate loop upper bounds that consist of the current loop iterator,
10398 an operator and an expression not involving the iterator.
10399 If this option is not set, then the current loop iterator may appear
10400 several times in the upper bound.
10401 For example, when this option is turned off, AST generation
10402 for the schedule
10404         [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
10406 produces
10408         for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
10409           A(c0);
10411 When the option is turned on, the following AST is generated
10413         for (int c0 = 0; c0 <= min(100, n); c0 += 1)
10414           A(c0);
10416 =item * ast_build_prefer_pdiv
10418 If this option is turned off, then the AST generation will
10419 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
10420 operators, but no C<isl_ast_op_pdiv_q> or
10421 C<isl_ast_op_pdiv_r> operators.
10422 If this option is turned on, then C<isl> will try to convert
10423 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
10424 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
10426 =item * ast_build_detect_min_max
10428 If this option is turned on, then C<isl> will try and detect
10429 min or max-expressions when building AST expressions from
10430 piecewise affine expressions.
10432 =item * ast_build_exploit_nested_bounds
10434 Simplify conditions based on bounds of nested for loops.
10435 In particular, remove conditions that are implied by the fact
10436 that one or more nested loops have at least one iteration,
10437 meaning that the upper bound is at least as large as the lower bound.
10438 For example, when this option is turned off, AST generation
10439 for the schedule
10441         [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
10442                                         0 <= j <= M }
10444 produces
10446         if (M >= 0)
10447           for (int c0 = 0; c0 <= N; c0 += 1)
10448             for (int c1 = 0; c1 <= M; c1 += 1)
10449               A(c0, c1);
10451 When the option is turned on, the following AST is generated
10453         for (int c0 = 0; c0 <= N; c0 += 1)
10454           for (int c1 = 0; c1 <= M; c1 += 1)
10455             A(c0, c1);
10457 =item * ast_build_group_coscheduled
10459 If two domain elements are assigned the same schedule point, then
10460 they may be executed in any order and they may even appear in different
10461 loops.  If this options is set, then the AST generator will make
10462 sure that coscheduled domain elements do not appear in separate parts
10463 of the AST.  This is useful in case of nested AST generation
10464 if the outer AST generation is given only part of a schedule
10465 and the inner AST generation should handle the domains that are
10466 coscheduled by this initial part of the schedule together.
10467 For example if an AST is generated for a schedule
10469         { A[i] -> [0]; B[i] -> [0] }
10471 then the C<isl_ast_build_set_create_leaf> callback described
10472 below may get called twice, once for each domain.
10473 Setting this option ensures that the callback is only called once
10474 on both domains together.
10476 =item * ast_build_separation_bounds
10478 This option specifies which bounds to use during separation.
10479 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
10480 then all (possibly implicit) bounds on the current dimension will
10481 be used during separation.
10482 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
10483 then only those bounds that are explicitly available will
10484 be used during separation.
10486 =item * ast_build_scale_strides
10488 This option specifies whether the AST generator is allowed
10489 to scale down iterators of strided loops.
10491 =item * ast_build_allow_else
10493 This option specifies whether the AST generator is allowed
10494 to construct if statements with else branches.
10496 =item * ast_build_allow_or
10498 This option specifies whether the AST generator is allowed
10499 to construct if conditions with disjunctions.
10501 =back
10503 =head3 AST Generation Options (Schedule Tree)
10505 In case of AST construction from a schedule tree, the options
10506 that control how an AST is created from the individual schedule
10507 dimensions are stored in the band nodes of the tree
10508 (see L</"Schedule Trees">).
10510 In particular, a schedule dimension can be handled in four
10511 different ways, atomic, separate, unroll or the default.
10512 This loop AST generation type can be set using
10513 C<isl_schedule_node_band_member_set_ast_loop_type>.
10514 Alternatively,
10515 the first three can be selected by including a one-dimensional
10516 element with as value the position of the schedule dimension
10517 within the band and as name one of C<atomic>, C<separate>
10518 or C<unroll> in the options
10519 set by C<isl_schedule_node_band_set_ast_build_options>.
10520 Only one of these three may be specified for
10521 any given schedule dimension within a band node.
10522 If none of these is specified, then the default
10523 is used.  The meaning of the options is as follows.
10525 =over
10527 =item C<atomic>
10529 When this option is specified, the AST generator will make
10530 sure that a given domains space only appears in a single
10531 loop at the specified level.
10533 For example, for the schedule tree
10535         domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
10536         child:
10537           schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
10538           options: "{ atomic[x] }"
10540 the following AST will be generated
10542         for (int c0 = 0; c0 <= 10; c0 += 1) {
10543           if (c0 >= 1)
10544             b(c0 - 1);
10545           if (c0 <= 9)
10546             a(c0);
10547         }
10549 On the other hand, for the schedule tree
10551         domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
10552         child:
10553           schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
10554           options: "{ separate[x] }"
10556 the following AST will be generated
10558         {
10559           a(0);
10560           for (int c0 = 1; c0 <= 9; c0 += 1) {
10561             b(c0 - 1);
10562             a(c0);
10563           }
10564           b(9);
10565         }
10567 If neither C<atomic> nor C<separate> is specified, then the AST generator
10568 may produce either of these two results or some intermediate form.
10570 =item C<separate>
10572 When this option is specified, the AST generator will
10573 split the domain of the specified schedule dimension
10574 into pieces with a fixed set of statements for which
10575 instances need to be executed by the iterations in
10576 the schedule domain part.  This option tends to avoid
10577 the generation of guards inside the corresponding loops.
10578 See also the C<atomic> option.
10580 =item C<unroll>
10582 When this option is specified, the AST generator will
10583 I<completely> unroll the corresponding schedule dimension.
10584 It is the responsibility of the user to ensure that such
10585 unrolling is possible.
10586 To obtain a partial unrolling, the user should apply an additional
10587 strip-mining to the schedule and fully unroll the inner schedule
10588 dimension.
10590 =back
10592 The C<isolate> option is a bit more involved.  It allows the user
10593 to isolate a range of schedule dimension values from smaller and
10594 greater values.  Additionally, the user may specify a different
10595 atomic/separate/unroll choice for the isolated part and the remaining
10596 parts.  The typical use case of the C<isolate> option is to isolate
10597 full tiles from partial tiles.
10598 The part that needs to be isolated may depend on outer schedule dimensions.
10599 The option therefore needs to be able to reference those outer schedule
10600 dimensions.  In particular, the space of the C<isolate> option is that
10601 of a wrapped map with as domain the flat product of all outer band nodes
10602 and as range the space of the current band node.
10603 The atomic/separate/unroll choice for the isolated part is determined
10604 by an option that lives in an unnamed wrapped space with as domain
10605 a zero-dimensional C<isolate> space and as range the regular
10606 C<atomic>, C<separate> or C<unroll> space.
10607 This option may also be set directly using
10608 C<isl_schedule_node_band_member_set_isolate_ast_loop_type>.
10609 The atomic/separate/unroll choice for the remaining part is determined
10610 by the regular C<atomic>, C<separate> or C<unroll> option.
10611 Since the C<isolate> option references outer schedule dimensions,
10612 its use in a band node causes any tree containing the node
10613 to be considered anchored.
10615 As an example, consider the isolation of full tiles from partial tiles
10616 in a tiling of a triangular domain.  The original schedule is as follows.
10618         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10619         child:
10620           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10621                 { A[i,j] -> [floor(j/10)] }, \
10622                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10624 The output is
10626         for (int c0 = 0; c0 <= 10; c0 += 1)
10627           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10628             for (int c2 = 10 * c0;
10629                  c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10630               for (int c3 = 10 * c1;
10631                    c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10632                 A(c2, c3);
10634 Isolating the full tiles, we have the following input
10636         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10637         child:
10638           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10639                 { A[i,j] -> [floor(j/10)] }, \
10640                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10641           options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
10642                 10a+9+10b+9 <= 100 }"
10644 and output
10646         {
10647           for (int c0 = 0; c0 <= 8; c0 += 1) {
10648             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10649               for (int c2 = 10 * c0;
10650                    c2 <= 10 * c0 + 9; c2 += 1)
10651                 for (int c3 = 10 * c1;
10652                      c3 <= 10 * c1 + 9; c3 += 1)
10653                   A(c2, c3);
10654             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10655               for (int c2 = 10 * c0;
10656                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10657                 for (int c3 = 10 * c1;
10658                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10659                   A(c2, c3);
10660           }
10661           for (int c0 = 9; c0 <= 10; c0 += 1)
10662             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10663               for (int c2 = 10 * c0;
10664                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10665                 for (int c3 = 10 * c1;
10666                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10667                   A(c2, c3);
10668         }
10670 We may then additionally unroll the innermost loop of the isolated part
10672         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10673         child:
10674           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10675                 { A[i,j] -> [floor(j/10)] }, \
10676                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10677           options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
10678                 10a+9+10b+9 <= 100; [isolate[] -> unroll[3]] }"
10680 to obtain
10682         {
10683           for (int c0 = 0; c0 <= 8; c0 += 1) {
10684             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10685               for (int c2 = 10 * c0; c2 <= 10 * c0 + 9; c2 += 1) {
10686                 A(c2, 10 * c1);
10687                 A(c2, 10 * c1 + 1);
10688                 A(c2, 10 * c1 + 2);
10689                 A(c2, 10 * c1 + 3);
10690                 A(c2, 10 * c1 + 4);
10691                 A(c2, 10 * c1 + 5);
10692                 A(c2, 10 * c1 + 6);
10693                 A(c2, 10 * c1 + 7);
10694                 A(c2, 10 * c1 + 8);
10695                 A(c2, 10 * c1 + 9);
10696               }
10697             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10698               for (int c2 = 10 * c0;
10699                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10700                 for (int c3 = 10 * c1;
10701                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10702                   A(c2, c3);
10703           }
10704           for (int c0 = 9; c0 <= 10; c0 += 1)
10705             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10706               for (int c2 = 10 * c0;
10707                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10708                 for (int c3 = 10 * c1;
10709                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10710                   A(c2, c3);
10711         }
10714 =head3 AST Generation Options (Schedule Map)
10716 In case of AST construction using
10717 C<isl_ast_build_node_from_schedule_map>, the options
10718 that control how an AST is created from the individual schedule
10719 dimensions are stored in the C<isl_ast_build>.
10720 They can be set using the following function.
10722         #include <isl/ast_build.h>
10723         __isl_give isl_ast_build *
10724         isl_ast_build_set_options(
10725                 __isl_take isl_ast_build *build,
10726                 __isl_take isl_union_map *options);
10728 The options are encoded in an C<isl_union_map>.
10729 The domain of this union relation refers to the schedule domain,
10730 i.e., the range of the schedule passed
10731 to C<isl_ast_build_node_from_schedule_map>.
10732 In the case of nested AST generation (see L</"Nested AST Generation">),
10733 the domain of C<options> should refer to the extra piece of the schedule.
10734 That is, it should be equal to the range of the wrapped relation in the
10735 range of the schedule.
10736 The range of the options can consist of elements in one or more spaces,
10737 the names of which determine the effect of the option.
10738 The values of the range typically also refer to the schedule dimension
10739 to which the option applies, with value C<0> representing
10740 the outermost schedule dimension.  In case of nested AST generation
10741 (see L</"Nested AST Generation">), these values refer to the position
10742 of the schedule dimension within the innermost AST generation.
10743 The constraints on the domain elements of
10744 the option should only refer to this dimension and earlier dimensions.
10745 We consider the following spaces.
10747 =over
10749 =item C<separation_class>
10751 B<This option has been deprecated.  Use the isolate option on
10752 schedule trees instead.>
10754 This space is a wrapped relation between two one dimensional spaces.
10755 The input space represents the schedule dimension to which the option
10756 applies and the output space represents the separation class.
10757 While constructing a loop corresponding to the specified schedule
10758 dimension(s), the AST generator will try to generate separate loops
10759 for domain elements that are assigned different classes.
10760 If only some of the elements are assigned a class, then those elements
10761 that are not assigned any class will be treated as belonging to a class
10762 that is separate from the explicitly assigned classes.
10763 The typical use case for this option is to separate full tiles from
10764 partial tiles.
10765 The other options, described below, are applied after the separation
10766 into classes.
10768 As an example, consider the separation into full and partial tiles
10769 of a tiling of a triangular domain.
10770 Take, for example, the domain
10772         { A[i,j] : 0 <= i,j and i + j <= 100 }
10774 and a tiling into tiles of 10 by 10.  The input to the AST generator
10775 is then the schedule
10777         { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
10778                                                 i + j <= 100 }
10780 Without any options, the following AST is generated
10782         for (int c0 = 0; c0 <= 10; c0 += 1)
10783           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10784             for (int c2 = 10 * c0;
10785                  c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10786                  c2 += 1)
10787               for (int c3 = 10 * c1;
10788                    c3 <= min(10 * c1 + 9, -c2 + 100);
10789                    c3 += 1)
10790                 A(c2, c3);
10792 Separation into full and partial tiles can be obtained by assigning
10793 a class, say C<0>, to the full tiles.  The full tiles are represented by those
10794 values of the first and second schedule dimensions for which there are
10795 values of the third and fourth dimensions to cover an entire tile.
10796 That is, we need to specify the following option
10798         { [a,b,c,d] -> separation_class[[0]->[0]] :
10799                 exists b': 0 <= 10a,10b' and
10800                            10a+9+10b'+9 <= 100;
10801           [a,b,c,d] -> separation_class[[1]->[0]] :
10802                 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
10804 which simplifies to
10806         { [a, b, c, d] -> separation_class[[1] -> [0]] :
10807                 a >= 0 and b >= 0 and b <= 8 - a;
10808           [a, b, c, d] -> separation_class[[0] -> [0]] :
10809                 a >= 0 and a <= 8 }
10811 With this option, the generated AST is as follows
10813         {
10814           for (int c0 = 0; c0 <= 8; c0 += 1) {
10815             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10816               for (int c2 = 10 * c0;
10817                    c2 <= 10 * c0 + 9; c2 += 1)
10818                 for (int c3 = 10 * c1;
10819                      c3 <= 10 * c1 + 9; c3 += 1)
10820                   A(c2, c3);
10821             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10822               for (int c2 = 10 * c0;
10823                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10824                    c2 += 1)
10825                 for (int c3 = 10 * c1;
10826                      c3 <= min(-c2 + 100, 10 * c1 + 9);
10827                      c3 += 1)
10828                   A(c2, c3);
10829           }
10830           for (int c0 = 9; c0 <= 10; c0 += 1)
10831             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10832               for (int c2 = 10 * c0;
10833                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10834                    c2 += 1)
10835                 for (int c3 = 10 * c1;
10836                      c3 <= min(10 * c1 + 9, -c2 + 100);
10837                      c3 += 1)
10838                   A(c2, c3);
10839         }
10841 =item C<separate>
10843 This is a single-dimensional space representing the schedule dimension(s)
10844 to which ``separation'' should be applied.  Separation tries to split
10845 a loop into several pieces if this can avoid the generation of guards
10846 inside the loop.
10847 See also the C<atomic> option.
10849 =item C<atomic>
10851 This is a single-dimensional space representing the schedule dimension(s)
10852 for which the domains should be considered ``atomic''.  That is, the
10853 AST generator will make sure that any given domain space will only appear
10854 in a single loop at the specified level.
10856 Consider the following schedule
10858         { a[i] -> [i] : 0 <= i < 10;
10859           b[i] -> [i+1] : 0 <= i < 10 }
10861 If the following option is specified
10863         { [i] -> separate[x] }
10865 then the following AST will be generated
10867         {
10868           a(0);
10869           for (int c0 = 1; c0 <= 9; c0 += 1) {
10870             a(c0);
10871             b(c0 - 1);
10872           }
10873           b(9);
10874         }
10876 If, on the other hand, the following option is specified
10878         { [i] -> atomic[x] }
10880 then the following AST will be generated
10882         for (int c0 = 0; c0 <= 10; c0 += 1) {
10883           if (c0 <= 9)
10884             a(c0);
10885           if (c0 >= 1)
10886             b(c0 - 1);
10887         }
10889 If neither C<atomic> nor C<separate> is specified, then the AST generator
10890 may produce either of these two results or some intermediate form.
10892 =item C<unroll>
10894 This is a single-dimensional space representing the schedule dimension(s)
10895 that should be I<completely> unrolled.
10896 To obtain a partial unrolling, the user should apply an additional
10897 strip-mining to the schedule and fully unroll the inner loop.
10899 =back
10901 =head3 Fine-grained Control over AST Generation
10903 Besides specifying the constraints on the parameters,
10904 an C<isl_ast_build> object can be used to control
10905 various aspects of the AST generation process.
10906 In case of AST construction using
10907 C<isl_ast_build_node_from_schedule_map>,
10908 the most prominent way of control is through ``options'',
10909 as explained above.
10911 Additional control is available through the following functions.
10913         #include <isl/ast_build.h>
10914         __isl_give isl_ast_build *
10915         isl_ast_build_set_iterators(
10916                 __isl_take isl_ast_build *build,
10917                 __isl_take isl_id_list *iterators);
10919 The function C<isl_ast_build_set_iterators> allows the user to
10920 specify a list of iterator C<isl_id>s to be used as iterators.
10921 If the input schedule is injective, then
10922 the number of elements in this list should be as large as the dimension
10923 of the schedule space, but no direct correspondence should be assumed
10924 between dimensions and elements.
10925 If the input schedule is not injective, then an additional number
10926 of C<isl_id>s equal to the largest dimension of the input domains
10927 may be required.
10928 If the number of provided C<isl_id>s is insufficient, then additional
10929 names are automatically generated.
10931         #include <isl/ast_build.h>
10932         __isl_give isl_ast_build *
10933         isl_ast_build_set_create_leaf(
10934                 __isl_take isl_ast_build *build,
10935                 __isl_give isl_ast_node *(*fn)(
10936                         __isl_take isl_ast_build *build,
10937                         void *user), void *user);
10940 C<isl_ast_build_set_create_leaf> function allows for the
10941 specification of a callback that should be called whenever the AST
10942 generator arrives at an element of the schedule domain.
10943 The callback should return an AST node that should be inserted
10944 at the corresponding position of the AST.  The default action (when
10945 the callback is not set) is to continue generating parts of the AST to scan
10946 all the domain elements associated to the schedule domain element
10947 and to insert user nodes, ``calling'' the domain element, for each of them.
10948 The C<build> argument contains the current state of the C<isl_ast_build>.
10949 To ease nested AST generation (see L</"Nested AST Generation">),
10950 all control information that is
10951 specific to the current AST generation such as the options and
10952 the callbacks has been removed from this C<isl_ast_build>.
10953 The callback would typically return the result of a nested
10954 AST generation or a
10955 user defined node created using the following function.
10957         #include <isl/ast.h>
10958         __isl_give isl_ast_node *isl_ast_node_alloc_user(
10959                 __isl_take isl_ast_expr *expr);
10961         #include <isl/ast_build.h>
10962         __isl_give isl_ast_build *
10963         isl_ast_build_set_at_each_domain(
10964                 __isl_take isl_ast_build *build,
10965                 __isl_give isl_ast_node *(*fn)(
10966                         __isl_take isl_ast_node *node,
10967                         __isl_keep isl_ast_build *build,
10968                         void *user), void *user);
10969         __isl_give isl_ast_build *
10970         isl_ast_build_set_before_each_for(
10971                 __isl_take isl_ast_build *build,
10972                 __isl_give isl_id *(*fn)(
10973                         __isl_keep isl_ast_build *build,
10974                         void *user), void *user);
10975         __isl_give isl_ast_build *
10976         isl_ast_build_set_after_each_for(
10977                 __isl_take isl_ast_build *build,
10978                 __isl_give isl_ast_node *(*fn)(
10979                         __isl_take isl_ast_node *node,
10980                         __isl_keep isl_ast_build *build,
10981                         void *user), void *user);
10982         __isl_give isl_ast_build *
10983         isl_ast_build_set_before_each_mark(
10984                 __isl_take isl_ast_build *build,
10985                 isl_stat (*fn)(__isl_keep isl_id *mark,
10986                         __isl_keep isl_ast_build *build,
10987                         void *user), void *user);
10988         __isl_give isl_ast_build *
10989         isl_ast_build_set_after_each_mark(
10990                 __isl_take isl_ast_build *build,
10991                 __isl_give isl_ast_node *(*fn)(
10992                         __isl_take isl_ast_node *node,
10993                         __isl_keep isl_ast_build *build,
10994                         void *user), void *user);
10996 The callback set by C<isl_ast_build_set_at_each_domain> will
10997 be called for each domain AST node.
10998 The callbacks set by C<isl_ast_build_set_before_each_for>
10999 and C<isl_ast_build_set_after_each_for> will be called
11000 for each for AST node.  The first will be called in depth-first
11001 pre-order, while the second will be called in depth-first post-order.
11002 Since C<isl_ast_build_set_before_each_for> is called before the for
11003 node is actually constructed, it is only passed an C<isl_ast_build>.
11004 The returned C<isl_id> will be added as an annotation (using
11005 C<isl_ast_node_set_annotation>) to the constructed for node.
11006 In particular, if the user has also specified an C<after_each_for>
11007 callback, then the annotation can be retrieved from the node passed to
11008 that callback using C<isl_ast_node_get_annotation>.
11009 The callbacks set by C<isl_ast_build_set_before_each_mark>
11010 and C<isl_ast_build_set_after_each_mark> will be called for each
11011 mark AST node that is created, i.e., for each mark schedule node
11012 in the input schedule tree.  The first will be called in depth-first
11013 pre-order, while the second will be called in depth-first post-order.
11014 Since the callback set by C<isl_ast_build_set_before_each_mark>
11015 is called before the mark AST node is actually constructed, it is passed
11016 the identifier of the mark node.
11017 All callbacks should C<NULL> (or C<isl_stat_error>) on failure.
11018 The given C<isl_ast_build> can be used to create new
11019 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
11020 or C<isl_ast_build_call_from_pw_multi_aff>.
11022 =head3 Nested AST Generation
11024 C<isl> allows the user to create an AST within the context
11025 of another AST.  These nested ASTs are created using the
11026 same C<isl_ast_build_node_from_schedule_map> function that is used to create
11027 the outer AST.  The C<build> argument should be an C<isl_ast_build>
11028 passed to a callback set by
11029 C<isl_ast_build_set_create_leaf>.
11030 The space of the range of the C<schedule> argument should refer
11031 to this build.  In particular, the space should be a wrapped
11032 relation and the domain of this wrapped relation should be the
11033 same as that of the range of the schedule returned by
11034 C<isl_ast_build_get_schedule> below.
11035 In practice, the new schedule is typically
11036 created by calling C<isl_union_map_range_product> on the old schedule
11037 and some extra piece of the schedule.
11038 The space of the schedule domain is also available from
11039 the C<isl_ast_build>.
11041         #include <isl/ast_build.h>
11042         __isl_give isl_union_map *isl_ast_build_get_schedule(
11043                 __isl_keep isl_ast_build *build);
11044         __isl_give isl_space *isl_ast_build_get_schedule_space(
11045                 __isl_keep isl_ast_build *build);
11046         __isl_give isl_ast_build *isl_ast_build_restrict(
11047                 __isl_take isl_ast_build *build,
11048                 __isl_take isl_set *set);
11050 The C<isl_ast_build_get_schedule> function returns a (partial)
11051 schedule for the domains elements for which part of the AST still needs to
11052 be generated in the current build.
11053 In particular, the domain elements are mapped to those iterations of the loops
11054 enclosing the current point of the AST generation inside which
11055 the domain elements are executed.
11056 No direct correspondence between
11057 the input schedule and this schedule should be assumed.
11058 The space obtained from C<isl_ast_build_get_schedule_space> can be used
11059 to create a set for C<isl_ast_build_restrict> to intersect
11060 with the current build.  In particular, the set passed to
11061 C<isl_ast_build_restrict> can have additional parameters.
11062 The ids of the set dimensions in the space returned by
11063 C<isl_ast_build_get_schedule_space> correspond to the
11064 iterators of the already generated loops.
11065 The user should not rely on the ids of the output dimensions
11066 of the relations in the union relation returned by
11067 C<isl_ast_build_get_schedule> having any particular value.
11069 =head1 Applications
11071 Although C<isl> is mainly meant to be used as a library,
11072 it also contains some basic applications that use some
11073 of the functionality of C<isl>.
11074 For applications that take one or more polytopes or polyhedra
11075 as input, this input may be specified in either the L<isl format>
11076 or the L<PolyLib format>.
11078 =head2 C<isl_polyhedron_sample>
11080 C<isl_polyhedron_sample> takes a polyhedron as input and prints
11081 an integer element of the polyhedron, if there is any.
11082 The first column in the output is the denominator and is always
11083 equal to 1.  If the polyhedron contains no integer points,
11084 then a vector of length zero is printed.
11086 =head2 C<isl_pip>
11088 C<isl_pip> takes the same input as the C<example> program
11089 from the C<piplib> distribution, i.e., a set of constraints
11090 on the parameters, a line containing only -1 and finally a set
11091 of constraints on a parametric polyhedron.
11092 The coefficients of the parameters appear in the last columns
11093 (but before the final constant column).
11094 The output is the lexicographic minimum of the parametric polyhedron.
11095 As C<isl> currently does not have its own output format, the output
11096 is just a dump of the internal state.
11098 =head2 C<isl_polyhedron_minimize>
11100 C<isl_polyhedron_minimize> computes the minimum of some linear
11101 or affine objective function over the integer points in a polyhedron.
11102 If an affine objective function
11103 is given, then the constant should appear in the last column.
11105 =head2 C<isl_polytope_scan>
11107 Given a polytope, C<isl_polytope_scan> prints
11108 all integer points in the polytope.
11110 =head2 C<isl_flow>
11112 Given an C<isl_union_access_info> object as input,
11113 C<isl_flow> prints out the corresponding dependences,
11114 as computed by C<isl_union_access_info_compute_flow>.
11116 =head2 C<isl_codegen>
11118 Given either a schedule tree or a sequence consisting of
11119 a schedule map, a context set and an options relation,
11120 C<isl_codegen> prints out an AST that scans the domain elements
11121 of the schedule in the order of their image(s) taking into account
11122 the constraints in the context set.
11124 =head2 C<isl_schedule>
11126 Given an C<isl_schedule_constraints> object as input,
11127 C<isl_schedule> prints out a schedule that satisfies the given
11128 constraints.