add isl_multi_{pw,}aff_project_domain_on_params
[isl.git] / doc / user.pod
blobb217ae5afdf877908c6b9923cdc74c0fa5223ac6
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 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/set.h>
4613         __isl_give isl_basic_set *isl_basic_set_from_params(
4614                 __isl_take isl_basic_set *bset);
4615         __isl_give isl_set *isl_set_from_params(
4616                 __isl_take isl_set *set);
4618 =item * Constructing a relation from one or two sets
4620 Create a relation with the given set(s) as domain and/or range.
4621 If only the domain or the range is specified, then
4622 the range or domain of the created relation is a zero-dimensional
4623 flat anonymous space.
4625         #include <isl/space.h>
4626         __isl_give isl_space *isl_space_from_domain(
4627                 __isl_take isl_space *space);
4628         __isl_give isl_space *isl_space_from_range(
4629                 __isl_take isl_space *space);
4630         __isl_give isl_space *isl_space_map_from_set(
4631                 __isl_take isl_space *space);
4632         __isl_give isl_space *isl_space_map_from_domain_and_range(
4633                 __isl_take isl_space *domain,
4634                 __isl_take isl_space *range);
4636         #include <isl/local_space.h>
4637         __isl_give isl_local_space *isl_local_space_from_domain(
4638                 __isl_take isl_local_space *ls);
4640         #include <isl/map.h>
4641         __isl_give isl_map *isl_map_from_domain(
4642                 __isl_take isl_set *set);
4643         __isl_give isl_map *isl_map_from_range(
4644                 __isl_take isl_set *set);
4646         #include <isl/union_map.h>
4647         __isl_give isl_union_map *isl_union_map_from_domain(
4648                 __isl_take isl_union_set *uset);
4649         __isl_give isl_union_map *isl_union_map_from_range(
4650                 __isl_take isl_union_set *uset);
4651         __isl_give isl_union_map *
4652         isl_union_map_from_domain_and_range(
4653                 __isl_take isl_union_set *domain,
4654                 __isl_take isl_union_set *range);
4656         #include <isl/val.h>
4657         __isl_give isl_multi_val *isl_multi_val_from_range(
4658                 __isl_take isl_multi_val *mv);
4660         #include <isl/aff.h>
4661         __isl_give isl_multi_aff *isl_multi_aff_from_range(
4662                 __isl_take isl_multi_aff *ma);
4663         __isl_give isl_pw_aff *isl_pw_aff_from_range(
4664                 __isl_take isl_pw_aff *pwa);
4665         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
4666                 __isl_take isl_multi_pw_aff *mpa);
4667         __isl_give isl_multi_union_pw_aff *
4668         isl_multi_union_pw_aff_from_range(
4669                 __isl_take isl_multi_union_pw_aff *mupa);
4670         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
4671                 __isl_take isl_set *set);
4672         __isl_give isl_union_pw_multi_aff *
4673         isl_union_pw_multi_aff_from_domain(
4674                 __isl_take isl_union_set *uset);
4676         #include <isl/polynomial.h>
4677         __isl_give isl_pw_qpolynomial *
4678         isl_pw_qpolynomial_from_range(
4679                 __isl_take isl_pw_qpolynomial *pwqp);
4680         __isl_give isl_pw_qpolynomial_fold *
4681         isl_pw_qpolynomial_fold_from_range(
4682                 __isl_take isl_pw_qpolynomial_fold *pwf);
4684 =item * Slicing
4686         #include <isl/set.h>
4687         __isl_give isl_basic_set *isl_basic_set_fix_si(
4688                 __isl_take isl_basic_set *bset,
4689                 enum isl_dim_type type, unsigned pos, int value);
4690         __isl_give isl_basic_set *isl_basic_set_fix_val(
4691                 __isl_take isl_basic_set *bset,
4692                 enum isl_dim_type type, unsigned pos,
4693                 __isl_take isl_val *v);
4694         __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
4695                 enum isl_dim_type type, unsigned pos, int value);
4696         __isl_give isl_set *isl_set_fix_val(
4697                 __isl_take isl_set *set,
4698                 enum isl_dim_type type, unsigned pos,
4699                 __isl_take isl_val *v);
4701         #include <isl/map.h>
4702         __isl_give isl_basic_map *isl_basic_map_fix_si(
4703                 __isl_take isl_basic_map *bmap,
4704                 enum isl_dim_type type, unsigned pos, int value);
4705         __isl_give isl_basic_map *isl_basic_map_fix_val(
4706                 __isl_take isl_basic_map *bmap,
4707                 enum isl_dim_type type, unsigned pos,
4708                 __isl_take isl_val *v);
4709         __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
4710                 enum isl_dim_type type, unsigned pos, int value);
4711         __isl_give isl_map *isl_map_fix_val(
4712                 __isl_take isl_map *map,
4713                 enum isl_dim_type type, unsigned pos,
4714                 __isl_take isl_val *v);
4716         #include <isl/aff.h>
4717         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
4718                 __isl_take isl_pw_multi_aff *pma,
4719                 enum isl_dim_type type, unsigned pos, int value);
4721         #include <isl/polynomial.h>
4722         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
4723                 __isl_take isl_pw_qpolynomial *pwqp,
4724                 enum isl_dim_type type, unsigned n,
4725                 __isl_take isl_val *v);
4726         __isl_give isl_pw_qpolynomial_fold *
4727         isl_pw_qpolynomial_fold_fix_val(
4728                 __isl_take isl_pw_qpolynomial_fold *pwf,
4729                 enum isl_dim_type type, unsigned n,
4730                 __isl_take isl_val *v);
4732 Intersect the set, relation or function domain
4733 with the hyperplane where the given
4734 dimension has the fixed given value.
4736         #include <isl/set.h>
4737         __isl_give isl_basic_set *
4738         isl_basic_set_lower_bound_val(
4739                 __isl_take isl_basic_set *bset,
4740                 enum isl_dim_type type, unsigned pos,
4741                 __isl_take isl_val *value);
4742         __isl_give isl_basic_set *
4743         isl_basic_set_upper_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_set *isl_set_lower_bound_si(
4748                 __isl_take isl_set *set,
4749                 enum isl_dim_type type, unsigned pos, int value);
4750         __isl_give isl_set *isl_set_lower_bound_val(
4751                 __isl_take isl_set *set,
4752                 enum isl_dim_type type, unsigned pos,
4753                 __isl_take isl_val *value);
4754         __isl_give isl_set *isl_set_upper_bound_si(
4755                 __isl_take isl_set *set,
4756                 enum isl_dim_type type, unsigned pos, int value);
4757         __isl_give isl_set *isl_set_upper_bound_val(
4758                 __isl_take isl_set *set,
4759                 enum isl_dim_type type, unsigned pos,
4760                 __isl_take isl_val *value);
4762         #include <isl/map.h>
4763         __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
4764                 __isl_take isl_basic_map *bmap,
4765                 enum isl_dim_type type, unsigned pos, int value);
4766         __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
4767                 __isl_take isl_basic_map *bmap,
4768                 enum isl_dim_type type, unsigned pos, int value);
4769         __isl_give isl_map *isl_map_lower_bound_si(
4770                 __isl_take isl_map *map,
4771                 enum isl_dim_type type, unsigned pos, int value);
4772         __isl_give isl_map *isl_map_upper_bound_si(
4773                 __isl_take isl_map *map,
4774                 enum isl_dim_type type, unsigned pos, int value);
4776 Intersect the set or relation with the half-space where the given
4777 dimension has a value bounded by the fixed given integer value.
4779         __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
4780                 enum isl_dim_type type1, int pos1,
4781                 enum isl_dim_type type2, int pos2);
4782         __isl_give isl_basic_map *isl_basic_map_equate(
4783                 __isl_take isl_basic_map *bmap,
4784                 enum isl_dim_type type1, int pos1,
4785                 enum isl_dim_type type2, int pos2);
4786         __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
4787                 enum isl_dim_type type1, int pos1,
4788                 enum isl_dim_type type2, int pos2);
4790 Intersect the set or relation with the hyperplane where the given
4791 dimensions are equal to each other.
4793         __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4794                 enum isl_dim_type type1, int pos1,
4795                 enum isl_dim_type type2, int pos2);
4797 Intersect the relation with the hyperplane where the given
4798 dimensions have opposite values.
4800         __isl_give isl_map *isl_map_order_le(
4801                 __isl_take isl_map *map,
4802                 enum isl_dim_type type1, int pos1,
4803                 enum isl_dim_type type2, int pos2);
4804         __isl_give isl_basic_map *isl_basic_map_order_ge(
4805                 __isl_take isl_basic_map *bmap,
4806                 enum isl_dim_type type1, int pos1,
4807                 enum isl_dim_type type2, int pos2);
4808         __isl_give isl_map *isl_map_order_ge(
4809                 __isl_take isl_map *map,
4810                 enum isl_dim_type type1, int pos1,
4811                 enum isl_dim_type type2, int pos2);
4812         __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4813                 enum isl_dim_type type1, int pos1,
4814                 enum isl_dim_type type2, int pos2);
4815         __isl_give isl_basic_map *isl_basic_map_order_gt(
4816                 __isl_take isl_basic_map *bmap,
4817                 enum isl_dim_type type1, int pos1,
4818                 enum isl_dim_type type2, int pos2);
4819         __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4820                 enum isl_dim_type type1, int pos1,
4821                 enum isl_dim_type type2, int pos2);
4823 Intersect the relation with the half-space where the given
4824 dimensions satisfy the given ordering.
4826         #include <isl/union_set.h>
4827         __isl_give isl_union_map *isl_union_map_remove_map_if(
4828                 __isl_take isl_union_map *umap,
4829                 isl_bool (*fn)(__isl_keep isl_map *map,
4830                         void *user), void *user);
4832 This function calls the callback function once for each
4833 pair of spaces for which there are elements in the input.
4834 If the callback returns C<isl_bool_true>, then all those elements
4835 are removed from the result.  The only remaining elements in the output
4836 are then those for which the callback returns C<isl_bool_false>.
4838 =item * Locus
4840         #include <isl/aff.h>
4841         __isl_give isl_basic_set *isl_aff_zero_basic_set(
4842                 __isl_take isl_aff *aff);
4843         __isl_give isl_basic_set *isl_aff_neg_basic_set(
4844                 __isl_take isl_aff *aff);
4845         __isl_give isl_set *isl_pw_aff_pos_set(
4846                 __isl_take isl_pw_aff *pa);
4847         __isl_give isl_set *isl_pw_aff_nonneg_set(
4848                 __isl_take isl_pw_aff *pwaff);
4849         __isl_give isl_set *isl_pw_aff_zero_set(
4850                 __isl_take isl_pw_aff *pwaff);
4851         __isl_give isl_set *isl_pw_aff_non_zero_set(
4852                 __isl_take isl_pw_aff *pwaff);
4853         __isl_give isl_union_set *
4854         isl_union_pw_aff_zero_union_set(
4855                 __isl_take isl_union_pw_aff *upa);
4856         __isl_give isl_union_set *
4857         isl_multi_union_pw_aff_zero_union_set(
4858                 __isl_take isl_multi_union_pw_aff *mupa);
4860 The function C<isl_aff_neg_basic_set> returns a basic set
4861 containing those elements in the domain space
4862 of C<aff> where C<aff> is negative.
4863 The function C<isl_pw_aff_nonneg_set> returns a set
4864 containing those elements in the domain
4865 of C<pwaff> where C<pwaff> is non-negative.
4866 The function C<isl_multi_union_pw_aff_zero_union_set>
4867 returns a union set containing those elements
4868 in the domains of its elements where they are all zero.
4870 =item * Identity
4872         __isl_give isl_map *isl_set_identity(
4873                 __isl_take isl_set *set);
4874         __isl_give isl_union_map *isl_union_set_identity(
4875                 __isl_take isl_union_set *uset);
4876         __isl_give isl_union_pw_multi_aff *
4877         isl_union_set_identity_union_pw_multi_aff(
4878                 __isl_take isl_union_set *uset);
4880 Construct an identity relation on the given (union) set.
4882 =item * Function Extraction
4884 A piecewise quasi affine expression that is equal to 1 on a set
4885 and 0 outside the set can be created using the following function.
4887         #include <isl/aff.h>
4888         __isl_give isl_pw_aff *isl_set_indicator_function(
4889                 __isl_take isl_set *set);
4891 A piecewise multiple quasi affine expression can be extracted
4892 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4893 and the C<isl_map> is single-valued.
4894 In case of a conversion from an C<isl_union_map>
4895 to an C<isl_union_pw_multi_aff>, these properties need to hold
4896 in each domain space.
4897 A conversion to a C<isl_multi_union_pw_aff> additionally
4898 requires that the input is non-empty and involves only a single
4899 range space.
4901         #include <isl/aff.h>
4902         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4903                 __isl_take isl_set *set);
4904         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4905                 __isl_take isl_map *map);
4907         __isl_give isl_union_pw_multi_aff *
4908         isl_union_pw_multi_aff_from_union_set(
4909                 __isl_take isl_union_set *uset);
4910         __isl_give isl_union_pw_multi_aff *
4911         isl_union_pw_multi_aff_from_union_map(
4912                 __isl_take isl_union_map *umap);
4914         __isl_give isl_multi_union_pw_aff *
4915         isl_multi_union_pw_aff_from_union_map(
4916                 __isl_take isl_union_map *umap);
4918 =item * Deltas
4920         __isl_give isl_basic_set *isl_basic_map_deltas(
4921                 __isl_take isl_basic_map *bmap);
4922         __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
4923         __isl_give isl_union_set *isl_union_map_deltas(
4924                 __isl_take isl_union_map *umap);
4926 These functions return a (basic) set containing the differences
4927 between image elements and corresponding domain elements in the input.
4929         __isl_give isl_basic_map *isl_basic_map_deltas_map(
4930                 __isl_take isl_basic_map *bmap);
4931         __isl_give isl_map *isl_map_deltas_map(
4932                 __isl_take isl_map *map);
4933         __isl_give isl_union_map *isl_union_map_deltas_map(
4934                 __isl_take isl_union_map *umap);
4936 The functions above construct a (basic, regular or union) relation
4937 that maps (a wrapped version of) the input relation to its delta set.
4939 =item * Coalescing
4941 Simplify the representation of a set, relation or functions by trying
4942 to combine pairs of basic sets or relations into a single
4943 basic set or relation.
4945         #include <isl/set.h>
4946         __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
4948         #include <isl/map.h>
4949         __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
4951         #include <isl/union_set.h>
4952         __isl_give isl_union_set *isl_union_set_coalesce(
4953                 __isl_take isl_union_set *uset);
4955         #include <isl/union_map.h>
4956         __isl_give isl_union_map *isl_union_map_coalesce(
4957                 __isl_take isl_union_map *umap);
4959         #include <isl/aff.h>
4960         __isl_give isl_pw_aff *isl_pw_aff_coalesce(
4961                 __isl_take isl_pw_aff *pwqp);
4962         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
4963                 __isl_take isl_pw_multi_aff *pma);
4964         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
4965                 __isl_take isl_multi_pw_aff *mpa);
4966         __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
4967                 __isl_take isl_union_pw_aff *upa);
4968         __isl_give isl_union_pw_multi_aff *
4969         isl_union_pw_multi_aff_coalesce(
4970                 __isl_take isl_union_pw_multi_aff *upma);
4971         __isl_give isl_multi_union_pw_aff *
4972         isl_multi_union_pw_aff_coalesce(
4973                 __isl_take isl_multi_union_pw_aff *aff);
4975         #include <isl/polynomial.h>
4976         __isl_give isl_pw_qpolynomial_fold *
4977         isl_pw_qpolynomial_fold_coalesce(
4978                 __isl_take isl_pw_qpolynomial_fold *pwf);
4979         __isl_give isl_union_pw_qpolynomial *
4980         isl_union_pw_qpolynomial_coalesce(
4981                 __isl_take isl_union_pw_qpolynomial *upwqp);
4982         __isl_give isl_union_pw_qpolynomial_fold *
4983         isl_union_pw_qpolynomial_fold_coalesce(
4984                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4986 One of the methods for combining pairs of basic sets or relations
4987 can result in coefficients that are much larger than those that appear
4988 in the constraints of the input.  By default, the coefficients are
4989 not allowed to grow larger, but this can be changed by unsetting
4990 the following option.
4992         isl_stat isl_options_set_coalesce_bounded_wrapping(
4993                 isl_ctx *ctx, int val);
4994         int isl_options_get_coalesce_bounded_wrapping(
4995                 isl_ctx *ctx);
4997 =item * Detecting equalities
4999         __isl_give isl_basic_set *isl_basic_set_detect_equalities(
5000                 __isl_take isl_basic_set *bset);
5001         __isl_give isl_basic_map *isl_basic_map_detect_equalities(
5002                 __isl_take isl_basic_map *bmap);
5003         __isl_give isl_set *isl_set_detect_equalities(
5004                 __isl_take isl_set *set);
5005         __isl_give isl_map *isl_map_detect_equalities(
5006                 __isl_take isl_map *map);
5007         __isl_give isl_union_set *isl_union_set_detect_equalities(
5008                 __isl_take isl_union_set *uset);
5009         __isl_give isl_union_map *isl_union_map_detect_equalities(
5010                 __isl_take isl_union_map *umap);
5012 Simplify the representation of a set or relation by detecting implicit
5013 equalities.
5015 =item * Removing redundant constraints
5017         #include <isl/set.h>
5018         __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
5019                 __isl_take isl_basic_set *bset);
5020         __isl_give isl_set *isl_set_remove_redundancies(
5021                 __isl_take isl_set *set);
5023         #include <isl/union_set.h>
5024         __isl_give isl_union_set *
5025         isl_union_set_remove_redundancies(
5026                 __isl_take isl_union_set *uset);
5028         #include <isl/map.h>
5029         __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
5030                 __isl_take isl_basic_map *bmap);
5031         __isl_give isl_map *isl_map_remove_redundancies(
5032                 __isl_take isl_map *map);
5034         #include <isl/union_map.h>
5035         __isl_give isl_union_map *
5036         isl_union_map_remove_redundancies(
5037                 __isl_take isl_union_map *umap);
5039 =item * Convex hull
5041         __isl_give isl_basic_set *isl_set_convex_hull(
5042                 __isl_take isl_set *set);
5043         __isl_give isl_basic_map *isl_map_convex_hull(
5044                 __isl_take isl_map *map);
5046 If the input set or relation has any existentially quantified
5047 variables, then the result of these operations is currently undefined.
5049 =item * Simple hull
5051         #include <isl/set.h>
5052         __isl_give isl_basic_set *
5053         isl_set_unshifted_simple_hull(
5054                 __isl_take isl_set *set);
5055         __isl_give isl_basic_set *isl_set_simple_hull(
5056                 __isl_take isl_set *set);
5057         __isl_give isl_basic_set *
5058         isl_set_plain_unshifted_simple_hull(
5059                 __isl_take isl_set *set);
5060         __isl_give isl_basic_set *
5061         isl_set_unshifted_simple_hull_from_set_list(
5062                 __isl_take isl_set *set,
5063                 __isl_take isl_set_list *list);
5065         #include <isl/map.h>
5066         __isl_give isl_basic_map *
5067         isl_map_unshifted_simple_hull(
5068                 __isl_take isl_map *map);
5069         __isl_give isl_basic_map *isl_map_simple_hull(
5070                 __isl_take isl_map *map);
5071         __isl_give isl_basic_map *
5072         isl_map_plain_unshifted_simple_hull(
5073                 __isl_take isl_map *map);
5074                 __isl_give isl_basic_map *
5075         isl_map_unshifted_simple_hull_from_map_list(
5076                 __isl_take isl_map *map,
5077                 __isl_take isl_map_list *list);
5079         #include <isl/union_map.h>
5080         __isl_give isl_union_map *isl_union_map_simple_hull(
5081                 __isl_take isl_union_map *umap);
5083 These functions compute a single basic set or relation
5084 that contains the whole input set or relation.
5085 In particular, the output is described by translates
5086 of the constraints describing the basic sets or relations in the input.
5087 In case of C<isl_set_unshifted_simple_hull>, only the original
5088 constraints are used, without any translation.
5089 In case of C<isl_set_plain_unshifted_simple_hull> and
5090 C<isl_map_plain_unshifted_simple_hull>, the result is described
5091 by original constraints that are obviously satisfied
5092 by the entire input set or relation.
5093 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
5094 C<isl_map_unshifted_simple_hull_from_map_list>, the
5095 constraints are taken from the elements of the second argument.
5097 =begin latex
5099 (See \autoref{s:simple hull}.)
5101 =end latex
5103 =item * Affine hull
5105         __isl_give isl_basic_set *isl_basic_set_affine_hull(
5106                 __isl_take isl_basic_set *bset);
5107         __isl_give isl_basic_set *isl_set_affine_hull(
5108                 __isl_take isl_set *set);
5109         __isl_give isl_union_set *isl_union_set_affine_hull(
5110                 __isl_take isl_union_set *uset);
5111         __isl_give isl_basic_map *isl_basic_map_affine_hull(
5112                 __isl_take isl_basic_map *bmap);
5113         __isl_give isl_basic_map *isl_map_affine_hull(
5114                 __isl_take isl_map *map);
5115         __isl_give isl_union_map *isl_union_map_affine_hull(
5116                 __isl_take isl_union_map *umap);
5118 In case of union sets and relations, the affine hull is computed
5119 per space.
5121 =item * Polyhedral hull
5123         __isl_give isl_basic_set *isl_set_polyhedral_hull(
5124                 __isl_take isl_set *set);
5125         __isl_give isl_basic_map *isl_map_polyhedral_hull(
5126                 __isl_take isl_map *map);
5127         __isl_give isl_union_set *isl_union_set_polyhedral_hull(
5128                 __isl_take isl_union_set *uset);
5129         __isl_give isl_union_map *isl_union_map_polyhedral_hull(
5130                 __isl_take isl_union_map *umap);
5132 These functions compute a single basic set or relation
5133 not involving any existentially quantified variables
5134 that contains the whole input set or relation.
5135 In case of union sets and relations, the polyhedral hull is computed
5136 per space.
5138 =item * Other approximations
5140         #include <isl/set.h>
5141         __isl_give isl_basic_set *
5142         isl_basic_set_drop_constraints_involving_dims(
5143                 __isl_take isl_basic_set *bset,
5144                 enum isl_dim_type type,
5145                 unsigned first, unsigned n);
5146         __isl_give isl_basic_set *
5147         isl_basic_set_drop_constraints_not_involving_dims(
5148                 __isl_take isl_basic_set *bset,
5149                 enum isl_dim_type type,
5150                 unsigned first, unsigned n);
5151         __isl_give isl_set *
5152         isl_set_drop_constraints_involving_dims(
5153                 __isl_take isl_set *set,
5154                 enum isl_dim_type type,
5155                 unsigned first, unsigned n);
5156         __isl_give isl_set *
5157         isl_set_drop_constraints_not_involving_dims(
5158                 __isl_take isl_set *set,
5159                 enum isl_dim_type type,
5160                 unsigned first, unsigned n);
5162         #include <isl/map.h>
5163         __isl_give isl_basic_map *
5164         isl_basic_map_drop_constraints_involving_dims(
5165                 __isl_take isl_basic_map *bmap,
5166                 enum isl_dim_type type,
5167                 unsigned first, unsigned n);
5168         __isl_give isl_basic_map *
5169         isl_basic_map_drop_constraints_not_involving_dims(
5170                 __isl_take isl_basic_map *bmap,
5171                 enum isl_dim_type type,
5172                 unsigned first, unsigned n);
5173         __isl_give isl_map *
5174         isl_map_drop_constraints_involving_dims(
5175                 __isl_take isl_map *map,
5176                 enum isl_dim_type type,
5177                 unsigned first, unsigned n);
5178         __isl_give isl_map *
5179         isl_map_drop_constraints_not_involving_dims(
5180                 __isl_take isl_map *map,
5181                 enum isl_dim_type type,
5182                 unsigned first, unsigned n);
5184 These functions drop any constraints (not) involving the specified dimensions.
5185 Note that the result depends on the representation of the input.
5187         #include <isl/polynomial.h>
5188         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
5189                 __isl_take isl_pw_qpolynomial *pwqp, int sign);
5190         __isl_give isl_union_pw_qpolynomial *
5191         isl_union_pw_qpolynomial_to_polynomial(
5192                 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
5194 Approximate each quasipolynomial by a polynomial.  If C<sign> is positive,
5195 the polynomial will be an overapproximation.  If C<sign> is negative,
5196 it will be an underapproximation.  If C<sign> is zero, the approximation
5197 will lie somewhere in between.
5199 =item * Feasibility
5201         __isl_give isl_basic_set *isl_basic_set_sample(
5202                 __isl_take isl_basic_set *bset);
5203         __isl_give isl_basic_set *isl_set_sample(
5204                 __isl_take isl_set *set);
5205         __isl_give isl_basic_map *isl_basic_map_sample(
5206                 __isl_take isl_basic_map *bmap);
5207         __isl_give isl_basic_map *isl_map_sample(
5208                 __isl_take isl_map *map);
5210 If the input (basic) set or relation is non-empty, then return
5211 a singleton subset of the input.  Otherwise, return an empty set.
5213 =item * Optimization
5215         #include <isl/ilp.h>
5216         __isl_give isl_val *isl_basic_set_max_val(
5217                 __isl_keep isl_basic_set *bset,
5218                 __isl_keep isl_aff *obj);
5219         __isl_give isl_val *isl_set_min_val(
5220                 __isl_keep isl_set *set,
5221                 __isl_keep isl_aff *obj);
5222         __isl_give isl_val *isl_set_max_val(
5223                 __isl_keep isl_set *set,
5224                 __isl_keep isl_aff *obj);
5225         __isl_give isl_multi_val *
5226         isl_union_set_min_multi_union_pw_aff(
5227                 __isl_keep isl_union_set *set,
5228                 __isl_keep isl_multi_union_pw_aff *obj);
5230 Compute the minimum or maximum of the integer affine expression C<obj>
5231 over the points in C<set>, returning the result in C<opt>.
5232 The result is C<NULL> in case of an error, the optimal value in case
5233 there is one, negative infinity or infinity if the problem is unbounded and
5234 NaN if the problem is empty.
5236         #include <isl/ilp.h>
5237         __isl_give isl_val *isl_basic_set_dim_max_val(
5238                 __isl_take isl_basic_set *bset, int pos);
5240 Return the maximal value attained by the given set dimension,
5241 independently of the parameter values and of any other dimensions.
5242 The result is C<NULL> in case of an error, the optimal value in case
5243 there is one, infinity if the problem is unbounded and
5244 NaN if the input is empty.
5246 =item * Parametric optimization
5248         __isl_give isl_pw_aff *isl_set_dim_min(
5249                 __isl_take isl_set *set, int pos);
5250         __isl_give isl_pw_aff *isl_set_dim_max(
5251                 __isl_take isl_set *set, int pos);
5252         __isl_give isl_pw_aff *isl_map_dim_min(
5253                 __isl_take isl_map *map, int pos);
5254         __isl_give isl_pw_aff *isl_map_dim_max(
5255                 __isl_take isl_map *map, int pos);
5257 Compute the minimum or maximum of the given set or output dimension
5258 as a function of the parameters (and input dimensions), but independently
5259 of the other set or output dimensions.
5260 For lexicographic optimization, see L<"Lexicographic Optimization">.
5262 =item * Dual
5264 The following functions compute either the set of (rational) coefficient
5265 values of valid constraints for the given set or the set of (rational)
5266 values satisfying the constraints with coefficients from the given set.
5267 Internally, these two sets of functions perform essentially the
5268 same operations, except that the set of coefficients is assumed to
5269 be a cone, while the set of values may be any polyhedron.
5270 The current implementation is based on the Farkas lemma and
5271 Fourier-Motzkin elimination, but this may change or be made optional
5272 in future.  In particular, future implementations may use different
5273 dualization algorithms or skip the elimination step.
5275         #include <isl/set.h>
5276         __isl_give isl_basic_set *isl_basic_set_coefficients(
5277                 __isl_take isl_basic_set *bset);
5278         __isl_give isl_basic_set_list *
5279         isl_basic_set_list_coefficients(
5280                 __isl_take isl_basic_set_list *list);
5281         __isl_give isl_basic_set *isl_set_coefficients(
5282                 __isl_take isl_set *set);
5283         __isl_give isl_union_set *isl_union_set_coefficients(
5284                 __isl_take isl_union_set *bset);
5285         __isl_give isl_basic_set *isl_basic_set_solutions(
5286                 __isl_take isl_basic_set *bset);
5287         __isl_give isl_basic_set *isl_set_solutions(
5288                 __isl_take isl_set *set);
5289         __isl_give isl_union_set *isl_union_set_solutions(
5290                 __isl_take isl_union_set *bset);
5292 =item * Power
5294         __isl_give isl_map *isl_map_fixed_power_val(
5295                 __isl_take isl_map *map,
5296                 __isl_take isl_val *exp);
5297         __isl_give isl_union_map *
5298         isl_union_map_fixed_power_val(
5299                 __isl_take isl_union_map *umap,
5300                 __isl_take isl_val *exp);
5302 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
5303 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
5304 of C<map> is computed.
5306         __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
5307                 int *exact);
5308         __isl_give isl_union_map *isl_union_map_power(
5309                 __isl_take isl_union_map *umap, int *exact);
5311 Compute a parametric representation for all positive powers I<k> of C<map>.
5312 The result maps I<k> to a nested relation corresponding to the
5313 I<k>th power of C<map>.
5314 The result may be an overapproximation.  If the result is known to be exact,
5315 then C<*exact> is set to C<1>.
5317 =item * Transitive closure
5319         __isl_give isl_map *isl_map_transitive_closure(
5320                 __isl_take isl_map *map, int *exact);
5321         __isl_give isl_union_map *isl_union_map_transitive_closure(
5322                 __isl_take isl_union_map *umap, int *exact);
5324 Compute the transitive closure of C<map>.
5325 The result may be an overapproximation.  If the result is known to be exact,
5326 then C<*exact> is set to C<1>.
5328 =item * Reaching path lengths
5330         __isl_give isl_map *isl_map_reaching_path_lengths(
5331                 __isl_take isl_map *map, int *exact);
5333 Compute a relation that maps each element in the range of C<map>
5334 to the lengths of all paths composed of edges in C<map> that
5335 end up in the given element.
5336 The result may be an overapproximation.  If the result is known to be exact,
5337 then C<*exact> is set to C<1>.
5338 To compute the I<maximal> path length, the resulting relation
5339 should be postprocessed by C<isl_map_lexmax>.
5340 In particular, if the input relation is a dependence relation
5341 (mapping sources to sinks), then the maximal path length corresponds
5342 to the free schedule.
5343 Note, however, that C<isl_map_lexmax> expects the maximum to be
5344 finite, so if the path lengths are unbounded (possibly due to
5345 the overapproximation), then you will get an error message.
5347 =item * Wrapping
5349         #include <isl/space.h>
5350         __isl_give isl_space *isl_space_wrap(
5351                 __isl_take isl_space *space);
5352         __isl_give isl_space *isl_space_unwrap(
5353                 __isl_take isl_space *space);
5355         #include <isl/local_space.h>
5356         __isl_give isl_local_space *isl_local_space_wrap(
5357                 __isl_take isl_local_space *ls);
5359         #include <isl/set.h>
5360         __isl_give isl_basic_map *isl_basic_set_unwrap(
5361                 __isl_take isl_basic_set *bset);
5362         __isl_give isl_map *isl_set_unwrap(
5363                 __isl_take isl_set *set);
5365         #include <isl/map.h>
5366         __isl_give isl_basic_set *isl_basic_map_wrap(
5367                 __isl_take isl_basic_map *bmap);
5368         __isl_give isl_set *isl_map_wrap(
5369                 __isl_take isl_map *map);
5371         #include <isl/union_set.h>
5372         __isl_give isl_union_map *isl_union_set_unwrap(
5373                 __isl_take isl_union_set *uset);
5375         #include <isl/union_map.h>
5376         __isl_give isl_union_set *isl_union_map_wrap(
5377                 __isl_take isl_union_map *umap);
5379 The input to C<isl_space_unwrap> should
5380 be the space of a set, while that of
5381 C<isl_space_wrap> should be the space of a relation.
5382 Conversely, the output of C<isl_space_unwrap> is the space
5383 of a relation, while that of C<isl_space_wrap> is the space of a set.
5385 =item * Flattening
5387 Remove any internal structure of domain (and range) of the given
5388 set or relation.  If there is any such internal structure in the input,
5389 then the name of the space is also removed.
5391         #include <isl/space.h>
5392         __isl_give isl_space *isl_space_flatten_domain(
5393                 __isl_take isl_space *space);
5394         __isl_give isl_space *isl_space_flatten_range(
5395                 __isl_take isl_space *space);
5397         #include <isl/local_space.h>
5398         __isl_give isl_local_space *
5399         isl_local_space_flatten_domain(
5400                 __isl_take isl_local_space *ls);
5401         __isl_give isl_local_space *
5402         isl_local_space_flatten_range(
5403                 __isl_take isl_local_space *ls);
5405         #include <isl/set.h>
5406         __isl_give isl_basic_set *isl_basic_set_flatten(
5407                 __isl_take isl_basic_set *bset);
5408         __isl_give isl_set *isl_set_flatten(
5409                 __isl_take isl_set *set);
5411         #include <isl/map.h>
5412         __isl_give isl_basic_map *isl_basic_map_flatten_domain(
5413                 __isl_take isl_basic_map *bmap);
5414         __isl_give isl_basic_map *isl_basic_map_flatten_range(
5415                 __isl_take isl_basic_map *bmap);
5416         __isl_give isl_map *isl_map_flatten_range(
5417                 __isl_take isl_map *map);
5418         __isl_give isl_map *isl_map_flatten_domain(
5419                 __isl_take isl_map *map);
5420         __isl_give isl_basic_map *isl_basic_map_flatten(
5421                 __isl_take isl_basic_map *bmap);
5422         __isl_give isl_map *isl_map_flatten(
5423                 __isl_take isl_map *map);
5425         #include <isl/val.h>
5426         __isl_give isl_multi_val *isl_multi_val_flatten_range(
5427                 __isl_take isl_multi_val *mv);
5429         #include <isl/aff.h>
5430         __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
5431                 __isl_take isl_multi_aff *ma);
5432         __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
5433                 __isl_take isl_multi_aff *ma);
5434         __isl_give isl_multi_pw_aff *
5435         isl_multi_pw_aff_flatten_range(
5436                 __isl_take isl_multi_pw_aff *mpa);
5437         __isl_give isl_multi_union_pw_aff *
5438         isl_multi_union_pw_aff_flatten_range(
5439                 __isl_take isl_multi_union_pw_aff *mupa);
5441         #include <isl/map.h>
5442         __isl_give isl_map *isl_set_flatten_map(
5443                 __isl_take isl_set *set);
5445 The function above constructs a relation
5446 that maps the input set to a flattened version of the set.
5448 =item * Lifting
5450 Lift the input set to a space with extra dimensions corresponding
5451 to the existentially quantified variables in the input.
5452 In particular, the result lives in a wrapped map where the domain
5453 is the original space and the range corresponds to the original
5454 existentially quantified variables.
5456         #include <isl/set.h>
5457         __isl_give isl_basic_set *isl_basic_set_lift(
5458                 __isl_take isl_basic_set *bset);
5459         __isl_give isl_set *isl_set_lift(
5460                 __isl_take isl_set *set);
5461         __isl_give isl_union_set *isl_union_set_lift(
5462                 __isl_take isl_union_set *uset);
5464 Given a local space that contains the existentially quantified
5465 variables of a set, a basic relation that, when applied to
5466 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
5467 can be constructed using the following function.
5469         #include <isl/local_space.h>
5470         __isl_give isl_basic_map *isl_local_space_lifting(
5471                 __isl_take isl_local_space *ls);
5473         #include <isl/aff.h>
5474         __isl_give isl_multi_aff *isl_multi_aff_lift(
5475                 __isl_take isl_multi_aff *maff,
5476                 __isl_give isl_local_space **ls);
5478 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
5479 then it is assigned the local space that lies at the basis of
5480 the lifting applied.
5482 =item * Internal Product
5484         #include <isl/space.h>
5485         __isl_give isl_space *isl_space_zip(
5486                 __isl_take isl_space *space);
5488         #include <isl/map.h>
5489         __isl_give isl_basic_map *isl_basic_map_zip(
5490                 __isl_take isl_basic_map *bmap);
5491         __isl_give isl_map *isl_map_zip(
5492                 __isl_take isl_map *map);
5494         #include <isl/union_map.h>
5495         __isl_give isl_union_map *isl_union_map_zip(
5496                 __isl_take isl_union_map *umap);
5498 Given a relation with nested relations for domain and range,
5499 interchange the range of the domain with the domain of the range.
5501 =item * Currying
5503         #include <isl/space.h>
5504         __isl_give isl_space *isl_space_curry(
5505                 __isl_take isl_space *space);
5506         __isl_give isl_space *isl_space_uncurry(
5507                 __isl_take isl_space *space);
5509         #include <isl/map.h>
5510         __isl_give isl_basic_map *isl_basic_map_curry(
5511                 __isl_take isl_basic_map *bmap);
5512         __isl_give isl_basic_map *isl_basic_map_uncurry(
5513                 __isl_take isl_basic_map *bmap);
5514         __isl_give isl_map *isl_map_curry(
5515                 __isl_take isl_map *map);
5516         __isl_give isl_map *isl_map_uncurry(
5517                 __isl_take isl_map *map);
5519         #include <isl/union_map.h>
5520         __isl_give isl_union_map *isl_union_map_curry(
5521                 __isl_take isl_union_map *umap);
5522         __isl_give isl_union_map *isl_union_map_uncurry(
5523                 __isl_take isl_union_map *umap);
5525 Given a relation with a nested relation for domain,
5526 the C<curry> functions
5527 move the range of the nested relation out of the domain
5528 and use it as the domain of a nested relation in the range,
5529 with the original range as range of this nested relation.
5530 The C<uncurry> functions perform the inverse operation.
5532         #include <isl/space.h>
5533         __isl_give isl_space *isl_space_range_curry(
5534                 __isl_take isl_space *space);
5536         #include <isl/map.h>
5537         __isl_give isl_map *isl_map_range_curry(
5538                 __isl_take isl_map *map);
5540         #include <isl/union_map.h>
5541         __isl_give isl_union_map *isl_union_map_range_curry(
5542                 __isl_take isl_union_map *umap);
5544 These functions apply the currying to the relation that
5545 is nested inside the range of the input.
5547 =item * Aligning parameters
5549 Change the order of the parameters of the given set, relation
5550 or function
5551 such that the first parameters match those of C<model>.
5552 This may involve the introduction of extra parameters.
5553 All parameters need to be named.
5555         #include <isl/space.h>
5556         __isl_give isl_space *isl_space_align_params(
5557                 __isl_take isl_space *space1,
5558                 __isl_take isl_space *space2)
5560         #include <isl/set.h>
5561         __isl_give isl_basic_set *isl_basic_set_align_params(
5562                 __isl_take isl_basic_set *bset,
5563                 __isl_take isl_space *model);
5564         __isl_give isl_set *isl_set_align_params(
5565                 __isl_take isl_set *set,
5566                 __isl_take isl_space *model);
5568         #include <isl/map.h>
5569         __isl_give isl_basic_map *isl_basic_map_align_params(
5570                 __isl_take isl_basic_map *bmap,
5571                 __isl_take isl_space *model);
5572         __isl_give isl_map *isl_map_align_params(
5573                 __isl_take isl_map *map,
5574                 __isl_take isl_space *model);
5576         #include <isl/val.h>
5577         __isl_give isl_multi_val *isl_multi_val_align_params(
5578                 __isl_take isl_multi_val *mv,
5579                 __isl_take isl_space *model);
5581         #include <isl/aff.h>
5582         __isl_give isl_aff *isl_aff_align_params(
5583                 __isl_take isl_aff *aff,
5584                 __isl_take isl_space *model);
5585         __isl_give isl_multi_aff *isl_multi_aff_align_params(
5586                 __isl_take isl_multi_aff *multi,
5587                 __isl_take isl_space *model);
5588         __isl_give isl_pw_aff *isl_pw_aff_align_params(
5589                 __isl_take isl_pw_aff *pwaff,
5590                 __isl_take isl_space *model);
5591         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
5592                 __isl_take isl_pw_multi_aff *pma,
5593                 __isl_take isl_space *model);
5594         __isl_give isl_union_pw_aff *
5595         isl_union_pw_aff_align_params(
5596                 __isl_take isl_union_pw_aff *upa,
5597                 __isl_take isl_space *model);
5598         __isl_give isl_union_pw_multi_aff *
5599         isl_union_pw_multi_aff_align_params(
5600                 __isl_take isl_union_pw_multi_aff *upma,
5601                 __isl_take isl_space *model);
5602         __isl_give isl_multi_union_pw_aff *
5603         isl_multi_union_pw_aff_align_params(
5604                 __isl_take isl_multi_union_pw_aff *mupa,
5605                 __isl_take isl_space *model);
5607         #include <isl/polynomial.h>
5608         __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
5609                 __isl_take isl_qpolynomial *qp,
5610                 __isl_take isl_space *model);
5612 =item * Unary Arithmetic Operations
5614         #include <isl/set.h>
5615         __isl_give isl_set *isl_set_neg(
5616                 __isl_take isl_set *set);
5617         #include <isl/map.h>
5618         __isl_give isl_map *isl_map_neg(
5619                 __isl_take isl_map *map);
5621 C<isl_set_neg> constructs a set containing the opposites of
5622 the elements in its argument.
5623 The domain of the result of C<isl_map_neg> is the same
5624 as the domain of its argument.  The corresponding range
5625 elements are the opposites of the corresponding range
5626 elements in the argument.
5628         #include <isl/val.h>
5629         __isl_give isl_multi_val *isl_multi_val_neg(
5630                 __isl_take isl_multi_val *mv);
5632         #include <isl/aff.h>
5633         __isl_give isl_aff *isl_aff_neg(
5634                 __isl_take isl_aff *aff);
5635         __isl_give isl_multi_aff *isl_multi_aff_neg(
5636                 __isl_take isl_multi_aff *ma);
5637         __isl_give isl_pw_aff *isl_pw_aff_neg(
5638                 __isl_take isl_pw_aff *pwaff);
5639         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
5640                 __isl_take isl_pw_multi_aff *pma);
5641         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
5642                 __isl_take isl_multi_pw_aff *mpa);
5643         __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
5644                 __isl_take isl_union_pw_aff *upa);
5645         __isl_give isl_union_pw_multi_aff *
5646         isl_union_pw_multi_aff_neg(
5647                 __isl_take isl_union_pw_multi_aff *upma);
5648         __isl_give isl_multi_union_pw_aff *
5649         isl_multi_union_pw_aff_neg(
5650                 __isl_take isl_multi_union_pw_aff *mupa);
5651         __isl_give isl_aff *isl_aff_ceil(
5652                 __isl_take isl_aff *aff);
5653         __isl_give isl_pw_aff *isl_pw_aff_ceil(
5654                 __isl_take isl_pw_aff *pwaff);
5655         __isl_give isl_aff *isl_aff_floor(
5656                 __isl_take isl_aff *aff);
5657         __isl_give isl_multi_aff *isl_multi_aff_floor(
5658                 __isl_take isl_multi_aff *ma);
5659         __isl_give isl_pw_aff *isl_pw_aff_floor(
5660                 __isl_take isl_pw_aff *pwaff);
5661         __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
5662                 __isl_take isl_union_pw_aff *upa);
5663         __isl_give isl_multi_union_pw_aff *
5664         isl_multi_union_pw_aff_floor(
5665                 __isl_take isl_multi_union_pw_aff *mupa);
5667         #include <isl/aff.h>
5668         __isl_give isl_pw_aff *isl_pw_aff_list_min(
5669                 __isl_take isl_pw_aff_list *list);
5670         __isl_give isl_pw_aff *isl_pw_aff_list_max(
5671                 __isl_take isl_pw_aff_list *list);
5673         #include <isl/polynomial.h>
5674         __isl_give isl_qpolynomial *isl_qpolynomial_neg(
5675                 __isl_take isl_qpolynomial *qp);
5676         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
5677                 __isl_take isl_pw_qpolynomial *pwqp);
5678         __isl_give isl_union_pw_qpolynomial *
5679         isl_union_pw_qpolynomial_neg(
5680                 __isl_take isl_union_pw_qpolynomial *upwqp);
5681         __isl_give isl_qpolynomial *isl_qpolynomial_pow(
5682                 __isl_take isl_qpolynomial *qp,
5683                 unsigned exponent);
5684         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
5685                 __isl_take isl_pw_qpolynomial *pwqp,
5686                 unsigned exponent);
5688 =item * Evaluation
5690 The following functions evaluate a function in a point.
5692         #include <isl/polynomial.h>
5693         __isl_give isl_val *isl_pw_qpolynomial_eval(
5694                 __isl_take isl_pw_qpolynomial *pwqp,
5695                 __isl_take isl_point *pnt);
5696         __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
5697                 __isl_take isl_pw_qpolynomial_fold *pwf,
5698                 __isl_take isl_point *pnt);
5699         __isl_give isl_val *isl_union_pw_qpolynomial_eval(
5700                 __isl_take isl_union_pw_qpolynomial *upwqp,
5701                 __isl_take isl_point *pnt);
5702         __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
5703                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5704                 __isl_take isl_point *pnt);
5706 =item * Dimension manipulation
5708 It is usually not advisable to directly change the (input or output)
5709 space of a set or a relation as this removes the name and the internal
5710 structure of the space.  However, the functions below can be useful
5711 to add new parameters, assuming
5712 C<isl_set_align_params> and C<isl_map_align_params>
5713 are not sufficient.
5715         #include <isl/space.h>
5716         __isl_give isl_space *isl_space_add_dims(
5717                 __isl_take isl_space *space,
5718                 enum isl_dim_type type, unsigned n);
5719         __isl_give isl_space *isl_space_insert_dims(
5720                 __isl_take isl_space *space,
5721                 enum isl_dim_type type, unsigned pos, unsigned n);
5722         __isl_give isl_space *isl_space_drop_dims(
5723                 __isl_take isl_space *space,
5724                 enum isl_dim_type type, unsigned first, unsigned n);
5725         __isl_give isl_space *isl_space_move_dims(
5726                 __isl_take isl_space *space,
5727                 enum isl_dim_type dst_type, unsigned dst_pos,
5728                 enum isl_dim_type src_type, unsigned src_pos,
5729                 unsigned n);
5731         #include <isl/local_space.h>
5732         __isl_give isl_local_space *isl_local_space_add_dims(
5733                 __isl_take isl_local_space *ls,
5734                 enum isl_dim_type type, unsigned n);
5735         __isl_give isl_local_space *isl_local_space_insert_dims(
5736                 __isl_take isl_local_space *ls,
5737                 enum isl_dim_type type, unsigned first, unsigned n);
5738         __isl_give isl_local_space *isl_local_space_drop_dims(
5739                 __isl_take isl_local_space *ls,
5740                 enum isl_dim_type type, unsigned first, unsigned n);
5742         #include <isl/set.h>
5743         __isl_give isl_basic_set *isl_basic_set_add_dims(
5744                 __isl_take isl_basic_set *bset,
5745                 enum isl_dim_type type, unsigned n);
5746         __isl_give isl_set *isl_set_add_dims(
5747                 __isl_take isl_set *set,
5748                 enum isl_dim_type type, unsigned n);
5749         __isl_give isl_basic_set *isl_basic_set_insert_dims(
5750                 __isl_take isl_basic_set *bset,
5751                 enum isl_dim_type type, unsigned pos,
5752                 unsigned n);
5753         __isl_give isl_set *isl_set_insert_dims(
5754                 __isl_take isl_set *set,
5755                 enum isl_dim_type type, unsigned pos, unsigned n);
5756         __isl_give isl_basic_set *isl_basic_set_move_dims(
5757                 __isl_take isl_basic_set *bset,
5758                 enum isl_dim_type dst_type, unsigned dst_pos,
5759                 enum isl_dim_type src_type, unsigned src_pos,
5760                 unsigned n);
5761         __isl_give isl_set *isl_set_move_dims(
5762                 __isl_take isl_set *set,
5763                 enum isl_dim_type dst_type, unsigned dst_pos,
5764                 enum isl_dim_type src_type, unsigned src_pos,
5765                 unsigned n);
5767         #include <isl/map.h>
5768         __isl_give isl_basic_map *isl_basic_map_add_dims(
5769                 __isl_take isl_basic_map *bmap,
5770                 enum isl_dim_type type, unsigned n);
5771         __isl_give isl_map *isl_map_add_dims(
5772                 __isl_take isl_map *map,
5773                 enum isl_dim_type type, unsigned n);
5774         __isl_give isl_basic_map *isl_basic_map_insert_dims(
5775                 __isl_take isl_basic_map *bmap,
5776                 enum isl_dim_type type, unsigned pos,
5777                 unsigned n);
5778         __isl_give isl_map *isl_map_insert_dims(
5779                 __isl_take isl_map *map,
5780                 enum isl_dim_type type, unsigned pos, unsigned n);
5781         __isl_give isl_basic_map *isl_basic_map_move_dims(
5782                 __isl_take isl_basic_map *bmap,
5783                 enum isl_dim_type dst_type, unsigned dst_pos,
5784                 enum isl_dim_type src_type, unsigned src_pos,
5785                 unsigned n);
5786         __isl_give isl_map *isl_map_move_dims(
5787                 __isl_take isl_map *map,
5788                 enum isl_dim_type dst_type, unsigned dst_pos,
5789                 enum isl_dim_type src_type, unsigned src_pos,
5790                 unsigned n);
5792         #include <isl/val.h>
5793         __isl_give isl_multi_val *isl_multi_val_insert_dims(
5794                 __isl_take isl_multi_val *mv,
5795                 enum isl_dim_type type, unsigned first, unsigned n);
5796         __isl_give isl_multi_val *isl_multi_val_add_dims(
5797                 __isl_take isl_multi_val *mv,
5798                 enum isl_dim_type type, unsigned n);
5799         __isl_give isl_multi_val *isl_multi_val_drop_dims(
5800                 __isl_take isl_multi_val *mv,
5801                 enum isl_dim_type type, unsigned first, unsigned n);
5803         #include <isl/aff.h>
5804         __isl_give isl_aff *isl_aff_insert_dims(
5805                 __isl_take isl_aff *aff,
5806                 enum isl_dim_type type, unsigned first, unsigned n);
5807         __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
5808                 __isl_take isl_multi_aff *ma,
5809                 enum isl_dim_type type, unsigned first, unsigned n);
5810         __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
5811                 __isl_take isl_pw_aff *pwaff,
5812                 enum isl_dim_type type, unsigned first, unsigned n);
5813         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
5814                 __isl_take isl_multi_pw_aff *mpa,
5815                 enum isl_dim_type type, unsigned first, unsigned n);
5816         __isl_give isl_aff *isl_aff_add_dims(
5817                 __isl_take isl_aff *aff,
5818                 enum isl_dim_type type, unsigned n);
5819         __isl_give isl_multi_aff *isl_multi_aff_add_dims(
5820                 __isl_take isl_multi_aff *ma,
5821                 enum isl_dim_type type, unsigned n);
5822         __isl_give isl_pw_aff *isl_pw_aff_add_dims(
5823                 __isl_take isl_pw_aff *pwaff,
5824                 enum isl_dim_type type, unsigned n);
5825         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
5826                 __isl_take isl_multi_pw_aff *mpa,
5827                 enum isl_dim_type type, unsigned n);
5828         __isl_give isl_aff *isl_aff_drop_dims(
5829                 __isl_take isl_aff *aff,
5830                 enum isl_dim_type type, unsigned first, unsigned n);
5831         __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
5832                 __isl_take isl_multi_aff *maff,
5833                 enum isl_dim_type type, unsigned first, unsigned n);
5834         __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
5835                 __isl_take isl_pw_aff *pwaff,
5836                 enum isl_dim_type type, unsigned first, unsigned n);
5837         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
5838                 __isl_take isl_pw_multi_aff *pma,
5839                 enum isl_dim_type type, unsigned first, unsigned n);
5840         __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
5841                 __isl_take isl_union_pw_aff *upa,
5842                 enum isl_dim_type type, unsigned first, unsigned n);
5843         __isl_give isl_union_pw_multi_aff *
5844                 isl_union_pw_multi_aff_drop_dims(
5845                 __isl_take isl_union_pw_multi_aff *upma,
5846                 enum isl_dim_type type,
5847                 unsigned first, unsigned n);
5848         __isl_give isl_multi_union_pw_aff *
5849         isl_multi_union_pw_aff_drop_dims(
5850                 __isl_take isl_multi_union_pw_aff *mupa,
5851                 enum isl_dim_type type, unsigned first,
5852                 unsigned n);
5853         __isl_give isl_aff *isl_aff_move_dims(
5854                 __isl_take isl_aff *aff,
5855                 enum isl_dim_type dst_type, unsigned dst_pos,
5856                 enum isl_dim_type src_type, unsigned src_pos,
5857                 unsigned n);
5858         __isl_give isl_multi_aff *isl_multi_aff_move_dims(
5859                 __isl_take isl_multi_aff *ma,
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_pw_aff *isl_pw_aff_move_dims(
5864                 __isl_take isl_pw_aff *pa,
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_multi_pw_aff *isl_multi_pw_aff_move_dims(
5869                 __isl_take isl_multi_pw_aff *pma,
5870                 enum isl_dim_type dst_type, unsigned dst_pos,
5871                 enum isl_dim_type src_type, unsigned src_pos,
5872                 unsigned n);
5874         #include <isl/polynomial.h>
5875         __isl_give isl_union_pw_qpolynomial *
5876         isl_union_pw_qpolynomial_drop_dims(
5877                 __isl_take isl_union_pw_qpolynomial *upwqp,
5878                 enum isl_dim_type type,
5879                 unsigned first, unsigned n);
5880         __isl_give isl_union_pw_qpolynomial_fold *
5881                 isl_union_pw_qpolynomial_fold_drop_dims(
5882                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5883                 enum isl_dim_type type,
5884                 unsigned first, unsigned n);
5886 The operations on union expressions can only manipulate parameters.
5888 =back
5890 =head2 Binary Operations
5892 The two arguments of a binary operation not only need to live
5893 in the same C<isl_ctx>, they currently also need to have
5894 the same (number of) parameters.
5896 =head3 Basic Operations
5898 =over
5900 =item * Intersection
5902         #include <isl/local_space.h>
5903         __isl_give isl_local_space *isl_local_space_intersect(
5904                 __isl_take isl_local_space *ls1,
5905                 __isl_take isl_local_space *ls2);
5907         #include <isl/set.h>
5908         __isl_give isl_basic_set *isl_basic_set_intersect_params(
5909                 __isl_take isl_basic_set *bset1,
5910                 __isl_take isl_basic_set *bset2);
5911         __isl_give isl_basic_set *isl_basic_set_intersect(
5912                 __isl_take isl_basic_set *bset1,
5913                 __isl_take isl_basic_set *bset2);
5914         __isl_give isl_basic_set *isl_basic_set_list_intersect(
5915                 __isl_take struct isl_basic_set_list *list);
5916         __isl_give isl_set *isl_set_intersect_params(
5917                 __isl_take isl_set *set,
5918                 __isl_take isl_set *params);
5919         __isl_give isl_set *isl_set_intersect(
5920                 __isl_take isl_set *set1,
5921                 __isl_take isl_set *set2);
5923         #include <isl/map.h>
5924         __isl_give isl_basic_map *isl_basic_map_intersect_domain(
5925                 __isl_take isl_basic_map *bmap,
5926                 __isl_take isl_basic_set *bset);
5927         __isl_give isl_basic_map *isl_basic_map_intersect_range(
5928                 __isl_take isl_basic_map *bmap,
5929                 __isl_take isl_basic_set *bset);
5930         __isl_give isl_basic_map *isl_basic_map_intersect(
5931                 __isl_take isl_basic_map *bmap1,
5932                 __isl_take isl_basic_map *bmap2);
5933         __isl_give isl_basic_map *isl_basic_map_list_intersect(
5934                 __isl_take isl_basic_map_list *list);
5935         __isl_give isl_map *isl_map_intersect_params(
5936                 __isl_take isl_map *map,
5937                 __isl_take isl_set *params);
5938         __isl_give isl_map *isl_map_intersect_domain(
5939                 __isl_take isl_map *map,
5940                 __isl_take isl_set *set);
5941         __isl_give isl_map *isl_map_intersect_range(
5942                 __isl_take isl_map *map,
5943                 __isl_take isl_set *set);
5944         __isl_give isl_map *isl_map_intersect(
5945                 __isl_take isl_map *map1,
5946                 __isl_take isl_map *map2);
5947         __isl_give isl_map *
5948         isl_map_intersect_domain_factor_range(
5949                 __isl_take isl_map *map,
5950                 __isl_take isl_map *factor);
5951         __isl_give isl_map *
5952         isl_map_intersect_range_factor_range(
5953                 __isl_take isl_map *map,
5954                 __isl_take isl_map *factor);
5956         #include <isl/union_set.h>
5957         __isl_give isl_union_set *isl_union_set_intersect_params(
5958                 __isl_take isl_union_set *uset,
5959                 __isl_take isl_set *set);
5960         __isl_give isl_union_set *isl_union_set_intersect(
5961                 __isl_take isl_union_set *uset1,
5962                 __isl_take isl_union_set *uset2);
5964         #include <isl/union_map.h>
5965         __isl_give isl_union_map *isl_union_map_intersect_params(
5966                 __isl_take isl_union_map *umap,
5967                 __isl_take isl_set *set);
5968         __isl_give isl_union_map *isl_union_map_intersect_domain(
5969                 __isl_take isl_union_map *umap,
5970                 __isl_take isl_union_set *uset);
5971         __isl_give isl_union_map *isl_union_map_intersect_range(
5972                 __isl_take isl_union_map *umap,
5973                 __isl_take isl_union_set *uset);
5974         __isl_give isl_union_map *isl_union_map_intersect(
5975                 __isl_take isl_union_map *umap1,
5976                 __isl_take isl_union_map *umap2);
5977         __isl_give isl_union_map *
5978         isl_union_map_intersect_range_factor_range(
5979                 __isl_take isl_union_map *umap,
5980                 __isl_take isl_union_map *factor);
5982         #include <isl/aff.h>
5983         __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
5984                 __isl_take isl_pw_aff *pa,
5985                 __isl_take isl_set *set);
5986         __isl_give isl_multi_pw_aff *
5987         isl_multi_pw_aff_intersect_domain(
5988                 __isl_take isl_multi_pw_aff *mpa,
5989                 __isl_take isl_set *domain);
5990         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
5991                 __isl_take isl_pw_multi_aff *pma,
5992                 __isl_take isl_set *set);
5993         __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
5994                 __isl_take isl_union_pw_aff *upa,
5995                 __isl_take isl_union_set *uset);
5996         __isl_give isl_union_pw_multi_aff *
5997         isl_union_pw_multi_aff_intersect_domain(
5998                 __isl_take isl_union_pw_multi_aff *upma,
5999                 __isl_take isl_union_set *uset);
6000         __isl_give isl_multi_union_pw_aff *
6001         isl_multi_union_pw_aff_intersect_domain(
6002                 __isl_take isl_multi_union_pw_aff *mupa,
6003                 __isl_take isl_union_set *uset);
6004         __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
6005                 __isl_take isl_pw_aff *pa,
6006                 __isl_take isl_set *set);
6007         __isl_give isl_multi_pw_aff *
6008         isl_multi_pw_aff_intersect_params(
6009                 __isl_take isl_multi_pw_aff *mpa,
6010                 __isl_take isl_set *set);
6011         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
6012                 __isl_take isl_pw_multi_aff *pma,
6013                 __isl_take isl_set *set);
6014         __isl_give isl_union_pw_aff *
6015         isl_union_pw_aff_intersect_params(
6016                 __isl_take isl_union_pw_aff *upa,
6017         __isl_give isl_union_pw_multi_aff *
6018         isl_union_pw_multi_aff_intersect_params(
6019                 __isl_take isl_union_pw_multi_aff *upma,
6020                 __isl_take isl_set *set);
6021         __isl_give isl_multi_union_pw_aff *
6022         isl_multi_union_pw_aff_intersect_params(
6023                 __isl_take isl_multi_union_pw_aff *mupa,
6024                 __isl_take isl_set *params);
6025         isl_multi_union_pw_aff_intersect_range(
6026                 __isl_take isl_multi_union_pw_aff *mupa,
6027                 __isl_take isl_set *set);
6029         #include <isl/polynomial.h>
6030         __isl_give isl_pw_qpolynomial *
6031         isl_pw_qpolynomial_intersect_domain(
6032                 __isl_take isl_pw_qpolynomial *pwpq,
6033                 __isl_take isl_set *set);
6034         __isl_give isl_union_pw_qpolynomial *
6035         isl_union_pw_qpolynomial_intersect_domain(
6036                 __isl_take isl_union_pw_qpolynomial *upwpq,
6037                 __isl_take isl_union_set *uset);
6038         __isl_give isl_union_pw_qpolynomial_fold *
6039         isl_union_pw_qpolynomial_fold_intersect_domain(
6040                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6041                 __isl_take isl_union_set *uset);
6042         __isl_give isl_pw_qpolynomial *
6043         isl_pw_qpolynomial_intersect_params(
6044                 __isl_take isl_pw_qpolynomial *pwpq,
6045                 __isl_take isl_set *set);
6046         __isl_give isl_pw_qpolynomial_fold *
6047         isl_pw_qpolynomial_fold_intersect_params(
6048                 __isl_take isl_pw_qpolynomial_fold *pwf,
6049                 __isl_take isl_set *set);
6050         __isl_give isl_union_pw_qpolynomial *
6051         isl_union_pw_qpolynomial_intersect_params(
6052                 __isl_take isl_union_pw_qpolynomial *upwpq,
6053                 __isl_take isl_set *set);
6054         __isl_give isl_union_pw_qpolynomial_fold *
6055         isl_union_pw_qpolynomial_fold_intersect_params(
6056                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6057                 __isl_take isl_set *set);
6059 The second argument to the C<_params> functions needs to be
6060 a parametric (basic) set.  For the other functions, a parametric set
6061 for either argument is only allowed if the other argument is
6062 a parametric set as well.
6063 The list passed to C<isl_basic_set_list_intersect> needs to have
6064 at least one element and all elements need to live in the same space.
6065 The function C<isl_multi_union_pw_aff_intersect_range>
6066 restricts the input function to those shared domain elements
6067 that map to the specified range.
6069 =item * Union
6071         #include <isl/set.h>
6072         __isl_give isl_set *isl_basic_set_union(
6073                 __isl_take isl_basic_set *bset1,
6074                 __isl_take isl_basic_set *bset2);
6075         __isl_give isl_set *isl_set_union(
6076                 __isl_take isl_set *set1,
6077                 __isl_take isl_set *set2);
6078         __isl_give isl_set *isl_set_list_union(
6079                 __isl_take isl_set_list *list);
6081         #include <isl/map.h>
6082         __isl_give isl_map *isl_basic_map_union(
6083                 __isl_take isl_basic_map *bmap1,
6084                 __isl_take isl_basic_map *bmap2);
6085         __isl_give isl_map *isl_map_union(
6086                 __isl_take isl_map *map1,
6087                 __isl_take isl_map *map2);
6089         #include <isl/union_set.h>
6090         __isl_give isl_union_set *isl_union_set_union(
6091                 __isl_take isl_union_set *uset1,
6092                 __isl_take isl_union_set *uset2);
6093         __isl_give isl_union_set *isl_union_set_list_union(
6094                 __isl_take isl_union_set_list *list);
6096         #include <isl/union_map.h>
6097         __isl_give isl_union_map *isl_union_map_union(
6098                 __isl_take isl_union_map *umap1,
6099                 __isl_take isl_union_map *umap2);
6101 The list passed to C<isl_set_list_union> needs to have
6102 at least one element and all elements need to live in the same space.
6104 =item * Set difference
6106         #include <isl/set.h>
6107         __isl_give isl_set *isl_set_subtract(
6108                 __isl_take isl_set *set1,
6109                 __isl_take isl_set *set2);
6111         #include <isl/map.h>
6112         __isl_give isl_map *isl_map_subtract(
6113                 __isl_take isl_map *map1,
6114                 __isl_take isl_map *map2);
6115         __isl_give isl_map *isl_map_subtract_domain(
6116                 __isl_take isl_map *map,
6117                 __isl_take isl_set *dom);
6118         __isl_give isl_map *isl_map_subtract_range(
6119                 __isl_take isl_map *map,
6120                 __isl_take isl_set *dom);
6122         #include <isl/union_set.h>
6123         __isl_give isl_union_set *isl_union_set_subtract(
6124                 __isl_take isl_union_set *uset1,
6125                 __isl_take isl_union_set *uset2);
6127         #include <isl/union_map.h>
6128         __isl_give isl_union_map *isl_union_map_subtract(
6129                 __isl_take isl_union_map *umap1,
6130                 __isl_take isl_union_map *umap2);
6131         __isl_give isl_union_map *isl_union_map_subtract_domain(
6132                 __isl_take isl_union_map *umap,
6133                 __isl_take isl_union_set *dom);
6134         __isl_give isl_union_map *isl_union_map_subtract_range(
6135                 __isl_take isl_union_map *umap,
6136                 __isl_take isl_union_set *dom);
6138         #include <isl/aff.h>
6139         __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
6140                 __isl_take isl_pw_aff *pa,
6141                 __isl_take isl_set *set);
6142         __isl_give isl_pw_multi_aff *
6143         isl_pw_multi_aff_subtract_domain(
6144                 __isl_take isl_pw_multi_aff *pma,
6145                 __isl_take isl_set *set);
6146         __isl_give isl_union_pw_aff *
6147         isl_union_pw_aff_subtract_domain(
6148                 __isl_take isl_union_pw_aff *upa,
6149                 __isl_take isl_union_set *uset);
6150         __isl_give isl_union_pw_multi_aff *
6151         isl_union_pw_multi_aff_subtract_domain(
6152                 __isl_take isl_union_pw_multi_aff *upma,
6153                 __isl_take isl_set *set);
6155         #include <isl/polynomial.h>
6156         __isl_give isl_pw_qpolynomial *
6157         isl_pw_qpolynomial_subtract_domain(
6158                 __isl_take isl_pw_qpolynomial *pwpq,
6159                 __isl_take isl_set *set);
6160         __isl_give isl_pw_qpolynomial_fold *
6161         isl_pw_qpolynomial_fold_subtract_domain(
6162                 __isl_take isl_pw_qpolynomial_fold *pwf,
6163                 __isl_take isl_set *set);
6164         __isl_give isl_union_pw_qpolynomial *
6165         isl_union_pw_qpolynomial_subtract_domain(
6166                 __isl_take isl_union_pw_qpolynomial *upwpq,
6167                 __isl_take isl_union_set *uset);
6168         __isl_give isl_union_pw_qpolynomial_fold *
6169         isl_union_pw_qpolynomial_fold_subtract_domain(
6170                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6171                 __isl_take isl_union_set *uset);
6173 =item * Application
6175         #include <isl/space.h>
6176         __isl_give isl_space *isl_space_join(
6177                 __isl_take isl_space *left,
6178                 __isl_take isl_space *right);
6180         #include <isl/map.h>
6181         __isl_give isl_basic_set *isl_basic_set_apply(
6182                 __isl_take isl_basic_set *bset,
6183                 __isl_take isl_basic_map *bmap);
6184         __isl_give isl_set *isl_set_apply(
6185                 __isl_take isl_set *set,
6186                 __isl_take isl_map *map);
6187         __isl_give isl_union_set *isl_union_set_apply(
6188                 __isl_take isl_union_set *uset,
6189                 __isl_take isl_union_map *umap);
6190         __isl_give isl_basic_map *isl_basic_map_apply_domain(
6191                 __isl_take isl_basic_map *bmap1,
6192                 __isl_take isl_basic_map *bmap2);
6193         __isl_give isl_basic_map *isl_basic_map_apply_range(
6194                 __isl_take isl_basic_map *bmap1,
6195                 __isl_take isl_basic_map *bmap2);
6196         __isl_give isl_map *isl_map_apply_domain(
6197                 __isl_take isl_map *map1,
6198                 __isl_take isl_map *map2);
6199         __isl_give isl_map *isl_map_apply_range(
6200                 __isl_take isl_map *map1,
6201                 __isl_take isl_map *map2);
6203         #include <isl/union_map.h>
6204         __isl_give isl_union_map *isl_union_map_apply_domain(
6205                 __isl_take isl_union_map *umap1,
6206                 __isl_take isl_union_map *umap2);
6207         __isl_give isl_union_map *isl_union_map_apply_range(
6208                 __isl_take isl_union_map *umap1,
6209                 __isl_take isl_union_map *umap2);
6211         #include <isl/aff.h>
6212         __isl_give isl_union_pw_aff *
6213         isl_multi_union_pw_aff_apply_aff(
6214                 __isl_take isl_multi_union_pw_aff *mupa,
6215                 __isl_take isl_aff *aff);
6216         __isl_give isl_union_pw_aff *
6217         isl_multi_union_pw_aff_apply_pw_aff(
6218                 __isl_take isl_multi_union_pw_aff *mupa,
6219                 __isl_take isl_pw_aff *pa);
6220         __isl_give isl_multi_union_pw_aff *
6221         isl_multi_union_pw_aff_apply_multi_aff(
6222                 __isl_take isl_multi_union_pw_aff *mupa,
6223                 __isl_take isl_multi_aff *ma);
6224         __isl_give isl_multi_union_pw_aff *
6225         isl_multi_union_pw_aff_apply_pw_multi_aff(
6226                 __isl_take isl_multi_union_pw_aff *mupa,
6227                 __isl_take isl_pw_multi_aff *pma);
6229 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
6230 over the shared domain of the elements of the input.  The dimension is
6231 required to be greater than zero.
6232 The C<isl_multi_union_pw_aff> argument of
6233 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
6234 but only if the range of the C<isl_multi_aff> argument
6235 is also zero-dimensional.
6236 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
6238         #include <isl/polynomial.h>
6239         __isl_give isl_pw_qpolynomial_fold *
6240         isl_set_apply_pw_qpolynomial_fold(
6241                 __isl_take isl_set *set,
6242                 __isl_take isl_pw_qpolynomial_fold *pwf,
6243                 int *tight);
6244         __isl_give isl_pw_qpolynomial_fold *
6245         isl_map_apply_pw_qpolynomial_fold(
6246                 __isl_take isl_map *map,
6247                 __isl_take isl_pw_qpolynomial_fold *pwf,
6248                 int *tight);
6249         __isl_give isl_union_pw_qpolynomial_fold *
6250         isl_union_set_apply_union_pw_qpolynomial_fold(
6251                 __isl_take isl_union_set *uset,
6252                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6253                 int *tight);
6254         __isl_give isl_union_pw_qpolynomial_fold *
6255         isl_union_map_apply_union_pw_qpolynomial_fold(
6256                 __isl_take isl_union_map *umap,
6257                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6258                 int *tight);
6260 The functions taking a map
6261 compose the given map with the given piecewise quasipolynomial reduction.
6262 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
6263 over all elements in the intersection of the range of the map
6264 and the domain of the piecewise quasipolynomial reduction
6265 as a function of an element in the domain of the map.
6266 The functions taking a set compute a bound over all elements in the
6267 intersection of the set and the domain of the
6268 piecewise quasipolynomial reduction.
6270 =item * Preimage
6272         #include <isl/set.h>
6273         __isl_give isl_basic_set *
6274         isl_basic_set_preimage_multi_aff(
6275                 __isl_take isl_basic_set *bset,
6276                 __isl_take isl_multi_aff *ma);
6277         __isl_give isl_set *isl_set_preimage_multi_aff(
6278                 __isl_take isl_set *set,
6279                 __isl_take isl_multi_aff *ma);
6280         __isl_give isl_set *isl_set_preimage_pw_multi_aff(
6281                 __isl_take isl_set *set,
6282                 __isl_take isl_pw_multi_aff *pma);
6283         __isl_give isl_set *isl_set_preimage_multi_pw_aff(
6284                 __isl_take isl_set *set,
6285                 __isl_take isl_multi_pw_aff *mpa);
6287         #include <isl/union_set.h>
6288         __isl_give isl_union_set *
6289         isl_union_set_preimage_multi_aff(
6290                 __isl_take isl_union_set *uset,
6291                 __isl_take isl_multi_aff *ma);
6292         __isl_give isl_union_set *
6293         isl_union_set_preimage_pw_multi_aff(
6294                 __isl_take isl_union_set *uset,
6295                 __isl_take isl_pw_multi_aff *pma);
6296         __isl_give isl_union_set *
6297         isl_union_set_preimage_union_pw_multi_aff(
6298                 __isl_take isl_union_set *uset,
6299                 __isl_take isl_union_pw_multi_aff *upma);
6301         #include <isl/map.h>
6302         __isl_give isl_basic_map *
6303         isl_basic_map_preimage_domain_multi_aff(
6304                 __isl_take isl_basic_map *bmap,
6305                 __isl_take isl_multi_aff *ma);
6306         __isl_give isl_map *isl_map_preimage_domain_multi_aff(
6307                 __isl_take isl_map *map,
6308                 __isl_take isl_multi_aff *ma);
6309         __isl_give isl_map *isl_map_preimage_range_multi_aff(
6310                 __isl_take isl_map *map,
6311                 __isl_take isl_multi_aff *ma);
6312         __isl_give isl_map *
6313         isl_map_preimage_domain_pw_multi_aff(
6314                 __isl_take isl_map *map,
6315                 __isl_take isl_pw_multi_aff *pma);
6316         __isl_give isl_map *
6317         isl_map_preimage_range_pw_multi_aff(
6318                 __isl_take isl_map *map,
6319                 __isl_take isl_pw_multi_aff *pma);
6320         __isl_give isl_map *
6321         isl_map_preimage_domain_multi_pw_aff(
6322                 __isl_take isl_map *map,
6323                 __isl_take isl_multi_pw_aff *mpa);
6324         __isl_give isl_basic_map *
6325         isl_basic_map_preimage_range_multi_aff(
6326                 __isl_take isl_basic_map *bmap,
6327                 __isl_take isl_multi_aff *ma);
6329         #include <isl/union_map.h>
6330         __isl_give isl_union_map *
6331         isl_union_map_preimage_domain_multi_aff(
6332                 __isl_take isl_union_map *umap,
6333                 __isl_take isl_multi_aff *ma);
6334         __isl_give isl_union_map *
6335         isl_union_map_preimage_range_multi_aff(
6336                 __isl_take isl_union_map *umap,
6337                 __isl_take isl_multi_aff *ma);
6338         __isl_give isl_union_map *
6339         isl_union_map_preimage_domain_pw_multi_aff(
6340                 __isl_take isl_union_map *umap,
6341                 __isl_take isl_pw_multi_aff *pma);
6342         __isl_give isl_union_map *
6343         isl_union_map_preimage_range_pw_multi_aff(
6344                 __isl_take isl_union_map *umap,
6345                 __isl_take isl_pw_multi_aff *pma);
6346         __isl_give isl_union_map *
6347         isl_union_map_preimage_domain_union_pw_multi_aff(
6348                 __isl_take isl_union_map *umap,
6349                 __isl_take isl_union_pw_multi_aff *upma);
6350         __isl_give isl_union_map *
6351         isl_union_map_preimage_range_union_pw_multi_aff(
6352                 __isl_take isl_union_map *umap,
6353                 __isl_take isl_union_pw_multi_aff *upma);
6355 These functions compute the preimage of the given set or map domain/range under
6356 the given function.  In other words, the expression is plugged
6357 into the set description or into the domain/range of the map.
6359 =item * Pullback
6361         #include <isl/aff.h>
6362         __isl_give isl_aff *isl_aff_pullback_aff(
6363                 __isl_take isl_aff *aff1,
6364                 __isl_take isl_aff *aff2);
6365         __isl_give isl_aff *isl_aff_pullback_multi_aff(
6366                 __isl_take isl_aff *aff,
6367                 __isl_take isl_multi_aff *ma);
6368         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
6369                 __isl_take isl_pw_aff *pa,
6370                 __isl_take isl_multi_aff *ma);
6371         __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
6372                 __isl_take isl_pw_aff *pa,
6373                 __isl_take isl_pw_multi_aff *pma);
6374         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
6375                 __isl_take isl_pw_aff *pa,
6376                 __isl_take isl_multi_pw_aff *mpa);
6377         __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
6378                 __isl_take isl_multi_aff *ma1,
6379                 __isl_take isl_multi_aff *ma2);
6380         __isl_give isl_pw_multi_aff *
6381         isl_pw_multi_aff_pullback_multi_aff(
6382                 __isl_take isl_pw_multi_aff *pma,
6383                 __isl_take isl_multi_aff *ma);
6384         __isl_give isl_multi_pw_aff *
6385         isl_multi_pw_aff_pullback_multi_aff(
6386                 __isl_take isl_multi_pw_aff *mpa,
6387                 __isl_take isl_multi_aff *ma);
6388         __isl_give isl_pw_multi_aff *
6389         isl_pw_multi_aff_pullback_pw_multi_aff(
6390                 __isl_take isl_pw_multi_aff *pma1,
6391                 __isl_take isl_pw_multi_aff *pma2);
6392         __isl_give isl_multi_pw_aff *
6393         isl_multi_pw_aff_pullback_pw_multi_aff(
6394                 __isl_take isl_multi_pw_aff *mpa,
6395                 __isl_take isl_pw_multi_aff *pma);
6396         __isl_give isl_multi_pw_aff *
6397         isl_multi_pw_aff_pullback_multi_pw_aff(
6398                 __isl_take isl_multi_pw_aff *mpa1,
6399                 __isl_take isl_multi_pw_aff *mpa2);
6400         __isl_give isl_union_pw_aff *
6401         isl_union_pw_aff_pullback_union_pw_multi_aff(
6402                 __isl_take isl_union_pw_aff *upa,
6403                 __isl_take isl_union_pw_multi_aff *upma);
6404         __isl_give isl_union_pw_multi_aff *
6405         isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
6406                 __isl_take isl_union_pw_multi_aff *upma1,
6407                 __isl_take isl_union_pw_multi_aff *upma2);
6408         __isl_give isl_multi_union_pw_aff *
6409         isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
6410                 __isl_take isl_multi_union_pw_aff *mupa,
6411                 __isl_take isl_union_pw_multi_aff *upma);
6413 These functions precompose the first expression by the second function.
6414 In other words, the second function is plugged
6415 into the first expression.
6417 =item * Locus
6419         #include <isl/aff.h>
6420         __isl_give isl_basic_set *isl_aff_eq_basic_set(
6421                 __isl_take isl_aff *aff1,
6422                 __isl_take isl_aff *aff2);
6423         __isl_give isl_set *isl_aff_eq_set(
6424                 __isl_take isl_aff *aff1,
6425                 __isl_take isl_aff *aff2);
6426         __isl_give isl_set *isl_aff_ne_set(
6427                 __isl_take isl_aff *aff1,
6428                 __isl_take isl_aff *aff2);
6429         __isl_give isl_basic_set *isl_aff_le_basic_set(
6430                 __isl_take isl_aff *aff1,
6431                 __isl_take isl_aff *aff2);
6432         __isl_give isl_set *isl_aff_le_set(
6433                 __isl_take isl_aff *aff1,
6434                 __isl_take isl_aff *aff2);
6435         __isl_give isl_basic_set *isl_aff_lt_basic_set(
6436                 __isl_take isl_aff *aff1,
6437                 __isl_take isl_aff *aff2);
6438         __isl_give isl_set *isl_aff_lt_set(
6439                 __isl_take isl_aff *aff1,
6440                 __isl_take isl_aff *aff2);
6441         __isl_give isl_basic_set *isl_aff_ge_basic_set(
6442                 __isl_take isl_aff *aff1,
6443                 __isl_take isl_aff *aff2);
6444         __isl_give isl_set *isl_aff_ge_set(
6445                 __isl_take isl_aff *aff1,
6446                 __isl_take isl_aff *aff2);
6447         __isl_give isl_basic_set *isl_aff_gt_basic_set(
6448                 __isl_take isl_aff *aff1,
6449                 __isl_take isl_aff *aff2);
6450         __isl_give isl_set *isl_aff_gt_set(
6451                 __isl_take isl_aff *aff1,
6452                 __isl_take isl_aff *aff2);
6453         __isl_give isl_set *isl_pw_aff_eq_set(
6454                 __isl_take isl_pw_aff *pwaff1,
6455                 __isl_take isl_pw_aff *pwaff2);
6456         __isl_give isl_set *isl_pw_aff_ne_set(
6457                 __isl_take isl_pw_aff *pwaff1,
6458                 __isl_take isl_pw_aff *pwaff2);
6459         __isl_give isl_set *isl_pw_aff_le_set(
6460                 __isl_take isl_pw_aff *pwaff1,
6461                 __isl_take isl_pw_aff *pwaff2);
6462         __isl_give isl_set *isl_pw_aff_lt_set(
6463                 __isl_take isl_pw_aff *pwaff1,
6464                 __isl_take isl_pw_aff *pwaff2);
6465         __isl_give isl_set *isl_pw_aff_ge_set(
6466                 __isl_take isl_pw_aff *pwaff1,
6467                 __isl_take isl_pw_aff *pwaff2);
6468         __isl_give isl_set *isl_pw_aff_gt_set(
6469                 __isl_take isl_pw_aff *pwaff1,
6470                 __isl_take isl_pw_aff *pwaff2);
6472         __isl_give isl_set *isl_multi_aff_lex_le_set(
6473                 __isl_take isl_multi_aff *ma1,
6474                 __isl_take isl_multi_aff *ma2);
6475         __isl_give isl_set *isl_multi_aff_lex_lt_set(
6476                 __isl_take isl_multi_aff *ma1,
6477                 __isl_take isl_multi_aff *ma2);
6478         __isl_give isl_set *isl_multi_aff_lex_ge_set(
6479                 __isl_take isl_multi_aff *ma1,
6480                 __isl_take isl_multi_aff *ma2);
6481         __isl_give isl_set *isl_multi_aff_lex_gt_set(
6482                 __isl_take isl_multi_aff *ma1,
6483                 __isl_take isl_multi_aff *ma2);
6485         __isl_give isl_set *isl_pw_aff_list_eq_set(
6486                 __isl_take isl_pw_aff_list *list1,
6487                 __isl_take isl_pw_aff_list *list2);
6488         __isl_give isl_set *isl_pw_aff_list_ne_set(
6489                 __isl_take isl_pw_aff_list *list1,
6490                 __isl_take isl_pw_aff_list *list2);
6491         __isl_give isl_set *isl_pw_aff_list_le_set(
6492                 __isl_take isl_pw_aff_list *list1,
6493                 __isl_take isl_pw_aff_list *list2);
6494         __isl_give isl_set *isl_pw_aff_list_lt_set(
6495                 __isl_take isl_pw_aff_list *list1,
6496                 __isl_take isl_pw_aff_list *list2);
6497         __isl_give isl_set *isl_pw_aff_list_ge_set(
6498                 __isl_take isl_pw_aff_list *list1,
6499                 __isl_take isl_pw_aff_list *list2);
6500         __isl_give isl_set *isl_pw_aff_list_gt_set(
6501                 __isl_take isl_pw_aff_list *list1,
6502                 __isl_take isl_pw_aff_list *list2);
6504 The function C<isl_aff_ge_basic_set> returns a basic set
6505 containing those elements in the shared space
6506 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
6507 The function C<isl_pw_aff_ge_set> returns a set
6508 containing those elements in the shared domain
6509 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
6510 greater than or equal to C<pwaff2>.
6511 The function C<isl_multi_aff_lex_le_set> returns a set
6512 containing those elements in the shared domain space
6513 where C<ma1> is lexicographically smaller than or
6514 equal to C<ma2>.
6515 The functions operating on C<isl_pw_aff_list> apply the corresponding
6516 C<isl_pw_aff> function to each pair of elements in the two lists.
6518         #include <isl/aff.h>
6519         __isl_give isl_map *isl_pw_aff_eq_map(
6520                 __isl_take isl_pw_aff *pa1,
6521                 __isl_take isl_pw_aff *pa2);
6522         __isl_give isl_map *isl_pw_aff_lt_map(
6523                 __isl_take isl_pw_aff *pa1,
6524                 __isl_take isl_pw_aff *pa2);
6525         __isl_give isl_map *isl_pw_aff_gt_map(
6526                 __isl_take isl_pw_aff *pa1,
6527                 __isl_take isl_pw_aff *pa2);
6529         __isl_give isl_map *isl_multi_pw_aff_eq_map(
6530                 __isl_take isl_multi_pw_aff *mpa1,
6531                 __isl_take isl_multi_pw_aff *mpa2);
6532         __isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
6533                 __isl_take isl_multi_pw_aff *mpa1,
6534                 __isl_take isl_multi_pw_aff *mpa2);
6535         __isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
6536                 __isl_take isl_multi_pw_aff *mpa1,
6537                 __isl_take isl_multi_pw_aff *mpa2);
6539 These functions return a map between domain elements of the arguments
6540 where the function values satisfy the given relation.
6542         #include <isl/union_map.h>
6543         __isl_give isl_union_map *
6544         isl_union_map_eq_at_multi_union_pw_aff(
6545                 __isl_take isl_union_map *umap,
6546                 __isl_take isl_multi_union_pw_aff *mupa);
6547         __isl_give isl_union_map *
6548         isl_union_map_lex_lt_at_multi_union_pw_aff(
6549                 __isl_take isl_union_map *umap,
6550                 __isl_take isl_multi_union_pw_aff *mupa);
6551         __isl_give isl_union_map *
6552         isl_union_map_lex_gt_at_multi_union_pw_aff(
6553                 __isl_take isl_union_map *umap,
6554                 __isl_take isl_multi_union_pw_aff *mupa);
6556 These functions select the subset of elements in the union map
6557 that have an equal or lexicographically smaller function value.
6559 =item * Cartesian Product
6561         #include <isl/space.h>
6562         __isl_give isl_space *isl_space_product(
6563                 __isl_take isl_space *space1,
6564                 __isl_take isl_space *space2);
6565         __isl_give isl_space *isl_space_domain_product(
6566                 __isl_take isl_space *space1,
6567                 __isl_take isl_space *space2);
6568         __isl_give isl_space *isl_space_range_product(
6569                 __isl_take isl_space *space1,
6570                 __isl_take isl_space *space2);
6572 The functions
6573 C<isl_space_product>, C<isl_space_domain_product>
6574 and C<isl_space_range_product> take pairs or relation spaces and
6575 produce a single relations space, where either the domain, the range
6576 or both domain and range are wrapped spaces of relations between
6577 the domains and/or ranges of the input spaces.
6578 If the product is only constructed over the domain or the range
6579 then the ranges or the domains of the inputs should be the same.
6580 The function C<isl_space_product> also accepts a pair of set spaces,
6581 in which case it returns a wrapped space of a relation between the
6582 two input spaces.
6584         #include <isl/set.h>
6585         __isl_give isl_set *isl_set_product(
6586                 __isl_take isl_set *set1,
6587                 __isl_take isl_set *set2);
6589         #include <isl/map.h>
6590         __isl_give isl_basic_map *isl_basic_map_domain_product(
6591                 __isl_take isl_basic_map *bmap1,
6592                 __isl_take isl_basic_map *bmap2);
6593         __isl_give isl_basic_map *isl_basic_map_range_product(
6594                 __isl_take isl_basic_map *bmap1,
6595                 __isl_take isl_basic_map *bmap2);
6596         __isl_give isl_basic_map *isl_basic_map_product(
6597                 __isl_take isl_basic_map *bmap1,
6598                 __isl_take isl_basic_map *bmap2);
6599         __isl_give isl_map *isl_map_domain_product(
6600                 __isl_take isl_map *map1,
6601                 __isl_take isl_map *map2);
6602         __isl_give isl_map *isl_map_range_product(
6603                 __isl_take isl_map *map1,
6604                 __isl_take isl_map *map2);
6605         __isl_give isl_map *isl_map_product(
6606                 __isl_take isl_map *map1,
6607                 __isl_take isl_map *map2);
6609         #include <isl/union_set.h>
6610         __isl_give isl_union_set *isl_union_set_product(
6611                 __isl_take isl_union_set *uset1,
6612                 __isl_take isl_union_set *uset2);
6614         #include <isl/union_map.h>
6615         __isl_give isl_union_map *isl_union_map_domain_product(
6616                 __isl_take isl_union_map *umap1,
6617                 __isl_take isl_union_map *umap2);
6618         __isl_give isl_union_map *isl_union_map_range_product(
6619                 __isl_take isl_union_map *umap1,
6620                 __isl_take isl_union_map *umap2);
6621         __isl_give isl_union_map *isl_union_map_product(
6622                 __isl_take isl_union_map *umap1,
6623                 __isl_take isl_union_map *umap2);
6625         #include <isl/val.h>
6626         __isl_give isl_multi_val *isl_multi_val_range_product(
6627                 __isl_take isl_multi_val *mv1,
6628                 __isl_take isl_multi_val *mv2);
6629         __isl_give isl_multi_val *isl_multi_val_product(
6630                 __isl_take isl_multi_val *mv1,
6631                 __isl_take isl_multi_val *mv2);
6633         #include <isl/aff.h>
6634         __isl_give isl_multi_aff *isl_multi_aff_range_product(
6635                 __isl_take isl_multi_aff *ma1,
6636                 __isl_take isl_multi_aff *ma2);
6637         __isl_give isl_multi_aff *isl_multi_aff_product(
6638                 __isl_take isl_multi_aff *ma1,
6639                 __isl_take isl_multi_aff *ma2);
6640         __isl_give isl_multi_pw_aff *
6641         isl_multi_pw_aff_range_product(
6642                 __isl_take isl_multi_pw_aff *mpa1,
6643                 __isl_take isl_multi_pw_aff *mpa2);
6644         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
6645                 __isl_take isl_multi_pw_aff *mpa1,
6646                 __isl_take isl_multi_pw_aff *mpa2);
6647         __isl_give isl_pw_multi_aff *
6648         isl_pw_multi_aff_range_product(
6649                 __isl_take isl_pw_multi_aff *pma1,
6650                 __isl_take isl_pw_multi_aff *pma2);
6651         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
6652                 __isl_take isl_pw_multi_aff *pma1,
6653                 __isl_take isl_pw_multi_aff *pma2);
6654         __isl_give isl_multi_union_pw_aff *
6655         isl_multi_union_pw_aff_range_product(
6656                 __isl_take isl_multi_union_pw_aff *mupa1,
6657                 __isl_take isl_multi_union_pw_aff *mupa2);
6659 The above functions compute the cross product of the given
6660 sets, relations or functions.  The domains and ranges of the results
6661 are wrapped maps between domains and ranges of the inputs.
6662 To obtain a ``flat'' product, use the following functions
6663 instead.
6665         #include <isl/set.h>
6666         __isl_give isl_basic_set *isl_basic_set_flat_product(
6667                 __isl_take isl_basic_set *bset1,
6668                 __isl_take isl_basic_set *bset2);
6669         __isl_give isl_set *isl_set_flat_product(
6670                 __isl_take isl_set *set1,
6671                 __isl_take isl_set *set2);
6673         #include <isl/map.h>
6674         __isl_give isl_basic_map *isl_basic_map_flat_range_product(
6675                 __isl_take isl_basic_map *bmap1,
6676                 __isl_take isl_basic_map *bmap2);
6677         __isl_give isl_map *isl_map_flat_domain_product(
6678                 __isl_take isl_map *map1,
6679                 __isl_take isl_map *map2);
6680         __isl_give isl_map *isl_map_flat_range_product(
6681                 __isl_take isl_map *map1,
6682                 __isl_take isl_map *map2);
6683         __isl_give isl_basic_map *isl_basic_map_flat_product(
6684                 __isl_take isl_basic_map *bmap1,
6685                 __isl_take isl_basic_map *bmap2);
6686         __isl_give isl_map *isl_map_flat_product(
6687                 __isl_take isl_map *map1,
6688                 __isl_take isl_map *map2);
6690         #include <isl/union_map.h>
6691         __isl_give isl_union_map *
6692         isl_union_map_flat_domain_product(
6693                 __isl_take isl_union_map *umap1,
6694                 __isl_take isl_union_map *umap2);
6695         __isl_give isl_union_map *
6696         isl_union_map_flat_range_product(
6697                 __isl_take isl_union_map *umap1,
6698                 __isl_take isl_union_map *umap2);
6700         #include <isl/val.h>
6701         __isl_give isl_multi_val *isl_multi_val_flat_range_product(
6702                 __isl_take isl_multi_val *mv1,
6703                 __isl_take isl_multi_aff *mv2);
6705         #include <isl/aff.h>
6706         __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
6707                 __isl_take isl_multi_aff *ma1,
6708                 __isl_take isl_multi_aff *ma2);
6709         __isl_give isl_pw_multi_aff *
6710         isl_pw_multi_aff_flat_range_product(
6711                 __isl_take isl_pw_multi_aff *pma1,
6712                 __isl_take isl_pw_multi_aff *pma2);
6713         __isl_give isl_multi_pw_aff *
6714         isl_multi_pw_aff_flat_range_product(
6715                 __isl_take isl_multi_pw_aff *mpa1,
6716                 __isl_take isl_multi_pw_aff *mpa2);
6717         __isl_give isl_union_pw_multi_aff *
6718         isl_union_pw_multi_aff_flat_range_product(
6719                 __isl_take isl_union_pw_multi_aff *upma1,
6720                 __isl_take isl_union_pw_multi_aff *upma2);
6721         __isl_give isl_multi_union_pw_aff *
6722         isl_multi_union_pw_aff_flat_range_product(
6723                 __isl_take isl_multi_union_pw_aff *mupa1,
6724                 __isl_take isl_multi_union_pw_aff *mupa2);
6726         #include <isl/space.h>
6727         __isl_give isl_space *isl_space_factor_domain(
6728                 __isl_take isl_space *space);
6729         __isl_give isl_space *isl_space_factor_range(
6730                 __isl_take isl_space *space);
6731         __isl_give isl_space *isl_space_domain_factor_domain(
6732                 __isl_take isl_space *space);
6733         __isl_give isl_space *isl_space_domain_factor_range(
6734                 __isl_take isl_space *space);
6735         __isl_give isl_space *isl_space_range_factor_domain(
6736                 __isl_take isl_space *space);
6737         __isl_give isl_space *isl_space_range_factor_range(
6738                 __isl_take isl_space *space);
6740 The functions C<isl_space_range_factor_domain> and
6741 C<isl_space_range_factor_range> extract the two arguments from
6742 the result of a call to C<isl_space_range_product>.
6744 The arguments of a call to a product can be extracted
6745 from the result using the following functions.
6747         #include <isl/map.h>
6748         __isl_give isl_map *isl_map_factor_domain(
6749                 __isl_take isl_map *map);
6750         __isl_give isl_map *isl_map_factor_range(
6751                 __isl_take isl_map *map);
6752         __isl_give isl_map *isl_map_domain_factor_domain(
6753                 __isl_take isl_map *map);
6754         __isl_give isl_map *isl_map_domain_factor_range(
6755                 __isl_take isl_map *map);
6756         __isl_give isl_map *isl_map_range_factor_domain(
6757                 __isl_take isl_map *map);
6758         __isl_give isl_map *isl_map_range_factor_range(
6759                 __isl_take isl_map *map);
6761         #include <isl/union_map.h>
6762         __isl_give isl_union_map *isl_union_map_factor_domain(
6763                 __isl_take isl_union_map *umap);
6764         __isl_give isl_union_map *isl_union_map_factor_range(
6765                 __isl_take isl_union_map *umap);
6766         __isl_give isl_union_map *
6767         isl_union_map_domain_factor_domain(
6768                 __isl_take isl_union_map *umap);
6769         __isl_give isl_union_map *
6770         isl_union_map_domain_factor_range(
6771                 __isl_take isl_union_map *umap);
6772         __isl_give isl_union_map *
6773         isl_union_map_range_factor_domain(
6774                 __isl_take isl_union_map *umap);
6775         __isl_give isl_union_map *
6776         isl_union_map_range_factor_range(
6777                 __isl_take isl_union_map *umap);
6779         #include <isl/val.h>
6780         __isl_give isl_multi_val *isl_multi_val_factor_range(
6781                 __isl_take isl_multi_val *mv);
6782         __isl_give isl_multi_val *
6783         isl_multi_val_range_factor_domain(
6784                 __isl_take isl_multi_val *mv);
6785         __isl_give isl_multi_val *
6786         isl_multi_val_range_factor_range(
6787                 __isl_take isl_multi_val *mv);
6789         #include <isl/aff.h>
6790         __isl_give isl_multi_aff *isl_multi_aff_factor_range(
6791                 __isl_take isl_multi_aff *ma);
6792         __isl_give isl_multi_aff *
6793         isl_multi_aff_range_factor_domain(
6794                 __isl_take isl_multi_aff *ma);
6795         __isl_give isl_multi_aff *
6796         isl_multi_aff_range_factor_range(
6797                 __isl_take isl_multi_aff *ma);
6798         __isl_give isl_multi_pw_aff *
6799         isl_multi_pw_aff_factor_range(
6800                 __isl_take isl_multi_pw_aff *mpa);
6801         __isl_give isl_multi_pw_aff *
6802         isl_multi_pw_aff_range_factor_domain(
6803                 __isl_take isl_multi_pw_aff *mpa);
6804         __isl_give isl_multi_pw_aff *
6805         isl_multi_pw_aff_range_factor_range(
6806                 __isl_take isl_multi_pw_aff *mpa);
6807         __isl_give isl_multi_union_pw_aff *
6808         isl_multi_union_pw_aff_factor_range(
6809                 __isl_take isl_multi_union_pw_aff *mupa);
6810         __isl_give isl_multi_union_pw_aff *
6811         isl_multi_union_pw_aff_range_factor_domain(
6812                 __isl_take isl_multi_union_pw_aff *mupa);
6813         __isl_give isl_multi_union_pw_aff *
6814         isl_multi_union_pw_aff_range_factor_range(
6815                 __isl_take isl_multi_union_pw_aff *mupa);
6817 The splice functions are a generalization of the flat product functions,
6818 where the second argument may be inserted at any position inside
6819 the first argument rather than being placed at the end.
6820 The functions C<isl_multi_val_factor_range>,
6821 C<isl_multi_aff_factor_range>,
6822 C<isl_multi_pw_aff_factor_range> and
6823 C<isl_multi_union_pw_aff_factor_range>
6824 take functions that live in a set space.
6826         #include <isl/val.h>
6827         __isl_give isl_multi_val *isl_multi_val_range_splice(
6828                 __isl_take isl_multi_val *mv1, unsigned pos,
6829                 __isl_take isl_multi_val *mv2);
6831         #include <isl/aff.h>
6832         __isl_give isl_multi_aff *isl_multi_aff_range_splice(
6833                 __isl_take isl_multi_aff *ma1, unsigned pos,
6834                 __isl_take isl_multi_aff *ma2);
6835         __isl_give isl_multi_aff *isl_multi_aff_splice(
6836                 __isl_take isl_multi_aff *ma1,
6837                 unsigned in_pos, unsigned out_pos,
6838                 __isl_take isl_multi_aff *ma2);
6839         __isl_give isl_multi_pw_aff *
6840         isl_multi_pw_aff_range_splice(
6841                 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
6842                 __isl_take isl_multi_pw_aff *mpa2);
6843         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
6844                 __isl_take isl_multi_pw_aff *mpa1,
6845                 unsigned in_pos, unsigned out_pos,
6846                 __isl_take isl_multi_pw_aff *mpa2);
6847         __isl_give isl_multi_union_pw_aff *
6848         isl_multi_union_pw_aff_range_splice(
6849                 __isl_take isl_multi_union_pw_aff *mupa1,
6850                 unsigned pos,
6851                 __isl_take isl_multi_union_pw_aff *mupa2);
6853 =item * Simplification
6855 When applied to a set or relation,
6856 the gist operation returns a set or relation that has the
6857 same intersection with the context as the input set or relation.
6858 Any implicit equality in the intersection is made explicit in the result,
6859 while all inequalities that are redundant with respect to the intersection
6860 are removed.
6861 In case of union sets and relations, the gist operation is performed
6862 per space.
6864 When applied to a function,
6865 the gist operation applies the set gist operation to each of
6866 the cells in the domain of the input piecewise expression.
6867 The context is also exploited
6868 to simplify the expression associated to each cell.
6870         #include <isl/set.h>
6871         __isl_give isl_basic_set *isl_basic_set_gist(
6872                 __isl_take isl_basic_set *bset,
6873                 __isl_take isl_basic_set *context);
6874         __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
6875                 __isl_take isl_set *context);
6876         __isl_give isl_set *isl_set_gist_params(
6877                 __isl_take isl_set *set,
6878                 __isl_take isl_set *context);
6880         #include <isl/map.h>
6881         __isl_give isl_basic_map *isl_basic_map_gist(
6882                 __isl_take isl_basic_map *bmap,
6883                 __isl_take isl_basic_map *context);
6884         __isl_give isl_basic_map *isl_basic_map_gist_domain(
6885                 __isl_take isl_basic_map *bmap,
6886                 __isl_take isl_basic_set *context);
6887         __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
6888                 __isl_take isl_map *context);
6889         __isl_give isl_map *isl_map_gist_params(
6890                 __isl_take isl_map *map,
6891                 __isl_take isl_set *context);
6892         __isl_give isl_map *isl_map_gist_domain(
6893                 __isl_take isl_map *map,
6894                 __isl_take isl_set *context);
6895         __isl_give isl_map *isl_map_gist_range(
6896                 __isl_take isl_map *map,
6897                 __isl_take isl_set *context);
6899         #include <isl/union_set.h>
6900         __isl_give isl_union_set *isl_union_set_gist(
6901                 __isl_take isl_union_set *uset,
6902                 __isl_take isl_union_set *context);
6903         __isl_give isl_union_set *isl_union_set_gist_params(
6904                 __isl_take isl_union_set *uset,
6905                 __isl_take isl_set *set);
6907         #include <isl/union_map.h>
6908         __isl_give isl_union_map *isl_union_map_gist(
6909                 __isl_take isl_union_map *umap,
6910                 __isl_take isl_union_map *context);
6911         __isl_give isl_union_map *isl_union_map_gist_params(
6912                 __isl_take isl_union_map *umap,
6913                 __isl_take isl_set *set);
6914         __isl_give isl_union_map *isl_union_map_gist_domain(
6915                 __isl_take isl_union_map *umap,
6916                 __isl_take isl_union_set *uset);
6917         __isl_give isl_union_map *isl_union_map_gist_range(
6918                 __isl_take isl_union_map *umap,
6919                 __isl_take isl_union_set *uset);
6921         #include <isl/aff.h>
6922         __isl_give isl_aff *isl_aff_gist_params(
6923                 __isl_take isl_aff *aff,
6924                 __isl_take isl_set *context);
6925         __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
6926                 __isl_take isl_set *context);
6927         __isl_give isl_multi_aff *isl_multi_aff_gist_params(
6928                 __isl_take isl_multi_aff *maff,
6929                 __isl_take isl_set *context);
6930         __isl_give isl_multi_aff *isl_multi_aff_gist(
6931                 __isl_take isl_multi_aff *maff,
6932                 __isl_take isl_set *context);
6933         __isl_give isl_pw_aff *isl_pw_aff_gist_params(
6934                 __isl_take isl_pw_aff *pwaff,
6935                 __isl_take isl_set *context);
6936         __isl_give isl_pw_aff *isl_pw_aff_gist(
6937                 __isl_take isl_pw_aff *pwaff,
6938                 __isl_take isl_set *context);
6939         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
6940                 __isl_take isl_pw_multi_aff *pma,
6941                 __isl_take isl_set *set);
6942         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
6943                 __isl_take isl_pw_multi_aff *pma,
6944                 __isl_take isl_set *set);
6945         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
6946                 __isl_take isl_multi_pw_aff *mpa,
6947                 __isl_take isl_set *set);
6948         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
6949                 __isl_take isl_multi_pw_aff *mpa,
6950                 __isl_take isl_set *set);
6951         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
6952                 __isl_take isl_union_pw_aff *upa,
6953                 __isl_take isl_union_set *context);
6954         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
6955                 __isl_take isl_union_pw_aff *upa,
6956                 __isl_take isl_set *context);
6957         __isl_give isl_union_pw_multi_aff *
6958         isl_union_pw_multi_aff_gist_params(
6959                 __isl_take isl_union_pw_multi_aff *upma,
6960                 __isl_take isl_set *context);
6961         __isl_give isl_union_pw_multi_aff *
6962         isl_union_pw_multi_aff_gist(
6963                 __isl_take isl_union_pw_multi_aff *upma,
6964                 __isl_take isl_union_set *context);
6965         __isl_give isl_multi_union_pw_aff *
6966         isl_multi_union_pw_aff_gist_params(
6967                 __isl_take isl_multi_union_pw_aff *aff,
6968                 __isl_take isl_set *context);
6969         __isl_give isl_multi_union_pw_aff *
6970         isl_multi_union_pw_aff_gist(
6971                 __isl_take isl_multi_union_pw_aff *aff,
6972                 __isl_take isl_union_set *context);
6974         #include <isl/polynomial.h>
6975         __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
6976                 __isl_take isl_qpolynomial *qp,
6977                 __isl_take isl_set *context);
6978         __isl_give isl_qpolynomial *isl_qpolynomial_gist(
6979                 __isl_take isl_qpolynomial *qp,
6980                 __isl_take isl_set *context);
6981         __isl_give isl_qpolynomial_fold *
6982         isl_qpolynomial_fold_gist_params(
6983                 __isl_take isl_qpolynomial_fold *fold,
6984                 __isl_take isl_set *context);
6985         __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
6986                 __isl_take isl_qpolynomial_fold *fold,
6987                 __isl_take isl_set *context);
6988         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
6989                 __isl_take isl_pw_qpolynomial *pwqp,
6990                 __isl_take isl_set *context);
6991         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
6992                 __isl_take isl_pw_qpolynomial *pwqp,
6993                 __isl_take isl_set *context);
6994         __isl_give isl_pw_qpolynomial_fold *
6995         isl_pw_qpolynomial_fold_gist(
6996                 __isl_take isl_pw_qpolynomial_fold *pwf,
6997                 __isl_take isl_set *context);
6998         __isl_give isl_pw_qpolynomial_fold *
6999         isl_pw_qpolynomial_fold_gist_params(
7000                 __isl_take isl_pw_qpolynomial_fold *pwf,
7001                 __isl_take isl_set *context);
7002         __isl_give isl_union_pw_qpolynomial *
7003         isl_union_pw_qpolynomial_gist_params(
7004                 __isl_take isl_union_pw_qpolynomial *upwqp,
7005                 __isl_take isl_set *context);
7006         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
7007                 __isl_take isl_union_pw_qpolynomial *upwqp,
7008                 __isl_take isl_union_set *context);
7009         __isl_give isl_union_pw_qpolynomial_fold *
7010         isl_union_pw_qpolynomial_fold_gist(
7011                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7012                 __isl_take isl_union_set *context);
7013         __isl_give isl_union_pw_qpolynomial_fold *
7014         isl_union_pw_qpolynomial_fold_gist_params(
7015                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7016                 __isl_take isl_set *context);
7018 =item * Binary Arithmetic Operations
7020         #include <isl/set.h>
7021         __isl_give isl_set *isl_set_sum(
7022                 __isl_take isl_set *set1,
7023                 __isl_take isl_set *set2);
7024         #include <isl/map.h>
7025         __isl_give isl_map *isl_map_sum(
7026                 __isl_take isl_map *map1,
7027                 __isl_take isl_map *map2);
7029 C<isl_set_sum> computes the Minkowski sum of its two arguments,
7030 i.e., the set containing the sums of pairs of elements from
7031 C<set1> and C<set2>.
7032 The domain of the result of C<isl_map_sum> is the intersection
7033 of the domains of its two arguments.  The corresponding range
7034 elements are the sums of the corresponding range elements
7035 in the two arguments.
7037         #include <isl/val.h>
7038         __isl_give isl_multi_val *isl_multi_val_add(
7039                 __isl_take isl_multi_val *mv1,
7040                 __isl_take isl_multi_val *mv2);
7041         __isl_give isl_multi_val *isl_multi_val_sub(
7042                 __isl_take isl_multi_val *mv1,
7043                 __isl_take isl_multi_val *mv2);
7045         #include <isl/aff.h>
7046         __isl_give isl_aff *isl_aff_add(
7047                 __isl_take isl_aff *aff1,
7048                 __isl_take isl_aff *aff2);
7049         __isl_give isl_multi_aff *isl_multi_aff_add(
7050                 __isl_take isl_multi_aff *maff1,
7051                 __isl_take isl_multi_aff *maff2);
7052         __isl_give isl_pw_aff *isl_pw_aff_add(
7053                 __isl_take isl_pw_aff *pwaff1,
7054                 __isl_take isl_pw_aff *pwaff2);
7055         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add(
7056                 __isl_take isl_multi_pw_aff *mpa1,
7057                 __isl_take isl_multi_pw_aff *mpa2);
7058         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
7059                 __isl_take isl_pw_multi_aff *pma1,
7060                 __isl_take isl_pw_multi_aff *pma2);
7061         __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
7062                 __isl_take isl_union_pw_aff *upa1,
7063                 __isl_take isl_union_pw_aff *upa2);
7064         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
7065                 __isl_take isl_union_pw_multi_aff *upma1,
7066                 __isl_take isl_union_pw_multi_aff *upma2);
7067         __isl_give isl_multi_union_pw_aff *
7068         isl_multi_union_pw_aff_add(
7069                 __isl_take isl_multi_union_pw_aff *mupa1,
7070                 __isl_take isl_multi_union_pw_aff *mupa2);
7071         __isl_give isl_pw_aff *isl_pw_aff_min(
7072                 __isl_take isl_pw_aff *pwaff1,
7073                 __isl_take isl_pw_aff *pwaff2);
7074         __isl_give isl_pw_aff *isl_pw_aff_max(
7075                 __isl_take isl_pw_aff *pwaff1,
7076                 __isl_take isl_pw_aff *pwaff2);
7077         __isl_give isl_aff *isl_aff_sub(
7078                 __isl_take isl_aff *aff1,
7079                 __isl_take isl_aff *aff2);
7080         __isl_give isl_multi_aff *isl_multi_aff_sub(
7081                 __isl_take isl_multi_aff *ma1,
7082                 __isl_take isl_multi_aff *ma2);
7083         __isl_give isl_pw_aff *isl_pw_aff_sub(
7084                 __isl_take isl_pw_aff *pwaff1,
7085                 __isl_take isl_pw_aff *pwaff2);
7086         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
7087                 __isl_take isl_multi_pw_aff *mpa1,
7088                 __isl_take isl_multi_pw_aff *mpa2);
7089         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
7090                 __isl_take isl_pw_multi_aff *pma1,
7091                 __isl_take isl_pw_multi_aff *pma2);
7092         __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
7093                 __isl_take isl_union_pw_aff *upa1,
7094                 __isl_take isl_union_pw_aff *upa2);
7095         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
7096                 __isl_take isl_union_pw_multi_aff *upma1,
7097                 __isl_take isl_union_pw_multi_aff *upma2);
7098         __isl_give isl_multi_union_pw_aff *
7099         isl_multi_union_pw_aff_sub(
7100                 __isl_take isl_multi_union_pw_aff *mupa1,
7101                 __isl_take isl_multi_union_pw_aff *mupa2);
7103 C<isl_aff_sub> subtracts the second argument from the first.
7105         #include <isl/polynomial.h>
7106         __isl_give isl_qpolynomial *isl_qpolynomial_add(
7107                 __isl_take isl_qpolynomial *qp1,
7108                 __isl_take isl_qpolynomial *qp2);
7109         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
7110                 __isl_take isl_pw_qpolynomial *pwqp1,
7111                 __isl_take isl_pw_qpolynomial *pwqp2);
7112         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
7113                 __isl_take isl_pw_qpolynomial *pwqp1,
7114                 __isl_take isl_pw_qpolynomial *pwqp2);
7115         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
7116                 __isl_take isl_pw_qpolynomial_fold *pwf1,
7117                 __isl_take isl_pw_qpolynomial_fold *pwf2);
7118         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
7119                 __isl_take isl_union_pw_qpolynomial *upwqp1,
7120                 __isl_take isl_union_pw_qpolynomial *upwqp2);
7121         __isl_give isl_qpolynomial *isl_qpolynomial_sub(
7122                 __isl_take isl_qpolynomial *qp1,
7123                 __isl_take isl_qpolynomial *qp2);
7124         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
7125                 __isl_take isl_pw_qpolynomial *pwqp1,
7126                 __isl_take isl_pw_qpolynomial *pwqp2);
7127         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
7128                 __isl_take isl_union_pw_qpolynomial *upwqp1,
7129                 __isl_take isl_union_pw_qpolynomial *upwqp2);
7130         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
7131                 __isl_take isl_pw_qpolynomial_fold *pwf1,
7132                 __isl_take isl_pw_qpolynomial_fold *pwf2);
7133         __isl_give isl_union_pw_qpolynomial_fold *
7134         isl_union_pw_qpolynomial_fold_fold(
7135                 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
7136                 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
7138         #include <isl/aff.h>
7139         __isl_give isl_pw_aff *isl_pw_aff_union_add(
7140                 __isl_take isl_pw_aff *pwaff1,
7141                 __isl_take isl_pw_aff *pwaff2);
7142         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
7143                 __isl_take isl_pw_multi_aff *pma1,
7144                 __isl_take isl_pw_multi_aff *pma2);
7145         __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
7146                 __isl_take isl_union_pw_aff *upa1,
7147                 __isl_take isl_union_pw_aff *upa2);
7148         __isl_give isl_union_pw_multi_aff *
7149         isl_union_pw_multi_aff_union_add(
7150                 __isl_take isl_union_pw_multi_aff *upma1,
7151                 __isl_take isl_union_pw_multi_aff *upma2);
7152         __isl_give isl_multi_union_pw_aff *
7153         isl_multi_union_pw_aff_union_add(
7154                 __isl_take isl_multi_union_pw_aff *mupa1,
7155                 __isl_take isl_multi_union_pw_aff *mupa2);
7156         __isl_give isl_pw_aff *isl_pw_aff_union_min(
7157                 __isl_take isl_pw_aff *pwaff1,
7158                 __isl_take isl_pw_aff *pwaff2);
7159         __isl_give isl_pw_aff *isl_pw_aff_union_max(
7160                 __isl_take isl_pw_aff *pwaff1,
7161                 __isl_take isl_pw_aff *pwaff2);
7163 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
7164 expression with a domain that is the union of those of C<pwaff1> and
7165 C<pwaff2> and such that on each cell, the quasi-affine expression is
7166 the maximum of those of C<pwaff1> and C<pwaff2>.  If only one of
7167 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
7168 associated expression is the defined one.
7169 This in contrast to the C<isl_pw_aff_max> function, which is
7170 only defined on the shared definition domain of the arguments.
7172         #include <isl/val.h>
7173         __isl_give isl_multi_val *isl_multi_val_add_val(
7174                 __isl_take isl_multi_val *mv,
7175                 __isl_take isl_val *v);
7176         __isl_give isl_multi_val *isl_multi_val_mod_val(
7177                 __isl_take isl_multi_val *mv,
7178                 __isl_take isl_val *v);
7179         __isl_give isl_multi_val *isl_multi_val_scale_val(
7180                 __isl_take isl_multi_val *mv,
7181                 __isl_take isl_val *v);
7182         __isl_give isl_multi_val *isl_multi_val_scale_down_val(
7183                 __isl_take isl_multi_val *mv,
7184                 __isl_take isl_val *v);
7186         #include <isl/aff.h>
7187         __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
7188                 __isl_take isl_val *mod);
7189         __isl_give isl_pw_aff *isl_pw_aff_mod_val(
7190                 __isl_take isl_pw_aff *pa,
7191                 __isl_take isl_val *mod);
7192         __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
7193                 __isl_take isl_union_pw_aff *upa,
7194                 __isl_take isl_val *f);
7195         __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
7196                 __isl_take isl_val *v);
7197         __isl_give isl_multi_aff *isl_multi_aff_scale_val(
7198                 __isl_take isl_multi_aff *ma,
7199                 __isl_take isl_val *v);
7200         __isl_give isl_pw_aff *isl_pw_aff_scale_val(
7201                 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
7202         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
7203                 __isl_take isl_multi_pw_aff *mpa,
7204                 __isl_take isl_val *v);
7205         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
7206                 __isl_take isl_pw_multi_aff *pma,
7207                 __isl_take isl_val *v);
7208         __isl_give isl_union_pw_multi_aff *
7209         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
7210                 __isl_take isl_union_pw_aff *upa,
7211                 __isl_take isl_val *f);
7212         isl_union_pw_multi_aff_scale_val(
7213                 __isl_take isl_union_pw_multi_aff *upma,
7214                 __isl_take isl_val *val);
7215         __isl_give isl_multi_union_pw_aff *
7216         isl_multi_union_pw_aff_scale_val(
7217                 __isl_take isl_multi_union_pw_aff *mupa,
7218                 __isl_take isl_val *v);
7219         __isl_give isl_aff *isl_aff_scale_down_ui(
7220                 __isl_take isl_aff *aff, unsigned f);
7221         __isl_give isl_aff *isl_aff_scale_down_val(
7222                 __isl_take isl_aff *aff, __isl_take isl_val *v);
7223         __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
7224                 __isl_take isl_multi_aff *ma,
7225                 __isl_take isl_val *v);
7226         __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
7227                 __isl_take isl_pw_aff *pa,
7228                 __isl_take isl_val *f);
7229         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
7230                 __isl_take isl_multi_pw_aff *mpa,
7231                 __isl_take isl_val *v);
7232         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
7233                 __isl_take isl_pw_multi_aff *pma,
7234                 __isl_take isl_val *v);
7235         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
7236                 __isl_take isl_union_pw_aff *upa,
7237                 __isl_take isl_val *v);
7238         __isl_give isl_union_pw_multi_aff *
7239         isl_union_pw_multi_aff_scale_down_val(
7240                 __isl_take isl_union_pw_multi_aff *upma,
7241                 __isl_take isl_val *val);
7242         __isl_give isl_multi_union_pw_aff *
7243         isl_multi_union_pw_aff_scale_down_val(
7244                 __isl_take isl_multi_union_pw_aff *mupa,
7245                 __isl_take isl_val *v);
7247         #include <isl/polynomial.h>
7248         __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
7249                 __isl_take isl_qpolynomial *qp,
7250                 __isl_take isl_val *v);
7251         __isl_give isl_qpolynomial_fold *
7252         isl_qpolynomial_fold_scale_val(
7253                 __isl_take isl_qpolynomial_fold *fold,
7254                 __isl_take isl_val *v);
7255         __isl_give isl_pw_qpolynomial *
7256         isl_pw_qpolynomial_scale_val(
7257                 __isl_take isl_pw_qpolynomial *pwqp,
7258                 __isl_take isl_val *v);
7259         __isl_give isl_pw_qpolynomial_fold *
7260         isl_pw_qpolynomial_fold_scale_val(
7261                 __isl_take isl_pw_qpolynomial_fold *pwf,
7262                 __isl_take isl_val *v);
7263         __isl_give isl_union_pw_qpolynomial *
7264         isl_union_pw_qpolynomial_scale_val(
7265                 __isl_take isl_union_pw_qpolynomial *upwqp,
7266                 __isl_take isl_val *v);
7267         __isl_give isl_union_pw_qpolynomial_fold *
7268         isl_union_pw_qpolynomial_fold_scale_val(
7269                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7270                 __isl_take isl_val *v);
7271         __isl_give isl_qpolynomial *
7272         isl_qpolynomial_scale_down_val(
7273                 __isl_take isl_qpolynomial *qp,
7274                 __isl_take isl_val *v);
7275         __isl_give isl_qpolynomial_fold *
7276         isl_qpolynomial_fold_scale_down_val(
7277                 __isl_take isl_qpolynomial_fold *fold,
7278                 __isl_take isl_val *v);
7279         __isl_give isl_pw_qpolynomial *
7280         isl_pw_qpolynomial_scale_down_val(
7281                 __isl_take isl_pw_qpolynomial *pwqp,
7282                 __isl_take isl_val *v);
7283         __isl_give isl_pw_qpolynomial_fold *
7284         isl_pw_qpolynomial_fold_scale_down_val(
7285                 __isl_take isl_pw_qpolynomial_fold *pwf,
7286                 __isl_take isl_val *v);
7287         __isl_give isl_union_pw_qpolynomial *
7288         isl_union_pw_qpolynomial_scale_down_val(
7289                 __isl_take isl_union_pw_qpolynomial *upwqp,
7290                 __isl_take isl_val *v);
7291         __isl_give isl_union_pw_qpolynomial_fold *
7292         isl_union_pw_qpolynomial_fold_scale_down_val(
7293                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7294                 __isl_take isl_val *v);
7296         #include <isl/val.h>
7297         __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
7298                 __isl_take isl_multi_val *mv1,
7299                 __isl_take isl_multi_val *mv2);
7300         __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
7301                 __isl_take isl_multi_val *mv1,
7302                 __isl_take isl_multi_val *mv2);
7303         __isl_give isl_multi_val *
7304         isl_multi_val_scale_down_multi_val(
7305                 __isl_take isl_multi_val *mv1,
7306                 __isl_take isl_multi_val *mv2);
7308         #include <isl/aff.h>
7309         __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
7310                 __isl_take isl_multi_aff *ma,
7311                 __isl_take isl_multi_val *mv);
7312         __isl_give isl_multi_union_pw_aff *
7313         isl_multi_union_pw_aff_mod_multi_val(
7314                 __isl_take isl_multi_union_pw_aff *upma,
7315                 __isl_take isl_multi_val *mv);
7316         __isl_give isl_multi_pw_aff *
7317         isl_multi_pw_aff_mod_multi_val(
7318                 __isl_take isl_multi_pw_aff *mpa,
7319                 __isl_take isl_multi_val *mv);
7320         __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
7321                 __isl_take isl_multi_aff *ma,
7322                 __isl_take isl_multi_val *mv);
7323         __isl_give isl_pw_multi_aff *
7324         isl_pw_multi_aff_scale_multi_val(
7325                 __isl_take isl_pw_multi_aff *pma,
7326                 __isl_take isl_multi_val *mv);
7327         __isl_give isl_multi_pw_aff *
7328         isl_multi_pw_aff_scale_multi_val(
7329                 __isl_take isl_multi_pw_aff *mpa,
7330                 __isl_take isl_multi_val *mv);
7331         __isl_give isl_multi_union_pw_aff *
7332         isl_multi_union_pw_aff_scale_multi_val(
7333                 __isl_take isl_multi_union_pw_aff *mupa,
7334                 __isl_take isl_multi_val *mv);
7335         __isl_give isl_union_pw_multi_aff *
7336         isl_union_pw_multi_aff_scale_multi_val(
7337                 __isl_take isl_union_pw_multi_aff *upma,
7338                 __isl_take isl_multi_val *mv);
7339         __isl_give isl_multi_aff *
7340         isl_multi_aff_scale_down_multi_val(
7341                 __isl_take isl_multi_aff *ma,
7342                 __isl_take isl_multi_val *mv);
7343         __isl_give isl_multi_pw_aff *
7344         isl_multi_pw_aff_scale_down_multi_val(
7345                 __isl_take isl_multi_pw_aff *mpa,
7346                 __isl_take isl_multi_val *mv);
7347         __isl_give isl_multi_union_pw_aff *
7348         isl_multi_union_pw_aff_scale_down_multi_val(
7349                 __isl_take isl_multi_union_pw_aff *mupa,
7350                 __isl_take isl_multi_val *mv);
7352 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
7353 by the corresponding elements of C<mv>.
7355         #include <isl/aff.h>
7356         __isl_give isl_aff *isl_aff_mul(
7357                 __isl_take isl_aff *aff1,
7358                 __isl_take isl_aff *aff2);
7359         __isl_give isl_aff *isl_aff_div(
7360                 __isl_take isl_aff *aff1,
7361                 __isl_take isl_aff *aff2);
7362         __isl_give isl_pw_aff *isl_pw_aff_mul(
7363                 __isl_take isl_pw_aff *pwaff1,
7364                 __isl_take isl_pw_aff *pwaff2);
7365         __isl_give isl_pw_aff *isl_pw_aff_div(
7366                 __isl_take isl_pw_aff *pa1,
7367                 __isl_take isl_pw_aff *pa2);
7368         __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
7369                 __isl_take isl_pw_aff *pa1,
7370                 __isl_take isl_pw_aff *pa2);
7371         __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
7372                 __isl_take isl_pw_aff *pa1,
7373                 __isl_take isl_pw_aff *pa2);
7375 When multiplying two affine expressions, at least one of the two needs
7376 to be a constant.  Similarly, when dividing an affine expression by another,
7377 the second expression needs to be a constant.
7378 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
7379 rounding towards zero.  C<isl_pw_aff_tdiv_r> computes the corresponding
7380 remainder.
7382         #include <isl/polynomial.h>
7383         __isl_give isl_qpolynomial *isl_qpolynomial_mul(
7384                 __isl_take isl_qpolynomial *qp1,
7385                 __isl_take isl_qpolynomial *qp2);
7386         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
7387                 __isl_take isl_pw_qpolynomial *pwqp1,
7388                 __isl_take isl_pw_qpolynomial *pwqp2);
7389         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
7390                 __isl_take isl_union_pw_qpolynomial *upwqp1,
7391                 __isl_take isl_union_pw_qpolynomial *upwqp2);
7393 =back
7395 =head3 Lexicographic Optimization
7397 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
7398 the following functions
7399 compute a set that contains the lexicographic minimum or maximum
7400 of the elements in C<set> (or C<bset>) for those values of the parameters
7401 that satisfy C<dom>.
7402 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
7403 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
7404 has no elements.
7405 In other words, the union of the parameter values
7406 for which the result is non-empty and of C<*empty>
7407 is equal to C<dom>.
7409         #include <isl/set.h>
7410         __isl_give isl_set *isl_basic_set_partial_lexmin(
7411                 __isl_take isl_basic_set *bset,
7412                 __isl_take isl_basic_set *dom,
7413                 __isl_give isl_set **empty);
7414         __isl_give isl_set *isl_basic_set_partial_lexmax(
7415                 __isl_take isl_basic_set *bset,
7416                 __isl_take isl_basic_set *dom,
7417                 __isl_give isl_set **empty);
7418         __isl_give isl_set *isl_set_partial_lexmin(
7419                 __isl_take isl_set *set, __isl_take isl_set *dom,
7420                 __isl_give isl_set **empty);
7421         __isl_give isl_set *isl_set_partial_lexmax(
7422                 __isl_take isl_set *set, __isl_take isl_set *dom,
7423                 __isl_give isl_set **empty);
7425 Given a (basic) set C<set> (or C<bset>), the following functions simply
7426 return a set containing the lexicographic minimum or maximum
7427 of the elements in C<set> (or C<bset>).
7428 In case of union sets, the optimum is computed per space.
7430         #include <isl/set.h>
7431         __isl_give isl_set *isl_basic_set_lexmin(
7432                 __isl_take isl_basic_set *bset);
7433         __isl_give isl_set *isl_basic_set_lexmax(
7434                 __isl_take isl_basic_set *bset);
7435         __isl_give isl_set *isl_set_lexmin(
7436                 __isl_take isl_set *set);
7437         __isl_give isl_set *isl_set_lexmax(
7438                 __isl_take isl_set *set);
7439         __isl_give isl_union_set *isl_union_set_lexmin(
7440                 __isl_take isl_union_set *uset);
7441         __isl_give isl_union_set *isl_union_set_lexmax(
7442                 __isl_take isl_union_set *uset);
7444 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
7445 the following functions
7446 compute a relation that maps each element of C<dom>
7447 to the single lexicographic minimum or maximum
7448 of the elements that are associated to that same
7449 element in C<map> (or C<bmap>).
7450 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
7451 that contains the elements in C<dom> that do not map
7452 to any elements in C<map> (or C<bmap>).
7453 In other words, the union of the domain of the result and of C<*empty>
7454 is equal to C<dom>.
7456         #include <isl/map.h>
7457         __isl_give isl_map *isl_basic_map_partial_lexmax(
7458                 __isl_take isl_basic_map *bmap,
7459                 __isl_take isl_basic_set *dom,
7460                 __isl_give isl_set **empty);
7461         __isl_give isl_map *isl_basic_map_partial_lexmin(
7462                 __isl_take isl_basic_map *bmap,
7463                 __isl_take isl_basic_set *dom,
7464                 __isl_give isl_set **empty);
7465         __isl_give isl_map *isl_map_partial_lexmax(
7466                 __isl_take isl_map *map, __isl_take isl_set *dom,
7467                 __isl_give isl_set **empty);
7468         __isl_give isl_map *isl_map_partial_lexmin(
7469                 __isl_take isl_map *map, __isl_take isl_set *dom,
7470                 __isl_give isl_set **empty);
7472 Given a (basic) map C<map> (or C<bmap>), the following functions simply
7473 return a map mapping each element in the domain of
7474 C<map> (or C<bmap>) to the lexicographic minimum or maximum
7475 of all elements associated to that element.
7476 In case of union relations, the optimum is computed per space.
7478         #include <isl/map.h>
7479         __isl_give isl_map *isl_basic_map_lexmin(
7480                 __isl_take isl_basic_map *bmap);
7481         __isl_give isl_map *isl_basic_map_lexmax(
7482                 __isl_take isl_basic_map *bmap);
7483         __isl_give isl_map *isl_map_lexmin(
7484                 __isl_take isl_map *map);
7485         __isl_give isl_map *isl_map_lexmax(
7486                 __isl_take isl_map *map);
7487         __isl_give isl_union_map *isl_union_map_lexmin(
7488                 __isl_take isl_union_map *umap);
7489         __isl_give isl_union_map *isl_union_map_lexmax(
7490                 __isl_take isl_union_map *umap);
7492 The following functions return their result in the form of
7493 a piecewise multi-affine expression,
7494 but are otherwise equivalent to the corresponding functions
7495 returning a basic set or relation.
7497         #include <isl/set.h>
7498         __isl_give isl_pw_multi_aff *
7499         isl_basic_set_partial_lexmin_pw_multi_aff(
7500                 __isl_take isl_basic_set *bset,
7501                 __isl_take isl_basic_set *dom,
7502                 __isl_give isl_set **empty);
7503         __isl_give isl_pw_multi_aff *
7504         isl_basic_set_partial_lexmax_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 *isl_set_lexmin_pw_multi_aff(
7509                 __isl_take isl_set *set);
7510         __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
7511                 __isl_take isl_set *set);
7513         #include <isl/map.h>
7514         __isl_give isl_pw_multi_aff *
7515         isl_basic_map_lexmin_pw_multi_aff(
7516                 __isl_take isl_basic_map *bmap);
7517         __isl_give isl_pw_multi_aff *
7518         isl_basic_map_partial_lexmin_pw_multi_aff(
7519                 __isl_take isl_basic_map *bmap,
7520                 __isl_take isl_basic_set *dom,
7521                 __isl_give isl_set **empty);
7522         __isl_give isl_pw_multi_aff *
7523         isl_basic_map_partial_lexmax_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 *isl_map_lexmin_pw_multi_aff(
7528                 __isl_take isl_map *map);
7529         __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
7530                 __isl_take isl_map *map);
7532 The following functions return the lexicographic minimum or maximum
7533 on the shared domain of the inputs and the single defined function
7534 on those parts of the domain where only a single function is defined.
7536         #include <isl/aff.h>
7537         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
7538                 __isl_take isl_pw_multi_aff *pma1,
7539                 __isl_take isl_pw_multi_aff *pma2);
7540         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
7541                 __isl_take isl_pw_multi_aff *pma1,
7542                 __isl_take isl_pw_multi_aff *pma2);
7544 If the input to a lexicographic optimization problem has
7545 multiple constraints with the same coefficients for the optimized
7546 variables, then, by default, this symmetry is exploited by
7547 replacing those constraints by a single constraint with
7548 an abstract bound, which is in turn bounded by the corresponding terms
7549 in the original constraints.
7550 Without this optimization, the solver would typically consider
7551 all possible orderings of those original bounds, resulting in a needless
7552 decomposition of the domain.
7553 However, the optimization can also result in slowdowns since
7554 an extra parameter is introduced that may get used in additional
7555 integer divisions.
7556 The following option determines whether symmetry detection is applied
7557 during lexicographic optimization.
7559         #include <isl/options.h>
7560         isl_stat isl_options_set_pip_symmetry(isl_ctx *ctx,
7561                 int val);
7562         int isl_options_get_pip_symmetry(isl_ctx *ctx);
7564 =begin latex
7566 See also \autoref{s:offline}.
7568 =end latex
7570 =head2 Ternary Operations
7572         #include <isl/aff.h>
7573         __isl_give isl_pw_aff *isl_pw_aff_cond(
7574                 __isl_take isl_pw_aff *cond,
7575                 __isl_take isl_pw_aff *pwaff_true,
7576                 __isl_take isl_pw_aff *pwaff_false);
7578 The function C<isl_pw_aff_cond> performs a conditional operator
7579 and returns an expression that is equal to C<pwaff_true>
7580 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
7581 where C<cond> is zero.
7583 =head2 Lists
7585 Lists are defined over several element types, including
7586 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_union_pw_aff>,
7587 C<isl_union_pw_multi_aff>, C<isl_constraint>,
7588 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
7589 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
7590 Here we take lists of C<isl_set>s as an example.
7591 Lists can be created, copied, modified and freed using the following functions.
7593         #include <isl/set.h>
7594         __isl_give isl_set_list *isl_set_list_from_set(
7595                 __isl_take isl_set *el);
7596         __isl_give isl_set_list *isl_set_list_alloc(
7597                 isl_ctx *ctx, int n);
7598         __isl_give isl_set_list *isl_set_list_copy(
7599                 __isl_keep isl_set_list *list);
7600         __isl_give isl_set_list *isl_set_list_insert(
7601                 __isl_take isl_set_list *list, unsigned pos,
7602                 __isl_take isl_set *el);
7603         __isl_give isl_set_list *isl_set_list_add(
7604                 __isl_take isl_set_list *list,
7605                 __isl_take isl_set *el);
7606         __isl_give isl_set_list *isl_set_list_drop(
7607                 __isl_take isl_set_list *list,
7608                 unsigned first, unsigned n);
7609         __isl_give isl_set_list *isl_set_list_set_set(
7610                 __isl_take isl_set_list *list, int index,
7611                 __isl_take isl_set *set);
7612         __isl_give isl_set_list *isl_set_list_concat(
7613                 __isl_take isl_set_list *list1,
7614                 __isl_take isl_set_list *list2);
7615         __isl_give isl_set_list *isl_set_list_map(
7616                 __isl_take isl_set_list *list,
7617                 __isl_give isl_set *(*fn)(__isl_take isl_set *el,
7618                         void *user),
7619                 void *user);
7620         __isl_give isl_set_list *isl_set_list_sort(
7621                 __isl_take isl_set_list *list,
7622                 int (*cmp)(__isl_keep isl_set *a,
7623                         __isl_keep isl_set *b, void *user),
7624                 void *user);
7625         __isl_null isl_set_list *isl_set_list_free(
7626                 __isl_take isl_set_list *list);
7628 C<isl_set_list_alloc> creates an empty list with an initial capacity
7629 for C<n> elements.  C<isl_set_list_insert> and C<isl_set_list_add>
7630 add elements to a list, increasing its capacity as needed.
7631 C<isl_set_list_from_set> creates a list with a single element.
7633 Lists can be inspected using the following functions.
7635         #include <isl/set.h>
7636         int isl_set_list_n_set(__isl_keep isl_set_list *list);
7637         __isl_give isl_set *isl_set_list_get_set(
7638                 __isl_keep isl_set_list *list, int index);
7639         isl_stat isl_set_list_foreach(__isl_keep isl_set_list *list,
7640                 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7641                 void *user);
7642         isl_stat isl_set_list_foreach_scc(
7643                 __isl_keep isl_set_list *list,
7644                 isl_bool (*follows)(__isl_keep isl_set *a,
7645                         __isl_keep isl_set *b, void *user),
7646                 void *follows_user,
7647                 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7648                 void *fn_user);
7650 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
7651 strongly connected components of the graph with as vertices the elements
7652 of C<list> and a directed edge from vertex C<b> to vertex C<a>
7653 iff C<follows(a, b)> returns C<isl_bool_true>.  The callbacks C<follows> and
7654 C<fn> should return C<isl_bool_error> or C<isl_stat_error> on error.
7656 Lists can be printed using
7658         #include <isl/set.h>
7659         __isl_give isl_printer *isl_printer_print_set_list(
7660                 __isl_take isl_printer *p,
7661                 __isl_keep isl_set_list *list);
7663 =head2 Associative arrays
7665 Associative arrays map isl objects of a specific type to isl objects
7666 of some (other) specific type.  They are defined for several pairs
7667 of types, including (C<isl_map>, C<isl_basic_set>),
7668 (C<isl_id>, C<isl_ast_expr>),
7669 (C<isl_id>, C<isl_id>) and
7670 (C<isl_id>, C<isl_pw_aff>).
7671 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
7672 as an example.
7674 Associative arrays can be created, copied and freed using
7675 the following functions.
7677         #include <isl/id_to_ast_expr.h>
7678         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
7679                 isl_ctx *ctx, int min_size);
7680         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
7681                 __isl_keep isl_id_to_ast_expr *id2expr);
7682         __isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
7683                 __isl_take isl_id_to_ast_expr *id2expr);
7685 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
7686 to specify the expected size of the associative array.
7687 The associative array will be grown automatically as needed.
7689 Associative arrays can be inspected using the following functions.
7691         #include <isl/id_to_ast_expr.h>
7692         __isl_give isl_maybe_isl_ast_expr
7693         isl_id_to_ast_expr_try_get(
7694                 __isl_keep isl_id_to_ast_expr *id2expr,
7695                 __isl_keep isl_id *key);
7696         isl_bool isl_id_to_ast_expr_has(
7697                 __isl_keep isl_id_to_ast_expr *id2expr,
7698                 __isl_keep isl_id *key);
7699         __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
7700                 __isl_keep isl_id_to_ast_expr *id2expr,
7701                 __isl_take isl_id *key);
7702         isl_stat isl_id_to_ast_expr_foreach(
7703                 __isl_keep isl_id_to_ast_expr *id2expr,
7704                 isl_stat (*fn)(__isl_take isl_id *key,
7705                         __isl_take isl_ast_expr *val, void *user),
7706                 void *user);
7708 The function C<isl_id_to_ast_expr_try_get> returns a structure
7709 containing two elements, C<valid> and C<value>.
7710 If there is a value associated to the key, then C<valid>
7711 is set to C<isl_bool_true> and C<value> contains a copy of
7712 the associated value.  Otherwise C<value> is C<NULL> and
7713 C<valid> may be C<isl_bool_error> or C<isl_bool_false> depending
7714 on whether some error has occurred or there simply is no associated value.
7715 The function C<isl_id_to_ast_expr_has> returns the C<valid> field
7716 in the structure and
7717 the function C<isl_id_to_ast_expr_get> returns the C<value> field.
7719 Associative arrays can be modified using the following functions.
7721         #include <isl/id_to_ast_expr.h>
7722         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
7723                 __isl_take isl_id_to_ast_expr *id2expr,
7724                 __isl_take isl_id *key,
7725                 __isl_take isl_ast_expr *val);
7726         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
7727                 __isl_take isl_id_to_ast_expr *id2expr,
7728                 __isl_take isl_id *key);
7730 Associative arrays can be printed using the following function.
7732         #include <isl/id_to_ast_expr.h>
7733         __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
7734                 __isl_take isl_printer *p,
7735                 __isl_keep isl_id_to_ast_expr *id2expr);
7737 =head2 Vectors
7739 Vectors can be created, copied and freed using the following functions.
7741         #include <isl/vec.h>
7742         __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
7743                 unsigned size);
7744         __isl_give isl_vec *isl_vec_zero(isl_ctx *ctx,
7745                 unsigned size);
7746         __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
7747         __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
7749 Note that the elements of a vector created by C<isl_vec_alloc>
7750 may have arbitrary values.
7751 A vector created by C<isl_vec_zero> has elements with value zero.
7752 The elements can be changed and inspected using the following functions.
7754         int isl_vec_size(__isl_keep isl_vec *vec);
7755         __isl_give isl_val *isl_vec_get_element_val(
7756                 __isl_keep isl_vec *vec, int pos);
7757         __isl_give isl_vec *isl_vec_set_element_si(
7758                 __isl_take isl_vec *vec, int pos, int v);
7759         __isl_give isl_vec *isl_vec_set_element_val(
7760                 __isl_take isl_vec *vec, int pos,
7761                 __isl_take isl_val *v);
7762         __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
7763                 int v);
7764         __isl_give isl_vec *isl_vec_set_val(
7765                 __isl_take isl_vec *vec, __isl_take isl_val *v);
7766         int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
7767                 __isl_keep isl_vec *vec2, int pos);
7769 C<isl_vec_get_element> will return a negative value if anything went wrong.
7770 In that case, the value of C<*v> is undefined.
7772 The following function can be used to concatenate two vectors.
7774         __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
7775                 __isl_take isl_vec *vec2);
7777 =head2 Matrices
7779 Matrices can be created, copied and freed using the following functions.
7781         #include <isl/mat.h>
7782         __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
7783                 unsigned n_row, unsigned n_col);
7784         __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
7785         __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
7787 Note that the elements of a newly created matrix may have arbitrary values.
7788 The elements can be changed and inspected using the following functions.
7790         int isl_mat_rows(__isl_keep isl_mat *mat);
7791         int isl_mat_cols(__isl_keep isl_mat *mat);
7792         __isl_give isl_val *isl_mat_get_element_val(
7793                 __isl_keep isl_mat *mat, int row, int col);
7794         __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
7795                 int row, int col, int v);
7796         __isl_give isl_mat *isl_mat_set_element_val(
7797                 __isl_take isl_mat *mat, int row, int col,
7798                 __isl_take isl_val *v);
7800 The following function computes the rank of a matrix.
7801 The return value may be -1 if some error occurred.
7803         #include <isl/mat.h>
7804         int isl_mat_rank(__isl_keep isl_mat *mat);
7806 The following function can be used to compute the (right) inverse
7807 of a matrix, i.e., a matrix such that the product of the original
7808 and the inverse (in that order) is a multiple of the identity matrix.
7809 The input matrix is assumed to be of full row-rank.
7811         __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
7813 The following function can be used to compute the (right) kernel
7814 (or null space) of a matrix, i.e., a matrix such that the product of
7815 the original and the kernel (in that order) is the zero matrix.
7817         __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
7819 The following function computes a basis for the space spanned
7820 by the rows of a matrix.
7822         __isl_give isl_mat *isl_mat_row_basis(
7823                 __isl_take isl_mat *mat);
7825 The following function computes rows that extend a basis of C<mat1>
7826 to a basis that also covers C<mat2>.
7828         __isl_give isl_mat *isl_mat_row_basis_extension(
7829                 __isl_take isl_mat *mat1,
7830                 __isl_take isl_mat *mat2);
7832 The following function checks whether there is no linear dependence
7833 among the combined rows of "mat1" and "mat2" that is not already present
7834 in "mat1" or "mat2" individually.
7835 If "mat1" and "mat2" have linearly independent rows by themselves,
7836 then this means that there is no linear dependence among all rows together.
7838         isl_bool isl_mat_has_linearly_independent_rows(
7839                 __isl_keep isl_mat *mat1,
7840                 __isl_keep isl_mat *mat2);
7842 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
7844 The following functions determine
7845 an upper or lower bound on a quasipolynomial over its domain.
7847         __isl_give isl_pw_qpolynomial_fold *
7848         isl_pw_qpolynomial_bound(
7849                 __isl_take isl_pw_qpolynomial *pwqp,
7850                 enum isl_fold type, int *tight);
7852         __isl_give isl_union_pw_qpolynomial_fold *
7853         isl_union_pw_qpolynomial_bound(
7854                 __isl_take isl_union_pw_qpolynomial *upwqp,
7855                 enum isl_fold type, int *tight);
7857 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
7858 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
7859 is the returned bound is known be tight, i.e., for each value
7860 of the parameters there is at least
7861 one element in the domain that reaches the bound.
7862 If the domain of C<pwqp> is not wrapping, then the bound is computed
7863 over all elements in that domain and the result has a purely parametric
7864 domain.  If the domain of C<pwqp> is wrapping, then the bound is
7865 computed over the range of the wrapped relation.  The domain of the
7866 wrapped relation becomes the domain of the result.
7868 =head2 Parametric Vertex Enumeration
7870 The parametric vertex enumeration described in this section
7871 is mainly intended to be used internally and by the C<barvinok>
7872 library.
7874         #include <isl/vertices.h>
7875         __isl_give isl_vertices *isl_basic_set_compute_vertices(
7876                 __isl_keep isl_basic_set *bset);
7878 The function C<isl_basic_set_compute_vertices> performs the
7879 actual computation of the parametric vertices and the chamber
7880 decomposition and stores the result in an C<isl_vertices> object.
7881 This information can be queried by either iterating over all
7882 the vertices or iterating over all the chambers or cells
7883 and then iterating over all vertices that are active on the chamber.
7885         isl_stat isl_vertices_foreach_vertex(
7886                 __isl_keep isl_vertices *vertices,
7887                 isl_stat (*fn)(__isl_take isl_vertex *vertex,
7888                         void *user), void *user);
7890         isl_stat isl_vertices_foreach_cell(
7891                 __isl_keep isl_vertices *vertices,
7892                 isl_stat (*fn)(__isl_take isl_cell *cell,
7893                         void *user), void *user);
7894         isl_stat isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
7895                 isl_stat (*fn)(__isl_take isl_vertex *vertex,
7896                         void *user), void *user);
7898 Other operations that can be performed on an C<isl_vertices> object are
7899 the following.
7901         int isl_vertices_get_n_vertices(
7902                 __isl_keep isl_vertices *vertices);
7903         __isl_null isl_vertices *isl_vertices_free(
7904                 __isl_take isl_vertices *vertices);
7906 Vertices can be inspected and destroyed using the following functions.
7908         int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
7909         __isl_give isl_basic_set *isl_vertex_get_domain(
7910                 __isl_keep isl_vertex *vertex);
7911         __isl_give isl_multi_aff *isl_vertex_get_expr(
7912                 __isl_keep isl_vertex *vertex);
7913         void isl_vertex_free(__isl_take isl_vertex *vertex);
7915 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
7916 describing the vertex in terms of the parameters,
7917 while C<isl_vertex_get_domain> returns the activity domain
7918 of the vertex.
7920 Chambers can be inspected and destroyed using the following functions.
7922         __isl_give isl_basic_set *isl_cell_get_domain(
7923                 __isl_keep isl_cell *cell);
7924         void isl_cell_free(__isl_take isl_cell *cell);
7926 =head1 Polyhedral Compilation Library
7928 This section collects functionality in C<isl> that has been specifically
7929 designed for use during polyhedral compilation.
7931 =head2 Schedule Trees
7933 A schedule tree is a structured representation of a schedule,
7934 assigning a relative order to a set of domain elements.
7935 The relative order expressed by the schedule tree is
7936 defined recursively.  In particular, the order between
7937 two domain elements is determined by the node that is closest
7938 to the root that refers to both elements and that orders them apart.
7939 Each node in the tree is of one of several types.
7940 The root node is always of type C<isl_schedule_node_domain>
7941 (or C<isl_schedule_node_extension>)
7942 and it describes the (extra) domain elements to which the schedule applies.
7943 The other types of nodes are as follows.
7945 =over
7947 =item C<isl_schedule_node_band>
7949 A band of schedule dimensions.  Each schedule dimension is represented
7950 by a union piecewise quasi-affine expression.  If this expression
7951 assigns a different value to two domain elements, while all previous
7952 schedule dimensions in the same band assign them the same value,
7953 then the two domain elements are ordered according to these two
7954 different values.
7955 Each expression is required to be total in the domain elements
7956 that reach the band node.
7958 =item C<isl_schedule_node_expansion>
7960 An expansion node maps each of the domain elements that reach the node
7961 to one or more domain elements.  The image of this mapping forms
7962 the set of domain elements that reach the child of the expansion node.
7963 The function that maps each of the expanded domain elements
7964 to the original domain element from which it was expanded
7965 is called the contraction.
7967 =item C<isl_schedule_node_filter>
7969 A filter node does not impose any ordering, but rather intersects
7970 the set of domain elements that the current subtree refers to
7971 with a given union set.  The subtree of the filter node only
7972 refers to domain elements in the intersection.
7973 A filter node is typically only used as a child of a sequence or
7974 set node.
7976 =item C<isl_schedule_node_leaf>
7978 A leaf of the schedule tree.  Leaf nodes do not impose any ordering.
7980 =item C<isl_schedule_node_mark>
7982 A mark node can be used to attach any kind of information to a subtree
7983 of the schedule tree.
7985 =item C<isl_schedule_node_sequence>
7987 A sequence node has one or more children, each of which is a filter node.
7988 The filters on these filter nodes form a partition of
7989 the domain elements that the current subtree refers to.
7990 If two domain elements appear in distinct filters then the sequence
7991 node orders them according to the child positions of the corresponding
7992 filter nodes.
7994 =item C<isl_schedule_node_set>
7996 A set node is similar to a sequence node, except that
7997 it expresses that domain elements appearing in distinct filters
7998 may have any order.  The order of the children of a set node
7999 is therefore also immaterial.
8001 =back
8003 The following node types are only supported by the AST generator.
8005 =over
8007 =item C<isl_schedule_node_context>
8009 The context describes constraints on the parameters and
8010 the schedule dimensions of outer
8011 bands that the AST generator may assume to hold.  It is also the only
8012 kind of node that may introduce additional parameters.
8013 The space of the context is that of the flat product of the outer
8014 band nodes.  In particular, if there are no outer band nodes, then
8015 this space is the unnamed zero-dimensional space.
8016 Since a context node references the outer band nodes, any tree
8017 containing a context node is considered to be anchored.
8019 =item C<isl_schedule_node_extension>
8021 An extension node instructs the AST generator to add additional
8022 domain elements that need to be scheduled.
8023 The additional domain elements are described by the range of
8024 the extension map in terms of the outer schedule dimensions,
8025 i.e., the flat product of the outer band nodes.
8026 Note that domain elements are added whenever the AST generator
8027 reaches the extension node, meaning that there are still some
8028 active domain elements for which an AST needs to be generated.
8029 The conditions under which some domain elements are still active
8030 may however not be completely described by the outer AST nodes
8031 generated at that point.
8032 Since an extension node references the outer band nodes, any tree
8033 containing an extension node is considered to be anchored.
8035 An extension node may also appear as the root of a schedule tree,
8036 when it is intended to be inserted into another tree
8037 using C<isl_schedule_node_graft_before> or C<isl_schedule_node_graft_after>.
8038 In this case, the domain of the extension node should
8039 correspond to the flat product of the outer band nodes
8040 in this other schedule tree at the point where the extension tree
8041 will be inserted.
8043 =item C<isl_schedule_node_guard>
8045 The guard describes constraints on the parameters and
8046 the schedule dimensions of outer
8047 bands that need to be enforced by the outer nodes
8048 in the generated AST.
8049 That is, the part of the AST that is generated from descendants
8050 of the guard node can assume that these constraints are satisfied.
8051 The space of the guard is that of the flat product of the outer
8052 band nodes.  In particular, if there are no outer band nodes, then
8053 this space is the unnamed zero-dimensional space.
8054 Since a guard node references the outer band nodes, any tree
8055 containing a guard node is considered to be anchored.
8057 =back
8059 Except for the C<isl_schedule_node_context> nodes,
8060 none of the nodes may introduce any parameters that were not
8061 already present in the root domain node.
8063 A schedule tree is encapsulated in an C<isl_schedule> object.
8064 The simplest such objects, those with a tree consisting of single domain node,
8065 can be created using the following functions with either an empty
8066 domain or a given domain.
8068         #include <isl/schedule.h>
8069         __isl_give isl_schedule *isl_schedule_empty(
8070                 __isl_take isl_space *space);
8071         __isl_give isl_schedule *isl_schedule_from_domain(
8072                 __isl_take isl_union_set *domain);
8074 The function C<isl_schedule_constraints_compute_schedule> described
8075 in L</"Scheduling"> can also be used to construct schedules.
8077 C<isl_schedule> objects may be copied and freed using the following functions.
8079         #include <isl/schedule.h>
8080         __isl_give isl_schedule *isl_schedule_copy(
8081                 __isl_keep isl_schedule *sched);
8082         __isl_null isl_schedule *isl_schedule_free(
8083                 __isl_take isl_schedule *sched);
8085 The following functions checks whether two C<isl_schedule> objects
8086 are obviously the same.
8088         #include <isl/schedule.h>
8089         isl_bool isl_schedule_plain_is_equal(
8090                 __isl_keep isl_schedule *schedule1,
8091                 __isl_keep isl_schedule *schedule2);
8093 The domain of the schedule, i.e., the domain described by the root node,
8094 can be obtained using the following function.
8096         #include <isl/schedule.h>
8097         __isl_give isl_union_set *isl_schedule_get_domain(
8098                 __isl_keep isl_schedule *schedule);
8100 An extra top-level band node (right underneath the domain node) can
8101 be introduced into the schedule using the following function.
8102 The schedule tree is assumed not to have any anchored nodes.
8104         #include <isl/schedule.h>
8105         __isl_give isl_schedule *
8106         isl_schedule_insert_partial_schedule(
8107                 __isl_take isl_schedule *schedule,
8108                 __isl_take isl_multi_union_pw_aff *partial);
8110 A top-level context node (right underneath the domain node) can
8111 be introduced into the schedule using the following function.
8113         #include <isl/schedule.h>
8114         __isl_give isl_schedule *isl_schedule_insert_context(
8115                 __isl_take isl_schedule *schedule,
8116                 __isl_take isl_set *context)
8118 A top-level guard node (right underneath the domain node) can
8119 be introduced into the schedule using the following function.
8121         #include <isl/schedule.h>
8122         __isl_give isl_schedule *isl_schedule_insert_guard(
8123                 __isl_take isl_schedule *schedule,
8124                 __isl_take isl_set *guard)
8126 A schedule that combines two schedules either in the given
8127 order or in an arbitrary order, i.e., with an C<isl_schedule_node_sequence>
8128 or an C<isl_schedule_node_set> node,
8129 can be created using the following functions.
8131         #include <isl/schedule.h>
8132         __isl_give isl_schedule *isl_schedule_sequence(
8133                 __isl_take isl_schedule *schedule1,
8134                 __isl_take isl_schedule *schedule2);
8135         __isl_give isl_schedule *isl_schedule_set(
8136                 __isl_take isl_schedule *schedule1,
8137                 __isl_take isl_schedule *schedule2);
8139 The domains of the two input schedules need to be disjoint.
8141 The following function can be used to restrict the domain
8142 of a schedule with a domain node as root to be a subset of the given union set.
8143 This operation may remove nodes in the tree that have become
8144 redundant.
8146         #include <isl/schedule.h>
8147         __isl_give isl_schedule *isl_schedule_intersect_domain(
8148                 __isl_take isl_schedule *schedule,
8149                 __isl_take isl_union_set *domain);
8151 The following function can be used to simplify the domain
8152 of a schedule with a domain node as root with respect to the given
8153 parameter domain.
8155         #include <isl/schedule.h>
8156         __isl_give isl_schedule *isl_schedule_gist_domain_params(
8157                 __isl_take isl_schedule *schedule,
8158                 __isl_take isl_set *context);
8160 The following function resets the user pointers on all parameter
8161 and tuple identifiers referenced by the nodes of the given schedule.
8163         #include <isl/schedule.h>
8164         __isl_give isl_schedule *isl_schedule_reset_user(
8165                 __isl_take isl_schedule *schedule);
8167 The following function aligns the parameters of all nodes
8168 in the given schedule to the given space.
8170         #include <isl/schedule.h>
8171         __isl_give isl_schedule *isl_schedule_align_params(
8172                 __isl_take isl_schedule *schedule,
8173                 __isl_take isl_space *space);
8175 The following function allows the user to plug in a given function
8176 in the iteration domains.  The input schedule is not allowed to contain
8177 any expansion nodes.
8179         #include <isl/schedule.h>
8180         __isl_give isl_schedule *
8181         isl_schedule_pullback_union_pw_multi_aff(
8182                 __isl_take isl_schedule *schedule,
8183                 __isl_take isl_union_pw_multi_aff *upma);
8185 The following function can be used to plug in the schedule C<expansion>
8186 in the leaves of C<schedule>, where C<contraction> describes how
8187 the domain elements of C<expansion> map to the domain elements
8188 at the original leaves of C<schedule>.
8189 The resulting schedule will contain expansion nodes, unless
8190 C<contraction> is an identity function.
8192         #include <isl/schedule.h>
8193         __isl_give isl_schedule *isl_schedule_expand(
8194                 __isl_take isl_schedule *schedule,
8195                 __isl_take isl_union_pw_multi_aff *contraction,
8196                 __isl_take isl_schedule *expansion);
8198 An C<isl_union_map> representation of the schedule can be obtained
8199 from an C<isl_schedule> using the following function.
8201         #include <isl/schedule.h>
8202         __isl_give isl_union_map *isl_schedule_get_map(
8203                 __isl_keep isl_schedule *sched);
8205 The resulting relation encodes the same relative ordering as
8206 the schedule by mapping the domain elements to a common schedule space.
8207 If the schedule_separate_components option is set, then the order
8208 of the children of a set node is explicitly encoded in the result.
8209 If the tree contains any expansion nodes, then the relation
8210 is formulated in terms of the expanded domain elements.
8212 Schedules can be read from input using the following functions.
8214         #include <isl/schedule.h>
8215         __isl_give isl_schedule *isl_schedule_read_from_file(
8216                 isl_ctx *ctx, FILE *input);
8217         __isl_give isl_schedule *isl_schedule_read_from_str(
8218                 isl_ctx *ctx, const char *str);
8220 A representation of the schedule can be printed using
8222         #include <isl/schedule.h>
8223         __isl_give isl_printer *isl_printer_print_schedule(
8224                 __isl_take isl_printer *p,
8225                 __isl_keep isl_schedule *schedule);
8226         __isl_give char *isl_schedule_to_str(
8227                 __isl_keep isl_schedule *schedule);
8229 C<isl_schedule_to_str> prints the schedule in flow format.
8231 The schedule tree can be traversed through the use of
8232 C<isl_schedule_node> objects that point to a particular
8233 position in the schedule tree.  Whenever a C<isl_schedule_node>
8234 is used to modify a node in the schedule tree, the original schedule
8235 tree is left untouched and the modifications are performed to a copy
8236 of the tree.  The returned C<isl_schedule_node> then points to
8237 this modified copy of the tree.
8239 The root of the schedule tree can be obtained using the following function.
8241         #include <isl/schedule.h>
8242         __isl_give isl_schedule_node *isl_schedule_get_root(
8243                 __isl_keep isl_schedule *schedule);
8245 A pointer to a newly created schedule tree with a single domain
8246 node can be created using the following functions.
8248         #include <isl/schedule_node.h>
8249         __isl_give isl_schedule_node *
8250         isl_schedule_node_from_domain(
8251                 __isl_take isl_union_set *domain);
8252         __isl_give isl_schedule_node *
8253         isl_schedule_node_from_extension(
8254                 __isl_take isl_union_map *extension);
8256 C<isl_schedule_node_from_extension> creates a tree with an extension
8257 node as root.
8259 Schedule nodes can be copied and freed using the following functions.
8261         #include <isl/schedule_node.h>
8262         __isl_give isl_schedule_node *isl_schedule_node_copy(
8263                 __isl_keep isl_schedule_node *node);
8264         __isl_null isl_schedule_node *isl_schedule_node_free(
8265                 __isl_take isl_schedule_node *node);
8267 The following functions can be used to check if two schedule
8268 nodes point to the same position in the same schedule.
8270         #include <isl/schedule_node.h>
8271         isl_bool isl_schedule_node_is_equal(
8272                 __isl_keep isl_schedule_node *node1,
8273                 __isl_keep isl_schedule_node *node2);
8275 The following properties can be obtained from a schedule node.
8277         #include <isl/schedule_node.h>
8278         enum isl_schedule_node_type isl_schedule_node_get_type(
8279                 __isl_keep isl_schedule_node *node);
8280         enum isl_schedule_node_type
8281         isl_schedule_node_get_parent_type(
8282                 __isl_keep isl_schedule_node *node);
8283         __isl_give isl_schedule *isl_schedule_node_get_schedule(
8284                 __isl_keep isl_schedule_node *node);
8286 The function C<isl_schedule_node_get_type> returns the type of
8287 the node, while C<isl_schedule_node_get_parent_type> returns
8288 type of the parent of the node, which is required to exist.
8289 The function C<isl_schedule_node_get_schedule> returns a copy
8290 to the schedule to which the node belongs.
8292 The following functions can be used to move the schedule node
8293 to a different position in the tree or to check if such a position
8294 exists.
8296         #include <isl/schedule_node.h>
8297         isl_bool isl_schedule_node_has_parent(
8298                 __isl_keep isl_schedule_node *node);
8299         __isl_give isl_schedule_node *isl_schedule_node_parent(
8300                 __isl_take isl_schedule_node *node);
8301         __isl_give isl_schedule_node *isl_schedule_node_root(
8302                 __isl_take isl_schedule_node *node);
8303         __isl_give isl_schedule_node *isl_schedule_node_ancestor(
8304                 __isl_take isl_schedule_node *node,
8305                 int generation);
8306         int isl_schedule_node_n_children(
8307                 __isl_keep isl_schedule_node *node);
8308         __isl_give isl_schedule_node *isl_schedule_node_child(
8309                 __isl_take isl_schedule_node *node, int pos);
8310         isl_bool isl_schedule_node_has_children(
8311                 __isl_keep isl_schedule_node *node);
8312         __isl_give isl_schedule_node *isl_schedule_node_first_child(
8313                 __isl_take isl_schedule_node *node);
8314         isl_bool isl_schedule_node_has_previous_sibling(
8315                 __isl_keep isl_schedule_node *node);
8316         __isl_give isl_schedule_node *
8317         isl_schedule_node_previous_sibling(
8318                 __isl_take isl_schedule_node *node);
8319         isl_bool isl_schedule_node_has_next_sibling(
8320                 __isl_keep isl_schedule_node *node);
8321         __isl_give isl_schedule_node *
8322         isl_schedule_node_next_sibling(
8323                 __isl_take isl_schedule_node *node);
8325 For C<isl_schedule_node_ancestor>, the ancestor of generation 0
8326 is the node itself, the ancestor of generation 1 is its parent and so on.
8328 It is also possible to query the number of ancestors of a node,
8329 the position of the current node
8330 within the children of its parent, the position of the subtree
8331 containing a node within the children of an ancestor
8332 or to obtain a copy of a given
8333 child without destroying the current node.
8334 Given two nodes that point to the same schedule, their closest
8335 shared ancestor can be obtained using
8336 C<isl_schedule_node_get_shared_ancestor>.
8338         #include <isl/schedule_node.h>
8339         int isl_schedule_node_get_tree_depth(
8340                 __isl_keep isl_schedule_node *node);
8341         int isl_schedule_node_get_child_position(
8342                 __isl_keep isl_schedule_node *node);
8343         int isl_schedule_node_get_ancestor_child_position(
8344                 __isl_keep isl_schedule_node *node,
8345                 __isl_keep isl_schedule_node *ancestor);
8346         __isl_give isl_schedule_node *isl_schedule_node_get_child(
8347                 __isl_keep isl_schedule_node *node, int pos);
8348         __isl_give isl_schedule_node *
8349         isl_schedule_node_get_shared_ancestor(
8350                 __isl_keep isl_schedule_node *node1,
8351                 __isl_keep isl_schedule_node *node2);
8353 All nodes in a schedule tree or
8354 all descendants of a specific node (including the node) can be visited
8355 in depth-first pre-order using the following functions.
8357         #include <isl/schedule.h>
8358         isl_stat isl_schedule_foreach_schedule_node_top_down(
8359                 __isl_keep isl_schedule *sched,
8360                 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
8361                         void *user), void *user);
8363         #include <isl/schedule_node.h>
8364         isl_stat isl_schedule_node_foreach_descendant_top_down(
8365                 __isl_keep isl_schedule_node *node,
8366                 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
8367                         void *user), void *user);
8369 The callback function is slightly different from the usual
8370 callbacks in that it not only indicates success (non-negative result)
8371 or failure (negative result), but also indicates whether the children
8372 of the given node should be visited.  In particular, if the callback
8373 returns a positive value, then the children are visited, but if
8374 the callback returns zero, then the children are not visited.
8376 The following functions checks whether
8377 all descendants of a specific node (including the node itself)
8378 satisfy a user-specified test.
8380         #include <isl/schedule_node.h>
8381         isl_bool isl_schedule_node_every_descendant(
8382                 __isl_keep isl_schedule_node *node,
8383                 isl_bool (*test)(__isl_keep isl_schedule_node *node,
8384                         void *user), void *user)
8386 The ancestors of a node in a schedule tree can be visited from
8387 the root down to and including the parent of the node using
8388 the following function.
8390         #include <isl/schedule_node.h>
8391         isl_stat isl_schedule_node_foreach_ancestor_top_down(
8392                 __isl_keep isl_schedule_node *node,
8393                 isl_stat (*fn)(__isl_keep isl_schedule_node *node,
8394                         void *user), void *user);
8396 The following functions allows for a depth-first post-order
8397 traversal of the nodes in a schedule tree or
8398 of the descendants of a specific node (including the node
8399 itself), where the user callback is allowed to modify the
8400 visited node.
8402         #include <isl/schedule.h>
8403         __isl_give isl_schedule *
8404         isl_schedule_map_schedule_node_bottom_up(
8405                 __isl_take isl_schedule *schedule,
8406                 __isl_give isl_schedule_node *(*fn)(
8407                         __isl_take isl_schedule_node *node,
8408                         void *user), void *user);
8410         #include <isl/schedule_node.h>
8411         __isl_give isl_schedule_node *
8412         isl_schedule_node_map_descendant_bottom_up(
8413                 __isl_take isl_schedule_node *node,
8414                 __isl_give isl_schedule_node *(*fn)(
8415                         __isl_take isl_schedule_node *node,
8416                         void *user), void *user);
8418 The traversal continues from the node returned by the callback function.
8419 It is the responsibility of the user to ensure that this does not
8420 lead to an infinite loop.  It is safest to always return a pointer
8421 to the same position (same ancestors and child positions) as the input node.
8423 The following function removes a node (along with its descendants)
8424 from a schedule tree and returns a pointer to the leaf at the
8425 same position in the updated tree.
8426 It is not allowed to remove the root of a schedule tree or
8427 a child of a set or sequence node.
8429         #include <isl/schedule_node.h>
8430         __isl_give isl_schedule_node *isl_schedule_node_cut(
8431                 __isl_take isl_schedule_node *node);
8433 The following function removes a single node
8434 from a schedule tree and returns a pointer to the child
8435 of the node, now located at the position of the original node
8436 or to a leaf node at that position if there was no child.
8437 It is not allowed to remove the root of a schedule tree,
8438 a set or sequence node, a child of a set or sequence node or
8439 a band node with an anchored subtree.
8441         #include <isl/schedule_node.h>
8442         __isl_give isl_schedule_node *isl_schedule_node_delete(
8443                 __isl_take isl_schedule_node *node);
8445 Most nodes in a schedule tree only contain local information.
8446 In some cases, however, a node may also refer to the schedule dimensions
8447 of its outer band nodes.
8448 This means that the position of the node within the tree should
8449 not be changed, or at least that no changes are performed to the
8450 outer band nodes.  The following function can be used to test
8451 whether the subtree rooted at a given node contains any such nodes.
8453         #include <isl/schedule_node.h>
8454         isl_bool isl_schedule_node_is_subtree_anchored(
8455                 __isl_keep isl_schedule_node *node);
8457 The following function resets the user pointers on all parameter
8458 and tuple identifiers referenced by the given schedule node.
8460         #include <isl/schedule_node.h>
8461         __isl_give isl_schedule_node *isl_schedule_node_reset_user(
8462                 __isl_take isl_schedule_node *node);
8464 The following function aligns the parameters of the given schedule
8465 node to the given space.
8467         #include <isl/schedule_node.h>
8468         __isl_give isl_schedule_node *
8469         isl_schedule_node_align_params(
8470                 __isl_take isl_schedule_node *node,
8471                 __isl_take isl_space *space);
8473 Several node types have their own functions for querying
8474 (and in some cases setting) some node type specific properties.
8476         #include <isl/schedule_node.h>
8477         __isl_give isl_space *isl_schedule_node_band_get_space(
8478                 __isl_keep isl_schedule_node *node);
8479         __isl_give isl_multi_union_pw_aff *
8480         isl_schedule_node_band_get_partial_schedule(
8481                 __isl_keep isl_schedule_node *node);
8482         __isl_give isl_union_map *
8483         isl_schedule_node_band_get_partial_schedule_union_map(
8484                 __isl_keep isl_schedule_node *node);
8485         unsigned isl_schedule_node_band_n_member(
8486                 __isl_keep isl_schedule_node *node);
8487         isl_bool isl_schedule_node_band_member_get_coincident(
8488                 __isl_keep isl_schedule_node *node, int pos);
8489         __isl_give isl_schedule_node *
8490         isl_schedule_node_band_member_set_coincident(
8491                 __isl_take isl_schedule_node *node, int pos,
8492                 int coincident);
8493         isl_bool isl_schedule_node_band_get_permutable(
8494                 __isl_keep isl_schedule_node *node);
8495         __isl_give isl_schedule_node *
8496         isl_schedule_node_band_set_permutable(
8497                 __isl_take isl_schedule_node *node, int permutable);
8498         enum isl_ast_loop_type
8499         isl_schedule_node_band_member_get_ast_loop_type(
8500                 __isl_keep isl_schedule_node *node, int pos);
8501         __isl_give isl_schedule_node *
8502         isl_schedule_node_band_member_set_ast_loop_type(
8503                 __isl_take isl_schedule_node *node, int pos,
8504                 enum isl_ast_loop_type type);
8505         __isl_give isl_union_set *
8506         enum isl_ast_loop_type
8507         isl_schedule_node_band_member_get_isolate_ast_loop_type(
8508                 __isl_keep isl_schedule_node *node, int pos);
8509         __isl_give isl_schedule_node *
8510         isl_schedule_node_band_member_set_isolate_ast_loop_type(
8511                 __isl_take isl_schedule_node *node, int pos,
8512                 enum isl_ast_loop_type type);
8513         isl_schedule_node_band_get_ast_build_options(
8514                 __isl_keep isl_schedule_node *node);
8515         __isl_give isl_schedule_node *
8516         isl_schedule_node_band_set_ast_build_options(
8517                 __isl_take isl_schedule_node *node,
8518                 __isl_take isl_union_set *options);
8519         __isl_give isl_set *
8520         isl_schedule_node_band_get_ast_isolate_option(
8521                 __isl_keep isl_schedule_node *node);
8523 The function C<isl_schedule_node_band_get_space> returns the space
8524 of the partial schedule of the band.
8525 The function C<isl_schedule_node_band_get_partial_schedule_union_map>
8526 returns a representation of the partial schedule of the band node
8527 in the form of an C<isl_union_map>.
8528 The coincident and permutable properties are set by
8529 C<isl_schedule_constraints_compute_schedule> on the schedule tree
8530 it produces.
8531 A scheduling dimension is considered to be ``coincident''
8532 if it satisfies the coincidence constraints within its band.
8533 That is, if the dependence distances of the coincidence
8534 constraints are all zero in that direction (for fixed
8535 iterations of outer bands).
8536 A band is marked permutable if it was produced using the Pluto-like scheduler.
8537 Note that the scheduler may have to resort to a Feautrier style scheduling
8538 step even if the default scheduler is used.
8539 An C<isl_ast_loop_type> is one of C<isl_ast_loop_default>,
8540 C<isl_ast_loop_atomic>, C<isl_ast_loop_unroll> or C<isl_ast_loop_separate>.
8541 For the meaning of these loop AST generation types and the difference
8542 between the regular loop AST generation type and the isolate
8543 loop AST generation type, see L</"AST Generation Options (Schedule Tree)">.
8544 The functions C<isl_schedule_node_band_member_get_ast_loop_type>
8545 and C<isl_schedule_node_band_member_get_isolate_ast_loop_type>
8546 may return C<isl_ast_loop_error> if an error occurs.
8547 The AST build options govern how an AST is generated for
8548 the individual schedule dimensions during AST generation.
8549 See L</"AST Generation Options (Schedule Tree)">.
8550 The isolate option for the given node can be extracted from these
8551 AST build options using the function
8552 C<isl_schedule_node_band_get_ast_isolate_option>.
8554         #include <isl/schedule_node.h>
8555         __isl_give isl_set *
8556         isl_schedule_node_context_get_context(
8557                 __isl_keep isl_schedule_node *node);
8559         #include <isl/schedule_node.h>
8560         __isl_give isl_union_set *
8561         isl_schedule_node_domain_get_domain(
8562                 __isl_keep isl_schedule_node *node);
8564         #include <isl/schedule_node.h>
8565         __isl_give isl_union_map *
8566         isl_schedule_node_expansion_get_expansion(
8567                 __isl_keep isl_schedule_node *node);
8568         __isl_give isl_union_pw_multi_aff *
8569         isl_schedule_node_expansion_get_contraction(
8570                 __isl_keep isl_schedule_node *node);
8572         #include <isl/schedule_node.h>
8573         __isl_give isl_union_map *
8574         isl_schedule_node_extension_get_extension(
8575                 __isl_keep isl_schedule_node *node);
8577         #include <isl/schedule_node.h>
8578         __isl_give isl_union_set *
8579         isl_schedule_node_filter_get_filter(
8580                 __isl_keep isl_schedule_node *node);
8582         #include <isl/schedule_node.h>
8583         __isl_give isl_set *isl_schedule_node_guard_get_guard(
8584                 __isl_keep isl_schedule_node *node);
8586         #include <isl/schedule_node.h>
8587         __isl_give isl_id *isl_schedule_node_mark_get_id(
8588                 __isl_keep isl_schedule_node *node);
8590 The following functions can be used to obtain an C<isl_multi_union_pw_aff>,
8591 an C<isl_union_pw_multi_aff> or C<isl_union_map> representation of
8592 partial schedules related to the node.
8594         #include <isl/schedule_node.h>
8595         __isl_give isl_multi_union_pw_aff *
8596         isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(
8597                 __isl_keep isl_schedule_node *node);
8598         __isl_give isl_union_pw_multi_aff *
8599         isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(
8600                 __isl_keep isl_schedule_node *node);
8601         __isl_give isl_union_map *
8602         isl_schedule_node_get_prefix_schedule_union_map(
8603                 __isl_keep isl_schedule_node *node);
8604         __isl_give isl_union_map *
8605         isl_schedule_node_get_prefix_schedule_relation(
8606                 __isl_keep isl_schedule_node *node);
8607         __isl_give isl_union_map *
8608         isl_schedule_node_get_subtree_schedule_union_map(
8609                 __isl_keep isl_schedule_node *node);
8611 In particular, the functions
8612 C<isl_schedule_node_get_prefix_schedule_multi_union_pw_aff>,
8613 C<isl_schedule_node_get_prefix_schedule_union_pw_multi_aff>
8614 and C<isl_schedule_node_get_prefix_schedule_union_map>
8615 return a relative ordering on the domain elements that reach the given
8616 node determined by its ancestors.
8617 The function C<isl_schedule_node_get_prefix_schedule_relation>
8618 additionally includes the domain constraints in the result.
8619 The function C<isl_schedule_node_get_subtree_schedule_union_map>
8620 returns a representation of the partial schedule defined by the
8621 subtree rooted at the given node.
8622 If the tree contains any expansion nodes, then the subtree schedule
8623 is formulated in terms of the expanded domain elements.
8624 The tree passed to functions returning a prefix schedule
8625 may only contain extension nodes if these would not affect
8626 the result of these functions.  That is, if one of the ancestors
8627 is an extension node, then all of the domain elements that were
8628 added by the extension node need to have been filtered out
8629 by filter nodes between the extension node and the input node.
8630 The tree passed to C<isl_schedule_node_get_subtree_schedule_union_map>
8631 may not contain in extension nodes in the selected subtree.
8633 The expansion/contraction defined by an entire subtree, combining
8634 the expansions/contractions
8635 on the expansion nodes in the subtree, can be obtained using
8636 the following functions.
8638         #include <isl/schedule_node.h>
8639         __isl_give isl_union_map *
8640         isl_schedule_node_get_subtree_expansion(
8641                 __isl_keep isl_schedule_node *node);
8642         __isl_give isl_union_pw_multi_aff *
8643         isl_schedule_node_get_subtree_contraction(
8644                 __isl_keep isl_schedule_node *node);
8646 The total number of outer band members of given node, i.e.,
8647 the shared output dimension of the maps in the result
8648 of C<isl_schedule_node_get_prefix_schedule_union_map> can be obtained
8649 using the following function.
8651         #include <isl/schedule_node.h>
8652         int isl_schedule_node_get_schedule_depth(
8653                 __isl_keep isl_schedule_node *node);
8655 The following functions return the elements that reach the given node
8656 or the union of universes in the spaces that contain these elements.
8658         #include <isl/schedule_node.h>
8659         __isl_give isl_union_set *
8660         isl_schedule_node_get_domain(
8661                 __isl_keep isl_schedule_node *node);
8662         __isl_give isl_union_set *
8663         isl_schedule_node_get_universe_domain(
8664                 __isl_keep isl_schedule_node *node);
8666 The input tree of C<isl_schedule_node_get_domain>
8667 may only contain extension nodes if these would not affect
8668 the result of this function.  That is, if one of the ancestors
8669 is an extension node, then all of the domain elements that were
8670 added by the extension node need to have been filtered out
8671 by filter nodes between the extension node and the input node.
8673 The following functions can be used to introduce additional nodes
8674 in the schedule tree.  The new node is introduced at the point
8675 in the tree where the C<isl_schedule_node> points to and
8676 the results points to the new node.
8678         #include <isl/schedule_node.h>
8679         __isl_give isl_schedule_node *
8680         isl_schedule_node_insert_partial_schedule(
8681                 __isl_take isl_schedule_node *node,
8682                 __isl_take isl_multi_union_pw_aff *schedule);
8684 This function inserts a new band node with (the greatest integer
8685 part of) the given partial schedule.
8686 The subtree rooted at the given node is assumed not to have
8687 any anchored nodes.
8689         #include <isl/schedule_node.h>
8690         __isl_give isl_schedule_node *
8691         isl_schedule_node_insert_context(
8692                 __isl_take isl_schedule_node *node,
8693                 __isl_take isl_set *context);
8695 This function inserts a new context node with the given context constraints.
8697         #include <isl/schedule_node.h>
8698         __isl_give isl_schedule_node *
8699         isl_schedule_node_insert_filter(
8700                 __isl_take isl_schedule_node *node,
8701                 __isl_take isl_union_set *filter);
8703 This function inserts a new filter node with the given filter.
8704 If the original node already pointed to a filter node, then the
8705 two filter nodes are merged into one.
8707         #include <isl/schedule_node.h>
8708         __isl_give isl_schedule_node *
8709         isl_schedule_node_insert_guard(
8710                 __isl_take isl_schedule_node *node,
8711                 __isl_take isl_set *guard);
8713 This function inserts a new guard node with the given guard constraints.
8715         #include <isl/schedule_node.h>
8716         __isl_give isl_schedule_node *
8717         isl_schedule_node_insert_mark(
8718                 __isl_take isl_schedule_node *node,
8719                 __isl_take isl_id *mark);
8721 This function inserts a new mark node with the give mark identifier.
8723         #include <isl/schedule_node.h>
8724         __isl_give isl_schedule_node *
8725         isl_schedule_node_insert_sequence(
8726                 __isl_take isl_schedule_node *node,
8727                 __isl_take isl_union_set_list *filters);
8728         __isl_give isl_schedule_node *
8729         isl_schedule_node_insert_set(
8730                 __isl_take isl_schedule_node *node,
8731                 __isl_take isl_union_set_list *filters);
8733 These functions insert a new sequence or set node with the given
8734 filters as children.
8736         #include <isl/schedule_node.h>
8737         __isl_give isl_schedule_node *isl_schedule_node_group(
8738                 __isl_take isl_schedule_node *node,
8739                 __isl_take isl_id *group_id);
8741 This function introduces an expansion node in between the current
8742 node and its parent that expands instances of a space with tuple
8743 identifier C<group_id> to the original domain elements that reach
8744 the node.  The group instances are identified by the prefix schedule
8745 of those domain elements.  The ancestors of the node are adjusted
8746 to refer to the group instances instead of the original domain
8747 elements.  The return value points to the same node in the updated
8748 schedule tree as the input node, i.e., to the child of the newly
8749 introduced expansion node.  Grouping instances of different statements
8750 ensures that they will be treated as a single statement by the
8751 AST generator up to the point of the expansion node.
8753 The following function can be used to flatten a nested
8754 sequence.
8756         #include <isl/schedule_node.h>
8757         __isl_give isl_schedule_node *
8758         isl_schedule_node_sequence_splice_child(
8759                 __isl_take isl_schedule_node *node, int pos);
8761 That is, given a sequence node C<node> that has another sequence node
8762 in its child at position C<pos> (in particular, the child of that filter
8763 node is a sequence node), attach the children of that other sequence
8764 node as children of C<node>, replacing the original child at position
8765 C<pos>.
8767 The partial schedule of a band node can be scaled (down) or reduced using
8768 the following functions.
8770         #include <isl/schedule_node.h>
8771         __isl_give isl_schedule_node *
8772         isl_schedule_node_band_scale(
8773                 __isl_take isl_schedule_node *node,
8774                 __isl_take isl_multi_val *mv);
8775         __isl_give isl_schedule_node *
8776         isl_schedule_node_band_scale_down(
8777                 __isl_take isl_schedule_node *node,
8778                 __isl_take isl_multi_val *mv);
8779         __isl_give isl_schedule_node *
8780         isl_schedule_node_band_mod(
8781                 __isl_take isl_schedule_node *node,
8782                 __isl_take isl_multi_val *mv);
8784 The spaces of the two arguments need to match.
8785 After scaling, the partial schedule is replaced by its greatest
8786 integer part to ensure that the schedule remains integral.
8788 The partial schedule of a band node can be shifted by an
8789 C<isl_multi_union_pw_aff> with a domain that is a superset
8790 of the domain of the partial schedule using
8791 the following function.
8793         #include <isl/schedule_node.h>
8794         __isl_give isl_schedule_node *
8795         isl_schedule_node_band_shift(
8796                 __isl_take isl_schedule_node *node,
8797                 __isl_take isl_multi_union_pw_aff *shift);
8799 A band node can be tiled using the following function.
8801         #include <isl/schedule_node.h>
8802         __isl_give isl_schedule_node *isl_schedule_node_band_tile(
8803                 __isl_take isl_schedule_node *node,
8804                 __isl_take isl_multi_val *sizes);
8806         isl_stat isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
8807                 int val);
8808         int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
8809         isl_stat isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
8810                 int val);
8811         int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
8813 The C<isl_schedule_node_band_tile> function tiles
8814 the band using the given tile sizes inside its schedule.
8815 A new child band node is created to represent the point loops and it is
8816 inserted between the modified band and its children.
8817 The subtree rooted at the given node is assumed not to have
8818 any anchored nodes.
8819 The C<tile_scale_tile_loops> option specifies whether the tile
8820 loops iterators should be scaled by the tile sizes.
8821 If the C<tile_shift_point_loops> option is set, then the point loops
8822 are shifted to start at zero.
8824 A band node can be split into two nested band nodes
8825 using the following function.
8827         #include <isl/schedule_node.h>
8828         __isl_give isl_schedule_node *isl_schedule_node_band_split(
8829                 __isl_take isl_schedule_node *node, int pos);
8831 The resulting outer band node contains the first C<pos> dimensions of
8832 the schedule of C<node> while the inner band contains the remaining dimensions.
8833 The schedules of the two band nodes live in anonymous spaces.
8834 The loop AST generation type options and the isolate option
8835 are split over the two band nodes.
8837 A band node can be moved down to the leaves of the subtree rooted
8838 at the band node using the following function.
8840         #include <isl/schedule_node.h>
8841         __isl_give isl_schedule_node *isl_schedule_node_band_sink(
8842                 __isl_take isl_schedule_node *node);
8844 The subtree rooted at the given node is assumed not to have
8845 any anchored nodes.
8846 The result points to the node in the resulting tree that is in the same
8847 position as the node pointed to by C<node> in the original tree.
8849         #include <isl/schedule_node.h>
8850         __isl_give isl_schedule_node *
8851         isl_schedule_node_order_before(
8852                 __isl_take isl_schedule_node *node,
8853                 __isl_take isl_union_set *filter);
8854         __isl_give isl_schedule_node *
8855         isl_schedule_node_order_after(
8856                 __isl_take isl_schedule_node *node,
8857                 __isl_take isl_union_set *filter);
8859 These functions split the domain elements that reach C<node>
8860 into those that satisfy C<filter> and those that do not and
8861 arranges for the elements that do satisfy the filter to be
8862 executed before (in case of C<isl_schedule_node_order_before>)
8863 or after (in case of C<isl_schedule_node_order_after>)
8864 those that do not.  The order is imposed by
8865 a sequence node, possibly reusing the grandparent of C<node>
8866 on two copies of the subtree attached to the original C<node>.
8867 Both copies are simplified with respect to their filter.
8869 Return a pointer to the copy of the subtree that does not
8870 satisfy C<filter>.  If there is no such copy (because all
8871 reaching domain elements satisfy the filter), then return
8872 the original pointer.
8874         #include <isl/schedule_node.h>
8875         __isl_give isl_schedule_node *
8876         isl_schedule_node_graft_before(
8877                 __isl_take isl_schedule_node *node,
8878                 __isl_take isl_schedule_node *graft);
8879         __isl_give isl_schedule_node *
8880         isl_schedule_node_graft_after(
8881                 __isl_take isl_schedule_node *node,
8882                 __isl_take isl_schedule_node *graft);
8884 This function inserts the C<graft> tree into the tree containing C<node>
8885 such that it is executed before (in case of C<isl_schedule_node_graft_before>)
8886 or after (in case of C<isl_schedule_node_graft_after>) C<node>.
8887 The root node of C<graft>
8888 should be an extension node where the domain of the extension
8889 is the flat product of all outer band nodes of C<node>.
8890 The root node may also be a domain node.
8891 The elements of the domain or the range of the extension may not
8892 intersect with the domain elements that reach "node".
8893 The schedule tree of C<graft> may not be anchored.
8895 The schedule tree of C<node> is modified to include an extension node
8896 corresponding to the root node of C<graft> as a child of the original
8897 parent of C<node>.  The original node that C<node> points to and the
8898 child of the root node of C<graft> are attached to this extension node
8899 through a sequence, with appropriate filters and with the child
8900 of C<graft> appearing before or after the original C<node>.
8902 If C<node> already appears inside a sequence that is the child of
8903 an extension node and if the spaces of the new domain elements
8904 do not overlap with those of the original domain elements,
8905 then that extension node is extended with the new extension
8906 rather than introducing a new segment of extension and sequence nodes.
8908 Return a pointer to the same node in the modified tree that
8909 C<node> pointed to in the original tree.
8911 A representation of the schedule node can be printed using
8913         #include <isl/schedule_node.h>
8914         __isl_give isl_printer *isl_printer_print_schedule_node(
8915                 __isl_take isl_printer *p,
8916                 __isl_keep isl_schedule_node *node);
8917         __isl_give char *isl_schedule_node_to_str(
8918                 __isl_keep isl_schedule_node *node);
8920 C<isl_schedule_node_to_str> prints the schedule node in block format.
8922 =head2 Dependence Analysis
8924 C<isl> contains specialized functionality for performing
8925 array dataflow analysis.  That is, given a I<sink> access relation,
8926 a collection of possible I<source> accesses and
8927 a collection of I<kill> accesses,
8928 C<isl> can compute relations that describe
8929 for each iteration of the sink access, which iterations
8930 of which of the source access relations may have
8931 accessed the same data element before the given iteration
8932 of the sink access without any intermediate kill of that data element.
8933 The resulting dependence relations map source iterations
8934 to either the corresponding sink iterations or
8935 pairs of corresponding sink iterations and accessed data elements.
8936 To compute standard flow dependences, the sink should be
8937 a read, while the sources should be writes.
8938 If no kills are specified,
8939 then memory based dependence analysis is performed.
8940 If, on the other hand, all sources are also kills,
8941 then value based dependence analysis is performed.
8942 If any of the source accesses are marked as being I<must>
8943 accesses, then they are also treated as kills.
8944 Furthermore, the specification of must-sources results
8945 in the computation of must-dependences.
8946 Only dependences originating in a must access not coscheduled
8947 with any other access to the same element and without
8948 any may accesses between the must access and the sink access
8949 are considered to be must dependences.
8951 =head3 High-level Interface
8953 A high-level interface to dependence analysis is provided
8954 by the following function.
8956         #include <isl/flow.h>
8957         __isl_give isl_union_flow *
8958         isl_union_access_info_compute_flow(
8959                 __isl_take isl_union_access_info *access);
8961 The input C<isl_union_access_info> object describes the sink
8962 access relations, the source access relations and a schedule,
8963 while the output C<isl_union_flow> object describes
8964 the resulting dependence relations and the subsets of the
8965 sink relations for which no source was found.
8967 An C<isl_union_access_info> is created, modified, copied and freed using
8968 the following functions.
8970         #include <isl/flow.h>
8971         __isl_give isl_union_access_info *
8972         isl_union_access_info_from_sink(
8973                 __isl_take isl_union_map *sink);
8974         __isl_give isl_union_access_info *
8975         isl_union_access_info_set_kill(
8976                 __isl_take isl_union_access_info *access,
8977                 __isl_take isl_union_map *kill);
8978         __isl_give isl_union_access_info *
8979         isl_union_access_info_set_may_source(
8980                 __isl_take isl_union_access_info *access,
8981                 __isl_take isl_union_map *may_source);
8982         __isl_give isl_union_access_info *
8983         isl_union_access_info_set_must_source(
8984                 __isl_take isl_union_access_info *access,
8985                 __isl_take isl_union_map *must_source);
8986         __isl_give isl_union_access_info *
8987         isl_union_access_info_set_schedule(
8988                 __isl_take isl_union_access_info *access,
8989                 __isl_take isl_schedule *schedule);
8990         __isl_give isl_union_access_info *
8991         isl_union_access_info_set_schedule_map(
8992                 __isl_take isl_union_access_info *access,
8993                 __isl_take isl_union_map *schedule_map);
8994         __isl_give isl_union_access_info *
8995         isl_union_access_info_copy(
8996                 __isl_keep isl_union_access_info *access);
8997         __isl_null isl_union_access_info *
8998         isl_union_access_info_free(
8999                 __isl_take isl_union_access_info *access);
9001 The may sources set by C<isl_union_access_info_set_may_source>
9002 do not need to include the must sources set by
9003 C<isl_union_access_info_set_must_source> as a subset.
9004 The kills set by C<isl_union_access_info_set_kill> may overlap
9005 with the may-sources and/or must-sources.
9006 The user is free not to call one (or more) of these functions,
9007 in which case the corresponding set is kept to its empty default.
9008 Similarly, the default schedule initialized by
9009 C<isl_union_access_info_from_sink> is empty.
9010 The current schedule is determined by the last call to either
9011 C<isl_union_access_info_set_schedule> or
9012 C<isl_union_access_info_set_schedule_map>.
9013 The domain of the schedule corresponds to the domains of
9014 the access relations.  In particular, the domains of the access
9015 relations are effectively intersected with the domain of the schedule
9016 and only the resulting accesses are considered by the dependence analysis.
9018 An C<isl_union_access_info> object can be read from input
9019 using the following function.
9021         #include <isl/flow.h>
9022         __isl_give isl_union_access_info *
9023         isl_union_access_info_read_from_file(isl_ctx *ctx,
9024                 FILE *input);
9026 A representation of the information contained in an object
9027 of type C<isl_union_access_info> can be obtained using
9029         #include <isl/flow.h>
9030         __isl_give isl_printer *
9031         isl_printer_print_union_access_info(
9032                 __isl_take isl_printer *p,
9033                 __isl_keep isl_union_access_info *access);
9034         __isl_give char *isl_union_access_info_to_str(
9035                 __isl_keep isl_union_access_info *access);
9037 C<isl_union_access_info_to_str> prints the information in flow format.
9039 The output of C<isl_union_access_info_compute_flow> can be examined,
9040 copied, and freed using the following functions.
9042         #include <isl/flow.h>
9043         __isl_give isl_union_map *isl_union_flow_get_must_dependence(
9044                 __isl_keep isl_union_flow *flow);
9045         __isl_give isl_union_map *isl_union_flow_get_may_dependence(
9046                 __isl_keep isl_union_flow *flow);
9047         __isl_give isl_union_map *
9048         isl_union_flow_get_full_must_dependence(
9049                 __isl_keep isl_union_flow *flow);
9050         __isl_give isl_union_map *
9051         isl_union_flow_get_full_may_dependence(
9052                 __isl_keep isl_union_flow *flow);
9053         __isl_give isl_union_map *isl_union_flow_get_must_no_source(
9054                 __isl_keep isl_union_flow *flow);
9055         __isl_give isl_union_map *isl_union_flow_get_may_no_source(
9056                 __isl_keep isl_union_flow *flow);
9057         __isl_give isl_union_flow *isl_union_flow_copy(
9058                 __isl_keep isl_union_flow *flow);
9059         __isl_null isl_union_flow *isl_union_flow_free(
9060                 __isl_take isl_union_flow *flow);
9062 The relation returned by C<isl_union_flow_get_must_dependence>
9063 relates domain elements of must sources to domain elements of the sink.
9064 The relation returned by C<isl_union_flow_get_may_dependence>
9065 relates domain elements of must or may sources to domain elements of the sink
9066 and includes the previous relation as a subset.
9067 The relation returned by C<isl_union_flow_get_full_must_dependence>
9068 relates domain elements of must sources to pairs of domain elements of the sink
9069 and accessed data elements.
9070 The relation returned by C<isl_union_flow_get_full_may_dependence>
9071 relates domain elements of must or may sources to pairs of
9072 domain elements of the sink and accessed data elements.
9073 This relation includes the previous relation as a subset.
9074 The relation returned by C<isl_union_flow_get_must_no_source> is the subset
9075 of the sink relation for which no dependences have been found.
9076 The relation returned by C<isl_union_flow_get_may_no_source> is the subset
9077 of the sink relation for which no definite dependences have been found.
9078 That is, it contains those sink access that do not contribute to any
9079 of the elements in the relation returned
9080 by C<isl_union_flow_get_must_dependence>.
9082 A representation of the information contained in an object
9083 of type C<isl_union_flow> can be obtained using
9085         #include <isl/flow.h>
9086         __isl_give isl_printer *isl_printer_print_union_flow(
9087                 __isl_take isl_printer *p,
9088                 __isl_keep isl_union_flow *flow);
9089         __isl_give char *isl_union_flow_to_str(
9090                 __isl_keep isl_union_flow *flow);
9092 C<isl_union_flow_to_str> prints the information in flow format.
9094 =head3 Low-level Interface
9096 A lower-level interface is provided by the following functions.
9098         #include <isl/flow.h>
9100         typedef int (*isl_access_level_before)(void *first, void *second);
9102         __isl_give isl_access_info *isl_access_info_alloc(
9103                 __isl_take isl_map *sink,
9104                 void *sink_user, isl_access_level_before fn,
9105                 int max_source);
9106         __isl_give isl_access_info *isl_access_info_add_source(
9107                 __isl_take isl_access_info *acc,
9108                 __isl_take isl_map *source, int must,
9109                 void *source_user);
9110         __isl_null isl_access_info *isl_access_info_free(
9111                 __isl_take isl_access_info *acc);
9113         __isl_give isl_flow *isl_access_info_compute_flow(
9114                 __isl_take isl_access_info *acc);
9116         isl_stat isl_flow_foreach(__isl_keep isl_flow *deps,
9117                 isl_stat (*fn)(__isl_take isl_map *dep, int must,
9118                           void *dep_user, void *user),
9119                 void *user);
9120         __isl_give isl_map *isl_flow_get_no_source(
9121                 __isl_keep isl_flow *deps, int must);
9122         void isl_flow_free(__isl_take isl_flow *deps);
9124 The function C<isl_access_info_compute_flow> performs the actual
9125 dependence analysis.  The other functions are used to construct
9126 the input for this function or to read off the output.
9128 The input is collected in an C<isl_access_info>, which can
9129 be created through a call to C<isl_access_info_alloc>.
9130 The arguments to this functions are the sink access relation
9131 C<sink>, a token C<sink_user> used to identify the sink
9132 access to the user, a callback function for specifying the
9133 relative order of source and sink accesses, and the number
9134 of source access relations that will be added.
9136 The callback function has type C<int (*)(void *first, void *second)>.
9137 The function is called with two user supplied tokens identifying
9138 either a source or the sink and it should return the shared nesting
9139 level and the relative order of the two accesses.
9140 In particular, let I<n> be the number of loops shared by
9141 the two accesses.  If C<first> precedes C<second> textually,
9142 then the function should return I<2 * n + 1>; otherwise,
9143 it should return I<2 * n>.
9144 The low-level interface assumes that no sources are coscheduled.
9145 If the information returned by the callback does not allow
9146 the relative order to be determined, then one of the sources
9147 is arbitrarily taken to be executed after the other(s).
9149 The sources can be added to the C<isl_access_info> object by performing
9150 (at most) C<max_source> calls to C<isl_access_info_add_source>.
9151 C<must> indicates whether the source is a I<must> access
9152 or a I<may> access.  Note that a multi-valued access relation
9153 should only be marked I<must> if every iteration in the domain
9154 of the relation accesses I<all> elements in its image.
9155 The C<source_user> token is again used to identify
9156 the source access.  The range of the source access relation
9157 C<source> should have the same dimension as the range
9158 of the sink access relation.
9159 The C<isl_access_info_free> function should usually not be
9160 called explicitly, because it is already called implicitly by
9161 C<isl_access_info_compute_flow>.
9163 The result of the dependence analysis is collected in an
9164 C<isl_flow>.  There may be elements of
9165 the sink access for which no preceding source access could be
9166 found or for which all preceding sources are I<may> accesses.
9167 The relations containing these elements can be obtained through
9168 calls to C<isl_flow_get_no_source>, the first with C<must> set
9169 and the second with C<must> unset.
9170 In the case of standard flow dependence analysis,
9171 with the sink a read and the sources I<must> writes,
9172 the first relation corresponds to the reads from uninitialized
9173 array elements and the second relation is empty.
9174 The actual flow dependences can be extracted using
9175 C<isl_flow_foreach>.  This function will call the user-specified
9176 callback function C<fn> for each B<non-empty> dependence between
9177 a source and the sink.  The callback function is called
9178 with four arguments, the actual flow dependence relation
9179 mapping source iterations to sink iterations, a boolean that
9180 indicates whether it is a I<must> or I<may> dependence, a token
9181 identifying the source and an additional C<void *> with value
9182 equal to the third argument of the C<isl_flow_foreach> call.
9183 A dependence is marked I<must> if it originates from a I<must>
9184 source and if it is not followed by any I<may> sources.
9186 After finishing with an C<isl_flow>, the user should call
9187 C<isl_flow_free> to free all associated memory.
9189 =head3 Interaction with the Low-level Interface
9191 During the dependence analysis, we frequently need to perform
9192 the following operation.  Given a relation between sink iterations
9193 and potential source iterations from a particular source domain,
9194 what is the last potential source iteration corresponding to each
9195 sink iteration.  It can sometimes be convenient to adjust
9196 the set of potential source iterations before or after each such operation.
9197 The prototypical example is fuzzy array dataflow analysis,
9198 where we need to analyze if, based on data-dependent constraints,
9199 the sink iteration can ever be executed without one or more of
9200 the corresponding potential source iterations being executed.
9201 If so, we can introduce extra parameters and select an unknown
9202 but fixed source iteration from the potential source iterations.
9203 To be able to perform such manipulations, C<isl> provides the following
9204 function.
9206         #include <isl/flow.h>
9208         typedef __isl_give isl_restriction *(*isl_access_restrict)(
9209                 __isl_keep isl_map *source_map,
9210                 __isl_keep isl_set *sink, void *source_user,
9211                 void *user);
9212         __isl_give isl_access_info *isl_access_info_set_restrict(
9213                 __isl_take isl_access_info *acc,
9214                 isl_access_restrict fn, void *user);
9216 The function C<isl_access_info_set_restrict> should be called
9217 before calling C<isl_access_info_compute_flow> and registers a callback function
9218 that will be called any time C<isl> is about to compute the last
9219 potential source.  The first argument is the (reverse) proto-dependence,
9220 mapping sink iterations to potential source iterations.
9221 The second argument represents the sink iterations for which
9222 we want to compute the last source iteration.
9223 The third argument is the token corresponding to the source
9224 and the final argument is the token passed to C<isl_access_info_set_restrict>.
9225 The callback is expected to return a restriction on either the input or
9226 the output of the operation computing the last potential source.
9227 If the input needs to be restricted then restrictions are needed
9228 for both the source and the sink iterations.  The sink iterations
9229 and the potential source iterations will be intersected with these sets.
9230 If the output needs to be restricted then only a restriction on the source
9231 iterations is required.
9232 If any error occurs, the callback should return C<NULL>.
9233 An C<isl_restriction> object can be created, freed and inspected
9234 using the following functions.
9236         #include <isl/flow.h>
9238         __isl_give isl_restriction *isl_restriction_input(
9239                 __isl_take isl_set *source_restr,
9240                 __isl_take isl_set *sink_restr);
9241         __isl_give isl_restriction *isl_restriction_output(
9242                 __isl_take isl_set *source_restr);
9243         __isl_give isl_restriction *isl_restriction_none(
9244                 __isl_take isl_map *source_map);
9245         __isl_give isl_restriction *isl_restriction_empty(
9246                 __isl_take isl_map *source_map);
9247         __isl_null isl_restriction *isl_restriction_free(
9248                 __isl_take isl_restriction *restr);
9250 C<isl_restriction_none> and C<isl_restriction_empty> are special
9251 cases of C<isl_restriction_input>.  C<isl_restriction_none>
9252 is essentially equivalent to
9254         isl_restriction_input(isl_set_universe(
9255             isl_space_range(isl_map_get_space(source_map))),
9256                             isl_set_universe(
9257             isl_space_domain(isl_map_get_space(source_map))));
9259 whereas C<isl_restriction_empty> is essentially equivalent to
9261         isl_restriction_input(isl_set_empty(
9262             isl_space_range(isl_map_get_space(source_map))),
9263                             isl_set_universe(
9264             isl_space_domain(isl_map_get_space(source_map))));
9266 =head2 Scheduling
9268         #include <isl/schedule.h>
9269         __isl_give isl_schedule *
9270         isl_schedule_constraints_compute_schedule(
9271                 __isl_take isl_schedule_constraints *sc);
9273 The function C<isl_schedule_constraints_compute_schedule> can be
9274 used to compute a schedule that satisfies the given schedule constraints.
9275 These schedule constraints include the iteration domain for which
9276 a schedule should be computed and dependences between pairs of
9277 iterations.  In particular, these dependences include
9278 I<validity> dependences and I<proximity> dependences.
9279 By default, the algorithm used to construct the schedule is similar
9280 to that of C<Pluto>.
9281 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
9282 be selected.
9283 The generated schedule respects all validity dependences.
9284 That is, all dependence distances over these dependences in the
9285 scheduled space are lexicographically positive.
9287 The default algorithm tries to ensure that the dependence distances
9288 over coincidence constraints are zero and to minimize the
9289 dependence distances over proximity dependences.
9290 Moreover, it tries to obtain sequences (bands) of schedule dimensions
9291 for groups of domains where the dependence distances over validity
9292 dependences have only non-negative values.
9293 Note that when minimizing the maximal dependence distance
9294 over proximity dependences, a single affine expression in the parameters
9295 is constructed that bounds all dependence distances.  If no such expression
9296 exists, then the algorithm will fail and resort to an alternative
9297 scheduling algorithm.  In particular, this means that adding proximity
9298 dependences may eliminate valid solutions.  A typical example where this
9299 phenomenon may occur is when some subset of the proximity dependences
9300 has no restriction on some parameter, forcing the coefficient of that
9301 parameter to be zero, while some other subset forces the dependence
9302 distance to depend on that parameter, requiring the same coefficient
9303 to be non-zero.
9304 When using Feautrier's algorithm, the coincidence and proximity constraints
9305 are only taken into account during the extension to a
9306 full-dimensional schedule.
9308 An C<isl_schedule_constraints> object can be constructed
9309 and manipulated using the following functions.
9311         #include <isl/schedule.h>
9312         __isl_give isl_schedule_constraints *
9313         isl_schedule_constraints_copy(
9314                 __isl_keep isl_schedule_constraints *sc);
9315         __isl_give isl_schedule_constraints *
9316         isl_schedule_constraints_on_domain(
9317                 __isl_take isl_union_set *domain);
9318         __isl_give isl_schedule_constraints *
9319         isl_schedule_constraints_set_context(
9320                 __isl_take isl_schedule_constraints *sc,
9321                 __isl_take isl_set *context);
9322         __isl_give isl_schedule_constraints *
9323         isl_schedule_constraints_set_validity(
9324                 __isl_take isl_schedule_constraints *sc,
9325                 __isl_take isl_union_map *validity);
9326         __isl_give isl_schedule_constraints *
9327         isl_schedule_constraints_set_coincidence(
9328                 __isl_take isl_schedule_constraints *sc,
9329                 __isl_take isl_union_map *coincidence);
9330         __isl_give isl_schedule_constraints *
9331         isl_schedule_constraints_set_proximity(
9332                 __isl_take isl_schedule_constraints *sc,
9333                 __isl_take isl_union_map *proximity);
9334         __isl_give isl_schedule_constraints *
9335         isl_schedule_constraints_set_conditional_validity(
9336                 __isl_take isl_schedule_constraints *sc,
9337                 __isl_take isl_union_map *condition,
9338                 __isl_take isl_union_map *validity);
9339         __isl_give isl_schedule_constraints *
9340         isl_schedule_constraints_apply(
9341                 __isl_take isl_schedule_constraints *sc,
9342                 __isl_take isl_union_map *umap);
9343         __isl_null isl_schedule_constraints *
9344         isl_schedule_constraints_free(
9345                 __isl_take isl_schedule_constraints *sc);
9347 The initial C<isl_schedule_constraints> object created by
9348 C<isl_schedule_constraints_on_domain> does not impose any constraints.
9349 That is, it has an empty set of dependences.
9350 The function C<isl_schedule_constraints_set_context> allows the user
9351 to specify additional constraints on the parameters that may
9352 be assumed to hold during the construction of the schedule.
9353 The function C<isl_schedule_constraints_set_validity> replaces the
9354 validity dependences, mapping domain elements I<i> to domain
9355 elements that should be scheduled after I<i>.
9356 The function C<isl_schedule_constraints_set_coincidence> replaces the
9357 coincidence dependences, mapping domain elements I<i> to domain
9358 elements that should be scheduled together with I<I>, if possible.
9359 The function C<isl_schedule_constraints_set_proximity> replaces the
9360 proximity dependences, mapping domain elements I<i> to domain
9361 elements that should be scheduled either before I<I>
9362 or as early as possible after I<i>.
9364 The function C<isl_schedule_constraints_set_conditional_validity>
9365 replaces the conditional validity constraints.
9366 A conditional validity constraint is only imposed when any of the corresponding
9367 conditions is satisfied, i.e., when any of them is non-zero.
9368 That is, the scheduler ensures that within each band if the dependence
9369 distances over the condition constraints are not all zero
9370 then all corresponding conditional validity constraints are respected.
9371 A conditional validity constraint corresponds to a condition
9372 if the two are adjacent, i.e., if the domain of one relation intersect
9373 the range of the other relation.
9374 The typical use case of conditional validity constraints is
9375 to allow order constraints between live ranges to be violated
9376 as long as the live ranges themselves are local to the band.
9377 To allow more fine-grained control over which conditions correspond
9378 to which conditional validity constraints, the domains and ranges
9379 of these relations may include I<tags>.  That is, the domains and
9380 ranges of those relation may themselves be wrapped relations
9381 where the iteration domain appears in the domain of those wrapped relations
9382 and the range of the wrapped relations can be arbitrarily chosen
9383 by the user.  Conditions and conditional validity constraints are only
9384 considered adjacent to each other if the entire wrapped relation matches.
9385 In particular, a relation with a tag will never be considered adjacent
9386 to a relation without a tag.
9388 The function C<isl_schedule_constraints_apply> takes
9389 schedule constraints that are defined on some set of domain elements
9390 and transforms them to schedule constraints on the elements
9391 to which these domain elements are mapped by the given transformation.
9393 An C<isl_schedule_constraints> object can be inspected
9394 using the following functions.
9396         #include <isl/schedule.h>
9397         __isl_give isl_union_set *
9398         isl_schedule_constraints_get_domain(
9399                 __isl_keep isl_schedule_constraints *sc);
9400         __isl_give isl_set *isl_schedule_constraints_get_context(
9401                 __isl_keep isl_schedule_constraints *sc);
9402         __isl_give isl_union_map *
9403         isl_schedule_constraints_get_validity(
9404                 __isl_keep isl_schedule_constraints *sc);
9405         __isl_give isl_union_map *
9406         isl_schedule_constraints_get_coincidence(
9407                 __isl_keep isl_schedule_constraints *sc);
9408         __isl_give isl_union_map *
9409         isl_schedule_constraints_get_proximity(
9410                 __isl_keep isl_schedule_constraints *sc);
9411         __isl_give isl_union_map *
9412         isl_schedule_constraints_get_conditional_validity(
9413                 __isl_keep isl_schedule_constraints *sc);
9414         __isl_give isl_union_map *
9415         isl_schedule_constraints_get_conditional_validity_condition(
9416                 __isl_keep isl_schedule_constraints *sc);
9418 An C<isl_schedule_constraints> object can be read from input
9419 using the following functions.
9421         #include <isl/schedule.h>
9422         __isl_give isl_schedule_constraints *
9423         isl_schedule_constraints_read_from_str(isl_ctx *ctx,
9424                 const char *str);
9425         __isl_give isl_schedule_constraints *
9426         isl_schedule_constraints_read_from_file(isl_ctx *ctx,
9427                 FILE *input);
9429 The contents of an C<isl_schedule_constraints> object can be printed
9430 using the following functions.
9432         #include <isl/schedule.h>
9433         __isl_give isl_printer *
9434         isl_printer_print_schedule_constraints(
9435                 __isl_take isl_printer *p,
9436                 __isl_keep isl_schedule_constraints *sc);
9437         __isl_give char *isl_schedule_constraints_to_str(
9438                 __isl_keep isl_schedule_constraints *sc);
9440 The following function computes a schedule directly from
9441 an iteration domain and validity and proximity dependences
9442 and is implemented in terms of the functions described above.
9443 The use of C<isl_union_set_compute_schedule> is discouraged.
9445         #include <isl/schedule.h>
9446         __isl_give isl_schedule *isl_union_set_compute_schedule(
9447                 __isl_take isl_union_set *domain,
9448                 __isl_take isl_union_map *validity,
9449                 __isl_take isl_union_map *proximity);
9451 The generated schedule represents a schedule tree.
9452 For more information on schedule trees, see
9453 L</"Schedule Trees">.
9455 =head3 Options
9457         #include <isl/schedule.h>
9458         isl_stat isl_options_set_schedule_max_coefficient(
9459                 isl_ctx *ctx, int val);
9460         int isl_options_get_schedule_max_coefficient(
9461                 isl_ctx *ctx);
9462         isl_stat isl_options_set_schedule_max_constant_term(
9463                 isl_ctx *ctx, int val);
9464         int isl_options_get_schedule_max_constant_term(
9465                 isl_ctx *ctx);
9466         isl_stat isl_options_set_schedule_serialize_sccs(
9467                 isl_ctx *ctx, int val);
9468         int isl_options_get_schedule_serialize_sccs(isl_ctx *ctx);
9469         isl_stat isl_options_set_schedule_whole_component(
9470                 isl_ctx *ctx, int val);
9471         int isl_options_get_schedule_whole_component(
9472                 isl_ctx *ctx);
9473         isl_stat isl_options_set_schedule_maximize_band_depth(
9474                 isl_ctx *ctx, int val);
9475         int isl_options_get_schedule_maximize_band_depth(
9476                 isl_ctx *ctx);
9477         isl_stat isl_options_set_schedule_maximize_coincidence(
9478                 isl_ctx *ctx, int val);
9479         int isl_options_get_schedule_maximize_coincidence(
9480                 isl_ctx *ctx);
9481         isl_stat isl_options_set_schedule_outer_coincidence(
9482                 isl_ctx *ctx, int val);
9483         int isl_options_get_schedule_outer_coincidence(
9484                 isl_ctx *ctx);
9485         isl_stat isl_options_set_schedule_split_scaled(
9486                 isl_ctx *ctx, int val);
9487         int isl_options_get_schedule_split_scaled(
9488                 isl_ctx *ctx);
9489         isl_stat isl_options_set_schedule_treat_coalescing(
9490                 isl_ctx *ctx, int val);
9491         int isl_options_get_schedule_treat_coalescing(
9492                 isl_ctx *ctx);
9493         isl_stat isl_options_set_schedule_algorithm(
9494                 isl_ctx *ctx, int val);
9495         int isl_options_get_schedule_algorithm(
9496                 isl_ctx *ctx);
9497         isl_stat isl_options_set_schedule_carry_self_first(
9498                 isl_ctx *ctx, int val);
9499         int isl_options_get_schedule_carry_self_first(
9500                 isl_ctx *ctx);
9501         isl_stat isl_options_set_schedule_separate_components(
9502                 isl_ctx *ctx, int val);
9503         int isl_options_get_schedule_separate_components(
9504                 isl_ctx *ctx);
9506 =over
9508 =item * schedule_max_coefficient
9510 This option enforces that the coefficients for variable and parameter
9511 dimensions in the calculated schedule are not larger than the specified value.
9512 This option can significantly increase the speed of the scheduling calculation
9513 and may also prevent fusing of unrelated dimensions. A value of -1 means that
9514 this option does not introduce bounds on the variable or parameter
9515 coefficients.
9517 =item * schedule_max_constant_term
9519 This option enforces that the constant coefficients in the calculated schedule
9520 are not larger than the maximal constant term. This option can significantly
9521 increase the speed of the scheduling calculation and may also prevent fusing of
9522 unrelated dimensions. A value of -1 means that this option does not introduce
9523 bounds on the constant coefficients.
9525 =item * schedule_serialize_sccs
9527 If this option is set, then all strongly connected components
9528 in the dependence graph are serialized as soon as they are detected.
9529 This means in particular that instances of statements will only
9530 appear in the same band node if these statements belong
9531 to the same strongly connected component at the point where
9532 the band node is constructed.
9534 =item * schedule_whole_component
9536 If this option is set, then entire (weakly) connected
9537 components in the dependence graph are scheduled together
9538 as a whole.
9539 Otherwise, each strongly connected component within
9540 such a weakly connected component is first scheduled separately
9541 and then combined with other strongly connected components.
9542 This option has no effect if C<schedule_serialize_sccs> is set.
9544 =item * schedule_maximize_band_depth
9546 If this option is set, then the scheduler tries to maximize
9547 the width of the bands.  Wider bands give more possibilities for tiling.
9548 In particular, if the C<schedule_whole_component> option is set,
9549 then bands are split if this might result in wider bands.
9550 Otherwise, the effect of this option is to only allow
9551 strongly connected components to be combined if this does
9552 not reduce the width of the bands.
9553 Note that if the C<schedule_serialize_sccs> options is set, then
9554 the C<schedule_maximize_band_depth> option therefore has no effect.
9556 =item * schedule_maximize_coincidence
9558 This option is only effective if the C<schedule_whole_component>
9559 option is turned off.
9560 If the C<schedule_maximize_coincidence> option is set, then (clusters of)
9561 strongly connected components are only combined with each other
9562 if this does not reduce the number of coincident band members.
9564 =item * schedule_outer_coincidence
9566 If this option is set, then we try to construct schedules
9567 where the outermost scheduling dimension in each band
9568 satisfies the coincidence constraints.
9570 =item * schedule_algorithm
9572 Selects the scheduling algorithm to be used.
9573 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
9574 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
9576 =item * schedule_split_scaled
9578 If this option is set, then we try to construct schedules in which the
9579 constant term is split off from the linear part if the linear parts of
9580 the scheduling rows for all nodes in the graph have a common non-trivial
9581 divisor.
9582 The constant term is then dropped and the linear
9583 part is reduced.
9584 This option is only effective when the Feautrier style scheduler is
9585 being used, either as the main scheduler or as a fallback for the
9586 Pluto-like scheduler.
9588 =item * schedule_treat_coalescing
9590 If this option is set, then the scheduler will try and avoid
9591 producing schedules that perform loop coalescing.
9592 In particular, for the Pluto-like scheduler, this option places
9593 bounds on the schedule coefficients based on the sizes of the instance sets.
9594 For the Feautrier style scheduler, this option detects potentially
9595 coalescing schedules and then tries to adjust the schedule to avoid
9596 the coalescing.
9598 =item * schedule_carry_self_first
9600 If this option is set, then the Feautrier style scheduler
9601 (when used as a fallback for the Pluto-like scheduler) will
9602 first try to only carry self-dependences.
9604 =item * schedule_separate_components
9606 If this option is set then the function C<isl_schedule_get_map>
9607 will treat set nodes in the same way as sequence nodes.
9609 =back
9611 =head2 AST Generation
9613 This section describes the C<isl> functionality for generating
9614 ASTs that visit all the elements
9615 in a domain in an order specified by a schedule tree or
9616 a schedule map.
9617 In case the schedule given as a C<isl_union_map>, an AST is generated
9618 that visits all the elements in the domain of the C<isl_union_map>
9619 according to the lexicographic order of the corresponding image
9620 element(s).  If the range of the C<isl_union_map> consists of
9621 elements in more than one space, then each of these spaces is handled
9622 separately in an arbitrary order.
9623 It should be noted that the schedule tree or the image elements
9624 in a schedule map only specify the I<order>
9625 in which the corresponding domain elements should be visited.
9626 No direct relation between the partial schedule values
9627 or the image elements on the one hand and the loop iterators
9628 in the generated AST on the other hand should be assumed.
9630 Each AST is generated within a build.  The initial build
9631 simply specifies the constraints on the parameters (if any)
9632 and can be created, inspected, copied and freed using the following functions.
9634         #include <isl/ast_build.h>
9635         __isl_give isl_ast_build *isl_ast_build_alloc(
9636                 isl_ctx *ctx);
9637         __isl_give isl_ast_build *isl_ast_build_from_context(
9638                 __isl_take isl_set *set);
9639         __isl_give isl_ast_build *isl_ast_build_copy(
9640                 __isl_keep isl_ast_build *build);
9641         __isl_null isl_ast_build *isl_ast_build_free(
9642                 __isl_take isl_ast_build *build);
9644 The C<set> argument is usually a parameter set with zero or more parameters.
9645 In fact, when creating an AST using C<isl_ast_build_node_from_schedule>,
9646 this set is required to be a parameter set.
9647 An C<isl_ast_build> created using C<isl_ast_build_alloc> does not
9648 specify any parameter constraints.
9649 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
9650 and L</"Fine-grained Control over AST Generation">.
9651 Finally, the AST itself can be constructed using one of the following
9652 functions.
9654         #include <isl/ast_build.h>
9655         __isl_give isl_ast_node *isl_ast_build_node_from_schedule(
9656                 __isl_keep isl_ast_build *build,
9657                 __isl_take isl_schedule *schedule);
9658         __isl_give isl_ast_node *
9659         isl_ast_build_node_from_schedule_map(
9660                 __isl_keep isl_ast_build *build,
9661                 __isl_take isl_union_map *schedule);
9663 =head3 Inspecting the AST
9665 The basic properties of an AST node can be obtained as follows.
9667         #include <isl/ast.h>
9668         enum isl_ast_node_type isl_ast_node_get_type(
9669                 __isl_keep isl_ast_node *node);
9671 The type of an AST node is one of
9672 C<isl_ast_node_for>,
9673 C<isl_ast_node_if>,
9674 C<isl_ast_node_block>,
9675 C<isl_ast_node_mark> or
9676 C<isl_ast_node_user>.
9677 An C<isl_ast_node_for> represents a for node.
9678 An C<isl_ast_node_if> represents an if node.
9679 An C<isl_ast_node_block> represents a compound node.
9680 An C<isl_ast_node_mark> introduces a mark in the AST.
9681 An C<isl_ast_node_user> represents an expression statement.
9682 An expression statement typically corresponds to a domain element, i.e.,
9683 one of the elements that is visited by the AST.
9685 Each type of node has its own additional properties.
9687         #include <isl/ast.h>
9688         __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
9689                 __isl_keep isl_ast_node *node);
9690         __isl_give isl_ast_expr *isl_ast_node_for_get_init(
9691                 __isl_keep isl_ast_node *node);
9692         __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
9693                 __isl_keep isl_ast_node *node);
9694         __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
9695                 __isl_keep isl_ast_node *node);
9696         __isl_give isl_ast_node *isl_ast_node_for_get_body(
9697                 __isl_keep isl_ast_node *node);
9698         isl_bool isl_ast_node_for_is_degenerate(
9699                 __isl_keep isl_ast_node *node);
9701 An C<isl_ast_for> is considered degenerate if it is known to execute
9702 exactly once.
9704         #include <isl/ast.h>
9705         __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
9706                 __isl_keep isl_ast_node *node);
9707         __isl_give isl_ast_node *isl_ast_node_if_get_then(
9708                 __isl_keep isl_ast_node *node);
9709         isl_bool isl_ast_node_if_has_else(
9710                 __isl_keep isl_ast_node *node);
9711         __isl_give isl_ast_node *isl_ast_node_if_get_else(
9712                 __isl_keep isl_ast_node *node);
9714         __isl_give isl_ast_node_list *
9715         isl_ast_node_block_get_children(
9716                 __isl_keep isl_ast_node *node);
9718         __isl_give isl_id *isl_ast_node_mark_get_id(
9719                 __isl_keep isl_ast_node *node);
9720         __isl_give isl_ast_node *isl_ast_node_mark_get_node(
9721                 __isl_keep isl_ast_node *node);
9723 C<isl_ast_node_mark_get_id> returns the identifier of the mark.
9724 C<isl_ast_node_mark_get_node> returns the child node that is being marked.
9726         #include <isl/ast.h>
9727         __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
9728                 __isl_keep isl_ast_node *node);
9730 All descendants of a specific node in the AST (including the node itself)
9731 can be visited
9732 in depth-first pre-order using the following function.
9734         #include <isl/ast.h>
9735         isl_stat isl_ast_node_foreach_descendant_top_down(
9736                 __isl_keep isl_ast_node *node,
9737                 isl_bool (*fn)(__isl_keep isl_ast_node *node,
9738                         void *user), void *user);
9740 The callback function should return C<isl_bool_true> if the children
9741 of the given node should be visited and C<isl_bool_false> if they should not.
9742 It should return C<isl_bool_error> in case of failure, in which case
9743 the entire traversal is aborted.
9745 Each of the returned C<isl_ast_expr>s can in turn be inspected using
9746 the following functions.
9748         #include <isl/ast.h>
9749         enum isl_ast_expr_type isl_ast_expr_get_type(
9750                 __isl_keep isl_ast_expr *expr);
9752 The type of an AST expression is one of
9753 C<isl_ast_expr_op>,
9754 C<isl_ast_expr_id> or
9755 C<isl_ast_expr_int>.
9756 An C<isl_ast_expr_op> represents the result of an operation.
9757 An C<isl_ast_expr_id> represents an identifier.
9758 An C<isl_ast_expr_int> represents an integer value.
9760 Each type of expression has its own additional properties.
9762         #include <isl/ast.h>
9763         enum isl_ast_op_type isl_ast_expr_get_op_type(
9764                 __isl_keep isl_ast_expr *expr);
9765         int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
9766         __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
9767                 __isl_keep isl_ast_expr *expr, int pos);
9768         isl_stat isl_ast_expr_foreach_ast_op_type(
9769                 __isl_keep isl_ast_expr *expr,
9770                 isl_stat (*fn)(enum isl_ast_op_type type,
9771                         void *user), void *user);
9772         isl_stat isl_ast_node_foreach_ast_op_type(
9773                 __isl_keep isl_ast_node *node,
9774                 isl_stat (*fn)(enum isl_ast_op_type type,
9775                         void *user), void *user);
9777 C<isl_ast_expr_get_op_type> returns the type of the operation
9778 performed.  C<isl_ast_expr_get_op_n_arg> returns the number of
9779 arguments.  C<isl_ast_expr_get_op_arg> returns the specified
9780 argument.
9781 C<isl_ast_expr_foreach_ast_op_type> calls C<fn> for each distinct
9782 C<isl_ast_op_type> that appears in C<expr>.
9783 C<isl_ast_node_foreach_ast_op_type> does the same for each distinct
9784 C<isl_ast_op_type> that appears in C<node>.
9785 The operation type is one of the following.
9787 =over
9789 =item C<isl_ast_op_and>
9791 Logical I<and> of two arguments.
9792 Both arguments can be evaluated.
9794 =item C<isl_ast_op_and_then>
9796 Logical I<and> of two arguments.
9797 The second argument can only be evaluated if the first evaluates to true.
9799 =item C<isl_ast_op_or>
9801 Logical I<or> of two arguments.
9802 Both arguments can be evaluated.
9804 =item C<isl_ast_op_or_else>
9806 Logical I<or> of two arguments.
9807 The second argument can only be evaluated if the first evaluates to false.
9809 =item C<isl_ast_op_max>
9811 Maximum of two or more arguments.
9813 =item C<isl_ast_op_min>
9815 Minimum of two or more arguments.
9817 =item C<isl_ast_op_minus>
9819 Change sign.
9821 =item C<isl_ast_op_add>
9823 Sum of two arguments.
9825 =item C<isl_ast_op_sub>
9827 Difference of two arguments.
9829 =item C<isl_ast_op_mul>
9831 Product of two arguments.
9833 =item C<isl_ast_op_div>
9835 Exact division.  That is, the result is known to be an integer.
9837 =item C<isl_ast_op_fdiv_q>
9839 Result of integer division, rounded towards negative
9840 infinity.
9842 =item C<isl_ast_op_pdiv_q>
9844 Result of integer division, where dividend is known to be non-negative.
9846 =item C<isl_ast_op_pdiv_r>
9848 Remainder of integer division, where dividend is known to be non-negative.
9850 =item C<isl_ast_op_zdiv_r>
9852 Equal to zero iff the remainder on integer division is zero.
9854 =item C<isl_ast_op_cond>
9856 Conditional operator defined on three arguments.
9857 If the first argument evaluates to true, then the result
9858 is equal to the second argument.  Otherwise, the result
9859 is equal to the third argument.
9860 The second and third argument may only be evaluated if
9861 the first argument evaluates to true and false, respectively.
9862 Corresponds to C<a ? b : c> in C.
9864 =item C<isl_ast_op_select>
9866 Conditional operator defined on three arguments.
9867 If the first argument evaluates to true, then the result
9868 is equal to the second argument.  Otherwise, the result
9869 is equal to the third argument.
9870 The second and third argument may be evaluated independently
9871 of the value of the first argument.
9872 Corresponds to C<a * b + (1 - a) * c> in C.
9874 =item C<isl_ast_op_eq>
9876 Equality relation.
9878 =item C<isl_ast_op_le>
9880 Less than or equal relation.
9882 =item C<isl_ast_op_lt>
9884 Less than relation.
9886 =item C<isl_ast_op_ge>
9888 Greater than or equal relation.
9890 =item C<isl_ast_op_gt>
9892 Greater than relation.
9894 =item C<isl_ast_op_call>
9896 A function call.
9897 The number of arguments of the C<isl_ast_expr> is one more than
9898 the number of arguments in the function call, the first argument
9899 representing the function being called.
9901 =item C<isl_ast_op_access>
9903 An array access.
9904 The number of arguments of the C<isl_ast_expr> is one more than
9905 the number of index expressions in the array access, the first argument
9906 representing the array being accessed.
9908 =item C<isl_ast_op_member>
9910 A member access.
9911 This operation has two arguments, a structure and the name of
9912 the member of the structure being accessed.
9914 =back
9916         #include <isl/ast.h>
9917         __isl_give isl_id *isl_ast_expr_get_id(
9918                 __isl_keep isl_ast_expr *expr);
9920 Return the identifier represented by the AST expression.
9922         #include <isl/ast.h>
9923         __isl_give isl_val *isl_ast_expr_get_val(
9924                 __isl_keep isl_ast_expr *expr);
9926 Return the integer represented by the AST expression.
9928 =head3 Properties of ASTs
9930         #include <isl/ast.h>
9931         isl_bool isl_ast_expr_is_equal(
9932                 __isl_keep isl_ast_expr *expr1,
9933                 __isl_keep isl_ast_expr *expr2);
9935 Check if two C<isl_ast_expr>s are equal to each other.
9937 =head3 Manipulating and printing the AST
9939 AST nodes can be copied and freed using the following functions.
9941         #include <isl/ast.h>
9942         __isl_give isl_ast_node *isl_ast_node_copy(
9943                 __isl_keep isl_ast_node *node);
9944         __isl_null isl_ast_node *isl_ast_node_free(
9945                 __isl_take isl_ast_node *node);
9947 AST expressions can be copied and freed using the following functions.
9949         #include <isl/ast.h>
9950         __isl_give isl_ast_expr *isl_ast_expr_copy(
9951                 __isl_keep isl_ast_expr *expr);
9952         __isl_null isl_ast_expr *isl_ast_expr_free(
9953                 __isl_take isl_ast_expr *expr);
9955 New AST expressions can be created either directly or within
9956 the context of an C<isl_ast_build>.
9958         #include <isl/ast.h>
9959         __isl_give isl_ast_expr *isl_ast_expr_from_val(
9960                 __isl_take isl_val *v);
9961         __isl_give isl_ast_expr *isl_ast_expr_from_id(
9962                 __isl_take isl_id *id);
9963         __isl_give isl_ast_expr *isl_ast_expr_neg(
9964                 __isl_take isl_ast_expr *expr);
9965         __isl_give isl_ast_expr *isl_ast_expr_address_of(
9966                 __isl_take isl_ast_expr *expr);
9967         __isl_give isl_ast_expr *isl_ast_expr_add(
9968                 __isl_take isl_ast_expr *expr1,
9969                 __isl_take isl_ast_expr *expr2);
9970         __isl_give isl_ast_expr *isl_ast_expr_sub(
9971                 __isl_take isl_ast_expr *expr1,
9972                 __isl_take isl_ast_expr *expr2);
9973         __isl_give isl_ast_expr *isl_ast_expr_mul(
9974                 __isl_take isl_ast_expr *expr1,
9975                 __isl_take isl_ast_expr *expr2);
9976         __isl_give isl_ast_expr *isl_ast_expr_div(
9977                 __isl_take isl_ast_expr *expr1,
9978                 __isl_take isl_ast_expr *expr2);
9979         __isl_give isl_ast_expr *isl_ast_expr_pdiv_q(
9980                 __isl_take isl_ast_expr *expr1,
9981                 __isl_take isl_ast_expr *expr2);
9982         __isl_give isl_ast_expr *isl_ast_expr_pdiv_r(
9983                 __isl_take isl_ast_expr *expr1,
9984                 __isl_take isl_ast_expr *expr2);
9985         __isl_give isl_ast_expr *isl_ast_expr_and(
9986                 __isl_take isl_ast_expr *expr1,
9987                 __isl_take isl_ast_expr *expr2)
9988         __isl_give isl_ast_expr *isl_ast_expr_and_then(
9989                 __isl_take isl_ast_expr *expr1,
9990                 __isl_take isl_ast_expr *expr2)
9991         __isl_give isl_ast_expr *isl_ast_expr_or(
9992                 __isl_take isl_ast_expr *expr1,
9993                 __isl_take isl_ast_expr *expr2)
9994         __isl_give isl_ast_expr *isl_ast_expr_or_else(
9995                 __isl_take isl_ast_expr *expr1,
9996                 __isl_take isl_ast_expr *expr2)
9997         __isl_give isl_ast_expr *isl_ast_expr_eq(
9998                 __isl_take isl_ast_expr *expr1,
9999                 __isl_take isl_ast_expr *expr2);
10000         __isl_give isl_ast_expr *isl_ast_expr_le(
10001                 __isl_take isl_ast_expr *expr1,
10002                 __isl_take isl_ast_expr *expr2);
10003         __isl_give isl_ast_expr *isl_ast_expr_lt(
10004                 __isl_take isl_ast_expr *expr1,
10005                 __isl_take isl_ast_expr *expr2);
10006         __isl_give isl_ast_expr *isl_ast_expr_ge(
10007                 __isl_take isl_ast_expr *expr1,
10008                 __isl_take isl_ast_expr *expr2);
10009         __isl_give isl_ast_expr *isl_ast_expr_gt(
10010                 __isl_take isl_ast_expr *expr1,
10011                 __isl_take isl_ast_expr *expr2);
10012         __isl_give isl_ast_expr *isl_ast_expr_access(
10013                 __isl_take isl_ast_expr *array,
10014                 __isl_take isl_ast_expr_list *indices);
10015         __isl_give isl_ast_expr *isl_ast_expr_call(
10016                 __isl_take isl_ast_expr *function,
10017                 __isl_take isl_ast_expr_list *arguments);
10019 The function C<isl_ast_expr_address_of> can be applied to an
10020 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
10021 to represent the address of the C<isl_ast_expr_access>. The function
10022 C<isl_ast_expr_and_then> as well as C<isl_ast_expr_or_else> are short-circuit
10023 versions of C<isl_ast_expr_and> and C<isl_ast_expr_or>, respectively.
10025         #include <isl/ast_build.h>
10026         __isl_give isl_ast_expr *isl_ast_build_expr_from_set(
10027                 __isl_keep isl_ast_build *build,
10028                 __isl_take isl_set *set);
10029         __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
10030                 __isl_keep isl_ast_build *build,
10031                 __isl_take isl_pw_aff *pa);
10032         __isl_give isl_ast_expr *
10033         isl_ast_build_access_from_pw_multi_aff(
10034                 __isl_keep isl_ast_build *build,
10035                 __isl_take isl_pw_multi_aff *pma);
10036         __isl_give isl_ast_expr *
10037         isl_ast_build_access_from_multi_pw_aff(
10038                 __isl_keep isl_ast_build *build,
10039                 __isl_take isl_multi_pw_aff *mpa);
10040         __isl_give isl_ast_expr *
10041         isl_ast_build_call_from_pw_multi_aff(
10042                 __isl_keep isl_ast_build *build,
10043                 __isl_take isl_pw_multi_aff *pma);
10044         __isl_give isl_ast_expr *
10045         isl_ast_build_call_from_multi_pw_aff(
10046                 __isl_keep isl_ast_build *build,
10047                 __isl_take isl_multi_pw_aff *mpa);
10049 The set <set> and
10050 the domains of C<pa>, C<mpa> and C<pma> should correspond
10051 to the schedule space of C<build>.
10052 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
10053 the function being called.
10054 If the accessed space is a nested relation, then it is taken
10055 to represent an access of the member specified by the range
10056 of this nested relation of the structure specified by the domain
10057 of the nested relation.
10059 The following functions can be used to modify an C<isl_ast_expr>.
10061         #include <isl/ast.h>
10062         __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
10063                 __isl_take isl_ast_expr *expr, int pos,
10064                 __isl_take isl_ast_expr *arg);
10066 Replace the argument of C<expr> at position C<pos> by C<arg>.
10068         #include <isl/ast.h>
10069         __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
10070                 __isl_take isl_ast_expr *expr,
10071                 __isl_take isl_id_to_ast_expr *id2expr);
10073 The function C<isl_ast_expr_substitute_ids> replaces the
10074 subexpressions of C<expr> of type C<isl_ast_expr_id>
10075 by the corresponding expression in C<id2expr>, if there is any.
10078 User specified data can be attached to an C<isl_ast_node> and obtained
10079 from the same C<isl_ast_node> using the following functions.
10081         #include <isl/ast.h>
10082         __isl_give isl_ast_node *isl_ast_node_set_annotation(
10083                 __isl_take isl_ast_node *node,
10084                 __isl_take isl_id *annotation);
10085         __isl_give isl_id *isl_ast_node_get_annotation(
10086                 __isl_keep isl_ast_node *node);
10088 Basic printing can be performed using the following functions.
10090         #include <isl/ast.h>
10091         __isl_give isl_printer *isl_printer_print_ast_expr(
10092                 __isl_take isl_printer *p,
10093                 __isl_keep isl_ast_expr *expr);
10094         __isl_give isl_printer *isl_printer_print_ast_node(
10095                 __isl_take isl_printer *p,
10096                 __isl_keep isl_ast_node *node);
10097         __isl_give char *isl_ast_expr_to_str(
10098                 __isl_keep isl_ast_expr *expr);
10099         __isl_give char *isl_ast_node_to_str(
10100                 __isl_keep isl_ast_node *node);
10101         __isl_give char *isl_ast_expr_to_C_str(
10102                 __isl_keep isl_ast_expr *expr);
10103         __isl_give char *isl_ast_node_to_C_str(
10104                 __isl_keep isl_ast_node *node);
10106 The functions C<isl_ast_expr_to_C_str> and
10107 C<isl_ast_node_to_C_str> are convenience functions
10108 that return a string representation of the input in C format.
10110 More advanced printing can be performed using the following functions.
10112         #include <isl/ast.h>
10113         __isl_give isl_printer *isl_ast_op_type_set_print_name(
10114                 __isl_take isl_printer *p,
10115                 enum isl_ast_op_type type,
10116                 __isl_keep const char *name);
10117         isl_stat isl_options_set_ast_print_macro_once(
10118                 isl_ctx *ctx, int val);
10119         int isl_options_get_ast_print_macro_once(isl_ctx *ctx);
10120         __isl_give isl_printer *isl_ast_op_type_print_macro(
10121                 enum isl_ast_op_type type,
10122                 __isl_take isl_printer *p);
10123         __isl_give isl_printer *isl_ast_expr_print_macros(
10124                 __isl_keep isl_ast_expr *expr,
10125                 __isl_take isl_printer *p);
10126         __isl_give isl_printer *isl_ast_node_print_macros(
10127                 __isl_keep isl_ast_node *node,
10128                 __isl_take isl_printer *p);
10129         __isl_give isl_printer *isl_ast_node_print(
10130                 __isl_keep isl_ast_node *node,
10131                 __isl_take isl_printer *p,
10132                 __isl_take isl_ast_print_options *options);
10133         __isl_give isl_printer *isl_ast_node_for_print(
10134                 __isl_keep isl_ast_node *node,
10135                 __isl_take isl_printer *p,
10136                 __isl_take isl_ast_print_options *options);
10137         __isl_give isl_printer *isl_ast_node_if_print(
10138                 __isl_keep isl_ast_node *node,
10139                 __isl_take isl_printer *p,
10140                 __isl_take isl_ast_print_options *options);
10142 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
10143 C<isl> may print out an AST that makes use of macros such
10144 as C<floord>, C<min> and C<max>.
10145 The names of these macros may be modified by a call
10146 to C<isl_ast_op_type_set_print_name>.  The user-specified
10147 names are associated to the printer object.
10148 C<isl_ast_op_type_print_macro> prints out the macro
10149 corresponding to a specific C<isl_ast_op_type>.
10150 If the print-macro-once option is set, then a given macro definition
10151 is only printed once to any given printer object.
10152 C<isl_ast_expr_print_macros> scans the C<isl_ast_expr>
10153 for subexpressions where these macros would be used and prints
10154 out the required macro definitions.
10155 Essentially, C<isl_ast_expr_print_macros> calls
10156 C<isl_ast_expr_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
10157 as function argument.
10158 C<isl_ast_node_print_macros> does the same
10159 for expressions in its C<isl_ast_node> argument.
10160 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
10161 C<isl_ast_node_if_print> print an C<isl_ast_node>
10162 in C<ISL_FORMAT_C>, but allow for some extra control
10163 through an C<isl_ast_print_options> object.
10164 This object can be created using the following functions.
10166         #include <isl/ast.h>
10167         __isl_give isl_ast_print_options *
10168         isl_ast_print_options_alloc(isl_ctx *ctx);
10169         __isl_give isl_ast_print_options *
10170         isl_ast_print_options_copy(
10171                 __isl_keep isl_ast_print_options *options);
10172         __isl_null isl_ast_print_options *
10173         isl_ast_print_options_free(
10174                 __isl_take isl_ast_print_options *options);
10176         __isl_give isl_ast_print_options *
10177         isl_ast_print_options_set_print_user(
10178                 __isl_take isl_ast_print_options *options,
10179                 __isl_give isl_printer *(*print_user)(
10180                         __isl_take isl_printer *p,
10181                         __isl_take isl_ast_print_options *options,
10182                         __isl_keep isl_ast_node *node, void *user),
10183                 void *user);
10184         __isl_give isl_ast_print_options *
10185         isl_ast_print_options_set_print_for(
10186                 __isl_take isl_ast_print_options *options,
10187                 __isl_give isl_printer *(*print_for)(
10188                         __isl_take isl_printer *p,
10189                         __isl_take isl_ast_print_options *options,
10190                         __isl_keep isl_ast_node *node, void *user),
10191                 void *user);
10193 The callback set by C<isl_ast_print_options_set_print_user>
10194 is called whenever a node of type C<isl_ast_node_user> needs to
10195 be printed.
10196 The callback set by C<isl_ast_print_options_set_print_for>
10197 is called whenever a node of type C<isl_ast_node_for> needs to
10198 be printed.
10199 Note that C<isl_ast_node_for_print> will I<not> call the
10200 callback set by C<isl_ast_print_options_set_print_for> on the node
10201 on which C<isl_ast_node_for_print> is called, but only on nested
10202 nodes of type C<isl_ast_node_for>.  It is therefore safe to
10203 call C<isl_ast_node_for_print> from within the callback set by
10204 C<isl_ast_print_options_set_print_for>.
10206 The following option determines the type to be used for iterators
10207 while printing the AST.
10209         isl_stat isl_options_set_ast_iterator_type(
10210                 isl_ctx *ctx, const char *val);
10211         const char *isl_options_get_ast_iterator_type(
10212                 isl_ctx *ctx);
10214 The AST printer only prints body nodes as blocks if these
10215 blocks cannot be safely omitted.
10216 For example, a C<for> node with one body node will not be
10217 surrounded with braces in C<ISL_FORMAT_C>.
10218 A block will always be printed by setting the following option.
10220         isl_stat isl_options_set_ast_always_print_block(isl_ctx *ctx,
10221                 int val);
10222         int isl_options_get_ast_always_print_block(isl_ctx *ctx);
10224 =head3 Options
10226         #include <isl/ast_build.h>
10227         isl_stat isl_options_set_ast_build_atomic_upper_bound(
10228                 isl_ctx *ctx, int val);
10229         int isl_options_get_ast_build_atomic_upper_bound(
10230                 isl_ctx *ctx);
10231         isl_stat isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
10232                 int val);
10233         int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
10234         isl_stat isl_options_set_ast_build_detect_min_max(
10235                 isl_ctx *ctx, int val);
10236         int isl_options_get_ast_build_detect_min_max(
10237                 isl_ctx *ctx);
10238         isl_stat isl_options_set_ast_build_exploit_nested_bounds(
10239                 isl_ctx *ctx, int val);
10240         int isl_options_get_ast_build_exploit_nested_bounds(
10241                 isl_ctx *ctx);
10242         isl_stat isl_options_set_ast_build_group_coscheduled(
10243                 isl_ctx *ctx, int val);
10244         int isl_options_get_ast_build_group_coscheduled(
10245                 isl_ctx *ctx);
10246         isl_stat isl_options_set_ast_build_scale_strides(
10247                 isl_ctx *ctx, int val);
10248         int isl_options_get_ast_build_scale_strides(
10249                 isl_ctx *ctx);
10250         isl_stat isl_options_set_ast_build_allow_else(isl_ctx *ctx,
10251                 int val);
10252         int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
10253         isl_stat isl_options_set_ast_build_allow_or(isl_ctx *ctx,
10254                 int val);
10255         int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
10257 =over
10259 =item * ast_build_atomic_upper_bound
10261 Generate loop upper bounds that consist of the current loop iterator,
10262 an operator and an expression not involving the iterator.
10263 If this option is not set, then the current loop iterator may appear
10264 several times in the upper bound.
10265 For example, when this option is turned off, AST generation
10266 for the schedule
10268         [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
10270 produces
10272         for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
10273           A(c0);
10275 When the option is turned on, the following AST is generated
10277         for (int c0 = 0; c0 <= min(100, n); c0 += 1)
10278           A(c0);
10280 =item * ast_build_prefer_pdiv
10282 If this option is turned off, then the AST generation will
10283 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
10284 operators, but no C<isl_ast_op_pdiv_q> or
10285 C<isl_ast_op_pdiv_r> operators.
10286 If this option is turned on, then C<isl> will try to convert
10287 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
10288 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
10290 =item * ast_build_detect_min_max
10292 If this option is turned on, then C<isl> will try and detect
10293 min or max-expressions when building AST expressions from
10294 piecewise affine expressions.
10296 =item * ast_build_exploit_nested_bounds
10298 Simplify conditions based on bounds of nested for loops.
10299 In particular, remove conditions that are implied by the fact
10300 that one or more nested loops have at least one iteration,
10301 meaning that the upper bound is at least as large as the lower bound.
10302 For example, when this option is turned off, AST generation
10303 for the schedule
10305         [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
10306                                         0 <= j <= M }
10308 produces
10310         if (M >= 0)
10311           for (int c0 = 0; c0 <= N; c0 += 1)
10312             for (int c1 = 0; c1 <= M; c1 += 1)
10313               A(c0, c1);
10315 When the option is turned on, the following AST is generated
10317         for (int c0 = 0; c0 <= N; c0 += 1)
10318           for (int c1 = 0; c1 <= M; c1 += 1)
10319             A(c0, c1);
10321 =item * ast_build_group_coscheduled
10323 If two domain elements are assigned the same schedule point, then
10324 they may be executed in any order and they may even appear in different
10325 loops.  If this options is set, then the AST generator will make
10326 sure that coscheduled domain elements do not appear in separate parts
10327 of the AST.  This is useful in case of nested AST generation
10328 if the outer AST generation is given only part of a schedule
10329 and the inner AST generation should handle the domains that are
10330 coscheduled by this initial part of the schedule together.
10331 For example if an AST is generated for a schedule
10333         { A[i] -> [0]; B[i] -> [0] }
10335 then the C<isl_ast_build_set_create_leaf> callback described
10336 below may get called twice, once for each domain.
10337 Setting this option ensures that the callback is only called once
10338 on both domains together.
10340 =item * ast_build_separation_bounds
10342 This option specifies which bounds to use during separation.
10343 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
10344 then all (possibly implicit) bounds on the current dimension will
10345 be used during separation.
10346 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
10347 then only those bounds that are explicitly available will
10348 be used during separation.
10350 =item * ast_build_scale_strides
10352 This option specifies whether the AST generator is allowed
10353 to scale down iterators of strided loops.
10355 =item * ast_build_allow_else
10357 This option specifies whether the AST generator is allowed
10358 to construct if statements with else branches.
10360 =item * ast_build_allow_or
10362 This option specifies whether the AST generator is allowed
10363 to construct if conditions with disjunctions.
10365 =back
10367 =head3 AST Generation Options (Schedule Tree)
10369 In case of AST construction from a schedule tree, the options
10370 that control how an AST is created from the individual schedule
10371 dimensions are stored in the band nodes of the tree
10372 (see L</"Schedule Trees">).
10374 In particular, a schedule dimension can be handled in four
10375 different ways, atomic, separate, unroll or the default.
10376 This loop AST generation type can be set using
10377 C<isl_schedule_node_band_member_set_ast_loop_type>.
10378 Alternatively,
10379 the first three can be selected by including a one-dimensional
10380 element with as value the position of the schedule dimension
10381 within the band and as name one of C<atomic>, C<separate>
10382 or C<unroll> in the options
10383 set by C<isl_schedule_node_band_set_ast_build_options>.
10384 Only one of these three may be specified for
10385 any given schedule dimension within a band node.
10386 If none of these is specified, then the default
10387 is used.  The meaning of the options is as follows.
10389 =over
10391 =item C<atomic>
10393 When this option is specified, the AST generator will make
10394 sure that a given domains space only appears in a single
10395 loop at the specified level.
10397 For example, for the schedule tree
10399         domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
10400         child:
10401           schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
10402           options: "{ atomic[x] }"
10404 the following AST will be generated
10406         for (int c0 = 0; c0 <= 10; c0 += 1) {
10407           if (c0 >= 1)
10408             b(c0 - 1);
10409           if (c0 <= 9)
10410             a(c0);
10411         }
10413 On the other hand, for the schedule tree
10415         domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
10416         child:
10417           schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
10418           options: "{ separate[x] }"
10420 the following AST will be generated
10422         {
10423           a(0);
10424           for (int c0 = 1; c0 <= 9; c0 += 1) {
10425             b(c0 - 1);
10426             a(c0);
10427           }
10428           b(9);
10429         }
10431 If neither C<atomic> nor C<separate> is specified, then the AST generator
10432 may produce either of these two results or some intermediate form.
10434 =item C<separate>
10436 When this option is specified, the AST generator will
10437 split the domain of the specified schedule dimension
10438 into pieces with a fixed set of statements for which
10439 instances need to be executed by the iterations in
10440 the schedule domain part.  This option tends to avoid
10441 the generation of guards inside the corresponding loops.
10442 See also the C<atomic> option.
10444 =item C<unroll>
10446 When this option is specified, the AST generator will
10447 I<completely> unroll the corresponding schedule dimension.
10448 It is the responsibility of the user to ensure that such
10449 unrolling is possible.
10450 To obtain a partial unrolling, the user should apply an additional
10451 strip-mining to the schedule and fully unroll the inner schedule
10452 dimension.
10454 =back
10456 The C<isolate> option is a bit more involved.  It allows the user
10457 to isolate a range of schedule dimension values from smaller and
10458 greater values.  Additionally, the user may specify a different
10459 atomic/separate/unroll choice for the isolated part and the remaining
10460 parts.  The typical use case of the C<isolate> option is to isolate
10461 full tiles from partial tiles.
10462 The part that needs to be isolated may depend on outer schedule dimensions.
10463 The option therefore needs to be able to reference those outer schedule
10464 dimensions.  In particular, the space of the C<isolate> option is that
10465 of a wrapped map with as domain the flat product of all outer band nodes
10466 and as range the space of the current band node.
10467 The atomic/separate/unroll choice for the isolated part is determined
10468 by an option that lives in an unnamed wrapped space with as domain
10469 a zero-dimensional C<isolate> space and as range the regular
10470 C<atomic>, C<separate> or C<unroll> space.
10471 This option may also be set directly using
10472 C<isl_schedule_node_band_member_set_isolate_ast_loop_type>.
10473 The atomic/separate/unroll choice for the remaining part is determined
10474 by the regular C<atomic>, C<separate> or C<unroll> option.
10475 Since the C<isolate> option references outer schedule dimensions,
10476 its use in a band node causes any tree containing the node
10477 to be considered anchored.
10479 As an example, consider the isolation of full tiles from partial tiles
10480 in a tiling of a triangular domain.  The original schedule is as follows.
10482         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10483         child:
10484           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10485                 { A[i,j] -> [floor(j/10)] }, \
10486                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10488 The output is
10490         for (int c0 = 0; c0 <= 10; c0 += 1)
10491           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10492             for (int c2 = 10 * c0;
10493                  c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10494               for (int c3 = 10 * c1;
10495                    c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10496                 A(c2, c3);
10498 Isolating the full tiles, we have the following input
10500         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10501         child:
10502           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10503                 { A[i,j] -> [floor(j/10)] }, \
10504                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10505           options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
10506                 10a+9+10b+9 <= 100 }"
10508 and output
10510         {
10511           for (int c0 = 0; c0 <= 8; c0 += 1) {
10512             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10513               for (int c2 = 10 * c0;
10514                    c2 <= 10 * c0 + 9; c2 += 1)
10515                 for (int c3 = 10 * c1;
10516                      c3 <= 10 * c1 + 9; c3 += 1)
10517                   A(c2, c3);
10518             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10519               for (int c2 = 10 * c0;
10520                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10521                 for (int c3 = 10 * c1;
10522                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10523                   A(c2, c3);
10524           }
10525           for (int c0 = 9; c0 <= 10; c0 += 1)
10526             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10527               for (int c2 = 10 * c0;
10528                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10529                 for (int c3 = 10 * c1;
10530                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10531                   A(c2, c3);
10532         }
10534 We may then additionally unroll the innermost loop of the isolated part
10536         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10537         child:
10538           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10539                 { A[i,j] -> [floor(j/10)] }, \
10540                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10541           options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
10542                 10a+9+10b+9 <= 100; [isolate[] -> unroll[3]] }"
10544 to obtain
10546         {
10547           for (int c0 = 0; c0 <= 8; c0 += 1) {
10548             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10549               for (int c2 = 10 * c0; c2 <= 10 * c0 + 9; c2 += 1) {
10550                 A(c2, 10 * c1);
10551                 A(c2, 10 * c1 + 1);
10552                 A(c2, 10 * c1 + 2);
10553                 A(c2, 10 * c1 + 3);
10554                 A(c2, 10 * c1 + 4);
10555                 A(c2, 10 * c1 + 5);
10556                 A(c2, 10 * c1 + 6);
10557                 A(c2, 10 * c1 + 7);
10558                 A(c2, 10 * c1 + 8);
10559                 A(c2, 10 * c1 + 9);
10560               }
10561             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10562               for (int c2 = 10 * c0;
10563                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10564                 for (int c3 = 10 * c1;
10565                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10566                   A(c2, c3);
10567           }
10568           for (int c0 = 9; c0 <= 10; c0 += 1)
10569             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10570               for (int c2 = 10 * c0;
10571                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10572                 for (int c3 = 10 * c1;
10573                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10574                   A(c2, c3);
10575         }
10578 =head3 AST Generation Options (Schedule Map)
10580 In case of AST construction using
10581 C<isl_ast_build_node_from_schedule_map>, the options
10582 that control how an AST is created from the individual schedule
10583 dimensions are stored in the C<isl_ast_build>.
10584 They can be set using the following function.
10586         #include <isl/ast_build.h>
10587         __isl_give isl_ast_build *
10588         isl_ast_build_set_options(
10589                 __isl_take isl_ast_build *build,
10590                 __isl_take isl_union_map *options);
10592 The options are encoded in an C<isl_union_map>.
10593 The domain of this union relation refers to the schedule domain,
10594 i.e., the range of the schedule passed
10595 to C<isl_ast_build_node_from_schedule_map>.
10596 In the case of nested AST generation (see L</"Nested AST Generation">),
10597 the domain of C<options> should refer to the extra piece of the schedule.
10598 That is, it should be equal to the range of the wrapped relation in the
10599 range of the schedule.
10600 The range of the options can consist of elements in one or more spaces,
10601 the names of which determine the effect of the option.
10602 The values of the range typically also refer to the schedule dimension
10603 to which the option applies.  In case of nested AST generation
10604 (see L</"Nested AST Generation">), these values refer to the position
10605 of the schedule dimension within the innermost AST generation.
10606 The constraints on the domain elements of
10607 the option should only refer to this dimension and earlier dimensions.
10608 We consider the following spaces.
10610 =over
10612 =item C<separation_class>
10614 B<This option has been deprecated.  Use the isolate option on
10615 schedule trees instead.>
10617 This space is a wrapped relation between two one dimensional spaces.
10618 The input space represents the schedule dimension to which the option
10619 applies and the output space represents the separation class.
10620 While constructing a loop corresponding to the specified schedule
10621 dimension(s), the AST generator will try to generate separate loops
10622 for domain elements that are assigned different classes.
10623 If only some of the elements are assigned a class, then those elements
10624 that are not assigned any class will be treated as belonging to a class
10625 that is separate from the explicitly assigned classes.
10626 The typical use case for this option is to separate full tiles from
10627 partial tiles.
10628 The other options, described below, are applied after the separation
10629 into classes.
10631 As an example, consider the separation into full and partial tiles
10632 of a tiling of a triangular domain.
10633 Take, for example, the domain
10635         { A[i,j] : 0 <= i,j and i + j <= 100 }
10637 and a tiling into tiles of 10 by 10.  The input to the AST generator
10638 is then the schedule
10640         { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
10641                                                 i + j <= 100 }
10643 Without any options, the following AST is generated
10645         for (int c0 = 0; c0 <= 10; c0 += 1)
10646           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10647             for (int c2 = 10 * c0;
10648                  c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10649                  c2 += 1)
10650               for (int c3 = 10 * c1;
10651                    c3 <= min(10 * c1 + 9, -c2 + 100);
10652                    c3 += 1)
10653                 A(c2, c3);
10655 Separation into full and partial tiles can be obtained by assigning
10656 a class, say C<0>, to the full tiles.  The full tiles are represented by those
10657 values of the first and second schedule dimensions for which there are
10658 values of the third and fourth dimensions to cover an entire tile.
10659 That is, we need to specify the following option
10661         { [a,b,c,d] -> separation_class[[0]->[0]] :
10662                 exists b': 0 <= 10a,10b' and
10663                            10a+9+10b'+9 <= 100;
10664           [a,b,c,d] -> separation_class[[1]->[0]] :
10665                 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
10667 which simplifies to
10669         { [a, b, c, d] -> separation_class[[1] -> [0]] :
10670                 a >= 0 and b >= 0 and b <= 8 - a;
10671           [a, b, c, d] -> separation_class[[0] -> [0]] :
10672                 a >= 0 and a <= 8 }
10674 With this option, the generated AST is as follows
10676         {
10677           for (int c0 = 0; c0 <= 8; c0 += 1) {
10678             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10679               for (int c2 = 10 * c0;
10680                    c2 <= 10 * c0 + 9; c2 += 1)
10681                 for (int c3 = 10 * c1;
10682                      c3 <= 10 * c1 + 9; c3 += 1)
10683                   A(c2, c3);
10684             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10685               for (int c2 = 10 * c0;
10686                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10687                    c2 += 1)
10688                 for (int c3 = 10 * c1;
10689                      c3 <= min(-c2 + 100, 10 * c1 + 9);
10690                      c3 += 1)
10691                   A(c2, c3);
10692           }
10693           for (int c0 = 9; c0 <= 10; c0 += 1)
10694             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10695               for (int c2 = 10 * c0;
10696                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10697                    c2 += 1)
10698                 for (int c3 = 10 * c1;
10699                      c3 <= min(10 * c1 + 9, -c2 + 100);
10700                      c3 += 1)
10701                   A(c2, c3);
10702         }
10704 =item C<separate>
10706 This is a single-dimensional space representing the schedule dimension(s)
10707 to which ``separation'' should be applied.  Separation tries to split
10708 a loop into several pieces if this can avoid the generation of guards
10709 inside the loop.
10710 See also the C<atomic> option.
10712 =item C<atomic>
10714 This is a single-dimensional space representing the schedule dimension(s)
10715 for which the domains should be considered ``atomic''.  That is, the
10716 AST generator will make sure that any given domain space will only appear
10717 in a single loop at the specified level.
10719 Consider the following schedule
10721         { a[i] -> [i] : 0 <= i < 10;
10722           b[i] -> [i+1] : 0 <= i < 10 }
10724 If the following option is specified
10726         { [i] -> separate[x] }
10728 then the following AST will be generated
10730         {
10731           a(0);
10732           for (int c0 = 1; c0 <= 9; c0 += 1) {
10733             a(c0);
10734             b(c0 - 1);
10735           }
10736           b(9);
10737         }
10739 If, on the other hand, the following option is specified
10741         { [i] -> atomic[x] }
10743 then the following AST will be generated
10745         for (int c0 = 0; c0 <= 10; c0 += 1) {
10746           if (c0 <= 9)
10747             a(c0);
10748           if (c0 >= 1)
10749             b(c0 - 1);
10750         }
10752 If neither C<atomic> nor C<separate> is specified, then the AST generator
10753 may produce either of these two results or some intermediate form.
10755 =item C<unroll>
10757 This is a single-dimensional space representing the schedule dimension(s)
10758 that should be I<completely> unrolled.
10759 To obtain a partial unrolling, the user should apply an additional
10760 strip-mining to the schedule and fully unroll the inner loop.
10762 =back
10764 =head3 Fine-grained Control over AST Generation
10766 Besides specifying the constraints on the parameters,
10767 an C<isl_ast_build> object can be used to control
10768 various aspects of the AST generation process.
10769 In case of AST construction using
10770 C<isl_ast_build_node_from_schedule_map>,
10771 the most prominent way of control is through ``options'',
10772 as explained above.
10774 Additional control is available through the following functions.
10776         #include <isl/ast_build.h>
10777         __isl_give isl_ast_build *
10778         isl_ast_build_set_iterators(
10779                 __isl_take isl_ast_build *build,
10780                 __isl_take isl_id_list *iterators);
10782 The function C<isl_ast_build_set_iterators> allows the user to
10783 specify a list of iterator C<isl_id>s to be used as iterators.
10784 If the input schedule is injective, then
10785 the number of elements in this list should be as large as the dimension
10786 of the schedule space, but no direct correspondence should be assumed
10787 between dimensions and elements.
10788 If the input schedule is not injective, then an additional number
10789 of C<isl_id>s equal to the largest dimension of the input domains
10790 may be required.
10791 If the number of provided C<isl_id>s is insufficient, then additional
10792 names are automatically generated.
10794         #include <isl/ast_build.h>
10795         __isl_give isl_ast_build *
10796         isl_ast_build_set_create_leaf(
10797                 __isl_take isl_ast_build *build,
10798                 __isl_give isl_ast_node *(*fn)(
10799                         __isl_take isl_ast_build *build,
10800                         void *user), void *user);
10803 C<isl_ast_build_set_create_leaf> function allows for the
10804 specification of a callback that should be called whenever the AST
10805 generator arrives at an element of the schedule domain.
10806 The callback should return an AST node that should be inserted
10807 at the corresponding position of the AST.  The default action (when
10808 the callback is not set) is to continue generating parts of the AST to scan
10809 all the domain elements associated to the schedule domain element
10810 and to insert user nodes, ``calling'' the domain element, for each of them.
10811 The C<build> argument contains the current state of the C<isl_ast_build>.
10812 To ease nested AST generation (see L</"Nested AST Generation">),
10813 all control information that is
10814 specific to the current AST generation such as the options and
10815 the callbacks has been removed from this C<isl_ast_build>.
10816 The callback would typically return the result of a nested
10817 AST generation or a
10818 user defined node created using the following function.
10820         #include <isl/ast.h>
10821         __isl_give isl_ast_node *isl_ast_node_alloc_user(
10822                 __isl_take isl_ast_expr *expr);
10824         #include <isl/ast_build.h>
10825         __isl_give isl_ast_build *
10826         isl_ast_build_set_at_each_domain(
10827                 __isl_take isl_ast_build *build,
10828                 __isl_give isl_ast_node *(*fn)(
10829                         __isl_take isl_ast_node *node,
10830                         __isl_keep isl_ast_build *build,
10831                         void *user), void *user);
10832         __isl_give isl_ast_build *
10833         isl_ast_build_set_before_each_for(
10834                 __isl_take isl_ast_build *build,
10835                 __isl_give isl_id *(*fn)(
10836                         __isl_keep isl_ast_build *build,
10837                         void *user), void *user);
10838         __isl_give isl_ast_build *
10839         isl_ast_build_set_after_each_for(
10840                 __isl_take isl_ast_build *build,
10841                 __isl_give isl_ast_node *(*fn)(
10842                         __isl_take isl_ast_node *node,
10843                         __isl_keep isl_ast_build *build,
10844                         void *user), void *user);
10845         __isl_give isl_ast_build *
10846         isl_ast_build_set_before_each_mark(
10847                 __isl_take isl_ast_build *build,
10848                 isl_stat (*fn)(__isl_keep isl_id *mark,
10849                         __isl_keep isl_ast_build *build,
10850                         void *user), void *user);
10851         __isl_give isl_ast_build *
10852         isl_ast_build_set_after_each_mark(
10853                 __isl_take isl_ast_build *build,
10854                 __isl_give isl_ast_node *(*fn)(
10855                         __isl_take isl_ast_node *node,
10856                         __isl_keep isl_ast_build *build,
10857                         void *user), void *user);
10859 The callback set by C<isl_ast_build_set_at_each_domain> will
10860 be called for each domain AST node.
10861 The callbacks set by C<isl_ast_build_set_before_each_for>
10862 and C<isl_ast_build_set_after_each_for> will be called
10863 for each for AST node.  The first will be called in depth-first
10864 pre-order, while the second will be called in depth-first post-order.
10865 Since C<isl_ast_build_set_before_each_for> is called before the for
10866 node is actually constructed, it is only passed an C<isl_ast_build>.
10867 The returned C<isl_id> will be added as an annotation (using
10868 C<isl_ast_node_set_annotation>) to the constructed for node.
10869 In particular, if the user has also specified an C<after_each_for>
10870 callback, then the annotation can be retrieved from the node passed to
10871 that callback using C<isl_ast_node_get_annotation>.
10872 The callbacks set by C<isl_ast_build_set_before_each_mark>
10873 and C<isl_ast_build_set_after_each_mark> will be called for each
10874 mark AST node that is created, i.e., for each mark schedule node
10875 in the input schedule tree.  The first will be called in depth-first
10876 pre-order, while the second will be called in depth-first post-order.
10877 Since the callback set by C<isl_ast_build_set_before_each_mark>
10878 is called before the mark AST node is actually constructed, it is passed
10879 the identifier of the mark node.
10880 All callbacks should C<NULL> (or C<isl_stat_error>) on failure.
10881 The given C<isl_ast_build> can be used to create new
10882 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
10883 or C<isl_ast_build_call_from_pw_multi_aff>.
10885 =head3 Nested AST Generation
10887 C<isl> allows the user to create an AST within the context
10888 of another AST.  These nested ASTs are created using the
10889 same C<isl_ast_build_node_from_schedule_map> function that is used to create
10890 the outer AST.  The C<build> argument should be an C<isl_ast_build>
10891 passed to a callback set by
10892 C<isl_ast_build_set_create_leaf>.
10893 The space of the range of the C<schedule> argument should refer
10894 to this build.  In particular, the space should be a wrapped
10895 relation and the domain of this wrapped relation should be the
10896 same as that of the range of the schedule returned by
10897 C<isl_ast_build_get_schedule> below.
10898 In practice, the new schedule is typically
10899 created by calling C<isl_union_map_range_product> on the old schedule
10900 and some extra piece of the schedule.
10901 The space of the schedule domain is also available from
10902 the C<isl_ast_build>.
10904         #include <isl/ast_build.h>
10905         __isl_give isl_union_map *isl_ast_build_get_schedule(
10906                 __isl_keep isl_ast_build *build);
10907         __isl_give isl_space *isl_ast_build_get_schedule_space(
10908                 __isl_keep isl_ast_build *build);
10909         __isl_give isl_ast_build *isl_ast_build_restrict(
10910                 __isl_take isl_ast_build *build,
10911                 __isl_take isl_set *set);
10913 The C<isl_ast_build_get_schedule> function returns a (partial)
10914 schedule for the domains elements for which part of the AST still needs to
10915 be generated in the current build.
10916 In particular, the domain elements are mapped to those iterations of the loops
10917 enclosing the current point of the AST generation inside which
10918 the domain elements are executed.
10919 No direct correspondence between
10920 the input schedule and this schedule should be assumed.
10921 The space obtained from C<isl_ast_build_get_schedule_space> can be used
10922 to create a set for C<isl_ast_build_restrict> to intersect
10923 with the current build.  In particular, the set passed to
10924 C<isl_ast_build_restrict> can have additional parameters.
10925 The ids of the set dimensions in the space returned by
10926 C<isl_ast_build_get_schedule_space> correspond to the
10927 iterators of the already generated loops.
10928 The user should not rely on the ids of the output dimensions
10929 of the relations in the union relation returned by
10930 C<isl_ast_build_get_schedule> having any particular value.
10932 =head1 Applications
10934 Although C<isl> is mainly meant to be used as a library,
10935 it also contains some basic applications that use some
10936 of the functionality of C<isl>.
10937 For applications that take one or more polytopes or polyhedra
10938 as input, this input may be specified in either the L<isl format>
10939 or the L<PolyLib format>.
10941 =head2 C<isl_polyhedron_sample>
10943 C<isl_polyhedron_sample> takes a polyhedron as input and prints
10944 an integer element of the polyhedron, if there is any.
10945 The first column in the output is the denominator and is always
10946 equal to 1.  If the polyhedron contains no integer points,
10947 then a vector of length zero is printed.
10949 =head2 C<isl_pip>
10951 C<isl_pip> takes the same input as the C<example> program
10952 from the C<piplib> distribution, i.e., a set of constraints
10953 on the parameters, a line containing only -1 and finally a set
10954 of constraints on a parametric polyhedron.
10955 The coefficients of the parameters appear in the last columns
10956 (but before the final constant column).
10957 The output is the lexicographic minimum of the parametric polyhedron.
10958 As C<isl> currently does not have its own output format, the output
10959 is just a dump of the internal state.
10961 =head2 C<isl_polyhedron_minimize>
10963 C<isl_polyhedron_minimize> computes the minimum of some linear
10964 or affine objective function over the integer points in a polyhedron.
10965 If an affine objective function
10966 is given, then the constant should appear in the last column.
10968 =head2 C<isl_polytope_scan>
10970 Given a polytope, C<isl_polytope_scan> prints
10971 all integer points in the polytope.
10973 =head2 C<isl_flow>
10975 Given an C<isl_union_access_info> object as input,
10976 C<isl_flow> prints out the corresponding dependences,
10977 as computed by C<isl_union_access_info_compute_flow>.
10979 =head2 C<isl_codegen>
10981 Given either a schedule tree or a sequence consisting of
10982 a schedule map, a context set and an options relation,
10983 C<isl_codegen> prints out an AST that scans the domain elements
10984 of the schedule in the order of their image(s) taking into account
10985 the constraints in the context set.
10987 =head2 C<isl_schedule>
10989 Given an C<isl_schedule_constraints> object as input,
10990 C<isl_schedule> prints out a schedule that satisfies the given
10991 constraints.