isl_basic_set_intersect_params: extract out isl_basic_map_intersect_params
[isl.git] / doc / user.pod
blobf2a4653ee91143cc67df65e353d92b58f07a3d77
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 =item * The C<isl_ast_op_type> enumeration type has been
296 renamed to C<isl_ast_expr_op_type>.  The corresponding
297 enumeration constants have been similarly renamed.
298 The old names are defined to the new names for backward
299 compatibility.
301 =item * Several functions returning an extra boolean value
302 through an C<int *> argument now do so through an C<isl_bool *>
303 argument.  The returned values are the same, only the type
304 of the pointer has been changed.
306 =back
308 =head1 License
310 C<isl> is released under the MIT license.
312 =over
314 Permission is hereby granted, free of charge, to any person obtaining a copy of
315 this software and associated documentation files (the "Software"), to deal in
316 the Software without restriction, including without limitation the rights to
317 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
318 of the Software, and to permit persons to whom the Software is furnished to do
319 so, subject to the following conditions:
321 The above copyright notice and this permission notice shall be included in all
322 copies or substantial portions of the Software.
324 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
325 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
326 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
327 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
328 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
329 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
330 SOFTWARE.
332 =back
334 Note that by default C<isl> requires C<GMP>, which is released
335 under the GNU Lesser General Public License (LGPL).  This means
336 that code linked against C<isl> is also linked against LGPL code.
338 When configuring with C<--with-int=imath> or C<--with-int=imath-32>, C<isl>
339 will link against C<imath>, a library for exact integer arithmetic released
340 under the MIT license.
342 =head1 Installation
344 The source of C<isl> can be obtained either as a tarball
345 or from the git repository.  Both are available from
346 L<https://libisl.sourceforge.io/>.
347 The installation process depends on how you obtained
348 the source.
350 =head2 Installation from the git repository
352 =over
354 =item 1 Clone or update the repository
356 The first time the source is obtained, you need to clone
357 the repository.
359         git clone git://repo.or.cz/isl.git
361 To obtain updates, you need to pull in the latest changes
363         git pull
365 =item 2 Optionally get C<imath> submodule
367 To build C<isl> with C<imath>, you need to obtain the C<imath>
368 submodule by running in the git source tree of C<isl>
370        git submodule init
371        git submodule update
373 This will fetch the required version of C<imath> in a subdirectory of C<isl>.
375 =item 2 Generate C<configure>
377         ./autogen.sh
379 =back
381 After performing the above steps, continue
382 with the L<Common installation instructions>.
384 =head2 Common installation instructions
386 =over
388 =item 1 Obtain C<GMP>
390 By default, building C<isl> requires C<GMP>, including its headers files.
391 Your distribution may not provide these header files by default
392 and you may need to install a package called C<gmp-devel> or something
393 similar.  Alternatively, C<GMP> can be built from
394 source, available from L<http://gmplib.org/>.
395 C<GMP> is not needed if you build C<isl> with C<imath>.
397 =item 2 Configure
399 C<isl> uses the standard C<autoconf> C<configure> script.
400 To run it, just type
402         ./configure
404 optionally followed by some configure options.
405 A complete list of options can be obtained by running
407         ./configure --help
409 Below we discuss some of the more common options.
411 =over
413 =item C<--prefix>
415 Installation prefix for C<isl>
417 =item C<--with-int=[gmp|imath|imath-32]>
419 Select the integer library to be used by C<isl>, the default is C<gmp>.
420 With C<imath-32>, C<isl> will use 32 bit integers, but fall back to C<imath>
421 for values out of the 32 bit range. In most applications, C<isl> will run
422 fastest with the C<imath-32> option, followed by C<gmp> and C<imath>, the
423 slowest.
425 =item C<--with-gmp-prefix=>I<path>
427 Installation prefix for C<GMP> (architecture-independent files).
429 =item C<--with-gmp-exec-prefix=>I<path>
431 Installation prefix for C<GMP> (architecture-dependent files).
433 =back
435 =item 3 Compile
437         make
439 =item 4 Test (optional)
441         make check
443 =item 5 Install (optional)
445         make install
447 =back
449 =head2 Building the foreign language bindings
451 The tarball already contains the generated foreign language bindings,
452 but they are not included in the git repository.
453 Building the C++ and Python bindings relies on the LLVM/clang libraries,
454 see C<http://clang.llvm.org/get_started.html>.
455 The C<configure> script will not assume that these are available
456 on the system.
457 To enable building the foreign language bindings,
458 one of the following options needs to be specified.
460 =over
462 =item C<--with-clang=system>
464 Use the system clang libraries (installed in a default location).
466 =item C<--with-clang-prefix=>I<path>
468 Use the system clang libraries installed in I<path>.
470 =back
472 It is best to use the latest release of the clang libraries (16.0),
473 although any release since 3.5 should work as well.
474 Note that if you build the clang libraries from source,
475 then you need to make sure they are also installed (using C<make install>).
476 If the compiler that was used to compile the clang libraries
477 is different from the default C++ compiler, then use C<CXX_FOR_BUILD>
478 to specify this non-default C++ compiler when running C<isl>'s C<./configure>.
480 =head1 Integer Set Library
482 =head2 Memory Management
484 Since a high-level operation on isl objects usually involves
485 several substeps and since the user is usually not interested in
486 the intermediate results, most functions that return a new object
487 will also release all the objects passed as arguments.
488 If the user still wants to use one or more of these arguments
489 after the function call, she should pass along a copy of the
490 object rather than the object itself.
491 The user is then responsible for making sure that the original
492 object gets used somewhere else or is explicitly freed.
494 The arguments and return values of all documented functions are
495 annotated to make clear which arguments are released and which
496 arguments are preserved.  In particular, the following annotations
497 are used
499 =over
501 =item C<__isl_give>
503 C<__isl_give> means that a new object is returned.
504 The user should make sure that the returned pointer is
505 used exactly once as a value for an C<__isl_take> argument.
506 In between, it can be used as a value for as many
507 C<__isl_keep> arguments as the user likes.
508 There is one exception, and that is the case where the
509 pointer returned is C<NULL>.  In this case, the user
510 is free to use it as an C<__isl_take> argument or not.
511 When applied to a C<char *>, the returned pointer needs to be
512 freed using C<free>.
514 =item C<__isl_null>
516 C<__isl_null> means that a C<NULL> value is returned.
518 =item C<__isl_take>
520 C<__isl_take> means that the object the argument points to
521 is taken over by the function and may no longer be used
522 by the user as an argument to any other function.
523 The pointer value must be one returned by a function
524 returning an C<__isl_give> pointer.
525 If the user passes in a C<NULL> value, then this will
526 be treated as an error in the sense that the function will
527 not perform its usual operation.  However, it will still
528 make sure that all the other C<__isl_take> arguments
529 are released.
531 =item C<__isl_keep>
533 C<__isl_keep> means that the function will only use the object
534 temporarily.  After the function has finished, the user
535 can still use it as an argument to other functions.
536 A C<NULL> value will be treated in the same way as
537 a C<NULL> value for an C<__isl_take> argument.
538 This annotation may also be used on return values of
539 type C<const char *>, in which case the returned pointer should
540 not be freed by the user and is only valid until the object
541 from which it was derived is updated or freed.
543 =back
545 =head2 Initialization
547 All manipulations of integer sets and relations occur within
548 the context of an C<isl_ctx>.
549 A given C<isl_ctx> can only be used within a single thread.
550 All arguments of a function are required to have been allocated
551 within the same context.
552 There are currently no functions available for moving an object
553 from one C<isl_ctx> to another C<isl_ctx>.  This means that
554 there is currently no way of safely moving an object from one
555 thread to another, unless the whole C<isl_ctx> is moved.
557 An C<isl_ctx> can be allocated using C<isl_ctx_alloc> and
558 freed using C<isl_ctx_free>.
559 All objects allocated within an C<isl_ctx> should be freed
560 before the C<isl_ctx> itself is freed.
562         isl_ctx *isl_ctx_alloc();
563         void isl_ctx_free(isl_ctx *ctx);
565 The user can impose a bound on the number of low-level I<operations>
566 that can be performed by an C<isl_ctx>.  This bound can be set and
567 retrieved using the following functions.  A bound of zero means that
568 no bound is imposed.  The number of operations performed can be
569 reset using C<isl_ctx_reset_operations>.  Note that the number
570 of low-level operations needed to perform a high-level computation
571 may differ significantly across different versions
572 of C<isl>, but it should be the same across different platforms
573 for the same version of C<isl>.
575 Warning: This feature is experimental.  C<isl> has good support to abort and
576 bail out during the computation, but this feature may exercise error code paths
577 that are normally not used that much. Consequently, it is not unlikely that
578 hidden bugs will be exposed.
580         void isl_ctx_set_max_operations(isl_ctx *ctx,
581                 unsigned long max_operations);
582         unsigned long isl_ctx_get_max_operations(isl_ctx *ctx);
583         void isl_ctx_reset_operations(isl_ctx *ctx);
585 In order to be able to create an object in the same context
586 as another object, most object types (described later in
587 this document) provide a function to obtain the context
588 in which the object was created.
590         #include <isl/val.h>
591         isl_ctx *isl_val_get_ctx(__isl_keep isl_val *val);
592         isl_ctx *isl_multi_val_get_ctx(
593                 __isl_keep isl_multi_val *mv);
595         #include <isl/id.h>
596         isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
597         isl_ctx *isl_multi_id_get_ctx(
598                 __isl_keep isl_multi_id *mi);
600         #include <isl/local_space.h>
601         isl_ctx *isl_local_space_get_ctx(
602                 __isl_keep isl_local_space *ls);
604         #include <isl/set.h>
605         isl_ctx *isl_set_list_get_ctx(
606                 __isl_keep isl_set_list *list);
608         #include <isl/aff.h>
609         isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
610         isl_ctx *isl_multi_aff_get_ctx(
611                 __isl_keep isl_multi_aff *maff);
612         isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pa);
613         isl_ctx *isl_pw_multi_aff_get_ctx(
614                 __isl_keep isl_pw_multi_aff *pma);
615         isl_ctx *isl_multi_pw_aff_get_ctx(
616                 __isl_keep isl_multi_pw_aff *mpa);
617         isl_ctx *isl_union_pw_aff_get_ctx(
618                 __isl_keep isl_union_pw_aff *upa);
619         isl_ctx *isl_union_pw_multi_aff_get_ctx(
620                 __isl_keep isl_union_pw_multi_aff *upma);
621         isl_ctx *isl_multi_union_pw_aff_get_ctx(
622                 __isl_keep isl_multi_union_pw_aff *mupa);
624         #include <isl/id_to_ast_expr.h>
625         isl_ctx *isl_id_to_ast_expr_get_ctx(
626                 __isl_keep isl_id_to_ast_expr *id2expr);
628         #include <isl/point.h>
629         isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
631         #include <isl/vec.h>
632         isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
634         #include <isl/mat.h>
635         isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
637         #include <isl/vertices.h>
638         isl_ctx *isl_vertices_get_ctx(
639                 __isl_keep isl_vertices *vertices);
640         isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
641         isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
643         #include <isl/flow.h>
644         isl_ctx *isl_restriction_get_ctx(
645                 __isl_keep isl_restriction *restr);
646         isl_ctx *isl_union_access_info_get_ctx(
647                 __isl_keep isl_union_access_info *access);
648         isl_ctx *isl_union_flow_get_ctx(
649                 __isl_keep isl_union_flow *flow);
651         #include <isl/schedule.h>
652         isl_ctx *isl_schedule_get_ctx(
653                 __isl_keep isl_schedule *sched);
654         isl_ctx *isl_schedule_constraints_get_ctx(
655                 __isl_keep isl_schedule_constraints *sc);
657         #include <isl/schedule_node.h>
658         isl_ctx *isl_schedule_node_get_ctx(
659                 __isl_keep isl_schedule_node *node);
661         #include <isl/ast_build.h>
662         isl_ctx *isl_ast_build_get_ctx(
663                 __isl_keep isl_ast_build *build);
665         #include <isl/ast.h>
666         isl_ctx *isl_ast_expr_get_ctx(
667                 __isl_keep isl_ast_expr *expr);
668         isl_ctx *isl_ast_node_get_ctx(
669                 __isl_keep isl_ast_node *node);
671         #include <isl/stride_info.h>
672         isl_ctx *isl_stride_info_get_ctx(
673                 __isl_keep isl_stride_info *si);
675         #include <isl/fixed_box.h>
676         isl_ctx *isl_fixed_box_get_ctx(
677                 __isl_keep isl_fixed_box *box);
679 =head2 Return Types
681 C<isl> uses the special return type C<isl_size> for functions
682 that return a non-negative value, typically a number or a position.
683 Besides the regular non-negative return values, a special (negative)
684 value C<isl_size_error> may be returned, indicating that something
685 went wrong.
687 C<isl> also uses two special return types for functions that either return
688 a boolean or that in principle do not return anything.
689 In particular, the C<isl_bool> type has three possible values:
690 C<isl_bool_true> (a positive integer value), indicating I<true> or I<yes>;
691 C<isl_bool_false> (the integer value zero), indicating I<false> or I<no>; and
692 C<isl_bool_error> (a negative integer value), indicating that something
693 went wrong.  The following operations are defined on C<isl_bool>. The function
694 C<isl_bool_not> can be used to negate an C<isl_bool>, where the negation of
695 C<isl_bool_error> is C<isl_bool_error> again. The function C<isl_bool_ok>
696 converts an integer to an C<isl_bool>. Any non-zero values yields
697 C<isl_bool_true> and zero yields C<isl_bool_false>.
699         #include <isl/ctx.h>
700         isl_bool isl_bool_not(isl_bool b);
701         isl_bool isl_bool_ok(int b);
703 The C<isl_stat> type has two possible values:
704 C<isl_stat_ok> (the integer value zero), indicating a successful
705 operation; and
706 C<isl_stat_error> (a negative integer value), indicating that something
707 went wrong.
708 The function C<isl_stat_non_null> converts an isl object pointer
709 to an C<isl_stat>, returning C<isl_stat_ok> if the object pointer is valid and
710 C<isl_stat_error> if it is C<NULL>.
712         #include <isl/ctx.h>
713         isl_stat isl_stat_non_null(void *obj);
715 See L</"Error Handling"> for more information on
716 C<isl_size_error>, C<isl_bool_error> and C<isl_stat_error>.
718 =head2 Values
720 An C<isl_val> represents an integer value, a rational value
721 or one of three special values, infinity, negative infinity and NaN.
722 Some predefined values can be created using the following functions.
724         #include <isl/val.h>
725         __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
726         __isl_give isl_val *isl_val_one(isl_ctx *ctx);
727         __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
728         __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
729         __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
730         __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
732 Specific integer values can be created using the following functions.
734         #include <isl/val.h>
735         __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
736                 long i);
737         __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
738                 unsigned long u);
739         __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
740                 size_t n, size_t size, const void *chunks);
742 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
743 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
744 The least significant digit is assumed to be stored first.
746 Value objects can be copied and freed using the following functions.
748         #include <isl/val.h>
749         __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
750         __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
752 They can be inspected using the following functions.
754         #include <isl/val.h>
755         long isl_val_get_num_si(__isl_keep isl_val *v);
756         long isl_val_get_den_si(__isl_keep isl_val *v);
757         __isl_give isl_val *isl_val_get_den_val(
758                 __isl_keep isl_val *v);
759         double isl_val_get_d(__isl_keep isl_val *v);
760         isl_size isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
761                 size_t size);
762         isl_stat isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
763                 size_t size, void *chunks);
765 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
766 of C<size> bytes needed to store the absolute value of the
767 numerator of C<v>.
768 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
769 which is assumed to have been preallocated by the caller.
770 The least significant digit is stored first.
771 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
772 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
773 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
775 An C<isl_val> can be modified using the following function.
777         #include <isl/val.h>
778         __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
779                 long i);
781 The following unary properties are defined on C<isl_val>s.
783         #include <isl/val.h>
784         int isl_val_sgn(__isl_keep isl_val *v);
785         isl_bool isl_val_is_zero(__isl_keep isl_val *v);
786         isl_bool isl_val_is_one(__isl_keep isl_val *v);
787         isl_bool isl_val_is_negone(__isl_keep isl_val *v);
788         isl_bool isl_val_is_nonneg(__isl_keep isl_val *v);
789         isl_bool isl_val_is_nonpos(__isl_keep isl_val *v);
790         isl_bool isl_val_is_pos(__isl_keep isl_val *v);
791         isl_bool isl_val_is_neg(__isl_keep isl_val *v);
792         isl_bool isl_val_is_int(__isl_keep isl_val *v);
793         isl_bool isl_val_is_rat(__isl_keep isl_val *v);
794         isl_bool isl_val_is_nan(__isl_keep isl_val *v);
795         isl_bool isl_val_is_infty(__isl_keep isl_val *v);
796         isl_bool isl_val_is_neginfty(__isl_keep isl_val *v);
798 Note that the sign of NaN is undefined.
800 The following binary properties are defined on pairs of C<isl_val>s.
802         #include <isl/val.h>
803         isl_bool isl_val_lt(__isl_keep isl_val *v1,
804                 __isl_keep isl_val *v2);
805         isl_bool isl_val_le(__isl_keep isl_val *v1,
806                 __isl_keep isl_val *v2);
807         isl_bool isl_val_gt(__isl_keep isl_val *v1,
808                 __isl_keep isl_val *v2);
809         isl_bool isl_val_ge(__isl_keep isl_val *v1,
810                 __isl_keep isl_val *v2);
811         isl_bool isl_val_eq(__isl_keep isl_val *v1,
812                 __isl_keep isl_val *v2);
813         isl_bool isl_val_ne(__isl_keep isl_val *v1,
814                 __isl_keep isl_val *v2);
815         isl_bool isl_val_abs_eq(__isl_keep isl_val *v1,
816                 __isl_keep isl_val *v2);
818 Comparisons to NaN always return false.
819 That is, a NaN is not considered to hold any relative position
820 with respect to any value.  In particular, a NaN
821 is neither considered to be equal to nor to be different from
822 any value (including another NaN).
823 The function C<isl_val_abs_eq> checks whether its two arguments
824 are equal in absolute value.
826 For integer C<isl_val>s we additionally have the following binary property.
828         #include <isl/val.h>
829         isl_bool isl_val_is_divisible_by(__isl_keep isl_val *v1,
830                 __isl_keep isl_val *v2);
832 An C<isl_val> can also be compared to an integer using the following
833 functions.  The result of C<isl_val_cmp_si> is undefined for NaN.
835         #include <isl/val.h>
836         isl_bool isl_val_gt_si(__isl_keep isl_val *v, long i);
837         isl_bool isl_val_eq_si(__isl_keep isl_val *v, long i);
838         int isl_val_cmp_si(__isl_keep isl_val *v, long i);
840 The following unary operations are available on C<isl_val>s.
842         #include <isl/val.h>
843         __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
844         __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
845         __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
846         __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
847         __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
848         __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
850 The following binary operations are available on C<isl_val>s.
852         #include <isl/val.h>
853         __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
854                 __isl_take isl_val *v2);
855         __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
856                 __isl_take isl_val *v2);
857         __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
858                 __isl_take isl_val *v2);
859         __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
860                 unsigned long v2);
861         __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
862                 __isl_take isl_val *v2);
863         __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
864                 unsigned long v2);
865         __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
866                 __isl_take isl_val *v2);
867         __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
868                 unsigned long v2);
869         __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
870                 __isl_take isl_val *v2);
871         __isl_give isl_val *isl_val_div_ui(__isl_take isl_val *v1,
872                 unsigned long v2);
874 On integer values, we additionally have the following operations.
876         #include <isl/val.h>
877         __isl_give isl_val *isl_val_pow2(__isl_take isl_val *v);
878         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
879         __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
880                 __isl_take isl_val *v2);
881         __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
882                 __isl_take isl_val *v2);
883         __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
884                 __isl_take isl_val *v2, __isl_give isl_val **x,
885                 __isl_give isl_val **y);
887 C<isl_val_2exp> is an alternative name for C<isl_val_pow2>.
888 The function C<isl_val_gcdext> returns the greatest common divisor g
889 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
890 that C<*x> * C<v1> + C<*y> * C<v2> = g.
892 =head3 GMP specific functions
894 These functions are only available if C<isl> has been compiled with C<GMP>
895 support.
897 Specific integer and rational values can be created from C<GMP> values using
898 the following functions.
900         #include <isl/val_gmp.h>
901         __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
902                 mpz_t z);
903         __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
904                 const mpz_t n, const mpz_t d);
906 The numerator and denominator of a rational value can be extracted as
907 C<GMP> values using the following functions.
909         #include <isl/val_gmp.h>
910         int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
911         int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
913 =head2 Sets and Relations
915 C<isl> uses six types of objects for representing sets and relations,
916 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
917 C<isl_union_set> and C<isl_union_map>.
918 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
919 can be described as a conjunction of affine constraints, while
920 C<isl_set> and C<isl_map> represent unions of
921 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
922 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
923 to live in the same space.  C<isl_union_set>s and C<isl_union_map>s
924 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
925 where spaces are considered different if they have a different number
926 of dimensions and/or different names (see L<"Spaces">).
927 The difference between sets and relations (maps) is that sets have
928 one set of variables, while relations have two sets of variables,
929 input variables and output variables.
931 =head2 Error Handling
933 C<isl> supports different ways to react in case a runtime error is triggered.
934 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
935 with two maps that have incompatible spaces. There are three possible ways
936 to react on error: to warn, to continue or to abort.
938 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
939 the last error in the corresponding C<isl_ctx> and the function in which the
940 error was triggered returns a value indicating that some error has
941 occurred.  In case of functions returning a pointer, this value is
942 C<NULL>.  In case of functions returning an C<isl_size>, C<isl_bool> or an
943 C<isl_stat>, this value is C<isl_size_error>,
944 C<isl_bool_error> or C<isl_stat_error>.
945 An error does not corrupt internal state,
946 such that isl can continue to be used. C<isl> also provides functions to
947 read the last error, including the specific error message,
948 the isl source file where the error occurred and the line number,
949 and to reset all information about the last error. The
950 last error is only stored for information purposes. Its presence does not
951 change the behavior of C<isl>. Hence, resetting an error is not required to
952 continue to use isl, but only to observe new errors.
954         #include <isl/ctx.h>
955         enum isl_error isl_ctx_last_error(isl_ctx *ctx);
956         const char *isl_ctx_last_error_msg(isl_ctx *ctx);
957         const char *isl_ctx_last_error_file(isl_ctx *ctx);
958         int isl_ctx_last_error_line(isl_ctx *ctx);
959         void isl_ctx_reset_error(isl_ctx *ctx);
961 If no error has occurred since the last call to C<isl_ctx_reset_error>,
962 then the functions C<isl_ctx_last_error_msg> and
963 C<isl_ctx_last_error_file> return C<NULL>.
965 Another option is to continue on error. This is similar to warn on error mode,
966 except that C<isl> does not print any warning. This allows a program to
967 implement its own error reporting.
969 The last option is to directly abort the execution of the program from within
970 the isl library. This makes it obviously impossible to recover from an error,
971 but it allows to directly spot the error location. By aborting on error,
972 debuggers break at the location the error occurred and can provide a stack
973 trace. Other tools that automatically provide stack traces on abort or that do
974 not want to continue execution after an error was triggered may also prefer to
975 abort on error.
977 The on error behavior of isl can be specified by calling
978 C<isl_options_set_on_error> or by setting the command line option
979 C<--isl-on-error>. Valid arguments for the function call are
980 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
981 choices for the command line option are C<warn>, C<continue> and C<abort>.
982 It is also possible to query the current error mode.
984         #include <isl/options.h>
985         isl_stat isl_options_set_on_error(isl_ctx *ctx, int val);
986         int isl_options_get_on_error(isl_ctx *ctx);
988 =head2 Identifiers
990 Identifiers are used to identify both individual dimensions
991 and tuples of dimensions.  They consist of an optional name and an optional
992 user pointer.  The name and the user pointer cannot both be C<NULL>, however.
993 Identifiers with the same name but different pointer values
994 are considered to be distinct.
995 Similarly, identifiers with different names but the same pointer value
996 are also considered to be distinct.
997 Equal identifiers are represented using the same object.
998 Pairs of identifiers can therefore be tested for equality using the
999 C<==> operator.
1000 Identifiers can be constructed, copied, freed, inspected and printed
1001 using the following functions.
1003         #include <isl/id.h>
1004         __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
1005                 __isl_keep const char *name, void *user);
1006         __isl_give isl_id *isl_id_set_free_user(
1007                 __isl_take isl_id *id,
1008                 void (*free_user)(void *user));
1009         void (*isl_id_get_free_user(__isl_keep isl_id *id))
1010                 (void *user);
1011         __isl_give isl_id *isl_id_copy(isl_id *id);
1012         __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
1014         void *isl_id_get_user(__isl_keep isl_id *id);
1015         __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
1017         __isl_give isl_printer *isl_printer_print_id(
1018                 __isl_take isl_printer *p, __isl_keep isl_id *id);
1020 The callback set by C<isl_id_set_free_user> is called on the user
1021 pointer when the last reference to the C<isl_id> is freed.
1022 This callback can be retrieved using C<isl_id_get_free_user>.
1023 Note that C<isl_id_get_name> returns a pointer to some internal
1024 data structure, so the result can only be used while the
1025 corresponding C<isl_id> is alive.
1027 =head2 Spaces
1029 Whenever a new set, relation or similar object is created from scratch,
1030 the space in which it lives needs to be specified using an C<isl_space>.
1031 Each space involves zero or more parameters and zero, one or two
1032 tuples of set or input/output dimensions.  The parameters and dimensions
1033 are identified by an C<isl_dim_type> and a position.
1034 The type C<isl_dim_param> refers to parameters,
1035 the type C<isl_dim_set> refers to set dimensions (for spaces
1036 with a single tuple of dimensions) and the types C<isl_dim_in>
1037 and C<isl_dim_out> refer to input and output dimensions
1038 (for spaces with two tuples of dimensions).
1039 Local spaces (see L</"Local Spaces">) also contain dimensions
1040 of type C<isl_dim_div>.
1041 Note that parameters are only identified by their position within
1042 a given object.  Across different objects, parameters are (usually)
1043 identified by their names or identifiers.  Only unnamed parameters
1044 are identified by their positions across objects.  The use of unnamed
1045 parameters is discouraged.
1047         #include <isl/space.h>
1048         __isl_give isl_space *isl_space_unit(isl_ctx *ctx);
1049         __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
1050                 unsigned nparam, unsigned n_in, unsigned n_out);
1051         __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
1052                 unsigned nparam);
1053         __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
1054                 unsigned nparam, unsigned dim);
1055         __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
1056         __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
1058 The space used for creating a parameter domain
1059 needs to be created using C<isl_space_unit> or C<isl_space_params_alloc>.
1060 For other sets, the space
1061 needs to be created using C<isl_space_set_alloc>, while
1062 for a relation, the space
1063 needs to be created using C<isl_space_alloc>.
1064 The use of C<isl_space_params_alloc>,
1065 C<isl_space_set_alloc> and C<isl_space_alloc> is discouraged as they allow
1066 for the introduction of unnamed parameters.
1068 To check whether a given space is that of a set or a map
1069 or whether it is a parameter space, use these functions:
1071         #include <isl/space.h>
1072         isl_bool isl_space_is_params(__isl_keep isl_space *space);
1073         isl_bool isl_space_is_set(__isl_keep isl_space *space);
1074         isl_bool isl_space_is_map(__isl_keep isl_space *space);
1076 Spaces can be compared using the following functions:
1078         #include <isl/space.h>
1079         isl_bool isl_space_is_equal(__isl_keep isl_space *space1,
1080                 __isl_keep isl_space *space2);
1081         isl_bool isl_space_has_equal_params(
1082                 __isl_keep isl_space *space1,
1083                 __isl_keep isl_space *space2);
1084         isl_bool isl_space_has_equal_tuples(
1085                 __isl_keep isl_space *space1,
1086                 __isl_keep isl_space *space2);
1087         isl_bool isl_space_is_domain(__isl_keep isl_space *space1,
1088                 __isl_keep isl_space *space2);
1089         isl_bool isl_space_is_range(__isl_keep isl_space *space1,
1090                 __isl_keep isl_space *space2);
1091         isl_bool isl_space_tuple_is_equal(
1092                 __isl_keep isl_space *space1,
1093                 enum isl_dim_type type1,
1094                 __isl_keep isl_space *space2,
1095                 enum isl_dim_type type2);
1097 C<isl_space_is_domain> checks whether the first argument is equal
1098 to the domain of the second argument.  This requires in particular that
1099 the first argument is a set space and that the second argument
1100 is a map space.  C<isl_space_tuple_is_equal> checks whether the given
1101 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
1102 spaces are the same.  That is, it checks if they have the same
1103 identifier (if any), the same dimension and the same internal structure
1104 (if any).
1105 The function
1106 C<isl_space_has_equal_params> checks whether two spaces
1107 have the same parameters in the same order.
1108 C<isl_space_has_equal_tuples> check whether two spaces have
1109 the same tuples.  In contrast to C<isl_space_is_equal> below,
1110 it does not check the
1111 parameters.  This is useful because many C<isl> functions align the
1112 parameters before they perform their operations, such that equivalence
1113 is not necessary.
1114 C<isl_space_is_equal> checks whether two spaces are identical,
1115 meaning that they have the same parameters and the same tuples.
1116 That is, it checks whether both C<isl_space_has_equal_params> and
1117 C<isl_space_has_equal_tuples> hold.
1119 It is often useful to create objects that live in the
1120 same space as some other object.  This can be accomplished
1121 by creating the new objects
1122 (see L</"Creating New Sets and Relations"> or
1123 L</"Functions">) based on the space
1124 of the original object.
1126         #include <isl/set.h>
1127         __isl_give isl_space *isl_basic_set_get_space(
1128                 __isl_keep isl_basic_set *bset);
1129         __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
1131         #include <isl/union_set.h>
1132         __isl_give isl_space *isl_union_set_get_space(
1133                 __isl_keep isl_union_set *uset);
1135         #include <isl/map.h>
1136         __isl_give isl_space *isl_basic_map_get_space(
1137                 __isl_keep isl_basic_map *bmap);
1138         __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
1140         #include <isl/union_map.h>
1141         __isl_give isl_space *isl_union_map_get_space(
1142                 __isl_keep isl_union_map *umap);
1144         #include <isl/constraint.h>
1145         __isl_give isl_space *isl_constraint_get_space(
1146                 __isl_keep isl_constraint *constraint);
1148         #include <isl/polynomial.h>
1149         __isl_give isl_space *isl_qpolynomial_get_domain_space(
1150                 __isl_keep isl_qpolynomial *qp);
1151         __isl_give isl_space *isl_qpolynomial_get_space(
1152                 __isl_keep isl_qpolynomial *qp);
1153         __isl_give isl_space *
1154         isl_qpolynomial_fold_get_domain_space(
1155                 __isl_keep isl_qpolynomial_fold *fold);
1156         __isl_give isl_space *isl_qpolynomial_fold_get_space(
1157                 __isl_keep isl_qpolynomial_fold *fold);
1158         __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
1159                 __isl_keep isl_pw_qpolynomial *pwqp);
1160         __isl_give isl_space *isl_pw_qpolynomial_get_space(
1161                 __isl_keep isl_pw_qpolynomial *pwqp);
1162         __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
1163                 __isl_keep isl_pw_qpolynomial_fold *pwf);
1164         __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
1165                 __isl_keep isl_pw_qpolynomial_fold *pwf);
1166         __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
1167                 __isl_keep isl_union_pw_qpolynomial *upwqp);
1168         __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
1169                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
1171         #include <isl/id.h>
1172         __isl_give isl_space *isl_multi_id_get_space(
1173                 __isl_keep isl_multi_id *mi);
1175         #include <isl/val.h>
1176         __isl_give isl_space *isl_multi_val_get_space(
1177                 __isl_keep isl_multi_val *mv);
1179         #include <isl/aff.h>
1180         __isl_give isl_space *isl_aff_get_domain_space(
1181                 __isl_keep isl_aff *aff);
1182         __isl_give isl_space *isl_aff_get_space(
1183                 __isl_keep isl_aff *aff);
1184         __isl_give isl_space *isl_pw_aff_get_domain_space(
1185                 __isl_keep isl_pw_aff *pwaff);
1186         __isl_give isl_space *isl_pw_aff_get_space(
1187                 __isl_keep isl_pw_aff *pwaff);
1188         __isl_give isl_space *isl_multi_aff_get_domain_space(
1189                 __isl_keep isl_multi_aff *maff);
1190         __isl_give isl_space *isl_multi_aff_get_space(
1191                 __isl_keep isl_multi_aff *maff);
1192         __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
1193                 __isl_keep isl_pw_multi_aff *pma);
1194         __isl_give isl_space *isl_pw_multi_aff_get_space(
1195                 __isl_keep isl_pw_multi_aff *pma);
1196         __isl_give isl_space *isl_union_pw_aff_get_space(
1197                 __isl_keep isl_union_pw_aff *upa);
1198         __isl_give isl_space *isl_union_pw_multi_aff_get_space(
1199                 __isl_keep isl_union_pw_multi_aff *upma);
1200         __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
1201                 __isl_keep isl_multi_pw_aff *mpa);
1202         __isl_give isl_space *isl_multi_pw_aff_get_space(
1203                 __isl_keep isl_multi_pw_aff *mpa);
1204         __isl_give isl_space *
1205         isl_multi_union_pw_aff_get_domain_space(
1206                 __isl_keep isl_multi_union_pw_aff *mupa);
1207         __isl_give isl_space *
1208         isl_multi_union_pw_aff_get_space(
1209                 __isl_keep isl_multi_union_pw_aff *mupa);
1211         #include <isl/point.h>
1212         __isl_give isl_space *isl_point_get_space(
1213                 __isl_keep isl_point *pnt);
1215         #include <isl/fixed_box.h>
1216         __isl_give isl_space *isl_fixed_box_get_space(
1217                 __isl_keep isl_fixed_box *box);
1219 The number of dimensions of a given type of space
1220 may be read off from a space or an object that lives
1221 in a space using the following functions.
1222 In case of C<isl_space_dim>, type may be
1223 C<isl_dim_param>, C<isl_dim_in> (only for relations),
1224 C<isl_dim_out> (only for relations), C<isl_dim_set>
1225 (only for sets) or C<isl_dim_all>.
1227         #include <isl/space.h>
1228         isl_size isl_space_dim(__isl_keep isl_space *space,
1229                 enum isl_dim_type type);
1231         #include <isl/local_space.h>
1232         isl_size isl_local_space_dim(__isl_keep isl_local_space *ls,
1233                 enum isl_dim_type type);
1235         #include <isl/set.h>
1236         isl_size isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1237                 enum isl_dim_type type);
1238         isl_size isl_set_tuple_dim(__isl_keep isl_set *set);
1239         isl_size isl_set_dim(__isl_keep isl_set *set,
1240                 enum isl_dim_type type);
1242         #include <isl/union_set.h>
1243         isl_size isl_union_set_dim(__isl_keep isl_union_set *uset,
1244                 enum isl_dim_type type);
1246         #include <isl/map.h>
1247         isl_size isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1248                 enum isl_dim_type type);
1249         isl_size isl_map_domain_tuple_dim(
1250                 __isl_keep isl_map *map);
1251         isl_size isl_map_range_tuple_dim(
1252                 __isl_keep isl_map *map);
1253         isl_size isl_map_dim(__isl_keep isl_map *map,
1254                 enum isl_dim_type type);
1256         #include <isl/union_map.h>
1257         isl_size isl_union_map_dim(__isl_keep isl_union_map *umap,
1258                 enum isl_dim_type type);
1260         #include <isl/val.h>
1261         isl_size isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1262                 enum isl_dim_type type);
1264         #include <isl/aff.h>
1265         isl_size isl_aff_dim(__isl_keep isl_aff *aff,
1266                 enum isl_dim_type type);
1267         isl_size isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1268                 enum isl_dim_type type);
1269         isl_size isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1270                 enum isl_dim_type type);
1271         isl_size isl_pw_multi_aff_dim(
1272                 __isl_keep isl_pw_multi_aff *pma,
1273                 enum isl_dim_type type);
1274         isl_size isl_multi_pw_aff_dim(
1275                 __isl_keep isl_multi_pw_aff *mpa,
1276                 enum isl_dim_type type);
1277         isl_size isl_union_pw_aff_dim(
1278                 __isl_keep isl_union_pw_aff *upa,
1279                 enum isl_dim_type type);
1280         isl_size isl_union_pw_multi_aff_dim(
1281                 __isl_keep isl_union_pw_multi_aff *upma,
1282                 enum isl_dim_type type);
1283         isl_size isl_multi_union_pw_aff_dim(
1284                 __isl_keep isl_multi_union_pw_aff *mupa,
1285                 enum isl_dim_type type);
1287         #include <isl/polynomial.h>
1288         isl_size isl_union_pw_qpolynomial_dim(
1289                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1290                 enum isl_dim_type type);
1291         isl_size isl_union_pw_qpolynomial_fold_dim(
1292                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1293                 enum isl_dim_type type);
1295 Note that an C<isl_union_set>, an C<isl_union_map>,
1296 an C<isl_union_pw_multi_aff>,
1297 an C<isl_union_pw_qpolynomial> and
1298 an C<isl_union_pw_qpolynomial_fold>
1299 only have parameters.
1301 Additional parameters can be added to a space using the following function.
1303         #include <isl/space.h>
1304         __isl_give isl_space *isl_space_add_param_id(
1305                 __isl_take isl_space *space,
1306                 __isl_take isl_id *id);
1308 If a parameter with the given identifier already appears in the space,
1309 then it is not added again.
1311 Conversely, all parameters can be removed from a space
1312 using the following function.
1314         #include <isl/space.h>
1315         __isl_give isl_space *isl_space_drop_all_params(
1316                 __isl_take isl_space *space);
1318 The identifiers or names of the individual dimensions of spaces
1319 may be set or read off using the following functions on spaces
1320 or objects that live in spaces.
1321 These functions are mostly useful to obtain the identifiers, positions
1322 or names of the parameters.  Identifiers of individual dimensions are
1323 essentially only useful for printing.  They are ignored by all other
1324 operations and may not be preserved across those operations.
1325 To keep track of a space along with names/identifiers of
1326 the set dimensions, use an C<isl_multi_id> as described in
1327 L</"Functions">.
1329         #include <isl/space.h>
1330         __isl_give isl_space *isl_space_set_dim_id(
1331                 __isl_take isl_space *space,
1332                 enum isl_dim_type type, unsigned pos,
1333                 __isl_take isl_id *id);
1334         isl_bool isl_space_has_dim_id(__isl_keep isl_space *space,
1335                 enum isl_dim_type type, unsigned pos);
1336         __isl_give isl_id *isl_space_get_dim_id(
1337                 __isl_keep isl_space *space,
1338                 enum isl_dim_type type, unsigned pos);
1339         __isl_give isl_space *isl_space_set_dim_name(
1340                 __isl_take isl_space *space,
1341                  enum isl_dim_type type, unsigned pos,
1342                  __isl_keep const char *name);
1343         isl_bool isl_space_has_dim_name(__isl_keep isl_space *space,
1344                 enum isl_dim_type type, unsigned pos);
1345         __isl_keep const char *isl_space_get_dim_name(
1346                 __isl_keep isl_space *space,
1347                 enum isl_dim_type type, unsigned pos);
1349         #include <isl/local_space.h>
1350         __isl_give isl_local_space *isl_local_space_set_dim_id(
1351                 __isl_take isl_local_space *ls,
1352                 enum isl_dim_type type, unsigned pos,
1353                 __isl_take isl_id *id);
1354         isl_bool isl_local_space_has_dim_id(
1355                 __isl_keep isl_local_space *ls,
1356                 enum isl_dim_type type, unsigned pos);
1357         __isl_give isl_id *isl_local_space_get_dim_id(
1358                 __isl_keep isl_local_space *ls,
1359                 enum isl_dim_type type, unsigned pos);
1360         __isl_give isl_local_space *isl_local_space_set_dim_name(
1361                 __isl_take isl_local_space *ls,
1362                 enum isl_dim_type type, unsigned pos, const char *s);
1363         isl_bool isl_local_space_has_dim_name(
1364                 __isl_keep isl_local_space *ls,
1365                 enum isl_dim_type type, unsigned pos)
1366         const char *isl_local_space_get_dim_name(
1367                 __isl_keep isl_local_space *ls,
1368                 enum isl_dim_type type, unsigned pos);
1370         #include <isl/constraint.h>
1371         const char *isl_constraint_get_dim_name(
1372                 __isl_keep isl_constraint *constraint,
1373                 enum isl_dim_type type, unsigned pos);
1375         #include <isl/set.h>
1376         __isl_give isl_id *isl_basic_set_get_dim_id(
1377                 __isl_keep isl_basic_set *bset,
1378                 enum isl_dim_type type, unsigned pos);
1379         __isl_give isl_set *isl_set_set_dim_id(
1380                 __isl_take isl_set *set, enum isl_dim_type type,
1381                 unsigned pos, __isl_take isl_id *id);
1382         isl_bool isl_set_has_dim_id(__isl_keep isl_set *set,
1383                 enum isl_dim_type type, unsigned pos);
1384         __isl_give isl_id *isl_set_get_dim_id(
1385                 __isl_keep isl_set *set, enum isl_dim_type type,
1386                 unsigned pos);
1387         const char *isl_basic_set_get_dim_name(
1388                 __isl_keep isl_basic_set *bset,
1389                 enum isl_dim_type type, unsigned pos);
1390         isl_bool isl_set_has_dim_name(__isl_keep isl_set *set,
1391                 enum isl_dim_type type, unsigned pos);
1392         const char *isl_set_get_dim_name(
1393                 __isl_keep isl_set *set,
1394                 enum isl_dim_type type, unsigned pos);
1396         #include <isl/map.h>
1397         __isl_give isl_map *isl_map_set_dim_id(
1398                 __isl_take isl_map *map, enum isl_dim_type type,
1399                 unsigned pos, __isl_take isl_id *id);
1400         isl_bool isl_basic_map_has_dim_id(
1401                 __isl_keep isl_basic_map *bmap,
1402                 enum isl_dim_type type, unsigned pos);
1403         isl_bool isl_map_has_dim_id(__isl_keep isl_map *map,
1404                 enum isl_dim_type type, unsigned pos);
1405         __isl_give isl_id *isl_map_get_dim_id(
1406                 __isl_keep isl_map *map, enum isl_dim_type type,
1407                 unsigned pos);
1408         __isl_give isl_id *isl_union_map_get_dim_id(
1409                 __isl_keep isl_union_map *umap,
1410                 enum isl_dim_type type, unsigned pos);
1411         const char *isl_basic_map_get_dim_name(
1412                 __isl_keep isl_basic_map *bmap,
1413                 enum isl_dim_type type, unsigned pos);
1414         isl_bool isl_map_has_dim_name(__isl_keep isl_map *map,
1415                 enum isl_dim_type type, unsigned pos);
1416         const char *isl_map_get_dim_name(
1417                 __isl_keep isl_map *map,
1418                 enum isl_dim_type type, unsigned pos);
1420         #include <isl/val.h>
1421         __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1422                 __isl_take isl_multi_val *mv,
1423                 enum isl_dim_type type, unsigned pos,
1424                 __isl_take isl_id *id);
1425         __isl_give isl_id *isl_multi_val_get_dim_id(
1426                 __isl_keep isl_multi_val *mv,
1427                 enum isl_dim_type type, unsigned pos);
1428         __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1429                 __isl_take isl_multi_val *mv,
1430                 enum isl_dim_type type, unsigned pos, const char *s);
1432         #include <isl/aff.h>
1433         __isl_give isl_aff *isl_aff_set_dim_id(
1434                 __isl_take isl_aff *aff, enum isl_dim_type type,
1435                 unsigned pos, __isl_take isl_id *id);
1436         __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1437                 __isl_take isl_multi_aff *maff,
1438                 enum isl_dim_type type, unsigned pos,
1439                 __isl_take isl_id *id);
1440         __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1441                 __isl_take isl_pw_aff *pma,
1442                 enum isl_dim_type type, unsigned pos,
1443                 __isl_take isl_id *id);
1444         __isl_give isl_multi_pw_aff *
1445         isl_multi_pw_aff_set_dim_id(
1446                 __isl_take isl_multi_pw_aff *mpa,
1447                 enum isl_dim_type type, unsigned pos,
1448                 __isl_take isl_id *id);
1449         __isl_give isl_multi_union_pw_aff *
1450         isl_multi_union_pw_aff_set_dim_id(
1451                 __isl_take isl_multi_union_pw_aff *mupa,
1452                 enum isl_dim_type type, unsigned pos,
1453                 __isl_take isl_id *id);
1454         __isl_give isl_id *isl_multi_aff_get_dim_id(
1455                 __isl_keep isl_multi_aff *ma,
1456                 enum isl_dim_type type, unsigned pos);
1457         isl_bool isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1458                 enum isl_dim_type type, unsigned pos);
1459         __isl_give isl_id *isl_pw_aff_get_dim_id(
1460                 __isl_keep isl_pw_aff *pa,
1461                 enum isl_dim_type type, unsigned pos);
1462         __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1463                 __isl_keep isl_pw_multi_aff *pma,
1464                 enum isl_dim_type type, unsigned pos);
1465         __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1466                 __isl_keep isl_multi_pw_aff *mpa,
1467                 enum isl_dim_type type, unsigned pos);
1468         __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1469                 __isl_keep isl_multi_union_pw_aff *mupa,
1470                 enum isl_dim_type type, unsigned pos);
1471         __isl_give isl_aff *isl_aff_set_dim_name(
1472                 __isl_take isl_aff *aff, enum isl_dim_type type,
1473                 unsigned pos, const char *s);
1474         __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1475                 __isl_take isl_multi_aff *maff,
1476                 enum isl_dim_type type, unsigned pos, const char *s);
1477         __isl_give isl_multi_pw_aff *
1478         isl_multi_pw_aff_set_dim_name(
1479                 __isl_take isl_multi_pw_aff *mpa,
1480                 enum isl_dim_type type, unsigned pos, const char *s);
1481         __isl_give isl_union_pw_aff *
1482         isl_union_pw_aff_set_dim_name(
1483                 __isl_take isl_union_pw_aff *upa,
1484                 enum isl_dim_type type, unsigned pos,
1485                 const char *s);
1486         __isl_give isl_union_pw_multi_aff *
1487         isl_union_pw_multi_aff_set_dim_name(
1488                 __isl_take isl_union_pw_multi_aff *upma,
1489                 enum isl_dim_type type, unsigned pos,
1490                 const char *s);
1491         __isl_give isl_multi_union_pw_aff *
1492         isl_multi_union_pw_aff_set_dim_name(
1493                 __isl_take isl_multi_union_pw_aff *mupa,
1494                 enum isl_dim_type type, unsigned pos,
1495                 const char *s);
1496         const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1497                 enum isl_dim_type type, unsigned pos);
1498         const char *isl_pw_aff_get_dim_name(
1499                 __isl_keep isl_pw_aff *pa,
1500                 enum isl_dim_type type, unsigned pos);
1501         const char *isl_pw_multi_aff_get_dim_name(
1502                 __isl_keep isl_pw_multi_aff *pma,
1503                 enum isl_dim_type type, unsigned pos);
1505         #include <isl/polynomial.h>
1506         __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1507                 __isl_take isl_qpolynomial *qp,
1508                 enum isl_dim_type type, unsigned pos,
1509                 const char *s);
1510         __isl_give isl_pw_qpolynomial *
1511         isl_pw_qpolynomial_set_dim_name(
1512                 __isl_take isl_pw_qpolynomial *pwqp,
1513                 enum isl_dim_type type, unsigned pos,
1514                 const char *s);
1515         __isl_give isl_pw_qpolynomial_fold *
1516         isl_pw_qpolynomial_fold_set_dim_name(
1517                 __isl_take isl_pw_qpolynomial_fold *pwf,
1518                 enum isl_dim_type type, unsigned pos,
1519                 const char *s);
1520         __isl_give isl_union_pw_qpolynomial *
1521         isl_union_pw_qpolynomial_set_dim_name(
1522                 __isl_take isl_union_pw_qpolynomial *upwqp,
1523                 enum isl_dim_type type, unsigned pos,
1524                 const char *s);
1525         __isl_give isl_union_pw_qpolynomial_fold *
1526         isl_union_pw_qpolynomial_fold_set_dim_name(
1527                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1528                 enum isl_dim_type type, unsigned pos,
1529                 const char *s);
1531 Note that C<isl_space_get_name> returns a pointer to some internal
1532 data structure, so the result can only be used while the
1533 corresponding C<isl_space> is alive.
1534 Also note that every function that operates on two sets or relations
1535 requires that both arguments have the same parameters.  This also
1536 means that if one of the arguments has named parameters, then the
1537 other needs to have named parameters too and the names need to match.
1538 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1539 arguments may have different parameters (as long as they are named),
1540 in which case the result will have as parameters the union of the parameters of
1541 the arguments.
1543 Given the identifier or name of a dimension (typically a parameter),
1544 its position can be obtained from the following functions.
1546         #include <isl/space.h>
1547         int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1548                 enum isl_dim_type type, __isl_keep isl_id *id);
1549         int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1550                 enum isl_dim_type type, const char *name);
1552         #include <isl/local_space.h>
1553         int isl_local_space_find_dim_by_name(
1554                 __isl_keep isl_local_space *ls,
1555                 enum isl_dim_type type, const char *name);
1557         #include <isl/val.h>
1558         int isl_multi_val_find_dim_by_id(
1559                 __isl_keep isl_multi_val *mv,
1560                 enum isl_dim_type type, __isl_keep isl_id *id);
1561         int isl_multi_val_find_dim_by_name(
1562                 __isl_keep isl_multi_val *mv,
1563                 enum isl_dim_type type, const char *name);
1565         #include <isl/set.h>
1566         int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1567                 enum isl_dim_type type, __isl_keep isl_id *id);
1568         int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1569                 enum isl_dim_type type, const char *name);
1571         #include <isl/map.h>
1572         int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1573                 enum isl_dim_type type, __isl_keep isl_id *id);
1574         int isl_basic_map_find_dim_by_name(
1575                 __isl_keep isl_basic_map *bmap,
1576                 enum isl_dim_type type, const char *name);
1577         int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1578                 enum isl_dim_type type, const char *name);
1579         int isl_union_map_find_dim_by_name(
1580                 __isl_keep isl_union_map *umap,
1581                 enum isl_dim_type type, const char *name);
1583         #include <isl/aff.h>
1584         int isl_multi_aff_find_dim_by_id(
1585                 __isl_keep isl_multi_aff *ma,
1586                 enum isl_dim_type type, __isl_keep isl_id *id);
1587         int isl_multi_pw_aff_find_dim_by_id(
1588                 __isl_keep isl_multi_pw_aff *mpa,
1589                 enum isl_dim_type type, __isl_keep isl_id *id);
1590         int isl_multi_union_pw_aff_find_dim_by_id(
1591                 __isl_keep isl_multi_union_pw_aff *mupa,
1592                 enum isl_dim_type type, __isl_keep isl_id *id);
1593         int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1594                 enum isl_dim_type type, const char *name);
1595         int isl_multi_aff_find_dim_by_name(
1596                 __isl_keep isl_multi_aff *ma,
1597                 enum isl_dim_type type, const char *name);
1598         int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1599                 enum isl_dim_type type, const char *name);
1600         int isl_multi_pw_aff_find_dim_by_name(
1601                 __isl_keep isl_multi_pw_aff *mpa,
1602                 enum isl_dim_type type, const char *name);
1603         int isl_pw_multi_aff_find_dim_by_name(
1604                 __isl_keep isl_pw_multi_aff *pma,
1605                 enum isl_dim_type type, const char *name);
1606         int isl_union_pw_aff_find_dim_by_name(
1607                 __isl_keep isl_union_pw_aff *upa,
1608                 enum isl_dim_type type, const char *name);
1609         int isl_union_pw_multi_aff_find_dim_by_name(
1610                 __isl_keep isl_union_pw_multi_aff *upma,
1611                 enum isl_dim_type type, const char *name);
1612         int isl_multi_union_pw_aff_find_dim_by_name(
1613                 __isl_keep isl_multi_union_pw_aff *mupa,
1614                 enum isl_dim_type type, const char *name);
1616         #include <isl/polynomial.h>
1617         int isl_pw_qpolynomial_find_dim_by_name(
1618                 __isl_keep isl_pw_qpolynomial *pwqp,
1619                 enum isl_dim_type type, const char *name);
1620         int isl_pw_qpolynomial_fold_find_dim_by_name(
1621                 __isl_keep isl_pw_qpolynomial_fold *pwf,
1622                 enum isl_dim_type type, const char *name);
1623         int isl_union_pw_qpolynomial_find_dim_by_name(
1624                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1625                 enum isl_dim_type type, const char *name);
1626         int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1627                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1628                 enum isl_dim_type type, const char *name);
1630 The identifiers or names of entire spaces may be set or read off
1631 using the following functions.
1633         #include <isl/space.h>
1634         __isl_give isl_space *isl_space_set_domain_tuple_id(
1635                 __isl_take isl_space *space,
1636                 __isl_take isl_id *id);
1637         __isl_give isl_space *isl_space_set_range_tuple_id(
1638                 __isl_take isl_space *space,
1639                 __isl_take isl_id *id);
1640         __isl_give isl_space *isl_space_set_tuple_id(
1641                 __isl_take isl_space *space,
1642                 enum isl_dim_type type, __isl_take isl_id *id);
1643         __isl_give isl_space *isl_space_reset_tuple_id(
1644                 __isl_take isl_space *space, enum isl_dim_type type);
1645         isl_bool isl_space_has_domain_tuple_id(
1646                 __isl_keep isl_space *space);
1647         isl_bool isl_space_has_range_tuple_id(
1648                 __isl_keep isl_space *space);
1649         isl_bool isl_space_has_tuple_id(
1650                 __isl_keep isl_space *space,
1651                 enum isl_dim_type type);
1652         __isl_give isl_id *isl_space_get_domain_tuple_id(
1653                 __isl_keep isl_space *space);
1654         __isl_give isl_id *isl_space_get_range_tuple_id(
1655                 __isl_keep isl_space *space);
1656         __isl_give isl_id *isl_space_get_tuple_id(
1657                 __isl_keep isl_space *space, enum isl_dim_type type);
1658         __isl_give isl_space *isl_space_set_tuple_name(
1659                 __isl_take isl_space *space,
1660                 enum isl_dim_type type, const char *s);
1661         isl_bool isl_space_has_tuple_name(
1662                 __isl_keep isl_space *space,
1663                 enum isl_dim_type type);
1664         __isl_keep const char *isl_space_get_tuple_name(
1665                 __isl_keep isl_space *space,
1666                 enum isl_dim_type type);
1668         #include <isl/local_space.h>
1669         __isl_give isl_local_space *isl_local_space_set_tuple_id(
1670                 __isl_take isl_local_space *ls,
1671                 enum isl_dim_type type, __isl_take isl_id *id);
1673         #include <isl/set.h>
1674         __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1675                 __isl_take isl_basic_set *bset,
1676                 __isl_take isl_id *id);
1677         __isl_give isl_set *isl_set_set_tuple_id(
1678                 __isl_take isl_set *set, __isl_take isl_id *id);
1679         __isl_give isl_set *isl_set_reset_tuple_id(
1680                 __isl_take isl_set *set);
1681         isl_bool isl_set_has_tuple_id(__isl_keep isl_set *set);
1682         __isl_give isl_id *isl_set_get_tuple_id(
1683                 __isl_keep isl_set *set);
1684         __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1685                 __isl_take isl_basic_set *set, const char *s);
1686         __isl_give isl_set *isl_set_set_tuple_name(
1687                 __isl_take isl_set *set, const char *s);
1688         const char *isl_basic_set_get_tuple_name(
1689                 __isl_keep isl_basic_set *bset);
1690         isl_bool isl_set_has_tuple_name(__isl_keep isl_set *set);
1691         const char *isl_set_get_tuple_name(
1692                 __isl_keep isl_set *set);
1694         #include <isl/map.h>
1695         __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1696                 __isl_take isl_basic_map *bmap,
1697                 enum isl_dim_type type, __isl_take isl_id *id);
1698         __isl_give isl_map *isl_map_set_domain_tuple_id(
1699                 __isl_take isl_map *map, __isl_take isl_id *id);
1700         __isl_give isl_map *isl_map_set_range_tuple_id(
1701                 __isl_take isl_map *map, __isl_take isl_id *id);
1702         __isl_give isl_map *isl_map_set_tuple_id(
1703                 __isl_take isl_map *map, enum isl_dim_type type,
1704                 __isl_take isl_id *id);
1705         __isl_give isl_map *isl_map_reset_tuple_id(
1706                 __isl_take isl_map *map, enum isl_dim_type type);
1707         isl_bool isl_map_has_domain_tuple_id(
1708                 __isl_keep isl_map *map);
1709         isl_bool isl_map_has_range_tuple_id(
1710                 __isl_keep isl_map *map);
1711         isl_bool isl_map_has_tuple_id(__isl_keep isl_map *map,
1712                 enum isl_dim_type type);
1713         __isl_give isl_id *isl_map_get_domain_tuple_id(
1714                 __isl_keep isl_map *map);
1715         __isl_give isl_id *isl_map_get_range_tuple_id(
1716                 __isl_keep isl_map *map);
1717         __isl_give isl_id *isl_map_get_tuple_id(
1718                 __isl_keep isl_map *map, enum isl_dim_type type);
1719         __isl_give isl_map *isl_map_set_tuple_name(
1720                 __isl_take isl_map *map,
1721                 enum isl_dim_type type, const char *s);
1722         const char *isl_basic_map_get_tuple_name(
1723                 __isl_keep isl_basic_map *bmap,
1724                 enum isl_dim_type type);
1725         __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1726                 __isl_take isl_basic_map *bmap,
1727                 enum isl_dim_type type, const char *s);
1728         isl_bool isl_map_has_tuple_name(__isl_keep isl_map *map,
1729                 enum isl_dim_type type);
1730         const char *isl_map_get_tuple_name(
1731                 __isl_keep isl_map *map,
1732                 enum isl_dim_type type);
1734         #include <isl/val.h>
1735         __isl_give isl_multi_val *isl_multi_val_set_range_tuple_id(
1736                 __isl_take isl_multi_val *mv,
1737                 __isl_take isl_id *id);
1738         __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1739                 __isl_take isl_multi_val *mv,
1740                 enum isl_dim_type type, __isl_take isl_id *id);
1741         __isl_give isl_multi_val *
1742         isl_multi_val_reset_range_tuple_id(
1743                 __isl_take isl_multi_val *mv);
1744         __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1745                 __isl_take isl_multi_val *mv,
1746                 enum isl_dim_type type);
1747         isl_bool isl_multi_val_has_range_tuple_id(
1748                 __isl_keep isl_multi_val *mv);
1749         __isl_give isl_id *isl_multi_val_get_range_tuple_id(
1750                 __isl_keep isl_multi_val *mv);
1751         isl_bool isl_multi_val_has_tuple_id(
1752                 __isl_keep isl_multi_val *mv,
1753                 enum isl_dim_type type);
1754         __isl_give isl_id *isl_multi_val_get_tuple_id(
1755                 __isl_keep isl_multi_val *mv,
1756                 enum isl_dim_type type);
1757         __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1758                 __isl_take isl_multi_val *mv,
1759                 enum isl_dim_type type, const char *s);
1760         const char *isl_multi_val_get_tuple_name(
1761                 __isl_keep isl_multi_val *mv,
1762                 enum isl_dim_type type);
1764         #include <isl/aff.h>
1765         __isl_give isl_aff *isl_aff_set_tuple_id(
1766                 __isl_take isl_aff *aff,
1767                 enum isl_dim_type type, __isl_take isl_id *id);
1768         __isl_give isl_multi_aff *isl_multi_aff_set_range_tuple_id(
1769                 __isl_take isl_multi_aff *ma,
1770                 __isl_take isl_id *id);
1771         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1772                 __isl_take isl_multi_aff *maff,
1773                 enum isl_dim_type type, __isl_take isl_id *id);
1774         __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1775                 __isl_take isl_pw_aff *pwaff,
1776                 enum isl_dim_type type, __isl_take isl_id *id);
1777         __isl_give isl_pw_multi_aff *
1778         isl_pw_multi_aff_set_range_tuple_id(
1779                 __isl_take isl_pw_multi_aff *pma,
1780                 __isl_take isl_id *id);
1781         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1782                 __isl_take isl_pw_multi_aff *pma,
1783                 enum isl_dim_type type, __isl_take isl_id *id);
1784         __isl_give isl_multi_pw_aff *
1785         isl_multi_pw_aff_set_range_tuple_id(
1786                 __isl_take isl_multi_pw_aff *mpa,
1787                 __isl_take isl_id *id);
1788         __isl_give isl_multi_union_pw_aff *
1789         isl_multi_union_pw_aff_set_range_tuple_id(
1790                 __isl_take isl_multi_union_pw_aff *mupa,
1791                 __isl_take isl_id *id);
1792         __isl_give isl_multi_union_pw_aff *
1793         isl_multi_union_pw_aff_set_tuple_id(
1794                 __isl_take isl_multi_union_pw_aff *mupa,
1795                 enum isl_dim_type type, __isl_take isl_id *id);
1796         __isl_give isl_multi_aff *
1797         isl_multi_aff_reset_range_tuple_id(
1798                 __isl_take isl_multi_aff *ma);
1799         __isl_give isl_multi_pw_aff *
1800         isl_multi_pw_aff_reset_range_tuple_id(
1801                 __isl_take isl_multi_pw_aff *mpa);
1802         __isl_give isl_multi_union_pw_aff *
1803         isl_multi_union_pw_aff_reset_range_tuple_id(
1804                 __isl_take isl_multi_union_pw_aff *mupa);
1805         __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1806                 __isl_take isl_multi_aff *ma,
1807                 enum isl_dim_type type);
1808         __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1809                 __isl_take isl_pw_aff *pa,
1810                 enum isl_dim_type type);
1811         __isl_give isl_multi_pw_aff *
1812         isl_multi_pw_aff_reset_tuple_id(
1813                 __isl_take isl_multi_pw_aff *mpa,
1814                 enum isl_dim_type type);
1815         __isl_give isl_pw_multi_aff *
1816         isl_pw_multi_aff_reset_tuple_id(
1817                 __isl_take isl_pw_multi_aff *pma,
1818                 enum isl_dim_type type);
1819         __isl_give isl_multi_union_pw_aff *
1820         isl_multi_union_pw_aff_reset_tuple_id(
1821                 __isl_take isl_multi_union_pw_aff *mupa,
1822                 enum isl_dim_type type);
1823         isl_bool isl_multi_aff_has_range_tuple_id(
1824                 __isl_keep isl_multi_aff *ma);
1825         __isl_give isl_id *isl_multi_aff_get_range_tuple_id(
1826                 __isl_keep isl_multi_aff *ma);
1827         isl_bool isl_multi_aff_has_tuple_id(
1828                 __isl_keep isl_multi_aff *ma,
1829                 enum isl_dim_type type);
1830         __isl_give isl_id *isl_multi_aff_get_tuple_id(
1831                 __isl_keep isl_multi_aff *ma,
1832                 enum isl_dim_type type);
1833         isl_bool isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1834                 enum isl_dim_type type);
1835         __isl_give isl_id *isl_pw_aff_get_tuple_id(
1836                 __isl_keep isl_pw_aff *pa,
1837                 enum isl_dim_type type);
1838         isl_bool isl_pw_multi_aff_has_range_tuple_id(
1839                 __isl_keep isl_pw_multi_aff *pma);
1840         isl_bool isl_pw_multi_aff_has_tuple_id(
1841                 __isl_keep isl_pw_multi_aff *pma,
1842                 enum isl_dim_type type);
1843         __isl_give isl_id *isl_pw_multi_aff_get_range_tuple_id(
1844                 __isl_keep isl_pw_multi_aff *pma);
1845         __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1846                 __isl_keep isl_pw_multi_aff *pma,
1847                 enum isl_dim_type type);
1848         isl_bool isl_multi_pw_aff_has_range_tuple_id(
1849                 __isl_keep isl_multi_pw_aff *mpa);
1850         __isl_give isl_id *isl_multi_pw_aff_get_range_tuple_id(
1851                 __isl_keep isl_multi_pw_aff *mpa);
1852         isl_bool isl_multi_pw_aff_has_tuple_id(
1853                 __isl_keep isl_multi_pw_aff *mpa,
1854                 enum isl_dim_type type);
1855         __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1856                 __isl_keep isl_multi_pw_aff *mpa,
1857                 enum isl_dim_type type);
1858         isl_bool isl_multi_union_pw_aff_has_range_tuple_id(
1859                 __isl_keep isl_multi_union_pw_aff *mupa);
1860         __isl_give isl_id *
1861         isl_multi_union_pw_aff_get_range_tuple_id(
1862                 __isl_keep isl_multi_union_pw_aff *mupa);
1863         isl_bool isl_multi_union_pw_aff_has_tuple_id(
1864                 __isl_keep isl_multi_union_pw_aff *mupa,
1865                 enum isl_dim_type type);
1866         __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1867                 __isl_keep isl_multi_union_pw_aff *mupa,
1868                 enum isl_dim_type type);
1869         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1870                 __isl_take isl_multi_aff *maff,
1871                 enum isl_dim_type type, const char *s);
1872         __isl_give isl_multi_pw_aff *
1873         isl_multi_pw_aff_set_tuple_name(
1874                 __isl_take isl_multi_pw_aff *mpa,
1875                 enum isl_dim_type type, const char *s);
1876         __isl_give isl_multi_union_pw_aff *
1877         isl_multi_union_pw_aff_set_tuple_name(
1878                 __isl_take isl_multi_union_pw_aff *mupa,
1879                 enum isl_dim_type type, const char *s);
1880         const char *isl_multi_aff_get_tuple_name(
1881                 __isl_keep isl_multi_aff *multi,
1882                 enum isl_dim_type type);
1883         isl_bool isl_pw_multi_aff_has_tuple_name(
1884                 __isl_keep isl_pw_multi_aff *pma,
1885                 enum isl_dim_type type);
1886         const char *isl_pw_multi_aff_get_tuple_name(
1887                 __isl_keep isl_pw_multi_aff *pma,
1888                 enum isl_dim_type type);
1889         const char *isl_multi_union_pw_aff_get_tuple_name(
1890                 __isl_keep isl_multi_union_pw_aff *mupa,
1891                 enum isl_dim_type type);
1893 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1894 or C<isl_dim_set>.  As with C<isl_space_get_name>,
1895 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1896 data structure.
1897 Binary operations require the corresponding spaces of their arguments
1898 to have the same name.
1900 To keep the names of all parameters and tuples, but reset the user pointers
1901 of all the corresponding identifiers, use the following function.
1903         #include <isl/space.h>
1904         __isl_give isl_space *isl_space_reset_user(
1905                 __isl_take isl_space *space);
1907         #include <isl/set.h>
1908         __isl_give isl_set *isl_set_reset_user(
1909                 __isl_take isl_set *set);
1911         #include <isl/map.h>
1912         __isl_give isl_map *isl_map_reset_user(
1913                 __isl_take isl_map *map);
1915         #include <isl/union_set.h>
1916         __isl_give isl_union_set *isl_union_set_reset_user(
1917                 __isl_take isl_union_set *uset);
1919         #include <isl/union_map.h>
1920         __isl_give isl_union_map *isl_union_map_reset_user(
1921                 __isl_take isl_union_map *umap);
1923         #include <isl/id.h>
1924         __isl_give isl_multi_id *isl_multi_id_reset_user(
1925                 __isl_take isl_multi_id *mi);
1927         #include <isl/val.h>
1928         __isl_give isl_multi_val *isl_multi_val_reset_user(
1929                 __isl_take isl_multi_val *mv);
1931         #include <isl/aff.h>
1932         __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1933                 __isl_take isl_multi_aff *ma);
1934         __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1935                 __isl_take isl_pw_aff *pa);
1936         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1937                 __isl_take isl_multi_pw_aff *mpa);
1938         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1939                 __isl_take isl_pw_multi_aff *pma);
1940         __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1941                 __isl_take isl_union_pw_aff *upa);
1942         __isl_give isl_multi_union_pw_aff *
1943         isl_multi_union_pw_aff_reset_user(
1944                 __isl_take isl_multi_union_pw_aff *mupa);
1945         __isl_give isl_union_pw_multi_aff *
1946         isl_union_pw_multi_aff_reset_user(
1947                 __isl_take isl_union_pw_multi_aff *upma);
1949         #include <isl/polynomial.h>
1950         __isl_give isl_pw_qpolynomial *
1951         isl_pw_qpolynomial_reset_user(
1952                 __isl_take isl_pw_qpolynomial *pwqp);
1953         __isl_give isl_union_pw_qpolynomial *
1954         isl_union_pw_qpolynomial_reset_user(
1955                 __isl_take isl_union_pw_qpolynomial *upwqp);
1956         __isl_give isl_pw_qpolynomial_fold *
1957         isl_pw_qpolynomial_fold_reset_user(
1958                 __isl_take isl_pw_qpolynomial_fold *pwf);
1959         __isl_give isl_union_pw_qpolynomial_fold *
1960         isl_union_pw_qpolynomial_fold_reset_user(
1961                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1963 Spaces can be nested.  In particular, the domain of a set or
1964 the domain or range of a relation can be a nested relation.
1965 This process is also called I<wrapping>.
1966 The functions for detecting, constructing and deconstructing
1967 such nested spaces can be found in the wrapping properties
1968 of L</"Unary Properties">, the wrapping operations
1969 of L</"Unary Operations"> and the Cartesian product operations
1970 of L</"Basic Operations">.
1972 Spaces can be created from other spaces
1973 using the functions described in L</"Unary Operations">
1974 and L</"Binary Operations">.
1976 =head2 Local Spaces
1978 A local space is essentially a space with
1979 zero or more existentially quantified variables.
1980 The local space of various objects can be obtained
1981 using the following functions.
1983         #include <isl/constraint.h>
1984         __isl_give isl_local_space *isl_constraint_get_local_space(
1985                 __isl_keep isl_constraint *constraint);
1987         #include <isl/set.h>
1988         __isl_give isl_local_space *isl_basic_set_get_local_space(
1989                 __isl_keep isl_basic_set *bset);
1991         #include <isl/map.h>
1992         __isl_give isl_local_space *isl_basic_map_get_local_space(
1993                 __isl_keep isl_basic_map *bmap);
1995         #include <isl/aff.h>
1996         __isl_give isl_local_space *isl_aff_get_domain_local_space(
1997                 __isl_keep isl_aff *aff);
1998         __isl_give isl_local_space *isl_aff_get_local_space(
1999                 __isl_keep isl_aff *aff);
2001 A new local space can be created from a space using
2003         #include <isl/local_space.h>
2004         __isl_give isl_local_space *isl_local_space_from_space(
2005                 __isl_take isl_space *space);
2007 They can be inspected, modified, copied and freed using the following functions.
2009         #include <isl/local_space.h>
2010         isl_bool isl_local_space_is_params(
2011                 __isl_keep isl_local_space *ls);
2012         isl_bool isl_local_space_is_set(
2013                 __isl_keep isl_local_space *ls);
2014         __isl_give isl_space *isl_local_space_get_space(
2015                 __isl_keep isl_local_space *ls);
2016         __isl_give isl_aff *isl_local_space_get_div(
2017                 __isl_keep isl_local_space *ls, int pos);
2018         __isl_give isl_local_space *isl_local_space_copy(
2019                 __isl_keep isl_local_space *ls);
2020         __isl_null isl_local_space *isl_local_space_free(
2021                 __isl_take isl_local_space *ls);
2023 Note that C<isl_local_space_get_div> can only be used on local spaces
2024 of sets.
2026 Two local spaces can be compared using
2028         isl_bool isl_local_space_is_equal(
2029                 __isl_keep isl_local_space *ls1,
2030                 __isl_keep isl_local_space *ls2);
2032 Local spaces can be created from other local spaces
2033 using the functions described in L</"Unary Operations">
2034 and L</"Binary Operations">.
2036 =head2 Creating New Sets and Relations
2038 C<isl> has functions for creating some standard sets and relations.
2040 =over
2042 =item * Empty sets and relations
2044         __isl_give isl_basic_set *isl_basic_set_empty(
2045                 __isl_take isl_space *space);
2046         __isl_give isl_basic_map *isl_basic_map_empty(
2047                 __isl_take isl_space *space);
2048         __isl_give isl_set *isl_set_empty(
2049                 __isl_take isl_space *space);
2050         __isl_give isl_map *isl_map_empty(
2051                 __isl_take isl_space *space);
2052         __isl_give isl_union_set *isl_union_set_empty_ctx(
2053                 isl_ctx *ctx);
2054         __isl_give isl_union_set *isl_union_set_empty_space(
2055                 __isl_take isl_space *space);
2056         __isl_give isl_union_set *isl_union_set_empty(
2057                 __isl_take isl_space *space);
2058         __isl_give isl_union_map *isl_union_map_empty_ctx(
2059                 isl_ctx *ctx);
2060         __isl_give isl_union_map *isl_union_map_empty_space(
2061                 __isl_take isl_space *space);
2062         __isl_give isl_union_map *isl_union_map_empty(
2063                 __isl_take isl_space *space);
2065 For C<isl_union_set>s and C<isl_union_map>s, the space
2066 is only used to specify the parameters.
2067 C<isl_union_set_empty> is an alternative name for
2068 C<isl_union_set_empty_space>.
2069 Similarly for the other pair of functions.
2071 =item * Universe sets and relations
2073         #include <isl/set.h>
2074         __isl_give isl_basic_set *isl_basic_set_universe(
2075                 __isl_take isl_space *space);
2076         __isl_give isl_set *isl_set_universe(
2077                 __isl_take isl_space *space);
2078         __isl_give isl_set *isl_space_universe_set(
2079                 __isl_take isl_space *space);
2081         #include <isl/map.h>
2082         __isl_give isl_basic_map *isl_basic_map_universe(
2083                 __isl_take isl_space *space);
2084         __isl_give isl_map *isl_map_universe(
2085                 __isl_take isl_space *space);
2086         __isl_give isl_map *isl_space_universe_map(
2087                 __isl_take isl_space *space);
2089         #include <isl/union_set.h>
2090         __isl_give isl_union_set *isl_union_set_universe(
2091                 __isl_take isl_union_set *uset);
2093         #include <isl/union_map.h>
2094         __isl_give isl_union_map *isl_union_map_universe(
2095                 __isl_take isl_union_map *umap);
2097 C<isl_set_universe> and C<isl_space_universe_set>
2098 perform the same operation.
2099 Similarly
2100 for the pair C<isl_map_universe> and C<isl_space_universe_map>.
2102 The sets and relations constructed by the functions above
2103 contain all integer values, while those constructed by the
2104 functions below only contain non-negative values.
2106         __isl_give isl_basic_set *isl_basic_set_nat_universe(
2107                 __isl_take isl_space *space);
2108         __isl_give isl_basic_map *isl_basic_map_nat_universe(
2109                 __isl_take isl_space *space);
2110         __isl_give isl_set *isl_set_nat_universe(
2111                 __isl_take isl_space *space);
2112         __isl_give isl_map *isl_map_nat_universe(
2113                 __isl_take isl_space *space);
2115 =item * Identity relations
2117         __isl_give isl_basic_map *isl_basic_map_identity(
2118                 __isl_take isl_space *space);
2119         __isl_give isl_map *isl_map_identity(
2120                 __isl_take isl_space *space);
2122 The number of input and output dimensions in C<space> needs
2123 to be the same.
2125 =item * Lexicographic order
2127         __isl_give isl_map *isl_map_lex_lt(
2128                 __isl_take isl_space *set_space);
2129         __isl_give isl_map *isl_map_lex_le(
2130                 __isl_take isl_space *set_space);
2131         __isl_give isl_map *isl_map_lex_gt(
2132                 __isl_take isl_space *set_space);
2133         __isl_give isl_map *isl_map_lex_ge(
2134                 __isl_take isl_space *set_space);
2135         __isl_give isl_map *isl_map_lex_lt_first(
2136                 __isl_take isl_space *space, unsigned n);
2137         __isl_give isl_map *isl_map_lex_le_first(
2138                 __isl_take isl_space *space, unsigned n);
2139         __isl_give isl_map *isl_map_lex_gt_first(
2140                 __isl_take isl_space *space, unsigned n);
2141         __isl_give isl_map *isl_map_lex_ge_first(
2142                 __isl_take isl_space *space, unsigned n);
2144 The first four functions take a space for a B<set>
2145 and return relations that express that the elements in the domain
2146 are lexicographically less
2147 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
2148 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
2149 than the elements in the range.
2150 The last four functions take a space for a map
2151 and return relations that express that the first C<n> dimensions
2152 in the domain are lexicographically less
2153 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
2154 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
2155 than the first C<n> dimensions in the range.
2157 =back
2159 A basic set or relation can be converted to a set or relation
2160 using the following functions.
2162         __isl_give isl_set *isl_basic_set_to_set(
2163                 __isl_take isl_basic_set *bset);
2164         __isl_give isl_set *isl_set_from_basic_set(
2165                 __isl_take isl_basic_set *bset);
2166         __isl_give isl_map *isl_map_from_basic_map(
2167                 __isl_take isl_basic_map *bmap);
2169 C<isl_basic_set_to_set> and C<isl_set_from_basic_set> perform
2170 the same operation.
2172 Sets and relations can be converted to union sets and relations
2173 using the following functions.
2175         __isl_give isl_union_set *isl_union_set_from_basic_set(
2176                 __isl_take isl_basic_set *bset);
2177         __isl_give isl_union_map *isl_union_map_from_basic_map(
2178                 __isl_take isl_basic_map *bmap);
2179         __isl_give isl_union_set *isl_set_to_union_set(
2180                 __isl_take isl_set *set);
2181         __isl_give isl_union_set *isl_union_set_from_set(
2182                 __isl_take isl_set *set);
2183         __isl_give isl_union_map *isl_map_to_union_map(
2184                 __isl_take isl_map *map);
2185         __isl_give isl_union_map *isl_union_map_from_map(
2186                 __isl_take isl_map *map);
2188 C<isl_map_to_union_map> and C<isl_union_map_from_map> perform
2189 the same operation.
2190 Similarly for C<isl_set_to_union_set> and C<isl_union_set_from_set>.
2192 The inverse conversions below can only be used if the input
2193 union set or relation is known to contain elements in exactly one
2194 space.
2196         #include <isl/union_set.h>
2197         isl_bool isl_union_set_isa_set(
2198                 __isl_keep isl_union_set *uset);
2199         __isl_give isl_set *isl_union_set_as_set(
2200                 __isl_take isl_union_set *uset);
2201         __isl_give isl_set *isl_set_from_union_set(
2202                 __isl_take isl_union_set *uset);
2204         #include <isl/union_map.h>
2205         isl_bool isl_union_map_isa_map(
2206                 __isl_keep isl_union_map *umap);
2207         __isl_give isl_map *isl_union_map_as_map(
2208                 __isl_take isl_union_map *umap);
2209         __isl_give isl_map *isl_map_from_union_map(
2210                 __isl_take isl_union_map *umap);
2212 C<isl_union_map_as_map> and C<isl_map_from_union_map> perform
2213 the same operation.
2214 Similarly for C<isl_union_set_as_set> and C<isl_set_from_union_set>.
2216 Sets and relations can be copied and freed again using the following
2217 functions.
2219         __isl_give isl_basic_set *isl_basic_set_copy(
2220                 __isl_keep isl_basic_set *bset);
2221         __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
2222         __isl_give isl_union_set *isl_union_set_copy(
2223                 __isl_keep isl_union_set *uset);
2224         __isl_give isl_basic_map *isl_basic_map_copy(
2225                 __isl_keep isl_basic_map *bmap);
2226         __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
2227         __isl_give isl_union_map *isl_union_map_copy(
2228                 __isl_keep isl_union_map *umap);
2229         __isl_null isl_basic_set *isl_basic_set_free(
2230                 __isl_take isl_basic_set *bset);
2231         __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
2232         __isl_null isl_union_set *isl_union_set_free(
2233                 __isl_take isl_union_set *uset);
2234         __isl_null isl_basic_map *isl_basic_map_free(
2235                 __isl_take isl_basic_map *bmap);
2236         __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
2237         __isl_null isl_union_map *isl_union_map_free(
2238                 __isl_take isl_union_map *umap);
2240 Other sets and relations can be constructed by starting
2241 from a universe set or relation, adding equality and/or
2242 inequality constraints and then projecting out the
2243 existentially quantified variables, if any.
2244 Constraints can be constructed, manipulated and
2245 added to (or removed from) (basic) sets and relations
2246 using the following functions.
2248         #include <isl/constraint.h>
2249         __isl_give isl_constraint *isl_constraint_alloc_equality(
2250                 __isl_take isl_local_space *ls);
2251         __isl_give isl_constraint *isl_constraint_alloc_inequality(
2252                 __isl_take isl_local_space *ls);
2253         __isl_give isl_constraint *isl_constraint_set_constant_si(
2254                 __isl_take isl_constraint *constraint, int v);
2255         __isl_give isl_constraint *isl_constraint_set_constant_val(
2256                 __isl_take isl_constraint *constraint,
2257                 __isl_take isl_val *v);
2258         __isl_give isl_constraint *isl_constraint_set_coefficient_si(
2259                 __isl_take isl_constraint *constraint,
2260                 enum isl_dim_type type, int pos, int v);
2261         __isl_give isl_constraint *
2262         isl_constraint_set_coefficient_val(
2263                 __isl_take isl_constraint *constraint,
2264                 enum isl_dim_type type, int pos,
2265                 __isl_take isl_val *v);
2266         __isl_give isl_basic_map *isl_basic_map_add_constraint(
2267                 __isl_take isl_basic_map *bmap,
2268                 __isl_take isl_constraint *constraint);
2269         __isl_give isl_basic_set *isl_basic_set_add_constraint(
2270                 __isl_take isl_basic_set *bset,
2271                 __isl_take isl_constraint *constraint);
2272         __isl_give isl_map *isl_map_add_constraint(
2273                 __isl_take isl_map *map,
2274                 __isl_take isl_constraint *constraint);
2275         __isl_give isl_set *isl_set_add_constraint(
2276                 __isl_take isl_set *set,
2277                 __isl_take isl_constraint *constraint);
2279 For example, to create a set containing the even integers
2280 between 10 and 42, you could use the following code.
2282         isl_space *space;
2283         isl_local_space *ls;
2284         isl_constraint *c;
2285         isl_basic_set *bset;
2287         space = isl_space_set_alloc(ctx, 0, 2);
2288         bset = isl_basic_set_universe(isl_space_copy(space));
2289         ls = isl_local_space_from_space(space);
2291         c = isl_constraint_alloc_equality(isl_local_space_copy(ls));
2292         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
2293         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
2294         bset = isl_basic_set_add_constraint(bset, c);
2296         c = isl_constraint_alloc_inequality(isl_local_space_copy(ls));
2297         c = isl_constraint_set_constant_si(c, -10);
2298         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
2299         bset = isl_basic_set_add_constraint(bset, c);
2301         c = isl_constraint_alloc_inequality(ls);
2302         c = isl_constraint_set_constant_si(c, 42);
2303         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
2304         bset = isl_basic_set_add_constraint(bset, c);
2306         bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
2308 However, this is considered to be a fairly low-level approach.
2309 It is more appropriate to construct a (basic) set by means
2310 of affine expressions (defined below in L</"Functions">).
2311 For example, the same set could be constructed as follows.
2313         isl_val *v, *two;
2314         isl_space *space;
2315         isl_multi_aff *ma;
2316         isl_aff *var, *cst;
2317         isl_basic_set *bset;
2319         space = isl_space_unit(ctx);
2320         space = isl_space_add_unnamed_tuple_ui(space, 1);
2321         ma = isl_multi_aff_identity_on_domain_space(
2322                 isl_space_copy(space));
2323         var = isl_multi_aff_get_at(ma, 0);
2324         v = isl_val_int_from_si(ctx, 10);
2325         cst = isl_aff_val_on_domain_space(isl_space_copy(space), v);
2326         bset = isl_aff_ge_basic_set(isl_aff_copy(var), cst);
2328         v = isl_val_int_from_si(ctx, 42);
2329         cst = isl_aff_val_on_domain_space(space, v);
2330         bset = isl_basic_set_intersect(bset,
2331                 isl_aff_le_basic_set(var, cst));
2333         two = isl_val_int_from_si(ctx, 2);
2334         ma = isl_multi_aff_scale_val(ma, isl_val_copy(two));
2335         bset = isl_basic_set_preimage_multi_aff(bset,
2336                 isl_multi_aff_copy(ma));
2337         ma = isl_multi_aff_scale_down_val(ma, isl_val_copy(two));
2338         ma = isl_multi_aff_scale_down_val(ma, two);
2339         bset = isl_basic_set_preimage_multi_aff(bset, ma);
2341 Alternatively, the set can be parsed from a string representation.
2343         isl_basic_set *bset;
2344         bset = isl_basic_set_read_from_str(ctx,
2345                 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
2347 A basic set or relation can also be constructed from two matrices
2348 describing the equalities and the inequalities.
2350         __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
2351                 __isl_take isl_space *space,
2352                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
2353                 enum isl_dim_type c1,
2354                 enum isl_dim_type c2, enum isl_dim_type c3,
2355                 enum isl_dim_type c4);
2356         __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
2357                 __isl_take isl_space *space,
2358                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
2359                 enum isl_dim_type c1,
2360                 enum isl_dim_type c2, enum isl_dim_type c3,
2361                 enum isl_dim_type c4, enum isl_dim_type c5);
2363 The C<isl_dim_type> arguments indicate the order in which
2364 different kinds of variables appear in the input matrices
2365 and should be a permutation of C<isl_dim_cst> (the constant term),
2366 C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div> for sets and
2367 of C<isl_dim_cst>, C<isl_dim_param>,
2368 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
2370 A (basic or union) set or relation can also be constructed from a
2371 (union) (piecewise) (multiple) affine expression
2372 or a list of affine expressions
2373 (See L</"Functions">), provided these affine expressions do not
2374 involve any NaN.
2376         #include <isl/set.h>
2377         __isl_give isl_basic_set *isl_basic_set_from_multi_aff(
2378                 __isl_take isl_multi_aff *ma);
2379         __isl_give isl_set *isl_multi_aff_as_set(
2380                 __isl_take isl_multi_aff *ma);
2381         __isl_give isl_set *isl_set_from_multi_aff(
2382                 __isl_take isl_multi_aff *ma);
2384         #include <isl/map.h>
2385         __isl_give isl_basic_map *isl_basic_map_from_aff(
2386                 __isl_take isl_aff *aff);
2387         __isl_give isl_map *isl_map_from_aff(
2388                 __isl_take isl_aff *aff);
2389         __isl_give isl_basic_map *isl_basic_map_from_aff_list(
2390                 __isl_take isl_space *domain_space,
2391                 __isl_take isl_aff_list *list);
2392         __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
2393                 __isl_take isl_multi_aff *maff)
2394         __isl_give isl_map *isl_multi_aff_as_map(
2395                 __isl_take isl_multi_aff *ma);
2396         __isl_give isl_map *isl_map_from_multi_aff(
2397                 __isl_take isl_multi_aff *maff)
2399         #include <isl/aff.h>
2400         __isl_give isl_set *isl_set_from_pw_aff(
2401                 __isl_take isl_pw_aff *pwaff);
2402         __isl_give isl_map *isl_pw_aff_as_map(
2403                 __isl_take isl_pw_aff *pa);
2404         __isl_give isl_map *isl_map_from_pw_aff(
2405                 __isl_take isl_pw_aff *pwaff);
2406         __isl_give isl_set *isl_pw_multi_aff_as_set(
2407                 __isl_take isl_pw_multi_aff *pma);
2408         __isl_give isl_set *isl_set_from_pw_multi_aff(
2409                 __isl_take isl_pw_multi_aff *pma);
2410         __isl_give isl_map *isl_pw_multi_aff_as_map(
2411                 __isl_take isl_pw_multi_aff *pma);
2412         __isl_give isl_map *isl_map_from_pw_multi_aff(
2413                 __isl_take isl_pw_multi_aff *pma);
2414         __isl_give isl_set *isl_multi_pw_aff_as_set(
2415                 __isl_take isl_multi_pw_aff *mpa);
2416         __isl_give isl_set *isl_set_from_multi_pw_aff(
2417                 __isl_take isl_multi_pw_aff *mpa);
2418         __isl_give isl_map *isl_multi_pw_aff_as_map(
2419                 __isl_take isl_multi_pw_aff *mpa);
2420         __isl_give isl_map *isl_map_from_multi_pw_aff(
2421                 __isl_take isl_multi_pw_aff *mpa);
2422         __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
2423                 __isl_take isl_union_pw_aff *upa);
2424         __isl_give isl_union_map *
2425         isl_union_pw_multi_aff_as_union_map(
2426                 __isl_take isl_union_pw_multi_aff *upma);
2427         __isl_give isl_union_map *
2428         isl_union_map_from_union_pw_multi_aff(
2429                 __isl_take isl_union_pw_multi_aff *upma);
2430         __isl_give isl_union_map *
2431         isl_union_map_from_multi_union_pw_aff(
2432                 __isl_take isl_multi_union_pw_aff *mupa);
2434 The C<domain_space> argument describes the domain of the resulting
2435 basic relation.  It is required because the C<list> may consist
2436 of zero affine expressions.
2437 The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
2438 is not allowed to be zero-dimensional.  The domain of the result
2439 is the shared domain of the union piecewise affine elements.
2440 C<isl_multi_aff_as_set> and C<isl_set_from_multi_aff> perform
2441 the same operation.
2442 Similarly for the pair C<isl_multi_aff_as_map> and C<isl_map_from_multi_aff>,
2443 for the pair C<isl_pw_aff_as_map> and C<isl_map_from_pw_aff>,
2444 for the pair C<isl_pw_multi_aff_as_set> and C<isl_set_from_pw_multi_aff>,
2445 for the pair C<isl_pw_multi_aff_as_map> and C<isl_map_from_pw_multi_aff>,
2446 the pair C<isl_multi_pw_aff_as_set> and C<isl_set_from_multi_pw_aff>,
2447 the pair C<isl_multi_pw_aff_as_map> and C<isl_map_from_multi_pw_aff>,
2449 C<isl_union_pw_multi_aff_as_union_map> and
2450 C<isl_union_map_from_union_pw_multi_aff>.
2452 =head2 Inspecting Sets and Relations
2454 Usually, the user should not have to care about the actual constraints
2455 of the sets and maps, but should instead apply the abstract operations
2456 explained in the following sections.
2457 Occasionally, however, it may be required to inspect the individual
2458 coefficients of the constraints.  This section explains how to do so.
2459 In these cases, it may also be useful to have C<isl> compute
2460 an explicit representation of the existentially quantified variables.
2462         __isl_give isl_set *isl_set_compute_divs(
2463                 __isl_take isl_set *set);
2464         __isl_give isl_map *isl_map_compute_divs(
2465                 __isl_take isl_map *map);
2466         __isl_give isl_union_set *isl_union_set_compute_divs(
2467                 __isl_take isl_union_set *uset);
2468         __isl_give isl_union_map *isl_union_map_compute_divs(
2469                 __isl_take isl_union_map *umap);
2471 This explicit representation defines the existentially quantified
2472 variables as integer divisions of the other variables, possibly
2473 including earlier existentially quantified variables.
2474 An explicitly represented existentially quantified variable therefore
2475 has a unique value when the values of the other variables are known.
2477 Alternatively, the existentially quantified variables can be removed
2478 using the following functions, which compute an overapproximation.
2480         #include <isl/set.h>
2481         __isl_give isl_basic_set *isl_basic_set_remove_divs(
2482                 __isl_take isl_basic_set *bset);
2483         __isl_give isl_set *isl_set_remove_divs(
2484                 __isl_take isl_set *set);
2486         #include <isl/map.h>
2487         __isl_give isl_basic_map *isl_basic_map_remove_divs(
2488                 __isl_take isl_basic_map *bmap);
2489         __isl_give isl_map *isl_map_remove_divs(
2490                 __isl_take isl_map *map);
2492         #include <isl/union_set.h>
2493         __isl_give isl_union_set *isl_union_set_remove_divs(
2494                 __isl_take isl_union_set *bset);
2496         #include <isl/union_map.h>
2497         __isl_give isl_union_map *isl_union_map_remove_divs(
2498                 __isl_take isl_union_map *bmap);
2500 It is also possible to only remove those divs that are defined
2501 in terms of a given range of dimensions or only those for which
2502 no explicit representation is known.
2504         __isl_give isl_basic_set *
2505         isl_basic_set_remove_divs_involving_dims(
2506                 __isl_take isl_basic_set *bset,
2507                 enum isl_dim_type type,
2508                 unsigned first, unsigned n);
2509         __isl_give isl_basic_map *
2510         isl_basic_map_remove_divs_involving_dims(
2511                 __isl_take isl_basic_map *bmap,
2512                 enum isl_dim_type type,
2513                 unsigned first, unsigned n);
2514         __isl_give isl_set *isl_set_remove_divs_involving_dims(
2515                 __isl_take isl_set *set, enum isl_dim_type type,
2516                 unsigned first, unsigned n);
2517         __isl_give isl_map *isl_map_remove_divs_involving_dims(
2518                 __isl_take isl_map *map, enum isl_dim_type type,
2519                 unsigned first, unsigned n);
2521         __isl_give isl_basic_set *
2522         isl_basic_set_remove_unknown_divs(
2523                 __isl_take isl_basic_set *bset);
2524         __isl_give isl_set *isl_set_remove_unknown_divs(
2525                 __isl_take isl_set *set);
2526         __isl_give isl_map *isl_map_remove_unknown_divs(
2527                 __isl_take isl_map *map);
2529 To iterate over all the sets or maps in a union set or map, use
2531         #include <isl/union_set.h>
2532         isl_stat isl_union_set_foreach_set(
2533                 __isl_keep isl_union_set *uset,
2534                 isl_stat (*fn)(__isl_take isl_set *set, void *user),
2535                 void *user);
2536         isl_bool isl_union_set_every_set(
2537                 __isl_keep isl_union_set *uset,
2538                 isl_bool (*test)(__isl_keep isl_set *set,
2539                         void *user),
2540                 void *user);
2542         #include <isl/union_map.h>
2543         isl_stat isl_union_map_foreach_map(
2544                 __isl_keep isl_union_map *umap,
2545                 isl_stat (*fn)(__isl_take isl_map *map, void *user),
2546                 void *user);
2547         isl_bool isl_union_map_every_map(
2548                 __isl_keep isl_union_map *umap,
2549                 isl_bool (*test)(__isl_keep isl_map *map,
2550                         void *user),
2551                 void *user);
2553 These functions call the callback function once for each
2554 (pair of) space(s) for which there are elements in the input.
2555 The argument to the callback contains all elements in the input
2556 with that (pair of) space(s).
2557 The C<isl_union_set_every_set> and
2558 C<isl_union_map_every_map> variants check whether each
2559 call to the callback returns true and stops checking as soon as one
2560 of these calls returns false.
2562 The number of sets or maps in a union set or map can be obtained
2563 from
2565         isl_size isl_union_set_n_set(__isl_keep isl_union_set *uset);
2566         isl_size isl_union_map_n_map(__isl_keep isl_union_map *umap);
2568 To extract the set or map in a given space from a union, use
2570         __isl_give isl_set *isl_union_set_extract_set(
2571                 __isl_keep isl_union_set *uset,
2572                 __isl_take isl_space *space);
2573         __isl_give isl_map *isl_union_map_extract_map(
2574                 __isl_keep isl_union_map *umap,
2575                 __isl_take isl_space *space);
2577 To iterate over all the basic sets or maps in a set or map, use
2579         isl_stat isl_set_foreach_basic_set(__isl_keep isl_set *set,
2580                 isl_stat (*fn)(__isl_take isl_basic_set *bset,
2581                         void *user),
2582                 void *user);
2583         isl_stat isl_map_foreach_basic_map(__isl_keep isl_map *map,
2584                 isl_stat (*fn)(__isl_take isl_basic_map *bmap,
2585                         void *user),
2586                 void *user);
2588 The callback function C<fn> should return C<isl_stat_ok> if successful and
2589 C<isl_stat_error> if an error occurs.  In the latter case, or if any other error
2590 occurs, the above functions will return C<isl_stat_error>.
2592 It should be noted that C<isl> does not guarantee that
2593 the basic sets or maps passed to C<fn> are disjoint.
2594 If this is required, then the user should call one of
2595 the following functions first.
2597         __isl_give isl_set *isl_set_make_disjoint(
2598                 __isl_take isl_set *set);
2599         __isl_give isl_map *isl_map_make_disjoint(
2600                 __isl_take isl_map *map);
2602 The number of basic sets in a set can be obtained
2603 or the number of basic maps in a map can be obtained
2604 from
2606         #include <isl/set.h>
2607         isl_size isl_set_n_basic_set(__isl_keep isl_set *set);
2609         #include <isl/map.h>
2610         isl_size isl_map_n_basic_map(__isl_keep isl_map *map);
2612 It is also possible to obtain a list of (basic) sets from a set
2613 or union set, a list of basic maps from a map and a list of maps from a union
2614 map.
2616         #include <isl/set.h>
2617         __isl_give isl_basic_set_list *isl_set_get_basic_set_list(
2618                 __isl_keep isl_set *set);
2620         #include <isl/union_set.h>
2621         __isl_give isl_basic_set_list *
2622         isl_union_set_get_basic_set_list(
2623                 __isl_keep isl_union_set *uset);
2624         __isl_give isl_set_list *isl_union_set_get_set_list(
2625                 __isl_keep isl_union_set *uset);
2627         #include <isl/map.h>
2628         __isl_give isl_basic_map_list *isl_map_get_basic_map_list(
2629                 __isl_keep isl_map *map);
2631         #include <isl/union_map.h>
2632         __isl_give isl_map_list *isl_union_map_get_map_list(
2633                 __isl_keep isl_union_map *umap);
2635 The returned list can be manipulated using the functions in L<"Lists">.
2637 To iterate over the constraints of a basic set or map, use
2639         #include <isl/constraint.h>
2641         isl_size isl_basic_set_n_constraint(
2642                 __isl_keep isl_basic_set *bset);
2643         isl_stat isl_basic_set_foreach_constraint(
2644                 __isl_keep isl_basic_set *bset,
2645                 isl_stat (*fn)(__isl_take isl_constraint *c,
2646                         void *user),
2647                 void *user);
2648         isl_size isl_basic_map_n_constraint(
2649                 __isl_keep isl_basic_map *bmap);
2650         isl_stat isl_basic_map_foreach_constraint(
2651                 __isl_keep isl_basic_map *bmap,
2652                 isl_stat (*fn)(__isl_take isl_constraint *c,
2653                         void *user),
2654                 void *user);
2655         __isl_null isl_constraint *isl_constraint_free(
2656                 __isl_take isl_constraint *c);
2658 Again, the callback function C<fn> should return C<isl_stat_ok>
2659 if successful and
2660 C<isl_stat_error> if an error occurs.  In the latter case, or if any other error
2661 occurs, the above functions will return C<isl_stat_error>.
2662 The constraint C<c> represents either an equality or an inequality.
2663 Use the following function to find out whether a constraint
2664 represents an equality.  If not, it represents an inequality.
2666         isl_bool isl_constraint_is_equality(
2667                 __isl_keep isl_constraint *constraint);
2669 It is also possible to obtain a list of constraints from a basic
2670 map or set
2672         #include <isl/constraint.h>
2673         __isl_give isl_constraint_list *
2674         isl_basic_map_get_constraint_list(
2675                 __isl_keep isl_basic_map *bmap);
2676         __isl_give isl_constraint_list *
2677         isl_basic_set_get_constraint_list(
2678                 __isl_keep isl_basic_set *bset);
2680 These functions require that all existentially quantified variables
2681 have an explicit representation.
2682 The returned list can be manipulated using the functions in L<"Lists">.
2684 The coefficients of the constraints can be inspected using
2685 the following functions.
2687         isl_bool isl_constraint_is_lower_bound(
2688                 __isl_keep isl_constraint *constraint,
2689                 enum isl_dim_type type, unsigned pos);
2690         isl_bool isl_constraint_is_upper_bound(
2691                 __isl_keep isl_constraint *constraint,
2692                 enum isl_dim_type type, unsigned pos);
2693         __isl_give isl_val *isl_constraint_get_constant_val(
2694                 __isl_keep isl_constraint *constraint);
2695         __isl_give isl_val *isl_constraint_get_coefficient_val(
2696                 __isl_keep isl_constraint *constraint,
2697                 enum isl_dim_type type, int pos);
2699 The explicit representations of the existentially quantified
2700 variables can be inspected using the following function.
2701 Note that the user is only allowed to use this function
2702 if the inspected set or map is the result of a call
2703 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2704 The existentially quantified variable is equal to the floor
2705 of the returned affine expression.  The affine expression
2706 itself can be inspected using the functions in
2707 L</"Functions">.
2709         __isl_give isl_aff *isl_constraint_get_div(
2710                 __isl_keep isl_constraint *constraint, int pos);
2712 To obtain the constraints of a basic set or map in matrix
2713 form, use the following functions.
2715         __isl_give isl_mat *isl_basic_set_equalities_matrix(
2716                 __isl_keep isl_basic_set *bset,
2717                 enum isl_dim_type c1, enum isl_dim_type c2,
2718                 enum isl_dim_type c3, enum isl_dim_type c4);
2719         __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2720                 __isl_keep isl_basic_set *bset,
2721                 enum isl_dim_type c1, enum isl_dim_type c2,
2722                 enum isl_dim_type c3, enum isl_dim_type c4);
2723         __isl_give isl_mat *isl_basic_map_equalities_matrix(
2724                 __isl_keep isl_basic_map *bmap,
2725                 enum isl_dim_type c1,
2726                 enum isl_dim_type c2, enum isl_dim_type c3,
2727                 enum isl_dim_type c4, enum isl_dim_type c5);
2728         __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2729                 __isl_keep isl_basic_map *bmap,
2730                 enum isl_dim_type c1,
2731                 enum isl_dim_type c2, enum isl_dim_type c3,
2732                 enum isl_dim_type c4, enum isl_dim_type c5);
2734 The C<isl_dim_type> arguments dictate the order in which
2735 different kinds of variables appear in the resulting matrix.
2736 For set inputs, they should be a permutation of
2737 C<isl_dim_cst> (the constant term), C<isl_dim_param>, C<isl_dim_set> and
2738 C<isl_dim_div>.
2739 For map inputs, they should be a permutation of
2740 C<isl_dim_cst>, C<isl_dim_param>,
2741 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2743 =head2 Points
2745 Points are elements of a set.  They can be used to construct
2746 simple sets (boxes) or they can be used to represent the
2747 individual elements of a set.
2748 The zero point (the origin) can be created using
2750         __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2752 The coordinates of a point can be inspected, set and changed
2753 using
2755         #include <isl/point.h>
2756         __isl_give isl_multi_val *isl_point_get_multi_val(
2757                 __isl_keep isl_point *pnt);
2758         __isl_give isl_val *isl_point_get_coordinate_val(
2759                 __isl_keep isl_point *pnt,
2760                 enum isl_dim_type type, int pos);
2761         __isl_give isl_point *isl_point_set_coordinate_val(
2762                 __isl_take isl_point *pnt,
2763                 enum isl_dim_type type, int pos,
2764                 __isl_take isl_val *v);
2766         __isl_give isl_point *isl_point_add_ui(
2767                 __isl_take isl_point *pnt,
2768                 enum isl_dim_type type, int pos, unsigned val);
2769         __isl_give isl_point *isl_point_sub_ui(
2770                 __isl_take isl_point *pnt,
2771                 enum isl_dim_type type, int pos, unsigned val);
2773 Points can be copied or freed using
2775         __isl_give isl_point *isl_point_copy(
2776                 __isl_keep isl_point *pnt);
2777         __isl_null isl_point *isl_point_free(
2778                 __isl_take isl_point *pnt);
2780 A singleton set can be created from a point using the following functions.
2782         __isl_give isl_basic_set *isl_basic_set_from_point(
2783                 __isl_take isl_point *pnt);
2784         __isl_give isl_set *isl_point_to_set(
2785                 __isl_take isl_point *pnt);
2786         __isl_give isl_set *isl_set_from_point(
2787                 __isl_take isl_point *pnt);
2788         __isl_give isl_union_set *isl_union_set_from_point(
2789                 __isl_take isl_point *pnt);
2791 C<isl_point_to_set> and C<isl_set_from_point> perform
2792 the same operation.
2794 A box can be created from two opposite extremal points using
2796         __isl_give isl_basic_set *isl_basic_set_box_from_points(
2797                 __isl_take isl_point *pnt1,
2798                 __isl_take isl_point *pnt2);
2799         __isl_give isl_set *isl_set_box_from_points(
2800                 __isl_take isl_point *pnt1,
2801                 __isl_take isl_point *pnt2);
2803 All elements of a B<bounded> (union) set can be enumerated using
2804 the following functions.
2806         isl_stat isl_set_foreach_point(__isl_keep isl_set *set,
2807                 isl_stat (*fn)(__isl_take isl_point *pnt,
2808                         void *user),
2809                 void *user);
2810         isl_stat isl_union_set_foreach_point(
2811                 __isl_keep isl_union_set *uset,
2812                 isl_stat (*fn)(__isl_take isl_point *pnt,
2813                         void *user),
2814                 void *user);
2816 The function C<fn> is called for each integer point in
2817 C<set> with as second argument the last argument of
2818 the C<isl_set_foreach_point> call.  The function C<fn>
2819 should return C<isl_stat_ok> on success and C<isl_stat_error> on failure.
2820 In the latter case, C<isl_set_foreach_point> will stop
2821 enumerating and return C<isl_stat_error> as well.
2822 If the enumeration is performed successfully and to completion,
2823 then C<isl_set_foreach_point> returns C<isl_stat_ok>.
2825 To obtain a single point of a (basic or union) set, use
2827         __isl_give isl_point *isl_basic_set_sample_point(
2828                 __isl_take isl_basic_set *bset);
2829         __isl_give isl_point *isl_set_sample_point(
2830                 __isl_take isl_set *set);
2831         __isl_give isl_point *isl_union_set_sample_point(
2832                 __isl_take isl_union_set *uset);
2834 If C<set> does not contain any (integer) points, then the
2835 resulting point will be ``void'', a property that can be
2836 tested using
2838         isl_bool isl_point_is_void(__isl_keep isl_point *pnt);
2840 =head2 Functions
2842 Besides sets and relation, C<isl> also supports various types of functions.
2843 Each of these types is derived from the value type (see L</"Values">)
2844 or from one of two primitive function types
2845 through the application of zero or more type constructors.
2846 As a special case, a multiple expression can also be derived
2847 from an identifier (see L</"Identifiers">) although the result
2848 is not really a function.
2849 We first describe the primitive type and then we describe
2850 the types derived from these primitive types.
2852 =head3 Primitive Functions
2854 C<isl> support two primitive function types, quasi-affine
2855 expressions and quasipolynomials.
2856 A quasi-affine expression is defined either over a parameter
2857 space or over a set and is composed of integer constants,
2858 parameters and set variables, addition, subtraction and
2859 integer division by an integer constant.
2860 For example, the quasi-affine expression
2862         [n] -> { [x] -> [2*floor((4 n + x)/9)] }
2864 maps C<x> to C<2*floor((4 n + x)/9>.
2865 A quasipolynomial is a polynomial expression in quasi-affine
2866 expression.  That is, it additionally allows for multiplication.
2867 Note, though, that it is not allowed to construct an integer
2868 division of an expression involving multiplications.
2869 Here is an example of a quasipolynomial that is not
2870 quasi-affine expression
2872         [n] -> { [x] -> (n*floor((4 n + x)/9)) }
2874 Note that the external representations of quasi-affine expressions
2875 and quasipolynomials are different.  Quasi-affine expressions
2876 use a notation with square brackets just like binary relations,
2877 while quasipolynomials do not.  This might change at some point.
2879 If a primitive function is defined over a parameter space,
2880 then the space of the function itself is that of a set.
2881 If it is defined over a set, then the space of the function
2882 is that of a relation.  In both cases, the set space (or
2883 the output space) is single-dimensional, anonymous and unstructured.
2884 To create functions with multiple dimensions or with other kinds
2885 of set or output spaces, use multiple expressions
2886 (see L</"Multiple Expressions">).
2888 =over
2890 =item * Quasi-affine Expressions
2892 Besides the expressions described above, a quasi-affine
2893 expression can also be set to NaN.  Such expressions
2894 typically represent a failure to represent a result
2895 as a quasi-affine expression.
2897 The zero quasi affine expression or the quasi affine expression
2898 that is equal to a given value, parameter or
2899 a specified dimension on a given domain can be created using
2901         #include <isl/aff.h>
2902         __isl_give isl_aff *isl_aff_zero_on_domain_space(
2903                 __isl_take isl_space *space);
2904         __isl_give isl_aff *isl_space_zero_aff_on_domain(
2905                 __isl_take isl_space *space);
2906         __isl_give isl_aff *isl_aff_zero_on_domain(
2907                 __isl_take isl_local_space *ls);
2908         __isl_give isl_aff *isl_aff_val_on_domain_space(
2909                 __isl_take isl_space *space,
2910                 __isl_take isl_val *val);
2911         __isl_give isl_aff *isl_aff_val_on_domain(
2912                 __isl_take isl_local_space *ls,
2913                 __isl_take isl_val *val);
2914         __isl_give isl_aff *isl_aff_param_on_domain_space_id(
2915                 __isl_take isl_space *space,
2916                 __isl_take isl_id *id);
2917         __isl_give isl_aff *isl_space_param_aff_on_domain_id(
2918                 __isl_take isl_space *space,
2919                 __isl_take isl_id *id);
2920         __isl_give isl_aff *isl_aff_var_on_domain(
2921                 __isl_take isl_local_space *ls,
2922                 enum isl_dim_type type, unsigned pos);
2923         __isl_give isl_aff *isl_aff_nan_on_domain_space(
2924                 __isl_take isl_space *space);
2925         __isl_give isl_aff *isl_aff_nan_on_domain(
2926                 __isl_take isl_local_space *ls);
2928 The space passed to C<isl_aff_param_on_domain_space_id>
2929 is required to have a parameter with the given identifier.
2930 C<isl_aff_param_on_domain_space_id> and
2931 C<isl_space_param_aff_on_domain_id> perform the same operation.
2933 C<isl_aff_zero_on_domain_space> and C<isl_space_zero_aff_on_domain>
2934 perform the same operation.
2936 Quasi affine expressions can be copied and freed using
2938         #include <isl/aff.h>
2939         __isl_give isl_aff *isl_aff_copy(
2940                 __isl_keep isl_aff *aff);
2941         __isl_null isl_aff *isl_aff_free(
2942                 __isl_take isl_aff *aff);
2944 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2945 using the following function.  The constraint is required to have
2946 a non-zero coefficient for the specified dimension.
2948         #include <isl/constraint.h>
2949         __isl_give isl_aff *isl_constraint_get_bound(
2950                 __isl_keep isl_constraint *constraint,
2951                 enum isl_dim_type type, int pos);
2953 The entire affine expression of the constraint can also be extracted
2954 using the following function.
2956         #include <isl/constraint.h>
2957         __isl_give isl_aff *isl_constraint_get_aff(
2958                 __isl_keep isl_constraint *constraint);
2960 Conversely, an equality constraint equating
2961 the affine expression to zero or an inequality constraint enforcing
2962 the affine expression to be non-negative, can be constructed using
2964         __isl_give isl_constraint *isl_equality_from_aff(
2965                 __isl_take isl_aff *aff);
2966         __isl_give isl_constraint *isl_inequality_from_aff(
2967                 __isl_take isl_aff *aff);
2969 The coefficients and the integer divisions of an affine expression
2970 can be inspected using the following functions.
2972         #include <isl/aff.h>
2973         __isl_give isl_val *isl_aff_get_constant_val(
2974                 __isl_keep isl_aff *aff);
2975         __isl_give isl_val *isl_aff_get_coefficient_val(
2976                 __isl_keep isl_aff *aff,
2977                 enum isl_dim_type type, int pos);
2978         int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2979                 enum isl_dim_type type, int pos);
2980         __isl_give isl_val *isl_aff_get_denominator_val(
2981                 __isl_keep isl_aff *aff);
2982         __isl_give isl_aff *isl_aff_get_div(
2983                 __isl_keep isl_aff *aff, int pos);
2985 They can be modified using the following functions.
2987         #include <isl/aff.h>
2988         __isl_give isl_aff *isl_aff_set_constant_si(
2989                 __isl_take isl_aff *aff, int v);
2990         __isl_give isl_aff *isl_aff_set_constant_val(
2991                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2992         __isl_give isl_aff *isl_aff_set_coefficient_si(
2993                 __isl_take isl_aff *aff,
2994                 enum isl_dim_type type, int pos, int v);
2995         __isl_give isl_aff *isl_aff_set_coefficient_val(
2996                 __isl_take isl_aff *aff,
2997                 enum isl_dim_type type, int pos,
2998                 __isl_take isl_val *v);
3000         __isl_give isl_aff *isl_aff_add_constant_si(
3001                 __isl_take isl_aff *aff, int v);
3002         __isl_give isl_aff *isl_aff_add_constant_val(
3003                 __isl_take isl_aff *aff, __isl_take isl_val *v);
3004         __isl_give isl_aff *isl_aff_add_constant_num_si(
3005                 __isl_take isl_aff *aff, int v);
3006         __isl_give isl_aff *isl_aff_add_coefficient_si(
3007                 __isl_take isl_aff *aff,
3008                 enum isl_dim_type type, int pos, int v);
3009         __isl_give isl_aff *isl_aff_add_coefficient_val(
3010                 __isl_take isl_aff *aff,
3011                 enum isl_dim_type type, int pos,
3012                 __isl_take isl_val *v);
3014 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
3015 set the I<numerator> of the constant or coefficient, while
3016 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
3017 the constant or coefficient as a whole.
3018 The C<add_constant> and C<add_coefficient> functions add an integer
3019 or rational value to
3020 the possibly rational constant or coefficient.
3021 The C<add_constant_num> functions add an integer value to
3022 the numerator.
3024 =item * Quasipolynomials
3026 Some simple quasipolynomials can be created using the following functions.
3028         #include <isl/polynomial.h>
3029         __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
3030                 __isl_take isl_space *domain);
3031         __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
3032                 __isl_take isl_space *domain);
3033         __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
3034                 __isl_take isl_space *domain);
3035         __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
3036                 __isl_take isl_space *domain);
3037         __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
3038                 __isl_take isl_space *domain);
3039         __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
3040                 __isl_take isl_space *domain,
3041                 __isl_take isl_val *val);
3042         __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
3043                 __isl_take isl_space *domain,
3044                 enum isl_dim_type type, unsigned pos);
3045         __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
3046                 __isl_take isl_aff *aff);
3048 Recall that the space in which a quasipolynomial lives is a map space
3049 with a one-dimensional range.  The C<domain> argument in some of
3050 the functions above corresponds to the domain of this map space.
3052 A quasi-polynomial that can also be represented as a quasi-affine expression
3053 can be converted using the function below.
3055         #include <isl/polynomial.h>
3056         isl_bool isl_qpolynomial_isa_aff(
3057                 __isl_keep isl_qpolynomial *qp);
3058         __isl_give isl_aff *isl_qpolynomial_as_aff(
3059                 __isl_take isl_qpolynomial *qp);
3061 Quasipolynomials can be copied and freed again using the following
3062 functions.
3064         #include <isl/polynomial.h>
3065         __isl_give isl_qpolynomial *isl_qpolynomial_copy(
3066                 __isl_keep isl_qpolynomial *qp);
3067         __isl_null isl_qpolynomial *isl_qpolynomial_free(
3068                 __isl_take isl_qpolynomial *qp);
3070 The constant term of a quasipolynomial can be extracted using
3072         __isl_give isl_val *isl_qpolynomial_get_constant_val(
3073                 __isl_keep isl_qpolynomial *qp);
3075 To iterate over all terms in a quasipolynomial,
3078         isl_stat isl_qpolynomial_foreach_term(
3079                 __isl_keep isl_qpolynomial *qp,
3080                 isl_stat (*fn)(__isl_take isl_term *term,
3081                           void *user), void *user);
3083 The terms themselves can be inspected and freed using
3084 these functions
3086         isl_size isl_term_dim(__isl_keep isl_term *term,
3087                 enum isl_dim_type type);
3088         __isl_give isl_val *isl_term_get_coefficient_val(
3089                 __isl_keep isl_term *term);
3090         isl_size isl_term_get_exp(__isl_keep isl_term *term,
3091                 enum isl_dim_type type, unsigned pos);
3092         __isl_give isl_aff *isl_term_get_div(
3093                 __isl_keep isl_term *term, unsigned pos);
3094         __isl_null isl_term *isl_term_free(
3095                 __isl_take isl_term *term);
3097 Each term is a product of parameters, set variables and
3098 integer divisions.  The function C<isl_term_get_exp>
3099 returns the exponent of a given dimensions in the given term.
3101 =back
3103 =head3 Reductions
3105 A reduction represents a maximum or a minimum of its
3106 base expressions.
3107 The only reduction type defined by C<isl> is
3108 C<isl_qpolynomial_fold>.
3110 There are currently no functions to directly create such
3111 objects, but they do appear in the piecewise quasipolynomial
3112 reductions returned by the C<isl_pw_qpolynomial_bound> function.
3114 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
3116 Reductions can be copied and freed using
3117 the following functions.
3119         #include <isl/polynomial.h>
3120         __isl_give isl_qpolynomial_fold *
3121         isl_qpolynomial_fold_copy(
3122                 __isl_keep isl_qpolynomial_fold *fold);
3123         __isl_null isl_qpolynomial_fold *
3124         isl_qpolynomial_fold_free(
3125                 __isl_take isl_qpolynomial_fold *fold);
3127 The type of a (union piecewise) reduction
3128 can be obtained using the following functions.
3130         #include <isl/polynomial.h>
3131         enum isl_fold isl_qpolynomial_fold_get_type(
3132                 __isl_keep isl_qpolynomial_fold *fold);
3133         enum isl_fold isl_pw_qpolynomial_fold_get_type(
3134                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3135         enum isl_fold isl_union_pw_qpolynomial_fold_get_type(
3136                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3138 The type may be either C<isl_fold_min> or C<isl_fold_max>
3139 (or C<isl_fold_error> in case of error).
3141 To iterate over all quasipolynomials in a reduction, use
3143         isl_stat isl_qpolynomial_fold_foreach_qpolynomial(
3144                 __isl_keep isl_qpolynomial_fold *fold,
3145                 isl_stat (*fn)(__isl_take isl_qpolynomial *qp,
3146                           void *user), void *user);
3148 =head3 Multiple Expressions
3150 A multiple expression represents a sequence of zero or
3151 more base expressions, all defined on the same domain space.
3152 The domain space of the multiple expression is the same
3153 as that of the base expressions, but the range space
3154 can be any space.  In case the base expressions have
3155 a set space, the corresponding multiple expression
3156 also has a set space.
3157 Objects of the value or identifier type do not have an associated space.
3158 The space of a multiple value or
3159 multiple identifier is therefore always a set space.
3160 Similarly, the space of a multiple union piecewise
3161 affine expression is always a set space.
3162 If the base expressions are not total, then
3163 a corresponding zero-dimensional multiple expression may
3164 have an explicit domain that keeps track of the domain
3165 outside of any base expressions.
3167 The multiple expression types defined by C<isl>
3168 are C<isl_multi_val>, C<isl_multi_id>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
3169 C<isl_multi_union_pw_aff>.
3171 A multiple expression with the value zero for
3172 each output (or set) dimension can be created
3173 using the following functions.
3175         #include <isl/val.h>
3176         __isl_give isl_multi_val *isl_multi_val_zero(
3177                 __isl_take isl_space *space);
3178         __isl_give isl_multi_val *isl_space_zero_multi_val(
3179                 __isl_take isl_space *space);
3181         #include <isl/aff.h>
3182         __isl_give isl_multi_aff *isl_multi_aff_zero(
3183                 __isl_take isl_space *space);
3184         __isl_give isl_multi_aff *isl_space_zero_multi_aff(
3185                 __isl_take isl_space *space);
3186         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
3187                 __isl_take isl_space *space);
3188         __isl_give isl_multi_pw_aff *isl_space_zero_multi_pw_aff(
3189                 __isl_take isl_space *space);
3190         __isl_give isl_multi_union_pw_aff *
3191         isl_multi_union_pw_aff_zero(
3192                 __isl_take isl_space *space);
3193         __isl_give isl_multi_union_pw_aff *
3194         isl_space_zero_multi_union_pw_aff(
3195                 __isl_take isl_space *space);
3197 Since there is no canonical way of representing a zero
3198 value of type C<isl_union_pw_aff>, the space passed
3199 to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
3200 C<isl_multi_val_zero> and C<isl_space_zero_multi_val>
3201 perform the same operation.
3202 Similarly
3203 for the pair C<isl_multi_aff_zero> and C<isl_space_zero_multi_aff>,
3204 for the pair C<isl_multi_pw_aff_zero> and C<isl_space_zero_multi_pw_aff> and
3205 for the pair C<isl_multi_union_pw_aff_zero> and
3206 C<isl_space_zero_multi_union_pw_aff>.
3209 An identity function can be created using the following
3210 functions.
3211 For the first group of functions, the space needs to be that of a set.
3212 For the second group,
3213 the space needs to be that of a relation
3214 with the same number of input and output dimensions.
3215 For the third group, the input function needs to live in a space
3216 with the same number of input and output dimensions and
3217 the identity function is created in that space.
3219         #include <isl/aff.h>
3220         __isl_give isl_multi_aff *
3221         isl_multi_aff_identity_on_domain_space(
3222                 __isl_take isl_space *space);
3223         __isl_give isl_multi_aff *
3224         isl_space_identity_multi_aff_on_domain(
3225                 __isl_take isl_space *space);
3226         __isl_give isl_multi_pw_aff *
3227         isl_multi_pw_aff_identity_on_domain_space(
3228                 __isl_take isl_space *space);
3229         __isl_give isl_multi_pw_aff *
3230         isl_space_identity_multi_pw_aff_on_domain(
3231                 __isl_take isl_space *space);
3232         __isl_give isl_multi_aff *isl_multi_aff_identity(
3233                 __isl_take isl_space *space);
3234         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
3235                 __isl_take isl_space *space);
3236         __isl_give isl_multi_aff *
3237         isl_multi_aff_identity_multi_aff(
3238                 __isl_take isl_multi_aff *ma);
3239         __isl_give isl_multi_pw_aff *
3240         isl_multi_pw_aff_identity_multi_pw_aff(
3241                 __isl_take isl_multi_pw_aff *mpa);
3243 C<isl_multi_aff_identity_on_domain_space> and
3244 C<isl_space_identity_multi_aff_on_domain>
3245 perform the same operation.
3246 Similarly
3247 for the pair C<isl_multi_pw_aff_identity_on_domain_space> and
3248 C<isl_space_identity_multi_pw_aff_on_domain>.
3250 A function that performs a projection on a universe
3251 relation or set can be created using the following functions.
3252 See also the corresponding
3253 projection operations in L</"Unary Operations">.
3255         #include <isl/aff.h>
3256         __isl_give isl_multi_aff *isl_multi_aff_domain_map(
3257                 __isl_take isl_space *space);
3258         __isl_give isl_multi_aff *isl_space_domain_map_multi_aff(
3259                 __isl_take isl_space *space);
3260         __isl_give isl_multi_aff *isl_multi_aff_range_map(
3261                 __isl_take isl_space *space);
3262         __isl_give isl_multi_aff *isl_space_range_map_multi_aff(
3263                 __isl_take isl_space *space);
3264         __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
3265                 __isl_take isl_space *space,
3266                 enum isl_dim_type type,
3267                 unsigned first, unsigned n);
3269 C<isl_multi_aff_domain_map> and C<isl_space_domain_map_multi_aff> perform
3270 the same operation.
3271 Similarly
3272 for the pair C<isl_multi_aff_range_map> and C<isl_space_range_map_multi_aff>.
3274 A multiple expression can be created from a single
3275 base expression using the following functions.
3276 The space of the created multiple expression is the same
3277 as that of the base expression, except for
3278 C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
3279 lives in a parameter space and the output lives
3280 in a single-dimensional set space.
3282         #include <isl/aff.h>
3283         __isl_give isl_multi_aff *isl_multi_aff_from_aff(
3284                 __isl_take isl_aff *aff);
3285         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
3286                 __isl_take isl_pw_aff *pa);
3287         __isl_give isl_multi_union_pw_aff *
3288         isl_multi_union_pw_aff_from_union_pw_aff(
3289                 __isl_take isl_union_pw_aff *upa);
3291 A multiple expression can be created from a list
3292 of base expression in a specified space.
3293 The domain of this space needs to be the same
3294 as the domains of the base expressions in the list.
3295 If the base expressions have a set space (or no associated space),
3296 then this space also needs to be a set space.
3298         #include <isl/id.h>
3299         __isl_give isl_multi_id *isl_multi_id_from_id_list(
3300                 __isl_take isl_space *space,
3301                 __isl_take isl_id_list *list);
3302         __isl_give isl_multi_id *isl_space_multi_id(
3303                 __isl_take isl_space *space,
3304                 __isl_take isl_id_list *list);
3306         #include <isl/val.h>
3307         __isl_give isl_multi_val *isl_multi_val_from_val_list(
3308                 __isl_take isl_space *space,
3309                 __isl_take isl_val_list *list);
3310         __isl_give isl_multi_val *isl_space_multi_val(
3311                 __isl_take isl_space *space,
3312                 __isl_take isl_val_list *list);
3314         #include <isl/aff.h>
3315         __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
3316                 __isl_take isl_space *space,
3317                 __isl_take isl_aff_list *list);
3318         __isl_give isl_multi_aff *isl_space_multi_aff(
3319                 __isl_take isl_space *space,
3320                 __isl_take isl_aff_list *list);
3321         __isl_give isl_multi_pw_aff *
3322         isl_multi_pw_aff_from_pw_aff_list(
3323                 __isl_take isl_space *space,
3324                 __isl_take isl_pw_aff_list *list);
3325         __isl_give isl_multi_pw_aff *
3326         isl_space_multi_pw_aff(
3327                 __isl_take isl_space *space,
3328                 __isl_take isl_pw_aff_list *list);
3329         __isl_give isl_multi_union_pw_aff *
3330         isl_multi_union_pw_aff_from_union_pw_aff_list(
3331                 __isl_take isl_space *space,
3332                 __isl_take isl_union_pw_aff_list *list);
3333         __isl_give isl_multi_union_pw_aff *
3334         isl_space_multi_union_pw_aff(
3335                 __isl_take isl_space *space,
3336                 __isl_take isl_union_pw_aff_list *list);
3338 C<isl_multi_id_from_id_list> and C<isl_space_multi_id> perform
3339 the same operation.
3340 Similarly for the pair C<isl_multi_val_from_val_list> and
3341 C<isl_space_multi_val>,
3342 for the pair C<isl_multi_aff_from_aff_list> and
3343 C<isl_space_multi_aff>,
3344 for the pair C<isl_multi_pw_aff_from_pw_aff_list> and
3345 C<isl_space_multi_pw_aff> and
3346 for the pair C<isl_multi_union_pw_aff_from_union_pw_aff_list> and
3347 C<isl_space_multi_union_pw_aff>.
3349 As a convenience, a multiple piecewise expression can
3350 also be created from a multiple expression,
3351 or even directly from a single base expression.
3352 Each piecewise expression in the result has a single
3353 universe cell.
3355         #include <isl/aff.h>
3356         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_aff(
3357                 __isl_take isl_aff *aff);
3358         __isl_give isl_multi_pw_aff *
3359         isl_multi_aff_to_multi_pw_aff(
3360                 __isl_take isl_multi_aff *ma);
3361         __isl_give isl_multi_pw_aff *
3362         isl_multi_pw_aff_from_multi_aff(
3363                 __isl_take isl_multi_aff *ma);
3365 C<isl_multi_aff_to_multi_pw_aff> and
3366 C<isl_multi_pw_aff_from_multi_aff> perform the same operation.
3368 Similarly, a multiple union expression can be
3369 created from a multiple expression.
3371         #include <isl/aff.h>
3372         __isl_give isl_multi_union_pw_aff *
3373         isl_multi_union_pw_aff_from_multi_aff(
3374                 __isl_take isl_multi_aff *ma);
3375         __isl_give isl_multi_union_pw_aff *
3376         isl_multi_aff_to_multi_union_pw_aff(
3377                 __isl_take isl_multi_aff *ma);
3378         __isl_give isl_multi_union_pw_aff *
3379         isl_multi_union_pw_aff_from_multi_pw_aff(
3380                 __isl_take isl_multi_pw_aff *mpa);
3382 C<isl_multi_aff_to_multi_union_pw_aff> and
3383 C<isl_multi_union_pw_aff_from_multi_aff> perform the same operation.
3385 A multiple quasi-affine expression can be created from
3386 a multiple value with a given domain space using the following
3387 function.
3389         #include <isl/aff.h>
3390         __isl_give isl_multi_aff *
3391         isl_multi_aff_multi_val_on_domain_space(
3392                 __isl_take isl_space *space,
3393                 __isl_take isl_multi_val *mv);
3394         __isl_give isl_multi_aff *
3395         isl_space_multi_aff_on_domain_multi_val(
3396                 __isl_take isl_space *space,
3397                 __isl_take isl_multi_val *mv);
3398         __isl_give isl_multi_aff *
3399         isl_multi_aff_multi_val_on_space(
3400                 __isl_take isl_space *space,
3401                 __isl_take isl_multi_val *mv);
3403 C<isl_space_multi_aff_on_domain_multi_val> and
3404 C<isl_multi_aff_multi_val_on_space> are alternative names
3405 for C<isl_multi_aff_multi_val_on_domain_space>.
3407 Similarly,
3408 a multiple union piecewise affine expression can be created from
3409 a multiple value with a given domain or
3410 a (piecewise) multiple affine expression with a given domain
3411 using the following functions.
3413         #include <isl/aff.h>
3414         __isl_give isl_multi_union_pw_aff *
3415         isl_multi_union_pw_aff_multi_val_on_domain(
3416                 __isl_take isl_union_set *domain,
3417                 __isl_take isl_multi_val *mv);
3418         __isl_give isl_multi_union_pw_aff *
3419         isl_multi_union_pw_aff_multi_aff_on_domain(
3420                 __isl_take isl_union_set *domain,
3421                 __isl_take isl_multi_aff *ma);
3422         __isl_give isl_multi_union_pw_aff *
3423         isl_multi_union_pw_aff_pw_multi_aff_on_domain(
3424                 __isl_take isl_union_set *domain,
3425                 __isl_take isl_pw_multi_aff *pma);
3427 Multiple expressions can be copied and freed using
3428 the following functions.
3430         #include <isl/id.h>
3431         __isl_give isl_multi_id *isl_multi_id_copy(
3432                 __isl_keep isl_multi_id *mi);
3433         __isl_null isl_multi_id *isl_multi_id_free(
3434                 __isl_take isl_multi_id *mi);
3436         #include <isl/val.h>
3437         __isl_give isl_multi_val *isl_multi_val_copy(
3438                 __isl_keep isl_multi_val *mv);
3439         __isl_null isl_multi_val *isl_multi_val_free(
3440                 __isl_take isl_multi_val *mv);
3442         #include <isl/aff.h>
3443         __isl_give isl_multi_aff *isl_multi_aff_copy(
3444                 __isl_keep isl_multi_aff *maff);
3445         __isl_null isl_multi_aff *isl_multi_aff_free(
3446                 __isl_take isl_multi_aff *maff);
3447         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
3448                 __isl_keep isl_multi_pw_aff *mpa);
3449         __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
3450                 __isl_take isl_multi_pw_aff *mpa);
3451         __isl_give isl_multi_union_pw_aff *
3452         isl_multi_union_pw_aff_copy(
3453                 __isl_keep isl_multi_union_pw_aff *mupa);
3454         __isl_null isl_multi_union_pw_aff *
3455         isl_multi_union_pw_aff_free(
3456                 __isl_take isl_multi_union_pw_aff *mupa);
3458 The number of base expressions in a multiple
3459 expression can be obtained using the following functions.
3461         #include <isl/id.h>
3462         int isl_multi_id_size(__isl_keep isl_multi_id *mi);
3464         #include <isl/val.h>
3465         isl_size isl_multi_val_size(__isl_keep isl_multi_val *mv);
3467         #include <isl/aff.h>
3468         isl_size isl_multi_aff_size(
3469                 __isl_keep isl_multi_aff *multi);
3470         isl_size isl_multi_pw_aff_size(
3471                 __isl_keep isl_multi_pw_aff *mpa);
3472         isl_size isl_multi_union_pw_aff_size(
3473                 __isl_keep isl_multi_union_pw_aff *mupa);
3475 The base expression at a given position of a multiple
3476 expression can be extracted using the following functions.
3478         #include <isl/id.h>
3479         __isl_give isl_id *isl_multi_id_get_at(
3480                 __isl_keep isl_multi_id *mi, int pos);
3481         __isl_give isl_id *isl_multi_id_get_id(
3482                 __isl_keep isl_multi_id *mi, int pos);
3484         #include <isl/val.h>
3485         __isl_give isl_val *isl_multi_val_get_at(
3486                 __isl_keep isl_multi_val *mv, int pos);
3487         __isl_give isl_val *isl_multi_val_get_val(
3488                 __isl_keep isl_multi_val *mv, int pos);
3490         #include <isl/aff.h>
3491         __isl_give isl_aff *isl_multi_aff_get_at(
3492                 __isl_keep isl_multi_aff *ma, int pos);
3493         __isl_give isl_aff *isl_multi_aff_get_aff(
3494                 __isl_keep isl_multi_aff *multi, int pos);
3495         __isl_give isl_pw_aff *isl_multi_pw_aff_get_at(
3496                 __isl_keep isl_multi_pw_aff *mpa, int pos);
3497         __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
3498                 __isl_keep isl_multi_pw_aff *mpa, int pos);
3499         __isl_give isl_union_pw_aff *
3500         isl_multi_union_pw_aff_get_at(
3501                 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
3502         __isl_give isl_union_pw_aff *
3503         isl_multi_union_pw_aff_get_union_pw_aff(
3504                 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
3506 C<isl_multi_id_get_id> is an alternative name for C<isl_multi_id_get_at>.
3507 Similarly for the other pairs of functions.
3509 The base expression can be replaced using the following functions.
3511         #include <isl/id.h>
3512         __isl_give isl_multi_id *isl_multi_id_set_at(
3513                 __isl_take isl_multi_id *mi, int pos,
3514                 __isl_take isl_id *id);
3515         __isl_give isl_multi_id *isl_multi_id_set_id(
3516                 __isl_take isl_multi_id *mi, int pos,
3517                 __isl_take isl_id *id);
3519         #include <isl/val.h>
3520         __isl_give isl_multi_val *isl_multi_val_set_at(
3521                 __isl_take isl_multi_val *mv, int pos,
3522                 __isl_take isl_val *val);
3523         __isl_give isl_multi_val *isl_multi_val_set_val(
3524                 __isl_take isl_multi_val *mv, int pos,
3525                 __isl_take isl_val *val);
3527         #include <isl/aff.h>
3528         __isl_give isl_multi_aff *isl_multi_aff_set_at(
3529                 __isl_take isl_multi_aff *ma, int pos,
3530                 __isl_take isl_aff *aff);
3531         __isl_give isl_multi_aff *isl_multi_aff_set_aff(
3532                 __isl_take isl_multi_aff *multi, int pos,
3533                 __isl_take isl_aff *aff);
3534         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_set_at(
3535                 __isl_take isl_multi_pw_aff *mpa, int pos,
3536                 __isl_take isl_pw_aff *pa);
3537         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_set_pw_aff(
3538                 __isl_take isl_multi_pw_aff *mpa, int pos,
3539                 __isl_take isl_pw_aff *pa);
3540         __isl_give isl_multi_union_pw_aff *
3541         isl_multi_union_pw_aff_set_at(
3542                 __isl_take isl_multi_union_pw_aff *mupa, int pos,
3543                 __isl_take isl_union_pw_aff *upa);
3544         __isl_give isl_multi_union_pw_aff *
3545         isl_multi_union_pw_aff_set_union_pw_aff(
3546                 __isl_take isl_multi_union_pw_aff *mupa, int pos,
3547                 __isl_take isl_union_pw_aff *upa);
3549 C<isl_multi_id_set_id> is an alternative name for C<isl_multi_id_set_at>.
3550 Similarly for the other pairs of functions.
3552 A list of all base expressions of a multiple
3553 expression can be extracted using the following functions.
3555         #include <isl/id.h>
3556         __isl_give isl_id_list *isl_multi_id_get_list(
3557                 __isl_keep isl_multi_id *mi);
3559         #include <isl/val.h>
3560         __isl_give isl_val_list *isl_multi_val_get_list(
3561                 __isl_keep isl_multi_val *mv);
3563         #include <isl/aff.h>
3564         __isl_give isl_aff_list *isl_multi_aff_get_list(
3565                 __isl_keep isl_multi_aff *multi);
3566         __isl_give isl_pw_aff_list *isl_multi_pw_aff_get_list(
3567                 __isl_keep isl_multi_pw_aff *mpa);
3568         __isl_give isl_union_pw_aff_list *
3569         isl_multi_union_pw_aff_list(
3570                 __isl_keep isl_multi_union_pw_aff *mupa);
3572 The constant terms of the base expressions can be obtained using
3573 the following function.
3575         #include <isl/aff.h>
3576         __isl_give isl_multi_val *
3577         isl_multi_aff_get_constant_multi_val(
3578                 __isl_keep isl_multi_aff *ma);
3580 As a convenience, a sequence of base expressions that have
3581 their domains in a given space can be extracted from a sequence
3582 of union expressions using the following function.
3584         #include <isl/aff.h>
3585         __isl_give isl_multi_pw_aff *
3586         isl_multi_union_pw_aff_extract_multi_pw_aff(
3587                 __isl_keep isl_multi_union_pw_aff *mupa,
3588                 __isl_take isl_space *space);
3590 Note that there is a difference between C<isl_multi_union_pw_aff>
3591 and C<isl_union_pw_multi_aff> objects.  The first is a sequence
3592 of unions of piecewise expressions, while the second is a union
3593 of piecewise sequences.  In particular, multiple affine expressions
3594 in an C<isl_union_pw_multi_aff> may live in different spaces,
3595 while there is only a single multiple expression in
3596 an C<isl_multi_union_pw_aff>, which can therefore only live
3597 in a single space.  This means that not every
3598 C<isl_union_pw_multi_aff> can be converted to
3599 an C<isl_multi_union_pw_aff>.  Conversely, the elements
3600 of an C<isl_multi_union_pw_aff> may be defined over different domains,
3601 while each multiple expression inside an C<isl_union_pw_multi_aff>
3602 has a single domain.  The conversion of an C<isl_union_pw_multi_aff>
3603 of dimension greater than one may therefore not be exact.
3604 The following functions can
3605 be used to perform these conversions when they are possible.
3607         #include <isl/aff.h>
3608         __isl_give isl_multi_union_pw_aff *
3609         isl_union_pw_multi_aff_as_multi_union_pw_aff(
3610                 __isl_take isl_union_pw_multi_aff *upma);
3611         __isl_give isl_multi_union_pw_aff *
3612         isl_multi_union_pw_aff_from_union_pw_multi_aff(
3613                 __isl_take isl_union_pw_multi_aff *upma);
3614         __isl_give isl_union_pw_multi_aff *
3615         isl_union_pw_multi_aff_from_multi_union_pw_aff(
3616                 __isl_take isl_multi_union_pw_aff *mupa);
3618 C<isl_union_pw_multi_aff_as_multi_union_pw_aff> and
3619 C<isl_multi_union_pw_aff_from_union_pw_multi_aff>
3620 perform the same operation.
3622 =head3 Piecewise Expressions
3624 A piecewise expression is an expression that is described
3625 using zero or more base expression defined over the same
3626 number of cells in the domain space of the base expressions.
3627 All base expressions are defined over the same
3628 domain space and the cells are disjoint.
3629 The space of a piecewise expression is the same as
3630 that of the base expressions.
3631 If the union of the cells is a strict subset of the domain
3632 space, then the value of the piecewise expression outside
3633 this union is different for types derived from quasi-affine
3634 expressions and those derived from quasipolynomials.
3635 Piecewise expressions derived from quasi-affine expressions
3636 are considered to be undefined outside the union of their cells.
3637 Piecewise expressions derived from quasipolynomials
3638 are considered to be zero outside the union of their cells.
3640 Piecewise quasipolynomials are mainly used by the C<barvinok>
3641 library for representing the number of elements in a parametric set or map.
3642 For example, the piecewise quasipolynomial
3644         [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
3646 represents the number of points in the map
3648         [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
3650 The piecewise expression types defined by C<isl>
3651 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
3652 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
3654 A piecewise expression with no cells can be created using
3655 the following functions.
3657         #include <isl/aff.h>
3658         __isl_give isl_pw_aff *isl_pw_aff_empty(
3659                 __isl_take isl_space *space);
3660         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
3661                 __isl_take isl_space *space);
3663 A piecewise expression with a single universe cell can be
3664 created using the following functions.
3666         #include <isl/aff.h>
3667         __isl_give isl_pw_aff *isl_pw_aff_from_aff(
3668                 __isl_take isl_aff *aff);
3669         __isl_give isl_pw_multi_aff *
3670         isl_multi_aff_to_pw_multi_aff(
3671                 __isl_take isl_multi_aff *ma);
3672         __isl_give isl_pw_multi_aff *
3673         isl_pw_multi_aff_from_multi_aff(
3674                 __isl_take isl_multi_aff *ma);
3676         #include <isl/polynomial.h>
3677         __isl_give isl_pw_qpolynomial *
3678         isl_pw_qpolynomial_from_qpolynomial(
3679                 __isl_take isl_qpolynomial *qp);
3680         __isl_give isl_pw_qpolynomial_fold *
3681         isl_pw_qpolynomial_fold_from_qpolynomial_fold(
3682                 __isl_take isl_qpolynomial_fold *fold);
3684 C<isl_multi_aff_to_pw_multi_aff> and C<isl_pw_multi_aff_from_multi_aff> perform
3685 the same operation.
3687 The inverse conversions below can only be used if the input
3688 expression is known to be defined over a single universe domain.
3690         #include <isl/aff.h>
3691         isl_bool isl_pw_aff_isa_aff(__isl_keep isl_pw_aff *pa);
3692         __isl_give isl_aff *isl_pw_aff_as_aff(
3693                 __isl_take isl_pw_aff *pa);
3694         isl_bool isl_multi_pw_aff_isa_multi_aff(
3695                 __isl_keep isl_multi_pw_aff *mpa);
3696         __isl_give isl_multi_aff *isl_multi_pw_aff_as_multi_aff(
3697                 __isl_take isl_multi_pw_aff *mpa);
3698         isl_bool isl_pw_multi_aff_isa_multi_aff(
3699                 __isl_keep isl_pw_multi_aff *pma);
3700         __isl_give isl_multi_aff *isl_pw_multi_aff_as_multi_aff(
3701                 __isl_take isl_pw_multi_aff *pma);
3703         #include <isl/polynomial.h>
3704         isl_bool isl_pw_qpolynomial_isa_qpolynomial(
3705                 __isl_keep isl_pw_qpolynomial *pwqp);
3706         __isl_give isl_qpolynomial *
3707         isl_pw_qpolynomial_as_qpolynomial(
3708                 __isl_take isl_pw_qpolynomial *pwqp);
3709         isl_bool isl_pw_qpolynomial_fold_isa_qpolynomial_fold(
3710                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3711         __isl_give isl_qpolynomial_fold *
3712         isl_pw_qpolynomial_fold_as_qpolynomial_fold(
3713                 __isl_take isl_pw_qpolynomial_fold *pwf);
3715 A piecewise expression with a single specified cell can be
3716 created using the following functions.
3718         #include <isl/aff.h>
3719         __isl_give isl_pw_aff *isl_pw_aff_alloc(
3720                 __isl_take isl_set *set, __isl_take isl_aff *aff);
3721         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
3722                 __isl_take isl_set *set,
3723                 __isl_take isl_multi_aff *maff);
3725         #include <isl/polynomial.h>
3726         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
3727                 __isl_take isl_set *set,
3728                 __isl_take isl_qpolynomial *qp);
3730 The following convenience functions first create a base expression and
3731 then create a piecewise expression over a universe domain.
3733         #include <isl/aff.h>
3734         __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
3735                 __isl_take isl_local_space *ls);
3736         __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
3737                 __isl_take isl_local_space *ls,
3738                 enum isl_dim_type type, unsigned pos);
3739         __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain_space(
3740                 __isl_take isl_space *space);
3741         __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
3742                 __isl_take isl_local_space *ls);
3743         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
3744                 __isl_take isl_space *space);
3745         __isl_give isl_pw_multi_aff *
3746         isl_pw_multi_aff_identity_on_domain_space(
3747                 __isl_take isl_space *space)
3748         __isl_give isl_pw_multi_aff *
3749         isl_space_identity_pw_multi_aff_on_domain(
3750                 __isl_take isl_space *space)
3751         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
3752                 __isl_take isl_space *space);
3753         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_domain_map(
3754                 __isl_take isl_space *space);
3755         __isl_give isl_pw_multi_aff *
3756         isl_space_domain_map_pw_multi_aff(
3757                 __isl_take isl_space *space);
3758         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
3759                 __isl_take isl_space *space);
3760         __isl_give isl_pw_multi_aff *
3761         isl_space_range_map_pw_multi_aff(
3762                 __isl_take isl_space *space);
3763         __isl_give isl_pw_multi_aff *
3764         isl_pw_multi_aff_project_out_map(
3765                 __isl_take isl_space *space,
3766                 enum isl_dim_type type,
3767                 unsigned first, unsigned n);
3769         #include <isl/polynomial.h>
3770         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
3771                 __isl_take isl_space *space);
3773 C<isl_pw_multi_aff_identity_on_domain_space> and
3774 C<isl_space_identity_pw_multi_aff_on_domain>
3775 perform the same operation.
3776 Similarly
3777 for the pair C<isl_pw_multi_aff_domain_map> and
3778 C<isl_space_domain_map_pw_multi_aff> and
3779 for the pair C<isl_pw_multi_aff_range_map> and
3780 C<isl_space_range_map_pw_multi_aff>.
3782 The following convenience functions first create a base expression and
3783 then create a piecewise expression over a given domain.
3785         #include <isl/aff.h>
3786         __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
3787                 __isl_take isl_set *domain,
3788                 __isl_take isl_val *v);
3789         __isl_give isl_pw_aff *isl_set_pw_aff_on_domain_val(
3790                 __isl_take isl_set *domain,
3791                 __isl_take isl_val *v);
3792         __isl_give isl_pw_multi_aff *
3793         isl_pw_multi_aff_multi_val_on_domain(
3794                 __isl_take isl_set *domain,
3795                 __isl_take isl_multi_val *mv);
3796         __isl_give isl_pw_multi_aff *
3797         isl_set_pw_multi_aff_on_domain_multi_val(
3798                 __isl_take isl_set *domain,
3799                 __isl_take isl_multi_val *mv);
3800         __isl_give isl_pw_aff *isl_pw_aff_param_on_domain_id(
3801                 __isl_take isl_set *domain,
3802                 __isl_take isl_id *id);
3803         __isl_give isl_pw_aff *isl_set_param_pw_aff_on_domain_id(
3804                 __isl_take isl_set *domain,
3805                 __isl_take isl_id *id);
3807 C<isl_set_pw_aff_on_domain_val> is an alternative name
3808 for C<isl_pw_aff_val_on_domain>.
3809 Similarly for the pair
3810 C<isl_set_pw_multi_aff_on_domain_multi_val> and
3811 C<isl_pw_multi_aff_multi_val_on_domain> and
3812 for the pair C<isl_set_param_pw_aff_on_domain_id> and
3813 C<isl_pw_aff_param_on_domain_id>.
3815 As a convenience, a piecewise multiple expression can
3816 also be created from a piecewise expression.
3817 Each multiple expression in the result is derived
3818 from the corresponding base expression.
3820         #include <isl/aff.h>
3821         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
3822                 __isl_take isl_pw_aff *pa);
3824 Similarly, a piecewise quasipolynomial can be
3825 created from a piecewise quasi-affine expression using
3826 the following function.
3828         #include <isl/polynomial.h>
3829         __isl_give isl_pw_qpolynomial *
3830         isl_pw_qpolynomial_from_pw_aff(
3831                 __isl_take isl_pw_aff *pwaff);
3833 Piecewise expressions can be copied and freed using the following functions.
3835         #include <isl/aff.h>
3836         __isl_give isl_pw_aff *isl_pw_aff_copy(
3837                 __isl_keep isl_pw_aff *pwaff);
3838         __isl_null isl_pw_aff *isl_pw_aff_free(
3839                 __isl_take isl_pw_aff *pwaff);
3840         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
3841                 __isl_keep isl_pw_multi_aff *pma);
3842         __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
3843                 __isl_take isl_pw_multi_aff *pma);
3845         #include <isl/polynomial.h>
3846         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
3847                 __isl_keep isl_pw_qpolynomial *pwqp);
3848         __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
3849                 __isl_take isl_pw_qpolynomial *pwqp);
3850         __isl_give isl_pw_qpolynomial_fold *
3851         isl_pw_qpolynomial_fold_copy(
3852                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3853         __isl_null isl_pw_qpolynomial_fold *
3854         isl_pw_qpolynomial_fold_free(
3855                 __isl_take isl_pw_qpolynomial_fold *pwf);
3857 To iterate over the different cells of a piecewise expression,
3858 use the following functions.
3860         #include <isl/aff.h>
3861         isl_bool isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
3862         isl_size isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
3863         isl_stat isl_pw_aff_foreach_piece(
3864                 __isl_keep isl_pw_aff *pwaff,
3865                 isl_stat (*fn)(__isl_take isl_set *set,
3866                           __isl_take isl_aff *aff,
3867                           void *user), void *user);
3868         isl_bool isl_pw_aff_every_piece(__isl_keep isl_pw_aff *pa,
3869                 isl_bool (*test)(__isl_keep isl_set *set,
3870                         __isl_keep isl_aff *aff, void *user),
3871                         void *user);
3872         isl_size isl_pw_multi_aff_n_piece(
3873                 __isl_keep isl_pw_multi_aff *pma);
3874         isl_stat isl_pw_multi_aff_foreach_piece(
3875                 __isl_keep isl_pw_multi_aff *pma,
3876                 isl_stat (*fn)(__isl_take isl_set *set,
3877                             __isl_take isl_multi_aff *maff,
3878                             void *user), void *user);
3879         isl_bool isl_pw_multi_aff_every_piece(
3880                 __isl_keep isl_pw_multi_aff *pma,
3881                 isl_bool (*test)(__isl_keep isl_set *set,
3882                         __isl_keep isl_multi_aff *ma, void *user),
3883                         void *user);
3885         #include <isl/polynomial.h>
3886         isl_size isl_pw_qpolynomial_n_piece(
3887                 __isl_keep isl_pw_qpolynomial *pwqp);
3888         isl_stat isl_pw_qpolynomial_foreach_piece(
3889                 __isl_keep isl_pw_qpolynomial *pwqp,
3890                 isl_stat (*fn)(__isl_take isl_set *set,
3891                           __isl_take isl_qpolynomial *qp,
3892                           void *user), void *user);
3893         isl_bool isl_pw_qpolynomial_every_piece(
3894                 __isl_keep isl_pw_qpolynomial *pwqp,
3895                 isl_bool (*test)(__isl_keep isl_set *set,
3896                         __isl_keep isl_qpolynomial *qp,
3897                         void *user), void *user);
3898         isl_stat isl_pw_qpolynomial_foreach_lifted_piece(
3899                 __isl_keep isl_pw_qpolynomial *pwqp,
3900                 isl_stat (*fn)(__isl_take isl_set *set,
3901                           __isl_take isl_qpolynomial *qp,
3902                           void *user), void *user);
3903         isl_size isl_pw_qpolynomial_fold_n_piece(
3904                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3905         isl_stat isl_pw_qpolynomial_fold_foreach_piece(
3906                 __isl_keep isl_pw_qpolynomial_fold *pwf,
3907                 isl_stat (*fn)(__isl_take isl_set *set,
3908                           __isl_take isl_qpolynomial_fold *fold,
3909                           void *user), void *user);
3910         isl_bool isl_pw_qpolynomial_fold_every_piece(
3911                 __isl_keep isl_pw_qpolynomial_fold *pwf,
3912                 isl_bool (*test)(__isl_keep isl_set *set,
3913                         __isl_keep isl_qpolynomial_fold *fold,
3914                         void *user), void *user);
3915         isl_stat isl_pw_qpolynomial_fold_foreach_lifted_piece(
3916                 __isl_keep isl_pw_qpolynomial_fold *pwf,
3917                 isl_stat (*fn)(__isl_take isl_set *set,
3918                           __isl_take isl_qpolynomial_fold *fold,
3919                           void *user), void *user);
3921 As usual, the function C<fn> should return C<isl_stat_ok> on success
3922 and C<isl_stat_error> on failure.  The difference between
3923 C<isl_pw_qpolynomial_foreach_piece> and
3924 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
3925 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
3926 compute unique representations for all existentially quantified
3927 variables and then turn these existentially quantified variables
3928 into extra set variables, adapting the associated quasipolynomial
3929 accordingly.  This means that the C<set> passed to C<fn>
3930 will not have any existentially quantified variables, but that
3931 the dimensions of the sets may be different for different
3932 invocations of C<fn>.
3933 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
3934 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
3935 The function C<isl_pw_aff_every_piece> and its variants
3936 check whether each call to the callback returns true and
3937 stop checking as soon as one of these calls returns false (or error).
3939 A piecewise expression consisting of the expressions at a given
3940 position of a piecewise multiple expression can be extracted
3941 using the following function.
3943         #include <isl/aff.h>
3944         __isl_give isl_pw_aff *isl_pw_multi_aff_get_at(
3945                 __isl_keep isl_pw_multi_aff *pma, int pos);
3946         __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3947                 __isl_keep isl_pw_multi_aff *pma, int pos);
3949 C<isl_pw_multi_aff_get_pw_aff> is an alternative name for
3950 C<isl_pw_multi_aff_get_at>.
3952 These expressions can be replaced using the following function.
3954         #include <isl/aff.h>
3955         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3956                 __isl_take isl_pw_multi_aff *pma, unsigned pos,
3957                 __isl_take isl_pw_aff *pa);
3959 Note that there is a difference between C<isl_multi_pw_aff> and
3960 C<isl_pw_multi_aff> objects.  The first is a sequence of piecewise
3961 affine expressions, while the second is a piecewise sequence
3962 of affine expressions.  In particular, each of the piecewise
3963 affine expressions in an C<isl_multi_pw_aff> may have a different
3964 domain, while all multiple expressions associated to a cell
3965 in an C<isl_pw_multi_aff> have the same domain.
3966 It is possible to convert between the two, but when converting
3967 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3968 of the result is the intersection of the domains of the input.
3969 The reverse conversion is exact.
3971         #include <isl/aff.h>
3972         __isl_give isl_pw_multi_aff *
3973         isl_pw_multi_aff_from_multi_pw_aff(
3974                 __isl_take isl_multi_pw_aff *mpa);
3975         __isl_give isl_multi_pw_aff *
3976         isl_pw_multi_aff_to_multi_pw_aff(
3977                 __isl_take isl_pw_multi_aff *pma);
3978         __isl_give isl_multi_pw_aff *
3979         isl_multi_pw_aff_from_pw_multi_aff(
3980                 __isl_take isl_pw_multi_aff *pma);
3982 C<isl_pw_multi_aff_to_multi_pw_aff> and
3983 C<isl_multi_pw_aff_from_pw_multi_aff> perform the same operation.
3985 =head3 Union Expressions
3987 A union expression collects base expressions defined
3988 over different domains.  The space of a union expression
3989 is that of the shared parameter space.
3991 The union expression types defined by C<isl>
3992 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3993 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3994 In case of
3995 C<isl_union_pw_aff>,
3996 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>,
3997 there can be at most one base expression for a given domain space.
3998 In case of
3999 C<isl_union_pw_multi_aff>,
4000 there can be multiple such expressions for a given domain space,
4001 but the domains of these expressions need to be disjoint.
4003 An empty union expression can be created using the following functions.
4005         #include <isl/aff.h>
4006         __isl_give isl_union_pw_aff *
4007         isl_union_pw_aff_empty_ctx(
4008                 isl_ctx *ctx);
4009         __isl_give isl_union_pw_aff *
4010         isl_union_pw_aff_empty_space(
4011                 __isl_take isl_space *space);
4012         __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
4013                 __isl_take isl_space *space);
4014         __isl_give isl_union_pw_multi_aff *
4015         isl_union_pw_multi_aff_empty_ctx(
4016                 isl_ctx *ctx);
4017         __isl_give isl_union_pw_multi_aff *
4018         isl_union_pw_multi_aff_empty_space(
4019                 __isl_take isl_space *space);
4020         __isl_give isl_union_pw_multi_aff *
4021         isl_union_pw_multi_aff_empty(
4022                 __isl_take isl_space *space);
4024         #include <isl/polynomial.h>
4025         __isl_give isl_union_pw_qpolynomial *
4026         isl_union_pw_qpolynomial_zero_ctx(
4027                 isl_ctx *ctx);
4028         __isl_give isl_union_pw_qpolynomial *
4029         isl_union_pw_qpolynomial_zero_space(
4030                 __isl_take isl_space *space);
4031         __isl_give isl_union_pw_qpolynomial *
4032         isl_union_pw_qpolynomial_zero(
4033                 __isl_take isl_space *space);
4035 C<isl_union_pw_aff_empty> is an alternative name for
4036 C<isl_union_pw_aff_empty_space>.
4037 Similarly for the other pairs of functions.
4039 A union expression containing a single base expression
4040 can be created using the following functions.
4042         #include <isl/aff.h>
4043         __isl_give isl_union_pw_aff *
4044         isl_pw_aff_to_union_pw_aff(
4045                 __isl_take isl_pw_aff *pa);
4046         __isl_give isl_union_pw_aff *
4047         isl_union_pw_aff_from_pw_aff(
4048                 __isl_take isl_pw_aff *pa);
4049         __isl_give isl_union_pw_multi_aff *
4050         isl_union_pw_multi_aff_from_aff(
4051                 __isl_take isl_aff *aff);
4052         __isl_give isl_union_pw_multi_aff *
4053         isl_pw_multi_aff_to_union_pw_multi_aff(
4054                 __isl_take isl_pw_multi_aff *pma);
4055         __isl_give isl_union_pw_multi_aff *
4056         isl_union_pw_multi_aff_from_pw_multi_aff(
4057                 __isl_take isl_pw_multi_aff *pma);
4059         #include <isl/polynomial.h>
4060         __isl_give isl_union_pw_qpolynomial *
4061         isl_pw_qpolynomial_to_union_pw_qpolynomial(
4062                 __isl_take isl_pw_qpolynomial *pwqp);
4063         __isl_give isl_union_pw_qpolynomial *
4064         isl_union_pw_qpolynomial_from_pw_qpolynomial(
4065                 __isl_take isl_pw_qpolynomial *pwqp);
4066         __isl_give isl_union_pw_qpolynomial_fold *
4067         isl_pw_qpolynomial_fold_to_union_pw_qpolynomial_fold(
4068                 __isl_take isl_pw_qpolynomial_fold *pwf);
4069         __isl_give isl_union_pw_qpolynomial_fold *
4070         isl_union_pw_qpolynomial_fold_from_pw_qpolynomial_fold(
4071                 __isl_take isl_pw_qpolynomial_fold *pwf);
4073 C<isl_pw_aff_to_union_pw_aff> and C<isl_union_pw_aff_from_pw_aff> perform
4074 the same operation.
4075 Similarly for C<isl_pw_multi_aff_to_union_pw_multi_aff> and
4076 C<isl_union_pw_multi_aff_from_pw_multi_aff>,
4078 C<isl_pw_qpolynomial_to_union_pw_qpolynomial> and
4079 C<isl_union_pw_qpolynomial_from_pw_qpolynomial>, and
4081 C<isl_pw_qpolynomial_fold_to_union_pw_qpolynomial_fold> and
4082 C<isl_union_pw_qpolynomial_fold_from_pw_qpolynomial_fold>.
4084 The inverse conversions below can only be used if the input
4085 expression is known to live in exactly one space.
4087         #include <isl/aff.h>
4088         isl_bool isl_union_pw_multi_aff_isa_pw_multi_aff(
4089                 __isl_keep isl_union_pw_multi_aff *upma);
4090         __isl_give isl_pw_multi_aff *
4091         isl_union_pw_multi_aff_as_pw_multi_aff(
4092                 __isl_take isl_union_pw_multi_aff *upma);
4094 A union piecewise expression containing a single base expression
4095 on a universe domain can also be created directly from
4096 a base expression using the following functions.
4098         #include <isl/aff.h>
4099         __isl_give isl_union_pw_aff *isl_union_pw_aff_from_aff(
4100                 __isl_take isl_aff *aff);
4101         __isl_give isl_union_pw_multi_aff *
4102         isl_union_pw_multi_aff_from_multi_aff(
4103                 __isl_take isl_multi_aff *ma);
4105 The following functions create a base expression on each
4106 of the sets in the union set and collect the results.
4108         #include <isl/aff.h>
4109         __isl_give isl_union_pw_multi_aff *
4110         isl_union_pw_multi_aff_from_union_pw_aff(
4111                 __isl_take isl_union_pw_aff *upa);
4112         __isl_give isl_union_pw_aff *
4113         isl_union_pw_multi_aff_get_union_pw_aff(
4114                 __isl_keep isl_union_pw_multi_aff *upma, int pos);
4115         __isl_give isl_union_pw_aff *
4116         isl_union_pw_aff_val_on_domain(
4117                 __isl_take isl_union_set *domain,
4118                 __isl_take isl_val *v);
4119         __isl_give isl_union_pw_multi_aff *
4120         isl_union_pw_multi_aff_multi_val_on_domain(
4121                 __isl_take isl_union_set *domain,
4122                 __isl_take isl_multi_val *mv);
4123         __isl_give isl_union_pw_aff *
4124         isl_union_pw_aff_param_on_domain_id(
4125                 __isl_take isl_union_set *domain,
4126                 __isl_take isl_id *id);
4128 The C<id> argument of C<isl_union_pw_aff_param_on_domain_id>
4129 is the identifier of a parameter that may or may not already
4130 be present in C<domain>.
4132 An C<isl_union_pw_aff> that is equal to a (parametric) affine
4133 or piecewise affine
4134 expression on a given domain can be created using the following
4135 functions.
4137         #include <isl/aff.h>
4138         __isl_give isl_union_pw_aff *
4139         isl_union_pw_aff_aff_on_domain(
4140                 __isl_take isl_union_set *domain,
4141                 __isl_take isl_aff *aff);
4142         __isl_give isl_union_pw_aff *
4143         isl_union_pw_aff_pw_aff_on_domain(
4144                 __isl_take isl_union_set *domain,
4145                 __isl_take isl_pw_aff *pa);
4147 A base expression can be added to a union expression using
4148 the following functions.
4150         #include <isl/aff.h>
4151         __isl_give isl_union_pw_aff *
4152         isl_union_pw_aff_add_pw_aff(
4153                 __isl_take isl_union_pw_aff *upa,
4154                 __isl_take isl_pw_aff *pa);
4155         __isl_give isl_union_pw_multi_aff *
4156         isl_union_pw_multi_aff_add_pw_multi_aff(
4157                 __isl_take isl_union_pw_multi_aff *upma,
4158                 __isl_take isl_pw_multi_aff *pma);
4160         #include <isl/polynomial.h>
4161         __isl_give isl_union_pw_qpolynomial *
4162         isl_union_pw_qpolynomial_add_pw_qpolynomial(
4163                 __isl_take isl_union_pw_qpolynomial *upwqp,
4164                 __isl_take isl_pw_qpolynomial *pwqp);
4166 Union expressions can be copied and freed using
4167 the following functions.
4169         #include <isl/aff.h>
4170         __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
4171                 __isl_keep isl_union_pw_aff *upa);
4172         __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
4173                 __isl_take isl_union_pw_aff *upa);
4174         __isl_give isl_union_pw_multi_aff *
4175         isl_union_pw_multi_aff_copy(
4176                 __isl_keep isl_union_pw_multi_aff *upma);
4177         __isl_null isl_union_pw_multi_aff *
4178         isl_union_pw_multi_aff_free(
4179                 __isl_take isl_union_pw_multi_aff *upma);
4181         #include <isl/polynomial.h>
4182         __isl_give isl_union_pw_qpolynomial *
4183         isl_union_pw_qpolynomial_copy(
4184                 __isl_keep isl_union_pw_qpolynomial *upwqp);
4185         __isl_null isl_union_pw_qpolynomial *
4186         isl_union_pw_qpolynomial_free(
4187                 __isl_take isl_union_pw_qpolynomial *upwqp);
4188         __isl_give isl_union_pw_qpolynomial_fold *
4189         isl_union_pw_qpolynomial_fold_copy(
4190                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
4191         __isl_null isl_union_pw_qpolynomial_fold *
4192         isl_union_pw_qpolynomial_fold_free(
4193                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4195 To iterate over the base expressions in a union expression,
4196 use the following functions.
4198         #include <isl/aff.h>
4199         isl_size isl_union_pw_aff_n_pw_aff(
4200                 __isl_keep isl_union_pw_aff *upa);
4201         isl_stat isl_union_pw_aff_foreach_pw_aff(
4202                 __isl_keep isl_union_pw_aff *upa,
4203                 isl_stat (*fn)(__isl_take isl_pw_aff *pa,
4204                         void *user), void *user);
4205         isl_bool isl_union_pw_aff_every_pw_aff(
4206                 __isl_keep isl_union_pw_aff *upa,
4207                 isl_bool (*test)(__isl_keep isl_pw_aff *pa,
4208                         void *user), void *user);
4209         isl_size isl_union_pw_multi_aff_n_pw_multi_aff(
4210                 __isl_keep isl_union_pw_multi_aff *upma);
4211         isl_stat isl_union_pw_multi_aff_foreach_pw_multi_aff(
4212                 __isl_keep isl_union_pw_multi_aff *upma,
4213                 isl_stat (*fn)(__isl_take isl_pw_multi_aff *pma,
4214                             void *user), void *user);
4215         isl_bool isl_union_pw_multi_aff_every_pw_multi_aff(
4216                 __isl_keep isl_union_pw_multi_aff *upma,
4217                 isl_bool (*test)(
4218                         __isl_keep isl_pw_multi_aff *pma,
4219                         void *user), void *user);
4221         #include <isl/polynomial.h>
4222         isl_size isl_union_pw_qpolynomial_n_pw_qpolynomial(
4223                 __isl_keep isl_union_pw_qpolynomial *upwqp);
4224         isl_stat isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
4225                 __isl_keep isl_union_pw_qpolynomial *upwqp,
4226                 isl_stat (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
4227                             void *user), void *user);
4228         isl_bool isl_union_pw_qpolynomial_every_pw_qpolynomial(
4229                 __isl_keep isl_union_pw_qpolynomial *upwqp,
4230                 isl_bool (*test)(
4231                         __isl_keep isl_pw_qpolynomial *pwqp,
4232                         void *user), void *user);
4233         isl_size isl_union_pw_qpolynomial_fold_n_pw_qpolynomial_fold(
4234                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
4235         isl_stat isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
4236                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
4237                 isl_stat (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
4238                             void *user), void *user);
4239         isl_bool
4240         isl_union_pw_qpolynomial_fold_every_pw_qpolynomial_fold(
4241                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
4242                 isl_bool (*test)(
4243                         __isl_keep isl_pw_qpolynomial_fold *pwf,
4244                         void *user), void *user);
4246 To extract the base expression in a given space from a union, use
4247 the following functions.
4249         #include <isl/aff.h>
4250         __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
4251                 __isl_keep isl_union_pw_aff *upa,
4252                 __isl_take isl_space *space);
4253         __isl_give isl_pw_multi_aff *
4254         isl_union_pw_multi_aff_extract_pw_multi_aff(
4255                 __isl_keep isl_union_pw_multi_aff *upma,
4256                 __isl_take isl_space *space);
4258         #include <isl/polynomial.h>
4259         __isl_give isl_pw_qpolynomial *
4260         isl_union_pw_qpolynomial_extract_pw_qpolynomial(
4261                 __isl_keep isl_union_pw_qpolynomial *upwqp,
4262                 __isl_take isl_space *space);
4264 It is also possible to obtain a list of the base expressions using
4265 the following functions.
4267         #include <isl/aff.h>
4268         __isl_give isl_pw_aff_list *
4269         isl_union_pw_aff_get_pw_aff_list(
4270                 __isl_keep isl_union_pw_aff *upa);
4271         __isl_give isl_pw_multi_aff_list *
4272         isl_union_pw_multi_aff_get_pw_multi_aff_list(
4273                 __isl_keep isl_union_pw_multi_aff *upma);
4275         #include <isl/polynomial.h>
4276         __isl_give isl_pw_qpolynomial_list *
4277         isl_union_pw_qpolynomial_get_pw_qpolynomial_list(
4278                 __isl_keep isl_union_pw_qpolynomial *upwqp);
4279         __isl_give isl_pw_qpolynomial_fold_list *
4280         isl_union_pw_qpolynomial_fold_get_pw_qpolynomial_fold_list(
4281                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
4283 The returned list can be manipulated using the functions in L<"Lists">.
4285 =head2 Input and Output
4287 For set and relation,
4288 C<isl> supports its own input/output format, which is similar
4289 to the C<Omega> format, but also supports the C<PolyLib> format
4290 in some cases.
4291 For other object types, typically only an C<isl> format is supported.
4293 =head3 C<isl> format
4295 The C<isl> format is similar to that of C<Omega>, but has a different
4296 syntax for describing the parameters and allows for the definition
4297 of an existentially quantified variable as the integer division
4298 of an affine expression.
4299 For example, the set of integers C<i> between C<0> and C<n>
4300 such that C<i % 10 <= 6> can be described as
4302         [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
4303                                 i - 10 a <= 6) }
4305 A set or relation can have several disjuncts, separated
4306 by the keyword C<or>.  Each disjunct is either a conjunction
4307 of constraints or a projection (C<exists>) of a conjunction
4308 of constraints.  The constraints are separated by the keyword
4309 C<and>.
4311 =head3 C<PolyLib> format
4313 If the represented set is a union, then the first line
4314 contains a single number representing the number of disjuncts.
4315 Otherwise, a line containing the number C<1> is optional.
4317 Each disjunct is represented by a matrix of constraints.
4318 The first line contains two numbers representing
4319 the number of rows and columns,
4320 where the number of rows is equal to the number of constraints
4321 and the number of columns is equal to two plus the number of variables.
4322 The following lines contain the actual rows of the constraint matrix.
4323 In each row, the first column indicates whether the constraint
4324 is an equality (C<0>) or inequality (C<1>).  The final column
4325 corresponds to the constant term.
4327 If the set is parametric, then the coefficients of the parameters
4328 appear in the last columns before the constant column.
4329 The coefficients of any existentially quantified variables appear
4330 between those of the set variables and those of the parameters.
4332 =head3 Extended C<PolyLib> format
4334 The extended C<PolyLib> format is nearly identical to the
4335 C<PolyLib> format.  The only difference is that the line
4336 containing the number of rows and columns of a constraint matrix
4337 also contains four additional numbers:
4338 the number of output dimensions, the number of input dimensions,
4339 the number of local dimensions (i.e., the number of existentially
4340 quantified variables) and the number of parameters.
4341 For sets, the number of ``output'' dimensions is equal
4342 to the number of set dimensions, while the number of ``input''
4343 dimensions is zero.
4345 =head3 Input
4347 Objects can be read from input using the following functions.
4349         #include <isl/id.h>
4350         __isl_give isl_id *isl_id_read_from_str(isl_ctx *ctx,
4351                 const char *str);
4352         __isl_give isl_multi_id *isl_multi_id_read_from_str(
4353                 isl_ctx *ctx, const char *str);
4355         #include <isl/val.h>
4356         __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
4357                 const char *str);
4358         __isl_give isl_multi_val *isl_multi_val_read_from_str(
4359                 isl_ctx *ctx, const char *str);
4361         #include <isl/space.h>
4362         __isl_give isl_space *isl_space_read_from_str(
4363                 isl_ctx *ctx, const char *str);
4365         #include <isl/set.h>
4366         __isl_give isl_basic_set *isl_basic_set_read_from_file(
4367                 isl_ctx *ctx, FILE *input);
4368         __isl_give isl_basic_set *isl_basic_set_read_from_str(
4369                 isl_ctx *ctx, const char *str);
4370         __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
4371                 FILE *input);
4372         __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
4373                 const char *str);
4375         #include <isl/map.h>
4376         __isl_give isl_basic_map *isl_basic_map_read_from_file(
4377                 isl_ctx *ctx, FILE *input);
4378         __isl_give isl_basic_map *isl_basic_map_read_from_str(
4379                 isl_ctx *ctx, const char *str);
4380         __isl_give isl_map *isl_map_read_from_file(
4381                 isl_ctx *ctx, FILE *input);
4382         __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
4383                 const char *str);
4385         #include <isl/union_set.h>
4386         __isl_give isl_union_set *isl_union_set_read_from_file(
4387                 isl_ctx *ctx, FILE *input);
4388         __isl_give isl_union_set *isl_union_set_read_from_str(
4389                 isl_ctx *ctx, const char *str);
4391         #include <isl/union_map.h>
4392         __isl_give isl_union_map *isl_union_map_read_from_file(
4393                 isl_ctx *ctx, FILE *input);
4394         __isl_give isl_union_map *isl_union_map_read_from_str(
4395                 isl_ctx *ctx, const char *str);
4397         #include <isl/aff.h>
4398         __isl_give isl_aff *isl_aff_read_from_str(
4399                 isl_ctx *ctx, const char *str);
4400         __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
4401                 isl_ctx *ctx, const char *str);
4402         __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
4403                 isl_ctx *ctx, const char *str);
4404         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
4405                 isl_ctx *ctx, const char *str);
4406         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
4407                 isl_ctx *ctx, const char *str);
4408         __isl_give isl_union_pw_aff *
4409         isl_union_pw_aff_read_from_str(
4410                 isl_ctx *ctx, const char *str);
4411         __isl_give isl_union_pw_multi_aff *
4412         isl_union_pw_multi_aff_read_from_str(
4413                 isl_ctx *ctx, const char *str);
4414         __isl_give isl_multi_union_pw_aff *
4415         isl_multi_union_pw_aff_read_from_str(
4416                 isl_ctx *ctx, const char *str);
4418         #include <isl/polynomial.h>
4419         __isl_give isl_union_pw_qpolynomial *
4420         isl_union_pw_qpolynomial_read_from_str(
4421                 isl_ctx *ctx, const char *str);
4423         __isl_give isl_pw_qpolynomial_fold *
4424         isl_pw_qpolynomial_fold_read_from_str(
4425                 isl_ctx *ctx, const char *str);
4427 For sets and relations,
4428 the input format is autodetected and may be either the C<PolyLib> format
4429 or the C<isl> format.
4431 =head3 Output
4433 Before anything can be printed, an C<isl_printer> needs to
4434 be created.
4436         __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
4437                 FILE *file);
4438         __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
4439         __isl_null isl_printer *isl_printer_free(
4440                 __isl_take isl_printer *printer);
4442 C<isl_printer_to_file> prints to the given file, while
4443 C<isl_printer_to_str> prints to a string that can be extracted
4444 using the following function.
4446         #include <isl/printer.h>
4447         __isl_give char *isl_printer_get_str(
4448                 __isl_keep isl_printer *printer);
4450 The printer can be inspected using the following functions.
4452         FILE *isl_printer_get_file(
4453                 __isl_keep isl_printer *printer);
4454         int isl_printer_get_output_format(
4455                 __isl_keep isl_printer *p);
4456         int isl_printer_get_yaml_style(__isl_keep isl_printer *p);
4458 The behavior of the printer can be modified in various ways
4460         __isl_give isl_printer *isl_printer_set_output_format(
4461                 __isl_take isl_printer *p, int output_format);
4462         __isl_give isl_printer *isl_printer_set_indent(
4463                 __isl_take isl_printer *p, int indent);
4464         __isl_give isl_printer *isl_printer_set_indent_prefix(
4465                 __isl_take isl_printer *p, const char *prefix);
4466         __isl_give isl_printer *isl_printer_indent(
4467                 __isl_take isl_printer *p, int indent);
4468         __isl_give isl_printer *isl_printer_set_prefix(
4469                 __isl_take isl_printer *p, const char *prefix);
4470         __isl_give isl_printer *isl_printer_set_suffix(
4471                 __isl_take isl_printer *p, const char *suffix);
4472         __isl_give isl_printer *isl_printer_set_yaml_style(
4473                 __isl_take isl_printer *p, int yaml_style);
4475 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
4476 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
4477 and defaults to C<ISL_FORMAT_ISL>.
4478 Each line in the output is prefixed by C<indent_prefix>,
4479 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
4480 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
4481 In the C<PolyLib> format output,
4482 the coefficients of the existentially quantified variables
4483 appear between those of the set variables and those
4484 of the parameters.
4485 The function C<isl_printer_indent> increases the indentation
4486 by the specified amount (which may be negative).
4487 The YAML style may be either C<ISL_YAML_STYLE_BLOCK> or
4488 C<ISL_YAML_STYLE_FLOW> and when we are printing something
4489 in YAML format.
4491 To actually print something, use
4493         #include <isl/printer.h>
4494         __isl_give isl_printer *isl_printer_print_double(
4495                 __isl_take isl_printer *p, double d);
4497         #include <isl/val.h>
4498         __isl_give isl_printer *isl_printer_print_val(
4499                 __isl_take isl_printer *p, __isl_keep isl_val *v);
4500         __isl_give isl_printer *isl_printer_print_multi_val(
4501                 __isl_take isl_printer *p,
4502                 __isl_keep isl_multi_val *mv);
4504         #include <isl/set.h>
4505         __isl_give isl_printer *isl_printer_print_basic_set(
4506                 __isl_take isl_printer *printer,
4507                 __isl_keep isl_basic_set *bset);
4508         __isl_give isl_printer *isl_printer_print_set(
4509                 __isl_take isl_printer *printer,
4510                 __isl_keep isl_set *set);
4512         #include <isl/map.h>
4513         __isl_give isl_printer *isl_printer_print_basic_map(
4514                 __isl_take isl_printer *printer,
4515                 __isl_keep isl_basic_map *bmap);
4516         __isl_give isl_printer *isl_printer_print_map(
4517                 __isl_take isl_printer *printer,
4518                 __isl_keep isl_map *map);
4520         #include <isl/union_set.h>
4521         __isl_give isl_printer *isl_printer_print_union_set(
4522                 __isl_take isl_printer *p,
4523                 __isl_keep isl_union_set *uset);
4525         #include <isl/union_map.h>
4526         __isl_give isl_printer *isl_printer_print_union_map(
4527                 __isl_take isl_printer *p,
4528                 __isl_keep isl_union_map *umap);
4530         #include <isl/id.h>
4531         __isl_give isl_printer *isl_printer_print_multi_id(
4532                 __isl_take isl_printer *p,
4533                 __isl_keep isl_multi_id *mi);
4535         #include <isl/aff.h>
4536         __isl_give isl_printer *isl_printer_print_aff(
4537                 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
4538         __isl_give isl_printer *isl_printer_print_multi_aff(
4539                 __isl_take isl_printer *p,
4540                 __isl_keep isl_multi_aff *maff);
4541         __isl_give isl_printer *isl_printer_print_pw_aff(
4542                 __isl_take isl_printer *p,
4543                 __isl_keep isl_pw_aff *pwaff);
4544         __isl_give isl_printer *isl_printer_print_pw_multi_aff(
4545                 __isl_take isl_printer *p,
4546                 __isl_keep isl_pw_multi_aff *pma);
4547         __isl_give isl_printer *isl_printer_print_multi_pw_aff(
4548                 __isl_take isl_printer *p,
4549                 __isl_keep isl_multi_pw_aff *mpa);
4550         __isl_give isl_printer *isl_printer_print_union_pw_aff(
4551                 __isl_take isl_printer *p,
4552                 __isl_keep isl_union_pw_aff *upa);
4553         __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
4554                 __isl_take isl_printer *p,
4555                 __isl_keep isl_union_pw_multi_aff *upma);
4556         __isl_give isl_printer *
4557         isl_printer_print_multi_union_pw_aff(
4558                 __isl_take isl_printer *p,
4559                 __isl_keep isl_multi_union_pw_aff *mupa);
4561         #include <isl/polynomial.h>
4562         __isl_give isl_printer *isl_printer_print_qpolynomial(
4563                 __isl_take isl_printer *p,
4564                 __isl_keep isl_qpolynomial *qp);
4565         __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
4566                 __isl_take isl_printer *p,
4567                 __isl_keep isl_pw_qpolynomial *pwqp);
4568         __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
4569                 __isl_take isl_printer *p,
4570                 __isl_keep isl_union_pw_qpolynomial *upwqp);
4572         __isl_give isl_printer *
4573         isl_printer_print_pw_qpolynomial_fold(
4574                 __isl_take isl_printer *p,
4575                 __isl_keep isl_pw_qpolynomial_fold *pwf);
4576         __isl_give isl_printer *
4577         isl_printer_print_union_pw_qpolynomial_fold(
4578                 __isl_take isl_printer *p,
4579                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
4581 For C<isl_printer_print_qpolynomial>,
4582 C<isl_printer_print_pw_qpolynomial> and
4583 C<isl_printer_print_pw_qpolynomial_fold>,
4584 the output format of the printer
4585 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
4586 For C<isl_printer_print_union_pw_qpolynomial> and
4587 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
4588 is supported.
4589 In case of printing in C<ISL_FORMAT_C>, the user may want
4590 to set the names of all dimensions first.
4592 C<isl> also provides limited support for printing YAML documents,
4593 just enough for the internal use for printing such documents.
4595         #include <isl/printer.h>
4596         __isl_give isl_printer *isl_printer_yaml_start_mapping(
4597                 __isl_take isl_printer *p);
4598         __isl_give isl_printer *isl_printer_yaml_end_mapping(
4599                 __isl_take isl_printer *p);
4600         __isl_give isl_printer *isl_printer_yaml_start_sequence(
4601                 __isl_take isl_printer *p);
4602         __isl_give isl_printer *isl_printer_yaml_end_sequence(
4603                 __isl_take isl_printer *p);
4604         __isl_give isl_printer *isl_printer_yaml_next(
4605                 __isl_take isl_printer *p);
4607 A document is started by a call to either
4608 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
4609 Anything printed to the printer after such a call belong to the
4610 first key of the mapping or the first element in the sequence.
4611 The function C<isl_printer_yaml_next> moves to the value if
4612 we are currently printing a mapping key, the next key if we
4613 are printing a value or the next element if we are printing
4614 an element in a sequence.
4615 Nested mappings and sequences are initiated by the same
4616 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
4617 Each call to these functions needs to have a corresponding call to
4618 C<isl_printer_yaml_end_mapping> or C<isl_printer_yaml_end_sequence>.
4620 When called on a file printer, the following function flushes
4621 the file.  When called on a string printer, the buffer is cleared.
4623         __isl_give isl_printer *isl_printer_flush(
4624                 __isl_take isl_printer *p);
4626 The following functions allow the user to attach
4627 notes to a printer in order to keep track of additional state.
4629         #include <isl/printer.h>
4630         isl_bool isl_printer_has_note(__isl_keep isl_printer *p,
4631                 __isl_keep isl_id *id);
4632         __isl_give isl_id *isl_printer_get_note(
4633                 __isl_keep isl_printer *p, __isl_take isl_id *id);
4634         __isl_give isl_printer *isl_printer_set_note(
4635                 __isl_take isl_printer *p,
4636                 __isl_take isl_id *id, __isl_take isl_id *note);
4638 C<isl_printer_set_note> associates the given note to the given
4639 identifier in the printer.
4640 C<isl_printer_get_note> retrieves a note associated to an
4641 identifier, while
4642 C<isl_printer_has_note> checks if there is such a note.
4643 C<isl_printer_get_note> fails if the requested note does not exist.
4645 Alternatively, a string representation can be obtained
4646 directly using the following functions, which always print
4647 in isl format.
4649         #include <isl/id.h>
4650         __isl_give char *isl_id_to_str(
4651                 __isl_keep isl_id *id);
4652         __isl_give char *isl_multi_id_to_str(
4653                 __isl_keep isl_multi_id *mi);
4655         #include <isl/space.h>
4656         __isl_give char *isl_space_to_str(
4657                 __isl_keep isl_space *space);
4659         #include <isl/val.h>
4660         __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
4661         __isl_give char *isl_multi_val_to_str(
4662                 __isl_keep isl_multi_val *mv);
4664         #include <isl/set.h>
4665         __isl_give char *isl_basic_set_to_str(
4666                 __isl_keep isl_basic_set *bset);
4667         __isl_give char *isl_set_to_str(
4668                 __isl_keep isl_set *set);
4670         #include <isl/union_set.h>
4671         __isl_give char *isl_union_set_to_str(
4672                 __isl_keep isl_union_set *uset);
4674         #include <isl/map.h>
4675         __isl_give char *isl_basic_map_to_str(
4676                 __isl_keep isl_basic_map *bmap);
4677         __isl_give char *isl_map_to_str(
4678                 __isl_keep isl_map *map);
4680         #include <isl/union_map.h>
4681         __isl_give char *isl_union_map_to_str(
4682                 __isl_keep isl_union_map *umap);
4684         #include <isl/aff.h>
4685         __isl_give char *isl_aff_to_str(__isl_keep isl_aff *aff);
4686         __isl_give char *isl_pw_aff_to_str(
4687                 __isl_keep isl_pw_aff *pa);
4688         __isl_give char *isl_multi_aff_to_str(
4689                 __isl_keep isl_multi_aff *ma);
4690         __isl_give char *isl_pw_multi_aff_to_str(
4691                 __isl_keep isl_pw_multi_aff *pma);
4692         __isl_give char *isl_multi_pw_aff_to_str(
4693                 __isl_keep isl_multi_pw_aff *mpa);
4694         __isl_give char *isl_union_pw_aff_to_str(
4695                 __isl_keep isl_union_pw_aff *upa);
4696         __isl_give char *isl_union_pw_multi_aff_to_str(
4697                 __isl_keep isl_union_pw_multi_aff *upma);
4698         __isl_give char *isl_multi_union_pw_aff_to_str(
4699                 __isl_keep isl_multi_union_pw_aff *mupa);
4701         #include <isl/point.h>
4702         __isl_give char *isl_point_to_str(
4703                 __isl_keep isl_point *pnt);
4705         #include <isl/polynomial.h>
4706         __isl_give char *isl_pw_qpolynomial_to_str(
4707                 __isl_keep isl_pw_qpolynomial *pwqp);
4708         __isl_give char *isl_union_pw_qpolynomial_to_str(
4709                 __isl_keep isl_union_pw_qpolynomial *upwqp);
4711 =head2 Properties
4713 =head3 Unary Properties
4715 =over
4717 =item * Emptiness
4719 The following functions test whether the given set or relation
4720 contains any integer points.  The ``plain'' variants do not perform
4721 any computations, but simply check if the given set or relation
4722 is already known to be empty.
4724         #include <isl/set.h>
4725         isl_bool isl_basic_set_plain_is_empty(
4726                 __isl_keep isl_basic_set *bset);
4727         isl_bool isl_basic_set_is_empty(
4728                 __isl_keep isl_basic_set *bset);
4729         isl_bool isl_set_plain_is_empty(
4730                 __isl_keep isl_set *set);
4731         isl_bool isl_set_is_empty(__isl_keep isl_set *set);
4733         #include <isl/union_set.h>
4734         isl_bool isl_union_set_is_empty(
4735                 __isl_keep isl_union_set *uset);
4737         #include <isl/map.h>
4738         isl_bool isl_basic_map_plain_is_empty(
4739                 __isl_keep isl_basic_map *bmap);
4740         isl_bool isl_basic_map_is_empty(
4741                 __isl_keep isl_basic_map *bmap);
4742         isl_bool isl_map_plain_is_empty(
4743                 __isl_keep isl_map *map);
4744         isl_bool isl_map_is_empty(__isl_keep isl_map *map);
4746         #include <isl/union_map.h>
4747         isl_bool isl_union_map_plain_is_empty(
4748                 __isl_keep isl_union_map *umap);
4749         isl_bool isl_union_map_is_empty(
4750                 __isl_keep isl_union_map *umap);
4752         #include <isl/aff.h>
4753         isl_bool isl_union_pw_multi_aff_plain_is_empty(
4754                 __isl_keep isl_union_pw_multi_aff *upma);
4756 =item * Universality
4758         isl_bool isl_basic_set_plain_is_universe(
4759                 __isl_keep isl_basic_set *bset);
4760         isl_bool isl_basic_set_is_universe(
4761                 __isl_keep isl_basic_set *bset);
4762         isl_bool isl_basic_map_plain_is_universe(
4763                 __isl_keep isl_basic_map *bmap);
4764         isl_bool isl_basic_map_is_universe(
4765                 __isl_keep isl_basic_map *bmap);
4766         isl_bool isl_set_plain_is_universe(
4767                 __isl_keep isl_set *set);
4768         isl_bool isl_map_plain_is_universe(
4769                 __isl_keep isl_map *map);
4771 =item * Single-valuedness
4773         #include <isl/set.h>
4774         isl_bool isl_set_is_singleton(__isl_keep isl_set *set);
4776         #include <isl/map.h>
4777         isl_bool isl_basic_map_is_single_valued(
4778                 __isl_keep isl_basic_map *bmap);
4779         isl_bool isl_map_plain_is_single_valued(
4780                 __isl_keep isl_map *map);
4781         isl_bool isl_map_is_single_valued(__isl_keep isl_map *map);
4783         #include <isl/union_map.h>
4784         isl_bool isl_union_map_is_single_valued(
4785                 __isl_keep isl_union_map *umap);
4787 =item * Injectivity
4789         isl_bool isl_map_plain_is_injective(
4790                 __isl_keep isl_map *map);
4791         isl_bool isl_map_is_injective(
4792                 __isl_keep isl_map *map);
4793         isl_bool isl_union_map_plain_is_injective(
4794                 __isl_keep isl_union_map *umap);
4795         isl_bool isl_union_map_is_injective(
4796                 __isl_keep isl_union_map *umap);
4798 =item * Bijectivity
4800         isl_bool isl_map_is_bijective(
4801                 __isl_keep isl_map *map);
4802         isl_bool isl_union_map_is_bijective(
4803                 __isl_keep isl_union_map *umap);
4805 =item * Identity
4807 The following functions test whether the given relation
4808 only maps elements to themselves.
4810         #include <isl/map.h>
4811         isl_bool isl_map_is_identity(
4812                 __isl_keep isl_map *map);
4814         #include <isl/union_map.h>
4815         isl_bool isl_union_map_is_identity(
4816                 __isl_keep isl_union_map *umap);
4818 =item * Position
4820         __isl_give isl_val *
4821         isl_basic_map_plain_get_val_if_fixed(
4822                 __isl_keep isl_basic_map *bmap,
4823                 enum isl_dim_type type, unsigned pos);
4824         __isl_give isl_val *isl_set_plain_get_val_if_fixed(
4825                 __isl_keep isl_set *set,
4826                 enum isl_dim_type type, unsigned pos);
4827         __isl_give isl_multi_val *
4828         isl_set_get_plain_multi_val_if_fixed(
4829                 __isl_keep isl_set *set);
4830         __isl_give isl_val *isl_map_plain_get_val_if_fixed(
4831                 __isl_keep isl_map *map,
4832                 enum isl_dim_type type, unsigned pos);
4834 If the set or relation obviously lies on a hyperplane where the given dimension
4835 has a fixed value, then return that value.
4836 Otherwise return NaN.
4837 C<isl_set_get_plain_multi_val_if_fixed> collects the results over
4838 all set dimensions.
4840 =item * Stride
4842 Stride detection is based on heuristics.
4843 The strides returned by the functions below are always valid,
4844 but there may be larger valid strides that are not detected.
4846         isl_stat isl_set_dim_residue_class_val(
4847                 __isl_keep isl_set *set,
4848                 int pos, __isl_give isl_val **modulo,
4849                 __isl_give isl_val **residue);
4851 Check if the values of the given set dimension are equal to a fixed
4852 value modulo some integer value.  If so, assign the modulo to C<*modulo>
4853 and the fixed value to C<*residue>.  If the given dimension attains only
4854 a single value, then assign C<0> to C<*modulo> and the fixed value to
4855 C<*residue>.
4856 If the dimension does not attain only a single value and if no modulo
4857 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
4859         #include <isl/set.h>
4860         __isl_give isl_stride_info *isl_set_get_stride_info(
4861                 __isl_keep isl_set *set, int pos);
4862         __isl_give isl_val *isl_set_get_stride(
4863                 __isl_keep isl_set *set, int pos);
4864         __isl_give isl_fixed_box *isl_set_get_lattice_tile(
4865                 __isl_keep isl_set *set);
4867         #include <isl/map.h>
4868         __isl_give isl_stride_info *
4869         isl_map_get_range_stride_info(
4870                 __isl_keep isl_map *map, int pos);
4871         __isl_give isl_fixed_box *
4872         isl_map_get_range_lattice_tile(
4873                 __isl_keep isl_map *map);
4875 Check if the values of the given set dimension are equal to
4876 some affine expression of the other dimensions (the offset)
4877 modulo some integer stride or
4878 check if the values of the given output dimensions are equal to
4879 some affine expression of the input dimensions (the offset)
4880 modulo some integer stride.
4881 If no more specific information can be found, then the stride
4882 is taken to be one and the offset is taken to be the zero expression.
4883 The function C<isl_set_get_stride> performs the same
4884 computation as C<isl_set_get_stride_info> but only returns the stride.
4885 The function C<isl_map_get_range_lattice_tile> collects the stride
4886 information over all output dimensions.
4887 In particular, it returns a tile of a rectangular lattice
4888 (possibly of size 1 in all directions)
4889 containing the output in terms of the parameters and the input dimensions.
4890 The size and the offset of this tile correspond to
4891 the strides and the offsets of the stride information and
4892 can be extracted from the returned
4893 C<isl_fixed_box> using the functions described under "Box hull" in
4894 L</"Unary Operations">.  Note that the C<isl_fixed_box> object returned by
4895 C<isl_map_get_range_lattice_tile> is always valid.
4896 The function C<isl_set_get_lattice_tile> collects the same stride
4897 information over all set dimensions.
4898 For the other functions,
4899 the stride and offset can be extracted from the returned object
4900 using the following functions.
4902         #include <isl/stride_info.h>
4903         __isl_give isl_val *isl_stride_info_get_stride(
4904                 __isl_keep isl_stride_info *si);
4905         __isl_give isl_aff *isl_stride_info_get_offset(
4906                 __isl_keep isl_stride_info *si);
4908 The stride info object can be copied and released using the following
4909 functions.
4911         #include <isl/stride_info.h>
4912         __isl_give isl_stride_info *isl_stride_info_copy(
4913                 __isl_keep isl_stride_info *si);
4914         __isl_null isl_stride_info *isl_stride_info_free(
4915                 __isl_take isl_stride_info *si);
4917 =item * Dependence
4919 To check whether a function involves any local variables,
4920 i.e., integer divisions,
4921 the following functions can be used.
4923         #include <isl/set.h>
4924         isl_bool isl_set_involves_locals(
4925                 __isl_keep isl_set *set);
4927         #include <isl/aff.h>
4928         isl_bool isl_aff_involves_locals(
4929                 __isl_keep isl_aff *aff);
4930         isl_bool isl_multi_aff_involves_locals(
4931                 __isl_keep isl_multi_aff *ma);
4932         isl_bool isl_pw_multi_aff_involves_locals(
4933                 __isl_keep isl_pw_multi_aff *pma);
4934         isl_bool isl_union_pw_multi_aff_involves_locals(
4935                 __isl_keep isl_union_pw_multi_aff *upma);
4937 To check whether the description of a set, relation or function depends
4938 on a parameter or one or more given dimensions,
4939 the following functions can be used.
4941         #include <isl/constraint.h>
4942         isl_bool isl_constraint_involves_dims(
4943                 __isl_keep isl_constraint *constraint,
4944                 enum isl_dim_type type, unsigned first, unsigned n);
4946         #include <isl/set.h>
4947         isl_bool isl_basic_set_involves_dims(
4948                 __isl_keep isl_basic_set *bset,
4949                 enum isl_dim_type type, unsigned first, unsigned n);
4950         isl_bool isl_set_involves_dims(__isl_keep isl_set *set,
4951                 enum isl_dim_type type, unsigned first, unsigned n);
4953         #include <isl/map.h>
4954         isl_bool isl_basic_map_involves_dims(
4955                 __isl_keep isl_basic_map *bmap,
4956                 enum isl_dim_type type, unsigned first, unsigned n);
4957         isl_bool isl_map_involves_dims(__isl_keep isl_map *map,
4958                 enum isl_dim_type type, unsigned first, unsigned n);
4960         #include <isl/union_map.h>
4961         isl_bool isl_union_map_involves_dims(
4962                 __isl_keep isl_union_map *umap,
4963                 enum isl_dim_type type, unsigned first, unsigned n);
4965         #include <isl/aff.h>
4966         isl_bool isl_aff_involves_dims(__isl_keep isl_aff *aff,
4967                 enum isl_dim_type type, unsigned first, unsigned n);
4968         isl_bool isl_pw_aff_involves_param_id(
4969                 __isl_keep isl_pw_aff *pa,
4970                 __isl_keep isl_id *id);
4971         isl_bool isl_pw_aff_involves_dims(
4972                 __isl_keep isl_pw_aff *pwaff,
4973                 enum isl_dim_type type, unsigned first, unsigned n);
4974         isl_bool isl_multi_aff_involves_dims(
4975                 __isl_keep isl_multi_aff *ma,
4976                 enum isl_dim_type type, unsigned first, unsigned n);
4977         isl_bool isl_pw_multi_aff_involves_param_id(
4978                 __isl_keep isl_pw_multi_aff *pma,
4979                 __isl_keep isl_id *id);
4980         isl_bool isl_pw_multi_aff_involves_dims(
4981                 __isl_keep isl_pw_multi_aff *pma,
4982                 enum isl_dim_type type, unsigned first, unsigned n);
4983         isl_bool isl_multi_pw_aff_involves_dims(
4984                 __isl_keep isl_multi_pw_aff *mpa,
4985                 enum isl_dim_type type, unsigned first, unsigned n);
4986         isl_bool isl_multi_pw_aff_involves_param_id(
4987                 __isl_keep isl_multi_pw_aff *mpa,
4988                 __isl_keep isl_id *id);
4989         isl_bool isl_multi_pw_aff_involves_param_id_list(
4990                 __isl_keep isl_multi_pw_aff *mpa,
4991                 __isl_keep isl_id_list *list);
4993         #include <isl/polynomial.h>
4994         isl_bool isl_qpolynomial_involves_dims(
4995                 __isl_keep isl_qpolynomial *qp,
4996                 enum isl_dim_type type, unsigned first, unsigned n);
4997         isl_bool isl_pw_qpolynomial_involves_param_id(
4998                 __isl_keep isl_pw_qpolynomial *pwqp,
4999                 __isl_keep isl_id *id);
5000         isl_bool isl_pw_qpolynomial_fold_involves_param_id(
5001                 __isl_keep isl_pw_qpolynomial_fold *pwf,
5002                 __isl_keep isl_id *id);
5004 Similarly, the following functions can be used to check whether
5005 a given dimension is involved in any lower or upper bound.
5007         #include <isl/set.h>
5008         isl_bool isl_set_dim_has_any_lower_bound(
5009                 __isl_keep isl_set *set,
5010                 enum isl_dim_type type, unsigned pos);
5011         isl_bool isl_set_dim_has_any_upper_bound(
5012                 __isl_keep isl_set *set,
5013                 enum isl_dim_type type, unsigned pos);
5015 Note that these functions return true even if there is a bound on
5016 the dimension on only some of the basic sets of C<set>.
5017 To check if they have a bound for all of the basic sets in C<set>,
5018 use the following functions instead.
5020         #include <isl/set.h>
5021         isl_bool isl_set_dim_has_lower_bound(
5022                 __isl_keep isl_set *set,
5023                 enum isl_dim_type type, unsigned pos);
5024         isl_bool isl_set_dim_has_upper_bound(
5025                 __isl_keep isl_set *set,
5026                 enum isl_dim_type type, unsigned pos);
5028 =item * Space
5030 To check whether a set is a parameter domain, use this function:
5032         isl_bool isl_set_is_params(__isl_keep isl_set *set);
5033         isl_bool isl_union_set_is_params(
5034                 __isl_keep isl_union_set *uset);
5036 =item * Wrapping
5038 The following functions check whether the space of the given
5039 (basic) set or relation domain and/or range is a wrapped relation.
5041         #include <isl/space.h>
5042         isl_bool isl_space_is_wrapping(
5043                 __isl_keep isl_space *space);
5044         isl_bool isl_space_domain_is_wrapping(
5045                 __isl_keep isl_space *space);
5046         isl_bool isl_space_range_is_wrapping(
5047                 __isl_keep isl_space *space);
5048         isl_bool isl_space_is_product(
5049                 __isl_keep isl_space *space);
5051         #include <isl/set.h>
5052         isl_bool isl_basic_set_is_wrapping(
5053                 __isl_keep isl_basic_set *bset);
5054         isl_bool isl_set_is_wrapping(__isl_keep isl_set *set);
5056         #include <isl/map.h>
5057         isl_bool isl_map_domain_is_wrapping(
5058                 __isl_keep isl_map *map);
5059         isl_bool isl_map_range_is_wrapping(
5060                 __isl_keep isl_map *map);
5061         isl_bool isl_map_is_product(__isl_keep isl_map *map);
5063         #include <isl/id.h>
5064         isl_bool isl_multi_id_range_is_wrapping(
5065                 __isl_keep isl_multi_id *mi);
5067         #include <isl/val.h>
5068         isl_bool isl_multi_val_range_is_wrapping(
5069                 __isl_keep isl_multi_val *mv);
5071         #include <isl/aff.h>
5072         isl_bool isl_multi_aff_range_is_wrapping(
5073                 __isl_keep isl_multi_aff *ma);
5074         isl_bool isl_multi_pw_aff_range_is_wrapping(
5075                 __isl_keep isl_multi_pw_aff *mpa);
5076         isl_bool isl_multi_union_pw_aff_range_is_wrapping(
5077                 __isl_keep isl_multi_union_pw_aff *mupa);
5079 The input to C<isl_space_is_wrapping> should
5080 be the space of a set, while that of
5081 C<isl_space_domain_is_wrapping> and
5082 C<isl_space_range_is_wrapping> should be the space of a relation.
5083 The input to C<isl_space_is_product> can be either the space
5084 of a set or that of a binary relation.
5085 In case the input is the space of a binary relation, it checks
5086 whether both domain and range are wrapping.
5088 =item * Internal Product
5090         isl_bool isl_basic_map_can_zip(
5091                 __isl_keep isl_basic_map *bmap);
5092         isl_bool isl_map_can_zip(__isl_keep isl_map *map);
5094 Check whether the product of domain and range of the given relation
5095 can be computed,
5096 i.e., whether both domain and range are nested relations.
5098 =item * Currying
5100         #include <isl/space.h>
5101         isl_bool isl_space_can_curry(
5102                 __isl_keep isl_space *space);
5104         #include <isl/map.h>
5105         isl_bool isl_basic_map_can_curry(
5106                 __isl_keep isl_basic_map *bmap);
5107         isl_bool isl_map_can_curry(__isl_keep isl_map *map);
5109 Check whether the domain of the (basic) relation is a wrapped relation.
5111         #include <isl/space.h>
5112         isl_bool isl_space_can_uncurry(
5113                 __isl_keep isl_space *space);
5115         #include <isl/map.h>
5116         isl_bool isl_basic_map_can_uncurry(
5117                 __isl_keep isl_basic_map *bmap);
5118         isl_bool isl_map_can_uncurry(__isl_keep isl_map *map);
5120 Check whether the range of the (basic) relation is a wrapped relation.
5122         #include <isl/space.h>
5123         isl_bool isl_space_can_range_curry(
5124                 __isl_keep isl_space *space);
5126         #include <isl/map.h>
5127         isl_bool isl_map_can_range_curry(
5128                 __isl_keep isl_map *map);
5130 Check whether the domain of the relation wrapped in the range of
5131 the input is itself a wrapped relation.
5133 =item * Special Values
5135         #include <isl/aff.h>
5136         isl_bool isl_aff_is_cst(__isl_keep isl_aff *aff);
5137         isl_bool isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
5138         isl_bool isl_multi_pw_aff_is_cst(
5139                 __isl_keep isl_multi_pw_aff *mpa);
5141 Check whether the given expression is a constant.
5143         #include <isl/val.h>
5144         isl_bool isl_multi_val_involves_nan(
5145                 __isl_keep isl_multi_val *mv);
5147         #include <isl/aff.h>
5148         isl_bool isl_aff_is_nan(__isl_keep isl_aff *aff);
5149         isl_bool isl_multi_aff_involves_nan(
5150                 __isl_keep isl_multi_aff *ma);
5151         isl_bool isl_pw_aff_involves_nan(
5152                 __isl_keep isl_pw_aff *pa);
5153         isl_bool isl_pw_multi_aff_involves_nan(
5154                 __isl_keep isl_pw_multi_aff *pma);
5155         isl_bool isl_multi_pw_aff_involves_nan(
5156                 __isl_keep isl_multi_pw_aff *mpa);
5157         isl_bool isl_union_pw_aff_involves_nan(
5158                 __isl_keep isl_union_pw_aff *upa);
5159         isl_bool isl_union_pw_multi_aff_involves_nan(
5160                 __isl_keep isl_union_pw_multi_aff *upma);
5161         isl_bool isl_multi_union_pw_aff_involves_nan(
5162                 __isl_keep isl_multi_union_pw_aff *mupa);
5164         #include <isl/polynomial.h>
5165         isl_bool isl_qpolynomial_is_nan(
5166                 __isl_keep isl_qpolynomial *qp);
5167         isl_bool isl_qpolynomial_fold_is_nan(
5168                 __isl_keep isl_qpolynomial_fold *fold);
5169         isl_bool isl_pw_qpolynomial_involves_nan(
5170                 __isl_keep isl_pw_qpolynomial *pwqp);
5171         isl_bool isl_pw_qpolynomial_fold_involves_nan(
5172                 __isl_keep isl_pw_qpolynomial_fold *pwf);
5173         isl_bool isl_union_pw_qpolynomial_involves_nan(
5174                 __isl_keep isl_union_pw_qpolynomial *upwqp);
5175         isl_bool isl_union_pw_qpolynomial_fold_involves_nan(
5176                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
5178 Check whether the given expression is equal to or involves NaN.
5180         #include <isl/val.h>
5181         isl_bool isl_multi_val_is_zero(
5182                 __isl_keep isl_multi_val *mv);
5184 Check whether the multiple value is zero.
5186         #include <isl/aff.h>
5187         isl_bool isl_aff_plain_is_zero(
5188                 __isl_keep isl_aff *aff);
5190 Check whether the affine expression is obviously zero.
5192 =back
5194 =head3 Binary Properties
5196 =over
5198 =item * Equality
5200 The following functions check whether two objects
5201 represent the same set, relation or function.
5202 The C<plain> variants only return true if the objects
5203 are obviously the same.  That is, they may return false
5204 even if the objects are the same, but they will never
5205 return true if the objects are not the same.
5207         #include <isl/set.h>
5208         isl_bool isl_basic_set_plain_is_equal(
5209                 __isl_keep isl_basic_set *bset1,
5210                 __isl_keep isl_basic_set *bset2);
5211         isl_bool isl_basic_set_is_equal(
5212                 __isl_keep isl_basic_set *bset1,
5213                 __isl_keep isl_basic_set *bset2);
5214         isl_bool isl_set_plain_is_equal(
5215                 __isl_keep isl_set *set1,
5216                 __isl_keep isl_set *set2);
5217         isl_bool isl_set_is_equal(__isl_keep isl_set *set1,
5218                 __isl_keep isl_set *set2);
5220         #include <isl/map.h>
5221         isl_bool isl_basic_map_is_equal(
5222                 __isl_keep isl_basic_map *bmap1,
5223                 __isl_keep isl_basic_map *bmap2);
5224         isl_bool isl_map_is_equal(__isl_keep isl_map *map1,
5225                 __isl_keep isl_map *map2);
5226         isl_bool isl_map_plain_is_equal(
5227                 __isl_keep isl_map *map1,
5228                 __isl_keep isl_map *map2);
5230         #include <isl/union_set.h>
5231         isl_bool isl_union_set_is_equal(
5232                 __isl_keep isl_union_set *uset1,
5233                 __isl_keep isl_union_set *uset2);
5235         #include <isl/union_map.h>
5236         isl_bool isl_union_map_is_equal(
5237                 __isl_keep isl_union_map *umap1,
5238                 __isl_keep isl_union_map *umap2);
5240         #include <isl/id.h>
5241         isl_bool isl_multi_id_plain_is_equal(
5242                 __isl_keep isl_multi_id *mi1,
5243                 __isl_keep isl_multi_id *mi2);
5245         #include <isl/val.h>
5246         isl_bool isl_multi_val_plain_is_equal(
5247                 __isl_keep isl_multi_val *mv1,
5248                 __isl_keep isl_multi_val *mv2);
5250         #include <isl/aff.h>
5251         isl_bool isl_aff_plain_is_equal(
5252                 __isl_keep isl_aff *aff1,
5253                 __isl_keep isl_aff *aff2);
5254         isl_bool isl_multi_aff_plain_is_equal(
5255                 __isl_keep isl_multi_aff *maff1,
5256                 __isl_keep isl_multi_aff *maff2);
5257         isl_bool isl_pw_aff_plain_is_equal(
5258                 __isl_keep isl_pw_aff *pwaff1,
5259                 __isl_keep isl_pw_aff *pwaff2);
5260         isl_bool isl_pw_aff_is_equal(
5261                 __isl_keep isl_pw_aff *pa1,
5262                 __isl_keep isl_pw_aff *pa2);
5263         isl_bool isl_pw_multi_aff_plain_is_equal(
5264                 __isl_keep isl_pw_multi_aff *pma1,
5265                 __isl_keep isl_pw_multi_aff *pma2);
5266         isl_bool isl_pw_multi_aff_is_equal(
5267                 __isl_keep isl_pw_multi_aff *pma1,
5268                 __isl_keep isl_pw_multi_aff *pma2);
5269         isl_bool isl_multi_pw_aff_plain_is_equal(
5270                 __isl_keep isl_multi_pw_aff *mpa1,
5271                 __isl_keep isl_multi_pw_aff *mpa2);
5272         isl_bool isl_multi_pw_aff_is_equal(
5273                 __isl_keep isl_multi_pw_aff *mpa1,
5274                 __isl_keep isl_multi_pw_aff *mpa2);
5275         isl_bool isl_union_pw_aff_plain_is_equal(
5276                 __isl_keep isl_union_pw_aff *upa1,
5277                 __isl_keep isl_union_pw_aff *upa2);
5278         isl_bool isl_union_pw_multi_aff_plain_is_equal(
5279                 __isl_keep isl_union_pw_multi_aff *upma1,
5280                 __isl_keep isl_union_pw_multi_aff *upma2);
5281         isl_bool isl_multi_union_pw_aff_plain_is_equal(
5282                 __isl_keep isl_multi_union_pw_aff *mupa1,
5283                 __isl_keep isl_multi_union_pw_aff *mupa2);
5285         #include <isl/polynomial.h>
5286         isl_bool isl_union_pw_qpolynomial_plain_is_equal(
5287                 __isl_keep isl_union_pw_qpolynomial *upwqp1,
5288                 __isl_keep isl_union_pw_qpolynomial *upwqp2);
5289         isl_bool isl_union_pw_qpolynomial_fold_plain_is_equal(
5290                 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
5291                 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
5293 =item * Disjointness
5295         #include <isl/set.h>
5296         isl_bool isl_basic_set_is_disjoint(
5297                 __isl_keep isl_basic_set *bset1,
5298                 __isl_keep isl_basic_set *bset2);
5299         isl_bool isl_set_plain_is_disjoint(
5300                 __isl_keep isl_set *set1,
5301                 __isl_keep isl_set *set2);
5302         isl_bool isl_set_is_disjoint(__isl_keep isl_set *set1,
5303                 __isl_keep isl_set *set2);
5305         #include <isl/map.h>
5306         isl_bool isl_basic_map_is_disjoint(
5307                 __isl_keep isl_basic_map *bmap1,
5308                 __isl_keep isl_basic_map *bmap2);
5309         isl_bool isl_map_is_disjoint(__isl_keep isl_map *map1,
5310                 __isl_keep isl_map *map2);
5312         #include <isl/union_set.h>
5313         isl_bool isl_union_set_is_disjoint(
5314                 __isl_keep isl_union_set *uset1,
5315                 __isl_keep isl_union_set *uset2);
5317         #include <isl/union_map.h>
5318         isl_bool isl_union_map_is_disjoint(
5319                 __isl_keep isl_union_map *umap1,
5320                 __isl_keep isl_union_map *umap2);
5322 =item * Subset
5324         isl_bool isl_basic_set_is_subset(
5325                 __isl_keep isl_basic_set *bset1,
5326                 __isl_keep isl_basic_set *bset2);
5327         isl_bool isl_set_is_subset(__isl_keep isl_set *set1,
5328                 __isl_keep isl_set *set2);
5329         isl_bool isl_set_is_strict_subset(
5330                 __isl_keep isl_set *set1,
5331                 __isl_keep isl_set *set2);
5332         isl_bool isl_union_set_is_subset(
5333                 __isl_keep isl_union_set *uset1,
5334                 __isl_keep isl_union_set *uset2);
5335         isl_bool isl_union_set_is_strict_subset(
5336                 __isl_keep isl_union_set *uset1,
5337                 __isl_keep isl_union_set *uset2);
5338         isl_bool isl_basic_map_is_subset(
5339                 __isl_keep isl_basic_map *bmap1,
5340                 __isl_keep isl_basic_map *bmap2);
5341         isl_bool isl_basic_map_is_strict_subset(
5342                 __isl_keep isl_basic_map *bmap1,
5343                 __isl_keep isl_basic_map *bmap2);
5344         isl_bool isl_map_is_subset(
5345                 __isl_keep isl_map *map1,
5346                 __isl_keep isl_map *map2);
5347         isl_bool isl_map_is_strict_subset(
5348                 __isl_keep isl_map *map1,
5349                 __isl_keep isl_map *map2);
5350         isl_bool isl_union_map_is_subset(
5351                 __isl_keep isl_union_map *umap1,
5352                 __isl_keep isl_union_map *umap2);
5353         isl_bool isl_union_map_is_strict_subset(
5354                 __isl_keep isl_union_map *umap1,
5355                 __isl_keep isl_union_map *umap2);
5357 Check whether the first argument is a (strict) subset of the
5358 second argument.
5360 =item * Order
5362 Every comparison function returns a negative value if the first
5363 argument is considered smaller than the second, a positive value
5364 if the first argument is considered greater and zero if the two
5365 constraints are considered the same by the comparison criterion.
5367         #include <isl/constraint.h>
5368         int isl_constraint_plain_cmp(
5369                 __isl_keep isl_constraint *c1,
5370                 __isl_keep isl_constraint *c2);
5372 This function is useful for sorting C<isl_constraint>s.
5373 The order depends on the internal representation of the inputs.
5374 The order is fixed over different calls to the function (assuming
5375 the internal representation of the inputs has not changed), but may
5376 change over different versions of C<isl>.
5378         #include <isl/constraint.h>
5379         int isl_constraint_cmp_last_non_zero(
5380                 __isl_keep isl_constraint *c1,
5381                 __isl_keep isl_constraint *c2);
5383 This function can be used to sort constraints that live in the same
5384 local space.  Constraints that involve ``earlier'' dimensions or
5385 that have a smaller coefficient for the shared latest dimension
5386 are considered smaller than other constraints.
5387 This function only defines a B<partial> order.
5389         #include <isl/set.h>
5390         int isl_set_plain_cmp(__isl_keep isl_set *set1,
5391                 __isl_keep isl_set *set2);
5393 This function is useful for sorting C<isl_set>s.
5394 The order depends on the internal representation of the inputs.
5395 The order is fixed over different calls to the function (assuming
5396 the internal representation of the inputs has not changed), but may
5397 change over different versions of C<isl>.
5399         #include <isl/aff.h>
5400         int isl_multi_aff_plain_cmp(
5401                 __isl_keep isl_multi_aff *ma1,
5402                 __isl_keep isl_multi_aff *ma2);
5403         int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
5404                 __isl_keep isl_pw_aff *pa2);
5406 The functions C<isl_multi_aff_plain_cmp> and
5407 C<isl_pw_aff_plain_cmp> can be used to sort C<isl_multi_aff>s and
5408 C<isl_pw_aff>s.  The order is not strictly defined.
5409 The current order sorts expressions that only involve
5410 earlier dimensions before those that involve later dimensions.
5412 =back
5414 =head2 Unary Operations
5416 =over
5418 =item * Complement
5420         __isl_give isl_set *isl_set_complement(
5421                 __isl_take isl_set *set);
5422         __isl_give isl_map *isl_map_complement(
5423                 __isl_take isl_map *map);
5425 =item * Inverse map
5427         #include <isl/space.h>
5428         __isl_give isl_space *isl_space_reverse(
5429                 __isl_take isl_space *space);
5430         __isl_give isl_space *isl_space_wrapped_reverse(
5431                 __isl_take isl_space *space);
5432         __isl_give isl_space *isl_space_domain_reverse(
5433                 __isl_take isl_space *space);
5434         __isl_give isl_space *isl_space_range_reverse(
5435                 __isl_take isl_space *space);
5437         #include <isl/aff.h>
5438         __isl_give isl_aff *isl_aff_domain_reverse(
5439                 __isl_take isl_aff *aff);
5440         __isl_give isl_multi_aff *
5441         isl_multi_aff_domain_reverse(
5442                 __isl_take isl_multi_aff *ma);
5443         __isl_give isl_pw_aff *isl_pw_aff_domain_reverse(
5444                 __isl_take isl_pw_aff *pa);
5445         __isl_give isl_pw_multi_aff *
5446         isl_pw_multi_aff_domain_reverse(
5447                 __isl_take isl_pw_multi_aff *pma);
5448         __isl_give isl_multi_pw_aff *
5449         isl_multi_pw_aff_domain_reverse(
5450                 __isl_take isl_multi_pw_aff *mpa);
5452         #include <isl/set.h>
5453         __isl_give isl_set *isl_set_wrapped_reverse(
5454                 __isl_take isl_set *set);
5456         #include <isl/map.h>
5457         __isl_give isl_basic_map *isl_basic_map_reverse(
5458                 __isl_take isl_basic_map *bmap);
5459         __isl_give isl_map *isl_map_reverse(
5460                 __isl_take isl_map *map);
5461         __isl_give isl_map *isl_map_domain_reverse(
5462                 __isl_take isl_map *map);
5463         __isl_give isl_map *isl_map_range_reverse(
5464                 __isl_take isl_map *map);
5466         #include <isl/union_map.h>
5467         __isl_give isl_union_map *isl_union_map_reverse(
5468                 __isl_take isl_union_map *umap);
5469         __isl_give isl_union_map *isl_union_map_domain_reverse(
5470                 __isl_take isl_union_map *umap);
5471         __isl_give isl_union_map *isl_union_map_range_reverse(
5472                 __isl_take isl_union_map *umap);
5474         #include <isl/polynomial.h>
5475         __isl_give isl_qpolynomial *
5476         isl_qpolynomial_domain_reverse(
5477                 __isl_take isl_qpolynomial *qp);
5478         __isl_give isl_pw_qpolynomial *
5479         isl_pw_qpolynomial_domain_reverse(
5480                 __isl_take isl_pw_qpolynomial *pwqp);
5481         __isl_give isl_union_pw_qpolynomial *
5482         isl_union_pw_qpolynomial_domain_reverse(
5483                 __isl_take isl_union_pw_qpolynomial *upwqp);
5485 The function C<isl_space_range_reverse> reverses the relation
5486 that is embedded in the range of the input map space.
5487 The identifier of the range, if any, is only preserved
5488 if this embedded relation has identical input and output tuples.
5489 Similarly for C<isl_space_domain_reverse>.
5490 Along the same lines, C<isl_space_wrapped_reverse> reverses
5491 the relation that is embedded in a set space.
5493 =item * Tuple binding
5495 The following function binds
5496 a tuple to a sequence of parameter identifiers, equating
5497 the tuple dimensions to the parameters with those identifiers and
5498 subsequently projecting out the tuple.
5499 If the original object did not reference any such parameters,
5500 then this means that the tuple dimensions are reinterpreted
5501 as parameters.
5502 The space of C<tuple> needs to match that of the bound tuple.
5504         #include <isl/set.h>
5505         __isl_give isl_set *isl_set_bind(
5506                 __isl_take isl_set *set,
5507                 __isl_take isl_multi_id *tuple);
5509         #include <isl/map.h>
5510         __isl_give isl_set *isl_map_bind_domain(
5511                 __isl_take isl_map *map,
5512                 __isl_take isl_multi_id *tuple);
5513         __isl_give isl_set *isl_map_bind_range(
5514                 __isl_take isl_map *map,
5515                 __isl_take isl_multi_id *tuple);
5517         #include <isl/union_map.h>
5518         __isl_give isl_union_set *isl_union_map_bind_range(
5519                 __isl_take isl_union_map *umap,
5520                 __isl_take isl_multi_id *tuple);
5522         #include <isl/aff.h>
5523         __isl_give isl_pw_aff *isl_pw_aff_bind_domain(
5524                 __isl_take isl_pw_aff *pa,
5525                 __isl_take isl_multi_id *tuple);
5526         __isl_give isl_multi_aff *isl_multi_aff_bind_domain(
5527                 __isl_take isl_multi_aff *ma,
5528                 __isl_take isl_multi_id *tuple);
5529         __isl_give isl_pw_multi_aff *
5530         isl_pw_multi_aff_bind_domain(
5531                 __isl_take isl_pw_multi_aff *pma,
5532                 __isl_take isl_multi_id *tuple);
5533         __isl_give isl_multi_pw_aff *
5534         isl_multi_pw_aff_bind_domain(
5535                 __isl_take isl_multi_pw_aff *mpa,
5536                 __isl_take isl_multi_id *tuple);
5537         __isl_give isl_pw_aff *
5538         isl_pw_aff_bind_domain_wrapped_domain(
5539                 __isl_take isl_pw_aff *pa,
5540                 __isl_take isl_multi_id *tuple);
5541         __isl_give isl_multi_aff *
5542         isl_multi_aff_bind_domain_wrapped_domain(
5543                 __isl_take isl_multi_aff *ma,
5544                 __isl_take isl_multi_id *tuple);
5545         __isl_give isl_pw_multi_aff *
5546         isl_pw_multi_aff_bind_domain_wrapped_domain(
5547                 __isl_take isl_pw_multi_aff *pma,
5548                 __isl_take isl_multi_id *tuple);
5549         __isl_give isl_multi_pw_aff *
5550         isl_multi_pw_aff_bind_domain_wrapped_domain(
5551                 __isl_take isl_multi_pw_aff *mpa,
5552                 __isl_take isl_multi_id *tuple);
5553         __isl_give isl_basic_set *isl_aff_bind_id(
5554                 __isl_take isl_aff *aff,
5555                 __isl_take isl_id *id);
5556         __isl_give isl_set *isl_pw_aff_bind_id(
5557                 __isl_take isl_pw_aff *pa,
5558                 __isl_take isl_id *id);
5559         __isl_give isl_basic_set *isl_multi_aff_bind(
5560                 __isl_take isl_multi_aff *ma,
5561                 __isl_take isl_multi_id *tuple);
5562         __isl_give isl_set *isl_multi_pw_aff_bind(
5563                 __isl_take isl_multi_pw_aff *mpa,
5564                 __isl_take isl_multi_id *tuple);
5565         __isl_give isl_union_set *isl_union_pw_aff_bind_id(
5566                 __isl_take isl_union_pw_aff *upa,
5567                 __isl_take isl_id *id);
5568         __isl_give isl_union_set *
5569         isl_multi_union_pw_aff_bind(
5570                 __isl_take isl_multi_union_pw_aff *mupa,
5571                 __isl_take isl_multi_id *tuple);
5573 Projecting out the domain of the wrapped relation in the domain
5574 of a function leaves the range of that wrapped relation
5575 in the domain of the resulting function.
5576 In the case of C<isl_aff_bind_id>, C<isl_pw_aff_bind_id>,
5577 C<isl_multi_aff_bind>, C<isl_multi_pw_aff_bind>,
5578 C<isl_union_pw_aff_bind_id> and
5579 C<isl_multi_union_pw_aff_bind>, the parameters
5580 are bound to the function values and the result lives
5581 in the domain of the input function.
5583 =item * Projection
5585         #include <isl/space.h>
5586         __isl_give isl_space *isl_space_domain(
5587                 __isl_take isl_space *space);
5588         __isl_give isl_space *isl_space_range(
5589                 __isl_take isl_space *space);
5590         __isl_give isl_space *isl_space_params(
5591                 __isl_take isl_space *space);
5592         __isl_give isl_space *
5593         isl_space_domain_wrapped_domain(
5594                 __isl_take isl_space *space);
5595         __isl_give isl_space *
5596         isl_space_domain_wrapped_range(
5597                 __isl_take isl_space *space);
5598         __isl_give isl_space *
5599         isl_space_range_wrapped_domain(
5600                 __isl_take isl_space *space);
5601         __isl_give isl_space *
5602         isl_space_range_wrapped_range(
5603                 __isl_take isl_space *space);
5605         #include <isl/local_space.h>
5606         __isl_give isl_local_space *isl_local_space_domain(
5607                 __isl_take isl_local_space *ls);
5608         __isl_give isl_local_space *isl_local_space_range(
5609                 __isl_take isl_local_space *ls);
5611         #include <isl/set.h>
5612         __isl_give isl_basic_set *isl_basic_set_project_out(
5613                 __isl_take isl_basic_set *bset,
5614                 enum isl_dim_type type, unsigned first, unsigned n);
5615         __isl_give isl_set *isl_set_project_out_param_id(
5616                 __isl_take isl_set *set,
5617                 __isl_take isl_id *id);
5618         __isl_give isl_set *
5619         isl_set_project_out_param_id_list(
5620                 __isl_take isl_set *set,
5621                 __isl_take isl_id_list *list);
5622         __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
5623                 enum isl_dim_type type, unsigned first, unsigned n);
5624         __isl_give isl_set *isl_set_project_out_all_params(
5625                 __isl_take isl_set *set);
5626         __isl_give isl_map *isl_set_project_onto_map(
5627                 __isl_take isl_set *set,
5628                 enum isl_dim_type type, unsigned first,
5629                 unsigned n);
5630         __isl_give isl_basic_set *isl_basic_set_params(
5631                 __isl_take isl_basic_set *bset);
5632         __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
5634 The function C<isl_space_domain_wrapped_domain> returns the domain
5635 of the binary relation wrapped inside the domain of the input.
5636 The function C<isl_set_project_onto_map> returns a relation
5637 that projects the input set onto the given set dimensions.
5639         #include <isl/map.h>
5640         __isl_give isl_basic_map *isl_basic_map_project_out(
5641                 __isl_take isl_basic_map *bmap,
5642                 enum isl_dim_type type, unsigned first, unsigned n);
5643         __isl_give isl_map *isl_map_project_out_param_id(
5644                 __isl_take isl_map *map,
5645                 __isl_take isl_id *id);
5646         __isl_give isl_map *isl_map_project_out_param_id_list(
5647                 __isl_take isl_map *map,
5648                 __isl_take isl_id_list *list);
5649         __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
5650                 enum isl_dim_type type, unsigned first, unsigned n);
5651         __isl_give isl_map *isl_map_project_out_all_params(
5652                 __isl_take isl_map *map);
5653         __isl_give isl_basic_set *isl_basic_map_domain(
5654                 __isl_take isl_basic_map *bmap);
5655         __isl_give isl_basic_set *isl_basic_map_range(
5656                 __isl_take isl_basic_map *bmap);
5657         __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
5658         __isl_give isl_set *isl_map_domain(
5659                 __isl_take isl_map *bmap);
5660         __isl_give isl_set *isl_map_range(
5661                 __isl_take isl_map *map);
5663         #include <isl/union_set.h>
5664         __isl_give isl_union_set *isl_union_set_project_out(
5665                 __isl_take isl_union_set *uset,
5666                 enum isl_dim_type type,
5667                 unsigned first, unsigned n);
5668         __isl_give isl_union_set *
5669         isl_union_set_project_out_all_params(
5670                 __isl_take isl_union_set *uset);
5671         __isl_give isl_set *isl_union_set_params(
5672                 __isl_take isl_union_set *uset);
5674 The function C<isl_union_set_project_out> can only project out
5675 parameters.
5677         #include <isl/union_map.h>
5678         __isl_give isl_union_map *
5679         isl_union_map_project_out_param_id(
5680                 __isl_take isl_union_map *umap,
5681                 __isl_take isl_id *id);
5682         __isl_give isl_union_map *
5683         isl_union_map_project_out_param_id_list(
5684                 __isl_take isl_union_map *umap,
5685                 __isl_take isl_id_list *list);
5686         __isl_give isl_union_map *isl_union_map_project_out(
5687                 __isl_take isl_union_map *umap,
5688                 enum isl_dim_type type, unsigned first, unsigned n);
5689         __isl_give isl_union_map *
5690         isl_union_map_project_out_all_params(
5691                 __isl_take isl_union_map *umap);
5692         __isl_give isl_set *isl_union_map_params(
5693                 __isl_take isl_union_map *umap);
5694         __isl_give isl_union_set *isl_union_map_domain(
5695                 __isl_take isl_union_map *umap);
5696         __isl_give isl_union_set *isl_union_map_range(
5697                 __isl_take isl_union_map *umap);
5699 The function C<isl_union_map_project_out> can only project out
5700 parameters.
5702         #include <isl/aff.h>
5703         __isl_give isl_aff *isl_aff_project_domain_on_params(
5704                 __isl_take isl_aff *aff);
5705         __isl_give isl_multi_aff *
5706         isl_multi_aff_project_domain_on_params(
5707                 __isl_take isl_multi_aff *ma);
5708         __isl_give isl_pw_aff *
5709         isl_pw_aff_project_domain_on_params(
5710                 __isl_take isl_pw_aff *pa);
5711         __isl_give isl_multi_pw_aff *
5712         isl_multi_pw_aff_project_domain_on_params(
5713                 __isl_take isl_multi_pw_aff *mpa);
5714         __isl_give isl_pw_multi_aff *
5715         isl_pw_multi_aff_project_domain_on_params(
5716                 __isl_take isl_pw_multi_aff *pma);
5717         __isl_give isl_set *isl_pw_aff_domain(
5718                 __isl_take isl_pw_aff *pwaff);
5719         __isl_give isl_set *isl_pw_multi_aff_domain(
5720                 __isl_take isl_pw_multi_aff *pma);
5721         __isl_give isl_set *isl_multi_pw_aff_domain(
5722                 __isl_take isl_multi_pw_aff *mpa);
5723         __isl_give isl_union_set *isl_union_pw_aff_domain(
5724                 __isl_take isl_union_pw_aff *upa);
5725         __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
5726                 __isl_take isl_union_pw_multi_aff *upma);
5727         __isl_give isl_union_set *
5728         isl_multi_union_pw_aff_domain(
5729                 __isl_take isl_multi_union_pw_aff *mupa);
5730         __isl_give isl_set *isl_pw_aff_params(
5731                 __isl_take isl_pw_aff *pwa);
5733 If no explicit domain was set on a zero-dimensional input to
5734 C<isl_multi_union_pw_aff_domain>, then this function will
5735 return a parameter set.
5737         #include <isl/polynomial.h>
5738         __isl_give isl_qpolynomial *
5739         isl_qpolynomial_project_domain_on_params(
5740                 __isl_take isl_qpolynomial *qp);
5741         __isl_give isl_pw_qpolynomial *
5742         isl_pw_qpolynomial_project_domain_on_params(
5743                 __isl_take isl_pw_qpolynomial *pwqp);
5744         __isl_give isl_pw_qpolynomial_fold *
5745         isl_pw_qpolynomial_fold_project_domain_on_params(
5746                 __isl_take isl_pw_qpolynomial_fold *pwf);
5747         __isl_give isl_set *isl_pw_qpolynomial_domain(
5748                 __isl_take isl_pw_qpolynomial *pwqp);
5749         __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
5750                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
5751         __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
5752                 __isl_take isl_union_pw_qpolynomial *upwqp);
5754         #include <isl/space.h>
5755         __isl_give isl_space *isl_space_domain_map(
5756                 __isl_take isl_space *space);
5757         __isl_give isl_space *isl_space_range_map(
5758                 __isl_take isl_space *space);
5760         #include <isl/map.h>
5761         __isl_give isl_map *isl_set_wrapped_domain_map(
5762                 __isl_take isl_set *set);
5763         __isl_give isl_basic_map *isl_basic_map_domain_map(
5764                 __isl_take isl_basic_map *bmap);
5765         __isl_give isl_basic_map *isl_basic_map_range_map(
5766                 __isl_take isl_basic_map *bmap);
5767         __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
5768         __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
5770         #include <isl/union_map.h>
5771         __isl_give isl_union_map *isl_union_map_domain_map(
5772                 __isl_take isl_union_map *umap);
5773         __isl_give isl_union_pw_multi_aff *
5774         isl_union_map_domain_map_union_pw_multi_aff(
5775                 __isl_take isl_union_map *umap);
5776         __isl_give isl_union_map *isl_union_map_range_map(
5777                 __isl_take isl_union_map *umap);
5778         __isl_give isl_union_map *
5779         isl_union_set_wrapped_domain_map(
5780                 __isl_take isl_union_set *uset);
5782 The functions above construct a (basic, regular or union) relation
5783 that maps (a wrapped version of) the input relation to its domain or range.
5784 C<isl_set_wrapped_domain_map> maps the input set to the domain
5785 of its wrapped relation.
5787 =item * Elimination
5789         __isl_give isl_basic_set *isl_basic_set_eliminate(
5790                 __isl_take isl_basic_set *bset,
5791                 enum isl_dim_type type,
5792                 unsigned first, unsigned n);
5793         __isl_give isl_set *isl_set_eliminate(
5794                 __isl_take isl_set *set, enum isl_dim_type type,
5795                 unsigned first, unsigned n);
5796         __isl_give isl_basic_map *isl_basic_map_eliminate(
5797                 __isl_take isl_basic_map *bmap,
5798                 enum isl_dim_type type,
5799                 unsigned first, unsigned n);
5800         __isl_give isl_map *isl_map_eliminate(
5801                 __isl_take isl_map *map, enum isl_dim_type type,
5802                 unsigned first, unsigned n);
5804 Eliminate the coefficients for the given dimensions from the constraints,
5805 without removing the dimensions.
5807 =item * Constructing a set from a parameter domain
5809 A set space of a given dimension and with an optional name
5810 can be created from a parameter space using the following functions.
5812         #include <isl/space.h>
5813         __isl_give isl_space *isl_space_add_unnamed_tuple_ui(
5814                 __isl_take isl_space *space, unsigned dim);
5815         __isl_give isl_space *
5816         isl_space_add_named_tuple_id_ui(
5817                 __isl_take isl_space *space,
5818                 __isl_take isl_id *tuple_id, unsigned dim);
5820 A set with a given tuple can be created from a parameter domain
5821 using the following function.
5823         #include <isl/set.h>
5824         __isl_give isl_set *isl_set_unbind_params(
5825                 __isl_take isl_set *set,
5826                 __isl_take isl_multi_id *tuple);
5828 Any parameters with identifiers in C<tuple> are reinterpreted
5829 as the corresponding set dimensions.
5831 A zero-dimensional (local) space or (basic) set can be constructed
5832 on a given parameter domain using the following functions.
5834         #include <isl/space.h>
5835         __isl_give isl_space *isl_space_set_from_params(
5836                 __isl_take isl_space *space);
5838         #include <isl/local_space.h>
5839         __isl_give isl_local_space *
5840         isl_local_space_set_from_params(
5841                 __isl_take isl_local_space *ls);
5843         #include <isl/set.h>
5844         __isl_give isl_basic_set *isl_basic_set_from_params(
5845                 __isl_take isl_basic_set *bset);
5846         __isl_give isl_set *isl_set_from_params(
5847                 __isl_take isl_set *set);
5849 =item * Constructing a relation from one or two sets
5851 A map space with a range of a given dimension and with an optional name
5852 can be created from a domain space using the functions
5853 C<isl_space_add_unnamed_tuple_ui> and C<isl_space_add_named_tuple_id_ui>
5854 described above.
5856 A relation with a given domain tuple can be created from a set
5857 that will become the range of the relation
5858 using the following function.
5860         #include <isl/set.h>
5861         __isl_give isl_map *
5862         isl_set_unbind_params_insert_domain(
5863                 __isl_take isl_set *set,
5864                 __isl_take isl_multi_id *domain);
5866 Any parameters with identifiers in C<domain> are reinterpreted
5867 as the corresponding input dimensions.
5869 Similarly, a function defined over a parameter domain can
5870 be converted into one defined over a set domain
5871 using the following functions.
5873         #include <isl/aff.h>
5874         __isl_give isl_aff *
5875         isl_aff_unbind_params_insert_domain(
5876                 __isl_take isl_aff *aff,
5877                 __isl_take isl_multi_id *domain);
5878         __isl_give isl_multi_aff *
5879         isl_multi_aff_unbind_params_insert_domain(
5880                 __isl_take isl_multi_aff *ma,
5881                 __isl_take isl_multi_id *domain);
5882         __isl_give isl_multi_pw_aff *
5883         isl_multi_pw_aff_unbind_params_insert_domain(
5884                 __isl_take isl_multi_pw_aff *mpa,
5885                 __isl_take isl_multi_id *domain);
5887 Again,
5888 any parameters with identifiers in C<domain> are reinterpreted
5889 as the corresponding input dimensions.
5891 Create a relation with the given set(s) as domain and/or range.
5892 If only the domain or the range is specified, then
5893 the range or domain of the created relation is a zero-dimensional
5894 flat anonymous space.
5895 If the case of C<isl_space_map_from_set>, the input space
5896 specifies both the domain and the range of the result.
5898         #include <isl/space.h>
5899         __isl_give isl_space *isl_space_from_domain(
5900                 __isl_take isl_space *space);
5901         __isl_give isl_space *isl_space_from_range(
5902                 __isl_take isl_space *space);
5903         __isl_give isl_space *isl_space_map_from_set(
5904                 __isl_take isl_space *space);
5905         __isl_give isl_space *isl_space_map_from_domain_and_range(
5906                 __isl_take isl_space *domain,
5907                 __isl_take isl_space *range);
5909         #include <isl/local_space.h>
5910         __isl_give isl_local_space *isl_local_space_from_domain(
5911                 __isl_take isl_local_space *ls);
5913         #include <isl/map.h>
5914         __isl_give isl_map *isl_set_insert_domain(
5915                 __isl_take isl_set *set,
5916                 __isl_take isl_space *domain);
5917         __isl_give isl_map *isl_map_from_domain(
5918                 __isl_take isl_set *set);
5919         __isl_give isl_map *isl_map_from_range(
5920                 __isl_take isl_set *set);
5922         #include <isl/union_map.h>
5923         __isl_give isl_union_map *isl_union_map_from_domain(
5924                 __isl_take isl_union_set *uset);
5925         __isl_give isl_union_map *isl_union_map_from_range(
5926                 __isl_take isl_union_set *uset);
5927         __isl_give isl_union_map *
5928         isl_union_map_from_domain_and_range(
5929                 __isl_take isl_union_set *domain,
5930                 __isl_take isl_union_set *range);
5932         #include <isl/id.h>
5933         __isl_give isl_multi_id *isl_multi_id_from_range(
5934                 __isl_take isl_multi_id *mi);
5936         #include <isl/val.h>
5937         __isl_give isl_multi_val *isl_multi_val_from_range(
5938                 __isl_take isl_multi_val *mv);
5940         #include <isl/aff.h>
5941         __isl_give isl_multi_aff *
5942         isl_multi_aff_insert_domain(
5943                 __isl_take isl_multi_aff *ma,
5944                 __isl_take isl_space *domain);
5945         __isl_give isl_pw_aff *isl_pw_aff_insert_domain(
5946                 __isl_take isl_pw_aff *pa,
5947                 __isl_take isl_space *domain);
5948         __isl_give isl_pw_multi_aff *
5949         isl_pw_multi_aff_insert_domain(
5950                 __isl_take isl_pw_multi_aff *pma,
5951                 __isl_take isl_space *domain);
5952         __isl_give isl_multi_pw_aff *
5953         isl_multi_pw_aff_insert_domain(
5954                 __isl_take isl_multi_pw_aff *mpa,
5955                 __isl_take isl_space *domain);
5956         __isl_give isl_aff *isl_aff_from_range(
5957                 __isl_take isl_aff *aff);
5958         __isl_give isl_multi_aff *isl_multi_aff_from_range(
5959                 __isl_take isl_multi_aff *ma);
5960         __isl_give isl_pw_aff *isl_pw_aff_from_range(
5961                 __isl_take isl_pw_aff *pwa);
5962         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
5963                 __isl_take isl_multi_pw_aff *mpa);
5964         __isl_give isl_multi_union_pw_aff *
5965         isl_multi_union_pw_aff_from_range(
5966                 __isl_take isl_multi_union_pw_aff *mupa);
5967         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
5968                 __isl_take isl_set *set);
5969         __isl_give isl_union_pw_multi_aff *
5970         isl_union_pw_multi_aff_from_domain(
5971                 __isl_take isl_union_set *uset);
5973         #include <isl/polynomial.h>
5974         __isl_give isl_pw_qpolynomial *
5975         isl_pw_qpolynomial_from_range(
5976                 __isl_take isl_pw_qpolynomial *pwqp);
5977         __isl_give isl_pw_qpolynomial_fold *
5978         isl_pw_qpolynomial_fold_from_range(
5979                 __isl_take isl_pw_qpolynomial_fold *pwf);
5981 =item * Slicing
5983         #include <isl/set.h>
5984         __isl_give isl_basic_set *isl_basic_set_fix_si(
5985                 __isl_take isl_basic_set *bset,
5986                 enum isl_dim_type type, unsigned pos, int value);
5987         __isl_give isl_basic_set *isl_basic_set_fix_val(
5988                 __isl_take isl_basic_set *bset,
5989                 enum isl_dim_type type, unsigned pos,
5990                 __isl_take isl_val *v);
5991         __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
5992                 enum isl_dim_type type, unsigned pos, int value);
5993         __isl_give isl_set *isl_set_fix_val(
5994                 __isl_take isl_set *set,
5995                 enum isl_dim_type type, unsigned pos,
5996                 __isl_take isl_val *v);
5998         #include <isl/map.h>
5999         __isl_give isl_basic_map *isl_basic_map_fix_si(
6000                 __isl_take isl_basic_map *bmap,
6001                 enum isl_dim_type type, unsigned pos, int value);
6002         __isl_give isl_basic_map *isl_basic_map_fix_val(
6003                 __isl_take isl_basic_map *bmap,
6004                 enum isl_dim_type type, unsigned pos,
6005                 __isl_take isl_val *v);
6006         __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
6007                 enum isl_dim_type type, unsigned pos, int value);
6008         __isl_give isl_map *isl_map_fix_val(
6009                 __isl_take isl_map *map,
6010                 enum isl_dim_type type, unsigned pos,
6011                 __isl_take isl_val *v);
6013         #include <isl/aff.h>
6014         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
6015                 __isl_take isl_pw_multi_aff *pma,
6016                 enum isl_dim_type type, unsigned pos, int value);
6018         #include <isl/polynomial.h>
6019         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
6020                 __isl_take isl_pw_qpolynomial *pwqp,
6021                 enum isl_dim_type type, unsigned n,
6022                 __isl_take isl_val *v);
6023         __isl_give isl_pw_qpolynomial_fold *
6024         isl_pw_qpolynomial_fold_fix_val(
6025                 __isl_take isl_pw_qpolynomial_fold *pwf,
6026                 enum isl_dim_type type, unsigned n,
6027                 __isl_take isl_val *v);
6029 Intersect the set, relation or function domain
6030 with the hyperplane where the given
6031 dimension has the fixed given value.
6033         #include <isl/set.h>
6034         __isl_give isl_basic_set *
6035         isl_basic_set_lower_bound_val(
6036                 __isl_take isl_basic_set *bset,
6037                 enum isl_dim_type type, unsigned pos,
6038                 __isl_take isl_val *value);
6039         __isl_give isl_basic_set *
6040         isl_basic_set_upper_bound_val(
6041                 __isl_take isl_basic_set *bset,
6042                 enum isl_dim_type type, unsigned pos,
6043                 __isl_take isl_val *value);
6044         __isl_give isl_set *isl_set_lower_bound_si(
6045                 __isl_take isl_set *set,
6046                 enum isl_dim_type type, unsigned pos, int value);
6047         __isl_give isl_set *isl_set_lower_bound_val(
6048                 __isl_take isl_set *set,
6049                 enum isl_dim_type type, unsigned pos,
6050                 __isl_take isl_val *value);
6051         __isl_give isl_set *isl_set_upper_bound_si(
6052                 __isl_take isl_set *set,
6053                 enum isl_dim_type type, unsigned pos, int value);
6054         __isl_give isl_set *isl_set_upper_bound_val(
6055                 __isl_take isl_set *set,
6056                 enum isl_dim_type type, unsigned pos,
6057                 __isl_take isl_val *value);
6058         __isl_give isl_set *isl_set_lower_bound_multi_val(
6059                 __isl_take isl_set *set,
6060                 __isl_take isl_multi_val *lower);
6061         __isl_give isl_set *isl_set_upper_bound_multi_val(
6062                 __isl_take isl_set *set,
6063                 __isl_take isl_multi_val *upper);
6064         __isl_give isl_set *isl_set_lower_bound_multi_pw_aff(
6065                 __isl_take isl_set *set,
6066                 __isl_take isl_multi_pw_aff *lower);
6067         __isl_give isl_set *isl_set_upper_bound_multi_pw_aff(
6068                 __isl_take isl_set *set,
6069                 __isl_take isl_multi_pw_aff *upper);
6071         #include <isl/map.h>
6072         __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
6073                 __isl_take isl_basic_map *bmap,
6074                 enum isl_dim_type type, unsigned pos, int value);
6075         __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
6076                 __isl_take isl_basic_map *bmap,
6077                 enum isl_dim_type type, unsigned pos, int value);
6078         __isl_give isl_map *isl_map_lower_bound_si(
6079                 __isl_take isl_map *map,
6080                 enum isl_dim_type type, unsigned pos, int value);
6081         __isl_give isl_map *isl_map_upper_bound_si(
6082                 __isl_take isl_map *map,
6083                 enum isl_dim_type type, unsigned pos, int value);
6084         __isl_give isl_map *isl_map_lower_bound_val(
6085                 __isl_take isl_map *map,
6086                 enum isl_dim_type type, unsigned pos,
6087                 __isl_take isl_val *value);
6088         __isl_give isl_map *isl_map_upper_bound_val(
6089                 __isl_take isl_map *map,
6090                 enum isl_dim_type type, unsigned pos,
6091                 __isl_take isl_val *value);
6092         __isl_give isl_map *isl_map_lower_bound_multi_pw_aff(
6093                 __isl_take isl_map *map,
6094                 __isl_take isl_multi_pw_aff *lower);
6095         __isl_give isl_map *isl_map_upper_bound_multi_pw_aff(
6096                 __isl_take isl_map *map,
6097                 __isl_take isl_multi_pw_aff *upper);
6099 Intersect the set or relation with the half-space where the given
6100 dimension has a value bounded by the given fixed integer value or
6101 symbolic constant expression.
6102 For functions taking a multi expression,
6103 this applies to all set dimensions.
6104 Those that bound a map, bound the range of that map.
6105 If the multi expression is zero-dimensional but has an explicit domain,
6106 then the (parameter) domain of the set or map is intersected
6107 with this explicit domain.
6109         __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
6110                 enum isl_dim_type type1, int pos1,
6111                 enum isl_dim_type type2, int pos2);
6112         __isl_give isl_basic_map *isl_basic_map_equate(
6113                 __isl_take isl_basic_map *bmap,
6114                 enum isl_dim_type type1, int pos1,
6115                 enum isl_dim_type type2, int pos2);
6116         __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
6117                 enum isl_dim_type type1, int pos1,
6118                 enum isl_dim_type type2, int pos2);
6120 Intersect the set or relation with the hyperplane where the given
6121 dimensions are equal to each other.
6123         __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
6124                 enum isl_dim_type type1, int pos1,
6125                 enum isl_dim_type type2, int pos2);
6127 Intersect the relation with the hyperplane where the given
6128 dimensions have opposite values.
6130         __isl_give isl_map *isl_map_order_le(
6131                 __isl_take isl_map *map,
6132                 enum isl_dim_type type1, int pos1,
6133                 enum isl_dim_type type2, int pos2);
6134         __isl_give isl_basic_map *isl_basic_map_order_ge(
6135                 __isl_take isl_basic_map *bmap,
6136                 enum isl_dim_type type1, int pos1,
6137                 enum isl_dim_type type2, int pos2);
6138         __isl_give isl_map *isl_map_order_ge(
6139                 __isl_take isl_map *map,
6140                 enum isl_dim_type type1, int pos1,
6141                 enum isl_dim_type type2, int pos2);
6142         __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
6143                 enum isl_dim_type type1, int pos1,
6144                 enum isl_dim_type type2, int pos2);
6145         __isl_give isl_basic_map *isl_basic_map_order_gt(
6146                 __isl_take isl_basic_map *bmap,
6147                 enum isl_dim_type type1, int pos1,
6148                 enum isl_dim_type type2, int pos2);
6149         __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
6150                 enum isl_dim_type type1, int pos1,
6151                 enum isl_dim_type type2, int pos2);
6153 Intersect the relation with the half-space where the given
6154 dimensions satisfy the given ordering.
6156         #include <isl/union_set.h>
6157         __isl_give isl_union_map *isl_union_map_remove_map_if(
6158                 __isl_take isl_union_map *umap,
6159                 isl_bool (*fn)(__isl_keep isl_map *map,
6160                         void *user), void *user);
6162 This function calls the callback function once for each
6163 pair of spaces for which there are elements in the input.
6164 If the callback returns C<isl_bool_true>, then all those elements
6165 are removed from the result.  The only remaining elements in the output
6166 are then those for which the callback returns C<isl_bool_false>.
6168 =item * Locus
6170         #include <isl/aff.h>
6171         __isl_give isl_basic_set *isl_aff_zero_basic_set(
6172                 __isl_take isl_aff *aff);
6173         __isl_give isl_basic_set *isl_aff_neg_basic_set(
6174                 __isl_take isl_aff *aff);
6175         __isl_give isl_set *isl_pw_aff_pos_set(
6176                 __isl_take isl_pw_aff *pa);
6177         __isl_give isl_set *isl_pw_aff_nonneg_set(
6178                 __isl_take isl_pw_aff *pwaff);
6179         __isl_give isl_set *isl_pw_aff_zero_set(
6180                 __isl_take isl_pw_aff *pwaff);
6181         __isl_give isl_set *isl_pw_aff_non_zero_set(
6182                 __isl_take isl_pw_aff *pwaff);
6183         __isl_give isl_union_set *
6184         isl_union_pw_aff_zero_union_set(
6185                 __isl_take isl_union_pw_aff *upa);
6186         __isl_give isl_union_set *
6187         isl_multi_union_pw_aff_zero_union_set(
6188                 __isl_take isl_multi_union_pw_aff *mupa);
6190 The function C<isl_aff_neg_basic_set> returns a basic set
6191 containing those elements in the domain space
6192 of C<aff> where C<aff> is negative.
6193 The function C<isl_pw_aff_nonneg_set> returns a set
6194 containing those elements in the domain
6195 of C<pwaff> where C<pwaff> is non-negative.
6196 The function C<isl_multi_union_pw_aff_zero_union_set>
6197 returns a union set containing those elements
6198 in the domains of its elements where they are all zero.
6200 =item * Identity
6202         __isl_give isl_map *isl_set_identity(
6203                 __isl_take isl_set *set);
6204         __isl_give isl_union_map *isl_union_set_identity(
6205                 __isl_take isl_union_set *uset);
6206         __isl_give isl_union_pw_multi_aff *
6207         isl_union_set_identity_union_pw_multi_aff(
6208                 __isl_take isl_union_set *uset);
6210 Construct an identity relation on the given (union) set.
6212 =item * Function Extraction
6214 A piecewise quasi affine expression that is equal to 1 on a set
6215 and 0 outside the set can be created using the following function.
6217         #include <isl/aff.h>
6218         __isl_give isl_pw_aff *isl_set_indicator_function(
6219                 __isl_take isl_set *set);
6221 A piecewise multiple quasi affine expression can be extracted
6222 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
6223 and the C<isl_map> is single-valued.
6224 In case of a conversion from an C<isl_union_map>
6225 to an C<isl_union_pw_multi_aff>, these properties need to hold
6226 in each domain space.
6227 A conversion to a C<isl_multi_union_pw_aff> additionally
6228 requires that the input is non-empty and involves only a single
6229 range space.
6231         #include <isl/aff.h>
6232         __isl_give isl_pw_multi_aff *isl_set_as_pw_multi_aff(
6233                 __isl_take isl_set *set);
6234         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
6235                 __isl_take isl_set *set);
6236         __isl_give isl_pw_multi_aff *isl_map_as_pw_multi_aff(
6237                 __isl_take isl_map *map);
6238         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
6239                 __isl_take isl_map *map);
6241         __isl_give isl_union_pw_multi_aff *
6242         isl_union_pw_multi_aff_from_union_set(
6243                 __isl_take isl_union_set *uset);
6244         __isl_give isl_union_pw_multi_aff *
6245         isl_union_map_as_union_pw_multi_aff(
6246                 __isl_take isl_union_map *umap);
6247         __isl_give isl_union_pw_multi_aff *
6248         isl_union_pw_multi_aff_from_union_map(
6249                 __isl_take isl_union_map *umap);
6251         __isl_give isl_multi_union_pw_aff *
6252         isl_union_map_as_multi_union_pw_aff(
6253                 __isl_take isl_union_map *umap);
6254         __isl_give isl_multi_union_pw_aff *
6255         isl_multi_union_pw_aff_from_union_map(
6256                 __isl_take isl_union_map *umap);
6258 C<isl_map_as_pw_multi_aff> and C<isl_pw_multi_aff_from_map> perform
6259 the same operation.
6260 Similarly for C<isl_set_as_pw_multi_aff> and
6261 C<isl_pw_multi_aff_from_set>,
6262 for C<isl_union_map_as_union_pw_multi_aff> and
6263 C<isl_union_pw_multi_aff_from_union_map> and
6264 for C<isl_union_map_as_multi_union_pw_aff> and
6265 C<isl_multi_union_pw_aff_from_union_map>.
6267 =item * Deltas
6269         __isl_give isl_basic_set *isl_basic_map_deltas(
6270                 __isl_take isl_basic_map *bmap);
6271         __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
6272         __isl_give isl_union_set *isl_union_map_deltas(
6273                 __isl_take isl_union_map *umap);
6275 These functions return a (basic) set containing the differences
6276 between image elements and corresponding domain elements in the input.
6278         __isl_give isl_basic_map *isl_basic_map_deltas_map(
6279                 __isl_take isl_basic_map *bmap);
6280         __isl_give isl_map *isl_map_deltas_map(
6281                 __isl_take isl_map *map);
6282         __isl_give isl_union_map *isl_union_map_deltas_map(
6283                 __isl_take isl_union_map *umap);
6285 The functions above construct a (basic, regular or union) relation
6286 that maps (a wrapped version of) the input relation to its delta set.
6288 =item * Translation
6290         #include <isl/map.h>
6291         __isl_give isl_map *isl_set_translation(
6292                 __isl_take isl_set *deltas);
6294 This function performs essentially the opposite operation
6295 of C<isl_map_deltas>.  In particular, it returns pairs
6296 of elements in the same space that have a difference in C<deltas>.
6298 =item * Coalescing
6300 Simplify the representation of a set, relation or functions by trying
6301 to combine pairs of basic sets or relations into a single
6302 basic set or relation.
6304         #include <isl/set.h>
6305         __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
6307         #include <isl/map.h>
6308         __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
6310         #include <isl/union_set.h>
6311         __isl_give isl_union_set *isl_union_set_coalesce(
6312                 __isl_take isl_union_set *uset);
6314         #include <isl/union_map.h>
6315         __isl_give isl_union_map *isl_union_map_coalesce(
6316                 __isl_take isl_union_map *umap);
6318         #include <isl/aff.h>
6319         __isl_give isl_pw_aff *isl_pw_aff_coalesce(
6320                 __isl_take isl_pw_aff *pa);
6321         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
6322                 __isl_take isl_pw_multi_aff *pma);
6323         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
6324                 __isl_take isl_multi_pw_aff *mpa);
6325         __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
6326                 __isl_take isl_union_pw_aff *upa);
6327         __isl_give isl_union_pw_multi_aff *
6328         isl_union_pw_multi_aff_coalesce(
6329                 __isl_take isl_union_pw_multi_aff *upma);
6330         __isl_give isl_multi_union_pw_aff *
6331         isl_multi_union_pw_aff_coalesce(
6332                 __isl_take isl_multi_union_pw_aff *mupa);
6334         #include <isl/polynomial.h>
6335         __isl_give isl_pw_qpolynomial_fold *
6336         isl_pw_qpolynomial_fold_coalesce(
6337                 __isl_take isl_pw_qpolynomial_fold *pwf);
6338         __isl_give isl_union_pw_qpolynomial *
6339         isl_union_pw_qpolynomial_coalesce(
6340                 __isl_take isl_union_pw_qpolynomial *upwqp);
6341         __isl_give isl_union_pw_qpolynomial_fold *
6342         isl_union_pw_qpolynomial_fold_coalesce(
6343                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
6345 One of the methods for combining pairs of basic sets or relations
6346 can result in coefficients that are much larger than those that appear
6347 in the constraints of the input.  By default, the coefficients are
6348 not allowed to grow larger, but this can be changed by unsetting
6349 the following option.
6351         isl_stat isl_options_set_coalesce_bounded_wrapping(
6352                 isl_ctx *ctx, int val);
6353         int isl_options_get_coalesce_bounded_wrapping(
6354                 isl_ctx *ctx);
6356 One of the other methods tries to combine pairs of basic sets
6357 with different local variables, treating them as existentially
6358 quantified variables even if they have known (but different)
6359 integer division expressions.  The result may then also have
6360 existentially quantified variables.  Turning on the following
6361 option prevents this from happening.
6363         isl_stat isl_options_set_coalesce_preserve_locals(
6364                 isl_ctx *ctx, int val);
6365         int isl_options_get_coalesce_preserve_locals(isl_ctx *ctx);
6367 =item * Detecting equalities
6369         __isl_give isl_basic_set *isl_basic_set_detect_equalities(
6370                 __isl_take isl_basic_set *bset);
6371         __isl_give isl_basic_map *isl_basic_map_detect_equalities(
6372                 __isl_take isl_basic_map *bmap);
6373         __isl_give isl_set *isl_set_detect_equalities(
6374                 __isl_take isl_set *set);
6375         __isl_give isl_map *isl_map_detect_equalities(
6376                 __isl_take isl_map *map);
6377         __isl_give isl_union_set *isl_union_set_detect_equalities(
6378                 __isl_take isl_union_set *uset);
6379         __isl_give isl_union_map *isl_union_map_detect_equalities(
6380                 __isl_take isl_union_map *umap);
6382 Simplify the representation of a set or relation by detecting implicit
6383 equalities.
6385 =item * Removing redundant constraints
6387         #include <isl/set.h>
6388         __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
6389                 __isl_take isl_basic_set *bset);
6390         __isl_give isl_set *isl_set_remove_redundancies(
6391                 __isl_take isl_set *set);
6393         #include <isl/union_set.h>
6394         __isl_give isl_union_set *
6395         isl_union_set_remove_redundancies(
6396                 __isl_take isl_union_set *uset);
6398         #include <isl/map.h>
6399         __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
6400                 __isl_take isl_basic_map *bmap);
6401         __isl_give isl_map *isl_map_remove_redundancies(
6402                 __isl_take isl_map *map);
6404         #include <isl/union_map.h>
6405         __isl_give isl_union_map *
6406         isl_union_map_remove_redundancies(
6407                 __isl_take isl_union_map *umap);
6409 =item * Convex hull
6411         __isl_give isl_basic_set *isl_set_convex_hull(
6412                 __isl_take isl_set *set);
6413         __isl_give isl_basic_map *isl_map_convex_hull(
6414                 __isl_take isl_map *map);
6416 If the input set or relation has any existentially quantified
6417 variables, then the result of these operations is currently undefined.
6419 =item * Simple hull
6421         #include <isl/set.h>
6422         __isl_give isl_basic_set *
6423         isl_set_unshifted_simple_hull(
6424                 __isl_take isl_set *set);
6425         __isl_give isl_basic_set *isl_set_simple_hull(
6426                 __isl_take isl_set *set);
6427         __isl_give isl_basic_set *
6428         isl_set_plain_unshifted_simple_hull(
6429                 __isl_take isl_set *set);
6430         __isl_give isl_basic_set *
6431         isl_set_unshifted_simple_hull_from_set_list(
6432                 __isl_take isl_set *set,
6433                 __isl_take isl_set_list *list);
6435         #include <isl/map.h>
6436         __isl_give isl_basic_map *
6437         isl_map_unshifted_simple_hull(
6438                 __isl_take isl_map *map);
6439         __isl_give isl_basic_map *isl_map_simple_hull(
6440                 __isl_take isl_map *map);
6441         __isl_give isl_basic_map *
6442         isl_map_plain_unshifted_simple_hull(
6443                 __isl_take isl_map *map);
6444                 __isl_give isl_basic_map *
6445         isl_map_unshifted_simple_hull_from_map_list(
6446                 __isl_take isl_map *map,
6447                 __isl_take isl_map_list *list);
6449         #include <isl/union_map.h>
6450         __isl_give isl_union_map *isl_union_map_simple_hull(
6451                 __isl_take isl_union_map *umap);
6453 These functions compute a single basic set or relation
6454 that contains the whole input set or relation.
6455 In particular, the output is described by translates
6456 of the constraints describing the basic sets or relations in the input.
6457 In case of C<isl_set_unshifted_simple_hull>, only the original
6458 constraints are used, without any translation.
6459 In case of C<isl_set_plain_unshifted_simple_hull> and
6460 C<isl_map_plain_unshifted_simple_hull>, the result is described
6461 by original constraints that are obviously satisfied
6462 by the entire input set or relation.
6463 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
6464 C<isl_map_unshifted_simple_hull_from_map_list>, the
6465 constraints are taken from the elements of the second argument.
6467 =begin latex
6469 (See \autoref{s:simple hull}.)
6471 =end latex
6473 =item * Affine hull
6475         __isl_give isl_basic_set *isl_basic_set_affine_hull(
6476                 __isl_take isl_basic_set *bset);
6477         __isl_give isl_basic_set *isl_set_affine_hull(
6478                 __isl_take isl_set *set);
6479         __isl_give isl_union_set *isl_union_set_affine_hull(
6480                 __isl_take isl_union_set *uset);
6481         __isl_give isl_basic_map *isl_basic_map_affine_hull(
6482                 __isl_take isl_basic_map *bmap);
6483         __isl_give isl_basic_map *isl_map_affine_hull(
6484                 __isl_take isl_map *map);
6485         __isl_give isl_union_map *isl_union_map_affine_hull(
6486                 __isl_take isl_union_map *umap);
6488 In case of union sets and relations, the affine hull is computed
6489 per space.
6491 =item * Polyhedral hull
6493         __isl_give isl_basic_set *isl_set_polyhedral_hull(
6494                 __isl_take isl_set *set);
6495         __isl_give isl_basic_map *isl_map_polyhedral_hull(
6496                 __isl_take isl_map *map);
6497         __isl_give isl_union_set *isl_union_set_polyhedral_hull(
6498                 __isl_take isl_union_set *uset);
6499         __isl_give isl_union_map *isl_union_map_polyhedral_hull(
6500                 __isl_take isl_union_map *umap);
6502 These functions compute a single basic set or relation
6503 not involving any existentially quantified variables
6504 that contains the whole input set or relation.
6505 In case of union sets and relations, the polyhedral hull is computed
6506 per space.
6508 =item * Box hull
6510         #include <isl/set.h>
6511         __isl_give isl_fixed_box *
6512         isl_set_get_simple_fixed_box_hull(
6513                 __isl_keep isl_set *set)
6515         #include <isl/map.h>
6516         __isl_give isl_fixed_box *
6517         isl_map_get_range_simple_fixed_box_hull(
6518                 __isl_keep isl_map *map);
6520 These functions try to approximate the set or
6521 the range of the map by a box of fixed size.
6522 The box is described in terms of an offset living in the same space as
6523 the input and a size living in the set or range space.  For any element
6524 in the input map, the range value is greater than or equal to
6525 the offset applied to the domain value and the difference with
6526 this offset is strictly smaller than the size.
6527 The same holds for the elements of the input set, where
6528 the offset is a parametric constant value.
6529 If no fixed-size approximation can be found,
6530 an I<invalid> box is returned, i.e., one for which
6531 C<isl_fixed_box_is_valid> below returns false.
6533 The validity, the offset and the size of the box can be obtained using
6534 the following functions.
6536         #include <isl/fixed_box.h>
6537         isl_bool isl_fixed_box_is_valid(
6538                 __isl_keep isl_fixed_box *box);
6539         __isl_give isl_multi_aff *isl_fixed_box_get_offset(
6540                 __isl_keep isl_fixed_box *box);
6541         __isl_give isl_multi_val *isl_fixed_box_get_size(
6542                 __isl_keep isl_fixed_box *box);
6544 The box can be copied and freed using the following functions.
6546         #include <isl/fixed_box.h>
6547         __isl_give isl_fixed_box *isl_fixed_box_copy(
6548                 __isl_keep isl_fixed_box *box);
6549         __isl_null isl_fixed_box *isl_fixed_box_free(
6550                 __isl_take isl_fixed_box *box);
6552 An object of type C<isl_fixed_box> can be read from input
6553 using the following function.
6555         #include <isl/fixed_box.h>
6556         __isl_give isl_fixed_box *
6557         isl_fixed_box_read_from_str(isl_ctx *ctx,
6558                 const char *str);
6560 A representation of the information contained in an object
6561 of type C<isl_fixed_box> can be obtained using
6563         #include <isl/fixed_box.h>
6564         __isl_give isl_printer *isl_printer_print_fixed_box(
6565                 __isl_take isl_printer *p,
6566                 __isl_keep isl_fixed_box *box);
6567         __isl_give char *isl_fixed_box_to_str(
6568                 __isl_keep isl_fixed_box *box);
6570 C<isl_fixed_box_to_str> prints the information in flow format.
6572 =item * Other approximations
6574         #include <isl/set.h>
6575         __isl_give isl_basic_set *
6576         isl_basic_set_drop_constraints_involving_dims(
6577                 __isl_take isl_basic_set *bset,
6578                 enum isl_dim_type type,
6579                 unsigned first, unsigned n);
6580         __isl_give isl_basic_set *
6581         isl_basic_set_drop_constraints_not_involving_dims(
6582                 __isl_take isl_basic_set *bset,
6583                 enum isl_dim_type type,
6584                 unsigned first, unsigned n);
6585         __isl_give isl_set *
6586         isl_set_drop_constraints_involving_dims(
6587                 __isl_take isl_set *set,
6588                 enum isl_dim_type type,
6589                 unsigned first, unsigned n);
6590         __isl_give isl_set *
6591         isl_set_drop_constraints_not_involving_dims(
6592                 __isl_take isl_set *set,
6593                 enum isl_dim_type type,
6594                 unsigned first, unsigned n);
6596         #include <isl/map.h>
6597         __isl_give isl_basic_map *
6598         isl_basic_map_drop_constraints_involving_dims(
6599                 __isl_take isl_basic_map *bmap,
6600                 enum isl_dim_type type,
6601                 unsigned first, unsigned n);
6602         __isl_give isl_basic_map *
6603         isl_basic_map_drop_constraints_not_involving_dims(
6604                 __isl_take isl_basic_map *bmap,
6605                 enum isl_dim_type type,
6606                 unsigned first, unsigned n);
6607         __isl_give isl_map *
6608         isl_map_drop_constraints_involving_dims(
6609                 __isl_take isl_map *map,
6610                 enum isl_dim_type type,
6611                 unsigned first, unsigned n);
6612         __isl_give isl_map *
6613         isl_map_drop_constraints_not_involving_dims(
6614                 __isl_take isl_map *map,
6615                 enum isl_dim_type type,
6616                 unsigned first, unsigned n);
6618 These functions drop any constraints (not) involving the specified dimensions.
6619 Note that the result depends on the representation of the input.
6621         #include <isl/polynomial.h>
6622         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
6623                 __isl_take isl_pw_qpolynomial *pwqp, int sign);
6624         __isl_give isl_union_pw_qpolynomial *
6625         isl_union_pw_qpolynomial_to_polynomial(
6626                 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
6628 Approximate each quasipolynomial by a polynomial.  If C<sign> is positive,
6629 the polynomial will be an overapproximation.  If C<sign> is negative,
6630 it will be an underapproximation.  If C<sign> is zero, the approximation
6631 will lie somewhere in between.
6633 =item * Feasibility
6635         __isl_give isl_basic_set *isl_basic_set_sample(
6636                 __isl_take isl_basic_set *bset);
6637         __isl_give isl_basic_set *isl_set_sample(
6638                 __isl_take isl_set *set);
6639         __isl_give isl_basic_map *isl_basic_map_sample(
6640                 __isl_take isl_basic_map *bmap);
6641         __isl_give isl_basic_map *isl_map_sample(
6642                 __isl_take isl_map *map);
6644 If the input (basic) set or relation is non-empty, then return
6645 a singleton subset of the input.  Otherwise, return an empty set.
6647 =item * Optimization
6649         #include <isl/ilp.h>
6650         __isl_give isl_val *isl_basic_set_max_val(
6651                 __isl_keep isl_basic_set *bset,
6652                 __isl_keep isl_aff *obj);
6653         __isl_give isl_val *isl_set_min_val(
6654                 __isl_keep isl_set *set,
6655                 __isl_keep isl_aff *obj);
6656         __isl_give isl_val *isl_set_max_val(
6657                 __isl_keep isl_set *set,
6658                 __isl_keep isl_aff *obj);
6659         __isl_give isl_multi_val *
6660         isl_union_set_min_multi_union_pw_aff(
6661                 __isl_keep isl_union_set *uset,
6662                 __isl_keep isl_multi_union_pw_aff *obj);
6664 Compute the minimum or maximum of the integer affine expression C<obj>
6665 over the points in C<set>.
6666 The result is C<NULL> in case of an error, the optimal value in case
6667 there is one, negative infinity or infinity if the problem is unbounded and
6668 NaN if the problem is empty.
6670         #include <isl/ilp.h>
6671         __isl_give isl_val *isl_pw_aff_min_val(
6672                 __isl_take isl_pw_aff *pa);
6673         __isl_give isl_val *isl_pw_aff_max_val(
6674                 __isl_take isl_pw_aff *pa);
6675         __isl_give isl_multi_val *
6676         isl_pw_multi_aff_min_multi_val(
6677                 __isl_take isl_pw_multi_aff *pma);
6678         __isl_give isl_multi_val *
6679         isl_pw_multi_aff_max_multi_val(
6680                 __isl_take isl_pw_multi_aff *pma);
6681         __isl_give isl_multi_val *
6682         isl_multi_pw_aff_min_multi_val(
6683                 __isl_take isl_multi_pw_aff *mpa);
6684         __isl_give isl_multi_val *
6685         isl_multi_pw_aff_max_multi_val(
6686                 __isl_take isl_multi_pw_aff *mpa);
6687         __isl_give isl_val *isl_union_pw_aff_min_val(
6688                 __isl_take isl_union_pw_aff *upa);
6689         __isl_give isl_val *isl_union_pw_aff_max_val(
6690                 __isl_take isl_union_pw_aff *upa);
6691         __isl_give isl_multi_val *
6692         isl_multi_union_pw_aff_min_multi_val(
6693                 __isl_take isl_multi_union_pw_aff *mupa);
6694         __isl_give isl_multi_val *
6695         isl_multi_union_pw_aff_max_multi_val(
6696                 __isl_take isl_multi_union_pw_aff *mupa);
6698 Compute the minimum or maximum of the integer affine expression
6699 over its definition domain.
6700 The result is C<NULL> in case of an error, the optimal value in case
6701 there is one, negative infinity or infinity if the problem is unbounded and
6702 NaN if the problem is empty.
6704         #include <isl/ilp.h>
6705         __isl_give isl_val *isl_basic_set_dim_max_val(
6706                 __isl_take isl_basic_set *bset, int pos);
6707         __isl_give isl_val *isl_set_dim_min_val(
6708                 __isl_take isl_set *set, int pos);
6709         __isl_give isl_val *isl_set_dim_max_val(
6710                 __isl_take isl_set *set, int pos);
6712 Return the minimal or maximal value attained by the given set dimension,
6713 independently of the parameter values and of any other dimensions.
6714 The result is C<NULL> in case of an error, the optimal value in case
6715 there is one, (negative) infinity if the problem is unbounded and
6716 NaN if the input is empty.
6718 =item * Parametric optimization
6720         __isl_give isl_pw_aff *isl_set_dim_min(
6721                 __isl_take isl_set *set, int pos);
6722         __isl_give isl_pw_aff *isl_set_dim_max(
6723                 __isl_take isl_set *set, int pos);
6724         __isl_give isl_pw_aff *isl_map_dim_min(
6725                 __isl_take isl_map *map, int pos);
6726         __isl_give isl_pw_aff *isl_map_dim_max(
6727                 __isl_take isl_map *map, int pos);
6728         __isl_give isl_multi_pw_aff *
6729         isl_set_min_multi_pw_aff(
6730                 __isl_take isl_set *set);
6731         __isl_give isl_multi_pw_aff *
6732         isl_set_max_multi_pw_aff(
6733                 __isl_take isl_set *set);
6734         __isl_give isl_multi_pw_aff *
6735         isl_map_min_multi_pw_aff(
6736                 __isl_take isl_map *map);
6737         __isl_give isl_multi_pw_aff *
6738         isl_map_max_multi_pw_aff(
6739                 __isl_take isl_map *map);
6741 Compute the minimum or maximum of the (given) set or output dimension(s)
6742 as a function of the parameters (and input dimensions), but independently
6743 of the other set or output dimensions.
6744 For lexicographic optimization, see L<"Lexicographic Optimization">.
6746 =item * Dual
6748 The following functions compute either the set of (rational) coefficient
6749 values of valid constraints for the given set or the set of (rational)
6750 values satisfying the constraints with coefficients from the given set.
6751 Internally, these two sets of functions perform essentially the
6752 same operations, except that the set of coefficients is assumed to
6753 be a cone, while the set of values may be any polyhedron.
6754 The current implementation is based on the Farkas lemma and
6755 Fourier-Motzkin elimination, but this may change or be made optional
6756 in future.  In particular, future implementations may use different
6757 dualization algorithms or skip the elimination step.
6759         #include <isl/set.h>
6760         __isl_give isl_basic_set *isl_basic_set_coefficients(
6761                 __isl_take isl_basic_set *bset);
6762         __isl_give isl_basic_set_list *
6763         isl_basic_set_list_coefficients(
6764                 __isl_take isl_basic_set_list *list);
6765         __isl_give isl_basic_set *isl_set_coefficients(
6766                 __isl_take isl_set *set);
6767         __isl_give isl_union_set *isl_union_set_coefficients(
6768                 __isl_take isl_union_set *bset);
6769         __isl_give isl_basic_set *isl_basic_set_solutions(
6770                 __isl_take isl_basic_set *bset);
6771         __isl_give isl_basic_set *isl_set_solutions(
6772                 __isl_take isl_set *set);
6773         __isl_give isl_union_set *isl_union_set_solutions(
6774                 __isl_take isl_union_set *bset);
6776 =item * Power
6778         __isl_give isl_map *isl_map_fixed_power_val(
6779                 __isl_take isl_map *map,
6780                 __isl_take isl_val *exp);
6781         __isl_give isl_union_map *
6782         isl_union_map_fixed_power_val(
6783                 __isl_take isl_union_map *umap,
6784                 __isl_take isl_val *exp);
6786 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
6787 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
6788 of C<map> is computed.
6790         __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
6791                 isl_bool *exact);
6792         __isl_give isl_union_map *isl_union_map_power(
6793                 __isl_take isl_union_map *umap, isl_bool *exact);
6795 Compute a parametric representation for all positive powers I<k> of C<map>.
6796 The result maps I<k> to a nested relation corresponding to the
6797 I<k>th power of C<map>.
6798 The result may be an overapproximation.  If the result is known to be exact,
6799 then C<*exact> is set to C<1>.
6801 =item * Transitive closure
6803         __isl_give isl_map *isl_map_transitive_closure(
6804                 __isl_take isl_map *map, isl_bool *exact);
6805         __isl_give isl_union_map *isl_union_map_transitive_closure(
6806                 __isl_take isl_union_map *umap, isl_bool *exact);
6808 Compute the transitive closure of C<map>.
6809 The result may be an overapproximation.  If the result is known to be exact,
6810 then C<*exact> is set to C<1>.
6812 =item * Reaching path lengths
6814         __isl_give isl_map *isl_map_reaching_path_lengths(
6815                 __isl_take isl_map *map, isl_bool *exact);
6817 Compute a relation that maps each element in the range of C<map>
6818 to the lengths of all paths composed of edges in C<map> that
6819 end up in the given element.
6820 The result may be an overapproximation.  If the result is known to be exact,
6821 then C<*exact> is set to C<1>.
6822 To compute the I<maximal> path length, the resulting relation
6823 should be postprocessed by C<isl_map_lexmax>.
6824 In particular, if the input relation is a dependence relation
6825 (mapping sources to sinks), then the maximal path length corresponds
6826 to the free schedule.
6827 Note, however, that C<isl_map_lexmax> expects the maximum to be
6828 finite, so if the path lengths are unbounded (possibly due to
6829 the overapproximation), then you will get an error message.
6831 =item * Wrapping
6833         #include <isl/space.h>
6834         __isl_give isl_space *isl_space_wrap(
6835                 __isl_take isl_space *space);
6836         __isl_give isl_space *isl_space_unwrap(
6837                 __isl_take isl_space *space);
6839         #include <isl/local_space.h>
6840         __isl_give isl_local_space *isl_local_space_wrap(
6841                 __isl_take isl_local_space *ls);
6843         #include <isl/set.h>
6844         __isl_give isl_basic_map *isl_basic_set_unwrap(
6845                 __isl_take isl_basic_set *bset);
6846         __isl_give isl_map *isl_set_unwrap(
6847                 __isl_take isl_set *set);
6849         #include <isl/map.h>
6850         __isl_give isl_basic_set *isl_basic_map_wrap(
6851                 __isl_take isl_basic_map *bmap);
6852         __isl_give isl_set *isl_map_wrap(
6853                 __isl_take isl_map *map);
6855         #include <isl/union_set.h>
6856         __isl_give isl_union_map *isl_union_set_unwrap(
6857                 __isl_take isl_union_set *uset);
6859         #include <isl/union_map.h>
6860         __isl_give isl_union_set *isl_union_map_wrap(
6861                 __isl_take isl_union_map *umap);
6863 The input to C<isl_space_unwrap> should
6864 be the space of a set, while that of
6865 C<isl_space_wrap> should be the space of a relation.
6866 Conversely, the output of C<isl_space_unwrap> is the space
6867 of a relation, while that of C<isl_space_wrap> is the space of a set.
6869 =item * Flattening
6871 Remove any internal structure of domain (and range) of the given
6872 set or relation.  If there is any such internal structure in the input,
6873 then the name of the space is also removed.
6875         #include <isl/space.h>
6876         __isl_give isl_space *isl_space_flatten_domain(
6877                 __isl_take isl_space *space);
6878         __isl_give isl_space *isl_space_flatten_range(
6879                 __isl_take isl_space *space);
6881         #include <isl/local_space.h>
6882         __isl_give isl_local_space *
6883         isl_local_space_flatten_domain(
6884                 __isl_take isl_local_space *ls);
6885         __isl_give isl_local_space *
6886         isl_local_space_flatten_range(
6887                 __isl_take isl_local_space *ls);
6889         #include <isl/set.h>
6890         __isl_give isl_basic_set *isl_basic_set_flatten(
6891                 __isl_take isl_basic_set *bset);
6892         __isl_give isl_set *isl_set_flatten(
6893                 __isl_take isl_set *set);
6895         #include <isl/map.h>
6896         __isl_give isl_basic_map *isl_basic_map_flatten_domain(
6897                 __isl_take isl_basic_map *bmap);
6898         __isl_give isl_basic_map *isl_basic_map_flatten_range(
6899                 __isl_take isl_basic_map *bmap);
6900         __isl_give isl_map *isl_map_flatten_range(
6901                 __isl_take isl_map *map);
6902         __isl_give isl_map *isl_map_flatten_domain(
6903                 __isl_take isl_map *map);
6904         __isl_give isl_basic_map *isl_basic_map_flatten(
6905                 __isl_take isl_basic_map *bmap);
6906         __isl_give isl_map *isl_map_flatten(
6907                 __isl_take isl_map *map);
6909         #include <isl/id.h>
6910         __isl_give isl_multi_id *isl_multi_id_flatten_range(
6911                 __isl_take isl_multi_id *mi);
6913         #include <isl/val.h>
6914         __isl_give isl_multi_val *isl_multi_val_flatten_range(
6915                 __isl_take isl_multi_val *mv);
6917         #include <isl/aff.h>
6918         __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
6919                 __isl_take isl_multi_aff *ma);
6920         __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
6921                 __isl_take isl_multi_aff *ma);
6922         __isl_give isl_multi_pw_aff *
6923         isl_multi_pw_aff_flatten_range(
6924                 __isl_take isl_multi_pw_aff *mpa);
6925         __isl_give isl_multi_union_pw_aff *
6926         isl_multi_union_pw_aff_flatten_range(
6927                 __isl_take isl_multi_union_pw_aff *mupa);
6929         #include <isl/map.h>
6930         __isl_give isl_map *isl_set_flatten_map(
6931                 __isl_take isl_set *set);
6933 The function above constructs a relation
6934 that maps the input set to a flattened version of the set.
6936 =item * Lifting
6938 Lift the input set to a space with extra dimensions corresponding
6939 to the existentially quantified variables in the input.
6940 In particular, the result lives in a wrapped map where the domain
6941 is the original space and the range corresponds to the original
6942 existentially quantified variables.
6944         #include <isl/set.h>
6945         __isl_give isl_basic_set *isl_basic_set_lift(
6946                 __isl_take isl_basic_set *bset);
6947         __isl_give isl_set *isl_set_lift(
6948                 __isl_take isl_set *set);
6949         __isl_give isl_union_set *isl_union_set_lift(
6950                 __isl_take isl_union_set *uset);
6952 Given a local space that contains the existentially quantified
6953 variables of a set, a basic relation that, when applied to
6954 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
6955 can be constructed using the following function.
6957         #include <isl/local_space.h>
6958         __isl_give isl_basic_map *isl_local_space_lifting(
6959                 __isl_take isl_local_space *ls);
6961         #include <isl/aff.h>
6962         __isl_give isl_multi_aff *isl_multi_aff_lift(
6963                 __isl_take isl_multi_aff *maff,
6964                 __isl_give isl_local_space **ls);
6966 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
6967 then it is assigned the local space that lies at the basis of
6968 the lifting applied.
6970 =item * Internal Product
6972         #include <isl/space.h>
6973         __isl_give isl_space *isl_space_zip(
6974                 __isl_take isl_space *space);
6976         #include <isl/map.h>
6977         __isl_give isl_basic_map *isl_basic_map_zip(
6978                 __isl_take isl_basic_map *bmap);
6979         __isl_give isl_map *isl_map_zip(
6980                 __isl_take isl_map *map);
6982         #include <isl/union_map.h>
6983         __isl_give isl_union_map *isl_union_map_zip(
6984                 __isl_take isl_union_map *umap);
6986 Given a relation with nested relations for domain and range,
6987 interchange the range of the domain with the domain of the range.
6989 =item * Currying
6991         #include <isl/space.h>
6992         __isl_give isl_space *isl_space_curry(
6993                 __isl_take isl_space *space);
6994         __isl_give isl_space *isl_space_uncurry(
6995                 __isl_take isl_space *space);
6997         #include <isl/map.h>
6998         __isl_give isl_basic_map *isl_basic_map_curry(
6999                 __isl_take isl_basic_map *bmap);
7000         __isl_give isl_basic_map *isl_basic_map_uncurry(
7001                 __isl_take isl_basic_map *bmap);
7002         __isl_give isl_map *isl_map_curry(
7003                 __isl_take isl_map *map);
7004         __isl_give isl_map *isl_map_uncurry(
7005                 __isl_take isl_map *map);
7007         #include <isl/union_map.h>
7008         __isl_give isl_union_map *isl_union_map_curry(
7009                 __isl_take isl_union_map *umap);
7010         __isl_give isl_union_map *isl_union_map_uncurry(
7011                 __isl_take isl_union_map *umap);
7013 Given a relation with a nested relation for domain,
7014 the C<curry> functions
7015 move the range of the nested relation out of the domain
7016 and use it as the domain of a nested relation in the range,
7017 with the original range as range of this nested relation.
7018 The C<uncurry> functions perform the inverse operation.
7020         #include <isl/space.h>
7021         __isl_give isl_space *isl_space_range_curry(
7022                 __isl_take isl_space *space);
7024         #include <isl/map.h>
7025         __isl_give isl_map *isl_map_range_curry(
7026                 __isl_take isl_map *map);
7028         #include <isl/union_map.h>
7029         __isl_give isl_union_map *isl_union_map_range_curry(
7030                 __isl_take isl_union_map *umap);
7032 These functions apply the currying to the relation that
7033 is nested inside the range of the input.
7035 =item * Aligning parameters
7037 Change the order of the parameters of the given set, relation
7038 or function
7039 such that the first parameters match those of C<model>.
7040 This may involve the introduction of extra parameters.
7041 All parameters need to be named.
7043         #include <isl/space.h>
7044         __isl_give isl_space *isl_space_align_params(
7045                 __isl_take isl_space *space1,
7046                 __isl_take isl_space *space2)
7048         #include <isl/set.h>
7049         __isl_give isl_basic_set *isl_basic_set_align_params(
7050                 __isl_take isl_basic_set *bset,
7051                 __isl_take isl_space *model);
7052         __isl_give isl_set *isl_set_align_params(
7053                 __isl_take isl_set *set,
7054                 __isl_take isl_space *model);
7056         #include <isl/map.h>
7057         __isl_give isl_basic_map *isl_basic_map_align_params(
7058                 __isl_take isl_basic_map *bmap,
7059                 __isl_take isl_space *model);
7060         __isl_give isl_map *isl_map_align_params(
7061                 __isl_take isl_map *map,
7062                 __isl_take isl_space *model);
7064         #include <isl/id.h>
7065         __isl_give isl_multi_id *isl_multi_id_align_params(
7066                 __isl_take isl_multi_id *mi,
7067                 __isl_take isl_space *model);
7069         #include <isl/val.h>
7070         __isl_give isl_multi_val *isl_multi_val_align_params(
7071                 __isl_take isl_multi_val *mv,
7072                 __isl_take isl_space *model);
7074         #include <isl/aff.h>
7075         __isl_give isl_aff *isl_aff_align_params(
7076                 __isl_take isl_aff *aff,
7077                 __isl_take isl_space *model);
7078         __isl_give isl_multi_aff *isl_multi_aff_align_params(
7079                 __isl_take isl_multi_aff *multi,
7080                 __isl_take isl_space *model);
7081         __isl_give isl_pw_aff *isl_pw_aff_align_params(
7082                 __isl_take isl_pw_aff *pwaff,
7083                 __isl_take isl_space *model);
7084         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
7085                 __isl_take isl_pw_multi_aff *pma,
7086                 __isl_take isl_space *model);
7087         __isl_give isl_union_pw_aff *
7088         isl_union_pw_aff_align_params(
7089                 __isl_take isl_union_pw_aff *upa,
7090                 __isl_take isl_space *model);
7091         __isl_give isl_union_pw_multi_aff *
7092         isl_union_pw_multi_aff_align_params(
7093                 __isl_take isl_union_pw_multi_aff *upma,
7094                 __isl_take isl_space *model);
7095         __isl_give isl_multi_union_pw_aff *
7096         isl_multi_union_pw_aff_align_params(
7097                 __isl_take isl_multi_union_pw_aff *mupa,
7098                 __isl_take isl_space *model);
7100         #include <isl/polynomial.h>
7101         __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
7102                 __isl_take isl_qpolynomial *qp,
7103                 __isl_take isl_space *model);
7105 =item * Drop unused parameters
7107 Drop parameters that are not referenced by the isl object.
7108 All parameters need to be named.
7110         #include <isl/set.h>
7111         __isl_give isl_basic_set *
7112         isl_basic_set_drop_unused_params(
7113                 __isl_take isl_basic_set *bset);
7114         __isl_give isl_set *isl_set_drop_unused_params(
7115                 __isl_take isl_set *set);
7117         #include <isl/map.h>
7118         __isl_give isl_basic_map *
7119         isl_basic_map_drop_unused_params(
7120                 __isl_take isl_basic_map *bmap);
7121         __isl_give isl_map *isl_map_drop_unused_params(
7122                 __isl_take isl_map *map);
7124         #include <isl/union_set.h>
7125         __isl_give isl_union_set *
7126         isl_union_set_drop_unused_params(
7127                 __isl_take isl_union_set *uset);
7129         #include <isl/union_map.h>
7130         __isl_give isl_union_map *
7131         isl_union_map_drop_unused_params(
7132                 __isl_take isl_union_map *umap);
7134         #include <isl/aff.h>
7135         __isl_give isl_pw_aff *isl_pw_aff_drop_unused_params(
7136                 __isl_take isl_pw_aff *pa);
7137         __isl_give isl_pw_multi_aff *
7138         isl_pw_multi_aff_drop_unused_params(
7139                 __isl_take isl_pw_multi_aff *pma);
7140         __isl_give isl_union_pw_aff *
7141         isl_union_pw_aff_drop_unused_params(
7142                 __isl_take isl_union_pw_aff *upa);
7143         __isl_give isl_union_pw_multi_aff *
7144         isl_union_pw_multi_aff_drop_unused_params(
7145                 __isl_take isl_union_pw_multi_aff *upma);
7147         #include <isl/polynomial.h>
7148         __isl_give isl_pw_qpolynomial *
7149         isl_pw_qpolynomial_drop_unused_params(
7150                 __isl_take isl_pw_qpolynomial *pwqp);
7151         __isl_give isl_pw_qpolynomial_fold *
7152         isl_pw_qpolynomial_fold_drop_unused_params(
7153                 __isl_take isl_pw_qpolynomial_fold *pwf);
7154         __isl_give isl_union_pw_qpolynomial *
7155         isl_union_pw_qpolynomial_drop_unused_params(
7156                 __isl_take isl_union_pw_qpolynomial *upwqp);
7157         __isl_give isl_union_pw_qpolynomial_fold *
7158         isl_union_pw_qpolynomial_fold_drop_unused_params(
7159                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
7161 =item * Unary Arithmetic Operations
7163         #include <isl/set.h>
7164         __isl_give isl_set *isl_set_neg(
7165                 __isl_take isl_set *set);
7166         #include <isl/map.h>
7167         __isl_give isl_map *isl_map_neg(
7168                 __isl_take isl_map *map);
7170 C<isl_set_neg> constructs a set containing the opposites of
7171 the elements in its argument.
7172 The domain of the result of C<isl_map_neg> is the same
7173 as the domain of its argument.  The corresponding range
7174 elements are the opposites of the corresponding range
7175 elements in the argument.
7177         #include <isl/val.h>
7178         __isl_give isl_multi_val *isl_multi_val_neg(
7179                 __isl_take isl_multi_val *mv);
7181         #include <isl/aff.h>
7182         __isl_give isl_aff *isl_aff_neg(
7183                 __isl_take isl_aff *aff);
7184         __isl_give isl_multi_aff *isl_multi_aff_neg(
7185                 __isl_take isl_multi_aff *ma);
7186         __isl_give isl_pw_aff *isl_pw_aff_neg(
7187                 __isl_take isl_pw_aff *pwaff);
7188         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
7189                 __isl_take isl_pw_multi_aff *pma);
7190         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
7191                 __isl_take isl_multi_pw_aff *mpa);
7192         __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
7193                 __isl_take isl_union_pw_aff *upa);
7194         __isl_give isl_union_pw_multi_aff *
7195         isl_union_pw_multi_aff_neg(
7196                 __isl_take isl_union_pw_multi_aff *upma);
7197         __isl_give isl_multi_union_pw_aff *
7198         isl_multi_union_pw_aff_neg(
7199                 __isl_take isl_multi_union_pw_aff *mupa);
7200         __isl_give isl_aff *isl_aff_ceil(
7201                 __isl_take isl_aff *aff);
7202         __isl_give isl_pw_aff *isl_pw_aff_ceil(
7203                 __isl_take isl_pw_aff *pwaff);
7204         __isl_give isl_aff *isl_aff_floor(
7205                 __isl_take isl_aff *aff);
7206         __isl_give isl_multi_aff *isl_multi_aff_floor(
7207                 __isl_take isl_multi_aff *ma);
7208         __isl_give isl_pw_aff *isl_pw_aff_floor(
7209                 __isl_take isl_pw_aff *pwaff);
7210         __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
7211                 __isl_take isl_union_pw_aff *upa);
7212         __isl_give isl_multi_union_pw_aff *
7213         isl_multi_union_pw_aff_floor(
7214                 __isl_take isl_multi_union_pw_aff *mupa);
7216         #include <isl/aff.h>
7217         __isl_give isl_pw_aff *isl_pw_aff_list_min(
7218                 __isl_take isl_pw_aff_list *list);
7219         __isl_give isl_pw_aff *isl_pw_aff_list_max(
7220                 __isl_take isl_pw_aff_list *list);
7222         #include <isl/polynomial.h>
7223         __isl_give isl_qpolynomial *isl_qpolynomial_neg(
7224                 __isl_take isl_qpolynomial *qp);
7225         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
7226                 __isl_take isl_pw_qpolynomial *pwqp);
7227         __isl_give isl_union_pw_qpolynomial *
7228         isl_union_pw_qpolynomial_neg(
7229                 __isl_take isl_union_pw_qpolynomial *upwqp);
7230         __isl_give isl_qpolynomial *isl_qpolynomial_pow(
7231                 __isl_take isl_qpolynomial *qp,
7232                 unsigned exponent);
7233         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
7234                 __isl_take isl_pw_qpolynomial *pwqp,
7235                 unsigned exponent);
7237 =item * Evaluation
7239 The following functions evaluate a function in a point.
7241         #include <isl/aff.h>
7242         __isl_give isl_val *isl_aff_eval(
7243                 __isl_take isl_aff *aff,
7244                 __isl_take isl_point *pnt);
7245         __isl_give isl_val *isl_pw_aff_eval(
7246                 __isl_take isl_pw_aff *pa,
7247                 __isl_take isl_point *pnt);
7249         #include <isl/polynomial.h>
7250         __isl_give isl_val *isl_pw_qpolynomial_eval(
7251                 __isl_take isl_pw_qpolynomial *pwqp,
7252                 __isl_take isl_point *pnt);
7253         __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
7254                 __isl_take isl_pw_qpolynomial_fold *pwf,
7255                 __isl_take isl_point *pnt);
7256         __isl_give isl_val *isl_union_pw_qpolynomial_eval(
7257                 __isl_take isl_union_pw_qpolynomial *upwqp,
7258                 __isl_take isl_point *pnt);
7259         __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
7260                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7261                 __isl_take isl_point *pnt);
7263 These functions return NaN when evaluated at a void point.
7264 Note that C<isl_pw_aff_eval> returns NaN when the function is evaluated outside
7265 its definition domain, while C<isl_pw_qpolynomial_eval> returns zero
7266 when the function is evaluated outside its explicit domain.
7268 =item * Dimension manipulation
7270 It is usually not advisable to directly change the (input or output)
7271 space of a set or a relation as this removes the name and the internal
7272 structure of the space.  However, the functions below can be useful
7273 to add new parameters, assuming
7274 C<isl_set_align_params> and C<isl_map_align_params>
7275 are not sufficient.
7277         #include <isl/space.h>
7278         __isl_give isl_space *isl_space_add_dims(
7279                 __isl_take isl_space *space,
7280                 enum isl_dim_type type, unsigned n);
7281         __isl_give isl_space *isl_space_insert_dims(
7282                 __isl_take isl_space *space,
7283                 enum isl_dim_type type, unsigned pos, unsigned n);
7284         __isl_give isl_space *isl_space_drop_dims(
7285                 __isl_take isl_space *space,
7286                 enum isl_dim_type type, unsigned first, unsigned n);
7287         __isl_give isl_space *isl_space_move_dims(
7288                 __isl_take isl_space *space,
7289                 enum isl_dim_type dst_type, unsigned dst_pos,
7290                 enum isl_dim_type src_type, unsigned src_pos,
7291                 unsigned n);
7293         #include <isl/local_space.h>
7294         __isl_give isl_local_space *isl_local_space_add_dims(
7295                 __isl_take isl_local_space *ls,
7296                 enum isl_dim_type type, unsigned n);
7297         __isl_give isl_local_space *isl_local_space_insert_dims(
7298                 __isl_take isl_local_space *ls,
7299                 enum isl_dim_type type, unsigned first, unsigned n);
7300         __isl_give isl_local_space *isl_local_space_drop_dims(
7301                 __isl_take isl_local_space *ls,
7302                 enum isl_dim_type type, unsigned first, unsigned n);
7304         #include <isl/set.h>
7305         __isl_give isl_basic_set *isl_basic_set_add_dims(
7306                 __isl_take isl_basic_set *bset,
7307                 enum isl_dim_type type, unsigned n);
7308         __isl_give isl_set *isl_set_add_dims(
7309                 __isl_take isl_set *set,
7310                 enum isl_dim_type type, unsigned n);
7311         __isl_give isl_basic_set *isl_basic_set_insert_dims(
7312                 __isl_take isl_basic_set *bset,
7313                 enum isl_dim_type type, unsigned pos,
7314                 unsigned n);
7315         __isl_give isl_set *isl_set_insert_dims(
7316                 __isl_take isl_set *set,
7317                 enum isl_dim_type type, unsigned pos, unsigned n);
7318         __isl_give isl_basic_set *isl_basic_set_move_dims(
7319                 __isl_take isl_basic_set *bset,
7320                 enum isl_dim_type dst_type, unsigned dst_pos,
7321                 enum isl_dim_type src_type, unsigned src_pos,
7322                 unsigned n);
7323         __isl_give isl_set *isl_set_move_dims(
7324                 __isl_take isl_set *set,
7325                 enum isl_dim_type dst_type, unsigned dst_pos,
7326                 enum isl_dim_type src_type, unsigned src_pos,
7327                 unsigned n);
7329         #include <isl/map.h>
7330         __isl_give isl_basic_map *isl_basic_map_add_dims(
7331                 __isl_take isl_basic_map *bmap,
7332                 enum isl_dim_type type, unsigned n);
7333         __isl_give isl_map *isl_map_add_dims(
7334                 __isl_take isl_map *map,
7335                 enum isl_dim_type type, unsigned n);
7336         __isl_give isl_basic_map *isl_basic_map_insert_dims(
7337                 __isl_take isl_basic_map *bmap,
7338                 enum isl_dim_type type, unsigned pos,
7339                 unsigned n);
7340         __isl_give isl_map *isl_map_insert_dims(
7341                 __isl_take isl_map *map,
7342                 enum isl_dim_type type, unsigned pos, unsigned n);
7343         __isl_give isl_basic_map *isl_basic_map_move_dims(
7344                 __isl_take isl_basic_map *bmap,
7345                 enum isl_dim_type dst_type, unsigned dst_pos,
7346                 enum isl_dim_type src_type, unsigned src_pos,
7347                 unsigned n);
7348         __isl_give isl_map *isl_map_move_dims(
7349                 __isl_take isl_map *map,
7350                 enum isl_dim_type dst_type, unsigned dst_pos,
7351                 enum isl_dim_type src_type, unsigned src_pos,
7352                 unsigned n);
7354         #include <isl/val.h>
7355         __isl_give isl_multi_val *isl_multi_val_insert_dims(
7356                 __isl_take isl_multi_val *mv,
7357                 enum isl_dim_type type, unsigned first, unsigned n);
7358         __isl_give isl_multi_val *isl_multi_val_add_dims(
7359                 __isl_take isl_multi_val *mv,
7360                 enum isl_dim_type type, unsigned n);
7361         __isl_give isl_multi_val *isl_multi_val_drop_dims(
7362                 __isl_take isl_multi_val *mv,
7363                 enum isl_dim_type type, unsigned first, unsigned n);
7365         #include <isl/aff.h>
7366         __isl_give isl_aff *isl_aff_insert_dims(
7367                 __isl_take isl_aff *aff,
7368                 enum isl_dim_type type, unsigned first, unsigned n);
7369         __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
7370                 __isl_take isl_multi_aff *ma,
7371                 enum isl_dim_type type, unsigned first, unsigned n);
7372         __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
7373                 __isl_take isl_pw_aff *pwaff,
7374                 enum isl_dim_type type, unsigned first, unsigned n);
7375         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
7376                 __isl_take isl_multi_pw_aff *mpa,
7377                 enum isl_dim_type type, unsigned first, unsigned n);
7378         __isl_give isl_aff *isl_aff_add_dims(
7379                 __isl_take isl_aff *aff,
7380                 enum isl_dim_type type, unsigned n);
7381         __isl_give isl_multi_aff *isl_multi_aff_add_dims(
7382                 __isl_take isl_multi_aff *ma,
7383                 enum isl_dim_type type, unsigned n);
7384         __isl_give isl_pw_aff *isl_pw_aff_add_dims(
7385                 __isl_take isl_pw_aff *pwaff,
7386                 enum isl_dim_type type, unsigned n);
7387         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
7388                 __isl_take isl_multi_pw_aff *mpa,
7389                 enum isl_dim_type type, unsigned n);
7390         __isl_give isl_aff *isl_aff_drop_dims(
7391                 __isl_take isl_aff *aff,
7392                 enum isl_dim_type type, unsigned first, unsigned n);
7393         __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
7394                 __isl_take isl_multi_aff *maff,
7395                 enum isl_dim_type type, unsigned first, unsigned n);
7396         __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
7397                 __isl_take isl_pw_aff *pwaff,
7398                 enum isl_dim_type type, unsigned first, unsigned n);
7399         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
7400                 __isl_take isl_pw_multi_aff *pma,
7401                 enum isl_dim_type type, unsigned first, unsigned n);
7402         __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
7403                 __isl_take isl_union_pw_aff *upa,
7404                 enum isl_dim_type type, unsigned first, unsigned n);
7405         __isl_give isl_union_pw_multi_aff *
7406                 isl_union_pw_multi_aff_drop_dims(
7407                 __isl_take isl_union_pw_multi_aff *upma,
7408                 enum isl_dim_type type,
7409                 unsigned first, unsigned n);
7410         __isl_give isl_multi_union_pw_aff *
7411         isl_multi_union_pw_aff_drop_dims(
7412                 __isl_take isl_multi_union_pw_aff *mupa,
7413                 enum isl_dim_type type, unsigned first,
7414                 unsigned n);
7415         __isl_give isl_aff *isl_aff_move_dims(
7416                 __isl_take isl_aff *aff,
7417                 enum isl_dim_type dst_type, unsigned dst_pos,
7418                 enum isl_dim_type src_type, unsigned src_pos,
7419                 unsigned n);
7420         __isl_give isl_multi_aff *isl_multi_aff_move_dims(
7421                 __isl_take isl_multi_aff *ma,
7422                 enum isl_dim_type dst_type, unsigned dst_pos,
7423                 enum isl_dim_type src_type, unsigned src_pos,
7424                 unsigned n);
7425         __isl_give isl_pw_aff *isl_pw_aff_move_dims(
7426                 __isl_take isl_pw_aff *pa,
7427                 enum isl_dim_type dst_type, unsigned dst_pos,
7428                 enum isl_dim_type src_type, unsigned src_pos,
7429                 unsigned n);
7430         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
7431                 __isl_take isl_multi_pw_aff *pma,
7432                 enum isl_dim_type dst_type, unsigned dst_pos,
7433                 enum isl_dim_type src_type, unsigned src_pos,
7434                 unsigned n);
7436         #include <isl/polynomial.h>
7437         __isl_give isl_union_pw_qpolynomial *
7438         isl_union_pw_qpolynomial_drop_dims(
7439                 __isl_take isl_union_pw_qpolynomial *upwqp,
7440                 enum isl_dim_type type,
7441                 unsigned first, unsigned n);
7442         __isl_give isl_union_pw_qpolynomial_fold *
7443                 isl_union_pw_qpolynomial_fold_drop_dims(
7444                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7445                 enum isl_dim_type type,
7446                 unsigned first, unsigned n);
7448 The operations on union expressions can only manipulate parameters.
7450 =back
7452 =head2 Binary Operations
7454 The two arguments of a binary operation not only need to live
7455 in the same C<isl_ctx>, they currently also need to have
7456 the same (number of) parameters.
7458 =head3 Basic Operations
7460 =over
7462 =item * Intersection
7464         #include <isl/local_space.h>
7465         __isl_give isl_local_space *isl_local_space_intersect(
7466                 __isl_take isl_local_space *ls1,
7467                 __isl_take isl_local_space *ls2);
7469         #include <isl/set.h>
7470         __isl_give isl_basic_set *isl_basic_set_intersect_params(
7471                 __isl_take isl_basic_set *bset1,
7472                 __isl_take isl_basic_set *bset2);
7473         __isl_give isl_basic_set *isl_basic_set_intersect(
7474                 __isl_take isl_basic_set *bset1,
7475                 __isl_take isl_basic_set *bset2);
7476         __isl_give isl_basic_set *isl_basic_set_list_intersect(
7477                 __isl_take struct isl_basic_set_list *list);
7478         __isl_give isl_set *isl_set_intersect_params(
7479                 __isl_take isl_set *set,
7480                 __isl_take isl_set *params);
7481         __isl_give isl_set *isl_set_intersect(
7482                 __isl_take isl_set *set1,
7483                 __isl_take isl_set *set2);
7484         __isl_give isl_set *isl_set_intersect_factor_domain(
7485                 __isl_take isl_set *set,
7486                 __isl_take isl_set *domain);
7487         __isl_give isl_set *isl_set_intersect_factor_range(
7488                 __isl_take isl_set *set,
7489                 __isl_take isl_set *range);
7491         #include <isl/map.h>
7492         __isl_give isl_basic_map *isl_basic_map_intersect_params(
7493                 __isl_take isl_basic_map *bmap,
7494                 __isl_take isl_basic_set *bset);
7495         __isl_give isl_basic_map *isl_basic_map_intersect_domain(
7496                 __isl_take isl_basic_map *bmap,
7497                 __isl_take isl_basic_set *bset);
7498         __isl_give isl_basic_map *isl_basic_map_intersect_range(
7499                 __isl_take isl_basic_map *bmap,
7500                 __isl_take isl_basic_set *bset);
7501         __isl_give isl_basic_map *isl_basic_map_intersect(
7502                 __isl_take isl_basic_map *bmap1,
7503                 __isl_take isl_basic_map *bmap2);
7504         __isl_give isl_basic_map *isl_basic_map_list_intersect(
7505                 __isl_take isl_basic_map_list *list);
7506         __isl_give isl_map *isl_map_intersect_params(
7507                 __isl_take isl_map *map,
7508                 __isl_take isl_set *params);
7509         __isl_give isl_map *isl_map_intersect_domain(
7510                 __isl_take isl_map *map,
7511                 __isl_take isl_set *set);
7512         __isl_give isl_map *isl_map_intersect_range(
7513                 __isl_take isl_map *map,
7514                 __isl_take isl_set *set);
7515         __isl_give isl_map *isl_map_intersect(
7516                 __isl_take isl_map *map1,
7517                 __isl_take isl_map *map2);
7518         __isl_give isl_map *
7519         isl_map_intersect_domain_factor_domain(
7520                 __isl_take isl_map *map,
7521                 __isl_take isl_map *factor);
7522         __isl_give isl_map *
7523         isl_map_intersect_domain_factor_range(
7524                 __isl_take isl_map *map,
7525                 __isl_take isl_map *factor);
7526         __isl_give isl_map *
7527         isl_map_intersect_range_factor_domain(
7528                 __isl_take isl_map *map,
7529                 __isl_take isl_map *factor);
7530         __isl_give isl_map *
7531         isl_map_intersect_range_factor_range(
7532                 __isl_take isl_map *map,
7533                 __isl_take isl_map *factor);
7534         __isl_give isl_map *
7535         isl_map_intersect_domain_wrapped_domain(
7536                 __isl_take isl_map *map,
7537                 __isl_take isl_set *domain);
7538         __isl_give isl_map *
7539         isl_map_intersect_range_wrapped_domain(
7540                 __isl_take isl_map *map,
7541                 __isl_take isl_set *domain);
7543         #include <isl/union_set.h>
7544         __isl_give isl_union_set *isl_union_set_intersect_params(
7545                 __isl_take isl_union_set *uset,
7546                 __isl_take isl_set *set);
7547         __isl_give isl_union_set *isl_union_set_intersect(
7548                 __isl_take isl_union_set *uset1,
7549                 __isl_take isl_union_set *uset2);
7551         #include <isl/union_map.h>
7552         __isl_give isl_union_map *isl_union_map_intersect_params(
7553                 __isl_take isl_union_map *umap,
7554                 __isl_take isl_set *set);
7555         __isl_give isl_union_map *
7556         isl_union_map_intersect_domain_union_set(
7557                 __isl_take isl_union_map *umap,
7558                 __isl_take isl_union_set *uset);
7559         __isl_give isl_union_map *
7560         isl_union_map_intersect_domain_space(
7561                 __isl_take isl_union_map *umap,
7562                 __isl_take isl_space *space);
7563         __isl_give isl_union_map *isl_union_map_intersect_domain(
7564                 __isl_take isl_union_map *umap,
7565                 __isl_take isl_union_set *uset);
7566         __isl_give isl_union_map *
7567         isl_union_map_intersect_range_union_set(
7568                 __isl_take isl_union_map *umap,
7569                 __isl_take isl_union_set *uset);
7570         __isl_give isl_union_map *
7571         isl_union_map_intersect_range_space(
7572                 __isl_take isl_union_map *umap,
7573                 __isl_take isl_space *space);
7574         __isl_give isl_union_map *isl_union_map_intersect_range(
7575                 __isl_take isl_union_map *umap,
7576                 __isl_take isl_union_set *uset);
7577         __isl_give isl_union_map *isl_union_map_intersect(
7578                 __isl_take isl_union_map *umap1,
7579                 __isl_take isl_union_map *umap2);
7580         __isl_give isl_union_map *
7581         isl_union_map_intersect_domain_factor_domain(
7582                 __isl_take isl_union_map *umap,
7583                 __isl_take isl_union_map *factor);
7584         __isl_give isl_union_map *
7585         isl_union_map_intersect_domain_factor_range(
7586                 __isl_take isl_union_map *umap,
7587                 __isl_take isl_union_map *factor);
7588         __isl_give isl_union_map *
7589         isl_union_map_intersect_range_factor_domain(
7590                 __isl_take isl_union_map *umap,
7591                 __isl_take isl_union_map *factor);
7592         __isl_give isl_union_map *
7593         isl_union_map_intersect_range_factor_range(
7594                 __isl_take isl_union_map *umap,
7595                 __isl_take isl_union_map *factor);
7596         __isl_give isl_union_map *
7597         isl_union_map_intersect_domain_wrapped_domain_union_set(
7598                 __isl_take isl_union_map *umap,
7599                 __isl_take isl_union_set *domain);
7600         __isl_give isl_union_map *
7601         isl_union_map_intersect_range_wrapped_domain_union_set(
7602                 __isl_take isl_union_map *umap,
7603                 __isl_take isl_union_set *domain);
7605         #include <isl/aff.h>
7606         __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
7607                 __isl_take isl_pw_aff *pa,
7608                 __isl_take isl_set *set);
7609         __isl_give isl_multi_pw_aff *
7610         isl_multi_pw_aff_intersect_domain(
7611                 __isl_take isl_multi_pw_aff *mpa,
7612                 __isl_take isl_set *domain);
7613         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
7614                 __isl_take isl_pw_multi_aff *pma,
7615                 __isl_take isl_set *set);
7616         __isl_give isl_union_pw_aff *
7617         isl_union_pw_aff_intersect_domain_space(
7618                 __isl_take isl_union_pw_aff *upa,
7619                 __isl_take isl_space *space);
7620         __isl_give isl_union_pw_aff *
7621         isl_union_pw_aff_intersect_domain_union_set(
7622                 __isl_take isl_union_pw_aff *upa,
7623                 __isl_take isl_union_set *uset);
7624         __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
7625                 __isl_take isl_union_pw_aff *upa,
7626                 __isl_take isl_union_set *uset);
7627         __isl_give isl_union_pw_multi_aff *
7628         isl_union_pw_multi_aff_intersect_domain_space(
7629                 __isl_take isl_union_pw_multi_aff *upma,
7630                 __isl_take isl_space *space);
7631         __isl_give isl_union_pw_multi_aff *
7632         isl_union_pw_multi_aff_intersect_domain_union_set(
7633                 __isl_take isl_union_pw_multi_aff *upma,
7634                 __isl_take isl_union_set *uset);
7635         __isl_give isl_union_pw_multi_aff *
7636         isl_union_pw_multi_aff_intersect_domain(
7637                 __isl_take isl_union_pw_multi_aff *upma,
7638                 __isl_take isl_union_set *uset);
7639         __isl_give isl_multi_union_pw_aff *
7640         isl_multi_union_pw_aff_intersect_domain(
7641                 __isl_take isl_multi_union_pw_aff *mupa,
7642                 __isl_take isl_union_set *uset);
7643         __isl_give isl_pw_aff *
7644         isl_pw_aff_intersect_domain_wrapped_domain(
7645                 __isl_take isl_pw_aff *pa,
7646                 __isl_take isl_set *set);
7647         __isl_give isl_pw_multi_aff *
7648         isl_pw_multi_aff_intersect_domain_wrapped_domain(
7649                 __isl_take isl_pw_multi_aff *pma,
7650                 __isl_take isl_set *set);
7651         __isl_give isl_union_pw_aff *
7652         isl_union_pw_aff_intersect_domain_wrapped_domain(
7653                 __isl_take isl_union_pw_aff *upa,
7654                 __isl_take isl_union_set *uset);
7655         __isl_give isl_union_pw_multi_aff *
7656         isl_union_pw_multi_aff_intersect_domain_wrapped_domain(
7657                 __isl_take isl_union_pw_multi_aff *upma,
7658                 __isl_take isl_union_set *uset);
7659         __isl_give isl_pw_aff *
7660         isl_pw_aff_intersect_domain_wrapped_range(
7661                 __isl_take isl_pw_aff *pa,
7662                 __isl_take isl_set *set);
7663         __isl_give isl_pw_multi_aff *
7664         isl_pw_multi_aff_intersect_domain_wrapped_range(
7665                 __isl_take isl_pw_multi_aff *pma,
7666                 __isl_take isl_set *set);
7667         __isl_give isl_union_pw_multi_aff *
7668         isl_union_pw_multi_aff_intersect_domain_wrapped_range(
7669                 __isl_take isl_union_pw_multi_aff *upma,
7670                 __isl_take isl_union_set *uset);
7671         __isl_give isl_union_pw_aff *
7672         isl_union_pw_aff_intersect_domain_wrapped_range(
7673                 __isl_take isl_union_pw_aff *upa,
7674                 __isl_take isl_union_set *uset);
7675         __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
7676                 __isl_take isl_pw_aff *pa,
7677                 __isl_take isl_set *set);
7678         __isl_give isl_multi_pw_aff *
7679         isl_multi_pw_aff_intersect_params(
7680                 __isl_take isl_multi_pw_aff *mpa,
7681                 __isl_take isl_set *set);
7682         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
7683                 __isl_take isl_pw_multi_aff *pma,
7684                 __isl_take isl_set *set);
7685         __isl_give isl_union_pw_aff *
7686         isl_union_pw_aff_intersect_params(
7687                 __isl_take isl_union_pw_aff *upa,
7688                 __isl_take isl_set *set);
7689         __isl_give isl_union_pw_multi_aff *
7690         isl_union_pw_multi_aff_intersect_params(
7691                 __isl_take isl_union_pw_multi_aff *upma,
7692                 __isl_take isl_set *set);
7693         __isl_give isl_multi_union_pw_aff *
7694         isl_multi_union_pw_aff_intersect_params(
7695                 __isl_take isl_multi_union_pw_aff *mupa,
7696                 __isl_take isl_set *params);
7697         __isl_give isl_multi_union_pw_aff *
7698         isl_multi_union_pw_aff_intersect_range(
7699                 __isl_take isl_multi_union_pw_aff *mupa,
7700                 __isl_take isl_set *set);
7702         #include <isl/polynomial.h>
7703         __isl_give isl_pw_qpolynomial *
7704         isl_pw_qpolynomial_intersect_domain(
7705                 __isl_take isl_pw_qpolynomial *pwpq,
7706                 __isl_take isl_set *set);
7707         __isl_give isl_union_pw_qpolynomial *
7708         isl_union_pw_qpolynomial_intersect_domain_space(
7709                 __isl_take isl_union_pw_qpolynomial *upwpq,
7710                 __isl_take isl_space *space);
7711         __isl_give isl_union_pw_qpolynomial *
7712         isl_union_pw_qpolynomial_intersect_domain_union_set(
7713                 __isl_take isl_union_pw_qpolynomial *upwpq,
7714                 __isl_take isl_union_set *uset);
7715         __isl_give isl_union_pw_qpolynomial *
7716         isl_union_pw_qpolynomial_intersect_domain(
7717                 __isl_take isl_union_pw_qpolynomial *upwpq,
7718                 __isl_take isl_union_set *uset);
7719         __isl_give isl_union_pw_qpolynomial_fold *
7720         isl_union_pw_qpolynomial_fold_intersect_domain_space(
7721                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7722                 __isl_take isl_space *space);
7723         __isl_give isl_union_pw_qpolynomial_fold *
7724         isl_union_pw_qpolynomial_fold_intersect_domain_union_set(
7725                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7726                 __isl_take isl_union_set *uset);
7727         __isl_give isl_union_pw_qpolynomial_fold *
7728         isl_union_pw_qpolynomial_fold_intersect_domain(
7729                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7730                 __isl_take isl_union_set *uset);
7731         __isl_give isl_pw_qpolynomial *
7732         isl_pw_qpolynomial_intersect_domain_wrapped_domain(
7733                 __isl_take isl_pw_qpolynomial *pwpq,
7734                 __isl_take isl_set *set);
7735         __isl_give isl_pw_qpolynomial_fold *
7736         isl_pw_qpolynomial_fold_intersect_domain_wrapped_domain(
7737                 __isl_take isl_pw_qpolynomial_fold *pwf,
7738                 __isl_take isl_set *set);
7739         __isl_give isl_union_pw_qpolynomial *
7740         isl_union_pw_qpolynomial_intersect_domain_wrapped_domain(
7741                 __isl_take isl_union_pw_qpolynomial *upwpq,
7742                 __isl_take isl_union_set *uset);
7743         __isl_give isl_union_pw_qpolynomial_fold *
7744         isl_union_pw_qpolynomial_fold_intersect_domain_wrapped_domain(
7745                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7746                 __isl_take isl_union_set *uset);
7747         __isl_give isl_pw_qpolynomial *
7748         isl_pw_qpolynomial_intersect_domain_wrapped_range(
7749                 __isl_take isl_pw_qpolynomial *pwpq,
7750                 __isl_take isl_set *set);
7751         __isl_give isl_pw_qpolynomial_fold *
7752         isl_pw_qpolynomial_fold_intersect_domain_wrapped_range(
7753                 __isl_take isl_pw_qpolynomial_fold *pwf,
7754                 __isl_take isl_set *set);
7755         __isl_give isl_union_pw_qpolynomial *
7756         isl_union_pw_qpolynomial_intersect_domain_wrapped_range(
7757                 __isl_take isl_union_pw_qpolynomial *upwpq,
7758                 __isl_take isl_union_set *uset);
7759         __isl_give isl_union_pw_qpolynomial_fold *
7760         isl_union_pw_qpolynomial_fold_intersect_domain_wrapped_range(
7761                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7762                 __isl_take isl_union_set *uset);
7763         __isl_give isl_pw_qpolynomial *
7764         isl_pw_qpolynomial_intersect_params(
7765                 __isl_take isl_pw_qpolynomial *pwpq,
7766                 __isl_take isl_set *set);
7767         __isl_give isl_pw_qpolynomial_fold *
7768         isl_pw_qpolynomial_fold_intersect_params(
7769                 __isl_take isl_pw_qpolynomial_fold *pwf,
7770                 __isl_take isl_set *set);
7771         __isl_give isl_union_pw_qpolynomial *
7772         isl_union_pw_qpolynomial_intersect_params(
7773                 __isl_take isl_union_pw_qpolynomial *upwpq,
7774                 __isl_take isl_set *set);
7775         __isl_give isl_union_pw_qpolynomial_fold *
7776         isl_union_pw_qpolynomial_fold_intersect_params(
7777                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7778                 __isl_take isl_set *set);
7780 The second argument to the C<_params> functions needs to be
7781 a parametric (basic) set.  For the other functions, a parametric set
7782 for either argument is only allowed if the other argument is
7783 a parametric set as well.
7784 The list passed to C<isl_basic_set_list_intersect> needs to have
7785 at least one element and all elements need to live in the same space.
7786 The function C<isl_multi_union_pw_aff_intersect_range>
7787 restricts the input function to those shared domain elements
7788 that map to the specified range.
7789 C<isl_union_map_intersect_domain> is an alternative name for
7790 C<isl_union_map_intersect_domain_union_set>.
7791 Similarly for the other pairs of functions.
7793 =item * Union
7795         #include <isl/set.h>
7796         __isl_give isl_set *isl_basic_set_union(
7797                 __isl_take isl_basic_set *bset1,
7798                 __isl_take isl_basic_set *bset2);
7799         __isl_give isl_set *isl_set_union(
7800                 __isl_take isl_set *set1,
7801                 __isl_take isl_set *set2);
7802         __isl_give isl_set *isl_set_list_union(
7803                 __isl_take isl_set_list *list);
7805         #include <isl/map.h>
7806         __isl_give isl_map *isl_basic_map_union(
7807                 __isl_take isl_basic_map *bmap1,
7808                 __isl_take isl_basic_map *bmap2);
7809         __isl_give isl_map *isl_map_union(
7810                 __isl_take isl_map *map1,
7811                 __isl_take isl_map *map2);
7813         #include <isl/union_set.h>
7814         __isl_give isl_union_set *isl_union_set_union(
7815                 __isl_take isl_union_set *uset1,
7816                 __isl_take isl_union_set *uset2);
7817         __isl_give isl_union_set *isl_union_set_list_union(
7818                 __isl_take isl_union_set_list *list);
7820         #include <isl/union_map.h>
7821         __isl_give isl_union_map *isl_union_map_union(
7822                 __isl_take isl_union_map *umap1,
7823                 __isl_take isl_union_map *umap2);
7825 The list passed to C<isl_set_list_union> needs to have
7826 at least one element and all elements need to live in the same space.
7828 =item * Set difference
7830         #include <isl/set.h>
7831         __isl_give isl_set *isl_set_subtract(
7832                 __isl_take isl_set *set1,
7833                 __isl_take isl_set *set2);
7835         #include <isl/map.h>
7836         __isl_give isl_map *isl_map_subtract(
7837                 __isl_take isl_map *map1,
7838                 __isl_take isl_map *map2);
7839         __isl_give isl_map *isl_map_subtract_domain(
7840                 __isl_take isl_map *map,
7841                 __isl_take isl_set *dom);
7842         __isl_give isl_map *isl_map_subtract_range(
7843                 __isl_take isl_map *map,
7844                 __isl_take isl_set *dom);
7846         #include <isl/union_set.h>
7847         __isl_give isl_union_set *isl_union_set_subtract(
7848                 __isl_take isl_union_set *uset1,
7849                 __isl_take isl_union_set *uset2);
7851         #include <isl/union_map.h>
7852         __isl_give isl_union_map *isl_union_map_subtract(
7853                 __isl_take isl_union_map *umap1,
7854                 __isl_take isl_union_map *umap2);
7855         __isl_give isl_union_map *isl_union_map_subtract_domain(
7856                 __isl_take isl_union_map *umap,
7857                 __isl_take isl_union_set *dom);
7858         __isl_give isl_union_map *isl_union_map_subtract_range(
7859                 __isl_take isl_union_map *umap,
7860                 __isl_take isl_union_set *dom);
7862         #include <isl/aff.h>
7863         __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
7864                 __isl_take isl_pw_aff *pa,
7865                 __isl_take isl_set *set);
7866         __isl_give isl_pw_multi_aff *
7867         isl_pw_multi_aff_subtract_domain(
7868                 __isl_take isl_pw_multi_aff *pma,
7869                 __isl_take isl_set *set);
7870         __isl_give isl_union_pw_aff *
7871         isl_union_pw_aff_subtract_domain_union_set(
7872                 __isl_take isl_union_pw_aff *upa,
7873                 __isl_take isl_union_set *uset);
7874         __isl_give isl_union_pw_aff *
7875         isl_union_pw_aff_subtract_domain_space(
7876                 __isl_take isl_union_pw_aff *upa,
7877                 __isl_take isl_space *space);
7878         __isl_give isl_union_pw_aff *
7879         isl_union_pw_aff_subtract_domain(
7880                 __isl_take isl_union_pw_aff *upa,
7881                 __isl_take isl_union_set *uset);
7882         __isl_give isl_union_pw_multi_aff *
7883         isl_union_pw_multi_aff_subtract_domain_union_set(
7884                 __isl_take isl_union_pw_multi_aff *upma,
7885                 __isl_take isl_set *set);
7886         __isl_give isl_union_pw_multi_aff *
7887         isl_union_pw_multi_aff_subtract_domain_space(
7888                 __isl_take isl_union_pw_multi_aff *upma,
7889                 __isl_take isl_space *space);
7890         __isl_give isl_union_pw_multi_aff *
7891         isl_union_pw_multi_aff_subtract_domain(
7892                 __isl_take isl_union_pw_multi_aff *upma,
7893                 __isl_take isl_union_set *uset);
7895         #include <isl/polynomial.h>
7896         __isl_give isl_pw_qpolynomial *
7897         isl_pw_qpolynomial_subtract_domain(
7898                 __isl_take isl_pw_qpolynomial *pwpq,
7899                 __isl_take isl_set *set);
7900         __isl_give isl_pw_qpolynomial_fold *
7901         isl_pw_qpolynomial_fold_subtract_domain(
7902                 __isl_take isl_pw_qpolynomial_fold *pwf,
7903                 __isl_take isl_set *set);
7904         __isl_give isl_union_pw_qpolynomial *
7905         isl_union_pw_qpolynomial_subtract_domain_union_set(
7906                 __isl_take isl_union_pw_qpolynomial *upwpq,
7907                 __isl_take isl_union_set *uset);
7908         __isl_give isl_union_pw_qpolynomial *
7909         isl_union_pw_qpolynomial_subtract_domain_space(
7910                 __isl_take isl_union_pw_qpolynomial *upwpq,
7911                 __isl_take isl_space *space);
7912         __isl_give isl_union_pw_qpolynomial *
7913         isl_union_pw_qpolynomial_subtract_domain(
7914                 __isl_take isl_union_pw_qpolynomial *upwpq,
7915                 __isl_take isl_union_set *uset);
7916         __isl_give isl_union_pw_qpolynomial_fold *
7917         isl_union_pw_qpolynomial_fold_subtract_domain_union_set(
7918                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7919                 __isl_take isl_union_set *uset);
7920         __isl_give isl_union_pw_qpolynomial_fold *
7921         isl_union_pw_qpolynomial_fold_subtract_domain_space(
7922                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7923                 __isl_take isl_space *space);
7924         __isl_give isl_union_pw_qpolynomial_fold *
7925         isl_union_pw_qpolynomial_fold_subtract_domain(
7926                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7927                 __isl_take isl_union_set *uset);
7929 C<isl_union_pw_aff_subtract_domain> is an alternative name for
7930 C<isl_union_pw_aff_subtract_domain_union_set>.
7931 Similarly for the other pairs of functions.
7933 =item * Application
7935         #include <isl/space.h>
7936         __isl_give isl_space *isl_space_join(
7937                 __isl_take isl_space *left,
7938                 __isl_take isl_space *right);
7940         #include <isl/set.h>
7941         __isl_give isl_basic_set *isl_basic_set_apply(
7942                 __isl_take isl_basic_set *bset,
7943                 __isl_take isl_basic_map *bmap);
7944         __isl_give isl_set *isl_set_apply(
7945                 __isl_take isl_set *set,
7946                 __isl_take isl_map *map);
7948         #include <isl/union_set.h>
7949         __isl_give isl_union_set *isl_union_set_apply(
7950                 __isl_take isl_union_set *uset,
7951                 __isl_take isl_union_map *umap);
7953         #include <isl/map.h>
7954         __isl_give isl_basic_map *isl_basic_map_apply_domain(
7955                 __isl_take isl_basic_map *bmap1,
7956                 __isl_take isl_basic_map *bmap2);
7957         __isl_give isl_basic_map *isl_basic_map_apply_range(
7958                 __isl_take isl_basic_map *bmap1,
7959                 __isl_take isl_basic_map *bmap2);
7960         __isl_give isl_map *isl_map_apply_domain(
7961                 __isl_take isl_map *map1,
7962                 __isl_take isl_map *map2);
7963         __isl_give isl_map *isl_map_apply_range(
7964                 __isl_take isl_map *map1,
7965                 __isl_take isl_map *map2);
7967         #include <isl/union_map.h>
7968         __isl_give isl_union_map *isl_union_map_apply_domain(
7969                 __isl_take isl_union_map *umap1,
7970                 __isl_take isl_union_map *umap2);
7971         __isl_give isl_union_map *isl_union_map_apply_range(
7972                 __isl_take isl_union_map *umap1,
7973                 __isl_take isl_union_map *umap2);
7975         #include <isl/aff.h>
7976         __isl_give isl_union_pw_multi_aff *
7977         isl_union_pw_multi_aff_apply_union_pw_multi_aff(
7978                 __isl_take isl_union_pw_multi_aff *upma1,
7979                 __isl_take isl_union_pw_multi_aff *upma2);
7980         __isl_give isl_union_pw_aff *
7981         isl_multi_union_pw_aff_apply_aff(
7982                 __isl_take isl_multi_union_pw_aff *mupa,
7983                 __isl_take isl_aff *aff);
7984         __isl_give isl_union_pw_aff *
7985         isl_multi_union_pw_aff_apply_pw_aff(
7986                 __isl_take isl_multi_union_pw_aff *mupa,
7987                 __isl_take isl_pw_aff *pa);
7988         __isl_give isl_multi_union_pw_aff *
7989         isl_multi_union_pw_aff_apply_multi_aff(
7990                 __isl_take isl_multi_union_pw_aff *mupa,
7991                 __isl_take isl_multi_aff *ma);
7992         __isl_give isl_multi_union_pw_aff *
7993         isl_multi_union_pw_aff_apply_pw_multi_aff(
7994                 __isl_take isl_multi_union_pw_aff *mupa,
7995                 __isl_take isl_pw_multi_aff *pma);
7997 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
7998 over the shared domain of the elements of the input.  The dimension is
7999 required to be greater than zero.
8000 The C<isl_multi_union_pw_aff> argument of
8001 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
8002 but only if the range of the C<isl_multi_aff> argument
8003 is also zero-dimensional.
8004 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
8006         #include <isl/polynomial.h>
8007         __isl_give isl_pw_qpolynomial_fold *
8008         isl_set_apply_pw_qpolynomial_fold(
8009                 __isl_take isl_set *set,
8010                 __isl_take isl_pw_qpolynomial_fold *pwf,
8011                 isl_bool *tight);
8012         __isl_give isl_pw_qpolynomial_fold *
8013         isl_map_apply_pw_qpolynomial_fold(
8014                 __isl_take isl_map *map,
8015                 __isl_take isl_pw_qpolynomial_fold *pwf,
8016                 isl_bool *tight);
8017         __isl_give isl_union_pw_qpolynomial_fold *
8018         isl_union_set_apply_union_pw_qpolynomial_fold(
8019                 __isl_take isl_union_set *uset,
8020                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
8021                 isl_bool *tight);
8022         __isl_give isl_union_pw_qpolynomial_fold *
8023         isl_union_map_apply_union_pw_qpolynomial_fold(
8024                 __isl_take isl_union_map *umap,
8025                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
8026                 isl_bool *tight);
8028 The functions taking a map
8029 compose the given map with the given piecewise quasipolynomial reduction.
8030 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
8031 over all elements in the intersection of the range of the map
8032 and the domain of the piecewise quasipolynomial reduction
8033 as a function of an element in the domain of the map.
8034 The functions taking a set compute a bound over all elements in the
8035 intersection of the set and the domain of the
8036 piecewise quasipolynomial reduction.
8038 =item * Preimage
8040         #include <isl/set.h>
8041         __isl_give isl_basic_set *
8042         isl_basic_set_preimage_multi_aff(
8043                 __isl_take isl_basic_set *bset,
8044                 __isl_take isl_multi_aff *ma);
8045         __isl_give isl_set *isl_set_preimage_multi_aff(
8046                 __isl_take isl_set *set,
8047                 __isl_take isl_multi_aff *ma);
8048         __isl_give isl_set *isl_set_preimage_pw_multi_aff(
8049                 __isl_take isl_set *set,
8050                 __isl_take isl_pw_multi_aff *pma);
8051         __isl_give isl_set *isl_set_preimage_multi_pw_aff(
8052                 __isl_take isl_set *set,
8053                 __isl_take isl_multi_pw_aff *mpa);
8055         #include <isl/union_set.h>
8056         __isl_give isl_union_set *
8057         isl_union_set_preimage_multi_aff(
8058                 __isl_take isl_union_set *uset,
8059                 __isl_take isl_multi_aff *ma);
8060         __isl_give isl_union_set *
8061         isl_union_set_preimage_pw_multi_aff(
8062                 __isl_take isl_union_set *uset,
8063                 __isl_take isl_pw_multi_aff *pma);
8064         __isl_give isl_union_set *
8065         isl_union_set_preimage_union_pw_multi_aff(
8066                 __isl_take isl_union_set *uset,
8067                 __isl_take isl_union_pw_multi_aff *upma);
8069         #include <isl/map.h>
8070         __isl_give isl_basic_map *
8071         isl_basic_map_preimage_domain_multi_aff(
8072                 __isl_take isl_basic_map *bmap,
8073                 __isl_take isl_multi_aff *ma);
8074         __isl_give isl_map *isl_map_preimage_domain_multi_aff(
8075                 __isl_take isl_map *map,
8076                 __isl_take isl_multi_aff *ma);
8077         __isl_give isl_map *isl_map_preimage_range_multi_aff(
8078                 __isl_take isl_map *map,
8079                 __isl_take isl_multi_aff *ma);
8080         __isl_give isl_map *
8081         isl_map_preimage_domain_pw_multi_aff(
8082                 __isl_take isl_map *map,
8083                 __isl_take isl_pw_multi_aff *pma);
8084         __isl_give isl_map *
8085         isl_map_preimage_range_pw_multi_aff(
8086                 __isl_take isl_map *map,
8087                 __isl_take isl_pw_multi_aff *pma);
8088         __isl_give isl_map *
8089         isl_map_preimage_domain_multi_pw_aff(
8090                 __isl_take isl_map *map,
8091                 __isl_take isl_multi_pw_aff *mpa);
8092         __isl_give isl_basic_map *
8093         isl_basic_map_preimage_range_multi_aff(
8094                 __isl_take isl_basic_map *bmap,
8095                 __isl_take isl_multi_aff *ma);
8097         #include <isl/union_map.h>
8098         __isl_give isl_union_map *
8099         isl_union_map_preimage_domain_multi_aff(
8100                 __isl_take isl_union_map *umap,
8101                 __isl_take isl_multi_aff *ma);
8102         __isl_give isl_union_map *
8103         isl_union_map_preimage_range_multi_aff(
8104                 __isl_take isl_union_map *umap,
8105                 __isl_take isl_multi_aff *ma);
8106         __isl_give isl_union_map *
8107         isl_union_map_preimage_domain_pw_multi_aff(
8108                 __isl_take isl_union_map *umap,
8109                 __isl_take isl_pw_multi_aff *pma);
8110         __isl_give isl_union_map *
8111         isl_union_map_preimage_range_pw_multi_aff(
8112                 __isl_take isl_union_map *umap,
8113                 __isl_take isl_pw_multi_aff *pma);
8114         __isl_give isl_union_map *
8115         isl_union_map_preimage_domain_union_pw_multi_aff(
8116                 __isl_take isl_union_map *umap,
8117                 __isl_take isl_union_pw_multi_aff *upma);
8118         __isl_give isl_union_map *
8119         isl_union_map_preimage_range_union_pw_multi_aff(
8120                 __isl_take isl_union_map *umap,
8121                 __isl_take isl_union_pw_multi_aff *upma);
8123         #include <isl/aff.h>
8124         __isl_give isl_pw_multi_aff *
8125         isl_pw_multi_aff_preimage_domain_wrapped_domain_pw_multi_aff(
8126                 __isl_take isl_pw_multi_aff *pma1,
8127                 __isl_take isl_pw_multi_aff *pma2);
8128         __isl_give isl_union_pw_multi_aff *
8129         isl_union_pw_multi_aff_preimage_domain_wrapped_domain_union_pw_multi_aff(
8130                 __isl_take isl_union_pw_multi_aff *upma1,
8131                 __isl_take isl_union_pw_multi_aff *upma2);
8133 These functions compute the preimage of the given set or map domain/range under
8134 the given function.  In other words, the expression is plugged
8135 into the set description or into the domain/range of the map or function.
8137 =item * Pullback
8139         #include <isl/aff.h>
8140         __isl_give isl_aff *isl_aff_pullback_aff(
8141                 __isl_take isl_aff *aff1,
8142                 __isl_take isl_aff *aff2);
8143         __isl_give isl_aff *isl_aff_pullback_multi_aff(
8144                 __isl_take isl_aff *aff,
8145                 __isl_take isl_multi_aff *ma);
8146         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
8147                 __isl_take isl_pw_aff *pa,
8148                 __isl_take isl_multi_aff *ma);
8149         __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
8150                 __isl_take isl_pw_aff *pa,
8151                 __isl_take isl_pw_multi_aff *pma);
8152         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
8153                 __isl_take isl_pw_aff *pa,
8154                 __isl_take isl_multi_pw_aff *mpa);
8155         __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
8156                 __isl_take isl_multi_aff *ma1,
8157                 __isl_take isl_multi_aff *ma2);
8158         __isl_give isl_pw_multi_aff *
8159         isl_pw_multi_aff_pullback_multi_aff(
8160                 __isl_take isl_pw_multi_aff *pma,
8161                 __isl_take isl_multi_aff *ma);
8162         __isl_give isl_multi_pw_aff *
8163         isl_multi_pw_aff_pullback_multi_aff(
8164                 __isl_take isl_multi_pw_aff *mpa,
8165                 __isl_take isl_multi_aff *ma);
8166         __isl_give isl_pw_multi_aff *
8167         isl_pw_multi_aff_pullback_pw_multi_aff(
8168                 __isl_take isl_pw_multi_aff *pma1,
8169                 __isl_take isl_pw_multi_aff *pma2);
8170         __isl_give isl_multi_pw_aff *
8171         isl_multi_pw_aff_pullback_pw_multi_aff(
8172                 __isl_take isl_multi_pw_aff *mpa,
8173                 __isl_take isl_pw_multi_aff *pma);
8174         __isl_give isl_multi_pw_aff *
8175         isl_multi_pw_aff_pullback_multi_pw_aff(
8176                 __isl_take isl_multi_pw_aff *mpa1,
8177                 __isl_take isl_multi_pw_aff *mpa2);
8178         __isl_give isl_union_pw_aff *
8179         isl_union_pw_aff_pullback_union_pw_multi_aff(
8180                 __isl_take isl_union_pw_aff *upa,
8181                 __isl_take isl_union_pw_multi_aff *upma);
8182         __isl_give isl_union_pw_multi_aff *
8183         isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
8184                 __isl_take isl_union_pw_multi_aff *upma1,
8185                 __isl_take isl_union_pw_multi_aff *upma2);
8186         __isl_give isl_multi_union_pw_aff *
8187         isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
8188                 __isl_take isl_multi_union_pw_aff *mupa,
8189                 __isl_take isl_union_pw_multi_aff *upma);
8191 These functions precompose the first expression by the second function.
8192 In other words, the second function is plugged
8193 into the first expression.
8195 =item * Locus
8197         #include <isl/aff.h>
8198         __isl_give isl_basic_set *isl_aff_eq_basic_set(
8199                 __isl_take isl_aff *aff1,
8200                 __isl_take isl_aff *aff2);
8201         __isl_give isl_set *isl_aff_eq_set(
8202                 __isl_take isl_aff *aff1,
8203                 __isl_take isl_aff *aff2);
8204         __isl_give isl_set *isl_aff_ne_set(
8205                 __isl_take isl_aff *aff1,
8206                 __isl_take isl_aff *aff2);
8207         __isl_give isl_basic_set *isl_aff_le_basic_set(
8208                 __isl_take isl_aff *aff1,
8209                 __isl_take isl_aff *aff2);
8210         __isl_give isl_set *isl_aff_le_set(
8211                 __isl_take isl_aff *aff1,
8212                 __isl_take isl_aff *aff2);
8213         __isl_give isl_basic_set *isl_aff_lt_basic_set(
8214                 __isl_take isl_aff *aff1,
8215                 __isl_take isl_aff *aff2);
8216         __isl_give isl_set *isl_aff_lt_set(
8217                 __isl_take isl_aff *aff1,
8218                 __isl_take isl_aff *aff2);
8219         __isl_give isl_basic_set *isl_aff_ge_basic_set(
8220                 __isl_take isl_aff *aff1,
8221                 __isl_take isl_aff *aff2);
8222         __isl_give isl_set *isl_aff_ge_set(
8223                 __isl_take isl_aff *aff1,
8224                 __isl_take isl_aff *aff2);
8225         __isl_give isl_basic_set *isl_aff_gt_basic_set(
8226                 __isl_take isl_aff *aff1,
8227                 __isl_take isl_aff *aff2);
8228         __isl_give isl_set *isl_aff_gt_set(
8229                 __isl_take isl_aff *aff1,
8230                 __isl_take isl_aff *aff2);
8231         __isl_give isl_set *isl_pw_aff_eq_set(
8232                 __isl_take isl_pw_aff *pwaff1,
8233                 __isl_take isl_pw_aff *pwaff2);
8234         __isl_give isl_set *isl_pw_aff_ne_set(
8235                 __isl_take isl_pw_aff *pwaff1,
8236                 __isl_take isl_pw_aff *pwaff2);
8237         __isl_give isl_set *isl_pw_aff_le_set(
8238                 __isl_take isl_pw_aff *pwaff1,
8239                 __isl_take isl_pw_aff *pwaff2);
8240         __isl_give isl_set *isl_pw_aff_lt_set(
8241                 __isl_take isl_pw_aff *pwaff1,
8242                 __isl_take isl_pw_aff *pwaff2);
8243         __isl_give isl_set *isl_pw_aff_ge_set(
8244                 __isl_take isl_pw_aff *pwaff1,
8245                 __isl_take isl_pw_aff *pwaff2);
8246         __isl_give isl_set *isl_pw_aff_gt_set(
8247                 __isl_take isl_pw_aff *pwaff1,
8248                 __isl_take isl_pw_aff *pwaff2);
8250         __isl_give isl_set *isl_multi_aff_lex_le_set(
8251                 __isl_take isl_multi_aff *ma1,
8252                 __isl_take isl_multi_aff *ma2);
8253         __isl_give isl_set *isl_multi_aff_lex_lt_set(
8254                 __isl_take isl_multi_aff *ma1,
8255                 __isl_take isl_multi_aff *ma2);
8256         __isl_give isl_set *isl_multi_aff_lex_ge_set(
8257                 __isl_take isl_multi_aff *ma1,
8258                 __isl_take isl_multi_aff *ma2);
8259         __isl_give isl_set *isl_multi_aff_lex_gt_set(
8260                 __isl_take isl_multi_aff *ma1,
8261                 __isl_take isl_multi_aff *ma2);
8263         __isl_give isl_set *isl_pw_aff_list_eq_set(
8264                 __isl_take isl_pw_aff_list *list1,
8265                 __isl_take isl_pw_aff_list *list2);
8266         __isl_give isl_set *isl_pw_aff_list_ne_set(
8267                 __isl_take isl_pw_aff_list *list1,
8268                 __isl_take isl_pw_aff_list *list2);
8269         __isl_give isl_set *isl_pw_aff_list_le_set(
8270                 __isl_take isl_pw_aff_list *list1,
8271                 __isl_take isl_pw_aff_list *list2);
8272         __isl_give isl_set *isl_pw_aff_list_lt_set(
8273                 __isl_take isl_pw_aff_list *list1,
8274                 __isl_take isl_pw_aff_list *list2);
8275         __isl_give isl_set *isl_pw_aff_list_ge_set(
8276                 __isl_take isl_pw_aff_list *list1,
8277                 __isl_take isl_pw_aff_list *list2);
8278         __isl_give isl_set *isl_pw_aff_list_gt_set(
8279                 __isl_take isl_pw_aff_list *list1,
8280                 __isl_take isl_pw_aff_list *list2);
8282 The function C<isl_aff_ge_basic_set> returns a basic set
8283 containing those elements in the shared space
8284 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
8285 The function C<isl_pw_aff_ge_set> returns a set
8286 containing those elements in the shared domain
8287 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
8288 greater than or equal to C<pwaff2>.
8289 The function C<isl_multi_aff_lex_le_set> returns a set
8290 containing those elements in the shared domain space
8291 where C<ma1> is lexicographically smaller than or
8292 equal to C<ma2>.
8293 The functions operating on C<isl_pw_aff_list> apply the corresponding
8294 C<isl_pw_aff> function to each pair of elements in the two lists.
8296         #include <isl/aff.h>
8297         __isl_give isl_map *isl_pw_aff_eq_map(
8298                 __isl_take isl_pw_aff *pa1,
8299                 __isl_take isl_pw_aff *pa2);
8300         __isl_give isl_map *isl_pw_aff_le_map(
8301                 __isl_take isl_pw_aff *pa1,
8302                 __isl_take isl_pw_aff *pa2);
8303         __isl_give isl_map *isl_pw_aff_lt_map(
8304                 __isl_take isl_pw_aff *pa1,
8305                 __isl_take isl_pw_aff *pa2);
8306         __isl_give isl_map *isl_pw_aff_ge_map(
8307                 __isl_take isl_pw_aff *pa1,
8308                 __isl_take isl_pw_aff *pa2);
8309         __isl_give isl_map *isl_pw_aff_gt_map(
8310                 __isl_take isl_pw_aff *pa1,
8311                 __isl_take isl_pw_aff *pa2);
8313         __isl_give isl_map *isl_multi_pw_aff_eq_map(
8314                 __isl_take isl_multi_pw_aff *mpa1,
8315                 __isl_take isl_multi_pw_aff *mpa2);
8316         __isl_give isl_map *isl_multi_pw_aff_lex_le_map(
8317                 __isl_take isl_multi_pw_aff *mpa1,
8318                 __isl_take isl_multi_pw_aff *mpa2);
8319         __isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
8320                 __isl_take isl_multi_pw_aff *mpa1,
8321                 __isl_take isl_multi_pw_aff *mpa2);
8322         __isl_give isl_map *isl_multi_pw_aff_lex_ge_map(
8323                 __isl_take isl_multi_pw_aff *mpa1,
8324                 __isl_take isl_multi_pw_aff *mpa2);
8325         __isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
8326                 __isl_take isl_multi_pw_aff *mpa1,
8327                 __isl_take isl_multi_pw_aff *mpa2);
8329 These functions return a map between domain elements of the arguments
8330 where the function values satisfy the given relation.
8332         #include <isl/map.h>
8333         __isl_give isl_map *isl_map_eq_at_multi_pw_aff(
8334                 __isl_take isl_map *map,
8335                 __isl_take isl_multi_pw_aff *mpa);
8336         __isl_give isl_map *isl_map_lex_lt_at_multi_pw_aff(
8337                 __isl_take isl_map *map,
8338                 __isl_take isl_multi_pw_aff *mpa);
8339         __isl_give isl_map *isl_map_lex_le_at_multi_pw_aff(
8340                 __isl_take isl_map *map,
8341                 __isl_take isl_multi_pw_aff *mpa);
8342         __isl_give isl_map *isl_map_lex_gt_at_multi_pw_aff(
8343                 __isl_take isl_map *map,
8344                 __isl_take isl_multi_pw_aff *mpa);
8345         __isl_give isl_map *isl_map_lex_ge_at_multi_pw_aff(
8346                 __isl_take isl_map *map,
8347                 __isl_take isl_multi_pw_aff *mpa);
8349         #include <isl/union_map.h>
8350         __isl_give isl_union_map *
8351         isl_union_map_eq_at_multi_union_pw_aff(
8352                 __isl_take isl_union_map *umap,
8353                 __isl_take isl_multi_union_pw_aff *mupa);
8354         __isl_give isl_union_map *
8355         isl_union_map_lex_lt_at_multi_union_pw_aff(
8356                 __isl_take isl_union_map *umap,
8357                 __isl_take isl_multi_union_pw_aff *mupa);
8358         __isl_give isl_union_map *
8359         isl_union_map_lex_le_at_multi_union_pw_aff(
8360                 __isl_take isl_union_map *umap,
8361                 __isl_take isl_multi_union_pw_aff *mupa);
8362         __isl_give isl_union_map *
8363         isl_union_map_lex_gt_at_multi_union_pw_aff(
8364                 __isl_take isl_union_map *umap,
8365                 __isl_take isl_multi_union_pw_aff *mupa);
8366         __isl_give isl_union_map *
8367         isl_union_map_lex_ge_at_multi_union_pw_aff(
8368                 __isl_take isl_union_map *umap,
8369                 __isl_take isl_multi_union_pw_aff *mupa);
8371 These functions select the subset of elements in the union map
8372 that have an equal or lexicographically smaller or greater function value.
8374 =item * Cartesian Product
8376         #include <isl/space.h>
8377         __isl_give isl_space *isl_space_product(
8378                 __isl_take isl_space *space1,
8379                 __isl_take isl_space *space2);
8380         __isl_give isl_space *isl_space_domain_product(
8381                 __isl_take isl_space *space1,
8382                 __isl_take isl_space *space2);
8383         __isl_give isl_space *isl_space_range_product(
8384                 __isl_take isl_space *space1,
8385                 __isl_take isl_space *space2);
8387 The functions
8388 C<isl_space_product>, C<isl_space_domain_product>
8389 and C<isl_space_range_product> take pairs or relation spaces and
8390 produce a single relations space, where either the domain, the range
8391 or both domain and range are wrapped spaces of relations between
8392 the domains and/or ranges of the input spaces.
8393 If the product is only constructed over the domain or the range
8394 then the ranges or the domains of the inputs should be the same.
8395 The function C<isl_space_product> also accepts a pair of set spaces,
8396 in which case it returns a wrapped space of a relation between the
8397 two input spaces.
8399         #include <isl/set.h>
8400         __isl_give isl_set *isl_set_product(
8401                 __isl_take isl_set *set1,
8402                 __isl_take isl_set *set2);
8404         #include <isl/map.h>
8405         __isl_give isl_basic_map *isl_basic_map_domain_product(
8406                 __isl_take isl_basic_map *bmap1,
8407                 __isl_take isl_basic_map *bmap2);
8408         __isl_give isl_basic_map *isl_basic_map_range_product(
8409                 __isl_take isl_basic_map *bmap1,
8410                 __isl_take isl_basic_map *bmap2);
8411         __isl_give isl_basic_map *isl_basic_map_product(
8412                 __isl_take isl_basic_map *bmap1,
8413                 __isl_take isl_basic_map *bmap2);
8414         __isl_give isl_map *isl_map_domain_product(
8415                 __isl_take isl_map *map1,
8416                 __isl_take isl_map *map2);
8417         __isl_give isl_map *isl_map_range_product(
8418                 __isl_take isl_map *map1,
8419                 __isl_take isl_map *map2);
8420         __isl_give isl_map *isl_map_product(
8421                 __isl_take isl_map *map1,
8422                 __isl_take isl_map *map2);
8424         #include <isl/union_set.h>
8425         __isl_give isl_union_set *isl_union_set_product(
8426                 __isl_take isl_union_set *uset1,
8427                 __isl_take isl_union_set *uset2);
8429         #include <isl/union_map.h>
8430         __isl_give isl_union_map *isl_union_map_domain_product(
8431                 __isl_take isl_union_map *umap1,
8432                 __isl_take isl_union_map *umap2);
8433         __isl_give isl_union_map *isl_union_map_range_product(
8434                 __isl_take isl_union_map *umap1,
8435                 __isl_take isl_union_map *umap2);
8436         __isl_give isl_union_map *isl_union_map_product(
8437                 __isl_take isl_union_map *umap1,
8438                 __isl_take isl_union_map *umap2);
8440         #include <isl/id.h>
8441         __isl_give isl_multi_id *isl_multi_id_range_product(
8442                 __isl_take isl_multi_id *mi1,
8443                 __isl_take isl_multi_id *mi2);
8445         #include <isl/val.h>
8446         __isl_give isl_multi_val *isl_multi_val_range_product(
8447                 __isl_take isl_multi_val *mv1,
8448                 __isl_take isl_multi_val *mv2);
8449         __isl_give isl_multi_val *isl_multi_val_product(
8450                 __isl_take isl_multi_val *mv1,
8451                 __isl_take isl_multi_val *mv2);
8453         #include <isl/aff.h>
8454         __isl_give isl_multi_aff *isl_multi_aff_range_product(
8455                 __isl_take isl_multi_aff *ma1,
8456                 __isl_take isl_multi_aff *ma2);
8457         __isl_give isl_multi_aff *isl_multi_aff_product(
8458                 __isl_take isl_multi_aff *ma1,
8459                 __isl_take isl_multi_aff *ma2);
8460         __isl_give isl_multi_pw_aff *
8461         isl_multi_pw_aff_range_product(
8462                 __isl_take isl_multi_pw_aff *mpa1,
8463                 __isl_take isl_multi_pw_aff *mpa2);
8464         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
8465                 __isl_take isl_multi_pw_aff *mpa1,
8466                 __isl_take isl_multi_pw_aff *mpa2);
8467         __isl_give isl_pw_multi_aff *
8468         isl_pw_multi_aff_range_product(
8469                 __isl_take isl_pw_multi_aff *pma1,
8470                 __isl_take isl_pw_multi_aff *pma2);
8471         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
8472                 __isl_take isl_pw_multi_aff *pma1,
8473                 __isl_take isl_pw_multi_aff *pma2);
8474         __isl_give isl_union_pw_multi_aff *
8475         isl_union_pw_multi_aff_range_product(
8476                 __isl_take isl_union_pw_multi_aff *upma1,
8477                 __isl_take isl_union_pw_multi_aff *upma2);
8478         __isl_give isl_multi_union_pw_aff *
8479         isl_multi_union_pw_aff_range_product(
8480                 __isl_take isl_multi_union_pw_aff *mupa1,
8481                 __isl_take isl_multi_union_pw_aff *mupa2);
8483 The above functions compute the cross product of the given
8484 sets, relations or functions.  The domains and ranges of the results
8485 are wrapped maps between domains and ranges of the inputs.
8486 To obtain a ``flat'' product, use the following functions
8487 instead.
8489         #include <isl/set.h>
8490         __isl_give isl_basic_set *isl_basic_set_flat_product(
8491                 __isl_take isl_basic_set *bset1,
8492                 __isl_take isl_basic_set *bset2);
8493         __isl_give isl_set *isl_set_flat_product(
8494                 __isl_take isl_set *set1,
8495                 __isl_take isl_set *set2);
8497         #include <isl/map.h>
8498         __isl_give isl_basic_map *isl_basic_map_flat_range_product(
8499                 __isl_take isl_basic_map *bmap1,
8500                 __isl_take isl_basic_map *bmap2);
8501         __isl_give isl_map *isl_map_flat_domain_product(
8502                 __isl_take isl_map *map1,
8503                 __isl_take isl_map *map2);
8504         __isl_give isl_map *isl_map_flat_range_product(
8505                 __isl_take isl_map *map1,
8506                 __isl_take isl_map *map2);
8507         __isl_give isl_basic_map *isl_basic_map_flat_product(
8508                 __isl_take isl_basic_map *bmap1,
8509                 __isl_take isl_basic_map *bmap2);
8510         __isl_give isl_map *isl_map_flat_product(
8511                 __isl_take isl_map *map1,
8512                 __isl_take isl_map *map2);
8514         #include <isl/union_map.h>
8515         __isl_give isl_union_map *
8516         isl_union_map_flat_domain_product(
8517                 __isl_take isl_union_map *umap1,
8518                 __isl_take isl_union_map *umap2);
8519         __isl_give isl_union_map *
8520         isl_union_map_flat_range_product(
8521                 __isl_take isl_union_map *umap1,
8522                 __isl_take isl_union_map *umap2);
8524         #include <isl/id.h>
8525         __isl_give isl_multi_id *
8526         isl_multi_id_flat_range_product(
8527                 __isl_take isl_multi_id *mi1,
8528                 __isl_take isl_multi_id *mi2);
8530         #include <isl/val.h>
8531         __isl_give isl_multi_val *isl_multi_val_flat_range_product(
8532                 __isl_take isl_multi_val *mv1,
8533                 __isl_take isl_multi_val *mv2);
8535         #include <isl/aff.h>
8536         __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
8537                 __isl_take isl_multi_aff *ma1,
8538                 __isl_take isl_multi_aff *ma2);
8539         __isl_give isl_pw_multi_aff *
8540         isl_pw_multi_aff_flat_range_product(
8541                 __isl_take isl_pw_multi_aff *pma1,
8542                 __isl_take isl_pw_multi_aff *pma2);
8543         __isl_give isl_multi_pw_aff *
8544         isl_multi_pw_aff_flat_range_product(
8545                 __isl_take isl_multi_pw_aff *mpa1,
8546                 __isl_take isl_multi_pw_aff *mpa2);
8547         __isl_give isl_union_pw_multi_aff *
8548         isl_union_pw_multi_aff_flat_range_product(
8549                 __isl_take isl_union_pw_multi_aff *upma1,
8550                 __isl_take isl_union_pw_multi_aff *upma2);
8551         __isl_give isl_multi_union_pw_aff *
8552         isl_multi_union_pw_aff_flat_range_product(
8553                 __isl_take isl_multi_union_pw_aff *mupa1,
8554                 __isl_take isl_multi_union_pw_aff *mupa2);
8556         #include <isl/space.h>
8557         __isl_give isl_space *isl_space_factor_domain(
8558                 __isl_take isl_space *space);
8559         __isl_give isl_space *isl_space_factor_range(
8560                 __isl_take isl_space *space);
8561         __isl_give isl_space *isl_space_domain_factor_domain(
8562                 __isl_take isl_space *space);
8563         __isl_give isl_space *isl_space_domain_factor_range(
8564                 __isl_take isl_space *space);
8565         __isl_give isl_space *isl_space_range_factor_domain(
8566                 __isl_take isl_space *space);
8567         __isl_give isl_space *isl_space_range_factor_range(
8568                 __isl_take isl_space *space);
8570 The functions C<isl_space_range_factor_domain> and
8571 C<isl_space_range_factor_range> extract the two arguments from
8572 the result of a call to C<isl_space_range_product>.
8574 The arguments of a call to a product can be extracted
8575 from the result using the following functions.
8577         #include <isl/map.h>
8578         __isl_give isl_map *isl_map_factor_domain(
8579                 __isl_take isl_map *map);
8580         __isl_give isl_map *isl_map_factor_range(
8581                 __isl_take isl_map *map);
8582         __isl_give isl_map *isl_map_domain_factor_domain(
8583                 __isl_take isl_map *map);
8584         __isl_give isl_map *isl_map_domain_factor_range(
8585                 __isl_take isl_map *map);
8586         __isl_give isl_map *isl_map_range_factor_domain(
8587                 __isl_take isl_map *map);
8588         __isl_give isl_map *isl_map_range_factor_range(
8589                 __isl_take isl_map *map);
8591         #include <isl/union_map.h>
8592         __isl_give isl_union_map *isl_union_map_factor_domain(
8593                 __isl_take isl_union_map *umap);
8594         __isl_give isl_union_map *isl_union_map_factor_range(
8595                 __isl_take isl_union_map *umap);
8596         __isl_give isl_union_map *
8597         isl_union_map_domain_factor_domain(
8598                 __isl_take isl_union_map *umap);
8599         __isl_give isl_union_map *
8600         isl_union_map_domain_factor_range(
8601                 __isl_take isl_union_map *umap);
8602         __isl_give isl_union_map *
8603         isl_union_map_range_factor_domain(
8604                 __isl_take isl_union_map *umap);
8605         __isl_give isl_union_map *
8606         isl_union_map_range_factor_range(
8607                 __isl_take isl_union_map *umap);
8609         #include <isl/id.h>
8610         __isl_give isl_multi_id *isl_multi_id_factor_range(
8611                 __isl_take isl_multi_id *mi);
8612         __isl_give isl_multi_id *
8613         isl_multi_id_range_factor_domain(
8614                 __isl_take isl_multi_id *mi);
8615         __isl_give isl_multi_id *
8616         isl_multi_id_range_factor_range(
8617                 __isl_take isl_multi_id *mi);
8619         #include <isl/val.h>
8620         __isl_give isl_multi_val *isl_multi_val_factor_range(
8621                 __isl_take isl_multi_val *mv);
8622         __isl_give isl_multi_val *
8623         isl_multi_val_range_factor_domain(
8624                 __isl_take isl_multi_val *mv);
8625         __isl_give isl_multi_val *
8626         isl_multi_val_range_factor_range(
8627                 __isl_take isl_multi_val *mv);
8629         #include <isl/aff.h>
8630         __isl_give isl_multi_aff *isl_multi_aff_factor_range(
8631                 __isl_take isl_multi_aff *ma);
8632         __isl_give isl_multi_aff *
8633         isl_multi_aff_range_factor_domain(
8634                 __isl_take isl_multi_aff *ma);
8635         __isl_give isl_multi_aff *
8636         isl_multi_aff_range_factor_range(
8637                 __isl_take isl_multi_aff *ma);
8638         __isl_give isl_multi_pw_aff *
8639         isl_multi_pw_aff_factor_range(
8640                 __isl_take isl_multi_pw_aff *mpa);
8641         __isl_give isl_multi_pw_aff *
8642         isl_multi_pw_aff_range_factor_domain(
8643                 __isl_take isl_multi_pw_aff *mpa);
8644         __isl_give isl_multi_pw_aff *
8645         isl_multi_pw_aff_range_factor_range(
8646                 __isl_take isl_multi_pw_aff *mpa);
8647         __isl_give isl_pw_multi_aff *
8648         isl_pw_multi_aff_range_factor_domain(
8649                 __isl_take isl_pw_multi_aff *pma);
8650         __isl_give isl_pw_multi_aff *
8651         isl_pw_multi_aff_range_factor_range(
8652                 __isl_take isl_pw_multi_aff *pma);
8653         __isl_give isl_union_pw_multi_aff *
8654         isl_union_pw_multi_aff_range_factor_domain(
8655                 __isl_take isl_union_pw_multi_aff *upma);
8656         __isl_give isl_union_pw_multi_aff *
8657         isl_union_pw_multi_aff_range_factor_range(
8658                 __isl_take isl_union_pw_multi_aff *upma);
8659         __isl_give isl_multi_union_pw_aff *
8660         isl_multi_union_pw_aff_factor_range(
8661                 __isl_take isl_multi_union_pw_aff *mupa);
8662         __isl_give isl_multi_union_pw_aff *
8663         isl_multi_union_pw_aff_range_factor_domain(
8664                 __isl_take isl_multi_union_pw_aff *mupa);
8665         __isl_give isl_multi_union_pw_aff *
8666         isl_multi_union_pw_aff_range_factor_range(
8667                 __isl_take isl_multi_union_pw_aff *mupa);
8669 The splice functions are a generalization of the flat product functions,
8670 where the second argument may be inserted at any position inside
8671 the first argument rather than being placed at the end.
8672 The functions C<isl_multi_val_factor_range>,
8673 C<isl_multi_aff_factor_range>,
8674 C<isl_multi_pw_aff_factor_range> and
8675 C<isl_multi_union_pw_aff_factor_range>
8676 take functions that live in a set space.
8678         #include <isl/id.h>
8679         __isl_give isl_multi_id *isl_multi_id_range_splice(
8680                 __isl_take isl_multi_id *mi1, unsigned pos,
8681                 __isl_take isl_multi_id *mi2);
8683         #include <isl/val.h>
8684         __isl_give isl_multi_val *isl_multi_val_range_splice(
8685                 __isl_take isl_multi_val *mv1, unsigned pos,
8686                 __isl_take isl_multi_val *mv2);
8688         #include <isl/aff.h>
8689         __isl_give isl_multi_aff *isl_multi_aff_range_splice(
8690                 __isl_take isl_multi_aff *ma1, unsigned pos,
8691                 __isl_take isl_multi_aff *ma2);
8692         __isl_give isl_multi_aff *isl_multi_aff_splice(
8693                 __isl_take isl_multi_aff *ma1,
8694                 unsigned in_pos, unsigned out_pos,
8695                 __isl_take isl_multi_aff *ma2);
8696         __isl_give isl_multi_pw_aff *
8697         isl_multi_pw_aff_range_splice(
8698                 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
8699                 __isl_take isl_multi_pw_aff *mpa2);
8700         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
8701                 __isl_take isl_multi_pw_aff *mpa1,
8702                 unsigned in_pos, unsigned out_pos,
8703                 __isl_take isl_multi_pw_aff *mpa2);
8704         __isl_give isl_multi_union_pw_aff *
8705         isl_multi_union_pw_aff_range_splice(
8706                 __isl_take isl_multi_union_pw_aff *mupa1,
8707                 unsigned pos,
8708                 __isl_take isl_multi_union_pw_aff *mupa2);
8710 =item * Simplification
8712 When applied to a set or relation,
8713 the gist operation returns a set or relation that has the
8714 same intersection with the context as the input set or relation.
8715 Any implicit equality in the intersection is made explicit in the result,
8716 while all inequalities that are redundant with respect to the intersection
8717 are removed.
8718 In case of union sets and relations, the gist operation is performed
8719 per space.
8721 When applied to a function,
8722 the gist operation applies the set gist operation to each of
8723 the cells in the domain of the input piecewise expression.
8724 The context is also exploited
8725 to simplify the expression associated to each cell.
8727         #include <isl/set.h>
8728         __isl_give isl_basic_set *isl_basic_set_gist(
8729                 __isl_take isl_basic_set *bset,
8730                 __isl_take isl_basic_set *context);
8731         __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
8732                 __isl_take isl_set *context);
8733         __isl_give isl_set *isl_set_gist_params(
8734                 __isl_take isl_set *set,
8735                 __isl_take isl_set *context);
8737         #include <isl/map.h>
8738         __isl_give isl_basic_map *isl_basic_map_gist(
8739                 __isl_take isl_basic_map *bmap,
8740                 __isl_take isl_basic_map *context);
8741         __isl_give isl_basic_map *isl_basic_map_gist_domain(
8742                 __isl_take isl_basic_map *bmap,
8743                 __isl_take isl_basic_set *context);
8744         __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
8745                 __isl_take isl_map *context);
8746         __isl_give isl_map *isl_map_gist_params(
8747                 __isl_take isl_map *map,
8748                 __isl_take isl_set *context);
8749         __isl_give isl_map *isl_map_gist_domain(
8750                 __isl_take isl_map *map,
8751                 __isl_take isl_set *context);
8752         __isl_give isl_map *isl_map_gist_range(
8753                 __isl_take isl_map *map,
8754                 __isl_take isl_set *context);
8756         #include <isl/union_set.h>
8757         __isl_give isl_union_set *isl_union_set_gist(
8758                 __isl_take isl_union_set *uset,
8759                 __isl_take isl_union_set *context);
8760         __isl_give isl_union_set *isl_union_set_gist_params(
8761                 __isl_take isl_union_set *uset,
8762                 __isl_take isl_set *set);
8764         #include <isl/union_map.h>
8765         __isl_give isl_union_map *isl_union_map_gist(
8766                 __isl_take isl_union_map *umap,
8767                 __isl_take isl_union_map *context);
8768         __isl_give isl_union_map *isl_union_map_gist_params(
8769                 __isl_take isl_union_map *umap,
8770                 __isl_take isl_set *set);
8771         __isl_give isl_union_map *isl_union_map_gist_domain(
8772                 __isl_take isl_union_map *umap,
8773                 __isl_take isl_union_set *uset);
8774         __isl_give isl_union_map *isl_union_map_gist_range(
8775                 __isl_take isl_union_map *umap,
8776                 __isl_take isl_union_set *uset);
8778         #include <isl/aff.h>
8779         __isl_give isl_aff *isl_aff_gist_params(
8780                 __isl_take isl_aff *aff,
8781                 __isl_take isl_set *context);
8782         __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
8783                 __isl_take isl_set *context);
8784         __isl_give isl_multi_aff *isl_multi_aff_gist_params(
8785                 __isl_take isl_multi_aff *maff,
8786                 __isl_take isl_set *context);
8787         __isl_give isl_multi_aff *isl_multi_aff_gist(
8788                 __isl_take isl_multi_aff *maff,
8789                 __isl_take isl_set *context);
8790         __isl_give isl_pw_aff *isl_pw_aff_gist_params(
8791                 __isl_take isl_pw_aff *pwaff,
8792                 __isl_take isl_set *context);
8793         __isl_give isl_pw_aff *isl_pw_aff_gist(
8794                 __isl_take isl_pw_aff *pwaff,
8795                 __isl_take isl_set *context);
8796         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
8797                 __isl_take isl_pw_multi_aff *pma,
8798                 __isl_take isl_set *set);
8799         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
8800                 __isl_take isl_pw_multi_aff *pma,
8801                 __isl_take isl_set *set);
8802         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
8803                 __isl_take isl_multi_pw_aff *mpa,
8804                 __isl_take isl_set *set);
8805         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
8806                 __isl_take isl_multi_pw_aff *mpa,
8807                 __isl_take isl_set *set);
8808         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
8809                 __isl_take isl_union_pw_aff *upa,
8810                 __isl_take isl_union_set *context);
8811         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
8812                 __isl_take isl_union_pw_aff *upa,
8813                 __isl_take isl_set *context);
8814         __isl_give isl_union_pw_multi_aff *
8815         isl_union_pw_multi_aff_gist_params(
8816                 __isl_take isl_union_pw_multi_aff *upma,
8817                 __isl_take isl_set *context);
8818         __isl_give isl_union_pw_multi_aff *
8819         isl_union_pw_multi_aff_gist(
8820                 __isl_take isl_union_pw_multi_aff *upma,
8821                 __isl_take isl_union_set *context);
8822         __isl_give isl_multi_union_pw_aff *
8823         isl_multi_union_pw_aff_gist_params(
8824                 __isl_take isl_multi_union_pw_aff *mupa,
8825                 __isl_take isl_set *context);
8826         __isl_give isl_multi_union_pw_aff *
8827         isl_multi_union_pw_aff_gist(
8828                 __isl_take isl_multi_union_pw_aff *mupa,
8829                 __isl_take isl_union_set *context);
8831         #include <isl/polynomial.h>
8832         __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
8833                 __isl_take isl_qpolynomial *qp,
8834                 __isl_take isl_set *context);
8835         __isl_give isl_qpolynomial *isl_qpolynomial_gist(
8836                 __isl_take isl_qpolynomial *qp,
8837                 __isl_take isl_set *context);
8838         __isl_give isl_qpolynomial_fold *
8839         isl_qpolynomial_fold_gist_params(
8840                 __isl_take isl_qpolynomial_fold *fold,
8841                 __isl_take isl_set *context);
8842         __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
8843                 __isl_take isl_qpolynomial_fold *fold,
8844                 __isl_take isl_set *context);
8845         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
8846                 __isl_take isl_pw_qpolynomial *pwqp,
8847                 __isl_take isl_set *context);
8848         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
8849                 __isl_take isl_pw_qpolynomial *pwqp,
8850                 __isl_take isl_set *context);
8851         __isl_give isl_pw_qpolynomial_fold *
8852         isl_pw_qpolynomial_fold_gist(
8853                 __isl_take isl_pw_qpolynomial_fold *pwf,
8854                 __isl_take isl_set *context);
8855         __isl_give isl_pw_qpolynomial_fold *
8856         isl_pw_qpolynomial_fold_gist_params(
8857                 __isl_take isl_pw_qpolynomial_fold *pwf,
8858                 __isl_take isl_set *context);
8859         __isl_give isl_union_pw_qpolynomial *
8860         isl_union_pw_qpolynomial_gist_params(
8861                 __isl_take isl_union_pw_qpolynomial *upwqp,
8862                 __isl_take isl_set *context);
8863         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
8864                 __isl_take isl_union_pw_qpolynomial *upwqp,
8865                 __isl_take isl_union_set *context);
8866         __isl_give isl_union_pw_qpolynomial_fold *
8867         isl_union_pw_qpolynomial_fold_gist(
8868                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
8869                 __isl_take isl_union_set *context);
8870         __isl_give isl_union_pw_qpolynomial_fold *
8871         isl_union_pw_qpolynomial_fold_gist_params(
8872                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
8873                 __isl_take isl_set *context);
8875 =item * Binary Arithmetic Operations
8877         #include <isl/set.h>
8878         __isl_give isl_set *isl_set_sum(
8879                 __isl_take isl_set *set1,
8880                 __isl_take isl_set *set2);
8881         #include <isl/map.h>
8882         __isl_give isl_map *isl_map_sum(
8883                 __isl_take isl_map *map1,
8884                 __isl_take isl_map *map2);
8886 C<isl_set_sum> computes the Minkowski sum of its two arguments,
8887 i.e., the set containing the sums of pairs of elements from
8888 C<set1> and C<set2>.
8889 The domain of the result of C<isl_map_sum> is the intersection
8890 of the domains of its two arguments.  The corresponding range
8891 elements are the sums of the corresponding range elements
8892 in the two arguments.
8894         #include <isl/val.h>
8895         __isl_give isl_multi_val *isl_multi_val_add(
8896                 __isl_take isl_multi_val *mv1,
8897                 __isl_take isl_multi_val *mv2);
8898         __isl_give isl_multi_val *isl_multi_val_sub(
8899                 __isl_take isl_multi_val *mv1,
8900                 __isl_take isl_multi_val *mv2);
8901         __isl_give isl_multi_val *isl_multi_val_min(
8902                 __isl_take isl_multi_val *mv1,
8903                 __isl_take isl_multi_val *mv2);
8904         __isl_give isl_multi_val *isl_multi_val_max(
8905                 __isl_take isl_multi_val *mv1,
8906                 __isl_take isl_multi_val *mv2);
8908         #include <isl/aff.h>
8909         __isl_give isl_aff *isl_aff_add(
8910                 __isl_take isl_aff *aff1,
8911                 __isl_take isl_aff *aff2);
8912         __isl_give isl_multi_aff *isl_multi_aff_add(
8913                 __isl_take isl_multi_aff *maff1,
8914                 __isl_take isl_multi_aff *maff2);
8915         __isl_give isl_pw_aff *isl_pw_aff_add(
8916                 __isl_take isl_pw_aff *pwaff1,
8917                 __isl_take isl_pw_aff *pwaff2);
8918         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add(
8919                 __isl_take isl_multi_pw_aff *mpa1,
8920                 __isl_take isl_multi_pw_aff *mpa2);
8921         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
8922                 __isl_take isl_pw_multi_aff *pma1,
8923                 __isl_take isl_pw_multi_aff *pma2);
8924         __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
8925                 __isl_take isl_union_pw_aff *upa1,
8926                 __isl_take isl_union_pw_aff *upa2);
8927         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
8928                 __isl_take isl_union_pw_multi_aff *upma1,
8929                 __isl_take isl_union_pw_multi_aff *upma2);
8930         __isl_give isl_multi_union_pw_aff *
8931         isl_multi_union_pw_aff_add(
8932                 __isl_take isl_multi_union_pw_aff *mupa1,
8933                 __isl_take isl_multi_union_pw_aff *mupa2);
8934         __isl_give isl_pw_aff *isl_pw_aff_add_constant_val(
8935                 __isl_take isl_pw_aff *pa,
8936                 __isl_take isl_val *v);
8937         __isl_give isl_multi_aff *
8938         isl_multi_aff_add_constant_val(
8939                 __isl_take isl_multi_aff *pa,
8940                 __isl_take isl_val *v);
8941         __isl_give isl_pw_multi_aff *
8942         isl_pw_multi_aff_add_constant_val(
8943                 __isl_take isl_pw_multi_aff *pma,
8944                 __isl_take isl_val *v);
8945         __isl_give isl_pw_multi_aff *
8946         isl_pw_multi_aff_add_constant_multi_val(
8947                 __isl_take isl_pw_multi_aff *pma,
8948                 __isl_take isl_multi_val *mv);
8949         __isl_give isl_multi_pw_aff *
8950         isl_multi_pw_aff_add_constant_val(
8951                 __isl_take isl_multi_pw_aff *mpa,
8952                 __isl_take isl_val *v);
8953         __isl_give isl_multi_aff *
8954         isl_multi_aff_add_constant_multi_val(
8955                 __isl_take isl_multi_aff *pa,
8956                 __isl_take isl_multi_val *mv);
8957         __isl_give isl_multi_pw_aff *
8958         isl_multi_pw_aff_add_constant_multi_val(
8959                 __isl_take isl_multi_pw_aff *mpa,
8960                 __isl_take isl_multi_val *mv);
8961         __isl_give isl_pw_aff *isl_pw_aff_min(
8962                 __isl_take isl_pw_aff *pwaff1,
8963                 __isl_take isl_pw_aff *pwaff2);
8964         __isl_give isl_pw_aff *isl_pw_aff_max(
8965                 __isl_take isl_pw_aff *pwaff1,
8966                 __isl_take isl_pw_aff *pwaff2);
8967         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_min(
8968                 __isl_take isl_multi_pw_aff *mpa1,
8969                 __isl_take isl_multi_pw_aff *mpa2);
8970         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_max(
8971                 __isl_take isl_multi_pw_aff *mpa1,
8972                 __isl_take isl_multi_pw_aff *mpa2);
8973         __isl_give isl_aff *isl_aff_sub(
8974                 __isl_take isl_aff *aff1,
8975                 __isl_take isl_aff *aff2);
8976         __isl_give isl_multi_aff *isl_multi_aff_sub(
8977                 __isl_take isl_multi_aff *ma1,
8978                 __isl_take isl_multi_aff *ma2);
8979         __isl_give isl_pw_aff *isl_pw_aff_sub(
8980                 __isl_take isl_pw_aff *pwaff1,
8981                 __isl_take isl_pw_aff *pwaff2);
8982         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
8983                 __isl_take isl_multi_pw_aff *mpa1,
8984                 __isl_take isl_multi_pw_aff *mpa2);
8985         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
8986                 __isl_take isl_pw_multi_aff *pma1,
8987                 __isl_take isl_pw_multi_aff *pma2);
8988         __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
8989                 __isl_take isl_union_pw_aff *upa1,
8990                 __isl_take isl_union_pw_aff *upa2);
8991         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
8992                 __isl_take isl_union_pw_multi_aff *upma1,
8993                 __isl_take isl_union_pw_multi_aff *upma2);
8994         __isl_give isl_multi_union_pw_aff *
8995         isl_multi_union_pw_aff_sub(
8996                 __isl_take isl_multi_union_pw_aff *mupa1,
8997                 __isl_take isl_multi_union_pw_aff *mupa2);
8999 C<isl_aff_sub> subtracts the second argument from the first.
9001         #include <isl/polynomial.h>
9002         __isl_give isl_qpolynomial *isl_qpolynomial_add(
9003                 __isl_take isl_qpolynomial *qp1,
9004                 __isl_take isl_qpolynomial *qp2);
9005         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
9006                 __isl_take isl_pw_qpolynomial *pwqp1,
9007                 __isl_take isl_pw_qpolynomial *pwqp2);
9008         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
9009                 __isl_take isl_pw_qpolynomial *pwqp1,
9010                 __isl_take isl_pw_qpolynomial *pwqp2);
9011         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
9012                 __isl_take isl_pw_qpolynomial_fold *pwf1,
9013                 __isl_take isl_pw_qpolynomial_fold *pwf2);
9014         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
9015                 __isl_take isl_union_pw_qpolynomial *upwqp1,
9016                 __isl_take isl_union_pw_qpolynomial *upwqp2);
9017         __isl_give isl_qpolynomial *isl_qpolynomial_sub(
9018                 __isl_take isl_qpolynomial *qp1,
9019                 __isl_take isl_qpolynomial *qp2);
9020         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
9021                 __isl_take isl_pw_qpolynomial *pwqp1,
9022                 __isl_take isl_pw_qpolynomial *pwqp2);
9023         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
9024                 __isl_take isl_union_pw_qpolynomial *upwqp1,
9025                 __isl_take isl_union_pw_qpolynomial *upwqp2);
9026         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
9027                 __isl_take isl_pw_qpolynomial_fold *pwf1,
9028                 __isl_take isl_pw_qpolynomial_fold *pwf2);
9029         __isl_give isl_union_pw_qpolynomial_fold *
9030         isl_union_pw_qpolynomial_fold_fold(
9031                 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
9032                 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
9034         #include <isl/aff.h>
9035         __isl_give isl_pw_aff *isl_pw_aff_union_add(
9036                 __isl_take isl_pw_aff *pwaff1,
9037                 __isl_take isl_pw_aff *pwaff2);
9038         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_union_add(
9039                 __isl_take isl_multi_pw_aff *mpa1,
9040                 __isl_take isl_multi_pw_aff *mpa2);
9041         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
9042                 __isl_take isl_pw_multi_aff *pma1,
9043                 __isl_take isl_pw_multi_aff *pma2);
9044         __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
9045                 __isl_take isl_union_pw_aff *upa1,
9046                 __isl_take isl_union_pw_aff *upa2);
9047         __isl_give isl_union_pw_multi_aff *
9048         isl_union_pw_multi_aff_union_add(
9049                 __isl_take isl_union_pw_multi_aff *upma1,
9050                 __isl_take isl_union_pw_multi_aff *upma2);
9051         __isl_give isl_multi_union_pw_aff *
9052         isl_multi_union_pw_aff_union_add(
9053                 __isl_take isl_multi_union_pw_aff *mupa1,
9054                 __isl_take isl_multi_union_pw_aff *mupa2);
9055         __isl_give isl_pw_aff *isl_pw_aff_union_min(
9056                 __isl_take isl_pw_aff *pwaff1,
9057                 __isl_take isl_pw_aff *pwaff2);
9058         __isl_give isl_pw_aff *isl_pw_aff_union_max(
9059                 __isl_take isl_pw_aff *pwaff1,
9060                 __isl_take isl_pw_aff *pwaff2);
9062 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
9063 expression with a domain that is the union of those of C<pwaff1> and
9064 C<pwaff2> and such that on each cell, the quasi-affine expression is
9065 the maximum of those of C<pwaff1> and C<pwaff2>.  If only one of
9066 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
9067 associated expression is the defined one.
9068 This in contrast to the C<isl_pw_aff_max> function, which is
9069 only defined on the shared definition domain of the arguments.
9071         #include <isl/val.h>
9072         __isl_give isl_multi_val *isl_multi_val_add_val(
9073                 __isl_take isl_multi_val *mv,
9074                 __isl_take isl_val *v);
9075         __isl_give isl_multi_val *isl_multi_val_mod_val(
9076                 __isl_take isl_multi_val *mv,
9077                 __isl_take isl_val *v);
9078         __isl_give isl_multi_val *isl_multi_val_scale_val(
9079                 __isl_take isl_multi_val *mv,
9080                 __isl_take isl_val *v);
9081         __isl_give isl_multi_val *isl_multi_val_scale_down_val(
9082                 __isl_take isl_multi_val *mv,
9083                 __isl_take isl_val *v);
9085         #include <isl/aff.h>
9086         __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
9087                 __isl_take isl_val *mod);
9088         __isl_give isl_pw_aff *isl_pw_aff_mod_val(
9089                 __isl_take isl_pw_aff *pa,
9090                 __isl_take isl_val *mod);
9091         __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
9092                 __isl_take isl_union_pw_aff *upa,
9093                 __isl_take isl_val *f);
9094         __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
9095                 __isl_take isl_val *v);
9096         __isl_give isl_multi_aff *isl_multi_aff_scale_val(
9097                 __isl_take isl_multi_aff *ma,
9098                 __isl_take isl_val *v);
9099         __isl_give isl_pw_aff *isl_pw_aff_scale_val(
9100                 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
9101         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
9102                 __isl_take isl_multi_pw_aff *mpa,
9103                 __isl_take isl_val *v);
9104         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
9105                 __isl_take isl_pw_multi_aff *pma,
9106                 __isl_take isl_val *v);
9107         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
9108                 __isl_take isl_union_pw_aff *upa,
9109                 __isl_take isl_val *f);
9110         __isl_give isl_union_pw_multi_aff *
9111         isl_union_pw_multi_aff_scale_val(
9112                 __isl_take isl_union_pw_multi_aff *upma,
9113                 __isl_take isl_val *val);
9114         __isl_give isl_multi_union_pw_aff *
9115         isl_multi_union_pw_aff_scale_val(
9116                 __isl_take isl_multi_union_pw_aff *mupa,
9117                 __isl_take isl_val *v);
9118         __isl_give isl_aff *isl_aff_scale_down_ui(
9119                 __isl_take isl_aff *aff, unsigned f);
9120         __isl_give isl_aff *isl_aff_scale_down_val(
9121                 __isl_take isl_aff *aff, __isl_take isl_val *v);
9122         __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
9123                 __isl_take isl_multi_aff *ma,
9124                 __isl_take isl_val *v);
9125         __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
9126                 __isl_take isl_pw_aff *pa,
9127                 __isl_take isl_val *f);
9128         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
9129                 __isl_take isl_multi_pw_aff *mpa,
9130                 __isl_take isl_val *v);
9131         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
9132                 __isl_take isl_pw_multi_aff *pma,
9133                 __isl_take isl_val *v);
9134         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
9135                 __isl_take isl_union_pw_aff *upa,
9136                 __isl_take isl_val *v);
9137         __isl_give isl_union_pw_multi_aff *
9138         isl_union_pw_multi_aff_scale_down_val(
9139                 __isl_take isl_union_pw_multi_aff *upma,
9140                 __isl_take isl_val *val);
9141         __isl_give isl_multi_union_pw_aff *
9142         isl_multi_union_pw_aff_scale_down_val(
9143                 __isl_take isl_multi_union_pw_aff *mupa,
9144                 __isl_take isl_val *v);
9146         #include <isl/polynomial.h>
9147         __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
9148                 __isl_take isl_qpolynomial *qp,
9149                 __isl_take isl_val *v);
9150         __isl_give isl_qpolynomial_fold *
9151         isl_qpolynomial_fold_scale_val(
9152                 __isl_take isl_qpolynomial_fold *fold,
9153                 __isl_take isl_val *v);
9154         __isl_give isl_pw_qpolynomial *
9155         isl_pw_qpolynomial_scale_val(
9156                 __isl_take isl_pw_qpolynomial *pwqp,
9157                 __isl_take isl_val *v);
9158         __isl_give isl_pw_qpolynomial_fold *
9159         isl_pw_qpolynomial_fold_scale_val(
9160                 __isl_take isl_pw_qpolynomial_fold *pwf,
9161                 __isl_take isl_val *v);
9162         __isl_give isl_union_pw_qpolynomial *
9163         isl_union_pw_qpolynomial_scale_val(
9164                 __isl_take isl_union_pw_qpolynomial *upwqp,
9165                 __isl_take isl_val *v);
9166         __isl_give isl_union_pw_qpolynomial_fold *
9167         isl_union_pw_qpolynomial_fold_scale_val(
9168                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
9169                 __isl_take isl_val *v);
9170         __isl_give isl_qpolynomial *
9171         isl_qpolynomial_scale_down_val(
9172                 __isl_take isl_qpolynomial *qp,
9173                 __isl_take isl_val *v);
9174         __isl_give isl_qpolynomial_fold *
9175         isl_qpolynomial_fold_scale_down_val(
9176                 __isl_take isl_qpolynomial_fold *fold,
9177                 __isl_take isl_val *v);
9178         __isl_give isl_pw_qpolynomial *
9179         isl_pw_qpolynomial_scale_down_val(
9180                 __isl_take isl_pw_qpolynomial *pwqp,
9181                 __isl_take isl_val *v);
9182         __isl_give isl_pw_qpolynomial_fold *
9183         isl_pw_qpolynomial_fold_scale_down_val(
9184                 __isl_take isl_pw_qpolynomial_fold *pwf,
9185                 __isl_take isl_val *v);
9186         __isl_give isl_union_pw_qpolynomial *
9187         isl_union_pw_qpolynomial_scale_down_val(
9188                 __isl_take isl_union_pw_qpolynomial *upwqp,
9189                 __isl_take isl_val *v);
9190         __isl_give isl_union_pw_qpolynomial_fold *
9191         isl_union_pw_qpolynomial_fold_scale_down_val(
9192                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
9193                 __isl_take isl_val *v);
9195         #include <isl/val.h>
9196         __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
9197                 __isl_take isl_multi_val *mv1,
9198                 __isl_take isl_multi_val *mv2);
9199         __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
9200                 __isl_take isl_multi_val *mv1,
9201                 __isl_take isl_multi_val *mv2);
9202         __isl_give isl_multi_val *
9203         isl_multi_val_scale_down_multi_val(
9204                 __isl_take isl_multi_val *mv1,
9205                 __isl_take isl_multi_val *mv2);
9207         #include <isl/aff.h>
9208         __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
9209                 __isl_take isl_multi_aff *ma,
9210                 __isl_take isl_multi_val *mv);
9211         __isl_give isl_multi_union_pw_aff *
9212         isl_multi_union_pw_aff_mod_multi_val(
9213                 __isl_take isl_multi_union_pw_aff *upma,
9214                 __isl_take isl_multi_val *mv);
9215         __isl_give isl_multi_pw_aff *
9216         isl_multi_pw_aff_mod_multi_val(
9217                 __isl_take isl_multi_pw_aff *mpa,
9218                 __isl_take isl_multi_val *mv);
9219         __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
9220                 __isl_take isl_multi_aff *ma,
9221                 __isl_take isl_multi_val *mv);
9222         __isl_give isl_pw_multi_aff *
9223         isl_pw_multi_aff_scale_multi_val(
9224                 __isl_take isl_pw_multi_aff *pma,
9225                 __isl_take isl_multi_val *mv);
9226         __isl_give isl_multi_pw_aff *
9227         isl_multi_pw_aff_scale_multi_val(
9228                 __isl_take isl_multi_pw_aff *mpa,
9229                 __isl_take isl_multi_val *mv);
9230         __isl_give isl_multi_union_pw_aff *
9231         isl_multi_union_pw_aff_scale_multi_val(
9232                 __isl_take isl_multi_union_pw_aff *mupa,
9233                 __isl_take isl_multi_val *mv);
9234         __isl_give isl_union_pw_multi_aff *
9235         isl_union_pw_multi_aff_scale_multi_val(
9236                 __isl_take isl_union_pw_multi_aff *upma,
9237                 __isl_take isl_multi_val *mv);
9238         __isl_give isl_multi_aff *
9239         isl_multi_aff_scale_down_multi_val(
9240                 __isl_take isl_multi_aff *ma,
9241                 __isl_take isl_multi_val *mv);
9242         __isl_give isl_pw_multi_aff *
9243         isl_pw_multi_aff_scale_down_multi_val(
9244                 __isl_take isl_pw_multi_aff *pma,
9245                 __isl_take isl_multi_val *mv);
9246         __isl_give isl_multi_pw_aff *
9247         isl_multi_pw_aff_scale_down_multi_val(
9248                 __isl_take isl_multi_pw_aff *mpa,
9249                 __isl_take isl_multi_val *mv);
9250         __isl_give isl_multi_union_pw_aff *
9251         isl_multi_union_pw_aff_scale_down_multi_val(
9252                 __isl_take isl_multi_union_pw_aff *mupa,
9253                 __isl_take isl_multi_val *mv);
9255 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
9256 by the corresponding elements of C<mv>.
9258         #include <isl/aff.h>
9259         __isl_give isl_aff *isl_aff_mul(
9260                 __isl_take isl_aff *aff1,
9261                 __isl_take isl_aff *aff2);
9262         __isl_give isl_aff *isl_aff_div(
9263                 __isl_take isl_aff *aff1,
9264                 __isl_take isl_aff *aff2);
9265         __isl_give isl_pw_aff *isl_pw_aff_mul(
9266                 __isl_take isl_pw_aff *pwaff1,
9267                 __isl_take isl_pw_aff *pwaff2);
9268         __isl_give isl_pw_aff *isl_pw_aff_div(
9269                 __isl_take isl_pw_aff *pa1,
9270                 __isl_take isl_pw_aff *pa2);
9271         __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
9272                 __isl_take isl_pw_aff *pa1,
9273                 __isl_take isl_pw_aff *pa2);
9274         __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
9275                 __isl_take isl_pw_aff *pa1,
9276                 __isl_take isl_pw_aff *pa2);
9278 When multiplying two affine expressions, at least one of the two needs
9279 to be a constant.  Similarly, when dividing an affine expression by another,
9280 the second expression needs to be a constant.
9281 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
9282 rounding towards zero.  C<isl_pw_aff_tdiv_r> computes the corresponding
9283 remainder.
9285         #include <isl/polynomial.h>
9286         __isl_give isl_qpolynomial *isl_qpolynomial_mul(
9287                 __isl_take isl_qpolynomial *qp1,
9288                 __isl_take isl_qpolynomial *qp2);
9289         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
9290                 __isl_take isl_pw_qpolynomial *pwqp1,
9291                 __isl_take isl_pw_qpolynomial *pwqp2);
9292         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
9293                 __isl_take isl_union_pw_qpolynomial *upwqp1,
9294                 __isl_take isl_union_pw_qpolynomial *upwqp2);
9296 =back
9298 =head3 Lexicographic Optimization
9300 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
9301 the following functions
9302 compute a set that contains the lexicographic minimum or maximum
9303 of the elements in C<set> (or C<bset>) for those values of the parameters
9304 that satisfy C<dom>.
9305 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
9306 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
9307 has no elements.
9308 In other words, the union of the parameter values
9309 for which the result is non-empty and of C<*empty>
9310 is equal to C<dom>.
9312         #include <isl/set.h>
9313         __isl_give isl_set *isl_basic_set_partial_lexmin(
9314                 __isl_take isl_basic_set *bset,
9315                 __isl_take isl_basic_set *dom,
9316                 __isl_give isl_set **empty);
9317         __isl_give isl_set *isl_basic_set_partial_lexmax(
9318                 __isl_take isl_basic_set *bset,
9319                 __isl_take isl_basic_set *dom,
9320                 __isl_give isl_set **empty);
9321         __isl_give isl_set *isl_set_partial_lexmin(
9322                 __isl_take isl_set *set, __isl_take isl_set *dom,
9323                 __isl_give isl_set **empty);
9324         __isl_give isl_set *isl_set_partial_lexmax(
9325                 __isl_take isl_set *set, __isl_take isl_set *dom,
9326                 __isl_give isl_set **empty);
9328 Given a (basic) set C<set> (or C<bset>), the following functions simply
9329 return a set containing the lexicographic minimum or maximum
9330 of the elements in C<set> (or C<bset>).
9331 In case of union sets, the optimum is computed per space.
9333         #include <isl/set.h>
9334         __isl_give isl_set *isl_basic_set_lexmin(
9335                 __isl_take isl_basic_set *bset);
9336         __isl_give isl_set *isl_basic_set_lexmax(
9337                 __isl_take isl_basic_set *bset);
9338         __isl_give isl_set *isl_set_lexmin(
9339                 __isl_take isl_set *set);
9340         __isl_give isl_set *isl_set_lexmax(
9341                 __isl_take isl_set *set);
9342         __isl_give isl_union_set *isl_union_set_lexmin(
9343                 __isl_take isl_union_set *uset);
9344         __isl_give isl_union_set *isl_union_set_lexmax(
9345                 __isl_take isl_union_set *uset);
9347 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
9348 the following functions
9349 compute a relation that maps each element of C<dom>
9350 to the single lexicographic minimum or maximum
9351 of the elements that are associated to that same
9352 element in C<map> (or C<bmap>).
9353 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
9354 that contains the elements in C<dom> that do not map
9355 to any elements in C<map> (or C<bmap>).
9356 In other words, the union of the domain of the result and of C<*empty>
9357 is equal to C<dom>.
9359         #include <isl/map.h>
9360         __isl_give isl_map *isl_basic_map_partial_lexmax(
9361                 __isl_take isl_basic_map *bmap,
9362                 __isl_take isl_basic_set *dom,
9363                 __isl_give isl_set **empty);
9364         __isl_give isl_map *isl_basic_map_partial_lexmin(
9365                 __isl_take isl_basic_map *bmap,
9366                 __isl_take isl_basic_set *dom,
9367                 __isl_give isl_set **empty);
9368         __isl_give isl_map *isl_map_partial_lexmax(
9369                 __isl_take isl_map *map, __isl_take isl_set *dom,
9370                 __isl_give isl_set **empty);
9371         __isl_give isl_map *isl_map_partial_lexmin(
9372                 __isl_take isl_map *map, __isl_take isl_set *dom,
9373                 __isl_give isl_set **empty);
9375 Given a (basic) map C<map> (or C<bmap>), the following functions simply
9376 return a map mapping each element in the domain of
9377 C<map> (or C<bmap>) to the lexicographic minimum or maximum
9378 of all elements associated to that element.
9379 In case of union relations, the optimum is computed per space.
9381         #include <isl/map.h>
9382         __isl_give isl_map *isl_basic_map_lexmin(
9383                 __isl_take isl_basic_map *bmap);
9384         __isl_give isl_map *isl_basic_map_lexmax(
9385                 __isl_take isl_basic_map *bmap);
9386         __isl_give isl_map *isl_map_lexmin(
9387                 __isl_take isl_map *map);
9388         __isl_give isl_map *isl_map_lexmax(
9389                 __isl_take isl_map *map);
9390         __isl_give isl_union_map *isl_union_map_lexmin(
9391                 __isl_take isl_union_map *umap);
9392         __isl_give isl_union_map *isl_union_map_lexmax(
9393                 __isl_take isl_union_map *umap);
9395 The following functions return their result in the form of
9396 a piecewise multi-affine expression,
9397 but are otherwise equivalent to the corresponding functions
9398 returning a basic set or relation.
9400         #include <isl/set.h>
9401         __isl_give isl_pw_multi_aff *
9402         isl_basic_set_partial_lexmin_pw_multi_aff(
9403                 __isl_take isl_basic_set *bset,
9404                 __isl_take isl_basic_set *dom,
9405                 __isl_give isl_set **empty);
9406         __isl_give isl_pw_multi_aff *
9407         isl_basic_set_partial_lexmax_pw_multi_aff(
9408                 __isl_take isl_basic_set *bset,
9409                 __isl_take isl_basic_set *dom,
9410                 __isl_give isl_set **empty);
9411         __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
9412                 __isl_take isl_set *set);
9413         __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
9414                 __isl_take isl_set *set);
9416         #include <isl/map.h>
9417         __isl_give isl_pw_multi_aff *
9418         isl_basic_map_lexmin_pw_multi_aff(
9419                 __isl_take isl_basic_map *bmap);
9420         __isl_give isl_pw_multi_aff *
9421         isl_basic_map_partial_lexmin_pw_multi_aff(
9422                 __isl_take isl_basic_map *bmap,
9423                 __isl_take isl_basic_set *dom,
9424                 __isl_give isl_set **empty);
9425         __isl_give isl_pw_multi_aff *
9426         isl_basic_map_partial_lexmax_pw_multi_aff(
9427                 __isl_take isl_basic_map *bmap,
9428                 __isl_take isl_basic_set *dom,
9429                 __isl_give isl_set **empty);
9430         __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
9431                 __isl_take isl_map *map);
9432         __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
9433                 __isl_take isl_map *map);
9435 The following functions return the lexicographic minimum or maximum
9436 on the shared domain of the inputs and the single defined function
9437 on those parts of the domain where only a single function is defined.
9439         #include <isl/aff.h>
9440         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
9441                 __isl_take isl_pw_multi_aff *pma1,
9442                 __isl_take isl_pw_multi_aff *pma2);
9443         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
9444                 __isl_take isl_pw_multi_aff *pma1,
9445                 __isl_take isl_pw_multi_aff *pma2);
9447 If the input to a lexicographic optimization problem has
9448 multiple constraints with the same coefficients for the optimized
9449 variables, then, by default, this symmetry is exploited by
9450 replacing those constraints by a single constraint with
9451 an abstract bound, which is in turn bounded by the corresponding terms
9452 in the original constraints.
9453 Without this optimization, the solver would typically consider
9454 all possible orderings of those original bounds, resulting in a needless
9455 decomposition of the domain.
9456 However, the optimization can also result in slowdowns since
9457 an extra parameter is introduced that may get used in additional
9458 integer divisions.
9459 The following option determines whether symmetry detection is applied
9460 during lexicographic optimization.
9462         #include <isl/options.h>
9463         isl_stat isl_options_set_pip_symmetry(isl_ctx *ctx,
9464                 int val);
9465         int isl_options_get_pip_symmetry(isl_ctx *ctx);
9467 =begin latex
9469 See also \autoref{s:offline}.
9471 =end latex
9473 =head2 Ternary Operations
9475         #include <isl/aff.h>
9476         __isl_give isl_pw_aff *isl_pw_aff_cond(
9477                 __isl_take isl_pw_aff *cond,
9478                 __isl_take isl_pw_aff *pwaff_true,
9479                 __isl_take isl_pw_aff *pwaff_false);
9481 The function C<isl_pw_aff_cond> performs a conditional operator
9482 and returns an expression that is equal to C<pwaff_true>
9483 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
9484 where C<cond> is zero.
9486 =head2 Lists
9488 Lists are defined over several element types, including
9489 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_pw_multi_aff>,
9490 C<isl_union_pw_aff>,
9491 C<isl_union_pw_multi_aff>,
9492 C<isl_qpolynomial>, C<isl_pw_qpolynomial>, C<isl_pw_qpolynomial_fold>,
9493 C<isl_constraint>,
9494 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
9495 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
9496 Here we take lists of C<isl_set>s as an example.
9497 Lists can be created, copied, modified and freed using the following functions.
9499         #include <isl/set.h>
9500         __isl_give isl_set_list *isl_set_to_list(
9501                 __isl_take isl_set *el);
9502         __isl_give isl_set_list *isl_set_list_from_set(
9503                 __isl_take isl_set *el);
9504         __isl_give isl_set_list *isl_set_list_alloc(
9505                 isl_ctx *ctx, int n);
9506         __isl_give isl_set_list *isl_set_list_copy(
9507                 __isl_keep isl_set_list *list);
9508         __isl_give isl_set_list *isl_set_list_insert(
9509                 __isl_take isl_set_list *list, unsigned pos,
9510                 __isl_take isl_set *el);
9511         __isl_give isl_set_list *isl_set_list_add(
9512                 __isl_take isl_set_list *list,
9513                 __isl_take isl_set *el);
9514         __isl_give isl_set_list *isl_set_list_drop(
9515                 __isl_take isl_set_list *list,
9516                 unsigned first, unsigned n);
9517         __isl_give isl_set_list *isl_set_list_clear(
9518                 __isl_take isl_set_list *list);
9519         __isl_give isl_set_list *isl_set_list_swap(
9520                 __isl_take isl_set_list *list,
9521                 unsigned pos1, unsigned pos2);
9522         __isl_give isl_set_list *isl_set_list_reverse(
9523                 __isl_take isl_set_list *list);
9524         __isl_give isl_set_list *isl_set_list_set_at(
9525                 __isl_take isl_set_list *list, int index,
9526                 __isl_take isl_set *set);
9527         __isl_give isl_set_list *isl_set_list_set_set(
9528                 __isl_take isl_set_list *list, int index,
9529                 __isl_take isl_set *set);
9530         __isl_give isl_set_list *isl_set_list_concat(
9531                 __isl_take isl_set_list *list1,
9532                 __isl_take isl_set_list *list2);
9533         __isl_give isl_set_list *isl_set_list_map(
9534                 __isl_take isl_set_list *list,
9535                 __isl_give isl_set *(*fn)(__isl_take isl_set *el,
9536                         void *user),
9537                 void *user);
9538         __isl_give isl_set_list *isl_set_list_sort(
9539                 __isl_take isl_set_list *list,
9540                 int (*cmp)(__isl_keep isl_set *a,
9541                         __isl_keep isl_set *b, void *user),
9542                 void *user);
9543         __isl_null isl_set_list *isl_set_list_free(
9544                 __isl_take isl_set_list *list);
9546 C<isl_set_list_alloc> creates an empty list with an initial capacity
9547 for C<n> elements.  C<isl_set_list_insert> and C<isl_set_list_add>
9548 add elements to a list, increasing its capacity as needed.
9549 C<isl_set_to_list> creates a list with a single element.
9550 C<isl_set_list_from_set> performs the same operation.
9551 C<isl_set_list_clear> removes all elements from a list.
9552 C<isl_set_list_swap> swaps the elements at the specified locations.
9553 C<isl_set_list_reverse> reverses the elements in the list.
9554 C<isl_set_list_set_set> is an alternative name for C<isl_set_list_set_at>.
9556 Lists can be inspected using the following functions.
9558         #include <isl/set.h>
9559         isl_size isl_set_list_size(__isl_keep isl_set_list *list);
9560         isl_size isl_set_list_n_set(__isl_keep isl_set_list *list);
9561         __isl_give isl_set *isl_set_list_get_at(
9562                 __isl_keep isl_set_list *list, int index);
9563         __isl_give isl_set *isl_set_list_get_set(
9564                 __isl_keep isl_set_list *list, int index);
9565         isl_stat isl_set_list_foreach(__isl_keep isl_set_list *list,
9566                 isl_stat (*fn)(__isl_take isl_set *el, void *user),
9567                 void *user);
9568         isl_bool isl_set_list_every(__isl_keep isl_set_list *list,
9569                 isl_bool (*test)(__isl_take isl_set *el,
9570                         void *user),
9571                 void *user);
9572         isl_stat isl_set_list_foreach_scc(
9573                 __isl_keep isl_set_list *list,
9574                 isl_bool (*follows)(__isl_keep isl_set *a,
9575                         __isl_keep isl_set *b, void *user),
9576                 void *follows_user,
9577                 isl_stat (*fn)(__isl_take isl_set_list *scc,
9578                         void *user),
9579                 void *fn_user);
9581 C<isl_set_list_n_set> is an alternative name for C<isl_set_list_size>.
9582 Similarly,
9583 C<isl_set_list_get_set> is an alternative name for C<isl_set_list_get_at>.
9584 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
9585 strongly connected components of the graph with as vertices the elements
9586 of C<list> and a directed edge from vertex C<b> to vertex C<a>
9587 iff C<follows(a, b)> returns C<isl_bool_true>.  The callbacks C<follows> and
9588 C<fn> should return C<isl_bool_error> or C<isl_stat_error> on error.
9590 Lists can be printed using
9592         #include <isl/set.h>
9593         __isl_give isl_printer *isl_printer_print_set_list(
9594                 __isl_take isl_printer *p,
9595                 __isl_keep isl_set_list *list);
9597 Alternatively, a string representation can be obtained
9598 directly using the following function, which always prints
9599 in isl format.
9601         #include <isl/set.h>
9602         __isl_give char *isl_set_list_to_str(
9603                 __isl_keep isl_set_list *list);
9605 An C<isl_val_list>, C<isl_id_list>,
9606 C<isl_aff_list>, C<isl_pw_aff_list>, C<isl_pw_multi_aff_list>,
9607 C<isl_union_pw_aff_list>,
9608 C<isl_set_list>, C<isl_map_list> or C<isl_union_set_list> object
9609 can also be read from input using the following functions.
9611         #include <isl/val.h>
9612         __isl_give isl_val_list *isl_val_list_read_from_str(
9613                 isl_ctx *ctx, const char *str);
9615         #include <isl/id.h>
9616         __isl_give isl_id_list *isl_id_list_read_from_str(
9617                 isl_ctx *ctx, const char *str);
9619         #include <isl/aff.h>
9620         __isl_give isl_aff_list *
9621         isl_aff_list_read_from_str(isl_ctx *ctx,
9622                 const char *str);
9623         __isl_give isl_pw_aff_list *
9624         isl_pw_aff_list_read_from_str(isl_ctx *ctx,
9625                 const char *str);
9626         __isl_give isl_pw_multi_aff_list *
9627         isl_pw_multi_aff_list_read_from_str(isl_ctx *ctx,
9628                 const char *str);
9629         __isl_give isl_union_pw_aff_list *
9630         isl_union_pw_aff_list_read_from_str(isl_ctx *ctx,
9631                 const char *str);
9633         #include <isl/set.h>
9634         __isl_give isl_set_list *isl_set_list_read_from_str(
9635                 isl_ctx *ctx, const char *str);
9637         #include <isl/map.h>
9638         __isl_give isl_map_list *isl_map_list_read_from_str(
9639                 isl_ctx *ctx, const char *str);
9641         #include <isl/union_set.h>
9642         __isl_give isl_union_set_list *
9643         isl_union_set_list_read_from_str(isl_ctx *ctx,
9644                 const char *str);
9646 =head2 Associative arrays
9648 Associative arrays map isl objects of a specific type to isl objects
9649 of some (other) specific type.  They are defined for several pairs
9650 of types, including (C<isl_map>, C<isl_basic_set>),
9651 (C<isl_id>, C<isl_ast_expr>),
9652 (C<isl_id>, C<isl_id>) and
9653 (C<isl_id>, C<isl_pw_aff>).
9654 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
9655 as an example.
9657 Associative arrays can be created, copied and freed using
9658 the following functions.
9660         #include <isl/id_to_ast_expr.h>
9661         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
9662                 isl_ctx *ctx, int min_size);
9663         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
9664                 __isl_keep isl_id_to_ast_expr *id2expr);
9665         __isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
9666                 __isl_take isl_id_to_ast_expr *id2expr);
9668 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
9669 to specify the expected size of the associative array.
9670 The associative array will be grown automatically as needed.
9672 Associative arrays can be inspected using the following functions.
9674         #include <isl/id_to_ast_expr.h>
9675         __isl_give isl_maybe_isl_ast_expr
9676         isl_id_to_ast_expr_try_get(
9677                 __isl_keep isl_id_to_ast_expr *id2expr,
9678                 __isl_keep isl_id *key);
9679         isl_bool isl_id_to_ast_expr_has(
9680                 __isl_keep isl_id_to_ast_expr *id2expr,
9681                 __isl_keep isl_id *key);
9682         __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
9683                 __isl_keep isl_id_to_ast_expr *id2expr,
9684                 __isl_take isl_id *key);
9685         isl_stat isl_id_to_ast_expr_foreach(
9686                 __isl_keep isl_id_to_ast_expr *id2expr,
9687                 isl_stat (*fn)(__isl_take isl_id *key,
9688                         __isl_take isl_ast_expr *val, void *user),
9689                 void *user);
9690         isl_bool isl_id_to_ast_expr_every(
9691                 __isl_keep isl_id_to_ast_expr *id2expr,
9692                 isl_bool (*test)(__isl_keep isl_id *key,
9693                         __isl_keep isl_ast_expr *val, void *user),
9694                 void *user);
9696 The function C<isl_id_to_ast_expr_try_get> returns a structure
9697 containing two elements, C<valid> and C<value>.
9698 If there is a value associated to the key, then C<valid>
9699 is set to C<isl_bool_true> and C<value> contains a copy of
9700 the associated value.  Otherwise C<value> is C<NULL> and
9701 C<valid> may be C<isl_bool_error> or C<isl_bool_false> depending
9702 on whether some error has occurred or there simply is no associated value.
9703 The function C<isl_id_to_ast_expr_has> returns the C<valid> field
9704 in the structure and
9705 the function C<isl_id_to_ast_expr_get> returns the C<value> field.
9707 Associative arrays can be modified using the following functions.
9709         #include <isl/id_to_ast_expr.h>
9710         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
9711                 __isl_take isl_id_to_ast_expr *id2expr,
9712                 __isl_take isl_id *key,
9713                 __isl_take isl_ast_expr *val);
9714         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
9715                 __isl_take isl_id_to_ast_expr *id2expr,
9716                 __isl_take isl_id *key);
9718 Associative arrays can be checked for (obvious) equality
9719 using the following function.
9721         #include <isl/id_to_ast_expr.h>
9722         isl_bool isl_id_to_ast_expr_is_equal(
9723                 __isl_take isl_id_to_ast_expr *id2expr1,
9724                 __isl_take isl_id_to_ast_expr *id2expr2);
9726 Note that depending on how the keys and values are being compared,
9727 for other types of keys and/or values, this function may be called
9728 C<plain_is_equal> rather than C<is_equal>.
9730 Associative arrays can be printed using the following functions.
9732         #include <isl/id_to_ast_expr.h>
9733         __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
9734                 __isl_take isl_printer *p,
9735                 __isl_keep isl_id_to_ast_expr *id2expr);
9736         __isl_give char *isl_id_to_ast_expr_to_str(
9737                 __isl_keep isl_id_to_ast_expr *id2expr);
9739 They can be read from input using the following function.
9741         #include <isl/id_to_ast_expr.h>
9742         __isl_give isl_id_to_ast_expr *
9743         isl_id_to_ast_expr_read_from_str(isl_ctx *ctx,
9744                 const char *str);
9746 =head2 Vectors
9748 Vectors can be created, copied and freed using the following functions.
9750         #include <isl/vec.h>
9751         __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
9752                 unsigned size);
9753         __isl_give isl_vec *isl_vec_zero(isl_ctx *ctx,
9754                 unsigned size);
9755         __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
9756         __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
9758 Note that the elements of a vector created by C<isl_vec_alloc>
9759 may have arbitrary values.
9760 A vector created by C<isl_vec_zero> has elements with value zero.
9761 The elements can be changed and inspected using the following functions.
9763         isl_size isl_vec_size(__isl_keep isl_vec *vec);
9764         __isl_give isl_val *isl_vec_get_element_val(
9765                 __isl_keep isl_vec *vec, int pos);
9766         __isl_give isl_vec *isl_vec_set_element_si(
9767                 __isl_take isl_vec *vec, int pos, int v);
9768         __isl_give isl_vec *isl_vec_set_element_val(
9769                 __isl_take isl_vec *vec, int pos,
9770                 __isl_take isl_val *v);
9771         __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
9772                 int v);
9773         __isl_give isl_vec *isl_vec_set_val(
9774                 __isl_take isl_vec *vec, __isl_take isl_val *v);
9775         int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
9776                 __isl_keep isl_vec *vec2, int pos);
9778 C<isl_vec_get_element> will return a negative value if anything went wrong.
9779 In that case, the value of C<*v> is undefined.
9781 The following function can be used to concatenate two vectors.
9783         __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
9784                 __isl_take isl_vec *vec2);
9786 =head2 Matrices
9788 Matrices can be created, copied and freed using the following functions.
9790         #include <isl/mat.h>
9791         __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
9792                 unsigned n_row, unsigned n_col);
9793         __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
9794         __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
9796 Note that the elements of a newly created matrix may have arbitrary values.
9797 The elements can be changed and inspected using the following functions.
9799         isl_size isl_mat_rows(__isl_keep isl_mat *mat);
9800         isl_size isl_mat_cols(__isl_keep isl_mat *mat);
9801         __isl_give isl_val *isl_mat_get_element_val(
9802                 __isl_keep isl_mat *mat, int row, int col);
9803         __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
9804                 int row, int col, int v);
9805         __isl_give isl_mat *isl_mat_set_element_val(
9806                 __isl_take isl_mat *mat, int row, int col,
9807                 __isl_take isl_val *v);
9809 The following function computes the rank of a matrix.
9810 The return value may be -1 if some error occurred.
9812         #include <isl/mat.h>
9813         isl_size isl_mat_rank(__isl_keep isl_mat *mat);
9815 The following function can be used to compute the (right) inverse
9816 of a matrix, i.e., a matrix such that the product of the original
9817 and the inverse (in that order) is a multiple of the identity matrix.
9818 The input matrix is assumed to be of full row-rank.
9820         __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
9822 The following function can be used to compute the (right) kernel
9823 (or null space) of a matrix, i.e., a matrix such that the product of
9824 the original and the kernel (in that order) is the zero matrix.
9826         __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
9828 The following function computes a basis for the space spanned
9829 by the rows of a matrix.
9831         __isl_give isl_mat *isl_mat_row_basis(
9832                 __isl_take isl_mat *mat);
9834 The following function computes rows that extend a basis of C<mat1>
9835 to a basis that also covers C<mat2>.
9837         __isl_give isl_mat *isl_mat_row_basis_extension(
9838                 __isl_take isl_mat *mat1,
9839                 __isl_take isl_mat *mat2);
9841 The following function checks whether there is no linear dependence
9842 among the combined rows of "mat1" and "mat2" that is not already present
9843 in "mat1" or "mat2" individually.
9844 If "mat1" and "mat2" have linearly independent rows by themselves,
9845 then this means that there is no linear dependence among all rows together.
9847         isl_bool isl_mat_has_linearly_independent_rows(
9848                 __isl_keep isl_mat *mat1,
9849                 __isl_keep isl_mat *mat2);
9851 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
9853 The following functions determine
9854 an upper or lower bound on a quasipolynomial over its domain.
9856         __isl_give isl_pw_qpolynomial_fold *
9857         isl_pw_qpolynomial_bound(
9858                 __isl_take isl_pw_qpolynomial *pwqp,
9859                 enum isl_fold type, isl_bool *tight);
9861         __isl_give isl_union_pw_qpolynomial_fold *
9862         isl_union_pw_qpolynomial_bound(
9863                 __isl_take isl_union_pw_qpolynomial *upwqp,
9864                 enum isl_fold type, isl_bool *tight);
9866 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
9867 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
9868 is the returned bound is known be tight, i.e., for each value
9869 of the parameters there is at least
9870 one element in the domain that reaches the bound.
9871 If the domain of C<pwqp> is not wrapping, then the bound is computed
9872 over all elements in that domain and the result has a purely parametric
9873 domain.  If the domain of C<pwqp> is wrapping, then the bound is
9874 computed over the range of the wrapped relation.  The domain of the
9875 wrapped relation becomes the domain of the result.
9877 =head2 Parametric Vertex Enumeration
9879 The parametric vertex enumeration described in this section
9880 is mainly intended to be used internally and by the C<barvinok>
9881 library.
9883         #include <isl/vertices.h>
9884         __isl_give isl_vertices *isl_basic_set_compute_vertices(
9885                 __isl_keep isl_basic_set *bset);
9887 The function C<isl_basic_set_compute_vertices> performs the
9888 actual computation of the parametric vertices and the chamber
9889 decomposition and stores the result in an C<isl_vertices> object.
9890 This information can be queried by either iterating over all
9891 the vertices or iterating over all the chambers or cells
9892 and then iterating over all vertices that are active on the chamber.
9894         isl_stat isl_vertices_foreach_vertex(
9895                 __isl_keep isl_vertices *vertices,
9896                 isl_stat (*fn)(__isl_take isl_vertex *vertex,
9897                         void *user), void *user);
9899         isl_stat isl_vertices_foreach_cell(
9900                 __isl_keep isl_vertices *vertices,
9901                 isl_stat (*fn)(__isl_take isl_cell *cell,
9902                         void *user), void *user);
9903         isl_stat isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
9904                 isl_stat (*fn)(__isl_take isl_vertex *vertex,
9905                         void *user), void *user);
9907 Other operations that can be performed on an C<isl_vertices> object are
9908 the following.
9910         isl_size isl_vertices_get_n_vertices(
9911                 __isl_keep isl_vertices *vertices);
9912         __isl_null isl_vertices *isl_vertices_free(
9913                 __isl_take isl_vertices *vertices);
9915 Vertices can be inspected and destroyed using the following functions.
9917         isl_size isl_vertex_get_id(__isl_keep isl_vertex *vertex);
9918         __isl_give isl_basic_set *isl_vertex_get_domain(
9919                 __isl_keep isl_vertex *vertex);
9920         __isl_give isl_multi_aff *isl_vertex_get_expr(
9921                 __isl_keep isl_vertex *vertex);
9922         __isl_null isl_vertex *isl_vertex_free(
9923                 __isl_take isl_vertex *vertex);
9925 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
9926 describing the vertex in terms of the parameters,
9927 while C<isl_vertex_get_domain> returns the activity domain
9928 of the vertex.
9930 Chambers can be inspected and destroyed using the following functions.
9932         __isl_give isl_basic_set *isl_cell_get_domain(
9933                 __isl_keep isl_cell *cell);
9934         __isl_null isl_cell *isl_cell_free(
9935                 __isl_take isl_cell *cell);
9937 =head1 Polyhedral Compilation Library
9939 This section collects functionality in C<isl> that has been specifically
9940 designed for use during polyhedral compilation.
9942 =head2 Schedule Trees
9944 A schedule tree is a structured representation of a schedule,
9945 assigning a relative order to a set of domain elements.
9946 The relative order expressed by the schedule tree is
9947 defined recursively.  In particular, the order between
9948 two domain elements is determined by the node that is closest
9949 to the root that refers to both elements and that orders them apart.
9950 Each node in the tree is of one of several types.
9951 The root node is always of type C<isl_schedule_node_domain>
9952 (or C<isl_schedule_node_extension>)
9953 and it describes the (extra) domain elements to which the schedule applies.
9954 The other types of nodes are as follows.
9956 =over
9958 =item C<isl_schedule_node_band>
9960 A band of schedule dimensions.  Each schedule dimension is represented
9961 by a union piecewise quasi-affine expression.  If this expression
9962 assigns a different value to two domain elements, while all previous
9963 schedule dimensions in the same band assign them the same value,
9964 then the two domain elements are ordered according to these two
9965 different values.
9966 Each expression is required to be total in the domain elements
9967 that reach the band node.
9969 =item C<isl_schedule_node_expansion>
9971 An expansion node maps each of the domain elements that reach the node
9972 to one or more domain elements.  The image of this mapping forms
9973 the set of domain elements that reach the child of the expansion node.
9974 The function that maps each of the expanded domain elements
9975 to the original domain element from which it was expanded
9976 is called the contraction.
9978 =item C<isl_schedule_node_filter>
9980 A filter node does not impose any ordering, but rather intersects
9981 the set of domain elements that the current subtree refers to
9982 with a given union set.  The subtree of the filter node only
9983 refers to domain elements in the intersection.
9984 A filter node is typically only used as a child of a sequence or
9985 set node.
9987 =item C<isl_schedule_node_leaf>
9989 A leaf of the schedule tree.  Leaf nodes do not impose any ordering.
9991 =item C<isl_schedule_node_mark>
9993 A mark node can be used to attach any kind of information to a subtree
9994 of the schedule tree.
9996 =item C<isl_schedule_node_sequence>
9998 A sequence node has one or more children, each of which is a filter node.
9999 The filters on these filter nodes form a partition of
10000 the domain elements that the current subtree refers to.
10001 If two domain elements appear in distinct filters then the sequence
10002 node orders them according to the child positions of the corresponding
10003 filter nodes.
10005 =item C<isl_schedule_node_set>
10007 A set node is similar to a sequence node, except that
10008 it expresses that domain elements appearing in distinct filters
10009 may have any order.  The order of the children of a set node
10010 is therefore also immaterial.
10012 =back
10014 The following node types are only supported by the AST generator.
10016 =over
10018 =item C<isl_schedule_node_context>
10020 The context describes constraints on the parameters and
10021 the schedule dimensions of outer
10022 bands that the AST generator may assume to hold.  It is also the only
10023 kind of node that may introduce additional parameters.
10024 The space of the context is that of the flat product of the outer
10025 band nodes.  In particular, if there are no outer band nodes, then
10026 this space is the unnamed zero-dimensional space.
10027 Since a context node references the outer band nodes, any tree
10028 containing a context node is considered to be anchored.
10030 =item C<isl_schedule_node_extension>
10032 An extension node instructs the AST generator to add additional
10033 domain elements that need to be scheduled.
10034 The additional domain elements are described by the range of
10035 the extension map in terms of the outer schedule dimensions,
10036 i.e., the flat product of the outer band nodes.
10037 Note that domain elements are added whenever the AST generator
10038 reaches the extension node, meaning that there are still some
10039 active domain elements for which an AST needs to be generated.
10040 The conditions under which some domain elements are still active
10041 may however not be completely described by the outer AST nodes
10042 generated at that point.
10043 Since an extension node references the outer band nodes, any tree
10044 containing an extension node is considered to be anchored.
10046 An extension node may also appear as the root of a schedule tree,
10047 when it is intended to be inserted into another tree
10048 using C<isl_schedule_node_graft_before> or C<isl_schedule_node_graft_after>.
10049 In this case, the domain of the extension node should
10050 correspond to the flat product of the outer band nodes
10051 in this other schedule tree at the point where the extension tree
10052 will be inserted.
10054 =item C<isl_schedule_node_guard>
10056 The guard describes constraints on the parameters and
10057 the schedule dimensions of outer
10058 bands that need to be enforced by the outer nodes
10059 in the generated AST.
10060 That is, the part of the AST that is generated from descendants
10061 of the guard node can assume that these constraints are satisfied.
10062 The space of the guard is that of the flat product of the outer
10063 band nodes.  In particular, if there are no outer band nodes, then
10064 this space is the unnamed zero-dimensional space.
10065 Since a guard node references the outer band nodes, any tree
10066 containing a guard node is considered to be anchored.
10068 =back
10070 Except for the C<isl_schedule_node_context> nodes,
10071 none of the nodes may introduce any parameters that were not
10072 already present in the root domain node.
10074 A schedule tree is encapsulated in an C<isl_schedule> object.
10075 The simplest such objects, those with a tree consisting of single domain node,
10076 can be created using the following functions with either an empty
10077 domain or a given domain.
10079         #include <isl/schedule.h>
10080         __isl_give isl_schedule *isl_schedule_empty(
10081                 __isl_take isl_space *space);
10082         __isl_give isl_schedule *isl_schedule_from_domain(
10083                 __isl_take isl_union_set *domain);
10085 The function C<isl_schedule_constraints_compute_schedule> described
10086 in L</"Scheduling"> can also be used to construct schedules.
10088 C<isl_schedule> objects may be copied and freed using the following functions.
10090         #include <isl/schedule.h>
10091         __isl_give isl_schedule *isl_schedule_copy(
10092                 __isl_keep isl_schedule *sched);
10093         __isl_null isl_schedule *isl_schedule_free(
10094                 __isl_take isl_schedule *sched);
10096 The following functions checks whether two C<isl_schedule> objects
10097 are obviously the same.
10099         #include <isl/schedule.h>
10100         isl_bool isl_schedule_plain_is_equal(
10101                 __isl_keep isl_schedule *schedule1,
10102                 __isl_keep isl_schedule *schedule2);
10104 The domain of the schedule, i.e., the domain described by the root node,
10105 can be obtained using the following function.
10107         #include <isl/schedule.h>
10108         __isl_give isl_union_set *isl_schedule_get_domain(
10109                 __isl_keep isl_schedule *schedule);
10111 An extra top-level band node (right underneath the domain node) can
10112 be introduced into the schedule using the following function.
10113 The schedule tree is assumed not to have any anchored nodes.
10115         #include <isl/schedule.h>
10116         __isl_give isl_schedule *
10117         isl_schedule_insert_partial_schedule(
10118                 __isl_take isl_schedule *schedule,
10119                 __isl_take isl_multi_union_pw_aff *partial);
10121 A top-level context node (right underneath the domain node) can
10122 be introduced into the schedule using the following function.
10124         #include <isl/schedule.h>
10125         __isl_give isl_schedule *isl_schedule_insert_context(
10126                 __isl_take isl_schedule *schedule,
10127                 __isl_take isl_set *context)
10129 A top-level guard node (right underneath the domain node) can
10130 be introduced into the schedule using the following function.
10132         #include <isl/schedule.h>
10133         __isl_give isl_schedule *isl_schedule_insert_guard(
10134                 __isl_take isl_schedule *schedule,
10135                 __isl_take isl_set *guard)
10137 A schedule that combines two schedules either in the given
10138 order or in an arbitrary order, i.e., with an C<isl_schedule_node_sequence>
10139 or an C<isl_schedule_node_set> node,
10140 can be created using the following functions.
10142         #include <isl/schedule.h>
10143         __isl_give isl_schedule *isl_schedule_sequence(
10144                 __isl_take isl_schedule *schedule1,
10145                 __isl_take isl_schedule *schedule2);
10146         __isl_give isl_schedule *isl_schedule_set(
10147                 __isl_take isl_schedule *schedule1,
10148                 __isl_take isl_schedule *schedule2);
10150 The domains of the two input schedules need to be disjoint.
10152 The following function can be used to restrict the domain
10153 of a schedule with a domain node as root to be a subset of the given union set.
10154 This operation may remove nodes in the tree that have become
10155 redundant.
10157         #include <isl/schedule.h>
10158         __isl_give isl_schedule *isl_schedule_intersect_domain(
10159                 __isl_take isl_schedule *schedule,
10160                 __isl_take isl_union_set *domain);
10162 The following function can be used to simplify the domain
10163 of a schedule with a domain node as root with respect to the given
10164 parameter domain.
10166         #include <isl/schedule.h>
10167         __isl_give isl_schedule *isl_schedule_gist_domain_params(
10168                 __isl_take isl_schedule *schedule,
10169                 __isl_take isl_set *context);
10171 The following function resets the user pointers on all parameter
10172 and tuple identifiers referenced by the nodes of the given schedule.
10174         #include <isl/schedule.h>
10175         __isl_give isl_schedule *isl_schedule_reset_user(
10176                 __isl_take isl_schedule *schedule);
10178 The following function aligns the parameters of all nodes
10179 in the given schedule to the given space.
10181         #include <isl/schedule.h>
10182         __isl_give isl_schedule *isl_schedule_align_params(
10183                 __isl_take isl_schedule *schedule,
10184                 __isl_take isl_space *space);
10186 The following function allows the user to plug in a given function
10187 in the iteration domains.  The input schedule is not allowed to contain
10188 any expansion nodes.
10190         #include <isl/schedule.h>
10191         __isl_give isl_schedule *
10192         isl_schedule_pullback_union_pw_multi_aff(
10193                 __isl_take isl_schedule *schedule,
10194                 __isl_take isl_union_pw_multi_aff *upma);
10196 The following function can be used to plug in the schedule C<expansion>
10197 in the leaves of C<schedule>, where C<contraction> describes how
10198 the domain elements of C<expansion> map to the domain elements
10199 at the original leaves of C<schedule>.
10200 The resulting schedule will contain expansion nodes, unless
10201 C<contraction> is an identity function.
10203         #include <isl/schedule.h>
10204         __isl_give isl_schedule *isl_schedule_expand(
10205                 __isl_take isl_schedule *schedule,
10206                 __isl_take isl_union_pw_multi_aff *contraction,
10207                 __isl_take isl_schedule *expansion);
10209 An C<isl_union_map> representation of the schedule can be obtained
10210 from an C<isl_schedule> using the following function.
10212         #include <isl/schedule.h>
10213         __isl_give isl_union_map *isl_schedule_get_map(
10214                 __isl_keep isl_schedule *sched);
10216 The resulting relation encodes the same relative ordering as
10217 the schedule by mapping the domain elements to a common schedule space.
10218 If the schedule_separate_components option is set, then the order
10219 of the children of a set node is explicitly encoded in the result.
10220 If the tree contains any expansion nodes, then the relation
10221 is formulated in terms of the expanded domain elements.
10223 Schedules can be read from input using the following functions.
10225         #include <isl/schedule.h>
10226         __isl_give isl_schedule *isl_schedule_read_from_file(
10227                 isl_ctx *ctx, FILE *input);
10228         __isl_give isl_schedule *isl_schedule_read_from_str(
10229                 isl_ctx *ctx, const char *str);
10231 A representation of the schedule can be printed using
10233         #include <isl/schedule.h>
10234         __isl_give isl_printer *isl_printer_print_schedule(
10235                 __isl_take isl_printer *p,
10236                 __isl_keep isl_schedule *schedule);
10237         __isl_give char *isl_schedule_to_str(
10238                 __isl_keep isl_schedule *schedule);
10240 C<isl_schedule_to_str> prints the schedule in flow format.
10242 The schedule tree can be traversed through the use of
10243 C<isl_schedule_node> objects that point to a particular
10244 position in the schedule tree.  Whenever a C<isl_schedule_node>
10245 is used to modify a node in the schedule tree, the original schedule
10246 tree is left untouched and the modifications are performed to a copy
10247 of the tree.  The returned C<isl_schedule_node> then points to
10248 this modified copy of the tree.
10250 The root of the schedule tree can be obtained using the following function.
10252         #include <isl/schedule.h>
10253         __isl_give isl_schedule_node *isl_schedule_get_root(
10254                 __isl_keep isl_schedule *schedule);
10256 A pointer to a newly created schedule tree with a single domain
10257 node can be created using the following functions.
10259         #include <isl/schedule_node.h>
10260         __isl_give isl_schedule_node *
10261         isl_schedule_node_from_domain(
10262                 __isl_take isl_union_set *domain);
10263         __isl_give isl_schedule_node *
10264         isl_schedule_node_from_extension(
10265                 __isl_take isl_union_map *extension);
10267 C<isl_schedule_node_from_extension> creates a tree with an extension
10268 node as root.
10270 Schedule nodes can be copied and freed using the following functions.
10272         #include <isl/schedule_node.h>
10273         __isl_give isl_schedule_node *isl_schedule_node_copy(
10274                 __isl_keep isl_schedule_node *node);
10275         __isl_null isl_schedule_node *isl_schedule_node_free(
10276                 __isl_take isl_schedule_node *node);
10278 The following functions can be used to check if two schedule
10279 nodes point to the same position in the same schedule.
10281         #include <isl/schedule_node.h>
10282         isl_bool isl_schedule_node_is_equal(
10283                 __isl_keep isl_schedule_node *node1,
10284                 __isl_keep isl_schedule_node *node2);
10286 The following properties can be obtained from a schedule node.
10288         #include <isl/schedule_node.h>
10289         enum isl_schedule_node_type isl_schedule_node_get_type(
10290                 __isl_keep isl_schedule_node *node);
10291         enum isl_schedule_node_type
10292         isl_schedule_node_get_parent_type(
10293                 __isl_keep isl_schedule_node *node);
10294         __isl_give isl_schedule *isl_schedule_node_get_schedule(
10295                 __isl_keep isl_schedule_node *node);
10297 The function C<isl_schedule_node_get_type> returns the type of
10298 the node, while C<isl_schedule_node_get_parent_type> returns
10299 type of the parent of the node, which is required to exist.
10300 The function C<isl_schedule_node_get_schedule> returns a copy
10301 to the schedule to which the node belongs.
10303 The following functions can be used to move the schedule node
10304 to a different position in the tree or to check if such a position
10305 exists.
10307         #include <isl/schedule_node.h>
10308         isl_bool isl_schedule_node_has_parent(
10309                 __isl_keep isl_schedule_node *node);
10310         __isl_give isl_schedule_node *isl_schedule_node_parent(
10311                 __isl_take isl_schedule_node *node);
10312         __isl_give isl_schedule_node *
10313         isl_schedule_node_grandparent(
10314                 __isl_take isl_schedule_node *node);
10315         __isl_give isl_schedule_node *isl_schedule_node_root(
10316                 __isl_take isl_schedule_node *node);
10317         __isl_give isl_schedule_node *isl_schedule_node_ancestor(
10318                 __isl_take isl_schedule_node *node,
10319                 int generation);
10320         isl_size isl_schedule_node_n_children(
10321                 __isl_keep isl_schedule_node *node);
10322         __isl_give isl_schedule_node *isl_schedule_node_child(
10323                 __isl_take isl_schedule_node *node, int pos);
10324         isl_bool isl_schedule_node_has_children(
10325                 __isl_keep isl_schedule_node *node);
10326         __isl_give isl_schedule_node *
10327         isl_schedule_node_grandchild(
10328                 __isl_take isl_schedule_node *node,
10329                 int pos1, int pos2);
10330         __isl_give isl_schedule_node *isl_schedule_node_first_child(
10331                 __isl_take isl_schedule_node *node);
10332         isl_bool isl_schedule_node_has_previous_sibling(
10333                 __isl_keep isl_schedule_node *node);
10334         __isl_give isl_schedule_node *
10335         isl_schedule_node_previous_sibling(
10336                 __isl_take isl_schedule_node *node);
10337         isl_bool isl_schedule_node_has_next_sibling(
10338                 __isl_keep isl_schedule_node *node);
10339         __isl_give isl_schedule_node *
10340         isl_schedule_node_next_sibling(
10341                 __isl_take isl_schedule_node *node);
10343 For C<isl_schedule_node_ancestor>, the ancestor of generation 0
10344 is the node itself, the ancestor of generation 1 is its parent and so on.
10346 It is also possible to query the number of ancestors of a node,
10347 the position of the current node
10348 within the children of its parent, the position of the subtree
10349 containing a node within the children of an ancestor
10350 or to obtain a copy of a given
10351 child without destroying the current node.
10352 Given two nodes that point to the same schedule, their closest
10353 shared ancestor can be obtained using
10354 C<isl_schedule_node_get_shared_ancestor>.
10356         #include <isl/schedule_node.h>
10357         isl_size isl_schedule_node_get_tree_depth(
10358                 __isl_keep isl_schedule_node *node);
10359         isl_size isl_schedule_node_get_child_position(
10360                 __isl_keep isl_schedule_node *node);
10361         isl_size isl_schedule_node_get_ancestor_child_position(
10362                 __isl_keep isl_schedule_node *node,
10363                 __isl_keep isl_schedule_node *ancestor);
10364         __isl_give isl_schedule_node *isl_schedule_node_get_child(
10365                 __isl_keep isl_schedule_node *node, int pos);
10366         __isl_give isl_schedule_node *
10367         isl_schedule_node_get_shared_ancestor(
10368                 __isl_keep isl_schedule_node *node1,
10369                 __isl_keep isl_schedule_node *node2);
10371 All nodes in a schedule tree or
10372 all descendants of a specific node (including the node) can be visited
10373 in depth-first pre-order using the following functions.
10375         #include <isl/schedule.h>
10376         isl_stat isl_schedule_foreach_schedule_node_top_down(
10377                 __isl_keep isl_schedule *sched,
10378                 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
10379                         void *user), void *user);
10381         #include <isl/schedule_node.h>
10382         isl_stat isl_schedule_node_foreach_descendant_top_down(
10383                 __isl_keep isl_schedule_node *node,
10384                 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
10385                         void *user), void *user);
10387 The callback function is slightly different from the usual
10388 callbacks in that it not only indicates success (non-negative result)
10389 or failure (negative result), but also indicates whether the children
10390 of the given node should be visited.  In particular, if the callback
10391 returns a positive value, then the children are visited, but if
10392 the callback returns zero, then the children are not visited.
10394 The following functions checks whether
10395 all descendants of a specific node (including the node itself)
10396 satisfy a user-specified test.
10398         #include <isl/schedule_node.h>
10399         isl_bool isl_schedule_node_every_descendant(
10400                 __isl_keep isl_schedule_node *node,
10401                 isl_bool (*test)(__isl_keep isl_schedule_node *node,
10402                         void *user), void *user)
10404 The ancestors of a node in a schedule tree can be visited from
10405 the root down to and including the parent of the node using
10406 the following function.
10408         #include <isl/schedule_node.h>
10409         isl_stat isl_schedule_node_foreach_ancestor_top_down(
10410                 __isl_keep isl_schedule_node *node,
10411                 isl_stat (*fn)(__isl_keep isl_schedule_node *node,
10412                         void *user), void *user);
10414 The following functions allows for a depth-first post-order
10415 traversal of the nodes in a schedule tree or
10416 of the descendants of a specific node (including the node
10417 itself), where the user callback is allowed to modify the
10418 visited node.
10420         #include <isl/schedule.h>
10421         __isl_give isl_schedule *
10422         isl_schedule_map_schedule_node_bottom_up(
10423                 __isl_take isl_schedule *schedule,
10424                 __isl_give isl_schedule_node *(*fn)(
10425                         __isl_take isl_schedule_node *node,
10426                         void *user), void *user);
10428         #include <isl/schedule_node.h>
10429         __isl_give isl_schedule_node *
10430         isl_schedule_node_map_descendant_bottom_up(
10431                 __isl_take isl_schedule_node *node,
10432                 __isl_give isl_schedule_node *(*fn)(
10433                         __isl_take isl_schedule_node *node,
10434                         void *user), void *user);
10436 The traversal continues from the node returned by the callback function.
10437 It is the responsibility of the user to ensure that this does not
10438 lead to an infinite loop.  It is safest to always return a pointer
10439 to the same position (same ancestors and child positions) as the input node.
10441 The following function removes a node (along with its descendants)
10442 from a schedule tree and returns a pointer to the leaf at the
10443 same position in the updated tree.
10444 It is not allowed to remove the root of a schedule tree or
10445 a child of a set or sequence node.
10447         #include <isl/schedule_node.h>
10448         __isl_give isl_schedule_node *isl_schedule_node_cut(
10449                 __isl_take isl_schedule_node *node);
10451 The following function removes a single node
10452 from a schedule tree and returns a pointer to the child
10453 of the node, now located at the position of the original node
10454 or to a leaf node at that position if there was no child.
10455 It is not allowed to remove the root of a schedule tree,
10456 a set or sequence node, a child of a set or sequence node or
10457 a band node with an anchored subtree.
10459         #include <isl/schedule_node.h>
10460         __isl_give isl_schedule_node *isl_schedule_node_delete(
10461                 __isl_take isl_schedule_node *node);
10463 Most nodes in a schedule tree only contain local information.
10464 In some cases, however, a node may also refer to the schedule dimensions
10465 of its outer band nodes.
10466 This means that the position of the node within the tree should
10467 not be changed, or at least that no changes are performed to the
10468 outer band nodes.  The following function can be used to test
10469 whether the subtree rooted at a given node contains any such nodes.
10471         #include <isl/schedule_node.h>
10472         isl_bool isl_schedule_node_is_subtree_anchored(
10473                 __isl_keep isl_schedule_node *node);
10475 The following function resets the user pointers on all parameter
10476 and tuple identifiers referenced by the given schedule node.
10478         #include <isl/schedule_node.h>
10479         __isl_give isl_schedule_node *isl_schedule_node_reset_user(
10480                 __isl_take isl_schedule_node *node);
10482 The following function aligns the parameters of the given schedule
10483 node to the given space.
10485         #include <isl/schedule_node.h>
10486         __isl_give isl_schedule_node *
10487         isl_schedule_node_align_params(
10488                 __isl_take isl_schedule_node *node,
10489                 __isl_take isl_space *space);
10491 Several node types have their own functions for querying
10492 (and in some cases setting) some node type specific properties.
10494         #include <isl/schedule_node.h>
10495         __isl_give isl_space *isl_schedule_node_band_get_space(
10496                 __isl_keep isl_schedule_node *node);
10497         __isl_give isl_multi_union_pw_aff *
10498         isl_schedule_node_band_get_partial_schedule(
10499                 __isl_keep isl_schedule_node *node);
10500         __isl_give isl_union_map *
10501         isl_schedule_node_band_get_partial_schedule_union_map(
10502                 __isl_keep isl_schedule_node *node);
10503         isl_size isl_schedule_node_band_n_member(
10504                 __isl_keep isl_schedule_node *node);
10505         isl_bool isl_schedule_node_band_member_get_coincident(
10506                 __isl_keep isl_schedule_node *node, int pos);
10507         __isl_give isl_schedule_node *
10508         isl_schedule_node_band_member_set_coincident(
10509                 __isl_take isl_schedule_node *node, int pos,
10510                 int coincident);
10511         isl_bool isl_schedule_node_band_get_permutable(
10512                 __isl_keep isl_schedule_node *node);
10513         __isl_give isl_schedule_node *
10514         isl_schedule_node_band_set_permutable(
10515                 __isl_take isl_schedule_node *node, int permutable);
10516         enum isl_ast_loop_type
10517         isl_schedule_node_band_member_get_ast_loop_type(
10518                 __isl_keep isl_schedule_node *node, int pos);
10519         __isl_give isl_schedule_node *
10520         isl_schedule_node_band_member_set_ast_loop_type(
10521                 __isl_take isl_schedule_node *node, int pos,
10522                 enum isl_ast_loop_type type);
10523         enum isl_ast_loop_type
10524         isl_schedule_node_band_member_get_isolate_ast_loop_type(
10525                 __isl_keep isl_schedule_node *node, int pos);
10526         __isl_give isl_schedule_node *
10527         isl_schedule_node_band_member_set_isolate_ast_loop_type(
10528                 __isl_take isl_schedule_node *node, int pos,
10529                 enum isl_ast_loop_type type);
10530         __isl_give isl_union_set *
10531         isl_schedule_node_band_get_ast_build_options(
10532                 __isl_keep isl_schedule_node *node);
10533         __isl_give isl_schedule_node *
10534         isl_schedule_node_band_set_ast_build_options(
10535                 __isl_take isl_schedule_node *node,
10536                 __isl_take isl_union_set *options);
10537         __isl_give isl_set *
10538         isl_schedule_node_band_get_ast_isolate_option(
10539                 __isl_keep isl_schedule_node *node);
10541 The function C<isl_schedule_node_band_get_space> returns the space
10542 of the partial schedule of the band.
10543 The function C<isl_schedule_node_band_get_partial_schedule_union_map>
10544 returns a representation of the partial schedule of the band node
10545 in the form of an C<isl_union_map>.
10546 The coincident and permutable properties are set by
10547 C<isl_schedule_constraints_compute_schedule> on the schedule tree
10548 it produces.
10549 A scheduling dimension is considered to be ``coincident''
10550 if it satisfies the coincidence constraints within its band.
10551 That is, if the dependence distances of the coincidence
10552 constraints are all zero in that direction (for fixed
10553 iterations of outer bands).
10554 A band is marked permutable if it was produced using the Pluto-like scheduler.
10555 Note that the scheduler may have to resort to a Feautrier style scheduling
10556 step even if the default scheduler is used.
10557 An C<isl_ast_loop_type> is one of C<isl_ast_loop_default>,
10558 C<isl_ast_loop_atomic>, C<isl_ast_loop_unroll> or C<isl_ast_loop_separate>.
10559 For the meaning of these loop AST generation types and the difference
10560 between the regular loop AST generation type and the isolate
10561 loop AST generation type, see L</"AST Generation Options (Schedule Tree)">.
10562 The functions C<isl_schedule_node_band_member_get_ast_loop_type>
10563 and C<isl_schedule_node_band_member_get_isolate_ast_loop_type>
10564 may return C<isl_ast_loop_error> if an error occurs.
10565 The AST build options govern how an AST is generated for
10566 the individual schedule dimensions during AST generation.
10567 See L</"AST Generation Options (Schedule Tree)">.
10568 The isolate option for the given node can be extracted from these
10569 AST build options using the function
10570 C<isl_schedule_node_band_get_ast_isolate_option>.
10572         #include <isl/schedule_node.h>
10573         __isl_give isl_set *
10574         isl_schedule_node_context_get_context(
10575                 __isl_keep isl_schedule_node *node);
10577         #include <isl/schedule_node.h>
10578         __isl_give isl_union_set *
10579         isl_schedule_node_domain_get_domain(
10580                 __isl_keep isl_schedule_node *node);
10582         #include <isl/schedule_node.h>
10583         __isl_give isl_union_map *
10584         isl_schedule_node_expansion_get_expansion(
10585                 __isl_keep isl_schedule_node *node);
10586         __isl_give isl_union_pw_multi_aff *
10587         isl_schedule_node_expansion_get_contraction(
10588                 __isl_keep isl_schedule_node *node);
10590         #include <isl/schedule_node.h>
10591         __isl_give isl_union_map *
10592         isl_schedule_node_extension_get_extension(
10593                 __isl_keep isl_schedule_node *node);
10595         #include <isl/schedule_node.h>
10596         __isl_give isl_union_set *
10597         isl_schedule_node_filter_get_filter(
10598                 __isl_keep isl_schedule_node *node);
10600         #include <isl/schedule_node.h>
10601         __isl_give isl_set *isl_schedule_node_guard_get_guard(
10602                 __isl_keep isl_schedule_node *node);
10604         #include <isl/schedule_node.h>
10605         __isl_give isl_id *isl_schedule_node_mark_get_id(
10606                 __isl_keep isl_schedule_node *node);
10608 The following functions can be used to obtain an C<isl_multi_union_pw_aff>,
10609 an C<isl_union_pw_multi_aff> or C<isl_union_map> representation of
10610 partial schedules related to the node.
10612         #include <isl/schedule_node.h>
10613         __isl_give isl_multi_union_pw_aff *
10614         isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(
10615                 __isl_keep isl_schedule_node *node);
10616         __isl_give isl_union_pw_multi_aff *
10617         isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(
10618                 __isl_keep isl_schedule_node *node);
10619         __isl_give isl_union_map *
10620         isl_schedule_node_get_prefix_schedule_union_map(
10621                 __isl_keep isl_schedule_node *node);
10622         __isl_give isl_union_map *
10623         isl_schedule_node_get_prefix_schedule_relation(
10624                 __isl_keep isl_schedule_node *node);
10625         __isl_give isl_union_map *
10626         isl_schedule_node_get_subtree_schedule_union_map(
10627                 __isl_keep isl_schedule_node *node);
10629 In particular, the functions
10630 C<isl_schedule_node_get_prefix_schedule_multi_union_pw_aff>,
10631 C<isl_schedule_node_get_prefix_schedule_union_pw_multi_aff>
10632 and C<isl_schedule_node_get_prefix_schedule_union_map>
10633 return a relative ordering on the domain elements that reach the given
10634 node determined by its ancestors.
10635 The function C<isl_schedule_node_get_prefix_schedule_relation>
10636 additionally includes the domain constraints in the result.
10637 The function C<isl_schedule_node_get_subtree_schedule_union_map>
10638 returns a representation of the partial schedule defined by the
10639 subtree rooted at the given node.
10640 If the tree contains any expansion nodes, then the subtree schedule
10641 is formulated in terms of the expanded domain elements.
10642 The tree passed to functions returning a prefix schedule
10643 may only contain extension nodes if these would not affect
10644 the result of these functions.  That is, if one of the ancestors
10645 is an extension node, then all of the domain elements that were
10646 added by the extension node need to have been filtered out
10647 by filter nodes between the extension node and the input node.
10648 The tree passed to C<isl_schedule_node_get_subtree_schedule_union_map>
10649 may not contain in extension nodes in the selected subtree.
10651 The expansion/contraction defined by an entire subtree, combining
10652 the expansions/contractions
10653 on the expansion nodes in the subtree, can be obtained using
10654 the following functions.
10656         #include <isl/schedule_node.h>
10657         __isl_give isl_union_map *
10658         isl_schedule_node_get_subtree_expansion(
10659                 __isl_keep isl_schedule_node *node);
10660         __isl_give isl_union_pw_multi_aff *
10661         isl_schedule_node_get_subtree_contraction(
10662                 __isl_keep isl_schedule_node *node);
10664 The total number of outer band members of given node, i.e.,
10665 the shared output dimension of the maps in the result
10666 of C<isl_schedule_node_get_prefix_schedule_union_map> can be obtained
10667 using the following function.
10669         #include <isl/schedule_node.h>
10670         isl_size isl_schedule_node_get_schedule_depth(
10671                 __isl_keep isl_schedule_node *node);
10673 The following functions return the elements that reach the given node
10674 or the union of universes in the spaces that contain these elements.
10676         #include <isl/schedule_node.h>
10677         __isl_give isl_union_set *
10678         isl_schedule_node_get_domain(
10679                 __isl_keep isl_schedule_node *node);
10680         __isl_give isl_union_set *
10681         isl_schedule_node_get_universe_domain(
10682                 __isl_keep isl_schedule_node *node);
10684 The input tree of C<isl_schedule_node_get_domain>
10685 may only contain extension nodes if these would not affect
10686 the result of this function.  That is, if one of the ancestors
10687 is an extension node, then all of the domain elements that were
10688 added by the extension node need to have been filtered out
10689 by filter nodes between the extension node and the input node.
10691 The following functions can be used to introduce additional nodes
10692 in the schedule tree.  The new node is introduced at the point
10693 in the tree where the C<isl_schedule_node> points to and
10694 the results points to the new node.
10696         #include <isl/schedule_node.h>
10697         __isl_give isl_schedule_node *
10698         isl_schedule_node_insert_partial_schedule(
10699                 __isl_take isl_schedule_node *node,
10700                 __isl_take isl_multi_union_pw_aff *schedule);
10702 This function inserts a new band node with (the greatest integer
10703 part of) the given partial schedule.
10704 The subtree rooted at the given node is assumed not to have
10705 any anchored nodes.
10707         #include <isl/schedule_node.h>
10708         __isl_give isl_schedule_node *
10709         isl_schedule_node_insert_context(
10710                 __isl_take isl_schedule_node *node,
10711                 __isl_take isl_set *context);
10713 This function inserts a new context node with the given context constraints.
10715         #include <isl/schedule_node.h>
10716         __isl_give isl_schedule_node *
10717         isl_schedule_node_insert_filter(
10718                 __isl_take isl_schedule_node *node,
10719                 __isl_take isl_union_set *filter);
10721 This function inserts a new filter node with the given filter.
10722 If the original node already pointed to a filter node, then the
10723 two filter nodes are merged into one.
10725         #include <isl/schedule_node.h>
10726         __isl_give isl_schedule_node *
10727         isl_schedule_node_insert_guard(
10728                 __isl_take isl_schedule_node *node,
10729                 __isl_take isl_set *guard);
10731 This function inserts a new guard node with the given guard constraints.
10733         #include <isl/schedule_node.h>
10734         __isl_give isl_schedule_node *
10735         isl_schedule_node_insert_mark(
10736                 __isl_take isl_schedule_node *node,
10737                 __isl_take isl_id *mark);
10739 This function inserts a new mark node with the give mark identifier.
10741         #include <isl/schedule_node.h>
10742         __isl_give isl_schedule_node *
10743         isl_schedule_node_insert_sequence(
10744                 __isl_take isl_schedule_node *node,
10745                 __isl_take isl_union_set_list *filters);
10746         __isl_give isl_schedule_node *
10747         isl_schedule_node_insert_set(
10748                 __isl_take isl_schedule_node *node,
10749                 __isl_take isl_union_set_list *filters);
10751 These functions insert a new sequence or set node with the given
10752 filters as children.
10754         #include <isl/schedule_node.h>
10755         __isl_give isl_schedule_node *isl_schedule_node_group(
10756                 __isl_take isl_schedule_node *node,
10757                 __isl_take isl_id *group_id);
10759 This function introduces an expansion node in between the current
10760 node and its parent that expands instances of a space with tuple
10761 identifier C<group_id> to the original domain elements that reach
10762 the node.  The group instances are identified by the prefix schedule
10763 of those domain elements.  The ancestors of the node are adjusted
10764 to refer to the group instances instead of the original domain
10765 elements.  The return value points to the same node in the updated
10766 schedule tree as the input node, i.e., to the child of the newly
10767 introduced expansion node.  Grouping instances of different statements
10768 ensures that they will be treated as a single statement by the
10769 AST generator up to the point of the expansion node.
10771 The following functions can be used to flatten a nested
10772 sequence.
10774         #include <isl/schedule_node.h>
10775         __isl_give isl_schedule_node *
10776         isl_schedule_node_sequence_splice_child(
10777                 __isl_take isl_schedule_node *node, int pos);
10778         __isl_give isl_schedule_node *
10779         isl_schedule_node_sequence_splice_children(
10780                 __isl_take isl_schedule_node *node);
10782 That is, given a sequence node C<node> that has another sequence node
10783 in its child at position C<pos> (in particular, the child of that filter
10784 node is a sequence node), the function
10785 C<isl_schedule_node_sequence_splice_child>
10786 attaches the children of that other sequence
10787 node as children of C<node>, replacing the original child at position
10788 C<pos>.
10789 C<isl_schedule_node_sequence_splice_children> does this for all
10790 such children.
10792 The partial schedule of a band node can be scaled (down) or reduced using
10793 the following functions.
10795         #include <isl/schedule_node.h>
10796         __isl_give isl_schedule_node *
10797         isl_schedule_node_band_scale(
10798                 __isl_take isl_schedule_node *node,
10799                 __isl_take isl_multi_val *mv);
10800         __isl_give isl_schedule_node *
10801         isl_schedule_node_band_scale_down(
10802                 __isl_take isl_schedule_node *node,
10803                 __isl_take isl_multi_val *mv);
10804         __isl_give isl_schedule_node *
10805         isl_schedule_node_band_mod(
10806                 __isl_take isl_schedule_node *node,
10807                 __isl_take isl_multi_val *mv);
10809 The spaces of the two arguments need to match.
10810 After scaling, the partial schedule is replaced by its greatest
10811 integer part to ensure that the schedule remains integral.
10813 The partial schedule of a band node can be shifted by an
10814 C<isl_multi_union_pw_aff> with a domain that is a superset
10815 of the domain of the partial schedule using
10816 the following function.
10818         #include <isl/schedule_node.h>
10819         __isl_give isl_schedule_node *
10820         isl_schedule_node_band_shift(
10821                 __isl_take isl_schedule_node *node,
10822                 __isl_take isl_multi_union_pw_aff *shift);
10824 A band node can be tiled using the following function.
10826         #include <isl/schedule_node.h>
10827         __isl_give isl_schedule_node *isl_schedule_node_band_tile(
10828                 __isl_take isl_schedule_node *node,
10829                 __isl_take isl_multi_val *sizes);
10831         isl_stat isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
10832                 int val);
10833         int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
10834         isl_stat isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
10835                 int val);
10836         int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
10838 The C<isl_schedule_node_band_tile> function tiles
10839 the band using the given tile sizes inside its schedule.
10840 A new child band node is created to represent the point loops and it is
10841 inserted between the modified band and its children.
10842 The subtree rooted at the given node is assumed not to have
10843 any anchored nodes.
10844 The C<tile_scale_tile_loops> option specifies whether the tile
10845 loops iterators should be scaled by the tile sizes.
10846 If the C<tile_shift_point_loops> option is set, then the point loops
10847 are shifted to start at zero.
10849 A band node can be split into two nested band nodes
10850 using the following function.
10852         #include <isl/schedule_node.h>
10853         __isl_give isl_schedule_node *isl_schedule_node_band_split(
10854                 __isl_take isl_schedule_node *node, int pos);
10856 The resulting outer band node contains the first C<pos> dimensions of
10857 the schedule of C<node> while the inner band contains the remaining dimensions.
10858 The schedules of the two band nodes live in anonymous spaces.
10859 The loop AST generation type options and the isolate option
10860 are split over the two band nodes.
10862 A band node can be moved down to the leaves of the subtree rooted
10863 at the band node using the following function.
10865         #include <isl/schedule_node.h>
10866         __isl_give isl_schedule_node *isl_schedule_node_band_sink(
10867                 __isl_take isl_schedule_node *node);
10869 The subtree rooted at the given node is assumed not to have
10870 any anchored nodes.
10871 The result points to the node in the resulting tree that is in the same
10872 position as the node pointed to by C<node> in the original tree.
10874         #include <isl/schedule_node.h>
10875         __isl_give isl_schedule_node *
10876         isl_schedule_node_order_before(
10877                 __isl_take isl_schedule_node *node,
10878                 __isl_take isl_union_set *filter);
10879         __isl_give isl_schedule_node *
10880         isl_schedule_node_order_after(
10881                 __isl_take isl_schedule_node *node,
10882                 __isl_take isl_union_set *filter);
10884 These functions split the domain elements that reach C<node>
10885 into those that satisfy C<filter> and those that do not and
10886 arranges for the elements that do satisfy the filter to be
10887 executed before (in case of C<isl_schedule_node_order_before>)
10888 or after (in case of C<isl_schedule_node_order_after>)
10889 those that do not.  The order is imposed by
10890 a sequence node, possibly reusing the grandparent of C<node>
10891 on two copies of the subtree attached to the original C<node>.
10892 Both copies are simplified with respect to their filter.
10894 Return a pointer to the copy of the subtree that does not
10895 satisfy C<filter>.  If there is no such copy (because all
10896 reaching domain elements satisfy the filter), then return
10897 the original pointer.
10899         #include <isl/schedule_node.h>
10900         __isl_give isl_schedule_node *
10901         isl_schedule_node_graft_before(
10902                 __isl_take isl_schedule_node *node,
10903                 __isl_take isl_schedule_node *graft);
10904         __isl_give isl_schedule_node *
10905         isl_schedule_node_graft_after(
10906                 __isl_take isl_schedule_node *node,
10907                 __isl_take isl_schedule_node *graft);
10909 This function inserts the C<graft> tree into the tree containing C<node>
10910 such that it is executed before (in case of C<isl_schedule_node_graft_before>)
10911 or after (in case of C<isl_schedule_node_graft_after>) C<node>.
10912 The root node of C<graft>
10913 should be an extension node where the domain of the extension
10914 is the flat product of all outer band nodes of C<node>.
10915 The root node may also be a domain node.
10916 The elements of the domain or the range of the extension may not
10917 intersect with the domain elements that reach "node".
10918 The schedule tree of C<graft> may not be anchored.
10920 The schedule tree of C<node> is modified to include an extension node
10921 corresponding to the root node of C<graft> as a child of the original
10922 parent of C<node>.  The original node that C<node> points to and the
10923 child of the root node of C<graft> are attached to this extension node
10924 through a sequence, with appropriate filters and with the child
10925 of C<graft> appearing before or after the original C<node>.
10927 If C<node> already appears inside a sequence that is the child of
10928 an extension node and if the spaces of the new domain elements
10929 do not overlap with those of the original domain elements,
10930 then that extension node is extended with the new extension
10931 rather than introducing a new segment of extension and sequence nodes.
10933 Return a pointer to the same node in the modified tree that
10934 C<node> pointed to in the original tree.
10936 A representation of the schedule node can be printed using
10938         #include <isl/schedule_node.h>
10939         __isl_give isl_printer *isl_printer_print_schedule_node(
10940                 __isl_take isl_printer *p,
10941                 __isl_keep isl_schedule_node *node);
10942         __isl_give char *isl_schedule_node_to_str(
10943                 __isl_keep isl_schedule_node *node);
10945 C<isl_schedule_node_to_str> prints the schedule node in block format.
10947 =head2 Dependence Analysis
10949 C<isl> contains specialized functionality for performing
10950 array dataflow analysis.  That is, given a I<sink> access relation,
10951 a collection of possible I<source> accesses and
10952 a collection of I<kill> accesses,
10953 C<isl> can compute relations that describe
10954 for each iteration of the sink access, which iterations
10955 of which of the source access relations may have
10956 accessed the same data element before the given iteration
10957 of the sink access without any intermediate kill of that data element.
10958 The resulting dependence relations map source iterations
10959 to either the corresponding sink iterations or
10960 pairs of corresponding sink iterations and accessed data elements.
10961 To compute standard flow dependences, the sink should be
10962 a read, while the sources should be writes.
10963 If no kills are specified,
10964 then memory based dependence analysis is performed.
10965 If, on the other hand, all sources are also kills,
10966 then value based dependence analysis is performed.
10967 If any of the source accesses are marked as being I<must>
10968 accesses, then they are also treated as kills.
10969 Furthermore, the specification of must-sources results
10970 in the computation of must-dependences.
10971 Only dependences originating in a must access not coscheduled
10972 with any other access to the same element and without
10973 any may accesses between the must access and the sink access
10974 are considered to be must dependences.
10976 =head3 High-level Interface
10978 A high-level interface to dependence analysis is provided
10979 by the following function.
10981         #include <isl/flow.h>
10982         __isl_give isl_union_flow *
10983         isl_union_access_info_compute_flow(
10984                 __isl_take isl_union_access_info *access);
10986 The input C<isl_union_access_info> object describes the sink
10987 access relations, the source access relations and a schedule,
10988 while the output C<isl_union_flow> object describes
10989 the resulting dependence relations and the subsets of the
10990 sink relations for which no source was found.
10992 An C<isl_union_access_info> is created, modified, copied and freed using
10993 the following functions.
10995         #include <isl/flow.h>
10996         __isl_give isl_union_access_info *
10997         isl_union_access_info_from_sink(
10998                 __isl_take isl_union_map *sink);
10999         __isl_give isl_union_access_info *
11000         isl_union_access_info_set_kill(
11001                 __isl_take isl_union_access_info *access,
11002                 __isl_take isl_union_map *kill);
11003         __isl_give isl_union_access_info *
11004         isl_union_access_info_set_may_source(
11005                 __isl_take isl_union_access_info *access,
11006                 __isl_take isl_union_map *may_source);
11007         __isl_give isl_union_access_info *
11008         isl_union_access_info_set_must_source(
11009                 __isl_take isl_union_access_info *access,
11010                 __isl_take isl_union_map *must_source);
11011         __isl_give isl_union_access_info *
11012         isl_union_access_info_set_schedule(
11013                 __isl_take isl_union_access_info *access,
11014                 __isl_take isl_schedule *schedule);
11015         __isl_give isl_union_access_info *
11016         isl_union_access_info_set_schedule_map(
11017                 __isl_take isl_union_access_info *access,
11018                 __isl_take isl_union_map *schedule_map);
11019         __isl_give isl_union_access_info *
11020         isl_union_access_info_copy(
11021                 __isl_keep isl_union_access_info *access);
11022         __isl_null isl_union_access_info *
11023         isl_union_access_info_free(
11024                 __isl_take isl_union_access_info *access);
11026 The may sources set by C<isl_union_access_info_set_may_source>
11027 do not need to include the must sources set by
11028 C<isl_union_access_info_set_must_source> as a subset.
11029 The kills set by C<isl_union_access_info_set_kill> may overlap
11030 with the may-sources and/or must-sources.
11031 The user is free not to call one (or more) of these functions,
11032 in which case the corresponding set is kept to its empty default.
11033 Similarly, the default schedule initialized by
11034 C<isl_union_access_info_from_sink> is empty.
11035 The current schedule is determined by the last call to either
11036 C<isl_union_access_info_set_schedule> or
11037 C<isl_union_access_info_set_schedule_map>.
11038 The domain of the schedule corresponds to the domains of
11039 the access relations.  In particular, the domains of the access
11040 relations are effectively intersected with the domain of the schedule
11041 and only the resulting accesses are considered by the dependence analysis.
11043 An C<isl_union_access_info> object can be read from input
11044 using the following function.
11046         #include <isl/flow.h>
11047         __isl_give isl_union_access_info *
11048         isl_union_access_info_read_from_file(isl_ctx *ctx,
11049                 FILE *input);
11051 A representation of the information contained in an object
11052 of type C<isl_union_access_info> can be obtained using
11054         #include <isl/flow.h>
11055         __isl_give isl_printer *
11056         isl_printer_print_union_access_info(
11057                 __isl_take isl_printer *p,
11058                 __isl_keep isl_union_access_info *access);
11059         __isl_give char *isl_union_access_info_to_str(
11060                 __isl_keep isl_union_access_info *access);
11062 C<isl_union_access_info_to_str> prints the information in flow format.
11064 The output of C<isl_union_access_info_compute_flow> can be examined,
11065 copied, and freed using the following functions.
11067         #include <isl/flow.h>
11068         __isl_give isl_union_map *isl_union_flow_get_must_dependence(
11069                 __isl_keep isl_union_flow *flow);
11070         __isl_give isl_union_map *isl_union_flow_get_may_dependence(
11071                 __isl_keep isl_union_flow *flow);
11072         __isl_give isl_union_map *
11073         isl_union_flow_get_full_must_dependence(
11074                 __isl_keep isl_union_flow *flow);
11075         __isl_give isl_union_map *
11076         isl_union_flow_get_full_may_dependence(
11077                 __isl_keep isl_union_flow *flow);
11078         __isl_give isl_union_map *isl_union_flow_get_must_no_source(
11079                 __isl_keep isl_union_flow *flow);
11080         __isl_give isl_union_map *isl_union_flow_get_may_no_source(
11081                 __isl_keep isl_union_flow *flow);
11082         __isl_give isl_union_flow *isl_union_flow_copy(
11083                 __isl_keep isl_union_flow *flow);
11084         __isl_null isl_union_flow *isl_union_flow_free(
11085                 __isl_take isl_union_flow *flow);
11087 The relation returned by C<isl_union_flow_get_must_dependence>
11088 relates domain elements of must sources to domain elements of the sink.
11089 The relation returned by C<isl_union_flow_get_may_dependence>
11090 relates domain elements of must or may sources to domain elements of the sink
11091 and includes the previous relation as a subset.
11092 The relation returned by C<isl_union_flow_get_full_must_dependence>
11093 relates domain elements of must sources to pairs of domain elements of the sink
11094 and accessed data elements.
11095 The relation returned by C<isl_union_flow_get_full_may_dependence>
11096 relates domain elements of must or may sources to pairs of
11097 domain elements of the sink and accessed data elements.
11098 This relation includes the previous relation as a subset.
11099 The relation returned by C<isl_union_flow_get_must_no_source> is the subset
11100 of the sink relation for which no dependences have been found.
11101 The relation returned by C<isl_union_flow_get_may_no_source> is the subset
11102 of the sink relation for which no definite dependences have been found.
11103 That is, it contains those sink access that do not contribute to any
11104 of the elements in the relation returned
11105 by C<isl_union_flow_get_must_dependence>.
11107 A representation of the information contained in an object
11108 of type C<isl_union_flow> can be obtained using
11110         #include <isl/flow.h>
11111         __isl_give isl_printer *isl_printer_print_union_flow(
11112                 __isl_take isl_printer *p,
11113                 __isl_keep isl_union_flow *flow);
11114         __isl_give char *isl_union_flow_to_str(
11115                 __isl_keep isl_union_flow *flow);
11117 C<isl_union_flow_to_str> prints the information in flow format.
11119 =head3 Low-level Interface
11121 A lower-level interface is provided by the following functions.
11123         #include <isl/flow.h>
11125         typedef int (*isl_access_level_before)(void *first, void *second);
11127         __isl_give isl_access_info *isl_access_info_alloc(
11128                 __isl_take isl_map *sink,
11129                 void *sink_user, isl_access_level_before fn,
11130                 int max_source);
11131         __isl_give isl_access_info *isl_access_info_add_source(
11132                 __isl_take isl_access_info *acc,
11133                 __isl_take isl_map *source, int must,
11134                 void *source_user);
11135         __isl_null isl_access_info *isl_access_info_free(
11136                 __isl_take isl_access_info *acc);
11138         __isl_give isl_flow *isl_access_info_compute_flow(
11139                 __isl_take isl_access_info *acc);
11141         isl_stat isl_flow_foreach(__isl_keep isl_flow *deps,
11142                 isl_stat (*fn)(__isl_take isl_map *dep, int must,
11143                           void *dep_user, void *user),
11144                 void *user);
11145         __isl_give isl_map *isl_flow_get_no_source(
11146                 __isl_keep isl_flow *deps, int must);
11147         __isl_null isl_flow *isl_flow_free(
11148                 __isl_take isl_flow *deps);
11150 The function C<isl_access_info_compute_flow> performs the actual
11151 dependence analysis.  The other functions are used to construct
11152 the input for this function or to read off the output.
11154 The input is collected in an C<isl_access_info>, which can
11155 be created through a call to C<isl_access_info_alloc>.
11156 The arguments to this functions are the sink access relation
11157 C<sink>, a token C<sink_user> used to identify the sink
11158 access to the user, a callback function for specifying the
11159 relative order of source and sink accesses, and the number
11160 of source access relations that will be added.
11162 The callback function has type C<int (*)(void *first, void *second)>.
11163 The function is called with two user supplied tokens identifying
11164 either a source or the sink and it should return the shared nesting
11165 level and the relative order of the two accesses.
11166 In particular, let I<n> be the number of loops shared by
11167 the two accesses.  If C<first> precedes C<second> textually,
11168 then the function should return I<2 * n + 1>; otherwise,
11169 it should return I<2 * n>.
11170 The low-level interface assumes that no sources are coscheduled.
11171 If the information returned by the callback does not allow
11172 the relative order to be determined, then one of the sources
11173 is arbitrarily taken to be executed after the other(s).
11175 The sources can be added to the C<isl_access_info> object by performing
11176 (at most) C<max_source> calls to C<isl_access_info_add_source>.
11177 C<must> indicates whether the source is a I<must> access
11178 or a I<may> access.  Note that a multi-valued access relation
11179 should only be marked I<must> if every iteration in the domain
11180 of the relation accesses I<all> elements in its image.
11181 The C<source_user> token is again used to identify
11182 the source access.  The range of the source access relation
11183 C<source> should have the same dimension as the range
11184 of the sink access relation.
11185 The C<isl_access_info_free> function should usually not be
11186 called explicitly, because it is already called implicitly by
11187 C<isl_access_info_compute_flow>.
11189 The result of the dependence analysis is collected in an
11190 C<isl_flow>.  There may be elements of
11191 the sink access for which no preceding source access could be
11192 found or for which all preceding sources are I<may> accesses.
11193 The relations containing these elements can be obtained through
11194 calls to C<isl_flow_get_no_source>, the first with C<must> set
11195 and the second with C<must> unset.
11196 In the case of standard flow dependence analysis,
11197 with the sink a read and the sources I<must> writes,
11198 the first relation corresponds to the reads from uninitialized
11199 array elements and the second relation is empty.
11200 The actual flow dependences can be extracted using
11201 C<isl_flow_foreach>.  This function will call the user-specified
11202 callback function C<fn> for each B<non-empty> dependence between
11203 a source and the sink.  The callback function is called
11204 with four arguments, the actual flow dependence relation
11205 mapping source iterations to sink iterations, a boolean that
11206 indicates whether it is a I<must> or I<may> dependence, a token
11207 identifying the source and an additional C<void *> with value
11208 equal to the third argument of the C<isl_flow_foreach> call.
11209 A dependence is marked I<must> if it originates from a I<must>
11210 source and if it is not followed by any I<may> sources.
11212 After finishing with an C<isl_flow>, the user should call
11213 C<isl_flow_free> to free all associated memory.
11215 =head3 Interaction with the Low-level Interface
11217 During the dependence analysis, we frequently need to perform
11218 the following operation.  Given a relation between sink iterations
11219 and potential source iterations from a particular source domain,
11220 what is the last potential source iteration corresponding to each
11221 sink iteration.  It can sometimes be convenient to adjust
11222 the set of potential source iterations before or after each such operation.
11223 The prototypical example is fuzzy array dataflow analysis,
11224 where we need to analyze if, based on data-dependent constraints,
11225 the sink iteration can ever be executed without one or more of
11226 the corresponding potential source iterations being executed.
11227 If so, we can introduce extra parameters and select an unknown
11228 but fixed source iteration from the potential source iterations.
11229 To be able to perform such manipulations, C<isl> provides the following
11230 function.
11232         #include <isl/flow.h>
11234         typedef __isl_give isl_restriction *(*isl_access_restrict)(
11235                 __isl_keep isl_map *source_map,
11236                 __isl_keep isl_set *sink, void *source_user,
11237                 void *user);
11238         __isl_give isl_access_info *isl_access_info_set_restrict(
11239                 __isl_take isl_access_info *acc,
11240                 isl_access_restrict fn, void *user);
11242 The function C<isl_access_info_set_restrict> should be called
11243 before calling C<isl_access_info_compute_flow> and registers a callback function
11244 that will be called any time C<isl> is about to compute the last
11245 potential source.  The first argument is the (reverse) proto-dependence,
11246 mapping sink iterations to potential source iterations.
11247 The second argument represents the sink iterations for which
11248 we want to compute the last source iteration.
11249 The third argument is the token corresponding to the source
11250 and the final argument is the token passed to C<isl_access_info_set_restrict>.
11251 The callback is expected to return a restriction on either the input or
11252 the output of the operation computing the last potential source.
11253 If the input needs to be restricted then restrictions are needed
11254 for both the source and the sink iterations.  The sink iterations
11255 and the potential source iterations will be intersected with these sets.
11256 If the output needs to be restricted then only a restriction on the source
11257 iterations is required.
11258 If any error occurs, the callback should return C<NULL>.
11259 An C<isl_restriction> object can be created, freed and inspected
11260 using the following functions.
11262         #include <isl/flow.h>
11264         __isl_give isl_restriction *isl_restriction_input(
11265                 __isl_take isl_set *source_restr,
11266                 __isl_take isl_set *sink_restr);
11267         __isl_give isl_restriction *isl_restriction_output(
11268                 __isl_take isl_set *source_restr);
11269         __isl_give isl_restriction *isl_restriction_none(
11270                 __isl_take isl_map *source_map);
11271         __isl_give isl_restriction *isl_restriction_empty(
11272                 __isl_take isl_map *source_map);
11273         __isl_null isl_restriction *isl_restriction_free(
11274                 __isl_take isl_restriction *restr);
11276 C<isl_restriction_none> and C<isl_restriction_empty> are special
11277 cases of C<isl_restriction_input>.  C<isl_restriction_none>
11278 is essentially equivalent to
11280         isl_restriction_input(isl_set_universe(
11281             isl_space_range(isl_map_get_space(source_map))),
11282                             isl_set_universe(
11283             isl_space_domain(isl_map_get_space(source_map))));
11285 whereas C<isl_restriction_empty> is essentially equivalent to
11287         isl_restriction_input(isl_set_empty(
11288             isl_space_range(isl_map_get_space(source_map))),
11289                             isl_set_universe(
11290             isl_space_domain(isl_map_get_space(source_map))));
11292 =head2 Scheduling
11294         #include <isl/schedule.h>
11295         __isl_give isl_schedule *
11296         isl_schedule_constraints_compute_schedule(
11297                 __isl_take isl_schedule_constraints *sc);
11299 The function C<isl_schedule_constraints_compute_schedule> can be
11300 used to compute a schedule that satisfies the given schedule constraints.
11301 These schedule constraints include the iteration domain for which
11302 a schedule should be computed and dependences between pairs of
11303 iterations.  In particular, these dependences include
11304 I<validity> dependences and I<proximity> dependences.
11305 By default, the algorithm used to construct the schedule is similar
11306 to that of C<Pluto>.
11307 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
11308 be selected.
11309 The generated schedule respects all validity dependences.
11310 That is, all dependence distances over these dependences in the
11311 scheduled space are lexicographically positive.
11313 The default algorithm tries to ensure that the dependence distances
11314 over coincidence constraints are zero and to minimize the
11315 dependence distances over proximity dependences.
11316 Moreover, it tries to obtain sequences (bands) of schedule dimensions
11317 for groups of domains where the dependence distances over validity
11318 dependences have only non-negative values.
11319 Note that when minimizing the maximal dependence distance
11320 over proximity dependences, a single affine expression in the parameters
11321 is constructed that bounds all dependence distances.  If no such expression
11322 exists, then the algorithm will fail and resort to an alternative
11323 scheduling algorithm.  In particular, this means that adding proximity
11324 dependences may eliminate valid solutions.  A typical example where this
11325 phenomenon may occur is when some subset of the proximity dependences
11326 has no restriction on some parameter, forcing the coefficient of that
11327 parameter to be zero, while some other subset forces the dependence
11328 distance to depend on that parameter, requiring the same coefficient
11329 to be non-zero.
11330 When using Feautrier's algorithm, the coincidence and proximity constraints
11331 are only taken into account during the extension to a
11332 full-dimensional schedule.
11334 An C<isl_schedule_constraints> object can be constructed
11335 and manipulated using the following functions.
11337         #include <isl/schedule.h>
11338         __isl_give isl_schedule_constraints *
11339         isl_schedule_constraints_copy(
11340                 __isl_keep isl_schedule_constraints *sc);
11341         __isl_give isl_schedule_constraints *
11342         isl_schedule_constraints_on_domain(
11343                 __isl_take isl_union_set *domain);
11344         __isl_give isl_schedule_constraints *
11345         isl_schedule_constraints_set_context(
11346                 __isl_take isl_schedule_constraints *sc,
11347                 __isl_take isl_set *context);
11348         __isl_give isl_schedule_constraints *
11349         isl_schedule_constraints_set_validity(
11350                 __isl_take isl_schedule_constraints *sc,
11351                 __isl_take isl_union_map *validity);
11352         __isl_give isl_schedule_constraints *
11353         isl_schedule_constraints_set_coincidence(
11354                 __isl_take isl_schedule_constraints *sc,
11355                 __isl_take isl_union_map *coincidence);
11356         __isl_give isl_schedule_constraints *
11357         isl_schedule_constraints_set_proximity(
11358                 __isl_take isl_schedule_constraints *sc,
11359                 __isl_take isl_union_map *proximity);
11360         __isl_give isl_schedule_constraints *
11361         isl_schedule_constraints_set_conditional_validity(
11362                 __isl_take isl_schedule_constraints *sc,
11363                 __isl_take isl_union_map *condition,
11364                 __isl_take isl_union_map *validity);
11365         __isl_give isl_schedule_constraints *
11366         isl_schedule_constraints_apply(
11367                 __isl_take isl_schedule_constraints *sc,
11368                 __isl_take isl_union_map *umap);
11369         __isl_null isl_schedule_constraints *
11370         isl_schedule_constraints_free(
11371                 __isl_take isl_schedule_constraints *sc);
11373 The initial C<isl_schedule_constraints> object created by
11374 C<isl_schedule_constraints_on_domain> does not impose any constraints.
11375 That is, it has an empty set of dependences.
11376 The function C<isl_schedule_constraints_set_context> allows the user
11377 to specify additional constraints on the parameters that may
11378 be assumed to hold during the construction of the schedule.
11379 The function C<isl_schedule_constraints_set_validity> replaces the
11380 validity dependences, mapping domain elements I<i> to domain
11381 elements that should be scheduled after I<i>.
11382 The function C<isl_schedule_constraints_set_coincidence> replaces the
11383 coincidence dependences, mapping domain elements I<i> to domain
11384 elements that should be scheduled together with I<I>, if possible.
11385 The function C<isl_schedule_constraints_set_proximity> replaces the
11386 proximity dependences, mapping domain elements I<i> to domain
11387 elements that should be scheduled either before I<I>
11388 or as early as possible after I<i>.
11390 The function C<isl_schedule_constraints_set_conditional_validity>
11391 replaces the conditional validity constraints.
11392 A conditional validity constraint is only imposed when any of the corresponding
11393 conditions is satisfied, i.e., when any of them is non-zero.
11394 That is, the scheduler ensures that within each band if the dependence
11395 distances over the condition constraints are not all zero
11396 then all corresponding conditional validity constraints are respected.
11397 A conditional validity constraint corresponds to a condition
11398 if the two are adjacent, i.e., if the domain of one relation intersect
11399 the range of the other relation.
11400 The typical use case of conditional validity constraints is
11401 to allow order constraints between live ranges to be violated
11402 as long as the live ranges themselves are local to the band.
11403 To allow more fine-grained control over which conditions correspond
11404 to which conditional validity constraints, the domains and ranges
11405 of these relations may include I<tags>.  That is, the domains and
11406 ranges of those relation may themselves be wrapped relations
11407 where the iteration domain appears in the domain of those wrapped relations
11408 and the range of the wrapped relations can be arbitrarily chosen
11409 by the user.  Conditions and conditional validity constraints are only
11410 considered adjacent to each other if the entire wrapped relation matches.
11411 In particular, a relation with a tag will never be considered adjacent
11412 to a relation without a tag.
11414 The function C<isl_schedule_constraints_apply> takes
11415 schedule constraints that are defined on some set of domain elements
11416 and transforms them to schedule constraints on the elements
11417 to which these domain elements are mapped by the given transformation.
11419 An C<isl_schedule_constraints> object can be inspected
11420 using the following functions.
11422         #include <isl/schedule.h>
11423         __isl_give isl_union_set *
11424         isl_schedule_constraints_get_domain(
11425                 __isl_keep isl_schedule_constraints *sc);
11426         __isl_give isl_set *isl_schedule_constraints_get_context(
11427                 __isl_keep isl_schedule_constraints *sc);
11428         __isl_give isl_union_map *
11429         isl_schedule_constraints_get_validity(
11430                 __isl_keep isl_schedule_constraints *sc);
11431         __isl_give isl_union_map *
11432         isl_schedule_constraints_get_coincidence(
11433                 __isl_keep isl_schedule_constraints *sc);
11434         __isl_give isl_union_map *
11435         isl_schedule_constraints_get_proximity(
11436                 __isl_keep isl_schedule_constraints *sc);
11437         __isl_give isl_union_map *
11438         isl_schedule_constraints_get_conditional_validity(
11439                 __isl_keep isl_schedule_constraints *sc);
11440         __isl_give isl_union_map *
11441         isl_schedule_constraints_get_conditional_validity_condition(
11442                 __isl_keep isl_schedule_constraints *sc);
11444 An C<isl_schedule_constraints> object can be read from input
11445 using the following functions.
11447         #include <isl/schedule.h>
11448         __isl_give isl_schedule_constraints *
11449         isl_schedule_constraints_read_from_str(isl_ctx *ctx,
11450                 const char *str);
11451         __isl_give isl_schedule_constraints *
11452         isl_schedule_constraints_read_from_file(isl_ctx *ctx,
11453                 FILE *input);
11455 The contents of an C<isl_schedule_constraints> object can be printed
11456 using the following functions.
11458         #include <isl/schedule.h>
11459         __isl_give isl_printer *
11460         isl_printer_print_schedule_constraints(
11461                 __isl_take isl_printer *p,
11462                 __isl_keep isl_schedule_constraints *sc);
11463         __isl_give char *isl_schedule_constraints_to_str(
11464                 __isl_keep isl_schedule_constraints *sc);
11466 The following function computes a schedule directly from
11467 an iteration domain and validity and proximity dependences
11468 and is implemented in terms of the functions described above.
11469 The use of C<isl_union_set_compute_schedule> is discouraged.
11471         #include <isl/schedule.h>
11472         __isl_give isl_schedule *isl_union_set_compute_schedule(
11473                 __isl_take isl_union_set *domain,
11474                 __isl_take isl_union_map *validity,
11475                 __isl_take isl_union_map *proximity);
11477 The generated schedule represents a schedule tree.
11478 For more information on schedule trees, see
11479 L</"Schedule Trees">.
11481 =head3 Options
11483         #include <isl/schedule.h>
11484         isl_stat isl_options_set_schedule_max_coefficient(
11485                 isl_ctx *ctx, int val);
11486         int isl_options_get_schedule_max_coefficient(
11487                 isl_ctx *ctx);
11488         isl_stat isl_options_set_schedule_max_constant_term(
11489                 isl_ctx *ctx, int val);
11490         int isl_options_get_schedule_max_constant_term(
11491                 isl_ctx *ctx);
11492         isl_stat isl_options_set_schedule_serialize_sccs(
11493                 isl_ctx *ctx, int val);
11494         int isl_options_get_schedule_serialize_sccs(isl_ctx *ctx);
11495         isl_stat isl_options_set_schedule_whole_component(
11496                 isl_ctx *ctx, int val);
11497         int isl_options_get_schedule_whole_component(
11498                 isl_ctx *ctx);
11499         isl_stat isl_options_set_schedule_maximize_band_depth(
11500                 isl_ctx *ctx, int val);
11501         int isl_options_get_schedule_maximize_band_depth(
11502                 isl_ctx *ctx);
11503         isl_stat isl_options_set_schedule_maximize_coincidence(
11504                 isl_ctx *ctx, int val);
11505         int isl_options_get_schedule_maximize_coincidence(
11506                 isl_ctx *ctx);
11507         isl_stat isl_options_set_schedule_outer_coincidence(
11508                 isl_ctx *ctx, int val);
11509         int isl_options_get_schedule_outer_coincidence(
11510                 isl_ctx *ctx);
11511         isl_stat isl_options_set_schedule_split_scaled(
11512                 isl_ctx *ctx, int val);
11513         int isl_options_get_schedule_split_scaled(
11514                 isl_ctx *ctx);
11515         isl_stat isl_options_set_schedule_treat_coalescing(
11516                 isl_ctx *ctx, int val);
11517         int isl_options_get_schedule_treat_coalescing(
11518                 isl_ctx *ctx);
11519         isl_stat isl_options_set_schedule_algorithm(
11520                 isl_ctx *ctx, int val);
11521         int isl_options_get_schedule_algorithm(
11522                 isl_ctx *ctx);
11523         isl_stat isl_options_set_schedule_carry_self_first(
11524                 isl_ctx *ctx, int val);
11525         int isl_options_get_schedule_carry_self_first(
11526                 isl_ctx *ctx);
11527         isl_stat isl_options_set_schedule_separate_components(
11528                 isl_ctx *ctx, int val);
11529         int isl_options_get_schedule_separate_components(
11530                 isl_ctx *ctx);
11532 =over
11534 =item * schedule_max_coefficient
11536 This option enforces that the coefficients for variable and parameter
11537 dimensions in the calculated schedule are not larger than the specified value.
11538 This option can significantly increase the speed of the scheduling calculation
11539 and may also prevent fusing of unrelated dimensions. A value of -1 means that
11540 this option does not introduce bounds on the variable or parameter
11541 coefficients.
11542 This option has no effect on the Feautrier style scheduler.
11544 =item * schedule_max_constant_term
11546 This option enforces that the constant coefficients in the calculated schedule
11547 are not larger than the maximal constant term. This option can significantly
11548 increase the speed of the scheduling calculation and may also prevent fusing of
11549 unrelated dimensions. A value of -1 means that this option does not introduce
11550 bounds on the constant coefficients.
11552 =item * schedule_serialize_sccs
11554 If this option is set, then all strongly connected components
11555 in the dependence graph are serialized as soon as they are detected.
11556 This means in particular that instances of statements will only
11557 appear in the same band node if these statements belong
11558 to the same strongly connected component at the point where
11559 the band node is constructed.
11561 =item * schedule_whole_component
11563 If this option is set, then entire (weakly) connected
11564 components in the dependence graph are scheduled together
11565 as a whole.
11566 Otherwise, each strongly connected component within
11567 such a weakly connected component is first scheduled separately
11568 and then combined with other strongly connected components.
11569 This option has no effect if C<schedule_serialize_sccs> is set.
11571 =item * schedule_maximize_band_depth
11573 If this option is set, then the scheduler tries to maximize
11574 the width of the bands.  Wider bands give more possibilities for tiling.
11575 In particular, if the C<schedule_whole_component> option is set,
11576 then bands are split if this might result in wider bands.
11577 Otherwise, the effect of this option is to only allow
11578 strongly connected components to be combined if this does
11579 not reduce the width of the bands.
11580 Note that if the C<schedule_serialize_sccs> options is set, then
11581 the C<schedule_maximize_band_depth> option therefore has no effect.
11583 =item * schedule_maximize_coincidence
11585 This option is only effective if the C<schedule_whole_component>
11586 option is turned off.
11587 If the C<schedule_maximize_coincidence> option is set, then (clusters of)
11588 strongly connected components are only combined with each other
11589 if this does not reduce the number of coincident band members.
11591 =item * schedule_outer_coincidence
11593 If this option is set, then we try to construct schedules
11594 where the outermost scheduling dimension in each band
11595 satisfies the coincidence constraints.
11597 =item * schedule_algorithm
11599 Selects the scheduling algorithm to be used.
11600 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
11601 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
11603 =item * schedule_split_scaled
11605 If this option is set, then we try to construct schedules in which the
11606 constant term is split off from the linear part if the linear parts of
11607 the scheduling rows for all nodes in the graph have a common non-trivial
11608 divisor.
11609 The constant term is then dropped and the linear
11610 part is reduced.
11611 This option is only effective when the Feautrier style scheduler is
11612 being used, either as the main scheduler or as a fallback for the
11613 Pluto-like scheduler.
11615 =item * schedule_treat_coalescing
11617 If this option is set, then the scheduler will try and avoid
11618 producing schedules that perform loop coalescing.
11619 In particular, for the Pluto-like scheduler, this option places
11620 bounds on the schedule coefficients based on the sizes of the instance sets.
11621 For the Feautrier style scheduler, this option detects potentially
11622 coalescing schedules and then tries to adjust the schedule to avoid
11623 the coalescing.
11625 =item * schedule_carry_self_first
11627 If this option is set, then the Feautrier style scheduler
11628 (when used as a fallback for the Pluto-like scheduler) will
11629 first try to only carry self-dependences.
11631 =item * schedule_separate_components
11633 If this option is set then the function C<isl_schedule_get_map>
11634 will treat set nodes in the same way as sequence nodes.
11636 =back
11638 =head2 AST Generation
11640 This section describes the C<isl> functionality for generating
11641 ASTs that visit all the elements
11642 in a domain in an order specified by a schedule tree or
11643 a schedule map.
11644 In case the schedule given as a C<isl_union_map>, an AST is generated
11645 that visits all the elements in the domain of the C<isl_union_map>
11646 according to the lexicographic order of the corresponding image
11647 element(s).  If the range of the C<isl_union_map> consists of
11648 elements in more than one space, then each of these spaces is handled
11649 separately in an arbitrary order.
11650 It should be noted that the schedule tree or the image elements
11651 in a schedule map only specify the I<order>
11652 in which the corresponding domain elements should be visited.
11653 No direct relation between the partial schedule values
11654 or the image elements on the one hand and the loop iterators
11655 in the generated AST on the other hand should be assumed.
11657 Each AST is generated within a build.  The initial build
11658 simply specifies the constraints on the parameters (if any)
11659 and can be created, inspected, copied and freed using the following functions.
11661         #include <isl/ast_build.h>
11662         __isl_give isl_ast_build *isl_ast_build_alloc(
11663                 isl_ctx *ctx);
11664         __isl_give isl_ast_build *isl_ast_build_from_context(
11665                 __isl_take isl_set *set);
11666         __isl_give isl_ast_build *isl_ast_build_copy(
11667                 __isl_keep isl_ast_build *build);
11668         __isl_null isl_ast_build *isl_ast_build_free(
11669                 __isl_take isl_ast_build *build);
11671 The C<set> argument is usually a parameter set with zero or more parameters.
11672 In fact, when creating an AST using C<isl_ast_build_node_from_schedule>,
11673 this set is required to be a parameter set.
11674 An C<isl_ast_build> created using C<isl_ast_build_alloc> does not
11675 specify any parameter constraints.
11676 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
11677 and L</"Fine-grained Control over AST Generation">.
11678 Finally, the AST itself can be constructed using one of the following
11679 functions.
11681         #include <isl/ast_build.h>
11682         __isl_give isl_ast_node *isl_ast_build_node_from_schedule(
11683                 __isl_keep isl_ast_build *build,
11684                 __isl_take isl_schedule *schedule);
11685         __isl_give isl_ast_node *
11686         isl_ast_build_node_from_schedule_map(
11687                 __isl_keep isl_ast_build *build,
11688                 __isl_take isl_union_map *schedule);
11690 =head3 Inspecting the AST
11692 The basic properties of an AST node can be obtained as follows.
11694         #include <isl/ast.h>
11695         enum isl_ast_node_type isl_ast_node_get_type(
11696                 __isl_keep isl_ast_node *node);
11698 The type of an AST node is one of
11699 C<isl_ast_node_for>,
11700 C<isl_ast_node_if>,
11701 C<isl_ast_node_block>,
11702 C<isl_ast_node_mark> or
11703 C<isl_ast_node_user>.
11704 An C<isl_ast_node_for> represents a for node.
11705 An C<isl_ast_node_if> represents an if node.
11706 An C<isl_ast_node_block> represents a compound node.
11707 An C<isl_ast_node_mark> introduces a mark in the AST.
11708 An C<isl_ast_node_user> represents an expression statement.
11709 An expression statement typically corresponds to a domain element, i.e.,
11710 one of the elements that is visited by the AST.
11712 Each type of node has its own additional properties.
11714         #include <isl/ast.h>
11715         __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
11716                 __isl_keep isl_ast_node *node);
11717         __isl_give isl_ast_expr *isl_ast_node_for_get_init(
11718                 __isl_keep isl_ast_node *node);
11719         __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
11720                 __isl_keep isl_ast_node *node);
11721         __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
11722                 __isl_keep isl_ast_node *node);
11723         __isl_give isl_ast_node *isl_ast_node_for_get_body(
11724                 __isl_keep isl_ast_node *node);
11725         isl_bool isl_ast_node_for_is_degenerate(
11726                 __isl_keep isl_ast_node *node);
11728 An C<isl_ast_for> is considered degenerate if it is known to execute
11729 exactly once.
11731         #include <isl/ast.h>
11732         __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
11733                 __isl_keep isl_ast_node *node);
11734         __isl_give isl_ast_node *isl_ast_node_if_get_then_node(
11735                 __isl_keep isl_ast_node *node);
11736         __isl_give isl_ast_node *isl_ast_node_if_get_then(
11737                 __isl_keep isl_ast_node *node);
11738         isl_bool isl_ast_node_if_has_else_node(
11739                 __isl_keep isl_ast_node *node);
11740         isl_bool isl_ast_node_if_has_else(
11741                 __isl_keep isl_ast_node *node);
11742         __isl_give isl_ast_node *isl_ast_node_if_get_else_node(
11743                 __isl_keep isl_ast_node *node);
11744         __isl_give isl_ast_node *isl_ast_node_if_get_else(
11745                 __isl_keep isl_ast_node *node);
11747 C<isl_ast_node_if_get_then>,
11748 C<isl_ast_node_if_has_else> and
11749 C<isl_ast_node_if_get_else>
11750 are alternative names for
11751 C<isl_ast_node_if_get_then_node>,
11752 C<isl_ast_node_if_has_else_node> and
11753 C<isl_ast_node_if_get_else_node>, respectively.
11755         __isl_give isl_ast_node_list *
11756         isl_ast_node_block_get_children(
11757                 __isl_keep isl_ast_node *node);
11759         __isl_give isl_id *isl_ast_node_mark_get_id(
11760                 __isl_keep isl_ast_node *node);
11761         __isl_give isl_ast_node *isl_ast_node_mark_get_node(
11762                 __isl_keep isl_ast_node *node);
11764 C<isl_ast_node_mark_get_id> returns the identifier of the mark.
11765 C<isl_ast_node_mark_get_node> returns the child node that is being marked.
11767         #include <isl/ast.h>
11768         __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
11769                 __isl_keep isl_ast_node *node);
11771 All descendants of a specific node in the AST (including the node itself)
11772 can be visited
11773 in depth-first pre-order using the following function.
11775         #include <isl/ast.h>
11776         isl_stat isl_ast_node_foreach_descendant_top_down(
11777                 __isl_keep isl_ast_node *node,
11778                 isl_bool (*fn)(__isl_keep isl_ast_node *node,
11779                         void *user), void *user);
11781 The callback function should return C<isl_bool_true> if the children
11782 of the given node should be visited and C<isl_bool_false> if they should not.
11783 It should return C<isl_bool_error> in case of failure, in which case
11784 the entire traversal is aborted.
11786 Each of the returned C<isl_ast_expr>s can in turn be inspected using
11787 the following functions.
11789         #include <isl/ast.h>
11790         enum isl_ast_expr_type isl_ast_expr_get_type(
11791                 __isl_keep isl_ast_expr *expr);
11793 The type of an AST expression is one of
11794 C<isl_ast_expr_op>,
11795 C<isl_ast_expr_id> or
11796 C<isl_ast_expr_int>.
11797 An C<isl_ast_expr_op> represents the result of an operation.
11798 An C<isl_ast_expr_id> represents an identifier.
11799 An C<isl_ast_expr_int> represents an integer value.
11801 Each type of expression has its own additional properties.
11803         #include <isl/ast.h>
11804         enum isl_ast_expr_op_type isl_ast_expr_op_get_type(
11805                 __isl_keep isl_ast_expr *expr);
11806         enum isl_ast_expr_op_type isl_ast_expr_get_op_type(
11807                 __isl_keep isl_ast_expr *expr);
11808         isl_size isl_ast_expr_op_get_n_arg(__isl_keep isl_ast_expr *expr);
11809         isl_size isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
11810         __isl_give isl_ast_expr *isl_ast_expr_op_get_arg(
11811                 __isl_keep isl_ast_expr *expr, int pos);
11812         __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
11813                 __isl_keep isl_ast_expr *expr, int pos);
11814         isl_stat isl_ast_expr_foreach_ast_expr_op_type(
11815                 __isl_keep isl_ast_expr *expr,
11816                 isl_stat (*fn)(enum isl_ast_expr_op_type type,
11817                         void *user), void *user);
11818         isl_stat isl_ast_expr_foreach_ast_op_type(
11819                 __isl_keep isl_ast_expr *expr,
11820                 isl_stat (*fn)(enum isl_ast_expr_op_type type,
11821                         void *user), void *user);
11822         isl_stat isl_ast_node_foreach_ast_expr_op_type(
11823                 __isl_keep isl_ast_node *node,
11824                 isl_stat (*fn)(enum isl_ast_expr_op_type type,
11825                         void *user), void *user);
11826         isl_stat isl_ast_node_foreach_ast_op_type(
11827                 __isl_keep isl_ast_node *node,
11828                 isl_stat (*fn)(enum isl_ast_expr_op_type type,
11829                         void *user), void *user);
11831 C<isl_ast_expr_op_get_type> returns the type of the operation
11832 performed.  C<isl_ast_expr_op_get_n_arg> returns the number of
11833 arguments.  C<isl_ast_expr_get_op_arg> returns the specified
11834 argument.
11835 C<isl_ast_expr_get_op_type> is an alternative name for
11836 C<isl_ast_expr_op_get_type>.
11837 Similarly,
11838 C<isl_ast_expr_get_op_n_arg> is an alternative name for
11839 C<isl_ast_expr_op_get_n_arg> and
11840 C<isl_ast_expr_get_op_arg> is an alternative name for
11841 C<isl_ast_expr_op_get_arg>.
11843 C<isl_ast_expr_foreach_ast_expr_op_type> calls C<fn> for each distinct
11844 C<isl_ast_expr_op_type> that appears in C<expr>.
11845 C<isl_ast_expr_foreach_ast_op_type> is an alternative name for
11846 C<isl_ast_expr_foreach_ast_expr_op_type>.
11847 C<isl_ast_node_foreach_ast_expr_op_type> does the same for each distinct
11848 C<isl_ast_expr_op_type> that appears in C<node>.
11849 C<isl_ast_node_foreach_ast_op_type> is an alternative name for
11850 C<isl_ast_node_foreach_ast_expr_op_type>.
11851 The operation type is one of the following.
11853 =over
11855 =item C<isl_ast_expr_op_and>
11857 Logical I<and> of two arguments.
11858 Both arguments can be evaluated.
11860 =item C<isl_ast_expr_op_and_then>
11862 Logical I<and> of two arguments.
11863 The second argument can only be evaluated if the first evaluates to true.
11865 =item C<isl_ast_expr_op_or>
11867 Logical I<or> of two arguments.
11868 Both arguments can be evaluated.
11870 =item C<isl_ast_expr_op_or_else>
11872 Logical I<or> of two arguments.
11873 The second argument can only be evaluated if the first evaluates to false.
11875 =item C<isl_ast_expr_op_max>
11877 Maximum of two or more arguments.
11879 =item C<isl_ast_expr_op_min>
11881 Minimum of two or more arguments.
11883 =item C<isl_ast_expr_op_minus>
11885 Change sign.
11887 =item C<isl_ast_expr_op_add>
11889 Sum of two arguments.
11891 =item C<isl_ast_expr_op_sub>
11893 Difference of two arguments.
11895 =item C<isl_ast_expr_op_mul>
11897 Product of two arguments.
11899 =item C<isl_ast_expr_op_div>
11901 Exact division.  That is, the result is known to be an integer.
11903 =item C<isl_ast_expr_op_fdiv_q>
11905 Result of integer division, rounded towards negative
11906 infinity.
11907 The divisor is known to be positive.
11909 =item C<isl_ast_expr_op_pdiv_q>
11911 Result of integer division, where dividend is known to be non-negative.
11912 The divisor is known to be positive.
11914 =item C<isl_ast_expr_op_pdiv_r>
11916 Remainder of integer division, where dividend is known to be non-negative.
11917 The divisor is known to be positive.
11919 =item C<isl_ast_expr_op_zdiv_r>
11921 Equal to zero iff the remainder on integer division is zero.
11922 The divisor is known to be positive.
11924 =item C<isl_ast_expr_op_cond>
11926 Conditional operator defined on three arguments.
11927 If the first argument evaluates to true, then the result
11928 is equal to the second argument.  Otherwise, the result
11929 is equal to the third argument.
11930 The second and third argument may only be evaluated if
11931 the first argument evaluates to true and false, respectively.
11932 Corresponds to C<a ? b : c> in C.
11934 =item C<isl_ast_expr_op_select>
11936 Conditional operator defined on three arguments.
11937 If the first argument evaluates to true, then the result
11938 is equal to the second argument.  Otherwise, the result
11939 is equal to the third argument.
11940 The second and third argument may be evaluated independently
11941 of the value of the first argument.
11942 Corresponds to C<a * b + (1 - a) * c> in C.
11944 =item C<isl_ast_expr_op_eq>
11946 Equality relation.
11948 =item C<isl_ast_expr_op_le>
11950 Less than or equal relation.
11952 =item C<isl_ast_expr_op_lt>
11954 Less than relation.
11956 =item C<isl_ast_expr_op_ge>
11958 Greater than or equal relation.
11960 =item C<isl_ast_expr_op_gt>
11962 Greater than relation.
11964 =item C<isl_ast_expr_op_call>
11966 A function call.
11967 The number of arguments of the C<isl_ast_expr> is one more than
11968 the number of arguments in the function call, the first argument
11969 representing the function being called.
11971 =item C<isl_ast_expr_op_access>
11973 An array access.
11974 The number of arguments of the C<isl_ast_expr> is one more than
11975 the number of index expressions in the array access, the first argument
11976 representing the array being accessed.
11978 =item C<isl_ast_expr_op_member>
11980 A member access.
11981 This operation has two arguments, a structure and the name of
11982 the member of the structure being accessed.
11984 =item C<isl_ast_expr_op_address_of>
11986 The address of its single argument, which is always an array access.
11988 =back
11990         #include <isl/ast.h>
11991         __isl_give isl_id *isl_ast_expr_id_get_id(
11992                 __isl_keep isl_ast_expr *expr);
11993         __isl_give isl_id *isl_ast_expr_get_id(
11994                 __isl_keep isl_ast_expr *expr);
11996 Return the identifier represented by the AST expression.
11997 C<isl_ast_expr_get_id> is an alternative name for
11998 C<isl_ast_expr_id_get_id>.
12000         #include <isl/ast.h>
12001         __isl_give isl_val *isl_ast_expr_int_get_val(
12002                 __isl_keep isl_ast_expr *expr);
12003         __isl_give isl_val *isl_ast_expr_get_val(
12004                 __isl_keep isl_ast_expr *expr);
12006 Return the integer represented by the AST expression.
12007 C<isl_ast_expr_get_val> is an alternative name for
12008 C<isl_ast_expr_int_get_val>.
12010 =head3 Properties of ASTs
12012         #include <isl/ast.h>
12013         isl_bool isl_ast_expr_is_equal(
12014                 __isl_keep isl_ast_expr *expr1,
12015                 __isl_keep isl_ast_expr *expr2);
12017 Check if two C<isl_ast_expr>s are equal to each other.
12019 =head3 Manipulating and printing the AST
12021 AST nodes can be copied and freed using the following functions.
12023         #include <isl/ast.h>
12024         __isl_give isl_ast_node *isl_ast_node_copy(
12025                 __isl_keep isl_ast_node *node);
12026         __isl_null isl_ast_node *isl_ast_node_free(
12027                 __isl_take isl_ast_node *node);
12029 AST expressions can be copied and freed using the following functions.
12031         #include <isl/ast.h>
12032         __isl_give isl_ast_expr *isl_ast_expr_copy(
12033                 __isl_keep isl_ast_expr *expr);
12034         __isl_null isl_ast_expr *isl_ast_expr_free(
12035                 __isl_take isl_ast_expr *expr);
12037 New AST expressions can be created either directly or within
12038 the context of an C<isl_ast_build>.
12040         #include <isl/ast.h>
12041         __isl_give isl_ast_expr *isl_ast_expr_from_val(
12042                 __isl_take isl_val *v);
12043         __isl_give isl_ast_expr *isl_ast_expr_from_id(
12044                 __isl_take isl_id *id);
12045         __isl_give isl_ast_expr *isl_ast_expr_neg(
12046                 __isl_take isl_ast_expr *expr);
12047         __isl_give isl_ast_expr *isl_ast_expr_address_of(
12048                 __isl_take isl_ast_expr *expr);
12049         __isl_give isl_ast_expr *isl_ast_expr_add(
12050                 __isl_take isl_ast_expr *expr1,
12051                 __isl_take isl_ast_expr *expr2);
12052         __isl_give isl_ast_expr *isl_ast_expr_sub(
12053                 __isl_take isl_ast_expr *expr1,
12054                 __isl_take isl_ast_expr *expr2);
12055         __isl_give isl_ast_expr *isl_ast_expr_mul(
12056                 __isl_take isl_ast_expr *expr1,
12057                 __isl_take isl_ast_expr *expr2);
12058         __isl_give isl_ast_expr *isl_ast_expr_div(
12059                 __isl_take isl_ast_expr *expr1,
12060                 __isl_take isl_ast_expr *expr2);
12061         __isl_give isl_ast_expr *isl_ast_expr_pdiv_q(
12062                 __isl_take isl_ast_expr *expr1,
12063                 __isl_take isl_ast_expr *expr2);
12064         __isl_give isl_ast_expr *isl_ast_expr_pdiv_r(
12065                 __isl_take isl_ast_expr *expr1,
12066                 __isl_take isl_ast_expr *expr2);
12067         __isl_give isl_ast_expr *isl_ast_expr_and(
12068                 __isl_take isl_ast_expr *expr1,
12069                 __isl_take isl_ast_expr *expr2)
12070         __isl_give isl_ast_expr *isl_ast_expr_and_then(
12071                 __isl_take isl_ast_expr *expr1,
12072                 __isl_take isl_ast_expr *expr2)
12073         __isl_give isl_ast_expr *isl_ast_expr_or(
12074                 __isl_take isl_ast_expr *expr1,
12075                 __isl_take isl_ast_expr *expr2)
12076         __isl_give isl_ast_expr *isl_ast_expr_or_else(
12077                 __isl_take isl_ast_expr *expr1,
12078                 __isl_take isl_ast_expr *expr2)
12079         __isl_give isl_ast_expr *isl_ast_expr_eq(
12080                 __isl_take isl_ast_expr *expr1,
12081                 __isl_take isl_ast_expr *expr2);
12082         __isl_give isl_ast_expr *isl_ast_expr_le(
12083                 __isl_take isl_ast_expr *expr1,
12084                 __isl_take isl_ast_expr *expr2);
12085         __isl_give isl_ast_expr *isl_ast_expr_lt(
12086                 __isl_take isl_ast_expr *expr1,
12087                 __isl_take isl_ast_expr *expr2);
12088         __isl_give isl_ast_expr *isl_ast_expr_ge(
12089                 __isl_take isl_ast_expr *expr1,
12090                 __isl_take isl_ast_expr *expr2);
12091         __isl_give isl_ast_expr *isl_ast_expr_gt(
12092                 __isl_take isl_ast_expr *expr1,
12093                 __isl_take isl_ast_expr *expr2);
12094         __isl_give isl_ast_expr *isl_ast_expr_access(
12095                 __isl_take isl_ast_expr *array,
12096                 __isl_take isl_ast_expr_list *indices);
12097         __isl_give isl_ast_expr *isl_ast_expr_call(
12098                 __isl_take isl_ast_expr *function,
12099                 __isl_take isl_ast_expr_list *arguments);
12101 The function C<isl_ast_expr_address_of> can be applied to an
12102 C<isl_ast_expr> of type C<isl_ast_expr_op_access> only. It is meant
12103 to represent the address of the C<isl_ast_expr_access>.
12104 The second argument of the functions C<isl_ast_expr_pdiv_q> and
12105 C<isl_ast_expr_pdiv_r> should always evaluate to a positive number.
12106 The function
12107 C<isl_ast_expr_and_then> as well as C<isl_ast_expr_or_else> are short-circuit
12108 versions of C<isl_ast_expr_and> and C<isl_ast_expr_or>, respectively.
12110         #include <isl/ast_build.h>
12111         __isl_give isl_ast_expr *isl_ast_build_expr_from_set(
12112                 __isl_keep isl_ast_build *build,
12113                 __isl_take isl_set *set);
12114         __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
12115                 __isl_keep isl_ast_build *build,
12116                 __isl_take isl_pw_aff *pa);
12117         __isl_give isl_ast_expr *
12118         isl_ast_build_access_from_pw_multi_aff(
12119                 __isl_keep isl_ast_build *build,
12120                 __isl_take isl_pw_multi_aff *pma);
12121         __isl_give isl_ast_expr *
12122         isl_ast_build_access_from_multi_pw_aff(
12123                 __isl_keep isl_ast_build *build,
12124                 __isl_take isl_multi_pw_aff *mpa);
12125         __isl_give isl_ast_expr *
12126         isl_ast_build_call_from_pw_multi_aff(
12127                 __isl_keep isl_ast_build *build,
12128                 __isl_take isl_pw_multi_aff *pma);
12129         __isl_give isl_ast_expr *
12130         isl_ast_build_call_from_multi_pw_aff(
12131                 __isl_keep isl_ast_build *build,
12132                 __isl_take isl_multi_pw_aff *mpa);
12134 The set C<set> and
12135 the domains of C<pa>, C<mpa> and C<pma> should correspond
12136 to the schedule space of C<build>.
12137 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
12138 the function being called.
12139 If the accessed space is a nested relation, then it is taken
12140 to represent an access of the member specified by the range
12141 of this nested relation of the structure specified by the domain
12142 of the nested relation.
12144 The following functions can be used to modify an C<isl_ast_expr>.
12146         #include <isl/ast.h>
12147         __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
12148                 __isl_take isl_ast_expr *expr, int pos,
12149                 __isl_take isl_ast_expr *arg);
12151 Replace the argument of C<expr> at position C<pos> by C<arg>.
12153         #include <isl/ast.h>
12154         __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
12155                 __isl_take isl_ast_expr *expr,
12156                 __isl_take isl_id_to_ast_expr *id2expr);
12158 The function C<isl_ast_expr_substitute_ids> replaces the
12159 subexpressions of C<expr> of type C<isl_ast_expr_id>
12160 by the corresponding expression in C<id2expr>, if there is any.
12163 The following function can be used to modify the descendants
12164 of a specific node in an AST using a depth-first post-order
12165 traversal of those descendants (including the node itself).
12167         #include <isl/ast.h>
12168         __isl_give isl_ast_node *
12169         isl_ast_node_map_descendant_bottom_up(
12170                 __isl_take isl_ast_node *node,
12171                 __isl_give isl_ast_node *(*fn)(
12172                         __isl_take isl_ast_node *node,
12173                         void *user), void *user);
12175 User specified data can be attached to an C<isl_ast_node> and obtained
12176 from the same C<isl_ast_node> using the following functions.
12178         #include <isl/ast.h>
12179         __isl_give isl_ast_node *isl_ast_node_set_annotation(
12180                 __isl_take isl_ast_node *node,
12181                 __isl_take isl_id *annotation);
12182         __isl_give isl_id *isl_ast_node_get_annotation(
12183                 __isl_keep isl_ast_node *node);
12185 Basic printing can be performed using the following functions.
12187         #include <isl/ast.h>
12188         __isl_give isl_printer *isl_printer_print_ast_expr(
12189                 __isl_take isl_printer *p,
12190                 __isl_keep isl_ast_expr *expr);
12191         __isl_give isl_printer *isl_printer_print_ast_node(
12192                 __isl_take isl_printer *p,
12193                 __isl_keep isl_ast_node *node);
12194         __isl_give char *isl_ast_expr_to_str(
12195                 __isl_keep isl_ast_expr *expr);
12196         __isl_give char *isl_ast_node_to_str(
12197                 __isl_keep isl_ast_node *node);
12198         __isl_give char *isl_ast_expr_to_C_str(
12199                 __isl_keep isl_ast_expr *expr);
12200         __isl_give char *isl_ast_node_to_C_str(
12201                 __isl_keep isl_ast_node *node);
12203 The functions C<isl_ast_expr_to_C_str> and
12204 C<isl_ast_node_to_C_str> are convenience functions
12205 that return a string representation of the input in C format.
12207 More advanced printing can be performed using the following functions.
12209         #include <isl/ast.h>
12210         __isl_give isl_printer *
12211         isl_ast_expr_op_type_set_print_name(
12212                 __isl_take isl_printer *p,
12213                 enum isl_ast_expr_op_type type,
12214                 __isl_keep const char *name);
12215         __isl_give isl_printer *isl_ast_op_type_set_print_name(
12216                 __isl_take isl_printer *p,
12217                 enum isl_ast_expr_op_type type,
12218                 __isl_keep const char *name);
12219         isl_stat isl_options_set_ast_print_macro_once(
12220                 isl_ctx *ctx, int val);
12221         int isl_options_get_ast_print_macro_once(isl_ctx *ctx);
12222         __isl_give isl_printer *isl_ast_expr_op_type_print_macro(
12223                 enum isl_ast_expr_op_type type,
12224                 __isl_take isl_printer *p);
12225         __isl_give isl_printer *isl_ast_op_type_print_macro(
12226                 enum isl_ast_expr_op_type type,
12227                 __isl_take isl_printer *p);
12228         __isl_give isl_printer *isl_ast_expr_print_macros(
12229                 __isl_keep isl_ast_expr *expr,
12230                 __isl_take isl_printer *p);
12231         __isl_give isl_printer *isl_ast_node_print_macros(
12232                 __isl_keep isl_ast_node *node,
12233                 __isl_take isl_printer *p);
12234         __isl_give isl_printer *isl_ast_node_print(
12235                 __isl_keep isl_ast_node *node,
12236                 __isl_take isl_printer *p,
12237                 __isl_take isl_ast_print_options *options);
12238         __isl_give isl_printer *isl_ast_node_for_print(
12239                 __isl_keep isl_ast_node *node,
12240                 __isl_take isl_printer *p,
12241                 __isl_take isl_ast_print_options *options);
12242         __isl_give isl_printer *isl_ast_node_if_print(
12243                 __isl_keep isl_ast_node *node,
12244                 __isl_take isl_printer *p,
12245                 __isl_take isl_ast_print_options *options);
12247 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
12248 C<isl> may print out an AST that makes use of macros such
12249 as C<floord>, C<min> and C<max>.
12250 The names of these macros may be modified by a call
12251 to C<isl_ast_expr_op_type_set_print_name>.  The user-specified
12252 names are associated to the printer object.
12253 C<isl_ast_op_type_set_print_name> is an alternative name for
12254 C<isl_ast_expr_op_type_set_print_name>.
12255 C<isl_ast_expr_op_type_print_macro> prints out the macro
12256 corresponding to a specific C<isl_ast_expr_op_type>.
12257 If the print-macro-once option is set, then a given macro definition
12258 is only printed once to any given printer object.
12259 C<isl_ast_op_type_print_macro> is an alternative name for
12260 C<isl_ast_expr_op_type_print_macro>.
12261 C<isl_ast_expr_print_macros> scans the C<isl_ast_expr>
12262 for subexpressions where these macros would be used and prints
12263 out the required macro definitions.
12264 Essentially, C<isl_ast_expr_print_macros> calls
12265 C<isl_ast_expr_foreach_ast_expr_op_type> with
12266 C<isl_ast_expr_op_type_print_macro>
12267 as function argument.
12268 C<isl_ast_node_print_macros> does the same
12269 for expressions in its C<isl_ast_node> argument.
12270 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
12271 C<isl_ast_node_if_print> print an C<isl_ast_node>
12272 in C<ISL_FORMAT_C>, but allow for some extra control
12273 through an C<isl_ast_print_options> object.
12274 This object can be created using the following functions.
12276         #include <isl/ast.h>
12277         __isl_give isl_ast_print_options *
12278         isl_ast_print_options_alloc(isl_ctx *ctx);
12279         __isl_give isl_ast_print_options *
12280         isl_ast_print_options_copy(
12281                 __isl_keep isl_ast_print_options *options);
12282         __isl_null isl_ast_print_options *
12283         isl_ast_print_options_free(
12284                 __isl_take isl_ast_print_options *options);
12286         __isl_give isl_ast_print_options *
12287         isl_ast_print_options_set_print_user(
12288                 __isl_take isl_ast_print_options *options,
12289                 __isl_give isl_printer *(*print_user)(
12290                         __isl_take isl_printer *p,
12291                         __isl_take isl_ast_print_options *options,
12292                         __isl_keep isl_ast_node *node, void *user),
12293                 void *user);
12294         __isl_give isl_ast_print_options *
12295         isl_ast_print_options_set_print_for(
12296                 __isl_take isl_ast_print_options *options,
12297                 __isl_give isl_printer *(*print_for)(
12298                         __isl_take isl_printer *p,
12299                         __isl_take isl_ast_print_options *options,
12300                         __isl_keep isl_ast_node *node, void *user),
12301                 void *user);
12303 The callback set by C<isl_ast_print_options_set_print_user>
12304 is called whenever a node of type C<isl_ast_node_user> needs to
12305 be printed.
12306 The callback set by C<isl_ast_print_options_set_print_for>
12307 is called whenever a node of type C<isl_ast_node_for> needs to
12308 be printed.
12309 Note that C<isl_ast_node_for_print> will I<not> call the
12310 callback set by C<isl_ast_print_options_set_print_for> on the node
12311 on which C<isl_ast_node_for_print> is called, but only on nested
12312 nodes of type C<isl_ast_node_for>.  It is therefore safe to
12313 call C<isl_ast_node_for_print> from within the callback set by
12314 C<isl_ast_print_options_set_print_for>.
12316 The following option determines the type to be used for iterators
12317 while printing the AST.
12319         isl_stat isl_options_set_ast_iterator_type(
12320                 isl_ctx *ctx, const char *val);
12321         const char *isl_options_get_ast_iterator_type(
12322                 isl_ctx *ctx);
12324 The AST printer only prints body nodes of C<if> and C<for> nodes
12325 as blocks if these
12326 blocks cannot be safely omitted.
12327 For example, a C<for> node with one body node will not be
12328 surrounded with braces in C<ISL_FORMAT_C>.
12329 A block will always be printed by setting the following option.
12331         isl_stat isl_options_set_ast_always_print_block(isl_ctx *ctx,
12332                 int val);
12333         int isl_options_get_ast_always_print_block(isl_ctx *ctx);
12335 Explicit block nodes that appear inside the AST are always printed as blocks.
12336 If the block node appears as the outermost node,
12337 then it is only printed if the following option is set.
12339         isl_stat isl_options_set_ast_print_outermost_block(
12340                 isl_ctx *ctx, int val);
12341         int isl_options_get_ast_print_outermost_block(
12342                 isl_ctx *ctx);
12344 =head3 Options
12346         #include <isl/ast_build.h>
12347         isl_stat isl_options_set_ast_build_atomic_upper_bound(
12348                 isl_ctx *ctx, int val);
12349         int isl_options_get_ast_build_atomic_upper_bound(
12350                 isl_ctx *ctx);
12351         isl_stat isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
12352                 int val);
12353         int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
12354         isl_stat isl_options_set_ast_build_detect_min_max(
12355                 isl_ctx *ctx, int val);
12356         int isl_options_get_ast_build_detect_min_max(
12357                 isl_ctx *ctx);
12358         isl_stat isl_options_set_ast_build_exploit_nested_bounds(
12359                 isl_ctx *ctx, int val);
12360         int isl_options_get_ast_build_exploit_nested_bounds(
12361                 isl_ctx *ctx);
12362         isl_stat isl_options_set_ast_build_group_coscheduled(
12363                 isl_ctx *ctx, int val);
12364         int isl_options_get_ast_build_group_coscheduled(
12365                 isl_ctx *ctx);
12366         isl_stat isl_options_set_ast_build_separation_bounds(
12367                 isl_ctx *ctx, int val);
12368         int isl_options_get_ast_build_separation_bounds(
12369                 isl_ctx *ctx);
12370         isl_stat isl_options_set_ast_build_scale_strides(
12371                 isl_ctx *ctx, int val);
12372         int isl_options_get_ast_build_scale_strides(
12373                 isl_ctx *ctx);
12374         isl_stat isl_options_set_ast_build_allow_else(isl_ctx *ctx,
12375                 int val);
12376         int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
12377         isl_stat isl_options_set_ast_build_allow_or(isl_ctx *ctx,
12378                 int val);
12379         int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
12381 =over
12383 =item * ast_build_atomic_upper_bound
12385 Generate loop upper bounds that consist of the current loop iterator,
12386 an operator and an expression not involving the iterator.
12387 If this option is not set, then the current loop iterator may appear
12388 several times in the upper bound.
12389 For example, when this option is turned off, AST generation
12390 for the schedule
12392         [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
12394 produces
12396         for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
12397           A(c0);
12399 When the option is turned on, the following AST is generated
12401         for (int c0 = 0; c0 <= min(100, n); c0 += 1)
12402           A(c0);
12404 =item * ast_build_prefer_pdiv
12406 If this option is turned off, then the AST generation will
12407 produce ASTs that may only contain C<isl_ast_expr_op_fdiv_q>
12408 operators, but no C<isl_ast_expr_op_pdiv_q> or
12409 C<isl_ast_expr_op_pdiv_r> operators.
12410 If this option is turned on, then C<isl> will try to convert
12411 some of the C<isl_ast_expr_op_fdiv_q> operators to (expressions containing)
12412 C<isl_ast_expr_op_pdiv_q> or C<isl_ast_expr_op_pdiv_r> operators.
12414 =item * ast_build_detect_min_max
12416 If this option is turned on, then C<isl> will try and detect
12417 min or max-expressions when building AST expressions from
12418 piecewise affine expressions.
12420 =item * ast_build_exploit_nested_bounds
12422 Simplify conditions based on bounds of nested for loops.
12423 In particular, remove conditions that are implied by the fact
12424 that one or more nested loops have at least one iteration,
12425 meaning that the upper bound is at least as large as the lower bound.
12426 For example, when this option is turned off, AST generation
12427 for the schedule
12429         [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
12430                                         0 <= j <= M }
12432 produces
12434         if (M >= 0)
12435           for (int c0 = 0; c0 <= N; c0 += 1)
12436             for (int c1 = 0; c1 <= M; c1 += 1)
12437               A(c0, c1);
12439 When the option is turned on, the following AST is generated
12441         for (int c0 = 0; c0 <= N; c0 += 1)
12442           for (int c1 = 0; c1 <= M; c1 += 1)
12443             A(c0, c1);
12445 =item * ast_build_group_coscheduled
12447 If two domain elements are assigned the same schedule point, then
12448 they may be executed in any order and they may even appear in different
12449 loops.  If this options is set, then the AST generator will make
12450 sure that coscheduled domain elements do not appear in separate parts
12451 of the AST.  This is useful in case of nested AST generation
12452 if the outer AST generation is given only part of a schedule
12453 and the inner AST generation should handle the domains that are
12454 coscheduled by this initial part of the schedule together.
12455 For example if an AST is generated for a schedule
12457         { A[i] -> [0]; B[i] -> [0] }
12459 then the C<isl_ast_build_set_create_leaf> callback described
12460 below may get called twice, once for each domain.
12461 Setting this option ensures that the callback is only called once
12462 on both domains together.
12464 =item * ast_build_separation_bounds
12466 This option specifies which bounds to use during separation.
12467 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
12468 then all (possibly implicit) bounds on the current dimension will
12469 be used during separation.
12470 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
12471 then only those bounds that are explicitly available will
12472 be used during separation.
12474 =item * ast_build_scale_strides
12476 This option specifies whether the AST generator is allowed
12477 to scale down iterators of strided loops.
12479 =item * ast_build_allow_else
12481 This option specifies whether the AST generator is allowed
12482 to construct if statements with else branches.
12484 =item * ast_build_allow_or
12486 This option specifies whether the AST generator is allowed
12487 to construct if conditions with disjunctions.
12489 =back
12491 =head3 AST Generation Options (Schedule Tree)
12493 In case of AST construction from a schedule tree, the options
12494 that control how an AST is created from the individual schedule
12495 dimensions are stored in the band nodes of the tree
12496 (see L</"Schedule Trees">).
12498 In particular, a schedule dimension can be handled in four
12499 different ways, atomic, separate, unroll or the default.
12500 This loop AST generation type can be set using
12501 C<isl_schedule_node_band_member_set_ast_loop_type>.
12502 Alternatively,
12503 the first three can be selected by including a one-dimensional
12504 element with as value the position of the schedule dimension
12505 within the band and as name one of C<atomic>, C<separate>
12506 or C<unroll> in the options
12507 set by C<isl_schedule_node_band_set_ast_build_options>.
12508 Only one of these three may be specified for
12509 any given schedule dimension within a band node.
12510 If none of these is specified, then the default
12511 is used.  The meaning of the options is as follows.
12513 =over
12515 =item C<atomic>
12517 When this option is specified, the AST generator will make
12518 sure that a given domain space only appears in a single
12519 loop at the specified level.
12521 For example, for the schedule tree
12523         domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
12524         child:
12525           schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
12526           options: "{ atomic[x] }"
12528 the following AST will be generated
12530         for (int c0 = 0; c0 <= 10; c0 += 1) {
12531           if (c0 >= 1)
12532             b(c0 - 1);
12533           if (c0 <= 9)
12534             a(c0);
12535         }
12537 On the other hand, for the schedule tree
12539         domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
12540         child:
12541           schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
12542           options: "{ separate[x] }"
12544 the following AST will be generated
12546         {
12547           a(0);
12548           for (int c0 = 1; c0 <= 9; c0 += 1) {
12549             b(c0 - 1);
12550             a(c0);
12551           }
12552           b(9);
12553         }
12555 If neither C<atomic> nor C<separate> is specified, then the AST generator
12556 may produce either of these two results or some intermediate form.
12558 =item C<separate>
12560 When this option is specified, the AST generator will
12561 split the domain of the specified schedule dimension
12562 into pieces with a fixed set of statements for which
12563 instances need to be executed by the iterations in
12564 the schedule domain part.  This option tends to avoid
12565 the generation of guards inside the corresponding loops.
12566 See also the C<atomic> option.
12568 =item C<unroll>
12570 When this option is specified, the AST generator will
12571 I<completely> unroll the corresponding schedule dimension.
12572 It is the responsibility of the user to ensure that such
12573 unrolling is possible.
12574 To obtain a partial unrolling, the user should apply an additional
12575 strip-mining to the schedule and fully unroll the inner schedule
12576 dimension.
12578 =back
12580 The C<isolate> option is a bit more involved.  It allows the user
12581 to isolate a range of schedule dimension values from smaller and
12582 greater values.  Additionally, the user may specify a different
12583 atomic/separate/unroll choice for the isolated part and the remaining
12584 parts.  The typical use case of the C<isolate> option is to isolate
12585 full tiles from partial tiles.
12586 The part that needs to be isolated may depend on outer schedule dimensions.
12587 The option therefore needs to be able to reference those outer schedule
12588 dimensions.  In particular, the space of the C<isolate> option is that
12589 of a wrapped map with as domain the flat product of all outer band nodes
12590 and as range the space of the current band node.
12591 The atomic/separate/unroll choice for the isolated part is determined
12592 by an option that lives in an unnamed wrapped space with as domain
12593 a zero-dimensional C<isolate> space and as range the regular
12594 C<atomic>, C<separate> or C<unroll> space.
12595 This option may also be set directly using
12596 C<isl_schedule_node_band_member_set_isolate_ast_loop_type>.
12597 The atomic/separate/unroll choice for the remaining part is determined
12598 by the regular C<atomic>, C<separate> or C<unroll> option.
12599 Since the C<isolate> option references outer schedule dimensions,
12600 its use in a band node causes any tree containing the node
12601 to be considered anchored.
12603 As an example, consider the isolation of full tiles from partial tiles
12604 in a tiling of a triangular domain.  The original schedule is as follows.
12606         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
12607         child:
12608           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
12609                 { A[i,j] -> [floor(j/10)] }, \
12610                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
12612 The output is
12614         for (int c0 = 0; c0 <= 10; c0 += 1)
12615           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
12616             for (int c2 = 10 * c0;
12617                  c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
12618               for (int c3 = 10 * c1;
12619                    c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
12620                 A(c2, c3);
12622 Isolating the full tiles, we have the following input
12624         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
12625         child:
12626           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
12627                 { A[i,j] -> [floor(j/10)] }, \
12628                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
12629           options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
12630                 10a+9+10b+9 <= 100 }"
12632 and output
12634         {
12635           for (int c0 = 0; c0 <= 8; c0 += 1) {
12636             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
12637               for (int c2 = 10 * c0;
12638                    c2 <= 10 * c0 + 9; c2 += 1)
12639                 for (int c3 = 10 * c1;
12640                      c3 <= 10 * c1 + 9; c3 += 1)
12641                   A(c2, c3);
12642             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
12643               for (int c2 = 10 * c0;
12644                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
12645                 for (int c3 = 10 * c1;
12646                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
12647                   A(c2, c3);
12648           }
12649           for (int c0 = 9; c0 <= 10; c0 += 1)
12650             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
12651               for (int c2 = 10 * c0;
12652                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
12653                 for (int c3 = 10 * c1;
12654                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
12655                   A(c2, c3);
12656         }
12658 We may then additionally unroll the innermost loop of the isolated part
12660         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
12661         child:
12662           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
12663                 { A[i,j] -> [floor(j/10)] }, \
12664                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
12665           options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
12666                 10a+9+10b+9 <= 100; [isolate[] -> unroll[3]] }"
12668 to obtain
12670         {
12671           for (int c0 = 0; c0 <= 8; c0 += 1) {
12672             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
12673               for (int c2 = 10 * c0; c2 <= 10 * c0 + 9; c2 += 1) {
12674                 A(c2, 10 * c1);
12675                 A(c2, 10 * c1 + 1);
12676                 A(c2, 10 * c1 + 2);
12677                 A(c2, 10 * c1 + 3);
12678                 A(c2, 10 * c1 + 4);
12679                 A(c2, 10 * c1 + 5);
12680                 A(c2, 10 * c1 + 6);
12681                 A(c2, 10 * c1 + 7);
12682                 A(c2, 10 * c1 + 8);
12683                 A(c2, 10 * c1 + 9);
12684               }
12685             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
12686               for (int c2 = 10 * c0;
12687                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
12688                 for (int c3 = 10 * c1;
12689                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
12690                   A(c2, c3);
12691           }
12692           for (int c0 = 9; c0 <= 10; c0 += 1)
12693             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
12694               for (int c2 = 10 * c0;
12695                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
12696                 for (int c3 = 10 * c1;
12697                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
12698                   A(c2, c3);
12699         }
12702 =head3 AST Generation Options (Schedule Map)
12704 In case of AST construction using
12705 C<isl_ast_build_node_from_schedule_map>, the options
12706 that control how an AST is created from the individual schedule
12707 dimensions are stored in the C<isl_ast_build>.
12708 They can be set using the following function.
12710         #include <isl/ast_build.h>
12711         __isl_give isl_ast_build *
12712         isl_ast_build_set_options(
12713                 __isl_take isl_ast_build *build,
12714                 __isl_take isl_union_map *options);
12716 The options are encoded in an C<isl_union_map>.
12717 The domain of this union relation refers to the schedule domain,
12718 i.e., the range of the schedule passed
12719 to C<isl_ast_build_node_from_schedule_map>.
12720 In the case of nested AST generation (see L</"Nested AST Generation">),
12721 the domain of C<options> should refer to the extra piece of the schedule.
12722 That is, it should be equal to the range of the wrapped relation in the
12723 range of the schedule.
12724 The range of the options can consist of elements in one or more spaces,
12725 the names of which determine the effect of the option.
12726 The values of the range typically also refer to the schedule dimension
12727 to which the option applies, with value C<0> representing
12728 the outermost schedule dimension.  In case of nested AST generation
12729 (see L</"Nested AST Generation">), these values refer to the position
12730 of the schedule dimension within the innermost AST generation.
12731 The constraints on the domain elements of
12732 the option should only refer to this dimension and earlier dimensions.
12733 We consider the following spaces.
12735 =over
12737 =item C<separation_class>
12739 B<This option has been deprecated.  Use the isolate option on
12740 schedule trees instead.>
12742 This space is a wrapped relation between two one dimensional spaces.
12743 The input space represents the schedule dimension to which the option
12744 applies and the output space represents the separation class.
12745 While constructing a loop corresponding to the specified schedule
12746 dimension(s), the AST generator will try to generate separate loops
12747 for domain elements that are assigned different classes.
12748 If only some of the elements are assigned a class, then those elements
12749 that are not assigned any class will be treated as belonging to a class
12750 that is separate from the explicitly assigned classes.
12751 The typical use case for this option is to separate full tiles from
12752 partial tiles.
12753 The other options, described below, are applied after the separation
12754 into classes.
12756 As an example, consider the separation into full and partial tiles
12757 of a tiling of a triangular domain.
12758 Take, for example, the domain
12760         { A[i,j] : 0 <= i,j and i + j <= 100 }
12762 and a tiling into tiles of 10 by 10.  The input to the AST generator
12763 is then the schedule
12765         { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
12766                                                 i + j <= 100 }
12768 Without any options, the following AST is generated
12770         for (int c0 = 0; c0 <= 10; c0 += 1)
12771           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
12772             for (int c2 = 10 * c0;
12773                  c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
12774                  c2 += 1)
12775               for (int c3 = 10 * c1;
12776                    c3 <= min(10 * c1 + 9, -c2 + 100);
12777                    c3 += 1)
12778                 A(c2, c3);
12780 Separation into full and partial tiles can be obtained by assigning
12781 a class, say C<0>, to the full tiles.  The full tiles are represented by those
12782 values of the first and second schedule dimensions for which there are
12783 values of the third and fourth dimensions to cover an entire tile.
12784 That is, we need to specify the following option
12786         { [a,b,c,d] -> separation_class[[0]->[0]] :
12787                 exists b': 0 <= 10a,10b' and
12788                            10a+9+10b'+9 <= 100;
12789           [a,b,c,d] -> separation_class[[1]->[0]] :
12790                 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
12792 which simplifies to
12794         { [a, b, c, d] -> separation_class[[1] -> [0]] :
12795                 a >= 0 and b >= 0 and b <= 8 - a;
12796           [a, b, c, d] -> separation_class[[0] -> [0]] :
12797                 a >= 0 and a <= 8 }
12799 With this option, the generated AST is as follows
12801         {
12802           for (int c0 = 0; c0 <= 8; c0 += 1) {
12803             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
12804               for (int c2 = 10 * c0;
12805                    c2 <= 10 * c0 + 9; c2 += 1)
12806                 for (int c3 = 10 * c1;
12807                      c3 <= 10 * c1 + 9; c3 += 1)
12808                   A(c2, c3);
12809             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
12810               for (int c2 = 10 * c0;
12811                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
12812                    c2 += 1)
12813                 for (int c3 = 10 * c1;
12814                      c3 <= min(-c2 + 100, 10 * c1 + 9);
12815                      c3 += 1)
12816                   A(c2, c3);
12817           }
12818           for (int c0 = 9; c0 <= 10; c0 += 1)
12819             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
12820               for (int c2 = 10 * c0;
12821                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
12822                    c2 += 1)
12823                 for (int c3 = 10 * c1;
12824                      c3 <= min(10 * c1 + 9, -c2 + 100);
12825                      c3 += 1)
12826                   A(c2, c3);
12827         }
12829 =item C<separate>
12831 This is a single-dimensional space representing the schedule dimension(s)
12832 to which ``separation'' should be applied.  Separation tries to split
12833 a loop into several pieces if this can avoid the generation of guards
12834 inside the loop.
12835 See also the C<atomic> option.
12837 =item C<atomic>
12839 This is a single-dimensional space representing the schedule dimension(s)
12840 for which the domains should be considered ``atomic''.  That is, the
12841 AST generator will make sure that any given domain space will only appear
12842 in a single loop at the specified level.
12844 Consider the following schedule
12846         { a[i] -> [i] : 0 <= i < 10;
12847           b[i] -> [i+1] : 0 <= i < 10 }
12849 If the following option is specified
12851         { [i] -> separate[x] }
12853 then the following AST will be generated
12855         {
12856           a(0);
12857           for (int c0 = 1; c0 <= 9; c0 += 1) {
12858             a(c0);
12859             b(c0 - 1);
12860           }
12861           b(9);
12862         }
12864 If, on the other hand, the following option is specified
12866         { [i] -> atomic[x] }
12868 then the following AST will be generated
12870         for (int c0 = 0; c0 <= 10; c0 += 1) {
12871           if (c0 <= 9)
12872             a(c0);
12873           if (c0 >= 1)
12874             b(c0 - 1);
12875         }
12877 If neither C<atomic> nor C<separate> is specified, then the AST generator
12878 may produce either of these two results or some intermediate form.
12880 =item C<unroll>
12882 This is a single-dimensional space representing the schedule dimension(s)
12883 that should be I<completely> unrolled.
12884 To obtain a partial unrolling, the user should apply an additional
12885 strip-mining to the schedule and fully unroll the inner loop.
12887 =back
12889 =head3 Fine-grained Control over AST Generation
12891 Besides specifying the constraints on the parameters,
12892 an C<isl_ast_build> object can be used to control
12893 various aspects of the AST generation process.
12894 In case of AST construction using
12895 C<isl_ast_build_node_from_schedule_map>,
12896 the most prominent way of control is through ``options'',
12897 as explained above.
12899 Additional control is available through the following functions.
12901         #include <isl/ast_build.h>
12902         __isl_give isl_ast_build *
12903         isl_ast_build_set_iterators(
12904                 __isl_take isl_ast_build *build,
12905                 __isl_take isl_id_list *iterators);
12907 The function C<isl_ast_build_set_iterators> allows the user to
12908 specify a list of iterator C<isl_id>s to be used as iterators.
12909 If the input schedule is injective, then
12910 the number of elements in this list should be as large as the dimension
12911 of the schedule space, but no direct correspondence should be assumed
12912 between dimensions and elements.
12913 If the input schedule is not injective, then an additional number
12914 of C<isl_id>s equal to the largest dimension of the input domains
12915 may be required.
12916 If the number of provided C<isl_id>s is insufficient, then additional
12917 names are automatically generated.
12919         #include <isl/ast_build.h>
12920         __isl_give isl_ast_build *
12921         isl_ast_build_set_create_leaf(
12922                 __isl_take isl_ast_build *build,
12923                 __isl_give isl_ast_node *(*fn)(
12924                         __isl_take isl_ast_build *build,
12925                         void *user), void *user);
12928 C<isl_ast_build_set_create_leaf> function allows for the
12929 specification of a callback that should be called whenever the AST
12930 generator arrives at an element of the schedule domain.
12931 The callback should return an AST node that should be inserted
12932 at the corresponding position of the AST.  The default action (when
12933 the callback is not set) is to continue generating parts of the AST to scan
12934 all the domain elements associated to the schedule domain element
12935 and to insert user nodes, ``calling'' the domain element, for each of them.
12936 The C<build> argument contains the current state of the C<isl_ast_build>.
12937 To ease nested AST generation (see L</"Nested AST Generation">),
12938 all control information that is
12939 specific to the current AST generation such as the options and
12940 the callbacks has been removed from this C<isl_ast_build>.
12941 The callback would typically return the result of a nested
12942 AST generation or a
12943 user defined node created using the following function.
12945         #include <isl/ast.h>
12946         __isl_give isl_ast_node *isl_ast_node_user_from_expr(
12947                 __isl_take isl_ast_expr *expr);
12948         __isl_give isl_ast_node *isl_ast_node_alloc_user(
12949                 __isl_take isl_ast_expr *expr);
12951 C<isl_ast_node_alloc_user> is an alternative name for
12952 C<isl_ast_node_user_from_expr>.
12954 In some cases, a single user defined node is not enough,
12955 in which case the following function can be used
12956 to create a block node from multiple AST nodes.
12958         #include <isl/ast.h>
12959         __isl_give isl_ast_node *isl_ast_node_block_from_children(
12960                 __isl_take isl_ast_node_list *list);
12962         #include <isl/ast_build.h>
12963         __isl_give isl_ast_build *
12964         isl_ast_build_set_at_each_domain(
12965                 __isl_take isl_ast_build *build,
12966                 __isl_give isl_ast_node *(*fn)(
12967                         __isl_take isl_ast_node *node,
12968                         __isl_keep isl_ast_build *build,
12969                         void *user), void *user);
12970         __isl_give isl_ast_build *
12971         isl_ast_build_set_before_each_for(
12972                 __isl_take isl_ast_build *build,
12973                 __isl_give isl_id *(*fn)(
12974                         __isl_keep isl_ast_build *build,
12975                         void *user), void *user);
12976         __isl_give isl_ast_build *
12977         isl_ast_build_set_after_each_for(
12978                 __isl_take isl_ast_build *build,
12979                 __isl_give isl_ast_node *(*fn)(
12980                         __isl_take isl_ast_node *node,
12981                         __isl_keep isl_ast_build *build,
12982                         void *user), void *user);
12983         __isl_give isl_ast_build *
12984         isl_ast_build_set_before_each_mark(
12985                 __isl_take isl_ast_build *build,
12986                 isl_stat (*fn)(__isl_keep isl_id *mark,
12987                         __isl_keep isl_ast_build *build,
12988                         void *user), void *user);
12989         __isl_give isl_ast_build *
12990         isl_ast_build_set_after_each_mark(
12991                 __isl_take isl_ast_build *build,
12992                 __isl_give isl_ast_node *(*fn)(
12993                         __isl_take isl_ast_node *node,
12994                         __isl_keep isl_ast_build *build,
12995                         void *user), void *user);
12997 The callback set by C<isl_ast_build_set_at_each_domain> will
12998 be called for each domain AST node.
12999 The callbacks set by C<isl_ast_build_set_before_each_for>
13000 and C<isl_ast_build_set_after_each_for> will be called
13001 for each for AST node.  The first will be called in depth-first
13002 pre-order, while the second will be called in depth-first post-order.
13003 Since C<isl_ast_build_set_before_each_for> is called before the for
13004 node is actually constructed, it is only passed an C<isl_ast_build>.
13005 The returned C<isl_id> will be added as an annotation (using
13006 C<isl_ast_node_set_annotation>) to the constructed for node.
13007 In particular, if the user has also specified an C<after_each_for>
13008 callback, then the annotation can be retrieved from the node passed to
13009 that callback using C<isl_ast_node_get_annotation>.
13010 The callbacks set by C<isl_ast_build_set_before_each_mark>
13011 and C<isl_ast_build_set_after_each_mark> will be called for each
13012 mark AST node that is created, i.e., for each mark schedule node
13013 in the input schedule tree.  The first will be called in depth-first
13014 pre-order, while the second will be called in depth-first post-order.
13015 Since the callback set by C<isl_ast_build_set_before_each_mark>
13016 is called before the mark AST node is actually constructed, it is passed
13017 the identifier of the mark node.
13018 All callbacks should C<NULL> (or C<isl_stat_error>) on failure.
13019 The given C<isl_ast_build> can be used to create new
13020 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
13021 or C<isl_ast_build_call_from_pw_multi_aff>.
13023 =head3 Nested AST Generation
13025 C<isl> allows the user to create an AST within the context
13026 of another AST.  These nested ASTs are created using the
13027 same C<isl_ast_build_node_from_schedule_map> function that is used to create
13028 the outer AST.  The C<build> argument should be an C<isl_ast_build>
13029 passed to a callback set by
13030 C<isl_ast_build_set_create_leaf>.
13031 The space of the range of the C<schedule> argument should refer
13032 to this build.  In particular, the space should be a wrapped
13033 relation and the domain of this wrapped relation should be the
13034 same as that of the range of the schedule returned by
13035 C<isl_ast_build_get_schedule> below.
13036 In practice, the new schedule is typically
13037 created by calling C<isl_union_map_range_product> on the old schedule
13038 and some extra piece of the schedule.
13039 The space of the schedule domain is also available from
13040 the C<isl_ast_build>.
13042         #include <isl/ast_build.h>
13043         __isl_give isl_union_map *isl_ast_build_get_schedule(
13044                 __isl_keep isl_ast_build *build);
13045         __isl_give isl_space *isl_ast_build_get_schedule_space(
13046                 __isl_keep isl_ast_build *build);
13047         __isl_give isl_ast_build *isl_ast_build_restrict(
13048                 __isl_take isl_ast_build *build,
13049                 __isl_take isl_set *set);
13051 The C<isl_ast_build_get_schedule> function returns a (partial)
13052 schedule for the domains elements for which part of the AST still needs to
13053 be generated in the current build.
13054 In particular, the domain elements are mapped to those iterations of the loops
13055 enclosing the current point of the AST generation inside which
13056 the domain elements are executed.
13057 No direct correspondence between
13058 the input schedule and this schedule should be assumed.
13059 The space obtained from C<isl_ast_build_get_schedule_space> can be used
13060 to create a set for C<isl_ast_build_restrict> to intersect
13061 with the current build.  In particular, the set passed to
13062 C<isl_ast_build_restrict> can have additional parameters.
13063 The ids of the set dimensions in the space returned by
13064 C<isl_ast_build_get_schedule_space> correspond to the
13065 iterators of the already generated loops.
13066 The user should not rely on the ids of the output dimensions
13067 of the relations in the union relation returned by
13068 C<isl_ast_build_get_schedule> having any particular value.
13070 =head1 Applications
13072 Although C<isl> is mainly meant to be used as a library,
13073 it also contains some basic applications that use some
13074 of the functionality of C<isl>.
13075 For applications that take one or more polytopes or polyhedra
13076 as input, this input may be specified in either the L<isl format>
13077 or the L<PolyLib format>.
13079 =head2 C<isl_polyhedron_sample>
13081 C<isl_polyhedron_sample> takes a polyhedron as input and prints
13082 an integer element of the polyhedron, if there is any.
13083 The first column in the output is the denominator and is always
13084 equal to 1.  If the polyhedron contains no integer points,
13085 then a vector of length zero is printed.
13087 =head2 C<isl_pip>
13089 C<isl_pip> takes the same input as the C<example> program
13090 from the C<piplib> distribution, i.e., a set of constraints
13091 on the parameters, a line containing only -1 and finally a set
13092 of constraints on a parametric polyhedron.
13093 The coefficients of the parameters appear in the last columns
13094 (but before the final constant column).
13095 The output is the lexicographic minimum of the parametric polyhedron.
13096 As C<isl> currently does not have its own output format, the output
13097 is just a dump of the internal state.
13099 =head2 C<isl_polyhedron_minimize>
13101 C<isl_polyhedron_minimize> computes the minimum of some linear
13102 or affine objective function over the integer points in a polyhedron.
13103 If an affine objective function
13104 is given, then the constant should appear in the last column.
13106 =head2 C<isl_polytope_scan>
13108 Given a polytope, C<isl_polytope_scan> prints
13109 all integer points in the polytope.
13111 =head2 C<isl_flow>
13113 Given an C<isl_union_access_info> object as input,
13114 C<isl_flow> prints out the corresponding dependences,
13115 as computed by C<isl_union_access_info_compute_flow>.
13117 =head2 C<isl_codegen>
13119 Given either a schedule tree or a sequence consisting of
13120 a schedule map, a context set and an options relation,
13121 C<isl_codegen> prints out an AST that scans the domain elements
13122 of the schedule in the order of their image(s) taking into account
13123 the constraints in the context set.
13125 =head2 C<isl_schedule>
13127 Given an C<isl_schedule_constraints> object as input,
13128 C<isl_schedule> prints out a schedule that satisfies the given
13129 constraints.