add m4/ax_prog_{cc,cxx}_for_build.m4
[isl.git] / doc / user.pod
bloba1897b9ce854cbe2356859723bf97f8652d1900a
1 =head1 Introduction
3 C<isl> is a thread-safe C library for manipulating
4 sets and relations of integer points bounded by affine constraints.
5 The descriptions of the sets and relations may involve
6 both parameters and existentially quantified variables.
7 All computations are performed in exact integer arithmetic
8 using C<GMP> or C<imath>.
9 The C<isl> library offers functionality that is similar
10 to that offered by the C<Omega> and C<Omega+> libraries,
11 but the underlying algorithms are in most cases completely different.
13 The library is by no means complete and some fairly basic
14 functionality is still missing.
15 Still, even in its current form, the library has been successfully
16 used as a backend polyhedral library for the polyhedral
17 scanner C<CLooG> and as part of an equivalence checker of
18 static affine programs.
19 For bug reports, feature requests and questions,
20 visit the discussion group at
21 L<http://groups.google.com/group/isl-development>.
23 =head2 Backward Incompatible Changes
25 =head3 Changes since isl-0.02
27 =over
29 =item * The old printing functions have been deprecated
30 and replaced by C<isl_printer> functions, see L<Input and Output>.
32 =item * Most functions related to dependence analysis have acquired
33 an extra C<must> argument.  To obtain the old behavior, this argument
34 should be given the value 1.  See L<Dependence Analysis>.
36 =back
38 =head3 Changes since isl-0.03
40 =over
42 =item * The function C<isl_pw_qpolynomial_fold_add> has been
43 renamed to C<isl_pw_qpolynomial_fold_fold>.
44 Similarly, C<isl_union_pw_qpolynomial_fold_add> has been
45 renamed to C<isl_union_pw_qpolynomial_fold_fold>.
47 =back
49 =head3 Changes since isl-0.04
51 =over
53 =item * All header files have been renamed from C<isl_header.h>
54 to C<isl/header.h>.
56 =back
58 =head3 Changes since isl-0.05
60 =over
62 =item * The functions C<isl_printer_print_basic_set> and
63 C<isl_printer_print_basic_map> no longer print a newline.
65 =item * The functions C<isl_flow_get_no_source>
66 and C<isl_union_map_compute_flow> now return
67 the accesses for which no source could be found instead of
68 the iterations where those accesses occur.
70 =item * The functions C<isl_basic_map_identity> and
71 C<isl_map_identity> now take a B<map> space as input.  An old call
72 C<isl_map_identity(space)> can be rewritten to
73 C<isl_map_identity(isl_space_map_from_set(space))>.
75 =item * The function C<isl_map_power> no longer takes
76 a parameter position as input.  Instead, the exponent
77 is now expressed as the domain of the resulting relation.
79 =back
81 =head3 Changes since isl-0.06
83 =over
85 =item * The format of C<isl_printer_print_qpolynomial>'s
86 C<ISL_FORMAT_ISL> output has changed.
87 Use C<ISL_FORMAT_C> to obtain the old output.
89 =item * The C<*_fast_*> functions have been renamed to C<*_plain_*>.
90 Some of the old names have been kept for backward compatibility,
91 but they will be removed in the future.
93 =back
95 =head3 Changes since isl-0.07
97 =over
99 =item * The function C<isl_pw_aff_max> has been renamed to
100 C<isl_pw_aff_union_max>.
101 Similarly, the function C<isl_pw_aff_add> has been renamed to
102 C<isl_pw_aff_union_add>.
104 =item * The C<isl_dim> type has been renamed to C<isl_space>
105 along with the associated functions.
106 Some of the old names have been kept for backward compatibility,
107 but they will be removed in the future.
109 =item * Spaces of maps, sets and parameter domains are now
110 treated differently.  The distinction between map spaces and set spaces
111 has always been made on a conceptual level, but proper use of such spaces
112 was never checked.  Furthermore, up until isl-0.07 there was no way
113 of explicitly creating a parameter space.  These can now be created
114 directly using C<isl_space_params_alloc> or from other spaces using
115 C<isl_space_params>.
117 =item * The space in which C<isl_aff>, C<isl_pw_aff>, C<isl_qpolynomial>,
118 C<isl_pw_qpolynomial>, C<isl_qpolynomial_fold> and C<isl_pw_qpolynomial_fold>
119 objects live is now a map space
120 instead of a set space.  This means, for example, that the dimensions
121 of the domain of an C<isl_aff> are now considered to be of type
122 C<isl_dim_in> instead of C<isl_dim_set>.  Extra functions have been
123 added to obtain the domain space.  Some of the constructors still
124 take a domain space and have therefore been renamed.
126 =item * The functions C<isl_equality_alloc> and C<isl_inequality_alloc>
127 now take an C<isl_local_space> instead of an C<isl_space>.
128 An C<isl_local_space> can be created from an C<isl_space>
129 using C<isl_local_space_from_space>.
131 =item * The C<isl_div> type has been removed.  Functions that used
132 to return an C<isl_div> now return an C<isl_aff>.
133 Note that the space of an C<isl_aff> is that of relation.
134 When replacing a call to C<isl_div_get_coefficient> by a call to
135 C<isl_aff_get_coefficient> any C<isl_dim_set> argument needs
136 to be replaced by C<isl_dim_in>.
137 A call to C<isl_aff_from_div> can be replaced by a call
138 to C<isl_aff_floor>.
139 A call to C<isl_qpolynomial_div(div)> call be replaced by
140 the nested call
142         isl_qpolynomial_from_aff(isl_aff_floor(div))
144 The function C<isl_constraint_div> has also been renamed
145 to C<isl_constraint_get_div>.
147 =item * The C<nparam> argument has been removed from
148 C<isl_map_read_from_str> and similar functions.
149 When reading input in the original PolyLib format,
150 the result will have no parameters.
151 If parameters are expected, the caller may want to perform
152 dimension manipulation on the result.
154 =back
156 =head3 Changes since isl-0.09
158 =over
160 =item * The C<schedule_split_parallel> option has been replaced
161 by the C<schedule_split_scaled> option.
163 =item * The first argument of C<isl_pw_aff_cond> is now
164 an C<isl_pw_aff> instead of an C<isl_set>.
165 A call C<isl_pw_aff_cond(a, b, c)> can be replaced by
167         isl_pw_aff_cond(isl_set_indicator_function(a), b, c)
169 =back
171 =head3 Changes since isl-0.10
173 =over
175 =item * The functions C<isl_set_dim_has_lower_bound> and
176 C<isl_set_dim_has_upper_bound> have been renamed to
177 C<isl_set_dim_has_any_lower_bound> and
178 C<isl_set_dim_has_any_upper_bound>.
179 The new C<isl_set_dim_has_lower_bound> and
180 C<isl_set_dim_has_upper_bound> have slightly different meanings.
182 =back
184 =head3 Changes since isl-0.12
186 =over
188 =item * C<isl_int> has been replaced by C<isl_val>.
189 Some of the old functions are still available in C<isl/deprecated/*.h>
190 but they will be removed in the future.
192 =item * The functions C<isl_pw_qpolynomial_eval>,
193 C<isl_union_pw_qpolynomial_eval>, C<isl_pw_qpolynomial_fold_eval>
194 and C<isl_union_pw_qpolynomial_fold_eval> have been changed to return
195 an C<isl_val> instead of an C<isl_qpolynomial>.
197 =item * The function C<isl_band_member_is_zero_distance>
198 has been removed.  Essentially the same functionality is available
199 through C<isl_band_member_is_coincident>, except that it requires
200 setting up coincidence constraints.
201 The option C<schedule_outer_zero_distance> has accordingly been
202 replaced by the option C<schedule_outer_coincidence>.
204 =item * The function C<isl_vertex_get_expr> has been changed
205 to return an C<isl_multi_aff> instead of a rational C<isl_basic_set>.
206 The function C<isl_vertex_get_domain> has been changed to return
207 a regular basic set, rather than a rational basic set.
209 =back
211 =head3 Changes since isl-0.14
213 =over
215 =item * The function C<isl_union_pw_multi_aff_add> now consistently
216 computes the sum on the shared definition domain.
217 The function C<isl_union_pw_multi_aff_union_add> has been added
218 to compute the sum on the union of definition domains.
219 The original behavior of C<isl_union_pw_multi_aff_add> was
220 confused and is no longer available.
222 =item * Band forests have been replaced by schedule trees.
224 =item * The function C<isl_union_map_compute_flow> has been
225 replaced by the function C<isl_union_access_info_compute_flow>.
226 Note that the may dependence relation returned by
227 C<isl_union_flow_get_may_dependence> is the union of
228 the two dependence relations returned by
229 C<isl_union_map_compute_flow>.  Similarly for the no source relations.
230 The function C<isl_union_map_compute_flow> is still available
231 for backward compatibility, but it will be removed in the future.
233 =item * The function C<isl_basic_set_drop_constraint> has been
234 deprecated.
236 =item * The function C<isl_ast_build_ast_from_schedule> has been
237 renamed to C<isl_ast_build_node_from_schedule_map>.
238 The original name is still available
239 for backward compatibility, but it will be removed in the future.
241 =item * The C<separation_class> AST generation option has been
242 deprecated.
244 =item * The functions C<isl_equality_alloc> and C<isl_inequality_alloc>
245 have been renamed to C<isl_constraint_alloc_equality> and
246 C<isl_constraint_alloc_inequality>.  The original names have been
247 kept for backward compatibility, but they will be removed in the future.
249 =item * The C<schedule_fuse> option has been replaced
250 by the C<schedule_serialize_sccs> option.  The effect
251 of setting the C<schedule_fuse> option to C<ISL_SCHEDULE_FUSE_MIN>
252 is now obtained by turning on the C<schedule_serialize_sccs> option.
254 =back
256 =head3 Changes since isl-0.17
258 =over
260 =item * The function C<isl_printer_print_ast_expr> no longer prints
261 in C format by default.  To print in C format, the output format
262 of the printer needs to have been explicitly set to C<ISL_FORMAT_C>.
263 As a result, the function C<isl_ast_expr_to_str> no longer prints
264 the expression in C format.  Use C<isl_ast_expr_to_C_str> instead.
266 =item * The functions C<isl_set_align_divs> and C<isl_map_align_divs>
267 have been deprecated.  The function C<isl_set_lift> has an effect
268 that is similar to C<isl_set_align_divs> and could in some cases
269 be used as an alternative.
271 =back
273 =head3 Changes since isl-0.19
275 =over
277 =item * Zero-dimensional objects of type C<isl_multi_pw_aff> or
278 C<isl_multi_union_pw_aff> can now keep track of an explicit domain.
279 This explicit domain, if present, is taken into account
280 by various operations that take such objects as input.
282 =back
284 =head3 Changes since isl-0.20
286 =over
288 =item * Several functions that used to return C<unsigned>
289 now return C<isl_size>.  This means that these functions may
290 now return a negative value in case an error occurred.
291 The same holds for functions that used to return C<int>,
292 although some of those were already returning
293 a negative value in case of error.
295 =item * The C<isl_ast_op_type> enumeration type has been
296 renamed to C<isl_ast_expr_op_type>.  The corresponding
297 enumeration constants have been similarly renamed.
298 The old names are defined to the new names for backward
299 compatibility.
301 =item * Several functions returning an extra boolean value
302 through an C<int *> argument now do so through an C<isl_bool *>
303 argument.  The returned values are the same, only the type
304 of the pointer has been changed.
306 =back
308 =head1 License
310 C<isl> is released under the MIT license.
312 =over
314 Permission is hereby granted, free of charge, to any person obtaining a copy of
315 this software and associated documentation files (the "Software"), to deal in
316 the Software without restriction, including without limitation the rights to
317 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
318 of the Software, and to permit persons to whom the Software is furnished to do
319 so, subject to the following conditions:
321 The above copyright notice and this permission notice shall be included in all
322 copies or substantial portions of the Software.
324 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
325 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
326 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
327 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
328 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
329 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
330 SOFTWARE.
332 =back
334 Note that by default C<isl> requires C<GMP>, which is released
335 under the GNU Lesser General Public License (LGPL).  This means
336 that code linked against C<isl> is also linked against LGPL code.
338 When configuring with C<--with-int=imath> or C<--with-int=imath-32>, C<isl>
339 will link against C<imath>, a library for exact integer arithmetic released
340 under the MIT license.
342 =head1 Installation
344 The source of C<isl> can be obtained either as a tarball
345 or from the git repository.  Both are available from
346 L<http://isl.gforge.inria.fr/>.
347 The installation process depends on how you obtained
348 the source.
350 =head2 Installation from the git repository
352 =over
354 =item 1 Clone or update the repository
356 The first time the source is obtained, you need to clone
357 the repository.
359         git clone git://repo.or.cz/isl.git
361 To obtain updates, you need to pull in the latest changes
363         git pull
365 =item 2 Optionally get C<imath> submodule
367 To build C<isl> with C<imath>, you need to obtain the C<imath>
368 submodule by running in the git source tree of C<isl>
370        git submodule init
371        git submodule update
373 This will fetch the required version of C<imath> in a subdirectory of C<isl>.
375 =item 2 Generate C<configure>
377         ./autogen.sh
379 =back
381 After performing the above steps, continue
382 with the L<Common installation instructions>.
384 =head2 Common installation instructions
386 =over
388 =item 1 Obtain C<GMP>
390 By default, building C<isl> requires C<GMP>, including its headers files.
391 Your distribution may not provide these header files by default
392 and you may need to install a package called C<gmp-devel> or something
393 similar.  Alternatively, C<GMP> can be built from
394 source, available from L<http://gmplib.org/>.
395 C<GMP> is not needed if you build C<isl> with C<imath>.
397 =item 2 Configure
399 C<isl> uses the standard C<autoconf> C<configure> script.
400 To run it, just type
402         ./configure
404 optionally followed by some configure options.
405 A complete list of options can be obtained by running
407         ./configure --help
409 Below we discuss some of the more common options.
411 =over
413 =item C<--prefix>
415 Installation prefix for C<isl>
417 =item C<--with-int=[gmp|imath|imath-32]>
419 Select the integer library to be used by C<isl>, the default is C<gmp>.
420 With C<imath-32>, C<isl> will use 32 bit integers, but fall back to C<imath>
421 for values out of the 32 bit range. In most applications, C<isl> will run
422 fastest with the C<imath-32> option, followed by C<gmp> and C<imath>, the
423 slowest.
425 =item C<--with-gmp-prefix>
427 Installation prefix for C<GMP> (architecture-independent files).
429 =item C<--with-gmp-exec-prefix>
431 Installation prefix for C<GMP> (architecture-dependent files).
433 =back
435 =item 3 Compile
437         make
439 =item 4 Install (optional)
441         make install
443 =back
445 =head1 Integer Set Library
447 =head2 Memory Management
449 Since a high-level operation on isl objects usually involves
450 several substeps and since the user is usually not interested in
451 the intermediate results, most functions that return a new object
452 will also release all the objects passed as arguments.
453 If the user still wants to use one or more of these arguments
454 after the function call, she should pass along a copy of the
455 object rather than the object itself.
456 The user is then responsible for making sure that the original
457 object gets used somewhere else or is explicitly freed.
459 The arguments and return values of all documented functions are
460 annotated to make clear which arguments are released and which
461 arguments are preserved.  In particular, the following annotations
462 are used
464 =over
466 =item C<__isl_give>
468 C<__isl_give> means that a new object is returned.
469 The user should make sure that the returned pointer is
470 used exactly once as a value for an C<__isl_take> argument.
471 In between, it can be used as a value for as many
472 C<__isl_keep> arguments as the user likes.
473 There is one exception, and that is the case where the
474 pointer returned is C<NULL>.  In this case, the user
475 is free to use it as an C<__isl_take> argument or not.
476 When applied to a C<char *>, the returned pointer needs to be
477 freed using C<free>.
479 =item C<__isl_null>
481 C<__isl_null> means that a C<NULL> value is returned.
483 =item C<__isl_take>
485 C<__isl_take> means that the object the argument points to
486 is taken over by the function and may no longer be used
487 by the user as an argument to any other function.
488 The pointer value must be one returned by a function
489 returning an C<__isl_give> pointer.
490 If the user passes in a C<NULL> value, then this will
491 be treated as an error in the sense that the function will
492 not perform its usual operation.  However, it will still
493 make sure that all the other C<__isl_take> arguments
494 are released.
496 =item C<__isl_keep>
498 C<__isl_keep> means that the function will only use the object
499 temporarily.  After the function has finished, the user
500 can still use it as an argument to other functions.
501 A C<NULL> value will be treated in the same way as
502 a C<NULL> value for an C<__isl_take> argument.
503 This annotation may also be used on return values of
504 type C<const char *>, in which case the returned pointer should
505 not be freed by the user and is only valid until the object
506 from which it was derived is updated or freed.
508 =back
510 =head2 Initialization
512 All manipulations of integer sets and relations occur within
513 the context of an C<isl_ctx>.
514 A given C<isl_ctx> can only be used within a single thread.
515 All arguments of a function are required to have been allocated
516 within the same context.
517 There are currently no functions available for moving an object
518 from one C<isl_ctx> to another C<isl_ctx>.  This means that
519 there is currently no way of safely moving an object from one
520 thread to another, unless the whole C<isl_ctx> is moved.
522 An C<isl_ctx> can be allocated using C<isl_ctx_alloc> and
523 freed using C<isl_ctx_free>.
524 All objects allocated within an C<isl_ctx> should be freed
525 before the C<isl_ctx> itself is freed.
527         isl_ctx *isl_ctx_alloc();
528         void isl_ctx_free(isl_ctx *ctx);
530 The user can impose a bound on the number of low-level I<operations>
531 that can be performed by an C<isl_ctx>.  This bound can be set and
532 retrieved using the following functions.  A bound of zero means that
533 no bound is imposed.  The number of operations performed can be
534 reset using C<isl_ctx_reset_operations>.  Note that the number
535 of low-level operations needed to perform a high-level computation
536 may differ significantly across different versions
537 of C<isl>, but it should be the same across different platforms
538 for the same version of C<isl>.
540 Warning: This feature is experimental.  C<isl> has good support to abort and
541 bail out during the computation, but this feature may exercise error code paths
542 that are normally not used that much. Consequently, it is not unlikely that
543 hidden bugs will be exposed.
545         void isl_ctx_set_max_operations(isl_ctx *ctx,
546                 unsigned long max_operations);
547         unsigned long isl_ctx_get_max_operations(isl_ctx *ctx);
548         void isl_ctx_reset_operations(isl_ctx *ctx);
550 In order to be able to create an object in the same context
551 as another object, most object types (described later in
552 this document) provide a function to obtain the context
553 in which the object was created.
555         #include <isl/val.h>
556         isl_ctx *isl_val_get_ctx(__isl_keep isl_val *val);
557         isl_ctx *isl_multi_val_get_ctx(
558                 __isl_keep isl_multi_val *mv);
560         #include <isl/id.h>
561         isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
562         isl_ctx *isl_multi_id_get_ctx(
563                 __isl_keep isl_multi_id *mi);
565         #include <isl/local_space.h>
566         isl_ctx *isl_local_space_get_ctx(
567                 __isl_keep isl_local_space *ls);
569         #include <isl/set.h>
570         isl_ctx *isl_set_list_get_ctx(
571                 __isl_keep isl_set_list *list);
573         #include <isl/aff.h>
574         isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
575         isl_ctx *isl_multi_aff_get_ctx(
576                 __isl_keep isl_multi_aff *maff);
577         isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pa);
578         isl_ctx *isl_pw_multi_aff_get_ctx(
579                 __isl_keep isl_pw_multi_aff *pma);
580         isl_ctx *isl_multi_pw_aff_get_ctx(
581                 __isl_keep isl_multi_pw_aff *mpa);
582         isl_ctx *isl_union_pw_aff_get_ctx(
583                 __isl_keep isl_union_pw_aff *upa);
584         isl_ctx *isl_union_pw_multi_aff_get_ctx(
585                 __isl_keep isl_union_pw_multi_aff *upma);
586         isl_ctx *isl_multi_union_pw_aff_get_ctx(
587                 __isl_keep isl_multi_union_pw_aff *mupa);
589         #include <isl/id_to_ast_expr.h>
590         isl_ctx *isl_id_to_ast_expr_get_ctx(
591                 __isl_keep isl_id_to_ast_expr *id2expr);
593         #include <isl/point.h>
594         isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
596         #include <isl/vec.h>
597         isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
599         #include <isl/mat.h>
600         isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
602         #include <isl/vertices.h>
603         isl_ctx *isl_vertices_get_ctx(
604                 __isl_keep isl_vertices *vertices);
605         isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
606         isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
608         #include <isl/flow.h>
609         isl_ctx *isl_restriction_get_ctx(
610                 __isl_keep isl_restriction *restr);
611         isl_ctx *isl_union_access_info_get_ctx(
612                 __isl_keep isl_union_access_info *access);
613         isl_ctx *isl_union_flow_get_ctx(
614                 __isl_keep isl_union_flow *flow);
616         #include <isl/schedule.h>
617         isl_ctx *isl_schedule_get_ctx(
618                 __isl_keep isl_schedule *sched);
619         isl_ctx *isl_schedule_constraints_get_ctx(
620                 __isl_keep isl_schedule_constraints *sc);
622         #include <isl/schedule_node.h>
623         isl_ctx *isl_schedule_node_get_ctx(
624                 __isl_keep isl_schedule_node *node);
626         #include <isl/ast_build.h>
627         isl_ctx *isl_ast_build_get_ctx(
628                 __isl_keep isl_ast_build *build);
630         #include <isl/ast.h>
631         isl_ctx *isl_ast_expr_get_ctx(
632                 __isl_keep isl_ast_expr *expr);
633         isl_ctx *isl_ast_node_get_ctx(
634                 __isl_keep isl_ast_node *node);
636         #include <isl/stride_info.h>
637         isl_ctx *isl_stride_info_get_ctx(
638                 __isl_keep isl_stride_info *si);
640         #include <isl/fixed_box.h>
641         isl_ctx *isl_fixed_box_get_ctx(
642                 __isl_keep isl_fixed_box *box);
644 =head2 Return Types
646 C<isl> uses the special return type C<isl_size> for functions
647 that return a non-negative value, typically a number or a position.
648 Besides the regular non-negative return values, a special (negative)
649 value C<isl_size_error> may be returned, indicating that something
650 went wrong.
652 C<isl> also uses two special return types for functions that either return
653 a boolean or that in principle do not return anything.
654 In particular, the C<isl_bool> type has three possible values:
655 C<isl_bool_true> (a positive integer value), indicating I<true> or I<yes>;
656 C<isl_bool_false> (the integer value zero), indicating I<false> or I<no>; and
657 C<isl_bool_error> (a negative integer value), indicating that something
658 went wrong.  The following operations are defined on C<isl_bool>. The function
659 C<isl_bool_not> can be used to negate an C<isl_bool>, where the negation of
660 C<isl_bool_error> is C<isl_bool_error> again. The function C<isl_bool_ok>
661 converts an integer to an C<isl_bool>. Any non-zero values yields
662 C<isl_bool_true> and zero yields C<isl_bool_false>.
664         #include <isl/ctx.h>
665         isl_bool isl_bool_not(isl_bool b);
666         isl_bool isl_bool_ok(int b);
668 The C<isl_stat> type has two possible values:
669 C<isl_stat_ok> (the integer value zero), indicating a successful
670 operation; and
671 C<isl_stat_error> (a negative integer value), indicating that something
672 went wrong.
673 The function C<isl_stat_non_null> converts an isl object pointer
674 to an C<isl_stat>, returning C<isl_stat_ok> if the object pointer is valid and
675 C<isl_stat_error> if it is C<NULL>.
677         #include <isl/ctx.h>
678         isl_stat isl_stat_non_null(void *obj);
680 See L</"Error Handling"> for more information on
681 C<isl_size_error>, C<isl_bool_error> and C<isl_stat_error>.
683 =head2 Values
685 An C<isl_val> represents an integer value, a rational value
686 or one of three special values, infinity, negative infinity and NaN.
687 Some predefined values can be created using the following functions.
689         #include <isl/val.h>
690         __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
691         __isl_give isl_val *isl_val_one(isl_ctx *ctx);
692         __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
693         __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
694         __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
695         __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
697 Specific integer values can be created using the following functions.
699         #include <isl/val.h>
700         __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
701                 long i);
702         __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
703                 unsigned long u);
704         __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
705                 size_t n, size_t size, const void *chunks);
707 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
708 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
709 The least significant digit is assumed to be stored first.
711 Value objects can be copied and freed using the following functions.
713         #include <isl/val.h>
714         __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
715         __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
717 They can be inspected using the following functions.
719         #include <isl/val.h>
720         long isl_val_get_num_si(__isl_keep isl_val *v);
721         long isl_val_get_den_si(__isl_keep isl_val *v);
722         __isl_give isl_val *isl_val_get_den_val(
723                 __isl_keep isl_val *v);
724         double isl_val_get_d(__isl_keep isl_val *v);
725         isl_size isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
726                 size_t size);
727         isl_stat isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
728                 size_t size, void *chunks);
730 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
731 of C<size> bytes needed to store the absolute value of the
732 numerator of C<v>.
733 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
734 which is assumed to have been preallocated by the caller.
735 The least significant digit is stored first.
736 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
737 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
738 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
740 An C<isl_val> can be modified using the following function.
742         #include <isl/val.h>
743         __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
744                 long i);
746 The following unary properties are defined on C<isl_val>s.
748         #include <isl/val.h>
749         int isl_val_sgn(__isl_keep isl_val *v);
750         isl_bool isl_val_is_zero(__isl_keep isl_val *v);
751         isl_bool isl_val_is_one(__isl_keep isl_val *v);
752         isl_bool isl_val_is_negone(__isl_keep isl_val *v);
753         isl_bool isl_val_is_nonneg(__isl_keep isl_val *v);
754         isl_bool isl_val_is_nonpos(__isl_keep isl_val *v);
755         isl_bool isl_val_is_pos(__isl_keep isl_val *v);
756         isl_bool isl_val_is_neg(__isl_keep isl_val *v);
757         isl_bool isl_val_is_int(__isl_keep isl_val *v);
758         isl_bool isl_val_is_rat(__isl_keep isl_val *v);
759         isl_bool isl_val_is_nan(__isl_keep isl_val *v);
760         isl_bool isl_val_is_infty(__isl_keep isl_val *v);
761         isl_bool isl_val_is_neginfty(__isl_keep isl_val *v);
763 Note that the sign of NaN is undefined.
765 The following binary properties are defined on pairs of C<isl_val>s.
767         #include <isl/val.h>
768         isl_bool isl_val_lt(__isl_keep isl_val *v1,
769                 __isl_keep isl_val *v2);
770         isl_bool isl_val_le(__isl_keep isl_val *v1,
771                 __isl_keep isl_val *v2);
772         isl_bool isl_val_gt(__isl_keep isl_val *v1,
773                 __isl_keep isl_val *v2);
774         isl_bool isl_val_ge(__isl_keep isl_val *v1,
775                 __isl_keep isl_val *v2);
776         isl_bool isl_val_eq(__isl_keep isl_val *v1,
777                 __isl_keep isl_val *v2);
778         isl_bool isl_val_ne(__isl_keep isl_val *v1,
779                 __isl_keep isl_val *v2);
780         isl_bool isl_val_abs_eq(__isl_keep isl_val *v1,
781                 __isl_keep isl_val *v2);
783 Comparisons to NaN always return false.
784 That is, a NaN is not considered to hold any relative position
785 with respect to any value.  In particular, a NaN
786 is neither considered to be equal to nor to be different from
787 any value (including another NaN).
788 The function C<isl_val_abs_eq> checks whether its two arguments
789 are equal in absolute value.
791 For integer C<isl_val>s we additionally have the following binary property.
793         #include <isl/val.h>
794         isl_bool isl_val_is_divisible_by(__isl_keep isl_val *v1,
795                 __isl_keep isl_val *v2);
797 An C<isl_val> can also be compared to an integer using the following
798 functions.  The result of C<isl_val_cmp_si> undefined for NaN.
800         #include <isl/val.h>
801         isl_bool isl_val_gt_si(__isl_keep isl_val *v, long i);
802         int isl_val_cmp_si(__isl_keep isl_val *v, long i);
804 The following unary operations are available on C<isl_val>s.
806         #include <isl/val.h>
807         __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
808         __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
809         __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
810         __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
811         __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
812         __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
814 The following binary operations are available on C<isl_val>s.
816         #include <isl/val.h>
817         __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
818                 __isl_take isl_val *v2);
819         __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
820                 __isl_take isl_val *v2);
821         __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
822                 __isl_take isl_val *v2);
823         __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
824                 unsigned long v2);
825         __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
826                 __isl_take isl_val *v2);
827         __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
828                 unsigned long v2);
829         __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
830                 __isl_take isl_val *v2);
831         __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
832                 unsigned long v2);
833         __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
834                 __isl_take isl_val *v2);
835         __isl_give isl_val *isl_val_div_ui(__isl_take isl_val *v1,
836                 unsigned long v2);
838 On integer values, we additionally have the following operations.
840         #include <isl/val.h>
841         __isl_give isl_val *isl_val_pow2(__isl_take isl_val *v);
842         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
843         __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
844                 __isl_take isl_val *v2);
845         __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
846                 __isl_take isl_val *v2);
847         __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
848                 __isl_take isl_val *v2, __isl_give isl_val **x,
849                 __isl_give isl_val **y);
851 C<isl_val_2exp> is an alternative name for C<isl_val_pow2>.
852 The function C<isl_val_gcdext> returns the greatest common divisor g
853 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
854 that C<*x> * C<v1> + C<*y> * C<v2> = g.
856 =head3 GMP specific functions
858 These functions are only available if C<isl> has been compiled with C<GMP>
859 support.
861 Specific integer and rational values can be created from C<GMP> values using
862 the following functions.
864         #include <isl/val_gmp.h>
865         __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
866                 mpz_t z);
867         __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
868                 const mpz_t n, const mpz_t d);
870 The numerator and denominator of a rational value can be extracted as
871 C<GMP> values using the following functions.
873         #include <isl/val_gmp.h>
874         int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
875         int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
877 =head2 Sets and Relations
879 C<isl> uses six types of objects for representing sets and relations,
880 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
881 C<isl_union_set> and C<isl_union_map>.
882 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
883 can be described as a conjunction of affine constraints, while
884 C<isl_set> and C<isl_map> represent unions of
885 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
886 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
887 to live in the same space.  C<isl_union_set>s and C<isl_union_map>s
888 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
889 where spaces are considered different if they have a different number
890 of dimensions and/or different names (see L<"Spaces">).
891 The difference between sets and relations (maps) is that sets have
892 one set of variables, while relations have two sets of variables,
893 input variables and output variables.
895 =head2 Error Handling
897 C<isl> supports different ways to react in case a runtime error is triggered.
898 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
899 with two maps that have incompatible spaces. There are three possible ways
900 to react on error: to warn, to continue or to abort.
902 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
903 the last error in the corresponding C<isl_ctx> and the function in which the
904 error was triggered returns a value indicating that some error has
905 occurred.  In case of functions returning a pointer, this value is
906 C<NULL>.  In case of functions returning an C<isl_size>, C<isl_bool> or an
907 C<isl_stat>, this value is C<isl_size_error>,
908 C<isl_bool_error> or C<isl_stat_error>.
909 An error does not corrupt internal state,
910 such that isl can continue to be used. C<isl> also provides functions to
911 read the last error, including the specific error message,
912 the isl source file where the error occurred and the line number,
913 and to reset all information about the last error. The
914 last error is only stored for information purposes. Its presence does not
915 change the behavior of C<isl>. Hence, resetting an error is not required to
916 continue to use isl, but only to observe new errors.
918         #include <isl/ctx.h>
919         enum isl_error isl_ctx_last_error(isl_ctx *ctx);
920         const char *isl_ctx_last_error_msg(isl_ctx *ctx);
921         const char *isl_ctx_last_error_file(isl_ctx *ctx);
922         int isl_ctx_last_error_line(isl_ctx *ctx);
923         void isl_ctx_reset_error(isl_ctx *ctx);
925 If no error has occurred since the last call to C<isl_ctx_reset_error>,
926 then the functions C<isl_ctx_last_error_msg> and
927 C<isl_ctx_last_error_file> return C<NULL>.
929 Another option is to continue on error. This is similar to warn on error mode,
930 except that C<isl> does not print any warning. This allows a program to
931 implement its own error reporting.
933 The last option is to directly abort the execution of the program from within
934 the isl library. This makes it obviously impossible to recover from an error,
935 but it allows to directly spot the error location. By aborting on error,
936 debuggers break at the location the error occurred and can provide a stack
937 trace. Other tools that automatically provide stack traces on abort or that do
938 not want to continue execution after an error was triggered may also prefer to
939 abort on error.
941 The on error behavior of isl can be specified by calling
942 C<isl_options_set_on_error> or by setting the command line option
943 C<--isl-on-error>. Valid arguments for the function call are
944 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
945 choices for the command line option are C<warn>, C<continue> and C<abort>.
946 It is also possible to query the current error mode.
948         #include <isl/options.h>
949         isl_stat isl_options_set_on_error(isl_ctx *ctx, int val);
950         int isl_options_get_on_error(isl_ctx *ctx);
952 =head2 Identifiers
954 Identifiers are used to identify both individual dimensions
955 and tuples of dimensions.  They consist of an optional name and an optional
956 user pointer.  The name and the user pointer cannot both be C<NULL>, however.
957 Identifiers with the same name but different pointer values
958 are considered to be distinct.
959 Similarly, identifiers with different names but the same pointer value
960 are also considered to be distinct.
961 Equal identifiers are represented using the same object.
962 Pairs of identifiers can therefore be tested for equality using the
963 C<==> operator.
964 Identifiers can be constructed, copied, freed, inspected and printed
965 using the following functions.
967         #include <isl/id.h>
968         __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
969                 __isl_keep const char *name, void *user);
970         __isl_give isl_id *isl_id_set_free_user(
971                 __isl_take isl_id *id,
972                 void (*free_user)(void *user));
973         __isl_give isl_id *isl_id_copy(isl_id *id);
974         __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
976         void *isl_id_get_user(__isl_keep isl_id *id);
977         __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
979         __isl_give isl_printer *isl_printer_print_id(
980                 __isl_take isl_printer *p, __isl_keep isl_id *id);
982 The callback set by C<isl_id_set_free_user> is called on the user
983 pointer when the last reference to the C<isl_id> is freed.
984 Note that C<isl_id_get_name> returns a pointer to some internal
985 data structure, so the result can only be used while the
986 corresponding C<isl_id> is alive.
988 =head2 Spaces
990 Whenever a new set, relation or similar object is created from scratch,
991 the space in which it lives needs to be specified using an C<isl_space>.
992 Each space involves zero or more parameters and zero, one or two
993 tuples of set or input/output dimensions.  The parameters and dimensions
994 are identified by an C<isl_dim_type> and a position.
995 The type C<isl_dim_param> refers to parameters,
996 the type C<isl_dim_set> refers to set dimensions (for spaces
997 with a single tuple of dimensions) and the types C<isl_dim_in>
998 and C<isl_dim_out> refer to input and output dimensions
999 (for spaces with two tuples of dimensions).
1000 Local spaces (see L</"Local Spaces">) also contain dimensions
1001 of type C<isl_dim_div>.
1002 Note that parameters are only identified by their position within
1003 a given object.  Across different objects, parameters are (usually)
1004 identified by their names or identifiers.  Only unnamed parameters
1005 are identified by their positions across objects.  The use of unnamed
1006 parameters is discouraged.
1008         #include <isl/space.h>
1009         __isl_give isl_space *isl_space_unit(isl_ctx *ctx);
1010         __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
1011                 unsigned nparam, unsigned n_in, unsigned n_out);
1012         __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
1013                 unsigned nparam);
1014         __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
1015                 unsigned nparam, unsigned dim);
1016         __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
1017         __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
1019 The space used for creating a parameter domain
1020 needs to be created using C<isl_space_unit> or C<isl_space_params_alloc>.
1021 For other sets, the space
1022 needs to be created using C<isl_space_set_alloc>, while
1023 for a relation, the space
1024 needs to be created using C<isl_space_alloc>.
1025 The use of C<isl_space_params_alloc>,
1026 C<isl_space_set_alloc> and C<isl_space_alloc> is discouraged as they allow
1027 for the introduction of unnamed parameters.
1029 To check whether a given space is that of a set or a map
1030 or whether it is a parameter space, use these functions:
1032         #include <isl/space.h>
1033         isl_bool isl_space_is_params(__isl_keep isl_space *space);
1034         isl_bool isl_space_is_set(__isl_keep isl_space *space);
1035         isl_bool isl_space_is_map(__isl_keep isl_space *space);
1037 Spaces can be compared using the following functions:
1039         #include <isl/space.h>
1040         isl_bool isl_space_is_equal(__isl_keep isl_space *space1,
1041                 __isl_keep isl_space *space2);
1042         isl_bool isl_space_has_equal_params(
1043                 __isl_keep isl_space *space1,
1044                 __isl_keep isl_space *space2);
1045         isl_bool isl_space_has_equal_tuples(
1046                 __isl_keep isl_space *space1,
1047                 __isl_keep isl_space *space2);
1048         isl_bool isl_space_is_domain(__isl_keep isl_space *space1,
1049                 __isl_keep isl_space *space2);
1050         isl_bool isl_space_is_range(__isl_keep isl_space *space1,
1051                 __isl_keep isl_space *space2);
1052         isl_bool isl_space_tuple_is_equal(
1053                 __isl_keep isl_space *space1,
1054                 enum isl_dim_type type1,
1055                 __isl_keep isl_space *space2,
1056                 enum isl_dim_type type2);
1058 C<isl_space_is_domain> checks whether the first argument is equal
1059 to the domain of the second argument.  This requires in particular that
1060 the first argument is a set space and that the second argument
1061 is a map space.  C<isl_space_tuple_is_equal> checks whether the given
1062 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
1063 spaces are the same.  That is, it checks if they have the same
1064 identifier (if any), the same dimension and the same internal structure
1065 (if any).
1066 The function
1067 C<isl_space_has_equal_params> checks whether two spaces
1068 have the same parameters in the same order.
1069 C<isl_space_has_equal_tuples> check whether two spaces have
1070 the same tuples.  In contrast to C<isl_space_is_equal> below,
1071 it does not check the
1072 parameters.  This is useful because many C<isl> functions align the
1073 parameters before they perform their operations, such that equivalence
1074 is not necessary.
1075 C<isl_space_is_equal> checks whether two spaces are identical,
1076 meaning that they have the same parameters and the same tuples.
1077 That is, it checks whether both C<isl_space_has_equal_params> and
1078 C<isl_space_has_equal_tuples> hold.
1080 It is often useful to create objects that live in the
1081 same space as some other object.  This can be accomplished
1082 by creating the new objects
1083 (see L</"Creating New Sets and Relations"> or
1084 L</"Functions">) based on the space
1085 of the original object.
1087         #include <isl/set.h>
1088         __isl_give isl_space *isl_basic_set_get_space(
1089                 __isl_keep isl_basic_set *bset);
1090         __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
1092         #include <isl/union_set.h>
1093         __isl_give isl_space *isl_union_set_get_space(
1094                 __isl_keep isl_union_set *uset);
1096         #include <isl/map.h>
1097         __isl_give isl_space *isl_basic_map_get_space(
1098                 __isl_keep isl_basic_map *bmap);
1099         __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
1101         #include <isl/union_map.h>
1102         __isl_give isl_space *isl_union_map_get_space(
1103                 __isl_keep isl_union_map *umap);
1105         #include <isl/constraint.h>
1106         __isl_give isl_space *isl_constraint_get_space(
1107                 __isl_keep isl_constraint *constraint);
1109         #include <isl/polynomial.h>
1110         __isl_give isl_space *isl_qpolynomial_get_domain_space(
1111                 __isl_keep isl_qpolynomial *qp);
1112         __isl_give isl_space *isl_qpolynomial_get_space(
1113                 __isl_keep isl_qpolynomial *qp);
1114         __isl_give isl_space *
1115         isl_qpolynomial_fold_get_domain_space(
1116                 __isl_keep isl_qpolynomial_fold *fold);
1117         __isl_give isl_space *isl_qpolynomial_fold_get_space(
1118                 __isl_keep isl_qpolynomial_fold *fold);
1119         __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
1120                 __isl_keep isl_pw_qpolynomial *pwqp);
1121         __isl_give isl_space *isl_pw_qpolynomial_get_space(
1122                 __isl_keep isl_pw_qpolynomial *pwqp);
1123         __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
1124                 __isl_keep isl_pw_qpolynomial_fold *pwf);
1125         __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
1126                 __isl_keep isl_pw_qpolynomial_fold *pwf);
1127         __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
1128                 __isl_keep isl_union_pw_qpolynomial *upwqp);
1129         __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
1130                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
1132         #include <isl/id.h>
1133         __isl_give isl_space *isl_multi_id_get_space(
1134                 __isl_keep isl_multi_id *mi);
1136         #include <isl/val.h>
1137         __isl_give isl_space *isl_multi_val_get_space(
1138                 __isl_keep isl_multi_val *mv);
1140         #include <isl/aff.h>
1141         __isl_give isl_space *isl_aff_get_domain_space(
1142                 __isl_keep isl_aff *aff);
1143         __isl_give isl_space *isl_aff_get_space(
1144                 __isl_keep isl_aff *aff);
1145         __isl_give isl_space *isl_pw_aff_get_domain_space(
1146                 __isl_keep isl_pw_aff *pwaff);
1147         __isl_give isl_space *isl_pw_aff_get_space(
1148                 __isl_keep isl_pw_aff *pwaff);
1149         __isl_give isl_space *isl_multi_aff_get_domain_space(
1150                 __isl_keep isl_multi_aff *maff);
1151         __isl_give isl_space *isl_multi_aff_get_space(
1152                 __isl_keep isl_multi_aff *maff);
1153         __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
1154                 __isl_keep isl_pw_multi_aff *pma);
1155         __isl_give isl_space *isl_pw_multi_aff_get_space(
1156                 __isl_keep isl_pw_multi_aff *pma);
1157         __isl_give isl_space *isl_union_pw_aff_get_space(
1158                 __isl_keep isl_union_pw_aff *upa);
1159         __isl_give isl_space *isl_union_pw_multi_aff_get_space(
1160                 __isl_keep isl_union_pw_multi_aff *upma);
1161         __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
1162                 __isl_keep isl_multi_pw_aff *mpa);
1163         __isl_give isl_space *isl_multi_pw_aff_get_space(
1164                 __isl_keep isl_multi_pw_aff *mpa);
1165         __isl_give isl_space *
1166         isl_multi_union_pw_aff_get_domain_space(
1167                 __isl_keep isl_multi_union_pw_aff *mupa);
1168         __isl_give isl_space *
1169         isl_multi_union_pw_aff_get_space(
1170                 __isl_keep isl_multi_union_pw_aff *mupa);
1172         #include <isl/point.h>
1173         __isl_give isl_space *isl_point_get_space(
1174                 __isl_keep isl_point *pnt);
1176         #include <isl/fixed_box.h>
1177         __isl_give isl_space *isl_fixed_box_get_space(
1178                 __isl_keep isl_fixed_box *box);
1180 The number of dimensions of a given type of space
1181 may be read off from a space or an object that lives
1182 in a space using the following functions.
1183 In case of C<isl_space_dim>, type may be
1184 C<isl_dim_param>, C<isl_dim_in> (only for relations),
1185 C<isl_dim_out> (only for relations), C<isl_dim_set>
1186 (only for sets) or C<isl_dim_all>.
1188         #include <isl/space.h>
1189         isl_size isl_space_dim(__isl_keep isl_space *space,
1190                 enum isl_dim_type type);
1192         #include <isl/local_space.h>
1193         isl_size isl_local_space_dim(__isl_keep isl_local_space *ls,
1194                 enum isl_dim_type type);
1196         #include <isl/set.h>
1197         isl_size isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1198                 enum isl_dim_type type);
1199         isl_size isl_set_dim(__isl_keep isl_set *set,
1200                 enum isl_dim_type type);
1202         #include <isl/union_set.h>
1203         isl_size isl_union_set_dim(__isl_keep isl_union_set *uset,
1204                 enum isl_dim_type type);
1206         #include <isl/map.h>
1207         isl_size isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1208                 enum isl_dim_type type);
1209         isl_size isl_map_dim(__isl_keep isl_map *map,
1210                 enum isl_dim_type type);
1212         #include <isl/union_map.h>
1213         isl_size isl_union_map_dim(__isl_keep isl_union_map *umap,
1214                 enum isl_dim_type type);
1216         #include <isl/val.h>
1217         isl_size isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1218                 enum isl_dim_type type);
1220         #include <isl/aff.h>
1221         isl_size isl_aff_dim(__isl_keep isl_aff *aff,
1222                 enum isl_dim_type type);
1223         isl_size isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1224                 enum isl_dim_type type);
1225         isl_size isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1226                 enum isl_dim_type type);
1227         isl_size isl_pw_multi_aff_dim(
1228                 __isl_keep isl_pw_multi_aff *pma,
1229                 enum isl_dim_type type);
1230         isl_size isl_multi_pw_aff_dim(
1231                 __isl_keep isl_multi_pw_aff *mpa,
1232                 enum isl_dim_type type);
1233         isl_size isl_union_pw_aff_dim(
1234                 __isl_keep isl_union_pw_aff *upa,
1235                 enum isl_dim_type type);
1236         isl_size isl_union_pw_multi_aff_dim(
1237                 __isl_keep isl_union_pw_multi_aff *upma,
1238                 enum isl_dim_type type);
1239         isl_size isl_multi_union_pw_aff_dim(
1240                 __isl_keep isl_multi_union_pw_aff *mupa,
1241                 enum isl_dim_type type);
1243         #include <isl/polynomial.h>
1244         isl_size isl_union_pw_qpolynomial_dim(
1245                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1246                 enum isl_dim_type type);
1247         isl_size isl_union_pw_qpolynomial_fold_dim(
1248                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1249                 enum isl_dim_type type);
1251 Note that an C<isl_union_set>, an C<isl_union_map>,
1252 an C<isl_union_pw_multi_aff>,
1253 an C<isl_union_pw_qpolynomial> and
1254 an C<isl_union_pw_qpolynomial_fold>
1255 only have parameters.
1257 Additional parameters can be added to a space using the following function.
1259         #include <isl/space.h>
1260         __isl_give isl_space *isl_space_add_param_id(
1261                 __isl_take isl_space *space,
1262                 __isl_take isl_id *id);
1264 If a parameter with the given identifier already appears in the space,
1265 then it is not added again.
1267 Conversely, all parameters can be removed from a space
1268 using the following function.
1270         #include <isl/space.h>
1271         __isl_give isl_space *isl_space_drop_all_params(
1272                 __isl_take isl_space *space);
1274 The identifiers or names of the individual dimensions of spaces
1275 may be set or read off using the following functions on spaces
1276 or objects that live in spaces.
1277 These functions are mostly useful to obtain the identifiers, positions
1278 or names of the parameters.  Identifiers of individual dimensions are
1279 essentially only useful for printing.  They are ignored by all other
1280 operations and may not be preserved across those operations.
1281 To keep track of a space along with names/identifiers of
1282 the set dimensions, use an C<isl_multi_id> as described in
1283 L</"Functions">.
1285         #include <isl/space.h>
1286         __isl_give isl_space *isl_space_set_dim_id(
1287                 __isl_take isl_space *space,
1288                 enum isl_dim_type type, unsigned pos,
1289                 __isl_take isl_id *id);
1290         isl_bool isl_space_has_dim_id(__isl_keep isl_space *space,
1291                 enum isl_dim_type type, unsigned pos);
1292         __isl_give isl_id *isl_space_get_dim_id(
1293                 __isl_keep isl_space *space,
1294                 enum isl_dim_type type, unsigned pos);
1295         __isl_give isl_space *isl_space_set_dim_name(
1296                 __isl_take isl_space *space,
1297                  enum isl_dim_type type, unsigned pos,
1298                  __isl_keep const char *name);
1299         isl_bool isl_space_has_dim_name(__isl_keep isl_space *space,
1300                 enum isl_dim_type type, unsigned pos);
1301         __isl_keep const char *isl_space_get_dim_name(
1302                 __isl_keep isl_space *space,
1303                 enum isl_dim_type type, unsigned pos);
1305         #include <isl/local_space.h>
1306         __isl_give isl_local_space *isl_local_space_set_dim_id(
1307                 __isl_take isl_local_space *ls,
1308                 enum isl_dim_type type, unsigned pos,
1309                 __isl_take isl_id *id);
1310         isl_bool isl_local_space_has_dim_id(
1311                 __isl_keep isl_local_space *ls,
1312                 enum isl_dim_type type, unsigned pos);
1313         __isl_give isl_id *isl_local_space_get_dim_id(
1314                 __isl_keep isl_local_space *ls,
1315                 enum isl_dim_type type, unsigned pos);
1316         __isl_give isl_local_space *isl_local_space_set_dim_name(
1317                 __isl_take isl_local_space *ls,
1318                 enum isl_dim_type type, unsigned pos, const char *s);
1319         isl_bool isl_local_space_has_dim_name(
1320                 __isl_keep isl_local_space *ls,
1321                 enum isl_dim_type type, unsigned pos)
1322         const char *isl_local_space_get_dim_name(
1323                 __isl_keep isl_local_space *ls,
1324                 enum isl_dim_type type, unsigned pos);
1326         #include <isl/constraint.h>
1327         const char *isl_constraint_get_dim_name(
1328                 __isl_keep isl_constraint *constraint,
1329                 enum isl_dim_type type, unsigned pos);
1331         #include <isl/set.h>
1332         __isl_give isl_id *isl_basic_set_get_dim_id(
1333                 __isl_keep isl_basic_set *bset,
1334                 enum isl_dim_type type, unsigned pos);
1335         __isl_give isl_set *isl_set_set_dim_id(
1336                 __isl_take isl_set *set, enum isl_dim_type type,
1337                 unsigned pos, __isl_take isl_id *id);
1338         isl_bool isl_set_has_dim_id(__isl_keep isl_set *set,
1339                 enum isl_dim_type type, unsigned pos);
1340         __isl_give isl_id *isl_set_get_dim_id(
1341                 __isl_keep isl_set *set, enum isl_dim_type type,
1342                 unsigned pos);
1343         const char *isl_basic_set_get_dim_name(
1344                 __isl_keep isl_basic_set *bset,
1345                 enum isl_dim_type type, unsigned pos);
1346         isl_bool isl_set_has_dim_name(__isl_keep isl_set *set,
1347                 enum isl_dim_type type, unsigned pos);
1348         const char *isl_set_get_dim_name(
1349                 __isl_keep isl_set *set,
1350                 enum isl_dim_type type, unsigned pos);
1352         #include <isl/map.h>
1353         __isl_give isl_map *isl_map_set_dim_id(
1354                 __isl_take isl_map *map, enum isl_dim_type type,
1355                 unsigned pos, __isl_take isl_id *id);
1356         isl_bool isl_basic_map_has_dim_id(
1357                 __isl_keep isl_basic_map *bmap,
1358                 enum isl_dim_type type, unsigned pos);
1359         isl_bool isl_map_has_dim_id(__isl_keep isl_map *map,
1360                 enum isl_dim_type type, unsigned pos);
1361         __isl_give isl_id *isl_map_get_dim_id(
1362                 __isl_keep isl_map *map, enum isl_dim_type type,
1363                 unsigned pos);
1364         __isl_give isl_id *isl_union_map_get_dim_id(
1365                 __isl_keep isl_union_map *umap,
1366                 enum isl_dim_type type, unsigned pos);
1367         const char *isl_basic_map_get_dim_name(
1368                 __isl_keep isl_basic_map *bmap,
1369                 enum isl_dim_type type, unsigned pos);
1370         isl_bool isl_map_has_dim_name(__isl_keep isl_map *map,
1371                 enum isl_dim_type type, unsigned pos);
1372         const char *isl_map_get_dim_name(
1373                 __isl_keep isl_map *map,
1374                 enum isl_dim_type type, unsigned pos);
1376         #include <isl/val.h>
1377         __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1378                 __isl_take isl_multi_val *mv,
1379                 enum isl_dim_type type, unsigned pos,
1380                 __isl_take isl_id *id);
1381         __isl_give isl_id *isl_multi_val_get_dim_id(
1382                 __isl_keep isl_multi_val *mv,
1383                 enum isl_dim_type type, unsigned pos);
1384         __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1385                 __isl_take isl_multi_val *mv,
1386                 enum isl_dim_type type, unsigned pos, const char *s);
1388         #include <isl/aff.h>
1389         __isl_give isl_aff *isl_aff_set_dim_id(
1390                 __isl_take isl_aff *aff, enum isl_dim_type type,
1391                 unsigned pos, __isl_take isl_id *id);
1392         __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1393                 __isl_take isl_multi_aff *maff,
1394                 enum isl_dim_type type, unsigned pos,
1395                 __isl_take isl_id *id);
1396         __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1397                 __isl_take isl_pw_aff *pma,
1398                 enum isl_dim_type type, unsigned pos,
1399                 __isl_take isl_id *id);
1400         __isl_give isl_multi_pw_aff *
1401         isl_multi_pw_aff_set_dim_id(
1402                 __isl_take isl_multi_pw_aff *mpa,
1403                 enum isl_dim_type type, unsigned pos,
1404                 __isl_take isl_id *id);
1405         __isl_give isl_multi_union_pw_aff *
1406         isl_multi_union_pw_aff_set_dim_id(
1407                 __isl_take isl_multi_union_pw_aff *mupa,
1408                 enum isl_dim_type type, unsigned pos,
1409                 __isl_take isl_id *id);
1410         __isl_give isl_id *isl_multi_aff_get_dim_id(
1411                 __isl_keep isl_multi_aff *ma,
1412                 enum isl_dim_type type, unsigned pos);
1413         isl_bool isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1414                 enum isl_dim_type type, unsigned pos);
1415         __isl_give isl_id *isl_pw_aff_get_dim_id(
1416                 __isl_keep isl_pw_aff *pa,
1417                 enum isl_dim_type type, unsigned pos);
1418         __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1419                 __isl_keep isl_pw_multi_aff *pma,
1420                 enum isl_dim_type type, unsigned pos);
1421         __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1422                 __isl_keep isl_multi_pw_aff *mpa,
1423                 enum isl_dim_type type, unsigned pos);
1424         __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1425                 __isl_keep isl_multi_union_pw_aff *mupa,
1426                 enum isl_dim_type type, unsigned pos);
1427         __isl_give isl_aff *isl_aff_set_dim_name(
1428                 __isl_take isl_aff *aff, enum isl_dim_type type,
1429                 unsigned pos, const char *s);
1430         __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1431                 __isl_take isl_multi_aff *maff,
1432                 enum isl_dim_type type, unsigned pos, const char *s);
1433         __isl_give isl_multi_pw_aff *
1434         isl_multi_pw_aff_set_dim_name(
1435                 __isl_take isl_multi_pw_aff *mpa,
1436                 enum isl_dim_type type, unsigned pos, const char *s);
1437         __isl_give isl_union_pw_aff *
1438         isl_union_pw_aff_set_dim_name(
1439                 __isl_take isl_union_pw_aff *upa,
1440                 enum isl_dim_type type, unsigned pos,
1441                 const char *s);
1442         __isl_give isl_union_pw_multi_aff *
1443         isl_union_pw_multi_aff_set_dim_name(
1444                 __isl_take isl_union_pw_multi_aff *upma,
1445                 enum isl_dim_type type, unsigned pos,
1446                 const char *s);
1447         __isl_give isl_multi_union_pw_aff *
1448         isl_multi_union_pw_aff_set_dim_name(
1449                 __isl_take isl_multi_union_pw_aff *mupa,
1450                 enum isl_dim_type type, unsigned pos,
1451                 const char *s);
1452         const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1453                 enum isl_dim_type type, unsigned pos);
1454         const char *isl_pw_aff_get_dim_name(
1455                 __isl_keep isl_pw_aff *pa,
1456                 enum isl_dim_type type, unsigned pos);
1457         const char *isl_pw_multi_aff_get_dim_name(
1458                 __isl_keep isl_pw_multi_aff *pma,
1459                 enum isl_dim_type type, unsigned pos);
1461         #include <isl/polynomial.h>
1462         __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1463                 __isl_take isl_qpolynomial *qp,
1464                 enum isl_dim_type type, unsigned pos,
1465                 const char *s);
1466         __isl_give isl_pw_qpolynomial *
1467         isl_pw_qpolynomial_set_dim_name(
1468                 __isl_take isl_pw_qpolynomial *pwqp,
1469                 enum isl_dim_type type, unsigned pos,
1470                 const char *s);
1471         __isl_give isl_pw_qpolynomial_fold *
1472         isl_pw_qpolynomial_fold_set_dim_name(
1473                 __isl_take isl_pw_qpolynomial_fold *pwf,
1474                 enum isl_dim_type type, unsigned pos,
1475                 const char *s);
1476         __isl_give isl_union_pw_qpolynomial *
1477         isl_union_pw_qpolynomial_set_dim_name(
1478                 __isl_take isl_union_pw_qpolynomial *upwqp,
1479                 enum isl_dim_type type, unsigned pos,
1480                 const char *s);
1481         __isl_give isl_union_pw_qpolynomial_fold *
1482         isl_union_pw_qpolynomial_fold_set_dim_name(
1483                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1484                 enum isl_dim_type type, unsigned pos,
1485                 const char *s);
1487 Note that C<isl_space_get_name> returns a pointer to some internal
1488 data structure, so the result can only be used while the
1489 corresponding C<isl_space> is alive.
1490 Also note that every function that operates on two sets or relations
1491 requires that both arguments have the same parameters.  This also
1492 means that if one of the arguments has named parameters, then the
1493 other needs to have named parameters too and the names need to match.
1494 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1495 arguments may have different parameters (as long as they are named),
1496 in which case the result will have as parameters the union of the parameters of
1497 the arguments.
1499 Given the identifier or name of a dimension (typically a parameter),
1500 its position can be obtained from the following functions.
1502         #include <isl/space.h>
1503         int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1504                 enum isl_dim_type type, __isl_keep isl_id *id);
1505         int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1506                 enum isl_dim_type type, const char *name);
1508         #include <isl/local_space.h>
1509         int isl_local_space_find_dim_by_name(
1510                 __isl_keep isl_local_space *ls,
1511                 enum isl_dim_type type, const char *name);
1513         #include <isl/val.h>
1514         int isl_multi_val_find_dim_by_id(
1515                 __isl_keep isl_multi_val *mv,
1516                 enum isl_dim_type type, __isl_keep isl_id *id);
1517         int isl_multi_val_find_dim_by_name(
1518                 __isl_keep isl_multi_val *mv,
1519                 enum isl_dim_type type, const char *name);
1521         #include <isl/set.h>
1522         int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1523                 enum isl_dim_type type, __isl_keep isl_id *id);
1524         int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1525                 enum isl_dim_type type, const char *name);
1527         #include <isl/map.h>
1528         int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1529                 enum isl_dim_type type, __isl_keep isl_id *id);
1530         int isl_basic_map_find_dim_by_name(
1531                 __isl_keep isl_basic_map *bmap,
1532                 enum isl_dim_type type, const char *name);
1533         int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1534                 enum isl_dim_type type, const char *name);
1535         int isl_union_map_find_dim_by_name(
1536                 __isl_keep isl_union_map *umap,
1537                 enum isl_dim_type type, const char *name);
1539         #include <isl/aff.h>
1540         int isl_multi_aff_find_dim_by_id(
1541                 __isl_keep isl_multi_aff *ma,
1542                 enum isl_dim_type type, __isl_keep isl_id *id);
1543         int isl_multi_pw_aff_find_dim_by_id(
1544                 __isl_keep isl_multi_pw_aff *mpa,
1545                 enum isl_dim_type type, __isl_keep isl_id *id);
1546         int isl_multi_union_pw_aff_find_dim_by_id(
1547                 __isl_keep isl_multi_union_pw_aff *mupa,
1548                 enum isl_dim_type type, __isl_keep isl_id *id);
1549         int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1550                 enum isl_dim_type type, const char *name);
1551         int isl_multi_aff_find_dim_by_name(
1552                 __isl_keep isl_multi_aff *ma,
1553                 enum isl_dim_type type, const char *name);
1554         int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1555                 enum isl_dim_type type, const char *name);
1556         int isl_multi_pw_aff_find_dim_by_name(
1557                 __isl_keep isl_multi_pw_aff *mpa,
1558                 enum isl_dim_type type, const char *name);
1559         int isl_pw_multi_aff_find_dim_by_name(
1560                 __isl_keep isl_pw_multi_aff *pma,
1561                 enum isl_dim_type type, const char *name);
1562         int isl_union_pw_aff_find_dim_by_name(
1563                 __isl_keep isl_union_pw_aff *upa,
1564                 enum isl_dim_type type, const char *name);
1565         int isl_union_pw_multi_aff_find_dim_by_name(
1566                 __isl_keep isl_union_pw_multi_aff *upma,
1567                 enum isl_dim_type type, const char *name);
1568         int isl_multi_union_pw_aff_find_dim_by_name(
1569                 __isl_keep isl_multi_union_pw_aff *mupa,
1570                 enum isl_dim_type type, const char *name);
1572         #include <isl/polynomial.h>
1573         int isl_pw_qpolynomial_find_dim_by_name(
1574                 __isl_keep isl_pw_qpolynomial *pwqp,
1575                 enum isl_dim_type type, const char *name);
1576         int isl_pw_qpolynomial_fold_find_dim_by_name(
1577                 __isl_keep isl_pw_qpolynomial_fold *pwf,
1578                 enum isl_dim_type type, const char *name);
1579         int isl_union_pw_qpolynomial_find_dim_by_name(
1580                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1581                 enum isl_dim_type type, const char *name);
1582         int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1583                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1584                 enum isl_dim_type type, const char *name);
1586 The identifiers or names of entire spaces may be set or read off
1587 using the following functions.
1589         #include <isl/space.h>
1590         __isl_give isl_space *isl_space_set_tuple_id(
1591                 __isl_take isl_space *space,
1592                 enum isl_dim_type type, __isl_take isl_id *id);
1593         __isl_give isl_space *isl_space_reset_tuple_id(
1594                 __isl_take isl_space *space, enum isl_dim_type type);
1595         isl_bool isl_space_has_tuple_id(
1596                 __isl_keep isl_space *space,
1597                 enum isl_dim_type type);
1598         __isl_give isl_id *isl_space_get_tuple_id(
1599                 __isl_keep isl_space *space, enum isl_dim_type type);
1600         __isl_give isl_space *isl_space_set_tuple_name(
1601                 __isl_take isl_space *space,
1602                 enum isl_dim_type type, const char *s);
1603         isl_bool isl_space_has_tuple_name(
1604                 __isl_keep isl_space *space,
1605                 enum isl_dim_type type);
1606         __isl_keep const char *isl_space_get_tuple_name(
1607                 __isl_keep isl_space *space,
1608                 enum isl_dim_type type);
1610         #include <isl/local_space.h>
1611         __isl_give isl_local_space *isl_local_space_set_tuple_id(
1612                 __isl_take isl_local_space *ls,
1613                 enum isl_dim_type type, __isl_take isl_id *id);
1615         #include <isl/set.h>
1616         __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1617                 __isl_take isl_basic_set *bset,
1618                 __isl_take isl_id *id);
1619         __isl_give isl_set *isl_set_set_tuple_id(
1620                 __isl_take isl_set *set, __isl_take isl_id *id);
1621         __isl_give isl_set *isl_set_reset_tuple_id(
1622                 __isl_take isl_set *set);
1623         isl_bool isl_set_has_tuple_id(__isl_keep isl_set *set);
1624         __isl_give isl_id *isl_set_get_tuple_id(
1625                 __isl_keep isl_set *set);
1626         __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1627                 __isl_take isl_basic_set *set, const char *s);
1628         __isl_give isl_set *isl_set_set_tuple_name(
1629                 __isl_take isl_set *set, const char *s);
1630         const char *isl_basic_set_get_tuple_name(
1631                 __isl_keep isl_basic_set *bset);
1632         isl_bool isl_set_has_tuple_name(__isl_keep isl_set *set);
1633         const char *isl_set_get_tuple_name(
1634                 __isl_keep isl_set *set);
1636         #include <isl/map.h>
1637         __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1638                 __isl_take isl_basic_map *bmap,
1639                 enum isl_dim_type type, __isl_take isl_id *id);
1640         __isl_give isl_map *isl_map_set_tuple_id(
1641                 __isl_take isl_map *map, enum isl_dim_type type,
1642                 __isl_take isl_id *id);
1643         __isl_give isl_map *isl_map_reset_tuple_id(
1644                 __isl_take isl_map *map, enum isl_dim_type type);
1645         isl_bool isl_map_has_tuple_id(__isl_keep isl_map *map,
1646                 enum isl_dim_type type);
1647         __isl_give isl_id *isl_map_get_tuple_id(
1648                 __isl_keep isl_map *map, enum isl_dim_type type);
1649         __isl_give isl_map *isl_map_set_tuple_name(
1650                 __isl_take isl_map *map,
1651                 enum isl_dim_type type, const char *s);
1652         const char *isl_basic_map_get_tuple_name(
1653                 __isl_keep isl_basic_map *bmap,
1654                 enum isl_dim_type type);
1655         __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1656                 __isl_take isl_basic_map *bmap,
1657                 enum isl_dim_type type, const char *s);
1658         isl_bool isl_map_has_tuple_name(__isl_keep isl_map *map,
1659                 enum isl_dim_type type);
1660         const char *isl_map_get_tuple_name(
1661                 __isl_keep isl_map *map,
1662                 enum isl_dim_type type);
1664         #include <isl/val.h>
1665         __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1666                 __isl_take isl_multi_val *mv,
1667                 enum isl_dim_type type, __isl_take isl_id *id);
1668         __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1669                 __isl_take isl_multi_val *mv,
1670                 enum isl_dim_type type);
1671         isl_bool isl_multi_val_has_tuple_id(
1672                 __isl_keep isl_multi_val *mv,
1673                 enum isl_dim_type type);
1674         __isl_give isl_id *isl_multi_val_get_tuple_id(
1675                 __isl_keep isl_multi_val *mv,
1676                 enum isl_dim_type type);
1677         __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1678                 __isl_take isl_multi_val *mv,
1679                 enum isl_dim_type type, const char *s);
1680         const char *isl_multi_val_get_tuple_name(
1681                 __isl_keep isl_multi_val *mv,
1682                 enum isl_dim_type type);
1684         #include <isl/aff.h>
1685         __isl_give isl_aff *isl_aff_set_tuple_id(
1686                 __isl_take isl_aff *aff,
1687                 enum isl_dim_type type, __isl_take isl_id *id);
1688         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1689                 __isl_take isl_multi_aff *maff,
1690                 enum isl_dim_type type, __isl_take isl_id *id);
1691         __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1692                 __isl_take isl_pw_aff *pwaff,
1693                 enum isl_dim_type type, __isl_take isl_id *id);
1694         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1695                 __isl_take isl_pw_multi_aff *pma,
1696                 enum isl_dim_type type, __isl_take isl_id *id);
1697         __isl_give isl_multi_union_pw_aff *
1698         isl_multi_union_pw_aff_set_tuple_id(
1699                 __isl_take isl_multi_union_pw_aff *mupa,
1700                 enum isl_dim_type type, __isl_take isl_id *id);
1701         __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1702                 __isl_take isl_multi_aff *ma,
1703                 enum isl_dim_type type);
1704         __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1705                 __isl_take isl_pw_aff *pa,
1706                 enum isl_dim_type type);
1707         __isl_give isl_multi_pw_aff *
1708         isl_multi_pw_aff_reset_tuple_id(
1709                 __isl_take isl_multi_pw_aff *mpa,
1710                 enum isl_dim_type type);
1711         __isl_give isl_pw_multi_aff *
1712         isl_pw_multi_aff_reset_tuple_id(
1713                 __isl_take isl_pw_multi_aff *pma,
1714                 enum isl_dim_type type);
1715         __isl_give isl_multi_union_pw_aff *
1716         isl_multi_union_pw_aff_reset_tuple_id(
1717                 __isl_take isl_multi_union_pw_aff *mupa,
1718                 enum isl_dim_type type);
1719         isl_bool isl_multi_aff_has_tuple_id(
1720                 __isl_keep isl_multi_aff *ma,
1721                 enum isl_dim_type type);
1722         __isl_give isl_id *isl_multi_aff_get_tuple_id(
1723                 __isl_keep isl_multi_aff *ma,
1724                 enum isl_dim_type type);
1725         isl_bool isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1726                 enum isl_dim_type type);
1727         __isl_give isl_id *isl_pw_aff_get_tuple_id(
1728                 __isl_keep isl_pw_aff *pa,
1729                 enum isl_dim_type type);
1730         isl_bool isl_pw_multi_aff_has_tuple_id(
1731                 __isl_keep isl_pw_multi_aff *pma,
1732                 enum isl_dim_type type);
1733         __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1734                 __isl_keep isl_pw_multi_aff *pma,
1735                 enum isl_dim_type type);
1736         isl_bool isl_multi_pw_aff_has_tuple_id(
1737                 __isl_keep isl_multi_pw_aff *mpa,
1738                 enum isl_dim_type type);
1739         __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1740                 __isl_keep isl_multi_pw_aff *mpa,
1741                 enum isl_dim_type type);
1742         isl_bool isl_multi_union_pw_aff_has_tuple_id(
1743                 __isl_keep isl_multi_union_pw_aff *mupa,
1744                 enum isl_dim_type type);
1745         __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1746                 __isl_keep isl_multi_union_pw_aff *mupa,
1747                 enum isl_dim_type type);
1748         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1749                 __isl_take isl_multi_aff *maff,
1750                 enum isl_dim_type type, const char *s);
1751         __isl_give isl_multi_pw_aff *
1752         isl_multi_pw_aff_set_tuple_name(
1753                 __isl_take isl_multi_pw_aff *mpa,
1754                 enum isl_dim_type type, const char *s);
1755         __isl_give isl_multi_union_pw_aff *
1756         isl_multi_union_pw_aff_set_tuple_name(
1757                 __isl_take isl_multi_union_pw_aff *mupa,
1758                 enum isl_dim_type type, const char *s);
1759         const char *isl_multi_aff_get_tuple_name(
1760                 __isl_keep isl_multi_aff *multi,
1761                 enum isl_dim_type type);
1762         isl_bool isl_pw_multi_aff_has_tuple_name(
1763                 __isl_keep isl_pw_multi_aff *pma,
1764                 enum isl_dim_type type);
1765         const char *isl_pw_multi_aff_get_tuple_name(
1766                 __isl_keep isl_pw_multi_aff *pma,
1767                 enum isl_dim_type type);
1768         const char *isl_multi_union_pw_aff_get_tuple_name(
1769                 __isl_keep isl_multi_union_pw_aff *mupa,
1770                 enum isl_dim_type type);
1772 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1773 or C<isl_dim_set>.  As with C<isl_space_get_name>,
1774 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1775 data structure.
1776 Binary operations require the corresponding spaces of their arguments
1777 to have the same name.
1779 To keep the names of all parameters and tuples, but reset the user pointers
1780 of all the corresponding identifiers, use the following function.
1782         #include <isl/space.h>
1783         __isl_give isl_space *isl_space_reset_user(
1784                 __isl_take isl_space *space);
1786         #include <isl/set.h>
1787         __isl_give isl_set *isl_set_reset_user(
1788                 __isl_take isl_set *set);
1790         #include <isl/map.h>
1791         __isl_give isl_map *isl_map_reset_user(
1792                 __isl_take isl_map *map);
1794         #include <isl/union_set.h>
1795         __isl_give isl_union_set *isl_union_set_reset_user(
1796                 __isl_take isl_union_set *uset);
1798         #include <isl/union_map.h>
1799         __isl_give isl_union_map *isl_union_map_reset_user(
1800                 __isl_take isl_union_map *umap);
1802         #include <isl/id.h>
1803         __isl_give isl_multi_id *isl_multi_id_reset_user(
1804                 __isl_take isl_multi_id *mi);
1806         #include <isl/val.h>
1807         __isl_give isl_multi_val *isl_multi_val_reset_user(
1808                 __isl_take isl_multi_val *mv);
1810         #include <isl/aff.h>
1811         __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1812                 __isl_take isl_multi_aff *ma);
1813         __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1814                 __isl_take isl_pw_aff *pa);
1815         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1816                 __isl_take isl_multi_pw_aff *mpa);
1817         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1818                 __isl_take isl_pw_multi_aff *pma);
1819         __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1820                 __isl_take isl_union_pw_aff *upa);
1821         __isl_give isl_multi_union_pw_aff *
1822         isl_multi_union_pw_aff_reset_user(
1823                 __isl_take isl_multi_union_pw_aff *mupa);
1824         __isl_give isl_union_pw_multi_aff *
1825         isl_union_pw_multi_aff_reset_user(
1826                 __isl_take isl_union_pw_multi_aff *upma);
1828         #include <isl/polynomial.h>
1829         __isl_give isl_pw_qpolynomial *
1830         isl_pw_qpolynomial_reset_user(
1831                 __isl_take isl_pw_qpolynomial *pwqp);
1832         __isl_give isl_union_pw_qpolynomial *
1833         isl_union_pw_qpolynomial_reset_user(
1834                 __isl_take isl_union_pw_qpolynomial *upwqp);
1835         __isl_give isl_pw_qpolynomial_fold *
1836         isl_pw_qpolynomial_fold_reset_user(
1837                 __isl_take isl_pw_qpolynomial_fold *pwf);
1838         __isl_give isl_union_pw_qpolynomial_fold *
1839         isl_union_pw_qpolynomial_fold_reset_user(
1840                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1842 Spaces can be nested.  In particular, the domain of a set or
1843 the domain or range of a relation can be a nested relation.
1844 This process is also called I<wrapping>.
1845 The functions for detecting, constructing and deconstructing
1846 such nested spaces can be found in the wrapping properties
1847 of L</"Unary Properties">, the wrapping operations
1848 of L</"Unary Operations"> and the Cartesian product operations
1849 of L</"Basic Operations">.
1851 Spaces can be created from other spaces
1852 using the functions described in L</"Unary Operations">
1853 and L</"Binary Operations">.
1855 =head2 Local Spaces
1857 A local space is essentially a space with
1858 zero or more existentially quantified variables.
1859 The local space of various objects can be obtained
1860 using the following functions.
1862         #include <isl/constraint.h>
1863         __isl_give isl_local_space *isl_constraint_get_local_space(
1864                 __isl_keep isl_constraint *constraint);
1866         #include <isl/set.h>
1867         __isl_give isl_local_space *isl_basic_set_get_local_space(
1868                 __isl_keep isl_basic_set *bset);
1870         #include <isl/map.h>
1871         __isl_give isl_local_space *isl_basic_map_get_local_space(
1872                 __isl_keep isl_basic_map *bmap);
1874         #include <isl/aff.h>
1875         __isl_give isl_local_space *isl_aff_get_domain_local_space(
1876                 __isl_keep isl_aff *aff);
1877         __isl_give isl_local_space *isl_aff_get_local_space(
1878                 __isl_keep isl_aff *aff);
1880 A new local space can be created from a space using
1882         #include <isl/local_space.h>
1883         __isl_give isl_local_space *isl_local_space_from_space(
1884                 __isl_take isl_space *space);
1886 They can be inspected, modified, copied and freed using the following functions.
1888         #include <isl/local_space.h>
1889         isl_bool isl_local_space_is_params(
1890                 __isl_keep isl_local_space *ls);
1891         isl_bool isl_local_space_is_set(
1892                 __isl_keep isl_local_space *ls);
1893         __isl_give isl_space *isl_local_space_get_space(
1894                 __isl_keep isl_local_space *ls);
1895         __isl_give isl_aff *isl_local_space_get_div(
1896                 __isl_keep isl_local_space *ls, int pos);
1897         __isl_give isl_local_space *isl_local_space_copy(
1898                 __isl_keep isl_local_space *ls);
1899         __isl_null isl_local_space *isl_local_space_free(
1900                 __isl_take isl_local_space *ls);
1902 Note that C<isl_local_space_get_div> can only be used on local spaces
1903 of sets.
1905 Two local spaces can be compared using
1907         isl_bool isl_local_space_is_equal(
1908                 __isl_keep isl_local_space *ls1,
1909                 __isl_keep isl_local_space *ls2);
1911 Local spaces can be created from other local spaces
1912 using the functions described in L</"Unary Operations">
1913 and L</"Binary Operations">.
1915 =head2 Creating New Sets and Relations
1917 C<isl> has functions for creating some standard sets and relations.
1919 =over
1921 =item * Empty sets and relations
1923         __isl_give isl_basic_set *isl_basic_set_empty(
1924                 __isl_take isl_space *space);
1925         __isl_give isl_basic_map *isl_basic_map_empty(
1926                 __isl_take isl_space *space);
1927         __isl_give isl_set *isl_set_empty(
1928                 __isl_take isl_space *space);
1929         __isl_give isl_map *isl_map_empty(
1930                 __isl_take isl_space *space);
1931         __isl_give isl_union_set *isl_union_set_empty_ctx(
1932                 isl_ctx *ctx);
1933         __isl_give isl_union_set *isl_union_set_empty_space(
1934                 __isl_take isl_space *space);
1935         __isl_give isl_union_set *isl_union_set_empty(
1936                 __isl_take isl_space *space);
1937         __isl_give isl_union_map *isl_union_map_empty_ctx(
1938                 isl_ctx *ctx);
1939         __isl_give isl_union_map *isl_union_map_empty_space(
1940                 __isl_take isl_space *space);
1941         __isl_give isl_union_map *isl_union_map_empty(
1942                 __isl_take isl_space *space);
1944 For C<isl_union_set>s and C<isl_union_map>s, the space
1945 is only used to specify the parameters.
1946 C<isl_union_set_empty> is an alternative name for
1947 C<isl_union_set_empty_space>.
1948 Similarly for the other pair of functions.
1950 =item * Universe sets and relations
1952         __isl_give isl_basic_set *isl_basic_set_universe(
1953                 __isl_take isl_space *space);
1954         __isl_give isl_basic_map *isl_basic_map_universe(
1955                 __isl_take isl_space *space);
1956         __isl_give isl_set *isl_set_universe(
1957                 __isl_take isl_space *space);
1958         __isl_give isl_map *isl_map_universe(
1959                 __isl_take isl_space *space);
1960         __isl_give isl_union_set *isl_union_set_universe(
1961                 __isl_take isl_union_set *uset);
1962         __isl_give isl_union_map *isl_union_map_universe(
1963                 __isl_take isl_union_map *umap);
1965 The sets and relations constructed by the functions above
1966 contain all integer values, while those constructed by the
1967 functions below only contain non-negative values.
1969         __isl_give isl_basic_set *isl_basic_set_nat_universe(
1970                 __isl_take isl_space *space);
1971         __isl_give isl_basic_map *isl_basic_map_nat_universe(
1972                 __isl_take isl_space *space);
1973         __isl_give isl_set *isl_set_nat_universe(
1974                 __isl_take isl_space *space);
1975         __isl_give isl_map *isl_map_nat_universe(
1976                 __isl_take isl_space *space);
1978 =item * Identity relations
1980         __isl_give isl_basic_map *isl_basic_map_identity(
1981                 __isl_take isl_space *space);
1982         __isl_give isl_map *isl_map_identity(
1983                 __isl_take isl_space *space);
1985 The number of input and output dimensions in C<space> needs
1986 to be the same.
1988 =item * Lexicographic order
1990         __isl_give isl_map *isl_map_lex_lt(
1991                 __isl_take isl_space *set_space);
1992         __isl_give isl_map *isl_map_lex_le(
1993                 __isl_take isl_space *set_space);
1994         __isl_give isl_map *isl_map_lex_gt(
1995                 __isl_take isl_space *set_space);
1996         __isl_give isl_map *isl_map_lex_ge(
1997                 __isl_take isl_space *set_space);
1998         __isl_give isl_map *isl_map_lex_lt_first(
1999                 __isl_take isl_space *space, unsigned n);
2000         __isl_give isl_map *isl_map_lex_le_first(
2001                 __isl_take isl_space *space, unsigned n);
2002         __isl_give isl_map *isl_map_lex_gt_first(
2003                 __isl_take isl_space *space, unsigned n);
2004         __isl_give isl_map *isl_map_lex_ge_first(
2005                 __isl_take isl_space *space, unsigned n);
2007 The first four functions take a space for a B<set>
2008 and return relations that express that the elements in the domain
2009 are lexicographically less
2010 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
2011 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
2012 than the elements in the range.
2013 The last four functions take a space for a map
2014 and return relations that express that the first C<n> dimensions
2015 in the domain are lexicographically less
2016 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
2017 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
2018 than the first C<n> dimensions in the range.
2020 =back
2022 A basic set or relation can be converted to a set or relation
2023 using the following functions.
2025         __isl_give isl_set *isl_set_from_basic_set(
2026                 __isl_take isl_basic_set *bset);
2027         __isl_give isl_map *isl_map_from_basic_map(
2028                 __isl_take isl_basic_map *bmap);
2030 Sets and relations can be converted to union sets and relations
2031 using the following functions.
2033         __isl_give isl_union_set *isl_union_set_from_basic_set(
2034                 __isl_take isl_basic_set *bset);
2035         __isl_give isl_union_map *isl_union_map_from_basic_map(
2036                 __isl_take isl_basic_map *bmap);
2037         __isl_give isl_union_set *isl_union_set_from_set(
2038                 __isl_take isl_set *set);
2039         __isl_give isl_union_map *isl_union_map_from_map(
2040                 __isl_take isl_map *map);
2042 The inverse conversions below can only be used if the input
2043 union set or relation is known to contain elements in exactly one
2044 space.
2046         #include <isl/union_set.h>
2047         isl_bool isl_union_set_isa_set(
2048                 __isl_keep isl_union_set *uset);
2049         __isl_give isl_set *isl_set_from_union_set(
2050                 __isl_take isl_union_set *uset);
2052         #include <isl/union_map.h>
2053         isl_bool isl_union_map_isa_map(
2054                 __isl_keep isl_union_map *umap);
2055         __isl_give isl_map *isl_map_from_union_map(
2056                 __isl_take isl_union_map *umap);
2058 Sets and relations can be copied and freed again using the following
2059 functions.
2061         __isl_give isl_basic_set *isl_basic_set_copy(
2062                 __isl_keep isl_basic_set *bset);
2063         __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
2064         __isl_give isl_union_set *isl_union_set_copy(
2065                 __isl_keep isl_union_set *uset);
2066         __isl_give isl_basic_map *isl_basic_map_copy(
2067                 __isl_keep isl_basic_map *bmap);
2068         __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
2069         __isl_give isl_union_map *isl_union_map_copy(
2070                 __isl_keep isl_union_map *umap);
2071         __isl_null isl_basic_set *isl_basic_set_free(
2072                 __isl_take isl_basic_set *bset);
2073         __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
2074         __isl_null isl_union_set *isl_union_set_free(
2075                 __isl_take isl_union_set *uset);
2076         __isl_null isl_basic_map *isl_basic_map_free(
2077                 __isl_take isl_basic_map *bmap);
2078         __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
2079         __isl_null isl_union_map *isl_union_map_free(
2080                 __isl_take isl_union_map *umap);
2082 Other sets and relations can be constructed by starting
2083 from a universe set or relation, adding equality and/or
2084 inequality constraints and then projecting out the
2085 existentially quantified variables, if any.
2086 Constraints can be constructed, manipulated and
2087 added to (or removed from) (basic) sets and relations
2088 using the following functions.
2090         #include <isl/constraint.h>
2091         __isl_give isl_constraint *isl_constraint_alloc_equality(
2092                 __isl_take isl_local_space *ls);
2093         __isl_give isl_constraint *isl_constraint_alloc_inequality(
2094                 __isl_take isl_local_space *ls);
2095         __isl_give isl_constraint *isl_constraint_set_constant_si(
2096                 __isl_take isl_constraint *constraint, int v);
2097         __isl_give isl_constraint *isl_constraint_set_constant_val(
2098                 __isl_take isl_constraint *constraint,
2099                 __isl_take isl_val *v);
2100         __isl_give isl_constraint *isl_constraint_set_coefficient_si(
2101                 __isl_take isl_constraint *constraint,
2102                 enum isl_dim_type type, int pos, int v);
2103         __isl_give isl_constraint *
2104         isl_constraint_set_coefficient_val(
2105                 __isl_take isl_constraint *constraint,
2106                 enum isl_dim_type type, int pos,
2107                 __isl_take isl_val *v);
2108         __isl_give isl_basic_map *isl_basic_map_add_constraint(
2109                 __isl_take isl_basic_map *bmap,
2110                 __isl_take isl_constraint *constraint);
2111         __isl_give isl_basic_set *isl_basic_set_add_constraint(
2112                 __isl_take isl_basic_set *bset,
2113                 __isl_take isl_constraint *constraint);
2114         __isl_give isl_map *isl_map_add_constraint(
2115                 __isl_take isl_map *map,
2116                 __isl_take isl_constraint *constraint);
2117         __isl_give isl_set *isl_set_add_constraint(
2118                 __isl_take isl_set *set,
2119                 __isl_take isl_constraint *constraint);
2121 For example, to create a set containing the even integers
2122 between 10 and 42, you could use the following code.
2124         isl_space *space;
2125         isl_local_space *ls;
2126         isl_constraint *c;
2127         isl_basic_set *bset;
2129         space = isl_space_set_alloc(ctx, 0, 2);
2130         bset = isl_basic_set_universe(isl_space_copy(space));
2131         ls = isl_local_space_from_space(space);
2133         c = isl_constraint_alloc_equality(isl_local_space_copy(ls));
2134         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
2135         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
2136         bset = isl_basic_set_add_constraint(bset, c);
2138         c = isl_constraint_alloc_inequality(isl_local_space_copy(ls));
2139         c = isl_constraint_set_constant_si(c, -10);
2140         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
2141         bset = isl_basic_set_add_constraint(bset, c);
2143         c = isl_constraint_alloc_inequality(ls);
2144         c = isl_constraint_set_constant_si(c, 42);
2145         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
2146         bset = isl_basic_set_add_constraint(bset, c);
2148         bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
2150 However, this is considered to be a fairly low-level approach.
2151 It is more appropriate to construct a (basic) set by means
2152 of affine expressions (defined below in L</"Functions">).
2153 For example, the same set could be constructed as follows.
2155         isl_val *v, *two;
2156         isl_space *space;
2157         isl_multi_aff *ma;
2158         isl_aff *var, *cst;
2159         isl_basic_set *bset;
2161         space = isl_space_unit(ctx);
2162         space = isl_space_add_unnamed_tuple_ui(space, 1);
2163         ma = isl_multi_aff_identity_on_domain_space(
2164                 isl_space_copy(space));
2165         var = isl_multi_aff_get_at(ma, 0);
2166         v = isl_val_int_from_si(ctx, 10);
2167         cst = isl_aff_val_on_domain_space(isl_space_copy(space), v);
2168         bset = isl_aff_ge_basic_set(isl_aff_copy(var), cst);
2170         v = isl_val_int_from_si(ctx, 42);
2171         cst = isl_aff_val_on_domain_space(space, v);
2172         bset = isl_basic_set_intersect(bset,
2173                 isl_aff_le_basic_set(var, cst));
2175         two = isl_val_int_from_si(ctx, 2);
2176         ma = isl_multi_aff_scale_val(ma, isl_val_copy(two));
2177         bset = isl_basic_set_preimage_multi_aff(bset,
2178                 isl_multi_aff_copy(ma));
2179         ma = isl_multi_aff_scale_down_val(ma, isl_val_copy(two));
2180         ma = isl_multi_aff_scale_down_val(ma, two);
2181         bset = isl_basic_set_preimage_multi_aff(bset, ma);
2183 Alternatively, the set can be parsed from a string representation.
2185         isl_basic_set *bset;
2186         bset = isl_basic_set_read_from_str(ctx,
2187                 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
2189 A basic set or relation can also be constructed from two matrices
2190 describing the equalities and the inequalities.
2192         __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
2193                 __isl_take isl_space *space,
2194                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
2195                 enum isl_dim_type c1,
2196                 enum isl_dim_type c2, enum isl_dim_type c3,
2197                 enum isl_dim_type c4);
2198         __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
2199                 __isl_take isl_space *space,
2200                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
2201                 enum isl_dim_type c1,
2202                 enum isl_dim_type c2, enum isl_dim_type c3,
2203                 enum isl_dim_type c4, enum isl_dim_type c5);
2205 The C<isl_dim_type> arguments indicate the order in which
2206 different kinds of variables appear in the input matrices
2207 and should be a permutation of C<isl_dim_cst> (the constant term),
2208 C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div> for sets and
2209 of C<isl_dim_cst>, C<isl_dim_param>,
2210 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
2212 A (basic or union) set or relation can also be constructed from a
2213 (union) (piecewise) (multiple) affine expression
2214 or a list of affine expressions
2215 (See L</"Functions">), provided these affine expressions do not
2216 involve any NaN.
2218         #include <isl/set.h>
2219         __isl_give isl_basic_set *isl_basic_set_from_multi_aff(
2220                 __isl_take isl_multi_aff *ma);
2221         __isl_give isl_set *isl_set_from_multi_aff(
2222                 __isl_take isl_multi_aff *ma);
2224         #include <isl/map.h>
2225         __isl_give isl_basic_map *isl_basic_map_from_aff(
2226                 __isl_take isl_aff *aff);
2227         __isl_give isl_map *isl_map_from_aff(
2228                 __isl_take isl_aff *aff);
2229         __isl_give isl_basic_map *isl_basic_map_from_aff_list(
2230                 __isl_take isl_space *domain_space,
2231                 __isl_take isl_aff_list *list);
2232         __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
2233                 __isl_take isl_multi_aff *maff)
2234         __isl_give isl_map *isl_map_from_multi_aff(
2235                 __isl_take isl_multi_aff *maff)
2237         #include <isl/aff.h>
2238         __isl_give isl_set *isl_set_from_pw_aff(
2239                 __isl_take isl_pw_aff *pwaff);
2240         __isl_give isl_map *isl_map_from_pw_aff(
2241                 __isl_take isl_pw_aff *pwaff);
2242         __isl_give isl_set *isl_set_from_pw_multi_aff(
2243                 __isl_take isl_pw_multi_aff *pma);
2244         __isl_give isl_map *isl_map_from_pw_multi_aff(
2245                 __isl_take isl_pw_multi_aff *pma);
2246         __isl_give isl_set *isl_set_from_multi_pw_aff(
2247                 __isl_take isl_multi_pw_aff *mpa);
2248         __isl_give isl_map *isl_map_from_multi_pw_aff(
2249                 __isl_take isl_multi_pw_aff *mpa);
2250         __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
2251                 __isl_take isl_union_pw_aff *upa);
2252         __isl_give isl_union_map *
2253         isl_union_map_from_union_pw_multi_aff(
2254                 __isl_take isl_union_pw_multi_aff *upma);
2255         __isl_give isl_union_map *
2256         isl_union_map_from_multi_union_pw_aff(
2257                 __isl_take isl_multi_union_pw_aff *mupa);
2259 The C<domain_space> argument describes the domain of the resulting
2260 basic relation.  It is required because the C<list> may consist
2261 of zero affine expressions.
2262 The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
2263 is not allowed to be zero-dimensional.  The domain of the result
2264 is the shared domain of the union piecewise affine elements.
2266 =head2 Inspecting Sets and Relations
2268 Usually, the user should not have to care about the actual constraints
2269 of the sets and maps, but should instead apply the abstract operations
2270 explained in the following sections.
2271 Occasionally, however, it may be required to inspect the individual
2272 coefficients of the constraints.  This section explains how to do so.
2273 In these cases, it may also be useful to have C<isl> compute
2274 an explicit representation of the existentially quantified variables.
2276         __isl_give isl_set *isl_set_compute_divs(
2277                 __isl_take isl_set *set);
2278         __isl_give isl_map *isl_map_compute_divs(
2279                 __isl_take isl_map *map);
2280         __isl_give isl_union_set *isl_union_set_compute_divs(
2281                 __isl_take isl_union_set *uset);
2282         __isl_give isl_union_map *isl_union_map_compute_divs(
2283                 __isl_take isl_union_map *umap);
2285 This explicit representation defines the existentially quantified
2286 variables as integer divisions of the other variables, possibly
2287 including earlier existentially quantified variables.
2288 An explicitly represented existentially quantified variable therefore
2289 has a unique value when the values of the other variables are known.
2291 Alternatively, the existentially quantified variables can be removed
2292 using the following functions, which compute an overapproximation.
2294         #include <isl/set.h>
2295         __isl_give isl_basic_set *isl_basic_set_remove_divs(
2296                 __isl_take isl_basic_set *bset);
2297         __isl_give isl_set *isl_set_remove_divs(
2298                 __isl_take isl_set *set);
2300         #include <isl/map.h>
2301         __isl_give isl_basic_map *isl_basic_map_remove_divs(
2302                 __isl_take isl_basic_map *bmap);
2303         __isl_give isl_map *isl_map_remove_divs(
2304                 __isl_take isl_map *map);
2306         #include <isl/union_set.h>
2307         __isl_give isl_union_set *isl_union_set_remove_divs(
2308                 __isl_take isl_union_set *bset);
2310         #include <isl/union_map.h>
2311         __isl_give isl_union_map *isl_union_map_remove_divs(
2312                 __isl_take isl_union_map *bmap);
2314 It is also possible to only remove those divs that are defined
2315 in terms of a given range of dimensions or only those for which
2316 no explicit representation is known.
2318         __isl_give isl_basic_set *
2319         isl_basic_set_remove_divs_involving_dims(
2320                 __isl_take isl_basic_set *bset,
2321                 enum isl_dim_type type,
2322                 unsigned first, unsigned n);
2323         __isl_give isl_basic_map *
2324         isl_basic_map_remove_divs_involving_dims(
2325                 __isl_take isl_basic_map *bmap,
2326                 enum isl_dim_type type,
2327                 unsigned first, unsigned n);
2328         __isl_give isl_set *isl_set_remove_divs_involving_dims(
2329                 __isl_take isl_set *set, enum isl_dim_type type,
2330                 unsigned first, unsigned n);
2331         __isl_give isl_map *isl_map_remove_divs_involving_dims(
2332                 __isl_take isl_map *map, enum isl_dim_type type,
2333                 unsigned first, unsigned n);
2335         __isl_give isl_basic_set *
2336         isl_basic_set_remove_unknown_divs(
2337                 __isl_take isl_basic_set *bset);
2338         __isl_give isl_set *isl_set_remove_unknown_divs(
2339                 __isl_take isl_set *set);
2340         __isl_give isl_map *isl_map_remove_unknown_divs(
2341                 __isl_take isl_map *map);
2343 To iterate over all the sets or maps in a union set or map, use
2345         #include <isl/union_set.h>
2346         isl_stat isl_union_set_foreach_set(
2347                 __isl_keep isl_union_set *uset,
2348                 isl_stat (*fn)(__isl_take isl_set *set, void *user),
2349                 void *user);
2350         isl_bool isl_union_set_every_set(
2351                 __isl_keep isl_union_set *uset,
2352                 isl_bool (*test)(__isl_keep isl_set *set,
2353                         void *user),
2354                 void *user);
2356         #include <isl/union_map.h>
2357         isl_stat isl_union_map_foreach_map(
2358                 __isl_keep isl_union_map *umap,
2359                 isl_stat (*fn)(__isl_take isl_map *map, void *user),
2360                 void *user);
2361         isl_bool isl_union_map_every_map(
2362                 __isl_keep isl_union_map *umap,
2363                 isl_bool (*test)(__isl_keep isl_map *map,
2364                         void *user),
2365                 void *user);
2367 These functions call the callback function once for each
2368 (pair of) space(s) for which there are elements in the input.
2369 The argument to the callback contains all elements in the input
2370 with that (pair of) space(s).
2371 The C<isl_union_set_every_set> and
2372 C<isl_union_map_every_map> variants check whether each
2373 call to the callback returns true and stops checking as soon as one
2374 of these calls returns false.
2376 The number of sets or maps in a union set or map can be obtained
2377 from
2379         isl_size isl_union_set_n_set(__isl_keep isl_union_set *uset);
2380         isl_size isl_union_map_n_map(__isl_keep isl_union_map *umap);
2382 To extract the set or map in a given space from a union, use
2384         __isl_give isl_set *isl_union_set_extract_set(
2385                 __isl_keep isl_union_set *uset,
2386                 __isl_take isl_space *space);
2387         __isl_give isl_map *isl_union_map_extract_map(
2388                 __isl_keep isl_union_map *umap,
2389                 __isl_take isl_space *space);
2391 To iterate over all the basic sets or maps in a set or map, use
2393         isl_stat isl_set_foreach_basic_set(__isl_keep isl_set *set,
2394                 isl_stat (*fn)(__isl_take isl_basic_set *bset,
2395                         void *user),
2396                 void *user);
2397         isl_stat isl_map_foreach_basic_map(__isl_keep isl_map *map,
2398                 isl_stat (*fn)(__isl_take isl_basic_map *bmap,
2399                         void *user),
2400                 void *user);
2402 The callback function C<fn> should return C<isl_stat_ok> if successful and
2403 C<isl_stat_error> if an error occurs.  In the latter case, or if any other error
2404 occurs, the above functions will return C<isl_stat_error>.
2406 It should be noted that C<isl> does not guarantee that
2407 the basic sets or maps passed to C<fn> are disjoint.
2408 If this is required, then the user should call one of
2409 the following functions first.
2411         __isl_give isl_set *isl_set_make_disjoint(
2412                 __isl_take isl_set *set);
2413         __isl_give isl_map *isl_map_make_disjoint(
2414                 __isl_take isl_map *map);
2416 The number of basic sets in a set can be obtained
2417 or the number of basic maps in a map can be obtained
2418 from
2420         #include <isl/set.h>
2421         isl_size isl_set_n_basic_set(__isl_keep isl_set *set);
2423         #include <isl/map.h>
2424         isl_size isl_map_n_basic_map(__isl_keep isl_map *map);
2426 It is also possible to obtain a list of (basic) sets from a set
2427 or union set, a list of basic maps from a map and a list of maps from a union
2428 map.
2430         #include <isl/set.h>
2431         __isl_give isl_basic_set_list *isl_set_get_basic_set_list(
2432                 __isl_keep isl_set *set);
2434         #include <isl/union_set.h>
2435         __isl_give isl_basic_set_list *
2436         isl_union_set_get_basic_set_list(
2437                 __isl_keep isl_union_set *uset);
2438         __isl_give isl_set_list *isl_union_set_get_set_list(
2439                 __isl_keep isl_union_set *uset);
2441         #include <isl/map.h>
2442         __isl_give isl_basic_map_list *isl_map_get_basic_map_list(
2443                 __isl_keep isl_map *map);
2445         #include <isl/union_map.h>
2446         __isl_give isl_map_list *isl_union_map_get_map_list(
2447                 __isl_keep isl_union_map *umap);
2449 The returned list can be manipulated using the functions in L<"Lists">.
2451 To iterate over the constraints of a basic set or map, use
2453         #include <isl/constraint.h>
2455         isl_size isl_basic_set_n_constraint(
2456                 __isl_keep isl_basic_set *bset);
2457         isl_stat isl_basic_set_foreach_constraint(
2458                 __isl_keep isl_basic_set *bset,
2459                 isl_stat (*fn)(__isl_take isl_constraint *c,
2460                         void *user),
2461                 void *user);
2462         isl_size isl_basic_map_n_constraint(
2463                 __isl_keep isl_basic_map *bmap);
2464         isl_stat isl_basic_map_foreach_constraint(
2465                 __isl_keep isl_basic_map *bmap,
2466                 isl_stat (*fn)(__isl_take isl_constraint *c,
2467                         void *user),
2468                 void *user);
2469         __isl_null isl_constraint *isl_constraint_free(
2470                 __isl_take isl_constraint *c);
2472 Again, the callback function C<fn> should return C<isl_stat_ok>
2473 if successful and
2474 C<isl_stat_error> if an error occurs.  In the latter case, or if any other error
2475 occurs, the above functions will return C<isl_stat_error>.
2476 The constraint C<c> represents either an equality or an inequality.
2477 Use the following function to find out whether a constraint
2478 represents an equality.  If not, it represents an inequality.
2480         isl_bool isl_constraint_is_equality(
2481                 __isl_keep isl_constraint *constraint);
2483 It is also possible to obtain a list of constraints from a basic
2484 map or set
2486         #include <isl/constraint.h>
2487         __isl_give isl_constraint_list *
2488         isl_basic_map_get_constraint_list(
2489                 __isl_keep isl_basic_map *bmap);
2490         __isl_give isl_constraint_list *
2491         isl_basic_set_get_constraint_list(
2492                 __isl_keep isl_basic_set *bset);
2494 These functions require that all existentially quantified variables
2495 have an explicit representation.
2496 The returned list can be manipulated using the functions in L<"Lists">.
2498 The coefficients of the constraints can be inspected using
2499 the following functions.
2501         isl_bool isl_constraint_is_lower_bound(
2502                 __isl_keep isl_constraint *constraint,
2503                 enum isl_dim_type type, unsigned pos);
2504         isl_bool isl_constraint_is_upper_bound(
2505                 __isl_keep isl_constraint *constraint,
2506                 enum isl_dim_type type, unsigned pos);
2507         __isl_give isl_val *isl_constraint_get_constant_val(
2508                 __isl_keep isl_constraint *constraint);
2509         __isl_give isl_val *isl_constraint_get_coefficient_val(
2510                 __isl_keep isl_constraint *constraint,
2511                 enum isl_dim_type type, int pos);
2513 The explicit representations of the existentially quantified
2514 variables can be inspected using the following function.
2515 Note that the user is only allowed to use this function
2516 if the inspected set or map is the result of a call
2517 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2518 The existentially quantified variable is equal to the floor
2519 of the returned affine expression.  The affine expression
2520 itself can be inspected using the functions in
2521 L</"Functions">.
2523         __isl_give isl_aff *isl_constraint_get_div(
2524                 __isl_keep isl_constraint *constraint, int pos);
2526 To obtain the constraints of a basic set or map in matrix
2527 form, use the following functions.
2529         __isl_give isl_mat *isl_basic_set_equalities_matrix(
2530                 __isl_keep isl_basic_set *bset,
2531                 enum isl_dim_type c1, enum isl_dim_type c2,
2532                 enum isl_dim_type c3, enum isl_dim_type c4);
2533         __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2534                 __isl_keep isl_basic_set *bset,
2535                 enum isl_dim_type c1, enum isl_dim_type c2,
2536                 enum isl_dim_type c3, enum isl_dim_type c4);
2537         __isl_give isl_mat *isl_basic_map_equalities_matrix(
2538                 __isl_keep isl_basic_map *bmap,
2539                 enum isl_dim_type c1,
2540                 enum isl_dim_type c2, enum isl_dim_type c3,
2541                 enum isl_dim_type c4, enum isl_dim_type c5);
2542         __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2543                 __isl_keep isl_basic_map *bmap,
2544                 enum isl_dim_type c1,
2545                 enum isl_dim_type c2, enum isl_dim_type c3,
2546                 enum isl_dim_type c4, enum isl_dim_type c5);
2548 The C<isl_dim_type> arguments dictate the order in which
2549 different kinds of variables appear in the resulting matrix.
2550 For set inputs, they should be a permutation of
2551 C<isl_dim_cst> (the constant term), C<isl_dim_param>, C<isl_dim_set> and
2552 C<isl_dim_div>.
2553 For map inputs, they should be a permutation of
2554 C<isl_dim_cst>, C<isl_dim_param>,
2555 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2557 =head2 Points
2559 Points are elements of a set.  They can be used to construct
2560 simple sets (boxes) or they can be used to represent the
2561 individual elements of a set.
2562 The zero point (the origin) can be created using
2564         __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2566 The coordinates of a point can be inspected, set and changed
2567 using
2569         #include <isl/point.h>
2570         __isl_give isl_multi_val *isl_point_get_multi_val(
2571                 __isl_keep isl_point *pnt);
2572         __isl_give isl_val *isl_point_get_coordinate_val(
2573                 __isl_keep isl_point *pnt,
2574                 enum isl_dim_type type, int pos);
2575         __isl_give isl_point *isl_point_set_coordinate_val(
2576                 __isl_take isl_point *pnt,
2577                 enum isl_dim_type type, int pos,
2578                 __isl_take isl_val *v);
2580         __isl_give isl_point *isl_point_add_ui(
2581                 __isl_take isl_point *pnt,
2582                 enum isl_dim_type type, int pos, unsigned val);
2583         __isl_give isl_point *isl_point_sub_ui(
2584                 __isl_take isl_point *pnt,
2585                 enum isl_dim_type type, int pos, unsigned val);
2587 Points can be copied or freed using
2589         __isl_give isl_point *isl_point_copy(
2590                 __isl_keep isl_point *pnt);
2591         __isl_null isl_point *isl_point_free(
2592                 __isl_take isl_point *pnt);
2594 A singleton set can be created from a point using
2596         __isl_give isl_basic_set *isl_basic_set_from_point(
2597                 __isl_take isl_point *pnt);
2598         __isl_give isl_set *isl_set_from_point(
2599                 __isl_take isl_point *pnt);
2600         __isl_give isl_union_set *isl_union_set_from_point(
2601                 __isl_take isl_point *pnt);
2603 and a box can be created from two opposite extremal points using
2605         __isl_give isl_basic_set *isl_basic_set_box_from_points(
2606                 __isl_take isl_point *pnt1,
2607                 __isl_take isl_point *pnt2);
2608         __isl_give isl_set *isl_set_box_from_points(
2609                 __isl_take isl_point *pnt1,
2610                 __isl_take isl_point *pnt2);
2612 All elements of a B<bounded> (union) set can be enumerated using
2613 the following functions.
2615         isl_stat isl_set_foreach_point(__isl_keep isl_set *set,
2616                 isl_stat (*fn)(__isl_take isl_point *pnt,
2617                         void *user),
2618                 void *user);
2619         isl_stat isl_union_set_foreach_point(
2620                 __isl_keep isl_union_set *uset,
2621                 isl_stat (*fn)(__isl_take isl_point *pnt,
2622                         void *user),
2623                 void *user);
2625 The function C<fn> is called for each integer point in
2626 C<set> with as second argument the last argument of
2627 the C<isl_set_foreach_point> call.  The function C<fn>
2628 should return C<isl_stat_ok> on success and C<isl_stat_error> on failure.
2629 In the latter case, C<isl_set_foreach_point> will stop
2630 enumerating and return C<isl_stat_error> as well.
2631 If the enumeration is performed successfully and to completion,
2632 then C<isl_set_foreach_point> returns C<isl_stat_ok>.
2634 To obtain a single point of a (basic or union) set, use
2636         __isl_give isl_point *isl_basic_set_sample_point(
2637                 __isl_take isl_basic_set *bset);
2638         __isl_give isl_point *isl_set_sample_point(
2639                 __isl_take isl_set *set);
2640         __isl_give isl_point *isl_union_set_sample_point(
2641                 __isl_take isl_union_set *uset);
2643 If C<set> does not contain any (integer) points, then the
2644 resulting point will be ``void'', a property that can be
2645 tested using
2647         isl_bool isl_point_is_void(__isl_keep isl_point *pnt);
2649 =head2 Functions
2651 Besides sets and relation, C<isl> also supports various types of functions.
2652 Each of these types is derived from the value type (see L</"Values">)
2653 or from one of two primitive function types
2654 through the application of zero or more type constructors.
2655 As a special case, a multiple expression can also be derived
2656 from an identifier (see L</"Identifiers">) although the result
2657 is not really a function.
2658 We first describe the primitive type and then we describe
2659 the types derived from these primitive types.
2661 =head3 Primitive Functions
2663 C<isl> support two primitive function types, quasi-affine
2664 expressions and quasipolynomials.
2665 A quasi-affine expression is defined either over a parameter
2666 space or over a set and is composed of integer constants,
2667 parameters and set variables, addition, subtraction and
2668 integer division by an integer constant.
2669 For example, the quasi-affine expression
2671         [n] -> { [x] -> [2*floor((4 n + x)/9)] }
2673 maps C<x> to C<2*floor((4 n + x)/9>.
2674 A quasipolynomial is a polynomial expression in quasi-affine
2675 expression.  That is, it additionally allows for multiplication.
2676 Note, though, that it is not allowed to construct an integer
2677 division of an expression involving multiplications.
2678 Here is an example of a quasipolynomial that is not
2679 quasi-affine expression
2681         [n] -> { [x] -> (n*floor((4 n + x)/9)) }
2683 Note that the external representations of quasi-affine expressions
2684 and quasipolynomials are different.  Quasi-affine expressions
2685 use a notation with square brackets just like binary relations,
2686 while quasipolynomials do not.  This might change at some point.
2688 If a primitive function is defined over a parameter space,
2689 then the space of the function itself is that of a set.
2690 If it is defined over a set, then the space of the function
2691 is that of a relation.  In both cases, the set space (or
2692 the output space) is single-dimensional, anonymous and unstructured.
2693 To create functions with multiple dimensions or with other kinds
2694 of set or output spaces, use multiple expressions
2695 (see L</"Multiple Expressions">).
2697 =over
2699 =item * Quasi-affine Expressions
2701 Besides the expressions described above, a quasi-affine
2702 expression can also be set to NaN.  Such expressions
2703 typically represent a failure to represent a result
2704 as a quasi-affine expression.
2706 The zero quasi affine expression or the quasi affine expression
2707 that is equal to a given value, parameter or
2708 a specified dimension on a given domain can be created using
2710         #include <isl/aff.h>
2711         __isl_give isl_aff *isl_aff_zero_on_domain_space(
2712                 __isl_take isl_space *space);
2713         __isl_give isl_aff *isl_aff_zero_on_domain(
2714                 __isl_take isl_local_space *ls);
2715         __isl_give isl_aff *isl_aff_val_on_domain_space(
2716                 __isl_take isl_space *space,
2717                 __isl_take isl_val *val);
2718         __isl_give isl_aff *isl_aff_val_on_domain(
2719                 __isl_take isl_local_space *ls,
2720                 __isl_take isl_val *val);
2721         __isl_give isl_aff *isl_aff_param_on_domain_space_id(
2722                 __isl_take isl_space *space,
2723                 __isl_take isl_id *id);
2724         __isl_give isl_aff *isl_aff_var_on_domain(
2725                 __isl_take isl_local_space *ls,
2726                 enum isl_dim_type type, unsigned pos);
2727         __isl_give isl_aff *isl_aff_nan_on_domain(
2728                 __isl_take isl_local_space *ls);
2730 The space passed to C<isl_aff_param_on_domain_space_id>
2731 is required to have a parameter with the given identifier.
2733 Quasi affine expressions can be copied and freed using
2735         #include <isl/aff.h>
2736         __isl_give isl_aff *isl_aff_copy(
2737                 __isl_keep isl_aff *aff);
2738         __isl_null isl_aff *isl_aff_free(
2739                 __isl_take isl_aff *aff);
2741 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2742 using the following function.  The constraint is required to have
2743 a non-zero coefficient for the specified dimension.
2745         #include <isl/constraint.h>
2746         __isl_give isl_aff *isl_constraint_get_bound(
2747                 __isl_keep isl_constraint *constraint,
2748                 enum isl_dim_type type, int pos);
2750 The entire affine expression of the constraint can also be extracted
2751 using the following function.
2753         #include <isl/constraint.h>
2754         __isl_give isl_aff *isl_constraint_get_aff(
2755                 __isl_keep isl_constraint *constraint);
2757 Conversely, an equality constraint equating
2758 the affine expression to zero or an inequality constraint enforcing
2759 the affine expression to be non-negative, can be constructed using
2761         __isl_give isl_constraint *isl_equality_from_aff(
2762                 __isl_take isl_aff *aff);
2763         __isl_give isl_constraint *isl_inequality_from_aff(
2764                 __isl_take isl_aff *aff);
2766 The coefficients and the integer divisions of an affine expression
2767 can be inspected using the following functions.
2769         #include <isl/aff.h>
2770         __isl_give isl_val *isl_aff_get_constant_val(
2771                 __isl_keep isl_aff *aff);
2772         __isl_give isl_val *isl_aff_get_coefficient_val(
2773                 __isl_keep isl_aff *aff,
2774                 enum isl_dim_type type, int pos);
2775         int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2776                 enum isl_dim_type type, int pos);
2777         __isl_give isl_val *isl_aff_get_denominator_val(
2778                 __isl_keep isl_aff *aff);
2779         __isl_give isl_aff *isl_aff_get_div(
2780                 __isl_keep isl_aff *aff, int pos);
2782 They can be modified using the following functions.
2784         #include <isl/aff.h>
2785         __isl_give isl_aff *isl_aff_set_constant_si(
2786                 __isl_take isl_aff *aff, int v);
2787         __isl_give isl_aff *isl_aff_set_constant_val(
2788                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2789         __isl_give isl_aff *isl_aff_set_coefficient_si(
2790                 __isl_take isl_aff *aff,
2791                 enum isl_dim_type type, int pos, int v);
2792         __isl_give isl_aff *isl_aff_set_coefficient_val(
2793                 __isl_take isl_aff *aff,
2794                 enum isl_dim_type type, int pos,
2795                 __isl_take isl_val *v);
2797         __isl_give isl_aff *isl_aff_add_constant_si(
2798                 __isl_take isl_aff *aff, int v);
2799         __isl_give isl_aff *isl_aff_add_constant_val(
2800                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2801         __isl_give isl_aff *isl_aff_add_constant_num_si(
2802                 __isl_take isl_aff *aff, int v);
2803         __isl_give isl_aff *isl_aff_add_coefficient_si(
2804                 __isl_take isl_aff *aff,
2805                 enum isl_dim_type type, int pos, int v);
2806         __isl_give isl_aff *isl_aff_add_coefficient_val(
2807                 __isl_take isl_aff *aff,
2808                 enum isl_dim_type type, int pos,
2809                 __isl_take isl_val *v);
2811 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2812 set the I<numerator> of the constant or coefficient, while
2813 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2814 the constant or coefficient as a whole.
2815 The C<add_constant> and C<add_coefficient> functions add an integer
2816 or rational value to
2817 the possibly rational constant or coefficient.
2818 The C<add_constant_num> functions add an integer value to
2819 the numerator.
2821 =item * Quasipolynomials
2823 Some simple quasipolynomials can be created using the following functions.
2825         #include <isl/polynomial.h>
2826         __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2827                 __isl_take isl_space *domain);
2828         __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2829                 __isl_take isl_space *domain);
2830         __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2831                 __isl_take isl_space *domain);
2832         __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2833                 __isl_take isl_space *domain);
2834         __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2835                 __isl_take isl_space *domain);
2836         __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2837                 __isl_take isl_space *domain,
2838                 __isl_take isl_val *val);
2839         __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2840                 __isl_take isl_space *domain,
2841                 enum isl_dim_type type, unsigned pos);
2842         __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2843                 __isl_take isl_aff *aff);
2845 Recall that the space in which a quasipolynomial lives is a map space
2846 with a one-dimensional range.  The C<domain> argument in some of
2847 the functions above corresponds to the domain of this map space.
2849 Quasipolynomials can be copied and freed again using the following
2850 functions.
2852         #include <isl/polynomial.h>
2853         __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2854                 __isl_keep isl_qpolynomial *qp);
2855         __isl_null isl_qpolynomial *isl_qpolynomial_free(
2856                 __isl_take isl_qpolynomial *qp);
2858 The constant term of a quasipolynomial can be extracted using
2860         __isl_give isl_val *isl_qpolynomial_get_constant_val(
2861                 __isl_keep isl_qpolynomial *qp);
2863 To iterate over all terms in a quasipolynomial,
2866         isl_stat isl_qpolynomial_foreach_term(
2867                 __isl_keep isl_qpolynomial *qp,
2868                 isl_stat (*fn)(__isl_take isl_term *term,
2869                           void *user), void *user);
2871 The terms themselves can be inspected and freed using
2872 these functions
2874         isl_size isl_term_dim(__isl_keep isl_term *term,
2875                 enum isl_dim_type type);
2876         __isl_give isl_val *isl_term_get_coefficient_val(
2877                 __isl_keep isl_term *term);
2878         isl_size isl_term_get_exp(__isl_keep isl_term *term,
2879                 enum isl_dim_type type, unsigned pos);
2880         __isl_give isl_aff *isl_term_get_div(
2881                 __isl_keep isl_term *term, unsigned pos);
2882         __isl_null isl_term *isl_term_free(
2883                 __isl_take isl_term *term);
2885 Each term is a product of parameters, set variables and
2886 integer divisions.  The function C<isl_term_get_exp>
2887 returns the exponent of a given dimensions in the given term.
2889 =back
2891 =head3 Reductions
2893 A reduction represents a maximum or a minimum of its
2894 base expressions.
2895 The only reduction type defined by C<isl> is
2896 C<isl_qpolynomial_fold>.
2898 There are currently no functions to directly create such
2899 objects, but they do appear in the piecewise quasipolynomial
2900 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2902 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2904 Reductions can be copied and freed using
2905 the following functions.
2907         #include <isl/polynomial.h>
2908         __isl_give isl_qpolynomial_fold *
2909         isl_qpolynomial_fold_copy(
2910                 __isl_keep isl_qpolynomial_fold *fold);
2911         __isl_null isl_qpolynomial_fold *
2912         isl_qpolynomial_fold_free(
2913                 __isl_take isl_qpolynomial_fold *fold);
2915 The type of a (union piecewise) reduction
2916 can be obtained using the following functions.
2918         #include <isl/polynomial.h>
2919         enum isl_fold isl_qpolynomial_fold_get_type(
2920                 __isl_keep isl_qpolynomial_fold *fold);
2921         enum isl_fold isl_pw_qpolynomial_fold_get_type(
2922                 __isl_keep isl_pw_qpolynomial_fold *pwf);
2923         enum isl_fold isl_union_pw_qpolynomial_fold_get_type(
2924                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
2926 The type may be either C<isl_fold_min> or C<isl_fold_max>
2927 (or C<isl_fold_error> in case of error).
2929 To iterate over all quasipolynomials in a reduction, use
2931         isl_stat isl_qpolynomial_fold_foreach_qpolynomial(
2932                 __isl_keep isl_qpolynomial_fold *fold,
2933                 isl_stat (*fn)(__isl_take isl_qpolynomial *qp,
2934                           void *user), void *user);
2936 =head3 Multiple Expressions
2938 A multiple expression represents a sequence of zero or
2939 more base expressions, all defined on the same domain space.
2940 The domain space of the multiple expression is the same
2941 as that of the base expressions, but the range space
2942 can be any space.  In case the base expressions have
2943 a set space, the corresponding multiple expression
2944 also has a set space.
2945 Objects of the value or identifier type do not have an associated space.
2946 The space of a multiple value or
2947 multiple identifier is therefore always a set space.
2948 Similarly, the space of a multiple union piecewise
2949 affine expression is always a set space.
2950 If the base expressions are not total, then
2951 a corresponding zero-dimensional multiple expression may
2952 have an explicit domain that keeps track of the domain
2953 outside of any base expressions.
2955 The multiple expression types defined by C<isl>
2956 are C<isl_multi_val>, C<isl_multi_id>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
2957 C<isl_multi_union_pw_aff>.
2959 A multiple expression with the value zero for
2960 each output (or set) dimension can be created
2961 using the following functions.
2963         #include <isl/val.h>
2964         __isl_give isl_multi_val *isl_multi_val_zero(
2965                 __isl_take isl_space *space);
2967         #include <isl/aff.h>
2968         __isl_give isl_multi_aff *isl_multi_aff_zero(
2969                 __isl_take isl_space *space);
2970         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2971                 __isl_take isl_space *space);
2972         __isl_give isl_multi_union_pw_aff *
2973         isl_multi_union_pw_aff_zero(
2974                 __isl_take isl_space *space);
2976 Since there is no canonical way of representing a zero
2977 value of type C<isl_union_pw_aff>, the space passed
2978 to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
2980 An identity function can be created using the following
2981 functions.
2982 For the first group of functions, the space needs to be that of a set.
2983 For the second group,
2984 the space needs to be that of a relation
2985 with the same number of input and output dimensions.
2986 For the third group, the input function needs to live in a space
2987 with the same number of input and output dimensions and
2988 the identity function is created in that space.
2990         #include <isl/aff.h>
2991         __isl_give isl_multi_aff *
2992         isl_multi_aff_identity_on_domain_space(
2993                 __isl_take isl_space *space);
2994         __isl_give isl_multi_pw_aff *
2995         isl_multi_pw_aff_identity_on_domain_space(
2996                 __isl_take isl_space *space);
2997         __isl_give isl_multi_aff *isl_multi_aff_identity(
2998                 __isl_take isl_space *space);
2999         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
3000                 __isl_take isl_space *space);
3001         __isl_give isl_multi_aff *
3002         isl_multi_aff_identity_multi_aff(
3003                 __isl_take isl_multi_aff *ma);
3004         __isl_give isl_multi_pw_aff *
3005         isl_multi_pw_aff_identity_multi_pw_aff(
3006                 __isl_take isl_multi_pw_aff *mpa);
3008 A function that performs a projection on a universe
3009 relation or set can be created using the following functions.
3010 See also the corresponding
3011 projection operations in L</"Unary Operations">.
3013         #include <isl/aff.h>
3014         __isl_give isl_multi_aff *isl_multi_aff_domain_map(
3015                 __isl_take isl_space *space);
3016         __isl_give isl_multi_aff *isl_multi_aff_range_map(
3017                 __isl_take isl_space *space);
3018         __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
3019                 __isl_take isl_space *space,
3020                 enum isl_dim_type type,
3021                 unsigned first, unsigned n);
3023 A multiple expression can be created from a single
3024 base expression using the following functions.
3025 The space of the created multiple expression is the same
3026 as that of the base expression, except for
3027 C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
3028 lives in a parameter space and the output lives
3029 in a single-dimensional set space.
3031         #include <isl/aff.h>
3032         __isl_give isl_multi_aff *isl_multi_aff_from_aff(
3033                 __isl_take isl_aff *aff);
3034         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
3035                 __isl_take isl_pw_aff *pa);
3036         __isl_give isl_multi_union_pw_aff *
3037         isl_multi_union_pw_aff_from_union_pw_aff(
3038                 __isl_take isl_union_pw_aff *upa);
3040 A multiple expression can be created from a list
3041 of base expression in a specified space.
3042 The domain of this space needs to be the same
3043 as the domains of the base expressions in the list.
3044 If the base expressions have a set space (or no associated space),
3045 then this space also needs to be a set space.
3047         #include <isl/id.h>
3048         __isl_give isl_multi_id *isl_multi_id_from_id_list(
3049                 __isl_take isl_space *space,
3050                 __isl_take isl_id_list *list);
3052         #include <isl/val.h>
3053         __isl_give isl_multi_val *isl_multi_val_from_val_list(
3054                 __isl_take isl_space *space,
3055                 __isl_take isl_val_list *list);
3057         #include <isl/aff.h>
3058         __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
3059                 __isl_take isl_space *space,
3060                 __isl_take isl_aff_list *list);
3061         __isl_give isl_multi_pw_aff *
3062         isl_multi_pw_aff_from_pw_aff_list(
3063                 __isl_take isl_space *space,
3064                 __isl_take isl_pw_aff_list *list);
3065         __isl_give isl_multi_union_pw_aff *
3066         isl_multi_union_pw_aff_from_union_pw_aff_list(
3067                 __isl_take isl_space *space,
3068                 __isl_take isl_union_pw_aff_list *list);
3070 As a convenience, a multiple piecewise expression can
3071 also be created from a multiple expression.
3072 Each piecewise expression in the result has a single
3073 universe cell.
3075         #include <isl/aff.h>
3076         __isl_give isl_multi_pw_aff *
3077         isl_multi_pw_aff_from_multi_aff(
3078                 __isl_take isl_multi_aff *ma);
3080 Similarly, a multiple union expression can be
3081 created from a multiple expression.
3083         #include <isl/aff.h>
3084         __isl_give isl_multi_union_pw_aff *
3085         isl_multi_union_pw_aff_from_multi_aff(
3086                 __isl_take isl_multi_aff *ma);
3087         __isl_give isl_multi_union_pw_aff *
3088         isl_multi_union_pw_aff_from_multi_pw_aff(
3089                 __isl_take isl_multi_pw_aff *mpa);
3091 A multiple quasi-affine expression can be created from
3092 a multiple value with a given domain space using the following
3093 function.
3095         #include <isl/aff.h>
3096         __isl_give isl_multi_aff *
3097         isl_multi_aff_multi_val_on_space(
3098                 __isl_take isl_space *space,
3099                 __isl_take isl_multi_val *mv);
3101 Similarly,
3102 a multiple union piecewise affine expression can be created from
3103 a multiple value with a given domain or
3104 a (piecewise) multiple affine expression with a given domain
3105 using the following functions.
3107         #include <isl/aff.h>
3108         __isl_give isl_multi_union_pw_aff *
3109         isl_multi_union_pw_aff_multi_val_on_domain(
3110                 __isl_take isl_union_set *domain,
3111                 __isl_take isl_multi_val *mv);
3112         __isl_give isl_multi_union_pw_aff *
3113         isl_multi_union_pw_aff_multi_aff_on_domain(
3114                 __isl_take isl_union_set *domain,
3115                 __isl_take isl_multi_aff *ma);
3116         __isl_give isl_multi_union_pw_aff *
3117         isl_multi_union_pw_aff_pw_multi_aff_on_domain(
3118                 __isl_take isl_union_set *domain,
3119                 __isl_take isl_pw_multi_aff *pma);
3121 Multiple expressions can be copied and freed using
3122 the following functions.
3124         #include <isl/id.h>
3125         __isl_give isl_multi_id *isl_multi_id_copy(
3126                 __isl_keep isl_multi_id *mi);
3127         __isl_null isl_multi_id *isl_multi_id_free(
3128                 __isl_take isl_multi_id *mi);
3130         #include <isl/val.h>
3131         __isl_give isl_multi_val *isl_multi_val_copy(
3132                 __isl_keep isl_multi_val *mv);
3133         __isl_null isl_multi_val *isl_multi_val_free(
3134                 __isl_take isl_multi_val *mv);
3136         #include <isl/aff.h>
3137         __isl_give isl_multi_aff *isl_multi_aff_copy(
3138                 __isl_keep isl_multi_aff *maff);
3139         __isl_null isl_multi_aff *isl_multi_aff_free(
3140                 __isl_take isl_multi_aff *maff);
3141         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
3142                 __isl_keep isl_multi_pw_aff *mpa);
3143         __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
3144                 __isl_take isl_multi_pw_aff *mpa);
3145         __isl_give isl_multi_union_pw_aff *
3146         isl_multi_union_pw_aff_copy(
3147                 __isl_keep isl_multi_union_pw_aff *mupa);
3148         __isl_null isl_multi_union_pw_aff *
3149         isl_multi_union_pw_aff_free(
3150                 __isl_take isl_multi_union_pw_aff *mupa);
3152 The number of base expressions in a multiple
3153 expression can be obtained using the following functions.
3155         #include <isl/id.h>
3156         int isl_multi_id_size(__isl_keep isl_multi_id *mi);
3158         #include <isl/val.h>
3159         isl_size isl_multi_val_size(__isl_keep isl_multi_val *mv);
3161         #include <isl/aff.h>
3162         isl_size isl_multi_aff_size(
3163                 __isl_keep isl_multi_aff *multi);
3164         isl_size isl_multi_pw_aff_size(
3165                 __isl_keep isl_multi_pw_aff *mpa);
3166         isl_size isl_multi_union_pw_aff_size(
3167                 __isl_keep isl_multi_union_pw_aff *mupa);
3169 The base expression at a given position of a multiple
3170 expression can be extracted using the following functions.
3172         #include <isl/id.h>
3173         __isl_give isl_id *isl_multi_id_get_at(
3174                 __isl_keep isl_multi_id *mi, int pos);
3175         __isl_give isl_id *isl_multi_id_get_id(
3176                 __isl_keep isl_multi_id *mi, int pos);
3178         #include <isl/val.h>
3179         __isl_give isl_val *isl_multi_val_get_at(
3180                 __isl_keep isl_multi_val *mv, int pos);
3181         __isl_give isl_val *isl_multi_val_get_val(
3182                 __isl_keep isl_multi_val *mv, int pos);
3184         #include <isl/aff.h>
3185         __isl_give isl_aff *isl_multi_aff_get_at(
3186                 __isl_keep isl_multi_aff *ma, int pos);
3187         __isl_give isl_aff *isl_multi_aff_get_aff(
3188                 __isl_keep isl_multi_aff *multi, int pos);
3189         __isl_give isl_pw_aff *isl_multi_pw_aff_get_at(
3190                 __isl_keep isl_multi_pw_aff *mpa, int pos);
3191         __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
3192                 __isl_keep isl_multi_pw_aff *mpa, int pos);
3193         __isl_give isl_union_pw_aff *
3194         isl_multi_union_pw_aff_get_at(
3195                 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
3196         __isl_give isl_union_pw_aff *
3197         isl_multi_union_pw_aff_get_union_pw_aff(
3198                 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
3200 C<isl_multi_id_get_id> is an alternative name for C<isl_multi_id_get_at>.
3201 Similarly for the other pairs of functions.
3203 The base expression can be replaced using the following functions.
3205         #include <isl/id.h>
3206         __isl_give isl_multi_id *isl_multi_id_set_at(
3207                 __isl_take isl_multi_id *mi, int pos,
3208                 __isl_take isl_id *id);
3209         __isl_give isl_multi_id *isl_multi_id_set_id(
3210                 __isl_take isl_multi_id *mi, int pos,
3211                 __isl_take isl_id *id);
3213         #include <isl/val.h>
3214         __isl_give isl_multi_val *isl_multi_val_set_at(
3215                 __isl_take isl_multi_val *mv, int pos,
3216                 __isl_take isl_val *val);
3217         __isl_give isl_multi_val *isl_multi_val_set_val(
3218                 __isl_take isl_multi_val *mv, int pos,
3219                 __isl_take isl_val *val);
3221         #include <isl/aff.h>
3222         __isl_give isl_multi_aff *isl_multi_aff_set_at(
3223                 __isl_take isl_multi_aff *ma, int pos,
3224                 __isl_take isl_aff *aff);
3225         __isl_give isl_multi_aff *isl_multi_aff_set_aff(
3226                 __isl_take isl_multi_aff *multi, int pos,
3227                 __isl_take isl_aff *aff);
3228         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_set_at(
3229                 __isl_take isl_multi_pw_aff *mpa, int pos,
3230                 __isl_take isl_pw_aff *pa);
3231         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_set_pw_aff(
3232                 __isl_take isl_multi_pw_aff *mpa, int pos,
3233                 __isl_take isl_pw_aff *pa);
3234         __isl_give isl_multi_union_pw_aff *
3235         isl_multi_union_pw_aff_set_at(
3236                 __isl_take isl_multi_union_pw_aff *mupa, int pos,
3237                 __isl_take isl_union_pw_aff *upa);
3238         __isl_give isl_multi_union_pw_aff *
3239         isl_multi_union_pw_aff_set_union_pw_aff(
3240                 __isl_take isl_multi_union_pw_aff *mupa, int pos,
3241                 __isl_take isl_union_pw_aff *upa);
3243 C<isl_multi_id_set_id> is an alternative name for C<isl_multi_id_set_at>.
3244 Similarly for the other pairs of functions.
3246 A list of all base expressions of a multiple
3247 expression can be extracted using the following functions.
3249         #include <isl/id.h>
3250         __isl_give isl_id_list *isl_multi_id_get_list(
3251                 __isl_keep isl_multi_id *mi);
3253         #include <isl/val.h>
3254         __isl_give isl_val_list *isl_multi_val_get_list(
3255                 __isl_keep isl_multi_val *mv);
3257         #include <isl/aff.h>
3258         __isl_give isl_aff_list *isl_multi_aff_get_list(
3259                 __isl_keep isl_multi_aff *multi);
3260         __isl_give isl_pw_aff_list *isl_multi_pw_aff_get_list(
3261                 __isl_keep isl_multi_pw_aff *mpa);
3262         __isl_give isl_union_pw_aff_list *
3263         isl_multi_union_pw_aff_list(
3264                 __isl_keep isl_multi_union_pw_aff *mupa);
3266 The constant terms of the base expressions can be obtained using
3267 the following function.
3269         #include <isl/aff.h>
3270         __isl_give isl_multi_val *
3271         isl_multi_aff_get_constant_multi_val(
3272                 __isl_keep isl_multi_aff *ma);
3274 As a convenience, a sequence of base expressions that have
3275 their domains in a given space can be extracted from a sequence
3276 of union expressions using the following function.
3278         #include <isl/aff.h>
3279         __isl_give isl_multi_pw_aff *
3280         isl_multi_union_pw_aff_extract_multi_pw_aff(
3281                 __isl_keep isl_multi_union_pw_aff *mupa,
3282                 __isl_take isl_space *space);
3284 Note that there is a difference between C<isl_multi_union_pw_aff>
3285 and C<isl_union_pw_multi_aff> objects.  The first is a sequence
3286 of unions of piecewise expressions, while the second is a union
3287 of piecewise sequences.  In particular, multiple affine expressions
3288 in an C<isl_union_pw_multi_aff> may live in different spaces,
3289 while there is only a single multiple expression in
3290 an C<isl_multi_union_pw_aff>, which can therefore only live
3291 in a single space.  This means that not every
3292 C<isl_union_pw_multi_aff> can be converted to
3293 an C<isl_multi_union_pw_aff>.  Conversely, the elements
3294 of an C<isl_multi_union_pw_aff> may be defined over different domains,
3295 while each multiple expression inside an C<isl_union_pw_multi_aff>
3296 has a single domain.  The conversion of an C<isl_union_pw_multi_aff>
3297 of dimension greater than one may therefore not be exact.
3298 The following functions can
3299 be used to perform these conversions when they are possible.
3301         #include <isl/aff.h>
3302         __isl_give isl_multi_union_pw_aff *
3303         isl_multi_union_pw_aff_from_union_pw_multi_aff(
3304                 __isl_take isl_union_pw_multi_aff *upma);
3305         __isl_give isl_union_pw_multi_aff *
3306         isl_union_pw_multi_aff_from_multi_union_pw_aff(
3307                 __isl_take isl_multi_union_pw_aff *mupa);
3309 =head3 Piecewise Expressions
3311 A piecewise expression is an expression that is described
3312 using zero or more base expression defined over the same
3313 number of cells in the domain space of the base expressions.
3314 All base expressions are defined over the same
3315 domain space and the cells are disjoint.
3316 The space of a piecewise expression is the same as
3317 that of the base expressions.
3318 If the union of the cells is a strict subset of the domain
3319 space, then the value of the piecewise expression outside
3320 this union is different for types derived from quasi-affine
3321 expressions and those derived from quasipolynomials.
3322 Piecewise expressions derived from quasi-affine expressions
3323 are considered to be undefined outside the union of their cells.
3324 Piecewise expressions derived from quasipolynomials
3325 are considered to be zero outside the union of their cells.
3327 Piecewise quasipolynomials are mainly used by the C<barvinok>
3328 library for representing the number of elements in a parametric set or map.
3329 For example, the piecewise quasipolynomial
3331         [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
3333 represents the number of points in the map
3335         [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
3337 The piecewise expression types defined by C<isl>
3338 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
3339 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
3341 A piecewise expression with no cells can be created using
3342 the following functions.
3344         #include <isl/aff.h>
3345         __isl_give isl_pw_aff *isl_pw_aff_empty(
3346                 __isl_take isl_space *space);
3347         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
3348                 __isl_take isl_space *space);
3350 A piecewise expression with a single universe cell can be
3351 created using the following functions.
3353         #include <isl/aff.h>
3354         __isl_give isl_pw_aff *isl_pw_aff_from_aff(
3355                 __isl_take isl_aff *aff);
3356         __isl_give isl_pw_multi_aff *
3357         isl_pw_multi_aff_from_multi_aff(
3358                 __isl_take isl_multi_aff *ma);
3360         #include <isl/polynomial.h>
3361         __isl_give isl_pw_qpolynomial *
3362         isl_pw_qpolynomial_from_qpolynomial(
3363                 __isl_take isl_qpolynomial *qp);
3364         __isl_give isl_pw_qpolynomial_fold *
3365         isl_pw_qpolynomial_fold_from_qpolynomial_fold(
3366                 __isl_take isl_qpolynomial_fold *fold);
3368 The inverse conversions below can only be used if the input
3369 expression is known to be defined over a single universe domain.
3371         #include <isl/aff.h>
3372         isl_bool isl_pw_aff_isa_aff(__isl_keep isl_pw_aff *pa);
3373         __isl_give isl_aff *isl_pw_aff_as_aff(
3374                 __isl_take isl_pw_aff *pa);
3375         isl_bool isl_pw_multi_aff_isa_multi_aff(
3376                 __isl_keep isl_pw_multi_aff *pma);
3377         __isl_give isl_multi_aff *isl_pw_multi_aff_as_multi_aff(
3378                 __isl_take isl_pw_multi_aff *pma);
3380         #include <isl/polynomial.h>
3381         isl_bool isl_pw_qpolynomial_isa_qpolynomial(
3382                 __isl_keep isl_pw_qpolynomial *pwqp);
3383         __isl_give isl_qpolynomial *
3384         isl_pw_qpolynomial_as_qpolynomial(
3385                 __isl_take isl_pw_qpolynomial *pwqp);
3386         isl_bool isl_pw_qpolynomial_fold_isa_qpolynomial_fold(
3387                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3388         __isl_give isl_qpolynomial_fold *
3389         isl_pw_qpolynomial_fold_as_qpolynomial_fold(
3390                 __isl_take isl_pw_qpolynomial_fold *pwf);
3392 A piecewise expression with a single specified cell can be
3393 created using the following functions.
3395         #include <isl/aff.h>
3396         __isl_give isl_pw_aff *isl_pw_aff_alloc(
3397                 __isl_take isl_set *set, __isl_take isl_aff *aff);
3398         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
3399                 __isl_take isl_set *set,
3400                 __isl_take isl_multi_aff *maff);
3402         #include <isl/polynomial.h>
3403         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
3404                 __isl_take isl_set *set,
3405                 __isl_take isl_qpolynomial *qp);
3407 The following convenience functions first create a base expression and
3408 then create a piecewise expression over a universe domain.
3410         #include <isl/aff.h>
3411         __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
3412                 __isl_take isl_local_space *ls);
3413         __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
3414                 __isl_take isl_local_space *ls,
3415                 enum isl_dim_type type, unsigned pos);
3416         __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
3417                 __isl_take isl_local_space *ls);
3418         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
3419                 __isl_take isl_space *space);
3420         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
3421                 __isl_take isl_space *space);
3422         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
3423                 __isl_take isl_space *space);
3424         __isl_give isl_pw_multi_aff *
3425         isl_pw_multi_aff_project_out_map(
3426                 __isl_take isl_space *space,
3427                 enum isl_dim_type type,
3428                 unsigned first, unsigned n);
3430         #include <isl/polynomial.h>
3431         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
3432                 __isl_take isl_space *space);
3434 The following convenience functions first create a base expression and
3435 then create a piecewise expression over a given domain.
3437         #include <isl/aff.h>
3438         __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
3439                 __isl_take isl_set *domain,
3440                 __isl_take isl_val *v);
3441         __isl_give isl_pw_multi_aff *
3442         isl_pw_multi_aff_multi_val_on_domain(
3443                 __isl_take isl_set *domain,
3444                 __isl_take isl_multi_val *mv);
3445         __isl_give isl_pw_aff *isl_pw_aff_param_on_domain_id(
3446                 __isl_take isl_set *domain,
3447                 __isl_take isl_id *id);
3449 As a convenience, a piecewise multiple expression can
3450 also be created from a piecewise expression.
3451 Each multiple expression in the result is derived
3452 from the corresponding base expression.
3454         #include <isl/aff.h>
3455         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
3456                 __isl_take isl_pw_aff *pa);
3458 Similarly, a piecewise quasipolynomial can be
3459 created from a piecewise quasi-affine expression using
3460 the following function.
3462         #include <isl/polynomial.h>
3463         __isl_give isl_pw_qpolynomial *
3464         isl_pw_qpolynomial_from_pw_aff(
3465                 __isl_take isl_pw_aff *pwaff);
3467 Piecewise expressions can be copied and freed using the following functions.
3469         #include <isl/aff.h>
3470         __isl_give isl_pw_aff *isl_pw_aff_copy(
3471                 __isl_keep isl_pw_aff *pwaff);
3472         __isl_null isl_pw_aff *isl_pw_aff_free(
3473                 __isl_take isl_pw_aff *pwaff);
3474         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
3475                 __isl_keep isl_pw_multi_aff *pma);
3476         __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
3477                 __isl_take isl_pw_multi_aff *pma);
3479         #include <isl/polynomial.h>
3480         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
3481                 __isl_keep isl_pw_qpolynomial *pwqp);
3482         __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
3483                 __isl_take isl_pw_qpolynomial *pwqp);
3484         __isl_give isl_pw_qpolynomial_fold *
3485         isl_pw_qpolynomial_fold_copy(
3486                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3487         __isl_null isl_pw_qpolynomial_fold *
3488         isl_pw_qpolynomial_fold_free(
3489                 __isl_take isl_pw_qpolynomial_fold *pwf);
3491 To iterate over the different cells of a piecewise expression,
3492 use the following functions.
3494         #include <isl/aff.h>
3495         isl_bool isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
3496         isl_size isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
3497         isl_stat isl_pw_aff_foreach_piece(
3498                 __isl_keep isl_pw_aff *pwaff,
3499                 isl_stat (*fn)(__isl_take isl_set *set,
3500                           __isl_take isl_aff *aff,
3501                           void *user), void *user);
3502         isl_bool isl_pw_aff_every_piece(__isl_keep isl_pw_aff *pa,
3503                 isl_bool (*test)(__isl_keep isl_set *set,
3504                         __isl_keep isl_aff *aff, void *user),
3505                         void *user);
3506         isl_size isl_pw_multi_aff_n_piece(
3507                 __isl_keep isl_pw_multi_aff *pma);
3508         isl_stat isl_pw_multi_aff_foreach_piece(
3509                 __isl_keep isl_pw_multi_aff *pma,
3510                 isl_stat (*fn)(__isl_take isl_set *set,
3511                             __isl_take isl_multi_aff *maff,
3512                             void *user), void *user);
3513         isl_bool isl_pw_multi_aff_every_piece(
3514                 __isl_keep isl_pw_multi_aff *pma,
3515                 isl_bool (*test)(__isl_keep isl_set *set,
3516                         __isl_keep isl_multi_aff *ma, void *user),
3517                         void *user);
3519         #include <isl/polynomial.h>
3520         isl_size isl_pw_qpolynomial_n_piece(
3521                 __isl_keep isl_pw_qpolynomial *pwqp);
3522         isl_stat isl_pw_qpolynomial_foreach_piece(
3523                 __isl_keep isl_pw_qpolynomial *pwqp,
3524                 isl_stat (*fn)(__isl_take isl_set *set,
3525                           __isl_take isl_qpolynomial *qp,
3526                           void *user), void *user);
3527         isl_bool isl_pw_qpolynomial_every_piece(
3528                 __isl_keep isl_pw_qpolynomial *pwqp,
3529                 isl_bool (*test)(__isl_keep isl_set *set,
3530                         __isl_keep isl_qpolynomial *qp,
3531                         void *user), void *user);
3532         isl_stat isl_pw_qpolynomial_foreach_lifted_piece(
3533                 __isl_keep isl_pw_qpolynomial *pwqp,
3534                 isl_stat (*fn)(__isl_take isl_set *set,
3535                           __isl_take isl_qpolynomial *qp,
3536                           void *user), void *user);
3537         isl_size isl_pw_qpolynomial_fold_n_piece(
3538                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3539         isl_stat isl_pw_qpolynomial_fold_foreach_piece(
3540                 __isl_keep isl_pw_qpolynomial_fold *pwf,
3541                 isl_stat (*fn)(__isl_take isl_set *set,
3542                           __isl_take isl_qpolynomial_fold *fold,
3543                           void *user), void *user);
3544         isl_bool isl_pw_qpolynomial_fold_every_piece(
3545                 __isl_keep isl_pw_qpolynomial_fold *pwf,
3546                 isl_bool (*test)(__isl_keep isl_set *set,
3547                         __isl_keep isl_qpolynomial_fold *fold,
3548                         void *user), void *user);
3549         isl_stat isl_pw_qpolynomial_fold_foreach_lifted_piece(
3550                 __isl_keep isl_pw_qpolynomial_fold *pwf,
3551                 isl_stat (*fn)(__isl_take isl_set *set,
3552                           __isl_take isl_qpolynomial_fold *fold,
3553                           void *user), void *user);
3555 As usual, the function C<fn> should return C<isl_stat_ok> on success
3556 and C<isl_stat_error> on failure.  The difference between
3557 C<isl_pw_qpolynomial_foreach_piece> and
3558 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
3559 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
3560 compute unique representations for all existentially quantified
3561 variables and then turn these existentially quantified variables
3562 into extra set variables, adapting the associated quasipolynomial
3563 accordingly.  This means that the C<set> passed to C<fn>
3564 will not have any existentially quantified variables, but that
3565 the dimensions of the sets may be different for different
3566 invocations of C<fn>.
3567 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
3568 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
3569 The function C<isl_pw_aff_every_piece> and its variants
3570 check whether each call to the callback returns true and
3571 stop checking as soon as one of these calls returns false (or error).
3573 A piecewise expression consisting of the expressions at a given
3574 position of a piecewise multiple expression can be extracted
3575 using the following function.
3577         #include <isl/aff.h>
3578         __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3579                 __isl_keep isl_pw_multi_aff *pma, int pos);
3581 These expressions can be replaced using the following function.
3583         #include <isl/aff.h>
3584         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3585                 __isl_take isl_pw_multi_aff *pma, unsigned pos,
3586                 __isl_take isl_pw_aff *pa);
3588 Note that there is a difference between C<isl_multi_pw_aff> and
3589 C<isl_pw_multi_aff> objects.  The first is a sequence of piecewise
3590 affine expressions, while the second is a piecewise sequence
3591 of affine expressions.  In particular, each of the piecewise
3592 affine expressions in an C<isl_multi_pw_aff> may have a different
3593 domain, while all multiple expressions associated to a cell
3594 in an C<isl_pw_multi_aff> have the same domain.
3595 It is possible to convert between the two, but when converting
3596 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3597 of the result is the intersection of the domains of the input.
3598 The reverse conversion is exact.
3600         #include <isl/aff.h>
3601         __isl_give isl_pw_multi_aff *
3602         isl_pw_multi_aff_from_multi_pw_aff(
3603                 __isl_take isl_multi_pw_aff *mpa);
3604         __isl_give isl_multi_pw_aff *
3605         isl_multi_pw_aff_from_pw_multi_aff(
3606                 __isl_take isl_pw_multi_aff *pma);
3608 =head3 Union Expressions
3610 A union expression collects base expressions defined
3611 over different domains.  The space of a union expression
3612 is that of the shared parameter space.
3614 The union expression types defined by C<isl>
3615 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3616 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3617 In case of
3618 C<isl_union_pw_aff>,
3619 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>,
3620 there can be at most one base expression for a given domain space.
3621 In case of
3622 C<isl_union_pw_multi_aff>,
3623 there can be multiple such expressions for a given domain space,
3624 but the domains of these expressions need to be disjoint.
3626 An empty union expression can be created using the following functions.
3628         #include <isl/aff.h>
3629         __isl_give isl_union_pw_aff *
3630         isl_union_pw_aff_empty_ctx(
3631                 isl_ctx *ctx);
3632         __isl_give isl_union_pw_aff *
3633         isl_union_pw_aff_empty_space(
3634                 __isl_take isl_space *space);
3635         __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
3636                 __isl_take isl_space *space);
3637         __isl_give isl_union_pw_multi_aff *
3638         isl_union_pw_multi_aff_empty_ctx(
3639                 isl_ctx *ctx);
3640         __isl_give isl_union_pw_multi_aff *
3641         isl_union_pw_multi_aff_empty_space(
3642                 __isl_take isl_space *space);
3643         __isl_give isl_union_pw_multi_aff *
3644         isl_union_pw_multi_aff_empty(
3645                 __isl_take isl_space *space);
3647         #include <isl/polynomial.h>
3648         __isl_give isl_union_pw_qpolynomial *
3649         isl_union_pw_qpolynomial_zero_ctx(
3650                 isl_ctx *ctx);
3651         __isl_give isl_union_pw_qpolynomial *
3652         isl_union_pw_qpolynomial_zero_space(
3653                 __isl_take isl_space *space);
3654         __isl_give isl_union_pw_qpolynomial *
3655         isl_union_pw_qpolynomial_zero(
3656                 __isl_take isl_space *space);
3658 C<isl_union_pw_aff_empty> is an alternative name for
3659 C<isl_union_pw_aff_empty_space>.
3660 Similarly for the other pairs of functions.
3662 A union expression containing a single base expression
3663 can be created using the following functions.
3665         #include <isl/aff.h>
3666         __isl_give isl_union_pw_aff *
3667         isl_union_pw_aff_from_pw_aff(
3668                 __isl_take isl_pw_aff *pa);
3669         __isl_give isl_union_pw_multi_aff *
3670         isl_union_pw_multi_aff_from_aff(
3671                 __isl_take isl_aff *aff);
3672         __isl_give isl_union_pw_multi_aff *
3673         isl_union_pw_multi_aff_from_pw_multi_aff(
3674                 __isl_take isl_pw_multi_aff *pma);
3676         #include <isl/polynomial.h>
3677         __isl_give isl_union_pw_qpolynomial *
3678         isl_union_pw_qpolynomial_from_pw_qpolynomial(
3679                 __isl_take isl_pw_qpolynomial *pwqp);
3681 The inverse conversions below can only be used if the input
3682 expression is known to live in exactly one space.
3684         #include <isl/aff.h>
3685         isl_bool isl_union_pw_multi_aff_isa_pw_multi_aff(
3686                 __isl_keep isl_union_pw_multi_aff *upma);
3687         __isl_give isl_pw_multi_aff *
3688         isl_union_pw_multi_aff_as_pw_multi_aff(
3689                 __isl_take isl_union_pw_multi_aff *upma);
3691 The following functions create a base expression on each
3692 of the sets in the union set and collect the results.
3694         #include <isl/aff.h>
3695         __isl_give isl_union_pw_multi_aff *
3696         isl_union_pw_multi_aff_from_union_pw_aff(
3697                 __isl_take isl_union_pw_aff *upa);
3698         __isl_give isl_union_pw_aff *
3699         isl_union_pw_multi_aff_get_union_pw_aff(
3700                 __isl_keep isl_union_pw_multi_aff *upma, int pos);
3701         __isl_give isl_union_pw_aff *
3702         isl_union_pw_aff_val_on_domain(
3703                 __isl_take isl_union_set *domain,
3704                 __isl_take isl_val *v);
3705         __isl_give isl_union_pw_multi_aff *
3706         isl_union_pw_multi_aff_multi_val_on_domain(
3707                 __isl_take isl_union_set *domain,
3708                 __isl_take isl_multi_val *mv);
3709         __isl_give isl_union_pw_aff *
3710         isl_union_pw_aff_param_on_domain_id(
3711                 __isl_take isl_union_set *domain,
3712                 __isl_take isl_id *id);
3714 The C<id> argument of C<isl_union_pw_aff_param_on_domain_id>
3715 is the identifier of a parameter that may or may not already
3716 be present in C<domain>.
3718 An C<isl_union_pw_aff> that is equal to a (parametric) affine
3719 or piecewise affine
3720 expression on a given domain can be created using the following
3721 functions.
3723         #include <isl/aff.h>
3724         __isl_give isl_union_pw_aff *
3725         isl_union_pw_aff_aff_on_domain(
3726                 __isl_take isl_union_set *domain,
3727                 __isl_take isl_aff *aff);
3728         __isl_give isl_union_pw_aff *
3729         isl_union_pw_aff_pw_aff_on_domain(
3730                 __isl_take isl_union_set *domain,
3731                 __isl_take isl_pw_aff *pa);
3733 A base expression can be added to a union expression using
3734 the following functions.
3736         #include <isl/aff.h>
3737         __isl_give isl_union_pw_aff *
3738         isl_union_pw_aff_add_pw_aff(
3739                 __isl_take isl_union_pw_aff *upa,
3740                 __isl_take isl_pw_aff *pa);
3741         __isl_give isl_union_pw_multi_aff *
3742         isl_union_pw_multi_aff_add_pw_multi_aff(
3743                 __isl_take isl_union_pw_multi_aff *upma,
3744                 __isl_take isl_pw_multi_aff *pma);
3746         #include <isl/polynomial.h>
3747         __isl_give isl_union_pw_qpolynomial *
3748         isl_union_pw_qpolynomial_add_pw_qpolynomial(
3749                 __isl_take isl_union_pw_qpolynomial *upwqp,
3750                 __isl_take isl_pw_qpolynomial *pwqp);
3752 Union expressions can be copied and freed using
3753 the following functions.
3755         #include <isl/aff.h>
3756         __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
3757                 __isl_keep isl_union_pw_aff *upa);
3758         __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
3759                 __isl_take isl_union_pw_aff *upa);
3760         __isl_give isl_union_pw_multi_aff *
3761         isl_union_pw_multi_aff_copy(
3762                 __isl_keep isl_union_pw_multi_aff *upma);
3763         __isl_null isl_union_pw_multi_aff *
3764         isl_union_pw_multi_aff_free(
3765                 __isl_take isl_union_pw_multi_aff *upma);
3767         #include <isl/polynomial.h>
3768         __isl_give isl_union_pw_qpolynomial *
3769         isl_union_pw_qpolynomial_copy(
3770                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3771         __isl_null isl_union_pw_qpolynomial *
3772         isl_union_pw_qpolynomial_free(
3773                 __isl_take isl_union_pw_qpolynomial *upwqp);
3774         __isl_give isl_union_pw_qpolynomial_fold *
3775         isl_union_pw_qpolynomial_fold_copy(
3776                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3777         __isl_null isl_union_pw_qpolynomial_fold *
3778         isl_union_pw_qpolynomial_fold_free(
3779                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3781 To iterate over the base expressions in a union expression,
3782 use the following functions.
3784         #include <isl/aff.h>
3785         isl_size isl_union_pw_aff_n_pw_aff(
3786                 __isl_keep isl_union_pw_aff *upa);
3787         isl_stat isl_union_pw_aff_foreach_pw_aff(
3788                 __isl_keep isl_union_pw_aff *upa,
3789                 isl_stat (*fn)(__isl_take isl_pw_aff *pa,
3790                         void *user), void *user);
3791         isl_bool isl_union_pw_aff_every_pw_aff(
3792                 __isl_keep isl_union_pw_aff *upa,
3793                 isl_bool (*test)(__isl_keep isl_pw_aff *pa,
3794                         void *user), void *user);
3795         isl_size isl_union_pw_multi_aff_n_pw_multi_aff(
3796                 __isl_keep isl_union_pw_multi_aff *upma);
3797         isl_stat isl_union_pw_multi_aff_foreach_pw_multi_aff(
3798                 __isl_keep isl_union_pw_multi_aff *upma,
3799                 isl_stat (*fn)(__isl_take isl_pw_multi_aff *pma,
3800                             void *user), void *user);
3801         isl_bool isl_union_pw_multi_aff_every_pw_multi_aff(
3802                 __isl_keep isl_union_pw_multi_aff *upma,
3803                 isl_bool (*test)(
3804                         __isl_keep isl_pw_multi_aff *pma,
3805                         void *user), void *user);
3807         #include <isl/polynomial.h>
3808         isl_size isl_union_pw_qpolynomial_n_pw_qpolynomial(
3809                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3810         isl_stat isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3811                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3812                 isl_stat (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3813                             void *user), void *user);
3814         isl_bool isl_union_pw_qpolynomial_every_pw_qpolynomial(
3815                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3816                 isl_bool (*test)(
3817                         __isl_keep isl_pw_qpolynomial *pwqp,
3818                         void *user), void *user);
3819         isl_size isl_union_pw_qpolynomial_fold_n_pw_qpolynomial_fold(
3820                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3821         isl_stat isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3822                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3823                 isl_stat (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3824                             void *user), void *user);
3825         isl_bool
3826         isl_union_pw_qpolynomial_fold_every_pw_qpolynomial_fold(
3827                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3828                 isl_bool (*test)(
3829                         __isl_keep isl_pw_qpolynomial_fold *pwf,
3830                         void *user), void *user);
3832 To extract the base expression in a given space from a union, use
3833 the following functions.
3835         #include <isl/aff.h>
3836         __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3837                 __isl_keep isl_union_pw_aff *upa,
3838                 __isl_take isl_space *space);
3839         __isl_give isl_pw_multi_aff *
3840         isl_union_pw_multi_aff_extract_pw_multi_aff(
3841                 __isl_keep isl_union_pw_multi_aff *upma,
3842                 __isl_take isl_space *space);
3844         #include <isl/polynomial.h>
3845         __isl_give isl_pw_qpolynomial *
3846         isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3847                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3848                 __isl_take isl_space *space);
3850 It is also possible to obtain a list of the base expressions using
3851 the following functions.
3853         #include <isl/aff.h>
3854         __isl_give isl_pw_aff_list *
3855         isl_union_pw_aff_get_pw_aff_list(
3856                 __isl_keep isl_union_pw_aff *upa);
3857         __isl_give isl_pw_multi_aff_list *
3858         isl_union_pw_multi_aff_get_pw_multi_aff_list(
3859                 __isl_keep isl_union_pw_multi_aff *upma);
3861         #include <isl/polynomial.h>
3862         __isl_give isl_pw_qpolynomial_list *
3863         isl_union_pw_qpolynomial_get_pw_qpolynomial_list(
3864                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3865         __isl_give isl_pw_qpolynomial_fold_list *
3866         isl_union_pw_qpolynomial_fold_get_pw_qpolynomial_fold_list(
3867                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3869 The returned list can be manipulated using the functions in L<"Lists">.
3871 =head2 Input and Output
3873 For set and relation,
3874 C<isl> supports its own input/output format, which is similar
3875 to the C<Omega> format, but also supports the C<PolyLib> format
3876 in some cases.
3877 For other object types, typically only an C<isl> format is supported.
3879 =head3 C<isl> format
3881 The C<isl> format is similar to that of C<Omega>, but has a different
3882 syntax for describing the parameters and allows for the definition
3883 of an existentially quantified variable as the integer division
3884 of an affine expression.
3885 For example, the set of integers C<i> between C<0> and C<n>
3886 such that C<i % 10 <= 6> can be described as
3888         [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3889                                 i - 10 a <= 6) }
3891 A set or relation can have several disjuncts, separated
3892 by the keyword C<or>.  Each disjunct is either a conjunction
3893 of constraints or a projection (C<exists>) of a conjunction
3894 of constraints.  The constraints are separated by the keyword
3895 C<and>.
3897 =head3 C<PolyLib> format
3899 If the represented set is a union, then the first line
3900 contains a single number representing the number of disjuncts.
3901 Otherwise, a line containing the number C<1> is optional.
3903 Each disjunct is represented by a matrix of constraints.
3904 The first line contains two numbers representing
3905 the number of rows and columns,
3906 where the number of rows is equal to the number of constraints
3907 and the number of columns is equal to two plus the number of variables.
3908 The following lines contain the actual rows of the constraint matrix.
3909 In each row, the first column indicates whether the constraint
3910 is an equality (C<0>) or inequality (C<1>).  The final column
3911 corresponds to the constant term.
3913 If the set is parametric, then the coefficients of the parameters
3914 appear in the last columns before the constant column.
3915 The coefficients of any existentially quantified variables appear
3916 between those of the set variables and those of the parameters.
3918 =head3 Extended C<PolyLib> format
3920 The extended C<PolyLib> format is nearly identical to the
3921 C<PolyLib> format.  The only difference is that the line
3922 containing the number of rows and columns of a constraint matrix
3923 also contains four additional numbers:
3924 the number of output dimensions, the number of input dimensions,
3925 the number of local dimensions (i.e., the number of existentially
3926 quantified variables) and the number of parameters.
3927 For sets, the number of ``output'' dimensions is equal
3928 to the number of set dimensions, while the number of ``input''
3929 dimensions is zero.
3931 =head3 Input
3933 Objects can be read from input using the following functions.
3935         #include <isl/id.h>
3936         __isl_give isl_id *isl_id_read_from_str(isl_ctx *ctx,
3937                 const char *str);
3938         __isl_give isl_multi_id *isl_multi_id_read_from_str(
3939                 isl_ctx *ctx, const char *str);
3941         #include <isl/val.h>
3942         __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3943                 const char *str);
3944         __isl_give isl_multi_val *isl_multi_val_read_from_str(
3945                 isl_ctx *ctx, const char *str);
3947         #include <isl/set.h>
3948         __isl_give isl_basic_set *isl_basic_set_read_from_file(
3949                 isl_ctx *ctx, FILE *input);
3950         __isl_give isl_basic_set *isl_basic_set_read_from_str(
3951                 isl_ctx *ctx, const char *str);
3952         __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3953                 FILE *input);
3954         __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3955                 const char *str);
3957         #include <isl/map.h>
3958         __isl_give isl_basic_map *isl_basic_map_read_from_file(
3959                 isl_ctx *ctx, FILE *input);
3960         __isl_give isl_basic_map *isl_basic_map_read_from_str(
3961                 isl_ctx *ctx, const char *str);
3962         __isl_give isl_map *isl_map_read_from_file(
3963                 isl_ctx *ctx, FILE *input);
3964         __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3965                 const char *str);
3967         #include <isl/union_set.h>
3968         __isl_give isl_union_set *isl_union_set_read_from_file(
3969                 isl_ctx *ctx, FILE *input);
3970         __isl_give isl_union_set *isl_union_set_read_from_str(
3971                 isl_ctx *ctx, const char *str);
3973         #include <isl/union_map.h>
3974         __isl_give isl_union_map *isl_union_map_read_from_file(
3975                 isl_ctx *ctx, FILE *input);
3976         __isl_give isl_union_map *isl_union_map_read_from_str(
3977                 isl_ctx *ctx, const char *str);
3979         #include <isl/aff.h>
3980         __isl_give isl_aff *isl_aff_read_from_str(
3981                 isl_ctx *ctx, const char *str);
3982         __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3983                 isl_ctx *ctx, const char *str);
3984         __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3985                 isl_ctx *ctx, const char *str);
3986         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3987                 isl_ctx *ctx, const char *str);
3988         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3989                 isl_ctx *ctx, const char *str);
3990         __isl_give isl_union_pw_aff *
3991         isl_union_pw_aff_read_from_str(
3992                 isl_ctx *ctx, const char *str);
3993         __isl_give isl_union_pw_multi_aff *
3994         isl_union_pw_multi_aff_read_from_str(
3995                 isl_ctx *ctx, const char *str);
3996         __isl_give isl_multi_union_pw_aff *
3997         isl_multi_union_pw_aff_read_from_str(
3998                 isl_ctx *ctx, const char *str);
4000         #include <isl/polynomial.h>
4001         __isl_give isl_union_pw_qpolynomial *
4002         isl_union_pw_qpolynomial_read_from_str(
4003                 isl_ctx *ctx, const char *str);
4005 For sets and relations,
4006 the input format is autodetected and may be either the C<PolyLib> format
4007 or the C<isl> format.
4009 =head3 Output
4011 Before anything can be printed, an C<isl_printer> needs to
4012 be created.
4014         __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
4015                 FILE *file);
4016         __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
4017         __isl_null isl_printer *isl_printer_free(
4018                 __isl_take isl_printer *printer);
4020 C<isl_printer_to_file> prints to the given file, while
4021 C<isl_printer_to_str> prints to a string that can be extracted
4022 using the following function.
4024         #include <isl/printer.h>
4025         __isl_give char *isl_printer_get_str(
4026                 __isl_keep isl_printer *printer);
4028 The printer can be inspected using the following functions.
4030         FILE *isl_printer_get_file(
4031                 __isl_keep isl_printer *printer);
4032         int isl_printer_get_output_format(
4033                 __isl_keep isl_printer *p);
4034         int isl_printer_get_yaml_style(__isl_keep isl_printer *p);
4036 The behavior of the printer can be modified in various ways
4038         __isl_give isl_printer *isl_printer_set_output_format(
4039                 __isl_take isl_printer *p, int output_format);
4040         __isl_give isl_printer *isl_printer_set_indent(
4041                 __isl_take isl_printer *p, int indent);
4042         __isl_give isl_printer *isl_printer_set_indent_prefix(
4043                 __isl_take isl_printer *p, const char *prefix);
4044         __isl_give isl_printer *isl_printer_indent(
4045                 __isl_take isl_printer *p, int indent);
4046         __isl_give isl_printer *isl_printer_set_prefix(
4047                 __isl_take isl_printer *p, const char *prefix);
4048         __isl_give isl_printer *isl_printer_set_suffix(
4049                 __isl_take isl_printer *p, const char *suffix);
4050         __isl_give isl_printer *isl_printer_set_yaml_style(
4051                 __isl_take isl_printer *p, int yaml_style);
4053 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
4054 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
4055 and defaults to C<ISL_FORMAT_ISL>.
4056 Each line in the output is prefixed by C<indent_prefix>,
4057 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
4058 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
4059 In the C<PolyLib> format output,
4060 the coefficients of the existentially quantified variables
4061 appear between those of the set variables and those
4062 of the parameters.
4063 The function C<isl_printer_indent> increases the indentation
4064 by the specified amount (which may be negative).
4065 The YAML style may be either C<ISL_YAML_STYLE_BLOCK> or
4066 C<ISL_YAML_STYLE_FLOW> and when we are printing something
4067 in YAML format.
4069 To actually print something, use
4071         #include <isl/printer.h>
4072         __isl_give isl_printer *isl_printer_print_double(
4073                 __isl_take isl_printer *p, double d);
4075         #include <isl/val.h>
4076         __isl_give isl_printer *isl_printer_print_val(
4077                 __isl_take isl_printer *p, __isl_keep isl_val *v);
4079         #include <isl/set.h>
4080         __isl_give isl_printer *isl_printer_print_basic_set(
4081                 __isl_take isl_printer *printer,
4082                 __isl_keep isl_basic_set *bset);
4083         __isl_give isl_printer *isl_printer_print_set(
4084                 __isl_take isl_printer *printer,
4085                 __isl_keep isl_set *set);
4087         #include <isl/map.h>
4088         __isl_give isl_printer *isl_printer_print_basic_map(
4089                 __isl_take isl_printer *printer,
4090                 __isl_keep isl_basic_map *bmap);
4091         __isl_give isl_printer *isl_printer_print_map(
4092                 __isl_take isl_printer *printer,
4093                 __isl_keep isl_map *map);
4095         #include <isl/union_set.h>
4096         __isl_give isl_printer *isl_printer_print_union_set(
4097                 __isl_take isl_printer *p,
4098                 __isl_keep isl_union_set *uset);
4100         #include <isl/union_map.h>
4101         __isl_give isl_printer *isl_printer_print_union_map(
4102                 __isl_take isl_printer *p,
4103                 __isl_keep isl_union_map *umap);
4105         #include <isl/val.h>
4106         __isl_give isl_printer *isl_printer_print_multi_val(
4107                 __isl_take isl_printer *p,
4108                 __isl_keep isl_multi_val *mv);
4110         #include <isl/id.h>
4111         __isl_give isl_printer *isl_printer_print_multi_id(
4112                 __isl_take isl_printer *p,
4113                 __isl_keep isl_multi_id *mi);
4115         #include <isl/aff.h>
4116         __isl_give isl_printer *isl_printer_print_aff(
4117                 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
4118         __isl_give isl_printer *isl_printer_print_multi_aff(
4119                 __isl_take isl_printer *p,
4120                 __isl_keep isl_multi_aff *maff);
4121         __isl_give isl_printer *isl_printer_print_pw_aff(
4122                 __isl_take isl_printer *p,
4123                 __isl_keep isl_pw_aff *pwaff);
4124         __isl_give isl_printer *isl_printer_print_pw_multi_aff(
4125                 __isl_take isl_printer *p,
4126                 __isl_keep isl_pw_multi_aff *pma);
4127         __isl_give isl_printer *isl_printer_print_multi_pw_aff(
4128                 __isl_take isl_printer *p,
4129                 __isl_keep isl_multi_pw_aff *mpa);
4130         __isl_give isl_printer *isl_printer_print_union_pw_aff(
4131                 __isl_take isl_printer *p,
4132                 __isl_keep isl_union_pw_aff *upa);
4133         __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
4134                 __isl_take isl_printer *p,
4135                 __isl_keep isl_union_pw_multi_aff *upma);
4136         __isl_give isl_printer *
4137         isl_printer_print_multi_union_pw_aff(
4138                 __isl_take isl_printer *p,
4139                 __isl_keep isl_multi_union_pw_aff *mupa);
4141         #include <isl/polynomial.h>
4142         __isl_give isl_printer *isl_printer_print_qpolynomial(
4143                 __isl_take isl_printer *p,
4144                 __isl_keep isl_qpolynomial *qp);
4145         __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
4146                 __isl_take isl_printer *p,
4147                 __isl_keep isl_pw_qpolynomial *pwqp);
4148         __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
4149                 __isl_take isl_printer *p,
4150                 __isl_keep isl_union_pw_qpolynomial *upwqp);
4152         __isl_give isl_printer *
4153         isl_printer_print_pw_qpolynomial_fold(
4154                 __isl_take isl_printer *p,
4155                 __isl_keep isl_pw_qpolynomial_fold *pwf);
4156         __isl_give isl_printer *
4157         isl_printer_print_union_pw_qpolynomial_fold(
4158                 __isl_take isl_printer *p,
4159                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
4161 For C<isl_printer_print_qpolynomial>,
4162 C<isl_printer_print_pw_qpolynomial> and
4163 C<isl_printer_print_pw_qpolynomial_fold>,
4164 the output format of the printer
4165 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
4166 For C<isl_printer_print_union_pw_qpolynomial> and
4167 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
4168 is supported.
4169 In case of printing in C<ISL_FORMAT_C>, the user may want
4170 to set the names of all dimensions first.
4172 C<isl> also provides limited support for printing YAML documents,
4173 just enough for the internal use for printing such documents.
4175         #include <isl/printer.h>
4176         __isl_give isl_printer *isl_printer_yaml_start_mapping(
4177                 __isl_take isl_printer *p);
4178         __isl_give isl_printer *isl_printer_yaml_end_mapping(
4179                 __isl_take isl_printer *p);
4180         __isl_give isl_printer *isl_printer_yaml_start_sequence(
4181                 __isl_take isl_printer *p);
4182         __isl_give isl_printer *isl_printer_yaml_end_sequence(
4183                 __isl_take isl_printer *p);
4184         __isl_give isl_printer *isl_printer_yaml_next(
4185                 __isl_take isl_printer *p);
4187 A document is started by a call to either
4188 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
4189 Anything printed to the printer after such a call belong to the
4190 first key of the mapping or the first element in the sequence.
4191 The function C<isl_printer_yaml_next> moves to the value if
4192 we are currently printing a mapping key, the next key if we
4193 are printing a value or the next element if we are printing
4194 an element in a sequence.
4195 Nested mappings and sequences are initiated by the same
4196 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
4197 Each call to these functions needs to have a corresponding call to
4198 C<isl_printer_yaml_end_mapping> or C<isl_printer_yaml_end_sequence>.
4200 When called on a file printer, the following function flushes
4201 the file.  When called on a string printer, the buffer is cleared.
4203         __isl_give isl_printer *isl_printer_flush(
4204                 __isl_take isl_printer *p);
4206 The following functions allow the user to attach
4207 notes to a printer in order to keep track of additional state.
4209         #include <isl/printer.h>
4210         isl_bool isl_printer_has_note(__isl_keep isl_printer *p,
4211                 __isl_keep isl_id *id);
4212         __isl_give isl_id *isl_printer_get_note(
4213                 __isl_keep isl_printer *p, __isl_take isl_id *id);
4214         __isl_give isl_printer *isl_printer_set_note(
4215                 __isl_take isl_printer *p,
4216                 __isl_take isl_id *id, __isl_take isl_id *note);
4218 C<isl_printer_set_note> associates the given note to the given
4219 identifier in the printer.
4220 C<isl_printer_get_note> retrieves a note associated to an
4221 identifier, while
4222 C<isl_printer_has_note> checks if there is such a note.
4223 C<isl_printer_get_note> fails if the requested note does not exist.
4225 Alternatively, a string representation can be obtained
4226 directly using the following functions, which always print
4227 in isl format.
4229         #include <isl/id.h>
4230         __isl_give char *isl_id_to_str(
4231                 __isl_keep isl_id *id);
4232         __isl_give char *isl_multi_id_to_str(
4233                 __isl_keep isl_multi_id *mi);
4235         #include <isl/space.h>
4236         __isl_give char *isl_space_to_str(
4237                 __isl_keep isl_space *space);
4239         #include <isl/val.h>
4240         __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
4241         __isl_give char *isl_multi_val_to_str(
4242                 __isl_keep isl_multi_val *mv);
4244         #include <isl/set.h>
4245         __isl_give char *isl_basic_set_to_str(
4246                 __isl_keep isl_basic_set *bset);
4247         __isl_give char *isl_set_to_str(
4248                 __isl_keep isl_set *set);
4250         #include <isl/union_set.h>
4251         __isl_give char *isl_union_set_to_str(
4252                 __isl_keep isl_union_set *uset);
4254         #include <isl/map.h>
4255         __isl_give char *isl_basic_map_to_str(
4256                 __isl_keep isl_basic_map *bmap);
4257         __isl_give char *isl_map_to_str(
4258                 __isl_keep isl_map *map);
4260         #include <isl/union_map.h>
4261         __isl_give char *isl_union_map_to_str(
4262                 __isl_keep isl_union_map *umap);
4264         #include <isl/aff.h>
4265         __isl_give char *isl_aff_to_str(__isl_keep isl_aff *aff);
4266         __isl_give char *isl_pw_aff_to_str(
4267                 __isl_keep isl_pw_aff *pa);
4268         __isl_give char *isl_multi_aff_to_str(
4269                 __isl_keep isl_multi_aff *ma);
4270         __isl_give char *isl_pw_multi_aff_to_str(
4271                 __isl_keep isl_pw_multi_aff *pma);
4272         __isl_give char *isl_multi_pw_aff_to_str(
4273                 __isl_keep isl_multi_pw_aff *mpa);
4274         __isl_give char *isl_union_pw_aff_to_str(
4275                 __isl_keep isl_union_pw_aff *upa);
4276         __isl_give char *isl_union_pw_multi_aff_to_str(
4277                 __isl_keep isl_union_pw_multi_aff *upma);
4278         __isl_give char *isl_multi_union_pw_aff_to_str(
4279                 __isl_keep isl_multi_union_pw_aff *mupa);
4281         #include <isl/point.h>
4282         __isl_give char *isl_point_to_str(
4283                 __isl_keep isl_point *pnt);
4285         #include <isl/polynomial.h>
4286         __isl_give char *isl_pw_qpolynomial_to_str(
4287                 __isl_keep isl_pw_qpolynomial *pwqp);
4288         __isl_give char *isl_union_pw_qpolynomial_to_str(
4289                 __isl_keep isl_union_pw_qpolynomial *upwqp);
4291 =head2 Properties
4293 =head3 Unary Properties
4295 =over
4297 =item * Emptiness
4299 The following functions test whether the given set or relation
4300 contains any integer points.  The ``plain'' variants do not perform
4301 any computations, but simply check if the given set or relation
4302 is already known to be empty.
4304         #include <isl/set.h>
4305         isl_bool isl_basic_set_plain_is_empty(
4306                 __isl_keep isl_basic_set *bset);
4307         isl_bool isl_basic_set_is_empty(
4308                 __isl_keep isl_basic_set *bset);
4309         isl_bool isl_set_plain_is_empty(
4310                 __isl_keep isl_set *set);
4311         isl_bool isl_set_is_empty(__isl_keep isl_set *set);
4313         #include <isl/union_set.h>
4314         isl_bool isl_union_set_is_empty(
4315                 __isl_keep isl_union_set *uset);
4317         #include <isl/map.h>
4318         isl_bool isl_basic_map_plain_is_empty(
4319                 __isl_keep isl_basic_map *bmap);
4320         isl_bool isl_basic_map_is_empty(
4321                 __isl_keep isl_basic_map *bmap);
4322         isl_bool isl_map_plain_is_empty(
4323                 __isl_keep isl_map *map);
4324         isl_bool isl_map_is_empty(__isl_keep isl_map *map);
4326         #include <isl/union_map.h>
4327         isl_bool isl_union_map_plain_is_empty(
4328                 __isl_keep isl_union_map *umap);
4329         isl_bool isl_union_map_is_empty(
4330                 __isl_keep isl_union_map *umap);
4332         #include <isl/aff.h>
4333         isl_bool isl_union_pw_multi_aff_plain_is_empty(
4334                 __isl_keep isl_union_pw_multi_aff *upma);
4336 =item * Universality
4338         isl_bool isl_basic_set_plain_is_universe(
4339                 __isl_keep isl_basic_set *bset);
4340         isl_bool isl_basic_set_is_universe(
4341                 __isl_keep isl_basic_set *bset);
4342         isl_bool isl_basic_map_plain_is_universe(
4343                 __isl_keep isl_basic_map *bmap);
4344         isl_bool isl_basic_map_is_universe(
4345                 __isl_keep isl_basic_map *bmap);
4346         isl_bool isl_set_plain_is_universe(
4347                 __isl_keep isl_set *set);
4348         isl_bool isl_map_plain_is_universe(
4349                 __isl_keep isl_map *map);
4351 =item * Single-valuedness
4353         #include <isl/set.h>
4354         isl_bool isl_set_is_singleton(__isl_keep isl_set *set);
4356         #include <isl/map.h>
4357         isl_bool isl_basic_map_is_single_valued(
4358                 __isl_keep isl_basic_map *bmap);
4359         isl_bool isl_map_plain_is_single_valued(
4360                 __isl_keep isl_map *map);
4361         isl_bool isl_map_is_single_valued(__isl_keep isl_map *map);
4363         #include <isl/union_map.h>
4364         isl_bool isl_union_map_is_single_valued(
4365                 __isl_keep isl_union_map *umap);
4367 =item * Injectivity
4369         isl_bool isl_map_plain_is_injective(
4370                 __isl_keep isl_map *map);
4371         isl_bool isl_map_is_injective(
4372                 __isl_keep isl_map *map);
4373         isl_bool isl_union_map_plain_is_injective(
4374                 __isl_keep isl_union_map *umap);
4375         isl_bool isl_union_map_is_injective(
4376                 __isl_keep isl_union_map *umap);
4378 =item * Bijectivity
4380         isl_bool isl_map_is_bijective(
4381                 __isl_keep isl_map *map);
4382         isl_bool isl_union_map_is_bijective(
4383                 __isl_keep isl_union_map *umap);
4385 =item * Identity
4387 The following functions test whether the given relation
4388 only maps elements to themselves.
4390         #include <isl/map.h>
4391         isl_bool isl_map_is_identity(
4392                 __isl_keep isl_map *map);
4394         #include <isl/union_map.h>
4395         isl_bool isl_union_map_is_identity(
4396                 __isl_keep isl_union_map *umap);
4398 =item * Position
4400         __isl_give isl_val *
4401         isl_basic_map_plain_get_val_if_fixed(
4402                 __isl_keep isl_basic_map *bmap,
4403                 enum isl_dim_type type, unsigned pos);
4404         __isl_give isl_val *isl_set_plain_get_val_if_fixed(
4405                 __isl_keep isl_set *set,
4406                 enum isl_dim_type type, unsigned pos);
4407         __isl_give isl_multi_val *
4408         isl_set_get_plain_multi_val_if_fixed(
4409                 __isl_keep isl_set *set);
4410         __isl_give isl_val *isl_map_plain_get_val_if_fixed(
4411                 __isl_keep isl_map *map,
4412                 enum isl_dim_type type, unsigned pos);
4414 If the set or relation obviously lies on a hyperplane where the given dimension
4415 has a fixed value, then return that value.
4416 Otherwise return NaN.
4417 C<isl_set_get_plain_multi_val_if_fixed> collects the results over
4418 all set dimensions.
4420 =item * Stride
4422         isl_stat isl_set_dim_residue_class_val(
4423                 __isl_keep isl_set *set,
4424                 int pos, __isl_give isl_val **modulo,
4425                 __isl_give isl_val **residue);
4427 Check if the values of the given set dimension are equal to a fixed
4428 value modulo some integer value.  If so, assign the modulo to C<*modulo>
4429 and the fixed value to C<*residue>.  If the given dimension attains only
4430 a single value, then assign C<0> to C<*modulo> and the fixed value to
4431 C<*residue>.
4432 If the dimension does not attain only a single value and if no modulo
4433 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
4435         #include <isl/set.h>
4436         __isl_give isl_stride_info *isl_set_get_stride_info(
4437                 __isl_keep isl_set *set, int pos);
4438         __isl_give isl_val *isl_set_get_stride(
4439                 __isl_keep isl_set *set, int pos);
4441         #include <isl/map.h>
4442         __isl_give isl_stride_info *
4443         isl_map_get_range_stride_info(
4444                 __isl_keep isl_map *map, int pos);
4446 Check if the values of the given set dimension are equal to
4447 some affine expression of the other dimensions (the offset)
4448 modulo some integer stride or
4449 check if the values of the given output dimensions are equal to
4450 some affine expression of the input dimensions (the offset)
4451 modulo some integer stride.
4452 If no more specific information can be found, then the stride
4453 is taken to be one and the offset is taken to be the zero expression.
4454 The function C<isl_set_get_stride> performs the same
4455 computation as C<isl_set_get_stride_info> but only returns the stride.
4456 For the other functions,
4457 the stride and offset can be extracted from the returned object
4458 using the following functions.
4460         #include <isl/stride_info.h>
4461         __isl_give isl_val *isl_stride_info_get_stride(
4462                 __isl_keep isl_stride_info *si);
4463         __isl_give isl_aff *isl_stride_info_get_offset(
4464                 __isl_keep isl_stride_info *si);
4466 The stride info object can be copied and released using the following
4467 functions.
4469         #include <isl/stride_info.h>
4470         __isl_give isl_stride_info *isl_stride_info_copy(
4471                 __isl_keep isl_stride_info *si);
4472         __isl_null isl_stride_info *isl_stride_info_free(
4473                 __isl_take isl_stride_info *si);
4475 =item * Dependence
4477 To check whether a function involves any local variables,
4478 i.e., integer divisions,
4479 the following functions can be used.
4481         #include <isl/set.h>
4482         isl_bool isl_set_involves_locals(
4483                 __isl_keep isl_set *set);
4485         #include <isl/aff.h>
4486         isl_bool isl_aff_involves_locals(
4487                 __isl_keep isl_aff *aff);
4488         isl_bool isl_multi_aff_involves_locals(
4489                 __isl_keep isl_multi_aff *ma);
4490         isl_bool isl_pw_multi_aff_involves_locals(
4491                 __isl_keep isl_pw_multi_aff *pma);
4492         isl_bool isl_union_pw_multi_aff_involves_locals(
4493                 __isl_keep isl_union_pw_multi_aff *upma);
4495 To check whether the description of a set, relation or function depends
4496 on a parameter or one or more given dimensions,
4497 the following functions can be used.
4499         #include <isl/constraint.h>
4500         isl_bool isl_constraint_involves_dims(
4501                 __isl_keep isl_constraint *constraint,
4502                 enum isl_dim_type type, unsigned first, unsigned n);
4504         #include <isl/set.h>
4505         isl_bool isl_basic_set_involves_dims(
4506                 __isl_keep isl_basic_set *bset,
4507                 enum isl_dim_type type, unsigned first, unsigned n);
4508         isl_bool isl_set_involves_dims(__isl_keep isl_set *set,
4509                 enum isl_dim_type type, unsigned first, unsigned n);
4511         #include <isl/map.h>
4512         isl_bool isl_basic_map_involves_dims(
4513                 __isl_keep isl_basic_map *bmap,
4514                 enum isl_dim_type type, unsigned first, unsigned n);
4515         isl_bool isl_map_involves_dims(__isl_keep isl_map *map,
4516                 enum isl_dim_type type, unsigned first, unsigned n);
4518         #include <isl/union_map.h>
4519         isl_bool isl_union_map_involves_dims(
4520                 __isl_keep isl_union_map *umap,
4521                 enum isl_dim_type type, unsigned first, unsigned n);
4523         #include <isl/aff.h>
4524         isl_bool isl_aff_involves_dims(__isl_keep isl_aff *aff,
4525                 enum isl_dim_type type, unsigned first, unsigned n);
4526         isl_bool isl_pw_aff_involves_param_id(
4527                 __isl_keep isl_pw_aff *pa,
4528                 __isl_keep isl_id *id);
4529         isl_bool isl_pw_aff_involves_dims(
4530                 __isl_keep isl_pw_aff *pwaff,
4531                 enum isl_dim_type type, unsigned first, unsigned n);
4532         isl_bool isl_multi_aff_involves_dims(
4533                 __isl_keep isl_multi_aff *ma,
4534                 enum isl_dim_type type, unsigned first, unsigned n);
4535         isl_bool isl_pw_multi_aff_involves_param_id(
4536                 __isl_keep isl_pw_multi_aff *pma,
4537                 __isl_keep isl_id *id);
4538         isl_bool isl_pw_multi_aff_involves_dims(
4539                 __isl_keep isl_pw_multi_aff *pma,
4540                 enum isl_dim_type type, unsigned first, unsigned n);
4541         isl_bool isl_multi_pw_aff_involves_dims(
4542                 __isl_keep isl_multi_pw_aff *mpa,
4543                 enum isl_dim_type type, unsigned first, unsigned n);
4544         isl_bool isl_multi_pw_aff_involves_param_id(
4545                 __isl_keep isl_multi_pw_aff *mpa,
4546                 __isl_keep isl_id *id);
4547         isl_bool isl_multi_pw_aff_involves_param_id_list(
4548                 __isl_keep isl_multi_pw_aff *mpa,
4549                 __isl_keep isl_id_list *list);
4551         #include <isl/polynomial.h>
4552         isl_bool isl_qpolynomial_involves_dims(
4553                 __isl_keep isl_qpolynomial *qp,
4554                 enum isl_dim_type type, unsigned first, unsigned n);
4555         isl_bool isl_pw_qpolynomial_involves_param_id(
4556                 __isl_keep isl_pw_qpolynomial *pwqp,
4557                 __isl_keep isl_id *id);
4558         isl_bool isl_pw_qpolynomial_fold_involves_param_id(
4559                 __isl_keep isl_pw_qpolynomial_fold *pwf,
4560                 __isl_keep isl_id *id);
4562 Similarly, the following functions can be used to check whether
4563 a given dimension is involved in any lower or upper bound.
4565         #include <isl/set.h>
4566         isl_bool isl_set_dim_has_any_lower_bound(
4567                 __isl_keep isl_set *set,
4568                 enum isl_dim_type type, unsigned pos);
4569         isl_bool isl_set_dim_has_any_upper_bound(
4570                 __isl_keep isl_set *set,
4571                 enum isl_dim_type type, unsigned pos);
4573 Note that these functions return true even if there is a bound on
4574 the dimension on only some of the basic sets of C<set>.
4575 To check if they have a bound for all of the basic sets in C<set>,
4576 use the following functions instead.
4578         #include <isl/set.h>
4579         isl_bool isl_set_dim_has_lower_bound(
4580                 __isl_keep isl_set *set,
4581                 enum isl_dim_type type, unsigned pos);
4582         isl_bool isl_set_dim_has_upper_bound(
4583                 __isl_keep isl_set *set,
4584                 enum isl_dim_type type, unsigned pos);
4586 =item * Space
4588 To check whether a set is a parameter domain, use this function:
4590         isl_bool isl_set_is_params(__isl_keep isl_set *set);
4591         isl_bool isl_union_set_is_params(
4592                 __isl_keep isl_union_set *uset);
4594 =item * Wrapping
4596 The following functions check whether the space of the given
4597 (basic) set or relation domain and/or range is a wrapped relation.
4599         #include <isl/space.h>
4600         isl_bool isl_space_is_wrapping(
4601                 __isl_keep isl_space *space);
4602         isl_bool isl_space_domain_is_wrapping(
4603                 __isl_keep isl_space *space);
4604         isl_bool isl_space_range_is_wrapping(
4605                 __isl_keep isl_space *space);
4606         isl_bool isl_space_is_product(
4607                 __isl_keep isl_space *space);
4609         #include <isl/set.h>
4610         isl_bool isl_basic_set_is_wrapping(
4611                 __isl_keep isl_basic_set *bset);
4612         isl_bool isl_set_is_wrapping(__isl_keep isl_set *set);
4614         #include <isl/map.h>
4615         isl_bool isl_map_domain_is_wrapping(
4616                 __isl_keep isl_map *map);
4617         isl_bool isl_map_range_is_wrapping(
4618                 __isl_keep isl_map *map);
4619         isl_bool isl_map_is_product(__isl_keep isl_map *map);
4621         #include <isl/id.h>
4622         isl_bool isl_multi_id_range_is_wrapping(
4623                 __isl_keep isl_multi_id *mi);
4625         #include <isl/val.h>
4626         isl_bool isl_multi_val_range_is_wrapping(
4627                 __isl_keep isl_multi_val *mv);
4629         #include <isl/aff.h>
4630         isl_bool isl_multi_aff_range_is_wrapping(
4631                 __isl_keep isl_multi_aff *ma);
4632         isl_bool isl_multi_pw_aff_range_is_wrapping(
4633                 __isl_keep isl_multi_pw_aff *mpa);
4634         isl_bool isl_multi_union_pw_aff_range_is_wrapping(
4635                 __isl_keep isl_multi_union_pw_aff *mupa);
4637 The input to C<isl_space_is_wrapping> should
4638 be the space of a set, while that of
4639 C<isl_space_domain_is_wrapping> and
4640 C<isl_space_range_is_wrapping> should be the space of a relation.
4641 The input to C<isl_space_is_product> can be either the space
4642 of a set or that of a binary relation.
4643 In case the input is the space of a binary relation, it checks
4644 whether both domain and range are wrapping.
4646 =item * Internal Product
4648         isl_bool isl_basic_map_can_zip(
4649                 __isl_keep isl_basic_map *bmap);
4650         isl_bool isl_map_can_zip(__isl_keep isl_map *map);
4652 Check whether the product of domain and range of the given relation
4653 can be computed,
4654 i.e., whether both domain and range are nested relations.
4656 =item * Currying
4658         #include <isl/space.h>
4659         isl_bool isl_space_can_curry(
4660                 __isl_keep isl_space *space);
4662         #include <isl/map.h>
4663         isl_bool isl_basic_map_can_curry(
4664                 __isl_keep isl_basic_map *bmap);
4665         isl_bool isl_map_can_curry(__isl_keep isl_map *map);
4667 Check whether the domain of the (basic) relation is a wrapped relation.
4669         #include <isl/space.h>
4670         __isl_give isl_space *isl_space_uncurry(
4671                 __isl_take isl_space *space);
4673         #include <isl/map.h>
4674         isl_bool isl_basic_map_can_uncurry(
4675                 __isl_keep isl_basic_map *bmap);
4676         isl_bool isl_map_can_uncurry(__isl_keep isl_map *map);
4678 Check whether the range of the (basic) relation is a wrapped relation.
4680         #include <isl/space.h>
4681         isl_bool isl_space_can_range_curry(
4682                 __isl_keep isl_space *space);
4684         #include <isl/map.h>
4685         isl_bool isl_map_can_range_curry(
4686                 __isl_keep isl_map *map);
4688 Check whether the domain of the relation wrapped in the range of
4689 the input is itself a wrapped relation.
4691 =item * Special Values
4693         #include <isl/aff.h>
4694         isl_bool isl_aff_is_cst(__isl_keep isl_aff *aff);
4695         isl_bool isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
4696         isl_bool isl_multi_pw_aff_is_cst(
4697                 __isl_keep isl_multi_pw_aff *mpa);
4699 Check whether the given expression is a constant.
4701         #include <isl/val.h>
4702         isl_bool isl_multi_val_involves_nan(
4703                 __isl_keep isl_multi_val *mv);
4705         #include <isl/aff.h>
4706         isl_bool isl_aff_is_nan(__isl_keep isl_aff *aff);
4707         isl_bool isl_multi_aff_involves_nan(
4708                 __isl_keep isl_multi_aff *ma);
4709         isl_bool isl_pw_aff_involves_nan(
4710                 __isl_keep isl_pw_aff *pa);
4711         isl_bool isl_pw_multi_aff_involves_nan(
4712                 __isl_keep isl_pw_multi_aff *pma);
4713         isl_bool isl_multi_pw_aff_involves_nan(
4714                 __isl_keep isl_multi_pw_aff *mpa);
4715         isl_bool isl_union_pw_aff_involves_nan(
4716                 __isl_keep isl_union_pw_aff *upa);
4717         isl_bool isl_union_pw_multi_aff_involves_nan(
4718                 __isl_keep isl_union_pw_multi_aff *upma);
4719         isl_bool isl_multi_union_pw_aff_involves_nan(
4720                 __isl_keep isl_multi_union_pw_aff *mupa);
4722         #include <isl/polynomial.h>
4723         isl_bool isl_qpolynomial_is_nan(
4724                 __isl_keep isl_qpolynomial *qp);
4725         isl_bool isl_qpolynomial_fold_is_nan(
4726                 __isl_keep isl_qpolynomial_fold *fold);
4727         isl_bool isl_pw_qpolynomial_involves_nan(
4728                 __isl_keep isl_pw_qpolynomial *pwqp);
4729         isl_bool isl_pw_qpolynomial_fold_involves_nan(
4730                 __isl_keep isl_pw_qpolynomial_fold *pwf);
4731         isl_bool isl_union_pw_qpolynomial_involves_nan(
4732                 __isl_keep isl_union_pw_qpolynomial *upwqp);
4733         isl_bool isl_union_pw_qpolynomial_fold_involves_nan(
4734                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
4736 Check whether the given expression is equal to or involves NaN.
4738         #include <isl/val.h>
4739         isl_bool isl_multi_val_is_zero(
4740                 __isl_keep isl_multi_val *mv);
4742 Check whether the multiple value is zero.
4744         #include <isl/aff.h>
4745         isl_bool isl_aff_plain_is_zero(
4746                 __isl_keep isl_aff *aff);
4748 Check whether the affine expression is obviously zero.
4750 =back
4752 =head3 Binary Properties
4754 =over
4756 =item * Equality
4758 The following functions check whether two objects
4759 represent the same set, relation or function.
4760 The C<plain> variants only return true if the objects
4761 are obviously the same.  That is, they may return false
4762 even if the objects are the same, but they will never
4763 return true if the objects are not the same.
4765         #include <isl/set.h>
4766         isl_bool isl_basic_set_plain_is_equal(
4767                 __isl_keep isl_basic_set *bset1,
4768                 __isl_keep isl_basic_set *bset2);
4769         isl_bool isl_basic_set_is_equal(
4770                 __isl_keep isl_basic_set *bset1,
4771                 __isl_keep isl_basic_set *bset2);
4772         isl_bool isl_set_plain_is_equal(
4773                 __isl_keep isl_set *set1,
4774                 __isl_keep isl_set *set2);
4775         isl_bool isl_set_is_equal(__isl_keep isl_set *set1,
4776                 __isl_keep isl_set *set2);
4778         #include <isl/map.h>
4779         isl_bool isl_basic_map_is_equal(
4780                 __isl_keep isl_basic_map *bmap1,
4781                 __isl_keep isl_basic_map *bmap2);
4782         isl_bool isl_map_is_equal(__isl_keep isl_map *map1,
4783                 __isl_keep isl_map *map2);
4784         isl_bool isl_map_plain_is_equal(
4785                 __isl_keep isl_map *map1,
4786                 __isl_keep isl_map *map2);
4788         #include <isl/union_set.h>
4789         isl_bool isl_union_set_is_equal(
4790                 __isl_keep isl_union_set *uset1,
4791                 __isl_keep isl_union_set *uset2);
4793         #include <isl/union_map.h>
4794         isl_bool isl_union_map_is_equal(
4795                 __isl_keep isl_union_map *umap1,
4796                 __isl_keep isl_union_map *umap2);
4798         #include <isl/id.h>
4799         isl_bool isl_multi_id_plain_is_equal(
4800                 __isl_keep isl_multi_id *mi1,
4801                 __isl_keep isl_multi_id *mi2);
4803         #include <isl/val.h>
4804         isl_bool isl_multi_val_plain_is_equal(
4805                 __isl_keep isl_multi_val *mv1,
4806                 __isl_keep isl_multi_val *mv2);
4808         #include <isl/aff.h>
4809         isl_bool isl_aff_plain_is_equal(
4810                 __isl_keep isl_aff *aff1,
4811                 __isl_keep isl_aff *aff2);
4812         isl_bool isl_multi_aff_plain_is_equal(
4813                 __isl_keep isl_multi_aff *maff1,
4814                 __isl_keep isl_multi_aff *maff2);
4815         isl_bool isl_pw_aff_plain_is_equal(
4816                 __isl_keep isl_pw_aff *pwaff1,
4817                 __isl_keep isl_pw_aff *pwaff2);
4818         isl_bool isl_pw_aff_is_equal(
4819                 __isl_keep isl_pw_aff *pa1,
4820                 __isl_keep isl_pw_aff *pa2);
4821         isl_bool isl_pw_multi_aff_plain_is_equal(
4822                 __isl_keep isl_pw_multi_aff *pma1,
4823                 __isl_keep isl_pw_multi_aff *pma2);
4824         isl_bool isl_pw_multi_aff_is_equal(
4825                 __isl_keep isl_pw_multi_aff *pma1,
4826                 __isl_keep isl_pw_multi_aff *pma2);
4827         isl_bool isl_multi_pw_aff_plain_is_equal(
4828                 __isl_keep isl_multi_pw_aff *mpa1,
4829                 __isl_keep isl_multi_pw_aff *mpa2);
4830         isl_bool isl_multi_pw_aff_is_equal(
4831                 __isl_keep isl_multi_pw_aff *mpa1,
4832                 __isl_keep isl_multi_pw_aff *mpa2);
4833         isl_bool isl_union_pw_aff_plain_is_equal(
4834                 __isl_keep isl_union_pw_aff *upa1,
4835                 __isl_keep isl_union_pw_aff *upa2);
4836         isl_bool isl_union_pw_multi_aff_plain_is_equal(
4837                 __isl_keep isl_union_pw_multi_aff *upma1,
4838                 __isl_keep isl_union_pw_multi_aff *upma2);
4839         isl_bool isl_multi_union_pw_aff_plain_is_equal(
4840                 __isl_keep isl_multi_union_pw_aff *mupa1,
4841                 __isl_keep isl_multi_union_pw_aff *mupa2);
4843         #include <isl/polynomial.h>
4844         isl_bool isl_union_pw_qpolynomial_plain_is_equal(
4845                 __isl_keep isl_union_pw_qpolynomial *upwqp1,
4846                 __isl_keep isl_union_pw_qpolynomial *upwqp2);
4847         isl_bool isl_union_pw_qpolynomial_fold_plain_is_equal(
4848                 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
4849                 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
4851 =item * Disjointness
4853         #include <isl/set.h>
4854         isl_bool isl_basic_set_is_disjoint(
4855                 __isl_keep isl_basic_set *bset1,
4856                 __isl_keep isl_basic_set *bset2);
4857         isl_bool isl_set_plain_is_disjoint(
4858                 __isl_keep isl_set *set1,
4859                 __isl_keep isl_set *set2);
4860         isl_bool isl_set_is_disjoint(__isl_keep isl_set *set1,
4861                 __isl_keep isl_set *set2);
4863         #include <isl/map.h>
4864         isl_bool isl_basic_map_is_disjoint(
4865                 __isl_keep isl_basic_map *bmap1,
4866                 __isl_keep isl_basic_map *bmap2);
4867         isl_bool isl_map_is_disjoint(__isl_keep isl_map *map1,
4868                 __isl_keep isl_map *map2);
4870         #include <isl/union_set.h>
4871         isl_bool isl_union_set_is_disjoint(
4872                 __isl_keep isl_union_set *uset1,
4873                 __isl_keep isl_union_set *uset2);
4875         #include <isl/union_map.h>
4876         isl_bool isl_union_map_is_disjoint(
4877                 __isl_keep isl_union_map *umap1,
4878                 __isl_keep isl_union_map *umap2);
4880 =item * Subset
4882         isl_bool isl_basic_set_is_subset(
4883                 __isl_keep isl_basic_set *bset1,
4884                 __isl_keep isl_basic_set *bset2);
4885         isl_bool isl_set_is_subset(__isl_keep isl_set *set1,
4886                 __isl_keep isl_set *set2);
4887         isl_bool isl_set_is_strict_subset(
4888                 __isl_keep isl_set *set1,
4889                 __isl_keep isl_set *set2);
4890         isl_bool isl_union_set_is_subset(
4891                 __isl_keep isl_union_set *uset1,
4892                 __isl_keep isl_union_set *uset2);
4893         isl_bool isl_union_set_is_strict_subset(
4894                 __isl_keep isl_union_set *uset1,
4895                 __isl_keep isl_union_set *uset2);
4896         isl_bool isl_basic_map_is_subset(
4897                 __isl_keep isl_basic_map *bmap1,
4898                 __isl_keep isl_basic_map *bmap2);
4899         isl_bool isl_basic_map_is_strict_subset(
4900                 __isl_keep isl_basic_map *bmap1,
4901                 __isl_keep isl_basic_map *bmap2);
4902         isl_bool isl_map_is_subset(
4903                 __isl_keep isl_map *map1,
4904                 __isl_keep isl_map *map2);
4905         isl_bool isl_map_is_strict_subset(
4906                 __isl_keep isl_map *map1,
4907                 __isl_keep isl_map *map2);
4908         isl_bool isl_union_map_is_subset(
4909                 __isl_keep isl_union_map *umap1,
4910                 __isl_keep isl_union_map *umap2);
4911         isl_bool isl_union_map_is_strict_subset(
4912                 __isl_keep isl_union_map *umap1,
4913                 __isl_keep isl_union_map *umap2);
4915 Check whether the first argument is a (strict) subset of the
4916 second argument.
4918 =item * Order
4920 Every comparison function returns a negative value if the first
4921 argument is considered smaller than the second, a positive value
4922 if the first argument is considered greater and zero if the two
4923 constraints are considered the same by the comparison criterion.
4925         #include <isl/constraint.h>
4926         int isl_constraint_plain_cmp(
4927                 __isl_keep isl_constraint *c1,
4928                 __isl_keep isl_constraint *c2);
4930 This function is useful for sorting C<isl_constraint>s.
4931 The order depends on the internal representation of the inputs.
4932 The order is fixed over different calls to the function (assuming
4933 the internal representation of the inputs has not changed), but may
4934 change over different versions of C<isl>.
4936         #include <isl/constraint.h>
4937         int isl_constraint_cmp_last_non_zero(
4938                 __isl_keep isl_constraint *c1,
4939                 __isl_keep isl_constraint *c2);
4941 This function can be used to sort constraints that live in the same
4942 local space.  Constraints that involve ``earlier'' dimensions or
4943 that have a smaller coefficient for the shared latest dimension
4944 are considered smaller than other constraints.
4945 This function only defines a B<partial> order.
4947         #include <isl/set.h>
4948         int isl_set_plain_cmp(__isl_keep isl_set *set1,
4949                 __isl_keep isl_set *set2);
4951 This function is useful for sorting C<isl_set>s.
4952 The order depends on the internal representation of the inputs.
4953 The order is fixed over different calls to the function (assuming
4954 the internal representation of the inputs has not changed), but may
4955 change over different versions of C<isl>.
4957         #include <isl/aff.h>
4958         int isl_multi_aff_plain_cmp(
4959                 __isl_keep isl_multi_aff *ma1,
4960                 __isl_keep isl_multi_aff *ma2);
4961         int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
4962                 __isl_keep isl_pw_aff *pa2);
4964 The functions C<isl_multi_aff_plain_cmp> and
4965 C<isl_pw_aff_plain_cmp> can be used to sort C<isl_multi_aff>s and
4966 C<isl_pw_aff>s.  The order is not strictly defined.
4967 The current order sorts expressions that only involve
4968 earlier dimensions before those that involve later dimensions.
4970 =back
4972 =head2 Unary Operations
4974 =over
4976 =item * Complement
4978         __isl_give isl_set *isl_set_complement(
4979                 __isl_take isl_set *set);
4980         __isl_give isl_map *isl_map_complement(
4981                 __isl_take isl_map *map);
4983 =item * Inverse map
4985         #include <isl/space.h>
4986         __isl_give isl_space *isl_space_reverse(
4987                 __isl_take isl_space *space);
4988         __isl_give isl_space *isl_space_range_reverse(
4989                 __isl_take isl_space *space);
4991         #include <isl/map.h>
4992         __isl_give isl_basic_map *isl_basic_map_reverse(
4993                 __isl_take isl_basic_map *bmap);
4994         __isl_give isl_map *isl_map_reverse(
4995                 __isl_take isl_map *map);
4996         __isl_give isl_map *isl_map_range_reverse(
4997                 __isl_take isl_map *map);
4999         #include <isl/union_map.h>
5000         __isl_give isl_union_map *isl_union_map_reverse(
5001                 __isl_take isl_union_map *umap);
5002         __isl_give isl_union_map *isl_union_map_range_reverse(
5003                 __isl_take isl_union_map *umap);
5005 The function C<isl_space_range_reverse> reverses the relation
5006 that is embedded in the range of the input map space.
5007 The identifier of the range, if any, is only preserved
5008 if this embedded relation has identical input and output tuples.
5010 =item * Tuple binding
5012 The following function binds
5013 a tuple to a sequence of parameter identifiers, equating
5014 the tuple dimensions to the parameters with those identifiers and
5015 subsequently projecting out the tuple.
5016 If the original object did not reference any such parameters,
5017 then this means that the tuple dimensions are reinterpreted
5018 as parameters.
5019 The space of C<tuple> needs to match that of the bound tuple.
5021         #include <isl/set.h>
5022         __isl_give isl_set *isl_set_bind(
5023                 __isl_take isl_set *set,
5024                 __isl_take isl_multi_id *tuple);
5026         #include <isl/map.h>
5027         __isl_give isl_set *isl_map_bind_domain(
5028                 __isl_take isl_map *map,
5029                 __isl_take isl_multi_id *tuple);
5030         __isl_give isl_set *isl_map_bind_range(
5031                 __isl_take isl_map *map,
5032                 __isl_take isl_multi_id *tuple);
5034         #include <isl/union_map.h>
5035         __isl_give isl_union_set *isl_union_map_bind_range(
5036                 __isl_take isl_union_map *umap,
5037                 __isl_take isl_multi_id *tuple);
5039         #include <isl/aff.h>
5040         __isl_give isl_pw_aff *isl_pw_aff_bind_domain(
5041                 __isl_take isl_pw_aff *pa,
5042                 __isl_take isl_multi_id *tuple);
5043         __isl_give isl_multi_aff *isl_multi_aff_bind_domain(
5044                 __isl_take isl_multi_aff *ma,
5045                 __isl_take isl_multi_id *tuple);
5046         __isl_give isl_pw_multi_aff *
5047         isl_pw_multi_aff_bind_domain(
5048                 __isl_take isl_pw_multi_aff *pma,
5049                 __isl_take isl_multi_id *tuple);
5050         __isl_give isl_multi_pw_aff *
5051         isl_multi_pw_aff_bind_domain(
5052                 __isl_take isl_multi_pw_aff *mpa,
5053                 __isl_take isl_multi_id *tuple);
5054         __isl_give isl_pw_aff *
5055         isl_pw_aff_bind_domain_wrapped_domain(
5056                 __isl_take isl_pw_aff *pa,
5057                 __isl_take isl_multi_id *tuple);
5058         __isl_give isl_multi_aff *
5059         isl_multi_aff_bind_domain_wrapped_domain(
5060                 __isl_take isl_multi_aff *ma,
5061                 __isl_take isl_multi_id *tuple);
5062         __isl_give isl_pw_multi_aff *
5063         isl_pw_multi_aff_bind_domain_wrapped_domain(
5064                 __isl_take isl_pw_multi_aff *pma,
5065                 __isl_take isl_multi_id *tuple);
5066         __isl_give isl_multi_pw_aff *
5067         isl_multi_pw_aff_bind_domain_wrapped_domain(
5068                 __isl_take isl_multi_pw_aff *mpa,
5069                 __isl_take isl_multi_id *tuple);
5070         __isl_give isl_basic_set *isl_aff_bind_id(
5071                 __isl_take isl_aff *aff,
5072                 __isl_take isl_id *id);
5073         __isl_give isl_set *isl_pw_aff_bind_id(
5074                 __isl_take isl_pw_aff *pa,
5075                 __isl_take isl_id *id);
5076         __isl_give isl_basic_set *isl_multi_aff_bind(
5077                 __isl_take isl_multi_aff *ma,
5078                 __isl_take isl_multi_id *tuple);
5079         __isl_give isl_set *isl_multi_pw_aff_bind(
5080                 __isl_take isl_multi_pw_aff *mpa,
5081                 __isl_take isl_multi_id *tuple);
5082         __isl_give isl_union_set *isl_union_pw_aff_bind_id(
5083                 __isl_take isl_union_pw_aff *upa,
5084                 __isl_take isl_id *id);
5085         __isl_give isl_union_set *
5086         isl_multi_union_pw_aff_bind(
5087                 __isl_take isl_multi_union_pw_aff *mupa,
5088                 __isl_take isl_multi_id *tuple);
5090 Projecting out the domain of the wrapped relation in the domain
5091 of a function leaves the range of that wrapped relation
5092 in the domain of the resulting function.
5093 In the case of C<isl_aff_bind_id>, C<isl_pw_aff_bind_id>,
5094 C<isl_multi_aff_bind>, C<isl_multi_pw_aff_bind>,
5095 C<isl_union_pw_aff_bind_id> and
5096 C<isl_multi_union_pw_aff_bind>, the parameters
5097 are bound to the function values and the result lives
5098 in the domain of the input function.
5100 =item * Projection
5102         #include <isl/space.h>
5103         __isl_give isl_space *isl_space_domain(
5104                 __isl_take isl_space *space);
5105         __isl_give isl_space *isl_space_range(
5106                 __isl_take isl_space *space);
5107         __isl_give isl_space *isl_space_params(
5108                 __isl_take isl_space *space);
5110         #include <isl/local_space.h>
5111         __isl_give isl_local_space *isl_local_space_domain(
5112                 __isl_take isl_local_space *ls);
5113         __isl_give isl_local_space *isl_local_space_range(
5114                 __isl_take isl_local_space *ls);
5116         #include <isl/set.h>
5117         __isl_give isl_basic_set *isl_basic_set_project_out(
5118                 __isl_take isl_basic_set *bset,
5119                 enum isl_dim_type type, unsigned first, unsigned n);
5120         __isl_give isl_set *isl_set_project_out_param_id(
5121                 __isl_take isl_set *set,
5122                 __isl_take isl_id *id);
5123         __isl_give isl_set *
5124         isl_set_project_out_param_id_list(
5125                 __isl_take isl_set *set,
5126                 __isl_take isl_id_list *list);
5127         __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
5128                 enum isl_dim_type type, unsigned first, unsigned n);
5129         __isl_give isl_set *isl_set_project_out_all_params(
5130                 __isl_take isl_set *set);
5131         __isl_give isl_map *isl_set_project_onto_map(
5132                 __isl_take isl_set *set,
5133                 enum isl_dim_type type, unsigned first,
5134                 unsigned n);
5135         __isl_give isl_basic_set *isl_basic_set_params(
5136                 __isl_take isl_basic_set *bset);
5137         __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
5139 The function C<isl_set_project_onto_map> returns a relation
5140 that projects the input set onto the given set dimensions.
5142         #include <isl/map.h>
5143         __isl_give isl_basic_map *isl_basic_map_project_out(
5144                 __isl_take isl_basic_map *bmap,
5145                 enum isl_dim_type type, unsigned first, unsigned n);
5146         __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
5147                 enum isl_dim_type type, unsigned first, unsigned n);
5148         __isl_give isl_map *isl_map_project_out_all_params(
5149                 __isl_take isl_map *map);
5150         __isl_give isl_basic_set *isl_basic_map_domain(
5151                 __isl_take isl_basic_map *bmap);
5152         __isl_give isl_basic_set *isl_basic_map_range(
5153                 __isl_take isl_basic_map *bmap);
5154         __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
5155         __isl_give isl_set *isl_map_domain(
5156                 __isl_take isl_map *bmap);
5157         __isl_give isl_set *isl_map_range(
5158                 __isl_take isl_map *map);
5160         #include <isl/union_set.h>
5161         __isl_give isl_union_set *isl_union_set_project_out(
5162                 __isl_take isl_union_set *uset,
5163                 enum isl_dim_type type,
5164                 unsigned first, unsigned n);
5165         __isl_give isl_union_set *
5166         isl_union_set_project_out_all_params(
5167                 __isl_take isl_union_set *uset);
5168         __isl_give isl_set *isl_union_set_params(
5169                 __isl_take isl_union_set *uset);
5171 The function C<isl_union_set_project_out> can only project out
5172 parameters.
5174         #include <isl/union_map.h>
5175         __isl_give isl_union_map *isl_union_map_project_out(
5176                 __isl_take isl_union_map *umap,
5177                 enum isl_dim_type type, unsigned first, unsigned n);
5178         __isl_give isl_union_map *
5179         isl_union_map_project_out_all_params(
5180                 __isl_take isl_union_map *umap);
5181         __isl_give isl_set *isl_union_map_params(
5182                 __isl_take isl_union_map *umap);
5183         __isl_give isl_union_set *isl_union_map_domain(
5184                 __isl_take isl_union_map *umap);
5185         __isl_give isl_union_set *isl_union_map_range(
5186                 __isl_take isl_union_map *umap);
5188 The function C<isl_union_map_project_out> can only project out
5189 parameters.
5191         #include <isl/aff.h>
5192         __isl_give isl_aff *isl_aff_project_domain_on_params(
5193                 __isl_take isl_aff *aff);
5194         __isl_give isl_multi_aff *
5195         isl_multi_aff_project_domain_on_params(
5196                 __isl_take isl_multi_aff *ma);
5197         __isl_give isl_pw_aff *
5198         isl_pw_aff_project_domain_on_params(
5199                 __isl_take isl_pw_aff *pa);
5200         __isl_give isl_multi_pw_aff *
5201         isl_multi_pw_aff_project_domain_on_params(
5202                 __isl_take isl_multi_pw_aff *mpa);
5203         __isl_give isl_pw_multi_aff *
5204         isl_pw_multi_aff_project_domain_on_params(
5205                 __isl_take isl_pw_multi_aff *pma);
5206         __isl_give isl_set *isl_pw_aff_domain(
5207                 __isl_take isl_pw_aff *pwaff);
5208         __isl_give isl_set *isl_pw_multi_aff_domain(
5209                 __isl_take isl_pw_multi_aff *pma);
5210         __isl_give isl_set *isl_multi_pw_aff_domain(
5211                 __isl_take isl_multi_pw_aff *mpa);
5212         __isl_give isl_union_set *isl_union_pw_aff_domain(
5213                 __isl_take isl_union_pw_aff *upa);
5214         __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
5215                 __isl_take isl_union_pw_multi_aff *upma);
5216         __isl_give isl_union_set *
5217         isl_multi_union_pw_aff_domain(
5218                 __isl_take isl_multi_union_pw_aff *mupa);
5219         __isl_give isl_set *isl_pw_aff_params(
5220                 __isl_take isl_pw_aff *pwa);
5222 If no explicit domain was set on a zero-dimensional input to
5223 C<isl_multi_union_pw_aff_domain>, then this function will
5224 return a parameter set.
5226         #include <isl/polynomial.h>
5227         __isl_give isl_qpolynomial *
5228         isl_qpolynomial_project_domain_on_params(
5229                 __isl_take isl_qpolynomial *qp);
5230         __isl_give isl_pw_qpolynomial *
5231         isl_pw_qpolynomial_project_domain_on_params(
5232                 __isl_take isl_pw_qpolynomial *pwqp);
5233         __isl_give isl_pw_qpolynomial_fold *
5234         isl_pw_qpolynomial_fold_project_domain_on_params(
5235                 __isl_take isl_pw_qpolynomial_fold *pwf);
5236         __isl_give isl_set *isl_pw_qpolynomial_domain(
5237                 __isl_take isl_pw_qpolynomial *pwqp);
5238         __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
5239                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
5240         __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
5241                 __isl_take isl_union_pw_qpolynomial *upwqp);
5243         #include <isl/space.h>
5244         __isl_give isl_space *isl_space_domain_map(
5245                 __isl_take isl_space *space);
5246         __isl_give isl_space *isl_space_range_map(
5247                 __isl_take isl_space *space);
5249         #include <isl/map.h>
5250         __isl_give isl_map *isl_set_wrapped_domain_map(
5251                 __isl_take isl_set *set);
5252         __isl_give isl_basic_map *isl_basic_map_domain_map(
5253                 __isl_take isl_basic_map *bmap);
5254         __isl_give isl_basic_map *isl_basic_map_range_map(
5255                 __isl_take isl_basic_map *bmap);
5256         __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
5257         __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
5259         #include <isl/union_map.h>
5260         __isl_give isl_union_map *isl_union_map_domain_map(
5261                 __isl_take isl_union_map *umap);
5262         __isl_give isl_union_pw_multi_aff *
5263         isl_union_map_domain_map_union_pw_multi_aff(
5264                 __isl_take isl_union_map *umap);
5265         __isl_give isl_union_map *isl_union_map_range_map(
5266                 __isl_take isl_union_map *umap);
5267         __isl_give isl_union_map *
5268         isl_union_set_wrapped_domain_map(
5269                 __isl_take isl_union_set *uset);
5271 The functions above construct a (basic, regular or union) relation
5272 that maps (a wrapped version of) the input relation to its domain or range.
5273 C<isl_set_wrapped_domain_map> maps the input set to the domain
5274 of its wrapped relation.
5276 =item * Elimination
5278         __isl_give isl_basic_set *isl_basic_set_eliminate(
5279                 __isl_take isl_basic_set *bset,
5280                 enum isl_dim_type type,
5281                 unsigned first, unsigned n);
5282         __isl_give isl_set *isl_set_eliminate(
5283                 __isl_take isl_set *set, enum isl_dim_type type,
5284                 unsigned first, unsigned n);
5285         __isl_give isl_basic_map *isl_basic_map_eliminate(
5286                 __isl_take isl_basic_map *bmap,
5287                 enum isl_dim_type type,
5288                 unsigned first, unsigned n);
5289         __isl_give isl_map *isl_map_eliminate(
5290                 __isl_take isl_map *map, enum isl_dim_type type,
5291                 unsigned first, unsigned n);
5293 Eliminate the coefficients for the given dimensions from the constraints,
5294 without removing the dimensions.
5296 =item * Constructing a set from a parameter domain
5298 A set space of a given dimension and with an optional name
5299 can be created from a parameter space using the following functions.
5301         #include <isl/space.h>
5302         __isl_give isl_space *isl_space_add_unnamed_tuple_ui(
5303                 __isl_take isl_space *space, unsigned dim);
5304         __isl_give isl_space *
5305         isl_space_add_named_tuple_id_ui(
5306                 __isl_take isl_space *space,
5307                 __isl_take isl_id *tuple_id, unsigned dim);
5309 A set with a given tuple can be created from a parameter domain
5310 using the following function.
5312         #include <isl/set.h>
5313         __isl_give isl_set *isl_set_unbind_params(
5314                 __isl_take isl_set *set,
5315                 __isl_take isl_multi_id *tuple);
5317 Any parameters with identifiers in C<tuple> are reinterpreted
5318 as the corresponding set dimensions.
5320 A zero-dimensional (local) space or (basic) set can be constructed
5321 on a given parameter domain using the following functions.
5323         #include <isl/space.h>
5324         __isl_give isl_space *isl_space_set_from_params(
5325                 __isl_take isl_space *space);
5327         #include <isl/local_space.h>
5328         __isl_give isl_local_space *
5329         isl_local_space_set_from_params(
5330                 __isl_take isl_local_space *ls);
5332         #include <isl/set.h>
5333         __isl_give isl_basic_set *isl_basic_set_from_params(
5334                 __isl_take isl_basic_set *bset);
5335         __isl_give isl_set *isl_set_from_params(
5336                 __isl_take isl_set *set);
5338 =item * Constructing a relation from one or two sets
5340 A map space with a range of a given dimension and with an optional name
5341 can be created from a domain space using the functions
5342 C<isl_space_add_unnamed_tuple_ui> and C<isl_space_add_named_tuple_id_ui>
5343 described above.
5345 A relation with a given domain tuple can be created from a set
5346 that will become the range of the relation
5347 using the following function.
5349         #include <isl/set.h>
5350         __isl_give isl_map *
5351         isl_set_unbind_params_insert_domain(
5352                 __isl_take isl_set *set,
5353                 __isl_take isl_multi_id *domain);
5355 Any parameters with identifiers in C<domain> are reinterpreted
5356 as the corresponding input dimensions.
5358 Similarly, a function defined over a parameter domain can
5359 be converted into one defined over a set domain
5360 using the following functions.
5362         #include <isl/aff.h>
5363         __isl_give isl_aff *
5364         isl_aff_unbind_params_insert_domain(
5365                 __isl_take isl_aff *aff,
5366                 __isl_take isl_multi_id *domain);
5367         __isl_give isl_multi_aff *
5368         isl_multi_aff_unbind_params_insert_domain(
5369                 __isl_take isl_multi_aff *ma,
5370                 __isl_take isl_multi_id *domain);
5371         __isl_give isl_multi_pw_aff *
5372         isl_multi_pw_aff_unbind_params_insert_domain(
5373                 __isl_take isl_multi_pw_aff *mpa,
5374                 __isl_take isl_multi_id *domain);
5376 Again,
5377 any parameters with identifiers in C<domain> are reinterpreted
5378 as the corresponding input dimensions.
5380 Create a relation with the given set(s) as domain and/or range.
5381 If only the domain or the range is specified, then
5382 the range or domain of the created relation is a zero-dimensional
5383 flat anonymous space.
5384 If the case of C<isl_space_map_from_set>, the input space
5385 specifies both the domain and the range of the result.
5387         #include <isl/space.h>
5388         __isl_give isl_space *isl_space_from_domain(
5389                 __isl_take isl_space *space);
5390         __isl_give isl_space *isl_space_from_range(
5391                 __isl_take isl_space *space);
5392         __isl_give isl_space *isl_space_map_from_set(
5393                 __isl_take isl_space *space);
5394         __isl_give isl_space *isl_space_map_from_domain_and_range(
5395                 __isl_take isl_space *domain,
5396                 __isl_take isl_space *range);
5398         #include <isl/local_space.h>
5399         __isl_give isl_local_space *isl_local_space_from_domain(
5400                 __isl_take isl_local_space *ls);
5402         #include <isl/map.h>
5403         __isl_give isl_map *isl_set_insert_domain(
5404                 __isl_take isl_set *set,
5405                 __isl_take isl_space *domain);
5406         __isl_give isl_map *isl_map_from_domain(
5407                 __isl_take isl_set *set);
5408         __isl_give isl_map *isl_map_from_range(
5409                 __isl_take isl_set *set);
5411         #include <isl/union_map.h>
5412         __isl_give isl_union_map *isl_union_map_from_domain(
5413                 __isl_take isl_union_set *uset);
5414         __isl_give isl_union_map *isl_union_map_from_range(
5415                 __isl_take isl_union_set *uset);
5416         __isl_give isl_union_map *
5417         isl_union_map_from_domain_and_range(
5418                 __isl_take isl_union_set *domain,
5419                 __isl_take isl_union_set *range);
5421         #include <isl/id.h>
5422         __isl_give isl_multi_id *isl_multi_id_from_range(
5423                 __isl_take isl_multi_id *mi);
5425         #include <isl/val.h>
5426         __isl_give isl_multi_val *isl_multi_val_from_range(
5427                 __isl_take isl_multi_val *mv);
5429         #include <isl/aff.h>
5430         __isl_give isl_multi_aff *
5431         isl_multi_aff_insert_domain(
5432                 __isl_take isl_multi_aff *ma,
5433                 __isl_take isl_space *domain);
5434         __isl_give isl_pw_aff *isl_pw_aff_insert_domain(
5435                 __isl_take isl_pw_aff *pa,
5436                 __isl_take isl_space *domain);
5437         __isl_give isl_pw_multi_aff *
5438         isl_pw_multi_aff_insert_domain(
5439                 __isl_take isl_pw_multi_aff *pma,
5440                 __isl_take isl_space *domain);
5441         __isl_give isl_multi_pw_aff *
5442         isl_multi_pw_aff_insert_domain(
5443                 __isl_take isl_multi_pw_aff *mpa,
5444                 __isl_take isl_space *domain);
5445         __isl_give isl_aff *isl_aff_from_range(
5446                 __isl_take isl_aff *aff);
5447         __isl_give isl_multi_aff *isl_multi_aff_from_range(
5448                 __isl_take isl_multi_aff *ma);
5449         __isl_give isl_pw_aff *isl_pw_aff_from_range(
5450                 __isl_take isl_pw_aff *pwa);
5451         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
5452                 __isl_take isl_multi_pw_aff *mpa);
5453         __isl_give isl_multi_union_pw_aff *
5454         isl_multi_union_pw_aff_from_range(
5455                 __isl_take isl_multi_union_pw_aff *mupa);
5456         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
5457                 __isl_take isl_set *set);
5458         __isl_give isl_union_pw_multi_aff *
5459         isl_union_pw_multi_aff_from_domain(
5460                 __isl_take isl_union_set *uset);
5462         #include <isl/polynomial.h>
5463         __isl_give isl_pw_qpolynomial *
5464         isl_pw_qpolynomial_from_range(
5465                 __isl_take isl_pw_qpolynomial *pwqp);
5466         __isl_give isl_pw_qpolynomial_fold *
5467         isl_pw_qpolynomial_fold_from_range(
5468                 __isl_take isl_pw_qpolynomial_fold *pwf);
5470 =item * Slicing
5472         #include <isl/set.h>
5473         __isl_give isl_basic_set *isl_basic_set_fix_si(
5474                 __isl_take isl_basic_set *bset,
5475                 enum isl_dim_type type, unsigned pos, int value);
5476         __isl_give isl_basic_set *isl_basic_set_fix_val(
5477                 __isl_take isl_basic_set *bset,
5478                 enum isl_dim_type type, unsigned pos,
5479                 __isl_take isl_val *v);
5480         __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
5481                 enum isl_dim_type type, unsigned pos, int value);
5482         __isl_give isl_set *isl_set_fix_val(
5483                 __isl_take isl_set *set,
5484                 enum isl_dim_type type, unsigned pos,
5485                 __isl_take isl_val *v);
5487         #include <isl/map.h>
5488         __isl_give isl_basic_map *isl_basic_map_fix_si(
5489                 __isl_take isl_basic_map *bmap,
5490                 enum isl_dim_type type, unsigned pos, int value);
5491         __isl_give isl_basic_map *isl_basic_map_fix_val(
5492                 __isl_take isl_basic_map *bmap,
5493                 enum isl_dim_type type, unsigned pos,
5494                 __isl_take isl_val *v);
5495         __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
5496                 enum isl_dim_type type, unsigned pos, int value);
5497         __isl_give isl_map *isl_map_fix_val(
5498                 __isl_take isl_map *map,
5499                 enum isl_dim_type type, unsigned pos,
5500                 __isl_take isl_val *v);
5502         #include <isl/aff.h>
5503         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
5504                 __isl_take isl_pw_multi_aff *pma,
5505                 enum isl_dim_type type, unsigned pos, int value);
5507         #include <isl/polynomial.h>
5508         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
5509                 __isl_take isl_pw_qpolynomial *pwqp,
5510                 enum isl_dim_type type, unsigned n,
5511                 __isl_take isl_val *v);
5512         __isl_give isl_pw_qpolynomial_fold *
5513         isl_pw_qpolynomial_fold_fix_val(
5514                 __isl_take isl_pw_qpolynomial_fold *pwf,
5515                 enum isl_dim_type type, unsigned n,
5516                 __isl_take isl_val *v);
5518 Intersect the set, relation or function domain
5519 with the hyperplane where the given
5520 dimension has the fixed given value.
5522         #include <isl/set.h>
5523         __isl_give isl_basic_set *
5524         isl_basic_set_lower_bound_val(
5525                 __isl_take isl_basic_set *bset,
5526                 enum isl_dim_type type, unsigned pos,
5527                 __isl_take isl_val *value);
5528         __isl_give isl_basic_set *
5529         isl_basic_set_upper_bound_val(
5530                 __isl_take isl_basic_set *bset,
5531                 enum isl_dim_type type, unsigned pos,
5532                 __isl_take isl_val *value);
5533         __isl_give isl_set *isl_set_lower_bound_si(
5534                 __isl_take isl_set *set,
5535                 enum isl_dim_type type, unsigned pos, int value);
5536         __isl_give isl_set *isl_set_lower_bound_val(
5537                 __isl_take isl_set *set,
5538                 enum isl_dim_type type, unsigned pos,
5539                 __isl_take isl_val *value);
5540         __isl_give isl_set *isl_set_upper_bound_si(
5541                 __isl_take isl_set *set,
5542                 enum isl_dim_type type, unsigned pos, int value);
5543         __isl_give isl_set *isl_set_upper_bound_val(
5544                 __isl_take isl_set *set,
5545                 enum isl_dim_type type, unsigned pos,
5546                 __isl_take isl_val *value);
5547         __isl_give isl_set *isl_set_lower_bound_multi_val(
5548                 __isl_take isl_set *set,
5549                 __isl_take isl_multi_val *lower);
5550         __isl_give isl_set *isl_set_upper_bound_multi_val(
5551                 __isl_take isl_set *set,
5552                 __isl_take isl_multi_val *upper);
5553         __isl_give isl_set *isl_set_lower_bound_multi_pw_aff(
5554                 __isl_take isl_set *set,
5555                 __isl_take isl_multi_pw_aff *lower);
5556         __isl_give isl_set *isl_set_upper_bound_multi_pw_aff(
5557                 __isl_take isl_set *set,
5558                 __isl_take isl_multi_pw_aff *upper);
5560         #include <isl/map.h>
5561         __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
5562                 __isl_take isl_basic_map *bmap,
5563                 enum isl_dim_type type, unsigned pos, int value);
5564         __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
5565                 __isl_take isl_basic_map *bmap,
5566                 enum isl_dim_type type, unsigned pos, int value);
5567         __isl_give isl_map *isl_map_lower_bound_si(
5568                 __isl_take isl_map *map,
5569                 enum isl_dim_type type, unsigned pos, int value);
5570         __isl_give isl_map *isl_map_upper_bound_si(
5571                 __isl_take isl_map *map,
5572                 enum isl_dim_type type, unsigned pos, int value);
5573         __isl_give isl_map *isl_map_lower_bound_val(
5574                 __isl_take isl_map *map,
5575                 enum isl_dim_type type, unsigned pos,
5576                 __isl_take isl_val *value);
5577         __isl_give isl_map *isl_map_upper_bound_val(
5578                 __isl_take isl_map *map,
5579                 enum isl_dim_type type, unsigned pos,
5580                 __isl_take isl_val *value);
5581         __isl_give isl_map *isl_map_lower_bound_multi_val(
5582                 __isl_take isl_map *map,
5583                 __isl_take isl_multi_val *lower);
5584         __isl_give isl_map *isl_map_upper_bound_multi_val(
5585                 __isl_take isl_map *map,
5586                 __isl_take isl_multi_val *upper);
5587         __isl_give isl_map *isl_map_lower_bound_multi_pw_aff(
5588                 __isl_take isl_map *map,
5589                 __isl_take isl_multi_pw_aff *lower);
5590         __isl_give isl_map *isl_map_upper_bound_multi_pw_aff(
5591                 __isl_take isl_map *map,
5592                 __isl_take isl_multi_pw_aff *upper);
5594 Intersect the set or relation with the half-space where the given
5595 dimension has a value bounded by the given fixed integer value or
5596 symbolic constant expression.
5597 For functions taking a multi expression,
5598 this applies to all set dimensions.
5599 Those that bound a map, bound the range of that map.
5601         __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
5602                 enum isl_dim_type type1, int pos1,
5603                 enum isl_dim_type type2, int pos2);
5604         __isl_give isl_basic_map *isl_basic_map_equate(
5605                 __isl_take isl_basic_map *bmap,
5606                 enum isl_dim_type type1, int pos1,
5607                 enum isl_dim_type type2, int pos2);
5608         __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
5609                 enum isl_dim_type type1, int pos1,
5610                 enum isl_dim_type type2, int pos2);
5612 Intersect the set or relation with the hyperplane where the given
5613 dimensions are equal to each other.
5615         __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
5616                 enum isl_dim_type type1, int pos1,
5617                 enum isl_dim_type type2, int pos2);
5619 Intersect the relation with the hyperplane where the given
5620 dimensions have opposite values.
5622         __isl_give isl_map *isl_map_order_le(
5623                 __isl_take isl_map *map,
5624                 enum isl_dim_type type1, int pos1,
5625                 enum isl_dim_type type2, int pos2);
5626         __isl_give isl_basic_map *isl_basic_map_order_ge(
5627                 __isl_take isl_basic_map *bmap,
5628                 enum isl_dim_type type1, int pos1,
5629                 enum isl_dim_type type2, int pos2);
5630         __isl_give isl_map *isl_map_order_ge(
5631                 __isl_take isl_map *map,
5632                 enum isl_dim_type type1, int pos1,
5633                 enum isl_dim_type type2, int pos2);
5634         __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
5635                 enum isl_dim_type type1, int pos1,
5636                 enum isl_dim_type type2, int pos2);
5637         __isl_give isl_basic_map *isl_basic_map_order_gt(
5638                 __isl_take isl_basic_map *bmap,
5639                 enum isl_dim_type type1, int pos1,
5640                 enum isl_dim_type type2, int pos2);
5641         __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
5642                 enum isl_dim_type type1, int pos1,
5643                 enum isl_dim_type type2, int pos2);
5645 Intersect the relation with the half-space where the given
5646 dimensions satisfy the given ordering.
5648         #include <isl/union_set.h>
5649         __isl_give isl_union_map *isl_union_map_remove_map_if(
5650                 __isl_take isl_union_map *umap,
5651                 isl_bool (*fn)(__isl_keep isl_map *map,
5652                         void *user), void *user);
5654 This function calls the callback function once for each
5655 pair of spaces for which there are elements in the input.
5656 If the callback returns C<isl_bool_true>, then all those elements
5657 are removed from the result.  The only remaining elements in the output
5658 are then those for which the callback returns C<isl_bool_false>.
5660 =item * Locus
5662         #include <isl/aff.h>
5663         __isl_give isl_basic_set *isl_aff_zero_basic_set(
5664                 __isl_take isl_aff *aff);
5665         __isl_give isl_basic_set *isl_aff_neg_basic_set(
5666                 __isl_take isl_aff *aff);
5667         __isl_give isl_set *isl_pw_aff_pos_set(
5668                 __isl_take isl_pw_aff *pa);
5669         __isl_give isl_set *isl_pw_aff_nonneg_set(
5670                 __isl_take isl_pw_aff *pwaff);
5671         __isl_give isl_set *isl_pw_aff_zero_set(
5672                 __isl_take isl_pw_aff *pwaff);
5673         __isl_give isl_set *isl_pw_aff_non_zero_set(
5674                 __isl_take isl_pw_aff *pwaff);
5675         __isl_give isl_union_set *
5676         isl_union_pw_aff_zero_union_set(
5677                 __isl_take isl_union_pw_aff *upa);
5678         __isl_give isl_union_set *
5679         isl_multi_union_pw_aff_zero_union_set(
5680                 __isl_take isl_multi_union_pw_aff *mupa);
5682 The function C<isl_aff_neg_basic_set> returns a basic set
5683 containing those elements in the domain space
5684 of C<aff> where C<aff> is negative.
5685 The function C<isl_pw_aff_nonneg_set> returns a set
5686 containing those elements in the domain
5687 of C<pwaff> where C<pwaff> is non-negative.
5688 The function C<isl_multi_union_pw_aff_zero_union_set>
5689 returns a union set containing those elements
5690 in the domains of its elements where they are all zero.
5692 =item * Identity
5694         __isl_give isl_map *isl_set_identity(
5695                 __isl_take isl_set *set);
5696         __isl_give isl_union_map *isl_union_set_identity(
5697                 __isl_take isl_union_set *uset);
5698         __isl_give isl_union_pw_multi_aff *
5699         isl_union_set_identity_union_pw_multi_aff(
5700                 __isl_take isl_union_set *uset);
5702 Construct an identity relation on the given (union) set.
5704 =item * Function Extraction
5706 A piecewise quasi affine expression that is equal to 1 on a set
5707 and 0 outside the set can be created using the following function.
5709         #include <isl/aff.h>
5710         __isl_give isl_pw_aff *isl_set_indicator_function(
5711                 __isl_take isl_set *set);
5713 A piecewise multiple quasi affine expression can be extracted
5714 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
5715 and the C<isl_map> is single-valued.
5716 In case of a conversion from an C<isl_union_map>
5717 to an C<isl_union_pw_multi_aff>, these properties need to hold
5718 in each domain space.
5719 A conversion to a C<isl_multi_union_pw_aff> additionally
5720 requires that the input is non-empty and involves only a single
5721 range space.
5723         #include <isl/aff.h>
5724         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
5725                 __isl_take isl_set *set);
5726         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
5727                 __isl_take isl_map *map);
5729         __isl_give isl_union_pw_multi_aff *
5730         isl_union_pw_multi_aff_from_union_set(
5731                 __isl_take isl_union_set *uset);
5732         __isl_give isl_union_pw_multi_aff *
5733         isl_union_pw_multi_aff_from_union_map(
5734                 __isl_take isl_union_map *umap);
5736         __isl_give isl_multi_union_pw_aff *
5737         isl_multi_union_pw_aff_from_union_map(
5738                 __isl_take isl_union_map *umap);
5740 =item * Deltas
5742         __isl_give isl_basic_set *isl_basic_map_deltas(
5743                 __isl_take isl_basic_map *bmap);
5744         __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
5745         __isl_give isl_union_set *isl_union_map_deltas(
5746                 __isl_take isl_union_map *umap);
5748 These functions return a (basic) set containing the differences
5749 between image elements and corresponding domain elements in the input.
5751         __isl_give isl_basic_map *isl_basic_map_deltas_map(
5752                 __isl_take isl_basic_map *bmap);
5753         __isl_give isl_map *isl_map_deltas_map(
5754                 __isl_take isl_map *map);
5755         __isl_give isl_union_map *isl_union_map_deltas_map(
5756                 __isl_take isl_union_map *umap);
5758 The functions above construct a (basic, regular or union) relation
5759 that maps (a wrapped version of) the input relation to its delta set.
5761 =item * Coalescing
5763 Simplify the representation of a set, relation or functions by trying
5764 to combine pairs of basic sets or relations into a single
5765 basic set or relation.
5767         #include <isl/set.h>
5768         __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
5770         #include <isl/map.h>
5771         __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
5773         #include <isl/union_set.h>
5774         __isl_give isl_union_set *isl_union_set_coalesce(
5775                 __isl_take isl_union_set *uset);
5777         #include <isl/union_map.h>
5778         __isl_give isl_union_map *isl_union_map_coalesce(
5779                 __isl_take isl_union_map *umap);
5781         #include <isl/aff.h>
5782         __isl_give isl_pw_aff *isl_pw_aff_coalesce(
5783                 __isl_take isl_pw_aff *pa);
5784         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
5785                 __isl_take isl_pw_multi_aff *pma);
5786         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
5787                 __isl_take isl_multi_pw_aff *mpa);
5788         __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
5789                 __isl_take isl_union_pw_aff *upa);
5790         __isl_give isl_union_pw_multi_aff *
5791         isl_union_pw_multi_aff_coalesce(
5792                 __isl_take isl_union_pw_multi_aff *upma);
5793         __isl_give isl_multi_union_pw_aff *
5794         isl_multi_union_pw_aff_coalesce(
5795                 __isl_take isl_multi_union_pw_aff *mupa);
5797         #include <isl/polynomial.h>
5798         __isl_give isl_pw_qpolynomial_fold *
5799         isl_pw_qpolynomial_fold_coalesce(
5800                 __isl_take isl_pw_qpolynomial_fold *pwf);
5801         __isl_give isl_union_pw_qpolynomial *
5802         isl_union_pw_qpolynomial_coalesce(
5803                 __isl_take isl_union_pw_qpolynomial *upwqp);
5804         __isl_give isl_union_pw_qpolynomial_fold *
5805         isl_union_pw_qpolynomial_fold_coalesce(
5806                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
5808 One of the methods for combining pairs of basic sets or relations
5809 can result in coefficients that are much larger than those that appear
5810 in the constraints of the input.  By default, the coefficients are
5811 not allowed to grow larger, but this can be changed by unsetting
5812 the following option.
5814         isl_stat isl_options_set_coalesce_bounded_wrapping(
5815                 isl_ctx *ctx, int val);
5816         int isl_options_get_coalesce_bounded_wrapping(
5817                 isl_ctx *ctx);
5819 One of the other methods tries to combine pairs of basic sets
5820 with different local variables, treating them as existentially
5821 quantified variables even if they have known (but different)
5822 integer division expressions.  The result may then also have
5823 existentially quantified variables.  Turning on the following
5824 option prevents this from happening.
5826         isl_stat isl_options_set_coalesce_preserve_locals(
5827                 isl_ctx *ctx, int val);
5828         int isl_options_get_coalesce_preserve_locals(isl_ctx *ctx);
5830 =item * Detecting equalities
5832         __isl_give isl_basic_set *isl_basic_set_detect_equalities(
5833                 __isl_take isl_basic_set *bset);
5834         __isl_give isl_basic_map *isl_basic_map_detect_equalities(
5835                 __isl_take isl_basic_map *bmap);
5836         __isl_give isl_set *isl_set_detect_equalities(
5837                 __isl_take isl_set *set);
5838         __isl_give isl_map *isl_map_detect_equalities(
5839                 __isl_take isl_map *map);
5840         __isl_give isl_union_set *isl_union_set_detect_equalities(
5841                 __isl_take isl_union_set *uset);
5842         __isl_give isl_union_map *isl_union_map_detect_equalities(
5843                 __isl_take isl_union_map *umap);
5845 Simplify the representation of a set or relation by detecting implicit
5846 equalities.
5848 =item * Removing redundant constraints
5850         #include <isl/set.h>
5851         __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
5852                 __isl_take isl_basic_set *bset);
5853         __isl_give isl_set *isl_set_remove_redundancies(
5854                 __isl_take isl_set *set);
5856         #include <isl/union_set.h>
5857         __isl_give isl_union_set *
5858         isl_union_set_remove_redundancies(
5859                 __isl_take isl_union_set *uset);
5861         #include <isl/map.h>
5862         __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
5863                 __isl_take isl_basic_map *bmap);
5864         __isl_give isl_map *isl_map_remove_redundancies(
5865                 __isl_take isl_map *map);
5867         #include <isl/union_map.h>
5868         __isl_give isl_union_map *
5869         isl_union_map_remove_redundancies(
5870                 __isl_take isl_union_map *umap);
5872 =item * Convex hull
5874         __isl_give isl_basic_set *isl_set_convex_hull(
5875                 __isl_take isl_set *set);
5876         __isl_give isl_basic_map *isl_map_convex_hull(
5877                 __isl_take isl_map *map);
5879 If the input set or relation has any existentially quantified
5880 variables, then the result of these operations is currently undefined.
5882 =item * Simple hull
5884         #include <isl/set.h>
5885         __isl_give isl_basic_set *
5886         isl_set_unshifted_simple_hull(
5887                 __isl_take isl_set *set);
5888         __isl_give isl_basic_set *isl_set_simple_hull(
5889                 __isl_take isl_set *set);
5890         __isl_give isl_basic_set *
5891         isl_set_plain_unshifted_simple_hull(
5892                 __isl_take isl_set *set);
5893         __isl_give isl_basic_set *
5894         isl_set_unshifted_simple_hull_from_set_list(
5895                 __isl_take isl_set *set,
5896                 __isl_take isl_set_list *list);
5898         #include <isl/map.h>
5899         __isl_give isl_basic_map *
5900         isl_map_unshifted_simple_hull(
5901                 __isl_take isl_map *map);
5902         __isl_give isl_basic_map *isl_map_simple_hull(
5903                 __isl_take isl_map *map);
5904         __isl_give isl_basic_map *
5905         isl_map_plain_unshifted_simple_hull(
5906                 __isl_take isl_map *map);
5907                 __isl_give isl_basic_map *
5908         isl_map_unshifted_simple_hull_from_map_list(
5909                 __isl_take isl_map *map,
5910                 __isl_take isl_map_list *list);
5912         #include <isl/union_map.h>
5913         __isl_give isl_union_map *isl_union_map_simple_hull(
5914                 __isl_take isl_union_map *umap);
5916 These functions compute a single basic set or relation
5917 that contains the whole input set or relation.
5918 In particular, the output is described by translates
5919 of the constraints describing the basic sets or relations in the input.
5920 In case of C<isl_set_unshifted_simple_hull>, only the original
5921 constraints are used, without any translation.
5922 In case of C<isl_set_plain_unshifted_simple_hull> and
5923 C<isl_map_plain_unshifted_simple_hull>, the result is described
5924 by original constraints that are obviously satisfied
5925 by the entire input set or relation.
5926 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
5927 C<isl_map_unshifted_simple_hull_from_map_list>, the
5928 constraints are taken from the elements of the second argument.
5930 =begin latex
5932 (See \autoref{s:simple hull}.)
5934 =end latex
5936 =item * Affine hull
5938         __isl_give isl_basic_set *isl_basic_set_affine_hull(
5939                 __isl_take isl_basic_set *bset);
5940         __isl_give isl_basic_set *isl_set_affine_hull(
5941                 __isl_take isl_set *set);
5942         __isl_give isl_union_set *isl_union_set_affine_hull(
5943                 __isl_take isl_union_set *uset);
5944         __isl_give isl_basic_map *isl_basic_map_affine_hull(
5945                 __isl_take isl_basic_map *bmap);
5946         __isl_give isl_basic_map *isl_map_affine_hull(
5947                 __isl_take isl_map *map);
5948         __isl_give isl_union_map *isl_union_map_affine_hull(
5949                 __isl_take isl_union_map *umap);
5951 In case of union sets and relations, the affine hull is computed
5952 per space.
5954 =item * Polyhedral hull
5956         __isl_give isl_basic_set *isl_set_polyhedral_hull(
5957                 __isl_take isl_set *set);
5958         __isl_give isl_basic_map *isl_map_polyhedral_hull(
5959                 __isl_take isl_map *map);
5960         __isl_give isl_union_set *isl_union_set_polyhedral_hull(
5961                 __isl_take isl_union_set *uset);
5962         __isl_give isl_union_map *isl_union_map_polyhedral_hull(
5963                 __isl_take isl_union_map *umap);
5965 These functions compute a single basic set or relation
5966 not involving any existentially quantified variables
5967 that contains the whole input set or relation.
5968 In case of union sets and relations, the polyhedral hull is computed
5969 per space.
5971 =item * Box hull
5973         #include <isl/set.h>
5974         __isl_give isl_fixed_box *
5975         isl_set_get_simple_fixed_box_hull(
5976                 __isl_keep isl_set *set)
5978         #include <isl/map.h>
5979         __isl_give isl_fixed_box *
5980         isl_map_get_range_simple_fixed_box_hull(
5981                 __isl_keep isl_map *map);
5983 These functions try to approximate the set or
5984 the range of the map by a box of fixed size.
5985 The box is described in terms of an offset living in the same space as
5986 the input and a size living in the set or range space.  For any element
5987 in the input map, the range value is greater than or equal to
5988 the offset applied to the domain value and the difference with
5989 this offset is strictly smaller than the size.
5990 The same holds for the elements of the input set, where
5991 the offset is a parametric constant value.
5992 If no fixed-size approximation can be found,
5993 an I<invalid> box is returned, i.e., one for which
5994 C<isl_fixed_box_is_valid> below returns false.
5996 The validity, the offset and the size of the box can be obtained using
5997 the following functions.
5999         #include <isl/fixed_box.h>
6000         isl_bool isl_fixed_box_is_valid(
6001                 __isl_keep isl_fixed_box *box);
6002         __isl_give isl_multi_aff *isl_fixed_box_get_offset(
6003                 __isl_keep isl_fixed_box *box);
6004         __isl_give isl_multi_val *isl_fixed_box_get_size(
6005                 __isl_keep isl_fixed_box *box);
6007 The box can be copied and freed using the following functions.
6009         #include <isl/fixed_box.h>
6010         __isl_give isl_fixed_box *isl_fixed_box_copy(
6011                 __isl_keep isl_fixed_box *box);
6012         __isl_null isl_fixed_box *isl_fixed_box_free(
6013                 __isl_take isl_fixed_box *box);
6015 A representation of the information contained in an object
6016 of type C<isl_fixed_box> can be obtained using
6018         #include <isl/fixed_box.h>
6019         __isl_give isl_printer *isl_printer_print_fixed_box(
6020                 __isl_take isl_printer *p,
6021                 __isl_keep isl_fixed_box *box);
6022         __isl_give char *isl_fixed_box_to_str(
6023                 __isl_keep isl_fixed_box *box);
6025 C<isl_fixed_box_to_str> prints the information in flow format.
6027 =item * Other approximations
6029         #include <isl/set.h>
6030         __isl_give isl_basic_set *
6031         isl_basic_set_drop_constraints_involving_dims(
6032                 __isl_take isl_basic_set *bset,
6033                 enum isl_dim_type type,
6034                 unsigned first, unsigned n);
6035         __isl_give isl_basic_set *
6036         isl_basic_set_drop_constraints_not_involving_dims(
6037                 __isl_take isl_basic_set *bset,
6038                 enum isl_dim_type type,
6039                 unsigned first, unsigned n);
6040         __isl_give isl_set *
6041         isl_set_drop_constraints_involving_dims(
6042                 __isl_take isl_set *set,
6043                 enum isl_dim_type type,
6044                 unsigned first, unsigned n);
6045         __isl_give isl_set *
6046         isl_set_drop_constraints_not_involving_dims(
6047                 __isl_take isl_set *set,
6048                 enum isl_dim_type type,
6049                 unsigned first, unsigned n);
6051         #include <isl/map.h>
6052         __isl_give isl_basic_map *
6053         isl_basic_map_drop_constraints_involving_dims(
6054                 __isl_take isl_basic_map *bmap,
6055                 enum isl_dim_type type,
6056                 unsigned first, unsigned n);
6057         __isl_give isl_basic_map *
6058         isl_basic_map_drop_constraints_not_involving_dims(
6059                 __isl_take isl_basic_map *bmap,
6060                 enum isl_dim_type type,
6061                 unsigned first, unsigned n);
6062         __isl_give isl_map *
6063         isl_map_drop_constraints_involving_dims(
6064                 __isl_take isl_map *map,
6065                 enum isl_dim_type type,
6066                 unsigned first, unsigned n);
6067         __isl_give isl_map *
6068         isl_map_drop_constraints_not_involving_dims(
6069                 __isl_take isl_map *map,
6070                 enum isl_dim_type type,
6071                 unsigned first, unsigned n);
6073 These functions drop any constraints (not) involving the specified dimensions.
6074 Note that the result depends on the representation of the input.
6076         #include <isl/polynomial.h>
6077         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
6078                 __isl_take isl_pw_qpolynomial *pwqp, int sign);
6079         __isl_give isl_union_pw_qpolynomial *
6080         isl_union_pw_qpolynomial_to_polynomial(
6081                 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
6083 Approximate each quasipolynomial by a polynomial.  If C<sign> is positive,
6084 the polynomial will be an overapproximation.  If C<sign> is negative,
6085 it will be an underapproximation.  If C<sign> is zero, the approximation
6086 will lie somewhere in between.
6088 =item * Feasibility
6090         __isl_give isl_basic_set *isl_basic_set_sample(
6091                 __isl_take isl_basic_set *bset);
6092         __isl_give isl_basic_set *isl_set_sample(
6093                 __isl_take isl_set *set);
6094         __isl_give isl_basic_map *isl_basic_map_sample(
6095                 __isl_take isl_basic_map *bmap);
6096         __isl_give isl_basic_map *isl_map_sample(
6097                 __isl_take isl_map *map);
6099 If the input (basic) set or relation is non-empty, then return
6100 a singleton subset of the input.  Otherwise, return an empty set.
6102 =item * Optimization
6104         #include <isl/ilp.h>
6105         __isl_give isl_val *isl_basic_set_max_val(
6106                 __isl_keep isl_basic_set *bset,
6107                 __isl_keep isl_aff *obj);
6108         __isl_give isl_val *isl_set_min_val(
6109                 __isl_keep isl_set *set,
6110                 __isl_keep isl_aff *obj);
6111         __isl_give isl_val *isl_set_max_val(
6112                 __isl_keep isl_set *set,
6113                 __isl_keep isl_aff *obj);
6114         __isl_give isl_multi_val *
6115         isl_union_set_min_multi_union_pw_aff(
6116                 __isl_keep isl_union_set *uset,
6117                 __isl_keep isl_multi_union_pw_aff *obj);
6119 Compute the minimum or maximum of the integer affine expression C<obj>
6120 over the points in C<set>.
6121 The result is C<NULL> in case of an error, the optimal value in case
6122 there is one, negative infinity or infinity if the problem is unbounded and
6123 NaN if the problem is empty.
6125         #include <isl/ilp.h>
6126         __isl_give isl_multi_val *
6127         isl_pw_multi_aff_min_multi_val(
6128                 __isl_take isl_pw_multi_aff *pma);
6129         __isl_give isl_multi_val *
6130         isl_pw_multi_aff_max_multi_val(
6131                 __isl_take isl_pw_multi_aff *pma);
6132         __isl_give isl_multi_val *
6133         isl_multi_pw_aff_min_multi_val(
6134                 __isl_take isl_multi_pw_aff *mpa);
6135         __isl_give isl_multi_val *
6136         isl_multi_pw_aff_max_multi_val(
6137                 __isl_take isl_multi_pw_aff *mpa);
6138         __isl_give isl_val *isl_union_pw_aff_min_val(
6139                 __isl_take isl_union_pw_aff *upa);
6140         __isl_give isl_val *isl_union_pw_aff_max_val(
6141                 __isl_take isl_union_pw_aff *upa);
6142         __isl_give isl_multi_val *
6143         isl_multi_union_pw_aff_min_multi_val(
6144                 __isl_take isl_multi_union_pw_aff *mupa);
6145         __isl_give isl_multi_val *
6146         isl_multi_union_pw_aff_max_multi_val(
6147                 __isl_take isl_multi_union_pw_aff *mupa);
6149 Compute the minimum or maximum of the integer affine expression
6150 over its definition domain.
6151 The result is C<NULL> in case of an error, the optimal value in case
6152 there is one, negative infinity or infinity if the problem is unbounded and
6153 NaN if the problem is empty.
6155         #include <isl/ilp.h>
6156         __isl_give isl_val *isl_basic_set_dim_max_val(
6157                 __isl_take isl_basic_set *bset, int pos);
6158         __isl_give isl_val *isl_set_dim_min_val(
6159                 __isl_take isl_set *set, int pos);
6160         __isl_give isl_val *isl_set_dim_max_val(
6161                 __isl_take isl_set *set, int pos);
6163 Return the minimal or maximal value attained by the given set dimension,
6164 independently of the parameter values and of any other dimensions.
6165 The result is C<NULL> in case of an error, the optimal value in case
6166 there is one, (negative) infinity if the problem is unbounded and
6167 NaN if the input is empty.
6169 =item * Parametric optimization
6171         __isl_give isl_pw_aff *isl_set_dim_min(
6172                 __isl_take isl_set *set, int pos);
6173         __isl_give isl_pw_aff *isl_set_dim_max(
6174                 __isl_take isl_set *set, int pos);
6175         __isl_give isl_pw_aff *isl_map_dim_min(
6176                 __isl_take isl_map *map, int pos);
6177         __isl_give isl_pw_aff *isl_map_dim_max(
6178                 __isl_take isl_map *map, int pos);
6179         __isl_give isl_multi_pw_aff *
6180         isl_set_min_multi_pw_aff(
6181                 __isl_take isl_set *set);
6182         __isl_give isl_multi_pw_aff *
6183         isl_set_max_multi_pw_aff(
6184                 __isl_take isl_set *set);
6185         __isl_give isl_multi_pw_aff *
6186         isl_map_min_multi_pw_aff(
6187                 __isl_take isl_map *map);
6188         __isl_give isl_multi_pw_aff *
6189         isl_map_max_multi_pw_aff(
6190                 __isl_take isl_map *map);
6192 Compute the minimum or maximum of the (given) set or output dimension(s)
6193 as a function of the parameters (and input dimensions), but independently
6194 of the other set or output dimensions.
6195 For lexicographic optimization, see L<"Lexicographic Optimization">.
6197 =item * Dual
6199 The following functions compute either the set of (rational) coefficient
6200 values of valid constraints for the given set or the set of (rational)
6201 values satisfying the constraints with coefficients from the given set.
6202 Internally, these two sets of functions perform essentially the
6203 same operations, except that the set of coefficients is assumed to
6204 be a cone, while the set of values may be any polyhedron.
6205 The current implementation is based on the Farkas lemma and
6206 Fourier-Motzkin elimination, but this may change or be made optional
6207 in future.  In particular, future implementations may use different
6208 dualization algorithms or skip the elimination step.
6210         #include <isl/set.h>
6211         __isl_give isl_basic_set *isl_basic_set_coefficients(
6212                 __isl_take isl_basic_set *bset);
6213         __isl_give isl_basic_set_list *
6214         isl_basic_set_list_coefficients(
6215                 __isl_take isl_basic_set_list *list);
6216         __isl_give isl_basic_set *isl_set_coefficients(
6217                 __isl_take isl_set *set);
6218         __isl_give isl_union_set *isl_union_set_coefficients(
6219                 __isl_take isl_union_set *bset);
6220         __isl_give isl_basic_set *isl_basic_set_solutions(
6221                 __isl_take isl_basic_set *bset);
6222         __isl_give isl_basic_set *isl_set_solutions(
6223                 __isl_take isl_set *set);
6224         __isl_give isl_union_set *isl_union_set_solutions(
6225                 __isl_take isl_union_set *bset);
6227 =item * Power
6229         __isl_give isl_map *isl_map_fixed_power_val(
6230                 __isl_take isl_map *map,
6231                 __isl_take isl_val *exp);
6232         __isl_give isl_union_map *
6233         isl_union_map_fixed_power_val(
6234                 __isl_take isl_union_map *umap,
6235                 __isl_take isl_val *exp);
6237 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
6238 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
6239 of C<map> is computed.
6241         __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
6242                 isl_bool *exact);
6243         __isl_give isl_union_map *isl_union_map_power(
6244                 __isl_take isl_union_map *umap, isl_bool *exact);
6246 Compute a parametric representation for all positive powers I<k> of C<map>.
6247 The result maps I<k> to a nested relation corresponding to the
6248 I<k>th power of C<map>.
6249 The result may be an overapproximation.  If the result is known to be exact,
6250 then C<*exact> is set to C<1>.
6252 =item * Transitive closure
6254         __isl_give isl_map *isl_map_transitive_closure(
6255                 __isl_take isl_map *map, isl_bool *exact);
6256         __isl_give isl_union_map *isl_union_map_transitive_closure(
6257                 __isl_take isl_union_map *umap, isl_bool *exact);
6259 Compute the transitive closure of C<map>.
6260 The result may be an overapproximation.  If the result is known to be exact,
6261 then C<*exact> is set to C<1>.
6263 =item * Reaching path lengths
6265         __isl_give isl_map *isl_map_reaching_path_lengths(
6266                 __isl_take isl_map *map, isl_bool *exact);
6268 Compute a relation that maps each element in the range of C<map>
6269 to the lengths of all paths composed of edges in C<map> that
6270 end up in the given element.
6271 The result may be an overapproximation.  If the result is known to be exact,
6272 then C<*exact> is set to C<1>.
6273 To compute the I<maximal> path length, the resulting relation
6274 should be postprocessed by C<isl_map_lexmax>.
6275 In particular, if the input relation is a dependence relation
6276 (mapping sources to sinks), then the maximal path length corresponds
6277 to the free schedule.
6278 Note, however, that C<isl_map_lexmax> expects the maximum to be
6279 finite, so if the path lengths are unbounded (possibly due to
6280 the overapproximation), then you will get an error message.
6282 =item * Wrapping
6284         #include <isl/space.h>
6285         __isl_give isl_space *isl_space_wrap(
6286                 __isl_take isl_space *space);
6287         __isl_give isl_space *isl_space_unwrap(
6288                 __isl_take isl_space *space);
6290         #include <isl/local_space.h>
6291         __isl_give isl_local_space *isl_local_space_wrap(
6292                 __isl_take isl_local_space *ls);
6294         #include <isl/set.h>
6295         __isl_give isl_basic_map *isl_basic_set_unwrap(
6296                 __isl_take isl_basic_set *bset);
6297         __isl_give isl_map *isl_set_unwrap(
6298                 __isl_take isl_set *set);
6300         #include <isl/map.h>
6301         __isl_give isl_basic_set *isl_basic_map_wrap(
6302                 __isl_take isl_basic_map *bmap);
6303         __isl_give isl_set *isl_map_wrap(
6304                 __isl_take isl_map *map);
6306         #include <isl/union_set.h>
6307         __isl_give isl_union_map *isl_union_set_unwrap(
6308                 __isl_take isl_union_set *uset);
6310         #include <isl/union_map.h>
6311         __isl_give isl_union_set *isl_union_map_wrap(
6312                 __isl_take isl_union_map *umap);
6314 The input to C<isl_space_unwrap> should
6315 be the space of a set, while that of
6316 C<isl_space_wrap> should be the space of a relation.
6317 Conversely, the output of C<isl_space_unwrap> is the space
6318 of a relation, while that of C<isl_space_wrap> is the space of a set.
6320 =item * Flattening
6322 Remove any internal structure of domain (and range) of the given
6323 set or relation.  If there is any such internal structure in the input,
6324 then the name of the space is also removed.
6326         #include <isl/space.h>
6327         __isl_give isl_space *isl_space_flatten_domain(
6328                 __isl_take isl_space *space);
6329         __isl_give isl_space *isl_space_flatten_range(
6330                 __isl_take isl_space *space);
6332         #include <isl/local_space.h>
6333         __isl_give isl_local_space *
6334         isl_local_space_flatten_domain(
6335                 __isl_take isl_local_space *ls);
6336         __isl_give isl_local_space *
6337         isl_local_space_flatten_range(
6338                 __isl_take isl_local_space *ls);
6340         #include <isl/set.h>
6341         __isl_give isl_basic_set *isl_basic_set_flatten(
6342                 __isl_take isl_basic_set *bset);
6343         __isl_give isl_set *isl_set_flatten(
6344                 __isl_take isl_set *set);
6346         #include <isl/map.h>
6347         __isl_give isl_basic_map *isl_basic_map_flatten_domain(
6348                 __isl_take isl_basic_map *bmap);
6349         __isl_give isl_basic_map *isl_basic_map_flatten_range(
6350                 __isl_take isl_basic_map *bmap);
6351         __isl_give isl_map *isl_map_flatten_range(
6352                 __isl_take isl_map *map);
6353         __isl_give isl_map *isl_map_flatten_domain(
6354                 __isl_take isl_map *map);
6355         __isl_give isl_basic_map *isl_basic_map_flatten(
6356                 __isl_take isl_basic_map *bmap);
6357         __isl_give isl_map *isl_map_flatten(
6358                 __isl_take isl_map *map);
6360         #include <isl/id.h>
6361         __isl_give isl_multi_id *isl_multi_id_flatten_range(
6362                 __isl_take isl_multi_id *mi);
6364         #include <isl/val.h>
6365         __isl_give isl_multi_val *isl_multi_val_flatten_range(
6366                 __isl_take isl_multi_val *mv);
6368         #include <isl/aff.h>
6369         __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
6370                 __isl_take isl_multi_aff *ma);
6371         __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
6372                 __isl_take isl_multi_aff *ma);
6373         __isl_give isl_multi_pw_aff *
6374         isl_multi_pw_aff_flatten_range(
6375                 __isl_take isl_multi_pw_aff *mpa);
6376         __isl_give isl_multi_union_pw_aff *
6377         isl_multi_union_pw_aff_flatten_range(
6378                 __isl_take isl_multi_union_pw_aff *mupa);
6380         #include <isl/map.h>
6381         __isl_give isl_map *isl_set_flatten_map(
6382                 __isl_take isl_set *set);
6384 The function above constructs a relation
6385 that maps the input set to a flattened version of the set.
6387 =item * Lifting
6389 Lift the input set to a space with extra dimensions corresponding
6390 to the existentially quantified variables in the input.
6391 In particular, the result lives in a wrapped map where the domain
6392 is the original space and the range corresponds to the original
6393 existentially quantified variables.
6395         #include <isl/set.h>
6396         __isl_give isl_basic_set *isl_basic_set_lift(
6397                 __isl_take isl_basic_set *bset);
6398         __isl_give isl_set *isl_set_lift(
6399                 __isl_take isl_set *set);
6400         __isl_give isl_union_set *isl_union_set_lift(
6401                 __isl_take isl_union_set *uset);
6403 Given a local space that contains the existentially quantified
6404 variables of a set, a basic relation that, when applied to
6405 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
6406 can be constructed using the following function.
6408         #include <isl/local_space.h>
6409         __isl_give isl_basic_map *isl_local_space_lifting(
6410                 __isl_take isl_local_space *ls);
6412         #include <isl/aff.h>
6413         __isl_give isl_multi_aff *isl_multi_aff_lift(
6414                 __isl_take isl_multi_aff *maff,
6415                 __isl_give isl_local_space **ls);
6417 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
6418 then it is assigned the local space that lies at the basis of
6419 the lifting applied.
6421 =item * Internal Product
6423         #include <isl/space.h>
6424         __isl_give isl_space *isl_space_zip(
6425                 __isl_take isl_space *space);
6427         #include <isl/map.h>
6428         __isl_give isl_basic_map *isl_basic_map_zip(
6429                 __isl_take isl_basic_map *bmap);
6430         __isl_give isl_map *isl_map_zip(
6431                 __isl_take isl_map *map);
6433         #include <isl/union_map.h>
6434         __isl_give isl_union_map *isl_union_map_zip(
6435                 __isl_take isl_union_map *umap);
6437 Given a relation with nested relations for domain and range,
6438 interchange the range of the domain with the domain of the range.
6440 =item * Currying
6442         #include <isl/space.h>
6443         __isl_give isl_space *isl_space_curry(
6444                 __isl_take isl_space *space);
6445         __isl_give isl_space *isl_space_uncurry(
6446                 __isl_take isl_space *space);
6448         #include <isl/map.h>
6449         __isl_give isl_basic_map *isl_basic_map_curry(
6450                 __isl_take isl_basic_map *bmap);
6451         __isl_give isl_basic_map *isl_basic_map_uncurry(
6452                 __isl_take isl_basic_map *bmap);
6453         __isl_give isl_map *isl_map_curry(
6454                 __isl_take isl_map *map);
6455         __isl_give isl_map *isl_map_uncurry(
6456                 __isl_take isl_map *map);
6458         #include <isl/union_map.h>
6459         __isl_give isl_union_map *isl_union_map_curry(
6460                 __isl_take isl_union_map *umap);
6461         __isl_give isl_union_map *isl_union_map_uncurry(
6462                 __isl_take isl_union_map *umap);
6464 Given a relation with a nested relation for domain,
6465 the C<curry> functions
6466 move the range of the nested relation out of the domain
6467 and use it as the domain of a nested relation in the range,
6468 with the original range as range of this nested relation.
6469 The C<uncurry> functions perform the inverse operation.
6471         #include <isl/space.h>
6472         __isl_give isl_space *isl_space_range_curry(
6473                 __isl_take isl_space *space);
6475         #include <isl/map.h>
6476         __isl_give isl_map *isl_map_range_curry(
6477                 __isl_take isl_map *map);
6479         #include <isl/union_map.h>
6480         __isl_give isl_union_map *isl_union_map_range_curry(
6481                 __isl_take isl_union_map *umap);
6483 These functions apply the currying to the relation that
6484 is nested inside the range of the input.
6486 =item * Aligning parameters
6488 Change the order of the parameters of the given set, relation
6489 or function
6490 such that the first parameters match those of C<model>.
6491 This may involve the introduction of extra parameters.
6492 All parameters need to be named.
6494         #include <isl/space.h>
6495         __isl_give isl_space *isl_space_align_params(
6496                 __isl_take isl_space *space1,
6497                 __isl_take isl_space *space2)
6499         #include <isl/set.h>
6500         __isl_give isl_basic_set *isl_basic_set_align_params(
6501                 __isl_take isl_basic_set *bset,
6502                 __isl_take isl_space *model);
6503         __isl_give isl_set *isl_set_align_params(
6504                 __isl_take isl_set *set,
6505                 __isl_take isl_space *model);
6507         #include <isl/map.h>
6508         __isl_give isl_basic_map *isl_basic_map_align_params(
6509                 __isl_take isl_basic_map *bmap,
6510                 __isl_take isl_space *model);
6511         __isl_give isl_map *isl_map_align_params(
6512                 __isl_take isl_map *map,
6513                 __isl_take isl_space *model);
6515         #include <isl/id.h>
6516         __isl_give isl_multi_id *isl_multi_id_align_params(
6517                 __isl_take isl_multi_id *mi,
6518                 __isl_take isl_space *model);
6520         #include <isl/val.h>
6521         __isl_give isl_multi_val *isl_multi_val_align_params(
6522                 __isl_take isl_multi_val *mv,
6523                 __isl_take isl_space *model);
6525         #include <isl/aff.h>
6526         __isl_give isl_aff *isl_aff_align_params(
6527                 __isl_take isl_aff *aff,
6528                 __isl_take isl_space *model);
6529         __isl_give isl_multi_aff *isl_multi_aff_align_params(
6530                 __isl_take isl_multi_aff *multi,
6531                 __isl_take isl_space *model);
6532         __isl_give isl_pw_aff *isl_pw_aff_align_params(
6533                 __isl_take isl_pw_aff *pwaff,
6534                 __isl_take isl_space *model);
6535         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
6536                 __isl_take isl_pw_multi_aff *pma,
6537                 __isl_take isl_space *model);
6538         __isl_give isl_union_pw_aff *
6539         isl_union_pw_aff_align_params(
6540                 __isl_take isl_union_pw_aff *upa,
6541                 __isl_take isl_space *model);
6542         __isl_give isl_union_pw_multi_aff *
6543         isl_union_pw_multi_aff_align_params(
6544                 __isl_take isl_union_pw_multi_aff *upma,
6545                 __isl_take isl_space *model);
6546         __isl_give isl_multi_union_pw_aff *
6547         isl_multi_union_pw_aff_align_params(
6548                 __isl_take isl_multi_union_pw_aff *mupa,
6549                 __isl_take isl_space *model);
6551         #include <isl/polynomial.h>
6552         __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
6553                 __isl_take isl_qpolynomial *qp,
6554                 __isl_take isl_space *model);
6556 =item * Drop unused parameters
6558 Drop parameters that are not referenced by the isl object.
6559 All parameters need to be named.
6561         #include <isl/set.h>
6562         __isl_give isl_basic_set *
6563         isl_basic_set_drop_unused_params(
6564                 __isl_take isl_basic_set *bset);
6565         __isl_give isl_set *isl_set_drop_unused_params(
6566                 __isl_take isl_set *set);
6568         #include <isl/map.h>
6569         __isl_give isl_basic_map *
6570         isl_basic_map_drop_unused_params(
6571                 __isl_take isl_basic_map *bmap);
6572         __isl_give isl_map *isl_map_drop_unused_params(
6573                 __isl_take isl_map *map);
6575         #include <isl/aff.h>
6576         __isl_give isl_pw_aff *isl_pw_aff_drop_unused_params(
6577                 __isl_take isl_pw_aff *pa);
6578         __isl_give isl_pw_multi_aff *
6579         isl_pw_multi_aff_drop_unused_params(
6580                 __isl_take isl_pw_multi_aff *pma);
6582         #include <isl/polynomial.h>
6583         __isl_give isl_pw_qpolynomial *
6584         isl_pw_qpolynomial_drop_unused_params(
6585                 __isl_take isl_pw_qpolynomial *pwqp);
6586         __isl_give isl_pw_qpolynomial_fold *
6587         isl_pw_qpolynomial_fold_drop_unused_params(
6588                 __isl_take isl_pw_qpolynomial_fold *pwf);
6590 =item * Unary Arithmetic Operations
6592         #include <isl/set.h>
6593         __isl_give isl_set *isl_set_neg(
6594                 __isl_take isl_set *set);
6595         #include <isl/map.h>
6596         __isl_give isl_map *isl_map_neg(
6597                 __isl_take isl_map *map);
6599 C<isl_set_neg> constructs a set containing the opposites of
6600 the elements in its argument.
6601 The domain of the result of C<isl_map_neg> is the same
6602 as the domain of its argument.  The corresponding range
6603 elements are the opposites of the corresponding range
6604 elements in the argument.
6606         #include <isl/val.h>
6607         __isl_give isl_multi_val *isl_multi_val_neg(
6608                 __isl_take isl_multi_val *mv);
6610         #include <isl/aff.h>
6611         __isl_give isl_aff *isl_aff_neg(
6612                 __isl_take isl_aff *aff);
6613         __isl_give isl_multi_aff *isl_multi_aff_neg(
6614                 __isl_take isl_multi_aff *ma);
6615         __isl_give isl_pw_aff *isl_pw_aff_neg(
6616                 __isl_take isl_pw_aff *pwaff);
6617         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
6618                 __isl_take isl_pw_multi_aff *pma);
6619         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
6620                 __isl_take isl_multi_pw_aff *mpa);
6621         __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
6622                 __isl_take isl_union_pw_aff *upa);
6623         __isl_give isl_union_pw_multi_aff *
6624         isl_union_pw_multi_aff_neg(
6625                 __isl_take isl_union_pw_multi_aff *upma);
6626         __isl_give isl_multi_union_pw_aff *
6627         isl_multi_union_pw_aff_neg(
6628                 __isl_take isl_multi_union_pw_aff *mupa);
6629         __isl_give isl_aff *isl_aff_ceil(
6630                 __isl_take isl_aff *aff);
6631         __isl_give isl_pw_aff *isl_pw_aff_ceil(
6632                 __isl_take isl_pw_aff *pwaff);
6633         __isl_give isl_aff *isl_aff_floor(
6634                 __isl_take isl_aff *aff);
6635         __isl_give isl_multi_aff *isl_multi_aff_floor(
6636                 __isl_take isl_multi_aff *ma);
6637         __isl_give isl_pw_aff *isl_pw_aff_floor(
6638                 __isl_take isl_pw_aff *pwaff);
6639         __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
6640                 __isl_take isl_union_pw_aff *upa);
6641         __isl_give isl_multi_union_pw_aff *
6642         isl_multi_union_pw_aff_floor(
6643                 __isl_take isl_multi_union_pw_aff *mupa);
6645         #include <isl/aff.h>
6646         __isl_give isl_pw_aff *isl_pw_aff_list_min(
6647                 __isl_take isl_pw_aff_list *list);
6648         __isl_give isl_pw_aff *isl_pw_aff_list_max(
6649                 __isl_take isl_pw_aff_list *list);
6651         #include <isl/polynomial.h>
6652         __isl_give isl_qpolynomial *isl_qpolynomial_neg(
6653                 __isl_take isl_qpolynomial *qp);
6654         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
6655                 __isl_take isl_pw_qpolynomial *pwqp);
6656         __isl_give isl_union_pw_qpolynomial *
6657         isl_union_pw_qpolynomial_neg(
6658                 __isl_take isl_union_pw_qpolynomial *upwqp);
6659         __isl_give isl_qpolynomial *isl_qpolynomial_pow(
6660                 __isl_take isl_qpolynomial *qp,
6661                 unsigned exponent);
6662         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
6663                 __isl_take isl_pw_qpolynomial *pwqp,
6664                 unsigned exponent);
6666 =item * Evaluation
6668 The following functions evaluate a function in a point.
6670         #include <isl/aff.h>
6671         __isl_give isl_val *isl_aff_eval(
6672                 __isl_take isl_aff *aff,
6673                 __isl_take isl_point *pnt);
6674         __isl_give isl_val *isl_pw_aff_eval(
6675                 __isl_take isl_pw_aff *pa,
6676                 __isl_take isl_point *pnt);
6678         #include <isl/polynomial.h>
6679         __isl_give isl_val *isl_pw_qpolynomial_eval(
6680                 __isl_take isl_pw_qpolynomial *pwqp,
6681                 __isl_take isl_point *pnt);
6682         __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
6683                 __isl_take isl_pw_qpolynomial_fold *pwf,
6684                 __isl_take isl_point *pnt);
6685         __isl_give isl_val *isl_union_pw_qpolynomial_eval(
6686                 __isl_take isl_union_pw_qpolynomial *upwqp,
6687                 __isl_take isl_point *pnt);
6688         __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
6689                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6690                 __isl_take isl_point *pnt);
6692 These functions return NaN when evaluated at a void point.
6693 Note that C<isl_pw_aff_eval> returns NaN when the function is evaluated outside
6694 its definition domain, while C<isl_pw_qpolynomial_eval> returns zero
6695 when the function is evaluated outside its explicit domain.
6697 =item * Dimension manipulation
6699 It is usually not advisable to directly change the (input or output)
6700 space of a set or a relation as this removes the name and the internal
6701 structure of the space.  However, the functions below can be useful
6702 to add new parameters, assuming
6703 C<isl_set_align_params> and C<isl_map_align_params>
6704 are not sufficient.
6706         #include <isl/space.h>
6707         __isl_give isl_space *isl_space_add_dims(
6708                 __isl_take isl_space *space,
6709                 enum isl_dim_type type, unsigned n);
6710         __isl_give isl_space *isl_space_insert_dims(
6711                 __isl_take isl_space *space,
6712                 enum isl_dim_type type, unsigned pos, unsigned n);
6713         __isl_give isl_space *isl_space_drop_dims(
6714                 __isl_take isl_space *space,
6715                 enum isl_dim_type type, unsigned first, unsigned n);
6716         __isl_give isl_space *isl_space_move_dims(
6717                 __isl_take isl_space *space,
6718                 enum isl_dim_type dst_type, unsigned dst_pos,
6719                 enum isl_dim_type src_type, unsigned src_pos,
6720                 unsigned n);
6722         #include <isl/local_space.h>
6723         __isl_give isl_local_space *isl_local_space_add_dims(
6724                 __isl_take isl_local_space *ls,
6725                 enum isl_dim_type type, unsigned n);
6726         __isl_give isl_local_space *isl_local_space_insert_dims(
6727                 __isl_take isl_local_space *ls,
6728                 enum isl_dim_type type, unsigned first, unsigned n);
6729         __isl_give isl_local_space *isl_local_space_drop_dims(
6730                 __isl_take isl_local_space *ls,
6731                 enum isl_dim_type type, unsigned first, unsigned n);
6733         #include <isl/set.h>
6734         __isl_give isl_basic_set *isl_basic_set_add_dims(
6735                 __isl_take isl_basic_set *bset,
6736                 enum isl_dim_type type, unsigned n);
6737         __isl_give isl_set *isl_set_add_dims(
6738                 __isl_take isl_set *set,
6739                 enum isl_dim_type type, unsigned n);
6740         __isl_give isl_basic_set *isl_basic_set_insert_dims(
6741                 __isl_take isl_basic_set *bset,
6742                 enum isl_dim_type type, unsigned pos,
6743                 unsigned n);
6744         __isl_give isl_set *isl_set_insert_dims(
6745                 __isl_take isl_set *set,
6746                 enum isl_dim_type type, unsigned pos, unsigned n);
6747         __isl_give isl_basic_set *isl_basic_set_move_dims(
6748                 __isl_take isl_basic_set *bset,
6749                 enum isl_dim_type dst_type, unsigned dst_pos,
6750                 enum isl_dim_type src_type, unsigned src_pos,
6751                 unsigned n);
6752         __isl_give isl_set *isl_set_move_dims(
6753                 __isl_take isl_set *set,
6754                 enum isl_dim_type dst_type, unsigned dst_pos,
6755                 enum isl_dim_type src_type, unsigned src_pos,
6756                 unsigned n);
6758         #include <isl/map.h>
6759         __isl_give isl_basic_map *isl_basic_map_add_dims(
6760                 __isl_take isl_basic_map *bmap,
6761                 enum isl_dim_type type, unsigned n);
6762         __isl_give isl_map *isl_map_add_dims(
6763                 __isl_take isl_map *map,
6764                 enum isl_dim_type type, unsigned n);
6765         __isl_give isl_basic_map *isl_basic_map_insert_dims(
6766                 __isl_take isl_basic_map *bmap,
6767                 enum isl_dim_type type, unsigned pos,
6768                 unsigned n);
6769         __isl_give isl_map *isl_map_insert_dims(
6770                 __isl_take isl_map *map,
6771                 enum isl_dim_type type, unsigned pos, unsigned n);
6772         __isl_give isl_basic_map *isl_basic_map_move_dims(
6773                 __isl_take isl_basic_map *bmap,
6774                 enum isl_dim_type dst_type, unsigned dst_pos,
6775                 enum isl_dim_type src_type, unsigned src_pos,
6776                 unsigned n);
6777         __isl_give isl_map *isl_map_move_dims(
6778                 __isl_take isl_map *map,
6779                 enum isl_dim_type dst_type, unsigned dst_pos,
6780                 enum isl_dim_type src_type, unsigned src_pos,
6781                 unsigned n);
6783         #include <isl/val.h>
6784         __isl_give isl_multi_val *isl_multi_val_insert_dims(
6785                 __isl_take isl_multi_val *mv,
6786                 enum isl_dim_type type, unsigned first, unsigned n);
6787         __isl_give isl_multi_val *isl_multi_val_add_dims(
6788                 __isl_take isl_multi_val *mv,
6789                 enum isl_dim_type type, unsigned n);
6790         __isl_give isl_multi_val *isl_multi_val_drop_dims(
6791                 __isl_take isl_multi_val *mv,
6792                 enum isl_dim_type type, unsigned first, unsigned n);
6794         #include <isl/aff.h>
6795         __isl_give isl_aff *isl_aff_insert_dims(
6796                 __isl_take isl_aff *aff,
6797                 enum isl_dim_type type, unsigned first, unsigned n);
6798         __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
6799                 __isl_take isl_multi_aff *ma,
6800                 enum isl_dim_type type, unsigned first, unsigned n);
6801         __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
6802                 __isl_take isl_pw_aff *pwaff,
6803                 enum isl_dim_type type, unsigned first, unsigned n);
6804         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
6805                 __isl_take isl_multi_pw_aff *mpa,
6806                 enum isl_dim_type type, unsigned first, unsigned n);
6807         __isl_give isl_aff *isl_aff_add_dims(
6808                 __isl_take isl_aff *aff,
6809                 enum isl_dim_type type, unsigned n);
6810         __isl_give isl_multi_aff *isl_multi_aff_add_dims(
6811                 __isl_take isl_multi_aff *ma,
6812                 enum isl_dim_type type, unsigned n);
6813         __isl_give isl_pw_aff *isl_pw_aff_add_dims(
6814                 __isl_take isl_pw_aff *pwaff,
6815                 enum isl_dim_type type, unsigned n);
6816         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
6817                 __isl_take isl_multi_pw_aff *mpa,
6818                 enum isl_dim_type type, unsigned n);
6819         __isl_give isl_aff *isl_aff_drop_dims(
6820                 __isl_take isl_aff *aff,
6821                 enum isl_dim_type type, unsigned first, unsigned n);
6822         __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
6823                 __isl_take isl_multi_aff *maff,
6824                 enum isl_dim_type type, unsigned first, unsigned n);
6825         __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
6826                 __isl_take isl_pw_aff *pwaff,
6827                 enum isl_dim_type type, unsigned first, unsigned n);
6828         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
6829                 __isl_take isl_pw_multi_aff *pma,
6830                 enum isl_dim_type type, unsigned first, unsigned n);
6831         __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
6832                 __isl_take isl_union_pw_aff *upa,
6833                 enum isl_dim_type type, unsigned first, unsigned n);
6834         __isl_give isl_union_pw_multi_aff *
6835                 isl_union_pw_multi_aff_drop_dims(
6836                 __isl_take isl_union_pw_multi_aff *upma,
6837                 enum isl_dim_type type,
6838                 unsigned first, unsigned n);
6839         __isl_give isl_multi_union_pw_aff *
6840         isl_multi_union_pw_aff_drop_dims(
6841                 __isl_take isl_multi_union_pw_aff *mupa,
6842                 enum isl_dim_type type, unsigned first,
6843                 unsigned n);
6844         __isl_give isl_aff *isl_aff_move_dims(
6845                 __isl_take isl_aff *aff,
6846                 enum isl_dim_type dst_type, unsigned dst_pos,
6847                 enum isl_dim_type src_type, unsigned src_pos,
6848                 unsigned n);
6849         __isl_give isl_multi_aff *isl_multi_aff_move_dims(
6850                 __isl_take isl_multi_aff *ma,
6851                 enum isl_dim_type dst_type, unsigned dst_pos,
6852                 enum isl_dim_type src_type, unsigned src_pos,
6853                 unsigned n);
6854         __isl_give isl_pw_aff *isl_pw_aff_move_dims(
6855                 __isl_take isl_pw_aff *pa,
6856                 enum isl_dim_type dst_type, unsigned dst_pos,
6857                 enum isl_dim_type src_type, unsigned src_pos,
6858                 unsigned n);
6859         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
6860                 __isl_take isl_multi_pw_aff *pma,
6861                 enum isl_dim_type dst_type, unsigned dst_pos,
6862                 enum isl_dim_type src_type, unsigned src_pos,
6863                 unsigned n);
6865         #include <isl/polynomial.h>
6866         __isl_give isl_union_pw_qpolynomial *
6867         isl_union_pw_qpolynomial_drop_dims(
6868                 __isl_take isl_union_pw_qpolynomial *upwqp,
6869                 enum isl_dim_type type,
6870                 unsigned first, unsigned n);
6871         __isl_give isl_union_pw_qpolynomial_fold *
6872                 isl_union_pw_qpolynomial_fold_drop_dims(
6873                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6874                 enum isl_dim_type type,
6875                 unsigned first, unsigned n);
6877 The operations on union expressions can only manipulate parameters.
6879 =back
6881 =head2 Binary Operations
6883 The two arguments of a binary operation not only need to live
6884 in the same C<isl_ctx>, they currently also need to have
6885 the same (number of) parameters.
6887 =head3 Basic Operations
6889 =over
6891 =item * Intersection
6893         #include <isl/local_space.h>
6894         __isl_give isl_local_space *isl_local_space_intersect(
6895                 __isl_take isl_local_space *ls1,
6896                 __isl_take isl_local_space *ls2);
6898         #include <isl/set.h>
6899         __isl_give isl_basic_set *isl_basic_set_intersect_params(
6900                 __isl_take isl_basic_set *bset1,
6901                 __isl_take isl_basic_set *bset2);
6902         __isl_give isl_basic_set *isl_basic_set_intersect(
6903                 __isl_take isl_basic_set *bset1,
6904                 __isl_take isl_basic_set *bset2);
6905         __isl_give isl_basic_set *isl_basic_set_list_intersect(
6906                 __isl_take struct isl_basic_set_list *list);
6907         __isl_give isl_set *isl_set_intersect_params(
6908                 __isl_take isl_set *set,
6909                 __isl_take isl_set *params);
6910         __isl_give isl_set *isl_set_intersect(
6911                 __isl_take isl_set *set1,
6912                 __isl_take isl_set *set2);
6913         __isl_give isl_set *isl_set_intersect_factor_domain(
6914                 __isl_take isl_set *set,
6915                 __isl_take isl_set *domain);
6916         __isl_give isl_set *isl_set_intersect_factor_range(
6917                 __isl_take isl_set *set,
6918                 __isl_take isl_set *range);
6920         #include <isl/map.h>
6921         __isl_give isl_basic_map *isl_basic_map_intersect_domain(
6922                 __isl_take isl_basic_map *bmap,
6923                 __isl_take isl_basic_set *bset);
6924         __isl_give isl_basic_map *isl_basic_map_intersect_range(
6925                 __isl_take isl_basic_map *bmap,
6926                 __isl_take isl_basic_set *bset);
6927         __isl_give isl_basic_map *isl_basic_map_intersect(
6928                 __isl_take isl_basic_map *bmap1,
6929                 __isl_take isl_basic_map *bmap2);
6930         __isl_give isl_basic_map *isl_basic_map_list_intersect(
6931                 __isl_take isl_basic_map_list *list);
6932         __isl_give isl_map *isl_map_intersect_params(
6933                 __isl_take isl_map *map,
6934                 __isl_take isl_set *params);
6935         __isl_give isl_map *isl_map_intersect_domain(
6936                 __isl_take isl_map *map,
6937                 __isl_take isl_set *set);
6938         __isl_give isl_map *isl_map_intersect_range(
6939                 __isl_take isl_map *map,
6940                 __isl_take isl_set *set);
6941         __isl_give isl_map *isl_map_intersect(
6942                 __isl_take isl_map *map1,
6943                 __isl_take isl_map *map2);
6944         __isl_give isl_map *
6945         isl_map_intersect_domain_factor_range(
6946                 __isl_take isl_map *map,
6947                 __isl_take isl_map *factor);
6948         __isl_give isl_map *
6949         isl_map_intersect_range_factor_domain(
6950                 __isl_take isl_map *map,
6951                 __isl_take isl_map *factor);
6952         __isl_give isl_map *
6953         isl_map_intersect_range_factor_range(
6954                 __isl_take isl_map *map,
6955                 __isl_take isl_map *factor);
6957         #include <isl/union_set.h>
6958         __isl_give isl_union_set *isl_union_set_intersect_params(
6959                 __isl_take isl_union_set *uset,
6960                 __isl_take isl_set *set);
6961         __isl_give isl_union_set *isl_union_set_intersect(
6962                 __isl_take isl_union_set *uset1,
6963                 __isl_take isl_union_set *uset2);
6965         #include <isl/union_map.h>
6966         __isl_give isl_union_map *isl_union_map_intersect_params(
6967                 __isl_take isl_union_map *umap,
6968                 __isl_take isl_set *set);
6969         __isl_give isl_union_map *isl_union_map_intersect_domain(
6970                 __isl_take isl_union_map *umap,
6971                 __isl_take isl_union_set *uset);
6972         __isl_give isl_union_map *isl_union_map_intersect_range(
6973                 __isl_take isl_union_map *umap,
6974                 __isl_take isl_union_set *uset);
6975         __isl_give isl_union_map *isl_union_map_intersect(
6976                 __isl_take isl_union_map *umap1,
6977                 __isl_take isl_union_map *umap2);
6978         __isl_give isl_union_map *
6979         isl_union_map_intersect_domain_factor_range(
6980                 __isl_take isl_union_map *umap,
6981                 __isl_take isl_union_map *factor);
6982         __isl_give isl_union_map *
6983         isl_union_map_intersect_range_factor_domain(
6984                 __isl_take isl_union_map *umap,
6985                 __isl_take isl_union_map *factor);
6986         __isl_give isl_union_map *
6987         isl_union_map_intersect_range_factor_range(
6988                 __isl_take isl_union_map *umap,
6989                 __isl_take isl_union_map *factor);
6991         #include <isl/aff.h>
6992         __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
6993                 __isl_take isl_pw_aff *pa,
6994                 __isl_take isl_set *set);
6995         __isl_give isl_multi_pw_aff *
6996         isl_multi_pw_aff_intersect_domain(
6997                 __isl_take isl_multi_pw_aff *mpa,
6998                 __isl_take isl_set *domain);
6999         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
7000                 __isl_take isl_pw_multi_aff *pma,
7001                 __isl_take isl_set *set);
7002         __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
7003                 __isl_take isl_union_pw_aff *upa,
7004                 __isl_take isl_union_set *uset);
7005         __isl_give isl_union_pw_multi_aff *
7006         isl_union_pw_multi_aff_intersect_domain(
7007                 __isl_take isl_union_pw_multi_aff *upma,
7008                 __isl_take isl_union_set *uset);
7009         __isl_give isl_multi_union_pw_aff *
7010         isl_multi_union_pw_aff_intersect_domain(
7011                 __isl_take isl_multi_union_pw_aff *mupa,
7012                 __isl_take isl_union_set *uset);
7013         __isl_give isl_pw_aff *
7014         isl_pw_aff_intersect_domain_wrapped_domain(
7015                 __isl_take isl_pw_aff *pa,
7016                 __isl_take isl_set *set);
7017         __isl_give isl_pw_multi_aff *
7018         isl_pw_multi_aff_intersect_domain_wrapped_domain(
7019                 __isl_take isl_pw_multi_aff *pma,
7020                 __isl_take isl_set *set);
7021         __isl_give isl_union_pw_aff *
7022         isl_union_pw_aff_intersect_domain_wrapped_domain(
7023                 __isl_take isl_union_pw_aff *upa,
7024                 __isl_take isl_union_set *uset);
7025         __isl_give isl_union_pw_multi_aff *
7026         isl_union_pw_multi_aff_intersect_domain_wrapped_domain(
7027                 __isl_take isl_union_pw_multi_aff *upma,
7028                 __isl_take isl_union_set *uset);
7029         __isl_give isl_pw_aff *
7030         isl_pw_aff_intersect_domain_wrapped_range(
7031                 __isl_take isl_pw_aff *pa,
7032                 __isl_take isl_set *set);
7033         __isl_give isl_pw_multi_aff *
7034         isl_pw_multi_aff_intersect_domain_wrapped_range(
7035                 __isl_take isl_pw_multi_aff *pma,
7036                 __isl_take isl_set *set);
7037         __isl_give isl_union_pw_multi_aff *
7038         isl_union_pw_multi_aff_intersect_domain_wrapped_range(
7039                 __isl_take isl_union_pw_multi_aff *upma,
7040                 __isl_take isl_union_set *uset);
7041         __isl_give isl_union_pw_aff *
7042         isl_union_pw_aff_intersect_domain_wrapped_range(
7043                 __isl_take isl_union_pw_aff *upa,
7044                 __isl_take isl_union_set *uset);
7045         __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
7046                 __isl_take isl_pw_aff *pa,
7047                 __isl_take isl_set *set);
7048         __isl_give isl_multi_pw_aff *
7049         isl_multi_pw_aff_intersect_params(
7050                 __isl_take isl_multi_pw_aff *mpa,
7051                 __isl_take isl_set *set);
7052         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
7053                 __isl_take isl_pw_multi_aff *pma,
7054                 __isl_take isl_set *set);
7055         __isl_give isl_union_pw_aff *
7056         isl_union_pw_aff_intersect_params(
7057                 __isl_take isl_union_pw_aff *upa,
7058                 __isl_take isl_set *set);
7059         __isl_give isl_union_pw_multi_aff *
7060         isl_union_pw_multi_aff_intersect_params(
7061                 __isl_take isl_union_pw_multi_aff *upma,
7062                 __isl_take isl_set *set);
7063         __isl_give isl_multi_union_pw_aff *
7064         isl_multi_union_pw_aff_intersect_params(
7065                 __isl_take isl_multi_union_pw_aff *mupa,
7066                 __isl_take isl_set *params);
7067         __isl_give isl_multi_union_pw_aff *
7068         isl_multi_union_pw_aff_intersect_range(
7069                 __isl_take isl_multi_union_pw_aff *mupa,
7070                 __isl_take isl_set *set);
7072         #include <isl/polynomial.h>
7073         __isl_give isl_pw_qpolynomial *
7074         isl_pw_qpolynomial_intersect_domain(
7075                 __isl_take isl_pw_qpolynomial *pwpq,
7076                 __isl_take isl_set *set);
7077         __isl_give isl_union_pw_qpolynomial *
7078         isl_union_pw_qpolynomial_intersect_domain(
7079                 __isl_take isl_union_pw_qpolynomial *upwpq,
7080                 __isl_take isl_union_set *uset);
7081         __isl_give isl_union_pw_qpolynomial_fold *
7082         isl_union_pw_qpolynomial_fold_intersect_domain(
7083                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7084                 __isl_take isl_union_set *uset);
7085         __isl_give isl_pw_qpolynomial *
7086         isl_pw_qpolynomial_intersect_domain_wrapped_domain(
7087                 __isl_take isl_pw_qpolynomial *pwpq,
7088                 __isl_take isl_set *set);
7089         __isl_give isl_pw_qpolynomial_fold *
7090         isl_pw_qpolynomial_fold_intersect_domain_wrapped_domain(
7091                 __isl_take isl_pw_qpolynomial_fold *pwf,
7092                 __isl_take isl_set *set);
7093         __isl_give isl_union_pw_qpolynomial *
7094         isl_union_pw_qpolynomial_intersect_domain_wrapped_domain(
7095                 __isl_take isl_union_pw_qpolynomial *upwpq,
7096                 __isl_take isl_union_set *uset);
7097         __isl_give isl_union_pw_qpolynomial_fold *
7098         isl_union_pw_qpolynomial_fold_intersect_domain_wrapped_domain(
7099                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7100                 __isl_take isl_union_set *uset);
7101         __isl_give isl_pw_qpolynomial *
7102         isl_pw_qpolynomial_intersect_domain_wrapped_range(
7103                 __isl_take isl_pw_qpolynomial *pwpq,
7104                 __isl_take isl_set *set);
7105         __isl_give isl_pw_qpolynomial_fold *
7106         isl_pw_qpolynomial_fold_intersect_domain_wrapped_range(
7107                 __isl_take isl_pw_qpolynomial_fold *pwf,
7108                 __isl_take isl_set *set);
7109         __isl_give isl_union_pw_qpolynomial *
7110         isl_union_pw_qpolynomial_intersect_domain_wrapped_range(
7111                 __isl_take isl_union_pw_qpolynomial *upwpq,
7112                 __isl_take isl_union_set *uset);
7113         __isl_give isl_union_pw_qpolynomial_fold *
7114         isl_union_pw_qpolynomial_fold_intersect_domain_wrapped_range(
7115                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7116                 __isl_take isl_union_set *uset);
7117         __isl_give isl_pw_qpolynomial *
7118         isl_pw_qpolynomial_intersect_params(
7119                 __isl_take isl_pw_qpolynomial *pwpq,
7120                 __isl_take isl_set *set);
7121         __isl_give isl_pw_qpolynomial_fold *
7122         isl_pw_qpolynomial_fold_intersect_params(
7123                 __isl_take isl_pw_qpolynomial_fold *pwf,
7124                 __isl_take isl_set *set);
7125         __isl_give isl_union_pw_qpolynomial *
7126         isl_union_pw_qpolynomial_intersect_params(
7127                 __isl_take isl_union_pw_qpolynomial *upwpq,
7128                 __isl_take isl_set *set);
7129         __isl_give isl_union_pw_qpolynomial_fold *
7130         isl_union_pw_qpolynomial_fold_intersect_params(
7131                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7132                 __isl_take isl_set *set);
7134 The second argument to the C<_params> functions needs to be
7135 a parametric (basic) set.  For the other functions, a parametric set
7136 for either argument is only allowed if the other argument is
7137 a parametric set as well.
7138 The list passed to C<isl_basic_set_list_intersect> needs to have
7139 at least one element and all elements need to live in the same space.
7140 The function C<isl_multi_union_pw_aff_intersect_range>
7141 restricts the input function to those shared domain elements
7142 that map to the specified range.
7144 =item * Union
7146         #include <isl/set.h>
7147         __isl_give isl_set *isl_basic_set_union(
7148                 __isl_take isl_basic_set *bset1,
7149                 __isl_take isl_basic_set *bset2);
7150         __isl_give isl_set *isl_set_union(
7151                 __isl_take isl_set *set1,
7152                 __isl_take isl_set *set2);
7153         __isl_give isl_set *isl_set_list_union(
7154                 __isl_take isl_set_list *list);
7156         #include <isl/map.h>
7157         __isl_give isl_map *isl_basic_map_union(
7158                 __isl_take isl_basic_map *bmap1,
7159                 __isl_take isl_basic_map *bmap2);
7160         __isl_give isl_map *isl_map_union(
7161                 __isl_take isl_map *map1,
7162                 __isl_take isl_map *map2);
7164         #include <isl/union_set.h>
7165         __isl_give isl_union_set *isl_union_set_union(
7166                 __isl_take isl_union_set *uset1,
7167                 __isl_take isl_union_set *uset2);
7168         __isl_give isl_union_set *isl_union_set_list_union(
7169                 __isl_take isl_union_set_list *list);
7171         #include <isl/union_map.h>
7172         __isl_give isl_union_map *isl_union_map_union(
7173                 __isl_take isl_union_map *umap1,
7174                 __isl_take isl_union_map *umap2);
7176 The list passed to C<isl_set_list_union> needs to have
7177 at least one element and all elements need to live in the same space.
7179 =item * Set difference
7181         #include <isl/set.h>
7182         __isl_give isl_set *isl_set_subtract(
7183                 __isl_take isl_set *set1,
7184                 __isl_take isl_set *set2);
7186         #include <isl/map.h>
7187         __isl_give isl_map *isl_map_subtract(
7188                 __isl_take isl_map *map1,
7189                 __isl_take isl_map *map2);
7190         __isl_give isl_map *isl_map_subtract_domain(
7191                 __isl_take isl_map *map,
7192                 __isl_take isl_set *dom);
7193         __isl_give isl_map *isl_map_subtract_range(
7194                 __isl_take isl_map *map,
7195                 __isl_take isl_set *dom);
7197         #include <isl/union_set.h>
7198         __isl_give isl_union_set *isl_union_set_subtract(
7199                 __isl_take isl_union_set *uset1,
7200                 __isl_take isl_union_set *uset2);
7202         #include <isl/union_map.h>
7203         __isl_give isl_union_map *isl_union_map_subtract(
7204                 __isl_take isl_union_map *umap1,
7205                 __isl_take isl_union_map *umap2);
7206         __isl_give isl_union_map *isl_union_map_subtract_domain(
7207                 __isl_take isl_union_map *umap,
7208                 __isl_take isl_union_set *dom);
7209         __isl_give isl_union_map *isl_union_map_subtract_range(
7210                 __isl_take isl_union_map *umap,
7211                 __isl_take isl_union_set *dom);
7213         #include <isl/aff.h>
7214         __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
7215                 __isl_take isl_pw_aff *pa,
7216                 __isl_take isl_set *set);
7217         __isl_give isl_pw_multi_aff *
7218         isl_pw_multi_aff_subtract_domain(
7219                 __isl_take isl_pw_multi_aff *pma,
7220                 __isl_take isl_set *set);
7221         __isl_give isl_union_pw_aff *
7222         isl_union_pw_aff_subtract_domain(
7223                 __isl_take isl_union_pw_aff *upa,
7224                 __isl_take isl_union_set *uset);
7225         __isl_give isl_union_pw_multi_aff *
7226         isl_union_pw_multi_aff_subtract_domain(
7227                 __isl_take isl_union_pw_multi_aff *upma,
7228                 __isl_take isl_union_set *uset);
7230         #include <isl/polynomial.h>
7231         __isl_give isl_pw_qpolynomial *
7232         isl_pw_qpolynomial_subtract_domain(
7233                 __isl_take isl_pw_qpolynomial *pwpq,
7234                 __isl_take isl_set *set);
7235         __isl_give isl_pw_qpolynomial_fold *
7236         isl_pw_qpolynomial_fold_subtract_domain(
7237                 __isl_take isl_pw_qpolynomial_fold *pwf,
7238                 __isl_take isl_set *set);
7239         __isl_give isl_union_pw_qpolynomial *
7240         isl_union_pw_qpolynomial_subtract_domain(
7241                 __isl_take isl_union_pw_qpolynomial *upwpq,
7242                 __isl_take isl_union_set *uset);
7243         __isl_give isl_union_pw_qpolynomial_fold *
7244         isl_union_pw_qpolynomial_fold_subtract_domain(
7245                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7246                 __isl_take isl_union_set *uset);
7248 =item * Application
7250         #include <isl/space.h>
7251         __isl_give isl_space *isl_space_join(
7252                 __isl_take isl_space *left,
7253                 __isl_take isl_space *right);
7255         #include <isl/set.h>
7256         __isl_give isl_basic_set *isl_basic_set_apply(
7257                 __isl_take isl_basic_set *bset,
7258                 __isl_take isl_basic_map *bmap);
7259         __isl_give isl_set *isl_set_apply(
7260                 __isl_take isl_set *set,
7261                 __isl_take isl_map *map);
7263         #include <isl/union_set.h>
7264         __isl_give isl_union_set *isl_union_set_apply(
7265                 __isl_take isl_union_set *uset,
7266                 __isl_take isl_union_map *umap);
7268         #include <isl/map.h>
7269         __isl_give isl_basic_map *isl_basic_map_apply_domain(
7270                 __isl_take isl_basic_map *bmap1,
7271                 __isl_take isl_basic_map *bmap2);
7272         __isl_give isl_basic_map *isl_basic_map_apply_range(
7273                 __isl_take isl_basic_map *bmap1,
7274                 __isl_take isl_basic_map *bmap2);
7275         __isl_give isl_map *isl_map_apply_domain(
7276                 __isl_take isl_map *map1,
7277                 __isl_take isl_map *map2);
7278         __isl_give isl_map *isl_map_apply_range(
7279                 __isl_take isl_map *map1,
7280                 __isl_take isl_map *map2);
7282         #include <isl/union_map.h>
7283         __isl_give isl_union_map *isl_union_map_apply_domain(
7284                 __isl_take isl_union_map *umap1,
7285                 __isl_take isl_union_map *umap2);
7286         __isl_give isl_union_map *isl_union_map_apply_range(
7287                 __isl_take isl_union_map *umap1,
7288                 __isl_take isl_union_map *umap2);
7290         #include <isl/aff.h>
7291         __isl_give isl_union_pw_aff *
7292         isl_multi_union_pw_aff_apply_aff(
7293                 __isl_take isl_multi_union_pw_aff *mupa,
7294                 __isl_take isl_aff *aff);
7295         __isl_give isl_union_pw_aff *
7296         isl_multi_union_pw_aff_apply_pw_aff(
7297                 __isl_take isl_multi_union_pw_aff *mupa,
7298                 __isl_take isl_pw_aff *pa);
7299         __isl_give isl_multi_union_pw_aff *
7300         isl_multi_union_pw_aff_apply_multi_aff(
7301                 __isl_take isl_multi_union_pw_aff *mupa,
7302                 __isl_take isl_multi_aff *ma);
7303         __isl_give isl_multi_union_pw_aff *
7304         isl_multi_union_pw_aff_apply_pw_multi_aff(
7305                 __isl_take isl_multi_union_pw_aff *mupa,
7306                 __isl_take isl_pw_multi_aff *pma);
7308 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
7309 over the shared domain of the elements of the input.  The dimension is
7310 required to be greater than zero.
7311 The C<isl_multi_union_pw_aff> argument of
7312 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
7313 but only if the range of the C<isl_multi_aff> argument
7314 is also zero-dimensional.
7315 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
7317         #include <isl/polynomial.h>
7318         __isl_give isl_pw_qpolynomial_fold *
7319         isl_set_apply_pw_qpolynomial_fold(
7320                 __isl_take isl_set *set,
7321                 __isl_take isl_pw_qpolynomial_fold *pwf,
7322                 isl_bool *tight);
7323         __isl_give isl_pw_qpolynomial_fold *
7324         isl_map_apply_pw_qpolynomial_fold(
7325                 __isl_take isl_map *map,
7326                 __isl_take isl_pw_qpolynomial_fold *pwf,
7327                 isl_bool *tight);
7328         __isl_give isl_union_pw_qpolynomial_fold *
7329         isl_union_set_apply_union_pw_qpolynomial_fold(
7330                 __isl_take isl_union_set *uset,
7331                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7332                 isl_bool *tight);
7333         __isl_give isl_union_pw_qpolynomial_fold *
7334         isl_union_map_apply_union_pw_qpolynomial_fold(
7335                 __isl_take isl_union_map *umap,
7336                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7337                 isl_bool *tight);
7339 The functions taking a map
7340 compose the given map with the given piecewise quasipolynomial reduction.
7341 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
7342 over all elements in the intersection of the range of the map
7343 and the domain of the piecewise quasipolynomial reduction
7344 as a function of an element in the domain of the map.
7345 The functions taking a set compute a bound over all elements in the
7346 intersection of the set and the domain of the
7347 piecewise quasipolynomial reduction.
7349 =item * Preimage
7351         #include <isl/set.h>
7352         __isl_give isl_basic_set *
7353         isl_basic_set_preimage_multi_aff(
7354                 __isl_take isl_basic_set *bset,
7355                 __isl_take isl_multi_aff *ma);
7356         __isl_give isl_set *isl_set_preimage_multi_aff(
7357                 __isl_take isl_set *set,
7358                 __isl_take isl_multi_aff *ma);
7359         __isl_give isl_set *isl_set_preimage_pw_multi_aff(
7360                 __isl_take isl_set *set,
7361                 __isl_take isl_pw_multi_aff *pma);
7362         __isl_give isl_set *isl_set_preimage_multi_pw_aff(
7363                 __isl_take isl_set *set,
7364                 __isl_take isl_multi_pw_aff *mpa);
7366         #include <isl/union_set.h>
7367         __isl_give isl_union_set *
7368         isl_union_set_preimage_multi_aff(
7369                 __isl_take isl_union_set *uset,
7370                 __isl_take isl_multi_aff *ma);
7371         __isl_give isl_union_set *
7372         isl_union_set_preimage_pw_multi_aff(
7373                 __isl_take isl_union_set *uset,
7374                 __isl_take isl_pw_multi_aff *pma);
7375         __isl_give isl_union_set *
7376         isl_union_set_preimage_union_pw_multi_aff(
7377                 __isl_take isl_union_set *uset,
7378                 __isl_take isl_union_pw_multi_aff *upma);
7380         #include <isl/map.h>
7381         __isl_give isl_basic_map *
7382         isl_basic_map_preimage_domain_multi_aff(
7383                 __isl_take isl_basic_map *bmap,
7384                 __isl_take isl_multi_aff *ma);
7385         __isl_give isl_map *isl_map_preimage_domain_multi_aff(
7386                 __isl_take isl_map *map,
7387                 __isl_take isl_multi_aff *ma);
7388         __isl_give isl_map *isl_map_preimage_range_multi_aff(
7389                 __isl_take isl_map *map,
7390                 __isl_take isl_multi_aff *ma);
7391         __isl_give isl_map *
7392         isl_map_preimage_domain_pw_multi_aff(
7393                 __isl_take isl_map *map,
7394                 __isl_take isl_pw_multi_aff *pma);
7395         __isl_give isl_map *
7396         isl_map_preimage_range_pw_multi_aff(
7397                 __isl_take isl_map *map,
7398                 __isl_take isl_pw_multi_aff *pma);
7399         __isl_give isl_map *
7400         isl_map_preimage_domain_multi_pw_aff(
7401                 __isl_take isl_map *map,
7402                 __isl_take isl_multi_pw_aff *mpa);
7403         __isl_give isl_basic_map *
7404         isl_basic_map_preimage_range_multi_aff(
7405                 __isl_take isl_basic_map *bmap,
7406                 __isl_take isl_multi_aff *ma);
7408         #include <isl/union_map.h>
7409         __isl_give isl_union_map *
7410         isl_union_map_preimage_domain_multi_aff(
7411                 __isl_take isl_union_map *umap,
7412                 __isl_take isl_multi_aff *ma);
7413         __isl_give isl_union_map *
7414         isl_union_map_preimage_range_multi_aff(
7415                 __isl_take isl_union_map *umap,
7416                 __isl_take isl_multi_aff *ma);
7417         __isl_give isl_union_map *
7418         isl_union_map_preimage_domain_pw_multi_aff(
7419                 __isl_take isl_union_map *umap,
7420                 __isl_take isl_pw_multi_aff *pma);
7421         __isl_give isl_union_map *
7422         isl_union_map_preimage_range_pw_multi_aff(
7423                 __isl_take isl_union_map *umap,
7424                 __isl_take isl_pw_multi_aff *pma);
7425         __isl_give isl_union_map *
7426         isl_union_map_preimage_domain_union_pw_multi_aff(
7427                 __isl_take isl_union_map *umap,
7428                 __isl_take isl_union_pw_multi_aff *upma);
7429         __isl_give isl_union_map *
7430         isl_union_map_preimage_range_union_pw_multi_aff(
7431                 __isl_take isl_union_map *umap,
7432                 __isl_take isl_union_pw_multi_aff *upma);
7434 These functions compute the preimage of the given set or map domain/range under
7435 the given function.  In other words, the expression is plugged
7436 into the set description or into the domain/range of the map.
7438 =item * Pullback
7440         #include <isl/aff.h>
7441         __isl_give isl_aff *isl_aff_pullback_aff(
7442                 __isl_take isl_aff *aff1,
7443                 __isl_take isl_aff *aff2);
7444         __isl_give isl_aff *isl_aff_pullback_multi_aff(
7445                 __isl_take isl_aff *aff,
7446                 __isl_take isl_multi_aff *ma);
7447         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
7448                 __isl_take isl_pw_aff *pa,
7449                 __isl_take isl_multi_aff *ma);
7450         __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
7451                 __isl_take isl_pw_aff *pa,
7452                 __isl_take isl_pw_multi_aff *pma);
7453         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
7454                 __isl_take isl_pw_aff *pa,
7455                 __isl_take isl_multi_pw_aff *mpa);
7456         __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
7457                 __isl_take isl_multi_aff *ma1,
7458                 __isl_take isl_multi_aff *ma2);
7459         __isl_give isl_pw_multi_aff *
7460         isl_pw_multi_aff_pullback_multi_aff(
7461                 __isl_take isl_pw_multi_aff *pma,
7462                 __isl_take isl_multi_aff *ma);
7463         __isl_give isl_multi_pw_aff *
7464         isl_multi_pw_aff_pullback_multi_aff(
7465                 __isl_take isl_multi_pw_aff *mpa,
7466                 __isl_take isl_multi_aff *ma);
7467         __isl_give isl_pw_multi_aff *
7468         isl_pw_multi_aff_pullback_pw_multi_aff(
7469                 __isl_take isl_pw_multi_aff *pma1,
7470                 __isl_take isl_pw_multi_aff *pma2);
7471         __isl_give isl_multi_pw_aff *
7472         isl_multi_pw_aff_pullback_pw_multi_aff(
7473                 __isl_take isl_multi_pw_aff *mpa,
7474                 __isl_take isl_pw_multi_aff *pma);
7475         __isl_give isl_multi_pw_aff *
7476         isl_multi_pw_aff_pullback_multi_pw_aff(
7477                 __isl_take isl_multi_pw_aff *mpa1,
7478                 __isl_take isl_multi_pw_aff *mpa2);
7479         __isl_give isl_union_pw_aff *
7480         isl_union_pw_aff_pullback_union_pw_multi_aff(
7481                 __isl_take isl_union_pw_aff *upa,
7482                 __isl_take isl_union_pw_multi_aff *upma);
7483         __isl_give isl_union_pw_multi_aff *
7484         isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
7485                 __isl_take isl_union_pw_multi_aff *upma1,
7486                 __isl_take isl_union_pw_multi_aff *upma2);
7487         __isl_give isl_multi_union_pw_aff *
7488         isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
7489                 __isl_take isl_multi_union_pw_aff *mupa,
7490                 __isl_take isl_union_pw_multi_aff *upma);
7492 These functions precompose the first expression by the second function.
7493 In other words, the second function is plugged
7494 into the first expression.
7496 =item * Locus
7498         #include <isl/aff.h>
7499         __isl_give isl_basic_set *isl_aff_eq_basic_set(
7500                 __isl_take isl_aff *aff1,
7501                 __isl_take isl_aff *aff2);
7502         __isl_give isl_set *isl_aff_eq_set(
7503                 __isl_take isl_aff *aff1,
7504                 __isl_take isl_aff *aff2);
7505         __isl_give isl_set *isl_aff_ne_set(
7506                 __isl_take isl_aff *aff1,
7507                 __isl_take isl_aff *aff2);
7508         __isl_give isl_basic_set *isl_aff_le_basic_set(
7509                 __isl_take isl_aff *aff1,
7510                 __isl_take isl_aff *aff2);
7511         __isl_give isl_set *isl_aff_le_set(
7512                 __isl_take isl_aff *aff1,
7513                 __isl_take isl_aff *aff2);
7514         __isl_give isl_basic_set *isl_aff_lt_basic_set(
7515                 __isl_take isl_aff *aff1,
7516                 __isl_take isl_aff *aff2);
7517         __isl_give isl_set *isl_aff_lt_set(
7518                 __isl_take isl_aff *aff1,
7519                 __isl_take isl_aff *aff2);
7520         __isl_give isl_basic_set *isl_aff_ge_basic_set(
7521                 __isl_take isl_aff *aff1,
7522                 __isl_take isl_aff *aff2);
7523         __isl_give isl_set *isl_aff_ge_set(
7524                 __isl_take isl_aff *aff1,
7525                 __isl_take isl_aff *aff2);
7526         __isl_give isl_basic_set *isl_aff_gt_basic_set(
7527                 __isl_take isl_aff *aff1,
7528                 __isl_take isl_aff *aff2);
7529         __isl_give isl_set *isl_aff_gt_set(
7530                 __isl_take isl_aff *aff1,
7531                 __isl_take isl_aff *aff2);
7532         __isl_give isl_set *isl_pw_aff_eq_set(
7533                 __isl_take isl_pw_aff *pwaff1,
7534                 __isl_take isl_pw_aff *pwaff2);
7535         __isl_give isl_set *isl_pw_aff_ne_set(
7536                 __isl_take isl_pw_aff *pwaff1,
7537                 __isl_take isl_pw_aff *pwaff2);
7538         __isl_give isl_set *isl_pw_aff_le_set(
7539                 __isl_take isl_pw_aff *pwaff1,
7540                 __isl_take isl_pw_aff *pwaff2);
7541         __isl_give isl_set *isl_pw_aff_lt_set(
7542                 __isl_take isl_pw_aff *pwaff1,
7543                 __isl_take isl_pw_aff *pwaff2);
7544         __isl_give isl_set *isl_pw_aff_ge_set(
7545                 __isl_take isl_pw_aff *pwaff1,
7546                 __isl_take isl_pw_aff *pwaff2);
7547         __isl_give isl_set *isl_pw_aff_gt_set(
7548                 __isl_take isl_pw_aff *pwaff1,
7549                 __isl_take isl_pw_aff *pwaff2);
7551         __isl_give isl_set *isl_multi_aff_lex_le_set(
7552                 __isl_take isl_multi_aff *ma1,
7553                 __isl_take isl_multi_aff *ma2);
7554         __isl_give isl_set *isl_multi_aff_lex_lt_set(
7555                 __isl_take isl_multi_aff *ma1,
7556                 __isl_take isl_multi_aff *ma2);
7557         __isl_give isl_set *isl_multi_aff_lex_ge_set(
7558                 __isl_take isl_multi_aff *ma1,
7559                 __isl_take isl_multi_aff *ma2);
7560         __isl_give isl_set *isl_multi_aff_lex_gt_set(
7561                 __isl_take isl_multi_aff *ma1,
7562                 __isl_take isl_multi_aff *ma2);
7564         __isl_give isl_set *isl_pw_aff_list_eq_set(
7565                 __isl_take isl_pw_aff_list *list1,
7566                 __isl_take isl_pw_aff_list *list2);
7567         __isl_give isl_set *isl_pw_aff_list_ne_set(
7568                 __isl_take isl_pw_aff_list *list1,
7569                 __isl_take isl_pw_aff_list *list2);
7570         __isl_give isl_set *isl_pw_aff_list_le_set(
7571                 __isl_take isl_pw_aff_list *list1,
7572                 __isl_take isl_pw_aff_list *list2);
7573         __isl_give isl_set *isl_pw_aff_list_lt_set(
7574                 __isl_take isl_pw_aff_list *list1,
7575                 __isl_take isl_pw_aff_list *list2);
7576         __isl_give isl_set *isl_pw_aff_list_ge_set(
7577                 __isl_take isl_pw_aff_list *list1,
7578                 __isl_take isl_pw_aff_list *list2);
7579         __isl_give isl_set *isl_pw_aff_list_gt_set(
7580                 __isl_take isl_pw_aff_list *list1,
7581                 __isl_take isl_pw_aff_list *list2);
7583 The function C<isl_aff_ge_basic_set> returns a basic set
7584 containing those elements in the shared space
7585 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
7586 The function C<isl_pw_aff_ge_set> returns a set
7587 containing those elements in the shared domain
7588 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
7589 greater than or equal to C<pwaff2>.
7590 The function C<isl_multi_aff_lex_le_set> returns a set
7591 containing those elements in the shared domain space
7592 where C<ma1> is lexicographically smaller than or
7593 equal to C<ma2>.
7594 The functions operating on C<isl_pw_aff_list> apply the corresponding
7595 C<isl_pw_aff> function to each pair of elements in the two lists.
7597         #include <isl/aff.h>
7598         __isl_give isl_map *isl_pw_aff_eq_map(
7599                 __isl_take isl_pw_aff *pa1,
7600                 __isl_take isl_pw_aff *pa2);
7601         __isl_give isl_map *isl_pw_aff_le_map(
7602                 __isl_take isl_pw_aff *pa1,
7603                 __isl_take isl_pw_aff *pa2);
7604         __isl_give isl_map *isl_pw_aff_lt_map(
7605                 __isl_take isl_pw_aff *pa1,
7606                 __isl_take isl_pw_aff *pa2);
7607         __isl_give isl_map *isl_pw_aff_ge_map(
7608                 __isl_take isl_pw_aff *pa1,
7609                 __isl_take isl_pw_aff *pa2);
7610         __isl_give isl_map *isl_pw_aff_gt_map(
7611                 __isl_take isl_pw_aff *pa1,
7612                 __isl_take isl_pw_aff *pa2);
7614         __isl_give isl_map *isl_multi_pw_aff_eq_map(
7615                 __isl_take isl_multi_pw_aff *mpa1,
7616                 __isl_take isl_multi_pw_aff *mpa2);
7617         __isl_give isl_map *isl_multi_pw_aff_lex_le_map(
7618                 __isl_take isl_multi_pw_aff *mpa1,
7619                 __isl_take isl_multi_pw_aff *mpa2);
7620         __isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
7621                 __isl_take isl_multi_pw_aff *mpa1,
7622                 __isl_take isl_multi_pw_aff *mpa2);
7623         __isl_give isl_map *isl_multi_pw_aff_lex_ge_map(
7624                 __isl_take isl_multi_pw_aff *mpa1,
7625                 __isl_take isl_multi_pw_aff *mpa2);
7626         __isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
7627                 __isl_take isl_multi_pw_aff *mpa1,
7628                 __isl_take isl_multi_pw_aff *mpa2);
7630 These functions return a map between domain elements of the arguments
7631 where the function values satisfy the given relation.
7633         #include <isl/map.h>
7634         __isl_give isl_map *isl_map_eq_at_multi_pw_aff(
7635                 __isl_take isl_map *map,
7636                 __isl_take isl_multi_pw_aff *mpa);
7637         __isl_give isl_map *isl_map_lex_lt_at_multi_pw_aff(
7638                 __isl_take isl_map *map,
7639                 __isl_take isl_multi_pw_aff *mpa);
7640         __isl_give isl_map *isl_map_lex_le_at_multi_pw_aff(
7641                 __isl_take isl_map *map,
7642                 __isl_take isl_multi_pw_aff *mpa);
7643         __isl_give isl_map *isl_map_lex_gt_at_multi_pw_aff(
7644                 __isl_take isl_map *map,
7645                 __isl_take isl_multi_pw_aff *mpa);
7646         __isl_give isl_map *isl_map_lex_ge_at_multi_pw_aff(
7647                 __isl_take isl_map *map,
7648                 __isl_take isl_multi_pw_aff *mpa);
7650         #include <isl/union_map.h>
7651         __isl_give isl_union_map *
7652         isl_union_map_eq_at_multi_union_pw_aff(
7653                 __isl_take isl_union_map *umap,
7654                 __isl_take isl_multi_union_pw_aff *mupa);
7655         __isl_give isl_union_map *
7656         isl_union_map_lex_lt_at_multi_union_pw_aff(
7657                 __isl_take isl_union_map *umap,
7658                 __isl_take isl_multi_union_pw_aff *mupa);
7659         __isl_give isl_union_map *
7660         isl_union_map_lex_gt_at_multi_union_pw_aff(
7661                 __isl_take isl_union_map *umap,
7662                 __isl_take isl_multi_union_pw_aff *mupa);
7664 These functions select the subset of elements in the union map
7665 that have an equal or lexicographically smaller function value.
7667 =item * Cartesian Product
7669         #include <isl/space.h>
7670         __isl_give isl_space *isl_space_product(
7671                 __isl_take isl_space *space1,
7672                 __isl_take isl_space *space2);
7673         __isl_give isl_space *isl_space_domain_product(
7674                 __isl_take isl_space *space1,
7675                 __isl_take isl_space *space2);
7676         __isl_give isl_space *isl_space_range_product(
7677                 __isl_take isl_space *space1,
7678                 __isl_take isl_space *space2);
7680 The functions
7681 C<isl_space_product>, C<isl_space_domain_product>
7682 and C<isl_space_range_product> take pairs or relation spaces and
7683 produce a single relations space, where either the domain, the range
7684 or both domain and range are wrapped spaces of relations between
7685 the domains and/or ranges of the input spaces.
7686 If the product is only constructed over the domain or the range
7687 then the ranges or the domains of the inputs should be the same.
7688 The function C<isl_space_product> also accepts a pair of set spaces,
7689 in which case it returns a wrapped space of a relation between the
7690 two input spaces.
7692         #include <isl/set.h>
7693         __isl_give isl_set *isl_set_product(
7694                 __isl_take isl_set *set1,
7695                 __isl_take isl_set *set2);
7697         #include <isl/map.h>
7698         __isl_give isl_basic_map *isl_basic_map_domain_product(
7699                 __isl_take isl_basic_map *bmap1,
7700                 __isl_take isl_basic_map *bmap2);
7701         __isl_give isl_basic_map *isl_basic_map_range_product(
7702                 __isl_take isl_basic_map *bmap1,
7703                 __isl_take isl_basic_map *bmap2);
7704         __isl_give isl_basic_map *isl_basic_map_product(
7705                 __isl_take isl_basic_map *bmap1,
7706                 __isl_take isl_basic_map *bmap2);
7707         __isl_give isl_map *isl_map_domain_product(
7708                 __isl_take isl_map *map1,
7709                 __isl_take isl_map *map2);
7710         __isl_give isl_map *isl_map_range_product(
7711                 __isl_take isl_map *map1,
7712                 __isl_take isl_map *map2);
7713         __isl_give isl_map *isl_map_product(
7714                 __isl_take isl_map *map1,
7715                 __isl_take isl_map *map2);
7717         #include <isl/union_set.h>
7718         __isl_give isl_union_set *isl_union_set_product(
7719                 __isl_take isl_union_set *uset1,
7720                 __isl_take isl_union_set *uset2);
7722         #include <isl/union_map.h>
7723         __isl_give isl_union_map *isl_union_map_domain_product(
7724                 __isl_take isl_union_map *umap1,
7725                 __isl_take isl_union_map *umap2);
7726         __isl_give isl_union_map *isl_union_map_range_product(
7727                 __isl_take isl_union_map *umap1,
7728                 __isl_take isl_union_map *umap2);
7729         __isl_give isl_union_map *isl_union_map_product(
7730                 __isl_take isl_union_map *umap1,
7731                 __isl_take isl_union_map *umap2);
7733         #include <isl/id.h>
7734         __isl_give isl_multi_id *isl_multi_id_range_product(
7735                 __isl_take isl_multi_id *mi1,
7736                 __isl_take isl_multi_id *mi2);
7738         #include <isl/val.h>
7739         __isl_give isl_multi_val *isl_multi_val_range_product(
7740                 __isl_take isl_multi_val *mv1,
7741                 __isl_take isl_multi_val *mv2);
7742         __isl_give isl_multi_val *isl_multi_val_product(
7743                 __isl_take isl_multi_val *mv1,
7744                 __isl_take isl_multi_val *mv2);
7746         #include <isl/aff.h>
7747         __isl_give isl_multi_aff *isl_multi_aff_range_product(
7748                 __isl_take isl_multi_aff *ma1,
7749                 __isl_take isl_multi_aff *ma2);
7750         __isl_give isl_multi_aff *isl_multi_aff_product(
7751                 __isl_take isl_multi_aff *ma1,
7752                 __isl_take isl_multi_aff *ma2);
7753         __isl_give isl_multi_pw_aff *
7754         isl_multi_pw_aff_range_product(
7755                 __isl_take isl_multi_pw_aff *mpa1,
7756                 __isl_take isl_multi_pw_aff *mpa2);
7757         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
7758                 __isl_take isl_multi_pw_aff *mpa1,
7759                 __isl_take isl_multi_pw_aff *mpa2);
7760         __isl_give isl_pw_multi_aff *
7761         isl_pw_multi_aff_range_product(
7762                 __isl_take isl_pw_multi_aff *pma1,
7763                 __isl_take isl_pw_multi_aff *pma2);
7764         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
7765                 __isl_take isl_pw_multi_aff *pma1,
7766                 __isl_take isl_pw_multi_aff *pma2);
7767         __isl_give isl_union_pw_multi_aff *
7768         isl_union_pw_multi_aff_range_product(
7769                 __isl_take isl_union_pw_multi_aff *upma1,
7770                 __isl_take isl_union_pw_multi_aff *upma2);
7771         __isl_give isl_multi_union_pw_aff *
7772         isl_multi_union_pw_aff_range_product(
7773                 __isl_take isl_multi_union_pw_aff *mupa1,
7774                 __isl_take isl_multi_union_pw_aff *mupa2);
7776 The above functions compute the cross product of the given
7777 sets, relations or functions.  The domains and ranges of the results
7778 are wrapped maps between domains and ranges of the inputs.
7779 To obtain a ``flat'' product, use the following functions
7780 instead.
7782         #include <isl/set.h>
7783         __isl_give isl_basic_set *isl_basic_set_flat_product(
7784                 __isl_take isl_basic_set *bset1,
7785                 __isl_take isl_basic_set *bset2);
7786         __isl_give isl_set *isl_set_flat_product(
7787                 __isl_take isl_set *set1,
7788                 __isl_take isl_set *set2);
7790         #include <isl/map.h>
7791         __isl_give isl_basic_map *isl_basic_map_flat_range_product(
7792                 __isl_take isl_basic_map *bmap1,
7793                 __isl_take isl_basic_map *bmap2);
7794         __isl_give isl_map *isl_map_flat_domain_product(
7795                 __isl_take isl_map *map1,
7796                 __isl_take isl_map *map2);
7797         __isl_give isl_map *isl_map_flat_range_product(
7798                 __isl_take isl_map *map1,
7799                 __isl_take isl_map *map2);
7800         __isl_give isl_basic_map *isl_basic_map_flat_product(
7801                 __isl_take isl_basic_map *bmap1,
7802                 __isl_take isl_basic_map *bmap2);
7803         __isl_give isl_map *isl_map_flat_product(
7804                 __isl_take isl_map *map1,
7805                 __isl_take isl_map *map2);
7807         #include <isl/union_map.h>
7808         __isl_give isl_union_map *
7809         isl_union_map_flat_domain_product(
7810                 __isl_take isl_union_map *umap1,
7811                 __isl_take isl_union_map *umap2);
7812         __isl_give isl_union_map *
7813         isl_union_map_flat_range_product(
7814                 __isl_take isl_union_map *umap1,
7815                 __isl_take isl_union_map *umap2);
7817         #include <isl/id.h>
7818         __isl_give isl_multi_id *
7819         isl_multi_id_flat_range_product(
7820                 __isl_take isl_multi_id *mi1,
7821                 __isl_take isl_multi_id *mi2);
7823         #include <isl/val.h>
7824         __isl_give isl_multi_val *isl_multi_val_flat_range_product(
7825                 __isl_take isl_multi_val *mv1,
7826                 __isl_take isl_multi_val *mv2);
7828         #include <isl/aff.h>
7829         __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
7830                 __isl_take isl_multi_aff *ma1,
7831                 __isl_take isl_multi_aff *ma2);
7832         __isl_give isl_pw_multi_aff *
7833         isl_pw_multi_aff_flat_range_product(
7834                 __isl_take isl_pw_multi_aff *pma1,
7835                 __isl_take isl_pw_multi_aff *pma2);
7836         __isl_give isl_multi_pw_aff *
7837         isl_multi_pw_aff_flat_range_product(
7838                 __isl_take isl_multi_pw_aff *mpa1,
7839                 __isl_take isl_multi_pw_aff *mpa2);
7840         __isl_give isl_union_pw_multi_aff *
7841         isl_union_pw_multi_aff_flat_range_product(
7842                 __isl_take isl_union_pw_multi_aff *upma1,
7843                 __isl_take isl_union_pw_multi_aff *upma2);
7844         __isl_give isl_multi_union_pw_aff *
7845         isl_multi_union_pw_aff_flat_range_product(
7846                 __isl_take isl_multi_union_pw_aff *mupa1,
7847                 __isl_take isl_multi_union_pw_aff *mupa2);
7849         #include <isl/space.h>
7850         __isl_give isl_space *isl_space_factor_domain(
7851                 __isl_take isl_space *space);
7852         __isl_give isl_space *isl_space_factor_range(
7853                 __isl_take isl_space *space);
7854         __isl_give isl_space *isl_space_domain_factor_domain(
7855                 __isl_take isl_space *space);
7856         __isl_give isl_space *isl_space_domain_factor_range(
7857                 __isl_take isl_space *space);
7858         __isl_give isl_space *isl_space_range_factor_domain(
7859                 __isl_take isl_space *space);
7860         __isl_give isl_space *isl_space_range_factor_range(
7861                 __isl_take isl_space *space);
7863 The functions C<isl_space_range_factor_domain> and
7864 C<isl_space_range_factor_range> extract the two arguments from
7865 the result of a call to C<isl_space_range_product>.
7867 The arguments of a call to a product can be extracted
7868 from the result using the following functions.
7870         #include <isl/map.h>
7871         __isl_give isl_map *isl_map_factor_domain(
7872                 __isl_take isl_map *map);
7873         __isl_give isl_map *isl_map_factor_range(
7874                 __isl_take isl_map *map);
7875         __isl_give isl_map *isl_map_domain_factor_domain(
7876                 __isl_take isl_map *map);
7877         __isl_give isl_map *isl_map_domain_factor_range(
7878                 __isl_take isl_map *map);
7879         __isl_give isl_map *isl_map_range_factor_domain(
7880                 __isl_take isl_map *map);
7881         __isl_give isl_map *isl_map_range_factor_range(
7882                 __isl_take isl_map *map);
7884         #include <isl/union_map.h>
7885         __isl_give isl_union_map *isl_union_map_factor_domain(
7886                 __isl_take isl_union_map *umap);
7887         __isl_give isl_union_map *isl_union_map_factor_range(
7888                 __isl_take isl_union_map *umap);
7889         __isl_give isl_union_map *
7890         isl_union_map_domain_factor_domain(
7891                 __isl_take isl_union_map *umap);
7892         __isl_give isl_union_map *
7893         isl_union_map_domain_factor_range(
7894                 __isl_take isl_union_map *umap);
7895         __isl_give isl_union_map *
7896         isl_union_map_range_factor_domain(
7897                 __isl_take isl_union_map *umap);
7898         __isl_give isl_union_map *
7899         isl_union_map_range_factor_range(
7900                 __isl_take isl_union_map *umap);
7902         #include <isl/id.h>
7903         __isl_give isl_multi_id *isl_multi_id_factor_range(
7904                 __isl_take isl_multi_id *mi);
7905         __isl_give isl_multi_id *
7906         isl_multi_id_range_factor_domain(
7907                 __isl_take isl_multi_id *mi);
7908         __isl_give isl_multi_id *
7909         isl_multi_id_range_factor_range(
7910                 __isl_take isl_multi_id *mi);
7912         #include <isl/val.h>
7913         __isl_give isl_multi_val *isl_multi_val_factor_range(
7914                 __isl_take isl_multi_val *mv);
7915         __isl_give isl_multi_val *
7916         isl_multi_val_range_factor_domain(
7917                 __isl_take isl_multi_val *mv);
7918         __isl_give isl_multi_val *
7919         isl_multi_val_range_factor_range(
7920                 __isl_take isl_multi_val *mv);
7922         #include <isl/aff.h>
7923         __isl_give isl_multi_aff *isl_multi_aff_factor_range(
7924                 __isl_take isl_multi_aff *ma);
7925         __isl_give isl_multi_aff *
7926         isl_multi_aff_range_factor_domain(
7927                 __isl_take isl_multi_aff *ma);
7928         __isl_give isl_multi_aff *
7929         isl_multi_aff_range_factor_range(
7930                 __isl_take isl_multi_aff *ma);
7931         __isl_give isl_multi_pw_aff *
7932         isl_multi_pw_aff_factor_range(
7933                 __isl_take isl_multi_pw_aff *mpa);
7934         __isl_give isl_multi_pw_aff *
7935         isl_multi_pw_aff_range_factor_domain(
7936                 __isl_take isl_multi_pw_aff *mpa);
7937         __isl_give isl_multi_pw_aff *
7938         isl_multi_pw_aff_range_factor_range(
7939                 __isl_take isl_multi_pw_aff *mpa);
7940         __isl_give isl_pw_multi_aff *
7941         isl_pw_multi_aff_range_factor_domain(
7942                 __isl_take isl_pw_multi_aff *pma);
7943         __isl_give isl_pw_multi_aff *
7944         isl_pw_multi_aff_range_factor_range(
7945                 __isl_take isl_pw_multi_aff *pma);
7946         __isl_give isl_union_pw_multi_aff *
7947         isl_union_pw_multi_aff_range_factor_domain(
7948                 __isl_take isl_union_pw_multi_aff *upma);
7949         __isl_give isl_union_pw_multi_aff *
7950         isl_union_pw_multi_aff_range_factor_range(
7951                 __isl_take isl_union_pw_multi_aff *upma);
7952         __isl_give isl_multi_union_pw_aff *
7953         isl_multi_union_pw_aff_factor_range(
7954                 __isl_take isl_multi_union_pw_aff *mupa);
7955         __isl_give isl_multi_union_pw_aff *
7956         isl_multi_union_pw_aff_range_factor_domain(
7957                 __isl_take isl_multi_union_pw_aff *mupa);
7958         __isl_give isl_multi_union_pw_aff *
7959         isl_multi_union_pw_aff_range_factor_range(
7960                 __isl_take isl_multi_union_pw_aff *mupa);
7962 The splice functions are a generalization of the flat product functions,
7963 where the second argument may be inserted at any position inside
7964 the first argument rather than being placed at the end.
7965 The functions C<isl_multi_val_factor_range>,
7966 C<isl_multi_aff_factor_range>,
7967 C<isl_multi_pw_aff_factor_range> and
7968 C<isl_multi_union_pw_aff_factor_range>
7969 take functions that live in a set space.
7971         #include <isl/id.h>
7972         __isl_give isl_multi_id *isl_multi_id_range_splice(
7973                 __isl_take isl_multi_id *mi1, unsigned pos,
7974                 __isl_take isl_multi_id *mi2);
7976         #include <isl/val.h>
7977         __isl_give isl_multi_val *isl_multi_val_range_splice(
7978                 __isl_take isl_multi_val *mv1, unsigned pos,
7979                 __isl_take isl_multi_val *mv2);
7981         #include <isl/aff.h>
7982         __isl_give isl_multi_aff *isl_multi_aff_range_splice(
7983                 __isl_take isl_multi_aff *ma1, unsigned pos,
7984                 __isl_take isl_multi_aff *ma2);
7985         __isl_give isl_multi_aff *isl_multi_aff_splice(
7986                 __isl_take isl_multi_aff *ma1,
7987                 unsigned in_pos, unsigned out_pos,
7988                 __isl_take isl_multi_aff *ma2);
7989         __isl_give isl_multi_pw_aff *
7990         isl_multi_pw_aff_range_splice(
7991                 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
7992                 __isl_take isl_multi_pw_aff *mpa2);
7993         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
7994                 __isl_take isl_multi_pw_aff *mpa1,
7995                 unsigned in_pos, unsigned out_pos,
7996                 __isl_take isl_multi_pw_aff *mpa2);
7997         __isl_give isl_multi_union_pw_aff *
7998         isl_multi_union_pw_aff_range_splice(
7999                 __isl_take isl_multi_union_pw_aff *mupa1,
8000                 unsigned pos,
8001                 __isl_take isl_multi_union_pw_aff *mupa2);
8003 =item * Simplification
8005 When applied to a set or relation,
8006 the gist operation returns a set or relation that has the
8007 same intersection with the context as the input set or relation.
8008 Any implicit equality in the intersection is made explicit in the result,
8009 while all inequalities that are redundant with respect to the intersection
8010 are removed.
8011 In case of union sets and relations, the gist operation is performed
8012 per space.
8014 When applied to a function,
8015 the gist operation applies the set gist operation to each of
8016 the cells in the domain of the input piecewise expression.
8017 The context is also exploited
8018 to simplify the expression associated to each cell.
8020         #include <isl/set.h>
8021         __isl_give isl_basic_set *isl_basic_set_gist(
8022                 __isl_take isl_basic_set *bset,
8023                 __isl_take isl_basic_set *context);
8024         __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
8025                 __isl_take isl_set *context);
8026         __isl_give isl_set *isl_set_gist_params(
8027                 __isl_take isl_set *set,
8028                 __isl_take isl_set *context);
8030         #include <isl/map.h>
8031         __isl_give isl_basic_map *isl_basic_map_gist(
8032                 __isl_take isl_basic_map *bmap,
8033                 __isl_take isl_basic_map *context);
8034         __isl_give isl_basic_map *isl_basic_map_gist_domain(
8035                 __isl_take isl_basic_map *bmap,
8036                 __isl_take isl_basic_set *context);
8037         __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
8038                 __isl_take isl_map *context);
8039         __isl_give isl_map *isl_map_gist_params(
8040                 __isl_take isl_map *map,
8041                 __isl_take isl_set *context);
8042         __isl_give isl_map *isl_map_gist_domain(
8043                 __isl_take isl_map *map,
8044                 __isl_take isl_set *context);
8045         __isl_give isl_map *isl_map_gist_range(
8046                 __isl_take isl_map *map,
8047                 __isl_take isl_set *context);
8049         #include <isl/union_set.h>
8050         __isl_give isl_union_set *isl_union_set_gist(
8051                 __isl_take isl_union_set *uset,
8052                 __isl_take isl_union_set *context);
8053         __isl_give isl_union_set *isl_union_set_gist_params(
8054                 __isl_take isl_union_set *uset,
8055                 __isl_take isl_set *set);
8057         #include <isl/union_map.h>
8058         __isl_give isl_union_map *isl_union_map_gist(
8059                 __isl_take isl_union_map *umap,
8060                 __isl_take isl_union_map *context);
8061         __isl_give isl_union_map *isl_union_map_gist_params(
8062                 __isl_take isl_union_map *umap,
8063                 __isl_take isl_set *set);
8064         __isl_give isl_union_map *isl_union_map_gist_domain(
8065                 __isl_take isl_union_map *umap,
8066                 __isl_take isl_union_set *uset);
8067         __isl_give isl_union_map *isl_union_map_gist_range(
8068                 __isl_take isl_union_map *umap,
8069                 __isl_take isl_union_set *uset);
8071         #include <isl/aff.h>
8072         __isl_give isl_aff *isl_aff_gist_params(
8073                 __isl_take isl_aff *aff,
8074                 __isl_take isl_set *context);
8075         __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
8076                 __isl_take isl_set *context);
8077         __isl_give isl_multi_aff *isl_multi_aff_gist_params(
8078                 __isl_take isl_multi_aff *maff,
8079                 __isl_take isl_set *context);
8080         __isl_give isl_multi_aff *isl_multi_aff_gist(
8081                 __isl_take isl_multi_aff *maff,
8082                 __isl_take isl_set *context);
8083         __isl_give isl_pw_aff *isl_pw_aff_gist_params(
8084                 __isl_take isl_pw_aff *pwaff,
8085                 __isl_take isl_set *context);
8086         __isl_give isl_pw_aff *isl_pw_aff_gist(
8087                 __isl_take isl_pw_aff *pwaff,
8088                 __isl_take isl_set *context);
8089         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
8090                 __isl_take isl_pw_multi_aff *pma,
8091                 __isl_take isl_set *set);
8092         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
8093                 __isl_take isl_pw_multi_aff *pma,
8094                 __isl_take isl_set *set);
8095         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
8096                 __isl_take isl_multi_pw_aff *mpa,
8097                 __isl_take isl_set *set);
8098         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
8099                 __isl_take isl_multi_pw_aff *mpa,
8100                 __isl_take isl_set *set);
8101         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
8102                 __isl_take isl_union_pw_aff *upa,
8103                 __isl_take isl_union_set *context);
8104         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
8105                 __isl_take isl_union_pw_aff *upa,
8106                 __isl_take isl_set *context);
8107         __isl_give isl_union_pw_multi_aff *
8108         isl_union_pw_multi_aff_gist_params(
8109                 __isl_take isl_union_pw_multi_aff *upma,
8110                 __isl_take isl_set *context);
8111         __isl_give isl_union_pw_multi_aff *
8112         isl_union_pw_multi_aff_gist(
8113                 __isl_take isl_union_pw_multi_aff *upma,
8114                 __isl_take isl_union_set *context);
8115         __isl_give isl_multi_union_pw_aff *
8116         isl_multi_union_pw_aff_gist_params(
8117                 __isl_take isl_multi_union_pw_aff *mupa,
8118                 __isl_take isl_set *context);
8119         __isl_give isl_multi_union_pw_aff *
8120         isl_multi_union_pw_aff_gist(
8121                 __isl_take isl_multi_union_pw_aff *mupa,
8122                 __isl_take isl_union_set *context);
8124         #include <isl/polynomial.h>
8125         __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
8126                 __isl_take isl_qpolynomial *qp,
8127                 __isl_take isl_set *context);
8128         __isl_give isl_qpolynomial *isl_qpolynomial_gist(
8129                 __isl_take isl_qpolynomial *qp,
8130                 __isl_take isl_set *context);
8131         __isl_give isl_qpolynomial_fold *
8132         isl_qpolynomial_fold_gist_params(
8133                 __isl_take isl_qpolynomial_fold *fold,
8134                 __isl_take isl_set *context);
8135         __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
8136                 __isl_take isl_qpolynomial_fold *fold,
8137                 __isl_take isl_set *context);
8138         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
8139                 __isl_take isl_pw_qpolynomial *pwqp,
8140                 __isl_take isl_set *context);
8141         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
8142                 __isl_take isl_pw_qpolynomial *pwqp,
8143                 __isl_take isl_set *context);
8144         __isl_give isl_pw_qpolynomial_fold *
8145         isl_pw_qpolynomial_fold_gist(
8146                 __isl_take isl_pw_qpolynomial_fold *pwf,
8147                 __isl_take isl_set *context);
8148         __isl_give isl_pw_qpolynomial_fold *
8149         isl_pw_qpolynomial_fold_gist_params(
8150                 __isl_take isl_pw_qpolynomial_fold *pwf,
8151                 __isl_take isl_set *context);
8152         __isl_give isl_union_pw_qpolynomial *
8153         isl_union_pw_qpolynomial_gist_params(
8154                 __isl_take isl_union_pw_qpolynomial *upwqp,
8155                 __isl_take isl_set *context);
8156         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
8157                 __isl_take isl_union_pw_qpolynomial *upwqp,
8158                 __isl_take isl_union_set *context);
8159         __isl_give isl_union_pw_qpolynomial_fold *
8160         isl_union_pw_qpolynomial_fold_gist(
8161                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
8162                 __isl_take isl_union_set *context);
8163         __isl_give isl_union_pw_qpolynomial_fold *
8164         isl_union_pw_qpolynomial_fold_gist_params(
8165                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
8166                 __isl_take isl_set *context);
8168 =item * Binary Arithmetic Operations
8170         #include <isl/set.h>
8171         __isl_give isl_set *isl_set_sum(
8172                 __isl_take isl_set *set1,
8173                 __isl_take isl_set *set2);
8174         #include <isl/map.h>
8175         __isl_give isl_map *isl_map_sum(
8176                 __isl_take isl_map *map1,
8177                 __isl_take isl_map *map2);
8179 C<isl_set_sum> computes the Minkowski sum of its two arguments,
8180 i.e., the set containing the sums of pairs of elements from
8181 C<set1> and C<set2>.
8182 The domain of the result of C<isl_map_sum> is the intersection
8183 of the domains of its two arguments.  The corresponding range
8184 elements are the sums of the corresponding range elements
8185 in the two arguments.
8187         #include <isl/val.h>
8188         __isl_give isl_multi_val *isl_multi_val_add(
8189                 __isl_take isl_multi_val *mv1,
8190                 __isl_take isl_multi_val *mv2);
8191         __isl_give isl_multi_val *isl_multi_val_sub(
8192                 __isl_take isl_multi_val *mv1,
8193                 __isl_take isl_multi_val *mv2);
8194         __isl_give isl_multi_val *isl_multi_val_min(
8195                 __isl_take isl_multi_val *mv1,
8196                 __isl_take isl_multi_val *mv2);
8197         __isl_give isl_multi_val *isl_multi_val_max(
8198                 __isl_take isl_multi_val *mv1,
8199                 __isl_take isl_multi_val *mv2);
8201         #include <isl/aff.h>
8202         __isl_give isl_aff *isl_aff_add(
8203                 __isl_take isl_aff *aff1,
8204                 __isl_take isl_aff *aff2);
8205         __isl_give isl_multi_aff *isl_multi_aff_add(
8206                 __isl_take isl_multi_aff *maff1,
8207                 __isl_take isl_multi_aff *maff2);
8208         __isl_give isl_pw_aff *isl_pw_aff_add(
8209                 __isl_take isl_pw_aff *pwaff1,
8210                 __isl_take isl_pw_aff *pwaff2);
8211         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add(
8212                 __isl_take isl_multi_pw_aff *mpa1,
8213                 __isl_take isl_multi_pw_aff *mpa2);
8214         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
8215                 __isl_take isl_pw_multi_aff *pma1,
8216                 __isl_take isl_pw_multi_aff *pma2);
8217         __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
8218                 __isl_take isl_union_pw_aff *upa1,
8219                 __isl_take isl_union_pw_aff *upa2);
8220         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
8221                 __isl_take isl_union_pw_multi_aff *upma1,
8222                 __isl_take isl_union_pw_multi_aff *upma2);
8223         __isl_give isl_multi_union_pw_aff *
8224         isl_multi_union_pw_aff_add(
8225                 __isl_take isl_multi_union_pw_aff *mupa1,
8226                 __isl_take isl_multi_union_pw_aff *mupa2);
8227         __isl_give isl_pw_aff *isl_pw_aff_add_constant_val(
8228                 __isl_take isl_pw_aff *pa,
8229                 __isl_take isl_val *v);
8230         __isl_give isl_multi_aff *
8231         isl_multi_aff_add_constant_val(
8232                 __isl_take isl_multi_aff *pa,
8233                 __isl_take isl_val *v);
8234         __isl_give isl_pw_multi_aff *
8235         isl_pw_multi_aff_add_constant_val(
8236                 __isl_take isl_pw_multi_aff *pma,
8237                 __isl_take isl_val *v);
8238         __isl_give isl_pw_multi_aff *
8239         isl_pw_multi_aff_add_constant_multi_val(
8240                 __isl_take isl_pw_multi_aff *pma,
8241                 __isl_take isl_multi_val *mv);
8242         __isl_give isl_multi_pw_aff *
8243         isl_multi_pw_aff_add_constant_val(
8244                 __isl_take isl_multi_pw_aff *mpa,
8245                 __isl_take isl_val *v);
8246         __isl_give isl_multi_aff *
8247         isl_multi_aff_add_constant_multi_val(
8248                 __isl_take isl_multi_aff *pa,
8249                 __isl_take isl_multi_val *mv);
8250         __isl_give isl_multi_pw_aff *
8251         isl_multi_pw_aff_add_constant_multi_val(
8252                 __isl_take isl_multi_pw_aff *mpa,
8253                 __isl_take isl_multi_val *mv);
8254         __isl_give isl_pw_aff *isl_pw_aff_min(
8255                 __isl_take isl_pw_aff *pwaff1,
8256                 __isl_take isl_pw_aff *pwaff2);
8257         __isl_give isl_pw_aff *isl_pw_aff_max(
8258                 __isl_take isl_pw_aff *pwaff1,
8259                 __isl_take isl_pw_aff *pwaff2);
8260         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_min(
8261                 __isl_take isl_multi_pw_aff *mpa1,
8262                 __isl_take isl_multi_pw_aff *mpa2);
8263         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_max(
8264                 __isl_take isl_multi_pw_aff *mpa1,
8265                 __isl_take isl_multi_pw_aff *mpa2);
8266         __isl_give isl_aff *isl_aff_sub(
8267                 __isl_take isl_aff *aff1,
8268                 __isl_take isl_aff *aff2);
8269         __isl_give isl_multi_aff *isl_multi_aff_sub(
8270                 __isl_take isl_multi_aff *ma1,
8271                 __isl_take isl_multi_aff *ma2);
8272         __isl_give isl_pw_aff *isl_pw_aff_sub(
8273                 __isl_take isl_pw_aff *pwaff1,
8274                 __isl_take isl_pw_aff *pwaff2);
8275         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
8276                 __isl_take isl_multi_pw_aff *mpa1,
8277                 __isl_take isl_multi_pw_aff *mpa2);
8278         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
8279                 __isl_take isl_pw_multi_aff *pma1,
8280                 __isl_take isl_pw_multi_aff *pma2);
8281         __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
8282                 __isl_take isl_union_pw_aff *upa1,
8283                 __isl_take isl_union_pw_aff *upa2);
8284         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
8285                 __isl_take isl_union_pw_multi_aff *upma1,
8286                 __isl_take isl_union_pw_multi_aff *upma2);
8287         __isl_give isl_multi_union_pw_aff *
8288         isl_multi_union_pw_aff_sub(
8289                 __isl_take isl_multi_union_pw_aff *mupa1,
8290                 __isl_take isl_multi_union_pw_aff *mupa2);
8292 C<isl_aff_sub> subtracts the second argument from the first.
8294         #include <isl/polynomial.h>
8295         __isl_give isl_qpolynomial *isl_qpolynomial_add(
8296                 __isl_take isl_qpolynomial *qp1,
8297                 __isl_take isl_qpolynomial *qp2);
8298         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
8299                 __isl_take isl_pw_qpolynomial *pwqp1,
8300                 __isl_take isl_pw_qpolynomial *pwqp2);
8301         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
8302                 __isl_take isl_pw_qpolynomial *pwqp1,
8303                 __isl_take isl_pw_qpolynomial *pwqp2);
8304         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
8305                 __isl_take isl_pw_qpolynomial_fold *pwf1,
8306                 __isl_take isl_pw_qpolynomial_fold *pwf2);
8307         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
8308                 __isl_take isl_union_pw_qpolynomial *upwqp1,
8309                 __isl_take isl_union_pw_qpolynomial *upwqp2);
8310         __isl_give isl_qpolynomial *isl_qpolynomial_sub(
8311                 __isl_take isl_qpolynomial *qp1,
8312                 __isl_take isl_qpolynomial *qp2);
8313         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
8314                 __isl_take isl_pw_qpolynomial *pwqp1,
8315                 __isl_take isl_pw_qpolynomial *pwqp2);
8316         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
8317                 __isl_take isl_union_pw_qpolynomial *upwqp1,
8318                 __isl_take isl_union_pw_qpolynomial *upwqp2);
8319         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
8320                 __isl_take isl_pw_qpolynomial_fold *pwf1,
8321                 __isl_take isl_pw_qpolynomial_fold *pwf2);
8322         __isl_give isl_union_pw_qpolynomial_fold *
8323         isl_union_pw_qpolynomial_fold_fold(
8324                 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
8325                 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
8327         #include <isl/aff.h>
8328         __isl_give isl_pw_aff *isl_pw_aff_union_add(
8329                 __isl_take isl_pw_aff *pwaff1,
8330                 __isl_take isl_pw_aff *pwaff2);
8331         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_union_add(
8332                 __isl_take isl_multi_pw_aff *mpa1,
8333                 __isl_take isl_multi_pw_aff *mpa2);
8334         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
8335                 __isl_take isl_pw_multi_aff *pma1,
8336                 __isl_take isl_pw_multi_aff *pma2);
8337         __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
8338                 __isl_take isl_union_pw_aff *upa1,
8339                 __isl_take isl_union_pw_aff *upa2);
8340         __isl_give isl_union_pw_multi_aff *
8341         isl_union_pw_multi_aff_union_add(
8342                 __isl_take isl_union_pw_multi_aff *upma1,
8343                 __isl_take isl_union_pw_multi_aff *upma2);
8344         __isl_give isl_multi_union_pw_aff *
8345         isl_multi_union_pw_aff_union_add(
8346                 __isl_take isl_multi_union_pw_aff *mupa1,
8347                 __isl_take isl_multi_union_pw_aff *mupa2);
8348         __isl_give isl_pw_aff *isl_pw_aff_union_min(
8349                 __isl_take isl_pw_aff *pwaff1,
8350                 __isl_take isl_pw_aff *pwaff2);
8351         __isl_give isl_pw_aff *isl_pw_aff_union_max(
8352                 __isl_take isl_pw_aff *pwaff1,
8353                 __isl_take isl_pw_aff *pwaff2);
8355 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
8356 expression with a domain that is the union of those of C<pwaff1> and
8357 C<pwaff2> and such that on each cell, the quasi-affine expression is
8358 the maximum of those of C<pwaff1> and C<pwaff2>.  If only one of
8359 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
8360 associated expression is the defined one.
8361 This in contrast to the C<isl_pw_aff_max> function, which is
8362 only defined on the shared definition domain of the arguments.
8364         #include <isl/val.h>
8365         __isl_give isl_multi_val *isl_multi_val_add_val(
8366                 __isl_take isl_multi_val *mv,
8367                 __isl_take isl_val *v);
8368         __isl_give isl_multi_val *isl_multi_val_mod_val(
8369                 __isl_take isl_multi_val *mv,
8370                 __isl_take isl_val *v);
8371         __isl_give isl_multi_val *isl_multi_val_scale_val(
8372                 __isl_take isl_multi_val *mv,
8373                 __isl_take isl_val *v);
8374         __isl_give isl_multi_val *isl_multi_val_scale_down_val(
8375                 __isl_take isl_multi_val *mv,
8376                 __isl_take isl_val *v);
8378         #include <isl/aff.h>
8379         __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
8380                 __isl_take isl_val *mod);
8381         __isl_give isl_pw_aff *isl_pw_aff_mod_val(
8382                 __isl_take isl_pw_aff *pa,
8383                 __isl_take isl_val *mod);
8384         __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
8385                 __isl_take isl_union_pw_aff *upa,
8386                 __isl_take isl_val *f);
8387         __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
8388                 __isl_take isl_val *v);
8389         __isl_give isl_multi_aff *isl_multi_aff_scale_val(
8390                 __isl_take isl_multi_aff *ma,
8391                 __isl_take isl_val *v);
8392         __isl_give isl_pw_aff *isl_pw_aff_scale_val(
8393                 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
8394         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
8395                 __isl_take isl_multi_pw_aff *mpa,
8396                 __isl_take isl_val *v);
8397         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
8398                 __isl_take isl_pw_multi_aff *pma,
8399                 __isl_take isl_val *v);
8400         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
8401                 __isl_take isl_union_pw_aff *upa,
8402                 __isl_take isl_val *f);
8403         __isl_give isl_union_pw_multi_aff *
8404         isl_union_pw_multi_aff_scale_val(
8405                 __isl_take isl_union_pw_multi_aff *upma,
8406                 __isl_take isl_val *val);
8407         __isl_give isl_multi_union_pw_aff *
8408         isl_multi_union_pw_aff_scale_val(
8409                 __isl_take isl_multi_union_pw_aff *mupa,
8410                 __isl_take isl_val *v);
8411         __isl_give isl_aff *isl_aff_scale_down_ui(
8412                 __isl_take isl_aff *aff, unsigned f);
8413         __isl_give isl_aff *isl_aff_scale_down_val(
8414                 __isl_take isl_aff *aff, __isl_take isl_val *v);
8415         __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
8416                 __isl_take isl_multi_aff *ma,
8417                 __isl_take isl_val *v);
8418         __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
8419                 __isl_take isl_pw_aff *pa,
8420                 __isl_take isl_val *f);
8421         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
8422                 __isl_take isl_multi_pw_aff *mpa,
8423                 __isl_take isl_val *v);
8424         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
8425                 __isl_take isl_pw_multi_aff *pma,
8426                 __isl_take isl_val *v);
8427         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
8428                 __isl_take isl_union_pw_aff *upa,
8429                 __isl_take isl_val *v);
8430         __isl_give isl_union_pw_multi_aff *
8431         isl_union_pw_multi_aff_scale_down_val(
8432                 __isl_take isl_union_pw_multi_aff *upma,
8433                 __isl_take isl_val *val);
8434         __isl_give isl_multi_union_pw_aff *
8435         isl_multi_union_pw_aff_scale_down_val(
8436                 __isl_take isl_multi_union_pw_aff *mupa,
8437                 __isl_take isl_val *v);
8439         #include <isl/polynomial.h>
8440         __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
8441                 __isl_take isl_qpolynomial *qp,
8442                 __isl_take isl_val *v);
8443         __isl_give isl_qpolynomial_fold *
8444         isl_qpolynomial_fold_scale_val(
8445                 __isl_take isl_qpolynomial_fold *fold,
8446                 __isl_take isl_val *v);
8447         __isl_give isl_pw_qpolynomial *
8448         isl_pw_qpolynomial_scale_val(
8449                 __isl_take isl_pw_qpolynomial *pwqp,
8450                 __isl_take isl_val *v);
8451         __isl_give isl_pw_qpolynomial_fold *
8452         isl_pw_qpolynomial_fold_scale_val(
8453                 __isl_take isl_pw_qpolynomial_fold *pwf,
8454                 __isl_take isl_val *v);
8455         __isl_give isl_union_pw_qpolynomial *
8456         isl_union_pw_qpolynomial_scale_val(
8457                 __isl_take isl_union_pw_qpolynomial *upwqp,
8458                 __isl_take isl_val *v);
8459         __isl_give isl_union_pw_qpolynomial_fold *
8460         isl_union_pw_qpolynomial_fold_scale_val(
8461                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
8462                 __isl_take isl_val *v);
8463         __isl_give isl_qpolynomial *
8464         isl_qpolynomial_scale_down_val(
8465                 __isl_take isl_qpolynomial *qp,
8466                 __isl_take isl_val *v);
8467         __isl_give isl_qpolynomial_fold *
8468         isl_qpolynomial_fold_scale_down_val(
8469                 __isl_take isl_qpolynomial_fold *fold,
8470                 __isl_take isl_val *v);
8471         __isl_give isl_pw_qpolynomial *
8472         isl_pw_qpolynomial_scale_down_val(
8473                 __isl_take isl_pw_qpolynomial *pwqp,
8474                 __isl_take isl_val *v);
8475         __isl_give isl_pw_qpolynomial_fold *
8476         isl_pw_qpolynomial_fold_scale_down_val(
8477                 __isl_take isl_pw_qpolynomial_fold *pwf,
8478                 __isl_take isl_val *v);
8479         __isl_give isl_union_pw_qpolynomial *
8480         isl_union_pw_qpolynomial_scale_down_val(
8481                 __isl_take isl_union_pw_qpolynomial *upwqp,
8482                 __isl_take isl_val *v);
8483         __isl_give isl_union_pw_qpolynomial_fold *
8484         isl_union_pw_qpolynomial_fold_scale_down_val(
8485                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
8486                 __isl_take isl_val *v);
8488         #include <isl/val.h>
8489         __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
8490                 __isl_take isl_multi_val *mv1,
8491                 __isl_take isl_multi_val *mv2);
8492         __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
8493                 __isl_take isl_multi_val *mv1,
8494                 __isl_take isl_multi_val *mv2);
8495         __isl_give isl_multi_val *
8496         isl_multi_val_scale_down_multi_val(
8497                 __isl_take isl_multi_val *mv1,
8498                 __isl_take isl_multi_val *mv2);
8500         #include <isl/aff.h>
8501         __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
8502                 __isl_take isl_multi_aff *ma,
8503                 __isl_take isl_multi_val *mv);
8504         __isl_give isl_multi_union_pw_aff *
8505         isl_multi_union_pw_aff_mod_multi_val(
8506                 __isl_take isl_multi_union_pw_aff *upma,
8507                 __isl_take isl_multi_val *mv);
8508         __isl_give isl_multi_pw_aff *
8509         isl_multi_pw_aff_mod_multi_val(
8510                 __isl_take isl_multi_pw_aff *mpa,
8511                 __isl_take isl_multi_val *mv);
8512         __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
8513                 __isl_take isl_multi_aff *ma,
8514                 __isl_take isl_multi_val *mv);
8515         __isl_give isl_pw_multi_aff *
8516         isl_pw_multi_aff_scale_multi_val(
8517                 __isl_take isl_pw_multi_aff *pma,
8518                 __isl_take isl_multi_val *mv);
8519         __isl_give isl_multi_pw_aff *
8520         isl_multi_pw_aff_scale_multi_val(
8521                 __isl_take isl_multi_pw_aff *mpa,
8522                 __isl_take isl_multi_val *mv);
8523         __isl_give isl_multi_union_pw_aff *
8524         isl_multi_union_pw_aff_scale_multi_val(
8525                 __isl_take isl_multi_union_pw_aff *mupa,
8526                 __isl_take isl_multi_val *mv);
8527         __isl_give isl_union_pw_multi_aff *
8528         isl_union_pw_multi_aff_scale_multi_val(
8529                 __isl_take isl_union_pw_multi_aff *upma,
8530                 __isl_take isl_multi_val *mv);
8531         __isl_give isl_multi_aff *
8532         isl_multi_aff_scale_down_multi_val(
8533                 __isl_take isl_multi_aff *ma,
8534                 __isl_take isl_multi_val *mv);
8535         __isl_give isl_multi_pw_aff *
8536         isl_multi_pw_aff_scale_down_multi_val(
8537                 __isl_take isl_multi_pw_aff *mpa,
8538                 __isl_take isl_multi_val *mv);
8539         __isl_give isl_multi_union_pw_aff *
8540         isl_multi_union_pw_aff_scale_down_multi_val(
8541                 __isl_take isl_multi_union_pw_aff *mupa,
8542                 __isl_take isl_multi_val *mv);
8544 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
8545 by the corresponding elements of C<mv>.
8547         #include <isl/aff.h>
8548         __isl_give isl_aff *isl_aff_mul(
8549                 __isl_take isl_aff *aff1,
8550                 __isl_take isl_aff *aff2);
8551         __isl_give isl_aff *isl_aff_div(
8552                 __isl_take isl_aff *aff1,
8553                 __isl_take isl_aff *aff2);
8554         __isl_give isl_pw_aff *isl_pw_aff_mul(
8555                 __isl_take isl_pw_aff *pwaff1,
8556                 __isl_take isl_pw_aff *pwaff2);
8557         __isl_give isl_pw_aff *isl_pw_aff_div(
8558                 __isl_take isl_pw_aff *pa1,
8559                 __isl_take isl_pw_aff *pa2);
8560         __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
8561                 __isl_take isl_pw_aff *pa1,
8562                 __isl_take isl_pw_aff *pa2);
8563         __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
8564                 __isl_take isl_pw_aff *pa1,
8565                 __isl_take isl_pw_aff *pa2);
8567 When multiplying two affine expressions, at least one of the two needs
8568 to be a constant.  Similarly, when dividing an affine expression by another,
8569 the second expression needs to be a constant.
8570 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
8571 rounding towards zero.  C<isl_pw_aff_tdiv_r> computes the corresponding
8572 remainder.
8574         #include <isl/polynomial.h>
8575         __isl_give isl_qpolynomial *isl_qpolynomial_mul(
8576                 __isl_take isl_qpolynomial *qp1,
8577                 __isl_take isl_qpolynomial *qp2);
8578         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
8579                 __isl_take isl_pw_qpolynomial *pwqp1,
8580                 __isl_take isl_pw_qpolynomial *pwqp2);
8581         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
8582                 __isl_take isl_union_pw_qpolynomial *upwqp1,
8583                 __isl_take isl_union_pw_qpolynomial *upwqp2);
8585 =back
8587 =head3 Lexicographic Optimization
8589 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
8590 the following functions
8591 compute a set that contains the lexicographic minimum or maximum
8592 of the elements in C<set> (or C<bset>) for those values of the parameters
8593 that satisfy C<dom>.
8594 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
8595 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
8596 has no elements.
8597 In other words, the union of the parameter values
8598 for which the result is non-empty and of C<*empty>
8599 is equal to C<dom>.
8601         #include <isl/set.h>
8602         __isl_give isl_set *isl_basic_set_partial_lexmin(
8603                 __isl_take isl_basic_set *bset,
8604                 __isl_take isl_basic_set *dom,
8605                 __isl_give isl_set **empty);
8606         __isl_give isl_set *isl_basic_set_partial_lexmax(
8607                 __isl_take isl_basic_set *bset,
8608                 __isl_take isl_basic_set *dom,
8609                 __isl_give isl_set **empty);
8610         __isl_give isl_set *isl_set_partial_lexmin(
8611                 __isl_take isl_set *set, __isl_take isl_set *dom,
8612                 __isl_give isl_set **empty);
8613         __isl_give isl_set *isl_set_partial_lexmax(
8614                 __isl_take isl_set *set, __isl_take isl_set *dom,
8615                 __isl_give isl_set **empty);
8617 Given a (basic) set C<set> (or C<bset>), the following functions simply
8618 return a set containing the lexicographic minimum or maximum
8619 of the elements in C<set> (or C<bset>).
8620 In case of union sets, the optimum is computed per space.
8622         #include <isl/set.h>
8623         __isl_give isl_set *isl_basic_set_lexmin(
8624                 __isl_take isl_basic_set *bset);
8625         __isl_give isl_set *isl_basic_set_lexmax(
8626                 __isl_take isl_basic_set *bset);
8627         __isl_give isl_set *isl_set_lexmin(
8628                 __isl_take isl_set *set);
8629         __isl_give isl_set *isl_set_lexmax(
8630                 __isl_take isl_set *set);
8631         __isl_give isl_union_set *isl_union_set_lexmin(
8632                 __isl_take isl_union_set *uset);
8633         __isl_give isl_union_set *isl_union_set_lexmax(
8634                 __isl_take isl_union_set *uset);
8636 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
8637 the following functions
8638 compute a relation that maps each element of C<dom>
8639 to the single lexicographic minimum or maximum
8640 of the elements that are associated to that same
8641 element in C<map> (or C<bmap>).
8642 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
8643 that contains the elements in C<dom> that do not map
8644 to any elements in C<map> (or C<bmap>).
8645 In other words, the union of the domain of the result and of C<*empty>
8646 is equal to C<dom>.
8648         #include <isl/map.h>
8649         __isl_give isl_map *isl_basic_map_partial_lexmax(
8650                 __isl_take isl_basic_map *bmap,
8651                 __isl_take isl_basic_set *dom,
8652                 __isl_give isl_set **empty);
8653         __isl_give isl_map *isl_basic_map_partial_lexmin(
8654                 __isl_take isl_basic_map *bmap,
8655                 __isl_take isl_basic_set *dom,
8656                 __isl_give isl_set **empty);
8657         __isl_give isl_map *isl_map_partial_lexmax(
8658                 __isl_take isl_map *map, __isl_take isl_set *dom,
8659                 __isl_give isl_set **empty);
8660         __isl_give isl_map *isl_map_partial_lexmin(
8661                 __isl_take isl_map *map, __isl_take isl_set *dom,
8662                 __isl_give isl_set **empty);
8664 Given a (basic) map C<map> (or C<bmap>), the following functions simply
8665 return a map mapping each element in the domain of
8666 C<map> (or C<bmap>) to the lexicographic minimum or maximum
8667 of all elements associated to that element.
8668 In case of union relations, the optimum is computed per space.
8670         #include <isl/map.h>
8671         __isl_give isl_map *isl_basic_map_lexmin(
8672                 __isl_take isl_basic_map *bmap);
8673         __isl_give isl_map *isl_basic_map_lexmax(
8674                 __isl_take isl_basic_map *bmap);
8675         __isl_give isl_map *isl_map_lexmin(
8676                 __isl_take isl_map *map);
8677         __isl_give isl_map *isl_map_lexmax(
8678                 __isl_take isl_map *map);
8679         __isl_give isl_union_map *isl_union_map_lexmin(
8680                 __isl_take isl_union_map *umap);
8681         __isl_give isl_union_map *isl_union_map_lexmax(
8682                 __isl_take isl_union_map *umap);
8684 The following functions return their result in the form of
8685 a piecewise multi-affine expression,
8686 but are otherwise equivalent to the corresponding functions
8687 returning a basic set or relation.
8689         #include <isl/set.h>
8690         __isl_give isl_pw_multi_aff *
8691         isl_basic_set_partial_lexmin_pw_multi_aff(
8692                 __isl_take isl_basic_set *bset,
8693                 __isl_take isl_basic_set *dom,
8694                 __isl_give isl_set **empty);
8695         __isl_give isl_pw_multi_aff *
8696         isl_basic_set_partial_lexmax_pw_multi_aff(
8697                 __isl_take isl_basic_set *bset,
8698                 __isl_take isl_basic_set *dom,
8699                 __isl_give isl_set **empty);
8700         __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
8701                 __isl_take isl_set *set);
8702         __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
8703                 __isl_take isl_set *set);
8705         #include <isl/map.h>
8706         __isl_give isl_pw_multi_aff *
8707         isl_basic_map_lexmin_pw_multi_aff(
8708                 __isl_take isl_basic_map *bmap);
8709         __isl_give isl_pw_multi_aff *
8710         isl_basic_map_partial_lexmin_pw_multi_aff(
8711                 __isl_take isl_basic_map *bmap,
8712                 __isl_take isl_basic_set *dom,
8713                 __isl_give isl_set **empty);
8714         __isl_give isl_pw_multi_aff *
8715         isl_basic_map_partial_lexmax_pw_multi_aff(
8716                 __isl_take isl_basic_map *bmap,
8717                 __isl_take isl_basic_set *dom,
8718                 __isl_give isl_set **empty);
8719         __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
8720                 __isl_take isl_map *map);
8721         __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
8722                 __isl_take isl_map *map);
8724 The following functions return the lexicographic minimum or maximum
8725 on the shared domain of the inputs and the single defined function
8726 on those parts of the domain where only a single function is defined.
8728         #include <isl/aff.h>
8729         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
8730                 __isl_take isl_pw_multi_aff *pma1,
8731                 __isl_take isl_pw_multi_aff *pma2);
8732         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
8733                 __isl_take isl_pw_multi_aff *pma1,
8734                 __isl_take isl_pw_multi_aff *pma2);
8736 If the input to a lexicographic optimization problem has
8737 multiple constraints with the same coefficients for the optimized
8738 variables, then, by default, this symmetry is exploited by
8739 replacing those constraints by a single constraint with
8740 an abstract bound, which is in turn bounded by the corresponding terms
8741 in the original constraints.
8742 Without this optimization, the solver would typically consider
8743 all possible orderings of those original bounds, resulting in a needless
8744 decomposition of the domain.
8745 However, the optimization can also result in slowdowns since
8746 an extra parameter is introduced that may get used in additional
8747 integer divisions.
8748 The following option determines whether symmetry detection is applied
8749 during lexicographic optimization.
8751         #include <isl/options.h>
8752         isl_stat isl_options_set_pip_symmetry(isl_ctx *ctx,
8753                 int val);
8754         int isl_options_get_pip_symmetry(isl_ctx *ctx);
8756 =begin latex
8758 See also \autoref{s:offline}.
8760 =end latex
8762 =head2 Ternary Operations
8764         #include <isl/aff.h>
8765         __isl_give isl_pw_aff *isl_pw_aff_cond(
8766                 __isl_take isl_pw_aff *cond,
8767                 __isl_take isl_pw_aff *pwaff_true,
8768                 __isl_take isl_pw_aff *pwaff_false);
8770 The function C<isl_pw_aff_cond> performs a conditional operator
8771 and returns an expression that is equal to C<pwaff_true>
8772 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
8773 where C<cond> is zero.
8775 =head2 Lists
8777 Lists are defined over several element types, including
8778 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_pw_multi_aff>,
8779 C<isl_union_pw_aff>,
8780 C<isl_union_pw_multi_aff>,
8781 C<isl_pw_qpolynomial>, C<isl_pw_qpolynomial_fold>,
8782 C<isl_constraint>,
8783 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
8784 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
8785 Here we take lists of C<isl_set>s as an example.
8786 Lists can be created, copied, modified and freed using the following functions.
8788         #include <isl/set.h>
8789         __isl_give isl_set_list *isl_set_list_from_set(
8790                 __isl_take isl_set *el);
8791         __isl_give isl_set_list *isl_set_list_alloc(
8792                 isl_ctx *ctx, int n);
8793         __isl_give isl_set_list *isl_set_list_copy(
8794                 __isl_keep isl_set_list *list);
8795         __isl_give isl_set_list *isl_set_list_insert(
8796                 __isl_take isl_set_list *list, unsigned pos,
8797                 __isl_take isl_set *el);
8798         __isl_give isl_set_list *isl_set_list_add(
8799                 __isl_take isl_set_list *list,
8800                 __isl_take isl_set *el);
8801         __isl_give isl_set_list *isl_set_list_drop(
8802                 __isl_take isl_set_list *list,
8803                 unsigned first, unsigned n);
8804         __isl_give isl_set_list *isl_set_list_clear(
8805                 __isl_take isl_set_list *list);
8806         __isl_give isl_set_list *isl_set_list_swap(
8807                 __isl_take isl_set_list *list,
8808                 unsigned pos1, unsigned pos2);
8809         __isl_give isl_set_list *isl_set_list_reverse(
8810                 __isl_take isl_set_list *list);
8811         __isl_give isl_set_list *isl_set_list_set_set(
8812                 __isl_take isl_set_list *list, int index,
8813                 __isl_take isl_set *set);
8814         __isl_give isl_set_list *isl_set_list_concat(
8815                 __isl_take isl_set_list *list1,
8816                 __isl_take isl_set_list *list2);
8817         __isl_give isl_set_list *isl_set_list_map(
8818                 __isl_take isl_set_list *list,
8819                 __isl_give isl_set *(*fn)(__isl_take isl_set *el,
8820                         void *user),
8821                 void *user);
8822         __isl_give isl_set_list *isl_set_list_sort(
8823                 __isl_take isl_set_list *list,
8824                 int (*cmp)(__isl_keep isl_set *a,
8825                         __isl_keep isl_set *b, void *user),
8826                 void *user);
8827         __isl_null isl_set_list *isl_set_list_free(
8828                 __isl_take isl_set_list *list);
8830 C<isl_set_list_alloc> creates an empty list with an initial capacity
8831 for C<n> elements.  C<isl_set_list_insert> and C<isl_set_list_add>
8832 add elements to a list, increasing its capacity as needed.
8833 C<isl_set_list_from_set> creates a list with a single element.
8834 C<isl_set_list_clear> removes all elements from a list.
8835 C<isl_set_list_swap> swaps the elements at the specified locations.
8836 C<isl_set_list_reverse> reverses the elements in the list.
8838 Lists can be inspected using the following functions.
8840         #include <isl/set.h>
8841         isl_size isl_set_list_size(__isl_keep isl_set_list *list);
8842         isl_size isl_set_list_n_set(__isl_keep isl_set_list *list);
8843         __isl_give isl_set *isl_set_list_get_at(
8844                 __isl_keep isl_set_list *list, int index);
8845         __isl_give isl_set *isl_set_list_get_set(
8846                 __isl_keep isl_set_list *list, int index);
8847         isl_stat isl_set_list_foreach(__isl_keep isl_set_list *list,
8848                 isl_stat (*fn)(__isl_take isl_set *el, void *user),
8849                 void *user);
8850         isl_bool isl_set_list_every(__isl_keep isl_set_list *list,
8851                 isl_bool (*test)(__isl_take isl_set *el,
8852                         void *user),
8853                 void *user);
8854         isl_stat isl_set_list_foreach_scc(
8855                 __isl_keep isl_set_list *list,
8856                 isl_bool (*follows)(__isl_keep isl_set *a,
8857                         __isl_keep isl_set *b, void *user),
8858                 void *follows_user,
8859                 isl_stat (*fn)(__isl_take isl_set *el, void *user),
8860                 void *fn_user);
8862 C<isl_set_list_n_set> is an alternative name for C<isl_set_list_size>.
8863 Similarly,
8864 C<isl_set_list_get_set> is an alternative name for C<isl_set_list_get_at>.
8865 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
8866 strongly connected components of the graph with as vertices the elements
8867 of C<list> and a directed edge from vertex C<b> to vertex C<a>
8868 iff C<follows(a, b)> returns C<isl_bool_true>.  The callbacks C<follows> and
8869 C<fn> should return C<isl_bool_error> or C<isl_stat_error> on error.
8871 Lists can be printed using
8873         #include <isl/set.h>
8874         __isl_give isl_printer *isl_printer_print_set_list(
8875                 __isl_take isl_printer *p,
8876                 __isl_keep isl_set_list *list);
8878 Alternatively, a string representation can be obtained
8879 directly using the following function, which always prints
8880 in isl format.
8882         #include <isl/set.h>
8883         __isl_give char *isl_set_list_to_str(
8884                 __isl_keep isl_set_list *list);
8886 =head2 Associative arrays
8888 Associative arrays map isl objects of a specific type to isl objects
8889 of some (other) specific type.  They are defined for several pairs
8890 of types, including (C<isl_map>, C<isl_basic_set>),
8891 (C<isl_id>, C<isl_ast_expr>),
8892 (C<isl_id>, C<isl_id>) and
8893 (C<isl_id>, C<isl_pw_aff>).
8894 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
8895 as an example.
8897 Associative arrays can be created, copied and freed using
8898 the following functions.
8900         #include <isl/id_to_ast_expr.h>
8901         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
8902                 isl_ctx *ctx, int min_size);
8903         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
8904                 __isl_keep isl_id_to_ast_expr *id2expr);
8905         __isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
8906                 __isl_take isl_id_to_ast_expr *id2expr);
8908 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
8909 to specify the expected size of the associative array.
8910 The associative array will be grown automatically as needed.
8912 Associative arrays can be inspected using the following functions.
8914         #include <isl/id_to_ast_expr.h>
8915         __isl_give isl_maybe_isl_ast_expr
8916         isl_id_to_ast_expr_try_get(
8917                 __isl_keep isl_id_to_ast_expr *id2expr,
8918                 __isl_keep isl_id *key);
8919         isl_bool isl_id_to_ast_expr_has(
8920                 __isl_keep isl_id_to_ast_expr *id2expr,
8921                 __isl_keep isl_id *key);
8922         __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
8923                 __isl_keep isl_id_to_ast_expr *id2expr,
8924                 __isl_take isl_id *key);
8925         isl_stat isl_id_to_ast_expr_foreach(
8926                 __isl_keep isl_id_to_ast_expr *id2expr,
8927                 isl_stat (*fn)(__isl_take isl_id *key,
8928                         __isl_take isl_ast_expr *val, void *user),
8929                 void *user);
8931 The function C<isl_id_to_ast_expr_try_get> returns a structure
8932 containing two elements, C<valid> and C<value>.
8933 If there is a value associated to the key, then C<valid>
8934 is set to C<isl_bool_true> and C<value> contains a copy of
8935 the associated value.  Otherwise C<value> is C<NULL> and
8936 C<valid> may be C<isl_bool_error> or C<isl_bool_false> depending
8937 on whether some error has occurred or there simply is no associated value.
8938 The function C<isl_id_to_ast_expr_has> returns the C<valid> field
8939 in the structure and
8940 the function C<isl_id_to_ast_expr_get> returns the C<value> field.
8942 Associative arrays can be modified using the following functions.
8944         #include <isl/id_to_ast_expr.h>
8945         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
8946                 __isl_take isl_id_to_ast_expr *id2expr,
8947                 __isl_take isl_id *key,
8948                 __isl_take isl_ast_expr *val);
8949         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
8950                 __isl_take isl_id_to_ast_expr *id2expr,
8951                 __isl_take isl_id *key);
8953 Associative arrays can be printed using the following function.
8955         #include <isl/id_to_ast_expr.h>
8956         __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
8957                 __isl_take isl_printer *p,
8958                 __isl_keep isl_id_to_ast_expr *id2expr);
8960 =head2 Vectors
8962 Vectors can be created, copied and freed using the following functions.
8964         #include <isl/vec.h>
8965         __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
8966                 unsigned size);
8967         __isl_give isl_vec *isl_vec_zero(isl_ctx *ctx,
8968                 unsigned size);
8969         __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
8970         __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
8972 Note that the elements of a vector created by C<isl_vec_alloc>
8973 may have arbitrary values.
8974 A vector created by C<isl_vec_zero> has elements with value zero.
8975 The elements can be changed and inspected using the following functions.
8977         isl_size isl_vec_size(__isl_keep isl_vec *vec);
8978         __isl_give isl_val *isl_vec_get_element_val(
8979                 __isl_keep isl_vec *vec, int pos);
8980         __isl_give isl_vec *isl_vec_set_element_si(
8981                 __isl_take isl_vec *vec, int pos, int v);
8982         __isl_give isl_vec *isl_vec_set_element_val(
8983                 __isl_take isl_vec *vec, int pos,
8984                 __isl_take isl_val *v);
8985         __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
8986                 int v);
8987         __isl_give isl_vec *isl_vec_set_val(
8988                 __isl_take isl_vec *vec, __isl_take isl_val *v);
8989         int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
8990                 __isl_keep isl_vec *vec2, int pos);
8992 C<isl_vec_get_element> will return a negative value if anything went wrong.
8993 In that case, the value of C<*v> is undefined.
8995 The following function can be used to concatenate two vectors.
8997         __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
8998                 __isl_take isl_vec *vec2);
9000 =head2 Matrices
9002 Matrices can be created, copied and freed using the following functions.
9004         #include <isl/mat.h>
9005         __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
9006                 unsigned n_row, unsigned n_col);
9007         __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
9008         __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
9010 Note that the elements of a newly created matrix may have arbitrary values.
9011 The elements can be changed and inspected using the following functions.
9013         isl_size isl_mat_rows(__isl_keep isl_mat *mat);
9014         isl_size isl_mat_cols(__isl_keep isl_mat *mat);
9015         __isl_give isl_val *isl_mat_get_element_val(
9016                 __isl_keep isl_mat *mat, int row, int col);
9017         __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
9018                 int row, int col, int v);
9019         __isl_give isl_mat *isl_mat_set_element_val(
9020                 __isl_take isl_mat *mat, int row, int col,
9021                 __isl_take isl_val *v);
9023 The following function computes the rank of a matrix.
9024 The return value may be -1 if some error occurred.
9026         #include <isl/mat.h>
9027         isl_size isl_mat_rank(__isl_keep isl_mat *mat);
9029 The following function can be used to compute the (right) inverse
9030 of a matrix, i.e., a matrix such that the product of the original
9031 and the inverse (in that order) is a multiple of the identity matrix.
9032 The input matrix is assumed to be of full row-rank.
9034         __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
9036 The following function can be used to compute the (right) kernel
9037 (or null space) of a matrix, i.e., a matrix such that the product of
9038 the original and the kernel (in that order) is the zero matrix.
9040         __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
9042 The following function computes a basis for the space spanned
9043 by the rows of a matrix.
9045         __isl_give isl_mat *isl_mat_row_basis(
9046                 __isl_take isl_mat *mat);
9048 The following function computes rows that extend a basis of C<mat1>
9049 to a basis that also covers C<mat2>.
9051         __isl_give isl_mat *isl_mat_row_basis_extension(
9052                 __isl_take isl_mat *mat1,
9053                 __isl_take isl_mat *mat2);
9055 The following function checks whether there is no linear dependence
9056 among the combined rows of "mat1" and "mat2" that is not already present
9057 in "mat1" or "mat2" individually.
9058 If "mat1" and "mat2" have linearly independent rows by themselves,
9059 then this means that there is no linear dependence among all rows together.
9061         isl_bool isl_mat_has_linearly_independent_rows(
9062                 __isl_keep isl_mat *mat1,
9063                 __isl_keep isl_mat *mat2);
9065 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
9067 The following functions determine
9068 an upper or lower bound on a quasipolynomial over its domain.
9070         __isl_give isl_pw_qpolynomial_fold *
9071         isl_pw_qpolynomial_bound(
9072                 __isl_take isl_pw_qpolynomial *pwqp,
9073                 enum isl_fold type, isl_bool *tight);
9075         __isl_give isl_union_pw_qpolynomial_fold *
9076         isl_union_pw_qpolynomial_bound(
9077                 __isl_take isl_union_pw_qpolynomial *upwqp,
9078                 enum isl_fold type, isl_bool *tight);
9080 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
9081 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
9082 is the returned bound is known be tight, i.e., for each value
9083 of the parameters there is at least
9084 one element in the domain that reaches the bound.
9085 If the domain of C<pwqp> is not wrapping, then the bound is computed
9086 over all elements in that domain and the result has a purely parametric
9087 domain.  If the domain of C<pwqp> is wrapping, then the bound is
9088 computed over the range of the wrapped relation.  The domain of the
9089 wrapped relation becomes the domain of the result.
9091 =head2 Parametric Vertex Enumeration
9093 The parametric vertex enumeration described in this section
9094 is mainly intended to be used internally and by the C<barvinok>
9095 library.
9097         #include <isl/vertices.h>
9098         __isl_give isl_vertices *isl_basic_set_compute_vertices(
9099                 __isl_keep isl_basic_set *bset);
9101 The function C<isl_basic_set_compute_vertices> performs the
9102 actual computation of the parametric vertices and the chamber
9103 decomposition and stores the result in an C<isl_vertices> object.
9104 This information can be queried by either iterating over all
9105 the vertices or iterating over all the chambers or cells
9106 and then iterating over all vertices that are active on the chamber.
9108         isl_stat isl_vertices_foreach_vertex(
9109                 __isl_keep isl_vertices *vertices,
9110                 isl_stat (*fn)(__isl_take isl_vertex *vertex,
9111                         void *user), void *user);
9113         isl_stat isl_vertices_foreach_cell(
9114                 __isl_keep isl_vertices *vertices,
9115                 isl_stat (*fn)(__isl_take isl_cell *cell,
9116                         void *user), void *user);
9117         isl_stat isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
9118                 isl_stat (*fn)(__isl_take isl_vertex *vertex,
9119                         void *user), void *user);
9121 Other operations that can be performed on an C<isl_vertices> object are
9122 the following.
9124         isl_size isl_vertices_get_n_vertices(
9125                 __isl_keep isl_vertices *vertices);
9126         __isl_null isl_vertices *isl_vertices_free(
9127                 __isl_take isl_vertices *vertices);
9129 Vertices can be inspected and destroyed using the following functions.
9131         isl_size isl_vertex_get_id(__isl_keep isl_vertex *vertex);
9132         __isl_give isl_basic_set *isl_vertex_get_domain(
9133                 __isl_keep isl_vertex *vertex);
9134         __isl_give isl_multi_aff *isl_vertex_get_expr(
9135                 __isl_keep isl_vertex *vertex);
9136         __isl_null isl_vertex *isl_vertex_free(
9137                 __isl_take isl_vertex *vertex);
9139 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
9140 describing the vertex in terms of the parameters,
9141 while C<isl_vertex_get_domain> returns the activity domain
9142 of the vertex.
9144 Chambers can be inspected and destroyed using the following functions.
9146         __isl_give isl_basic_set *isl_cell_get_domain(
9147                 __isl_keep isl_cell *cell);
9148         __isl_null isl_cell *isl_cell_free(
9149                 __isl_take isl_cell *cell);
9151 =head1 Polyhedral Compilation Library
9153 This section collects functionality in C<isl> that has been specifically
9154 designed for use during polyhedral compilation.
9156 =head2 Schedule Trees
9158 A schedule tree is a structured representation of a schedule,
9159 assigning a relative order to a set of domain elements.
9160 The relative order expressed by the schedule tree is
9161 defined recursively.  In particular, the order between
9162 two domain elements is determined by the node that is closest
9163 to the root that refers to both elements and that orders them apart.
9164 Each node in the tree is of one of several types.
9165 The root node is always of type C<isl_schedule_node_domain>
9166 (or C<isl_schedule_node_extension>)
9167 and it describes the (extra) domain elements to which the schedule applies.
9168 The other types of nodes are as follows.
9170 =over
9172 =item C<isl_schedule_node_band>
9174 A band of schedule dimensions.  Each schedule dimension is represented
9175 by a union piecewise quasi-affine expression.  If this expression
9176 assigns a different value to two domain elements, while all previous
9177 schedule dimensions in the same band assign them the same value,
9178 then the two domain elements are ordered according to these two
9179 different values.
9180 Each expression is required to be total in the domain elements
9181 that reach the band node.
9183 =item C<isl_schedule_node_expansion>
9185 An expansion node maps each of the domain elements that reach the node
9186 to one or more domain elements.  The image of this mapping forms
9187 the set of domain elements that reach the child of the expansion node.
9188 The function that maps each of the expanded domain elements
9189 to the original domain element from which it was expanded
9190 is called the contraction.
9192 =item C<isl_schedule_node_filter>
9194 A filter node does not impose any ordering, but rather intersects
9195 the set of domain elements that the current subtree refers to
9196 with a given union set.  The subtree of the filter node only
9197 refers to domain elements in the intersection.
9198 A filter node is typically only used as a child of a sequence or
9199 set node.
9201 =item C<isl_schedule_node_leaf>
9203 A leaf of the schedule tree.  Leaf nodes do not impose any ordering.
9205 =item C<isl_schedule_node_mark>
9207 A mark node can be used to attach any kind of information to a subtree
9208 of the schedule tree.
9210 =item C<isl_schedule_node_sequence>
9212 A sequence node has one or more children, each of which is a filter node.
9213 The filters on these filter nodes form a partition of
9214 the domain elements that the current subtree refers to.
9215 If two domain elements appear in distinct filters then the sequence
9216 node orders them according to the child positions of the corresponding
9217 filter nodes.
9219 =item C<isl_schedule_node_set>
9221 A set node is similar to a sequence node, except that
9222 it expresses that domain elements appearing in distinct filters
9223 may have any order.  The order of the children of a set node
9224 is therefore also immaterial.
9226 =back
9228 The following node types are only supported by the AST generator.
9230 =over
9232 =item C<isl_schedule_node_context>
9234 The context describes constraints on the parameters and
9235 the schedule dimensions of outer
9236 bands that the AST generator may assume to hold.  It is also the only
9237 kind of node that may introduce additional parameters.
9238 The space of the context is that of the flat product of the outer
9239 band nodes.  In particular, if there are no outer band nodes, then
9240 this space is the unnamed zero-dimensional space.
9241 Since a context node references the outer band nodes, any tree
9242 containing a context node is considered to be anchored.
9244 =item C<isl_schedule_node_extension>
9246 An extension node instructs the AST generator to add additional
9247 domain elements that need to be scheduled.
9248 The additional domain elements are described by the range of
9249 the extension map in terms of the outer schedule dimensions,
9250 i.e., the flat product of the outer band nodes.
9251 Note that domain elements are added whenever the AST generator
9252 reaches the extension node, meaning that there are still some
9253 active domain elements for which an AST needs to be generated.
9254 The conditions under which some domain elements are still active
9255 may however not be completely described by the outer AST nodes
9256 generated at that point.
9257 Since an extension node references the outer band nodes, any tree
9258 containing an extension node is considered to be anchored.
9260 An extension node may also appear as the root of a schedule tree,
9261 when it is intended to be inserted into another tree
9262 using C<isl_schedule_node_graft_before> or C<isl_schedule_node_graft_after>.
9263 In this case, the domain of the extension node should
9264 correspond to the flat product of the outer band nodes
9265 in this other schedule tree at the point where the extension tree
9266 will be inserted.
9268 =item C<isl_schedule_node_guard>
9270 The guard describes constraints on the parameters and
9271 the schedule dimensions of outer
9272 bands that need to be enforced by the outer nodes
9273 in the generated AST.
9274 That is, the part of the AST that is generated from descendants
9275 of the guard node can assume that these constraints are satisfied.
9276 The space of the guard is that of the flat product of the outer
9277 band nodes.  In particular, if there are no outer band nodes, then
9278 this space is the unnamed zero-dimensional space.
9279 Since a guard node references the outer band nodes, any tree
9280 containing a guard node is considered to be anchored.
9282 =back
9284 Except for the C<isl_schedule_node_context> nodes,
9285 none of the nodes may introduce any parameters that were not
9286 already present in the root domain node.
9288 A schedule tree is encapsulated in an C<isl_schedule> object.
9289 The simplest such objects, those with a tree consisting of single domain node,
9290 can be created using the following functions with either an empty
9291 domain or a given domain.
9293         #include <isl/schedule.h>
9294         __isl_give isl_schedule *isl_schedule_empty(
9295                 __isl_take isl_space *space);
9296         __isl_give isl_schedule *isl_schedule_from_domain(
9297                 __isl_take isl_union_set *domain);
9299 The function C<isl_schedule_constraints_compute_schedule> described
9300 in L</"Scheduling"> can also be used to construct schedules.
9302 C<isl_schedule> objects may be copied and freed using the following functions.
9304         #include <isl/schedule.h>
9305         __isl_give isl_schedule *isl_schedule_copy(
9306                 __isl_keep isl_schedule *sched);
9307         __isl_null isl_schedule *isl_schedule_free(
9308                 __isl_take isl_schedule *sched);
9310 The following functions checks whether two C<isl_schedule> objects
9311 are obviously the same.
9313         #include <isl/schedule.h>
9314         isl_bool isl_schedule_plain_is_equal(
9315                 __isl_keep isl_schedule *schedule1,
9316                 __isl_keep isl_schedule *schedule2);
9318 The domain of the schedule, i.e., the domain described by the root node,
9319 can be obtained using the following function.
9321         #include <isl/schedule.h>
9322         __isl_give isl_union_set *isl_schedule_get_domain(
9323                 __isl_keep isl_schedule *schedule);
9325 An extra top-level band node (right underneath the domain node) can
9326 be introduced into the schedule using the following function.
9327 The schedule tree is assumed not to have any anchored nodes.
9329         #include <isl/schedule.h>
9330         __isl_give isl_schedule *
9331         isl_schedule_insert_partial_schedule(
9332                 __isl_take isl_schedule *schedule,
9333                 __isl_take isl_multi_union_pw_aff *partial);
9335 A top-level context node (right underneath the domain node) can
9336 be introduced into the schedule using the following function.
9338         #include <isl/schedule.h>
9339         __isl_give isl_schedule *isl_schedule_insert_context(
9340                 __isl_take isl_schedule *schedule,
9341                 __isl_take isl_set *context)
9343 A top-level guard node (right underneath the domain node) can
9344 be introduced into the schedule using the following function.
9346         #include <isl/schedule.h>
9347         __isl_give isl_schedule *isl_schedule_insert_guard(
9348                 __isl_take isl_schedule *schedule,
9349                 __isl_take isl_set *guard)
9351 A schedule that combines two schedules either in the given
9352 order or in an arbitrary order, i.e., with an C<isl_schedule_node_sequence>
9353 or an C<isl_schedule_node_set> node,
9354 can be created using the following functions.
9356         #include <isl/schedule.h>
9357         __isl_give isl_schedule *isl_schedule_sequence(
9358                 __isl_take isl_schedule *schedule1,
9359                 __isl_take isl_schedule *schedule2);
9360         __isl_give isl_schedule *isl_schedule_set(
9361                 __isl_take isl_schedule *schedule1,
9362                 __isl_take isl_schedule *schedule2);
9364 The domains of the two input schedules need to be disjoint.
9366 The following function can be used to restrict the domain
9367 of a schedule with a domain node as root to be a subset of the given union set.
9368 This operation may remove nodes in the tree that have become
9369 redundant.
9371         #include <isl/schedule.h>
9372         __isl_give isl_schedule *isl_schedule_intersect_domain(
9373                 __isl_take isl_schedule *schedule,
9374                 __isl_take isl_union_set *domain);
9376 The following function can be used to simplify the domain
9377 of a schedule with a domain node as root with respect to the given
9378 parameter domain.
9380         #include <isl/schedule.h>
9381         __isl_give isl_schedule *isl_schedule_gist_domain_params(
9382                 __isl_take isl_schedule *schedule,
9383                 __isl_take isl_set *context);
9385 The following function resets the user pointers on all parameter
9386 and tuple identifiers referenced by the nodes of the given schedule.
9388         #include <isl/schedule.h>
9389         __isl_give isl_schedule *isl_schedule_reset_user(
9390                 __isl_take isl_schedule *schedule);
9392 The following function aligns the parameters of all nodes
9393 in the given schedule to the given space.
9395         #include <isl/schedule.h>
9396         __isl_give isl_schedule *isl_schedule_align_params(
9397                 __isl_take isl_schedule *schedule,
9398                 __isl_take isl_space *space);
9400 The following function allows the user to plug in a given function
9401 in the iteration domains.  The input schedule is not allowed to contain
9402 any expansion nodes.
9404         #include <isl/schedule.h>
9405         __isl_give isl_schedule *
9406         isl_schedule_pullback_union_pw_multi_aff(
9407                 __isl_take isl_schedule *schedule,
9408                 __isl_take isl_union_pw_multi_aff *upma);
9410 The following function can be used to plug in the schedule C<expansion>
9411 in the leaves of C<schedule>, where C<contraction> describes how
9412 the domain elements of C<expansion> map to the domain elements
9413 at the original leaves of C<schedule>.
9414 The resulting schedule will contain expansion nodes, unless
9415 C<contraction> is an identity function.
9417         #include <isl/schedule.h>
9418         __isl_give isl_schedule *isl_schedule_expand(
9419                 __isl_take isl_schedule *schedule,
9420                 __isl_take isl_union_pw_multi_aff *contraction,
9421                 __isl_take isl_schedule *expansion);
9423 An C<isl_union_map> representation of the schedule can be obtained
9424 from an C<isl_schedule> using the following function.
9426         #include <isl/schedule.h>
9427         __isl_give isl_union_map *isl_schedule_get_map(
9428                 __isl_keep isl_schedule *sched);
9430 The resulting relation encodes the same relative ordering as
9431 the schedule by mapping the domain elements to a common schedule space.
9432 If the schedule_separate_components option is set, then the order
9433 of the children of a set node is explicitly encoded in the result.
9434 If the tree contains any expansion nodes, then the relation
9435 is formulated in terms of the expanded domain elements.
9437 Schedules can be read from input using the following functions.
9439         #include <isl/schedule.h>
9440         __isl_give isl_schedule *isl_schedule_read_from_file(
9441                 isl_ctx *ctx, FILE *input);
9442         __isl_give isl_schedule *isl_schedule_read_from_str(
9443                 isl_ctx *ctx, const char *str);
9445 A representation of the schedule can be printed using
9447         #include <isl/schedule.h>
9448         __isl_give isl_printer *isl_printer_print_schedule(
9449                 __isl_take isl_printer *p,
9450                 __isl_keep isl_schedule *schedule);
9451         __isl_give char *isl_schedule_to_str(
9452                 __isl_keep isl_schedule *schedule);
9454 C<isl_schedule_to_str> prints the schedule in flow format.
9456 The schedule tree can be traversed through the use of
9457 C<isl_schedule_node> objects that point to a particular
9458 position in the schedule tree.  Whenever a C<isl_schedule_node>
9459 is used to modify a node in the schedule tree, the original schedule
9460 tree is left untouched and the modifications are performed to a copy
9461 of the tree.  The returned C<isl_schedule_node> then points to
9462 this modified copy of the tree.
9464 The root of the schedule tree can be obtained using the following function.
9466         #include <isl/schedule.h>
9467         __isl_give isl_schedule_node *isl_schedule_get_root(
9468                 __isl_keep isl_schedule *schedule);
9470 A pointer to a newly created schedule tree with a single domain
9471 node can be created using the following functions.
9473         #include <isl/schedule_node.h>
9474         __isl_give isl_schedule_node *
9475         isl_schedule_node_from_domain(
9476                 __isl_take isl_union_set *domain);
9477         __isl_give isl_schedule_node *
9478         isl_schedule_node_from_extension(
9479                 __isl_take isl_union_map *extension);
9481 C<isl_schedule_node_from_extension> creates a tree with an extension
9482 node as root.
9484 Schedule nodes can be copied and freed using the following functions.
9486         #include <isl/schedule_node.h>
9487         __isl_give isl_schedule_node *isl_schedule_node_copy(
9488                 __isl_keep isl_schedule_node *node);
9489         __isl_null isl_schedule_node *isl_schedule_node_free(
9490                 __isl_take isl_schedule_node *node);
9492 The following functions can be used to check if two schedule
9493 nodes point to the same position in the same schedule.
9495         #include <isl/schedule_node.h>
9496         isl_bool isl_schedule_node_is_equal(
9497                 __isl_keep isl_schedule_node *node1,
9498                 __isl_keep isl_schedule_node *node2);
9500 The following properties can be obtained from a schedule node.
9502         #include <isl/schedule_node.h>
9503         enum isl_schedule_node_type isl_schedule_node_get_type(
9504                 __isl_keep isl_schedule_node *node);
9505         enum isl_schedule_node_type
9506         isl_schedule_node_get_parent_type(
9507                 __isl_keep isl_schedule_node *node);
9508         __isl_give isl_schedule *isl_schedule_node_get_schedule(
9509                 __isl_keep isl_schedule_node *node);
9511 The function C<isl_schedule_node_get_type> returns the type of
9512 the node, while C<isl_schedule_node_get_parent_type> returns
9513 type of the parent of the node, which is required to exist.
9514 The function C<isl_schedule_node_get_schedule> returns a copy
9515 to the schedule to which the node belongs.
9517 The following functions can be used to move the schedule node
9518 to a different position in the tree or to check if such a position
9519 exists.
9521         #include <isl/schedule_node.h>
9522         isl_bool isl_schedule_node_has_parent(
9523                 __isl_keep isl_schedule_node *node);
9524         __isl_give isl_schedule_node *isl_schedule_node_parent(
9525                 __isl_take isl_schedule_node *node);
9526         __isl_give isl_schedule_node *isl_schedule_node_root(
9527                 __isl_take isl_schedule_node *node);
9528         __isl_give isl_schedule_node *isl_schedule_node_ancestor(
9529                 __isl_take isl_schedule_node *node,
9530                 int generation);
9531         isl_size isl_schedule_node_n_children(
9532                 __isl_keep isl_schedule_node *node);
9533         __isl_give isl_schedule_node *isl_schedule_node_child(
9534                 __isl_take isl_schedule_node *node, int pos);
9535         isl_bool isl_schedule_node_has_children(
9536                 __isl_keep isl_schedule_node *node);
9537         __isl_give isl_schedule_node *isl_schedule_node_first_child(
9538                 __isl_take isl_schedule_node *node);
9539         isl_bool isl_schedule_node_has_previous_sibling(
9540                 __isl_keep isl_schedule_node *node);
9541         __isl_give isl_schedule_node *
9542         isl_schedule_node_previous_sibling(
9543                 __isl_take isl_schedule_node *node);
9544         isl_bool isl_schedule_node_has_next_sibling(
9545                 __isl_keep isl_schedule_node *node);
9546         __isl_give isl_schedule_node *
9547         isl_schedule_node_next_sibling(
9548                 __isl_take isl_schedule_node *node);
9550 For C<isl_schedule_node_ancestor>, the ancestor of generation 0
9551 is the node itself, the ancestor of generation 1 is its parent and so on.
9553 It is also possible to query the number of ancestors of a node,
9554 the position of the current node
9555 within the children of its parent, the position of the subtree
9556 containing a node within the children of an ancestor
9557 or to obtain a copy of a given
9558 child without destroying the current node.
9559 Given two nodes that point to the same schedule, their closest
9560 shared ancestor can be obtained using
9561 C<isl_schedule_node_get_shared_ancestor>.
9563         #include <isl/schedule_node.h>
9564         isl_size isl_schedule_node_get_tree_depth(
9565                 __isl_keep isl_schedule_node *node);
9566         isl_size isl_schedule_node_get_child_position(
9567                 __isl_keep isl_schedule_node *node);
9568         isl_size isl_schedule_node_get_ancestor_child_position(
9569                 __isl_keep isl_schedule_node *node,
9570                 __isl_keep isl_schedule_node *ancestor);
9571         __isl_give isl_schedule_node *isl_schedule_node_get_child(
9572                 __isl_keep isl_schedule_node *node, int pos);
9573         __isl_give isl_schedule_node *
9574         isl_schedule_node_get_shared_ancestor(
9575                 __isl_keep isl_schedule_node *node1,
9576                 __isl_keep isl_schedule_node *node2);
9578 All nodes in a schedule tree or
9579 all descendants of a specific node (including the node) can be visited
9580 in depth-first pre-order using the following functions.
9582         #include <isl/schedule.h>
9583         isl_stat isl_schedule_foreach_schedule_node_top_down(
9584                 __isl_keep isl_schedule *sched,
9585                 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
9586                         void *user), void *user);
9588         #include <isl/schedule_node.h>
9589         isl_stat isl_schedule_node_foreach_descendant_top_down(
9590                 __isl_keep isl_schedule_node *node,
9591                 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
9592                         void *user), void *user);
9594 The callback function is slightly different from the usual
9595 callbacks in that it not only indicates success (non-negative result)
9596 or failure (negative result), but also indicates whether the children
9597 of the given node should be visited.  In particular, if the callback
9598 returns a positive value, then the children are visited, but if
9599 the callback returns zero, then the children are not visited.
9601 The following functions checks whether
9602 all descendants of a specific node (including the node itself)
9603 satisfy a user-specified test.
9605         #include <isl/schedule_node.h>
9606         isl_bool isl_schedule_node_every_descendant(
9607                 __isl_keep isl_schedule_node *node,
9608                 isl_bool (*test)(__isl_keep isl_schedule_node *node,
9609                         void *user), void *user)
9611 The ancestors of a node in a schedule tree can be visited from
9612 the root down to and including the parent of the node using
9613 the following function.
9615         #include <isl/schedule_node.h>
9616         isl_stat isl_schedule_node_foreach_ancestor_top_down(
9617                 __isl_keep isl_schedule_node *node,
9618                 isl_stat (*fn)(__isl_keep isl_schedule_node *node,
9619                         void *user), void *user);
9621 The following functions allows for a depth-first post-order
9622 traversal of the nodes in a schedule tree or
9623 of the descendants of a specific node (including the node
9624 itself), where the user callback is allowed to modify the
9625 visited node.
9627         #include <isl/schedule.h>
9628         __isl_give isl_schedule *
9629         isl_schedule_map_schedule_node_bottom_up(
9630                 __isl_take isl_schedule *schedule,
9631                 __isl_give isl_schedule_node *(*fn)(
9632                         __isl_take isl_schedule_node *node,
9633                         void *user), void *user);
9635         #include <isl/schedule_node.h>
9636         __isl_give isl_schedule_node *
9637         isl_schedule_node_map_descendant_bottom_up(
9638                 __isl_take isl_schedule_node *node,
9639                 __isl_give isl_schedule_node *(*fn)(
9640                         __isl_take isl_schedule_node *node,
9641                         void *user), void *user);
9643 The traversal continues from the node returned by the callback function.
9644 It is the responsibility of the user to ensure that this does not
9645 lead to an infinite loop.  It is safest to always return a pointer
9646 to the same position (same ancestors and child positions) as the input node.
9648 The following function removes a node (along with its descendants)
9649 from a schedule tree and returns a pointer to the leaf at the
9650 same position in the updated tree.
9651 It is not allowed to remove the root of a schedule tree or
9652 a child of a set or sequence node.
9654         #include <isl/schedule_node.h>
9655         __isl_give isl_schedule_node *isl_schedule_node_cut(
9656                 __isl_take isl_schedule_node *node);
9658 The following function removes a single node
9659 from a schedule tree and returns a pointer to the child
9660 of the node, now located at the position of the original node
9661 or to a leaf node at that position if there was no child.
9662 It is not allowed to remove the root of a schedule tree,
9663 a set or sequence node, a child of a set or sequence node or
9664 a band node with an anchored subtree.
9666         #include <isl/schedule_node.h>
9667         __isl_give isl_schedule_node *isl_schedule_node_delete(
9668                 __isl_take isl_schedule_node *node);
9670 Most nodes in a schedule tree only contain local information.
9671 In some cases, however, a node may also refer to the schedule dimensions
9672 of its outer band nodes.
9673 This means that the position of the node within the tree should
9674 not be changed, or at least that no changes are performed to the
9675 outer band nodes.  The following function can be used to test
9676 whether the subtree rooted at a given node contains any such nodes.
9678         #include <isl/schedule_node.h>
9679         isl_bool isl_schedule_node_is_subtree_anchored(
9680                 __isl_keep isl_schedule_node *node);
9682 The following function resets the user pointers on all parameter
9683 and tuple identifiers referenced by the given schedule node.
9685         #include <isl/schedule_node.h>
9686         __isl_give isl_schedule_node *isl_schedule_node_reset_user(
9687                 __isl_take isl_schedule_node *node);
9689 The following function aligns the parameters of the given schedule
9690 node to the given space.
9692         #include <isl/schedule_node.h>
9693         __isl_give isl_schedule_node *
9694         isl_schedule_node_align_params(
9695                 __isl_take isl_schedule_node *node,
9696                 __isl_take isl_space *space);
9698 Several node types have their own functions for querying
9699 (and in some cases setting) some node type specific properties.
9701         #include <isl/schedule_node.h>
9702         __isl_give isl_space *isl_schedule_node_band_get_space(
9703                 __isl_keep isl_schedule_node *node);
9704         __isl_give isl_multi_union_pw_aff *
9705         isl_schedule_node_band_get_partial_schedule(
9706                 __isl_keep isl_schedule_node *node);
9707         __isl_give isl_union_map *
9708         isl_schedule_node_band_get_partial_schedule_union_map(
9709                 __isl_keep isl_schedule_node *node);
9710         isl_size isl_schedule_node_band_n_member(
9711                 __isl_keep isl_schedule_node *node);
9712         isl_bool isl_schedule_node_band_member_get_coincident(
9713                 __isl_keep isl_schedule_node *node, int pos);
9714         __isl_give isl_schedule_node *
9715         isl_schedule_node_band_member_set_coincident(
9716                 __isl_take isl_schedule_node *node, int pos,
9717                 int coincident);
9718         isl_bool isl_schedule_node_band_get_permutable(
9719                 __isl_keep isl_schedule_node *node);
9720         __isl_give isl_schedule_node *
9721         isl_schedule_node_band_set_permutable(
9722                 __isl_take isl_schedule_node *node, int permutable);
9723         enum isl_ast_loop_type
9724         isl_schedule_node_band_member_get_ast_loop_type(
9725                 __isl_keep isl_schedule_node *node, int pos);
9726         __isl_give isl_schedule_node *
9727         isl_schedule_node_band_member_set_ast_loop_type(
9728                 __isl_take isl_schedule_node *node, int pos,
9729                 enum isl_ast_loop_type type);
9730         enum isl_ast_loop_type
9731         isl_schedule_node_band_member_get_isolate_ast_loop_type(
9732                 __isl_keep isl_schedule_node *node, int pos);
9733         __isl_give isl_schedule_node *
9734         isl_schedule_node_band_member_set_isolate_ast_loop_type(
9735                 __isl_take isl_schedule_node *node, int pos,
9736                 enum isl_ast_loop_type type);
9737         __isl_give isl_union_set *
9738         isl_schedule_node_band_get_ast_build_options(
9739                 __isl_keep isl_schedule_node *node);
9740         __isl_give isl_schedule_node *
9741         isl_schedule_node_band_set_ast_build_options(
9742                 __isl_take isl_schedule_node *node,
9743                 __isl_take isl_union_set *options);
9744         __isl_give isl_set *
9745         isl_schedule_node_band_get_ast_isolate_option(
9746                 __isl_keep isl_schedule_node *node);
9748 The function C<isl_schedule_node_band_get_space> returns the space
9749 of the partial schedule of the band.
9750 The function C<isl_schedule_node_band_get_partial_schedule_union_map>
9751 returns a representation of the partial schedule of the band node
9752 in the form of an C<isl_union_map>.
9753 The coincident and permutable properties are set by
9754 C<isl_schedule_constraints_compute_schedule> on the schedule tree
9755 it produces.
9756 A scheduling dimension is considered to be ``coincident''
9757 if it satisfies the coincidence constraints within its band.
9758 That is, if the dependence distances of the coincidence
9759 constraints are all zero in that direction (for fixed
9760 iterations of outer bands).
9761 A band is marked permutable if it was produced using the Pluto-like scheduler.
9762 Note that the scheduler may have to resort to a Feautrier style scheduling
9763 step even if the default scheduler is used.
9764 An C<isl_ast_loop_type> is one of C<isl_ast_loop_default>,
9765 C<isl_ast_loop_atomic>, C<isl_ast_loop_unroll> or C<isl_ast_loop_separate>.
9766 For the meaning of these loop AST generation types and the difference
9767 between the regular loop AST generation type and the isolate
9768 loop AST generation type, see L</"AST Generation Options (Schedule Tree)">.
9769 The functions C<isl_schedule_node_band_member_get_ast_loop_type>
9770 and C<isl_schedule_node_band_member_get_isolate_ast_loop_type>
9771 may return C<isl_ast_loop_error> if an error occurs.
9772 The AST build options govern how an AST is generated for
9773 the individual schedule dimensions during AST generation.
9774 See L</"AST Generation Options (Schedule Tree)">.
9775 The isolate option for the given node can be extracted from these
9776 AST build options using the function
9777 C<isl_schedule_node_band_get_ast_isolate_option>.
9779         #include <isl/schedule_node.h>
9780         __isl_give isl_set *
9781         isl_schedule_node_context_get_context(
9782                 __isl_keep isl_schedule_node *node);
9784         #include <isl/schedule_node.h>
9785         __isl_give isl_union_set *
9786         isl_schedule_node_domain_get_domain(
9787                 __isl_keep isl_schedule_node *node);
9789         #include <isl/schedule_node.h>
9790         __isl_give isl_union_map *
9791         isl_schedule_node_expansion_get_expansion(
9792                 __isl_keep isl_schedule_node *node);
9793         __isl_give isl_union_pw_multi_aff *
9794         isl_schedule_node_expansion_get_contraction(
9795                 __isl_keep isl_schedule_node *node);
9797         #include <isl/schedule_node.h>
9798         __isl_give isl_union_map *
9799         isl_schedule_node_extension_get_extension(
9800                 __isl_keep isl_schedule_node *node);
9802         #include <isl/schedule_node.h>
9803         __isl_give isl_union_set *
9804         isl_schedule_node_filter_get_filter(
9805                 __isl_keep isl_schedule_node *node);
9807         #include <isl/schedule_node.h>
9808         __isl_give isl_set *isl_schedule_node_guard_get_guard(
9809                 __isl_keep isl_schedule_node *node);
9811         #include <isl/schedule_node.h>
9812         __isl_give isl_id *isl_schedule_node_mark_get_id(
9813                 __isl_keep isl_schedule_node *node);
9815 The following functions can be used to obtain an C<isl_multi_union_pw_aff>,
9816 an C<isl_union_pw_multi_aff> or C<isl_union_map> representation of
9817 partial schedules related to the node.
9819         #include <isl/schedule_node.h>
9820         __isl_give isl_multi_union_pw_aff *
9821         isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(
9822                 __isl_keep isl_schedule_node *node);
9823         __isl_give isl_union_pw_multi_aff *
9824         isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(
9825                 __isl_keep isl_schedule_node *node);
9826         __isl_give isl_union_map *
9827         isl_schedule_node_get_prefix_schedule_union_map(
9828                 __isl_keep isl_schedule_node *node);
9829         __isl_give isl_union_map *
9830         isl_schedule_node_get_prefix_schedule_relation(
9831                 __isl_keep isl_schedule_node *node);
9832         __isl_give isl_union_map *
9833         isl_schedule_node_get_subtree_schedule_union_map(
9834                 __isl_keep isl_schedule_node *node);
9836 In particular, the functions
9837 C<isl_schedule_node_get_prefix_schedule_multi_union_pw_aff>,
9838 C<isl_schedule_node_get_prefix_schedule_union_pw_multi_aff>
9839 and C<isl_schedule_node_get_prefix_schedule_union_map>
9840 return a relative ordering on the domain elements that reach the given
9841 node determined by its ancestors.
9842 The function C<isl_schedule_node_get_prefix_schedule_relation>
9843 additionally includes the domain constraints in the result.
9844 The function C<isl_schedule_node_get_subtree_schedule_union_map>
9845 returns a representation of the partial schedule defined by the
9846 subtree rooted at the given node.
9847 If the tree contains any expansion nodes, then the subtree schedule
9848 is formulated in terms of the expanded domain elements.
9849 The tree passed to functions returning a prefix schedule
9850 may only contain extension nodes if these would not affect
9851 the result of these functions.  That is, if one of the ancestors
9852 is an extension node, then all of the domain elements that were
9853 added by the extension node need to have been filtered out
9854 by filter nodes between the extension node and the input node.
9855 The tree passed to C<isl_schedule_node_get_subtree_schedule_union_map>
9856 may not contain in extension nodes in the selected subtree.
9858 The expansion/contraction defined by an entire subtree, combining
9859 the expansions/contractions
9860 on the expansion nodes in the subtree, can be obtained using
9861 the following functions.
9863         #include <isl/schedule_node.h>
9864         __isl_give isl_union_map *
9865         isl_schedule_node_get_subtree_expansion(
9866                 __isl_keep isl_schedule_node *node);
9867         __isl_give isl_union_pw_multi_aff *
9868         isl_schedule_node_get_subtree_contraction(
9869                 __isl_keep isl_schedule_node *node);
9871 The total number of outer band members of given node, i.e.,
9872 the shared output dimension of the maps in the result
9873 of C<isl_schedule_node_get_prefix_schedule_union_map> can be obtained
9874 using the following function.
9876         #include <isl/schedule_node.h>
9877         isl_size isl_schedule_node_get_schedule_depth(
9878                 __isl_keep isl_schedule_node *node);
9880 The following functions return the elements that reach the given node
9881 or the union of universes in the spaces that contain these elements.
9883         #include <isl/schedule_node.h>
9884         __isl_give isl_union_set *
9885         isl_schedule_node_get_domain(
9886                 __isl_keep isl_schedule_node *node);
9887         __isl_give isl_union_set *
9888         isl_schedule_node_get_universe_domain(
9889                 __isl_keep isl_schedule_node *node);
9891 The input tree of C<isl_schedule_node_get_domain>
9892 may only contain extension nodes if these would not affect
9893 the result of this function.  That is, if one of the ancestors
9894 is an extension node, then all of the domain elements that were
9895 added by the extension node need to have been filtered out
9896 by filter nodes between the extension node and the input node.
9898 The following functions can be used to introduce additional nodes
9899 in the schedule tree.  The new node is introduced at the point
9900 in the tree where the C<isl_schedule_node> points to and
9901 the results points to the new node.
9903         #include <isl/schedule_node.h>
9904         __isl_give isl_schedule_node *
9905         isl_schedule_node_insert_partial_schedule(
9906                 __isl_take isl_schedule_node *node,
9907                 __isl_take isl_multi_union_pw_aff *schedule);
9909 This function inserts a new band node with (the greatest integer
9910 part of) the given partial schedule.
9911 The subtree rooted at the given node is assumed not to have
9912 any anchored nodes.
9914         #include <isl/schedule_node.h>
9915         __isl_give isl_schedule_node *
9916         isl_schedule_node_insert_context(
9917                 __isl_take isl_schedule_node *node,
9918                 __isl_take isl_set *context);
9920 This function inserts a new context node with the given context constraints.
9922         #include <isl/schedule_node.h>
9923         __isl_give isl_schedule_node *
9924         isl_schedule_node_insert_filter(
9925                 __isl_take isl_schedule_node *node,
9926                 __isl_take isl_union_set *filter);
9928 This function inserts a new filter node with the given filter.
9929 If the original node already pointed to a filter node, then the
9930 two filter nodes are merged into one.
9932         #include <isl/schedule_node.h>
9933         __isl_give isl_schedule_node *
9934         isl_schedule_node_insert_guard(
9935                 __isl_take isl_schedule_node *node,
9936                 __isl_take isl_set *guard);
9938 This function inserts a new guard node with the given guard constraints.
9940         #include <isl/schedule_node.h>
9941         __isl_give isl_schedule_node *
9942         isl_schedule_node_insert_mark(
9943                 __isl_take isl_schedule_node *node,
9944                 __isl_take isl_id *mark);
9946 This function inserts a new mark node with the give mark identifier.
9948         #include <isl/schedule_node.h>
9949         __isl_give isl_schedule_node *
9950         isl_schedule_node_insert_sequence(
9951                 __isl_take isl_schedule_node *node,
9952                 __isl_take isl_union_set_list *filters);
9953         __isl_give isl_schedule_node *
9954         isl_schedule_node_insert_set(
9955                 __isl_take isl_schedule_node *node,
9956                 __isl_take isl_union_set_list *filters);
9958 These functions insert a new sequence or set node with the given
9959 filters as children.
9961         #include <isl/schedule_node.h>
9962         __isl_give isl_schedule_node *isl_schedule_node_group(
9963                 __isl_take isl_schedule_node *node,
9964                 __isl_take isl_id *group_id);
9966 This function introduces an expansion node in between the current
9967 node and its parent that expands instances of a space with tuple
9968 identifier C<group_id> to the original domain elements that reach
9969 the node.  The group instances are identified by the prefix schedule
9970 of those domain elements.  The ancestors of the node are adjusted
9971 to refer to the group instances instead of the original domain
9972 elements.  The return value points to the same node in the updated
9973 schedule tree as the input node, i.e., to the child of the newly
9974 introduced expansion node.  Grouping instances of different statements
9975 ensures that they will be treated as a single statement by the
9976 AST generator up to the point of the expansion node.
9978 The following function can be used to flatten a nested
9979 sequence.
9981         #include <isl/schedule_node.h>
9982         __isl_give isl_schedule_node *
9983         isl_schedule_node_sequence_splice_child(
9984                 __isl_take isl_schedule_node *node, int pos);
9986 That is, given a sequence node C<node> that has another sequence node
9987 in its child at position C<pos> (in particular, the child of that filter
9988 node is a sequence node), attach the children of that other sequence
9989 node as children of C<node>, replacing the original child at position
9990 C<pos>.
9992 The partial schedule of a band node can be scaled (down) or reduced using
9993 the following functions.
9995         #include <isl/schedule_node.h>
9996         __isl_give isl_schedule_node *
9997         isl_schedule_node_band_scale(
9998                 __isl_take isl_schedule_node *node,
9999                 __isl_take isl_multi_val *mv);
10000         __isl_give isl_schedule_node *
10001         isl_schedule_node_band_scale_down(
10002                 __isl_take isl_schedule_node *node,
10003                 __isl_take isl_multi_val *mv);
10004         __isl_give isl_schedule_node *
10005         isl_schedule_node_band_mod(
10006                 __isl_take isl_schedule_node *node,
10007                 __isl_take isl_multi_val *mv);
10009 The spaces of the two arguments need to match.
10010 After scaling, the partial schedule is replaced by its greatest
10011 integer part to ensure that the schedule remains integral.
10013 The partial schedule of a band node can be shifted by an
10014 C<isl_multi_union_pw_aff> with a domain that is a superset
10015 of the domain of the partial schedule using
10016 the following function.
10018         #include <isl/schedule_node.h>
10019         __isl_give isl_schedule_node *
10020         isl_schedule_node_band_shift(
10021                 __isl_take isl_schedule_node *node,
10022                 __isl_take isl_multi_union_pw_aff *shift);
10024 A band node can be tiled using the following function.
10026         #include <isl/schedule_node.h>
10027         __isl_give isl_schedule_node *isl_schedule_node_band_tile(
10028                 __isl_take isl_schedule_node *node,
10029                 __isl_take isl_multi_val *sizes);
10031         isl_stat isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
10032                 int val);
10033         int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
10034         isl_stat isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
10035                 int val);
10036         int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
10038 The C<isl_schedule_node_band_tile> function tiles
10039 the band using the given tile sizes inside its schedule.
10040 A new child band node is created to represent the point loops and it is
10041 inserted between the modified band and its children.
10042 The subtree rooted at the given node is assumed not to have
10043 any anchored nodes.
10044 The C<tile_scale_tile_loops> option specifies whether the tile
10045 loops iterators should be scaled by the tile sizes.
10046 If the C<tile_shift_point_loops> option is set, then the point loops
10047 are shifted to start at zero.
10049 A band node can be split into two nested band nodes
10050 using the following function.
10052         #include <isl/schedule_node.h>
10053         __isl_give isl_schedule_node *isl_schedule_node_band_split(
10054                 __isl_take isl_schedule_node *node, int pos);
10056 The resulting outer band node contains the first C<pos> dimensions of
10057 the schedule of C<node> while the inner band contains the remaining dimensions.
10058 The schedules of the two band nodes live in anonymous spaces.
10059 The loop AST generation type options and the isolate option
10060 are split over the two band nodes.
10062 A band node can be moved down to the leaves of the subtree rooted
10063 at the band node using the following function.
10065         #include <isl/schedule_node.h>
10066         __isl_give isl_schedule_node *isl_schedule_node_band_sink(
10067                 __isl_take isl_schedule_node *node);
10069 The subtree rooted at the given node is assumed not to have
10070 any anchored nodes.
10071 The result points to the node in the resulting tree that is in the same
10072 position as the node pointed to by C<node> in the original tree.
10074         #include <isl/schedule_node.h>
10075         __isl_give isl_schedule_node *
10076         isl_schedule_node_order_before(
10077                 __isl_take isl_schedule_node *node,
10078                 __isl_take isl_union_set *filter);
10079         __isl_give isl_schedule_node *
10080         isl_schedule_node_order_after(
10081                 __isl_take isl_schedule_node *node,
10082                 __isl_take isl_union_set *filter);
10084 These functions split the domain elements that reach C<node>
10085 into those that satisfy C<filter> and those that do not and
10086 arranges for the elements that do satisfy the filter to be
10087 executed before (in case of C<isl_schedule_node_order_before>)
10088 or after (in case of C<isl_schedule_node_order_after>)
10089 those that do not.  The order is imposed by
10090 a sequence node, possibly reusing the grandparent of C<node>
10091 on two copies of the subtree attached to the original C<node>.
10092 Both copies are simplified with respect to their filter.
10094 Return a pointer to the copy of the subtree that does not
10095 satisfy C<filter>.  If there is no such copy (because all
10096 reaching domain elements satisfy the filter), then return
10097 the original pointer.
10099         #include <isl/schedule_node.h>
10100         __isl_give isl_schedule_node *
10101         isl_schedule_node_graft_before(
10102                 __isl_take isl_schedule_node *node,
10103                 __isl_take isl_schedule_node *graft);
10104         __isl_give isl_schedule_node *
10105         isl_schedule_node_graft_after(
10106                 __isl_take isl_schedule_node *node,
10107                 __isl_take isl_schedule_node *graft);
10109 This function inserts the C<graft> tree into the tree containing C<node>
10110 such that it is executed before (in case of C<isl_schedule_node_graft_before>)
10111 or after (in case of C<isl_schedule_node_graft_after>) C<node>.
10112 The root node of C<graft>
10113 should be an extension node where the domain of the extension
10114 is the flat product of all outer band nodes of C<node>.
10115 The root node may also be a domain node.
10116 The elements of the domain or the range of the extension may not
10117 intersect with the domain elements that reach "node".
10118 The schedule tree of C<graft> may not be anchored.
10120 The schedule tree of C<node> is modified to include an extension node
10121 corresponding to the root node of C<graft> as a child of the original
10122 parent of C<node>.  The original node that C<node> points to and the
10123 child of the root node of C<graft> are attached to this extension node
10124 through a sequence, with appropriate filters and with the child
10125 of C<graft> appearing before or after the original C<node>.
10127 If C<node> already appears inside a sequence that is the child of
10128 an extension node and if the spaces of the new domain elements
10129 do not overlap with those of the original domain elements,
10130 then that extension node is extended with the new extension
10131 rather than introducing a new segment of extension and sequence nodes.
10133 Return a pointer to the same node in the modified tree that
10134 C<node> pointed to in the original tree.
10136 A representation of the schedule node can be printed using
10138         #include <isl/schedule_node.h>
10139         __isl_give isl_printer *isl_printer_print_schedule_node(
10140                 __isl_take isl_printer *p,
10141                 __isl_keep isl_schedule_node *node);
10142         __isl_give char *isl_schedule_node_to_str(
10143                 __isl_keep isl_schedule_node *node);
10145 C<isl_schedule_node_to_str> prints the schedule node in block format.
10147 =head2 Dependence Analysis
10149 C<isl> contains specialized functionality for performing
10150 array dataflow analysis.  That is, given a I<sink> access relation,
10151 a collection of possible I<source> accesses and
10152 a collection of I<kill> accesses,
10153 C<isl> can compute relations that describe
10154 for each iteration of the sink access, which iterations
10155 of which of the source access relations may have
10156 accessed the same data element before the given iteration
10157 of the sink access without any intermediate kill of that data element.
10158 The resulting dependence relations map source iterations
10159 to either the corresponding sink iterations or
10160 pairs of corresponding sink iterations and accessed data elements.
10161 To compute standard flow dependences, the sink should be
10162 a read, while the sources should be writes.
10163 If no kills are specified,
10164 then memory based dependence analysis is performed.
10165 If, on the other hand, all sources are also kills,
10166 then value based dependence analysis is performed.
10167 If any of the source accesses are marked as being I<must>
10168 accesses, then they are also treated as kills.
10169 Furthermore, the specification of must-sources results
10170 in the computation of must-dependences.
10171 Only dependences originating in a must access not coscheduled
10172 with any other access to the same element and without
10173 any may accesses between the must access and the sink access
10174 are considered to be must dependences.
10176 =head3 High-level Interface
10178 A high-level interface to dependence analysis is provided
10179 by the following function.
10181         #include <isl/flow.h>
10182         __isl_give isl_union_flow *
10183         isl_union_access_info_compute_flow(
10184                 __isl_take isl_union_access_info *access);
10186 The input C<isl_union_access_info> object describes the sink
10187 access relations, the source access relations and a schedule,
10188 while the output C<isl_union_flow> object describes
10189 the resulting dependence relations and the subsets of the
10190 sink relations for which no source was found.
10192 An C<isl_union_access_info> is created, modified, copied and freed using
10193 the following functions.
10195         #include <isl/flow.h>
10196         __isl_give isl_union_access_info *
10197         isl_union_access_info_from_sink(
10198                 __isl_take isl_union_map *sink);
10199         __isl_give isl_union_access_info *
10200         isl_union_access_info_set_kill(
10201                 __isl_take isl_union_access_info *access,
10202                 __isl_take isl_union_map *kill);
10203         __isl_give isl_union_access_info *
10204         isl_union_access_info_set_may_source(
10205                 __isl_take isl_union_access_info *access,
10206                 __isl_take isl_union_map *may_source);
10207         __isl_give isl_union_access_info *
10208         isl_union_access_info_set_must_source(
10209                 __isl_take isl_union_access_info *access,
10210                 __isl_take isl_union_map *must_source);
10211         __isl_give isl_union_access_info *
10212         isl_union_access_info_set_schedule(
10213                 __isl_take isl_union_access_info *access,
10214                 __isl_take isl_schedule *schedule);
10215         __isl_give isl_union_access_info *
10216         isl_union_access_info_set_schedule_map(
10217                 __isl_take isl_union_access_info *access,
10218                 __isl_take isl_union_map *schedule_map);
10219         __isl_give isl_union_access_info *
10220         isl_union_access_info_copy(
10221                 __isl_keep isl_union_access_info *access);
10222         __isl_null isl_union_access_info *
10223         isl_union_access_info_free(
10224                 __isl_take isl_union_access_info *access);
10226 The may sources set by C<isl_union_access_info_set_may_source>
10227 do not need to include the must sources set by
10228 C<isl_union_access_info_set_must_source> as a subset.
10229 The kills set by C<isl_union_access_info_set_kill> may overlap
10230 with the may-sources and/or must-sources.
10231 The user is free not to call one (or more) of these functions,
10232 in which case the corresponding set is kept to its empty default.
10233 Similarly, the default schedule initialized by
10234 C<isl_union_access_info_from_sink> is empty.
10235 The current schedule is determined by the last call to either
10236 C<isl_union_access_info_set_schedule> or
10237 C<isl_union_access_info_set_schedule_map>.
10238 The domain of the schedule corresponds to the domains of
10239 the access relations.  In particular, the domains of the access
10240 relations are effectively intersected with the domain of the schedule
10241 and only the resulting accesses are considered by the dependence analysis.
10243 An C<isl_union_access_info> object can be read from input
10244 using the following function.
10246         #include <isl/flow.h>
10247         __isl_give isl_union_access_info *
10248         isl_union_access_info_read_from_file(isl_ctx *ctx,
10249                 FILE *input);
10251 A representation of the information contained in an object
10252 of type C<isl_union_access_info> can be obtained using
10254         #include <isl/flow.h>
10255         __isl_give isl_printer *
10256         isl_printer_print_union_access_info(
10257                 __isl_take isl_printer *p,
10258                 __isl_keep isl_union_access_info *access);
10259         __isl_give char *isl_union_access_info_to_str(
10260                 __isl_keep isl_union_access_info *access);
10262 C<isl_union_access_info_to_str> prints the information in flow format.
10264 The output of C<isl_union_access_info_compute_flow> can be examined,
10265 copied, and freed using the following functions.
10267         #include <isl/flow.h>
10268         __isl_give isl_union_map *isl_union_flow_get_must_dependence(
10269                 __isl_keep isl_union_flow *flow);
10270         __isl_give isl_union_map *isl_union_flow_get_may_dependence(
10271                 __isl_keep isl_union_flow *flow);
10272         __isl_give isl_union_map *
10273         isl_union_flow_get_full_must_dependence(
10274                 __isl_keep isl_union_flow *flow);
10275         __isl_give isl_union_map *
10276         isl_union_flow_get_full_may_dependence(
10277                 __isl_keep isl_union_flow *flow);
10278         __isl_give isl_union_map *isl_union_flow_get_must_no_source(
10279                 __isl_keep isl_union_flow *flow);
10280         __isl_give isl_union_map *isl_union_flow_get_may_no_source(
10281                 __isl_keep isl_union_flow *flow);
10282         __isl_give isl_union_flow *isl_union_flow_copy(
10283                 __isl_keep isl_union_flow *flow);
10284         __isl_null isl_union_flow *isl_union_flow_free(
10285                 __isl_take isl_union_flow *flow);
10287 The relation returned by C<isl_union_flow_get_must_dependence>
10288 relates domain elements of must sources to domain elements of the sink.
10289 The relation returned by C<isl_union_flow_get_may_dependence>
10290 relates domain elements of must or may sources to domain elements of the sink
10291 and includes the previous relation as a subset.
10292 The relation returned by C<isl_union_flow_get_full_must_dependence>
10293 relates domain elements of must sources to pairs of domain elements of the sink
10294 and accessed data elements.
10295 The relation returned by C<isl_union_flow_get_full_may_dependence>
10296 relates domain elements of must or may sources to pairs of
10297 domain elements of the sink and accessed data elements.
10298 This relation includes the previous relation as a subset.
10299 The relation returned by C<isl_union_flow_get_must_no_source> is the subset
10300 of the sink relation for which no dependences have been found.
10301 The relation returned by C<isl_union_flow_get_may_no_source> is the subset
10302 of the sink relation for which no definite dependences have been found.
10303 That is, it contains those sink access that do not contribute to any
10304 of the elements in the relation returned
10305 by C<isl_union_flow_get_must_dependence>.
10307 A representation of the information contained in an object
10308 of type C<isl_union_flow> can be obtained using
10310         #include <isl/flow.h>
10311         __isl_give isl_printer *isl_printer_print_union_flow(
10312                 __isl_take isl_printer *p,
10313                 __isl_keep isl_union_flow *flow);
10314         __isl_give char *isl_union_flow_to_str(
10315                 __isl_keep isl_union_flow *flow);
10317 C<isl_union_flow_to_str> prints the information in flow format.
10319 =head3 Low-level Interface
10321 A lower-level interface is provided by the following functions.
10323         #include <isl/flow.h>
10325         typedef int (*isl_access_level_before)(void *first, void *second);
10327         __isl_give isl_access_info *isl_access_info_alloc(
10328                 __isl_take isl_map *sink,
10329                 void *sink_user, isl_access_level_before fn,
10330                 int max_source);
10331         __isl_give isl_access_info *isl_access_info_add_source(
10332                 __isl_take isl_access_info *acc,
10333                 __isl_take isl_map *source, int must,
10334                 void *source_user);
10335         __isl_null isl_access_info *isl_access_info_free(
10336                 __isl_take isl_access_info *acc);
10338         __isl_give isl_flow *isl_access_info_compute_flow(
10339                 __isl_take isl_access_info *acc);
10341         isl_stat isl_flow_foreach(__isl_keep isl_flow *deps,
10342                 isl_stat (*fn)(__isl_take isl_map *dep, int must,
10343                           void *dep_user, void *user),
10344                 void *user);
10345         __isl_give isl_map *isl_flow_get_no_source(
10346                 __isl_keep isl_flow *deps, int must);
10347         __isl_null isl_flow *isl_flow_free(
10348                 __isl_take isl_flow *deps);
10350 The function C<isl_access_info_compute_flow> performs the actual
10351 dependence analysis.  The other functions are used to construct
10352 the input for this function or to read off the output.
10354 The input is collected in an C<isl_access_info>, which can
10355 be created through a call to C<isl_access_info_alloc>.
10356 The arguments to this functions are the sink access relation
10357 C<sink>, a token C<sink_user> used to identify the sink
10358 access to the user, a callback function for specifying the
10359 relative order of source and sink accesses, and the number
10360 of source access relations that will be added.
10362 The callback function has type C<int (*)(void *first, void *second)>.
10363 The function is called with two user supplied tokens identifying
10364 either a source or the sink and it should return the shared nesting
10365 level and the relative order of the two accesses.
10366 In particular, let I<n> be the number of loops shared by
10367 the two accesses.  If C<first> precedes C<second> textually,
10368 then the function should return I<2 * n + 1>; otherwise,
10369 it should return I<2 * n>.
10370 The low-level interface assumes that no sources are coscheduled.
10371 If the information returned by the callback does not allow
10372 the relative order to be determined, then one of the sources
10373 is arbitrarily taken to be executed after the other(s).
10375 The sources can be added to the C<isl_access_info> object by performing
10376 (at most) C<max_source> calls to C<isl_access_info_add_source>.
10377 C<must> indicates whether the source is a I<must> access
10378 or a I<may> access.  Note that a multi-valued access relation
10379 should only be marked I<must> if every iteration in the domain
10380 of the relation accesses I<all> elements in its image.
10381 The C<source_user> token is again used to identify
10382 the source access.  The range of the source access relation
10383 C<source> should have the same dimension as the range
10384 of the sink access relation.
10385 The C<isl_access_info_free> function should usually not be
10386 called explicitly, because it is already called implicitly by
10387 C<isl_access_info_compute_flow>.
10389 The result of the dependence analysis is collected in an
10390 C<isl_flow>.  There may be elements of
10391 the sink access for which no preceding source access could be
10392 found or for which all preceding sources are I<may> accesses.
10393 The relations containing these elements can be obtained through
10394 calls to C<isl_flow_get_no_source>, the first with C<must> set
10395 and the second with C<must> unset.
10396 In the case of standard flow dependence analysis,
10397 with the sink a read and the sources I<must> writes,
10398 the first relation corresponds to the reads from uninitialized
10399 array elements and the second relation is empty.
10400 The actual flow dependences can be extracted using
10401 C<isl_flow_foreach>.  This function will call the user-specified
10402 callback function C<fn> for each B<non-empty> dependence between
10403 a source and the sink.  The callback function is called
10404 with four arguments, the actual flow dependence relation
10405 mapping source iterations to sink iterations, a boolean that
10406 indicates whether it is a I<must> or I<may> dependence, a token
10407 identifying the source and an additional C<void *> with value
10408 equal to the third argument of the C<isl_flow_foreach> call.
10409 A dependence is marked I<must> if it originates from a I<must>
10410 source and if it is not followed by any I<may> sources.
10412 After finishing with an C<isl_flow>, the user should call
10413 C<isl_flow_free> to free all associated memory.
10415 =head3 Interaction with the Low-level Interface
10417 During the dependence analysis, we frequently need to perform
10418 the following operation.  Given a relation between sink iterations
10419 and potential source iterations from a particular source domain,
10420 what is the last potential source iteration corresponding to each
10421 sink iteration.  It can sometimes be convenient to adjust
10422 the set of potential source iterations before or after each such operation.
10423 The prototypical example is fuzzy array dataflow analysis,
10424 where we need to analyze if, based on data-dependent constraints,
10425 the sink iteration can ever be executed without one or more of
10426 the corresponding potential source iterations being executed.
10427 If so, we can introduce extra parameters and select an unknown
10428 but fixed source iteration from the potential source iterations.
10429 To be able to perform such manipulations, C<isl> provides the following
10430 function.
10432         #include <isl/flow.h>
10434         typedef __isl_give isl_restriction *(*isl_access_restrict)(
10435                 __isl_keep isl_map *source_map,
10436                 __isl_keep isl_set *sink, void *source_user,
10437                 void *user);
10438         __isl_give isl_access_info *isl_access_info_set_restrict(
10439                 __isl_take isl_access_info *acc,
10440                 isl_access_restrict fn, void *user);
10442 The function C<isl_access_info_set_restrict> should be called
10443 before calling C<isl_access_info_compute_flow> and registers a callback function
10444 that will be called any time C<isl> is about to compute the last
10445 potential source.  The first argument is the (reverse) proto-dependence,
10446 mapping sink iterations to potential source iterations.
10447 The second argument represents the sink iterations for which
10448 we want to compute the last source iteration.
10449 The third argument is the token corresponding to the source
10450 and the final argument is the token passed to C<isl_access_info_set_restrict>.
10451 The callback is expected to return a restriction on either the input or
10452 the output of the operation computing the last potential source.
10453 If the input needs to be restricted then restrictions are needed
10454 for both the source and the sink iterations.  The sink iterations
10455 and the potential source iterations will be intersected with these sets.
10456 If the output needs to be restricted then only a restriction on the source
10457 iterations is required.
10458 If any error occurs, the callback should return C<NULL>.
10459 An C<isl_restriction> object can be created, freed and inspected
10460 using the following functions.
10462         #include <isl/flow.h>
10464         __isl_give isl_restriction *isl_restriction_input(
10465                 __isl_take isl_set *source_restr,
10466                 __isl_take isl_set *sink_restr);
10467         __isl_give isl_restriction *isl_restriction_output(
10468                 __isl_take isl_set *source_restr);
10469         __isl_give isl_restriction *isl_restriction_none(
10470                 __isl_take isl_map *source_map);
10471         __isl_give isl_restriction *isl_restriction_empty(
10472                 __isl_take isl_map *source_map);
10473         __isl_null isl_restriction *isl_restriction_free(
10474                 __isl_take isl_restriction *restr);
10476 C<isl_restriction_none> and C<isl_restriction_empty> are special
10477 cases of C<isl_restriction_input>.  C<isl_restriction_none>
10478 is essentially equivalent to
10480         isl_restriction_input(isl_set_universe(
10481             isl_space_range(isl_map_get_space(source_map))),
10482                             isl_set_universe(
10483             isl_space_domain(isl_map_get_space(source_map))));
10485 whereas C<isl_restriction_empty> is essentially equivalent to
10487         isl_restriction_input(isl_set_empty(
10488             isl_space_range(isl_map_get_space(source_map))),
10489                             isl_set_universe(
10490             isl_space_domain(isl_map_get_space(source_map))));
10492 =head2 Scheduling
10494         #include <isl/schedule.h>
10495         __isl_give isl_schedule *
10496         isl_schedule_constraints_compute_schedule(
10497                 __isl_take isl_schedule_constraints *sc);
10499 The function C<isl_schedule_constraints_compute_schedule> can be
10500 used to compute a schedule that satisfies the given schedule constraints.
10501 These schedule constraints include the iteration domain for which
10502 a schedule should be computed and dependences between pairs of
10503 iterations.  In particular, these dependences include
10504 I<validity> dependences and I<proximity> dependences.
10505 By default, the algorithm used to construct the schedule is similar
10506 to that of C<Pluto>.
10507 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
10508 be selected.
10509 The generated schedule respects all validity dependences.
10510 That is, all dependence distances over these dependences in the
10511 scheduled space are lexicographically positive.
10513 The default algorithm tries to ensure that the dependence distances
10514 over coincidence constraints are zero and to minimize the
10515 dependence distances over proximity dependences.
10516 Moreover, it tries to obtain sequences (bands) of schedule dimensions
10517 for groups of domains where the dependence distances over validity
10518 dependences have only non-negative values.
10519 Note that when minimizing the maximal dependence distance
10520 over proximity dependences, a single affine expression in the parameters
10521 is constructed that bounds all dependence distances.  If no such expression
10522 exists, then the algorithm will fail and resort to an alternative
10523 scheduling algorithm.  In particular, this means that adding proximity
10524 dependences may eliminate valid solutions.  A typical example where this
10525 phenomenon may occur is when some subset of the proximity dependences
10526 has no restriction on some parameter, forcing the coefficient of that
10527 parameter to be zero, while some other subset forces the dependence
10528 distance to depend on that parameter, requiring the same coefficient
10529 to be non-zero.
10530 When using Feautrier's algorithm, the coincidence and proximity constraints
10531 are only taken into account during the extension to a
10532 full-dimensional schedule.
10534 An C<isl_schedule_constraints> object can be constructed
10535 and manipulated using the following functions.
10537         #include <isl/schedule.h>
10538         __isl_give isl_schedule_constraints *
10539         isl_schedule_constraints_copy(
10540                 __isl_keep isl_schedule_constraints *sc);
10541         __isl_give isl_schedule_constraints *
10542         isl_schedule_constraints_on_domain(
10543                 __isl_take isl_union_set *domain);
10544         __isl_give isl_schedule_constraints *
10545         isl_schedule_constraints_set_context(
10546                 __isl_take isl_schedule_constraints *sc,
10547                 __isl_take isl_set *context);
10548         __isl_give isl_schedule_constraints *
10549         isl_schedule_constraints_set_validity(
10550                 __isl_take isl_schedule_constraints *sc,
10551                 __isl_take isl_union_map *validity);
10552         __isl_give isl_schedule_constraints *
10553         isl_schedule_constraints_set_coincidence(
10554                 __isl_take isl_schedule_constraints *sc,
10555                 __isl_take isl_union_map *coincidence);
10556         __isl_give isl_schedule_constraints *
10557         isl_schedule_constraints_set_proximity(
10558                 __isl_take isl_schedule_constraints *sc,
10559                 __isl_take isl_union_map *proximity);
10560         __isl_give isl_schedule_constraints *
10561         isl_schedule_constraints_set_conditional_validity(
10562                 __isl_take isl_schedule_constraints *sc,
10563                 __isl_take isl_union_map *condition,
10564                 __isl_take isl_union_map *validity);
10565         __isl_give isl_schedule_constraints *
10566         isl_schedule_constraints_apply(
10567                 __isl_take isl_schedule_constraints *sc,
10568                 __isl_take isl_union_map *umap);
10569         __isl_null isl_schedule_constraints *
10570         isl_schedule_constraints_free(
10571                 __isl_take isl_schedule_constraints *sc);
10573 The initial C<isl_schedule_constraints> object created by
10574 C<isl_schedule_constraints_on_domain> does not impose any constraints.
10575 That is, it has an empty set of dependences.
10576 The function C<isl_schedule_constraints_set_context> allows the user
10577 to specify additional constraints on the parameters that may
10578 be assumed to hold during the construction of the schedule.
10579 The function C<isl_schedule_constraints_set_validity> replaces the
10580 validity dependences, mapping domain elements I<i> to domain
10581 elements that should be scheduled after I<i>.
10582 The function C<isl_schedule_constraints_set_coincidence> replaces the
10583 coincidence dependences, mapping domain elements I<i> to domain
10584 elements that should be scheduled together with I<I>, if possible.
10585 The function C<isl_schedule_constraints_set_proximity> replaces the
10586 proximity dependences, mapping domain elements I<i> to domain
10587 elements that should be scheduled either before I<I>
10588 or as early as possible after I<i>.
10590 The function C<isl_schedule_constraints_set_conditional_validity>
10591 replaces the conditional validity constraints.
10592 A conditional validity constraint is only imposed when any of the corresponding
10593 conditions is satisfied, i.e., when any of them is non-zero.
10594 That is, the scheduler ensures that within each band if the dependence
10595 distances over the condition constraints are not all zero
10596 then all corresponding conditional validity constraints are respected.
10597 A conditional validity constraint corresponds to a condition
10598 if the two are adjacent, i.e., if the domain of one relation intersect
10599 the range of the other relation.
10600 The typical use case of conditional validity constraints is
10601 to allow order constraints between live ranges to be violated
10602 as long as the live ranges themselves are local to the band.
10603 To allow more fine-grained control over which conditions correspond
10604 to which conditional validity constraints, the domains and ranges
10605 of these relations may include I<tags>.  That is, the domains and
10606 ranges of those relation may themselves be wrapped relations
10607 where the iteration domain appears in the domain of those wrapped relations
10608 and the range of the wrapped relations can be arbitrarily chosen
10609 by the user.  Conditions and conditional validity constraints are only
10610 considered adjacent to each other if the entire wrapped relation matches.
10611 In particular, a relation with a tag will never be considered adjacent
10612 to a relation without a tag.
10614 The function C<isl_schedule_constraints_apply> takes
10615 schedule constraints that are defined on some set of domain elements
10616 and transforms them to schedule constraints on the elements
10617 to which these domain elements are mapped by the given transformation.
10619 An C<isl_schedule_constraints> object can be inspected
10620 using the following functions.
10622         #include <isl/schedule.h>
10623         __isl_give isl_union_set *
10624         isl_schedule_constraints_get_domain(
10625                 __isl_keep isl_schedule_constraints *sc);
10626         __isl_give isl_set *isl_schedule_constraints_get_context(
10627                 __isl_keep isl_schedule_constraints *sc);
10628         __isl_give isl_union_map *
10629         isl_schedule_constraints_get_validity(
10630                 __isl_keep isl_schedule_constraints *sc);
10631         __isl_give isl_union_map *
10632         isl_schedule_constraints_get_coincidence(
10633                 __isl_keep isl_schedule_constraints *sc);
10634         __isl_give isl_union_map *
10635         isl_schedule_constraints_get_proximity(
10636                 __isl_keep isl_schedule_constraints *sc);
10637         __isl_give isl_union_map *
10638         isl_schedule_constraints_get_conditional_validity(
10639                 __isl_keep isl_schedule_constraints *sc);
10640         __isl_give isl_union_map *
10641         isl_schedule_constraints_get_conditional_validity_condition(
10642                 __isl_keep isl_schedule_constraints *sc);
10644 An C<isl_schedule_constraints> object can be read from input
10645 using the following functions.
10647         #include <isl/schedule.h>
10648         __isl_give isl_schedule_constraints *
10649         isl_schedule_constraints_read_from_str(isl_ctx *ctx,
10650                 const char *str);
10651         __isl_give isl_schedule_constraints *
10652         isl_schedule_constraints_read_from_file(isl_ctx *ctx,
10653                 FILE *input);
10655 The contents of an C<isl_schedule_constraints> object can be printed
10656 using the following functions.
10658         #include <isl/schedule.h>
10659         __isl_give isl_printer *
10660         isl_printer_print_schedule_constraints(
10661                 __isl_take isl_printer *p,
10662                 __isl_keep isl_schedule_constraints *sc);
10663         __isl_give char *isl_schedule_constraints_to_str(
10664                 __isl_keep isl_schedule_constraints *sc);
10666 The following function computes a schedule directly from
10667 an iteration domain and validity and proximity dependences
10668 and is implemented in terms of the functions described above.
10669 The use of C<isl_union_set_compute_schedule> is discouraged.
10671         #include <isl/schedule.h>
10672         __isl_give isl_schedule *isl_union_set_compute_schedule(
10673                 __isl_take isl_union_set *domain,
10674                 __isl_take isl_union_map *validity,
10675                 __isl_take isl_union_map *proximity);
10677 The generated schedule represents a schedule tree.
10678 For more information on schedule trees, see
10679 L</"Schedule Trees">.
10681 =head3 Options
10683         #include <isl/schedule.h>
10684         isl_stat isl_options_set_schedule_max_coefficient(
10685                 isl_ctx *ctx, int val);
10686         int isl_options_get_schedule_max_coefficient(
10687                 isl_ctx *ctx);
10688         isl_stat isl_options_set_schedule_max_constant_term(
10689                 isl_ctx *ctx, int val);
10690         int isl_options_get_schedule_max_constant_term(
10691                 isl_ctx *ctx);
10692         isl_stat isl_options_set_schedule_serialize_sccs(
10693                 isl_ctx *ctx, int val);
10694         int isl_options_get_schedule_serialize_sccs(isl_ctx *ctx);
10695         isl_stat isl_options_set_schedule_whole_component(
10696                 isl_ctx *ctx, int val);
10697         int isl_options_get_schedule_whole_component(
10698                 isl_ctx *ctx);
10699         isl_stat isl_options_set_schedule_maximize_band_depth(
10700                 isl_ctx *ctx, int val);
10701         int isl_options_get_schedule_maximize_band_depth(
10702                 isl_ctx *ctx);
10703         isl_stat isl_options_set_schedule_maximize_coincidence(
10704                 isl_ctx *ctx, int val);
10705         int isl_options_get_schedule_maximize_coincidence(
10706                 isl_ctx *ctx);
10707         isl_stat isl_options_set_schedule_outer_coincidence(
10708                 isl_ctx *ctx, int val);
10709         int isl_options_get_schedule_outer_coincidence(
10710                 isl_ctx *ctx);
10711         isl_stat isl_options_set_schedule_split_scaled(
10712                 isl_ctx *ctx, int val);
10713         int isl_options_get_schedule_split_scaled(
10714                 isl_ctx *ctx);
10715         isl_stat isl_options_set_schedule_treat_coalescing(
10716                 isl_ctx *ctx, int val);
10717         int isl_options_get_schedule_treat_coalescing(
10718                 isl_ctx *ctx);
10719         isl_stat isl_options_set_schedule_algorithm(
10720                 isl_ctx *ctx, int val);
10721         int isl_options_get_schedule_algorithm(
10722                 isl_ctx *ctx);
10723         isl_stat isl_options_set_schedule_carry_self_first(
10724                 isl_ctx *ctx, int val);
10725         int isl_options_get_schedule_carry_self_first(
10726                 isl_ctx *ctx);
10727         isl_stat isl_options_set_schedule_separate_components(
10728                 isl_ctx *ctx, int val);
10729         int isl_options_get_schedule_separate_components(
10730                 isl_ctx *ctx);
10732 =over
10734 =item * schedule_max_coefficient
10736 This option enforces that the coefficients for variable and parameter
10737 dimensions in the calculated schedule are not larger than the specified value.
10738 This option can significantly increase the speed of the scheduling calculation
10739 and may also prevent fusing of unrelated dimensions. A value of -1 means that
10740 this option does not introduce bounds on the variable or parameter
10741 coefficients.
10742 This option has no effect on the Feautrier style scheduler.
10744 =item * schedule_max_constant_term
10746 This option enforces that the constant coefficients in the calculated schedule
10747 are not larger than the maximal constant term. This option can significantly
10748 increase the speed of the scheduling calculation and may also prevent fusing of
10749 unrelated dimensions. A value of -1 means that this option does not introduce
10750 bounds on the constant coefficients.
10752 =item * schedule_serialize_sccs
10754 If this option is set, then all strongly connected components
10755 in the dependence graph are serialized as soon as they are detected.
10756 This means in particular that instances of statements will only
10757 appear in the same band node if these statements belong
10758 to the same strongly connected component at the point where
10759 the band node is constructed.
10761 =item * schedule_whole_component
10763 If this option is set, then entire (weakly) connected
10764 components in the dependence graph are scheduled together
10765 as a whole.
10766 Otherwise, each strongly connected component within
10767 such a weakly connected component is first scheduled separately
10768 and then combined with other strongly connected components.
10769 This option has no effect if C<schedule_serialize_sccs> is set.
10771 =item * schedule_maximize_band_depth
10773 If this option is set, then the scheduler tries to maximize
10774 the width of the bands.  Wider bands give more possibilities for tiling.
10775 In particular, if the C<schedule_whole_component> option is set,
10776 then bands are split if this might result in wider bands.
10777 Otherwise, the effect of this option is to only allow
10778 strongly connected components to be combined if this does
10779 not reduce the width of the bands.
10780 Note that if the C<schedule_serialize_sccs> options is set, then
10781 the C<schedule_maximize_band_depth> option therefore has no effect.
10783 =item * schedule_maximize_coincidence
10785 This option is only effective if the C<schedule_whole_component>
10786 option is turned off.
10787 If the C<schedule_maximize_coincidence> option is set, then (clusters of)
10788 strongly connected components are only combined with each other
10789 if this does not reduce the number of coincident band members.
10791 =item * schedule_outer_coincidence
10793 If this option is set, then we try to construct schedules
10794 where the outermost scheduling dimension in each band
10795 satisfies the coincidence constraints.
10797 =item * schedule_algorithm
10799 Selects the scheduling algorithm to be used.
10800 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
10801 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
10803 =item * schedule_split_scaled
10805 If this option is set, then we try to construct schedules in which the
10806 constant term is split off from the linear part if the linear parts of
10807 the scheduling rows for all nodes in the graph have a common non-trivial
10808 divisor.
10809 The constant term is then dropped and the linear
10810 part is reduced.
10811 This option is only effective when the Feautrier style scheduler is
10812 being used, either as the main scheduler or as a fallback for the
10813 Pluto-like scheduler.
10815 =item * schedule_treat_coalescing
10817 If this option is set, then the scheduler will try and avoid
10818 producing schedules that perform loop coalescing.
10819 In particular, for the Pluto-like scheduler, this option places
10820 bounds on the schedule coefficients based on the sizes of the instance sets.
10821 For the Feautrier style scheduler, this option detects potentially
10822 coalescing schedules and then tries to adjust the schedule to avoid
10823 the coalescing.
10825 =item * schedule_carry_self_first
10827 If this option is set, then the Feautrier style scheduler
10828 (when used as a fallback for the Pluto-like scheduler) will
10829 first try to only carry self-dependences.
10831 =item * schedule_separate_components
10833 If this option is set then the function C<isl_schedule_get_map>
10834 will treat set nodes in the same way as sequence nodes.
10836 =back
10838 =head2 AST Generation
10840 This section describes the C<isl> functionality for generating
10841 ASTs that visit all the elements
10842 in a domain in an order specified by a schedule tree or
10843 a schedule map.
10844 In case the schedule given as a C<isl_union_map>, an AST is generated
10845 that visits all the elements in the domain of the C<isl_union_map>
10846 according to the lexicographic order of the corresponding image
10847 element(s).  If the range of the C<isl_union_map> consists of
10848 elements in more than one space, then each of these spaces is handled
10849 separately in an arbitrary order.
10850 It should be noted that the schedule tree or the image elements
10851 in a schedule map only specify the I<order>
10852 in which the corresponding domain elements should be visited.
10853 No direct relation between the partial schedule values
10854 or the image elements on the one hand and the loop iterators
10855 in the generated AST on the other hand should be assumed.
10857 Each AST is generated within a build.  The initial build
10858 simply specifies the constraints on the parameters (if any)
10859 and can be created, inspected, copied and freed using the following functions.
10861         #include <isl/ast_build.h>
10862         __isl_give isl_ast_build *isl_ast_build_alloc(
10863                 isl_ctx *ctx);
10864         __isl_give isl_ast_build *isl_ast_build_from_context(
10865                 __isl_take isl_set *set);
10866         __isl_give isl_ast_build *isl_ast_build_copy(
10867                 __isl_keep isl_ast_build *build);
10868         __isl_null isl_ast_build *isl_ast_build_free(
10869                 __isl_take isl_ast_build *build);
10871 The C<set> argument is usually a parameter set with zero or more parameters.
10872 In fact, when creating an AST using C<isl_ast_build_node_from_schedule>,
10873 this set is required to be a parameter set.
10874 An C<isl_ast_build> created using C<isl_ast_build_alloc> does not
10875 specify any parameter constraints.
10876 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
10877 and L</"Fine-grained Control over AST Generation">.
10878 Finally, the AST itself can be constructed using one of the following
10879 functions.
10881         #include <isl/ast_build.h>
10882         __isl_give isl_ast_node *isl_ast_build_node_from_schedule(
10883                 __isl_keep isl_ast_build *build,
10884                 __isl_take isl_schedule *schedule);
10885         __isl_give isl_ast_node *
10886         isl_ast_build_node_from_schedule_map(
10887                 __isl_keep isl_ast_build *build,
10888                 __isl_take isl_union_map *schedule);
10890 =head3 Inspecting the AST
10892 The basic properties of an AST node can be obtained as follows.
10894         #include <isl/ast.h>
10895         enum isl_ast_node_type isl_ast_node_get_type(
10896                 __isl_keep isl_ast_node *node);
10898 The type of an AST node is one of
10899 C<isl_ast_node_for>,
10900 C<isl_ast_node_if>,
10901 C<isl_ast_node_block>,
10902 C<isl_ast_node_mark> or
10903 C<isl_ast_node_user>.
10904 An C<isl_ast_node_for> represents a for node.
10905 An C<isl_ast_node_if> represents an if node.
10906 An C<isl_ast_node_block> represents a compound node.
10907 An C<isl_ast_node_mark> introduces a mark in the AST.
10908 An C<isl_ast_node_user> represents an expression statement.
10909 An expression statement typically corresponds to a domain element, i.e.,
10910 one of the elements that is visited by the AST.
10912 Each type of node has its own additional properties.
10914         #include <isl/ast.h>
10915         __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
10916                 __isl_keep isl_ast_node *node);
10917         __isl_give isl_ast_expr *isl_ast_node_for_get_init(
10918                 __isl_keep isl_ast_node *node);
10919         __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
10920                 __isl_keep isl_ast_node *node);
10921         __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
10922                 __isl_keep isl_ast_node *node);
10923         __isl_give isl_ast_node *isl_ast_node_for_get_body(
10924                 __isl_keep isl_ast_node *node);
10925         isl_bool isl_ast_node_for_is_degenerate(
10926                 __isl_keep isl_ast_node *node);
10928 An C<isl_ast_for> is considered degenerate if it is known to execute
10929 exactly once.
10931         #include <isl/ast.h>
10932         __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
10933                 __isl_keep isl_ast_node *node);
10934         __isl_give isl_ast_node *isl_ast_node_if_get_then_node(
10935                 __isl_keep isl_ast_node *node);
10936         __isl_give isl_ast_node *isl_ast_node_if_get_then(
10937                 __isl_keep isl_ast_node *node);
10938         isl_bool isl_ast_node_if_has_else_node(
10939                 __isl_keep isl_ast_node *node);
10940         isl_bool isl_ast_node_if_has_else(
10941                 __isl_keep isl_ast_node *node);
10942         __isl_give isl_ast_node *isl_ast_node_if_get_else_node(
10943                 __isl_keep isl_ast_node *node);
10944         __isl_give isl_ast_node *isl_ast_node_if_get_else(
10945                 __isl_keep isl_ast_node *node);
10947 C<isl_ast_node_if_get_then>,
10948 C<isl_ast_node_if_has_else> and
10949 C<isl_ast_node_if_get_else>
10950 are alternative names for
10951 C<isl_ast_node_if_get_then_node>,
10952 C<isl_ast_node_if_has_else_node> and
10953 C<isl_ast_node_if_get_else_node>, respectively.
10955         __isl_give isl_ast_node_list *
10956         isl_ast_node_block_get_children(
10957                 __isl_keep isl_ast_node *node);
10959         __isl_give isl_id *isl_ast_node_mark_get_id(
10960                 __isl_keep isl_ast_node *node);
10961         __isl_give isl_ast_node *isl_ast_node_mark_get_node(
10962                 __isl_keep isl_ast_node *node);
10964 C<isl_ast_node_mark_get_id> returns the identifier of the mark.
10965 C<isl_ast_node_mark_get_node> returns the child node that is being marked.
10967         #include <isl/ast.h>
10968         __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
10969                 __isl_keep isl_ast_node *node);
10971 All descendants of a specific node in the AST (including the node itself)
10972 can be visited
10973 in depth-first pre-order using the following function.
10975         #include <isl/ast.h>
10976         isl_stat isl_ast_node_foreach_descendant_top_down(
10977                 __isl_keep isl_ast_node *node,
10978                 isl_bool (*fn)(__isl_keep isl_ast_node *node,
10979                         void *user), void *user);
10981 The callback function should return C<isl_bool_true> if the children
10982 of the given node should be visited and C<isl_bool_false> if they should not.
10983 It should return C<isl_bool_error> in case of failure, in which case
10984 the entire traversal is aborted.
10986 Each of the returned C<isl_ast_expr>s can in turn be inspected using
10987 the following functions.
10989         #include <isl/ast.h>
10990         enum isl_ast_expr_type isl_ast_expr_get_type(
10991                 __isl_keep isl_ast_expr *expr);
10993 The type of an AST expression is one of
10994 C<isl_ast_expr_op>,
10995 C<isl_ast_expr_id> or
10996 C<isl_ast_expr_int>.
10997 An C<isl_ast_expr_op> represents the result of an operation.
10998 An C<isl_ast_expr_id> represents an identifier.
10999 An C<isl_ast_expr_int> represents an integer value.
11001 Each type of expression has its own additional properties.
11003         #include <isl/ast.h>
11004         enum isl_ast_expr_op_type isl_ast_expr_op_get_type(
11005                 __isl_keep isl_ast_expr *expr);
11006         enum isl_ast_expr_op_type isl_ast_expr_get_op_type(
11007                 __isl_keep isl_ast_expr *expr);
11008         isl_size isl_ast_expr_op_get_n_arg(__isl_keep isl_ast_expr *expr);
11009         isl_size isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
11010         __isl_give isl_ast_expr *isl_ast_expr_op_get_arg(
11011                 __isl_keep isl_ast_expr *expr, int pos);
11012         __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
11013                 __isl_keep isl_ast_expr *expr, int pos);
11014         isl_stat isl_ast_expr_foreach_ast_expr_op_type(
11015                 __isl_keep isl_ast_expr *expr,
11016                 isl_stat (*fn)(enum isl_ast_expr_op_type type,
11017                         void *user), void *user);
11018         isl_stat isl_ast_expr_foreach_ast_op_type(
11019                 __isl_keep isl_ast_expr *expr,
11020                 isl_stat (*fn)(enum isl_ast_expr_op_type type,
11021                         void *user), void *user);
11022         isl_stat isl_ast_node_foreach_ast_expr_op_type(
11023                 __isl_keep isl_ast_node *node,
11024                 isl_stat (*fn)(enum isl_ast_expr_op_type type,
11025                         void *user), void *user);
11026         isl_stat isl_ast_node_foreach_ast_op_type(
11027                 __isl_keep isl_ast_node *node,
11028                 isl_stat (*fn)(enum isl_ast_expr_op_type type,
11029                         void *user), void *user);
11031 C<isl_ast_expr_op_get_type> returns the type of the operation
11032 performed.  C<isl_ast_expr_op_get_n_arg> returns the number of
11033 arguments.  C<isl_ast_expr_get_op_arg> returns the specified
11034 argument.
11035 C<isl_ast_expr_get_op_type> is an alternative name for
11036 C<isl_ast_expr_op_get_type>.
11037 Similarly,
11038 C<isl_ast_expr_get_op_n_arg> is an alternative name for
11039 C<isl_ast_expr_op_get_n_arg> and
11040 C<isl_ast_expr_get_op_arg> is an alternative name for
11041 C<isl_ast_expr_op_get_arg>.
11043 C<isl_ast_expr_foreach_ast_expr_op_type> calls C<fn> for each distinct
11044 C<isl_ast_expr_op_type> that appears in C<expr>.
11045 C<isl_ast_expr_foreach_ast_op_type> is an alternative name for
11046 C<isl_ast_expr_foreach_ast_expr_op_type>.
11047 C<isl_ast_node_foreach_ast_expr_op_type> does the same for each distinct
11048 C<isl_ast_expr_op_type> that appears in C<node>.
11049 C<isl_ast_node_foreach_ast_op_type> is an alternative name for
11050 C<isl_ast_node_foreach_ast_expr_op_type>.
11051 The operation type is one of the following.
11053 =over
11055 =item C<isl_ast_expr_op_and>
11057 Logical I<and> of two arguments.
11058 Both arguments can be evaluated.
11060 =item C<isl_ast_expr_op_and_then>
11062 Logical I<and> of two arguments.
11063 The second argument can only be evaluated if the first evaluates to true.
11065 =item C<isl_ast_expr_op_or>
11067 Logical I<or> of two arguments.
11068 Both arguments can be evaluated.
11070 =item C<isl_ast_expr_op_or_else>
11072 Logical I<or> of two arguments.
11073 The second argument can only be evaluated if the first evaluates to false.
11075 =item C<isl_ast_expr_op_max>
11077 Maximum of two or more arguments.
11079 =item C<isl_ast_expr_op_min>
11081 Minimum of two or more arguments.
11083 =item C<isl_ast_expr_op_minus>
11085 Change sign.
11087 =item C<isl_ast_expr_op_add>
11089 Sum of two arguments.
11091 =item C<isl_ast_expr_op_sub>
11093 Difference of two arguments.
11095 =item C<isl_ast_expr_op_mul>
11097 Product of two arguments.
11099 =item C<isl_ast_expr_op_div>
11101 Exact division.  That is, the result is known to be an integer.
11103 =item C<isl_ast_expr_op_fdiv_q>
11105 Result of integer division, rounded towards negative
11106 infinity.
11107 The divisor is known to be positive.
11109 =item C<isl_ast_expr_op_pdiv_q>
11111 Result of integer division, where dividend is known to be non-negative.
11112 The divisor is known to be positive.
11114 =item C<isl_ast_expr_op_pdiv_r>
11116 Remainder of integer division, where dividend is known to be non-negative.
11117 The divisor is known to be positive.
11119 =item C<isl_ast_expr_op_zdiv_r>
11121 Equal to zero iff the remainder on integer division is zero.
11122 The divisor is known to be positive.
11124 =item C<isl_ast_expr_op_cond>
11126 Conditional operator defined on three arguments.
11127 If the first argument evaluates to true, then the result
11128 is equal to the second argument.  Otherwise, the result
11129 is equal to the third argument.
11130 The second and third argument may only be evaluated if
11131 the first argument evaluates to true and false, respectively.
11132 Corresponds to C<a ? b : c> in C.
11134 =item C<isl_ast_expr_op_select>
11136 Conditional operator defined on three arguments.
11137 If the first argument evaluates to true, then the result
11138 is equal to the second argument.  Otherwise, the result
11139 is equal to the third argument.
11140 The second and third argument may be evaluated independently
11141 of the value of the first argument.
11142 Corresponds to C<a * b + (1 - a) * c> in C.
11144 =item C<isl_ast_expr_op_eq>
11146 Equality relation.
11148 =item C<isl_ast_expr_op_le>
11150 Less than or equal relation.
11152 =item C<isl_ast_expr_op_lt>
11154 Less than relation.
11156 =item C<isl_ast_expr_op_ge>
11158 Greater than or equal relation.
11160 =item C<isl_ast_expr_op_gt>
11162 Greater than relation.
11164 =item C<isl_ast_expr_op_call>
11166 A function call.
11167 The number of arguments of the C<isl_ast_expr> is one more than
11168 the number of arguments in the function call, the first argument
11169 representing the function being called.
11171 =item C<isl_ast_expr_op_access>
11173 An array access.
11174 The number of arguments of the C<isl_ast_expr> is one more than
11175 the number of index expressions in the array access, the first argument
11176 representing the array being accessed.
11178 =item C<isl_ast_expr_op_member>
11180 A member access.
11181 This operation has two arguments, a structure and the name of
11182 the member of the structure being accessed.
11184 =back
11186         #include <isl/ast.h>
11187         __isl_give isl_id *isl_ast_expr_id_get_id(
11188                 __isl_keep isl_ast_expr *expr);
11189         __isl_give isl_id *isl_ast_expr_get_id(
11190                 __isl_keep isl_ast_expr *expr);
11192 Return the identifier represented by the AST expression.
11193 C<isl_ast_expr_get_id> is an alternative name for
11194 C<isl_ast_expr_id_get_id>.
11196         #include <isl/ast.h>
11197         __isl_give isl_val *isl_ast_expr_int_get_val(
11198                 __isl_keep isl_ast_expr *expr);
11199         __isl_give isl_val *isl_ast_expr_get_val(
11200                 __isl_keep isl_ast_expr *expr);
11202 Return the integer represented by the AST expression.
11203 C<isl_ast_expr_get_val> is an alternative name for
11204 C<isl_ast_expr_int_get_val>.
11206 =head3 Properties of ASTs
11208         #include <isl/ast.h>
11209         isl_bool isl_ast_expr_is_equal(
11210                 __isl_keep isl_ast_expr *expr1,
11211                 __isl_keep isl_ast_expr *expr2);
11213 Check if two C<isl_ast_expr>s are equal to each other.
11215 =head3 Manipulating and printing the AST
11217 AST nodes can be copied and freed using the following functions.
11219         #include <isl/ast.h>
11220         __isl_give isl_ast_node *isl_ast_node_copy(
11221                 __isl_keep isl_ast_node *node);
11222         __isl_null isl_ast_node *isl_ast_node_free(
11223                 __isl_take isl_ast_node *node);
11225 AST expressions can be copied and freed using the following functions.
11227         #include <isl/ast.h>
11228         __isl_give isl_ast_expr *isl_ast_expr_copy(
11229                 __isl_keep isl_ast_expr *expr);
11230         __isl_null isl_ast_expr *isl_ast_expr_free(
11231                 __isl_take isl_ast_expr *expr);
11233 New AST expressions can be created either directly or within
11234 the context of an C<isl_ast_build>.
11236         #include <isl/ast.h>
11237         __isl_give isl_ast_expr *isl_ast_expr_from_val(
11238                 __isl_take isl_val *v);
11239         __isl_give isl_ast_expr *isl_ast_expr_from_id(
11240                 __isl_take isl_id *id);
11241         __isl_give isl_ast_expr *isl_ast_expr_neg(
11242                 __isl_take isl_ast_expr *expr);
11243         __isl_give isl_ast_expr *isl_ast_expr_address_of(
11244                 __isl_take isl_ast_expr *expr);
11245         __isl_give isl_ast_expr *isl_ast_expr_add(
11246                 __isl_take isl_ast_expr *expr1,
11247                 __isl_take isl_ast_expr *expr2);
11248         __isl_give isl_ast_expr *isl_ast_expr_sub(
11249                 __isl_take isl_ast_expr *expr1,
11250                 __isl_take isl_ast_expr *expr2);
11251         __isl_give isl_ast_expr *isl_ast_expr_mul(
11252                 __isl_take isl_ast_expr *expr1,
11253                 __isl_take isl_ast_expr *expr2);
11254         __isl_give isl_ast_expr *isl_ast_expr_div(
11255                 __isl_take isl_ast_expr *expr1,
11256                 __isl_take isl_ast_expr *expr2);
11257         __isl_give isl_ast_expr *isl_ast_expr_pdiv_q(
11258                 __isl_take isl_ast_expr *expr1,
11259                 __isl_take isl_ast_expr *expr2);
11260         __isl_give isl_ast_expr *isl_ast_expr_pdiv_r(
11261                 __isl_take isl_ast_expr *expr1,
11262                 __isl_take isl_ast_expr *expr2);
11263         __isl_give isl_ast_expr *isl_ast_expr_and(
11264                 __isl_take isl_ast_expr *expr1,
11265                 __isl_take isl_ast_expr *expr2)
11266         __isl_give isl_ast_expr *isl_ast_expr_and_then(
11267                 __isl_take isl_ast_expr *expr1,
11268                 __isl_take isl_ast_expr *expr2)
11269         __isl_give isl_ast_expr *isl_ast_expr_or(
11270                 __isl_take isl_ast_expr *expr1,
11271                 __isl_take isl_ast_expr *expr2)
11272         __isl_give isl_ast_expr *isl_ast_expr_or_else(
11273                 __isl_take isl_ast_expr *expr1,
11274                 __isl_take isl_ast_expr *expr2)
11275         __isl_give isl_ast_expr *isl_ast_expr_eq(
11276                 __isl_take isl_ast_expr *expr1,
11277                 __isl_take isl_ast_expr *expr2);
11278         __isl_give isl_ast_expr *isl_ast_expr_le(
11279                 __isl_take isl_ast_expr *expr1,
11280                 __isl_take isl_ast_expr *expr2);
11281         __isl_give isl_ast_expr *isl_ast_expr_lt(
11282                 __isl_take isl_ast_expr *expr1,
11283                 __isl_take isl_ast_expr *expr2);
11284         __isl_give isl_ast_expr *isl_ast_expr_ge(
11285                 __isl_take isl_ast_expr *expr1,
11286                 __isl_take isl_ast_expr *expr2);
11287         __isl_give isl_ast_expr *isl_ast_expr_gt(
11288                 __isl_take isl_ast_expr *expr1,
11289                 __isl_take isl_ast_expr *expr2);
11290         __isl_give isl_ast_expr *isl_ast_expr_access(
11291                 __isl_take isl_ast_expr *array,
11292                 __isl_take isl_ast_expr_list *indices);
11293         __isl_give isl_ast_expr *isl_ast_expr_call(
11294                 __isl_take isl_ast_expr *function,
11295                 __isl_take isl_ast_expr_list *arguments);
11297 The function C<isl_ast_expr_address_of> can be applied to an
11298 C<isl_ast_expr> of type C<isl_ast_expr_op_access> only. It is meant
11299 to represent the address of the C<isl_ast_expr_access>.
11300 The second argument of the functions C<isl_ast_expr_pdiv_q> and
11301 C<isl_ast_expr_pdiv_r> should always evaluate to a positive number.
11302 The function
11303 C<isl_ast_expr_and_then> as well as C<isl_ast_expr_or_else> are short-circuit
11304 versions of C<isl_ast_expr_and> and C<isl_ast_expr_or>, respectively.
11306         #include <isl/ast_build.h>
11307         __isl_give isl_ast_expr *isl_ast_build_expr_from_set(
11308                 __isl_keep isl_ast_build *build,
11309                 __isl_take isl_set *set);
11310         __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
11311                 __isl_keep isl_ast_build *build,
11312                 __isl_take isl_pw_aff *pa);
11313         __isl_give isl_ast_expr *
11314         isl_ast_build_access_from_pw_multi_aff(
11315                 __isl_keep isl_ast_build *build,
11316                 __isl_take isl_pw_multi_aff *pma);
11317         __isl_give isl_ast_expr *
11318         isl_ast_build_access_from_multi_pw_aff(
11319                 __isl_keep isl_ast_build *build,
11320                 __isl_take isl_multi_pw_aff *mpa);
11321         __isl_give isl_ast_expr *
11322         isl_ast_build_call_from_pw_multi_aff(
11323                 __isl_keep isl_ast_build *build,
11324                 __isl_take isl_pw_multi_aff *pma);
11325         __isl_give isl_ast_expr *
11326         isl_ast_build_call_from_multi_pw_aff(
11327                 __isl_keep isl_ast_build *build,
11328                 __isl_take isl_multi_pw_aff *mpa);
11330 The set C<set> and
11331 the domains of C<pa>, C<mpa> and C<pma> should correspond
11332 to the schedule space of C<build>.
11333 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
11334 the function being called.
11335 If the accessed space is a nested relation, then it is taken
11336 to represent an access of the member specified by the range
11337 of this nested relation of the structure specified by the domain
11338 of the nested relation.
11340 The following functions can be used to modify an C<isl_ast_expr>.
11342         #include <isl/ast.h>
11343         __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
11344                 __isl_take isl_ast_expr *expr, int pos,
11345                 __isl_take isl_ast_expr *arg);
11347 Replace the argument of C<expr> at position C<pos> by C<arg>.
11349         #include <isl/ast.h>
11350         __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
11351                 __isl_take isl_ast_expr *expr,
11352                 __isl_take isl_id_to_ast_expr *id2expr);
11354 The function C<isl_ast_expr_substitute_ids> replaces the
11355 subexpressions of C<expr> of type C<isl_ast_expr_id>
11356 by the corresponding expression in C<id2expr>, if there is any.
11359 User specified data can be attached to an C<isl_ast_node> and obtained
11360 from the same C<isl_ast_node> using the following functions.
11362         #include <isl/ast.h>
11363         __isl_give isl_ast_node *isl_ast_node_set_annotation(
11364                 __isl_take isl_ast_node *node,
11365                 __isl_take isl_id *annotation);
11366         __isl_give isl_id *isl_ast_node_get_annotation(
11367                 __isl_keep isl_ast_node *node);
11369 Basic printing can be performed using the following functions.
11371         #include <isl/ast.h>
11372         __isl_give isl_printer *isl_printer_print_ast_expr(
11373                 __isl_take isl_printer *p,
11374                 __isl_keep isl_ast_expr *expr);
11375         __isl_give isl_printer *isl_printer_print_ast_node(
11376                 __isl_take isl_printer *p,
11377                 __isl_keep isl_ast_node *node);
11378         __isl_give char *isl_ast_expr_to_str(
11379                 __isl_keep isl_ast_expr *expr);
11380         __isl_give char *isl_ast_node_to_str(
11381                 __isl_keep isl_ast_node *node);
11382         __isl_give char *isl_ast_expr_to_C_str(
11383                 __isl_keep isl_ast_expr *expr);
11384         __isl_give char *isl_ast_node_to_C_str(
11385                 __isl_keep isl_ast_node *node);
11387 The functions C<isl_ast_expr_to_C_str> and
11388 C<isl_ast_node_to_C_str> are convenience functions
11389 that return a string representation of the input in C format.
11391 More advanced printing can be performed using the following functions.
11393         #include <isl/ast.h>
11394         __isl_give isl_printer *
11395         isl_ast_expr_op_type_set_print_name(
11396                 __isl_take isl_printer *p,
11397                 enum isl_ast_expr_op_type type,
11398                 __isl_keep const char *name);
11399         __isl_give isl_printer *isl_ast_op_type_set_print_name(
11400                 __isl_take isl_printer *p,
11401                 enum isl_ast_expr_op_type type,
11402                 __isl_keep const char *name);
11403         isl_stat isl_options_set_ast_print_macro_once(
11404                 isl_ctx *ctx, int val);
11405         int isl_options_get_ast_print_macro_once(isl_ctx *ctx);
11406         __isl_give isl_printer *isl_ast_expr_op_type_print_macro(
11407                 enum isl_ast_expr_op_type type,
11408                 __isl_take isl_printer *p);
11409         __isl_give isl_printer *isl_ast_op_type_print_macro(
11410                 enum isl_ast_expr_op_type type,
11411                 __isl_take isl_printer *p);
11412         __isl_give isl_printer *isl_ast_expr_print_macros(
11413                 __isl_keep isl_ast_expr *expr,
11414                 __isl_take isl_printer *p);
11415         __isl_give isl_printer *isl_ast_node_print_macros(
11416                 __isl_keep isl_ast_node *node,
11417                 __isl_take isl_printer *p);
11418         __isl_give isl_printer *isl_ast_node_print(
11419                 __isl_keep isl_ast_node *node,
11420                 __isl_take isl_printer *p,
11421                 __isl_take isl_ast_print_options *options);
11422         __isl_give isl_printer *isl_ast_node_for_print(
11423                 __isl_keep isl_ast_node *node,
11424                 __isl_take isl_printer *p,
11425                 __isl_take isl_ast_print_options *options);
11426         __isl_give isl_printer *isl_ast_node_if_print(
11427                 __isl_keep isl_ast_node *node,
11428                 __isl_take isl_printer *p,
11429                 __isl_take isl_ast_print_options *options);
11431 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
11432 C<isl> may print out an AST that makes use of macros such
11433 as C<floord>, C<min> and C<max>.
11434 The names of these macros may be modified by a call
11435 to C<isl_ast_expr_op_type_set_print_name>.  The user-specified
11436 names are associated to the printer object.
11437 C<isl_ast_op_type_set_print_name> is an alternative name for
11438 C<isl_ast_expr_op_type_set_print_name>.
11439 C<isl_ast_expr_op_type_print_macro> prints out the macro
11440 corresponding to a specific C<isl_ast_expr_op_type>.
11441 If the print-macro-once option is set, then a given macro definition
11442 is only printed once to any given printer object.
11443 C<isl_ast_op_type_print_macro> is an alternative name for
11444 C<isl_ast_expr_op_type_print_macro>.
11445 C<isl_ast_expr_print_macros> scans the C<isl_ast_expr>
11446 for subexpressions where these macros would be used and prints
11447 out the required macro definitions.
11448 Essentially, C<isl_ast_expr_print_macros> calls
11449 C<isl_ast_expr_foreach_ast_expr_op_type> with
11450 C<isl_ast_expr_op_type_print_macro>
11451 as function argument.
11452 C<isl_ast_node_print_macros> does the same
11453 for expressions in its C<isl_ast_node> argument.
11454 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
11455 C<isl_ast_node_if_print> print an C<isl_ast_node>
11456 in C<ISL_FORMAT_C>, but allow for some extra control
11457 through an C<isl_ast_print_options> object.
11458 This object can be created using the following functions.
11460         #include <isl/ast.h>
11461         __isl_give isl_ast_print_options *
11462         isl_ast_print_options_alloc(isl_ctx *ctx);
11463         __isl_give isl_ast_print_options *
11464         isl_ast_print_options_copy(
11465                 __isl_keep isl_ast_print_options *options);
11466         __isl_null isl_ast_print_options *
11467         isl_ast_print_options_free(
11468                 __isl_take isl_ast_print_options *options);
11470         __isl_give isl_ast_print_options *
11471         isl_ast_print_options_set_print_user(
11472                 __isl_take isl_ast_print_options *options,
11473                 __isl_give isl_printer *(*print_user)(
11474                         __isl_take isl_printer *p,
11475                         __isl_take isl_ast_print_options *options,
11476                         __isl_keep isl_ast_node *node, void *user),
11477                 void *user);
11478         __isl_give isl_ast_print_options *
11479         isl_ast_print_options_set_print_for(
11480                 __isl_take isl_ast_print_options *options,
11481                 __isl_give isl_printer *(*print_for)(
11482                         __isl_take isl_printer *p,
11483                         __isl_take isl_ast_print_options *options,
11484                         __isl_keep isl_ast_node *node, void *user),
11485                 void *user);
11487 The callback set by C<isl_ast_print_options_set_print_user>
11488 is called whenever a node of type C<isl_ast_node_user> needs to
11489 be printed.
11490 The callback set by C<isl_ast_print_options_set_print_for>
11491 is called whenever a node of type C<isl_ast_node_for> needs to
11492 be printed.
11493 Note that C<isl_ast_node_for_print> will I<not> call the
11494 callback set by C<isl_ast_print_options_set_print_for> on the node
11495 on which C<isl_ast_node_for_print> is called, but only on nested
11496 nodes of type C<isl_ast_node_for>.  It is therefore safe to
11497 call C<isl_ast_node_for_print> from within the callback set by
11498 C<isl_ast_print_options_set_print_for>.
11500 The following option determines the type to be used for iterators
11501 while printing the AST.
11503         isl_stat isl_options_set_ast_iterator_type(
11504                 isl_ctx *ctx, const char *val);
11505         const char *isl_options_get_ast_iterator_type(
11506                 isl_ctx *ctx);
11508 The AST printer only prints body nodes of C<if> and C<for> nodes
11509 as blocks if these
11510 blocks cannot be safely omitted.
11511 For example, a C<for> node with one body node will not be
11512 surrounded with braces in C<ISL_FORMAT_C>.
11513 A block will always be printed by setting the following option.
11515         isl_stat isl_options_set_ast_always_print_block(isl_ctx *ctx,
11516                 int val);
11517         int isl_options_get_ast_always_print_block(isl_ctx *ctx);
11519 Explicit block nodes that appear inside the AST are always printed as blocks.
11520 If the block node appears as the outermost node,
11521 then it is only printed if the following option is set.
11523         isl_stat isl_options_set_ast_print_outermost_block(
11524                 isl_ctx *ctx, int val);
11525         int isl_options_get_ast_print_outermost_block(
11526                 isl_ctx *ctx);
11528 =head3 Options
11530         #include <isl/ast_build.h>
11531         isl_stat isl_options_set_ast_build_atomic_upper_bound(
11532                 isl_ctx *ctx, int val);
11533         int isl_options_get_ast_build_atomic_upper_bound(
11534                 isl_ctx *ctx);
11535         isl_stat isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
11536                 int val);
11537         int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
11538         isl_stat isl_options_set_ast_build_detect_min_max(
11539                 isl_ctx *ctx, int val);
11540         int isl_options_get_ast_build_detect_min_max(
11541                 isl_ctx *ctx);
11542         isl_stat isl_options_set_ast_build_exploit_nested_bounds(
11543                 isl_ctx *ctx, int val);
11544         int isl_options_get_ast_build_exploit_nested_bounds(
11545                 isl_ctx *ctx);
11546         isl_stat isl_options_set_ast_build_group_coscheduled(
11547                 isl_ctx *ctx, int val);
11548         int isl_options_get_ast_build_group_coscheduled(
11549                 isl_ctx *ctx);
11550         isl_stat isl_options_set_ast_build_separation_bounds(
11551                 isl_ctx *ctx, int val);
11552         int isl_options_get_ast_build_separation_bounds(
11553                 isl_ctx *ctx);
11554         isl_stat isl_options_set_ast_build_scale_strides(
11555                 isl_ctx *ctx, int val);
11556         int isl_options_get_ast_build_scale_strides(
11557                 isl_ctx *ctx);
11558         isl_stat isl_options_set_ast_build_allow_else(isl_ctx *ctx,
11559                 int val);
11560         int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
11561         isl_stat isl_options_set_ast_build_allow_or(isl_ctx *ctx,
11562                 int val);
11563         int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
11565 =over
11567 =item * ast_build_atomic_upper_bound
11569 Generate loop upper bounds that consist of the current loop iterator,
11570 an operator and an expression not involving the iterator.
11571 If this option is not set, then the current loop iterator may appear
11572 several times in the upper bound.
11573 For example, when this option is turned off, AST generation
11574 for the schedule
11576         [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
11578 produces
11580         for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
11581           A(c0);
11583 When the option is turned on, the following AST is generated
11585         for (int c0 = 0; c0 <= min(100, n); c0 += 1)
11586           A(c0);
11588 =item * ast_build_prefer_pdiv
11590 If this option is turned off, then the AST generation will
11591 produce ASTs that may only contain C<isl_ast_expr_op_fdiv_q>
11592 operators, but no C<isl_ast_expr_op_pdiv_q> or
11593 C<isl_ast_expr_op_pdiv_r> operators.
11594 If this option is turned on, then C<isl> will try to convert
11595 some of the C<isl_ast_expr_op_fdiv_q> operators to (expressions containing)
11596 C<isl_ast_expr_op_pdiv_q> or C<isl_ast_expr_op_pdiv_r> operators.
11598 =item * ast_build_detect_min_max
11600 If this option is turned on, then C<isl> will try and detect
11601 min or max-expressions when building AST expressions from
11602 piecewise affine expressions.
11604 =item * ast_build_exploit_nested_bounds
11606 Simplify conditions based on bounds of nested for loops.
11607 In particular, remove conditions that are implied by the fact
11608 that one or more nested loops have at least one iteration,
11609 meaning that the upper bound is at least as large as the lower bound.
11610 For example, when this option is turned off, AST generation
11611 for the schedule
11613         [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
11614                                         0 <= j <= M }
11616 produces
11618         if (M >= 0)
11619           for (int c0 = 0; c0 <= N; c0 += 1)
11620             for (int c1 = 0; c1 <= M; c1 += 1)
11621               A(c0, c1);
11623 When the option is turned on, the following AST is generated
11625         for (int c0 = 0; c0 <= N; c0 += 1)
11626           for (int c1 = 0; c1 <= M; c1 += 1)
11627             A(c0, c1);
11629 =item * ast_build_group_coscheduled
11631 If two domain elements are assigned the same schedule point, then
11632 they may be executed in any order and they may even appear in different
11633 loops.  If this options is set, then the AST generator will make
11634 sure that coscheduled domain elements do not appear in separate parts
11635 of the AST.  This is useful in case of nested AST generation
11636 if the outer AST generation is given only part of a schedule
11637 and the inner AST generation should handle the domains that are
11638 coscheduled by this initial part of the schedule together.
11639 For example if an AST is generated for a schedule
11641         { A[i] -> [0]; B[i] -> [0] }
11643 then the C<isl_ast_build_set_create_leaf> callback described
11644 below may get called twice, once for each domain.
11645 Setting this option ensures that the callback is only called once
11646 on both domains together.
11648 =item * ast_build_separation_bounds
11650 This option specifies which bounds to use during separation.
11651 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
11652 then all (possibly implicit) bounds on the current dimension will
11653 be used during separation.
11654 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
11655 then only those bounds that are explicitly available will
11656 be used during separation.
11658 =item * ast_build_scale_strides
11660 This option specifies whether the AST generator is allowed
11661 to scale down iterators of strided loops.
11663 =item * ast_build_allow_else
11665 This option specifies whether the AST generator is allowed
11666 to construct if statements with else branches.
11668 =item * ast_build_allow_or
11670 This option specifies whether the AST generator is allowed
11671 to construct if conditions with disjunctions.
11673 =back
11675 =head3 AST Generation Options (Schedule Tree)
11677 In case of AST construction from a schedule tree, the options
11678 that control how an AST is created from the individual schedule
11679 dimensions are stored in the band nodes of the tree
11680 (see L</"Schedule Trees">).
11682 In particular, a schedule dimension can be handled in four
11683 different ways, atomic, separate, unroll or the default.
11684 This loop AST generation type can be set using
11685 C<isl_schedule_node_band_member_set_ast_loop_type>.
11686 Alternatively,
11687 the first three can be selected by including a one-dimensional
11688 element with as value the position of the schedule dimension
11689 within the band and as name one of C<atomic>, C<separate>
11690 or C<unroll> in the options
11691 set by C<isl_schedule_node_band_set_ast_build_options>.
11692 Only one of these three may be specified for
11693 any given schedule dimension within a band node.
11694 If none of these is specified, then the default
11695 is used.  The meaning of the options is as follows.
11697 =over
11699 =item C<atomic>
11701 When this option is specified, the AST generator will make
11702 sure that a given domains space only appears in a single
11703 loop at the specified level.
11705 For example, for the schedule tree
11707         domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
11708         child:
11709           schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
11710           options: "{ atomic[x] }"
11712 the following AST will be generated
11714         for (int c0 = 0; c0 <= 10; c0 += 1) {
11715           if (c0 >= 1)
11716             b(c0 - 1);
11717           if (c0 <= 9)
11718             a(c0);
11719         }
11721 On the other hand, for the schedule tree
11723         domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
11724         child:
11725           schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
11726           options: "{ separate[x] }"
11728 the following AST will be generated
11730         {
11731           a(0);
11732           for (int c0 = 1; c0 <= 9; c0 += 1) {
11733             b(c0 - 1);
11734             a(c0);
11735           }
11736           b(9);
11737         }
11739 If neither C<atomic> nor C<separate> is specified, then the AST generator
11740 may produce either of these two results or some intermediate form.
11742 =item C<separate>
11744 When this option is specified, the AST generator will
11745 split the domain of the specified schedule dimension
11746 into pieces with a fixed set of statements for which
11747 instances need to be executed by the iterations in
11748 the schedule domain part.  This option tends to avoid
11749 the generation of guards inside the corresponding loops.
11750 See also the C<atomic> option.
11752 =item C<unroll>
11754 When this option is specified, the AST generator will
11755 I<completely> unroll the corresponding schedule dimension.
11756 It is the responsibility of the user to ensure that such
11757 unrolling is possible.
11758 To obtain a partial unrolling, the user should apply an additional
11759 strip-mining to the schedule and fully unroll the inner schedule
11760 dimension.
11762 =back
11764 The C<isolate> option is a bit more involved.  It allows the user
11765 to isolate a range of schedule dimension values from smaller and
11766 greater values.  Additionally, the user may specify a different
11767 atomic/separate/unroll choice for the isolated part and the remaining
11768 parts.  The typical use case of the C<isolate> option is to isolate
11769 full tiles from partial tiles.
11770 The part that needs to be isolated may depend on outer schedule dimensions.
11771 The option therefore needs to be able to reference those outer schedule
11772 dimensions.  In particular, the space of the C<isolate> option is that
11773 of a wrapped map with as domain the flat product of all outer band nodes
11774 and as range the space of the current band node.
11775 The atomic/separate/unroll choice for the isolated part is determined
11776 by an option that lives in an unnamed wrapped space with as domain
11777 a zero-dimensional C<isolate> space and as range the regular
11778 C<atomic>, C<separate> or C<unroll> space.
11779 This option may also be set directly using
11780 C<isl_schedule_node_band_member_set_isolate_ast_loop_type>.
11781 The atomic/separate/unroll choice for the remaining part is determined
11782 by the regular C<atomic>, C<separate> or C<unroll> option.
11783 Since the C<isolate> option references outer schedule dimensions,
11784 its use in a band node causes any tree containing the node
11785 to be considered anchored.
11787 As an example, consider the isolation of full tiles from partial tiles
11788 in a tiling of a triangular domain.  The original schedule is as follows.
11790         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
11791         child:
11792           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
11793                 { A[i,j] -> [floor(j/10)] }, \
11794                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
11796 The output is
11798         for (int c0 = 0; c0 <= 10; c0 += 1)
11799           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
11800             for (int c2 = 10 * c0;
11801                  c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
11802               for (int c3 = 10 * c1;
11803                    c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
11804                 A(c2, c3);
11806 Isolating the full tiles, we have the following input
11808         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
11809         child:
11810           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
11811                 { A[i,j] -> [floor(j/10)] }, \
11812                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
11813           options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
11814                 10a+9+10b+9 <= 100 }"
11816 and output
11818         {
11819           for (int c0 = 0; c0 <= 8; c0 += 1) {
11820             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
11821               for (int c2 = 10 * c0;
11822                    c2 <= 10 * c0 + 9; c2 += 1)
11823                 for (int c3 = 10 * c1;
11824                      c3 <= 10 * c1 + 9; c3 += 1)
11825                   A(c2, c3);
11826             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
11827               for (int c2 = 10 * c0;
11828                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
11829                 for (int c3 = 10 * c1;
11830                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
11831                   A(c2, c3);
11832           }
11833           for (int c0 = 9; c0 <= 10; c0 += 1)
11834             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
11835               for (int c2 = 10 * c0;
11836                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
11837                 for (int c3 = 10 * c1;
11838                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
11839                   A(c2, c3);
11840         }
11842 We may then additionally unroll the innermost loop of the isolated part
11844         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
11845         child:
11846           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
11847                 { A[i,j] -> [floor(j/10)] }, \
11848                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
11849           options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
11850                 10a+9+10b+9 <= 100; [isolate[] -> unroll[3]] }"
11852 to obtain
11854         {
11855           for (int c0 = 0; c0 <= 8; c0 += 1) {
11856             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
11857               for (int c2 = 10 * c0; c2 <= 10 * c0 + 9; c2 += 1) {
11858                 A(c2, 10 * c1);
11859                 A(c2, 10 * c1 + 1);
11860                 A(c2, 10 * c1 + 2);
11861                 A(c2, 10 * c1 + 3);
11862                 A(c2, 10 * c1 + 4);
11863                 A(c2, 10 * c1 + 5);
11864                 A(c2, 10 * c1 + 6);
11865                 A(c2, 10 * c1 + 7);
11866                 A(c2, 10 * c1 + 8);
11867                 A(c2, 10 * c1 + 9);
11868               }
11869             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
11870               for (int c2 = 10 * c0;
11871                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
11872                 for (int c3 = 10 * c1;
11873                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
11874                   A(c2, c3);
11875           }
11876           for (int c0 = 9; c0 <= 10; c0 += 1)
11877             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
11878               for (int c2 = 10 * c0;
11879                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
11880                 for (int c3 = 10 * c1;
11881                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
11882                   A(c2, c3);
11883         }
11886 =head3 AST Generation Options (Schedule Map)
11888 In case of AST construction using
11889 C<isl_ast_build_node_from_schedule_map>, the options
11890 that control how an AST is created from the individual schedule
11891 dimensions are stored in the C<isl_ast_build>.
11892 They can be set using the following function.
11894         #include <isl/ast_build.h>
11895         __isl_give isl_ast_build *
11896         isl_ast_build_set_options(
11897                 __isl_take isl_ast_build *build,
11898                 __isl_take isl_union_map *options);
11900 The options are encoded in an C<isl_union_map>.
11901 The domain of this union relation refers to the schedule domain,
11902 i.e., the range of the schedule passed
11903 to C<isl_ast_build_node_from_schedule_map>.
11904 In the case of nested AST generation (see L</"Nested AST Generation">),
11905 the domain of C<options> should refer to the extra piece of the schedule.
11906 That is, it should be equal to the range of the wrapped relation in the
11907 range of the schedule.
11908 The range of the options can consist of elements in one or more spaces,
11909 the names of which determine the effect of the option.
11910 The values of the range typically also refer to the schedule dimension
11911 to which the option applies, with value C<0> representing
11912 the outermost schedule dimension.  In case of nested AST generation
11913 (see L</"Nested AST Generation">), these values refer to the position
11914 of the schedule dimension within the innermost AST generation.
11915 The constraints on the domain elements of
11916 the option should only refer to this dimension and earlier dimensions.
11917 We consider the following spaces.
11919 =over
11921 =item C<separation_class>
11923 B<This option has been deprecated.  Use the isolate option on
11924 schedule trees instead.>
11926 This space is a wrapped relation between two one dimensional spaces.
11927 The input space represents the schedule dimension to which the option
11928 applies and the output space represents the separation class.
11929 While constructing a loop corresponding to the specified schedule
11930 dimension(s), the AST generator will try to generate separate loops
11931 for domain elements that are assigned different classes.
11932 If only some of the elements are assigned a class, then those elements
11933 that are not assigned any class will be treated as belonging to a class
11934 that is separate from the explicitly assigned classes.
11935 The typical use case for this option is to separate full tiles from
11936 partial tiles.
11937 The other options, described below, are applied after the separation
11938 into classes.
11940 As an example, consider the separation into full and partial tiles
11941 of a tiling of a triangular domain.
11942 Take, for example, the domain
11944         { A[i,j] : 0 <= i,j and i + j <= 100 }
11946 and a tiling into tiles of 10 by 10.  The input to the AST generator
11947 is then the schedule
11949         { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
11950                                                 i + j <= 100 }
11952 Without any options, the following AST is generated
11954         for (int c0 = 0; c0 <= 10; c0 += 1)
11955           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
11956             for (int c2 = 10 * c0;
11957                  c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
11958                  c2 += 1)
11959               for (int c3 = 10 * c1;
11960                    c3 <= min(10 * c1 + 9, -c2 + 100);
11961                    c3 += 1)
11962                 A(c2, c3);
11964 Separation into full and partial tiles can be obtained by assigning
11965 a class, say C<0>, to the full tiles.  The full tiles are represented by those
11966 values of the first and second schedule dimensions for which there are
11967 values of the third and fourth dimensions to cover an entire tile.
11968 That is, we need to specify the following option
11970         { [a,b,c,d] -> separation_class[[0]->[0]] :
11971                 exists b': 0 <= 10a,10b' and
11972                            10a+9+10b'+9 <= 100;
11973           [a,b,c,d] -> separation_class[[1]->[0]] :
11974                 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
11976 which simplifies to
11978         { [a, b, c, d] -> separation_class[[1] -> [0]] :
11979                 a >= 0 and b >= 0 and b <= 8 - a;
11980           [a, b, c, d] -> separation_class[[0] -> [0]] :
11981                 a >= 0 and a <= 8 }
11983 With this option, the generated AST is as follows
11985         {
11986           for (int c0 = 0; c0 <= 8; c0 += 1) {
11987             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
11988               for (int c2 = 10 * c0;
11989                    c2 <= 10 * c0 + 9; c2 += 1)
11990                 for (int c3 = 10 * c1;
11991                      c3 <= 10 * c1 + 9; c3 += 1)
11992                   A(c2, c3);
11993             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
11994               for (int c2 = 10 * c0;
11995                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
11996                    c2 += 1)
11997                 for (int c3 = 10 * c1;
11998                      c3 <= min(-c2 + 100, 10 * c1 + 9);
11999                      c3 += 1)
12000                   A(c2, c3);
12001           }
12002           for (int c0 = 9; c0 <= 10; c0 += 1)
12003             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
12004               for (int c2 = 10 * c0;
12005                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
12006                    c2 += 1)
12007                 for (int c3 = 10 * c1;
12008                      c3 <= min(10 * c1 + 9, -c2 + 100);
12009                      c3 += 1)
12010                   A(c2, c3);
12011         }
12013 =item C<separate>
12015 This is a single-dimensional space representing the schedule dimension(s)
12016 to which ``separation'' should be applied.  Separation tries to split
12017 a loop into several pieces if this can avoid the generation of guards
12018 inside the loop.
12019 See also the C<atomic> option.
12021 =item C<atomic>
12023 This is a single-dimensional space representing the schedule dimension(s)
12024 for which the domains should be considered ``atomic''.  That is, the
12025 AST generator will make sure that any given domain space will only appear
12026 in a single loop at the specified level.
12028 Consider the following schedule
12030         { a[i] -> [i] : 0 <= i < 10;
12031           b[i] -> [i+1] : 0 <= i < 10 }
12033 If the following option is specified
12035         { [i] -> separate[x] }
12037 then the following AST will be generated
12039         {
12040           a(0);
12041           for (int c0 = 1; c0 <= 9; c0 += 1) {
12042             a(c0);
12043             b(c0 - 1);
12044           }
12045           b(9);
12046         }
12048 If, on the other hand, the following option is specified
12050         { [i] -> atomic[x] }
12052 then the following AST will be generated
12054         for (int c0 = 0; c0 <= 10; c0 += 1) {
12055           if (c0 <= 9)
12056             a(c0);
12057           if (c0 >= 1)
12058             b(c0 - 1);
12059         }
12061 If neither C<atomic> nor C<separate> is specified, then the AST generator
12062 may produce either of these two results or some intermediate form.
12064 =item C<unroll>
12066 This is a single-dimensional space representing the schedule dimension(s)
12067 that should be I<completely> unrolled.
12068 To obtain a partial unrolling, the user should apply an additional
12069 strip-mining to the schedule and fully unroll the inner loop.
12071 =back
12073 =head3 Fine-grained Control over AST Generation
12075 Besides specifying the constraints on the parameters,
12076 an C<isl_ast_build> object can be used to control
12077 various aspects of the AST generation process.
12078 In case of AST construction using
12079 C<isl_ast_build_node_from_schedule_map>,
12080 the most prominent way of control is through ``options'',
12081 as explained above.
12083 Additional control is available through the following functions.
12085         #include <isl/ast_build.h>
12086         __isl_give isl_ast_build *
12087         isl_ast_build_set_iterators(
12088                 __isl_take isl_ast_build *build,
12089                 __isl_take isl_id_list *iterators);
12091 The function C<isl_ast_build_set_iterators> allows the user to
12092 specify a list of iterator C<isl_id>s to be used as iterators.
12093 If the input schedule is injective, then
12094 the number of elements in this list should be as large as the dimension
12095 of the schedule space, but no direct correspondence should be assumed
12096 between dimensions and elements.
12097 If the input schedule is not injective, then an additional number
12098 of C<isl_id>s equal to the largest dimension of the input domains
12099 may be required.
12100 If the number of provided C<isl_id>s is insufficient, then additional
12101 names are automatically generated.
12103         #include <isl/ast_build.h>
12104         __isl_give isl_ast_build *
12105         isl_ast_build_set_create_leaf(
12106                 __isl_take isl_ast_build *build,
12107                 __isl_give isl_ast_node *(*fn)(
12108                         __isl_take isl_ast_build *build,
12109                         void *user), void *user);
12112 C<isl_ast_build_set_create_leaf> function allows for the
12113 specification of a callback that should be called whenever the AST
12114 generator arrives at an element of the schedule domain.
12115 The callback should return an AST node that should be inserted
12116 at the corresponding position of the AST.  The default action (when
12117 the callback is not set) is to continue generating parts of the AST to scan
12118 all the domain elements associated to the schedule domain element
12119 and to insert user nodes, ``calling'' the domain element, for each of them.
12120 The C<build> argument contains the current state of the C<isl_ast_build>.
12121 To ease nested AST generation (see L</"Nested AST Generation">),
12122 all control information that is
12123 specific to the current AST generation such as the options and
12124 the callbacks has been removed from this C<isl_ast_build>.
12125 The callback would typically return the result of a nested
12126 AST generation or a
12127 user defined node created using the following function.
12129         #include <isl/ast.h>
12130         __isl_give isl_ast_node *isl_ast_node_alloc_user(
12131                 __isl_take isl_ast_expr *expr);
12133         #include <isl/ast_build.h>
12134         __isl_give isl_ast_build *
12135         isl_ast_build_set_at_each_domain(
12136                 __isl_take isl_ast_build *build,
12137                 __isl_give isl_ast_node *(*fn)(
12138                         __isl_take isl_ast_node *node,
12139                         __isl_keep isl_ast_build *build,
12140                         void *user), void *user);
12141         __isl_give isl_ast_build *
12142         isl_ast_build_set_before_each_for(
12143                 __isl_take isl_ast_build *build,
12144                 __isl_give isl_id *(*fn)(
12145                         __isl_keep isl_ast_build *build,
12146                         void *user), void *user);
12147         __isl_give isl_ast_build *
12148         isl_ast_build_set_after_each_for(
12149                 __isl_take isl_ast_build *build,
12150                 __isl_give isl_ast_node *(*fn)(
12151                         __isl_take isl_ast_node *node,
12152                         __isl_keep isl_ast_build *build,
12153                         void *user), void *user);
12154         __isl_give isl_ast_build *
12155         isl_ast_build_set_before_each_mark(
12156                 __isl_take isl_ast_build *build,
12157                 isl_stat (*fn)(__isl_keep isl_id *mark,
12158                         __isl_keep isl_ast_build *build,
12159                         void *user), void *user);
12160         __isl_give isl_ast_build *
12161         isl_ast_build_set_after_each_mark(
12162                 __isl_take isl_ast_build *build,
12163                 __isl_give isl_ast_node *(*fn)(
12164                         __isl_take isl_ast_node *node,
12165                         __isl_keep isl_ast_build *build,
12166                         void *user), void *user);
12168 The callback set by C<isl_ast_build_set_at_each_domain> will
12169 be called for each domain AST node.
12170 The callbacks set by C<isl_ast_build_set_before_each_for>
12171 and C<isl_ast_build_set_after_each_for> will be called
12172 for each for AST node.  The first will be called in depth-first
12173 pre-order, while the second will be called in depth-first post-order.
12174 Since C<isl_ast_build_set_before_each_for> is called before the for
12175 node is actually constructed, it is only passed an C<isl_ast_build>.
12176 The returned C<isl_id> will be added as an annotation (using
12177 C<isl_ast_node_set_annotation>) to the constructed for node.
12178 In particular, if the user has also specified an C<after_each_for>
12179 callback, then the annotation can be retrieved from the node passed to
12180 that callback using C<isl_ast_node_get_annotation>.
12181 The callbacks set by C<isl_ast_build_set_before_each_mark>
12182 and C<isl_ast_build_set_after_each_mark> will be called for each
12183 mark AST node that is created, i.e., for each mark schedule node
12184 in the input schedule tree.  The first will be called in depth-first
12185 pre-order, while the second will be called in depth-first post-order.
12186 Since the callback set by C<isl_ast_build_set_before_each_mark>
12187 is called before the mark AST node is actually constructed, it is passed
12188 the identifier of the mark node.
12189 All callbacks should C<NULL> (or C<isl_stat_error>) on failure.
12190 The given C<isl_ast_build> can be used to create new
12191 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
12192 or C<isl_ast_build_call_from_pw_multi_aff>.
12194 =head3 Nested AST Generation
12196 C<isl> allows the user to create an AST within the context
12197 of another AST.  These nested ASTs are created using the
12198 same C<isl_ast_build_node_from_schedule_map> function that is used to create
12199 the outer AST.  The C<build> argument should be an C<isl_ast_build>
12200 passed to a callback set by
12201 C<isl_ast_build_set_create_leaf>.
12202 The space of the range of the C<schedule> argument should refer
12203 to this build.  In particular, the space should be a wrapped
12204 relation and the domain of this wrapped relation should be the
12205 same as that of the range of the schedule returned by
12206 C<isl_ast_build_get_schedule> below.
12207 In practice, the new schedule is typically
12208 created by calling C<isl_union_map_range_product> on the old schedule
12209 and some extra piece of the schedule.
12210 The space of the schedule domain is also available from
12211 the C<isl_ast_build>.
12213         #include <isl/ast_build.h>
12214         __isl_give isl_union_map *isl_ast_build_get_schedule(
12215                 __isl_keep isl_ast_build *build);
12216         __isl_give isl_space *isl_ast_build_get_schedule_space(
12217                 __isl_keep isl_ast_build *build);
12218         __isl_give isl_ast_build *isl_ast_build_restrict(
12219                 __isl_take isl_ast_build *build,
12220                 __isl_take isl_set *set);
12222 The C<isl_ast_build_get_schedule> function returns a (partial)
12223 schedule for the domains elements for which part of the AST still needs to
12224 be generated in the current build.
12225 In particular, the domain elements are mapped to those iterations of the loops
12226 enclosing the current point of the AST generation inside which
12227 the domain elements are executed.
12228 No direct correspondence between
12229 the input schedule and this schedule should be assumed.
12230 The space obtained from C<isl_ast_build_get_schedule_space> can be used
12231 to create a set for C<isl_ast_build_restrict> to intersect
12232 with the current build.  In particular, the set passed to
12233 C<isl_ast_build_restrict> can have additional parameters.
12234 The ids of the set dimensions in the space returned by
12235 C<isl_ast_build_get_schedule_space> correspond to the
12236 iterators of the already generated loops.
12237 The user should not rely on the ids of the output dimensions
12238 of the relations in the union relation returned by
12239 C<isl_ast_build_get_schedule> having any particular value.
12241 =head1 Applications
12243 Although C<isl> is mainly meant to be used as a library,
12244 it also contains some basic applications that use some
12245 of the functionality of C<isl>.
12246 For applications that take one or more polytopes or polyhedra
12247 as input, this input may be specified in either the L<isl format>
12248 or the L<PolyLib format>.
12250 =head2 C<isl_polyhedron_sample>
12252 C<isl_polyhedron_sample> takes a polyhedron as input and prints
12253 an integer element of the polyhedron, if there is any.
12254 The first column in the output is the denominator and is always
12255 equal to 1.  If the polyhedron contains no integer points,
12256 then a vector of length zero is printed.
12258 =head2 C<isl_pip>
12260 C<isl_pip> takes the same input as the C<example> program
12261 from the C<piplib> distribution, i.e., a set of constraints
12262 on the parameters, a line containing only -1 and finally a set
12263 of constraints on a parametric polyhedron.
12264 The coefficients of the parameters appear in the last columns
12265 (but before the final constant column).
12266 The output is the lexicographic minimum of the parametric polyhedron.
12267 As C<isl> currently does not have its own output format, the output
12268 is just a dump of the internal state.
12270 =head2 C<isl_polyhedron_minimize>
12272 C<isl_polyhedron_minimize> computes the minimum of some linear
12273 or affine objective function over the integer points in a polyhedron.
12274 If an affine objective function
12275 is given, then the constant should appear in the last column.
12277 =head2 C<isl_polytope_scan>
12279 Given a polytope, C<isl_polytope_scan> prints
12280 all integer points in the polytope.
12282 =head2 C<isl_flow>
12284 Given an C<isl_union_access_info> object as input,
12285 C<isl_flow> prints out the corresponding dependences,
12286 as computed by C<isl_union_access_info_compute_flow>.
12288 =head2 C<isl_codegen>
12290 Given either a schedule tree or a sequence consisting of
12291 a schedule map, a context set and an options relation,
12292 C<isl_codegen> prints out an AST that scans the domain elements
12293 of the schedule in the order of their image(s) taking into account
12294 the constraints in the context set.
12296 =head2 C<isl_schedule>
12298 Given an C<isl_schedule_constraints> object as input,
12299 C<isl_schedule> prints out a schedule that satisfies the given
12300 constraints.