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