add isl_local_space_set_from_params
[isl.git] / doc / user.pod
blob8e47c53d3ba49c982bc71006934a79e40af03997
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 =head1 License
275 C<isl> is released under the MIT license.
277 =over
279 Permission is hereby granted, free of charge, to any person obtaining a copy of
280 this software and associated documentation files (the "Software"), to deal in
281 the Software without restriction, including without limitation the rights to
282 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
283 of the Software, and to permit persons to whom the Software is furnished to do
284 so, subject to the following conditions:
286 The above copyright notice and this permission notice shall be included in all
287 copies or substantial portions of the Software.
289 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
290 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
291 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
292 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
293 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
294 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
295 SOFTWARE.
297 =back
299 Note that by default C<isl> requires C<GMP>, which is released
300 under the GNU Lesser General Public License (LGPL).  This means
301 that code linked against C<isl> is also linked against LGPL code.
303 When configuring with C<--with-int=imath> or C<--with-int=imath-32>, C<isl>
304 will link against C<imath>, a library for exact integer arithmetic released
305 under the MIT license.
307 =head1 Installation
309 The source of C<isl> can be obtained either as a tarball
310 or from the git repository.  Both are available from
311 L<http://isl.gforge.inria.fr/>.
312 The installation process depends on how you obtained
313 the source.
315 =head2 Installation from the git repository
317 =over
319 =item 1 Clone or update the repository
321 The first time the source is obtained, you need to clone
322 the repository.
324         git clone git://repo.or.cz/isl.git
326 To obtain updates, you need to pull in the latest changes
328         git pull
330 =item 2 Optionally get C<imath> submodule
332 To build C<isl> with C<imath>, you need to obtain the C<imath>
333 submodule by running in the git source tree of C<isl>
335        git submodule init
336        git submodule update
338 This will fetch the required version of C<imath> in a subdirectory of C<isl>.
340 =item 2 Generate C<configure>
342         ./autogen.sh
344 =back
346 After performing the above steps, continue
347 with the L<Common installation instructions>.
349 =head2 Common installation instructions
351 =over
353 =item 1 Obtain C<GMP>
355 By default, building C<isl> requires C<GMP>, including its headers files.
356 Your distribution may not provide these header files by default
357 and you may need to install a package called C<gmp-devel> or something
358 similar.  Alternatively, C<GMP> can be built from
359 source, available from L<http://gmplib.org/>.
360 C<GMP> is not needed if you build C<isl> with C<imath>.
362 =item 2 Configure
364 C<isl> uses the standard C<autoconf> C<configure> script.
365 To run it, just type
367         ./configure
369 optionally followed by some configure options.
370 A complete list of options can be obtained by running
372         ./configure --help
374 Below we discuss some of the more common options.
376 =over
378 =item C<--prefix>
380 Installation prefix for C<isl>
382 =item C<--with-int=[gmp|imath|imath-32]>
384 Select the integer library to be used by C<isl>, the default is C<gmp>.
385 With C<imath-32>, C<isl> will use 32 bit integers, but fall back to C<imath>
386 for values out of the 32 bit range. In most applications, C<isl> will run
387 fastest with the C<imath-32> option, followed by C<gmp> and C<imath>, the
388 slowest.
390 =item C<--with-gmp-prefix>
392 Installation prefix for C<GMP> (architecture-independent files).
394 =item C<--with-gmp-exec-prefix>
396 Installation prefix for C<GMP> (architecture-dependent files).
398 =back
400 =item 3 Compile
402         make
404 =item 4 Install (optional)
406         make install
408 =back
410 =head1 Integer Set Library
412 =head2 Memory Management
414 Since a high-level operation on isl objects usually involves
415 several substeps and since the user is usually not interested in
416 the intermediate results, most functions that return a new object
417 will also release all the objects passed as arguments.
418 If the user still wants to use one or more of these arguments
419 after the function call, she should pass along a copy of the
420 object rather than the object itself.
421 The user is then responsible for making sure that the original
422 object gets used somewhere else or is explicitly freed.
424 The arguments and return values of all documented functions are
425 annotated to make clear which arguments are released and which
426 arguments are preserved.  In particular, the following annotations
427 are used
429 =over
431 =item C<__isl_give>
433 C<__isl_give> means that a new object is returned.
434 The user should make sure that the returned pointer is
435 used exactly once as a value for an C<__isl_take> argument.
436 In between, it can be used as a value for as many
437 C<__isl_keep> arguments as the user likes.
438 There is one exception, and that is the case where the
439 pointer returned is C<NULL>.  Is this case, the user
440 is free to use it as an C<__isl_take> argument or not.
441 When applied to a C<char *>, the returned pointer needs to be
442 freed using C<free>.
444 =item C<__isl_null>
446 C<__isl_null> means that a C<NULL> value is returned.
448 =item C<__isl_take>
450 C<__isl_take> means that the object the argument points to
451 is taken over by the function and may no longer be used
452 by the user as an argument to any other function.
453 The pointer value must be one returned by a function
454 returning an C<__isl_give> pointer.
455 If the user passes in a C<NULL> value, then this will
456 be treated as an error in the sense that the function will
457 not perform its usual operation.  However, it will still
458 make sure that all the other C<__isl_take> arguments
459 are released.
461 =item C<__isl_keep>
463 C<__isl_keep> means that the function will only use the object
464 temporarily.  After the function has finished, the user
465 can still use it as an argument to other functions.
466 A C<NULL> value will be treated in the same way as
467 a C<NULL> value for an C<__isl_take> argument.
468 This annotation may also be used on return values of
469 type C<const char *>, in which case the returned pointer should
470 not be freed by the user and is only valid until the object
471 from which it was derived is updated or freed.
473 =back
475 =head2 Initialization
477 All manipulations of integer sets and relations occur within
478 the context of an C<isl_ctx>.
479 A given C<isl_ctx> can only be used within a single thread.
480 All arguments of a function are required to have been allocated
481 within the same context.
482 There are currently no functions available for moving an object
483 from one C<isl_ctx> to another C<isl_ctx>.  This means that
484 there is currently no way of safely moving an object from one
485 thread to another, unless the whole C<isl_ctx> is moved.
487 An C<isl_ctx> can be allocated using C<isl_ctx_alloc> and
488 freed using C<isl_ctx_free>.
489 All objects allocated within an C<isl_ctx> should be freed
490 before the C<isl_ctx> itself is freed.
492         isl_ctx *isl_ctx_alloc();
493         void isl_ctx_free(isl_ctx *ctx);
495 The user can impose a bound on the number of low-level I<operations>
496 that can be performed by an C<isl_ctx>.  This bound can be set and
497 retrieved using the following functions.  A bound of zero means that
498 no bound is imposed.  The number of operations performed can be
499 reset using C<isl_ctx_reset_operations>.  Note that the number
500 of low-level operations needed to perform a high-level computation
501 may differ significantly across different versions
502 of C<isl>, but it should be the same across different platforms
503 for the same version of C<isl>.
505 Warning: This feature is experimental.  C<isl> has good support to abort and
506 bail out during the computation, but this feature may exercise error code paths
507 that are normally not used that much. Consequently, it is not unlikely that
508 hidden bugs will be exposed.
510         void isl_ctx_set_max_operations(isl_ctx *ctx,
511                 unsigned long max_operations);
512         unsigned long isl_ctx_get_max_operations(isl_ctx *ctx);
513         void isl_ctx_reset_operations(isl_ctx *ctx);
515 In order to be able to create an object in the same context
516 as another object, most object types (described later in
517 this document) provide a function to obtain the context
518 in which the object was created.
520         #include <isl/val.h>
521         isl_ctx *isl_val_get_ctx(__isl_keep isl_val *val);
522         isl_ctx *isl_multi_val_get_ctx(
523                 __isl_keep isl_multi_val *mv);
525         #include <isl/id.h>
526         isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
528         #include <isl/local_space.h>
529         isl_ctx *isl_local_space_get_ctx(
530                 __isl_keep isl_local_space *ls);
532         #include <isl/set.h>
533         isl_ctx *isl_set_list_get_ctx(
534                 __isl_keep isl_set_list *list);
536         #include <isl/aff.h>
537         isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
538         isl_ctx *isl_multi_aff_get_ctx(
539                 __isl_keep isl_multi_aff *maff);
540         isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pa);
541         isl_ctx *isl_pw_multi_aff_get_ctx(
542                 __isl_keep isl_pw_multi_aff *pma);
543         isl_ctx *isl_multi_pw_aff_get_ctx(
544                 __isl_keep isl_multi_pw_aff *mpa);
545         isl_ctx *isl_union_pw_aff_get_ctx(
546                 __isl_keep isl_union_pw_aff *upa);
547         isl_ctx *isl_union_pw_multi_aff_get_ctx(
548                 __isl_keep isl_union_pw_multi_aff *upma);
549         isl_ctx *isl_multi_union_pw_aff_get_ctx(
550                 __isl_keep isl_multi_union_pw_aff *mupa);
552         #include <isl/id_to_ast_expr.h>
553         isl_ctx *isl_id_to_ast_expr_get_ctx(
554                 __isl_keep isl_id_to_ast_expr *id2expr);
556         #include <isl/point.h>
557         isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
559         #include <isl/vec.h>
560         isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
562         #include <isl/mat.h>
563         isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
565         #include <isl/vertices.h>
566         isl_ctx *isl_vertices_get_ctx(
567                 __isl_keep isl_vertices *vertices);
568         isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
569         isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
571         #include <isl/flow.h>
572         isl_ctx *isl_restriction_get_ctx(
573                 __isl_keep isl_restriction *restr);
574         isl_ctx *isl_union_access_info_get_ctx(
575                 __isl_keep isl_union_access_info *access);
576         isl_ctx *isl_union_flow_get_ctx(
577                 __isl_keep isl_union_flow *flow);
579         #include <isl/schedule.h>
580         isl_ctx *isl_schedule_get_ctx(
581                 __isl_keep isl_schedule *sched);
582         isl_ctx *isl_schedule_constraints_get_ctx(
583                 __isl_keep isl_schedule_constraints *sc);
585         #include <isl/schedule_node.h>
586         isl_ctx *isl_schedule_node_get_ctx(
587                 __isl_keep isl_schedule_node *node);
589         #include <isl/ast_build.h>
590         isl_ctx *isl_ast_build_get_ctx(
591                 __isl_keep isl_ast_build *build);
593         #include <isl/ast.h>
594         isl_ctx *isl_ast_expr_get_ctx(
595                 __isl_keep isl_ast_expr *expr);
596         isl_ctx *isl_ast_node_get_ctx(
597                 __isl_keep isl_ast_node *node);
599 =head2 Return Types
601 C<isl> uses two special return types for functions that either return
602 a boolean or that in principle do not return anything.
603 In particular, the C<isl_bool> type has three possible values:
604 C<isl_bool_true> (a positive integer value), indicating I<true> or I<yes>;
605 C<isl_bool_false> (the integer value zero), indicating I<false> or I<no>; and
606 C<isl_bool_error> (a negative integer value), indicating that something
607 went wrong.  The following function can be used to negate an C<isl_bool>,
608 where the negation of C<isl_bool_error> is C<isl_bool_error> again.
610         #include <isl/val.h>
611         isl_bool isl_bool_not(isl_bool b);
613 The C<isl_stat> type has two possible values:
614 C<isl_stat_ok> (the integer value zero), indicating a successful
615 operation; and
616 C<isl_stat_error> (a negative integer value), indicating that something
617 went wrong.
618 See L</"Error Handling"> for more information on
619 C<isl_bool_error> and C<isl_stat_error>.
621 =head2 Values
623 An C<isl_val> represents an integer value, a rational value
624 or one of three special values, infinity, negative infinity and NaN.
625 Some predefined values can be created using the following functions.
627         #include <isl/val.h>
628         __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
629         __isl_give isl_val *isl_val_one(isl_ctx *ctx);
630         __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
631         __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
632         __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
633         __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
635 Specific integer values can be created using the following functions.
637         #include <isl/val.h>
638         __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
639                 long i);
640         __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
641                 unsigned long u);
642         __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
643                 size_t n, size_t size, const void *chunks);
645 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
646 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
647 The least significant digit is assumed to be stored first.
649 Value objects can be copied and freed using the following functions.
651         #include <isl/val.h>
652         __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
653         __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
655 They can be inspected using the following functions.
657         #include <isl/val.h>
658         long isl_val_get_num_si(__isl_keep isl_val *v);
659         long isl_val_get_den_si(__isl_keep isl_val *v);
660         __isl_give isl_val *isl_val_get_den_val(
661                 __isl_keep isl_val *v);
662         double isl_val_get_d(__isl_keep isl_val *v);
663         size_t isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
664                 size_t size);
665         int isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
666                 size_t size, void *chunks);
668 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
669 of C<size> bytes needed to store the absolute value of the
670 numerator of C<v>.
671 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
672 which is assumed to have been preallocated by the caller.
673 The least significant digit is stored first.
674 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
675 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
676 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
678 An C<isl_val> can be modified using the following function.
680         #include <isl/val.h>
681         __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
682                 long i);
684 The following unary properties are defined on C<isl_val>s.
686         #include <isl/val.h>
687         int isl_val_sgn(__isl_keep isl_val *v);
688         isl_bool isl_val_is_zero(__isl_keep isl_val *v);
689         isl_bool isl_val_is_one(__isl_keep isl_val *v);
690         isl_bool isl_val_is_negone(__isl_keep isl_val *v);
691         isl_bool isl_val_is_nonneg(__isl_keep isl_val *v);
692         isl_bool isl_val_is_nonpos(__isl_keep isl_val *v);
693         isl_bool isl_val_is_pos(__isl_keep isl_val *v);
694         isl_bool isl_val_is_neg(__isl_keep isl_val *v);
695         isl_bool isl_val_is_int(__isl_keep isl_val *v);
696         isl_bool isl_val_is_rat(__isl_keep isl_val *v);
697         isl_bool isl_val_is_nan(__isl_keep isl_val *v);
698         isl_bool isl_val_is_infty(__isl_keep isl_val *v);
699         isl_bool isl_val_is_neginfty(__isl_keep isl_val *v);
701 Note that the sign of NaN is undefined.
703 The following binary properties are defined on pairs of C<isl_val>s.
705         #include <isl/val.h>
706         isl_bool isl_val_lt(__isl_keep isl_val *v1,
707                 __isl_keep isl_val *v2);
708         isl_bool isl_val_le(__isl_keep isl_val *v1,
709                 __isl_keep isl_val *v2);
710         isl_bool isl_val_gt(__isl_keep isl_val *v1,
711                 __isl_keep isl_val *v2);
712         isl_bool isl_val_ge(__isl_keep isl_val *v1,
713                 __isl_keep isl_val *v2);
714         isl_bool isl_val_eq(__isl_keep isl_val *v1,
715                 __isl_keep isl_val *v2);
716         isl_bool isl_val_ne(__isl_keep isl_val *v1,
717                 __isl_keep isl_val *v2);
718         isl_bool isl_val_abs_eq(__isl_keep isl_val *v1,
719                 __isl_keep isl_val *v2);
721 Comparisons to NaN always return false.
722 That is, a NaN is not considered to hold any relative position
723 with respect to any value.  In particular, a NaN
724 is neither considered to be equal to nor to be different from
725 any value (including another NaN).
726 The function C<isl_val_abs_eq> checks whether its two arguments
727 are equal in absolute value.
729 For integer C<isl_val>s we additionally have the following binary property.
731         #include <isl/val.h>
732         isl_bool isl_val_is_divisible_by(__isl_keep isl_val *v1,
733                 __isl_keep isl_val *v2);
735 An C<isl_val> can also be compared to an integer using the following
736 function.  The result is undefined for NaN.
738         #include <isl/val.h>
739         int isl_val_cmp_si(__isl_keep isl_val *v, long i);
741 The following unary operations are available on C<isl_val>s.
743         #include <isl/val.h>
744         __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
745         __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
746         __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
747         __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
748         __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
749         __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
750         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
752 The following binary operations are available on C<isl_val>s.
754         #include <isl/val.h>
755         __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
756                 __isl_take isl_val *v2);
757         __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
758                 __isl_take isl_val *v2);
759         __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
760                 __isl_take isl_val *v2);
761         __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
762                 unsigned long v2);
763         __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
764                 __isl_take isl_val *v2);
765         __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
766                 unsigned long v2);
767         __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
768                 __isl_take isl_val *v2);
769         __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
770                 unsigned long v2);
771         __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
772                 __isl_take isl_val *v2);
773         __isl_give isl_val *isl_val_div_ui(__isl_take isl_val *v1,
774                 unsigned long v2);
776 On integer values, we additionally have the following operations.
778         #include <isl/val.h>
779         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
780         __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
781                 __isl_take isl_val *v2);
782         __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
783                 __isl_take isl_val *v2);
784         __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
785                 __isl_take isl_val *v2, __isl_give isl_val **x,
786                 __isl_give isl_val **y);
788 The function C<isl_val_gcdext> returns the greatest common divisor g
789 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
790 that C<*x> * C<v1> + C<*y> * C<v2> = g.
792 =head3 GMP specific functions
794 These functions are only available if C<isl> has been compiled with C<GMP>
795 support.
797 Specific integer and rational values can be created from C<GMP> values using
798 the following functions.
800         #include <isl/val_gmp.h>
801         __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
802                 mpz_t z);
803         __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
804                 const mpz_t n, const mpz_t d);
806 The numerator and denominator of a rational value can be extracted as
807 C<GMP> values using the following functions.
809         #include <isl/val_gmp.h>
810         int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
811         int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
813 =head2 Sets and Relations
815 C<isl> uses six types of objects for representing sets and relations,
816 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
817 C<isl_union_set> and C<isl_union_map>.
818 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
819 can be described as a conjunction of affine constraints, while
820 C<isl_set> and C<isl_map> represent unions of
821 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
822 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
823 to live in the same space.  C<isl_union_set>s and C<isl_union_map>s
824 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
825 where spaces are considered different if they have a different number
826 of dimensions and/or different names (see L<"Spaces">).
827 The difference between sets and relations (maps) is that sets have
828 one set of variables, while relations have two sets of variables,
829 input variables and output variables.
831 =head2 Error Handling
833 C<isl> supports different ways to react in case a runtime error is triggered.
834 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
835 with two maps that have incompatible spaces. There are three possible ways
836 to react on error: to warn, to continue or to abort.
838 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
839 the last error in the corresponding C<isl_ctx> and the function in which the
840 error was triggered returns a value indicating that some error has
841 occurred.  In case of functions returning a pointer, this value is
842 C<NULL>.  In case of functions returning an C<isl_bool> or an
843 C<isl_stat>, this value is C<isl_bool_error> or C<isl_stat_error>.
844 An error does not corrupt internal state,
845 such that isl can continue to be used. C<isl> also provides functions to
846 read the last error and to reset the memory that stores the last error. The
847 last error is only stored for information purposes. Its presence does not
848 change the behavior of C<isl>. Hence, resetting an error is not required to
849 continue to use isl, but only to observe new errors.
851         #include <isl/ctx.h>
852         enum isl_error isl_ctx_last_error(isl_ctx *ctx);
853         void isl_ctx_reset_error(isl_ctx *ctx);
855 Another option is to continue on error. This is similar to warn on error mode,
856 except that C<isl> does not print any warning. This allows a program to
857 implement its own error reporting.
859 The last option is to directly abort the execution of the program from within
860 the isl library. This makes it obviously impossible to recover from an error,
861 but it allows to directly spot the error location. By aborting on error,
862 debuggers break at the location the error occurred and can provide a stack
863 trace. Other tools that automatically provide stack traces on abort or that do
864 not want to continue execution after an error was triggered may also prefer to
865 abort on error.
867 The on error behavior of isl can be specified by calling
868 C<isl_options_set_on_error> or by setting the command line option
869 C<--isl-on-error>. Valid arguments for the function call are
870 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
871 choices for the command line option are C<warn>, C<continue> and C<abort>.
872 It is also possible to query the current error mode.
874         #include <isl/options.h>
875         isl_stat isl_options_set_on_error(isl_ctx *ctx, int val);
876         int isl_options_get_on_error(isl_ctx *ctx);
878 =head2 Identifiers
880 Identifiers are used to identify both individual dimensions
881 and tuples of dimensions.  They consist of an optional name and an optional
882 user pointer.  The name and the user pointer cannot both be C<NULL>, however.
883 Identifiers with the same name but different pointer values
884 are considered to be distinct.
885 Similarly, identifiers with different names but the same pointer value
886 are also considered to be distinct.
887 Equal identifiers are represented using the same object.
888 Pairs of identifiers can therefore be tested for equality using the
889 C<==> operator.
890 Identifiers can be constructed, copied, freed, inspected and printed
891 using the following functions.
893         #include <isl/id.h>
894         __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
895                 __isl_keep const char *name, void *user);
896         __isl_give isl_id *isl_id_set_free_user(
897                 __isl_take isl_id *id,
898                 void (*free_user)(void *user));
899         __isl_give isl_id *isl_id_copy(isl_id *id);
900         __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
902         void *isl_id_get_user(__isl_keep isl_id *id);
903         __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
905         __isl_give isl_printer *isl_printer_print_id(
906                 __isl_take isl_printer *p, __isl_keep isl_id *id);
908 The callback set by C<isl_id_set_free_user> is called on the user
909 pointer when the last reference to the C<isl_id> is freed.
910 Note that C<isl_id_get_name> returns a pointer to some internal
911 data structure, so the result can only be used while the
912 corresponding C<isl_id> is alive.
914 =head2 Spaces
916 Whenever a new set, relation or similar object is created from scratch,
917 the space in which it lives needs to be specified using an C<isl_space>.
918 Each space involves zero or more parameters and zero, one or two
919 tuples of set or input/output dimensions.  The parameters and dimensions
920 are identified by an C<isl_dim_type> and a position.
921 The type C<isl_dim_param> refers to parameters,
922 the type C<isl_dim_set> refers to set dimensions (for spaces
923 with a single tuple of dimensions) and the types C<isl_dim_in>
924 and C<isl_dim_out> refer to input and output dimensions
925 (for spaces with two tuples of dimensions).
926 Local spaces (see L</"Local Spaces">) also contain dimensions
927 of type C<isl_dim_div>.
928 Note that parameters are only identified by their position within
929 a given object.  Across different objects, parameters are (usually)
930 identified by their names or identifiers.  Only unnamed parameters
931 are identified by their positions across objects.  The use of unnamed
932 parameters is discouraged.
934         #include <isl/space.h>
935         __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
936                 unsigned nparam, unsigned n_in, unsigned n_out);
937         __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
938                 unsigned nparam);
939         __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
940                 unsigned nparam, unsigned dim);
941         __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
942         __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
944 The space used for creating a parameter domain
945 needs to be created using C<isl_space_params_alloc>.
946 For other sets, the space
947 needs to be created using C<isl_space_set_alloc>, while
948 for a relation, the space
949 needs to be created using C<isl_space_alloc>.
951 To check whether a given space is that of a set or a map
952 or whether it is a parameter space, use these functions:
954         #include <isl/space.h>
955         isl_bool isl_space_is_params(__isl_keep isl_space *space);
956         isl_bool isl_space_is_set(__isl_keep isl_space *space);
957         isl_bool isl_space_is_map(__isl_keep isl_space *space);
959 Spaces can be compared using the following functions:
961         #include <isl/space.h>
962         isl_bool isl_space_is_equal(__isl_keep isl_space *space1,
963                 __isl_keep isl_space *space2);
964         isl_bool isl_space_has_equal_params(
965                 __isl_keep isl_space *space1,
966                 __isl_keep isl_space *space2);
967         isl_bool isl_space_has_equal_tuples(
968                 __isl_keep isl_space *space1,
969                 __isl_keep isl_space *space2);
970         isl_bool isl_space_is_domain(__isl_keep isl_space *space1,
971                 __isl_keep isl_space *space2);
972         isl_bool isl_space_is_range(__isl_keep isl_space *space1,
973                 __isl_keep isl_space *space2);
974         isl_bool isl_space_tuple_is_equal(
975                 __isl_keep isl_space *space1,
976                 enum isl_dim_type type1,
977                 __isl_keep isl_space *space2,
978                 enum isl_dim_type type2);
980 C<isl_space_is_domain> checks whether the first argument is equal
981 to the domain of the second argument.  This requires in particular that
982 the first argument is a set space and that the second argument
983 is a map space.  C<isl_space_tuple_is_equal> checks whether the given
984 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
985 spaces are the same.  That is, it checks if they have the same
986 identifier (if any), the same dimension and the same internal structure
987 (if any).
988 The function
989 C<isl_space_has_equal_params> checks whether two spaces
990 have the same parameters in the same order.
991 C<isl_space_has_equal_tuples> check whether two spaces have
992 the same tuples.  In contrast to C<isl_space_is_equal> below,
993 it does not check the
994 parameters.  This is useful because many C<isl> functions align the
995 parameters before they perform their operations, such that equivalence
996 is not necessary.
997 C<isl_space_is_equal> checks whether two spaces are identical,
998 meaning that they have the same parameters and the same tuples.
999 That is, it checks whether both C<isl_space_has_equal_params> and
1000 C<isl_space_has_equal_tuples> hold.
1002 It is often useful to create objects that live in the
1003 same space as some other object.  This can be accomplished
1004 by creating the new objects
1005 (see L</"Creating New Sets and Relations"> or
1006 L</"Functions">) based on the space
1007 of the original object.
1009         #include <isl/set.h>
1010         __isl_give isl_space *isl_basic_set_get_space(
1011                 __isl_keep isl_basic_set *bset);
1012         __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
1014         #include <isl/union_set.h>
1015         __isl_give isl_space *isl_union_set_get_space(
1016                 __isl_keep isl_union_set *uset);
1018         #include <isl/map.h>
1019         __isl_give isl_space *isl_basic_map_get_space(
1020                 __isl_keep isl_basic_map *bmap);
1021         __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
1023         #include <isl/union_map.h>
1024         __isl_give isl_space *isl_union_map_get_space(
1025                 __isl_keep isl_union_map *umap);
1027         #include <isl/constraint.h>
1028         __isl_give isl_space *isl_constraint_get_space(
1029                 __isl_keep isl_constraint *constraint);
1031         #include <isl/polynomial.h>
1032         __isl_give isl_space *isl_qpolynomial_get_domain_space(
1033                 __isl_keep isl_qpolynomial *qp);
1034         __isl_give isl_space *isl_qpolynomial_get_space(
1035                 __isl_keep isl_qpolynomial *qp);
1036         __isl_give isl_space *
1037         isl_qpolynomial_fold_get_domain_space(
1038                 __isl_keep isl_qpolynomial_fold *fold);
1039         __isl_give isl_space *isl_qpolynomial_fold_get_space(
1040                 __isl_keep isl_qpolynomial_fold *fold);
1041         __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
1042                 __isl_keep isl_pw_qpolynomial *pwqp);
1043         __isl_give isl_space *isl_pw_qpolynomial_get_space(
1044                 __isl_keep isl_pw_qpolynomial *pwqp);
1045         __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
1046                 __isl_keep isl_pw_qpolynomial_fold *pwf);
1047         __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
1048                 __isl_keep isl_pw_qpolynomial_fold *pwf);
1049         __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
1050                 __isl_keep isl_union_pw_qpolynomial *upwqp);
1051         __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
1052                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
1054         #include <isl/val.h>
1055         __isl_give isl_space *isl_multi_val_get_space(
1056                 __isl_keep isl_multi_val *mv);
1058         #include <isl/aff.h>
1059         __isl_give isl_space *isl_aff_get_domain_space(
1060                 __isl_keep isl_aff *aff);
1061         __isl_give isl_space *isl_aff_get_space(
1062                 __isl_keep isl_aff *aff);
1063         __isl_give isl_space *isl_pw_aff_get_domain_space(
1064                 __isl_keep isl_pw_aff *pwaff);
1065         __isl_give isl_space *isl_pw_aff_get_space(
1066                 __isl_keep isl_pw_aff *pwaff);
1067         __isl_give isl_space *isl_multi_aff_get_domain_space(
1068                 __isl_keep isl_multi_aff *maff);
1069         __isl_give isl_space *isl_multi_aff_get_space(
1070                 __isl_keep isl_multi_aff *maff);
1071         __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
1072                 __isl_keep isl_pw_multi_aff *pma);
1073         __isl_give isl_space *isl_pw_multi_aff_get_space(
1074                 __isl_keep isl_pw_multi_aff *pma);
1075         __isl_give isl_space *isl_union_pw_aff_get_space(
1076                 __isl_keep isl_union_pw_aff *upa);
1077         __isl_give isl_space *isl_union_pw_multi_aff_get_space(
1078                 __isl_keep isl_union_pw_multi_aff *upma);
1079         __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
1080                 __isl_keep isl_multi_pw_aff *mpa);
1081         __isl_give isl_space *isl_multi_pw_aff_get_space(
1082                 __isl_keep isl_multi_pw_aff *mpa);
1083         __isl_give isl_space *
1084         isl_multi_union_pw_aff_get_domain_space(
1085                 __isl_keep isl_multi_union_pw_aff *mupa);
1086         __isl_give isl_space *
1087         isl_multi_union_pw_aff_get_space(
1088                 __isl_keep isl_multi_union_pw_aff *mupa);
1090         #include <isl/point.h>
1091         __isl_give isl_space *isl_point_get_space(
1092                 __isl_keep isl_point *pnt);
1094 The number of dimensions of a given type of space
1095 may be read off from a space or an object that lives
1096 in a space using the following functions.
1097 In case of C<isl_space_dim>, type may be
1098 C<isl_dim_param>, C<isl_dim_in> (only for relations),
1099 C<isl_dim_out> (only for relations), C<isl_dim_set>
1100 (only for sets) or C<isl_dim_all>.
1102         #include <isl/space.h>
1103         unsigned isl_space_dim(__isl_keep isl_space *space,
1104                 enum isl_dim_type type);
1106         #include <isl/local_space.h>
1107         int isl_local_space_dim(__isl_keep isl_local_space *ls,
1108                 enum isl_dim_type type);
1110         #include <isl/set.h>
1111         unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1112                 enum isl_dim_type type);
1113         unsigned isl_set_dim(__isl_keep isl_set *set,
1114                 enum isl_dim_type type);
1116         #include <isl/union_set.h>
1117         unsigned isl_union_set_dim(__isl_keep isl_union_set *uset,
1118                 enum isl_dim_type type);
1120         #include <isl/map.h>
1121         unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1122                 enum isl_dim_type type);
1123         unsigned isl_map_dim(__isl_keep isl_map *map,
1124                 enum isl_dim_type type);
1126         #include <isl/union_map.h>
1127         unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
1128                 enum isl_dim_type type);
1130         #include <isl/val.h>
1131         unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1132                 enum isl_dim_type type);
1134         #include <isl/aff.h>
1135         int isl_aff_dim(__isl_keep isl_aff *aff,
1136                 enum isl_dim_type type);
1137         unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1138                 enum isl_dim_type type);
1139         unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1140                 enum isl_dim_type type);
1141         unsigned isl_pw_multi_aff_dim(
1142                 __isl_keep isl_pw_multi_aff *pma,
1143                 enum isl_dim_type type);
1144         unsigned isl_multi_pw_aff_dim(
1145                 __isl_keep isl_multi_pw_aff *mpa,
1146                 enum isl_dim_type type);
1147         unsigned isl_union_pw_aff_dim(
1148                 __isl_keep isl_union_pw_aff *upa,
1149                 enum isl_dim_type type);
1150         unsigned isl_union_pw_multi_aff_dim(
1151                 __isl_keep isl_union_pw_multi_aff *upma,
1152                 enum isl_dim_type type);
1153         unsigned isl_multi_union_pw_aff_dim(
1154                 __isl_keep isl_multi_union_pw_aff *mupa,
1155                 enum isl_dim_type type);
1157         #include <isl/polynomial.h>
1158         unsigned isl_union_pw_qpolynomial_dim(
1159                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1160                 enum isl_dim_type type);
1161         unsigned isl_union_pw_qpolynomial_fold_dim(
1162                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1163                 enum isl_dim_type type);
1165 Note that an C<isl_union_set>, an C<isl_union_map>,
1166 an C<isl_union_pw_multi_aff>,
1167 an C<isl_union_pw_qpolynomial> and
1168 an C<isl_union_pw_qpolynomial_fold>
1169 only have parameters.
1171 The identifiers or names of the individual dimensions of spaces
1172 may be set or read off using the following functions on spaces
1173 or objects that live in spaces.
1174 These functions are mostly useful to obtain the identifiers, positions
1175 or names of the parameters.  Identifiers of individual dimensions are
1176 essentially only useful for printing.  They are ignored by all other
1177 operations and may not be preserved across those operations.
1179         #include <isl/space.h>
1180         __isl_give isl_space *isl_space_set_dim_id(
1181                 __isl_take isl_space *space,
1182                 enum isl_dim_type type, unsigned pos,
1183                 __isl_take isl_id *id);
1184         isl_bool isl_space_has_dim_id(__isl_keep isl_space *space,
1185                 enum isl_dim_type type, unsigned pos);
1186         __isl_give isl_id *isl_space_get_dim_id(
1187                 __isl_keep isl_space *space,
1188                 enum isl_dim_type type, unsigned pos);
1189         __isl_give isl_space *isl_space_set_dim_name(
1190                 __isl_take isl_space *space,
1191                  enum isl_dim_type type, unsigned pos,
1192                  __isl_keep const char *name);
1193         isl_bool isl_space_has_dim_name(__isl_keep isl_space *space,
1194                 enum isl_dim_type type, unsigned pos);
1195         __isl_keep const char *isl_space_get_dim_name(
1196                 __isl_keep isl_space *space,
1197                 enum isl_dim_type type, unsigned pos);
1199         #include <isl/local_space.h>
1200         __isl_give isl_local_space *isl_local_space_set_dim_id(
1201                 __isl_take isl_local_space *ls,
1202                 enum isl_dim_type type, unsigned pos,
1203                 __isl_take isl_id *id);
1204         isl_bool isl_local_space_has_dim_id(
1205                 __isl_keep isl_local_space *ls,
1206                 enum isl_dim_type type, unsigned pos);
1207         __isl_give isl_id *isl_local_space_get_dim_id(
1208                 __isl_keep isl_local_space *ls,
1209                 enum isl_dim_type type, unsigned pos);
1210         __isl_give isl_local_space *isl_local_space_set_dim_name(
1211                 __isl_take isl_local_space *ls,
1212                 enum isl_dim_type type, unsigned pos, const char *s);
1213         isl_bool isl_local_space_has_dim_name(
1214                 __isl_keep isl_local_space *ls,
1215                 enum isl_dim_type type, unsigned pos)
1216         const char *isl_local_space_get_dim_name(
1217                 __isl_keep isl_local_space *ls,
1218                 enum isl_dim_type type, unsigned pos);
1220         #include <isl/constraint.h>
1221         const char *isl_constraint_get_dim_name(
1222                 __isl_keep isl_constraint *constraint,
1223                 enum isl_dim_type type, unsigned pos);
1225         #include <isl/set.h>
1226         __isl_give isl_id *isl_basic_set_get_dim_id(
1227                 __isl_keep isl_basic_set *bset,
1228                 enum isl_dim_type type, unsigned pos);
1229         __isl_give isl_set *isl_set_set_dim_id(
1230                 __isl_take isl_set *set, enum isl_dim_type type,
1231                 unsigned pos, __isl_take isl_id *id);
1232         isl_bool isl_set_has_dim_id(__isl_keep isl_set *set,
1233                 enum isl_dim_type type, unsigned pos);
1234         __isl_give isl_id *isl_set_get_dim_id(
1235                 __isl_keep isl_set *set, enum isl_dim_type type,
1236                 unsigned pos);
1237         const char *isl_basic_set_get_dim_name(
1238                 __isl_keep isl_basic_set *bset,
1239                 enum isl_dim_type type, unsigned pos);
1240         isl_bool isl_set_has_dim_name(__isl_keep isl_set *set,
1241                 enum isl_dim_type type, unsigned pos);
1242         const char *isl_set_get_dim_name(
1243                 __isl_keep isl_set *set,
1244                 enum isl_dim_type type, unsigned pos);
1246         #include <isl/map.h>
1247         __isl_give isl_map *isl_map_set_dim_id(
1248                 __isl_take isl_map *map, enum isl_dim_type type,
1249                 unsigned pos, __isl_take isl_id *id);
1250         isl_bool isl_basic_map_has_dim_id(
1251                 __isl_keep isl_basic_map *bmap,
1252                 enum isl_dim_type type, unsigned pos);
1253         isl_bool isl_map_has_dim_id(__isl_keep isl_map *map,
1254                 enum isl_dim_type type, unsigned pos);
1255         __isl_give isl_id *isl_map_get_dim_id(
1256                 __isl_keep isl_map *map, enum isl_dim_type type,
1257                 unsigned pos);
1258         __isl_give isl_id *isl_union_map_get_dim_id(
1259                 __isl_keep isl_union_map *umap,
1260                 enum isl_dim_type type, unsigned pos);
1261         const char *isl_basic_map_get_dim_name(
1262                 __isl_keep isl_basic_map *bmap,
1263                 enum isl_dim_type type, unsigned pos);
1264         isl_bool isl_map_has_dim_name(__isl_keep isl_map *map,
1265                 enum isl_dim_type type, unsigned pos);
1266         const char *isl_map_get_dim_name(
1267                 __isl_keep isl_map *map,
1268                 enum isl_dim_type type, unsigned pos);
1270         #include <isl/val.h>
1271         __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1272                 __isl_take isl_multi_val *mv,
1273                 enum isl_dim_type type, unsigned pos,
1274                 __isl_take isl_id *id);
1275         __isl_give isl_id *isl_multi_val_get_dim_id(
1276                 __isl_keep isl_multi_val *mv,
1277                 enum isl_dim_type type, unsigned pos);
1278         __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1279                 __isl_take isl_multi_val *mv,
1280                 enum isl_dim_type type, unsigned pos, const char *s);
1282         #include <isl/aff.h>
1283         __isl_give isl_aff *isl_aff_set_dim_id(
1284                 __isl_take isl_aff *aff, enum isl_dim_type type,
1285                 unsigned pos, __isl_take isl_id *id);
1286         __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1287                 __isl_take isl_multi_aff *maff,
1288                 enum isl_dim_type type, unsigned pos,
1289                 __isl_take isl_id *id);
1290         __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1291                 __isl_take isl_pw_aff *pma,
1292                 enum isl_dim_type type, unsigned pos,
1293                 __isl_take isl_id *id);
1294         __isl_give isl_multi_pw_aff *
1295         isl_multi_pw_aff_set_dim_id(
1296                 __isl_take isl_multi_pw_aff *mpa,
1297                 enum isl_dim_type type, unsigned pos,
1298                 __isl_take isl_id *id);
1299         __isl_give isl_multi_union_pw_aff *
1300         isl_multi_union_pw_aff_set_dim_id(
1301                 __isl_take isl_multi_union_pw_aff *mupa,
1302                 enum isl_dim_type type, unsigned pos,
1303                 __isl_take isl_id *id);
1304         __isl_give isl_id *isl_multi_aff_get_dim_id(
1305                 __isl_keep isl_multi_aff *ma,
1306                 enum isl_dim_type type, unsigned pos);
1307         isl_bool isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1308                 enum isl_dim_type type, unsigned pos);
1309         __isl_give isl_id *isl_pw_aff_get_dim_id(
1310                 __isl_keep isl_pw_aff *pa,
1311                 enum isl_dim_type type, unsigned pos);
1312         __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1313                 __isl_keep isl_pw_multi_aff *pma,
1314                 enum isl_dim_type type, unsigned pos);
1315         __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1316                 __isl_keep isl_multi_pw_aff *mpa,
1317                 enum isl_dim_type type, unsigned pos);
1318         __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1319                 __isl_keep isl_multi_union_pw_aff *mupa,
1320                 enum isl_dim_type type, unsigned pos);
1321         __isl_give isl_aff *isl_aff_set_dim_name(
1322                 __isl_take isl_aff *aff, enum isl_dim_type type,
1323                 unsigned pos, const char *s);
1324         __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1325                 __isl_take isl_multi_aff *maff,
1326                 enum isl_dim_type type, unsigned pos, const char *s);
1327         __isl_give isl_multi_pw_aff *
1328         isl_multi_pw_aff_set_dim_name(
1329                 __isl_take isl_multi_pw_aff *mpa,
1330                 enum isl_dim_type type, unsigned pos, const char *s);
1331         __isl_give isl_union_pw_aff *
1332         isl_union_pw_aff_set_dim_name(
1333                 __isl_take isl_union_pw_aff *upa,
1334                 enum isl_dim_type type, unsigned pos,
1335                 const char *s);
1336         __isl_give isl_union_pw_multi_aff *
1337         isl_union_pw_multi_aff_set_dim_name(
1338                 __isl_take isl_union_pw_multi_aff *upma,
1339                 enum isl_dim_type type, unsigned pos,
1340                 const char *s);
1341         __isl_give isl_multi_union_pw_aff *
1342         isl_multi_union_pw_aff_set_dim_name(
1343                 __isl_take isl_multi_union_pw_aff *mupa,
1344                 enum isl_dim_type type, unsigned pos,
1345         const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1346                 enum isl_dim_type type, unsigned pos);
1347         const char *isl_pw_aff_get_dim_name(
1348                 __isl_keep isl_pw_aff *pa,
1349                 enum isl_dim_type type, unsigned pos);
1350         const char *isl_pw_multi_aff_get_dim_name(
1351                 __isl_keep isl_pw_multi_aff *pma,
1352                 enum isl_dim_type type, unsigned pos);
1354         #include <isl/polynomial.h>
1355         __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1356                 __isl_take isl_qpolynomial *qp,
1357                 enum isl_dim_type type, unsigned pos,
1358                 const char *s);
1359         __isl_give isl_pw_qpolynomial *
1360         isl_pw_qpolynomial_set_dim_name(
1361                 __isl_take isl_pw_qpolynomial *pwqp,
1362                 enum isl_dim_type type, unsigned pos,
1363                 const char *s);
1364         __isl_give isl_pw_qpolynomial_fold *
1365         isl_pw_qpolynomial_fold_set_dim_name(
1366                 __isl_take isl_pw_qpolynomial_fold *pwf,
1367                 enum isl_dim_type type, unsigned pos,
1368                 const char *s);
1369         __isl_give isl_union_pw_qpolynomial *
1370         isl_union_pw_qpolynomial_set_dim_name(
1371                 __isl_take isl_union_pw_qpolynomial *upwqp,
1372                 enum isl_dim_type type, unsigned pos,
1373                 const char *s);
1374         __isl_give isl_union_pw_qpolynomial_fold *
1375         isl_union_pw_qpolynomial_fold_set_dim_name(
1376                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1377                 enum isl_dim_type type, unsigned pos,
1378                 const char *s);
1380 Note that C<isl_space_get_name> returns a pointer to some internal
1381 data structure, so the result can only be used while the
1382 corresponding C<isl_space> is alive.
1383 Also note that every function that operates on two sets or relations
1384 requires that both arguments have the same parameters.  This also
1385 means that if one of the arguments has named parameters, then the
1386 other needs to have named parameters too and the names need to match.
1387 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1388 arguments may have different parameters (as long as they are named),
1389 in which case the result will have as parameters the union of the parameters of
1390 the arguments.
1392 Given the identifier or name of a dimension (typically a parameter),
1393 its position can be obtained from the following functions.
1395         #include <isl/space.h>
1396         int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1397                 enum isl_dim_type type, __isl_keep isl_id *id);
1398         int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1399                 enum isl_dim_type type, const char *name);
1401         #include <isl/local_space.h>
1402         int isl_local_space_find_dim_by_name(
1403                 __isl_keep isl_local_space *ls,
1404                 enum isl_dim_type type, const char *name);
1406         #include <isl/val.h>
1407         int isl_multi_val_find_dim_by_id(
1408                 __isl_keep isl_multi_val *mv,
1409                 enum isl_dim_type type, __isl_keep isl_id *id);
1410         int isl_multi_val_find_dim_by_name(
1411                 __isl_keep isl_multi_val *mv,
1412                 enum isl_dim_type type, const char *name);
1414         #include <isl/set.h>
1415         int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1416                 enum isl_dim_type type, __isl_keep isl_id *id);
1417         int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1418                 enum isl_dim_type type, const char *name);
1420         #include <isl/map.h>
1421         int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1422                 enum isl_dim_type type, __isl_keep isl_id *id);
1423         int isl_basic_map_find_dim_by_name(
1424                 __isl_keep isl_basic_map *bmap,
1425                 enum isl_dim_type type, const char *name);
1426         int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1427                 enum isl_dim_type type, const char *name);
1428         int isl_union_map_find_dim_by_name(
1429                 __isl_keep isl_union_map *umap,
1430                 enum isl_dim_type type, const char *name);
1432         #include <isl/aff.h>
1433         int isl_multi_aff_find_dim_by_id(
1434                 __isl_keep isl_multi_aff *ma,
1435                 enum isl_dim_type type, __isl_keep isl_id *id);
1436         int isl_multi_pw_aff_find_dim_by_id(
1437                 __isl_keep isl_multi_pw_aff *mpa,
1438                 enum isl_dim_type type, __isl_keep isl_id *id);
1439         int isl_multi_union_pw_aff_find_dim_by_id(
1440                 __isl_keep isl_union_multi_pw_aff *mupa,
1441                 enum isl_dim_type type, __isl_keep isl_id *id);
1442         int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1443                 enum isl_dim_type type, const char *name);
1444         int isl_multi_aff_find_dim_by_name(
1445                 __isl_keep isl_multi_aff *ma,
1446                 enum isl_dim_type type, const char *name);
1447         int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1448                 enum isl_dim_type type, const char *name);
1449         int isl_multi_pw_aff_find_dim_by_name(
1450                 __isl_keep isl_multi_pw_aff *mpa,
1451                 enum isl_dim_type type, const char *name);
1452         int isl_pw_multi_aff_find_dim_by_name(
1453                 __isl_keep isl_pw_multi_aff *pma,
1454                 enum isl_dim_type type, const char *name);
1455         int isl_union_pw_aff_find_dim_by_name(
1456                 __isl_keep isl_union_pw_aff *upa,
1457                 enum isl_dim_type type, const char *name);
1458         int isl_union_pw_multi_aff_find_dim_by_name(
1459                 __isl_keep isl_union_pw_multi_aff *upma,
1460                 enum isl_dim_type type, const char *name);
1461         int isl_multi_union_pw_aff_find_dim_by_name(
1462                 __isl_keep isl_multi_union_pw_aff *mupa,
1463                 enum isl_dim_type type, const char *name);
1465         #include <isl/polynomial.h>
1466         int isl_pw_qpolynomial_find_dim_by_name(
1467                 __isl_keep isl_pw_qpolynomial *pwqp,
1468                 enum isl_dim_type type, const char *name);
1469         int isl_pw_qpolynomial_fold_find_dim_by_name(
1470                 __isl_keep isl_pw_qpolynomial_fold *pwf,
1471                 enum isl_dim_type type, const char *name);
1472         int isl_union_pw_qpolynomial_find_dim_by_name(
1473                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1474                 enum isl_dim_type type, const char *name);
1475         int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1476                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1477                 enum isl_dim_type type, const char *name);
1479 The identifiers or names of entire spaces may be set or read off
1480 using the following functions.
1482         #include <isl/space.h>
1483         __isl_give isl_space *isl_space_set_tuple_id(
1484                 __isl_take isl_space *space,
1485                 enum isl_dim_type type, __isl_take isl_id *id);
1486         __isl_give isl_space *isl_space_reset_tuple_id(
1487                 __isl_take isl_space *space, enum isl_dim_type type);
1488         isl_bool isl_space_has_tuple_id(
1489                 __isl_keep isl_space *space,
1490                 enum isl_dim_type type);
1491         __isl_give isl_id *isl_space_get_tuple_id(
1492                 __isl_keep isl_space *space, enum isl_dim_type type);
1493         __isl_give isl_space *isl_space_set_tuple_name(
1494                 __isl_take isl_space *space,
1495                 enum isl_dim_type type, const char *s);
1496         isl_bool isl_space_has_tuple_name(
1497                 __isl_keep isl_space *space,
1498                 enum isl_dim_type type);
1499         __isl_keep const char *isl_space_get_tuple_name(
1500                 __isl_keep isl_space *space,
1501                 enum isl_dim_type type);
1503         #include <isl/local_space.h>
1504         __isl_give isl_local_space *isl_local_space_set_tuple_id(
1505                 __isl_take isl_local_space *ls,
1506                 enum isl_dim_type type, __isl_take isl_id *id);
1508         #include <isl/set.h>
1509         __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1510                 __isl_take isl_basic_set *bset,
1511                 __isl_take isl_id *id);
1512         __isl_give isl_set *isl_set_set_tuple_id(
1513                 __isl_take isl_set *set, __isl_take isl_id *id);
1514         __isl_give isl_set *isl_set_reset_tuple_id(
1515                 __isl_take isl_set *set);
1516         isl_bool isl_set_has_tuple_id(__isl_keep isl_set *set);
1517         __isl_give isl_id *isl_set_get_tuple_id(
1518                 __isl_keep isl_set *set);
1519         __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1520                 __isl_take isl_basic_set *set, const char *s);
1521         __isl_give isl_set *isl_set_set_tuple_name(
1522                 __isl_take isl_set *set, const char *s);
1523         const char *isl_basic_set_get_tuple_name(
1524                 __isl_keep isl_basic_set *bset);
1525         isl_bool isl_set_has_tuple_name(__isl_keep isl_set *set);
1526         const char *isl_set_get_tuple_name(
1527                 __isl_keep isl_set *set);
1529         #include <isl/map.h>
1530         __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1531                 __isl_take isl_basic_map *bmap,
1532                 enum isl_dim_type type, __isl_take isl_id *id);
1533         __isl_give isl_map *isl_map_set_tuple_id(
1534                 __isl_take isl_map *map, enum isl_dim_type type,
1535                 __isl_take isl_id *id);
1536         __isl_give isl_map *isl_map_reset_tuple_id(
1537                 __isl_take isl_map *map, enum isl_dim_type type);
1538         isl_bool isl_map_has_tuple_id(__isl_keep isl_map *map,
1539                 enum isl_dim_type type);
1540         __isl_give isl_id *isl_map_get_tuple_id(
1541                 __isl_keep isl_map *map, enum isl_dim_type type);
1542         __isl_give isl_map *isl_map_set_tuple_name(
1543                 __isl_take isl_map *map,
1544                 enum isl_dim_type type, const char *s);
1545         const char *isl_basic_map_get_tuple_name(
1546                 __isl_keep isl_basic_map *bmap,
1547                 enum isl_dim_type type);
1548         __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1549                 __isl_take isl_basic_map *bmap,
1550                 enum isl_dim_type type, const char *s);
1551         isl_bool isl_map_has_tuple_name(__isl_keep isl_map *map,
1552                 enum isl_dim_type type);
1553         const char *isl_map_get_tuple_name(
1554                 __isl_keep isl_map *map,
1555                 enum isl_dim_type type);
1557         #include <isl/val.h>
1558         __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1559                 __isl_take isl_multi_val *mv,
1560                 enum isl_dim_type type, __isl_take isl_id *id);
1561         __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1562                 __isl_take isl_multi_val *mv,
1563                 enum isl_dim_type type);
1564         isl_bool isl_multi_val_has_tuple_id(
1565                 __isl_keep isl_multi_val *mv,
1566                 enum isl_dim_type type);
1567         __isl_give isl_id *isl_multi_val_get_tuple_id(
1568                 __isl_keep isl_multi_val *mv,
1569                 enum isl_dim_type type);
1570         __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1571                 __isl_take isl_multi_val *mv,
1572                 enum isl_dim_type type, const char *s);
1573         const char *isl_multi_val_get_tuple_name(
1574                 __isl_keep isl_multi_val *mv,
1575                 enum isl_dim_type type);
1577         #include <isl/aff.h>
1578         __isl_give isl_aff *isl_aff_set_tuple_id(
1579                 __isl_take isl_aff *aff,
1580                 enum isl_dim_type type, __isl_take isl_id *id);
1581         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1582                 __isl_take isl_multi_aff *maff,
1583                 enum isl_dim_type type, __isl_take isl_id *id);
1584         __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1585                 __isl_take isl_pw_aff *pwaff,
1586                 enum isl_dim_type type, __isl_take isl_id *id);
1587         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1588                 __isl_take isl_pw_multi_aff *pma,
1589                 enum isl_dim_type type, __isl_take isl_id *id);
1590         __isl_give isl_multi_union_pw_aff *
1591         isl_multi_union_pw_aff_set_tuple_id(
1592                 __isl_take isl_multi_union_pw_aff *mupa,
1593                 enum isl_dim_type type, __isl_take isl_id *id);
1594         __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1595                 __isl_take isl_multi_aff *ma,
1596                 enum isl_dim_type type);
1597         __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1598                 __isl_take isl_pw_aff *pa,
1599                 enum isl_dim_type type);
1600         __isl_give isl_multi_pw_aff *
1601         isl_multi_pw_aff_reset_tuple_id(
1602                 __isl_take isl_multi_pw_aff *mpa,
1603                 enum isl_dim_type type);
1604         __isl_give isl_pw_multi_aff *
1605         isl_pw_multi_aff_reset_tuple_id(
1606                 __isl_take isl_pw_multi_aff *pma,
1607                 enum isl_dim_type type);
1608         __isl_give isl_multi_union_pw_aff *
1609         isl_multi_union_pw_aff_reset_tuple_id(
1610                 __isl_take isl_multi_union_pw_aff *mupa,
1611                 enum isl_dim_type type);
1612         isl_bool isl_multi_aff_has_tuple_id(
1613                 __isl_keep isl_multi_aff *ma,
1614                 enum isl_dim_type type);
1615         __isl_give isl_id *isl_multi_aff_get_tuple_id(
1616                 __isl_keep isl_multi_aff *ma,
1617                 enum isl_dim_type type);
1618         isl_bool isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1619                 enum isl_dim_type type);
1620         __isl_give isl_id *isl_pw_aff_get_tuple_id(
1621                 __isl_keep isl_pw_aff *pa,
1622                 enum isl_dim_type type);
1623         isl_bool isl_pw_multi_aff_has_tuple_id(
1624                 __isl_keep isl_pw_multi_aff *pma,
1625                 enum isl_dim_type type);
1626         __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1627                 __isl_keep isl_pw_multi_aff *pma,
1628                 enum isl_dim_type type);
1629         isl_bool isl_multi_pw_aff_has_tuple_id(
1630                 __isl_keep isl_multi_pw_aff *mpa,
1631                 enum isl_dim_type type);
1632         __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1633                 __isl_keep isl_multi_pw_aff *mpa,
1634                 enum isl_dim_type type);
1635         isl_bool isl_multi_union_pw_aff_has_tuple_id(
1636                 __isl_keep isl_multi_union_pw_aff *mupa,
1637                 enum isl_dim_type type);
1638         __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1639                 __isl_keep isl_multi_union_pw_aff *mupa,
1640                 enum isl_dim_type type);
1641         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1642                 __isl_take isl_multi_aff *maff,
1643                 enum isl_dim_type type, const char *s);
1644         __isl_give isl_multi_pw_aff *
1645         isl_multi_pw_aff_set_tuple_name(
1646                 __isl_take isl_multi_pw_aff *mpa,
1647                 enum isl_dim_type type, const char *s);
1648         __isl_give isl_multi_union_pw_aff *
1649         isl_multi_union_pw_aff_set_tuple_name(
1650                 __isl_take isl_multi_union_pw_aff *mupa,
1651                 enum isl_dim_type type, const char *s);
1652         const char *isl_multi_aff_get_tuple_name(
1653                 __isl_keep isl_multi_aff *multi,
1654                 enum isl_dim_type type);
1655         isl_bool isl_pw_multi_aff_has_tuple_name(
1656                 __isl_keep isl_pw_multi_aff *pma,
1657                 enum isl_dim_type type);
1658         const char *isl_pw_multi_aff_get_tuple_name(
1659                 __isl_keep isl_pw_multi_aff *pma,
1660                 enum isl_dim_type type);
1661         const char *isl_multi_union_pw_aff_get_tuple_name(
1662                 __isl_keep isl_multi_union_pw_aff *mupa,
1663                 enum isl_dim_type type);
1665 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1666 or C<isl_dim_set>.  As with C<isl_space_get_name>,
1667 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1668 data structure.
1669 Binary operations require the corresponding spaces of their arguments
1670 to have the same name.
1672 To keep the names of all parameters and tuples, but reset the user pointers
1673 of all the corresponding identifiers, use the following function.
1675         #include <isl/space.h>
1676         __isl_give isl_space *isl_space_reset_user(
1677                 __isl_take isl_space *space);
1679         #include <isl/set.h>
1680         __isl_give isl_set *isl_set_reset_user(
1681                 __isl_take isl_set *set);
1683         #include <isl/map.h>
1684         __isl_give isl_map *isl_map_reset_user(
1685                 __isl_take isl_map *map);
1687         #include <isl/union_set.h>
1688         __isl_give isl_union_set *isl_union_set_reset_user(
1689                 __isl_take isl_union_set *uset);
1691         #include <isl/union_map.h>
1692         __isl_give isl_union_map *isl_union_map_reset_user(
1693                 __isl_take isl_union_map *umap);
1695         #include <isl/val.h>
1696         __isl_give isl_multi_val *isl_multi_val_reset_user(
1697                 __isl_take isl_multi_val *mv);
1699         #include <isl/aff.h>
1700         __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1701                 __isl_take isl_multi_aff *ma);
1702         __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1703                 __isl_take isl_pw_aff *pa);
1704         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1705                 __isl_take isl_multi_pw_aff *mpa);
1706         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1707                 __isl_take isl_pw_multi_aff *pma);
1708         __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1709                 __isl_take isl_union_pw_aff *upa);
1710         __isl_give isl_multi_union_pw_aff *
1711         isl_multi_union_pw_aff_reset_user(
1712                 __isl_take isl_multi_union_pw_aff *mupa);
1713         __isl_give isl_union_pw_multi_aff *
1714         isl_union_pw_multi_aff_reset_user(
1715                 __isl_take isl_union_pw_multi_aff *upma);
1717         #include <isl/polynomial.h>
1718         __isl_give isl_pw_qpolynomial *
1719         isl_pw_qpolynomial_reset_user(
1720                 __isl_take isl_pw_qpolynomial *pwqp);
1721         __isl_give isl_union_pw_qpolynomial *
1722         isl_union_pw_qpolynomial_reset_user(
1723                 __isl_take isl_union_pw_qpolynomial *upwqp);
1724         __isl_give isl_pw_qpolynomial_fold *
1725         isl_pw_qpolynomial_fold_reset_user(
1726                 __isl_take isl_pw_qpolynomial_fold *pwf);
1727         __isl_give isl_union_pw_qpolynomial_fold *
1728         isl_union_pw_qpolynomial_fold_reset_user(
1729                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1731 Spaces can be nested.  In particular, the domain of a set or
1732 the domain or range of a relation can be a nested relation.
1733 This process is also called I<wrapping>.
1734 The functions for detecting, constructing and deconstructing
1735 such nested spaces can be found in the wrapping properties
1736 of L</"Unary Properties">, the wrapping operations
1737 of L</"Unary Operations"> and the Cartesian product operations
1738 of L</"Basic Operations">.
1740 Spaces can be created from other spaces
1741 using the functions described in L</"Unary Operations">
1742 and L</"Binary Operations">.
1744 =head2 Local Spaces
1746 A local space is essentially a space with
1747 zero or more existentially quantified variables.
1748 The local space of various objects can be obtained
1749 using the following functions.
1751         #include <isl/constraint.h>
1752         __isl_give isl_local_space *isl_constraint_get_local_space(
1753                 __isl_keep isl_constraint *constraint);
1755         #include <isl/set.h>
1756         __isl_give isl_local_space *isl_basic_set_get_local_space(
1757                 __isl_keep isl_basic_set *bset);
1759         #include <isl/map.h>
1760         __isl_give isl_local_space *isl_basic_map_get_local_space(
1761                 __isl_keep isl_basic_map *bmap);
1763         #include <isl/aff.h>
1764         __isl_give isl_local_space *isl_aff_get_domain_local_space(
1765                 __isl_keep isl_aff *aff);
1766         __isl_give isl_local_space *isl_aff_get_local_space(
1767                 __isl_keep isl_aff *aff);
1769 A new local space can be created from a space using
1771         #include <isl/local_space.h>
1772         __isl_give isl_local_space *isl_local_space_from_space(
1773                 __isl_take isl_space *space);
1775 They can be inspected, modified, copied and freed using the following functions.
1777         #include <isl/local_space.h>
1778         isl_bool isl_local_space_is_params(
1779                 __isl_keep isl_local_space *ls);
1780         isl_bool isl_local_space_is_set(
1781                 __isl_keep isl_local_space *ls);
1782         __isl_give isl_space *isl_local_space_get_space(
1783                 __isl_keep isl_local_space *ls);
1784         __isl_give isl_aff *isl_local_space_get_div(
1785                 __isl_keep isl_local_space *ls, int pos);
1786         __isl_give isl_local_space *isl_local_space_copy(
1787                 __isl_keep isl_local_space *ls);
1788         __isl_null isl_local_space *isl_local_space_free(
1789                 __isl_take isl_local_space *ls);
1791 Note that C<isl_local_space_get_div> can only be used on local spaces
1792 of sets.
1794 Two local spaces can be compared using
1796         isl_bool isl_local_space_is_equal(
1797                 __isl_keep isl_local_space *ls1,
1798                 __isl_keep isl_local_space *ls2);
1800 Local spaces can be created from other local spaces
1801 using the functions described in L</"Unary Operations">
1802 and L</"Binary Operations">.
1804 =head2 Creating New Sets and Relations
1806 C<isl> has functions for creating some standard sets and relations.
1808 =over
1810 =item * Empty sets and relations
1812         __isl_give isl_basic_set *isl_basic_set_empty(
1813                 __isl_take isl_space *space);
1814         __isl_give isl_basic_map *isl_basic_map_empty(
1815                 __isl_take isl_space *space);
1816         __isl_give isl_set *isl_set_empty(
1817                 __isl_take isl_space *space);
1818         __isl_give isl_map *isl_map_empty(
1819                 __isl_take isl_space *space);
1820         __isl_give isl_union_set *isl_union_set_empty(
1821                 __isl_take isl_space *space);
1822         __isl_give isl_union_map *isl_union_map_empty(
1823                 __isl_take isl_space *space);
1825 For C<isl_union_set>s and C<isl_union_map>s, the space
1826 is only used to specify the parameters.
1828 =item * Universe sets and relations
1830         __isl_give isl_basic_set *isl_basic_set_universe(
1831                 __isl_take isl_space *space);
1832         __isl_give isl_basic_map *isl_basic_map_universe(
1833                 __isl_take isl_space *space);
1834         __isl_give isl_set *isl_set_universe(
1835                 __isl_take isl_space *space);
1836         __isl_give isl_map *isl_map_universe(
1837                 __isl_take isl_space *space);
1838         __isl_give isl_union_set *isl_union_set_universe(
1839                 __isl_take isl_union_set *uset);
1840         __isl_give isl_union_map *isl_union_map_universe(
1841                 __isl_take isl_union_map *umap);
1843 The sets and relations constructed by the functions above
1844 contain all integer values, while those constructed by the
1845 functions below only contain non-negative values.
1847         __isl_give isl_basic_set *isl_basic_set_nat_universe(
1848                 __isl_take isl_space *space);
1849         __isl_give isl_basic_map *isl_basic_map_nat_universe(
1850                 __isl_take isl_space *space);
1851         __isl_give isl_set *isl_set_nat_universe(
1852                 __isl_take isl_space *space);
1853         __isl_give isl_map *isl_map_nat_universe(
1854                 __isl_take isl_space *space);
1856 =item * Identity relations
1858         __isl_give isl_basic_map *isl_basic_map_identity(
1859                 __isl_take isl_space *space);
1860         __isl_give isl_map *isl_map_identity(
1861                 __isl_take isl_space *space);
1863 The number of input and output dimensions in C<space> needs
1864 to be the same.
1866 =item * Lexicographic order
1868         __isl_give isl_map *isl_map_lex_lt(
1869                 __isl_take isl_space *set_space);
1870         __isl_give isl_map *isl_map_lex_le(
1871                 __isl_take isl_space *set_space);
1872         __isl_give isl_map *isl_map_lex_gt(
1873                 __isl_take isl_space *set_space);
1874         __isl_give isl_map *isl_map_lex_ge(
1875                 __isl_take isl_space *set_space);
1876         __isl_give isl_map *isl_map_lex_lt_first(
1877                 __isl_take isl_space *space, unsigned n);
1878         __isl_give isl_map *isl_map_lex_le_first(
1879                 __isl_take isl_space *space, unsigned n);
1880         __isl_give isl_map *isl_map_lex_gt_first(
1881                 __isl_take isl_space *space, unsigned n);
1882         __isl_give isl_map *isl_map_lex_ge_first(
1883                 __isl_take isl_space *space, unsigned n);
1885 The first four functions take a space for a B<set>
1886 and return relations that express that the elements in the domain
1887 are lexicographically less
1888 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1889 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1890 than the elements in the range.
1891 The last four functions take a space for a map
1892 and return relations that express that the first C<n> dimensions
1893 in the domain are lexicographically less
1894 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1895 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1896 than the first C<n> dimensions in the range.
1898 =back
1900 A basic set or relation can be converted to a set or relation
1901 using the following functions.
1903         __isl_give isl_set *isl_set_from_basic_set(
1904                 __isl_take isl_basic_set *bset);
1905         __isl_give isl_map *isl_map_from_basic_map(
1906                 __isl_take isl_basic_map *bmap);
1908 Sets and relations can be converted to union sets and relations
1909 using the following functions.
1911         __isl_give isl_union_set *isl_union_set_from_basic_set(
1912                 __isl_take isl_basic_set *bset);
1913         __isl_give isl_union_map *isl_union_map_from_basic_map(
1914                 __isl_take isl_basic_map *bmap);
1915         __isl_give isl_union_set *isl_union_set_from_set(
1916                 __isl_take isl_set *set);
1917         __isl_give isl_union_map *isl_union_map_from_map(
1918                 __isl_take isl_map *map);
1920 The inverse conversions below can only be used if the input
1921 union set or relation is known to contain elements in exactly one
1922 space.
1924         __isl_give isl_set *isl_set_from_union_set(
1925                 __isl_take isl_union_set *uset);
1926         __isl_give isl_map *isl_map_from_union_map(
1927                 __isl_take isl_union_map *umap);
1929 Sets and relations can be copied and freed again using the following
1930 functions.
1932         __isl_give isl_basic_set *isl_basic_set_copy(
1933                 __isl_keep isl_basic_set *bset);
1934         __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1935         __isl_give isl_union_set *isl_union_set_copy(
1936                 __isl_keep isl_union_set *uset);
1937         __isl_give isl_basic_map *isl_basic_map_copy(
1938                 __isl_keep isl_basic_map *bmap);
1939         __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1940         __isl_give isl_union_map *isl_union_map_copy(
1941                 __isl_keep isl_union_map *umap);
1942         __isl_null isl_basic_set *isl_basic_set_free(
1943                 __isl_take isl_basic_set *bset);
1944         __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1945         __isl_null isl_union_set *isl_union_set_free(
1946                 __isl_take isl_union_set *uset);
1947         __isl_null isl_basic_map *isl_basic_map_free(
1948                 __isl_take isl_basic_map *bmap);
1949         __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1950         __isl_null isl_union_map *isl_union_map_free(
1951                 __isl_take isl_union_map *umap);
1953 Other sets and relations can be constructed by starting
1954 from a universe set or relation, adding equality and/or
1955 inequality constraints and then projecting out the
1956 existentially quantified variables, if any.
1957 Constraints can be constructed, manipulated and
1958 added to (or removed from) (basic) sets and relations
1959 using the following functions.
1961         #include <isl/constraint.h>
1962         __isl_give isl_constraint *isl_constraint_alloc_equality(
1963                 __isl_take isl_local_space *ls);
1964         __isl_give isl_constraint *isl_constraint_alloc_inequality(
1965                 __isl_take isl_local_space *ls);
1966         __isl_give isl_constraint *isl_constraint_set_constant_si(
1967                 __isl_take isl_constraint *constraint, int v);
1968         __isl_give isl_constraint *isl_constraint_set_constant_val(
1969                 __isl_take isl_constraint *constraint,
1970                 __isl_take isl_val *v);
1971         __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1972                 __isl_take isl_constraint *constraint,
1973                 enum isl_dim_type type, int pos, int v);
1974         __isl_give isl_constraint *
1975         isl_constraint_set_coefficient_val(
1976                 __isl_take isl_constraint *constraint,
1977                 enum isl_dim_type type, int pos,
1978                 __isl_take isl_val *v);
1979         __isl_give isl_basic_map *isl_basic_map_add_constraint(
1980                 __isl_take isl_basic_map *bmap,
1981                 __isl_take isl_constraint *constraint);
1982         __isl_give isl_basic_set *isl_basic_set_add_constraint(
1983                 __isl_take isl_basic_set *bset,
1984                 __isl_take isl_constraint *constraint);
1985         __isl_give isl_map *isl_map_add_constraint(
1986                 __isl_take isl_map *map,
1987                 __isl_take isl_constraint *constraint);
1988         __isl_give isl_set *isl_set_add_constraint(
1989                 __isl_take isl_set *set,
1990                 __isl_take isl_constraint *constraint);
1992 For example, to create a set containing the even integers
1993 between 10 and 42, you would use the following code.
1995         isl_space *space;
1996         isl_local_space *ls;
1997         isl_constraint *c;
1998         isl_basic_set *bset;
2000         space = isl_space_set_alloc(ctx, 0, 2);
2001         bset = isl_basic_set_universe(isl_space_copy(space));
2002         ls = isl_local_space_from_space(space);
2004         c = isl_constraint_alloc_equality(isl_local_space_copy(ls));
2005         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
2006         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
2007         bset = isl_basic_set_add_constraint(bset, c);
2009         c = isl_constraint_alloc_inequality(isl_local_space_copy(ls));
2010         c = isl_constraint_set_constant_si(c, -10);
2011         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
2012         bset = isl_basic_set_add_constraint(bset, c);
2014         c = isl_constraint_alloc_inequality(ls);
2015         c = isl_constraint_set_constant_si(c, 42);
2016         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
2017         bset = isl_basic_set_add_constraint(bset, c);
2019         bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
2021 Or, alternatively,
2023         isl_basic_set *bset;
2024         bset = isl_basic_set_read_from_str(ctx,
2025                 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
2027 A basic set or relation can also be constructed from two matrices
2028 describing the equalities and the inequalities.
2030         __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
2031                 __isl_take isl_space *space,
2032                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
2033                 enum isl_dim_type c1,
2034                 enum isl_dim_type c2, enum isl_dim_type c3,
2035                 enum isl_dim_type c4);
2036         __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
2037                 __isl_take isl_space *space,
2038                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
2039                 enum isl_dim_type c1,
2040                 enum isl_dim_type c2, enum isl_dim_type c3,
2041                 enum isl_dim_type c4, enum isl_dim_type c5);
2043 The C<isl_dim_type> arguments indicate the order in which
2044 different kinds of variables appear in the input matrices
2045 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
2046 C<isl_dim_set> and C<isl_dim_div> for sets and
2047 of C<isl_dim_cst>, C<isl_dim_param>,
2048 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
2050 A (basic or union) set or relation can also be constructed from a
2051 (union) (piecewise) (multiple) affine expression
2052 or a list of affine expressions
2053 (See L</"Functions">), provided these affine expressions do not
2054 involve any NaN.
2056         __isl_give isl_basic_map *isl_basic_map_from_aff(
2057                 __isl_take isl_aff *aff);
2058         __isl_give isl_map *isl_map_from_aff(
2059                 __isl_take isl_aff *aff);
2060         __isl_give isl_set *isl_set_from_pw_aff(
2061                 __isl_take isl_pw_aff *pwaff);
2062         __isl_give isl_map *isl_map_from_pw_aff(
2063                 __isl_take isl_pw_aff *pwaff);
2064         __isl_give isl_basic_map *isl_basic_map_from_aff_list(
2065                 __isl_take isl_space *domain_space,
2066                 __isl_take isl_aff_list *list);
2067         __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
2068                 __isl_take isl_multi_aff *maff)
2069         __isl_give isl_map *isl_map_from_multi_aff(
2070                 __isl_take isl_multi_aff *maff)
2071         __isl_give isl_set *isl_set_from_pw_multi_aff(
2072                 __isl_take isl_pw_multi_aff *pma);
2073         __isl_give isl_map *isl_map_from_pw_multi_aff(
2074                 __isl_take isl_pw_multi_aff *pma);
2075         __isl_give isl_set *isl_set_from_multi_pw_aff(
2076                 __isl_take isl_multi_pw_aff *mpa);
2077         __isl_give isl_map *isl_map_from_multi_pw_aff(
2078                 __isl_take isl_multi_pw_aff *mpa);
2079         __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
2080                 __isl_take isl_union_pw_aff *upa);
2081         __isl_give isl_union_map *
2082         isl_union_map_from_union_pw_multi_aff(
2083                 __isl_take isl_union_pw_multi_aff *upma);
2084         __isl_give isl_union_map *
2085         isl_union_map_from_multi_union_pw_aff(
2086                 __isl_take isl_multi_union_pw_aff *mupa);
2088 The C<domain_space> argument describes the domain of the resulting
2089 basic relation.  It is required because the C<list> may consist
2090 of zero affine expressions.
2091 The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
2092 is not allowed to be zero-dimensional.  The domain of the result
2093 is the shared domain of the union piecewise affine elements.
2095 =head2 Inspecting Sets and Relations
2097 Usually, the user should not have to care about the actual constraints
2098 of the sets and maps, but should instead apply the abstract operations
2099 explained in the following sections.
2100 Occasionally, however, it may be required to inspect the individual
2101 coefficients of the constraints.  This section explains how to do so.
2102 In these cases, it may also be useful to have C<isl> compute
2103 an explicit representation of the existentially quantified variables.
2105         __isl_give isl_set *isl_set_compute_divs(
2106                 __isl_take isl_set *set);
2107         __isl_give isl_map *isl_map_compute_divs(
2108                 __isl_take isl_map *map);
2109         __isl_give isl_union_set *isl_union_set_compute_divs(
2110                 __isl_take isl_union_set *uset);
2111         __isl_give isl_union_map *isl_union_map_compute_divs(
2112                 __isl_take isl_union_map *umap);
2114 This explicit representation defines the existentially quantified
2115 variables as integer divisions of the other variables, possibly
2116 including earlier existentially quantified variables.
2117 An explicitly represented existentially quantified variable therefore
2118 has a unique value when the values of the other variables are known.
2120 Alternatively, the existentially quantified variables can be removed
2121 using the following functions, which compute an overapproximation.
2123         #include <isl/set.h>
2124         __isl_give isl_basic_set *isl_basic_set_remove_divs(
2125                 __isl_take isl_basic_set *bset);
2126         __isl_give isl_set *isl_set_remove_divs(
2127                 __isl_take isl_set *set);
2129         #include <isl/map.h>
2130         __isl_give isl_basic_map *isl_basic_map_remove_divs(
2131                 __isl_take isl_basic_map *bmap);
2132         __isl_give isl_map *isl_map_remove_divs(
2133                 __isl_take isl_map *map);
2135         #include <isl/union_set.h>
2136         __isl_give isl_union_set *isl_union_set_remove_divs(
2137                 __isl_take isl_union_set *bset);
2139         #include <isl/union_map.h>
2140         __isl_give isl_union_map *isl_union_map_remove_divs(
2141                 __isl_take isl_union_map *bmap);
2143 It is also possible to only remove those divs that are defined
2144 in terms of a given range of dimensions or only those for which
2145 no explicit representation is known.
2147         __isl_give isl_basic_set *
2148         isl_basic_set_remove_divs_involving_dims(
2149                 __isl_take isl_basic_set *bset,
2150                 enum isl_dim_type type,
2151                 unsigned first, unsigned n);
2152         __isl_give isl_basic_map *
2153         isl_basic_map_remove_divs_involving_dims(
2154                 __isl_take isl_basic_map *bmap,
2155                 enum isl_dim_type type,
2156                 unsigned first, unsigned n);
2157         __isl_give isl_set *isl_set_remove_divs_involving_dims(
2158                 __isl_take isl_set *set, enum isl_dim_type type,
2159                 unsigned first, unsigned n);
2160         __isl_give isl_map *isl_map_remove_divs_involving_dims(
2161                 __isl_take isl_map *map, enum isl_dim_type type,
2162                 unsigned first, unsigned n);
2164         __isl_give isl_basic_set *
2165         isl_basic_set_remove_unknown_divs(
2166                 __isl_take isl_basic_set *bset);
2167         __isl_give isl_set *isl_set_remove_unknown_divs(
2168                 __isl_take isl_set *set);
2169         __isl_give isl_map *isl_map_remove_unknown_divs(
2170                 __isl_take isl_map *map);
2172 To iterate over all the sets or maps in a union set or map, use
2174         #include <isl/union_set.h>
2175         isl_stat isl_union_set_foreach_set(
2176                 __isl_keep isl_union_set *uset,
2177                 isl_stat (*fn)(__isl_take isl_set *set, void *user),
2178                 void *user);
2180         #include <isl/union_map.h>
2181         isl_stat isl_union_map_foreach_map(
2182                 __isl_keep isl_union_map *umap,
2183                 isl_stat (*fn)(__isl_take isl_map *map, void *user),
2184                 void *user);
2185         isl_bool isl_union_map_every_map(
2186                 __isl_keep isl_union_map *umap,
2187                 isl_bool (*test)(__isl_keep isl_map *map,
2188                         void *user),
2189                 void *user);
2191 These functions call the callback function once for each
2192 (pair of) space(s) for which there are elements in the input.
2193 The argument to the callback contains all elements in the input
2194 with that (pair of) space(s).
2195 The C<isl_union_map_every_map> variant check whether each
2196 call to the callback returns true and stops checking as soon as one
2197 of these calls returns false.
2199 The number of sets or maps in a union set or map can be obtained
2200 from
2202         int isl_union_set_n_set(__isl_keep isl_union_set *uset);
2203         int isl_union_map_n_map(__isl_keep isl_union_map *umap);
2205 To extract the set or map in a given space from a union, use
2207         __isl_give isl_set *isl_union_set_extract_set(
2208                 __isl_keep isl_union_set *uset,
2209                 __isl_take isl_space *space);
2210         __isl_give isl_map *isl_union_map_extract_map(
2211                 __isl_keep isl_union_map *umap,
2212                 __isl_take isl_space *space);
2214 To iterate over all the basic sets or maps in a set or map, use
2216         isl_stat isl_set_foreach_basic_set(__isl_keep isl_set *set,
2217                 isl_stat (*fn)(__isl_take isl_basic_set *bset,
2218                         void *user),
2219                 void *user);
2220         isl_stat isl_map_foreach_basic_map(__isl_keep isl_map *map,
2221                 isl_stat (*fn)(__isl_take isl_basic_map *bmap,
2222                         void *user),
2223                 void *user);
2225 The callback function C<fn> should return C<isl_stat_ok> if successful and
2226 C<isl_stat_error> if an error occurs.  In the latter case, or if any other error
2227 occurs, the above functions will return C<isl_stat_error>.
2229 It should be noted that C<isl> does not guarantee that
2230 the basic sets or maps passed to C<fn> are disjoint.
2231 If this is required, then the user should call one of
2232 the following functions first.
2234         __isl_give isl_set *isl_set_make_disjoint(
2235                 __isl_take isl_set *set);
2236         __isl_give isl_map *isl_map_make_disjoint(
2237                 __isl_take isl_map *map);
2239 The number of basic sets in a set can be obtained
2240 or the number of basic maps in a map can be obtained
2241 from
2243         #include <isl/set.h>
2244         int isl_set_n_basic_set(__isl_keep isl_set *set);
2246         #include <isl/map.h>
2247         int isl_map_n_basic_map(__isl_keep isl_map *map);
2249 It is also possible to obtain a list of basic sets from a set
2250 or union set
2252         #include <isl/set.h>
2253         __isl_give isl_basic_set_list *isl_set_get_basic_set_list(
2254                 __isl_keep isl_set *set);
2256         #include <isl/union_set.h>
2257         __isl_give isl_basic_set_list *
2258         isl_union_set_get_basic_set_list(
2259                 __isl_keep isl_union_set *uset);
2261 The returned list can be manipulated using the functions in L<"Lists">.
2263 To iterate over the constraints of a basic set or map, use
2265         #include <isl/constraint.h>
2267         int isl_basic_set_n_constraint(
2268                 __isl_keep isl_basic_set *bset);
2269         isl_stat isl_basic_set_foreach_constraint(
2270                 __isl_keep isl_basic_set *bset,
2271                 isl_stat (*fn)(__isl_take isl_constraint *c,
2272                         void *user),
2273                 void *user);
2274         int isl_basic_map_n_constraint(
2275                 __isl_keep isl_basic_map *bmap);
2276         isl_stat isl_basic_map_foreach_constraint(
2277                 __isl_keep isl_basic_map *bmap,
2278                 isl_stat (*fn)(__isl_take isl_constraint *c,
2279                         void *user),
2280                 void *user);
2281         __isl_null isl_constraint *isl_constraint_free(
2282                 __isl_take isl_constraint *c);
2284 Again, the callback function C<fn> should return C<isl_stat_ok>
2285 if successful and
2286 C<isl_stat_error> if an error occurs.  In the latter case, or if any other error
2287 occurs, the above functions will return C<isl_stat_error>.
2288 The constraint C<c> represents either an equality or an inequality.
2289 Use the following function to find out whether a constraint
2290 represents an equality.  If not, it represents an inequality.
2292         isl_bool isl_constraint_is_equality(
2293                 __isl_keep isl_constraint *constraint);
2295 It is also possible to obtain a list of constraints from a basic
2296 map or set
2298         #include <isl/constraint.h>
2299         __isl_give isl_constraint_list *
2300         isl_basic_map_get_constraint_list(
2301                 __isl_keep isl_basic_map *bmap);
2302         __isl_give isl_constraint_list *
2303         isl_basic_set_get_constraint_list(
2304                 __isl_keep isl_basic_set *bset);
2306 These functions require that all existentially quantified variables
2307 have an explicit representation.
2308 The returned list can be manipulated using the functions in L<"Lists">.
2310 The coefficients of the constraints can be inspected using
2311 the following functions.
2313         isl_bool isl_constraint_is_lower_bound(
2314                 __isl_keep isl_constraint *constraint,
2315                 enum isl_dim_type type, unsigned pos);
2316         isl_bool isl_constraint_is_upper_bound(
2317                 __isl_keep isl_constraint *constraint,
2318                 enum isl_dim_type type, unsigned pos);
2319         __isl_give isl_val *isl_constraint_get_constant_val(
2320                 __isl_keep isl_constraint *constraint);
2321         __isl_give isl_val *isl_constraint_get_coefficient_val(
2322                 __isl_keep isl_constraint *constraint,
2323                 enum isl_dim_type type, int pos);
2325 The explicit representations of the existentially quantified
2326 variables can be inspected using the following function.
2327 Note that the user is only allowed to use this function
2328 if the inspected set or map is the result of a call
2329 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2330 The existentially quantified variable is equal to the floor
2331 of the returned affine expression.  The affine expression
2332 itself can be inspected using the functions in
2333 L</"Functions">.
2335         __isl_give isl_aff *isl_constraint_get_div(
2336                 __isl_keep isl_constraint *constraint, int pos);
2338 To obtain the constraints of a basic set or map in matrix
2339 form, use the following functions.
2341         __isl_give isl_mat *isl_basic_set_equalities_matrix(
2342                 __isl_keep isl_basic_set *bset,
2343                 enum isl_dim_type c1, enum isl_dim_type c2,
2344                 enum isl_dim_type c3, enum isl_dim_type c4);
2345         __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2346                 __isl_keep isl_basic_set *bset,
2347                 enum isl_dim_type c1, enum isl_dim_type c2,
2348                 enum isl_dim_type c3, enum isl_dim_type c4);
2349         __isl_give isl_mat *isl_basic_map_equalities_matrix(
2350                 __isl_keep isl_basic_map *bmap,
2351                 enum isl_dim_type c1,
2352                 enum isl_dim_type c2, enum isl_dim_type c3,
2353                 enum isl_dim_type c4, enum isl_dim_type c5);
2354         __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2355                 __isl_keep isl_basic_map *bmap,
2356                 enum isl_dim_type c1,
2357                 enum isl_dim_type c2, enum isl_dim_type c3,
2358                 enum isl_dim_type c4, enum isl_dim_type c5);
2360 The C<isl_dim_type> arguments dictate the order in which
2361 different kinds of variables appear in the resulting matrix.
2362 For set inputs, they should be a permutation of
2363 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2364 For map inputs, they should be a permutation of
2365 C<isl_dim_cst>, C<isl_dim_param>,
2366 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2368 =head2 Points
2370 Points are elements of a set.  They can be used to construct
2371 simple sets (boxes) or they can be used to represent the
2372 individual elements of a set.
2373 The zero point (the origin) can be created using
2375         __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2377 The coordinates of a point can be inspected, set and changed
2378 using
2380         __isl_give isl_val *isl_point_get_coordinate_val(
2381                 __isl_keep isl_point *pnt,
2382                 enum isl_dim_type type, int pos);
2383         __isl_give isl_point *isl_point_set_coordinate_val(
2384                 __isl_take isl_point *pnt,
2385                 enum isl_dim_type type, int pos,
2386                 __isl_take isl_val *v);
2388         __isl_give isl_point *isl_point_add_ui(
2389                 __isl_take isl_point *pnt,
2390                 enum isl_dim_type type, int pos, unsigned val);
2391         __isl_give isl_point *isl_point_sub_ui(
2392                 __isl_take isl_point *pnt,
2393                 enum isl_dim_type type, int pos, unsigned val);
2395 Points can be copied or freed using
2397         __isl_give isl_point *isl_point_copy(
2398                 __isl_keep isl_point *pnt);
2399         __isl_null isl_point *isl_point_free(
2400                 __isl_take isl_point *pnt);
2402 A singleton set can be created from a point using
2404         __isl_give isl_basic_set *isl_basic_set_from_point(
2405                 __isl_take isl_point *pnt);
2406         __isl_give isl_set *isl_set_from_point(
2407                 __isl_take isl_point *pnt);
2408         __isl_give isl_union_set *isl_union_set_from_point(
2409                 __isl_take isl_point *pnt);
2411 and a box can be created from two opposite extremal points using
2413         __isl_give isl_basic_set *isl_basic_set_box_from_points(
2414                 __isl_take isl_point *pnt1,
2415                 __isl_take isl_point *pnt2);
2416         __isl_give isl_set *isl_set_box_from_points(
2417                 __isl_take isl_point *pnt1,
2418                 __isl_take isl_point *pnt2);
2420 All elements of a B<bounded> (union) set can be enumerated using
2421 the following functions.
2423         isl_stat isl_set_foreach_point(__isl_keep isl_set *set,
2424                 isl_stat (*fn)(__isl_take isl_point *pnt,
2425                         void *user),
2426                 void *user);
2427         isl_stat isl_union_set_foreach_point(
2428                 __isl_keep isl_union_set *uset,
2429                 isl_stat (*fn)(__isl_take isl_point *pnt,
2430                         void *user),
2431                 void *user);
2433 The function C<fn> is called for each integer point in
2434 C<set> with as second argument the last argument of
2435 the C<isl_set_foreach_point> call.  The function C<fn>
2436 should return C<isl_stat_ok> on success and C<isl_stat_error> on failure.
2437 In the latter case, C<isl_set_foreach_point> will stop
2438 enumerating and return C<isl_stat_error> as well.
2439 If the enumeration is performed successfully and to completion,
2440 then C<isl_set_foreach_point> returns C<isl_stat_ok>.
2442 To obtain a single point of a (basic or union) set, use
2444         __isl_give isl_point *isl_basic_set_sample_point(
2445                 __isl_take isl_basic_set *bset);
2446         __isl_give isl_point *isl_set_sample_point(
2447                 __isl_take isl_set *set);
2448         __isl_give isl_point *isl_union_set_sample_point(
2449                 __isl_take isl_union_set *uset);
2451 If C<set> does not contain any (integer) points, then the
2452 resulting point will be ``void'', a property that can be
2453 tested using
2455         isl_bool isl_point_is_void(__isl_keep isl_point *pnt);
2457 =head2 Functions
2459 Besides sets and relation, C<isl> also supports various types of functions.
2460 Each of these types is derived from the value type (see L</"Values">)
2461 or from one of two primitive function types
2462 through the application of zero or more type constructors.
2463 We first describe the primitive type and then we describe
2464 the types derived from these primitive types.
2466 =head3 Primitive Functions
2468 C<isl> support two primitive function types, quasi-affine
2469 expressions and quasipolynomials.
2470 A quasi-affine expression is defined either over a parameter
2471 space or over a set and is composed of integer constants,
2472 parameters and set variables, addition, subtraction and
2473 integer division by an integer constant.
2474 For example, the quasi-affine expression
2476         [n] -> { [x] -> [2*floor((4 n + x)/9)] }
2478 maps C<x> to C<2*floor((4 n + x)/9>.
2479 A quasipolynomial is a polynomial expression in quasi-affine
2480 expression.  That is, it additionally allows for multiplication.
2481 Note, though, that it is not allowed to construct an integer
2482 division of an expression involving multiplications.
2483 Here is an example of a quasipolynomial that is not
2484 quasi-affine expression
2486         [n] -> { [x] -> (n*floor((4 n + x)/9)) }
2488 Note that the external representations of quasi-affine expressions
2489 and quasipolynomials are different.  Quasi-affine expressions
2490 use a notation with square brackets just like binary relations,
2491 while quasipolynomials do not.  This might change at some point.
2493 If a primitive function is defined over a parameter space,
2494 then the space of the function itself is that of a set.
2495 If it is defined over a set, then the space of the function
2496 is that of a relation.  In both cases, the set space (or
2497 the output space) is single-dimensional, anonymous and unstructured.
2498 To create functions with multiple dimensions or with other kinds
2499 of set or output spaces, use multiple expressions
2500 (see L</"Multiple Expressions">).
2502 =over
2504 =item * Quasi-affine Expressions
2506 Besides the expressions described above, a quasi-affine
2507 expression can also be set to NaN.  Such expressions
2508 typically represent a failure to represent a result
2509 as a quasi-affine expression.
2511 The zero quasi affine expression or the quasi affine expression
2512 that is equal to a given value or
2513 a specified dimension on a given domain can be created using
2515         #include <isl/aff.h>
2516         __isl_give isl_aff *isl_aff_zero_on_domain(
2517                 __isl_take isl_local_space *ls);
2518         __isl_give isl_aff *isl_aff_val_on_domain(
2519                 __isl_take isl_local_space *ls,
2520                 __isl_take isl_val *val);
2521         __isl_give isl_aff *isl_aff_var_on_domain(
2522                 __isl_take isl_local_space *ls,
2523                 enum isl_dim_type type, unsigned pos);
2524         __isl_give isl_aff *isl_aff_nan_on_domain(
2525                 __isl_take isl_local_space *ls);
2527 Quasi affine expressions can be copied and freed using
2529         #include <isl/aff.h>
2530         __isl_give isl_aff *isl_aff_copy(
2531                 __isl_keep isl_aff *aff);
2532         __isl_null isl_aff *isl_aff_free(
2533                 __isl_take isl_aff *aff);
2535 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2536 using the following function.  The constraint is required to have
2537 a non-zero coefficient for the specified dimension.
2539         #include <isl/constraint.h>
2540         __isl_give isl_aff *isl_constraint_get_bound(
2541                 __isl_keep isl_constraint *constraint,
2542                 enum isl_dim_type type, int pos);
2544 The entire affine expression of the constraint can also be extracted
2545 using the following function.
2547         #include <isl/constraint.h>
2548         __isl_give isl_aff *isl_constraint_get_aff(
2549                 __isl_keep isl_constraint *constraint);
2551 Conversely, an equality constraint equating
2552 the affine expression to zero or an inequality constraint enforcing
2553 the affine expression to be non-negative, can be constructed using
2555         __isl_give isl_constraint *isl_equality_from_aff(
2556                 __isl_take isl_aff *aff);
2557         __isl_give isl_constraint *isl_inequality_from_aff(
2558                 __isl_take isl_aff *aff);
2560 The coefficients and the integer divisions of an affine expression
2561 can be inspected using the following functions.
2563         #include <isl/aff.h>
2564         __isl_give isl_val *isl_aff_get_constant_val(
2565                 __isl_keep isl_aff *aff);
2566         __isl_give isl_val *isl_aff_get_coefficient_val(
2567                 __isl_keep isl_aff *aff,
2568                 enum isl_dim_type type, int pos);
2569         int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2570                 enum isl_dim_type type, int pos);
2571         __isl_give isl_val *isl_aff_get_denominator_val(
2572                 __isl_keep isl_aff *aff);
2573         __isl_give isl_aff *isl_aff_get_div(
2574                 __isl_keep isl_aff *aff, int pos);
2576 They can be modified using the following functions.
2578         #include <isl/aff.h>
2579         __isl_give isl_aff *isl_aff_set_constant_si(
2580                 __isl_take isl_aff *aff, int v);
2581         __isl_give isl_aff *isl_aff_set_constant_val(
2582                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2583         __isl_give isl_aff *isl_aff_set_coefficient_si(
2584                 __isl_take isl_aff *aff,
2585                 enum isl_dim_type type, int pos, int v);
2586         __isl_give isl_aff *isl_aff_set_coefficient_val(
2587                 __isl_take isl_aff *aff,
2588                 enum isl_dim_type type, int pos,
2589                 __isl_take isl_val *v);
2591         __isl_give isl_aff *isl_aff_add_constant_si(
2592                 __isl_take isl_aff *aff, int v);
2593         __isl_give isl_aff *isl_aff_add_constant_val(
2594                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2595         __isl_give isl_aff *isl_aff_add_constant_num_si(
2596                 __isl_take isl_aff *aff, int v);
2597         __isl_give isl_aff *isl_aff_add_coefficient_si(
2598                 __isl_take isl_aff *aff,
2599                 enum isl_dim_type type, int pos, int v);
2600         __isl_give isl_aff *isl_aff_add_coefficient_val(
2601                 __isl_take isl_aff *aff,
2602                 enum isl_dim_type type, int pos,
2603                 __isl_take isl_val *v);
2605 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2606 set the I<numerator> of the constant or coefficient, while
2607 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2608 the constant or coefficient as a whole.
2609 The C<add_constant> and C<add_coefficient> functions add an integer
2610 or rational value to
2611 the possibly rational constant or coefficient.
2612 The C<add_constant_num> functions add an integer value to
2613 the numerator.
2615 =item * Quasipolynomials
2617 Some simple quasipolynomials can be created using the following functions.
2619         #include <isl/polynomial.h>
2620         __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2621                 __isl_take isl_space *domain);
2622         __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2623                 __isl_take isl_space *domain);
2624         __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2625                 __isl_take isl_space *domain);
2626         __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2627                 __isl_take isl_space *domain);
2628         __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2629                 __isl_take isl_space *domain);
2630         __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2631                 __isl_take isl_space *domain,
2632                 __isl_take isl_val *val);
2633         __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2634                 __isl_take isl_space *domain,
2635                 enum isl_dim_type type, unsigned pos);
2636         __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2637                 __isl_take isl_aff *aff);
2639 Recall that the space in which a quasipolynomial lives is a map space
2640 with a one-dimensional range.  The C<domain> argument in some of
2641 the functions above corresponds to the domain of this map space.
2643 Quasipolynomials can be copied and freed again using the following
2644 functions.
2646         #include <isl/polynomial.h>
2647         __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2648                 __isl_keep isl_qpolynomial *qp);
2649         __isl_null isl_qpolynomial *isl_qpolynomial_free(
2650                 __isl_take isl_qpolynomial *qp);
2652 The constant term of a quasipolynomial can be extracted using
2654         __isl_give isl_val *isl_qpolynomial_get_constant_val(
2655                 __isl_keep isl_qpolynomial *qp);
2657 To iterate over all terms in a quasipolynomial,
2660         isl_stat isl_qpolynomial_foreach_term(
2661                 __isl_keep isl_qpolynomial *qp,
2662                 isl_stat (*fn)(__isl_take isl_term *term,
2663                           void *user), void *user);
2665 The terms themselves can be inspected and freed using
2666 these functions
2668         unsigned isl_term_dim(__isl_keep isl_term *term,
2669                 enum isl_dim_type type);
2670         __isl_give isl_val *isl_term_get_coefficient_val(
2671                 __isl_keep isl_term *term);
2672         int isl_term_get_exp(__isl_keep isl_term *term,
2673                 enum isl_dim_type type, unsigned pos);
2674         __isl_give isl_aff *isl_term_get_div(
2675                 __isl_keep isl_term *term, unsigned pos);
2676         void isl_term_free(__isl_take isl_term *term);
2678 Each term is a product of parameters, set variables and
2679 integer divisions.  The function C<isl_term_get_exp>
2680 returns the exponent of a given dimensions in the given term.
2682 =back
2684 =head3 Reductions
2686 A reduction represents a maximum or a minimum of its
2687 base expressions.
2688 The only reduction type defined by C<isl> is
2689 C<isl_qpolynomial_fold>.
2691 There are currently no functions to directly create such
2692 objects, but they do appear in the piecewise quasipolynomial
2693 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2695 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2697 Reductions can be copied and freed using
2698 the following functions.
2700         #include <isl/polynomial.h>
2701         __isl_give isl_qpolynomial_fold *
2702         isl_qpolynomial_fold_copy(
2703                 __isl_keep isl_qpolynomial_fold *fold);
2704         void isl_qpolynomial_fold_free(
2705                 __isl_take isl_qpolynomial_fold *fold);
2707 To iterate over all quasipolynomials in a reduction, use
2709         isl_stat isl_qpolynomial_fold_foreach_qpolynomial(
2710                 __isl_keep isl_qpolynomial_fold *fold,
2711                 isl_stat (*fn)(__isl_take isl_qpolynomial *qp,
2712                           void *user), void *user);
2714 =head3 Multiple Expressions
2716 A multiple expression represents a sequence of zero or
2717 more base expressions, all defined on the same domain space.
2718 The domain space of the multiple expression is the same
2719 as that of the base expressions, but the range space
2720 can be any space.  In case the base expressions have
2721 a set space, the corresponding multiple expression
2722 also has a set space.
2723 Objects of the value type do not have an associated space.
2724 The space of a multiple value is therefore always a set space.
2725 Similarly, the space of a multiple union piecewise
2726 affine expression is always a set space.
2728 The multiple expression types defined by C<isl>
2729 are C<isl_multi_val>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
2730 C<isl_multi_union_pw_aff>.
2732 A multiple expression with the value zero for
2733 each output (or set) dimension can be created
2734 using the following functions.
2736         #include <isl/val.h>
2737         __isl_give isl_multi_val *isl_multi_val_zero(
2738                 __isl_take isl_space *space);
2740         #include <isl/aff.h>
2741         __isl_give isl_multi_aff *isl_multi_aff_zero(
2742                 __isl_take isl_space *space);
2743         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2744                 __isl_take isl_space *space);
2745         __isl_give isl_multi_union_pw_aff *
2746         isl_multi_union_pw_aff_zero(
2747                 __isl_take isl_space *space);
2749 Since there is no canonical way of representing a zero
2750 value of type C<isl_union_pw_aff>, the space passed
2751 to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
2753 An identity function can be created using the following
2754 functions.  The space needs to be that of a relation
2755 with the same number of input and output dimensions.
2757         #include <isl/aff.h>
2758         __isl_give isl_multi_aff *isl_multi_aff_identity(
2759                 __isl_take isl_space *space);
2760         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2761                 __isl_take isl_space *space);
2763 A function that performs a projection on a universe
2764 relation or set can be created using the following functions.
2765 See also the corresponding
2766 projection operations in L</"Unary Operations">.
2768         #include <isl/aff.h>
2769         __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2770                 __isl_take isl_space *space);
2771         __isl_give isl_multi_aff *isl_multi_aff_range_map(
2772                 __isl_take isl_space *space);
2773         __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2774                 __isl_take isl_space *space,
2775                 enum isl_dim_type type,
2776                 unsigned first, unsigned n);
2778 A multiple expression can be created from a single
2779 base expression using the following functions.
2780 The space of the created multiple expression is the same
2781 as that of the base expression, except for
2782 C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
2783 lives in a parameter space and the output lives
2784 in a single-dimensional set space.
2786         #include <isl/aff.h>
2787         __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2788                 __isl_take isl_aff *aff);
2789         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2790                 __isl_take isl_pw_aff *pa);
2791         __isl_give isl_multi_union_pw_aff *
2792         isl_multi_union_pw_aff_from_union_pw_aff(
2793                 __isl_take isl_union_pw_aff *upa);
2795 A multiple expression can be created from a list
2796 of base expression in a specified space.
2797 The domain of this space needs to be the same
2798 as the domains of the base expressions in the list.
2799 If the base expressions have a set space (or no associated space),
2800 then this space also needs to be a set space.
2802         #include <isl/val.h>
2803         __isl_give isl_multi_val *isl_multi_val_from_val_list(
2804                 __isl_take isl_space *space,
2805                 __isl_take isl_val_list *list);
2807         #include <isl/aff.h>
2808         __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2809                 __isl_take isl_space *space,
2810                 __isl_take isl_aff_list *list);
2811         __isl_give isl_multi_pw_aff *
2812         isl_multi_pw_aff_from_pw_aff_list(
2813                 __isl_take isl_space *space,
2814                 __isl_take isl_pw_aff_list *list);
2815         __isl_give isl_multi_union_pw_aff *
2816         isl_multi_union_pw_aff_from_union_pw_aff_list(
2817                 __isl_take isl_space *space,
2818                 __isl_take isl_union_pw_aff_list *list);
2820 As a convenience, a multiple piecewise expression can
2821 also be created from a multiple expression.
2822 Each piecewise expression in the result has a single
2823 universe cell.
2825         #include <isl/aff.h>
2826         __isl_give isl_multi_pw_aff *
2827         isl_multi_pw_aff_from_multi_aff(
2828                 __isl_take isl_multi_aff *ma);
2830 Similarly, a multiple union expression can be
2831 created from a multiple expression.
2833         #include <isl/aff.h>
2834         __isl_give isl_multi_union_pw_aff *
2835         isl_multi_union_pw_aff_from_multi_aff(
2836                 __isl_take isl_multi_aff *ma);
2837         __isl_give isl_multi_union_pw_aff *
2838         isl_multi_union_pw_aff_from_multi_pw_aff(
2839                 __isl_take isl_multi_pw_aff *mpa);
2841 A multiple quasi-affine expression can be created from
2842 a multiple value with a given domain space using the following
2843 function.
2845         #include <isl/aff.h>
2846         __isl_give isl_multi_aff *
2847         isl_multi_aff_multi_val_on_space(
2848                 __isl_take isl_space *space,
2849                 __isl_take isl_multi_val *mv);
2851 Similarly,
2852 a multiple union piecewise affine expression can be created from
2853 a multiple value with a given domain or
2854 a multiple affine expression with a given domain
2855 using the following functions.
2857         #include <isl/aff.h>
2858         __isl_give isl_multi_union_pw_aff *
2859         isl_multi_union_pw_aff_multi_val_on_domain(
2860                 __isl_take isl_union_set *domain,
2861                 __isl_take isl_multi_val *mv);
2862         __isl_give isl_multi_union_pw_aff *
2863         isl_multi_union_pw_aff_multi_aff_on_domain(
2864                 __isl_take isl_union_set *domain,
2865                 __isl_take isl_multi_aff *ma);
2867 Multiple expressions can be copied and freed using
2868 the following functions.
2870         #include <isl/val.h>
2871         __isl_give isl_multi_val *isl_multi_val_copy(
2872                 __isl_keep isl_multi_val *mv);
2873         __isl_null isl_multi_val *isl_multi_val_free(
2874                 __isl_take isl_multi_val *mv);
2876         #include <isl/aff.h>
2877         __isl_give isl_multi_aff *isl_multi_aff_copy(
2878                 __isl_keep isl_multi_aff *maff);
2879         __isl_null isl_multi_aff *isl_multi_aff_free(
2880                 __isl_take isl_multi_aff *maff);
2881         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2882                 __isl_keep isl_multi_pw_aff *mpa);
2883         __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2884                 __isl_take isl_multi_pw_aff *mpa);
2885         __isl_give isl_multi_union_pw_aff *
2886         isl_multi_union_pw_aff_copy(
2887                 __isl_keep isl_multi_union_pw_aff *mupa);
2888         __isl_null isl_multi_union_pw_aff *
2889         isl_multi_union_pw_aff_free(
2890                 __isl_take isl_multi_union_pw_aff *mupa);
2892 The base expression at a given position of a multiple
2893 expression can be extracted using the following functions.
2895         #include <isl/val.h>
2896         __isl_give isl_val *isl_multi_val_get_val(
2897                 __isl_keep isl_multi_val *mv, int pos);
2899         #include <isl/aff.h>
2900         __isl_give isl_aff *isl_multi_aff_get_aff(
2901                 __isl_keep isl_multi_aff *multi, int pos);
2902         __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2903                 __isl_keep isl_multi_pw_aff *mpa, int pos);
2904         __isl_give isl_union_pw_aff *
2905         isl_multi_union_pw_aff_get_union_pw_aff(
2906                 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
2908 It can be replaced using the following functions.
2910         #include <isl/val.h>
2911         __isl_give isl_multi_val *isl_multi_val_set_val(
2912                 __isl_take isl_multi_val *mv, int pos,
2913                 __isl_take isl_val *val);
2915         #include <isl/aff.h>
2916         __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2917                 __isl_take isl_multi_aff *multi, int pos,
2918                 __isl_take isl_aff *aff);
2919         __isl_give isl_multi_union_pw_aff *
2920         isl_multi_union_pw_aff_set_union_pw_aff(
2921                 __isl_take isl_multi_union_pw_aff *mupa, int pos,
2922                 __isl_take isl_union_pw_aff *upa);
2924 As a convenience, a sequence of base expressions that have
2925 their domains in a given space can be extracted from a sequence
2926 of union expressions using the following function.
2928         #include <isl/aff.h>
2929         __isl_give isl_multi_pw_aff *
2930         isl_multi_union_pw_aff_extract_multi_pw_aff(
2931                 __isl_keep isl_multi_union_pw_aff *mupa,
2932                 __isl_take isl_space *space);
2934 Note that there is a difference between C<isl_multi_union_pw_aff>
2935 and C<isl_union_pw_multi_aff> objects.  The first is a sequence
2936 of unions of piecewise expressions, while the second is a union
2937 of piecewise sequences.  In particular, multiple affine expressions
2938 in an C<isl_union_pw_multi_aff> may live in different spaces,
2939 while there is only a single multiple expression in
2940 an C<isl_multi_union_pw_aff>, which can therefore only live
2941 in a single space.  This means that not every
2942 C<isl_union_pw_multi_aff> can be converted to
2943 an C<isl_multi_union_pw_aff>.  Conversely, a zero-dimensional
2944 C<isl_multi_union_pw_aff> carries no information
2945 about any possible domain and therefore cannot be converted
2946 to an C<isl_union_pw_multi_aff>.  Moreover, the elements
2947 of an C<isl_multi_union_pw_aff> may be defined over different domains,
2948 while each multiple expression inside an C<isl_union_pw_multi_aff>
2949 has a single domain.  The conversion of an C<isl_union_pw_multi_aff>
2950 of dimension greater than one may therefore not be exact.
2951 The following functions can
2952 be used to perform these conversions when they are possible.
2954         #include <isl/aff.h>
2955         __isl_give isl_multi_union_pw_aff *
2956         isl_multi_union_pw_aff_from_union_pw_multi_aff(
2957                 __isl_take isl_union_pw_multi_aff *upma);
2958         __isl_give isl_union_pw_multi_aff *
2959         isl_union_pw_multi_aff_from_multi_union_pw_aff(
2960                 __isl_take isl_multi_union_pw_aff *mupa);
2962 =head3 Piecewise Expressions
2964 A piecewise expression is an expression that is described
2965 using zero or more base expression defined over the same
2966 number of cells in the domain space of the base expressions.
2967 All base expressions are defined over the same
2968 domain space and the cells are disjoint.
2969 The space of a piecewise expression is the same as
2970 that of the base expressions.
2971 If the union of the cells is a strict subset of the domain
2972 space, then the value of the piecewise expression outside
2973 this union is different for types derived from quasi-affine
2974 expressions and those derived from quasipolynomials.
2975 Piecewise expressions derived from quasi-affine expressions
2976 are considered to be undefined outside the union of their cells.
2977 Piecewise expressions derived from quasipolynomials
2978 are considered to be zero outside the union of their cells.
2980 Piecewise quasipolynomials are mainly used by the C<barvinok>
2981 library for representing the number of elements in a parametric set or map.
2982 For example, the piecewise quasipolynomial
2984         [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
2986 represents the number of points in the map
2988         [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
2990 The piecewise expression types defined by C<isl>
2991 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
2992 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
2994 A piecewise expression with no cells can be created using
2995 the following functions.
2997         #include <isl/aff.h>
2998         __isl_give isl_pw_aff *isl_pw_aff_empty(
2999                 __isl_take isl_space *space);
3000         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
3001                 __isl_take isl_space *space);
3003 A piecewise expression with a single universe cell can be
3004 created using the following functions.
3006         #include <isl/aff.h>
3007         __isl_give isl_pw_aff *isl_pw_aff_from_aff(
3008                 __isl_take isl_aff *aff);
3009         __isl_give isl_pw_multi_aff *
3010         isl_pw_multi_aff_from_multi_aff(
3011                 __isl_take isl_multi_aff *ma);
3013         #include <isl/polynomial.h>
3014         __isl_give isl_pw_qpolynomial *
3015         isl_pw_qpolynomial_from_qpolynomial(
3016                 __isl_take isl_qpolynomial *qp);
3018 A piecewise expression with a single specified cell can be
3019 created using the following functions.
3021         #include <isl/aff.h>
3022         __isl_give isl_pw_aff *isl_pw_aff_alloc(
3023                 __isl_take isl_set *set, __isl_take isl_aff *aff);
3024         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
3025                 __isl_take isl_set *set,
3026                 __isl_take isl_multi_aff *maff);
3028         #include <isl/polynomial.h>
3029         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
3030                 __isl_take isl_set *set,
3031                 __isl_take isl_qpolynomial *qp);
3033 The following convenience functions first create a base expression and
3034 then create a piecewise expression over a universe domain.
3036         #include <isl/aff.h>
3037         __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
3038                 __isl_take isl_local_space *ls);
3039         __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
3040                 __isl_take isl_local_space *ls,
3041                 enum isl_dim_type type, unsigned pos);
3042         __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
3043                 __isl_take isl_local_space *ls);
3044         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
3045                 __isl_take isl_space *space);
3046         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
3047                 __isl_take isl_space *space);
3048         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
3049                 __isl_take isl_space *space);
3050         __isl_give isl_pw_multi_aff *
3051         isl_pw_multi_aff_project_out_map(
3052                 __isl_take isl_space *space,
3053                 enum isl_dim_type type,
3054                 unsigned first, unsigned n);
3056         #include <isl/polynomial.h>
3057         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
3058                 __isl_take isl_space *space);
3060 The following convenience functions first create a base expression and
3061 then create a piecewise expression over a given domain.
3063         #include <isl/aff.h>
3064         __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
3065                 __isl_take isl_set *domain,
3066                 __isl_take isl_val *v);
3067         __isl_give isl_pw_multi_aff *
3068         isl_pw_multi_aff_multi_val_on_domain(
3069                 __isl_take isl_set *domain,
3070                 __isl_take isl_multi_val *mv);
3072 As a convenience, a piecewise multiple expression can
3073 also be created from a piecewise expression.
3074 Each multiple expression in the result is derived
3075 from the corresponding base expression.
3077         #include <isl/aff.h>
3078         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
3079                 __isl_take isl_pw_aff *pa);
3081 Similarly, a piecewise quasipolynomial can be
3082 created from a piecewise quasi-affine expression using
3083 the following function.
3085         #include <isl/polynomial.h>
3086         __isl_give isl_pw_qpolynomial *
3087         isl_pw_qpolynomial_from_pw_aff(
3088                 __isl_take isl_pw_aff *pwaff);
3090 Piecewise expressions can be copied and freed using the following functions.
3092         #include <isl/aff.h>
3093         __isl_give isl_pw_aff *isl_pw_aff_copy(
3094                 __isl_keep isl_pw_aff *pwaff);
3095         __isl_null isl_pw_aff *isl_pw_aff_free(
3096                 __isl_take isl_pw_aff *pwaff);
3097         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
3098                 __isl_keep isl_pw_multi_aff *pma);
3099         __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
3100                 __isl_take isl_pw_multi_aff *pma);
3102         #include <isl/polynomial.h>
3103         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
3104                 __isl_keep isl_pw_qpolynomial *pwqp);
3105         __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
3106                 __isl_take isl_pw_qpolynomial *pwqp);
3107         __isl_give isl_pw_qpolynomial_fold *
3108         isl_pw_qpolynomial_fold_copy(
3109                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3110         __isl_null isl_pw_qpolynomial_fold *
3111         isl_pw_qpolynomial_fold_free(
3112                 __isl_take isl_pw_qpolynomial_fold *pwf);
3114 To iterate over the different cells of a piecewise expression,
3115 use the following functions.
3117         #include <isl/aff.h>
3118         isl_bool isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
3119         int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
3120         isl_stat isl_pw_aff_foreach_piece(
3121                 __isl_keep isl_pw_aff *pwaff,
3122                 isl_stat (*fn)(__isl_take isl_set *set,
3123                           __isl_take isl_aff *aff,
3124                           void *user), void *user);
3125         int isl_pw_multi_aff_n_piece(
3126                 __isl_keep isl_pw_multi_aff *pma);
3127         isl_stat isl_pw_multi_aff_foreach_piece(
3128                 __isl_keep isl_pw_multi_aff *pma,
3129                 isl_stat (*fn)(__isl_take isl_set *set,
3130                             __isl_take isl_multi_aff *maff,
3131                             void *user), void *user);
3133         #include <isl/polynomial.h>
3134         int isl_pw_qpolynomial_n_piece(
3135                 __isl_keep isl_pw_qpolynomial *pwqp);
3136         isl_stat isl_pw_qpolynomial_foreach_piece(
3137                 __isl_keep isl_pw_qpolynomial *pwqp,
3138                 isl_stat (*fn)(__isl_take isl_set *set,
3139                           __isl_take isl_qpolynomial *qp,
3140                           void *user), void *user);
3141         isl_stat isl_pw_qpolynomial_foreach_lifted_piece(
3142                 __isl_keep isl_pw_qpolynomial *pwqp,
3143                 isl_stat (*fn)(__isl_take isl_set *set,
3144                           __isl_take isl_qpolynomial *qp,
3145                           void *user), void *user);
3146         int isl_pw_qpolynomial_fold_n_piece(
3147                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3148         isl_stat isl_pw_qpolynomial_fold_foreach_piece(
3149                 __isl_keep isl_pw_qpolynomial_fold *pwf,
3150                 isl_stat (*fn)(__isl_take isl_set *set,
3151                           __isl_take isl_qpolynomial_fold *fold,
3152                           void *user), void *user);
3153         isl_stat isl_pw_qpolynomial_fold_foreach_lifted_piece(
3154                 __isl_keep isl_pw_qpolynomial_fold *pwf,
3155                 isl_stat (*fn)(__isl_take isl_set *set,
3156                           __isl_take isl_qpolynomial_fold *fold,
3157                           void *user), void *user);
3159 As usual, the function C<fn> should return C<isl_stat_ok> on success
3160 and C<isl_stat_error> on failure.  The difference between
3161 C<isl_pw_qpolynomial_foreach_piece> and
3162 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
3163 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
3164 compute unique representations for all existentially quantified
3165 variables and then turn these existentially quantified variables
3166 into extra set variables, adapting the associated quasipolynomial
3167 accordingly.  This means that the C<set> passed to C<fn>
3168 will not have any existentially quantified variables, but that
3169 the dimensions of the sets may be different for different
3170 invocations of C<fn>.
3171 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
3172 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
3174 A piecewise expression consisting of the expressions at a given
3175 position of a piecewise multiple expression can be extracted
3176 using the following function.
3178         #include <isl/aff.h>
3179         __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3180                 __isl_keep isl_pw_multi_aff *pma, int pos);
3182 These expressions can be replaced using the following function.
3184         #include <isl/aff.h>
3185         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3186                 __isl_take isl_pw_multi_aff *pma, unsigned pos,
3187                 __isl_take isl_pw_aff *pa);
3189 Note that there is a difference between C<isl_multi_pw_aff> and
3190 C<isl_pw_multi_aff> objects.  The first is a sequence of piecewise
3191 affine expressions, while the second is a piecewise sequence
3192 of affine expressions.  In particular, each of the piecewise
3193 affine expressions in an C<isl_multi_pw_aff> may have a different
3194 domain, while all multiple expressions associated to a cell
3195 in an C<isl_pw_multi_aff> have the same domain.
3196 It is possible to convert between the two, but when converting
3197 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3198 of the result is the intersection of the domains of the input.
3199 The reverse conversion is exact.
3201         #include <isl/aff.h>
3202         __isl_give isl_pw_multi_aff *
3203         isl_pw_multi_aff_from_multi_pw_aff(
3204                 __isl_take isl_multi_pw_aff *mpa);
3205         __isl_give isl_multi_pw_aff *
3206         isl_multi_pw_aff_from_pw_multi_aff(
3207                 __isl_take isl_pw_multi_aff *pma);
3209 =head3 Union Expressions
3211 A union expression collects base expressions defined
3212 over different domains.  The space of a union expression
3213 is that of the shared parameter space.
3215 The union expression types defined by C<isl>
3216 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3217 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3218 In case of
3219 C<isl_union_pw_aff>,
3220 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>,
3221 there can be at most one base expression for a given domain space.
3222 In case of
3223 C<isl_union_pw_multi_aff>,
3224 there can be multiple such expressions for a given domain space,
3225 but the domains of these expressions need to be disjoint.
3227 An empty union expression can be created using the following functions.
3229         #include <isl/aff.h>
3230         __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
3231                 __isl_take isl_space *space);
3232         __isl_give isl_union_pw_multi_aff *
3233         isl_union_pw_multi_aff_empty(
3234                 __isl_take isl_space *space);
3236         #include <isl/polynomial.h>
3237         __isl_give isl_union_pw_qpolynomial *
3238         isl_union_pw_qpolynomial_zero(
3239                 __isl_take isl_space *space);
3241 A union expression containing a single base expression
3242 can be created using the following functions.
3244         #include <isl/aff.h>
3245         __isl_give isl_union_pw_aff *
3246         isl_union_pw_aff_from_pw_aff(
3247                 __isl_take isl_pw_aff *pa);
3248         __isl_give isl_union_pw_multi_aff *
3249         isl_union_pw_multi_aff_from_aff(
3250                 __isl_take isl_aff *aff);
3251         __isl_give isl_union_pw_multi_aff *
3252         isl_union_pw_multi_aff_from_pw_multi_aff(
3253                 __isl_take isl_pw_multi_aff *pma);
3255         #include <isl/polynomial.h>
3256         __isl_give isl_union_pw_qpolynomial *
3257         isl_union_pw_qpolynomial_from_pw_qpolynomial(
3258                 __isl_take isl_pw_qpolynomial *pwqp);
3260 The following functions create a base expression on each
3261 of the sets in the union set and collect the results.
3263         #include <isl/aff.h>
3264         __isl_give isl_union_pw_multi_aff *
3265         isl_union_pw_multi_aff_from_union_pw_aff(
3266                 __isl_take isl_union_pw_aff *upa);
3267         __isl_give isl_union_pw_aff *
3268         isl_union_pw_multi_aff_get_union_pw_aff(
3269                 __isl_keep isl_union_pw_multi_aff *upma, int pos);
3270         __isl_give isl_union_pw_aff *
3271         isl_union_pw_aff_val_on_domain(
3272                 __isl_take isl_union_set *domain,
3273                 __isl_take isl_val *v);
3274         __isl_give isl_union_pw_multi_aff *
3275         isl_union_pw_multi_aff_multi_val_on_domain(
3276                 __isl_take isl_union_set *domain,
3277                 __isl_take isl_multi_val *mv);
3279 An C<isl_union_pw_aff> that is equal to a (parametric) affine
3280 expression on a given domain can be created using the following
3281 function.
3283         #include <isl/aff.h>
3284         __isl_give isl_union_pw_aff *
3285         isl_union_pw_aff_aff_on_domain(
3286                 __isl_take isl_union_set *domain,
3287                 __isl_take isl_aff *aff);
3289 A base expression can be added to a union expression using
3290 the following functions.
3292         #include <isl/aff.h>
3293         __isl_give isl_union_pw_aff *
3294         isl_union_pw_aff_add_pw_aff(
3295                 __isl_take isl_union_pw_aff *upa,
3296                 __isl_take isl_pw_aff *pa);
3297         __isl_give isl_union_pw_multi_aff *
3298         isl_union_pw_multi_aff_add_pw_multi_aff(
3299                 __isl_take isl_union_pw_multi_aff *upma,
3300                 __isl_take isl_pw_multi_aff *pma);
3302         #include <isl/polynomial.h>
3303         __isl_give isl_union_pw_qpolynomial *
3304         isl_union_pw_qpolynomial_add_pw_qpolynomial(
3305                 __isl_take isl_union_pw_qpolynomial *upwqp,
3306                 __isl_take isl_pw_qpolynomial *pwqp);
3308 Union expressions can be copied and freed using
3309 the following functions.
3311         #include <isl/aff.h>
3312         __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
3313                 __isl_keep isl_union_pw_aff *upa);
3314         __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
3315                 __isl_take isl_union_pw_aff *upa);
3316         __isl_give isl_union_pw_multi_aff *
3317         isl_union_pw_multi_aff_copy(
3318                 __isl_keep isl_union_pw_multi_aff *upma);
3319         __isl_null isl_union_pw_multi_aff *
3320         isl_union_pw_multi_aff_free(
3321                 __isl_take isl_union_pw_multi_aff *upma);
3323         #include <isl/polynomial.h>
3324         __isl_give isl_union_pw_qpolynomial *
3325         isl_union_pw_qpolynomial_copy(
3326                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3327         __isl_null isl_union_pw_qpolynomial *
3328         isl_union_pw_qpolynomial_free(
3329                 __isl_take isl_union_pw_qpolynomial *upwqp);
3330         __isl_give isl_union_pw_qpolynomial_fold *
3331         isl_union_pw_qpolynomial_fold_copy(
3332                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3333         __isl_null isl_union_pw_qpolynomial_fold *
3334         isl_union_pw_qpolynomial_fold_free(
3335                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3337 To iterate over the base expressions in a union expression,
3338 use the following functions.
3340         #include <isl/aff.h>
3341         int isl_union_pw_aff_n_pw_aff(
3342                 __isl_keep isl_union_pw_aff *upa);
3343         isl_stat isl_union_pw_aff_foreach_pw_aff(
3344                 __isl_keep isl_union_pw_aff *upa,
3345                 isl_stat (*fn)(__isl_take isl_pw_aff *pa,
3346                         void *user), void *user);
3347         int isl_union_pw_multi_aff_n_pw_multi_aff(
3348                 __isl_keep isl_union_pw_multi_aff *upma);
3349         isl_stat isl_union_pw_multi_aff_foreach_pw_multi_aff(
3350                 __isl_keep isl_union_pw_multi_aff *upma,
3351                 isl_stat (*fn)(__isl_take isl_pw_multi_aff *pma,
3352                             void *user), void *user);
3354         #include <isl/polynomial.h>
3355         int isl_union_pw_qpolynomial_n_pw_qpolynomial(
3356                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3357         isl_stat isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3358                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3359                 isl_stat (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3360                             void *user), void *user);
3361         int isl_union_pw_qpolynomial_fold_n_pw_qpolynomial_fold(
3362                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3363         isl_stat isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3364                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3365                 isl_stat (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3366                             void *user), void *user);
3368 To extract the base expression in a given space from a union, use
3369 the following functions.
3371         #include <isl/aff.h>
3372         __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3373                 __isl_keep isl_union_pw_aff *upa,
3374                 __isl_take isl_space *space);
3375         __isl_give isl_pw_multi_aff *
3376         isl_union_pw_multi_aff_extract_pw_multi_aff(
3377                 __isl_keep isl_union_pw_multi_aff *upma,
3378                 __isl_take isl_space *space);
3380         #include <isl/polynomial.h>
3381         __isl_give isl_pw_qpolynomial *
3382         isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3383                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3384                 __isl_take isl_space *space);
3386 =head2 Input and Output
3388 For set and relation,
3389 C<isl> supports its own input/output format, which is similar
3390 to the C<Omega> format, but also supports the C<PolyLib> format
3391 in some cases.
3392 For other object types, typically only an C<isl> format is supported.
3394 =head3 C<isl> format
3396 The C<isl> format is similar to that of C<Omega>, but has a different
3397 syntax for describing the parameters and allows for the definition
3398 of an existentially quantified variable as the integer division
3399 of an affine expression.
3400 For example, the set of integers C<i> between C<0> and C<n>
3401 such that C<i % 10 <= 6> can be described as
3403         [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3404                                 i - 10 a <= 6) }
3406 A set or relation can have several disjuncts, separated
3407 by the keyword C<or>.  Each disjunct is either a conjunction
3408 of constraints or a projection (C<exists>) of a conjunction
3409 of constraints.  The constraints are separated by the keyword
3410 C<and>.
3412 =head3 C<PolyLib> format
3414 If the represented set is a union, then the first line
3415 contains a single number representing the number of disjuncts.
3416 Otherwise, a line containing the number C<1> is optional.
3418 Each disjunct is represented by a matrix of constraints.
3419 The first line contains two numbers representing
3420 the number of rows and columns,
3421 where the number of rows is equal to the number of constraints
3422 and the number of columns is equal to two plus the number of variables.
3423 The following lines contain the actual rows of the constraint matrix.
3424 In each row, the first column indicates whether the constraint
3425 is an equality (C<0>) or inequality (C<1>).  The final column
3426 corresponds to the constant term.
3428 If the set is parametric, then the coefficients of the parameters
3429 appear in the last columns before the constant column.
3430 The coefficients of any existentially quantified variables appear
3431 between those of the set variables and those of the parameters.
3433 =head3 Extended C<PolyLib> format
3435 The extended C<PolyLib> format is nearly identical to the
3436 C<PolyLib> format.  The only difference is that the line
3437 containing the number of rows and columns of a constraint matrix
3438 also contains four additional numbers:
3439 the number of output dimensions, the number of input dimensions,
3440 the number of local dimensions (i.e., the number of existentially
3441 quantified variables) and the number of parameters.
3442 For sets, the number of ``output'' dimensions is equal
3443 to the number of set dimensions, while the number of ``input''
3444 dimensions is zero.
3446 =head3 Input
3448 Objects can be read from input using the following functions.
3450         #include <isl/val.h>
3451         __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3452                 const char *str);
3453         __isl_give isl_multi_val *isl_multi_val_read_from_str(
3454                 isl_ctx *ctx, const char *str);
3456         #include <isl/set.h>
3457         __isl_give isl_basic_set *isl_basic_set_read_from_file(
3458                 isl_ctx *ctx, FILE *input);
3459         __isl_give isl_basic_set *isl_basic_set_read_from_str(
3460                 isl_ctx *ctx, const char *str);
3461         __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3462                 FILE *input);
3463         __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3464                 const char *str);
3466         #include <isl/map.h>
3467         __isl_give isl_basic_map *isl_basic_map_read_from_file(
3468                 isl_ctx *ctx, FILE *input);
3469         __isl_give isl_basic_map *isl_basic_map_read_from_str(
3470                 isl_ctx *ctx, const char *str);
3471         __isl_give isl_map *isl_map_read_from_file(
3472                 isl_ctx *ctx, FILE *input);
3473         __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3474                 const char *str);
3476         #include <isl/union_set.h>
3477         __isl_give isl_union_set *isl_union_set_read_from_file(
3478                 isl_ctx *ctx, FILE *input);
3479         __isl_give isl_union_set *isl_union_set_read_from_str(
3480                 isl_ctx *ctx, const char *str);
3482         #include <isl/union_map.h>
3483         __isl_give isl_union_map *isl_union_map_read_from_file(
3484                 isl_ctx *ctx, FILE *input);
3485         __isl_give isl_union_map *isl_union_map_read_from_str(
3486                 isl_ctx *ctx, const char *str);
3488         #include <isl/aff.h>
3489         __isl_give isl_aff *isl_aff_read_from_str(
3490                 isl_ctx *ctx, const char *str);
3491         __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3492                 isl_ctx *ctx, const char *str);
3493         __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3494                 isl_ctx *ctx, const char *str);
3495         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3496                 isl_ctx *ctx, const char *str);
3497         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3498                 isl_ctx *ctx, const char *str);
3499         __isl_give isl_union_pw_aff *
3500         isl_union_pw_aff_read_from_str(
3501                 isl_ctx *ctx, const char *str);
3502         __isl_give isl_union_pw_multi_aff *
3503         isl_union_pw_multi_aff_read_from_str(
3504                 isl_ctx *ctx, const char *str);
3505         __isl_give isl_multi_union_pw_aff *
3506         isl_multi_union_pw_aff_read_from_str(
3507                 isl_ctx *ctx, const char *str);
3509         #include <isl/polynomial.h>
3510         __isl_give isl_union_pw_qpolynomial *
3511         isl_union_pw_qpolynomial_read_from_str(
3512                 isl_ctx *ctx, const char *str);
3514 For sets and relations,
3515 the input format is autodetected and may be either the C<PolyLib> format
3516 or the C<isl> format.
3518 =head3 Output
3520 Before anything can be printed, an C<isl_printer> needs to
3521 be created.
3523         __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3524                 FILE *file);
3525         __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3526         __isl_null isl_printer *isl_printer_free(
3527                 __isl_take isl_printer *printer);
3529 C<isl_printer_to_file> prints to the given file, while
3530 C<isl_printer_to_str> prints to a string that can be extracted
3531 using the following function.
3533         #include <isl/printer.h>
3534         __isl_give char *isl_printer_get_str(
3535                 __isl_keep isl_printer *printer);
3537 The printer can be inspected using the following functions.
3539         FILE *isl_printer_get_file(
3540                 __isl_keep isl_printer *printer);
3541         int isl_printer_get_output_format(
3542                 __isl_keep isl_printer *p);
3543         int isl_printer_get_yaml_style(__isl_keep isl_printer *p);
3545 The behavior of the printer can be modified in various ways
3547         __isl_give isl_printer *isl_printer_set_output_format(
3548                 __isl_take isl_printer *p, int output_format);
3549         __isl_give isl_printer *isl_printer_set_indent(
3550                 __isl_take isl_printer *p, int indent);
3551         __isl_give isl_printer *isl_printer_set_indent_prefix(
3552                 __isl_take isl_printer *p, const char *prefix);
3553         __isl_give isl_printer *isl_printer_indent(
3554                 __isl_take isl_printer *p, int indent);
3555         __isl_give isl_printer *isl_printer_set_prefix(
3556                 __isl_take isl_printer *p, const char *prefix);
3557         __isl_give isl_printer *isl_printer_set_suffix(
3558                 __isl_take isl_printer *p, const char *suffix);
3559         __isl_give isl_printer *isl_printer_set_yaml_style(
3560                 __isl_take isl_printer *p, int yaml_style);
3562 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3563 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3564 and defaults to C<ISL_FORMAT_ISL>.
3565 Each line in the output is prefixed by C<indent_prefix>,
3566 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3567 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3568 In the C<PolyLib> format output,
3569 the coefficients of the existentially quantified variables
3570 appear between those of the set variables and those
3571 of the parameters.
3572 The function C<isl_printer_indent> increases the indentation
3573 by the specified amount (which may be negative).
3574 The YAML style may be either C<ISL_YAML_STYLE_BLOCK> or
3575 C<ISL_YAML_STYLE_FLOW> and when we are printing something
3576 in YAML format.
3578 To actually print something, use
3580         #include <isl/printer.h>
3581         __isl_give isl_printer *isl_printer_print_double(
3582                 __isl_take isl_printer *p, double d);
3584         #include <isl/val.h>
3585         __isl_give isl_printer *isl_printer_print_val(
3586                 __isl_take isl_printer *p, __isl_keep isl_val *v);
3588         #include <isl/set.h>
3589         __isl_give isl_printer *isl_printer_print_basic_set(
3590                 __isl_take isl_printer *printer,
3591                 __isl_keep isl_basic_set *bset);
3592         __isl_give isl_printer *isl_printer_print_set(
3593                 __isl_take isl_printer *printer,
3594                 __isl_keep isl_set *set);
3596         #include <isl/map.h>
3597         __isl_give isl_printer *isl_printer_print_basic_map(
3598                 __isl_take isl_printer *printer,
3599                 __isl_keep isl_basic_map *bmap);
3600         __isl_give isl_printer *isl_printer_print_map(
3601                 __isl_take isl_printer *printer,
3602                 __isl_keep isl_map *map);
3604         #include <isl/union_set.h>
3605         __isl_give isl_printer *isl_printer_print_union_set(
3606                 __isl_take isl_printer *p,
3607                 __isl_keep isl_union_set *uset);
3609         #include <isl/union_map.h>
3610         __isl_give isl_printer *isl_printer_print_union_map(
3611                 __isl_take isl_printer *p,
3612                 __isl_keep isl_union_map *umap);
3614         #include <isl/val.h>
3615         __isl_give isl_printer *isl_printer_print_multi_val(
3616                 __isl_take isl_printer *p,
3617                 __isl_keep isl_multi_val *mv);
3619         #include <isl/aff.h>
3620         __isl_give isl_printer *isl_printer_print_aff(
3621                 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3622         __isl_give isl_printer *isl_printer_print_multi_aff(
3623                 __isl_take isl_printer *p,
3624                 __isl_keep isl_multi_aff *maff);
3625         __isl_give isl_printer *isl_printer_print_pw_aff(
3626                 __isl_take isl_printer *p,
3627                 __isl_keep isl_pw_aff *pwaff);
3628         __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3629                 __isl_take isl_printer *p,
3630                 __isl_keep isl_pw_multi_aff *pma);
3631         __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3632                 __isl_take isl_printer *p,
3633                 __isl_keep isl_multi_pw_aff *mpa);
3634         __isl_give isl_printer *isl_printer_print_union_pw_aff(
3635                 __isl_take isl_printer *p,
3636                 __isl_keep isl_union_pw_aff *upa);
3637         __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3638                 __isl_take isl_printer *p,
3639                 __isl_keep isl_union_pw_multi_aff *upma);
3640         __isl_give isl_printer *
3641         isl_printer_print_multi_union_pw_aff(
3642                 __isl_take isl_printer *p,
3643                 __isl_keep isl_multi_union_pw_aff *mupa);
3645         #include <isl/polynomial.h>
3646         __isl_give isl_printer *isl_printer_print_qpolynomial(
3647                 __isl_take isl_printer *p,
3648                 __isl_keep isl_qpolynomial *qp);
3649         __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3650                 __isl_take isl_printer *p,
3651                 __isl_keep isl_pw_qpolynomial *pwqp);
3652         __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3653                 __isl_take isl_printer *p,
3654                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3656         __isl_give isl_printer *
3657         isl_printer_print_pw_qpolynomial_fold(
3658                 __isl_take isl_printer *p,
3659                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3660         __isl_give isl_printer *
3661         isl_printer_print_union_pw_qpolynomial_fold(
3662                 __isl_take isl_printer *p,
3663                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3665 For C<isl_printer_print_qpolynomial>,
3666 C<isl_printer_print_pw_qpolynomial> and
3667 C<isl_printer_print_pw_qpolynomial_fold>,
3668 the output format of the printer
3669 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3670 For C<isl_printer_print_union_pw_qpolynomial> and
3671 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3672 is supported.
3673 In case of printing in C<ISL_FORMAT_C>, the user may want
3674 to set the names of all dimensions first.
3676 C<isl> also provides limited support for printing YAML documents,
3677 just enough for the internal use for printing such documents.
3679         #include <isl/printer.h>
3680         __isl_give isl_printer *isl_printer_yaml_start_mapping(
3681                 __isl_take isl_printer *p);
3682         __isl_give isl_printer *isl_printer_yaml_end_mapping(
3683                 __isl_take isl_printer *p);
3684         __isl_give isl_printer *isl_printer_yaml_start_sequence(
3685                 __isl_take isl_printer *p);
3686         __isl_give isl_printer *isl_printer_yaml_end_sequence(
3687                 __isl_take isl_printer *p);
3688         __isl_give isl_printer *isl_printer_yaml_next(
3689                 __isl_take isl_printer *p);
3691 A document is started by a call to either
3692 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3693 Anything printed to the printer after such a call belong to the
3694 first key of the mapping or the first element in the sequence.
3695 The function C<isl_printer_yaml_next> moves to the value if
3696 we are currently printing a mapping key, the next key if we
3697 are printing a value or the next element if we are printing
3698 an element in a sequence.
3699 Nested mappings and sequences are initiated by the same
3700 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3701 Each call to these functions needs to have a corresponding call to
3702 C<isl_printer_yaml_end_mapping> or C<isl_printer_yaml_end_sequence>.
3704 When called on a file printer, the following function flushes
3705 the file.  When called on a string printer, the buffer is cleared.
3707         __isl_give isl_printer *isl_printer_flush(
3708                 __isl_take isl_printer *p);
3710 The following functions allow the user to attach
3711 notes to a printer in order to keep track of additional state.
3713         #include <isl/printer.h>
3714         isl_bool isl_printer_has_note(__isl_keep isl_printer *p,
3715                 __isl_keep isl_id *id);
3716         __isl_give isl_id *isl_printer_get_note(
3717                 __isl_keep isl_printer *p, __isl_take isl_id *id);
3718         __isl_give isl_printer *isl_printer_set_note(
3719                 __isl_take isl_printer *p,
3720                 __isl_take isl_id *id, __isl_take isl_id *note);
3722 C<isl_printer_set_note> associates the given note to the given
3723 identifier in the printer.
3724 C<isl_printer_get_note> retrieves a note associated to an
3725 identifier, while
3726 C<isl_printer_has_note> checks if there is such a note.
3727 C<isl_printer_get_note> fails if the requested note does not exist.
3729 Alternatively, a string representation can be obtained
3730 directly using the following functions, which always print
3731 in isl format.
3733         #include <isl/id.h>
3734         __isl_give char *isl_id_to_str(
3735                 __isl_keep isl_id *id);
3737         #include <isl/space.h>
3738         __isl_give char *isl_space_to_str(
3739                 __isl_keep isl_space *space);
3741         #include <isl/val.h>
3742         __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3743         __isl_give char *isl_multi_val_to_str(
3744                 __isl_keep isl_multi_val *mv);
3746         #include <isl/set.h>
3747         __isl_give char *isl_basic_set_to_str(
3748                 __isl_keep isl_basic_set *bset);
3749         __isl_give char *isl_set_to_str(
3750                 __isl_keep isl_set *set);
3752         #include <isl/union_set.h>
3753         __isl_give char *isl_union_set_to_str(
3754                 __isl_keep isl_union_set *uset);
3756         #include <isl/map.h>
3757         __isl_give char *isl_basic_map_to_str(
3758                 __isl_keep isl_basic_map *bmap);
3759         __isl_give char *isl_map_to_str(
3760                 __isl_keep isl_map *map);
3762         #include <isl/union_map.h>
3763         __isl_give char *isl_union_map_to_str(
3764                 __isl_keep isl_union_map *umap);
3766         #include <isl/aff.h>
3767         __isl_give char *isl_aff_to_str(__isl_keep isl_aff *aff);
3768         __isl_give char *isl_pw_aff_to_str(
3769                 __isl_keep isl_pw_aff *pa);
3770         __isl_give char *isl_multi_aff_to_str(
3771                 __isl_keep isl_multi_aff *ma);
3772         __isl_give char *isl_pw_multi_aff_to_str(
3773                 __isl_keep isl_pw_multi_aff *pma);
3774         __isl_give char *isl_multi_pw_aff_to_str(
3775                 __isl_keep isl_multi_pw_aff *mpa);
3776         __isl_give char *isl_union_pw_aff_to_str(
3777                 __isl_keep isl_union_pw_aff *upa);
3778         __isl_give char *isl_union_pw_multi_aff_to_str(
3779                 __isl_keep isl_union_pw_multi_aff *upma);
3780         __isl_give char *isl_multi_union_pw_aff_to_str(
3781                 __isl_keep isl_multi_union_pw_aff *mupa);
3783         #include <isl/point.h>
3784         __isl_give char *isl_point_to_str(
3785                 __isl_keep isl_point *pnt);
3787         #include <isl/polynomial.h>
3788         __isl_give char *isl_pw_qpolynomial_to_str(
3789                 __isl_keep isl_pw_qpolynomial *pwqp);
3790         __isl_give char *isl_union_pw_qpolynomial_to_str(
3791                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3793 =head2 Properties
3795 =head3 Unary Properties
3797 =over
3799 =item * Emptiness
3801 The following functions test whether the given set or relation
3802 contains any integer points.  The ``plain'' variants do not perform
3803 any computations, but simply check if the given set or relation
3804 is already known to be empty.
3806         #include <isl/set.h>
3807         isl_bool isl_basic_set_plain_is_empty(
3808                 __isl_keep isl_basic_set *bset);
3809         isl_bool isl_basic_set_is_empty(
3810                 __isl_keep isl_basic_set *bset);
3811         isl_bool isl_set_plain_is_empty(
3812                 __isl_keep isl_set *set);
3813         isl_bool isl_set_is_empty(__isl_keep isl_set *set);
3815         #include <isl/union_set.h>
3816         isl_bool isl_union_set_is_empty(
3817                 __isl_keep isl_union_set *uset);
3819         #include <isl/map.h>
3820         isl_bool isl_basic_map_plain_is_empty(
3821                 __isl_keep isl_basic_map *bmap);
3822         isl_bool isl_basic_map_is_empty(
3823                 __isl_keep isl_basic_map *bmap);
3824         isl_bool isl_map_plain_is_empty(
3825                 __isl_keep isl_map *map);
3826         isl_bool isl_map_is_empty(__isl_keep isl_map *map);
3828         #include <isl/union_map.h>
3829         isl_bool isl_union_map_plain_is_empty(
3830                 __isl_keep isl_union_map *umap);
3831         isl_bool isl_union_map_is_empty(
3832                 __isl_keep isl_union_map *umap);
3834 =item * Universality
3836         isl_bool isl_basic_set_plain_is_universe(
3837                 __isl_keep isl_basic_set *bset);
3838         isl_bool isl_basic_set_is_universe(
3839                 __isl_keep isl_basic_set *bset);
3840         isl_bool isl_basic_map_plain_is_universe(
3841                 __isl_keep isl_basic_map *bmap);
3842         isl_bool isl_basic_map_is_universe(
3843                 __isl_keep isl_basic_map *bmap);
3844         isl_bool isl_set_plain_is_universe(
3845                 __isl_keep isl_set *set);
3846         isl_bool isl_map_plain_is_universe(
3847                 __isl_keep isl_map *map);
3849 =item * Single-valuedness
3851         #include <isl/set.h>
3852         isl_bool isl_set_is_singleton(__isl_keep isl_set *set);
3854         #include <isl/map.h>
3855         isl_bool isl_basic_map_is_single_valued(
3856                 __isl_keep isl_basic_map *bmap);
3857         isl_bool isl_map_plain_is_single_valued(
3858                 __isl_keep isl_map *map);
3859         isl_bool isl_map_is_single_valued(__isl_keep isl_map *map);
3861         #include <isl/union_map.h>
3862         isl_bool isl_union_map_is_single_valued(
3863                 __isl_keep isl_union_map *umap);
3865 =item * Injectivity
3867         isl_bool isl_map_plain_is_injective(
3868                 __isl_keep isl_map *map);
3869         isl_bool isl_map_is_injective(
3870                 __isl_keep isl_map *map);
3871         isl_bool isl_union_map_plain_is_injective(
3872                 __isl_keep isl_union_map *umap);
3873         isl_bool isl_union_map_is_injective(
3874                 __isl_keep isl_union_map *umap);
3876 =item * Bijectivity
3878         isl_bool isl_map_is_bijective(
3879                 __isl_keep isl_map *map);
3880         isl_bool isl_union_map_is_bijective(
3881                 __isl_keep isl_union_map *umap);
3883 =item * Identity
3885 The following functions test whether the given relation
3886 only maps elements to themselves.
3888         #include <isl/map.h>
3889         isl_bool isl_map_is_identity(
3890                 __isl_keep isl_map *map);
3892         #include <isl/union_map.h>
3893         isl_bool isl_union_map_is_identity(
3894                 __isl_keep isl_union_map *umap);
3896 =item * Position
3898         __isl_give isl_val *
3899         isl_basic_map_plain_get_val_if_fixed(
3900                 __isl_keep isl_basic_map *bmap,
3901                 enum isl_dim_type type, unsigned pos);
3902         __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3903                 __isl_keep isl_set *set,
3904                 enum isl_dim_type type, unsigned pos);
3905         __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3906                 __isl_keep isl_map *map,
3907                 enum isl_dim_type type, unsigned pos);
3909 If the set or relation obviously lies on a hyperplane where the given dimension
3910 has a fixed value, then return that value.
3911 Otherwise return NaN.
3913 =item * Stride
3915         isl_stat isl_set_dim_residue_class_val(
3916                 __isl_keep isl_set *set,
3917                 int pos, __isl_give isl_val **modulo,
3918                 __isl_give isl_val **residue);
3920 Check if the values of the given set dimension are equal to a fixed
3921 value modulo some integer value.  If so, assign the modulo to C<*modulo>
3922 and the fixed value to C<*residue>.  If the given dimension attains only
3923 a single value, then assign C<0> to C<*modulo> and the fixed value to
3924 C<*residue>.
3925 If the dimension does not attain only a single value and if no modulo
3926 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3928         #include <isl/set.h>
3929         __isl_give isl_stride_info *isl_set_get_stride_info(
3930                 __isl_keep isl_set *set, int pos);
3931         __isl_give isl_val *isl_set_get_stride(
3932                 __isl_keep isl_set *set, int pos);
3934 Check if the values of the given set dimension are equal to
3935 some affine expression of the other dimensions (the offset)
3936 modulo some integer stride.
3937 If no more specific information can be found, then the stride
3938 is taken to be one and the offset is taken to be the zero expression.
3939 The function C<isl_set_get_stride_info> performs the same
3940 computation but only returns the stride.
3941 Otherwise,
3942 the stride and offset can be extracted from the returned object
3943 using the following functions.
3945         #include <isl/set.h>
3946         __isl_give isl_val *isl_stride_info_get_stride(
3947                 __isl_keep isl_stride_info *si);
3948         __isl_give isl_aff *isl_stride_info_get_offset(
3949                 __isl_keep isl_stride_info *si);
3951 The stride info object can be released using the following function.
3953         #include <isl/set.h>
3954         __isl_null isl_stride_info *isl_stride_info_free(
3955                 __isl_take isl_stride_info *si);
3957 =item * Dependence
3959 To check whether the description of a set, relation or function depends
3960 on one or more given dimensions,
3961 the following functions can be used.
3963         #include <isl/constraint.h>
3964         isl_bool isl_constraint_involves_dims(
3965                 __isl_keep isl_constraint *constraint,
3966                 enum isl_dim_type type, unsigned first, unsigned n);
3968         #include <isl/set.h>
3969         isl_bool isl_basic_set_involves_dims(
3970                 __isl_keep isl_basic_set *bset,
3971                 enum isl_dim_type type, unsigned first, unsigned n);
3972         isl_bool isl_set_involves_dims(__isl_keep isl_set *set,
3973                 enum isl_dim_type type, unsigned first, unsigned n);
3975         #include <isl/map.h>
3976         isl_bool isl_basic_map_involves_dims(
3977                 __isl_keep isl_basic_map *bmap,
3978                 enum isl_dim_type type, unsigned first, unsigned n);
3979         isl_bool isl_map_involves_dims(__isl_keep isl_map *map,
3980                 enum isl_dim_type type, unsigned first, unsigned n);
3982         #include <isl/union_map.h>
3983         isl_bool isl_union_map_involves_dims(
3984                 __isl_keep isl_union_map *umap,
3985                 enum isl_dim_type type, unsigned first, unsigned n);
3987         #include <isl/aff.h>
3988         isl_bool isl_aff_involves_dims(__isl_keep isl_aff *aff,
3989                 enum isl_dim_type type, unsigned first, unsigned n);
3990         isl_bool isl_pw_aff_involves_dims(
3991                 __isl_keep isl_pw_aff *pwaff,
3992                 enum isl_dim_type type, unsigned first, unsigned n);
3993         isl_bool isl_multi_aff_involves_dims(
3994                 __isl_keep isl_multi_aff *ma,
3995                 enum isl_dim_type type, unsigned first, unsigned n);
3996         isl_bool isl_multi_pw_aff_involves_dims(
3997                 __isl_keep isl_multi_pw_aff *mpa,
3998                 enum isl_dim_type type, unsigned first, unsigned n);
4000         #include <isl/polynomial.h>
4001         isl_bool isl_qpolynomial_involves_dims(
4002                 __isl_keep isl_qpolynomial *qp,
4003                 enum isl_dim_type type, unsigned first, unsigned n);
4005 Similarly, the following functions can be used to check whether
4006 a given dimension is involved in any lower or upper bound.
4008         #include <isl/set.h>
4009         isl_bool isl_set_dim_has_any_lower_bound(
4010                 __isl_keep isl_set *set,
4011                 enum isl_dim_type type, unsigned pos);
4012         isl_bool isl_set_dim_has_any_upper_bound(
4013                 __isl_keep isl_set *set,
4014                 enum isl_dim_type type, unsigned pos);
4016 Note that these functions return true even if there is a bound on
4017 the dimension on only some of the basic sets of C<set>.
4018 To check if they have a bound for all of the basic sets in C<set>,
4019 use the following functions instead.
4021         #include <isl/set.h>
4022         isl_bool isl_set_dim_has_lower_bound(
4023                 __isl_keep isl_set *set,
4024                 enum isl_dim_type type, unsigned pos);
4025         isl_bool isl_set_dim_has_upper_bound(
4026                 __isl_keep isl_set *set,
4027                 enum isl_dim_type type, unsigned pos);
4029 =item * Space
4031 To check whether a set is a parameter domain, use this function:
4033         isl_bool isl_set_is_params(__isl_keep isl_set *set);
4034         isl_bool isl_union_set_is_params(
4035                 __isl_keep isl_union_set *uset);
4037 =item * Wrapping
4039 The following functions check whether the space of the given
4040 (basic) set or relation domain and/or range is a wrapped relation.
4042         #include <isl/space.h>
4043         isl_bool isl_space_is_wrapping(
4044                 __isl_keep isl_space *space);
4045         isl_bool isl_space_domain_is_wrapping(
4046                 __isl_keep isl_space *space);
4047         isl_bool isl_space_range_is_wrapping(
4048                 __isl_keep isl_space *space);
4049         isl_bool isl_space_is_product(
4050                 __isl_keep isl_space *space);
4052         #include <isl/set.h>
4053         isl_bool isl_basic_set_is_wrapping(
4054                 __isl_keep isl_basic_set *bset);
4055         isl_bool isl_set_is_wrapping(__isl_keep isl_set *set);
4057         #include <isl/map.h>
4058         isl_bool isl_map_domain_is_wrapping(
4059                 __isl_keep isl_map *map);
4060         isl_bool isl_map_range_is_wrapping(
4061                 __isl_keep isl_map *map);
4062         isl_bool isl_map_is_product(__isl_keep isl_map *map);
4064         #include <isl/val.h>
4065         isl_bool isl_multi_val_range_is_wrapping(
4066                 __isl_keep isl_multi_val *mv);
4068         #include <isl/aff.h>
4069         isl_bool isl_multi_aff_range_is_wrapping(
4070                 __isl_keep isl_multi_aff *ma);
4071         isl_bool isl_multi_pw_aff_range_is_wrapping(
4072                 __isl_keep isl_multi_pw_aff *mpa);
4073         isl_bool isl_multi_union_pw_aff_range_is_wrapping(
4074                 __isl_keep isl_multi_union_pw_aff *mupa);
4076 The input to C<isl_space_is_wrapping> should
4077 be the space of a set, while that of
4078 C<isl_space_domain_is_wrapping> and
4079 C<isl_space_range_is_wrapping> should be the space of a relation.
4080 The input to C<isl_space_is_product> can be either the space
4081 of a set or that of a binary relation.
4082 In case the input is the space of a binary relation, it checks
4083 whether both domain and range are wrapping.
4085 =item * Internal Product
4087         isl_bool isl_basic_map_can_zip(
4088                 __isl_keep isl_basic_map *bmap);
4089         isl_bool isl_map_can_zip(__isl_keep isl_map *map);
4091 Check whether the product of domain and range of the given relation
4092 can be computed,
4093 i.e., whether both domain and range are nested relations.
4095 =item * Currying
4097         #include <isl/space.h>
4098         isl_bool isl_space_can_curry(
4099                 __isl_keep isl_space *space);
4101         #include <isl/map.h>
4102         isl_bool isl_basic_map_can_curry(
4103                 __isl_keep isl_basic_map *bmap);
4104         isl_bool isl_map_can_curry(__isl_keep isl_map *map);
4106 Check whether the domain of the (basic) relation is a wrapped relation.
4108         #include <isl/space.h>
4109         __isl_give isl_space *isl_space_uncurry(
4110                 __isl_take isl_space *space);
4112         #include <isl/map.h>
4113         isl_bool isl_basic_map_can_uncurry(
4114                 __isl_keep isl_basic_map *bmap);
4115         isl_bool isl_map_can_uncurry(__isl_keep isl_map *map);
4117 Check whether the range of the (basic) relation is a wrapped relation.
4119         #include <isl/space.h>
4120         isl_bool isl_space_can_range_curry(
4121                 __isl_keep isl_space *space);
4123         #include <isl/map.h>
4124         isl_bool isl_map_can_range_curry(
4125                 __isl_keep isl_map *map);
4127 Check whether the domain of the relation wrapped in the range of
4128 the input is itself a wrapped relation.
4130 =item * Special Values
4132         #include <isl/aff.h>
4133         isl_bool isl_aff_is_cst(__isl_keep isl_aff *aff);
4134         isl_bool isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
4135         isl_bool isl_multi_pw_aff_is_cst(
4136                 __isl_keep isl_multi_pw_aff *mpa);
4138 Check whether the given expression is a constant.
4140         #include <isl/val.h>
4141         isl_bool isl_multi_val_involves_nan(
4142                 __isl_keep isl_multi_val *mv);
4144         #include <isl/aff.h>
4145         isl_bool isl_aff_is_nan(__isl_keep isl_aff *aff);
4146         isl_bool isl_multi_aff_involves_nan(
4147                 __isl_keep isl_multi_aff *ma);
4148         isl_bool isl_pw_aff_involves_nan(
4149                 __isl_keep isl_pw_aff *pa);
4150         isl_bool isl_pw_multi_aff_involves_nan(
4151                 __isl_keep isl_pw_multi_aff *pma);
4152         isl_bool isl_multi_pw_aff_involves_nan(
4153                 __isl_keep isl_multi_pw_aff *mpa);
4154         isl_bool isl_union_pw_aff_involves_nan(
4155                 __isl_keep isl_union_pw_aff *upa);
4156         isl_bool isl_union_pw_multi_aff_involves_nan(
4157                 __isl_keep isl_union_pw_multi_aff *upma);
4158         isl_bool isl_multi_union_pw_aff_involves_nan(
4159                 __isl_keep isl_multi_union_pw_aff *mupa);
4161         #include <isl/polynomial.h>
4162         isl_bool isl_qpolynomial_is_nan(
4163                 __isl_keep isl_qpolynomial *qp);
4164         isl_bool isl_qpolynomial_fold_is_nan(
4165                 __isl_keep isl_qpolynomial_fold *fold);
4166         isl_bool isl_pw_qpolynomial_involves_nan(
4167                 __isl_keep isl_pw_qpolynomial *pwqp);
4168         isl_bool isl_pw_qpolynomial_fold_involves_nan(
4169                 __isl_keep isl_pw_qpolynomial_fold *pwf);
4170         isl_bool isl_union_pw_qpolynomial_involves_nan(
4171                 __isl_keep isl_union_pw_qpolynomial *upwqp);
4172         isl_bool isl_union_pw_qpolynomial_fold_involves_nan(
4173                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
4175 Check whether the given expression is equal to or involves NaN.
4177         #include <isl/aff.h>
4178         isl_bool isl_aff_plain_is_zero(
4179                 __isl_keep isl_aff *aff);
4181 Check whether the affine expression is obviously zero.
4183 =back
4185 =head3 Binary Properties
4187 =over
4189 =item * Equality
4191 The following functions check whether two objects
4192 represent the same set, relation or function.
4193 The C<plain> variants only return true if the objects
4194 are obviously the same.  That is, they may return false
4195 even if the objects are the same, but they will never
4196 return true if the objects are not the same.
4198         #include <isl/set.h>
4199         isl_bool isl_basic_set_plain_is_equal(
4200                 __isl_keep isl_basic_set *bset1,
4201                 __isl_keep isl_basic_set *bset2);
4202         isl_bool isl_basic_set_is_equal(
4203                 __isl_keep isl_basic_set *bset1,
4204                 __isl_keep isl_basic_set *bset2);
4205         isl_bool isl_set_plain_is_equal(
4206                 __isl_keep isl_set *set1,
4207                 __isl_keep isl_set *set2);
4208         isl_bool isl_set_is_equal(__isl_keep isl_set *set1,
4209                 __isl_keep isl_set *set2);
4211         #include <isl/map.h>
4212         isl_bool isl_basic_map_is_equal(
4213                 __isl_keep isl_basic_map *bmap1,
4214                 __isl_keep isl_basic_map *bmap2);
4215         isl_bool isl_map_is_equal(__isl_keep isl_map *map1,
4216                 __isl_keep isl_map *map2);
4217         isl_bool isl_map_plain_is_equal(
4218                 __isl_keep isl_map *map1,
4219                 __isl_keep isl_map *map2);
4221         #include <isl/union_set.h>
4222         isl_bool isl_union_set_is_equal(
4223                 __isl_keep isl_union_set *uset1,
4224                 __isl_keep isl_union_set *uset2);
4226         #include <isl/union_map.h>
4227         isl_bool isl_union_map_is_equal(
4228                 __isl_keep isl_union_map *umap1,
4229                 __isl_keep isl_union_map *umap2);
4231         #include <isl/aff.h>
4232         isl_bool isl_aff_plain_is_equal(
4233                 __isl_keep isl_aff *aff1,
4234                 __isl_keep isl_aff *aff2);
4235         isl_bool isl_multi_aff_plain_is_equal(
4236                 __isl_keep isl_multi_aff *maff1,
4237                 __isl_keep isl_multi_aff *maff2);
4238         isl_bool isl_pw_aff_plain_is_equal(
4239                 __isl_keep isl_pw_aff *pwaff1,
4240                 __isl_keep isl_pw_aff *pwaff2);
4241         isl_bool isl_pw_aff_is_equal(
4242                 __isl_keep isl_pw_aff *pa1,
4243                 __isl_keep isl_pw_aff *pa2);
4244         isl_bool isl_pw_multi_aff_plain_is_equal(
4245                 __isl_keep isl_pw_multi_aff *pma1,
4246                 __isl_keep isl_pw_multi_aff *pma2);
4247         isl_bool isl_pw_multi_aff_is_equal(
4248                 __isl_keep isl_pw_multi_aff *pma1,
4249                 __isl_keep isl_pw_multi_aff *pma2);
4250         isl_bool isl_multi_pw_aff_plain_is_equal(
4251                 __isl_keep isl_multi_pw_aff *mpa1,
4252                 __isl_keep isl_multi_pw_aff *mpa2);
4253         isl_bool isl_multi_pw_aff_is_equal(
4254                 __isl_keep isl_multi_pw_aff *mpa1,
4255                 __isl_keep isl_multi_pw_aff *mpa2);
4256         isl_bool isl_union_pw_aff_plain_is_equal(
4257                 __isl_keep isl_union_pw_aff *upa1,
4258                 __isl_keep isl_union_pw_aff *upa2);
4259         isl_bool isl_union_pw_multi_aff_plain_is_equal(
4260                 __isl_keep isl_union_pw_multi_aff *upma1,
4261                 __isl_keep isl_union_pw_multi_aff *upma2);
4262         isl_bool isl_multi_union_pw_aff_plain_is_equal(
4263                 __isl_keep isl_multi_union_pw_aff *mupa1,
4264                 __isl_keep isl_multi_union_pw_aff *mupa2);
4266         #include <isl/polynomial.h>
4267         isl_bool isl_union_pw_qpolynomial_plain_is_equal(
4268                 __isl_keep isl_union_pw_qpolynomial *upwqp1,
4269                 __isl_keep isl_union_pw_qpolynomial *upwqp2);
4270         isl_bool isl_union_pw_qpolynomial_fold_plain_is_equal(
4271                 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
4272                 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
4274 =item * Disjointness
4276         #include <isl/set.h>
4277         isl_bool isl_basic_set_is_disjoint(
4278                 __isl_keep isl_basic_set *bset1,
4279                 __isl_keep isl_basic_set *bset2);
4280         isl_bool isl_set_plain_is_disjoint(
4281                 __isl_keep isl_set *set1,
4282                 __isl_keep isl_set *set2);
4283         isl_bool isl_set_is_disjoint(__isl_keep isl_set *set1,
4284                 __isl_keep isl_set *set2);
4286         #include <isl/map.h>
4287         isl_bool isl_basic_map_is_disjoint(
4288                 __isl_keep isl_basic_map *bmap1,
4289                 __isl_keep isl_basic_map *bmap2);
4290         isl_bool isl_map_is_disjoint(__isl_keep isl_map *map1,
4291                 __isl_keep isl_map *map2);
4293         #include <isl/union_set.h>
4294         isl_bool isl_union_set_is_disjoint(
4295                 __isl_keep isl_union_set *uset1,
4296                 __isl_keep isl_union_set *uset2);
4298         #include <isl/union_map.h>
4299         isl_bool isl_union_map_is_disjoint(
4300                 __isl_keep isl_union_map *umap1,
4301                 __isl_keep isl_union_map *umap2);
4303 =item * Subset
4305         isl_bool isl_basic_set_is_subset(
4306                 __isl_keep isl_basic_set *bset1,
4307                 __isl_keep isl_basic_set *bset2);
4308         isl_bool isl_set_is_subset(__isl_keep isl_set *set1,
4309                 __isl_keep isl_set *set2);
4310         isl_bool isl_set_is_strict_subset(
4311                 __isl_keep isl_set *set1,
4312                 __isl_keep isl_set *set2);
4313         isl_bool isl_union_set_is_subset(
4314                 __isl_keep isl_union_set *uset1,
4315                 __isl_keep isl_union_set *uset2);
4316         isl_bool isl_union_set_is_strict_subset(
4317                 __isl_keep isl_union_set *uset1,
4318                 __isl_keep isl_union_set *uset2);
4319         isl_bool isl_basic_map_is_subset(
4320                 __isl_keep isl_basic_map *bmap1,
4321                 __isl_keep isl_basic_map *bmap2);
4322         isl_bool isl_basic_map_is_strict_subset(
4323                 __isl_keep isl_basic_map *bmap1,
4324                 __isl_keep isl_basic_map *bmap2);
4325         isl_bool isl_map_is_subset(
4326                 __isl_keep isl_map *map1,
4327                 __isl_keep isl_map *map2);
4328         isl_bool isl_map_is_strict_subset(
4329                 __isl_keep isl_map *map1,
4330                 __isl_keep isl_map *map2);
4331         isl_bool isl_union_map_is_subset(
4332                 __isl_keep isl_union_map *umap1,
4333                 __isl_keep isl_union_map *umap2);
4334         isl_bool isl_union_map_is_strict_subset(
4335                 __isl_keep isl_union_map *umap1,
4336                 __isl_keep isl_union_map *umap2);
4338 Check whether the first argument is a (strict) subset of the
4339 second argument.
4341 =item * Order
4343 Every comparison function returns a negative value if the first
4344 argument is considered smaller than the second, a positive value
4345 if the first argument is considered greater and zero if the two
4346 constraints are considered the same by the comparison criterion.
4348         #include <isl/constraint.h>
4349         int isl_constraint_plain_cmp(
4350                 __isl_keep isl_constraint *c1,
4351                 __isl_keep isl_constraint *c2);
4353 This function is useful for sorting C<isl_constraint>s.
4354 The order depends on the internal representation of the inputs.
4355 The order is fixed over different calls to the function (assuming
4356 the internal representation of the inputs has not changed), but may
4357 change over different versions of C<isl>.
4359         #include <isl/constraint.h>
4360         int isl_constraint_cmp_last_non_zero(
4361                 __isl_keep isl_constraint *c1,
4362                 __isl_keep isl_constraint *c2);
4364 This function can be used to sort constraints that live in the same
4365 local space.  Constraints that involve ``earlier'' dimensions or
4366 that have a smaller coefficient for the shared latest dimension
4367 are considered smaller than other constraints.
4368 This function only defines a B<partial> order.
4370         #include <isl/set.h>
4371         int isl_set_plain_cmp(__isl_keep isl_set *set1,
4372                 __isl_keep isl_set *set2);
4374 This function is useful for sorting C<isl_set>s.
4375 The order depends on the internal representation of the inputs.
4376 The order is fixed over different calls to the function (assuming
4377 the internal representation of the inputs has not changed), but may
4378 change over different versions of C<isl>.
4380         #include <isl/aff.h>
4381         int isl_multi_aff_plain_cmp(
4382                 __isl_keep isl_multi_aff *ma1,
4383                 __isl_keep isl_multi_aff *ma2);
4384         int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
4385                 __isl_keep isl_pw_aff *pa2);
4387 The functions C<isl_multi_aff_plain_cmp> and
4388 C<isl_pw_aff_plain_cmp> can be used to sort C<isl_multi_aff>s and
4389 C<isl_pw_aff>s.  The order is not strictly defined.
4390 The current order sorts expressions that only involve
4391 earlier dimensions before those that involve later dimensions.
4393 =back
4395 =head2 Unary Operations
4397 =over
4399 =item * Complement
4401         __isl_give isl_set *isl_set_complement(
4402                 __isl_take isl_set *set);
4403         __isl_give isl_map *isl_map_complement(
4404                 __isl_take isl_map *map);
4406 =item * Inverse map
4408         #include <isl/space.h>
4409         __isl_give isl_space *isl_space_reverse(
4410                 __isl_take isl_space *space);
4412         #include <isl/map.h>
4413         __isl_give isl_basic_map *isl_basic_map_reverse(
4414                 __isl_take isl_basic_map *bmap);
4415         __isl_give isl_map *isl_map_reverse(
4416                 __isl_take isl_map *map);
4418         #include <isl/union_map.h>
4419         __isl_give isl_union_map *isl_union_map_reverse(
4420                 __isl_take isl_union_map *umap);
4422 =item * Projection
4424         #include <isl/space.h>
4425         __isl_give isl_space *isl_space_domain(
4426                 __isl_take isl_space *space);
4427         __isl_give isl_space *isl_space_range(
4428                 __isl_take isl_space *space);
4429         __isl_give isl_space *isl_space_params(
4430                 __isl_take isl_space *space);
4432         #include <isl/local_space.h>
4433         __isl_give isl_local_space *isl_local_space_domain(
4434                 __isl_take isl_local_space *ls);
4435         __isl_give isl_local_space *isl_local_space_range(
4436                 __isl_take isl_local_space *ls);
4438         #include <isl/set.h>
4439         __isl_give isl_basic_set *isl_basic_set_project_out(
4440                 __isl_take isl_basic_set *bset,
4441                 enum isl_dim_type type, unsigned first, unsigned n);
4442         __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
4443                 enum isl_dim_type type, unsigned first, unsigned n);
4444         __isl_give isl_map *isl_set_project_onto_map(
4445                 __isl_take isl_set *set,
4446                 enum isl_dim_type type, unsigned first,
4447                 unsigned n);
4448         __isl_give isl_basic_set *isl_basic_set_params(
4449                 __isl_take isl_basic_set *bset);
4450         __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
4452 The function C<isl_set_project_onto_map> returns a relation
4453 that projects the input set onto the given set dimensions.
4455         #include <isl/map.h>
4456         __isl_give isl_basic_map *isl_basic_map_project_out(
4457                 __isl_take isl_basic_map *bmap,
4458                 enum isl_dim_type type, unsigned first, unsigned n);
4459         __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
4460                 enum isl_dim_type type, unsigned first, unsigned n);
4461         __isl_give isl_basic_set *isl_basic_map_domain(
4462                 __isl_take isl_basic_map *bmap);
4463         __isl_give isl_basic_set *isl_basic_map_range(
4464                 __isl_take isl_basic_map *bmap);
4465         __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
4466         __isl_give isl_set *isl_map_domain(
4467                 __isl_take isl_map *bmap);
4468         __isl_give isl_set *isl_map_range(
4469                 __isl_take isl_map *map);
4471         #include <isl/union_set.h>
4472         __isl_give isl_union_set *isl_union_set_project_out(
4473                 __isl_take isl_union_set *uset,
4474                 enum isl_dim_type type,
4475                 unsigned first, unsigned n);
4476         __isl_give isl_set *isl_union_set_params(
4477                 __isl_take isl_union_set *uset);
4479 The function C<isl_union_set_project_out> can only project out
4480 parameters.
4482         #include <isl/union_map.h>
4483         __isl_give isl_union_map *isl_union_map_project_out(
4484                 __isl_take isl_union_map *umap,
4485                 enum isl_dim_type type, unsigned first, unsigned n);
4486         __isl_give isl_union_map *
4487         isl_union_map_project_out_all_params(
4488                 __isl_take isl_union_map *umap);
4489         __isl_give isl_set *isl_union_map_params(
4490                 __isl_take isl_union_map *umap);
4491         __isl_give isl_union_set *isl_union_map_domain(
4492                 __isl_take isl_union_map *umap);
4493         __isl_give isl_union_set *isl_union_map_range(
4494                 __isl_take isl_union_map *umap);
4496 The function C<isl_union_map_project_out> can only project out
4497 parameters.
4499         #include <isl/aff.h>
4500         __isl_give isl_aff *isl_aff_project_domain_on_params(
4501                 __isl_take isl_aff *aff);
4502         __isl_give isl_multi_aff *
4503         isl_multi_aff_project_domain_on_params(
4504                 __isl_take isl_multi_aff *ma);
4505         __isl_give isl_pw_aff *
4506         isl_pw_aff_project_domain_on_params(
4507                 __isl_take isl_pw_aff *pa);
4508         __isl_give isl_multi_pw_aff *
4509         isl_multi_pw_aff_project_domain_on_params(
4510                 __isl_take isl_multi_pw_aff *mpa);
4511         __isl_give isl_pw_multi_aff *
4512         isl_pw_multi_aff_project_domain_on_params(
4513                 __isl_take isl_pw_multi_aff *pma);
4514         __isl_give isl_set *isl_pw_aff_domain(
4515                 __isl_take isl_pw_aff *pwaff);
4516         __isl_give isl_set *isl_pw_multi_aff_domain(
4517                 __isl_take isl_pw_multi_aff *pma);
4518         __isl_give isl_set *isl_multi_pw_aff_domain(
4519                 __isl_take isl_multi_pw_aff *mpa);
4520         __isl_give isl_union_set *isl_union_pw_aff_domain(
4521                 __isl_take isl_union_pw_aff *upa);
4522         __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
4523                 __isl_take isl_union_pw_multi_aff *upma);
4524         __isl_give isl_union_set *
4525         isl_multi_union_pw_aff_domain(
4526                 __isl_take isl_multi_union_pw_aff *mupa);
4527         __isl_give isl_set *isl_pw_aff_params(
4528                 __isl_take isl_pw_aff *pwa);
4530 The function C<isl_multi_union_pw_aff_domain> requires its
4531 input to have at least one set dimension.
4533         #include <isl/polynomial.h>
4534         __isl_give isl_qpolynomial *
4535         isl_qpolynomial_project_domain_on_params(
4536                 __isl_take isl_qpolynomial *qp);
4537         __isl_give isl_pw_qpolynomial *
4538         isl_pw_qpolynomial_project_domain_on_params(
4539                 __isl_take isl_pw_qpolynomial *pwqp);
4540         __isl_give isl_pw_qpolynomial_fold *
4541         isl_pw_qpolynomial_fold_project_domain_on_params(
4542                 __isl_take isl_pw_qpolynomial_fold *pwf);
4543         __isl_give isl_set *isl_pw_qpolynomial_domain(
4544                 __isl_take isl_pw_qpolynomial *pwqp);
4545         __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
4546                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4547         __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
4548                 __isl_take isl_union_pw_qpolynomial *upwqp);
4550         #include <isl/space.h>
4551         __isl_give isl_space *isl_space_domain_map(
4552                 __isl_take isl_space *space);
4553         __isl_give isl_space *isl_space_range_map(
4554                 __isl_take isl_space *space);
4556         #include <isl/map.h>
4557         __isl_give isl_map *isl_set_wrapped_domain_map(
4558                 __isl_take isl_set *set);
4559         __isl_give isl_basic_map *isl_basic_map_domain_map(
4560                 __isl_take isl_basic_map *bmap);
4561         __isl_give isl_basic_map *isl_basic_map_range_map(
4562                 __isl_take isl_basic_map *bmap);
4563         __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
4564         __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
4566         #include <isl/union_map.h>
4567         __isl_give isl_union_map *isl_union_map_domain_map(
4568                 __isl_take isl_union_map *umap);
4569         __isl_give isl_union_pw_multi_aff *
4570         isl_union_map_domain_map_union_pw_multi_aff(
4571                 __isl_take isl_union_map *umap);
4572         __isl_give isl_union_map *isl_union_map_range_map(
4573                 __isl_take isl_union_map *umap);
4574         __isl_give isl_union_map *
4575         isl_union_set_wrapped_domain_map(
4576                 __isl_take isl_union_set *uset);
4578 The functions above construct a (basic, regular or union) relation
4579 that maps (a wrapped version of) the input relation to its domain or range.
4580 C<isl_set_wrapped_domain_map> maps the input set to the domain
4581 of its wrapped relation.
4583 =item * Elimination
4585         __isl_give isl_basic_set *isl_basic_set_eliminate(
4586                 __isl_take isl_basic_set *bset,
4587                 enum isl_dim_type type,
4588                 unsigned first, unsigned n);
4589         __isl_give isl_set *isl_set_eliminate(
4590                 __isl_take isl_set *set, enum isl_dim_type type,
4591                 unsigned first, unsigned n);
4592         __isl_give isl_basic_map *isl_basic_map_eliminate(
4593                 __isl_take isl_basic_map *bmap,
4594                 enum isl_dim_type type,
4595                 unsigned first, unsigned n);
4596         __isl_give isl_map *isl_map_eliminate(
4597                 __isl_take isl_map *map, enum isl_dim_type type,
4598                 unsigned first, unsigned n);
4600 Eliminate the coefficients for the given dimensions from the constraints,
4601 without removing the dimensions.
4603 =item * Constructing a set from a parameter domain
4605 A zero-dimensional (local) space or (basic) set can be constructed
4606 on a given parameter domain using the following functions.
4608         #include <isl/space.h>
4609         __isl_give isl_space *isl_space_set_from_params(
4610                 __isl_take isl_space *space);
4612         #include <isl/local_space.h>
4613         __isl_give isl_local_space *
4614         isl_local_space_set_from_params(
4615                 __isl_take isl_local_space *ls);
4617         #include <isl/set.h>
4618         __isl_give isl_basic_set *isl_basic_set_from_params(
4619                 __isl_take isl_basic_set *bset);
4620         __isl_give isl_set *isl_set_from_params(
4621                 __isl_take isl_set *set);
4623 =item * Constructing a relation from one or two sets
4625 Create a relation with the given set(s) as domain and/or range.
4626 If only the domain or the range is specified, then
4627 the range or domain of the created relation is a zero-dimensional
4628 flat anonymous space.
4630         #include <isl/space.h>
4631         __isl_give isl_space *isl_space_from_domain(
4632                 __isl_take isl_space *space);
4633         __isl_give isl_space *isl_space_from_range(
4634                 __isl_take isl_space *space);
4635         __isl_give isl_space *isl_space_map_from_set(
4636                 __isl_take isl_space *space);
4637         __isl_give isl_space *isl_space_map_from_domain_and_range(
4638                 __isl_take isl_space *domain,
4639                 __isl_take isl_space *range);
4641         #include <isl/local_space.h>
4642         __isl_give isl_local_space *isl_local_space_from_domain(
4643                 __isl_take isl_local_space *ls);
4645         #include <isl/map.h>
4646         __isl_give isl_map *isl_map_from_domain(
4647                 __isl_take isl_set *set);
4648         __isl_give isl_map *isl_map_from_range(
4649                 __isl_take isl_set *set);
4651         #include <isl/union_map.h>
4652         __isl_give isl_union_map *isl_union_map_from_domain(
4653                 __isl_take isl_union_set *uset);
4654         __isl_give isl_union_map *isl_union_map_from_range(
4655                 __isl_take isl_union_set *uset);
4656         __isl_give isl_union_map *
4657         isl_union_map_from_domain_and_range(
4658                 __isl_take isl_union_set *domain,
4659                 __isl_take isl_union_set *range);
4661         #include <isl/val.h>
4662         __isl_give isl_multi_val *isl_multi_val_from_range(
4663                 __isl_take isl_multi_val *mv);
4665         #include <isl/aff.h>
4666         __isl_give isl_multi_aff *isl_multi_aff_from_range(
4667                 __isl_take isl_multi_aff *ma);
4668         __isl_give isl_pw_aff *isl_pw_aff_from_range(
4669                 __isl_take isl_pw_aff *pwa);
4670         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
4671                 __isl_take isl_multi_pw_aff *mpa);
4672         __isl_give isl_multi_union_pw_aff *
4673         isl_multi_union_pw_aff_from_range(
4674                 __isl_take isl_multi_union_pw_aff *mupa);
4675         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
4676                 __isl_take isl_set *set);
4677         __isl_give isl_union_pw_multi_aff *
4678         isl_union_pw_multi_aff_from_domain(
4679                 __isl_take isl_union_set *uset);
4681         #include <isl/polynomial.h>
4682         __isl_give isl_pw_qpolynomial *
4683         isl_pw_qpolynomial_from_range(
4684                 __isl_take isl_pw_qpolynomial *pwqp);
4685         __isl_give isl_pw_qpolynomial_fold *
4686         isl_pw_qpolynomial_fold_from_range(
4687                 __isl_take isl_pw_qpolynomial_fold *pwf);
4689 =item * Slicing
4691         #include <isl/set.h>
4692         __isl_give isl_basic_set *isl_basic_set_fix_si(
4693                 __isl_take isl_basic_set *bset,
4694                 enum isl_dim_type type, unsigned pos, int value);
4695         __isl_give isl_basic_set *isl_basic_set_fix_val(
4696                 __isl_take isl_basic_set *bset,
4697                 enum isl_dim_type type, unsigned pos,
4698                 __isl_take isl_val *v);
4699         __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
4700                 enum isl_dim_type type, unsigned pos, int value);
4701         __isl_give isl_set *isl_set_fix_val(
4702                 __isl_take isl_set *set,
4703                 enum isl_dim_type type, unsigned pos,
4704                 __isl_take isl_val *v);
4706         #include <isl/map.h>
4707         __isl_give isl_basic_map *isl_basic_map_fix_si(
4708                 __isl_take isl_basic_map *bmap,
4709                 enum isl_dim_type type, unsigned pos, int value);
4710         __isl_give isl_basic_map *isl_basic_map_fix_val(
4711                 __isl_take isl_basic_map *bmap,
4712                 enum isl_dim_type type, unsigned pos,
4713                 __isl_take isl_val *v);
4714         __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
4715                 enum isl_dim_type type, unsigned pos, int value);
4716         __isl_give isl_map *isl_map_fix_val(
4717                 __isl_take isl_map *map,
4718                 enum isl_dim_type type, unsigned pos,
4719                 __isl_take isl_val *v);
4721         #include <isl/aff.h>
4722         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
4723                 __isl_take isl_pw_multi_aff *pma,
4724                 enum isl_dim_type type, unsigned pos, int value);
4726         #include <isl/polynomial.h>
4727         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
4728                 __isl_take isl_pw_qpolynomial *pwqp,
4729                 enum isl_dim_type type, unsigned n,
4730                 __isl_take isl_val *v);
4731         __isl_give isl_pw_qpolynomial_fold *
4732         isl_pw_qpolynomial_fold_fix_val(
4733                 __isl_take isl_pw_qpolynomial_fold *pwf,
4734                 enum isl_dim_type type, unsigned n,
4735                 __isl_take isl_val *v);
4737 Intersect the set, relation or function domain
4738 with the hyperplane where the given
4739 dimension has the fixed given value.
4741         #include <isl/set.h>
4742         __isl_give isl_basic_set *
4743         isl_basic_set_lower_bound_val(
4744                 __isl_take isl_basic_set *bset,
4745                 enum isl_dim_type type, unsigned pos,
4746                 __isl_take isl_val *value);
4747         __isl_give isl_basic_set *
4748         isl_basic_set_upper_bound_val(
4749                 __isl_take isl_basic_set *bset,
4750                 enum isl_dim_type type, unsigned pos,
4751                 __isl_take isl_val *value);
4752         __isl_give isl_set *isl_set_lower_bound_si(
4753                 __isl_take isl_set *set,
4754                 enum isl_dim_type type, unsigned pos, int value);
4755         __isl_give isl_set *isl_set_lower_bound_val(
4756                 __isl_take isl_set *set,
4757                 enum isl_dim_type type, unsigned pos,
4758                 __isl_take isl_val *value);
4759         __isl_give isl_set *isl_set_upper_bound_si(
4760                 __isl_take isl_set *set,
4761                 enum isl_dim_type type, unsigned pos, int value);
4762         __isl_give isl_set *isl_set_upper_bound_val(
4763                 __isl_take isl_set *set,
4764                 enum isl_dim_type type, unsigned pos,
4765                 __isl_take isl_val *value);
4767         #include <isl/map.h>
4768         __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
4769                 __isl_take isl_basic_map *bmap,
4770                 enum isl_dim_type type, unsigned pos, int value);
4771         __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
4772                 __isl_take isl_basic_map *bmap,
4773                 enum isl_dim_type type, unsigned pos, int value);
4774         __isl_give isl_map *isl_map_lower_bound_si(
4775                 __isl_take isl_map *map,
4776                 enum isl_dim_type type, unsigned pos, int value);
4777         __isl_give isl_map *isl_map_upper_bound_si(
4778                 __isl_take isl_map *map,
4779                 enum isl_dim_type type, unsigned pos, int value);
4781 Intersect the set or relation with the half-space where the given
4782 dimension has a value bounded by the fixed given integer value.
4784         __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
4785                 enum isl_dim_type type1, int pos1,
4786                 enum isl_dim_type type2, int pos2);
4787         __isl_give isl_basic_map *isl_basic_map_equate(
4788                 __isl_take isl_basic_map *bmap,
4789                 enum isl_dim_type type1, int pos1,
4790                 enum isl_dim_type type2, int pos2);
4791         __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
4792                 enum isl_dim_type type1, int pos1,
4793                 enum isl_dim_type type2, int pos2);
4795 Intersect the set or relation with the hyperplane where the given
4796 dimensions are equal to each other.
4798         __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4799                 enum isl_dim_type type1, int pos1,
4800                 enum isl_dim_type type2, int pos2);
4802 Intersect the relation with the hyperplane where the given
4803 dimensions have opposite values.
4805         __isl_give isl_map *isl_map_order_le(
4806                 __isl_take isl_map *map,
4807                 enum isl_dim_type type1, int pos1,
4808                 enum isl_dim_type type2, int pos2);
4809         __isl_give isl_basic_map *isl_basic_map_order_ge(
4810                 __isl_take isl_basic_map *bmap,
4811                 enum isl_dim_type type1, int pos1,
4812                 enum isl_dim_type type2, int pos2);
4813         __isl_give isl_map *isl_map_order_ge(
4814                 __isl_take isl_map *map,
4815                 enum isl_dim_type type1, int pos1,
4816                 enum isl_dim_type type2, int pos2);
4817         __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4818                 enum isl_dim_type type1, int pos1,
4819                 enum isl_dim_type type2, int pos2);
4820         __isl_give isl_basic_map *isl_basic_map_order_gt(
4821                 __isl_take isl_basic_map *bmap,
4822                 enum isl_dim_type type1, int pos1,
4823                 enum isl_dim_type type2, int pos2);
4824         __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4825                 enum isl_dim_type type1, int pos1,
4826                 enum isl_dim_type type2, int pos2);
4828 Intersect the relation with the half-space where the given
4829 dimensions satisfy the given ordering.
4831         #include <isl/union_set.h>
4832         __isl_give isl_union_map *isl_union_map_remove_map_if(
4833                 __isl_take isl_union_map *umap,
4834                 isl_bool (*fn)(__isl_keep isl_map *map,
4835                         void *user), void *user);
4837 This function calls the callback function once for each
4838 pair of spaces for which there are elements in the input.
4839 If the callback returns C<isl_bool_true>, then all those elements
4840 are removed from the result.  The only remaining elements in the output
4841 are then those for which the callback returns C<isl_bool_false>.
4843 =item * Locus
4845         #include <isl/aff.h>
4846         __isl_give isl_basic_set *isl_aff_zero_basic_set(
4847                 __isl_take isl_aff *aff);
4848         __isl_give isl_basic_set *isl_aff_neg_basic_set(
4849                 __isl_take isl_aff *aff);
4850         __isl_give isl_set *isl_pw_aff_pos_set(
4851                 __isl_take isl_pw_aff *pa);
4852         __isl_give isl_set *isl_pw_aff_nonneg_set(
4853                 __isl_take isl_pw_aff *pwaff);
4854         __isl_give isl_set *isl_pw_aff_zero_set(
4855                 __isl_take isl_pw_aff *pwaff);
4856         __isl_give isl_set *isl_pw_aff_non_zero_set(
4857                 __isl_take isl_pw_aff *pwaff);
4858         __isl_give isl_union_set *
4859         isl_union_pw_aff_zero_union_set(
4860                 __isl_take isl_union_pw_aff *upa);
4861         __isl_give isl_union_set *
4862         isl_multi_union_pw_aff_zero_union_set(
4863                 __isl_take isl_multi_union_pw_aff *mupa);
4865 The function C<isl_aff_neg_basic_set> returns a basic set
4866 containing those elements in the domain space
4867 of C<aff> where C<aff> is negative.
4868 The function C<isl_pw_aff_nonneg_set> returns a set
4869 containing those elements in the domain
4870 of C<pwaff> where C<pwaff> is non-negative.
4871 The function C<isl_multi_union_pw_aff_zero_union_set>
4872 returns a union set containing those elements
4873 in the domains of its elements where they are all zero.
4875 =item * Identity
4877         __isl_give isl_map *isl_set_identity(
4878                 __isl_take isl_set *set);
4879         __isl_give isl_union_map *isl_union_set_identity(
4880                 __isl_take isl_union_set *uset);
4881         __isl_give isl_union_pw_multi_aff *
4882         isl_union_set_identity_union_pw_multi_aff(
4883                 __isl_take isl_union_set *uset);
4885 Construct an identity relation on the given (union) set.
4887 =item * Function Extraction
4889 A piecewise quasi affine expression that is equal to 1 on a set
4890 and 0 outside the set can be created using the following function.
4892         #include <isl/aff.h>
4893         __isl_give isl_pw_aff *isl_set_indicator_function(
4894                 __isl_take isl_set *set);
4896 A piecewise multiple quasi affine expression can be extracted
4897 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4898 and the C<isl_map> is single-valued.
4899 In case of a conversion from an C<isl_union_map>
4900 to an C<isl_union_pw_multi_aff>, these properties need to hold
4901 in each domain space.
4902 A conversion to a C<isl_multi_union_pw_aff> additionally
4903 requires that the input is non-empty and involves only a single
4904 range space.
4906         #include <isl/aff.h>
4907         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4908                 __isl_take isl_set *set);
4909         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4910                 __isl_take isl_map *map);
4912         __isl_give isl_union_pw_multi_aff *
4913         isl_union_pw_multi_aff_from_union_set(
4914                 __isl_take isl_union_set *uset);
4915         __isl_give isl_union_pw_multi_aff *
4916         isl_union_pw_multi_aff_from_union_map(
4917                 __isl_take isl_union_map *umap);
4919         __isl_give isl_multi_union_pw_aff *
4920         isl_multi_union_pw_aff_from_union_map(
4921                 __isl_take isl_union_map *umap);
4923 =item * Deltas
4925         __isl_give isl_basic_set *isl_basic_map_deltas(
4926                 __isl_take isl_basic_map *bmap);
4927         __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
4928         __isl_give isl_union_set *isl_union_map_deltas(
4929                 __isl_take isl_union_map *umap);
4931 These functions return a (basic) set containing the differences
4932 between image elements and corresponding domain elements in the input.
4934         __isl_give isl_basic_map *isl_basic_map_deltas_map(
4935                 __isl_take isl_basic_map *bmap);
4936         __isl_give isl_map *isl_map_deltas_map(
4937                 __isl_take isl_map *map);
4938         __isl_give isl_union_map *isl_union_map_deltas_map(
4939                 __isl_take isl_union_map *umap);
4941 The functions above construct a (basic, regular or union) relation
4942 that maps (a wrapped version of) the input relation to its delta set.
4944 =item * Coalescing
4946 Simplify the representation of a set, relation or functions by trying
4947 to combine pairs of basic sets or relations into a single
4948 basic set or relation.
4950         #include <isl/set.h>
4951         __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
4953         #include <isl/map.h>
4954         __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
4956         #include <isl/union_set.h>
4957         __isl_give isl_union_set *isl_union_set_coalesce(
4958                 __isl_take isl_union_set *uset);
4960         #include <isl/union_map.h>
4961         __isl_give isl_union_map *isl_union_map_coalesce(
4962                 __isl_take isl_union_map *umap);
4964         #include <isl/aff.h>
4965         __isl_give isl_pw_aff *isl_pw_aff_coalesce(
4966                 __isl_take isl_pw_aff *pwqp);
4967         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
4968                 __isl_take isl_pw_multi_aff *pma);
4969         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
4970                 __isl_take isl_multi_pw_aff *mpa);
4971         __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
4972                 __isl_take isl_union_pw_aff *upa);
4973         __isl_give isl_union_pw_multi_aff *
4974         isl_union_pw_multi_aff_coalesce(
4975                 __isl_take isl_union_pw_multi_aff *upma);
4976         __isl_give isl_multi_union_pw_aff *
4977         isl_multi_union_pw_aff_coalesce(
4978                 __isl_take isl_multi_union_pw_aff *aff);
4980         #include <isl/polynomial.h>
4981         __isl_give isl_pw_qpolynomial_fold *
4982         isl_pw_qpolynomial_fold_coalesce(
4983                 __isl_take isl_pw_qpolynomial_fold *pwf);
4984         __isl_give isl_union_pw_qpolynomial *
4985         isl_union_pw_qpolynomial_coalesce(
4986                 __isl_take isl_union_pw_qpolynomial *upwqp);
4987         __isl_give isl_union_pw_qpolynomial_fold *
4988         isl_union_pw_qpolynomial_fold_coalesce(
4989                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4991 One of the methods for combining pairs of basic sets or relations
4992 can result in coefficients that are much larger than those that appear
4993 in the constraints of the input.  By default, the coefficients are
4994 not allowed to grow larger, but this can be changed by unsetting
4995 the following option.
4997         isl_stat isl_options_set_coalesce_bounded_wrapping(
4998                 isl_ctx *ctx, int val);
4999         int isl_options_get_coalesce_bounded_wrapping(
5000                 isl_ctx *ctx);
5002 =item * Detecting equalities
5004         __isl_give isl_basic_set *isl_basic_set_detect_equalities(
5005                 __isl_take isl_basic_set *bset);
5006         __isl_give isl_basic_map *isl_basic_map_detect_equalities(
5007                 __isl_take isl_basic_map *bmap);
5008         __isl_give isl_set *isl_set_detect_equalities(
5009                 __isl_take isl_set *set);
5010         __isl_give isl_map *isl_map_detect_equalities(
5011                 __isl_take isl_map *map);
5012         __isl_give isl_union_set *isl_union_set_detect_equalities(
5013                 __isl_take isl_union_set *uset);
5014         __isl_give isl_union_map *isl_union_map_detect_equalities(
5015                 __isl_take isl_union_map *umap);
5017 Simplify the representation of a set or relation by detecting implicit
5018 equalities.
5020 =item * Removing redundant constraints
5022         #include <isl/set.h>
5023         __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
5024                 __isl_take isl_basic_set *bset);
5025         __isl_give isl_set *isl_set_remove_redundancies(
5026                 __isl_take isl_set *set);
5028         #include <isl/union_set.h>
5029         __isl_give isl_union_set *
5030         isl_union_set_remove_redundancies(
5031                 __isl_take isl_union_set *uset);
5033         #include <isl/map.h>
5034         __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
5035                 __isl_take isl_basic_map *bmap);
5036         __isl_give isl_map *isl_map_remove_redundancies(
5037                 __isl_take isl_map *map);
5039         #include <isl/union_map.h>
5040         __isl_give isl_union_map *
5041         isl_union_map_remove_redundancies(
5042                 __isl_take isl_union_map *umap);
5044 =item * Convex hull
5046         __isl_give isl_basic_set *isl_set_convex_hull(
5047                 __isl_take isl_set *set);
5048         __isl_give isl_basic_map *isl_map_convex_hull(
5049                 __isl_take isl_map *map);
5051 If the input set or relation has any existentially quantified
5052 variables, then the result of these operations is currently undefined.
5054 =item * Simple hull
5056         #include <isl/set.h>
5057         __isl_give isl_basic_set *
5058         isl_set_unshifted_simple_hull(
5059                 __isl_take isl_set *set);
5060         __isl_give isl_basic_set *isl_set_simple_hull(
5061                 __isl_take isl_set *set);
5062         __isl_give isl_basic_set *
5063         isl_set_plain_unshifted_simple_hull(
5064                 __isl_take isl_set *set);
5065         __isl_give isl_basic_set *
5066         isl_set_unshifted_simple_hull_from_set_list(
5067                 __isl_take isl_set *set,
5068                 __isl_take isl_set_list *list);
5070         #include <isl/map.h>
5071         __isl_give isl_basic_map *
5072         isl_map_unshifted_simple_hull(
5073                 __isl_take isl_map *map);
5074         __isl_give isl_basic_map *isl_map_simple_hull(
5075                 __isl_take isl_map *map);
5076         __isl_give isl_basic_map *
5077         isl_map_plain_unshifted_simple_hull(
5078                 __isl_take isl_map *map);
5079                 __isl_give isl_basic_map *
5080         isl_map_unshifted_simple_hull_from_map_list(
5081                 __isl_take isl_map *map,
5082                 __isl_take isl_map_list *list);
5084         #include <isl/union_map.h>
5085         __isl_give isl_union_map *isl_union_map_simple_hull(
5086                 __isl_take isl_union_map *umap);
5088 These functions compute a single basic set or relation
5089 that contains the whole input set or relation.
5090 In particular, the output is described by translates
5091 of the constraints describing the basic sets or relations in the input.
5092 In case of C<isl_set_unshifted_simple_hull>, only the original
5093 constraints are used, without any translation.
5094 In case of C<isl_set_plain_unshifted_simple_hull> and
5095 C<isl_map_plain_unshifted_simple_hull>, the result is described
5096 by original constraints that are obviously satisfied
5097 by the entire input set or relation.
5098 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
5099 C<isl_map_unshifted_simple_hull_from_map_list>, the
5100 constraints are taken from the elements of the second argument.
5102 =begin latex
5104 (See \autoref{s:simple hull}.)
5106 =end latex
5108 =item * Affine hull
5110         __isl_give isl_basic_set *isl_basic_set_affine_hull(
5111                 __isl_take isl_basic_set *bset);
5112         __isl_give isl_basic_set *isl_set_affine_hull(
5113                 __isl_take isl_set *set);
5114         __isl_give isl_union_set *isl_union_set_affine_hull(
5115                 __isl_take isl_union_set *uset);
5116         __isl_give isl_basic_map *isl_basic_map_affine_hull(
5117                 __isl_take isl_basic_map *bmap);
5118         __isl_give isl_basic_map *isl_map_affine_hull(
5119                 __isl_take isl_map *map);
5120         __isl_give isl_union_map *isl_union_map_affine_hull(
5121                 __isl_take isl_union_map *umap);
5123 In case of union sets and relations, the affine hull is computed
5124 per space.
5126 =item * Polyhedral hull
5128         __isl_give isl_basic_set *isl_set_polyhedral_hull(
5129                 __isl_take isl_set *set);
5130         __isl_give isl_basic_map *isl_map_polyhedral_hull(
5131                 __isl_take isl_map *map);
5132         __isl_give isl_union_set *isl_union_set_polyhedral_hull(
5133                 __isl_take isl_union_set *uset);
5134         __isl_give isl_union_map *isl_union_map_polyhedral_hull(
5135                 __isl_take isl_union_map *umap);
5137 These functions compute a single basic set or relation
5138 not involving any existentially quantified variables
5139 that contains the whole input set or relation.
5140 In case of union sets and relations, the polyhedral hull is computed
5141 per space.
5143 =item * Other approximations
5145         #include <isl/set.h>
5146         __isl_give isl_basic_set *
5147         isl_basic_set_drop_constraints_involving_dims(
5148                 __isl_take isl_basic_set *bset,
5149                 enum isl_dim_type type,
5150                 unsigned first, unsigned n);
5151         __isl_give isl_basic_set *
5152         isl_basic_set_drop_constraints_not_involving_dims(
5153                 __isl_take isl_basic_set *bset,
5154                 enum isl_dim_type type,
5155                 unsigned first, unsigned n);
5156         __isl_give isl_set *
5157         isl_set_drop_constraints_involving_dims(
5158                 __isl_take isl_set *set,
5159                 enum isl_dim_type type,
5160                 unsigned first, unsigned n);
5161         __isl_give isl_set *
5162         isl_set_drop_constraints_not_involving_dims(
5163                 __isl_take isl_set *set,
5164                 enum isl_dim_type type,
5165                 unsigned first, unsigned n);
5167         #include <isl/map.h>
5168         __isl_give isl_basic_map *
5169         isl_basic_map_drop_constraints_involving_dims(
5170                 __isl_take isl_basic_map *bmap,
5171                 enum isl_dim_type type,
5172                 unsigned first, unsigned n);
5173         __isl_give isl_basic_map *
5174         isl_basic_map_drop_constraints_not_involving_dims(
5175                 __isl_take isl_basic_map *bmap,
5176                 enum isl_dim_type type,
5177                 unsigned first, unsigned n);
5178         __isl_give isl_map *
5179         isl_map_drop_constraints_involving_dims(
5180                 __isl_take isl_map *map,
5181                 enum isl_dim_type type,
5182                 unsigned first, unsigned n);
5183         __isl_give isl_map *
5184         isl_map_drop_constraints_not_involving_dims(
5185                 __isl_take isl_map *map,
5186                 enum isl_dim_type type,
5187                 unsigned first, unsigned n);
5189 These functions drop any constraints (not) involving the specified dimensions.
5190 Note that the result depends on the representation of the input.
5192         #include <isl/polynomial.h>
5193         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
5194                 __isl_take isl_pw_qpolynomial *pwqp, int sign);
5195         __isl_give isl_union_pw_qpolynomial *
5196         isl_union_pw_qpolynomial_to_polynomial(
5197                 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
5199 Approximate each quasipolynomial by a polynomial.  If C<sign> is positive,
5200 the polynomial will be an overapproximation.  If C<sign> is negative,
5201 it will be an underapproximation.  If C<sign> is zero, the approximation
5202 will lie somewhere in between.
5204 =item * Feasibility
5206         __isl_give isl_basic_set *isl_basic_set_sample(
5207                 __isl_take isl_basic_set *bset);
5208         __isl_give isl_basic_set *isl_set_sample(
5209                 __isl_take isl_set *set);
5210         __isl_give isl_basic_map *isl_basic_map_sample(
5211                 __isl_take isl_basic_map *bmap);
5212         __isl_give isl_basic_map *isl_map_sample(
5213                 __isl_take isl_map *map);
5215 If the input (basic) set or relation is non-empty, then return
5216 a singleton subset of the input.  Otherwise, return an empty set.
5218 =item * Optimization
5220         #include <isl/ilp.h>
5221         __isl_give isl_val *isl_basic_set_max_val(
5222                 __isl_keep isl_basic_set *bset,
5223                 __isl_keep isl_aff *obj);
5224         __isl_give isl_val *isl_set_min_val(
5225                 __isl_keep isl_set *set,
5226                 __isl_keep isl_aff *obj);
5227         __isl_give isl_val *isl_set_max_val(
5228                 __isl_keep isl_set *set,
5229                 __isl_keep isl_aff *obj);
5230         __isl_give isl_multi_val *
5231         isl_union_set_min_multi_union_pw_aff(
5232                 __isl_keep isl_union_set *set,
5233                 __isl_keep isl_multi_union_pw_aff *obj);
5235 Compute the minimum or maximum of the integer affine expression C<obj>
5236 over the points in C<set>, returning the result in C<opt>.
5237 The result is C<NULL> in case of an error, the optimal value in case
5238 there is one, negative infinity or infinity if the problem is unbounded and
5239 NaN if the problem is empty.
5241         #include <isl/ilp.h>
5242         __isl_give isl_val *isl_basic_set_dim_max_val(
5243                 __isl_take isl_basic_set *bset, int pos);
5245 Return the maximal value attained by the given set dimension,
5246 independently of the parameter values and of any other dimensions.
5247 The result is C<NULL> in case of an error, the optimal value in case
5248 there is one, infinity if the problem is unbounded and
5249 NaN if the input is empty.
5251 =item * Parametric optimization
5253         __isl_give isl_pw_aff *isl_set_dim_min(
5254                 __isl_take isl_set *set, int pos);
5255         __isl_give isl_pw_aff *isl_set_dim_max(
5256                 __isl_take isl_set *set, int pos);
5257         __isl_give isl_pw_aff *isl_map_dim_min(
5258                 __isl_take isl_map *map, int pos);
5259         __isl_give isl_pw_aff *isl_map_dim_max(
5260                 __isl_take isl_map *map, int pos);
5262 Compute the minimum or maximum of the given set or output dimension
5263 as a function of the parameters (and input dimensions), but independently
5264 of the other set or output dimensions.
5265 For lexicographic optimization, see L<"Lexicographic Optimization">.
5267 =item * Dual
5269 The following functions compute either the set of (rational) coefficient
5270 values of valid constraints for the given set or the set of (rational)
5271 values satisfying the constraints with coefficients from the given set.
5272 Internally, these two sets of functions perform essentially the
5273 same operations, except that the set of coefficients is assumed to
5274 be a cone, while the set of values may be any polyhedron.
5275 The current implementation is based on the Farkas lemma and
5276 Fourier-Motzkin elimination, but this may change or be made optional
5277 in future.  In particular, future implementations may use different
5278 dualization algorithms or skip the elimination step.
5280         #include <isl/set.h>
5281         __isl_give isl_basic_set *isl_basic_set_coefficients(
5282                 __isl_take isl_basic_set *bset);
5283         __isl_give isl_basic_set_list *
5284         isl_basic_set_list_coefficients(
5285                 __isl_take isl_basic_set_list *list);
5286         __isl_give isl_basic_set *isl_set_coefficients(
5287                 __isl_take isl_set *set);
5288         __isl_give isl_union_set *isl_union_set_coefficients(
5289                 __isl_take isl_union_set *bset);
5290         __isl_give isl_basic_set *isl_basic_set_solutions(
5291                 __isl_take isl_basic_set *bset);
5292         __isl_give isl_basic_set *isl_set_solutions(
5293                 __isl_take isl_set *set);
5294         __isl_give isl_union_set *isl_union_set_solutions(
5295                 __isl_take isl_union_set *bset);
5297 =item * Power
5299         __isl_give isl_map *isl_map_fixed_power_val(
5300                 __isl_take isl_map *map,
5301                 __isl_take isl_val *exp);
5302         __isl_give isl_union_map *
5303         isl_union_map_fixed_power_val(
5304                 __isl_take isl_union_map *umap,
5305                 __isl_take isl_val *exp);
5307 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
5308 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
5309 of C<map> is computed.
5311         __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
5312                 int *exact);
5313         __isl_give isl_union_map *isl_union_map_power(
5314                 __isl_take isl_union_map *umap, int *exact);
5316 Compute a parametric representation for all positive powers I<k> of C<map>.
5317 The result maps I<k> to a nested relation corresponding to the
5318 I<k>th power of C<map>.
5319 The result may be an overapproximation.  If the result is known to be exact,
5320 then C<*exact> is set to C<1>.
5322 =item * Transitive closure
5324         __isl_give isl_map *isl_map_transitive_closure(
5325                 __isl_take isl_map *map, int *exact);
5326         __isl_give isl_union_map *isl_union_map_transitive_closure(
5327                 __isl_take isl_union_map *umap, int *exact);
5329 Compute the transitive closure of C<map>.
5330 The result may be an overapproximation.  If the result is known to be exact,
5331 then C<*exact> is set to C<1>.
5333 =item * Reaching path lengths
5335         __isl_give isl_map *isl_map_reaching_path_lengths(
5336                 __isl_take isl_map *map, int *exact);
5338 Compute a relation that maps each element in the range of C<map>
5339 to the lengths of all paths composed of edges in C<map> that
5340 end up in the given element.
5341 The result may be an overapproximation.  If the result is known to be exact,
5342 then C<*exact> is set to C<1>.
5343 To compute the I<maximal> path length, the resulting relation
5344 should be postprocessed by C<isl_map_lexmax>.
5345 In particular, if the input relation is a dependence relation
5346 (mapping sources to sinks), then the maximal path length corresponds
5347 to the free schedule.
5348 Note, however, that C<isl_map_lexmax> expects the maximum to be
5349 finite, so if the path lengths are unbounded (possibly due to
5350 the overapproximation), then you will get an error message.
5352 =item * Wrapping
5354         #include <isl/space.h>
5355         __isl_give isl_space *isl_space_wrap(
5356                 __isl_take isl_space *space);
5357         __isl_give isl_space *isl_space_unwrap(
5358                 __isl_take isl_space *space);
5360         #include <isl/local_space.h>
5361         __isl_give isl_local_space *isl_local_space_wrap(
5362                 __isl_take isl_local_space *ls);
5364         #include <isl/set.h>
5365         __isl_give isl_basic_map *isl_basic_set_unwrap(
5366                 __isl_take isl_basic_set *bset);
5367         __isl_give isl_map *isl_set_unwrap(
5368                 __isl_take isl_set *set);
5370         #include <isl/map.h>
5371         __isl_give isl_basic_set *isl_basic_map_wrap(
5372                 __isl_take isl_basic_map *bmap);
5373         __isl_give isl_set *isl_map_wrap(
5374                 __isl_take isl_map *map);
5376         #include <isl/union_set.h>
5377         __isl_give isl_union_map *isl_union_set_unwrap(
5378                 __isl_take isl_union_set *uset);
5380         #include <isl/union_map.h>
5381         __isl_give isl_union_set *isl_union_map_wrap(
5382                 __isl_take isl_union_map *umap);
5384 The input to C<isl_space_unwrap> should
5385 be the space of a set, while that of
5386 C<isl_space_wrap> should be the space of a relation.
5387 Conversely, the output of C<isl_space_unwrap> is the space
5388 of a relation, while that of C<isl_space_wrap> is the space of a set.
5390 =item * Flattening
5392 Remove any internal structure of domain (and range) of the given
5393 set or relation.  If there is any such internal structure in the input,
5394 then the name of the space is also removed.
5396         #include <isl/space.h>
5397         __isl_give isl_space *isl_space_flatten_domain(
5398                 __isl_take isl_space *space);
5399         __isl_give isl_space *isl_space_flatten_range(
5400                 __isl_take isl_space *space);
5402         #include <isl/local_space.h>
5403         __isl_give isl_local_space *
5404         isl_local_space_flatten_domain(
5405                 __isl_take isl_local_space *ls);
5406         __isl_give isl_local_space *
5407         isl_local_space_flatten_range(
5408                 __isl_take isl_local_space *ls);
5410         #include <isl/set.h>
5411         __isl_give isl_basic_set *isl_basic_set_flatten(
5412                 __isl_take isl_basic_set *bset);
5413         __isl_give isl_set *isl_set_flatten(
5414                 __isl_take isl_set *set);
5416         #include <isl/map.h>
5417         __isl_give isl_basic_map *isl_basic_map_flatten_domain(
5418                 __isl_take isl_basic_map *bmap);
5419         __isl_give isl_basic_map *isl_basic_map_flatten_range(
5420                 __isl_take isl_basic_map *bmap);
5421         __isl_give isl_map *isl_map_flatten_range(
5422                 __isl_take isl_map *map);
5423         __isl_give isl_map *isl_map_flatten_domain(
5424                 __isl_take isl_map *map);
5425         __isl_give isl_basic_map *isl_basic_map_flatten(
5426                 __isl_take isl_basic_map *bmap);
5427         __isl_give isl_map *isl_map_flatten(
5428                 __isl_take isl_map *map);
5430         #include <isl/val.h>
5431         __isl_give isl_multi_val *isl_multi_val_flatten_range(
5432                 __isl_take isl_multi_val *mv);
5434         #include <isl/aff.h>
5435         __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
5436                 __isl_take isl_multi_aff *ma);
5437         __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
5438                 __isl_take isl_multi_aff *ma);
5439         __isl_give isl_multi_pw_aff *
5440         isl_multi_pw_aff_flatten_range(
5441                 __isl_take isl_multi_pw_aff *mpa);
5442         __isl_give isl_multi_union_pw_aff *
5443         isl_multi_union_pw_aff_flatten_range(
5444                 __isl_take isl_multi_union_pw_aff *mupa);
5446         #include <isl/map.h>
5447         __isl_give isl_map *isl_set_flatten_map(
5448                 __isl_take isl_set *set);
5450 The function above constructs a relation
5451 that maps the input set to a flattened version of the set.
5453 =item * Lifting
5455 Lift the input set to a space with extra dimensions corresponding
5456 to the existentially quantified variables in the input.
5457 In particular, the result lives in a wrapped map where the domain
5458 is the original space and the range corresponds to the original
5459 existentially quantified variables.
5461         #include <isl/set.h>
5462         __isl_give isl_basic_set *isl_basic_set_lift(
5463                 __isl_take isl_basic_set *bset);
5464         __isl_give isl_set *isl_set_lift(
5465                 __isl_take isl_set *set);
5466         __isl_give isl_union_set *isl_union_set_lift(
5467                 __isl_take isl_union_set *uset);
5469 Given a local space that contains the existentially quantified
5470 variables of a set, a basic relation that, when applied to
5471 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
5472 can be constructed using the following function.
5474         #include <isl/local_space.h>
5475         __isl_give isl_basic_map *isl_local_space_lifting(
5476                 __isl_take isl_local_space *ls);
5478         #include <isl/aff.h>
5479         __isl_give isl_multi_aff *isl_multi_aff_lift(
5480                 __isl_take isl_multi_aff *maff,
5481                 __isl_give isl_local_space **ls);
5483 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
5484 then it is assigned the local space that lies at the basis of
5485 the lifting applied.
5487 =item * Internal Product
5489         #include <isl/space.h>
5490         __isl_give isl_space *isl_space_zip(
5491                 __isl_take isl_space *space);
5493         #include <isl/map.h>
5494         __isl_give isl_basic_map *isl_basic_map_zip(
5495                 __isl_take isl_basic_map *bmap);
5496         __isl_give isl_map *isl_map_zip(
5497                 __isl_take isl_map *map);
5499         #include <isl/union_map.h>
5500         __isl_give isl_union_map *isl_union_map_zip(
5501                 __isl_take isl_union_map *umap);
5503 Given a relation with nested relations for domain and range,
5504 interchange the range of the domain with the domain of the range.
5506 =item * Currying
5508         #include <isl/space.h>
5509         __isl_give isl_space *isl_space_curry(
5510                 __isl_take isl_space *space);
5511         __isl_give isl_space *isl_space_uncurry(
5512                 __isl_take isl_space *space);
5514         #include <isl/map.h>
5515         __isl_give isl_basic_map *isl_basic_map_curry(
5516                 __isl_take isl_basic_map *bmap);
5517         __isl_give isl_basic_map *isl_basic_map_uncurry(
5518                 __isl_take isl_basic_map *bmap);
5519         __isl_give isl_map *isl_map_curry(
5520                 __isl_take isl_map *map);
5521         __isl_give isl_map *isl_map_uncurry(
5522                 __isl_take isl_map *map);
5524         #include <isl/union_map.h>
5525         __isl_give isl_union_map *isl_union_map_curry(
5526                 __isl_take isl_union_map *umap);
5527         __isl_give isl_union_map *isl_union_map_uncurry(
5528                 __isl_take isl_union_map *umap);
5530 Given a relation with a nested relation for domain,
5531 the C<curry> functions
5532 move the range of the nested relation out of the domain
5533 and use it as the domain of a nested relation in the range,
5534 with the original range as range of this nested relation.
5535 The C<uncurry> functions perform the inverse operation.
5537         #include <isl/space.h>
5538         __isl_give isl_space *isl_space_range_curry(
5539                 __isl_take isl_space *space);
5541         #include <isl/map.h>
5542         __isl_give isl_map *isl_map_range_curry(
5543                 __isl_take isl_map *map);
5545         #include <isl/union_map.h>
5546         __isl_give isl_union_map *isl_union_map_range_curry(
5547                 __isl_take isl_union_map *umap);
5549 These functions apply the currying to the relation that
5550 is nested inside the range of the input.
5552 =item * Aligning parameters
5554 Change the order of the parameters of the given set, relation
5555 or function
5556 such that the first parameters match those of C<model>.
5557 This may involve the introduction of extra parameters.
5558 All parameters need to be named.
5560         #include <isl/space.h>
5561         __isl_give isl_space *isl_space_align_params(
5562                 __isl_take isl_space *space1,
5563                 __isl_take isl_space *space2)
5565         #include <isl/set.h>
5566         __isl_give isl_basic_set *isl_basic_set_align_params(
5567                 __isl_take isl_basic_set *bset,
5568                 __isl_take isl_space *model);
5569         __isl_give isl_set *isl_set_align_params(
5570                 __isl_take isl_set *set,
5571                 __isl_take isl_space *model);
5573         #include <isl/map.h>
5574         __isl_give isl_basic_map *isl_basic_map_align_params(
5575                 __isl_take isl_basic_map *bmap,
5576                 __isl_take isl_space *model);
5577         __isl_give isl_map *isl_map_align_params(
5578                 __isl_take isl_map *map,
5579                 __isl_take isl_space *model);
5581         #include <isl/val.h>
5582         __isl_give isl_multi_val *isl_multi_val_align_params(
5583                 __isl_take isl_multi_val *mv,
5584                 __isl_take isl_space *model);
5586         #include <isl/aff.h>
5587         __isl_give isl_aff *isl_aff_align_params(
5588                 __isl_take isl_aff *aff,
5589                 __isl_take isl_space *model);
5590         __isl_give isl_multi_aff *isl_multi_aff_align_params(
5591                 __isl_take isl_multi_aff *multi,
5592                 __isl_take isl_space *model);
5593         __isl_give isl_pw_aff *isl_pw_aff_align_params(
5594                 __isl_take isl_pw_aff *pwaff,
5595                 __isl_take isl_space *model);
5596         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
5597                 __isl_take isl_pw_multi_aff *pma,
5598                 __isl_take isl_space *model);
5599         __isl_give isl_union_pw_aff *
5600         isl_union_pw_aff_align_params(
5601                 __isl_take isl_union_pw_aff *upa,
5602                 __isl_take isl_space *model);
5603         __isl_give isl_union_pw_multi_aff *
5604         isl_union_pw_multi_aff_align_params(
5605                 __isl_take isl_union_pw_multi_aff *upma,
5606                 __isl_take isl_space *model);
5607         __isl_give isl_multi_union_pw_aff *
5608         isl_multi_union_pw_aff_align_params(
5609                 __isl_take isl_multi_union_pw_aff *mupa,
5610                 __isl_take isl_space *model);
5612         #include <isl/polynomial.h>
5613         __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
5614                 __isl_take isl_qpolynomial *qp,
5615                 __isl_take isl_space *model);
5617 =item * Unary Arithmetic Operations
5619         #include <isl/set.h>
5620         __isl_give isl_set *isl_set_neg(
5621                 __isl_take isl_set *set);
5622         #include <isl/map.h>
5623         __isl_give isl_map *isl_map_neg(
5624                 __isl_take isl_map *map);
5626 C<isl_set_neg> constructs a set containing the opposites of
5627 the elements in its argument.
5628 The domain of the result of C<isl_map_neg> is the same
5629 as the domain of its argument.  The corresponding range
5630 elements are the opposites of the corresponding range
5631 elements in the argument.
5633         #include <isl/val.h>
5634         __isl_give isl_multi_val *isl_multi_val_neg(
5635                 __isl_take isl_multi_val *mv);
5637         #include <isl/aff.h>
5638         __isl_give isl_aff *isl_aff_neg(
5639                 __isl_take isl_aff *aff);
5640         __isl_give isl_multi_aff *isl_multi_aff_neg(
5641                 __isl_take isl_multi_aff *ma);
5642         __isl_give isl_pw_aff *isl_pw_aff_neg(
5643                 __isl_take isl_pw_aff *pwaff);
5644         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
5645                 __isl_take isl_pw_multi_aff *pma);
5646         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
5647                 __isl_take isl_multi_pw_aff *mpa);
5648         __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
5649                 __isl_take isl_union_pw_aff *upa);
5650         __isl_give isl_union_pw_multi_aff *
5651         isl_union_pw_multi_aff_neg(
5652                 __isl_take isl_union_pw_multi_aff *upma);
5653         __isl_give isl_multi_union_pw_aff *
5654         isl_multi_union_pw_aff_neg(
5655                 __isl_take isl_multi_union_pw_aff *mupa);
5656         __isl_give isl_aff *isl_aff_ceil(
5657                 __isl_take isl_aff *aff);
5658         __isl_give isl_pw_aff *isl_pw_aff_ceil(
5659                 __isl_take isl_pw_aff *pwaff);
5660         __isl_give isl_aff *isl_aff_floor(
5661                 __isl_take isl_aff *aff);
5662         __isl_give isl_multi_aff *isl_multi_aff_floor(
5663                 __isl_take isl_multi_aff *ma);
5664         __isl_give isl_pw_aff *isl_pw_aff_floor(
5665                 __isl_take isl_pw_aff *pwaff);
5666         __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
5667                 __isl_take isl_union_pw_aff *upa);
5668         __isl_give isl_multi_union_pw_aff *
5669         isl_multi_union_pw_aff_floor(
5670                 __isl_take isl_multi_union_pw_aff *mupa);
5672         #include <isl/aff.h>
5673         __isl_give isl_pw_aff *isl_pw_aff_list_min(
5674                 __isl_take isl_pw_aff_list *list);
5675         __isl_give isl_pw_aff *isl_pw_aff_list_max(
5676                 __isl_take isl_pw_aff_list *list);
5678         #include <isl/polynomial.h>
5679         __isl_give isl_qpolynomial *isl_qpolynomial_neg(
5680                 __isl_take isl_qpolynomial *qp);
5681         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
5682                 __isl_take isl_pw_qpolynomial *pwqp);
5683         __isl_give isl_union_pw_qpolynomial *
5684         isl_union_pw_qpolynomial_neg(
5685                 __isl_take isl_union_pw_qpolynomial *upwqp);
5686         __isl_give isl_qpolynomial *isl_qpolynomial_pow(
5687                 __isl_take isl_qpolynomial *qp,
5688                 unsigned exponent);
5689         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
5690                 __isl_take isl_pw_qpolynomial *pwqp,
5691                 unsigned exponent);
5693 =item * Evaluation
5695 The following functions evaluate a function in a point.
5697         #include <isl/polynomial.h>
5698         __isl_give isl_val *isl_pw_qpolynomial_eval(
5699                 __isl_take isl_pw_qpolynomial *pwqp,
5700                 __isl_take isl_point *pnt);
5701         __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
5702                 __isl_take isl_pw_qpolynomial_fold *pwf,
5703                 __isl_take isl_point *pnt);
5704         __isl_give isl_val *isl_union_pw_qpolynomial_eval(
5705                 __isl_take isl_union_pw_qpolynomial *upwqp,
5706                 __isl_take isl_point *pnt);
5707         __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
5708                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5709                 __isl_take isl_point *pnt);
5711 =item * Dimension manipulation
5713 It is usually not advisable to directly change the (input or output)
5714 space of a set or a relation as this removes the name and the internal
5715 structure of the space.  However, the functions below can be useful
5716 to add new parameters, assuming
5717 C<isl_set_align_params> and C<isl_map_align_params>
5718 are not sufficient.
5720         #include <isl/space.h>
5721         __isl_give isl_space *isl_space_add_dims(
5722                 __isl_take isl_space *space,
5723                 enum isl_dim_type type, unsigned n);
5724         __isl_give isl_space *isl_space_insert_dims(
5725                 __isl_take isl_space *space,
5726                 enum isl_dim_type type, unsigned pos, unsigned n);
5727         __isl_give isl_space *isl_space_drop_dims(
5728                 __isl_take isl_space *space,
5729                 enum isl_dim_type type, unsigned first, unsigned n);
5730         __isl_give isl_space *isl_space_move_dims(
5731                 __isl_take isl_space *space,
5732                 enum isl_dim_type dst_type, unsigned dst_pos,
5733                 enum isl_dim_type src_type, unsigned src_pos,
5734                 unsigned n);
5736         #include <isl/local_space.h>
5737         __isl_give isl_local_space *isl_local_space_add_dims(
5738                 __isl_take isl_local_space *ls,
5739                 enum isl_dim_type type, unsigned n);
5740         __isl_give isl_local_space *isl_local_space_insert_dims(
5741                 __isl_take isl_local_space *ls,
5742                 enum isl_dim_type type, unsigned first, unsigned n);
5743         __isl_give isl_local_space *isl_local_space_drop_dims(
5744                 __isl_take isl_local_space *ls,
5745                 enum isl_dim_type type, unsigned first, unsigned n);
5747         #include <isl/set.h>
5748         __isl_give isl_basic_set *isl_basic_set_add_dims(
5749                 __isl_take isl_basic_set *bset,
5750                 enum isl_dim_type type, unsigned n);
5751         __isl_give isl_set *isl_set_add_dims(
5752                 __isl_take isl_set *set,
5753                 enum isl_dim_type type, unsigned n);
5754         __isl_give isl_basic_set *isl_basic_set_insert_dims(
5755                 __isl_take isl_basic_set *bset,
5756                 enum isl_dim_type type, unsigned pos,
5757                 unsigned n);
5758         __isl_give isl_set *isl_set_insert_dims(
5759                 __isl_take isl_set *set,
5760                 enum isl_dim_type type, unsigned pos, unsigned n);
5761         __isl_give isl_basic_set *isl_basic_set_move_dims(
5762                 __isl_take isl_basic_set *bset,
5763                 enum isl_dim_type dst_type, unsigned dst_pos,
5764                 enum isl_dim_type src_type, unsigned src_pos,
5765                 unsigned n);
5766         __isl_give isl_set *isl_set_move_dims(
5767                 __isl_take isl_set *set,
5768                 enum isl_dim_type dst_type, unsigned dst_pos,
5769                 enum isl_dim_type src_type, unsigned src_pos,
5770                 unsigned n);
5772         #include <isl/map.h>
5773         __isl_give isl_basic_map *isl_basic_map_add_dims(
5774                 __isl_take isl_basic_map *bmap,
5775                 enum isl_dim_type type, unsigned n);
5776         __isl_give isl_map *isl_map_add_dims(
5777                 __isl_take isl_map *map,
5778                 enum isl_dim_type type, unsigned n);
5779         __isl_give isl_basic_map *isl_basic_map_insert_dims(
5780                 __isl_take isl_basic_map *bmap,
5781                 enum isl_dim_type type, unsigned pos,
5782                 unsigned n);
5783         __isl_give isl_map *isl_map_insert_dims(
5784                 __isl_take isl_map *map,
5785                 enum isl_dim_type type, unsigned pos, unsigned n);
5786         __isl_give isl_basic_map *isl_basic_map_move_dims(
5787                 __isl_take isl_basic_map *bmap,
5788                 enum isl_dim_type dst_type, unsigned dst_pos,
5789                 enum isl_dim_type src_type, unsigned src_pos,
5790                 unsigned n);
5791         __isl_give isl_map *isl_map_move_dims(
5792                 __isl_take isl_map *map,
5793                 enum isl_dim_type dst_type, unsigned dst_pos,
5794                 enum isl_dim_type src_type, unsigned src_pos,
5795                 unsigned n);
5797         #include <isl/val.h>
5798         __isl_give isl_multi_val *isl_multi_val_insert_dims(
5799                 __isl_take isl_multi_val *mv,
5800                 enum isl_dim_type type, unsigned first, unsigned n);
5801         __isl_give isl_multi_val *isl_multi_val_add_dims(
5802                 __isl_take isl_multi_val *mv,
5803                 enum isl_dim_type type, unsigned n);
5804         __isl_give isl_multi_val *isl_multi_val_drop_dims(
5805                 __isl_take isl_multi_val *mv,
5806                 enum isl_dim_type type, unsigned first, unsigned n);
5808         #include <isl/aff.h>
5809         __isl_give isl_aff *isl_aff_insert_dims(
5810                 __isl_take isl_aff *aff,
5811                 enum isl_dim_type type, unsigned first, unsigned n);
5812         __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
5813                 __isl_take isl_multi_aff *ma,
5814                 enum isl_dim_type type, unsigned first, unsigned n);
5815         __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
5816                 __isl_take isl_pw_aff *pwaff,
5817                 enum isl_dim_type type, unsigned first, unsigned n);
5818         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
5819                 __isl_take isl_multi_pw_aff *mpa,
5820                 enum isl_dim_type type, unsigned first, unsigned n);
5821         __isl_give isl_aff *isl_aff_add_dims(
5822                 __isl_take isl_aff *aff,
5823                 enum isl_dim_type type, unsigned n);
5824         __isl_give isl_multi_aff *isl_multi_aff_add_dims(
5825                 __isl_take isl_multi_aff *ma,
5826                 enum isl_dim_type type, unsigned n);
5827         __isl_give isl_pw_aff *isl_pw_aff_add_dims(
5828                 __isl_take isl_pw_aff *pwaff,
5829                 enum isl_dim_type type, unsigned n);
5830         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
5831                 __isl_take isl_multi_pw_aff *mpa,
5832                 enum isl_dim_type type, unsigned n);
5833         __isl_give isl_aff *isl_aff_drop_dims(
5834                 __isl_take isl_aff *aff,
5835                 enum isl_dim_type type, unsigned first, unsigned n);
5836         __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
5837                 __isl_take isl_multi_aff *maff,
5838                 enum isl_dim_type type, unsigned first, unsigned n);
5839         __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
5840                 __isl_take isl_pw_aff *pwaff,
5841                 enum isl_dim_type type, unsigned first, unsigned n);
5842         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
5843                 __isl_take isl_pw_multi_aff *pma,
5844                 enum isl_dim_type type, unsigned first, unsigned n);
5845         __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
5846                 __isl_take isl_union_pw_aff *upa,
5847                 enum isl_dim_type type, unsigned first, unsigned n);
5848         __isl_give isl_union_pw_multi_aff *
5849                 isl_union_pw_multi_aff_drop_dims(
5850                 __isl_take isl_union_pw_multi_aff *upma,
5851                 enum isl_dim_type type,
5852                 unsigned first, unsigned n);
5853         __isl_give isl_multi_union_pw_aff *
5854         isl_multi_union_pw_aff_drop_dims(
5855                 __isl_take isl_multi_union_pw_aff *mupa,
5856                 enum isl_dim_type type, unsigned first,
5857                 unsigned n);
5858         __isl_give isl_aff *isl_aff_move_dims(
5859                 __isl_take isl_aff *aff,
5860                 enum isl_dim_type dst_type, unsigned dst_pos,
5861                 enum isl_dim_type src_type, unsigned src_pos,
5862                 unsigned n);
5863         __isl_give isl_multi_aff *isl_multi_aff_move_dims(
5864                 __isl_take isl_multi_aff *ma,
5865                 enum isl_dim_type dst_type, unsigned dst_pos,
5866                 enum isl_dim_type src_type, unsigned src_pos,
5867                 unsigned n);
5868         __isl_give isl_pw_aff *isl_pw_aff_move_dims(
5869                 __isl_take isl_pw_aff *pa,
5870                 enum isl_dim_type dst_type, unsigned dst_pos,
5871                 enum isl_dim_type src_type, unsigned src_pos,
5872                 unsigned n);
5873         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
5874                 __isl_take isl_multi_pw_aff *pma,
5875                 enum isl_dim_type dst_type, unsigned dst_pos,
5876                 enum isl_dim_type src_type, unsigned src_pos,
5877                 unsigned n);
5879         #include <isl/polynomial.h>
5880         __isl_give isl_union_pw_qpolynomial *
5881         isl_union_pw_qpolynomial_drop_dims(
5882                 __isl_take isl_union_pw_qpolynomial *upwqp,
5883                 enum isl_dim_type type,
5884                 unsigned first, unsigned n);
5885         __isl_give isl_union_pw_qpolynomial_fold *
5886                 isl_union_pw_qpolynomial_fold_drop_dims(
5887                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5888                 enum isl_dim_type type,
5889                 unsigned first, unsigned n);
5891 The operations on union expressions can only manipulate parameters.
5893 =back
5895 =head2 Binary Operations
5897 The two arguments of a binary operation not only need to live
5898 in the same C<isl_ctx>, they currently also need to have
5899 the same (number of) parameters.
5901 =head3 Basic Operations
5903 =over
5905 =item * Intersection
5907         #include <isl/local_space.h>
5908         __isl_give isl_local_space *isl_local_space_intersect(
5909                 __isl_take isl_local_space *ls1,
5910                 __isl_take isl_local_space *ls2);
5912         #include <isl/set.h>
5913         __isl_give isl_basic_set *isl_basic_set_intersect_params(
5914                 __isl_take isl_basic_set *bset1,
5915                 __isl_take isl_basic_set *bset2);
5916         __isl_give isl_basic_set *isl_basic_set_intersect(
5917                 __isl_take isl_basic_set *bset1,
5918                 __isl_take isl_basic_set *bset2);
5919         __isl_give isl_basic_set *isl_basic_set_list_intersect(
5920                 __isl_take struct isl_basic_set_list *list);
5921         __isl_give isl_set *isl_set_intersect_params(
5922                 __isl_take isl_set *set,
5923                 __isl_take isl_set *params);
5924         __isl_give isl_set *isl_set_intersect(
5925                 __isl_take isl_set *set1,
5926                 __isl_take isl_set *set2);
5928         #include <isl/map.h>
5929         __isl_give isl_basic_map *isl_basic_map_intersect_domain(
5930                 __isl_take isl_basic_map *bmap,
5931                 __isl_take isl_basic_set *bset);
5932         __isl_give isl_basic_map *isl_basic_map_intersect_range(
5933                 __isl_take isl_basic_map *bmap,
5934                 __isl_take isl_basic_set *bset);
5935         __isl_give isl_basic_map *isl_basic_map_intersect(
5936                 __isl_take isl_basic_map *bmap1,
5937                 __isl_take isl_basic_map *bmap2);
5938         __isl_give isl_basic_map *isl_basic_map_list_intersect(
5939                 __isl_take isl_basic_map_list *list);
5940         __isl_give isl_map *isl_map_intersect_params(
5941                 __isl_take isl_map *map,
5942                 __isl_take isl_set *params);
5943         __isl_give isl_map *isl_map_intersect_domain(
5944                 __isl_take isl_map *map,
5945                 __isl_take isl_set *set);
5946         __isl_give isl_map *isl_map_intersect_range(
5947                 __isl_take isl_map *map,
5948                 __isl_take isl_set *set);
5949         __isl_give isl_map *isl_map_intersect(
5950                 __isl_take isl_map *map1,
5951                 __isl_take isl_map *map2);
5952         __isl_give isl_map *
5953         isl_map_intersect_domain_factor_range(
5954                 __isl_take isl_map *map,
5955                 __isl_take isl_map *factor);
5956         __isl_give isl_map *
5957         isl_map_intersect_range_factor_range(
5958                 __isl_take isl_map *map,
5959                 __isl_take isl_map *factor);
5961         #include <isl/union_set.h>
5962         __isl_give isl_union_set *isl_union_set_intersect_params(
5963                 __isl_take isl_union_set *uset,
5964                 __isl_take isl_set *set);
5965         __isl_give isl_union_set *isl_union_set_intersect(
5966                 __isl_take isl_union_set *uset1,
5967                 __isl_take isl_union_set *uset2);
5969         #include <isl/union_map.h>
5970         __isl_give isl_union_map *isl_union_map_intersect_params(
5971                 __isl_take isl_union_map *umap,
5972                 __isl_take isl_set *set);
5973         __isl_give isl_union_map *isl_union_map_intersect_domain(
5974                 __isl_take isl_union_map *umap,
5975                 __isl_take isl_union_set *uset);
5976         __isl_give isl_union_map *isl_union_map_intersect_range(
5977                 __isl_take isl_union_map *umap,
5978                 __isl_take isl_union_set *uset);
5979         __isl_give isl_union_map *isl_union_map_intersect(
5980                 __isl_take isl_union_map *umap1,
5981                 __isl_take isl_union_map *umap2);
5982         __isl_give isl_union_map *
5983         isl_union_map_intersect_range_factor_range(
5984                 __isl_take isl_union_map *umap,
5985                 __isl_take isl_union_map *factor);
5987         #include <isl/aff.h>
5988         __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
5989                 __isl_take isl_pw_aff *pa,
5990                 __isl_take isl_set *set);
5991         __isl_give isl_multi_pw_aff *
5992         isl_multi_pw_aff_intersect_domain(
5993                 __isl_take isl_multi_pw_aff *mpa,
5994                 __isl_take isl_set *domain);
5995         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
5996                 __isl_take isl_pw_multi_aff *pma,
5997                 __isl_take isl_set *set);
5998         __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
5999                 __isl_take isl_union_pw_aff *upa,
6000                 __isl_take isl_union_set *uset);
6001         __isl_give isl_union_pw_multi_aff *
6002         isl_union_pw_multi_aff_intersect_domain(
6003                 __isl_take isl_union_pw_multi_aff *upma,
6004                 __isl_take isl_union_set *uset);
6005         __isl_give isl_multi_union_pw_aff *
6006         isl_multi_union_pw_aff_intersect_domain(
6007                 __isl_take isl_multi_union_pw_aff *mupa,
6008                 __isl_take isl_union_set *uset);
6009         __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
6010                 __isl_take isl_pw_aff *pa,
6011                 __isl_take isl_set *set);
6012         __isl_give isl_multi_pw_aff *
6013         isl_multi_pw_aff_intersect_params(
6014                 __isl_take isl_multi_pw_aff *mpa,
6015                 __isl_take isl_set *set);
6016         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
6017                 __isl_take isl_pw_multi_aff *pma,
6018                 __isl_take isl_set *set);
6019         __isl_give isl_union_pw_aff *
6020         isl_union_pw_aff_intersect_params(
6021                 __isl_take isl_union_pw_aff *upa,
6022         __isl_give isl_union_pw_multi_aff *
6023         isl_union_pw_multi_aff_intersect_params(
6024                 __isl_take isl_union_pw_multi_aff *upma,
6025                 __isl_take isl_set *set);
6026         __isl_give isl_multi_union_pw_aff *
6027         isl_multi_union_pw_aff_intersect_params(
6028                 __isl_take isl_multi_union_pw_aff *mupa,
6029                 __isl_take isl_set *params);
6030         isl_multi_union_pw_aff_intersect_range(
6031                 __isl_take isl_multi_union_pw_aff *mupa,
6032                 __isl_take isl_set *set);
6034         #include <isl/polynomial.h>
6035         __isl_give isl_pw_qpolynomial *
6036         isl_pw_qpolynomial_intersect_domain(
6037                 __isl_take isl_pw_qpolynomial *pwpq,
6038                 __isl_take isl_set *set);
6039         __isl_give isl_union_pw_qpolynomial *
6040         isl_union_pw_qpolynomial_intersect_domain(
6041                 __isl_take isl_union_pw_qpolynomial *upwpq,
6042                 __isl_take isl_union_set *uset);
6043         __isl_give isl_union_pw_qpolynomial_fold *
6044         isl_union_pw_qpolynomial_fold_intersect_domain(
6045                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6046                 __isl_take isl_union_set *uset);
6047         __isl_give isl_pw_qpolynomial *
6048         isl_pw_qpolynomial_intersect_params(
6049                 __isl_take isl_pw_qpolynomial *pwpq,
6050                 __isl_take isl_set *set);
6051         __isl_give isl_pw_qpolynomial_fold *
6052         isl_pw_qpolynomial_fold_intersect_params(
6053                 __isl_take isl_pw_qpolynomial_fold *pwf,
6054                 __isl_take isl_set *set);
6055         __isl_give isl_union_pw_qpolynomial *
6056         isl_union_pw_qpolynomial_intersect_params(
6057                 __isl_take isl_union_pw_qpolynomial *upwpq,
6058                 __isl_take isl_set *set);
6059         __isl_give isl_union_pw_qpolynomial_fold *
6060         isl_union_pw_qpolynomial_fold_intersect_params(
6061                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6062                 __isl_take isl_set *set);
6064 The second argument to the C<_params> functions needs to be
6065 a parametric (basic) set.  For the other functions, a parametric set
6066 for either argument is only allowed if the other argument is
6067 a parametric set as well.
6068 The list passed to C<isl_basic_set_list_intersect> needs to have
6069 at least one element and all elements need to live in the same space.
6070 The function C<isl_multi_union_pw_aff_intersect_range>
6071 restricts the input function to those shared domain elements
6072 that map to the specified range.
6074 =item * Union
6076         #include <isl/set.h>
6077         __isl_give isl_set *isl_basic_set_union(
6078                 __isl_take isl_basic_set *bset1,
6079                 __isl_take isl_basic_set *bset2);
6080         __isl_give isl_set *isl_set_union(
6081                 __isl_take isl_set *set1,
6082                 __isl_take isl_set *set2);
6083         __isl_give isl_set *isl_set_list_union(
6084                 __isl_take isl_set_list *list);
6086         #include <isl/map.h>
6087         __isl_give isl_map *isl_basic_map_union(
6088                 __isl_take isl_basic_map *bmap1,
6089                 __isl_take isl_basic_map *bmap2);
6090         __isl_give isl_map *isl_map_union(
6091                 __isl_take isl_map *map1,
6092                 __isl_take isl_map *map2);
6094         #include <isl/union_set.h>
6095         __isl_give isl_union_set *isl_union_set_union(
6096                 __isl_take isl_union_set *uset1,
6097                 __isl_take isl_union_set *uset2);
6098         __isl_give isl_union_set *isl_union_set_list_union(
6099                 __isl_take isl_union_set_list *list);
6101         #include <isl/union_map.h>
6102         __isl_give isl_union_map *isl_union_map_union(
6103                 __isl_take isl_union_map *umap1,
6104                 __isl_take isl_union_map *umap2);
6106 The list passed to C<isl_set_list_union> needs to have
6107 at least one element and all elements need to live in the same space.
6109 =item * Set difference
6111         #include <isl/set.h>
6112         __isl_give isl_set *isl_set_subtract(
6113                 __isl_take isl_set *set1,
6114                 __isl_take isl_set *set2);
6116         #include <isl/map.h>
6117         __isl_give isl_map *isl_map_subtract(
6118                 __isl_take isl_map *map1,
6119                 __isl_take isl_map *map2);
6120         __isl_give isl_map *isl_map_subtract_domain(
6121                 __isl_take isl_map *map,
6122                 __isl_take isl_set *dom);
6123         __isl_give isl_map *isl_map_subtract_range(
6124                 __isl_take isl_map *map,
6125                 __isl_take isl_set *dom);
6127         #include <isl/union_set.h>
6128         __isl_give isl_union_set *isl_union_set_subtract(
6129                 __isl_take isl_union_set *uset1,
6130                 __isl_take isl_union_set *uset2);
6132         #include <isl/union_map.h>
6133         __isl_give isl_union_map *isl_union_map_subtract(
6134                 __isl_take isl_union_map *umap1,
6135                 __isl_take isl_union_map *umap2);
6136         __isl_give isl_union_map *isl_union_map_subtract_domain(
6137                 __isl_take isl_union_map *umap,
6138                 __isl_take isl_union_set *dom);
6139         __isl_give isl_union_map *isl_union_map_subtract_range(
6140                 __isl_take isl_union_map *umap,
6141                 __isl_take isl_union_set *dom);
6143         #include <isl/aff.h>
6144         __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
6145                 __isl_take isl_pw_aff *pa,
6146                 __isl_take isl_set *set);
6147         __isl_give isl_pw_multi_aff *
6148         isl_pw_multi_aff_subtract_domain(
6149                 __isl_take isl_pw_multi_aff *pma,
6150                 __isl_take isl_set *set);
6151         __isl_give isl_union_pw_aff *
6152         isl_union_pw_aff_subtract_domain(
6153                 __isl_take isl_union_pw_aff *upa,
6154                 __isl_take isl_union_set *uset);
6155         __isl_give isl_union_pw_multi_aff *
6156         isl_union_pw_multi_aff_subtract_domain(
6157                 __isl_take isl_union_pw_multi_aff *upma,
6158                 __isl_take isl_set *set);
6160         #include <isl/polynomial.h>
6161         __isl_give isl_pw_qpolynomial *
6162         isl_pw_qpolynomial_subtract_domain(
6163                 __isl_take isl_pw_qpolynomial *pwpq,
6164                 __isl_take isl_set *set);
6165         __isl_give isl_pw_qpolynomial_fold *
6166         isl_pw_qpolynomial_fold_subtract_domain(
6167                 __isl_take isl_pw_qpolynomial_fold *pwf,
6168                 __isl_take isl_set *set);
6169         __isl_give isl_union_pw_qpolynomial *
6170         isl_union_pw_qpolynomial_subtract_domain(
6171                 __isl_take isl_union_pw_qpolynomial *upwpq,
6172                 __isl_take isl_union_set *uset);
6173         __isl_give isl_union_pw_qpolynomial_fold *
6174         isl_union_pw_qpolynomial_fold_subtract_domain(
6175                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6176                 __isl_take isl_union_set *uset);
6178 =item * Application
6180         #include <isl/space.h>
6181         __isl_give isl_space *isl_space_join(
6182                 __isl_take isl_space *left,
6183                 __isl_take isl_space *right);
6185         #include <isl/map.h>
6186         __isl_give isl_basic_set *isl_basic_set_apply(
6187                 __isl_take isl_basic_set *bset,
6188                 __isl_take isl_basic_map *bmap);
6189         __isl_give isl_set *isl_set_apply(
6190                 __isl_take isl_set *set,
6191                 __isl_take isl_map *map);
6192         __isl_give isl_union_set *isl_union_set_apply(
6193                 __isl_take isl_union_set *uset,
6194                 __isl_take isl_union_map *umap);
6195         __isl_give isl_basic_map *isl_basic_map_apply_domain(
6196                 __isl_take isl_basic_map *bmap1,
6197                 __isl_take isl_basic_map *bmap2);
6198         __isl_give isl_basic_map *isl_basic_map_apply_range(
6199                 __isl_take isl_basic_map *bmap1,
6200                 __isl_take isl_basic_map *bmap2);
6201         __isl_give isl_map *isl_map_apply_domain(
6202                 __isl_take isl_map *map1,
6203                 __isl_take isl_map *map2);
6204         __isl_give isl_map *isl_map_apply_range(
6205                 __isl_take isl_map *map1,
6206                 __isl_take isl_map *map2);
6208         #include <isl/union_map.h>
6209         __isl_give isl_union_map *isl_union_map_apply_domain(
6210                 __isl_take isl_union_map *umap1,
6211                 __isl_take isl_union_map *umap2);
6212         __isl_give isl_union_map *isl_union_map_apply_range(
6213                 __isl_take isl_union_map *umap1,
6214                 __isl_take isl_union_map *umap2);
6216         #include <isl/aff.h>
6217         __isl_give isl_union_pw_aff *
6218         isl_multi_union_pw_aff_apply_aff(
6219                 __isl_take isl_multi_union_pw_aff *mupa,
6220                 __isl_take isl_aff *aff);
6221         __isl_give isl_union_pw_aff *
6222         isl_multi_union_pw_aff_apply_pw_aff(
6223                 __isl_take isl_multi_union_pw_aff *mupa,
6224                 __isl_take isl_pw_aff *pa);
6225         __isl_give isl_multi_union_pw_aff *
6226         isl_multi_union_pw_aff_apply_multi_aff(
6227                 __isl_take isl_multi_union_pw_aff *mupa,
6228                 __isl_take isl_multi_aff *ma);
6229         __isl_give isl_multi_union_pw_aff *
6230         isl_multi_union_pw_aff_apply_pw_multi_aff(
6231                 __isl_take isl_multi_union_pw_aff *mupa,
6232                 __isl_take isl_pw_multi_aff *pma);
6234 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
6235 over the shared domain of the elements of the input.  The dimension is
6236 required to be greater than zero.
6237 The C<isl_multi_union_pw_aff> argument of
6238 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
6239 but only if the range of the C<isl_multi_aff> argument
6240 is also zero-dimensional.
6241 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
6243         #include <isl/polynomial.h>
6244         __isl_give isl_pw_qpolynomial_fold *
6245         isl_set_apply_pw_qpolynomial_fold(
6246                 __isl_take isl_set *set,
6247                 __isl_take isl_pw_qpolynomial_fold *pwf,
6248                 int *tight);
6249         __isl_give isl_pw_qpolynomial_fold *
6250         isl_map_apply_pw_qpolynomial_fold(
6251                 __isl_take isl_map *map,
6252                 __isl_take isl_pw_qpolynomial_fold *pwf,
6253                 int *tight);
6254         __isl_give isl_union_pw_qpolynomial_fold *
6255         isl_union_set_apply_union_pw_qpolynomial_fold(
6256                 __isl_take isl_union_set *uset,
6257                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6258                 int *tight);
6259         __isl_give isl_union_pw_qpolynomial_fold *
6260         isl_union_map_apply_union_pw_qpolynomial_fold(
6261                 __isl_take isl_union_map *umap,
6262                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6263                 int *tight);
6265 The functions taking a map
6266 compose the given map with the given piecewise quasipolynomial reduction.
6267 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
6268 over all elements in the intersection of the range of the map
6269 and the domain of the piecewise quasipolynomial reduction
6270 as a function of an element in the domain of the map.
6271 The functions taking a set compute a bound over all elements in the
6272 intersection of the set and the domain of the
6273 piecewise quasipolynomial reduction.
6275 =item * Preimage
6277         #include <isl/set.h>
6278         __isl_give isl_basic_set *
6279         isl_basic_set_preimage_multi_aff(
6280                 __isl_take isl_basic_set *bset,
6281                 __isl_take isl_multi_aff *ma);
6282         __isl_give isl_set *isl_set_preimage_multi_aff(
6283                 __isl_take isl_set *set,
6284                 __isl_take isl_multi_aff *ma);
6285         __isl_give isl_set *isl_set_preimage_pw_multi_aff(
6286                 __isl_take isl_set *set,
6287                 __isl_take isl_pw_multi_aff *pma);
6288         __isl_give isl_set *isl_set_preimage_multi_pw_aff(
6289                 __isl_take isl_set *set,
6290                 __isl_take isl_multi_pw_aff *mpa);
6292         #include <isl/union_set.h>
6293         __isl_give isl_union_set *
6294         isl_union_set_preimage_multi_aff(
6295                 __isl_take isl_union_set *uset,
6296                 __isl_take isl_multi_aff *ma);
6297         __isl_give isl_union_set *
6298         isl_union_set_preimage_pw_multi_aff(
6299                 __isl_take isl_union_set *uset,
6300                 __isl_take isl_pw_multi_aff *pma);
6301         __isl_give isl_union_set *
6302         isl_union_set_preimage_union_pw_multi_aff(
6303                 __isl_take isl_union_set *uset,
6304                 __isl_take isl_union_pw_multi_aff *upma);
6306         #include <isl/map.h>
6307         __isl_give isl_basic_map *
6308         isl_basic_map_preimage_domain_multi_aff(
6309                 __isl_take isl_basic_map *bmap,
6310                 __isl_take isl_multi_aff *ma);
6311         __isl_give isl_map *isl_map_preimage_domain_multi_aff(
6312                 __isl_take isl_map *map,
6313                 __isl_take isl_multi_aff *ma);
6314         __isl_give isl_map *isl_map_preimage_range_multi_aff(
6315                 __isl_take isl_map *map,
6316                 __isl_take isl_multi_aff *ma);
6317         __isl_give isl_map *
6318         isl_map_preimage_domain_pw_multi_aff(
6319                 __isl_take isl_map *map,
6320                 __isl_take isl_pw_multi_aff *pma);
6321         __isl_give isl_map *
6322         isl_map_preimage_range_pw_multi_aff(
6323                 __isl_take isl_map *map,
6324                 __isl_take isl_pw_multi_aff *pma);
6325         __isl_give isl_map *
6326         isl_map_preimage_domain_multi_pw_aff(
6327                 __isl_take isl_map *map,
6328                 __isl_take isl_multi_pw_aff *mpa);
6329         __isl_give isl_basic_map *
6330         isl_basic_map_preimage_range_multi_aff(
6331                 __isl_take isl_basic_map *bmap,
6332                 __isl_take isl_multi_aff *ma);
6334         #include <isl/union_map.h>
6335         __isl_give isl_union_map *
6336         isl_union_map_preimage_domain_multi_aff(
6337                 __isl_take isl_union_map *umap,
6338                 __isl_take isl_multi_aff *ma);
6339         __isl_give isl_union_map *
6340         isl_union_map_preimage_range_multi_aff(
6341                 __isl_take isl_union_map *umap,
6342                 __isl_take isl_multi_aff *ma);
6343         __isl_give isl_union_map *
6344         isl_union_map_preimage_domain_pw_multi_aff(
6345                 __isl_take isl_union_map *umap,
6346                 __isl_take isl_pw_multi_aff *pma);
6347         __isl_give isl_union_map *
6348         isl_union_map_preimage_range_pw_multi_aff(
6349                 __isl_take isl_union_map *umap,
6350                 __isl_take isl_pw_multi_aff *pma);
6351         __isl_give isl_union_map *
6352         isl_union_map_preimage_domain_union_pw_multi_aff(
6353                 __isl_take isl_union_map *umap,
6354                 __isl_take isl_union_pw_multi_aff *upma);
6355         __isl_give isl_union_map *
6356         isl_union_map_preimage_range_union_pw_multi_aff(
6357                 __isl_take isl_union_map *umap,
6358                 __isl_take isl_union_pw_multi_aff *upma);
6360 These functions compute the preimage of the given set or map domain/range under
6361 the given function.  In other words, the expression is plugged
6362 into the set description or into the domain/range of the map.
6364 =item * Pullback
6366         #include <isl/aff.h>
6367         __isl_give isl_aff *isl_aff_pullback_aff(
6368                 __isl_take isl_aff *aff1,
6369                 __isl_take isl_aff *aff2);
6370         __isl_give isl_aff *isl_aff_pullback_multi_aff(
6371                 __isl_take isl_aff *aff,
6372                 __isl_take isl_multi_aff *ma);
6373         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
6374                 __isl_take isl_pw_aff *pa,
6375                 __isl_take isl_multi_aff *ma);
6376         __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
6377                 __isl_take isl_pw_aff *pa,
6378                 __isl_take isl_pw_multi_aff *pma);
6379         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
6380                 __isl_take isl_pw_aff *pa,
6381                 __isl_take isl_multi_pw_aff *mpa);
6382         __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
6383                 __isl_take isl_multi_aff *ma1,
6384                 __isl_take isl_multi_aff *ma2);
6385         __isl_give isl_pw_multi_aff *
6386         isl_pw_multi_aff_pullback_multi_aff(
6387                 __isl_take isl_pw_multi_aff *pma,
6388                 __isl_take isl_multi_aff *ma);
6389         __isl_give isl_multi_pw_aff *
6390         isl_multi_pw_aff_pullback_multi_aff(
6391                 __isl_take isl_multi_pw_aff *mpa,
6392                 __isl_take isl_multi_aff *ma);
6393         __isl_give isl_pw_multi_aff *
6394         isl_pw_multi_aff_pullback_pw_multi_aff(
6395                 __isl_take isl_pw_multi_aff *pma1,
6396                 __isl_take isl_pw_multi_aff *pma2);
6397         __isl_give isl_multi_pw_aff *
6398         isl_multi_pw_aff_pullback_pw_multi_aff(
6399                 __isl_take isl_multi_pw_aff *mpa,
6400                 __isl_take isl_pw_multi_aff *pma);
6401         __isl_give isl_multi_pw_aff *
6402         isl_multi_pw_aff_pullback_multi_pw_aff(
6403                 __isl_take isl_multi_pw_aff *mpa1,
6404                 __isl_take isl_multi_pw_aff *mpa2);
6405         __isl_give isl_union_pw_aff *
6406         isl_union_pw_aff_pullback_union_pw_multi_aff(
6407                 __isl_take isl_union_pw_aff *upa,
6408                 __isl_take isl_union_pw_multi_aff *upma);
6409         __isl_give isl_union_pw_multi_aff *
6410         isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
6411                 __isl_take isl_union_pw_multi_aff *upma1,
6412                 __isl_take isl_union_pw_multi_aff *upma2);
6413         __isl_give isl_multi_union_pw_aff *
6414         isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
6415                 __isl_take isl_multi_union_pw_aff *mupa,
6416                 __isl_take isl_union_pw_multi_aff *upma);
6418 These functions precompose the first expression by the second function.
6419 In other words, the second function is plugged
6420 into the first expression.
6422 =item * Locus
6424         #include <isl/aff.h>
6425         __isl_give isl_basic_set *isl_aff_eq_basic_set(
6426                 __isl_take isl_aff *aff1,
6427                 __isl_take isl_aff *aff2);
6428         __isl_give isl_set *isl_aff_eq_set(
6429                 __isl_take isl_aff *aff1,
6430                 __isl_take isl_aff *aff2);
6431         __isl_give isl_set *isl_aff_ne_set(
6432                 __isl_take isl_aff *aff1,
6433                 __isl_take isl_aff *aff2);
6434         __isl_give isl_basic_set *isl_aff_le_basic_set(
6435                 __isl_take isl_aff *aff1,
6436                 __isl_take isl_aff *aff2);
6437         __isl_give isl_set *isl_aff_le_set(
6438                 __isl_take isl_aff *aff1,
6439                 __isl_take isl_aff *aff2);
6440         __isl_give isl_basic_set *isl_aff_lt_basic_set(
6441                 __isl_take isl_aff *aff1,
6442                 __isl_take isl_aff *aff2);
6443         __isl_give isl_set *isl_aff_lt_set(
6444                 __isl_take isl_aff *aff1,
6445                 __isl_take isl_aff *aff2);
6446         __isl_give isl_basic_set *isl_aff_ge_basic_set(
6447                 __isl_take isl_aff *aff1,
6448                 __isl_take isl_aff *aff2);
6449         __isl_give isl_set *isl_aff_ge_set(
6450                 __isl_take isl_aff *aff1,
6451                 __isl_take isl_aff *aff2);
6452         __isl_give isl_basic_set *isl_aff_gt_basic_set(
6453                 __isl_take isl_aff *aff1,
6454                 __isl_take isl_aff *aff2);
6455         __isl_give isl_set *isl_aff_gt_set(
6456                 __isl_take isl_aff *aff1,
6457                 __isl_take isl_aff *aff2);
6458         __isl_give isl_set *isl_pw_aff_eq_set(
6459                 __isl_take isl_pw_aff *pwaff1,
6460                 __isl_take isl_pw_aff *pwaff2);
6461         __isl_give isl_set *isl_pw_aff_ne_set(
6462                 __isl_take isl_pw_aff *pwaff1,
6463                 __isl_take isl_pw_aff *pwaff2);
6464         __isl_give isl_set *isl_pw_aff_le_set(
6465                 __isl_take isl_pw_aff *pwaff1,
6466                 __isl_take isl_pw_aff *pwaff2);
6467         __isl_give isl_set *isl_pw_aff_lt_set(
6468                 __isl_take isl_pw_aff *pwaff1,
6469                 __isl_take isl_pw_aff *pwaff2);
6470         __isl_give isl_set *isl_pw_aff_ge_set(
6471                 __isl_take isl_pw_aff *pwaff1,
6472                 __isl_take isl_pw_aff *pwaff2);
6473         __isl_give isl_set *isl_pw_aff_gt_set(
6474                 __isl_take isl_pw_aff *pwaff1,
6475                 __isl_take isl_pw_aff *pwaff2);
6477         __isl_give isl_set *isl_multi_aff_lex_le_set(
6478                 __isl_take isl_multi_aff *ma1,
6479                 __isl_take isl_multi_aff *ma2);
6480         __isl_give isl_set *isl_multi_aff_lex_lt_set(
6481                 __isl_take isl_multi_aff *ma1,
6482                 __isl_take isl_multi_aff *ma2);
6483         __isl_give isl_set *isl_multi_aff_lex_ge_set(
6484                 __isl_take isl_multi_aff *ma1,
6485                 __isl_take isl_multi_aff *ma2);
6486         __isl_give isl_set *isl_multi_aff_lex_gt_set(
6487                 __isl_take isl_multi_aff *ma1,
6488                 __isl_take isl_multi_aff *ma2);
6490         __isl_give isl_set *isl_pw_aff_list_eq_set(
6491                 __isl_take isl_pw_aff_list *list1,
6492                 __isl_take isl_pw_aff_list *list2);
6493         __isl_give isl_set *isl_pw_aff_list_ne_set(
6494                 __isl_take isl_pw_aff_list *list1,
6495                 __isl_take isl_pw_aff_list *list2);
6496         __isl_give isl_set *isl_pw_aff_list_le_set(
6497                 __isl_take isl_pw_aff_list *list1,
6498                 __isl_take isl_pw_aff_list *list2);
6499         __isl_give isl_set *isl_pw_aff_list_lt_set(
6500                 __isl_take isl_pw_aff_list *list1,
6501                 __isl_take isl_pw_aff_list *list2);
6502         __isl_give isl_set *isl_pw_aff_list_ge_set(
6503                 __isl_take isl_pw_aff_list *list1,
6504                 __isl_take isl_pw_aff_list *list2);
6505         __isl_give isl_set *isl_pw_aff_list_gt_set(
6506                 __isl_take isl_pw_aff_list *list1,
6507                 __isl_take isl_pw_aff_list *list2);
6509 The function C<isl_aff_ge_basic_set> returns a basic set
6510 containing those elements in the shared space
6511 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
6512 The function C<isl_pw_aff_ge_set> returns a set
6513 containing those elements in the shared domain
6514 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
6515 greater than or equal to C<pwaff2>.
6516 The function C<isl_multi_aff_lex_le_set> returns a set
6517 containing those elements in the shared domain space
6518 where C<ma1> is lexicographically smaller than or
6519 equal to C<ma2>.
6520 The functions operating on C<isl_pw_aff_list> apply the corresponding
6521 C<isl_pw_aff> function to each pair of elements in the two lists.
6523         #include <isl/aff.h>
6524         __isl_give isl_map *isl_pw_aff_eq_map(
6525                 __isl_take isl_pw_aff *pa1,
6526                 __isl_take isl_pw_aff *pa2);
6527         __isl_give isl_map *isl_pw_aff_lt_map(
6528                 __isl_take isl_pw_aff *pa1,
6529                 __isl_take isl_pw_aff *pa2);
6530         __isl_give isl_map *isl_pw_aff_gt_map(
6531                 __isl_take isl_pw_aff *pa1,
6532                 __isl_take isl_pw_aff *pa2);
6534         __isl_give isl_map *isl_multi_pw_aff_eq_map(
6535                 __isl_take isl_multi_pw_aff *mpa1,
6536                 __isl_take isl_multi_pw_aff *mpa2);
6537         __isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
6538                 __isl_take isl_multi_pw_aff *mpa1,
6539                 __isl_take isl_multi_pw_aff *mpa2);
6540         __isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
6541                 __isl_take isl_multi_pw_aff *mpa1,
6542                 __isl_take isl_multi_pw_aff *mpa2);
6544 These functions return a map between domain elements of the arguments
6545 where the function values satisfy the given relation.
6547         #include <isl/union_map.h>
6548         __isl_give isl_union_map *
6549         isl_union_map_eq_at_multi_union_pw_aff(
6550                 __isl_take isl_union_map *umap,
6551                 __isl_take isl_multi_union_pw_aff *mupa);
6552         __isl_give isl_union_map *
6553         isl_union_map_lex_lt_at_multi_union_pw_aff(
6554                 __isl_take isl_union_map *umap,
6555                 __isl_take isl_multi_union_pw_aff *mupa);
6556         __isl_give isl_union_map *
6557         isl_union_map_lex_gt_at_multi_union_pw_aff(
6558                 __isl_take isl_union_map *umap,
6559                 __isl_take isl_multi_union_pw_aff *mupa);
6561 These functions select the subset of elements in the union map
6562 that have an equal or lexicographically smaller function value.
6564 =item * Cartesian Product
6566         #include <isl/space.h>
6567         __isl_give isl_space *isl_space_product(
6568                 __isl_take isl_space *space1,
6569                 __isl_take isl_space *space2);
6570         __isl_give isl_space *isl_space_domain_product(
6571                 __isl_take isl_space *space1,
6572                 __isl_take isl_space *space2);
6573         __isl_give isl_space *isl_space_range_product(
6574                 __isl_take isl_space *space1,
6575                 __isl_take isl_space *space2);
6577 The functions
6578 C<isl_space_product>, C<isl_space_domain_product>
6579 and C<isl_space_range_product> take pairs or relation spaces and
6580 produce a single relations space, where either the domain, the range
6581 or both domain and range are wrapped spaces of relations between
6582 the domains and/or ranges of the input spaces.
6583 If the product is only constructed over the domain or the range
6584 then the ranges or the domains of the inputs should be the same.
6585 The function C<isl_space_product> also accepts a pair of set spaces,
6586 in which case it returns a wrapped space of a relation between the
6587 two input spaces.
6589         #include <isl/set.h>
6590         __isl_give isl_set *isl_set_product(
6591                 __isl_take isl_set *set1,
6592                 __isl_take isl_set *set2);
6594         #include <isl/map.h>
6595         __isl_give isl_basic_map *isl_basic_map_domain_product(
6596                 __isl_take isl_basic_map *bmap1,
6597                 __isl_take isl_basic_map *bmap2);
6598         __isl_give isl_basic_map *isl_basic_map_range_product(
6599                 __isl_take isl_basic_map *bmap1,
6600                 __isl_take isl_basic_map *bmap2);
6601         __isl_give isl_basic_map *isl_basic_map_product(
6602                 __isl_take isl_basic_map *bmap1,
6603                 __isl_take isl_basic_map *bmap2);
6604         __isl_give isl_map *isl_map_domain_product(
6605                 __isl_take isl_map *map1,
6606                 __isl_take isl_map *map2);
6607         __isl_give isl_map *isl_map_range_product(
6608                 __isl_take isl_map *map1,
6609                 __isl_take isl_map *map2);
6610         __isl_give isl_map *isl_map_product(
6611                 __isl_take isl_map *map1,
6612                 __isl_take isl_map *map2);
6614         #include <isl/union_set.h>
6615         __isl_give isl_union_set *isl_union_set_product(
6616                 __isl_take isl_union_set *uset1,
6617                 __isl_take isl_union_set *uset2);
6619         #include <isl/union_map.h>
6620         __isl_give isl_union_map *isl_union_map_domain_product(
6621                 __isl_take isl_union_map *umap1,
6622                 __isl_take isl_union_map *umap2);
6623         __isl_give isl_union_map *isl_union_map_range_product(
6624                 __isl_take isl_union_map *umap1,
6625                 __isl_take isl_union_map *umap2);
6626         __isl_give isl_union_map *isl_union_map_product(
6627                 __isl_take isl_union_map *umap1,
6628                 __isl_take isl_union_map *umap2);
6630         #include <isl/val.h>
6631         __isl_give isl_multi_val *isl_multi_val_range_product(
6632                 __isl_take isl_multi_val *mv1,
6633                 __isl_take isl_multi_val *mv2);
6634         __isl_give isl_multi_val *isl_multi_val_product(
6635                 __isl_take isl_multi_val *mv1,
6636                 __isl_take isl_multi_val *mv2);
6638         #include <isl/aff.h>
6639         __isl_give isl_multi_aff *isl_multi_aff_range_product(
6640                 __isl_take isl_multi_aff *ma1,
6641                 __isl_take isl_multi_aff *ma2);
6642         __isl_give isl_multi_aff *isl_multi_aff_product(
6643                 __isl_take isl_multi_aff *ma1,
6644                 __isl_take isl_multi_aff *ma2);
6645         __isl_give isl_multi_pw_aff *
6646         isl_multi_pw_aff_range_product(
6647                 __isl_take isl_multi_pw_aff *mpa1,
6648                 __isl_take isl_multi_pw_aff *mpa2);
6649         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
6650                 __isl_take isl_multi_pw_aff *mpa1,
6651                 __isl_take isl_multi_pw_aff *mpa2);
6652         __isl_give isl_pw_multi_aff *
6653         isl_pw_multi_aff_range_product(
6654                 __isl_take isl_pw_multi_aff *pma1,
6655                 __isl_take isl_pw_multi_aff *pma2);
6656         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
6657                 __isl_take isl_pw_multi_aff *pma1,
6658                 __isl_take isl_pw_multi_aff *pma2);
6659         __isl_give isl_multi_union_pw_aff *
6660         isl_multi_union_pw_aff_range_product(
6661                 __isl_take isl_multi_union_pw_aff *mupa1,
6662                 __isl_take isl_multi_union_pw_aff *mupa2);
6664 The above functions compute the cross product of the given
6665 sets, relations or functions.  The domains and ranges of the results
6666 are wrapped maps between domains and ranges of the inputs.
6667 To obtain a ``flat'' product, use the following functions
6668 instead.
6670         #include <isl/set.h>
6671         __isl_give isl_basic_set *isl_basic_set_flat_product(
6672                 __isl_take isl_basic_set *bset1,
6673                 __isl_take isl_basic_set *bset2);
6674         __isl_give isl_set *isl_set_flat_product(
6675                 __isl_take isl_set *set1,
6676                 __isl_take isl_set *set2);
6678         #include <isl/map.h>
6679         __isl_give isl_basic_map *isl_basic_map_flat_range_product(
6680                 __isl_take isl_basic_map *bmap1,
6681                 __isl_take isl_basic_map *bmap2);
6682         __isl_give isl_map *isl_map_flat_domain_product(
6683                 __isl_take isl_map *map1,
6684                 __isl_take isl_map *map2);
6685         __isl_give isl_map *isl_map_flat_range_product(
6686                 __isl_take isl_map *map1,
6687                 __isl_take isl_map *map2);
6688         __isl_give isl_basic_map *isl_basic_map_flat_product(
6689                 __isl_take isl_basic_map *bmap1,
6690                 __isl_take isl_basic_map *bmap2);
6691         __isl_give isl_map *isl_map_flat_product(
6692                 __isl_take isl_map *map1,
6693                 __isl_take isl_map *map2);
6695         #include <isl/union_map.h>
6696         __isl_give isl_union_map *
6697         isl_union_map_flat_domain_product(
6698                 __isl_take isl_union_map *umap1,
6699                 __isl_take isl_union_map *umap2);
6700         __isl_give isl_union_map *
6701         isl_union_map_flat_range_product(
6702                 __isl_take isl_union_map *umap1,
6703                 __isl_take isl_union_map *umap2);
6705         #include <isl/val.h>
6706         __isl_give isl_multi_val *isl_multi_val_flat_range_product(
6707                 __isl_take isl_multi_val *mv1,
6708                 __isl_take isl_multi_aff *mv2);
6710         #include <isl/aff.h>
6711         __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
6712                 __isl_take isl_multi_aff *ma1,
6713                 __isl_take isl_multi_aff *ma2);
6714         __isl_give isl_pw_multi_aff *
6715         isl_pw_multi_aff_flat_range_product(
6716                 __isl_take isl_pw_multi_aff *pma1,
6717                 __isl_take isl_pw_multi_aff *pma2);
6718         __isl_give isl_multi_pw_aff *
6719         isl_multi_pw_aff_flat_range_product(
6720                 __isl_take isl_multi_pw_aff *mpa1,
6721                 __isl_take isl_multi_pw_aff *mpa2);
6722         __isl_give isl_union_pw_multi_aff *
6723         isl_union_pw_multi_aff_flat_range_product(
6724                 __isl_take isl_union_pw_multi_aff *upma1,
6725                 __isl_take isl_union_pw_multi_aff *upma2);
6726         __isl_give isl_multi_union_pw_aff *
6727         isl_multi_union_pw_aff_flat_range_product(
6728                 __isl_take isl_multi_union_pw_aff *mupa1,
6729                 __isl_take isl_multi_union_pw_aff *mupa2);
6731         #include <isl/space.h>
6732         __isl_give isl_space *isl_space_factor_domain(
6733                 __isl_take isl_space *space);
6734         __isl_give isl_space *isl_space_factor_range(
6735                 __isl_take isl_space *space);
6736         __isl_give isl_space *isl_space_domain_factor_domain(
6737                 __isl_take isl_space *space);
6738         __isl_give isl_space *isl_space_domain_factor_range(
6739                 __isl_take isl_space *space);
6740         __isl_give isl_space *isl_space_range_factor_domain(
6741                 __isl_take isl_space *space);
6742         __isl_give isl_space *isl_space_range_factor_range(
6743                 __isl_take isl_space *space);
6745 The functions C<isl_space_range_factor_domain> and
6746 C<isl_space_range_factor_range> extract the two arguments from
6747 the result of a call to C<isl_space_range_product>.
6749 The arguments of a call to a product can be extracted
6750 from the result using the following functions.
6752         #include <isl/map.h>
6753         __isl_give isl_map *isl_map_factor_domain(
6754                 __isl_take isl_map *map);
6755         __isl_give isl_map *isl_map_factor_range(
6756                 __isl_take isl_map *map);
6757         __isl_give isl_map *isl_map_domain_factor_domain(
6758                 __isl_take isl_map *map);
6759         __isl_give isl_map *isl_map_domain_factor_range(
6760                 __isl_take isl_map *map);
6761         __isl_give isl_map *isl_map_range_factor_domain(
6762                 __isl_take isl_map *map);
6763         __isl_give isl_map *isl_map_range_factor_range(
6764                 __isl_take isl_map *map);
6766         #include <isl/union_map.h>
6767         __isl_give isl_union_map *isl_union_map_factor_domain(
6768                 __isl_take isl_union_map *umap);
6769         __isl_give isl_union_map *isl_union_map_factor_range(
6770                 __isl_take isl_union_map *umap);
6771         __isl_give isl_union_map *
6772         isl_union_map_domain_factor_domain(
6773                 __isl_take isl_union_map *umap);
6774         __isl_give isl_union_map *
6775         isl_union_map_domain_factor_range(
6776                 __isl_take isl_union_map *umap);
6777         __isl_give isl_union_map *
6778         isl_union_map_range_factor_domain(
6779                 __isl_take isl_union_map *umap);
6780         __isl_give isl_union_map *
6781         isl_union_map_range_factor_range(
6782                 __isl_take isl_union_map *umap);
6784         #include <isl/val.h>
6785         __isl_give isl_multi_val *isl_multi_val_factor_range(
6786                 __isl_take isl_multi_val *mv);
6787         __isl_give isl_multi_val *
6788         isl_multi_val_range_factor_domain(
6789                 __isl_take isl_multi_val *mv);
6790         __isl_give isl_multi_val *
6791         isl_multi_val_range_factor_range(
6792                 __isl_take isl_multi_val *mv);
6794         #include <isl/aff.h>
6795         __isl_give isl_multi_aff *isl_multi_aff_factor_range(
6796                 __isl_take isl_multi_aff *ma);
6797         __isl_give isl_multi_aff *
6798         isl_multi_aff_range_factor_domain(
6799                 __isl_take isl_multi_aff *ma);
6800         __isl_give isl_multi_aff *
6801         isl_multi_aff_range_factor_range(
6802                 __isl_take isl_multi_aff *ma);
6803         __isl_give isl_multi_pw_aff *
6804         isl_multi_pw_aff_factor_range(
6805                 __isl_take isl_multi_pw_aff *mpa);
6806         __isl_give isl_multi_pw_aff *
6807         isl_multi_pw_aff_range_factor_domain(
6808                 __isl_take isl_multi_pw_aff *mpa);
6809         __isl_give isl_multi_pw_aff *
6810         isl_multi_pw_aff_range_factor_range(
6811                 __isl_take isl_multi_pw_aff *mpa);
6812         __isl_give isl_multi_union_pw_aff *
6813         isl_multi_union_pw_aff_factor_range(
6814                 __isl_take isl_multi_union_pw_aff *mupa);
6815         __isl_give isl_multi_union_pw_aff *
6816         isl_multi_union_pw_aff_range_factor_domain(
6817                 __isl_take isl_multi_union_pw_aff *mupa);
6818         __isl_give isl_multi_union_pw_aff *
6819         isl_multi_union_pw_aff_range_factor_range(
6820                 __isl_take isl_multi_union_pw_aff *mupa);
6822 The splice functions are a generalization of the flat product functions,
6823 where the second argument may be inserted at any position inside
6824 the first argument rather than being placed at the end.
6825 The functions C<isl_multi_val_factor_range>,
6826 C<isl_multi_aff_factor_range>,
6827 C<isl_multi_pw_aff_factor_range> and
6828 C<isl_multi_union_pw_aff_factor_range>
6829 take functions that live in a set space.
6831         #include <isl/val.h>
6832         __isl_give isl_multi_val *isl_multi_val_range_splice(
6833                 __isl_take isl_multi_val *mv1, unsigned pos,
6834                 __isl_take isl_multi_val *mv2);
6836         #include <isl/aff.h>
6837         __isl_give isl_multi_aff *isl_multi_aff_range_splice(
6838                 __isl_take isl_multi_aff *ma1, unsigned pos,
6839                 __isl_take isl_multi_aff *ma2);
6840         __isl_give isl_multi_aff *isl_multi_aff_splice(
6841                 __isl_take isl_multi_aff *ma1,
6842                 unsigned in_pos, unsigned out_pos,
6843                 __isl_take isl_multi_aff *ma2);
6844         __isl_give isl_multi_pw_aff *
6845         isl_multi_pw_aff_range_splice(
6846                 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
6847                 __isl_take isl_multi_pw_aff *mpa2);
6848         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
6849                 __isl_take isl_multi_pw_aff *mpa1,
6850                 unsigned in_pos, unsigned out_pos,
6851                 __isl_take isl_multi_pw_aff *mpa2);
6852         __isl_give isl_multi_union_pw_aff *
6853         isl_multi_union_pw_aff_range_splice(
6854                 __isl_take isl_multi_union_pw_aff *mupa1,
6855                 unsigned pos,
6856                 __isl_take isl_multi_union_pw_aff *mupa2);
6858 =item * Simplification
6860 When applied to a set or relation,
6861 the gist operation returns a set or relation that has the
6862 same intersection with the context as the input set or relation.
6863 Any implicit equality in the intersection is made explicit in the result,
6864 while all inequalities that are redundant with respect to the intersection
6865 are removed.
6866 In case of union sets and relations, the gist operation is performed
6867 per space.
6869 When applied to a function,
6870 the gist operation applies the set gist operation to each of
6871 the cells in the domain of the input piecewise expression.
6872 The context is also exploited
6873 to simplify the expression associated to each cell.
6875         #include <isl/set.h>
6876         __isl_give isl_basic_set *isl_basic_set_gist(
6877                 __isl_take isl_basic_set *bset,
6878                 __isl_take isl_basic_set *context);
6879         __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
6880                 __isl_take isl_set *context);
6881         __isl_give isl_set *isl_set_gist_params(
6882                 __isl_take isl_set *set,
6883                 __isl_take isl_set *context);
6885         #include <isl/map.h>
6886         __isl_give isl_basic_map *isl_basic_map_gist(
6887                 __isl_take isl_basic_map *bmap,
6888                 __isl_take isl_basic_map *context);
6889         __isl_give isl_basic_map *isl_basic_map_gist_domain(
6890                 __isl_take isl_basic_map *bmap,
6891                 __isl_take isl_basic_set *context);
6892         __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
6893                 __isl_take isl_map *context);
6894         __isl_give isl_map *isl_map_gist_params(
6895                 __isl_take isl_map *map,
6896                 __isl_take isl_set *context);
6897         __isl_give isl_map *isl_map_gist_domain(
6898                 __isl_take isl_map *map,
6899                 __isl_take isl_set *context);
6900         __isl_give isl_map *isl_map_gist_range(
6901                 __isl_take isl_map *map,
6902                 __isl_take isl_set *context);
6904         #include <isl/union_set.h>
6905         __isl_give isl_union_set *isl_union_set_gist(
6906                 __isl_take isl_union_set *uset,
6907                 __isl_take isl_union_set *context);
6908         __isl_give isl_union_set *isl_union_set_gist_params(
6909                 __isl_take isl_union_set *uset,
6910                 __isl_take isl_set *set);
6912         #include <isl/union_map.h>
6913         __isl_give isl_union_map *isl_union_map_gist(
6914                 __isl_take isl_union_map *umap,
6915                 __isl_take isl_union_map *context);
6916         __isl_give isl_union_map *isl_union_map_gist_params(
6917                 __isl_take isl_union_map *umap,
6918                 __isl_take isl_set *set);
6919         __isl_give isl_union_map *isl_union_map_gist_domain(
6920                 __isl_take isl_union_map *umap,
6921                 __isl_take isl_union_set *uset);
6922         __isl_give isl_union_map *isl_union_map_gist_range(
6923                 __isl_take isl_union_map *umap,
6924                 __isl_take isl_union_set *uset);
6926         #include <isl/aff.h>
6927         __isl_give isl_aff *isl_aff_gist_params(
6928                 __isl_take isl_aff *aff,
6929                 __isl_take isl_set *context);
6930         __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
6931                 __isl_take isl_set *context);
6932         __isl_give isl_multi_aff *isl_multi_aff_gist_params(
6933                 __isl_take isl_multi_aff *maff,
6934                 __isl_take isl_set *context);
6935         __isl_give isl_multi_aff *isl_multi_aff_gist(
6936                 __isl_take isl_multi_aff *maff,
6937                 __isl_take isl_set *context);
6938         __isl_give isl_pw_aff *isl_pw_aff_gist_params(
6939                 __isl_take isl_pw_aff *pwaff,
6940                 __isl_take isl_set *context);
6941         __isl_give isl_pw_aff *isl_pw_aff_gist(
6942                 __isl_take isl_pw_aff *pwaff,
6943                 __isl_take isl_set *context);
6944         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
6945                 __isl_take isl_pw_multi_aff *pma,
6946                 __isl_take isl_set *set);
6947         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
6948                 __isl_take isl_pw_multi_aff *pma,
6949                 __isl_take isl_set *set);
6950         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
6951                 __isl_take isl_multi_pw_aff *mpa,
6952                 __isl_take isl_set *set);
6953         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
6954                 __isl_take isl_multi_pw_aff *mpa,
6955                 __isl_take isl_set *set);
6956         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
6957                 __isl_take isl_union_pw_aff *upa,
6958                 __isl_take isl_union_set *context);
6959         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
6960                 __isl_take isl_union_pw_aff *upa,
6961                 __isl_take isl_set *context);
6962         __isl_give isl_union_pw_multi_aff *
6963         isl_union_pw_multi_aff_gist_params(
6964                 __isl_take isl_union_pw_multi_aff *upma,
6965                 __isl_take isl_set *context);
6966         __isl_give isl_union_pw_multi_aff *
6967         isl_union_pw_multi_aff_gist(
6968                 __isl_take isl_union_pw_multi_aff *upma,
6969                 __isl_take isl_union_set *context);
6970         __isl_give isl_multi_union_pw_aff *
6971         isl_multi_union_pw_aff_gist_params(
6972                 __isl_take isl_multi_union_pw_aff *aff,
6973                 __isl_take isl_set *context);
6974         __isl_give isl_multi_union_pw_aff *
6975         isl_multi_union_pw_aff_gist(
6976                 __isl_take isl_multi_union_pw_aff *aff,
6977                 __isl_take isl_union_set *context);
6979         #include <isl/polynomial.h>
6980         __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
6981                 __isl_take isl_qpolynomial *qp,
6982                 __isl_take isl_set *context);
6983         __isl_give isl_qpolynomial *isl_qpolynomial_gist(
6984                 __isl_take isl_qpolynomial *qp,
6985                 __isl_take isl_set *context);
6986         __isl_give isl_qpolynomial_fold *
6987         isl_qpolynomial_fold_gist_params(
6988                 __isl_take isl_qpolynomial_fold *fold,
6989                 __isl_take isl_set *context);
6990         __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
6991                 __isl_take isl_qpolynomial_fold *fold,
6992                 __isl_take isl_set *context);
6993         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
6994                 __isl_take isl_pw_qpolynomial *pwqp,
6995                 __isl_take isl_set *context);
6996         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
6997                 __isl_take isl_pw_qpolynomial *pwqp,
6998                 __isl_take isl_set *context);
6999         __isl_give isl_pw_qpolynomial_fold *
7000         isl_pw_qpolynomial_fold_gist(
7001                 __isl_take isl_pw_qpolynomial_fold *pwf,
7002                 __isl_take isl_set *context);
7003         __isl_give isl_pw_qpolynomial_fold *
7004         isl_pw_qpolynomial_fold_gist_params(
7005                 __isl_take isl_pw_qpolynomial_fold *pwf,
7006                 __isl_take isl_set *context);
7007         __isl_give isl_union_pw_qpolynomial *
7008         isl_union_pw_qpolynomial_gist_params(
7009                 __isl_take isl_union_pw_qpolynomial *upwqp,
7010                 __isl_take isl_set *context);
7011         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
7012                 __isl_take isl_union_pw_qpolynomial *upwqp,
7013                 __isl_take isl_union_set *context);
7014         __isl_give isl_union_pw_qpolynomial_fold *
7015         isl_union_pw_qpolynomial_fold_gist(
7016                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7017                 __isl_take isl_union_set *context);
7018         __isl_give isl_union_pw_qpolynomial_fold *
7019         isl_union_pw_qpolynomial_fold_gist_params(
7020                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7021                 __isl_take isl_set *context);
7023 =item * Binary Arithmetic Operations
7025         #include <isl/set.h>
7026         __isl_give isl_set *isl_set_sum(
7027                 __isl_take isl_set *set1,
7028                 __isl_take isl_set *set2);
7029         #include <isl/map.h>
7030         __isl_give isl_map *isl_map_sum(
7031                 __isl_take isl_map *map1,
7032                 __isl_take isl_map *map2);
7034 C<isl_set_sum> computes the Minkowski sum of its two arguments,
7035 i.e., the set containing the sums of pairs of elements from
7036 C<set1> and C<set2>.
7037 The domain of the result of C<isl_map_sum> is the intersection
7038 of the domains of its two arguments.  The corresponding range
7039 elements are the sums of the corresponding range elements
7040 in the two arguments.
7042         #include <isl/val.h>
7043         __isl_give isl_multi_val *isl_multi_val_add(
7044                 __isl_take isl_multi_val *mv1,
7045                 __isl_take isl_multi_val *mv2);
7046         __isl_give isl_multi_val *isl_multi_val_sub(
7047                 __isl_take isl_multi_val *mv1,
7048                 __isl_take isl_multi_val *mv2);
7050         #include <isl/aff.h>
7051         __isl_give isl_aff *isl_aff_add(
7052                 __isl_take isl_aff *aff1,
7053                 __isl_take isl_aff *aff2);
7054         __isl_give isl_multi_aff *isl_multi_aff_add(
7055                 __isl_take isl_multi_aff *maff1,
7056                 __isl_take isl_multi_aff *maff2);
7057         __isl_give isl_pw_aff *isl_pw_aff_add(
7058                 __isl_take isl_pw_aff *pwaff1,
7059                 __isl_take isl_pw_aff *pwaff2);
7060         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add(
7061                 __isl_take isl_multi_pw_aff *mpa1,
7062                 __isl_take isl_multi_pw_aff *mpa2);
7063         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
7064                 __isl_take isl_pw_multi_aff *pma1,
7065                 __isl_take isl_pw_multi_aff *pma2);
7066         __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
7067                 __isl_take isl_union_pw_aff *upa1,
7068                 __isl_take isl_union_pw_aff *upa2);
7069         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
7070                 __isl_take isl_union_pw_multi_aff *upma1,
7071                 __isl_take isl_union_pw_multi_aff *upma2);
7072         __isl_give isl_multi_union_pw_aff *
7073         isl_multi_union_pw_aff_add(
7074                 __isl_take isl_multi_union_pw_aff *mupa1,
7075                 __isl_take isl_multi_union_pw_aff *mupa2);
7076         __isl_give isl_pw_aff *isl_pw_aff_min(
7077                 __isl_take isl_pw_aff *pwaff1,
7078                 __isl_take isl_pw_aff *pwaff2);
7079         __isl_give isl_pw_aff *isl_pw_aff_max(
7080                 __isl_take isl_pw_aff *pwaff1,
7081                 __isl_take isl_pw_aff *pwaff2);
7082         __isl_give isl_aff *isl_aff_sub(
7083                 __isl_take isl_aff *aff1,
7084                 __isl_take isl_aff *aff2);
7085         __isl_give isl_multi_aff *isl_multi_aff_sub(
7086                 __isl_take isl_multi_aff *ma1,
7087                 __isl_take isl_multi_aff *ma2);
7088         __isl_give isl_pw_aff *isl_pw_aff_sub(
7089                 __isl_take isl_pw_aff *pwaff1,
7090                 __isl_take isl_pw_aff *pwaff2);
7091         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
7092                 __isl_take isl_multi_pw_aff *mpa1,
7093                 __isl_take isl_multi_pw_aff *mpa2);
7094         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
7095                 __isl_take isl_pw_multi_aff *pma1,
7096                 __isl_take isl_pw_multi_aff *pma2);
7097         __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
7098                 __isl_take isl_union_pw_aff *upa1,
7099                 __isl_take isl_union_pw_aff *upa2);
7100         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
7101                 __isl_take isl_union_pw_multi_aff *upma1,
7102                 __isl_take isl_union_pw_multi_aff *upma2);
7103         __isl_give isl_multi_union_pw_aff *
7104         isl_multi_union_pw_aff_sub(
7105                 __isl_take isl_multi_union_pw_aff *mupa1,
7106                 __isl_take isl_multi_union_pw_aff *mupa2);
7108 C<isl_aff_sub> subtracts the second argument from the first.
7110         #include <isl/polynomial.h>
7111         __isl_give isl_qpolynomial *isl_qpolynomial_add(
7112                 __isl_take isl_qpolynomial *qp1,
7113                 __isl_take isl_qpolynomial *qp2);
7114         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
7115                 __isl_take isl_pw_qpolynomial *pwqp1,
7116                 __isl_take isl_pw_qpolynomial *pwqp2);
7117         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
7118                 __isl_take isl_pw_qpolynomial *pwqp1,
7119                 __isl_take isl_pw_qpolynomial *pwqp2);
7120         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
7121                 __isl_take isl_pw_qpolynomial_fold *pwf1,
7122                 __isl_take isl_pw_qpolynomial_fold *pwf2);
7123         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
7124                 __isl_take isl_union_pw_qpolynomial *upwqp1,
7125                 __isl_take isl_union_pw_qpolynomial *upwqp2);
7126         __isl_give isl_qpolynomial *isl_qpolynomial_sub(
7127                 __isl_take isl_qpolynomial *qp1,
7128                 __isl_take isl_qpolynomial *qp2);
7129         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
7130                 __isl_take isl_pw_qpolynomial *pwqp1,
7131                 __isl_take isl_pw_qpolynomial *pwqp2);
7132         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
7133                 __isl_take isl_union_pw_qpolynomial *upwqp1,
7134                 __isl_take isl_union_pw_qpolynomial *upwqp2);
7135         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
7136                 __isl_take isl_pw_qpolynomial_fold *pwf1,
7137                 __isl_take isl_pw_qpolynomial_fold *pwf2);
7138         __isl_give isl_union_pw_qpolynomial_fold *
7139         isl_union_pw_qpolynomial_fold_fold(
7140                 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
7141                 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
7143         #include <isl/aff.h>
7144         __isl_give isl_pw_aff *isl_pw_aff_union_add(
7145                 __isl_take isl_pw_aff *pwaff1,
7146                 __isl_take isl_pw_aff *pwaff2);
7147         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
7148                 __isl_take isl_pw_multi_aff *pma1,
7149                 __isl_take isl_pw_multi_aff *pma2);
7150         __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
7151                 __isl_take isl_union_pw_aff *upa1,
7152                 __isl_take isl_union_pw_aff *upa2);
7153         __isl_give isl_union_pw_multi_aff *
7154         isl_union_pw_multi_aff_union_add(
7155                 __isl_take isl_union_pw_multi_aff *upma1,
7156                 __isl_take isl_union_pw_multi_aff *upma2);
7157         __isl_give isl_multi_union_pw_aff *
7158         isl_multi_union_pw_aff_union_add(
7159                 __isl_take isl_multi_union_pw_aff *mupa1,
7160                 __isl_take isl_multi_union_pw_aff *mupa2);
7161         __isl_give isl_pw_aff *isl_pw_aff_union_min(
7162                 __isl_take isl_pw_aff *pwaff1,
7163                 __isl_take isl_pw_aff *pwaff2);
7164         __isl_give isl_pw_aff *isl_pw_aff_union_max(
7165                 __isl_take isl_pw_aff *pwaff1,
7166                 __isl_take isl_pw_aff *pwaff2);
7168 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
7169 expression with a domain that is the union of those of C<pwaff1> and
7170 C<pwaff2> and such that on each cell, the quasi-affine expression is
7171 the maximum of those of C<pwaff1> and C<pwaff2>.  If only one of
7172 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
7173 associated expression is the defined one.
7174 This in contrast to the C<isl_pw_aff_max> function, which is
7175 only defined on the shared definition domain of the arguments.
7177         #include <isl/val.h>
7178         __isl_give isl_multi_val *isl_multi_val_add_val(
7179                 __isl_take isl_multi_val *mv,
7180                 __isl_take isl_val *v);
7181         __isl_give isl_multi_val *isl_multi_val_mod_val(
7182                 __isl_take isl_multi_val *mv,
7183                 __isl_take isl_val *v);
7184         __isl_give isl_multi_val *isl_multi_val_scale_val(
7185                 __isl_take isl_multi_val *mv,
7186                 __isl_take isl_val *v);
7187         __isl_give isl_multi_val *isl_multi_val_scale_down_val(
7188                 __isl_take isl_multi_val *mv,
7189                 __isl_take isl_val *v);
7191         #include <isl/aff.h>
7192         __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
7193                 __isl_take isl_val *mod);
7194         __isl_give isl_pw_aff *isl_pw_aff_mod_val(
7195                 __isl_take isl_pw_aff *pa,
7196                 __isl_take isl_val *mod);
7197         __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
7198                 __isl_take isl_union_pw_aff *upa,
7199                 __isl_take isl_val *f);
7200         __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
7201                 __isl_take isl_val *v);
7202         __isl_give isl_multi_aff *isl_multi_aff_scale_val(
7203                 __isl_take isl_multi_aff *ma,
7204                 __isl_take isl_val *v);
7205         __isl_give isl_pw_aff *isl_pw_aff_scale_val(
7206                 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
7207         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
7208                 __isl_take isl_multi_pw_aff *mpa,
7209                 __isl_take isl_val *v);
7210         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
7211                 __isl_take isl_pw_multi_aff *pma,
7212                 __isl_take isl_val *v);
7213         __isl_give isl_union_pw_multi_aff *
7214         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
7215                 __isl_take isl_union_pw_aff *upa,
7216                 __isl_take isl_val *f);
7217         isl_union_pw_multi_aff_scale_val(
7218                 __isl_take isl_union_pw_multi_aff *upma,
7219                 __isl_take isl_val *val);
7220         __isl_give isl_multi_union_pw_aff *
7221         isl_multi_union_pw_aff_scale_val(
7222                 __isl_take isl_multi_union_pw_aff *mupa,
7223                 __isl_take isl_val *v);
7224         __isl_give isl_aff *isl_aff_scale_down_ui(
7225                 __isl_take isl_aff *aff, unsigned f);
7226         __isl_give isl_aff *isl_aff_scale_down_val(
7227                 __isl_take isl_aff *aff, __isl_take isl_val *v);
7228         __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
7229                 __isl_take isl_multi_aff *ma,
7230                 __isl_take isl_val *v);
7231         __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
7232                 __isl_take isl_pw_aff *pa,
7233                 __isl_take isl_val *f);
7234         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
7235                 __isl_take isl_multi_pw_aff *mpa,
7236                 __isl_take isl_val *v);
7237         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
7238                 __isl_take isl_pw_multi_aff *pma,
7239                 __isl_take isl_val *v);
7240         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
7241                 __isl_take isl_union_pw_aff *upa,
7242                 __isl_take isl_val *v);
7243         __isl_give isl_union_pw_multi_aff *
7244         isl_union_pw_multi_aff_scale_down_val(
7245                 __isl_take isl_union_pw_multi_aff *upma,
7246                 __isl_take isl_val *val);
7247         __isl_give isl_multi_union_pw_aff *
7248         isl_multi_union_pw_aff_scale_down_val(
7249                 __isl_take isl_multi_union_pw_aff *mupa,
7250                 __isl_take isl_val *v);
7252         #include <isl/polynomial.h>
7253         __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
7254                 __isl_take isl_qpolynomial *qp,
7255                 __isl_take isl_val *v);
7256         __isl_give isl_qpolynomial_fold *
7257         isl_qpolynomial_fold_scale_val(
7258                 __isl_take isl_qpolynomial_fold *fold,
7259                 __isl_take isl_val *v);
7260         __isl_give isl_pw_qpolynomial *
7261         isl_pw_qpolynomial_scale_val(
7262                 __isl_take isl_pw_qpolynomial *pwqp,
7263                 __isl_take isl_val *v);
7264         __isl_give isl_pw_qpolynomial_fold *
7265         isl_pw_qpolynomial_fold_scale_val(
7266                 __isl_take isl_pw_qpolynomial_fold *pwf,
7267                 __isl_take isl_val *v);
7268         __isl_give isl_union_pw_qpolynomial *
7269         isl_union_pw_qpolynomial_scale_val(
7270                 __isl_take isl_union_pw_qpolynomial *upwqp,
7271                 __isl_take isl_val *v);
7272         __isl_give isl_union_pw_qpolynomial_fold *
7273         isl_union_pw_qpolynomial_fold_scale_val(
7274                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7275                 __isl_take isl_val *v);
7276         __isl_give isl_qpolynomial *
7277         isl_qpolynomial_scale_down_val(
7278                 __isl_take isl_qpolynomial *qp,
7279                 __isl_take isl_val *v);
7280         __isl_give isl_qpolynomial_fold *
7281         isl_qpolynomial_fold_scale_down_val(
7282                 __isl_take isl_qpolynomial_fold *fold,
7283                 __isl_take isl_val *v);
7284         __isl_give isl_pw_qpolynomial *
7285         isl_pw_qpolynomial_scale_down_val(
7286                 __isl_take isl_pw_qpolynomial *pwqp,
7287                 __isl_take isl_val *v);
7288         __isl_give isl_pw_qpolynomial_fold *
7289         isl_pw_qpolynomial_fold_scale_down_val(
7290                 __isl_take isl_pw_qpolynomial_fold *pwf,
7291                 __isl_take isl_val *v);
7292         __isl_give isl_union_pw_qpolynomial *
7293         isl_union_pw_qpolynomial_scale_down_val(
7294                 __isl_take isl_union_pw_qpolynomial *upwqp,
7295                 __isl_take isl_val *v);
7296         __isl_give isl_union_pw_qpolynomial_fold *
7297         isl_union_pw_qpolynomial_fold_scale_down_val(
7298                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7299                 __isl_take isl_val *v);
7301         #include <isl/val.h>
7302         __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
7303                 __isl_take isl_multi_val *mv1,
7304                 __isl_take isl_multi_val *mv2);
7305         __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
7306                 __isl_take isl_multi_val *mv1,
7307                 __isl_take isl_multi_val *mv2);
7308         __isl_give isl_multi_val *
7309         isl_multi_val_scale_down_multi_val(
7310                 __isl_take isl_multi_val *mv1,
7311                 __isl_take isl_multi_val *mv2);
7313         #include <isl/aff.h>
7314         __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
7315                 __isl_take isl_multi_aff *ma,
7316                 __isl_take isl_multi_val *mv);
7317         __isl_give isl_multi_union_pw_aff *
7318         isl_multi_union_pw_aff_mod_multi_val(
7319                 __isl_take isl_multi_union_pw_aff *upma,
7320                 __isl_take isl_multi_val *mv);
7321         __isl_give isl_multi_pw_aff *
7322         isl_multi_pw_aff_mod_multi_val(
7323                 __isl_take isl_multi_pw_aff *mpa,
7324                 __isl_take isl_multi_val *mv);
7325         __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
7326                 __isl_take isl_multi_aff *ma,
7327                 __isl_take isl_multi_val *mv);
7328         __isl_give isl_pw_multi_aff *
7329         isl_pw_multi_aff_scale_multi_val(
7330                 __isl_take isl_pw_multi_aff *pma,
7331                 __isl_take isl_multi_val *mv);
7332         __isl_give isl_multi_pw_aff *
7333         isl_multi_pw_aff_scale_multi_val(
7334                 __isl_take isl_multi_pw_aff *mpa,
7335                 __isl_take isl_multi_val *mv);
7336         __isl_give isl_multi_union_pw_aff *
7337         isl_multi_union_pw_aff_scale_multi_val(
7338                 __isl_take isl_multi_union_pw_aff *mupa,
7339                 __isl_take isl_multi_val *mv);
7340         __isl_give isl_union_pw_multi_aff *
7341         isl_union_pw_multi_aff_scale_multi_val(
7342                 __isl_take isl_union_pw_multi_aff *upma,
7343                 __isl_take isl_multi_val *mv);
7344         __isl_give isl_multi_aff *
7345         isl_multi_aff_scale_down_multi_val(
7346                 __isl_take isl_multi_aff *ma,
7347                 __isl_take isl_multi_val *mv);
7348         __isl_give isl_multi_pw_aff *
7349         isl_multi_pw_aff_scale_down_multi_val(
7350                 __isl_take isl_multi_pw_aff *mpa,
7351                 __isl_take isl_multi_val *mv);
7352         __isl_give isl_multi_union_pw_aff *
7353         isl_multi_union_pw_aff_scale_down_multi_val(
7354                 __isl_take isl_multi_union_pw_aff *mupa,
7355                 __isl_take isl_multi_val *mv);
7357 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
7358 by the corresponding elements of C<mv>.
7360         #include <isl/aff.h>
7361         __isl_give isl_aff *isl_aff_mul(
7362                 __isl_take isl_aff *aff1,
7363                 __isl_take isl_aff *aff2);
7364         __isl_give isl_aff *isl_aff_div(
7365                 __isl_take isl_aff *aff1,
7366                 __isl_take isl_aff *aff2);
7367         __isl_give isl_pw_aff *isl_pw_aff_mul(
7368                 __isl_take isl_pw_aff *pwaff1,
7369                 __isl_take isl_pw_aff *pwaff2);
7370         __isl_give isl_pw_aff *isl_pw_aff_div(
7371                 __isl_take isl_pw_aff *pa1,
7372                 __isl_take isl_pw_aff *pa2);
7373         __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
7374                 __isl_take isl_pw_aff *pa1,
7375                 __isl_take isl_pw_aff *pa2);
7376         __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
7377                 __isl_take isl_pw_aff *pa1,
7378                 __isl_take isl_pw_aff *pa2);
7380 When multiplying two affine expressions, at least one of the two needs
7381 to be a constant.  Similarly, when dividing an affine expression by another,
7382 the second expression needs to be a constant.
7383 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
7384 rounding towards zero.  C<isl_pw_aff_tdiv_r> computes the corresponding
7385 remainder.
7387         #include <isl/polynomial.h>
7388         __isl_give isl_qpolynomial *isl_qpolynomial_mul(
7389                 __isl_take isl_qpolynomial *qp1,
7390                 __isl_take isl_qpolynomial *qp2);
7391         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
7392                 __isl_take isl_pw_qpolynomial *pwqp1,
7393                 __isl_take isl_pw_qpolynomial *pwqp2);
7394         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
7395                 __isl_take isl_union_pw_qpolynomial *upwqp1,
7396                 __isl_take isl_union_pw_qpolynomial *upwqp2);
7398 =back
7400 =head3 Lexicographic Optimization
7402 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
7403 the following functions
7404 compute a set that contains the lexicographic minimum or maximum
7405 of the elements in C<set> (or C<bset>) for those values of the parameters
7406 that satisfy C<dom>.
7407 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
7408 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
7409 has no elements.
7410 In other words, the union of the parameter values
7411 for which the result is non-empty and of C<*empty>
7412 is equal to C<dom>.
7414         #include <isl/set.h>
7415         __isl_give isl_set *isl_basic_set_partial_lexmin(
7416                 __isl_take isl_basic_set *bset,
7417                 __isl_take isl_basic_set *dom,
7418                 __isl_give isl_set **empty);
7419         __isl_give isl_set *isl_basic_set_partial_lexmax(
7420                 __isl_take isl_basic_set *bset,
7421                 __isl_take isl_basic_set *dom,
7422                 __isl_give isl_set **empty);
7423         __isl_give isl_set *isl_set_partial_lexmin(
7424                 __isl_take isl_set *set, __isl_take isl_set *dom,
7425                 __isl_give isl_set **empty);
7426         __isl_give isl_set *isl_set_partial_lexmax(
7427                 __isl_take isl_set *set, __isl_take isl_set *dom,
7428                 __isl_give isl_set **empty);
7430 Given a (basic) set C<set> (or C<bset>), the following functions simply
7431 return a set containing the lexicographic minimum or maximum
7432 of the elements in C<set> (or C<bset>).
7433 In case of union sets, the optimum is computed per space.
7435         #include <isl/set.h>
7436         __isl_give isl_set *isl_basic_set_lexmin(
7437                 __isl_take isl_basic_set *bset);
7438         __isl_give isl_set *isl_basic_set_lexmax(
7439                 __isl_take isl_basic_set *bset);
7440         __isl_give isl_set *isl_set_lexmin(
7441                 __isl_take isl_set *set);
7442         __isl_give isl_set *isl_set_lexmax(
7443                 __isl_take isl_set *set);
7444         __isl_give isl_union_set *isl_union_set_lexmin(
7445                 __isl_take isl_union_set *uset);
7446         __isl_give isl_union_set *isl_union_set_lexmax(
7447                 __isl_take isl_union_set *uset);
7449 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
7450 the following functions
7451 compute a relation that maps each element of C<dom>
7452 to the single lexicographic minimum or maximum
7453 of the elements that are associated to that same
7454 element in C<map> (or C<bmap>).
7455 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
7456 that contains the elements in C<dom> that do not map
7457 to any elements in C<map> (or C<bmap>).
7458 In other words, the union of the domain of the result and of C<*empty>
7459 is equal to C<dom>.
7461         #include <isl/map.h>
7462         __isl_give isl_map *isl_basic_map_partial_lexmax(
7463                 __isl_take isl_basic_map *bmap,
7464                 __isl_take isl_basic_set *dom,
7465                 __isl_give isl_set **empty);
7466         __isl_give isl_map *isl_basic_map_partial_lexmin(
7467                 __isl_take isl_basic_map *bmap,
7468                 __isl_take isl_basic_set *dom,
7469                 __isl_give isl_set **empty);
7470         __isl_give isl_map *isl_map_partial_lexmax(
7471                 __isl_take isl_map *map, __isl_take isl_set *dom,
7472                 __isl_give isl_set **empty);
7473         __isl_give isl_map *isl_map_partial_lexmin(
7474                 __isl_take isl_map *map, __isl_take isl_set *dom,
7475                 __isl_give isl_set **empty);
7477 Given a (basic) map C<map> (or C<bmap>), the following functions simply
7478 return a map mapping each element in the domain of
7479 C<map> (or C<bmap>) to the lexicographic minimum or maximum
7480 of all elements associated to that element.
7481 In case of union relations, the optimum is computed per space.
7483         #include <isl/map.h>
7484         __isl_give isl_map *isl_basic_map_lexmin(
7485                 __isl_take isl_basic_map *bmap);
7486         __isl_give isl_map *isl_basic_map_lexmax(
7487                 __isl_take isl_basic_map *bmap);
7488         __isl_give isl_map *isl_map_lexmin(
7489                 __isl_take isl_map *map);
7490         __isl_give isl_map *isl_map_lexmax(
7491                 __isl_take isl_map *map);
7492         __isl_give isl_union_map *isl_union_map_lexmin(
7493                 __isl_take isl_union_map *umap);
7494         __isl_give isl_union_map *isl_union_map_lexmax(
7495                 __isl_take isl_union_map *umap);
7497 The following functions return their result in the form of
7498 a piecewise multi-affine expression,
7499 but are otherwise equivalent to the corresponding functions
7500 returning a basic set or relation.
7502         #include <isl/set.h>
7503         __isl_give isl_pw_multi_aff *
7504         isl_basic_set_partial_lexmin_pw_multi_aff(
7505                 __isl_take isl_basic_set *bset,
7506                 __isl_take isl_basic_set *dom,
7507                 __isl_give isl_set **empty);
7508         __isl_give isl_pw_multi_aff *
7509         isl_basic_set_partial_lexmax_pw_multi_aff(
7510                 __isl_take isl_basic_set *bset,
7511                 __isl_take isl_basic_set *dom,
7512                 __isl_give isl_set **empty);
7513         __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
7514                 __isl_take isl_set *set);
7515         __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
7516                 __isl_take isl_set *set);
7518         #include <isl/map.h>
7519         __isl_give isl_pw_multi_aff *
7520         isl_basic_map_lexmin_pw_multi_aff(
7521                 __isl_take isl_basic_map *bmap);
7522         __isl_give isl_pw_multi_aff *
7523         isl_basic_map_partial_lexmin_pw_multi_aff(
7524                 __isl_take isl_basic_map *bmap,
7525                 __isl_take isl_basic_set *dom,
7526                 __isl_give isl_set **empty);
7527         __isl_give isl_pw_multi_aff *
7528         isl_basic_map_partial_lexmax_pw_multi_aff(
7529                 __isl_take isl_basic_map *bmap,
7530                 __isl_take isl_basic_set *dom,
7531                 __isl_give isl_set **empty);
7532         __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
7533                 __isl_take isl_map *map);
7534         __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
7535                 __isl_take isl_map *map);
7537 The following functions return the lexicographic minimum or maximum
7538 on the shared domain of the inputs and the single defined function
7539 on those parts of the domain where only a single function is defined.
7541         #include <isl/aff.h>
7542         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
7543                 __isl_take isl_pw_multi_aff *pma1,
7544                 __isl_take isl_pw_multi_aff *pma2);
7545         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
7546                 __isl_take isl_pw_multi_aff *pma1,
7547                 __isl_take isl_pw_multi_aff *pma2);
7549 If the input to a lexicographic optimization problem has
7550 multiple constraints with the same coefficients for the optimized
7551 variables, then, by default, this symmetry is exploited by
7552 replacing those constraints by a single constraint with
7553 an abstract bound, which is in turn bounded by the corresponding terms
7554 in the original constraints.
7555 Without this optimization, the solver would typically consider
7556 all possible orderings of those original bounds, resulting in a needless
7557 decomposition of the domain.
7558 However, the optimization can also result in slowdowns since
7559 an extra parameter is introduced that may get used in additional
7560 integer divisions.
7561 The following option determines whether symmetry detection is applied
7562 during lexicographic optimization.
7564         #include <isl/options.h>
7565         isl_stat isl_options_set_pip_symmetry(isl_ctx *ctx,
7566                 int val);
7567         int isl_options_get_pip_symmetry(isl_ctx *ctx);
7569 =begin latex
7571 See also \autoref{s:offline}.
7573 =end latex
7575 =head2 Ternary Operations
7577         #include <isl/aff.h>
7578         __isl_give isl_pw_aff *isl_pw_aff_cond(
7579                 __isl_take isl_pw_aff *cond,
7580                 __isl_take isl_pw_aff *pwaff_true,
7581                 __isl_take isl_pw_aff *pwaff_false);
7583 The function C<isl_pw_aff_cond> performs a conditional operator
7584 and returns an expression that is equal to C<pwaff_true>
7585 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
7586 where C<cond> is zero.
7588 =head2 Lists
7590 Lists are defined over several element types, including
7591 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_union_pw_aff>,
7592 C<isl_union_pw_multi_aff>, C<isl_constraint>,
7593 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
7594 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
7595 Here we take lists of C<isl_set>s as an example.
7596 Lists can be created, copied, modified and freed using the following functions.
7598         #include <isl/set.h>
7599         __isl_give isl_set_list *isl_set_list_from_set(
7600                 __isl_take isl_set *el);
7601         __isl_give isl_set_list *isl_set_list_alloc(
7602                 isl_ctx *ctx, int n);
7603         __isl_give isl_set_list *isl_set_list_copy(
7604                 __isl_keep isl_set_list *list);
7605         __isl_give isl_set_list *isl_set_list_insert(
7606                 __isl_take isl_set_list *list, unsigned pos,
7607                 __isl_take isl_set *el);
7608         __isl_give isl_set_list *isl_set_list_add(
7609                 __isl_take isl_set_list *list,
7610                 __isl_take isl_set *el);
7611         __isl_give isl_set_list *isl_set_list_drop(
7612                 __isl_take isl_set_list *list,
7613                 unsigned first, unsigned n);
7614         __isl_give isl_set_list *isl_set_list_set_set(
7615                 __isl_take isl_set_list *list, int index,
7616                 __isl_take isl_set *set);
7617         __isl_give isl_set_list *isl_set_list_concat(
7618                 __isl_take isl_set_list *list1,
7619                 __isl_take isl_set_list *list2);
7620         __isl_give isl_set_list *isl_set_list_map(
7621                 __isl_take isl_set_list *list,
7622                 __isl_give isl_set *(*fn)(__isl_take isl_set *el,
7623                         void *user),
7624                 void *user);
7625         __isl_give isl_set_list *isl_set_list_sort(
7626                 __isl_take isl_set_list *list,
7627                 int (*cmp)(__isl_keep isl_set *a,
7628                         __isl_keep isl_set *b, void *user),
7629                 void *user);
7630         __isl_null isl_set_list *isl_set_list_free(
7631                 __isl_take isl_set_list *list);
7633 C<isl_set_list_alloc> creates an empty list with an initial capacity
7634 for C<n> elements.  C<isl_set_list_insert> and C<isl_set_list_add>
7635 add elements to a list, increasing its capacity as needed.
7636 C<isl_set_list_from_set> creates a list with a single element.
7638 Lists can be inspected using the following functions.
7640         #include <isl/set.h>
7641         int isl_set_list_n_set(__isl_keep isl_set_list *list);
7642         __isl_give isl_set *isl_set_list_get_set(
7643                 __isl_keep isl_set_list *list, int index);
7644         isl_stat isl_set_list_foreach(__isl_keep isl_set_list *list,
7645                 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7646                 void *user);
7647         isl_stat isl_set_list_foreach_scc(
7648                 __isl_keep isl_set_list *list,
7649                 isl_bool (*follows)(__isl_keep isl_set *a,
7650                         __isl_keep isl_set *b, void *user),
7651                 void *follows_user,
7652                 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7653                 void *fn_user);
7655 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
7656 strongly connected components of the graph with as vertices the elements
7657 of C<list> and a directed edge from vertex C<b> to vertex C<a>
7658 iff C<follows(a, b)> returns C<isl_bool_true>.  The callbacks C<follows> and
7659 C<fn> should return C<isl_bool_error> or C<isl_stat_error> on error.
7661 Lists can be printed using
7663         #include <isl/set.h>
7664         __isl_give isl_printer *isl_printer_print_set_list(
7665                 __isl_take isl_printer *p,
7666                 __isl_keep isl_set_list *list);
7668 =head2 Associative arrays
7670 Associative arrays map isl objects of a specific type to isl objects
7671 of some (other) specific type.  They are defined for several pairs
7672 of types, including (C<isl_map>, C<isl_basic_set>),
7673 (C<isl_id>, C<isl_ast_expr>),
7674 (C<isl_id>, C<isl_id>) and
7675 (C<isl_id>, C<isl_pw_aff>).
7676 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
7677 as an example.
7679 Associative arrays can be created, copied and freed using
7680 the following functions.
7682         #include <isl/id_to_ast_expr.h>
7683         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
7684                 isl_ctx *ctx, int min_size);
7685         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
7686                 __isl_keep isl_id_to_ast_expr *id2expr);
7687         __isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
7688                 __isl_take isl_id_to_ast_expr *id2expr);
7690 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
7691 to specify the expected size of the associative array.
7692 The associative array will be grown automatically as needed.
7694 Associative arrays can be inspected using the following functions.
7696         #include <isl/id_to_ast_expr.h>
7697         __isl_give isl_maybe_isl_ast_expr
7698         isl_id_to_ast_expr_try_get(
7699                 __isl_keep isl_id_to_ast_expr *id2expr,
7700                 __isl_keep isl_id *key);
7701         isl_bool isl_id_to_ast_expr_has(
7702                 __isl_keep isl_id_to_ast_expr *id2expr,
7703                 __isl_keep isl_id *key);
7704         __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
7705                 __isl_keep isl_id_to_ast_expr *id2expr,
7706                 __isl_take isl_id *key);
7707         isl_stat isl_id_to_ast_expr_foreach(
7708                 __isl_keep isl_id_to_ast_expr *id2expr,
7709                 isl_stat (*fn)(__isl_take isl_id *key,
7710                         __isl_take isl_ast_expr *val, void *user),
7711                 void *user);
7713 The function C<isl_id_to_ast_expr_try_get> returns a structure
7714 containing two elements, C<valid> and C<value>.
7715 If there is a value associated to the key, then C<valid>
7716 is set to C<isl_bool_true> and C<value> contains a copy of
7717 the associated value.  Otherwise C<value> is C<NULL> and
7718 C<valid> may be C<isl_bool_error> or C<isl_bool_false> depending
7719 on whether some error has occurred or there simply is no associated value.
7720 The function C<isl_id_to_ast_expr_has> returns the C<valid> field
7721 in the structure and
7722 the function C<isl_id_to_ast_expr_get> returns the C<value> field.
7724 Associative arrays can be modified using the following functions.
7726         #include <isl/id_to_ast_expr.h>
7727         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
7728                 __isl_take isl_id_to_ast_expr *id2expr,
7729                 __isl_take isl_id *key,
7730                 __isl_take isl_ast_expr *val);
7731         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
7732                 __isl_take isl_id_to_ast_expr *id2expr,
7733                 __isl_take isl_id *key);
7735 Associative arrays can be printed using the following function.
7737         #include <isl/id_to_ast_expr.h>
7738         __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
7739                 __isl_take isl_printer *p,
7740                 __isl_keep isl_id_to_ast_expr *id2expr);
7742 =head2 Vectors
7744 Vectors can be created, copied and freed using the following functions.
7746         #include <isl/vec.h>
7747         __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
7748                 unsigned size);
7749         __isl_give isl_vec *isl_vec_zero(isl_ctx *ctx,
7750                 unsigned size);
7751         __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
7752         __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
7754 Note that the elements of a vector created by C<isl_vec_alloc>
7755 may have arbitrary values.
7756 A vector created by C<isl_vec_zero> has elements with value zero.
7757 The elements can be changed and inspected using the following functions.
7759         int isl_vec_size(__isl_keep isl_vec *vec);
7760         __isl_give isl_val *isl_vec_get_element_val(
7761                 __isl_keep isl_vec *vec, int pos);
7762         __isl_give isl_vec *isl_vec_set_element_si(
7763                 __isl_take isl_vec *vec, int pos, int v);
7764         __isl_give isl_vec *isl_vec_set_element_val(
7765                 __isl_take isl_vec *vec, int pos,
7766                 __isl_take isl_val *v);
7767         __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
7768                 int v);
7769         __isl_give isl_vec *isl_vec_set_val(
7770                 __isl_take isl_vec *vec, __isl_take isl_val *v);
7771         int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
7772                 __isl_keep isl_vec *vec2, int pos);
7774 C<isl_vec_get_element> will return a negative value if anything went wrong.
7775 In that case, the value of C<*v> is undefined.
7777 The following function can be used to concatenate two vectors.
7779         __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
7780                 __isl_take isl_vec *vec2);
7782 =head2 Matrices
7784 Matrices can be created, copied and freed using the following functions.
7786         #include <isl/mat.h>
7787         __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
7788                 unsigned n_row, unsigned n_col);
7789         __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
7790         __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
7792 Note that the elements of a newly created matrix may have arbitrary values.
7793 The elements can be changed and inspected using the following functions.
7795         int isl_mat_rows(__isl_keep isl_mat *mat);
7796         int isl_mat_cols(__isl_keep isl_mat *mat);
7797         __isl_give isl_val *isl_mat_get_element_val(
7798                 __isl_keep isl_mat *mat, int row, int col);
7799         __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
7800                 int row, int col, int v);
7801         __isl_give isl_mat *isl_mat_set_element_val(
7802                 __isl_take isl_mat *mat, int row, int col,
7803                 __isl_take isl_val *v);
7805 The following function computes the rank of a matrix.
7806 The return value may be -1 if some error occurred.
7808         #include <isl/mat.h>
7809         int isl_mat_rank(__isl_keep isl_mat *mat);
7811 The following function can be used to compute the (right) inverse
7812 of a matrix, i.e., a matrix such that the product of the original
7813 and the inverse (in that order) is a multiple of the identity matrix.
7814 The input matrix is assumed to be of full row-rank.
7816         __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
7818 The following function can be used to compute the (right) kernel
7819 (or null space) of a matrix, i.e., a matrix such that the product of
7820 the original and the kernel (in that order) is the zero matrix.
7822         __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
7824 The following function computes a basis for the space spanned
7825 by the rows of a matrix.
7827         __isl_give isl_mat *isl_mat_row_basis(
7828                 __isl_take isl_mat *mat);
7830 The following function computes rows that extend a basis of C<mat1>
7831 to a basis that also covers C<mat2>.
7833         __isl_give isl_mat *isl_mat_row_basis_extension(
7834                 __isl_take isl_mat *mat1,
7835                 __isl_take isl_mat *mat2);
7837 The following function checks whether there is no linear dependence
7838 among the combined rows of "mat1" and "mat2" that is not already present
7839 in "mat1" or "mat2" individually.
7840 If "mat1" and "mat2" have linearly independent rows by themselves,
7841 then this means that there is no linear dependence among all rows together.
7843         isl_bool isl_mat_has_linearly_independent_rows(
7844                 __isl_keep isl_mat *mat1,
7845                 __isl_keep isl_mat *mat2);
7847 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
7849 The following functions determine
7850 an upper or lower bound on a quasipolynomial over its domain.
7852         __isl_give isl_pw_qpolynomial_fold *
7853         isl_pw_qpolynomial_bound(
7854                 __isl_take isl_pw_qpolynomial *pwqp,
7855                 enum isl_fold type, int *tight);
7857         __isl_give isl_union_pw_qpolynomial_fold *
7858         isl_union_pw_qpolynomial_bound(
7859                 __isl_take isl_union_pw_qpolynomial *upwqp,
7860                 enum isl_fold type, int *tight);
7862 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
7863 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
7864 is the returned bound is known be tight, i.e., for each value
7865 of the parameters there is at least
7866 one element in the domain that reaches the bound.
7867 If the domain of C<pwqp> is not wrapping, then the bound is computed
7868 over all elements in that domain and the result has a purely parametric
7869 domain.  If the domain of C<pwqp> is wrapping, then the bound is
7870 computed over the range of the wrapped relation.  The domain of the
7871 wrapped relation becomes the domain of the result.
7873 =head2 Parametric Vertex Enumeration
7875 The parametric vertex enumeration described in this section
7876 is mainly intended to be used internally and by the C<barvinok>
7877 library.
7879         #include <isl/vertices.h>
7880         __isl_give isl_vertices *isl_basic_set_compute_vertices(
7881                 __isl_keep isl_basic_set *bset);
7883 The function C<isl_basic_set_compute_vertices> performs the
7884 actual computation of the parametric vertices and the chamber
7885 decomposition and stores the result in an C<isl_vertices> object.
7886 This information can be queried by either iterating over all
7887 the vertices or iterating over all the chambers or cells
7888 and then iterating over all vertices that are active on the chamber.
7890         isl_stat isl_vertices_foreach_vertex(
7891                 __isl_keep isl_vertices *vertices,
7892                 isl_stat (*fn)(__isl_take isl_vertex *vertex,
7893                         void *user), void *user);
7895         isl_stat isl_vertices_foreach_cell(
7896                 __isl_keep isl_vertices *vertices,
7897                 isl_stat (*fn)(__isl_take isl_cell *cell,
7898                         void *user), void *user);
7899         isl_stat isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
7900                 isl_stat (*fn)(__isl_take isl_vertex *vertex,
7901                         void *user), void *user);
7903 Other operations that can be performed on an C<isl_vertices> object are
7904 the following.
7906         int isl_vertices_get_n_vertices(
7907                 __isl_keep isl_vertices *vertices);
7908         __isl_null isl_vertices *isl_vertices_free(
7909                 __isl_take isl_vertices *vertices);
7911 Vertices can be inspected and destroyed using the following functions.
7913         int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
7914         __isl_give isl_basic_set *isl_vertex_get_domain(
7915                 __isl_keep isl_vertex *vertex);
7916         __isl_give isl_multi_aff *isl_vertex_get_expr(
7917                 __isl_keep isl_vertex *vertex);
7918         void isl_vertex_free(__isl_take isl_vertex *vertex);
7920 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
7921 describing the vertex in terms of the parameters,
7922 while C<isl_vertex_get_domain> returns the activity domain
7923 of the vertex.
7925 Chambers can be inspected and destroyed using the following functions.
7927         __isl_give isl_basic_set *isl_cell_get_domain(
7928                 __isl_keep isl_cell *cell);
7929         void isl_cell_free(__isl_take isl_cell *cell);
7931 =head1 Polyhedral Compilation Library
7933 This section collects functionality in C<isl> that has been specifically
7934 designed for use during polyhedral compilation.
7936 =head2 Schedule Trees
7938 A schedule tree is a structured representation of a schedule,
7939 assigning a relative order to a set of domain elements.
7940 The relative order expressed by the schedule tree is
7941 defined recursively.  In particular, the order between
7942 two domain elements is determined by the node that is closest
7943 to the root that refers to both elements and that orders them apart.
7944 Each node in the tree is of one of several types.
7945 The root node is always of type C<isl_schedule_node_domain>
7946 (or C<isl_schedule_node_extension>)
7947 and it describes the (extra) domain elements to which the schedule applies.
7948 The other types of nodes are as follows.
7950 =over
7952 =item C<isl_schedule_node_band>
7954 A band of schedule dimensions.  Each schedule dimension is represented
7955 by a union piecewise quasi-affine expression.  If this expression
7956 assigns a different value to two domain elements, while all previous
7957 schedule dimensions in the same band assign them the same value,
7958 then the two domain elements are ordered according to these two
7959 different values.
7960 Each expression is required to be total in the domain elements
7961 that reach the band node.
7963 =item C<isl_schedule_node_expansion>
7965 An expansion node maps each of the domain elements that reach the node
7966 to one or more domain elements.  The image of this mapping forms
7967 the set of domain elements that reach the child of the expansion node.
7968 The function that maps each of the expanded domain elements
7969 to the original domain element from which it was expanded
7970 is called the contraction.
7972 =item C<isl_schedule_node_filter>
7974 A filter node does not impose any ordering, but rather intersects
7975 the set of domain elements that the current subtree refers to
7976 with a given union set.  The subtree of the filter node only
7977 refers to domain elements in the intersection.
7978 A filter node is typically only used as a child of a sequence or
7979 set node.
7981 =item C<isl_schedule_node_leaf>
7983 A leaf of the schedule tree.  Leaf nodes do not impose any ordering.
7985 =item C<isl_schedule_node_mark>
7987 A mark node can be used to attach any kind of information to a subtree
7988 of the schedule tree.
7990 =item C<isl_schedule_node_sequence>
7992 A sequence node has one or more children, each of which is a filter node.
7993 The filters on these filter nodes form a partition of
7994 the domain elements that the current subtree refers to.
7995 If two domain elements appear in distinct filters then the sequence
7996 node orders them according to the child positions of the corresponding
7997 filter nodes.
7999 =item C<isl_schedule_node_set>
8001 A set node is similar to a sequence node, except that
8002 it expresses that domain elements appearing in distinct filters
8003 may have any order.  The order of the children of a set node
8004 is therefore also immaterial.
8006 =back
8008 The following node types are only supported by the AST generator.
8010 =over
8012 =item C<isl_schedule_node_context>
8014 The context describes constraints on the parameters and
8015 the schedule dimensions of outer
8016 bands that the AST generator may assume to hold.  It is also the only
8017 kind of node that may introduce additional parameters.
8018 The space of the context is that of the flat product of the outer
8019 band nodes.  In particular, if there are no outer band nodes, then
8020 this space is the unnamed zero-dimensional space.
8021 Since a context node references the outer band nodes, any tree
8022 containing a context node is considered to be anchored.
8024 =item C<isl_schedule_node_extension>
8026 An extension node instructs the AST generator to add additional
8027 domain elements that need to be scheduled.
8028 The additional domain elements are described by the range of
8029 the extension map in terms of the outer schedule dimensions,
8030 i.e., the flat product of the outer band nodes.
8031 Note that domain elements are added whenever the AST generator
8032 reaches the extension node, meaning that there are still some
8033 active domain elements for which an AST needs to be generated.
8034 The conditions under which some domain elements are still active
8035 may however not be completely described by the outer AST nodes
8036 generated at that point.
8037 Since an extension node references the outer band nodes, any tree
8038 containing an extension node is considered to be anchored.
8040 An extension node may also appear as the root of a schedule tree,
8041 when it is intended to be inserted into another tree
8042 using C<isl_schedule_node_graft_before> or C<isl_schedule_node_graft_after>.
8043 In this case, the domain of the extension node should
8044 correspond to the flat product of the outer band nodes
8045 in this other schedule tree at the point where the extension tree
8046 will be inserted.
8048 =item C<isl_schedule_node_guard>
8050 The guard describes constraints on the parameters and
8051 the schedule dimensions of outer
8052 bands that need to be enforced by the outer nodes
8053 in the generated AST.
8054 That is, the part of the AST that is generated from descendants
8055 of the guard node can assume that these constraints are satisfied.
8056 The space of the guard is that of the flat product of the outer
8057 band nodes.  In particular, if there are no outer band nodes, then
8058 this space is the unnamed zero-dimensional space.
8059 Since a guard node references the outer band nodes, any tree
8060 containing a guard node is considered to be anchored.
8062 =back
8064 Except for the C<isl_schedule_node_context> nodes,
8065 none of the nodes may introduce any parameters that were not
8066 already present in the root domain node.
8068 A schedule tree is encapsulated in an C<isl_schedule> object.
8069 The simplest such objects, those with a tree consisting of single domain node,
8070 can be created using the following functions with either an empty
8071 domain or a given domain.
8073         #include <isl/schedule.h>
8074         __isl_give isl_schedule *isl_schedule_empty(
8075                 __isl_take isl_space *space);
8076         __isl_give isl_schedule *isl_schedule_from_domain(
8077                 __isl_take isl_union_set *domain);
8079 The function C<isl_schedule_constraints_compute_schedule> described
8080 in L</"Scheduling"> can also be used to construct schedules.
8082 C<isl_schedule> objects may be copied and freed using the following functions.
8084         #include <isl/schedule.h>
8085         __isl_give isl_schedule *isl_schedule_copy(
8086                 __isl_keep isl_schedule *sched);
8087         __isl_null isl_schedule *isl_schedule_free(
8088                 __isl_take isl_schedule *sched);
8090 The following functions checks whether two C<isl_schedule> objects
8091 are obviously the same.
8093         #include <isl/schedule.h>
8094         isl_bool isl_schedule_plain_is_equal(
8095                 __isl_keep isl_schedule *schedule1,
8096                 __isl_keep isl_schedule *schedule2);
8098 The domain of the schedule, i.e., the domain described by the root node,
8099 can be obtained using the following function.
8101         #include <isl/schedule.h>
8102         __isl_give isl_union_set *isl_schedule_get_domain(
8103                 __isl_keep isl_schedule *schedule);
8105 An extra top-level band node (right underneath the domain node) can
8106 be introduced into the schedule using the following function.
8107 The schedule tree is assumed not to have any anchored nodes.
8109         #include <isl/schedule.h>
8110         __isl_give isl_schedule *
8111         isl_schedule_insert_partial_schedule(
8112                 __isl_take isl_schedule *schedule,
8113                 __isl_take isl_multi_union_pw_aff *partial);
8115 A top-level context node (right underneath the domain node) can
8116 be introduced into the schedule using the following function.
8118         #include <isl/schedule.h>
8119         __isl_give isl_schedule *isl_schedule_insert_context(
8120                 __isl_take isl_schedule *schedule,
8121                 __isl_take isl_set *context)
8123 A top-level guard node (right underneath the domain node) can
8124 be introduced into the schedule using the following function.
8126         #include <isl/schedule.h>
8127         __isl_give isl_schedule *isl_schedule_insert_guard(
8128                 __isl_take isl_schedule *schedule,
8129                 __isl_take isl_set *guard)
8131 A schedule that combines two schedules either in the given
8132 order or in an arbitrary order, i.e., with an C<isl_schedule_node_sequence>
8133 or an C<isl_schedule_node_set> node,
8134 can be created using the following functions.
8136         #include <isl/schedule.h>
8137         __isl_give isl_schedule *isl_schedule_sequence(
8138                 __isl_take isl_schedule *schedule1,
8139                 __isl_take isl_schedule *schedule2);
8140         __isl_give isl_schedule *isl_schedule_set(
8141                 __isl_take isl_schedule *schedule1,
8142                 __isl_take isl_schedule *schedule2);
8144 The domains of the two input schedules need to be disjoint.
8146 The following function can be used to restrict the domain
8147 of a schedule with a domain node as root to be a subset of the given union set.
8148 This operation may remove nodes in the tree that have become
8149 redundant.
8151         #include <isl/schedule.h>
8152         __isl_give isl_schedule *isl_schedule_intersect_domain(
8153                 __isl_take isl_schedule *schedule,
8154                 __isl_take isl_union_set *domain);
8156 The following function can be used to simplify the domain
8157 of a schedule with a domain node as root with respect to the given
8158 parameter domain.
8160         #include <isl/schedule.h>
8161         __isl_give isl_schedule *isl_schedule_gist_domain_params(
8162                 __isl_take isl_schedule *schedule,
8163                 __isl_take isl_set *context);
8165 The following function resets the user pointers on all parameter
8166 and tuple identifiers referenced by the nodes of the given schedule.
8168         #include <isl/schedule.h>
8169         __isl_give isl_schedule *isl_schedule_reset_user(
8170                 __isl_take isl_schedule *schedule);
8172 The following function aligns the parameters of all nodes
8173 in the given schedule to the given space.
8175         #include <isl/schedule.h>
8176         __isl_give isl_schedule *isl_schedule_align_params(
8177                 __isl_take isl_schedule *schedule,
8178                 __isl_take isl_space *space);
8180 The following function allows the user to plug in a given function
8181 in the iteration domains.  The input schedule is not allowed to contain
8182 any expansion nodes.
8184         #include <isl/schedule.h>
8185         __isl_give isl_schedule *
8186         isl_schedule_pullback_union_pw_multi_aff(
8187                 __isl_take isl_schedule *schedule,
8188                 __isl_take isl_union_pw_multi_aff *upma);
8190 The following function can be used to plug in the schedule C<expansion>
8191 in the leaves of C<schedule>, where C<contraction> describes how
8192 the domain elements of C<expansion> map to the domain elements
8193 at the original leaves of C<schedule>.
8194 The resulting schedule will contain expansion nodes, unless
8195 C<contraction> is an identity function.
8197         #include <isl/schedule.h>
8198         __isl_give isl_schedule *isl_schedule_expand(
8199                 __isl_take isl_schedule *schedule,
8200                 __isl_take isl_union_pw_multi_aff *contraction,
8201                 __isl_take isl_schedule *expansion);
8203 An C<isl_union_map> representation of the schedule can be obtained
8204 from an C<isl_schedule> using the following function.
8206         #include <isl/schedule.h>
8207         __isl_give isl_union_map *isl_schedule_get_map(
8208                 __isl_keep isl_schedule *sched);
8210 The resulting relation encodes the same relative ordering as
8211 the schedule by mapping the domain elements to a common schedule space.
8212 If the schedule_separate_components option is set, then the order
8213 of the children of a set node is explicitly encoded in the result.
8214 If the tree contains any expansion nodes, then the relation
8215 is formulated in terms of the expanded domain elements.
8217 Schedules can be read from input using the following functions.
8219         #include <isl/schedule.h>
8220         __isl_give isl_schedule *isl_schedule_read_from_file(
8221                 isl_ctx *ctx, FILE *input);
8222         __isl_give isl_schedule *isl_schedule_read_from_str(
8223                 isl_ctx *ctx, const char *str);
8225 A representation of the schedule can be printed using
8227         #include <isl/schedule.h>
8228         __isl_give isl_printer *isl_printer_print_schedule(
8229                 __isl_take isl_printer *p,
8230                 __isl_keep isl_schedule *schedule);
8231         __isl_give char *isl_schedule_to_str(
8232                 __isl_keep isl_schedule *schedule);
8234 C<isl_schedule_to_str> prints the schedule in flow format.
8236 The schedule tree can be traversed through the use of
8237 C<isl_schedule_node> objects that point to a particular
8238 position in the schedule tree.  Whenever a C<isl_schedule_node>
8239 is used to modify a node in the schedule tree, the original schedule
8240 tree is left untouched and the modifications are performed to a copy
8241 of the tree.  The returned C<isl_schedule_node> then points to
8242 this modified copy of the tree.
8244 The root of the schedule tree can be obtained using the following function.
8246         #include <isl/schedule.h>
8247         __isl_give isl_schedule_node *isl_schedule_get_root(
8248                 __isl_keep isl_schedule *schedule);
8250 A pointer to a newly created schedule tree with a single domain
8251 node can be created using the following functions.
8253         #include <isl/schedule_node.h>
8254         __isl_give isl_schedule_node *
8255         isl_schedule_node_from_domain(
8256                 __isl_take isl_union_set *domain);
8257         __isl_give isl_schedule_node *
8258         isl_schedule_node_from_extension(
8259                 __isl_take isl_union_map *extension);
8261 C<isl_schedule_node_from_extension> creates a tree with an extension
8262 node as root.
8264 Schedule nodes can be copied and freed using the following functions.
8266         #include <isl/schedule_node.h>
8267         __isl_give isl_schedule_node *isl_schedule_node_copy(
8268                 __isl_keep isl_schedule_node *node);
8269         __isl_null isl_schedule_node *isl_schedule_node_free(
8270                 __isl_take isl_schedule_node *node);
8272 The following functions can be used to check if two schedule
8273 nodes point to the same position in the same schedule.
8275         #include <isl/schedule_node.h>
8276         isl_bool isl_schedule_node_is_equal(
8277                 __isl_keep isl_schedule_node *node1,
8278                 __isl_keep isl_schedule_node *node2);
8280 The following properties can be obtained from a schedule node.
8282         #include <isl/schedule_node.h>
8283         enum isl_schedule_node_type isl_schedule_node_get_type(
8284                 __isl_keep isl_schedule_node *node);
8285         enum isl_schedule_node_type
8286         isl_schedule_node_get_parent_type(
8287                 __isl_keep isl_schedule_node *node);
8288         __isl_give isl_schedule *isl_schedule_node_get_schedule(
8289                 __isl_keep isl_schedule_node *node);
8291 The function C<isl_schedule_node_get_type> returns the type of
8292 the node, while C<isl_schedule_node_get_parent_type> returns
8293 type of the parent of the node, which is required to exist.
8294 The function C<isl_schedule_node_get_schedule> returns a copy
8295 to the schedule to which the node belongs.
8297 The following functions can be used to move the schedule node
8298 to a different position in the tree or to check if such a position
8299 exists.
8301         #include <isl/schedule_node.h>
8302         isl_bool isl_schedule_node_has_parent(
8303                 __isl_keep isl_schedule_node *node);
8304         __isl_give isl_schedule_node *isl_schedule_node_parent(
8305                 __isl_take isl_schedule_node *node);
8306         __isl_give isl_schedule_node *isl_schedule_node_root(
8307                 __isl_take isl_schedule_node *node);
8308         __isl_give isl_schedule_node *isl_schedule_node_ancestor(
8309                 __isl_take isl_schedule_node *node,
8310                 int generation);
8311         int isl_schedule_node_n_children(
8312                 __isl_keep isl_schedule_node *node);
8313         __isl_give isl_schedule_node *isl_schedule_node_child(
8314                 __isl_take isl_schedule_node *node, int pos);
8315         isl_bool isl_schedule_node_has_children(
8316                 __isl_keep isl_schedule_node *node);
8317         __isl_give isl_schedule_node *isl_schedule_node_first_child(
8318                 __isl_take isl_schedule_node *node);
8319         isl_bool isl_schedule_node_has_previous_sibling(
8320                 __isl_keep isl_schedule_node *node);
8321         __isl_give isl_schedule_node *
8322         isl_schedule_node_previous_sibling(
8323                 __isl_take isl_schedule_node *node);
8324         isl_bool isl_schedule_node_has_next_sibling(
8325                 __isl_keep isl_schedule_node *node);
8326         __isl_give isl_schedule_node *
8327         isl_schedule_node_next_sibling(
8328                 __isl_take isl_schedule_node *node);
8330 For C<isl_schedule_node_ancestor>, the ancestor of generation 0
8331 is the node itself, the ancestor of generation 1 is its parent and so on.
8333 It is also possible to query the number of ancestors of a node,
8334 the position of the current node
8335 within the children of its parent, the position of the subtree
8336 containing a node within the children of an ancestor
8337 or to obtain a copy of a given
8338 child without destroying the current node.
8339 Given two nodes that point to the same schedule, their closest
8340 shared ancestor can be obtained using
8341 C<isl_schedule_node_get_shared_ancestor>.
8343         #include <isl/schedule_node.h>
8344         int isl_schedule_node_get_tree_depth(
8345                 __isl_keep isl_schedule_node *node);
8346         int isl_schedule_node_get_child_position(
8347                 __isl_keep isl_schedule_node *node);
8348         int isl_schedule_node_get_ancestor_child_position(
8349                 __isl_keep isl_schedule_node *node,
8350                 __isl_keep isl_schedule_node *ancestor);
8351         __isl_give isl_schedule_node *isl_schedule_node_get_child(
8352                 __isl_keep isl_schedule_node *node, int pos);
8353         __isl_give isl_schedule_node *
8354         isl_schedule_node_get_shared_ancestor(
8355                 __isl_keep isl_schedule_node *node1,
8356                 __isl_keep isl_schedule_node *node2);
8358 All nodes in a schedule tree or
8359 all descendants of a specific node (including the node) can be visited
8360 in depth-first pre-order using the following functions.
8362         #include <isl/schedule.h>
8363         isl_stat isl_schedule_foreach_schedule_node_top_down(
8364                 __isl_keep isl_schedule *sched,
8365                 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
8366                         void *user), void *user);
8368         #include <isl/schedule_node.h>
8369         isl_stat isl_schedule_node_foreach_descendant_top_down(
8370                 __isl_keep isl_schedule_node *node,
8371                 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
8372                         void *user), void *user);
8374 The callback function is slightly different from the usual
8375 callbacks in that it not only indicates success (non-negative result)
8376 or failure (negative result), but also indicates whether the children
8377 of the given node should be visited.  In particular, if the callback
8378 returns a positive value, then the children are visited, but if
8379 the callback returns zero, then the children are not visited.
8381 The following functions checks whether
8382 all descendants of a specific node (including the node itself)
8383 satisfy a user-specified test.
8385         #include <isl/schedule_node.h>
8386         isl_bool isl_schedule_node_every_descendant(
8387                 __isl_keep isl_schedule_node *node,
8388                 isl_bool (*test)(__isl_keep isl_schedule_node *node,
8389                         void *user), void *user)
8391 The ancestors of a node in a schedule tree can be visited from
8392 the root down to and including the parent of the node using
8393 the following function.
8395         #include <isl/schedule_node.h>
8396         isl_stat isl_schedule_node_foreach_ancestor_top_down(
8397                 __isl_keep isl_schedule_node *node,
8398                 isl_stat (*fn)(__isl_keep isl_schedule_node *node,
8399                         void *user), void *user);
8401 The following functions allows for a depth-first post-order
8402 traversal of the nodes in a schedule tree or
8403 of the descendants of a specific node (including the node
8404 itself), where the user callback is allowed to modify the
8405 visited node.
8407         #include <isl/schedule.h>
8408         __isl_give isl_schedule *
8409         isl_schedule_map_schedule_node_bottom_up(
8410                 __isl_take isl_schedule *schedule,
8411                 __isl_give isl_schedule_node *(*fn)(
8412                         __isl_take isl_schedule_node *node,
8413                         void *user), void *user);
8415         #include <isl/schedule_node.h>
8416         __isl_give isl_schedule_node *
8417         isl_schedule_node_map_descendant_bottom_up(
8418                 __isl_take isl_schedule_node *node,
8419                 __isl_give isl_schedule_node *(*fn)(
8420                         __isl_take isl_schedule_node *node,
8421                         void *user), void *user);
8423 The traversal continues from the node returned by the callback function.
8424 It is the responsibility of the user to ensure that this does not
8425 lead to an infinite loop.  It is safest to always return a pointer
8426 to the same position (same ancestors and child positions) as the input node.
8428 The following function removes a node (along with its descendants)
8429 from a schedule tree and returns a pointer to the leaf at the
8430 same position in the updated tree.
8431 It is not allowed to remove the root of a schedule tree or
8432 a child of a set or sequence node.
8434         #include <isl/schedule_node.h>
8435         __isl_give isl_schedule_node *isl_schedule_node_cut(
8436                 __isl_take isl_schedule_node *node);
8438 The following function removes a single node
8439 from a schedule tree and returns a pointer to the child
8440 of the node, now located at the position of the original node
8441 or to a leaf node at that position if there was no child.
8442 It is not allowed to remove the root of a schedule tree,
8443 a set or sequence node, a child of a set or sequence node or
8444 a band node with an anchored subtree.
8446         #include <isl/schedule_node.h>
8447         __isl_give isl_schedule_node *isl_schedule_node_delete(
8448                 __isl_take isl_schedule_node *node);
8450 Most nodes in a schedule tree only contain local information.
8451 In some cases, however, a node may also refer to the schedule dimensions
8452 of its outer band nodes.
8453 This means that the position of the node within the tree should
8454 not be changed, or at least that no changes are performed to the
8455 outer band nodes.  The following function can be used to test
8456 whether the subtree rooted at a given node contains any such nodes.
8458         #include <isl/schedule_node.h>
8459         isl_bool isl_schedule_node_is_subtree_anchored(
8460                 __isl_keep isl_schedule_node *node);
8462 The following function resets the user pointers on all parameter
8463 and tuple identifiers referenced by the given schedule node.
8465         #include <isl/schedule_node.h>
8466         __isl_give isl_schedule_node *isl_schedule_node_reset_user(
8467                 __isl_take isl_schedule_node *node);
8469 The following function aligns the parameters of the given schedule
8470 node to the given space.
8472         #include <isl/schedule_node.h>
8473         __isl_give isl_schedule_node *
8474         isl_schedule_node_align_params(
8475                 __isl_take isl_schedule_node *node,
8476                 __isl_take isl_space *space);
8478 Several node types have their own functions for querying
8479 (and in some cases setting) some node type specific properties.
8481         #include <isl/schedule_node.h>
8482         __isl_give isl_space *isl_schedule_node_band_get_space(
8483                 __isl_keep isl_schedule_node *node);
8484         __isl_give isl_multi_union_pw_aff *
8485         isl_schedule_node_band_get_partial_schedule(
8486                 __isl_keep isl_schedule_node *node);
8487         __isl_give isl_union_map *
8488         isl_schedule_node_band_get_partial_schedule_union_map(
8489                 __isl_keep isl_schedule_node *node);
8490         unsigned isl_schedule_node_band_n_member(
8491                 __isl_keep isl_schedule_node *node);
8492         isl_bool isl_schedule_node_band_member_get_coincident(
8493                 __isl_keep isl_schedule_node *node, int pos);
8494         __isl_give isl_schedule_node *
8495         isl_schedule_node_band_member_set_coincident(
8496                 __isl_take isl_schedule_node *node, int pos,
8497                 int coincident);
8498         isl_bool isl_schedule_node_band_get_permutable(
8499                 __isl_keep isl_schedule_node *node);
8500         __isl_give isl_schedule_node *
8501         isl_schedule_node_band_set_permutable(
8502                 __isl_take isl_schedule_node *node, int permutable);
8503         enum isl_ast_loop_type
8504         isl_schedule_node_band_member_get_ast_loop_type(
8505                 __isl_keep isl_schedule_node *node, int pos);
8506         __isl_give isl_schedule_node *
8507         isl_schedule_node_band_member_set_ast_loop_type(
8508                 __isl_take isl_schedule_node *node, int pos,
8509                 enum isl_ast_loop_type type);
8510         __isl_give isl_union_set *
8511         enum isl_ast_loop_type
8512         isl_schedule_node_band_member_get_isolate_ast_loop_type(
8513                 __isl_keep isl_schedule_node *node, int pos);
8514         __isl_give isl_schedule_node *
8515         isl_schedule_node_band_member_set_isolate_ast_loop_type(
8516                 __isl_take isl_schedule_node *node, int pos,
8517                 enum isl_ast_loop_type type);
8518         isl_schedule_node_band_get_ast_build_options(
8519                 __isl_keep isl_schedule_node *node);
8520         __isl_give isl_schedule_node *
8521         isl_schedule_node_band_set_ast_build_options(
8522                 __isl_take isl_schedule_node *node,
8523                 __isl_take isl_union_set *options);
8524         __isl_give isl_set *
8525         isl_schedule_node_band_get_ast_isolate_option(
8526                 __isl_keep isl_schedule_node *node);
8528 The function C<isl_schedule_node_band_get_space> returns the space
8529 of the partial schedule of the band.
8530 The function C<isl_schedule_node_band_get_partial_schedule_union_map>
8531 returns a representation of the partial schedule of the band node
8532 in the form of an C<isl_union_map>.
8533 The coincident and permutable properties are set by
8534 C<isl_schedule_constraints_compute_schedule> on the schedule tree
8535 it produces.
8536 A scheduling dimension is considered to be ``coincident''
8537 if it satisfies the coincidence constraints within its band.
8538 That is, if the dependence distances of the coincidence
8539 constraints are all zero in that direction (for fixed
8540 iterations of outer bands).
8541 A band is marked permutable if it was produced using the Pluto-like scheduler.
8542 Note that the scheduler may have to resort to a Feautrier style scheduling
8543 step even if the default scheduler is used.
8544 An C<isl_ast_loop_type> is one of C<isl_ast_loop_default>,
8545 C<isl_ast_loop_atomic>, C<isl_ast_loop_unroll> or C<isl_ast_loop_separate>.
8546 For the meaning of these loop AST generation types and the difference
8547 between the regular loop AST generation type and the isolate
8548 loop AST generation type, see L</"AST Generation Options (Schedule Tree)">.
8549 The functions C<isl_schedule_node_band_member_get_ast_loop_type>
8550 and C<isl_schedule_node_band_member_get_isolate_ast_loop_type>
8551 may return C<isl_ast_loop_error> if an error occurs.
8552 The AST build options govern how an AST is generated for
8553 the individual schedule dimensions during AST generation.
8554 See L</"AST Generation Options (Schedule Tree)">.
8555 The isolate option for the given node can be extracted from these
8556 AST build options using the function
8557 C<isl_schedule_node_band_get_ast_isolate_option>.
8559         #include <isl/schedule_node.h>
8560         __isl_give isl_set *
8561         isl_schedule_node_context_get_context(
8562                 __isl_keep isl_schedule_node *node);
8564         #include <isl/schedule_node.h>
8565         __isl_give isl_union_set *
8566         isl_schedule_node_domain_get_domain(
8567                 __isl_keep isl_schedule_node *node);
8569         #include <isl/schedule_node.h>
8570         __isl_give isl_union_map *
8571         isl_schedule_node_expansion_get_expansion(
8572                 __isl_keep isl_schedule_node *node);
8573         __isl_give isl_union_pw_multi_aff *
8574         isl_schedule_node_expansion_get_contraction(
8575                 __isl_keep isl_schedule_node *node);
8577         #include <isl/schedule_node.h>
8578         __isl_give isl_union_map *
8579         isl_schedule_node_extension_get_extension(
8580                 __isl_keep isl_schedule_node *node);
8582         #include <isl/schedule_node.h>
8583         __isl_give isl_union_set *
8584         isl_schedule_node_filter_get_filter(
8585                 __isl_keep isl_schedule_node *node);
8587         #include <isl/schedule_node.h>
8588         __isl_give isl_set *isl_schedule_node_guard_get_guard(
8589                 __isl_keep isl_schedule_node *node);
8591         #include <isl/schedule_node.h>
8592         __isl_give isl_id *isl_schedule_node_mark_get_id(
8593                 __isl_keep isl_schedule_node *node);
8595 The following functions can be used to obtain an C<isl_multi_union_pw_aff>,
8596 an C<isl_union_pw_multi_aff> or C<isl_union_map> representation of
8597 partial schedules related to the node.
8599         #include <isl/schedule_node.h>
8600         __isl_give isl_multi_union_pw_aff *
8601         isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(
8602                 __isl_keep isl_schedule_node *node);
8603         __isl_give isl_union_pw_multi_aff *
8604         isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(
8605                 __isl_keep isl_schedule_node *node);
8606         __isl_give isl_union_map *
8607         isl_schedule_node_get_prefix_schedule_union_map(
8608                 __isl_keep isl_schedule_node *node);
8609         __isl_give isl_union_map *
8610         isl_schedule_node_get_prefix_schedule_relation(
8611                 __isl_keep isl_schedule_node *node);
8612         __isl_give isl_union_map *
8613         isl_schedule_node_get_subtree_schedule_union_map(
8614                 __isl_keep isl_schedule_node *node);
8616 In particular, the functions
8617 C<isl_schedule_node_get_prefix_schedule_multi_union_pw_aff>,
8618 C<isl_schedule_node_get_prefix_schedule_union_pw_multi_aff>
8619 and C<isl_schedule_node_get_prefix_schedule_union_map>
8620 return a relative ordering on the domain elements that reach the given
8621 node determined by its ancestors.
8622 The function C<isl_schedule_node_get_prefix_schedule_relation>
8623 additionally includes the domain constraints in the result.
8624 The function C<isl_schedule_node_get_subtree_schedule_union_map>
8625 returns a representation of the partial schedule defined by the
8626 subtree rooted at the given node.
8627 If the tree contains any expansion nodes, then the subtree schedule
8628 is formulated in terms of the expanded domain elements.
8629 The tree passed to functions returning a prefix schedule
8630 may only contain extension nodes if these would not affect
8631 the result of these functions.  That is, if one of the ancestors
8632 is an extension node, then all of the domain elements that were
8633 added by the extension node need to have been filtered out
8634 by filter nodes between the extension node and the input node.
8635 The tree passed to C<isl_schedule_node_get_subtree_schedule_union_map>
8636 may not contain in extension nodes in the selected subtree.
8638 The expansion/contraction defined by an entire subtree, combining
8639 the expansions/contractions
8640 on the expansion nodes in the subtree, can be obtained using
8641 the following functions.
8643         #include <isl/schedule_node.h>
8644         __isl_give isl_union_map *
8645         isl_schedule_node_get_subtree_expansion(
8646                 __isl_keep isl_schedule_node *node);
8647         __isl_give isl_union_pw_multi_aff *
8648         isl_schedule_node_get_subtree_contraction(
8649                 __isl_keep isl_schedule_node *node);
8651 The total number of outer band members of given node, i.e.,
8652 the shared output dimension of the maps in the result
8653 of C<isl_schedule_node_get_prefix_schedule_union_map> can be obtained
8654 using the following function.
8656         #include <isl/schedule_node.h>
8657         int isl_schedule_node_get_schedule_depth(
8658                 __isl_keep isl_schedule_node *node);
8660 The following functions return the elements that reach the given node
8661 or the union of universes in the spaces that contain these elements.
8663         #include <isl/schedule_node.h>
8664         __isl_give isl_union_set *
8665         isl_schedule_node_get_domain(
8666                 __isl_keep isl_schedule_node *node);
8667         __isl_give isl_union_set *
8668         isl_schedule_node_get_universe_domain(
8669                 __isl_keep isl_schedule_node *node);
8671 The input tree of C<isl_schedule_node_get_domain>
8672 may only contain extension nodes if these would not affect
8673 the result of this function.  That is, if one of the ancestors
8674 is an extension node, then all of the domain elements that were
8675 added by the extension node need to have been filtered out
8676 by filter nodes between the extension node and the input node.
8678 The following functions can be used to introduce additional nodes
8679 in the schedule tree.  The new node is introduced at the point
8680 in the tree where the C<isl_schedule_node> points to and
8681 the results points to the new node.
8683         #include <isl/schedule_node.h>
8684         __isl_give isl_schedule_node *
8685         isl_schedule_node_insert_partial_schedule(
8686                 __isl_take isl_schedule_node *node,
8687                 __isl_take isl_multi_union_pw_aff *schedule);
8689 This function inserts a new band node with (the greatest integer
8690 part of) the given partial schedule.
8691 The subtree rooted at the given node is assumed not to have
8692 any anchored nodes.
8694         #include <isl/schedule_node.h>
8695         __isl_give isl_schedule_node *
8696         isl_schedule_node_insert_context(
8697                 __isl_take isl_schedule_node *node,
8698                 __isl_take isl_set *context);
8700 This function inserts a new context node with the given context constraints.
8702         #include <isl/schedule_node.h>
8703         __isl_give isl_schedule_node *
8704         isl_schedule_node_insert_filter(
8705                 __isl_take isl_schedule_node *node,
8706                 __isl_take isl_union_set *filter);
8708 This function inserts a new filter node with the given filter.
8709 If the original node already pointed to a filter node, then the
8710 two filter nodes are merged into one.
8712         #include <isl/schedule_node.h>
8713         __isl_give isl_schedule_node *
8714         isl_schedule_node_insert_guard(
8715                 __isl_take isl_schedule_node *node,
8716                 __isl_take isl_set *guard);
8718 This function inserts a new guard node with the given guard constraints.
8720         #include <isl/schedule_node.h>
8721         __isl_give isl_schedule_node *
8722         isl_schedule_node_insert_mark(
8723                 __isl_take isl_schedule_node *node,
8724                 __isl_take isl_id *mark);
8726 This function inserts a new mark node with the give mark identifier.
8728         #include <isl/schedule_node.h>
8729         __isl_give isl_schedule_node *
8730         isl_schedule_node_insert_sequence(
8731                 __isl_take isl_schedule_node *node,
8732                 __isl_take isl_union_set_list *filters);
8733         __isl_give isl_schedule_node *
8734         isl_schedule_node_insert_set(
8735                 __isl_take isl_schedule_node *node,
8736                 __isl_take isl_union_set_list *filters);
8738 These functions insert a new sequence or set node with the given
8739 filters as children.
8741         #include <isl/schedule_node.h>
8742         __isl_give isl_schedule_node *isl_schedule_node_group(
8743                 __isl_take isl_schedule_node *node,
8744                 __isl_take isl_id *group_id);
8746 This function introduces an expansion node in between the current
8747 node and its parent that expands instances of a space with tuple
8748 identifier C<group_id> to the original domain elements that reach
8749 the node.  The group instances are identified by the prefix schedule
8750 of those domain elements.  The ancestors of the node are adjusted
8751 to refer to the group instances instead of the original domain
8752 elements.  The return value points to the same node in the updated
8753 schedule tree as the input node, i.e., to the child of the newly
8754 introduced expansion node.  Grouping instances of different statements
8755 ensures that they will be treated as a single statement by the
8756 AST generator up to the point of the expansion node.
8758 The following function can be used to flatten a nested
8759 sequence.
8761         #include <isl/schedule_node.h>
8762         __isl_give isl_schedule_node *
8763         isl_schedule_node_sequence_splice_child(
8764                 __isl_take isl_schedule_node *node, int pos);
8766 That is, given a sequence node C<node> that has another sequence node
8767 in its child at position C<pos> (in particular, the child of that filter
8768 node is a sequence node), attach the children of that other sequence
8769 node as children of C<node>, replacing the original child at position
8770 C<pos>.
8772 The partial schedule of a band node can be scaled (down) or reduced using
8773 the following functions.
8775         #include <isl/schedule_node.h>
8776         __isl_give isl_schedule_node *
8777         isl_schedule_node_band_scale(
8778                 __isl_take isl_schedule_node *node,
8779                 __isl_take isl_multi_val *mv);
8780         __isl_give isl_schedule_node *
8781         isl_schedule_node_band_scale_down(
8782                 __isl_take isl_schedule_node *node,
8783                 __isl_take isl_multi_val *mv);
8784         __isl_give isl_schedule_node *
8785         isl_schedule_node_band_mod(
8786                 __isl_take isl_schedule_node *node,
8787                 __isl_take isl_multi_val *mv);
8789 The spaces of the two arguments need to match.
8790 After scaling, the partial schedule is replaced by its greatest
8791 integer part to ensure that the schedule remains integral.
8793 The partial schedule of a band node can be shifted by an
8794 C<isl_multi_union_pw_aff> with a domain that is a superset
8795 of the domain of the partial schedule using
8796 the following function.
8798         #include <isl/schedule_node.h>
8799         __isl_give isl_schedule_node *
8800         isl_schedule_node_band_shift(
8801                 __isl_take isl_schedule_node *node,
8802                 __isl_take isl_multi_union_pw_aff *shift);
8804 A band node can be tiled using the following function.
8806         #include <isl/schedule_node.h>
8807         __isl_give isl_schedule_node *isl_schedule_node_band_tile(
8808                 __isl_take isl_schedule_node *node,
8809                 __isl_take isl_multi_val *sizes);
8811         isl_stat isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
8812                 int val);
8813         int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
8814         isl_stat isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
8815                 int val);
8816         int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
8818 The C<isl_schedule_node_band_tile> function tiles
8819 the band using the given tile sizes inside its schedule.
8820 A new child band node is created to represent the point loops and it is
8821 inserted between the modified band and its children.
8822 The subtree rooted at the given node is assumed not to have
8823 any anchored nodes.
8824 The C<tile_scale_tile_loops> option specifies whether the tile
8825 loops iterators should be scaled by the tile sizes.
8826 If the C<tile_shift_point_loops> option is set, then the point loops
8827 are shifted to start at zero.
8829 A band node can be split into two nested band nodes
8830 using the following function.
8832         #include <isl/schedule_node.h>
8833         __isl_give isl_schedule_node *isl_schedule_node_band_split(
8834                 __isl_take isl_schedule_node *node, int pos);
8836 The resulting outer band node contains the first C<pos> dimensions of
8837 the schedule of C<node> while the inner band contains the remaining dimensions.
8838 The schedules of the two band nodes live in anonymous spaces.
8839 The loop AST generation type options and the isolate option
8840 are split over the two band nodes.
8842 A band node can be moved down to the leaves of the subtree rooted
8843 at the band node using the following function.
8845         #include <isl/schedule_node.h>
8846         __isl_give isl_schedule_node *isl_schedule_node_band_sink(
8847                 __isl_take isl_schedule_node *node);
8849 The subtree rooted at the given node is assumed not to have
8850 any anchored nodes.
8851 The result points to the node in the resulting tree that is in the same
8852 position as the node pointed to by C<node> in the original tree.
8854         #include <isl/schedule_node.h>
8855         __isl_give isl_schedule_node *
8856         isl_schedule_node_order_before(
8857                 __isl_take isl_schedule_node *node,
8858                 __isl_take isl_union_set *filter);
8859         __isl_give isl_schedule_node *
8860         isl_schedule_node_order_after(
8861                 __isl_take isl_schedule_node *node,
8862                 __isl_take isl_union_set *filter);
8864 These functions split the domain elements that reach C<node>
8865 into those that satisfy C<filter> and those that do not and
8866 arranges for the elements that do satisfy the filter to be
8867 executed before (in case of C<isl_schedule_node_order_before>)
8868 or after (in case of C<isl_schedule_node_order_after>)
8869 those that do not.  The order is imposed by
8870 a sequence node, possibly reusing the grandparent of C<node>
8871 on two copies of the subtree attached to the original C<node>.
8872 Both copies are simplified with respect to their filter.
8874 Return a pointer to the copy of the subtree that does not
8875 satisfy C<filter>.  If there is no such copy (because all
8876 reaching domain elements satisfy the filter), then return
8877 the original pointer.
8879         #include <isl/schedule_node.h>
8880         __isl_give isl_schedule_node *
8881         isl_schedule_node_graft_before(
8882                 __isl_take isl_schedule_node *node,
8883                 __isl_take isl_schedule_node *graft);
8884         __isl_give isl_schedule_node *
8885         isl_schedule_node_graft_after(
8886                 __isl_take isl_schedule_node *node,
8887                 __isl_take isl_schedule_node *graft);
8889 This function inserts the C<graft> tree into the tree containing C<node>
8890 such that it is executed before (in case of C<isl_schedule_node_graft_before>)
8891 or after (in case of C<isl_schedule_node_graft_after>) C<node>.
8892 The root node of C<graft>
8893 should be an extension node where the domain of the extension
8894 is the flat product of all outer band nodes of C<node>.
8895 The root node may also be a domain node.
8896 The elements of the domain or the range of the extension may not
8897 intersect with the domain elements that reach "node".
8898 The schedule tree of C<graft> may not be anchored.
8900 The schedule tree of C<node> is modified to include an extension node
8901 corresponding to the root node of C<graft> as a child of the original
8902 parent of C<node>.  The original node that C<node> points to and the
8903 child of the root node of C<graft> are attached to this extension node
8904 through a sequence, with appropriate filters and with the child
8905 of C<graft> appearing before or after the original C<node>.
8907 If C<node> already appears inside a sequence that is the child of
8908 an extension node and if the spaces of the new domain elements
8909 do not overlap with those of the original domain elements,
8910 then that extension node is extended with the new extension
8911 rather than introducing a new segment of extension and sequence nodes.
8913 Return a pointer to the same node in the modified tree that
8914 C<node> pointed to in the original tree.
8916 A representation of the schedule node can be printed using
8918         #include <isl/schedule_node.h>
8919         __isl_give isl_printer *isl_printer_print_schedule_node(
8920                 __isl_take isl_printer *p,
8921                 __isl_keep isl_schedule_node *node);
8922         __isl_give char *isl_schedule_node_to_str(
8923                 __isl_keep isl_schedule_node *node);
8925 C<isl_schedule_node_to_str> prints the schedule node in block format.
8927 =head2 Dependence Analysis
8929 C<isl> contains specialized functionality for performing
8930 array dataflow analysis.  That is, given a I<sink> access relation,
8931 a collection of possible I<source> accesses and
8932 a collection of I<kill> accesses,
8933 C<isl> can compute relations that describe
8934 for each iteration of the sink access, which iterations
8935 of which of the source access relations may have
8936 accessed the same data element before the given iteration
8937 of the sink access without any intermediate kill of that data element.
8938 The resulting dependence relations map source iterations
8939 to either the corresponding sink iterations or
8940 pairs of corresponding sink iterations and accessed data elements.
8941 To compute standard flow dependences, the sink should be
8942 a read, while the sources should be writes.
8943 If no kills are specified,
8944 then memory based dependence analysis is performed.
8945 If, on the other hand, all sources are also kills,
8946 then value based dependence analysis is performed.
8947 If any of the source accesses are marked as being I<must>
8948 accesses, then they are also treated as kills.
8949 Furthermore, the specification of must-sources results
8950 in the computation of must-dependences.
8951 Only dependences originating in a must access not coscheduled
8952 with any other access to the same element and without
8953 any may accesses between the must access and the sink access
8954 are considered to be must dependences.
8956 =head3 High-level Interface
8958 A high-level interface to dependence analysis is provided
8959 by the following function.
8961         #include <isl/flow.h>
8962         __isl_give isl_union_flow *
8963         isl_union_access_info_compute_flow(
8964                 __isl_take isl_union_access_info *access);
8966 The input C<isl_union_access_info> object describes the sink
8967 access relations, the source access relations and a schedule,
8968 while the output C<isl_union_flow> object describes
8969 the resulting dependence relations and the subsets of the
8970 sink relations for which no source was found.
8972 An C<isl_union_access_info> is created, modified, copied and freed using
8973 the following functions.
8975         #include <isl/flow.h>
8976         __isl_give isl_union_access_info *
8977         isl_union_access_info_from_sink(
8978                 __isl_take isl_union_map *sink);
8979         __isl_give isl_union_access_info *
8980         isl_union_access_info_set_kill(
8981                 __isl_take isl_union_access_info *access,
8982                 __isl_take isl_union_map *kill);
8983         __isl_give isl_union_access_info *
8984         isl_union_access_info_set_may_source(
8985                 __isl_take isl_union_access_info *access,
8986                 __isl_take isl_union_map *may_source);
8987         __isl_give isl_union_access_info *
8988         isl_union_access_info_set_must_source(
8989                 __isl_take isl_union_access_info *access,
8990                 __isl_take isl_union_map *must_source);
8991         __isl_give isl_union_access_info *
8992         isl_union_access_info_set_schedule(
8993                 __isl_take isl_union_access_info *access,
8994                 __isl_take isl_schedule *schedule);
8995         __isl_give isl_union_access_info *
8996         isl_union_access_info_set_schedule_map(
8997                 __isl_take isl_union_access_info *access,
8998                 __isl_take isl_union_map *schedule_map);
8999         __isl_give isl_union_access_info *
9000         isl_union_access_info_copy(
9001                 __isl_keep isl_union_access_info *access);
9002         __isl_null isl_union_access_info *
9003         isl_union_access_info_free(
9004                 __isl_take isl_union_access_info *access);
9006 The may sources set by C<isl_union_access_info_set_may_source>
9007 do not need to include the must sources set by
9008 C<isl_union_access_info_set_must_source> as a subset.
9009 The kills set by C<isl_union_access_info_set_kill> may overlap
9010 with the may-sources and/or must-sources.
9011 The user is free not to call one (or more) of these functions,
9012 in which case the corresponding set is kept to its empty default.
9013 Similarly, the default schedule initialized by
9014 C<isl_union_access_info_from_sink> is empty.
9015 The current schedule is determined by the last call to either
9016 C<isl_union_access_info_set_schedule> or
9017 C<isl_union_access_info_set_schedule_map>.
9018 The domain of the schedule corresponds to the domains of
9019 the access relations.  In particular, the domains of the access
9020 relations are effectively intersected with the domain of the schedule
9021 and only the resulting accesses are considered by the dependence analysis.
9023 An C<isl_union_access_info> object can be read from input
9024 using the following function.
9026         #include <isl/flow.h>
9027         __isl_give isl_union_access_info *
9028         isl_union_access_info_read_from_file(isl_ctx *ctx,
9029                 FILE *input);
9031 A representation of the information contained in an object
9032 of type C<isl_union_access_info> can be obtained using
9034         #include <isl/flow.h>
9035         __isl_give isl_printer *
9036         isl_printer_print_union_access_info(
9037                 __isl_take isl_printer *p,
9038                 __isl_keep isl_union_access_info *access);
9039         __isl_give char *isl_union_access_info_to_str(
9040                 __isl_keep isl_union_access_info *access);
9042 C<isl_union_access_info_to_str> prints the information in flow format.
9044 The output of C<isl_union_access_info_compute_flow> can be examined,
9045 copied, and freed using the following functions.
9047         #include <isl/flow.h>
9048         __isl_give isl_union_map *isl_union_flow_get_must_dependence(
9049                 __isl_keep isl_union_flow *flow);
9050         __isl_give isl_union_map *isl_union_flow_get_may_dependence(
9051                 __isl_keep isl_union_flow *flow);
9052         __isl_give isl_union_map *
9053         isl_union_flow_get_full_must_dependence(
9054                 __isl_keep isl_union_flow *flow);
9055         __isl_give isl_union_map *
9056         isl_union_flow_get_full_may_dependence(
9057                 __isl_keep isl_union_flow *flow);
9058         __isl_give isl_union_map *isl_union_flow_get_must_no_source(
9059                 __isl_keep isl_union_flow *flow);
9060         __isl_give isl_union_map *isl_union_flow_get_may_no_source(
9061                 __isl_keep isl_union_flow *flow);
9062         __isl_give isl_union_flow *isl_union_flow_copy(
9063                 __isl_keep isl_union_flow *flow);
9064         __isl_null isl_union_flow *isl_union_flow_free(
9065                 __isl_take isl_union_flow *flow);
9067 The relation returned by C<isl_union_flow_get_must_dependence>
9068 relates domain elements of must sources to domain elements of the sink.
9069 The relation returned by C<isl_union_flow_get_may_dependence>
9070 relates domain elements of must or may sources to domain elements of the sink
9071 and includes the previous relation as a subset.
9072 The relation returned by C<isl_union_flow_get_full_must_dependence>
9073 relates domain elements of must sources to pairs of domain elements of the sink
9074 and accessed data elements.
9075 The relation returned by C<isl_union_flow_get_full_may_dependence>
9076 relates domain elements of must or may sources to pairs of
9077 domain elements of the sink and accessed data elements.
9078 This relation includes the previous relation as a subset.
9079 The relation returned by C<isl_union_flow_get_must_no_source> is the subset
9080 of the sink relation for which no dependences have been found.
9081 The relation returned by C<isl_union_flow_get_may_no_source> is the subset
9082 of the sink relation for which no definite dependences have been found.
9083 That is, it contains those sink access that do not contribute to any
9084 of the elements in the relation returned
9085 by C<isl_union_flow_get_must_dependence>.
9087 A representation of the information contained in an object
9088 of type C<isl_union_flow> can be obtained using
9090         #include <isl/flow.h>
9091         __isl_give isl_printer *isl_printer_print_union_flow(
9092                 __isl_take isl_printer *p,
9093                 __isl_keep isl_union_flow *flow);
9094         __isl_give char *isl_union_flow_to_str(
9095                 __isl_keep isl_union_flow *flow);
9097 C<isl_union_flow_to_str> prints the information in flow format.
9099 =head3 Low-level Interface
9101 A lower-level interface is provided by the following functions.
9103         #include <isl/flow.h>
9105         typedef int (*isl_access_level_before)(void *first, void *second);
9107         __isl_give isl_access_info *isl_access_info_alloc(
9108                 __isl_take isl_map *sink,
9109                 void *sink_user, isl_access_level_before fn,
9110                 int max_source);
9111         __isl_give isl_access_info *isl_access_info_add_source(
9112                 __isl_take isl_access_info *acc,
9113                 __isl_take isl_map *source, int must,
9114                 void *source_user);
9115         __isl_null isl_access_info *isl_access_info_free(
9116                 __isl_take isl_access_info *acc);
9118         __isl_give isl_flow *isl_access_info_compute_flow(
9119                 __isl_take isl_access_info *acc);
9121         isl_stat isl_flow_foreach(__isl_keep isl_flow *deps,
9122                 isl_stat (*fn)(__isl_take isl_map *dep, int must,
9123                           void *dep_user, void *user),
9124                 void *user);
9125         __isl_give isl_map *isl_flow_get_no_source(
9126                 __isl_keep isl_flow *deps, int must);
9127         void isl_flow_free(__isl_take isl_flow *deps);
9129 The function C<isl_access_info_compute_flow> performs the actual
9130 dependence analysis.  The other functions are used to construct
9131 the input for this function or to read off the output.
9133 The input is collected in an C<isl_access_info>, which can
9134 be created through a call to C<isl_access_info_alloc>.
9135 The arguments to this functions are the sink access relation
9136 C<sink>, a token C<sink_user> used to identify the sink
9137 access to the user, a callback function for specifying the
9138 relative order of source and sink accesses, and the number
9139 of source access relations that will be added.
9141 The callback function has type C<int (*)(void *first, void *second)>.
9142 The function is called with two user supplied tokens identifying
9143 either a source or the sink and it should return the shared nesting
9144 level and the relative order of the two accesses.
9145 In particular, let I<n> be the number of loops shared by
9146 the two accesses.  If C<first> precedes C<second> textually,
9147 then the function should return I<2 * n + 1>; otherwise,
9148 it should return I<2 * n>.
9149 The low-level interface assumes that no sources are coscheduled.
9150 If the information returned by the callback does not allow
9151 the relative order to be determined, then one of the sources
9152 is arbitrarily taken to be executed after the other(s).
9154 The sources can be added to the C<isl_access_info> object by performing
9155 (at most) C<max_source> calls to C<isl_access_info_add_source>.
9156 C<must> indicates whether the source is a I<must> access
9157 or a I<may> access.  Note that a multi-valued access relation
9158 should only be marked I<must> if every iteration in the domain
9159 of the relation accesses I<all> elements in its image.
9160 The C<source_user> token is again used to identify
9161 the source access.  The range of the source access relation
9162 C<source> should have the same dimension as the range
9163 of the sink access relation.
9164 The C<isl_access_info_free> function should usually not be
9165 called explicitly, because it is already called implicitly by
9166 C<isl_access_info_compute_flow>.
9168 The result of the dependence analysis is collected in an
9169 C<isl_flow>.  There may be elements of
9170 the sink access for which no preceding source access could be
9171 found or for which all preceding sources are I<may> accesses.
9172 The relations containing these elements can be obtained through
9173 calls to C<isl_flow_get_no_source>, the first with C<must> set
9174 and the second with C<must> unset.
9175 In the case of standard flow dependence analysis,
9176 with the sink a read and the sources I<must> writes,
9177 the first relation corresponds to the reads from uninitialized
9178 array elements and the second relation is empty.
9179 The actual flow dependences can be extracted using
9180 C<isl_flow_foreach>.  This function will call the user-specified
9181 callback function C<fn> for each B<non-empty> dependence between
9182 a source and the sink.  The callback function is called
9183 with four arguments, the actual flow dependence relation
9184 mapping source iterations to sink iterations, a boolean that
9185 indicates whether it is a I<must> or I<may> dependence, a token
9186 identifying the source and an additional C<void *> with value
9187 equal to the third argument of the C<isl_flow_foreach> call.
9188 A dependence is marked I<must> if it originates from a I<must>
9189 source and if it is not followed by any I<may> sources.
9191 After finishing with an C<isl_flow>, the user should call
9192 C<isl_flow_free> to free all associated memory.
9194 =head3 Interaction with the Low-level Interface
9196 During the dependence analysis, we frequently need to perform
9197 the following operation.  Given a relation between sink iterations
9198 and potential source iterations from a particular source domain,
9199 what is the last potential source iteration corresponding to each
9200 sink iteration.  It can sometimes be convenient to adjust
9201 the set of potential source iterations before or after each such operation.
9202 The prototypical example is fuzzy array dataflow analysis,
9203 where we need to analyze if, based on data-dependent constraints,
9204 the sink iteration can ever be executed without one or more of
9205 the corresponding potential source iterations being executed.
9206 If so, we can introduce extra parameters and select an unknown
9207 but fixed source iteration from the potential source iterations.
9208 To be able to perform such manipulations, C<isl> provides the following
9209 function.
9211         #include <isl/flow.h>
9213         typedef __isl_give isl_restriction *(*isl_access_restrict)(
9214                 __isl_keep isl_map *source_map,
9215                 __isl_keep isl_set *sink, void *source_user,
9216                 void *user);
9217         __isl_give isl_access_info *isl_access_info_set_restrict(
9218                 __isl_take isl_access_info *acc,
9219                 isl_access_restrict fn, void *user);
9221 The function C<isl_access_info_set_restrict> should be called
9222 before calling C<isl_access_info_compute_flow> and registers a callback function
9223 that will be called any time C<isl> is about to compute the last
9224 potential source.  The first argument is the (reverse) proto-dependence,
9225 mapping sink iterations to potential source iterations.
9226 The second argument represents the sink iterations for which
9227 we want to compute the last source iteration.
9228 The third argument is the token corresponding to the source
9229 and the final argument is the token passed to C<isl_access_info_set_restrict>.
9230 The callback is expected to return a restriction on either the input or
9231 the output of the operation computing the last potential source.
9232 If the input needs to be restricted then restrictions are needed
9233 for both the source and the sink iterations.  The sink iterations
9234 and the potential source iterations will be intersected with these sets.
9235 If the output needs to be restricted then only a restriction on the source
9236 iterations is required.
9237 If any error occurs, the callback should return C<NULL>.
9238 An C<isl_restriction> object can be created, freed and inspected
9239 using the following functions.
9241         #include <isl/flow.h>
9243         __isl_give isl_restriction *isl_restriction_input(
9244                 __isl_take isl_set *source_restr,
9245                 __isl_take isl_set *sink_restr);
9246         __isl_give isl_restriction *isl_restriction_output(
9247                 __isl_take isl_set *source_restr);
9248         __isl_give isl_restriction *isl_restriction_none(
9249                 __isl_take isl_map *source_map);
9250         __isl_give isl_restriction *isl_restriction_empty(
9251                 __isl_take isl_map *source_map);
9252         __isl_null isl_restriction *isl_restriction_free(
9253                 __isl_take isl_restriction *restr);
9255 C<isl_restriction_none> and C<isl_restriction_empty> are special
9256 cases of C<isl_restriction_input>.  C<isl_restriction_none>
9257 is essentially equivalent to
9259         isl_restriction_input(isl_set_universe(
9260             isl_space_range(isl_map_get_space(source_map))),
9261                             isl_set_universe(
9262             isl_space_domain(isl_map_get_space(source_map))));
9264 whereas C<isl_restriction_empty> is essentially equivalent to
9266         isl_restriction_input(isl_set_empty(
9267             isl_space_range(isl_map_get_space(source_map))),
9268                             isl_set_universe(
9269             isl_space_domain(isl_map_get_space(source_map))));
9271 =head2 Scheduling
9273         #include <isl/schedule.h>
9274         __isl_give isl_schedule *
9275         isl_schedule_constraints_compute_schedule(
9276                 __isl_take isl_schedule_constraints *sc);
9278 The function C<isl_schedule_constraints_compute_schedule> can be
9279 used to compute a schedule that satisfies the given schedule constraints.
9280 These schedule constraints include the iteration domain for which
9281 a schedule should be computed and dependences between pairs of
9282 iterations.  In particular, these dependences include
9283 I<validity> dependences and I<proximity> dependences.
9284 By default, the algorithm used to construct the schedule is similar
9285 to that of C<Pluto>.
9286 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
9287 be selected.
9288 The generated schedule respects all validity dependences.
9289 That is, all dependence distances over these dependences in the
9290 scheduled space are lexicographically positive.
9292 The default algorithm tries to ensure that the dependence distances
9293 over coincidence constraints are zero and to minimize the
9294 dependence distances over proximity dependences.
9295 Moreover, it tries to obtain sequences (bands) of schedule dimensions
9296 for groups of domains where the dependence distances over validity
9297 dependences have only non-negative values.
9298 Note that when minimizing the maximal dependence distance
9299 over proximity dependences, a single affine expression in the parameters
9300 is constructed that bounds all dependence distances.  If no such expression
9301 exists, then the algorithm will fail and resort to an alternative
9302 scheduling algorithm.  In particular, this means that adding proximity
9303 dependences may eliminate valid solutions.  A typical example where this
9304 phenomenon may occur is when some subset of the proximity dependences
9305 has no restriction on some parameter, forcing the coefficient of that
9306 parameter to be zero, while some other subset forces the dependence
9307 distance to depend on that parameter, requiring the same coefficient
9308 to be non-zero.
9309 When using Feautrier's algorithm, the coincidence and proximity constraints
9310 are only taken into account during the extension to a
9311 full-dimensional schedule.
9313 An C<isl_schedule_constraints> object can be constructed
9314 and manipulated using the following functions.
9316         #include <isl/schedule.h>
9317         __isl_give isl_schedule_constraints *
9318         isl_schedule_constraints_copy(
9319                 __isl_keep isl_schedule_constraints *sc);
9320         __isl_give isl_schedule_constraints *
9321         isl_schedule_constraints_on_domain(
9322                 __isl_take isl_union_set *domain);
9323         __isl_give isl_schedule_constraints *
9324         isl_schedule_constraints_set_context(
9325                 __isl_take isl_schedule_constraints *sc,
9326                 __isl_take isl_set *context);
9327         __isl_give isl_schedule_constraints *
9328         isl_schedule_constraints_set_validity(
9329                 __isl_take isl_schedule_constraints *sc,
9330                 __isl_take isl_union_map *validity);
9331         __isl_give isl_schedule_constraints *
9332         isl_schedule_constraints_set_coincidence(
9333                 __isl_take isl_schedule_constraints *sc,
9334                 __isl_take isl_union_map *coincidence);
9335         __isl_give isl_schedule_constraints *
9336         isl_schedule_constraints_set_proximity(
9337                 __isl_take isl_schedule_constraints *sc,
9338                 __isl_take isl_union_map *proximity);
9339         __isl_give isl_schedule_constraints *
9340         isl_schedule_constraints_set_conditional_validity(
9341                 __isl_take isl_schedule_constraints *sc,
9342                 __isl_take isl_union_map *condition,
9343                 __isl_take isl_union_map *validity);
9344         __isl_give isl_schedule_constraints *
9345         isl_schedule_constraints_apply(
9346                 __isl_take isl_schedule_constraints *sc,
9347                 __isl_take isl_union_map *umap);
9348         __isl_null isl_schedule_constraints *
9349         isl_schedule_constraints_free(
9350                 __isl_take isl_schedule_constraints *sc);
9352 The initial C<isl_schedule_constraints> object created by
9353 C<isl_schedule_constraints_on_domain> does not impose any constraints.
9354 That is, it has an empty set of dependences.
9355 The function C<isl_schedule_constraints_set_context> allows the user
9356 to specify additional constraints on the parameters that may
9357 be assumed to hold during the construction of the schedule.
9358 The function C<isl_schedule_constraints_set_validity> replaces the
9359 validity dependences, mapping domain elements I<i> to domain
9360 elements that should be scheduled after I<i>.
9361 The function C<isl_schedule_constraints_set_coincidence> replaces the
9362 coincidence dependences, mapping domain elements I<i> to domain
9363 elements that should be scheduled together with I<I>, if possible.
9364 The function C<isl_schedule_constraints_set_proximity> replaces the
9365 proximity dependences, mapping domain elements I<i> to domain
9366 elements that should be scheduled either before I<I>
9367 or as early as possible after I<i>.
9369 The function C<isl_schedule_constraints_set_conditional_validity>
9370 replaces the conditional validity constraints.
9371 A conditional validity constraint is only imposed when any of the corresponding
9372 conditions is satisfied, i.e., when any of them is non-zero.
9373 That is, the scheduler ensures that within each band if the dependence
9374 distances over the condition constraints are not all zero
9375 then all corresponding conditional validity constraints are respected.
9376 A conditional validity constraint corresponds to a condition
9377 if the two are adjacent, i.e., if the domain of one relation intersect
9378 the range of the other relation.
9379 The typical use case of conditional validity constraints is
9380 to allow order constraints between live ranges to be violated
9381 as long as the live ranges themselves are local to the band.
9382 To allow more fine-grained control over which conditions correspond
9383 to which conditional validity constraints, the domains and ranges
9384 of these relations may include I<tags>.  That is, the domains and
9385 ranges of those relation may themselves be wrapped relations
9386 where the iteration domain appears in the domain of those wrapped relations
9387 and the range of the wrapped relations can be arbitrarily chosen
9388 by the user.  Conditions and conditional validity constraints are only
9389 considered adjacent to each other if the entire wrapped relation matches.
9390 In particular, a relation with a tag will never be considered adjacent
9391 to a relation without a tag.
9393 The function C<isl_schedule_constraints_apply> takes
9394 schedule constraints that are defined on some set of domain elements
9395 and transforms them to schedule constraints on the elements
9396 to which these domain elements are mapped by the given transformation.
9398 An C<isl_schedule_constraints> object can be inspected
9399 using the following functions.
9401         #include <isl/schedule.h>
9402         __isl_give isl_union_set *
9403         isl_schedule_constraints_get_domain(
9404                 __isl_keep isl_schedule_constraints *sc);
9405         __isl_give isl_set *isl_schedule_constraints_get_context(
9406                 __isl_keep isl_schedule_constraints *sc);
9407         __isl_give isl_union_map *
9408         isl_schedule_constraints_get_validity(
9409                 __isl_keep isl_schedule_constraints *sc);
9410         __isl_give isl_union_map *
9411         isl_schedule_constraints_get_coincidence(
9412                 __isl_keep isl_schedule_constraints *sc);
9413         __isl_give isl_union_map *
9414         isl_schedule_constraints_get_proximity(
9415                 __isl_keep isl_schedule_constraints *sc);
9416         __isl_give isl_union_map *
9417         isl_schedule_constraints_get_conditional_validity(
9418                 __isl_keep isl_schedule_constraints *sc);
9419         __isl_give isl_union_map *
9420         isl_schedule_constraints_get_conditional_validity_condition(
9421                 __isl_keep isl_schedule_constraints *sc);
9423 An C<isl_schedule_constraints> object can be read from input
9424 using the following functions.
9426         #include <isl/schedule.h>
9427         __isl_give isl_schedule_constraints *
9428         isl_schedule_constraints_read_from_str(isl_ctx *ctx,
9429                 const char *str);
9430         __isl_give isl_schedule_constraints *
9431         isl_schedule_constraints_read_from_file(isl_ctx *ctx,
9432                 FILE *input);
9434 The contents of an C<isl_schedule_constraints> object can be printed
9435 using the following functions.
9437         #include <isl/schedule.h>
9438         __isl_give isl_printer *
9439         isl_printer_print_schedule_constraints(
9440                 __isl_take isl_printer *p,
9441                 __isl_keep isl_schedule_constraints *sc);
9442         __isl_give char *isl_schedule_constraints_to_str(
9443                 __isl_keep isl_schedule_constraints *sc);
9445 The following function computes a schedule directly from
9446 an iteration domain and validity and proximity dependences
9447 and is implemented in terms of the functions described above.
9448 The use of C<isl_union_set_compute_schedule> is discouraged.
9450         #include <isl/schedule.h>
9451         __isl_give isl_schedule *isl_union_set_compute_schedule(
9452                 __isl_take isl_union_set *domain,
9453                 __isl_take isl_union_map *validity,
9454                 __isl_take isl_union_map *proximity);
9456 The generated schedule represents a schedule tree.
9457 For more information on schedule trees, see
9458 L</"Schedule Trees">.
9460 =head3 Options
9462         #include <isl/schedule.h>
9463         isl_stat isl_options_set_schedule_max_coefficient(
9464                 isl_ctx *ctx, int val);
9465         int isl_options_get_schedule_max_coefficient(
9466                 isl_ctx *ctx);
9467         isl_stat isl_options_set_schedule_max_constant_term(
9468                 isl_ctx *ctx, int val);
9469         int isl_options_get_schedule_max_constant_term(
9470                 isl_ctx *ctx);
9471         isl_stat isl_options_set_schedule_serialize_sccs(
9472                 isl_ctx *ctx, int val);
9473         int isl_options_get_schedule_serialize_sccs(isl_ctx *ctx);
9474         isl_stat isl_options_set_schedule_whole_component(
9475                 isl_ctx *ctx, int val);
9476         int isl_options_get_schedule_whole_component(
9477                 isl_ctx *ctx);
9478         isl_stat isl_options_set_schedule_maximize_band_depth(
9479                 isl_ctx *ctx, int val);
9480         int isl_options_get_schedule_maximize_band_depth(
9481                 isl_ctx *ctx);
9482         isl_stat isl_options_set_schedule_maximize_coincidence(
9483                 isl_ctx *ctx, int val);
9484         int isl_options_get_schedule_maximize_coincidence(
9485                 isl_ctx *ctx);
9486         isl_stat isl_options_set_schedule_outer_coincidence(
9487                 isl_ctx *ctx, int val);
9488         int isl_options_get_schedule_outer_coincidence(
9489                 isl_ctx *ctx);
9490         isl_stat isl_options_set_schedule_split_scaled(
9491                 isl_ctx *ctx, int val);
9492         int isl_options_get_schedule_split_scaled(
9493                 isl_ctx *ctx);
9494         isl_stat isl_options_set_schedule_treat_coalescing(
9495                 isl_ctx *ctx, int val);
9496         int isl_options_get_schedule_treat_coalescing(
9497                 isl_ctx *ctx);
9498         isl_stat isl_options_set_schedule_algorithm(
9499                 isl_ctx *ctx, int val);
9500         int isl_options_get_schedule_algorithm(
9501                 isl_ctx *ctx);
9502         isl_stat isl_options_set_schedule_carry_self_first(
9503                 isl_ctx *ctx, int val);
9504         int isl_options_get_schedule_carry_self_first(
9505                 isl_ctx *ctx);
9506         isl_stat isl_options_set_schedule_separate_components(
9507                 isl_ctx *ctx, int val);
9508         int isl_options_get_schedule_separate_components(
9509                 isl_ctx *ctx);
9511 =over
9513 =item * schedule_max_coefficient
9515 This option enforces that the coefficients for variable and parameter
9516 dimensions in the calculated schedule are not larger than the specified value.
9517 This option can significantly increase the speed of the scheduling calculation
9518 and may also prevent fusing of unrelated dimensions. A value of -1 means that
9519 this option does not introduce bounds on the variable or parameter
9520 coefficients.
9522 =item * schedule_max_constant_term
9524 This option enforces that the constant coefficients in the calculated schedule
9525 are not larger than the maximal constant term. This option can significantly
9526 increase the speed of the scheduling calculation and may also prevent fusing of
9527 unrelated dimensions. A value of -1 means that this option does not introduce
9528 bounds on the constant coefficients.
9530 =item * schedule_serialize_sccs
9532 If this option is set, then all strongly connected components
9533 in the dependence graph are serialized as soon as they are detected.
9534 This means in particular that instances of statements will only
9535 appear in the same band node if these statements belong
9536 to the same strongly connected component at the point where
9537 the band node is constructed.
9539 =item * schedule_whole_component
9541 If this option is set, then entire (weakly) connected
9542 components in the dependence graph are scheduled together
9543 as a whole.
9544 Otherwise, each strongly connected component within
9545 such a weakly connected component is first scheduled separately
9546 and then combined with other strongly connected components.
9547 This option has no effect if C<schedule_serialize_sccs> is set.
9549 =item * schedule_maximize_band_depth
9551 If this option is set, then the scheduler tries to maximize
9552 the width of the bands.  Wider bands give more possibilities for tiling.
9553 In particular, if the C<schedule_whole_component> option is set,
9554 then bands are split if this might result in wider bands.
9555 Otherwise, the effect of this option is to only allow
9556 strongly connected components to be combined if this does
9557 not reduce the width of the bands.
9558 Note that if the C<schedule_serialize_sccs> options is set, then
9559 the C<schedule_maximize_band_depth> option therefore has no effect.
9561 =item * schedule_maximize_coincidence
9563 This option is only effective if the C<schedule_whole_component>
9564 option is turned off.
9565 If the C<schedule_maximize_coincidence> option is set, then (clusters of)
9566 strongly connected components are only combined with each other
9567 if this does not reduce the number of coincident band members.
9569 =item * schedule_outer_coincidence
9571 If this option is set, then we try to construct schedules
9572 where the outermost scheduling dimension in each band
9573 satisfies the coincidence constraints.
9575 =item * schedule_algorithm
9577 Selects the scheduling algorithm to be used.
9578 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
9579 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
9581 =item * schedule_split_scaled
9583 If this option is set, then we try to construct schedules in which the
9584 constant term is split off from the linear part if the linear parts of
9585 the scheduling rows for all nodes in the graph have a common non-trivial
9586 divisor.
9587 The constant term is then dropped and the linear
9588 part is reduced.
9589 This option is only effective when the Feautrier style scheduler is
9590 being used, either as the main scheduler or as a fallback for the
9591 Pluto-like scheduler.
9593 =item * schedule_treat_coalescing
9595 If this option is set, then the scheduler will try and avoid
9596 producing schedules that perform loop coalescing.
9597 In particular, for the Pluto-like scheduler, this option places
9598 bounds on the schedule coefficients based on the sizes of the instance sets.
9599 For the Feautrier style scheduler, this option detects potentially
9600 coalescing schedules and then tries to adjust the schedule to avoid
9601 the coalescing.
9603 =item * schedule_carry_self_first
9605 If this option is set, then the Feautrier style scheduler
9606 (when used as a fallback for the Pluto-like scheduler) will
9607 first try to only carry self-dependences.
9609 =item * schedule_separate_components
9611 If this option is set then the function C<isl_schedule_get_map>
9612 will treat set nodes in the same way as sequence nodes.
9614 =back
9616 =head2 AST Generation
9618 This section describes the C<isl> functionality for generating
9619 ASTs that visit all the elements
9620 in a domain in an order specified by a schedule tree or
9621 a schedule map.
9622 In case the schedule given as a C<isl_union_map>, an AST is generated
9623 that visits all the elements in the domain of the C<isl_union_map>
9624 according to the lexicographic order of the corresponding image
9625 element(s).  If the range of the C<isl_union_map> consists of
9626 elements in more than one space, then each of these spaces is handled
9627 separately in an arbitrary order.
9628 It should be noted that the schedule tree or the image elements
9629 in a schedule map only specify the I<order>
9630 in which the corresponding domain elements should be visited.
9631 No direct relation between the partial schedule values
9632 or the image elements on the one hand and the loop iterators
9633 in the generated AST on the other hand should be assumed.
9635 Each AST is generated within a build.  The initial build
9636 simply specifies the constraints on the parameters (if any)
9637 and can be created, inspected, copied and freed using the following functions.
9639         #include <isl/ast_build.h>
9640         __isl_give isl_ast_build *isl_ast_build_alloc(
9641                 isl_ctx *ctx);
9642         __isl_give isl_ast_build *isl_ast_build_from_context(
9643                 __isl_take isl_set *set);
9644         __isl_give isl_ast_build *isl_ast_build_copy(
9645                 __isl_keep isl_ast_build *build);
9646         __isl_null isl_ast_build *isl_ast_build_free(
9647                 __isl_take isl_ast_build *build);
9649 The C<set> argument is usually a parameter set with zero or more parameters.
9650 In fact, when creating an AST using C<isl_ast_build_node_from_schedule>,
9651 this set is required to be a parameter set.
9652 An C<isl_ast_build> created using C<isl_ast_build_alloc> does not
9653 specify any parameter constraints.
9654 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
9655 and L</"Fine-grained Control over AST Generation">.
9656 Finally, the AST itself can be constructed using one of the following
9657 functions.
9659         #include <isl/ast_build.h>
9660         __isl_give isl_ast_node *isl_ast_build_node_from_schedule(
9661                 __isl_keep isl_ast_build *build,
9662                 __isl_take isl_schedule *schedule);
9663         __isl_give isl_ast_node *
9664         isl_ast_build_node_from_schedule_map(
9665                 __isl_keep isl_ast_build *build,
9666                 __isl_take isl_union_map *schedule);
9668 =head3 Inspecting the AST
9670 The basic properties of an AST node can be obtained as follows.
9672         #include <isl/ast.h>
9673         enum isl_ast_node_type isl_ast_node_get_type(
9674                 __isl_keep isl_ast_node *node);
9676 The type of an AST node is one of
9677 C<isl_ast_node_for>,
9678 C<isl_ast_node_if>,
9679 C<isl_ast_node_block>,
9680 C<isl_ast_node_mark> or
9681 C<isl_ast_node_user>.
9682 An C<isl_ast_node_for> represents a for node.
9683 An C<isl_ast_node_if> represents an if node.
9684 An C<isl_ast_node_block> represents a compound node.
9685 An C<isl_ast_node_mark> introduces a mark in the AST.
9686 An C<isl_ast_node_user> represents an expression statement.
9687 An expression statement typically corresponds to a domain element, i.e.,
9688 one of the elements that is visited by the AST.
9690 Each type of node has its own additional properties.
9692         #include <isl/ast.h>
9693         __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
9694                 __isl_keep isl_ast_node *node);
9695         __isl_give isl_ast_expr *isl_ast_node_for_get_init(
9696                 __isl_keep isl_ast_node *node);
9697         __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
9698                 __isl_keep isl_ast_node *node);
9699         __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
9700                 __isl_keep isl_ast_node *node);
9701         __isl_give isl_ast_node *isl_ast_node_for_get_body(
9702                 __isl_keep isl_ast_node *node);
9703         isl_bool isl_ast_node_for_is_degenerate(
9704                 __isl_keep isl_ast_node *node);
9706 An C<isl_ast_for> is considered degenerate if it is known to execute
9707 exactly once.
9709         #include <isl/ast.h>
9710         __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
9711                 __isl_keep isl_ast_node *node);
9712         __isl_give isl_ast_node *isl_ast_node_if_get_then(
9713                 __isl_keep isl_ast_node *node);
9714         isl_bool isl_ast_node_if_has_else(
9715                 __isl_keep isl_ast_node *node);
9716         __isl_give isl_ast_node *isl_ast_node_if_get_else(
9717                 __isl_keep isl_ast_node *node);
9719         __isl_give isl_ast_node_list *
9720         isl_ast_node_block_get_children(
9721                 __isl_keep isl_ast_node *node);
9723         __isl_give isl_id *isl_ast_node_mark_get_id(
9724                 __isl_keep isl_ast_node *node);
9725         __isl_give isl_ast_node *isl_ast_node_mark_get_node(
9726                 __isl_keep isl_ast_node *node);
9728 C<isl_ast_node_mark_get_id> returns the identifier of the mark.
9729 C<isl_ast_node_mark_get_node> returns the child node that is being marked.
9731         #include <isl/ast.h>
9732         __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
9733                 __isl_keep isl_ast_node *node);
9735 All descendants of a specific node in the AST (including the node itself)
9736 can be visited
9737 in depth-first pre-order using the following function.
9739         #include <isl/ast.h>
9740         isl_stat isl_ast_node_foreach_descendant_top_down(
9741                 __isl_keep isl_ast_node *node,
9742                 isl_bool (*fn)(__isl_keep isl_ast_node *node,
9743                         void *user), void *user);
9745 The callback function should return C<isl_bool_true> if the children
9746 of the given node should be visited and C<isl_bool_false> if they should not.
9747 It should return C<isl_bool_error> in case of failure, in which case
9748 the entire traversal is aborted.
9750 Each of the returned C<isl_ast_expr>s can in turn be inspected using
9751 the following functions.
9753         #include <isl/ast.h>
9754         enum isl_ast_expr_type isl_ast_expr_get_type(
9755                 __isl_keep isl_ast_expr *expr);
9757 The type of an AST expression is one of
9758 C<isl_ast_expr_op>,
9759 C<isl_ast_expr_id> or
9760 C<isl_ast_expr_int>.
9761 An C<isl_ast_expr_op> represents the result of an operation.
9762 An C<isl_ast_expr_id> represents an identifier.
9763 An C<isl_ast_expr_int> represents an integer value.
9765 Each type of expression has its own additional properties.
9767         #include <isl/ast.h>
9768         enum isl_ast_op_type isl_ast_expr_get_op_type(
9769                 __isl_keep isl_ast_expr *expr);
9770         int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
9771         __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
9772                 __isl_keep isl_ast_expr *expr, int pos);
9773         isl_stat isl_ast_expr_foreach_ast_op_type(
9774                 __isl_keep isl_ast_expr *expr,
9775                 isl_stat (*fn)(enum isl_ast_op_type type,
9776                         void *user), void *user);
9777         isl_stat isl_ast_node_foreach_ast_op_type(
9778                 __isl_keep isl_ast_node *node,
9779                 isl_stat (*fn)(enum isl_ast_op_type type,
9780                         void *user), void *user);
9782 C<isl_ast_expr_get_op_type> returns the type of the operation
9783 performed.  C<isl_ast_expr_get_op_n_arg> returns the number of
9784 arguments.  C<isl_ast_expr_get_op_arg> returns the specified
9785 argument.
9786 C<isl_ast_expr_foreach_ast_op_type> calls C<fn> for each distinct
9787 C<isl_ast_op_type> that appears in C<expr>.
9788 C<isl_ast_node_foreach_ast_op_type> does the same for each distinct
9789 C<isl_ast_op_type> that appears in C<node>.
9790 The operation type is one of the following.
9792 =over
9794 =item C<isl_ast_op_and>
9796 Logical I<and> of two arguments.
9797 Both arguments can be evaluated.
9799 =item C<isl_ast_op_and_then>
9801 Logical I<and> of two arguments.
9802 The second argument can only be evaluated if the first evaluates to true.
9804 =item C<isl_ast_op_or>
9806 Logical I<or> of two arguments.
9807 Both arguments can be evaluated.
9809 =item C<isl_ast_op_or_else>
9811 Logical I<or> of two arguments.
9812 The second argument can only be evaluated if the first evaluates to false.
9814 =item C<isl_ast_op_max>
9816 Maximum of two or more arguments.
9818 =item C<isl_ast_op_min>
9820 Minimum of two or more arguments.
9822 =item C<isl_ast_op_minus>
9824 Change sign.
9826 =item C<isl_ast_op_add>
9828 Sum of two arguments.
9830 =item C<isl_ast_op_sub>
9832 Difference of two arguments.
9834 =item C<isl_ast_op_mul>
9836 Product of two arguments.
9838 =item C<isl_ast_op_div>
9840 Exact division.  That is, the result is known to be an integer.
9842 =item C<isl_ast_op_fdiv_q>
9844 Result of integer division, rounded towards negative
9845 infinity.
9847 =item C<isl_ast_op_pdiv_q>
9849 Result of integer division, where dividend is known to be non-negative.
9851 =item C<isl_ast_op_pdiv_r>
9853 Remainder of integer division, where dividend is known to be non-negative.
9855 =item C<isl_ast_op_zdiv_r>
9857 Equal to zero iff the remainder on integer division is zero.
9859 =item C<isl_ast_op_cond>
9861 Conditional operator defined on three arguments.
9862 If the first argument evaluates to true, then the result
9863 is equal to the second argument.  Otherwise, the result
9864 is equal to the third argument.
9865 The second and third argument may only be evaluated if
9866 the first argument evaluates to true and false, respectively.
9867 Corresponds to C<a ? b : c> in C.
9869 =item C<isl_ast_op_select>
9871 Conditional operator defined on three arguments.
9872 If the first argument evaluates to true, then the result
9873 is equal to the second argument.  Otherwise, the result
9874 is equal to the third argument.
9875 The second and third argument may be evaluated independently
9876 of the value of the first argument.
9877 Corresponds to C<a * b + (1 - a) * c> in C.
9879 =item C<isl_ast_op_eq>
9881 Equality relation.
9883 =item C<isl_ast_op_le>
9885 Less than or equal relation.
9887 =item C<isl_ast_op_lt>
9889 Less than relation.
9891 =item C<isl_ast_op_ge>
9893 Greater than or equal relation.
9895 =item C<isl_ast_op_gt>
9897 Greater than relation.
9899 =item C<isl_ast_op_call>
9901 A function call.
9902 The number of arguments of the C<isl_ast_expr> is one more than
9903 the number of arguments in the function call, the first argument
9904 representing the function being called.
9906 =item C<isl_ast_op_access>
9908 An array access.
9909 The number of arguments of the C<isl_ast_expr> is one more than
9910 the number of index expressions in the array access, the first argument
9911 representing the array being accessed.
9913 =item C<isl_ast_op_member>
9915 A member access.
9916 This operation has two arguments, a structure and the name of
9917 the member of the structure being accessed.
9919 =back
9921         #include <isl/ast.h>
9922         __isl_give isl_id *isl_ast_expr_get_id(
9923                 __isl_keep isl_ast_expr *expr);
9925 Return the identifier represented by the AST expression.
9927         #include <isl/ast.h>
9928         __isl_give isl_val *isl_ast_expr_get_val(
9929                 __isl_keep isl_ast_expr *expr);
9931 Return the integer represented by the AST expression.
9933 =head3 Properties of ASTs
9935         #include <isl/ast.h>
9936         isl_bool isl_ast_expr_is_equal(
9937                 __isl_keep isl_ast_expr *expr1,
9938                 __isl_keep isl_ast_expr *expr2);
9940 Check if two C<isl_ast_expr>s are equal to each other.
9942 =head3 Manipulating and printing the AST
9944 AST nodes can be copied and freed using the following functions.
9946         #include <isl/ast.h>
9947         __isl_give isl_ast_node *isl_ast_node_copy(
9948                 __isl_keep isl_ast_node *node);
9949         __isl_null isl_ast_node *isl_ast_node_free(
9950                 __isl_take isl_ast_node *node);
9952 AST expressions can be copied and freed using the following functions.
9954         #include <isl/ast.h>
9955         __isl_give isl_ast_expr *isl_ast_expr_copy(
9956                 __isl_keep isl_ast_expr *expr);
9957         __isl_null isl_ast_expr *isl_ast_expr_free(
9958                 __isl_take isl_ast_expr *expr);
9960 New AST expressions can be created either directly or within
9961 the context of an C<isl_ast_build>.
9963         #include <isl/ast.h>
9964         __isl_give isl_ast_expr *isl_ast_expr_from_val(
9965                 __isl_take isl_val *v);
9966         __isl_give isl_ast_expr *isl_ast_expr_from_id(
9967                 __isl_take isl_id *id);
9968         __isl_give isl_ast_expr *isl_ast_expr_neg(
9969                 __isl_take isl_ast_expr *expr);
9970         __isl_give isl_ast_expr *isl_ast_expr_address_of(
9971                 __isl_take isl_ast_expr *expr);
9972         __isl_give isl_ast_expr *isl_ast_expr_add(
9973                 __isl_take isl_ast_expr *expr1,
9974                 __isl_take isl_ast_expr *expr2);
9975         __isl_give isl_ast_expr *isl_ast_expr_sub(
9976                 __isl_take isl_ast_expr *expr1,
9977                 __isl_take isl_ast_expr *expr2);
9978         __isl_give isl_ast_expr *isl_ast_expr_mul(
9979                 __isl_take isl_ast_expr *expr1,
9980                 __isl_take isl_ast_expr *expr2);
9981         __isl_give isl_ast_expr *isl_ast_expr_div(
9982                 __isl_take isl_ast_expr *expr1,
9983                 __isl_take isl_ast_expr *expr2);
9984         __isl_give isl_ast_expr *isl_ast_expr_pdiv_q(
9985                 __isl_take isl_ast_expr *expr1,
9986                 __isl_take isl_ast_expr *expr2);
9987         __isl_give isl_ast_expr *isl_ast_expr_pdiv_r(
9988                 __isl_take isl_ast_expr *expr1,
9989                 __isl_take isl_ast_expr *expr2);
9990         __isl_give isl_ast_expr *isl_ast_expr_and(
9991                 __isl_take isl_ast_expr *expr1,
9992                 __isl_take isl_ast_expr *expr2)
9993         __isl_give isl_ast_expr *isl_ast_expr_and_then(
9994                 __isl_take isl_ast_expr *expr1,
9995                 __isl_take isl_ast_expr *expr2)
9996         __isl_give isl_ast_expr *isl_ast_expr_or(
9997                 __isl_take isl_ast_expr *expr1,
9998                 __isl_take isl_ast_expr *expr2)
9999         __isl_give isl_ast_expr *isl_ast_expr_or_else(
10000                 __isl_take isl_ast_expr *expr1,
10001                 __isl_take isl_ast_expr *expr2)
10002         __isl_give isl_ast_expr *isl_ast_expr_eq(
10003                 __isl_take isl_ast_expr *expr1,
10004                 __isl_take isl_ast_expr *expr2);
10005         __isl_give isl_ast_expr *isl_ast_expr_le(
10006                 __isl_take isl_ast_expr *expr1,
10007                 __isl_take isl_ast_expr *expr2);
10008         __isl_give isl_ast_expr *isl_ast_expr_lt(
10009                 __isl_take isl_ast_expr *expr1,
10010                 __isl_take isl_ast_expr *expr2);
10011         __isl_give isl_ast_expr *isl_ast_expr_ge(
10012                 __isl_take isl_ast_expr *expr1,
10013                 __isl_take isl_ast_expr *expr2);
10014         __isl_give isl_ast_expr *isl_ast_expr_gt(
10015                 __isl_take isl_ast_expr *expr1,
10016                 __isl_take isl_ast_expr *expr2);
10017         __isl_give isl_ast_expr *isl_ast_expr_access(
10018                 __isl_take isl_ast_expr *array,
10019                 __isl_take isl_ast_expr_list *indices);
10020         __isl_give isl_ast_expr *isl_ast_expr_call(
10021                 __isl_take isl_ast_expr *function,
10022                 __isl_take isl_ast_expr_list *arguments);
10024 The function C<isl_ast_expr_address_of> can be applied to an
10025 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
10026 to represent the address of the C<isl_ast_expr_access>. The function
10027 C<isl_ast_expr_and_then> as well as C<isl_ast_expr_or_else> are short-circuit
10028 versions of C<isl_ast_expr_and> and C<isl_ast_expr_or>, respectively.
10030         #include <isl/ast_build.h>
10031         __isl_give isl_ast_expr *isl_ast_build_expr_from_set(
10032                 __isl_keep isl_ast_build *build,
10033                 __isl_take isl_set *set);
10034         __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
10035                 __isl_keep isl_ast_build *build,
10036                 __isl_take isl_pw_aff *pa);
10037         __isl_give isl_ast_expr *
10038         isl_ast_build_access_from_pw_multi_aff(
10039                 __isl_keep isl_ast_build *build,
10040                 __isl_take isl_pw_multi_aff *pma);
10041         __isl_give isl_ast_expr *
10042         isl_ast_build_access_from_multi_pw_aff(
10043                 __isl_keep isl_ast_build *build,
10044                 __isl_take isl_multi_pw_aff *mpa);
10045         __isl_give isl_ast_expr *
10046         isl_ast_build_call_from_pw_multi_aff(
10047                 __isl_keep isl_ast_build *build,
10048                 __isl_take isl_pw_multi_aff *pma);
10049         __isl_give isl_ast_expr *
10050         isl_ast_build_call_from_multi_pw_aff(
10051                 __isl_keep isl_ast_build *build,
10052                 __isl_take isl_multi_pw_aff *mpa);
10054 The set <set> and
10055 the domains of C<pa>, C<mpa> and C<pma> should correspond
10056 to the schedule space of C<build>.
10057 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
10058 the function being called.
10059 If the accessed space is a nested relation, then it is taken
10060 to represent an access of the member specified by the range
10061 of this nested relation of the structure specified by the domain
10062 of the nested relation.
10064 The following functions can be used to modify an C<isl_ast_expr>.
10066         #include <isl/ast.h>
10067         __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
10068                 __isl_take isl_ast_expr *expr, int pos,
10069                 __isl_take isl_ast_expr *arg);
10071 Replace the argument of C<expr> at position C<pos> by C<arg>.
10073         #include <isl/ast.h>
10074         __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
10075                 __isl_take isl_ast_expr *expr,
10076                 __isl_take isl_id_to_ast_expr *id2expr);
10078 The function C<isl_ast_expr_substitute_ids> replaces the
10079 subexpressions of C<expr> of type C<isl_ast_expr_id>
10080 by the corresponding expression in C<id2expr>, if there is any.
10083 User specified data can be attached to an C<isl_ast_node> and obtained
10084 from the same C<isl_ast_node> using the following functions.
10086         #include <isl/ast.h>
10087         __isl_give isl_ast_node *isl_ast_node_set_annotation(
10088                 __isl_take isl_ast_node *node,
10089                 __isl_take isl_id *annotation);
10090         __isl_give isl_id *isl_ast_node_get_annotation(
10091                 __isl_keep isl_ast_node *node);
10093 Basic printing can be performed using the following functions.
10095         #include <isl/ast.h>
10096         __isl_give isl_printer *isl_printer_print_ast_expr(
10097                 __isl_take isl_printer *p,
10098                 __isl_keep isl_ast_expr *expr);
10099         __isl_give isl_printer *isl_printer_print_ast_node(
10100                 __isl_take isl_printer *p,
10101                 __isl_keep isl_ast_node *node);
10102         __isl_give char *isl_ast_expr_to_str(
10103                 __isl_keep isl_ast_expr *expr);
10104         __isl_give char *isl_ast_node_to_str(
10105                 __isl_keep isl_ast_node *node);
10106         __isl_give char *isl_ast_expr_to_C_str(
10107                 __isl_keep isl_ast_expr *expr);
10108         __isl_give char *isl_ast_node_to_C_str(
10109                 __isl_keep isl_ast_node *node);
10111 The functions C<isl_ast_expr_to_C_str> and
10112 C<isl_ast_node_to_C_str> are convenience functions
10113 that return a string representation of the input in C format.
10115 More advanced printing can be performed using the following functions.
10117         #include <isl/ast.h>
10118         __isl_give isl_printer *isl_ast_op_type_set_print_name(
10119                 __isl_take isl_printer *p,
10120                 enum isl_ast_op_type type,
10121                 __isl_keep const char *name);
10122         isl_stat isl_options_set_ast_print_macro_once(
10123                 isl_ctx *ctx, int val);
10124         int isl_options_get_ast_print_macro_once(isl_ctx *ctx);
10125         __isl_give isl_printer *isl_ast_op_type_print_macro(
10126                 enum isl_ast_op_type type,
10127                 __isl_take isl_printer *p);
10128         __isl_give isl_printer *isl_ast_expr_print_macros(
10129                 __isl_keep isl_ast_expr *expr,
10130                 __isl_take isl_printer *p);
10131         __isl_give isl_printer *isl_ast_node_print_macros(
10132                 __isl_keep isl_ast_node *node,
10133                 __isl_take isl_printer *p);
10134         __isl_give isl_printer *isl_ast_node_print(
10135                 __isl_keep isl_ast_node *node,
10136                 __isl_take isl_printer *p,
10137                 __isl_take isl_ast_print_options *options);
10138         __isl_give isl_printer *isl_ast_node_for_print(
10139                 __isl_keep isl_ast_node *node,
10140                 __isl_take isl_printer *p,
10141                 __isl_take isl_ast_print_options *options);
10142         __isl_give isl_printer *isl_ast_node_if_print(
10143                 __isl_keep isl_ast_node *node,
10144                 __isl_take isl_printer *p,
10145                 __isl_take isl_ast_print_options *options);
10147 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
10148 C<isl> may print out an AST that makes use of macros such
10149 as C<floord>, C<min> and C<max>.
10150 The names of these macros may be modified by a call
10151 to C<isl_ast_op_type_set_print_name>.  The user-specified
10152 names are associated to the printer object.
10153 C<isl_ast_op_type_print_macro> prints out the macro
10154 corresponding to a specific C<isl_ast_op_type>.
10155 If the print-macro-once option is set, then a given macro definition
10156 is only printed once to any given printer object.
10157 C<isl_ast_expr_print_macros> scans the C<isl_ast_expr>
10158 for subexpressions where these macros would be used and prints
10159 out the required macro definitions.
10160 Essentially, C<isl_ast_expr_print_macros> calls
10161 C<isl_ast_expr_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
10162 as function argument.
10163 C<isl_ast_node_print_macros> does the same
10164 for expressions in its C<isl_ast_node> argument.
10165 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
10166 C<isl_ast_node_if_print> print an C<isl_ast_node>
10167 in C<ISL_FORMAT_C>, but allow for some extra control
10168 through an C<isl_ast_print_options> object.
10169 This object can be created using the following functions.
10171         #include <isl/ast.h>
10172         __isl_give isl_ast_print_options *
10173         isl_ast_print_options_alloc(isl_ctx *ctx);
10174         __isl_give isl_ast_print_options *
10175         isl_ast_print_options_copy(
10176                 __isl_keep isl_ast_print_options *options);
10177         __isl_null isl_ast_print_options *
10178         isl_ast_print_options_free(
10179                 __isl_take isl_ast_print_options *options);
10181         __isl_give isl_ast_print_options *
10182         isl_ast_print_options_set_print_user(
10183                 __isl_take isl_ast_print_options *options,
10184                 __isl_give isl_printer *(*print_user)(
10185                         __isl_take isl_printer *p,
10186                         __isl_take isl_ast_print_options *options,
10187                         __isl_keep isl_ast_node *node, void *user),
10188                 void *user);
10189         __isl_give isl_ast_print_options *
10190         isl_ast_print_options_set_print_for(
10191                 __isl_take isl_ast_print_options *options,
10192                 __isl_give isl_printer *(*print_for)(
10193                         __isl_take isl_printer *p,
10194                         __isl_take isl_ast_print_options *options,
10195                         __isl_keep isl_ast_node *node, void *user),
10196                 void *user);
10198 The callback set by C<isl_ast_print_options_set_print_user>
10199 is called whenever a node of type C<isl_ast_node_user> needs to
10200 be printed.
10201 The callback set by C<isl_ast_print_options_set_print_for>
10202 is called whenever a node of type C<isl_ast_node_for> needs to
10203 be printed.
10204 Note that C<isl_ast_node_for_print> will I<not> call the
10205 callback set by C<isl_ast_print_options_set_print_for> on the node
10206 on which C<isl_ast_node_for_print> is called, but only on nested
10207 nodes of type C<isl_ast_node_for>.  It is therefore safe to
10208 call C<isl_ast_node_for_print> from within the callback set by
10209 C<isl_ast_print_options_set_print_for>.
10211 The following option determines the type to be used for iterators
10212 while printing the AST.
10214         isl_stat isl_options_set_ast_iterator_type(
10215                 isl_ctx *ctx, const char *val);
10216         const char *isl_options_get_ast_iterator_type(
10217                 isl_ctx *ctx);
10219 The AST printer only prints body nodes as blocks if these
10220 blocks cannot be safely omitted.
10221 For example, a C<for> node with one body node will not be
10222 surrounded with braces in C<ISL_FORMAT_C>.
10223 A block will always be printed by setting the following option.
10225         isl_stat isl_options_set_ast_always_print_block(isl_ctx *ctx,
10226                 int val);
10227         int isl_options_get_ast_always_print_block(isl_ctx *ctx);
10229 =head3 Options
10231         #include <isl/ast_build.h>
10232         isl_stat isl_options_set_ast_build_atomic_upper_bound(
10233                 isl_ctx *ctx, int val);
10234         int isl_options_get_ast_build_atomic_upper_bound(
10235                 isl_ctx *ctx);
10236         isl_stat isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
10237                 int val);
10238         int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
10239         isl_stat isl_options_set_ast_build_detect_min_max(
10240                 isl_ctx *ctx, int val);
10241         int isl_options_get_ast_build_detect_min_max(
10242                 isl_ctx *ctx);
10243         isl_stat isl_options_set_ast_build_exploit_nested_bounds(
10244                 isl_ctx *ctx, int val);
10245         int isl_options_get_ast_build_exploit_nested_bounds(
10246                 isl_ctx *ctx);
10247         isl_stat isl_options_set_ast_build_group_coscheduled(
10248                 isl_ctx *ctx, int val);
10249         int isl_options_get_ast_build_group_coscheduled(
10250                 isl_ctx *ctx);
10251         isl_stat isl_options_set_ast_build_scale_strides(
10252                 isl_ctx *ctx, int val);
10253         int isl_options_get_ast_build_scale_strides(
10254                 isl_ctx *ctx);
10255         isl_stat isl_options_set_ast_build_allow_else(isl_ctx *ctx,
10256                 int val);
10257         int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
10258         isl_stat isl_options_set_ast_build_allow_or(isl_ctx *ctx,
10259                 int val);
10260         int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
10262 =over
10264 =item * ast_build_atomic_upper_bound
10266 Generate loop upper bounds that consist of the current loop iterator,
10267 an operator and an expression not involving the iterator.
10268 If this option is not set, then the current loop iterator may appear
10269 several times in the upper bound.
10270 For example, when this option is turned off, AST generation
10271 for the schedule
10273         [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
10275 produces
10277         for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
10278           A(c0);
10280 When the option is turned on, the following AST is generated
10282         for (int c0 = 0; c0 <= min(100, n); c0 += 1)
10283           A(c0);
10285 =item * ast_build_prefer_pdiv
10287 If this option is turned off, then the AST generation will
10288 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
10289 operators, but no C<isl_ast_op_pdiv_q> or
10290 C<isl_ast_op_pdiv_r> operators.
10291 If this option is turned on, then C<isl> will try to convert
10292 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
10293 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
10295 =item * ast_build_detect_min_max
10297 If this option is turned on, then C<isl> will try and detect
10298 min or max-expressions when building AST expressions from
10299 piecewise affine expressions.
10301 =item * ast_build_exploit_nested_bounds
10303 Simplify conditions based on bounds of nested for loops.
10304 In particular, remove conditions that are implied by the fact
10305 that one or more nested loops have at least one iteration,
10306 meaning that the upper bound is at least as large as the lower bound.
10307 For example, when this option is turned off, AST generation
10308 for the schedule
10310         [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
10311                                         0 <= j <= M }
10313 produces
10315         if (M >= 0)
10316           for (int c0 = 0; c0 <= N; c0 += 1)
10317             for (int c1 = 0; c1 <= M; c1 += 1)
10318               A(c0, c1);
10320 When the option is turned on, the following AST is generated
10322         for (int c0 = 0; c0 <= N; c0 += 1)
10323           for (int c1 = 0; c1 <= M; c1 += 1)
10324             A(c0, c1);
10326 =item * ast_build_group_coscheduled
10328 If two domain elements are assigned the same schedule point, then
10329 they may be executed in any order and they may even appear in different
10330 loops.  If this options is set, then the AST generator will make
10331 sure that coscheduled domain elements do not appear in separate parts
10332 of the AST.  This is useful in case of nested AST generation
10333 if the outer AST generation is given only part of a schedule
10334 and the inner AST generation should handle the domains that are
10335 coscheduled by this initial part of the schedule together.
10336 For example if an AST is generated for a schedule
10338         { A[i] -> [0]; B[i] -> [0] }
10340 then the C<isl_ast_build_set_create_leaf> callback described
10341 below may get called twice, once for each domain.
10342 Setting this option ensures that the callback is only called once
10343 on both domains together.
10345 =item * ast_build_separation_bounds
10347 This option specifies which bounds to use during separation.
10348 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
10349 then all (possibly implicit) bounds on the current dimension will
10350 be used during separation.
10351 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
10352 then only those bounds that are explicitly available will
10353 be used during separation.
10355 =item * ast_build_scale_strides
10357 This option specifies whether the AST generator is allowed
10358 to scale down iterators of strided loops.
10360 =item * ast_build_allow_else
10362 This option specifies whether the AST generator is allowed
10363 to construct if statements with else branches.
10365 =item * ast_build_allow_or
10367 This option specifies whether the AST generator is allowed
10368 to construct if conditions with disjunctions.
10370 =back
10372 =head3 AST Generation Options (Schedule Tree)
10374 In case of AST construction from a schedule tree, the options
10375 that control how an AST is created from the individual schedule
10376 dimensions are stored in the band nodes of the tree
10377 (see L</"Schedule Trees">).
10379 In particular, a schedule dimension can be handled in four
10380 different ways, atomic, separate, unroll or the default.
10381 This loop AST generation type can be set using
10382 C<isl_schedule_node_band_member_set_ast_loop_type>.
10383 Alternatively,
10384 the first three can be selected by including a one-dimensional
10385 element with as value the position of the schedule dimension
10386 within the band and as name one of C<atomic>, C<separate>
10387 or C<unroll> in the options
10388 set by C<isl_schedule_node_band_set_ast_build_options>.
10389 Only one of these three may be specified for
10390 any given schedule dimension within a band node.
10391 If none of these is specified, then the default
10392 is used.  The meaning of the options is as follows.
10394 =over
10396 =item C<atomic>
10398 When this option is specified, the AST generator will make
10399 sure that a given domains space only appears in a single
10400 loop at the specified level.
10402 For example, for the schedule tree
10404         domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
10405         child:
10406           schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
10407           options: "{ atomic[x] }"
10409 the following AST will be generated
10411         for (int c0 = 0; c0 <= 10; c0 += 1) {
10412           if (c0 >= 1)
10413             b(c0 - 1);
10414           if (c0 <= 9)
10415             a(c0);
10416         }
10418 On the other hand, for the schedule tree
10420         domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
10421         child:
10422           schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
10423           options: "{ separate[x] }"
10425 the following AST will be generated
10427         {
10428           a(0);
10429           for (int c0 = 1; c0 <= 9; c0 += 1) {
10430             b(c0 - 1);
10431             a(c0);
10432           }
10433           b(9);
10434         }
10436 If neither C<atomic> nor C<separate> is specified, then the AST generator
10437 may produce either of these two results or some intermediate form.
10439 =item C<separate>
10441 When this option is specified, the AST generator will
10442 split the domain of the specified schedule dimension
10443 into pieces with a fixed set of statements for which
10444 instances need to be executed by the iterations in
10445 the schedule domain part.  This option tends to avoid
10446 the generation of guards inside the corresponding loops.
10447 See also the C<atomic> option.
10449 =item C<unroll>
10451 When this option is specified, the AST generator will
10452 I<completely> unroll the corresponding schedule dimension.
10453 It is the responsibility of the user to ensure that such
10454 unrolling is possible.
10455 To obtain a partial unrolling, the user should apply an additional
10456 strip-mining to the schedule and fully unroll the inner schedule
10457 dimension.
10459 =back
10461 The C<isolate> option is a bit more involved.  It allows the user
10462 to isolate a range of schedule dimension values from smaller and
10463 greater values.  Additionally, the user may specify a different
10464 atomic/separate/unroll choice for the isolated part and the remaining
10465 parts.  The typical use case of the C<isolate> option is to isolate
10466 full tiles from partial tiles.
10467 The part that needs to be isolated may depend on outer schedule dimensions.
10468 The option therefore needs to be able to reference those outer schedule
10469 dimensions.  In particular, the space of the C<isolate> option is that
10470 of a wrapped map with as domain the flat product of all outer band nodes
10471 and as range the space of the current band node.
10472 The atomic/separate/unroll choice for the isolated part is determined
10473 by an option that lives in an unnamed wrapped space with as domain
10474 a zero-dimensional C<isolate> space and as range the regular
10475 C<atomic>, C<separate> or C<unroll> space.
10476 This option may also be set directly using
10477 C<isl_schedule_node_band_member_set_isolate_ast_loop_type>.
10478 The atomic/separate/unroll choice for the remaining part is determined
10479 by the regular C<atomic>, C<separate> or C<unroll> option.
10480 Since the C<isolate> option references outer schedule dimensions,
10481 its use in a band node causes any tree containing the node
10482 to be considered anchored.
10484 As an example, consider the isolation of full tiles from partial tiles
10485 in a tiling of a triangular domain.  The original schedule is as follows.
10487         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10488         child:
10489           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10490                 { A[i,j] -> [floor(j/10)] }, \
10491                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10493 The output is
10495         for (int c0 = 0; c0 <= 10; c0 += 1)
10496           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10497             for (int c2 = 10 * c0;
10498                  c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10499               for (int c3 = 10 * c1;
10500                    c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10501                 A(c2, c3);
10503 Isolating the full tiles, we have the following input
10505         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10506         child:
10507           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10508                 { A[i,j] -> [floor(j/10)] }, \
10509                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10510           options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
10511                 10a+9+10b+9 <= 100 }"
10513 and output
10515         {
10516           for (int c0 = 0; c0 <= 8; c0 += 1) {
10517             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10518               for (int c2 = 10 * c0;
10519                    c2 <= 10 * c0 + 9; c2 += 1)
10520                 for (int c3 = 10 * c1;
10521                      c3 <= 10 * c1 + 9; c3 += 1)
10522                   A(c2, c3);
10523             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10524               for (int c2 = 10 * c0;
10525                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10526                 for (int c3 = 10 * c1;
10527                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10528                   A(c2, c3);
10529           }
10530           for (int c0 = 9; c0 <= 10; c0 += 1)
10531             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10532               for (int c2 = 10 * c0;
10533                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10534                 for (int c3 = 10 * c1;
10535                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10536                   A(c2, c3);
10537         }
10539 We may then additionally unroll the innermost loop of the isolated part
10541         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10542         child:
10543           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10544                 { A[i,j] -> [floor(j/10)] }, \
10545                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10546           options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
10547                 10a+9+10b+9 <= 100; [isolate[] -> unroll[3]] }"
10549 to obtain
10551         {
10552           for (int c0 = 0; c0 <= 8; c0 += 1) {
10553             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10554               for (int c2 = 10 * c0; c2 <= 10 * c0 + 9; c2 += 1) {
10555                 A(c2, 10 * c1);
10556                 A(c2, 10 * c1 + 1);
10557                 A(c2, 10 * c1 + 2);
10558                 A(c2, 10 * c1 + 3);
10559                 A(c2, 10 * c1 + 4);
10560                 A(c2, 10 * c1 + 5);
10561                 A(c2, 10 * c1 + 6);
10562                 A(c2, 10 * c1 + 7);
10563                 A(c2, 10 * c1 + 8);
10564                 A(c2, 10 * c1 + 9);
10565               }
10566             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10567               for (int c2 = 10 * c0;
10568                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10569                 for (int c3 = 10 * c1;
10570                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10571                   A(c2, c3);
10572           }
10573           for (int c0 = 9; c0 <= 10; c0 += 1)
10574             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10575               for (int c2 = 10 * c0;
10576                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10577                 for (int c3 = 10 * c1;
10578                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10579                   A(c2, c3);
10580         }
10583 =head3 AST Generation Options (Schedule Map)
10585 In case of AST construction using
10586 C<isl_ast_build_node_from_schedule_map>, the options
10587 that control how an AST is created from the individual schedule
10588 dimensions are stored in the C<isl_ast_build>.
10589 They can be set using the following function.
10591         #include <isl/ast_build.h>
10592         __isl_give isl_ast_build *
10593         isl_ast_build_set_options(
10594                 __isl_take isl_ast_build *build,
10595                 __isl_take isl_union_map *options);
10597 The options are encoded in an C<isl_union_map>.
10598 The domain of this union relation refers to the schedule domain,
10599 i.e., the range of the schedule passed
10600 to C<isl_ast_build_node_from_schedule_map>.
10601 In the case of nested AST generation (see L</"Nested AST Generation">),
10602 the domain of C<options> should refer to the extra piece of the schedule.
10603 That is, it should be equal to the range of the wrapped relation in the
10604 range of the schedule.
10605 The range of the options can consist of elements in one or more spaces,
10606 the names of which determine the effect of the option.
10607 The values of the range typically also refer to the schedule dimension
10608 to which the option applies.  In case of nested AST generation
10609 (see L</"Nested AST Generation">), these values refer to the position
10610 of the schedule dimension within the innermost AST generation.
10611 The constraints on the domain elements of
10612 the option should only refer to this dimension and earlier dimensions.
10613 We consider the following spaces.
10615 =over
10617 =item C<separation_class>
10619 B<This option has been deprecated.  Use the isolate option on
10620 schedule trees instead.>
10622 This space is a wrapped relation between two one dimensional spaces.
10623 The input space represents the schedule dimension to which the option
10624 applies and the output space represents the separation class.
10625 While constructing a loop corresponding to the specified schedule
10626 dimension(s), the AST generator will try to generate separate loops
10627 for domain elements that are assigned different classes.
10628 If only some of the elements are assigned a class, then those elements
10629 that are not assigned any class will be treated as belonging to a class
10630 that is separate from the explicitly assigned classes.
10631 The typical use case for this option is to separate full tiles from
10632 partial tiles.
10633 The other options, described below, are applied after the separation
10634 into classes.
10636 As an example, consider the separation into full and partial tiles
10637 of a tiling of a triangular domain.
10638 Take, for example, the domain
10640         { A[i,j] : 0 <= i,j and i + j <= 100 }
10642 and a tiling into tiles of 10 by 10.  The input to the AST generator
10643 is then the schedule
10645         { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
10646                                                 i + j <= 100 }
10648 Without any options, the following AST is generated
10650         for (int c0 = 0; c0 <= 10; c0 += 1)
10651           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10652             for (int c2 = 10 * c0;
10653                  c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10654                  c2 += 1)
10655               for (int c3 = 10 * c1;
10656                    c3 <= min(10 * c1 + 9, -c2 + 100);
10657                    c3 += 1)
10658                 A(c2, c3);
10660 Separation into full and partial tiles can be obtained by assigning
10661 a class, say C<0>, to the full tiles.  The full tiles are represented by those
10662 values of the first and second schedule dimensions for which there are
10663 values of the third and fourth dimensions to cover an entire tile.
10664 That is, we need to specify the following option
10666         { [a,b,c,d] -> separation_class[[0]->[0]] :
10667                 exists b': 0 <= 10a,10b' and
10668                            10a+9+10b'+9 <= 100;
10669           [a,b,c,d] -> separation_class[[1]->[0]] :
10670                 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
10672 which simplifies to
10674         { [a, b, c, d] -> separation_class[[1] -> [0]] :
10675                 a >= 0 and b >= 0 and b <= 8 - a;
10676           [a, b, c, d] -> separation_class[[0] -> [0]] :
10677                 a >= 0 and a <= 8 }
10679 With this option, the generated AST is as follows
10681         {
10682           for (int c0 = 0; c0 <= 8; c0 += 1) {
10683             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10684               for (int c2 = 10 * c0;
10685                    c2 <= 10 * c0 + 9; c2 += 1)
10686                 for (int c3 = 10 * c1;
10687                      c3 <= 10 * c1 + 9; c3 += 1)
10688                   A(c2, c3);
10689             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10690               for (int c2 = 10 * c0;
10691                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10692                    c2 += 1)
10693                 for (int c3 = 10 * c1;
10694                      c3 <= min(-c2 + 100, 10 * c1 + 9);
10695                      c3 += 1)
10696                   A(c2, c3);
10697           }
10698           for (int c0 = 9; c0 <= 10; c0 += 1)
10699             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10700               for (int c2 = 10 * c0;
10701                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10702                    c2 += 1)
10703                 for (int c3 = 10 * c1;
10704                      c3 <= min(10 * c1 + 9, -c2 + 100);
10705                      c3 += 1)
10706                   A(c2, c3);
10707         }
10709 =item C<separate>
10711 This is a single-dimensional space representing the schedule dimension(s)
10712 to which ``separation'' should be applied.  Separation tries to split
10713 a loop into several pieces if this can avoid the generation of guards
10714 inside the loop.
10715 See also the C<atomic> option.
10717 =item C<atomic>
10719 This is a single-dimensional space representing the schedule dimension(s)
10720 for which the domains should be considered ``atomic''.  That is, the
10721 AST generator will make sure that any given domain space will only appear
10722 in a single loop at the specified level.
10724 Consider the following schedule
10726         { a[i] -> [i] : 0 <= i < 10;
10727           b[i] -> [i+1] : 0 <= i < 10 }
10729 If the following option is specified
10731         { [i] -> separate[x] }
10733 then the following AST will be generated
10735         {
10736           a(0);
10737           for (int c0 = 1; c0 <= 9; c0 += 1) {
10738             a(c0);
10739             b(c0 - 1);
10740           }
10741           b(9);
10742         }
10744 If, on the other hand, the following option is specified
10746         { [i] -> atomic[x] }
10748 then the following AST will be generated
10750         for (int c0 = 0; c0 <= 10; c0 += 1) {
10751           if (c0 <= 9)
10752             a(c0);
10753           if (c0 >= 1)
10754             b(c0 - 1);
10755         }
10757 If neither C<atomic> nor C<separate> is specified, then the AST generator
10758 may produce either of these two results or some intermediate form.
10760 =item C<unroll>
10762 This is a single-dimensional space representing the schedule dimension(s)
10763 that should be I<completely> unrolled.
10764 To obtain a partial unrolling, the user should apply an additional
10765 strip-mining to the schedule and fully unroll the inner loop.
10767 =back
10769 =head3 Fine-grained Control over AST Generation
10771 Besides specifying the constraints on the parameters,
10772 an C<isl_ast_build> object can be used to control
10773 various aspects of the AST generation process.
10774 In case of AST construction using
10775 C<isl_ast_build_node_from_schedule_map>,
10776 the most prominent way of control is through ``options'',
10777 as explained above.
10779 Additional control is available through the following functions.
10781         #include <isl/ast_build.h>
10782         __isl_give isl_ast_build *
10783         isl_ast_build_set_iterators(
10784                 __isl_take isl_ast_build *build,
10785                 __isl_take isl_id_list *iterators);
10787 The function C<isl_ast_build_set_iterators> allows the user to
10788 specify a list of iterator C<isl_id>s to be used as iterators.
10789 If the input schedule is injective, then
10790 the number of elements in this list should be as large as the dimension
10791 of the schedule space, but no direct correspondence should be assumed
10792 between dimensions and elements.
10793 If the input schedule is not injective, then an additional number
10794 of C<isl_id>s equal to the largest dimension of the input domains
10795 may be required.
10796 If the number of provided C<isl_id>s is insufficient, then additional
10797 names are automatically generated.
10799         #include <isl/ast_build.h>
10800         __isl_give isl_ast_build *
10801         isl_ast_build_set_create_leaf(
10802                 __isl_take isl_ast_build *build,
10803                 __isl_give isl_ast_node *(*fn)(
10804                         __isl_take isl_ast_build *build,
10805                         void *user), void *user);
10808 C<isl_ast_build_set_create_leaf> function allows for the
10809 specification of a callback that should be called whenever the AST
10810 generator arrives at an element of the schedule domain.
10811 The callback should return an AST node that should be inserted
10812 at the corresponding position of the AST.  The default action (when
10813 the callback is not set) is to continue generating parts of the AST to scan
10814 all the domain elements associated to the schedule domain element
10815 and to insert user nodes, ``calling'' the domain element, for each of them.
10816 The C<build> argument contains the current state of the C<isl_ast_build>.
10817 To ease nested AST generation (see L</"Nested AST Generation">),
10818 all control information that is
10819 specific to the current AST generation such as the options and
10820 the callbacks has been removed from this C<isl_ast_build>.
10821 The callback would typically return the result of a nested
10822 AST generation or a
10823 user defined node created using the following function.
10825         #include <isl/ast.h>
10826         __isl_give isl_ast_node *isl_ast_node_alloc_user(
10827                 __isl_take isl_ast_expr *expr);
10829         #include <isl/ast_build.h>
10830         __isl_give isl_ast_build *
10831         isl_ast_build_set_at_each_domain(
10832                 __isl_take isl_ast_build *build,
10833                 __isl_give isl_ast_node *(*fn)(
10834                         __isl_take isl_ast_node *node,
10835                         __isl_keep isl_ast_build *build,
10836                         void *user), void *user);
10837         __isl_give isl_ast_build *
10838         isl_ast_build_set_before_each_for(
10839                 __isl_take isl_ast_build *build,
10840                 __isl_give isl_id *(*fn)(
10841                         __isl_keep isl_ast_build *build,
10842                         void *user), void *user);
10843         __isl_give isl_ast_build *
10844         isl_ast_build_set_after_each_for(
10845                 __isl_take isl_ast_build *build,
10846                 __isl_give isl_ast_node *(*fn)(
10847                         __isl_take isl_ast_node *node,
10848                         __isl_keep isl_ast_build *build,
10849                         void *user), void *user);
10850         __isl_give isl_ast_build *
10851         isl_ast_build_set_before_each_mark(
10852                 __isl_take isl_ast_build *build,
10853                 isl_stat (*fn)(__isl_keep isl_id *mark,
10854                         __isl_keep isl_ast_build *build,
10855                         void *user), void *user);
10856         __isl_give isl_ast_build *
10857         isl_ast_build_set_after_each_mark(
10858                 __isl_take isl_ast_build *build,
10859                 __isl_give isl_ast_node *(*fn)(
10860                         __isl_take isl_ast_node *node,
10861                         __isl_keep isl_ast_build *build,
10862                         void *user), void *user);
10864 The callback set by C<isl_ast_build_set_at_each_domain> will
10865 be called for each domain AST node.
10866 The callbacks set by C<isl_ast_build_set_before_each_for>
10867 and C<isl_ast_build_set_after_each_for> will be called
10868 for each for AST node.  The first will be called in depth-first
10869 pre-order, while the second will be called in depth-first post-order.
10870 Since C<isl_ast_build_set_before_each_for> is called before the for
10871 node is actually constructed, it is only passed an C<isl_ast_build>.
10872 The returned C<isl_id> will be added as an annotation (using
10873 C<isl_ast_node_set_annotation>) to the constructed for node.
10874 In particular, if the user has also specified an C<after_each_for>
10875 callback, then the annotation can be retrieved from the node passed to
10876 that callback using C<isl_ast_node_get_annotation>.
10877 The callbacks set by C<isl_ast_build_set_before_each_mark>
10878 and C<isl_ast_build_set_after_each_mark> will be called for each
10879 mark AST node that is created, i.e., for each mark schedule node
10880 in the input schedule tree.  The first will be called in depth-first
10881 pre-order, while the second will be called in depth-first post-order.
10882 Since the callback set by C<isl_ast_build_set_before_each_mark>
10883 is called before the mark AST node is actually constructed, it is passed
10884 the identifier of the mark node.
10885 All callbacks should C<NULL> (or C<isl_stat_error>) on failure.
10886 The given C<isl_ast_build> can be used to create new
10887 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
10888 or C<isl_ast_build_call_from_pw_multi_aff>.
10890 =head3 Nested AST Generation
10892 C<isl> allows the user to create an AST within the context
10893 of another AST.  These nested ASTs are created using the
10894 same C<isl_ast_build_node_from_schedule_map> function that is used to create
10895 the outer AST.  The C<build> argument should be an C<isl_ast_build>
10896 passed to a callback set by
10897 C<isl_ast_build_set_create_leaf>.
10898 The space of the range of the C<schedule> argument should refer
10899 to this build.  In particular, the space should be a wrapped
10900 relation and the domain of this wrapped relation should be the
10901 same as that of the range of the schedule returned by
10902 C<isl_ast_build_get_schedule> below.
10903 In practice, the new schedule is typically
10904 created by calling C<isl_union_map_range_product> on the old schedule
10905 and some extra piece of the schedule.
10906 The space of the schedule domain is also available from
10907 the C<isl_ast_build>.
10909         #include <isl/ast_build.h>
10910         __isl_give isl_union_map *isl_ast_build_get_schedule(
10911                 __isl_keep isl_ast_build *build);
10912         __isl_give isl_space *isl_ast_build_get_schedule_space(
10913                 __isl_keep isl_ast_build *build);
10914         __isl_give isl_ast_build *isl_ast_build_restrict(
10915                 __isl_take isl_ast_build *build,
10916                 __isl_take isl_set *set);
10918 The C<isl_ast_build_get_schedule> function returns a (partial)
10919 schedule for the domains elements for which part of the AST still needs to
10920 be generated in the current build.
10921 In particular, the domain elements are mapped to those iterations of the loops
10922 enclosing the current point of the AST generation inside which
10923 the domain elements are executed.
10924 No direct correspondence between
10925 the input schedule and this schedule should be assumed.
10926 The space obtained from C<isl_ast_build_get_schedule_space> can be used
10927 to create a set for C<isl_ast_build_restrict> to intersect
10928 with the current build.  In particular, the set passed to
10929 C<isl_ast_build_restrict> can have additional parameters.
10930 The ids of the set dimensions in the space returned by
10931 C<isl_ast_build_get_schedule_space> correspond to the
10932 iterators of the already generated loops.
10933 The user should not rely on the ids of the output dimensions
10934 of the relations in the union relation returned by
10935 C<isl_ast_build_get_schedule> having any particular value.
10937 =head1 Applications
10939 Although C<isl> is mainly meant to be used as a library,
10940 it also contains some basic applications that use some
10941 of the functionality of C<isl>.
10942 For applications that take one or more polytopes or polyhedra
10943 as input, this input may be specified in either the L<isl format>
10944 or the L<PolyLib format>.
10946 =head2 C<isl_polyhedron_sample>
10948 C<isl_polyhedron_sample> takes a polyhedron as input and prints
10949 an integer element of the polyhedron, if there is any.
10950 The first column in the output is the denominator and is always
10951 equal to 1.  If the polyhedron contains no integer points,
10952 then a vector of length zero is printed.
10954 =head2 C<isl_pip>
10956 C<isl_pip> takes the same input as the C<example> program
10957 from the C<piplib> distribution, i.e., a set of constraints
10958 on the parameters, a line containing only -1 and finally a set
10959 of constraints on a parametric polyhedron.
10960 The coefficients of the parameters appear in the last columns
10961 (but before the final constant column).
10962 The output is the lexicographic minimum of the parametric polyhedron.
10963 As C<isl> currently does not have its own output format, the output
10964 is just a dump of the internal state.
10966 =head2 C<isl_polyhedron_minimize>
10968 C<isl_polyhedron_minimize> computes the minimum of some linear
10969 or affine objective function over the integer points in a polyhedron.
10970 If an affine objective function
10971 is given, then the constant should appear in the last column.
10973 =head2 C<isl_polytope_scan>
10975 Given a polytope, C<isl_polytope_scan> prints
10976 all integer points in the polytope.
10978 =head2 C<isl_flow>
10980 Given an C<isl_union_access_info> object as input,
10981 C<isl_flow> prints out the corresponding dependences,
10982 as computed by C<isl_union_access_info_compute_flow>.
10984 =head2 C<isl_codegen>
10986 Given either a schedule tree or a sequence consisting of
10987 a schedule map, a context set and an options relation,
10988 C<isl_codegen> prints out an AST that scans the domain elements
10989 of the schedule in the order of their image(s) taking into account
10990 the constraints in the context set.
10992 =head2 C<isl_schedule>
10994 Given an C<isl_schedule_constraints> object as input,
10995 C<isl_schedule> prints out a schedule that satisfies the given
10996 constraints.