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