add isl_union_pw_multi_aff_get_union_pw_aff
[isl.git] / doc / user.pod
blob857d22bbdb48ec8adc92d2b267e701bb1bb25858
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 is 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 * Objects of type C<isl_union_pw_multi_aff> can no longer contain
216 two or more C<isl_pw_multi_aff> objects with the same domain space.
218 =item * The function C<isl_union_pw_multi_aff_add> now consistently
219 computes the sum on the shared definition domain.
220 The function C<isl_union_pw_multi_aff_union_add> has been added
221 to compute the sum on the union of definition domains.
222 The original behavior of C<isl_union_pw_multi_aff_add> was
223 confused and is no longer available.
225 =back
227 =head1 License
229 C<isl> is released under the MIT license.
231 =over
233 Permission is hereby granted, free of charge, to any person obtaining a copy of
234 this software and associated documentation files (the "Software"), to deal in
235 the Software without restriction, including without limitation the rights to
236 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
237 of the Software, and to permit persons to whom the Software is furnished to do
238 so, subject to the following conditions:
240 The above copyright notice and this permission notice shall be included in all
241 copies or substantial portions of the Software.
243 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
244 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
245 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
246 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
247 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
248 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
249 SOFTWARE.
251 =back
253 Note that by default C<isl> requires C<GMP>, which is released
254 under the GNU Lesser General Public License (LGPL).  This means
255 that code linked against C<isl> is also linked against LGPL code.
257 When configuring with C<--with-int=imath>, C<isl> will link against C<imath>, a
258 library for exact integer arithmetic released under the MIT license.
260 =head1 Installation
262 The source of C<isl> can be obtained either as a tarball
263 or from the git repository.  Both are available from
264 L<http://freshmeat.net/projects/isl/>.
265 The installation process depends on how you obtained
266 the source.
268 =head2 Installation from the git repository
270 =over
272 =item 1 Clone or update the repository
274 The first time the source is obtained, you need to clone
275 the repository.
277         git clone git://repo.or.cz/isl.git
279 To obtain updates, you need to pull in the latest changes
281         git pull
283 =item 2 Optionally get C<imath> submodule
285 To build C<isl> with C<imath>, you need to obtain the C<imath>
286 submodule by running in the git source tree of C<isl>
288        git submodule init
289        git submodule update
291 This will fetch the required version of C<imath> in a subdirectory of C<isl>.
293 =item 2 Generate C<configure>
295         ./autogen.sh
297 =back
299 After performing the above steps, continue
300 with the L<Common installation instructions>.
302 =head2 Common installation instructions
304 =over
306 =item 1 Obtain C<GMP>
308 By default, building C<isl> requires C<GMP>, including its headers files.
309 Your distribution may not provide these header files by default
310 and you may need to install a package called C<gmp-devel> or something
311 similar.  Alternatively, C<GMP> can be built from
312 source, available from L<http://gmplib.org/>.
313 C<GMP> is not needed if you build C<isl> with C<imath>.
315 =item 2 Configure
317 C<isl> uses the standard C<autoconf> C<configure> script.
318 To run it, just type
320         ./configure
322 optionally followed by some configure options.
323 A complete list of options can be obtained by running
325         ./configure --help
327 Below we discuss some of the more common options.
329 =over
331 =item C<--prefix>
333 Installation prefix for C<isl>
335 =item C<--with-int=[gmp|imath]>
337 Select the integer library to be used by C<isl>, the default is C<gmp>.
338 Note that C<isl> may run significantly slower if you use C<imath>.
340 =item C<--with-gmp-prefix>
342 Installation prefix for C<GMP> (architecture-independent files).
344 =item C<--with-gmp-exec-prefix>
346 Installation prefix for C<GMP> (architecture-dependent files).
348 =back
350 =item 3 Compile
352         make
354 =item 4 Install (optional)
356         make install
358 =back
360 =head1 Integer Set Library
362 =head2 Memory Management
364 Since a high-level operation on isl objects usually involves
365 several substeps and since the user is usually not interested in
366 the intermediate results, most functions that return a new object
367 will also release all the objects passed as arguments.
368 If the user still wants to use one or more of these arguments
369 after the function call, she should pass along a copy of the
370 object rather than the object itself.
371 The user is then responsible for making sure that the original
372 object gets used somewhere else or is explicitly freed.
374 The arguments and return values of all documented functions are
375 annotated to make clear which arguments are released and which
376 arguments are preserved.  In particular, the following annotations
377 are used
379 =over
381 =item C<__isl_give>
383 C<__isl_give> means that a new object is returned.
384 The user should make sure that the returned pointer is
385 used exactly once as a value for an C<__isl_take> argument.
386 In between, it can be used as a value for as many
387 C<__isl_keep> arguments as the user likes.
388 There is one exception, and that is the case where the
389 pointer returned is C<NULL>.  Is this case, the user
390 is free to use it as an C<__isl_take> argument or not.
391 When applied to a C<char *>, the returned pointer needs to be
392 freed using C<free>.
394 =item C<__isl_null>
396 C<__isl_null> means that a C<NULL> value is returned.
398 =item C<__isl_take>
400 C<__isl_take> means that the object the argument points to
401 is taken over by the function and may no longer be used
402 by the user as an argument to any other function.
403 The pointer value must be one returned by a function
404 returning an C<__isl_give> pointer.
405 If the user passes in a C<NULL> value, then this will
406 be treated as an error in the sense that the function will
407 not perform its usual operation.  However, it will still
408 make sure that all the other C<__isl_take> arguments
409 are released.
411 =item C<__isl_keep>
413 C<__isl_keep> means that the function will only use the object
414 temporarily.  After the function has finished, the user
415 can still use it as an argument to other functions.
416 A C<NULL> value will be treated in the same way as
417 a C<NULL> value for an C<__isl_take> argument.
418 This annotation may also be used on return values of
419 type C<const char *>, in which case the returned pointer should
420 not be freed by the user and is only valid until the object
421 from which it was derived is updated or freed.
423 =back
425 =head2 Initialization
427 All manipulations of integer sets and relations occur within
428 the context of an C<isl_ctx>.
429 A given C<isl_ctx> can only be used within a single thread.
430 All arguments of a function are required to have been allocated
431 within the same context.
432 There are currently no functions available for moving an object
433 from one C<isl_ctx> to another C<isl_ctx>.  This means that
434 there is currently no way of safely moving an object from one
435 thread to another, unless the whole C<isl_ctx> is moved.
437 An C<isl_ctx> can be allocated using C<isl_ctx_alloc> and
438 freed using C<isl_ctx_free>.
439 All objects allocated within an C<isl_ctx> should be freed
440 before the C<isl_ctx> itself is freed.
442         isl_ctx *isl_ctx_alloc();
443         void isl_ctx_free(isl_ctx *ctx);
445 The user can impose a bound on the number of low-level I<operations>
446 that can be performed by an C<isl_ctx>.  This bound can be set and
447 retrieved using the following functions.  A bound of zero means that
448 no bound is imposed.  The number of operations performed can be
449 reset using C<isl_ctx_reset_operations>.  Note that the number
450 of low-level operations needed to perform a high-level computation
451 may differ significantly across different versions
452 of C<isl>, but it should be the same across different platforms
453 for the same version of C<isl>.
455 Warning: This feature is experimental.  C<isl> has good support to abort and
456 bail out during the computation, but this feature may exercise error code paths
457 that are normally not used that much. Consequently, it is not unlikely that
458 hidden bugs will be exposed.
460         void isl_ctx_set_max_operations(isl_ctx *ctx,
461                 unsigned long max_operations);
462         unsigned long isl_ctx_get_max_operations(isl_ctx *ctx);
463         void isl_ctx_reset_operations(isl_ctx *ctx);
465 In order to be able to create an object in the same context
466 as another object, most object types (described later in
467 this document) provide a function to obtain the context
468 in which the object was created.
470         #include <isl/val.h>
471         isl_ctx *isl_val_get_ctx(__isl_keep isl_val *val);
472         isl_ctx *isl_multi_val_get_ctx(
473                 __isl_keep isl_multi_val *mv);
475         #include <isl/id.h>
476         isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
478         #include <isl/local_space.h>
479         isl_ctx *isl_local_space_get_ctx(
480                 __isl_keep isl_local_space *ls);
482         #include <isl/set.h>
483         isl_ctx *isl_set_list_get_ctx(
484                 __isl_keep isl_set_list *list);
486         #include <isl/aff.h>
487         isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
488         isl_ctx *isl_multi_aff_get_ctx(
489                 __isl_keep isl_multi_aff *maff);
490         isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pa);
491         isl_ctx *isl_pw_multi_aff_get_ctx(
492                 __isl_keep isl_pw_multi_aff *pma);
493         isl_ctx *isl_multi_pw_aff_get_ctx(
494                 __isl_keep isl_multi_pw_aff *mpa);
495         isl_ctx *isl_union_pw_aff_get_ctx(
496                 __isl_keep isl_union_pw_aff *upa);
497         isl_ctx *isl_union_pw_multi_aff_get_ctx(
498                 __isl_keep isl_union_pw_multi_aff *upma);
500         #include <isl/id_to_ast_expr.h>
501         isl_ctx *isl_id_to_ast_expr_get_ctx(
502                 __isl_keep id_to_ast_expr *id2expr);
504         #include <isl/point.h>
505         isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
507         #include <isl/vec.h>
508         isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
510         #include <isl/mat.h>
511         isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
513         #include <isl/vertices.h>
514         isl_ctx *isl_vertices_get_ctx(
515                 __isl_keep isl_vertices *vertices);
516         isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
517         isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
519         #include <isl/flow.h>
520         isl_ctx *isl_restriction_get_ctx(
521                 __isl_keep isl_restriction *restr);
523         #include <isl/schedule.h>
524         isl_ctx *isl_schedule_constraints_get_ctx(
525                 __isl_keep isl_schedule_constraints *sc);
527         #include <isl/band.h>
528         isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band);
530         #include <isl/ast_build.h>
531         isl_ctx *isl_ast_build_get_ctx(
532                 __isl_keep isl_ast_build *build);
534         #include <isl/ast.h>
535         isl_ctx *isl_ast_expr_get_ctx(
536                 __isl_keep isl_ast_expr *expr);
537         isl_ctx *isl_ast_node_get_ctx(
538                 __isl_keep isl_ast_node *node);
540 =head2 Values
542 An C<isl_val> represents an integer value, a rational value
543 or one of three special values, infinity, negative infinity and NaN.
544 Some predefined values can be created using the following functions.
546         #include <isl/val.h>
547         __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
548         __isl_give isl_val *isl_val_one(isl_ctx *ctx);
549         __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
550         __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
551         __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
552         __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
554 Specific integer values can be created using the following functions.
556         #include <isl/val.h>
557         __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
558                 long i);
559         __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
560                 unsigned long u);
561         __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
562                 size_t n, size_t size, const void *chunks);
564 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
565 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
566 The least significant digit is assumed to be stored first.
568 Value objects can be copied and freed using the following functions.
570         #include <isl/val.h>
571         __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
572         __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
574 They can be inspected using the following functions.
576         #include <isl/val.h>
577         long isl_val_get_num_si(__isl_keep isl_val *v);
578         long isl_val_get_den_si(__isl_keep isl_val *v);
579         double isl_val_get_d(__isl_keep isl_val *v);
580         size_t isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
581                 size_t size);
582         int isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
583                 size_t size, void *chunks);
585 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
586 of C<size> bytes needed to store the absolute value of the
587 numerator of C<v>.
588 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
589 which is assumed to have been preallocated by the caller.
590 The least significant digit is stored first.
591 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
592 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
593 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
595 An C<isl_val> can be modified using the following function.
597         #include <isl/val.h>
598         __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
599                 long i);
601 The following unary properties are defined on C<isl_val>s.
603         #include <isl/val.h>
604         int isl_val_sgn(__isl_keep isl_val *v);
605         int isl_val_is_zero(__isl_keep isl_val *v);
606         int isl_val_is_one(__isl_keep isl_val *v);
607         int isl_val_is_negone(__isl_keep isl_val *v);
608         int isl_val_is_nonneg(__isl_keep isl_val *v);
609         int isl_val_is_nonpos(__isl_keep isl_val *v);
610         int isl_val_is_pos(__isl_keep isl_val *v);
611         int isl_val_is_neg(__isl_keep isl_val *v);
612         int isl_val_is_int(__isl_keep isl_val *v);
613         int isl_val_is_rat(__isl_keep isl_val *v);
614         int isl_val_is_nan(__isl_keep isl_val *v);
615         int isl_val_is_infty(__isl_keep isl_val *v);
616         int isl_val_is_neginfty(__isl_keep isl_val *v);
618 Note that the sign of NaN is undefined.
620 The following binary properties are defined on pairs of C<isl_val>s.
622         #include <isl/val.h>
623         int isl_val_lt(__isl_keep isl_val *v1,
624                 __isl_keep isl_val *v2);
625         int isl_val_le(__isl_keep isl_val *v1,
626                 __isl_keep isl_val *v2);
627         int isl_val_gt(__isl_keep isl_val *v1,
628                 __isl_keep isl_val *v2);
629         int isl_val_ge(__isl_keep isl_val *v1,
630                 __isl_keep isl_val *v2);
631         int isl_val_eq(__isl_keep isl_val *v1,
632                 __isl_keep isl_val *v2);
633         int isl_val_ne(__isl_keep isl_val *v1,
634                 __isl_keep isl_val *v2);
635         int isl_val_abs_eq(__isl_keep isl_val *v1,
636                 __isl_keep isl_val *v2);
638 The function C<isl_val_abs_eq> checks whether its two arguments
639 are equal in absolute value.
641 For integer C<isl_val>s we additionally have the following binary property.
643         #include <isl/val.h>
644         int isl_val_is_divisible_by(__isl_keep isl_val *v1,
645                 __isl_keep isl_val *v2);
647 An C<isl_val> can also be compared to an integer using the following
648 function.  The result is undefined for NaN.
650         #include <isl/val.h>
651         int isl_val_cmp_si(__isl_keep isl_val *v, long i);
653 The following unary operations are available on C<isl_val>s.
655         #include <isl/val.h>
656         __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
657         __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
658         __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
659         __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
660         __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
661         __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
662         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
664 The following binary operations are available on C<isl_val>s.
666         #include <isl/val.h>
667         __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
668                 __isl_take isl_val *v2);
669         __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
670                 __isl_take isl_val *v2);
671         __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
672                 __isl_take isl_val *v2);
673         __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
674                 unsigned long v2);
675         __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
676                 __isl_take isl_val *v2);
677         __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
678                 unsigned long v2);
679         __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
680                 __isl_take isl_val *v2);
681         __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
682                 unsigned long v2);
683         __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
684                 __isl_take isl_val *v2);
686 On integer values, we additionally have the following operations.
688         #include <isl/val.h>
689         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
690         __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
691                 __isl_take isl_val *v2);
692         __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
693                 __isl_take isl_val *v2);
694         __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
695                 __isl_take isl_val *v2, __isl_give isl_val **x,
696                 __isl_give isl_val **y);
698 The function C<isl_val_gcdext> returns the greatest common divisor g
699 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
700 that C<*x> * C<v1> + C<*y> * C<v2> = g.
702 =head3 GMP specific functions
704 These functions are only available if C<isl> has been compiled with C<GMP>
705 support.
707 Specific integer and rational values can be created from C<GMP> values using
708 the following functions.
710         #include <isl/val_gmp.h>
711         __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
712                 mpz_t z);
713         __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
714                 const mpz_t n, const mpz_t d);
716 The numerator and denominator of a rational value can be extracted as
717 C<GMP> values using the following functions.
719         #include <isl/val_gmp.h>
720         int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
721         int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
723 =head2 Sets and Relations
725 C<isl> uses six types of objects for representing sets and relations,
726 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
727 C<isl_union_set> and C<isl_union_map>.
728 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
729 can be described as a conjunction of affine constraints, while
730 C<isl_set> and C<isl_map> represent unions of
731 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
732 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
733 to live in the same space.  C<isl_union_set>s and C<isl_union_map>s
734 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
735 where spaces are considered different if they have a different number
736 of dimensions and/or different names (see L<"Spaces">).
737 The difference between sets and relations (maps) is that sets have
738 one set of variables, while relations have two sets of variables,
739 input variables and output variables.
741 =head2 Error Handling
743 C<isl> supports different ways to react in case a runtime error is triggered.
744 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
745 with two maps that have incompatible spaces. There are three possible ways
746 to react on error: to warn, to continue or to abort.
748 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
749 the last error in the corresponding C<isl_ctx> and the function in which the
750 error was triggered returns C<NULL>. An error does not corrupt internal state,
751 such that isl can continue to be used. C<isl> also provides functions to
752 read the last error and to reset the memory that stores the last error. The
753 last error is only stored for information purposes. Its presence does not
754 change the behavior of C<isl>. Hence, resetting an error is not required to
755 continue to use isl, but only to observe new errors.
757         #include <isl/ctx.h>
758         enum isl_error isl_ctx_last_error(isl_ctx *ctx);
759         void isl_ctx_reset_error(isl_ctx *ctx);
761 Another option is to continue on error. This is similar to warn on error mode,
762 except that C<isl> does not print any warning. This allows a program to
763 implement its own error reporting.
765 The last option is to directly abort the execution of the program from within
766 the isl library. This makes it obviously impossible to recover from an error,
767 but it allows to directly spot the error location. By aborting on error,
768 debuggers break at the location the error occurred and can provide a stack
769 trace. Other tools that automatically provide stack traces on abort or that do
770 not want to continue execution after an error was triggered may also prefer to
771 abort on error.
773 The on error behavior of isl can be specified by calling
774 C<isl_options_set_on_error> or by setting the command line option
775 C<--isl-on-error>. Valid arguments for the function call are
776 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
777 choices for the command line option are C<warn>, C<continue> and C<abort>.
778 It is also possible to query the current error mode.
780         #include <isl/options.h>
781         int isl_options_set_on_error(isl_ctx *ctx, int val);
782         int isl_options_get_on_error(isl_ctx *ctx);
784 =head2 Identifiers
786 Identifiers are used to identify both individual dimensions
787 and tuples of dimensions.  They consist of an optional name and an optional
788 user pointer.  The name and the user pointer cannot both be C<NULL>, however.
789 Identifiers with the same name but different pointer values
790 are considered to be distinct.
791 Similarly, identifiers with different names but the same pointer value
792 are also considered to be distinct.
793 Equal identifiers are represented using the same object.
794 Pairs of identifiers can therefore be tested for equality using the
795 C<==> operator.
796 Identifiers can be constructed, copied, freed, inspected and printed
797 using the following functions.
799         #include <isl/id.h>
800         __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
801                 __isl_keep const char *name, void *user);
802         __isl_give isl_id *isl_id_set_free_user(
803                 __isl_take isl_id *id,
804                 __isl_give void (*free_user)(void *user));
805         __isl_give isl_id *isl_id_copy(isl_id *id);
806         __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
808         void *isl_id_get_user(__isl_keep isl_id *id);
809         __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
811         __isl_give isl_printer *isl_printer_print_id(
812                 __isl_take isl_printer *p, __isl_keep isl_id *id);
814 The callback set by C<isl_id_set_free_user> is called on the user
815 pointer when the last reference to the C<isl_id> is freed.
816 Note that C<isl_id_get_name> returns a pointer to some internal
817 data structure, so the result can only be used while the
818 corresponding C<isl_id> is alive.
820 =head2 Spaces
822 Whenever a new set, relation or similar object is created from scratch,
823 the space in which it lives needs to be specified using an C<isl_space>.
824 Each space involves zero or more parameters and zero, one or two
825 tuples of set or input/output dimensions.  The parameters and dimensions
826 are identified by an C<isl_dim_type> and a position.
827 The type C<isl_dim_param> refers to parameters,
828 the type C<isl_dim_set> refers to set dimensions (for spaces
829 with a single tuple of dimensions) and the types C<isl_dim_in>
830 and C<isl_dim_out> refer to input and output dimensions
831 (for spaces with two tuples of dimensions).
832 Local spaces (see L</"Local Spaces">) also contain dimensions
833 of type C<isl_dim_div>.
834 Note that parameters are only identified by their position within
835 a given object.  Across different objects, parameters are (usually)
836 identified by their names or identifiers.  Only unnamed parameters
837 are identified by their positions across objects.  The use of unnamed
838 parameters is discouraged.
840         #include <isl/space.h>
841         __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
842                 unsigned nparam, unsigned n_in, unsigned n_out);
843         __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
844                 unsigned nparam);
845         __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
846                 unsigned nparam, unsigned dim);
847         __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
848         __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
850 The space used for creating a parameter domain
851 needs to be created using C<isl_space_params_alloc>.
852 For other sets, the space
853 needs to be created using C<isl_space_set_alloc>, while
854 for a relation, the space
855 needs to be created using C<isl_space_alloc>.
857 To check whether a given space is that of a set or a map
858 or whether it is a parameter space, use these functions:
860         #include <isl/space.h>
861         int isl_space_is_params(__isl_keep isl_space *space);
862         int isl_space_is_set(__isl_keep isl_space *space);
863         int isl_space_is_map(__isl_keep isl_space *space);
865 Spaces can be compared using the following functions:
867         #include <isl/space.h>
868         int isl_space_is_equal(__isl_keep isl_space *space1,
869                 __isl_keep isl_space *space2);
870         int isl_space_is_domain(__isl_keep isl_space *space1,
871                 __isl_keep isl_space *space2);
872         int isl_space_is_range(__isl_keep isl_space *space1,
873                 __isl_keep isl_space *space2);
874         int isl_space_tuple_is_equal(
875                 __isl_keep isl_space *space1,
876                 enum isl_dim_type type1,
877                 __isl_keep isl_space *space2,
878                 enum isl_dim_type type2);
880 C<isl_space_is_domain> checks whether the first argument is equal
881 to the domain of the second argument.  This requires in particular that
882 the first argument is a set space and that the second argument
883 is a map space.  C<isl_space_tuple_is_equal> checks whether the given
884 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
885 spaces are the same.  That is, it checks if they have the same
886 identifier (if any), the same dimension and the same internal structure
887 (if any).
889 It is often useful to create objects that live in the
890 same space as some other object.  This can be accomplished
891 by creating the new objects
892 (see L</"Creating New Sets and Relations"> or
893 L</"Functions">) based on the space
894 of the original object.
896         #include <isl/set.h>
897         __isl_give isl_space *isl_basic_set_get_space(
898                 __isl_keep isl_basic_set *bset);
899         __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
901         #include <isl/union_set.h>
902         __isl_give isl_space *isl_union_set_get_space(
903                 __isl_keep isl_union_set *uset);
905         #include <isl/map.h>
906         __isl_give isl_space *isl_basic_map_get_space(
907                 __isl_keep isl_basic_map *bmap);
908         __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
910         #include <isl/union_map.h>
911         __isl_give isl_space *isl_union_map_get_space(
912                 __isl_keep isl_union_map *umap);
914         #include <isl/constraint.h>
915         __isl_give isl_space *isl_constraint_get_space(
916                 __isl_keep isl_constraint *constraint);
918         #include <isl/polynomial.h>
919         __isl_give isl_space *isl_qpolynomial_get_domain_space(
920                 __isl_keep isl_qpolynomial *qp);
921         __isl_give isl_space *isl_qpolynomial_get_space(
922                 __isl_keep isl_qpolynomial *qp);
923         __isl_give isl_space *isl_qpolynomial_fold_get_space(
924                 __isl_keep isl_qpolynomial_fold *fold);
925         __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
926                 __isl_keep isl_pw_qpolynomial *pwqp);
927         __isl_give isl_space *isl_pw_qpolynomial_get_space(
928                 __isl_keep isl_pw_qpolynomial *pwqp);
929         __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
930                 __isl_keep isl_pw_qpolynomial_fold *pwf);
931         __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
932                 __isl_keep isl_pw_qpolynomial_fold *pwf);
933         __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
934                 __isl_keep isl_union_pw_qpolynomial *upwqp);
935         __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
936                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
938         #include <isl/val.h>
939         __isl_give isl_space *isl_multi_val_get_space(
940                 __isl_keep isl_multi_val *mv);
942         #include <isl/aff.h>
943         __isl_give isl_space *isl_aff_get_domain_space(
944                 __isl_keep isl_aff *aff);
945         __isl_give isl_space *isl_aff_get_space(
946                 __isl_keep isl_aff *aff);
947         __isl_give isl_space *isl_pw_aff_get_domain_space(
948                 __isl_keep isl_pw_aff *pwaff);
949         __isl_give isl_space *isl_pw_aff_get_space(
950                 __isl_keep isl_pw_aff *pwaff);
951         __isl_give isl_space *isl_multi_aff_get_domain_space(
952                 __isl_keep isl_multi_aff *maff);
953         __isl_give isl_space *isl_multi_aff_get_space(
954                 __isl_keep isl_multi_aff *maff);
955         __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
956                 __isl_keep isl_pw_multi_aff *pma);
957         __isl_give isl_space *isl_pw_multi_aff_get_space(
958                 __isl_keep isl_pw_multi_aff *pma);
959         __isl_give isl_space *isl_union_pw_aff_get_space(
960                 __isl_keep isl_union_pw_aff *upa);
961         __isl_give isl_space *isl_union_pw_multi_aff_get_space(
962                 __isl_keep isl_union_pw_multi_aff *upma);
963         __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
964                 __isl_keep isl_multi_pw_aff *mpa);
965         __isl_give isl_space *isl_multi_pw_aff_get_space(
966                 __isl_keep isl_multi_pw_aff *mpa);
968         #include <isl/point.h>
969         __isl_give isl_space *isl_point_get_space(
970                 __isl_keep isl_point *pnt);
972 The number of dimensions of a given type of space
973 may be read off from a space or an object that lives
974 in a space using the following functions.
975 In case of C<isl_space_dim>, type may be
976 C<isl_dim_param>, C<isl_dim_in> (only for relations),
977 C<isl_dim_out> (only for relations), C<isl_dim_set>
978 (only for sets) or C<isl_dim_all>.
980         #include <isl/space.h>
981         unsigned isl_space_dim(__isl_keep isl_space *space,
982                 enum isl_dim_type type);
984         #include <isl/local_space.h>
985         int isl_local_space_dim(__isl_keep isl_local_space *ls,
986                 enum isl_dim_type type);
988         #include <isl/set.h>
989         unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
990                 enum isl_dim_type type);
991         unsigned isl_set_dim(__isl_keep isl_set *set,
992                 enum isl_dim_type type);
994         #include <isl/union_set.h>
995         unsigned isl_union_set_dim(__isl_keep isl_union_set *uset,
996                 enum isl_dim_type type);
998         #include <isl/map.h>
999         unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1000                 enum isl_dim_type type);
1001         unsigned isl_map_dim(__isl_keep isl_map *map,
1002                 enum isl_dim_type type);
1004         #include <isl/union_map.h>
1005         unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
1006                 enum isl_dim_type type);
1008         #include <isl/val.h>
1009         unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1010                 enum isl_dim_type type);
1012         #include <isl/aff.h>
1013         int isl_aff_dim(__isl_keep isl_aff *aff,
1014                 enum isl_dim_type type);
1015         unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1016                 enum isl_dim_type type);
1017         unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1018                 enum isl_dim_type type);
1019         unsigned isl_pw_multi_aff_dim(
1020                 __isl_keep isl_pw_multi_aff *pma,
1021                 enum isl_dim_type type);
1022         unsigned isl_multi_pw_aff_dim(
1023                 __isl_keep isl_multi_pw_aff *mpa,
1024                 enum isl_dim_type type);
1025         unsigned isl_union_pw_aff_dim(
1026                 __isl_keep isl_union_pw_aff *upa,
1027                 enum isl_dim_type type);
1028         unsigned isl_union_pw_multi_aff_dim(
1029                 __isl_keep isl_union_pw_multi_aff *upma,
1030                 enum isl_dim_type type);
1032         #include <isl/polynomial.h>
1033         unsigned isl_union_pw_qpolynomial_dim(
1034                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1035                 enum isl_dim_type type);
1036         unsigned isl_union_pw_qpolynomial_fold_dim(
1037                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1038                 enum isl_dim_type type);
1040 Note that an C<isl_union_set>, an C<isl_union_map>,
1041 an C<isl_union_pw_multi_aff>,
1042 an C<isl_union_pw_qpolynomial> and
1043 an C<isl_union_pw_qpolynomial_fold>
1044 only have parameters.
1046 The identifiers or names of the individual dimensions of spaces
1047 may be set or read off using the following functions on spaces
1048 or objects that live in spaces.
1049 These functions are mostly useful to obtain the identifiers, positions
1050 or names of the parameters.  Identifiers of individual dimensions are
1051 essentially only useful for printing.  They are ignored by all other
1052 operations and may not be preserved across those operations.
1054         #include <isl/space.h>
1055         __isl_give isl_space *isl_space_set_dim_id(
1056                 __isl_take isl_space *space,
1057                 enum isl_dim_type type, unsigned pos,
1058                 __isl_take isl_id *id);
1059         int isl_space_has_dim_id(__isl_keep isl_space *space,
1060                 enum isl_dim_type type, unsigned pos);
1061         __isl_give isl_id *isl_space_get_dim_id(
1062                 __isl_keep isl_space *space,
1063                 enum isl_dim_type type, unsigned pos);
1064         __isl_give isl_space *isl_space_set_dim_name(
1065                 __isl_take isl_space *space,
1066                  enum isl_dim_type type, unsigned pos,
1067                  __isl_keep const char *name);
1068         int isl_space_has_dim_name(__isl_keep isl_space *space,
1069                 enum isl_dim_type type, unsigned pos);
1070         __isl_keep const char *isl_space_get_dim_name(
1071                 __isl_keep isl_space *space,
1072                 enum isl_dim_type type, unsigned pos);
1074         #include <isl/local_space.h>
1075         __isl_give isl_local_space *isl_local_space_set_dim_id(
1076                 __isl_take isl_local_space *ls,
1077                 enum isl_dim_type type, unsigned pos,
1078                 __isl_take isl_id *id);
1079         int isl_local_space_has_dim_id(
1080                 __isl_keep isl_local_space *ls,
1081                 enum isl_dim_type type, unsigned pos);
1082         __isl_give isl_id *isl_local_space_get_dim_id(
1083                 __isl_keep isl_local_space *ls,
1084                 enum isl_dim_type type, unsigned pos);
1085         __isl_give isl_local_space *isl_local_space_set_dim_name(
1086                 __isl_take isl_local_space *ls,
1087                 enum isl_dim_type type, unsigned pos, const char *s);
1088         int isl_local_space_has_dim_name(
1089                 __isl_keep isl_local_space *ls,
1090                 enum isl_dim_type type, unsigned pos)
1091         const char *isl_local_space_get_dim_name(
1092                 __isl_keep isl_local_space *ls,
1093                 enum isl_dim_type type, unsigned pos);
1095         #include <isl/constraint.h>
1096         const char *isl_constraint_get_dim_name(
1097                 __isl_keep isl_constraint *constraint,
1098                 enum isl_dim_type type, unsigned pos);
1100         #include <isl/set.h>
1101         __isl_give isl_id *isl_basic_set_get_dim_id(
1102                 __isl_keep isl_basic_set *bset,
1103                 enum isl_dim_type type, unsigned pos);
1104         __isl_give isl_set *isl_set_set_dim_id(
1105                 __isl_take isl_set *set, enum isl_dim_type type,
1106                 unsigned pos, __isl_take isl_id *id);
1107         int isl_set_has_dim_id(__isl_keep isl_set *set,
1108                 enum isl_dim_type type, unsigned pos);
1109         __isl_give isl_id *isl_set_get_dim_id(
1110                 __isl_keep isl_set *set, enum isl_dim_type type,
1111                 unsigned pos);
1112         const char *isl_basic_set_get_dim_name(
1113                 __isl_keep isl_basic_set *bset,
1114                 enum isl_dim_type type, unsigned pos);
1115         int isl_set_has_dim_name(__isl_keep isl_set *set,
1116                 enum isl_dim_type type, unsigned pos);
1117         const char *isl_set_get_dim_name(
1118                 __isl_keep isl_set *set,
1119                 enum isl_dim_type type, unsigned pos);
1121         #include <isl/map.h>
1122         __isl_give isl_map *isl_map_set_dim_id(
1123                 __isl_take isl_map *map, enum isl_dim_type type,
1124                 unsigned pos, __isl_take isl_id *id);
1125         int isl_basic_map_has_dim_id(
1126                 __isl_keep isl_basic_map *bmap,
1127                 enum isl_dim_type type, unsigned pos);
1128         int isl_map_has_dim_id(__isl_keep isl_map *map,
1129                 enum isl_dim_type type, unsigned pos);
1130         __isl_give isl_id *isl_map_get_dim_id(
1131                 __isl_keep isl_map *map, enum isl_dim_type type,
1132                 unsigned pos);
1133         __isl_give isl_id *isl_union_map_get_dim_id(
1134                 __isl_keep isl_union_map *umap,
1135                 enum isl_dim_type type, unsigned pos);
1136         const char *isl_basic_map_get_dim_name(
1137                 __isl_keep isl_basic_map *bmap,
1138                 enum isl_dim_type type, unsigned pos);
1139         int isl_map_has_dim_name(__isl_keep isl_map *map,
1140                 enum isl_dim_type type, unsigned pos);
1141         const char *isl_map_get_dim_name(
1142                 __isl_keep isl_map *map,
1143                 enum isl_dim_type type, unsigned pos);
1145         #include <isl/val.h>
1146         __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1147                 __isl_take isl_multi_val *mv,
1148                 enum isl_dim_type type, unsigned pos,
1149                 __isl_take isl_id *id);
1150         __isl_give isl_id *isl_multi_val_get_dim_id(
1151                 __isl_keep isl_multi_val *mv,
1152                 enum isl_dim_type type, unsigned pos);
1153         __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1154                 __isl_take isl_multi_val *mv,
1155                 enum isl_dim_type type, unsigned pos, const char *s);
1157         #include <isl/aff.h>
1158         __isl_give isl_aff *isl_aff_set_dim_id(
1159                 __isl_take isl_aff *aff, enum isl_dim_type type,
1160                 unsigned pos, __isl_take isl_id *id);
1161         __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1162                 __isl_take isl_multi_aff *maff,
1163                 enum isl_dim_type type, unsigned pos,
1164                 __isl_take isl_id *id);
1165         __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1166                 __isl_take isl_pw_aff *pma,
1167                 enum isl_dim_type type, unsigned pos,
1168                 __isl_take isl_id *id);
1169         __isl_give isl_multi_pw_aff *
1170         isl_multi_pw_aff_set_dim_id(
1171                 __isl_take isl_multi_pw_aff *mpa,
1172                 enum isl_dim_type type, unsigned pos,
1173                 __isl_take isl_id *id);
1174         __isl_give isl_id *isl_multi_aff_get_dim_id(
1175                 __isl_keep isl_multi_aff *ma,
1176                 enum isl_dim_type type, unsigned pos);
1177         int isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1178                 enum isl_dim_type type, unsigned pos);
1179         __isl_give isl_id *isl_pw_aff_get_dim_id(
1180                 __isl_keep isl_pw_aff *pa,
1181                 enum isl_dim_type type, unsigned pos);
1182         __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1183                 __isl_keep isl_pw_multi_aff *pma,
1184                 enum isl_dim_type type, unsigned pos);
1185         __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1186                 __isl_keep isl_multi_pw_aff *mpa,
1187                 enum isl_dim_type type, unsigned pos);
1188         __isl_give isl_aff *isl_aff_set_dim_name(
1189                 __isl_take isl_aff *aff, enum isl_dim_type type,
1190                 unsigned pos, const char *s);
1191         __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1192                 __isl_take isl_multi_aff *maff,
1193                 enum isl_dim_type type, unsigned pos, const char *s);
1194         __isl_give isl_multi_pw_aff *
1195         isl_multi_pw_aff_set_dim_name(
1196                 __isl_take isl_multi_pw_aff *mpa,
1197                 enum isl_dim_type type, unsigned pos, const char *s);
1198         __isl_give isl_union_pw_aff *
1199         isl_union_pw_aff_set_dim_name(
1200                 __isl_take isl_union_pw_aff *upa,
1201                 enum isl_dim_type type, unsigned pos,
1202                 const char *s);
1203         __isl_give isl_union_pw_multi_aff *
1204         isl_union_pw_multi_aff_set_dim_name(
1205                 __isl_take isl_union_pw_multi_aff *upma,
1206                 enum isl_dim_type type, unsigned pos,
1207                 const char *s);
1208         const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1209                 enum isl_dim_type type, unsigned pos);
1210         const char *isl_pw_aff_get_dim_name(
1211                 __isl_keep isl_pw_aff *pa,
1212                 enum isl_dim_type type, unsigned pos);
1213         const char *isl_pw_multi_aff_get_dim_name(
1214                 __isl_keep isl_pw_multi_aff *pma,
1215                 enum isl_dim_type type, unsigned pos);
1217         #include <isl/polynomial.h>
1218         __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1219                 __isl_take isl_qpolynomial *qp,
1220                 enum isl_dim_type type, unsigned pos,
1221                 const char *s);
1222         __isl_give isl_pw_qpolynomial *
1223         isl_pw_qpolynomial_set_dim_name(
1224                 __isl_take isl_pw_qpolynomial *pwqp,
1225                 enum isl_dim_type type, unsigned pos,
1226                 const char *s);
1227         __isl_give isl_pw_qpolynomial_fold *
1228         isl_pw_qpolynomial_fold_set_dim_name(
1229                 __isl_take isl_pw_qpolynomial_fold *pwf,
1230                 enum isl_dim_type type, unsigned pos,
1231                 const char *s);
1232         __isl_give isl_union_pw_qpolynomial *
1233         isl_union_pw_qpolynomial_set_dim_name(
1234                 __isl_take isl_union_pw_qpolynomial *upwqp,
1235                 enum isl_dim_type type, unsigned pos,
1236                 const char *s);
1237         __isl_give isl_union_pw_qpolynomial_fold *
1238         isl_union_pw_qpolynomial_fold_set_dim_name(
1239                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1240                 enum isl_dim_type type, unsigned pos,
1241                 const char *s);
1243 Note that C<isl_space_get_name> returns a pointer to some internal
1244 data structure, so the result can only be used while the
1245 corresponding C<isl_space> is alive.
1246 Also note that every function that operates on two sets or relations
1247 requires that both arguments have the same parameters.  This also
1248 means that if one of the arguments has named parameters, then the
1249 other needs to have named parameters too and the names need to match.
1250 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1251 arguments may have different parameters (as long as they are named),
1252 in which case the result will have as parameters the union of the parameters of
1253 the arguments.
1255 Given the identifier or name of a dimension (typically a parameter),
1256 its position can be obtained from the following functions.
1258         #include <isl/space.h>
1259         int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1260                 enum isl_dim_type type, __isl_keep isl_id *id);
1261         int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1262                 enum isl_dim_type type, const char *name);
1264         #include <isl/local_space.h>
1265         int isl_local_space_find_dim_by_name(
1266                 __isl_keep isl_local_space *ls,
1267                 enum isl_dim_type type, const char *name);
1269         #include <isl/val.h>
1270         int isl_multi_val_find_dim_by_id(
1271                 __isl_keep isl_multi_val *mv,
1272                 enum isl_dim_type type, __isl_keep isl_id *id);
1273         int isl_multi_val_find_dim_by_name(
1274                 __isl_keep isl_multi_val *mv,
1275                 enum isl_dim_type type, const char *name);
1277         #include <isl/set.h>
1278         int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1279                 enum isl_dim_type type, __isl_keep isl_id *id);
1280         int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1281                 enum isl_dim_type type, const char *name);
1283         #include <isl/map.h>
1284         int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1285                 enum isl_dim_type type, __isl_keep isl_id *id);
1286         int isl_basic_map_find_dim_by_name(
1287                 __isl_keep isl_basic_map *bmap,
1288                 enum isl_dim_type type, const char *name);
1289         int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1290                 enum isl_dim_type type, const char *name);
1291         int isl_union_map_find_dim_by_name(
1292                 __isl_keep isl_union_map *umap,
1293                 enum isl_dim_type type, const char *name);
1295         #include <isl/aff.h>
1296         int isl_multi_aff_find_dim_by_id(
1297                 __isl_keep isl_multi_aff *ma,
1298                 enum isl_dim_type type, __isl_keep isl_id *id);
1299         int isl_multi_pw_aff_find_dim_by_id(
1300                 __isl_keep isl_multi_pw_aff *mpa,
1301                 enum isl_dim_type type, __isl_keep isl_id *id);
1302         int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1303                 enum isl_dim_type type, const char *name);
1304         int isl_multi_aff_find_dim_by_name(
1305                 __isl_keep isl_multi_aff *ma,
1306                 enum isl_dim_type type, const char *name);
1307         int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1308                 enum isl_dim_type type, const char *name);
1309         int isl_multi_pw_aff_find_dim_by_name(
1310                 __isl_keep isl_multi_pw_aff *mpa,
1311                 enum isl_dim_type type, const char *name);
1312         int isl_pw_multi_aff_find_dim_by_name(
1313                 __isl_keep isl_pw_multi_aff *pma,
1314                 enum isl_dim_type type, const char *name);
1315         int isl_union_pw_aff_find_dim_by_name(
1316                 __isl_keep isl_union_pw_aff *upa,
1317                 enum isl_dim_type type, const char *name);
1318         int isl_union_pw_multi_aff_find_dim_by_name(
1319                 __isl_keep isl_union_pw_multi_aff *upma,
1320                 enum isl_dim_type type, const char *name);
1322         #include <isl/polynomial.h>
1323         int isl_pw_qpolynomial_find_dim_by_name(
1324                 __isl_keep isl_pw_qpolynomial *pwqp,
1325                 enum isl_dim_type type, const char *name);
1326         int isl_pw_qpolynomial_fold_find_dim_by_name(
1327                 __isl_keep isl_pw_qpolynomial_fold *pwf,
1328                 enum isl_dim_type type, const char *name);
1329         int isl_union_pw_qpolynomial_find_dim_by_name(
1330                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1331                 enum isl_dim_type type, const char *name);
1332         int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1333                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1334                 enum isl_dim_type type, const char *name);
1336 The identifiers or names of entire spaces may be set or read off
1337 using the following functions.
1339         #include <isl/space.h>
1340         __isl_give isl_space *isl_space_set_tuple_id(
1341                 __isl_take isl_space *space,
1342                 enum isl_dim_type type, __isl_take isl_id *id);
1343         __isl_give isl_space *isl_space_reset_tuple_id(
1344                 __isl_take isl_space *space, enum isl_dim_type type);
1345         int isl_space_has_tuple_id(__isl_keep isl_space *space,
1346                 enum isl_dim_type type);
1347         __isl_give isl_id *isl_space_get_tuple_id(
1348                 __isl_keep isl_space *space, enum isl_dim_type type);
1349         __isl_give isl_space *isl_space_set_tuple_name(
1350                 __isl_take isl_space *space,
1351                 enum isl_dim_type type, const char *s);
1352         int isl_space_has_tuple_name(__isl_keep isl_space *space,
1353                 enum isl_dim_type type);
1354         const char *isl_space_get_tuple_name(__isl_keep isl_space *space,
1355                 enum isl_dim_type type);
1357         #include <isl/local_space.h>
1358         __isl_give isl_local_space *isl_local_space_set_tuple_id(
1359                 __isl_take isl_local_space *ls,
1360                 enum isl_dim_type type, __isl_take isl_id *id);
1362         #include <isl/set.h>
1363         __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1364                 __isl_take isl_basic_set *bset,
1365                 __isl_take isl_id *id);
1366         __isl_give isl_set *isl_set_set_tuple_id(
1367                 __isl_take isl_set *set, __isl_take isl_id *id);
1368         __isl_give isl_set *isl_set_reset_tuple_id(
1369                 __isl_take isl_set *set);
1370         int isl_set_has_tuple_id(__isl_keep isl_set *set);
1371         __isl_give isl_id *isl_set_get_tuple_id(
1372                 __isl_keep isl_set *set);
1373         __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1374                 __isl_take isl_basic_set *set, const char *s);
1375         __isl_give isl_set *isl_set_set_tuple_name(
1376                 __isl_take isl_set *set, const char *s);
1377         const char *isl_basic_set_get_tuple_name(
1378                 __isl_keep isl_basic_set *bset);
1379         int isl_set_has_tuple_name(__isl_keep isl_set *set);
1380         const char *isl_set_get_tuple_name(
1381                 __isl_keep isl_set *set);
1383         #include <isl/map.h>
1384         __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1385                 __isl_take isl_basic_map *bmap,
1386                 enum isl_dim_type type, __isl_take isl_id *id);
1387         __isl_give isl_map *isl_map_set_tuple_id(
1388                 __isl_take isl_map *map, enum isl_dim_type type,
1389                 __isl_take isl_id *id);
1390         __isl_give isl_map *isl_map_reset_tuple_id(
1391                 __isl_take isl_map *map, enum isl_dim_type type);
1392         int isl_map_has_tuple_id(__isl_keep isl_map *map,
1393                 enum isl_dim_type type);
1394         __isl_give isl_id *isl_map_get_tuple_id(
1395                 __isl_keep isl_map *map, enum isl_dim_type type);
1396         __isl_give isl_map *isl_map_set_tuple_name(
1397                 __isl_take isl_map *map,
1398                 enum isl_dim_type type, const char *s);
1399         const char *isl_basic_map_get_tuple_name(
1400                 __isl_keep isl_basic_map *bmap,
1401                 enum isl_dim_type type);
1402         __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1403                 __isl_take isl_basic_map *bmap,
1404                 enum isl_dim_type type, const char *s);
1405         int isl_map_has_tuple_name(__isl_keep isl_map *map,
1406                 enum isl_dim_type type);
1407         const char *isl_map_get_tuple_name(
1408                 __isl_keep isl_map *map,
1409                 enum isl_dim_type type);
1411         #include <isl/val.h>
1412         __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1413                 __isl_take isl_multi_val *mv,
1414                 enum isl_dim_type type, __isl_take isl_id *id);
1415         __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1416                 __isl_take isl_multi_val *mv,
1417                 enum isl_dim_type type);
1418         int isl_multi_val_has_tuple_id(__isl_keep isl_multi_val *mv,
1419                 enum isl_dim_type type);
1420         __isl_give isl_id *isl_multi_val_get_tuple_id(
1421                 __isl_keep isl_multi_val *mv,
1422                 enum isl_dim_type type);
1423         __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1424                 __isl_take isl_multi_val *mv,
1425                 enum isl_dim_type type, const char *s);
1426         const char *isl_multi_val_get_tuple_name(
1427                 __isl_keep isl_multi_val *mv,
1428                 enum isl_dim_type type);
1430         #include <isl/aff.h>
1431         __isl_give isl_aff *isl_aff_set_tuple_id(
1432                 __isl_take isl_aff *aff,
1433                 enum isl_dim_type type, __isl_take isl_id *id);
1434         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1435                 __isl_take isl_multi_aff *maff,
1436                 enum isl_dim_type type, __isl_take isl_id *id);
1437         __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1438                 __isl_take isl_pw_aff *pwaff,
1439                 enum isl_dim_type type, __isl_take isl_id *id);
1440         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1441                 __isl_take isl_pw_multi_aff *pma,
1442                 enum isl_dim_type type, __isl_take isl_id *id);
1443         __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1444                 __isl_take isl_multi_aff *ma,
1445                 enum isl_dim_type type);
1446         __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1447                 __isl_take isl_pw_aff *pa,
1448                 enum isl_dim_type type);
1449         __isl_give isl_multi_pw_aff *
1450         isl_multi_pw_aff_reset_tuple_id(
1451                 __isl_take isl_multi_pw_aff *mpa,
1452                 enum isl_dim_type type);
1453         __isl_give isl_pw_multi_aff *
1454         isl_pw_multi_aff_reset_tuple_id(
1455                 __isl_take isl_pw_multi_aff *pma,
1456                 enum isl_dim_type type);
1457         int isl_multi_aff_has_tuple_id(__isl_keep isl_multi_aff *ma,
1458                 enum isl_dim_type type);
1459         __isl_give isl_id *isl_multi_aff_get_tuple_id(
1460                 __isl_keep isl_multi_aff *ma,
1461                 enum isl_dim_type type);
1462         int isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1463                 enum isl_dim_type type);
1464         __isl_give isl_id *isl_pw_aff_get_tuple_id(
1465                 __isl_keep isl_pw_aff *pa,
1466                 enum isl_dim_type type);
1467         int isl_pw_multi_aff_has_tuple_id(
1468                 __isl_keep isl_pw_multi_aff *pma,
1469                 enum isl_dim_type type);
1470         __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1471                 __isl_keep isl_pw_multi_aff *pma,
1472                 enum isl_dim_type type);
1473         int isl_multi_pw_aff_has_tuple_id(
1474                 __isl_keep isl_multi_pw_aff *mpa,
1475                 enum isl_dim_type type);
1476         __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1477                 __isl_keep isl_multi_pw_aff *mpa,
1478                 enum isl_dim_type type);
1479         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1480                 __isl_take isl_multi_aff *maff,
1481                 enum isl_dim_type type, const char *s);
1482         __isl_give isl_multi_pw_aff *
1483         isl_multi_pw_aff_set_tuple_name(
1484                 __isl_take isl_multi_pw_aff *mpa,
1485                 enum isl_dim_type type, const char *s);
1486         const char *isl_multi_aff_get_tuple_name(
1487                 __isl_keep isl_multi_aff *multi,
1488                 enum isl_dim_type type);
1489         int isl_pw_multi_aff_has_tuple_name(
1490                 __isl_keep isl_pw_multi_aff *pma,
1491                 enum isl_dim_type type);
1492         const char *isl_pw_multi_aff_get_tuple_name(
1493                 __isl_keep isl_pw_multi_aff *pma,
1494                 enum isl_dim_type type);
1496 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1497 or C<isl_dim_set>.  As with C<isl_space_get_name>,
1498 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1499 data structure.
1500 Binary operations require the corresponding spaces of their arguments
1501 to have the same name.
1503 To keep the names of all parameters and tuples, but reset the user pointers
1504 of all the corresponding identifiers, use the following function.
1506         #include <isl/space.h>
1507         __isl_give isl_space *isl_space_reset_user(
1508                 __isl_take isl_space *space);
1510         #include <isl/set.h>
1511         __isl_give isl_set *isl_set_reset_user(
1512                 __isl_take isl_set *set);
1514         #include <isl/map.h>
1515         __isl_give isl_map *isl_map_reset_user(
1516                 __isl_take isl_map *map);
1518         #include <isl/union_set.h>
1519         __isl_give isl_union_set *isl_union_set_reset_user(
1520                 __isl_take isl_union_set *uset);
1522         #include <isl/union_map.h>
1523         __isl_give isl_union_map *isl_union_map_reset_user(
1524                 __isl_take isl_union_map *umap);
1526         #include <isl/val.h>
1527         __isl_give isl_multi_val *isl_multi_val_reset_user(
1528                 __isl_take isl_multi_val *mv);
1530         #include <isl/aff.h>
1531         __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1532                 __isl_take isl_multi_aff *ma);
1533         __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1534                 __isl_take isl_pw_aff *pa);
1535         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1536                 __isl_take isl_multi_pw_aff *mpa);
1537         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1538                 __isl_take isl_pw_multi_aff *pma);
1539         __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1540                 __isl_take isl_union_pw_aff *upa);
1541         __isl_give isl_union_pw_multi_aff *
1542         isl_union_pw_multi_aff_reset_user(
1543                 __isl_take isl_union_pw_multi_aff *upma);
1545         #include <isl/polynomial.h>
1546         __isl_give isl_pw_qpolynomial *
1547         isl_pw_qpolynomial_reset_user(
1548                 __isl_take isl_pw_qpolynomial *pwqp);
1549         __isl_give isl_union_pw_qpolynomial *
1550         isl_union_pw_qpolynomial_reset_user(
1551                 __isl_take isl_union_pw_qpolynomial *upwqp);
1552         __isl_give isl_pw_qpolynomial_fold *
1553         isl_pw_qpolynomial_fold_reset_user(
1554                 __isl_take isl_pw_qpolynomial_fold *pwf);
1555         __isl_give isl_union_pw_qpolynomial_fold *
1556         isl_union_pw_qpolynomial_fold_reset_user(
1557                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1559 Spaces can be nested.  In particular, the domain of a set or
1560 the domain or range of a relation can be a nested relation.
1561 This process is also called I<wrapping>.
1562 The functions for detecting, constructing and deconstructing
1563 such nested spaces can be found in the wrapping properties
1564 of L</"Unary Properties">, the wrapping operations
1565 of L</"Unary Operations"> and the Cartesian product operations
1566 of L</"Basic Operations">.
1568 Spaces can be created from other spaces
1569 using the functions described in L</"Unary Operations">
1570 and L</"Binary Operations">.
1572 =head2 Local Spaces
1574 A local space is essentially a space with
1575 zero or more existentially quantified variables.
1576 The local space of various objects can be obtained
1577 using the following functions.
1579         #include <isl/constraint.h>
1580         __isl_give isl_local_space *isl_constraint_get_local_space(
1581                 __isl_keep isl_constraint *constraint);
1583         #include <isl/set.h>
1584         __isl_give isl_local_space *isl_basic_set_get_local_space(
1585                 __isl_keep isl_basic_set *bset);
1587         #include <isl/map.h>
1588         __isl_give isl_local_space *isl_basic_map_get_local_space(
1589                 __isl_keep isl_basic_map *bmap);
1591         #include <isl/aff.h>
1592         __isl_give isl_local_space *isl_aff_get_domain_local_space(
1593                 __isl_keep isl_aff *aff);
1594         __isl_give isl_local_space *isl_aff_get_local_space(
1595                 __isl_keep isl_aff *aff);
1597 A new local space can be created from a space using
1599         #include <isl/local_space.h>
1600         __isl_give isl_local_space *isl_local_space_from_space(
1601                 __isl_take isl_space *space);
1603 They can be inspected, modified, copied and freed using the following functions.
1605         #include <isl/local_space.h>
1606         int isl_local_space_is_params(
1607                 __isl_keep isl_local_space *ls);
1608         int isl_local_space_is_set(__isl_keep isl_local_space *ls);
1609         __isl_give isl_space *isl_local_space_get_space(
1610                 __isl_keep isl_local_space *ls);
1611         __isl_give isl_aff *isl_local_space_get_div(
1612                 __isl_keep isl_local_space *ls, int pos);
1613         __isl_give isl_local_space *isl_local_space_copy(
1614                 __isl_keep isl_local_space *ls);
1615         __isl_null isl_local_space *isl_local_space_free(
1616                 __isl_take isl_local_space *ls);
1618 Note that C<isl_local_space_get_div> can only be used on local spaces
1619 of sets.
1621 Two local spaces can be compared using
1623         int isl_local_space_is_equal(__isl_keep isl_local_space *ls1,
1624                 __isl_keep isl_local_space *ls2);
1626 Local spaces can be created from other local spaces
1627 using the functions described in L</"Unary Operations">
1628 and L</"Binary Operations">.
1630 =head2 Creating New Sets and Relations
1632 C<isl> has functions for creating some standard sets and relations.
1634 =over
1636 =item * Empty sets and relations
1638         __isl_give isl_basic_set *isl_basic_set_empty(
1639                 __isl_take isl_space *space);
1640         __isl_give isl_basic_map *isl_basic_map_empty(
1641                 __isl_take isl_space *space);
1642         __isl_give isl_set *isl_set_empty(
1643                 __isl_take isl_space *space);
1644         __isl_give isl_map *isl_map_empty(
1645                 __isl_take isl_space *space);
1646         __isl_give isl_union_set *isl_union_set_empty(
1647                 __isl_take isl_space *space);
1648         __isl_give isl_union_map *isl_union_map_empty(
1649                 __isl_take isl_space *space);
1651 For C<isl_union_set>s and C<isl_union_map>s, the space
1652 is only used to specify the parameters.
1654 =item * Universe sets and relations
1656         __isl_give isl_basic_set *isl_basic_set_universe(
1657                 __isl_take isl_space *space);
1658         __isl_give isl_basic_map *isl_basic_map_universe(
1659                 __isl_take isl_space *space);
1660         __isl_give isl_set *isl_set_universe(
1661                 __isl_take isl_space *space);
1662         __isl_give isl_map *isl_map_universe(
1663                 __isl_take isl_space *space);
1664         __isl_give isl_union_set *isl_union_set_universe(
1665                 __isl_take isl_union_set *uset);
1666         __isl_give isl_union_map *isl_union_map_universe(
1667                 __isl_take isl_union_map *umap);
1669 The sets and relations constructed by the functions above
1670 contain all integer values, while those constructed by the
1671 functions below only contain non-negative values.
1673         __isl_give isl_basic_set *isl_basic_set_nat_universe(
1674                 __isl_take isl_space *space);
1675         __isl_give isl_basic_map *isl_basic_map_nat_universe(
1676                 __isl_take isl_space *space);
1677         __isl_give isl_set *isl_set_nat_universe(
1678                 __isl_take isl_space *space);
1679         __isl_give isl_map *isl_map_nat_universe(
1680                 __isl_take isl_space *space);
1682 =item * Identity relations
1684         __isl_give isl_basic_map *isl_basic_map_identity(
1685                 __isl_take isl_space *space);
1686         __isl_give isl_map *isl_map_identity(
1687                 __isl_take isl_space *space);
1689 The number of input and output dimensions in C<space> needs
1690 to be the same.
1692 =item * Lexicographic order
1694         __isl_give isl_map *isl_map_lex_lt(
1695                 __isl_take isl_space *set_space);
1696         __isl_give isl_map *isl_map_lex_le(
1697                 __isl_take isl_space *set_space);
1698         __isl_give isl_map *isl_map_lex_gt(
1699                 __isl_take isl_space *set_space);
1700         __isl_give isl_map *isl_map_lex_ge(
1701                 __isl_take isl_space *set_space);
1702         __isl_give isl_map *isl_map_lex_lt_first(
1703                 __isl_take isl_space *space, unsigned n);
1704         __isl_give isl_map *isl_map_lex_le_first(
1705                 __isl_take isl_space *space, unsigned n);
1706         __isl_give isl_map *isl_map_lex_gt_first(
1707                 __isl_take isl_space *space, unsigned n);
1708         __isl_give isl_map *isl_map_lex_ge_first(
1709                 __isl_take isl_space *space, unsigned n);
1711 The first four functions take a space for a B<set>
1712 and return relations that express that the elements in the domain
1713 are lexicographically less
1714 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1715 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1716 than the elements in the range.
1717 The last four functions take a space for a map
1718 and return relations that express that the first C<n> dimensions
1719 in the domain are lexicographically less
1720 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1721 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1722 than the first C<n> dimensions in the range.
1724 =back
1726 A basic set or relation can be converted to a set or relation
1727 using the following functions.
1729         __isl_give isl_set *isl_set_from_basic_set(
1730                 __isl_take isl_basic_set *bset);
1731         __isl_give isl_map *isl_map_from_basic_map(
1732                 __isl_take isl_basic_map *bmap);
1734 Sets and relations can be converted to union sets and relations
1735 using the following functions.
1737         __isl_give isl_union_set *isl_union_set_from_basic_set(
1738                 __isl_take isl_basic_set *bset);
1739         __isl_give isl_union_map *isl_union_map_from_basic_map(
1740                 __isl_take isl_basic_map *bmap);
1741         __isl_give isl_union_set *isl_union_set_from_set(
1742                 __isl_take isl_set *set);
1743         __isl_give isl_union_map *isl_union_map_from_map(
1744                 __isl_take isl_map *map);
1746 The inverse conversions below can only be used if the input
1747 union set or relation is known to contain elements in exactly one
1748 space.
1750         __isl_give isl_set *isl_set_from_union_set(
1751                 __isl_take isl_union_set *uset);
1752         __isl_give isl_map *isl_map_from_union_map(
1753                 __isl_take isl_union_map *umap);
1755 Sets and relations can be copied and freed again using the following
1756 functions.
1758         __isl_give isl_basic_set *isl_basic_set_copy(
1759                 __isl_keep isl_basic_set *bset);
1760         __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1761         __isl_give isl_union_set *isl_union_set_copy(
1762                 __isl_keep isl_union_set *uset);
1763         __isl_give isl_basic_map *isl_basic_map_copy(
1764                 __isl_keep isl_basic_map *bmap);
1765         __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1766         __isl_give isl_union_map *isl_union_map_copy(
1767                 __isl_keep isl_union_map *umap);
1768         __isl_null isl_basic_set *isl_basic_set_free(
1769                 __isl_take isl_basic_set *bset);
1770         __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1771         __isl_null isl_union_set *isl_union_set_free(
1772                 __isl_take isl_union_set *uset);
1773         __isl_null isl_basic_map *isl_basic_map_free(
1774                 __isl_take isl_basic_map *bmap);
1775         __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1776         __isl_null isl_union_map *isl_union_map_free(
1777                 __isl_take isl_union_map *umap);
1779 Other sets and relations can be constructed by starting
1780 from a universe set or relation, adding equality and/or
1781 inequality constraints and then projecting out the
1782 existentially quantified variables, if any.
1783 Constraints can be constructed, manipulated and
1784 added to (or removed from) (basic) sets and relations
1785 using the following functions.
1787         #include <isl/constraint.h>
1788         __isl_give isl_constraint *isl_equality_alloc(
1789                 __isl_take isl_local_space *ls);
1790         __isl_give isl_constraint *isl_inequality_alloc(
1791                 __isl_take isl_local_space *ls);
1792         __isl_give isl_constraint *isl_constraint_set_constant_si(
1793                 __isl_take isl_constraint *constraint, int v);
1794         __isl_give isl_constraint *isl_constraint_set_constant_val(
1795                 __isl_take isl_constraint *constraint,
1796                 __isl_take isl_val *v);
1797         __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1798                 __isl_take isl_constraint *constraint,
1799                 enum isl_dim_type type, int pos, int v);
1800         __isl_give isl_constraint *
1801         isl_constraint_set_coefficient_val(
1802                 __isl_take isl_constraint *constraint,
1803                 enum isl_dim_type type, int pos,
1804                 __isl_take isl_val *v);
1805         __isl_give isl_basic_map *isl_basic_map_add_constraint(
1806                 __isl_take isl_basic_map *bmap,
1807                 __isl_take isl_constraint *constraint);
1808         __isl_give isl_basic_set *isl_basic_set_add_constraint(
1809                 __isl_take isl_basic_set *bset,
1810                 __isl_take isl_constraint *constraint);
1811         __isl_give isl_map *isl_map_add_constraint(
1812                 __isl_take isl_map *map,
1813                 __isl_take isl_constraint *constraint);
1814         __isl_give isl_set *isl_set_add_constraint(
1815                 __isl_take isl_set *set,
1816                 __isl_take isl_constraint *constraint);
1817         __isl_give isl_basic_set *isl_basic_set_drop_constraint(
1818                 __isl_take isl_basic_set *bset,
1819                 __isl_take isl_constraint *constraint);
1821 For example, to create a set containing the even integers
1822 between 10 and 42, you would use the following code.
1824         isl_space *space;
1825         isl_local_space *ls;
1826         isl_constraint *c;
1827         isl_basic_set *bset;
1829         space = isl_space_set_alloc(ctx, 0, 2);
1830         bset = isl_basic_set_universe(isl_space_copy(space));
1831         ls = isl_local_space_from_space(space);
1833         c = isl_equality_alloc(isl_local_space_copy(ls));
1834         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1835         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
1836         bset = isl_basic_set_add_constraint(bset, c);
1838         c = isl_inequality_alloc(isl_local_space_copy(ls));
1839         c = isl_constraint_set_constant_si(c, -10);
1840         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
1841         bset = isl_basic_set_add_constraint(bset, c);
1843         c = isl_inequality_alloc(ls);
1844         c = isl_constraint_set_constant_si(c, 42);
1845         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1846         bset = isl_basic_set_add_constraint(bset, c);
1848         bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
1850 Or, alternatively,
1852         isl_basic_set *bset;
1853         bset = isl_basic_set_read_from_str(ctx,
1854                 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
1856 A basic set or relation can also be constructed from two matrices
1857 describing the equalities and the inequalities.
1859         __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
1860                 __isl_take isl_space *space,
1861                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1862                 enum isl_dim_type c1,
1863                 enum isl_dim_type c2, enum isl_dim_type c3,
1864                 enum isl_dim_type c4);
1865         __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
1866                 __isl_take isl_space *space,
1867                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1868                 enum isl_dim_type c1,
1869                 enum isl_dim_type c2, enum isl_dim_type c3,
1870                 enum isl_dim_type c4, enum isl_dim_type c5);
1872 The C<isl_dim_type> arguments indicate the order in which
1873 different kinds of variables appear in the input matrices
1874 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
1875 C<isl_dim_set> and C<isl_dim_div> for sets and
1876 of C<isl_dim_cst>, C<isl_dim_param>,
1877 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
1879 A (basic or union) set or relation can also be constructed from a
1880 (union) (piecewise) (multiple) affine expression
1881 or a list of affine expressions
1882 (See L</"Functions">).
1884         __isl_give isl_basic_map *isl_basic_map_from_aff(
1885                 __isl_take isl_aff *aff);
1886         __isl_give isl_map *isl_map_from_aff(
1887                 __isl_take isl_aff *aff);
1888         __isl_give isl_set *isl_set_from_pw_aff(
1889                 __isl_take isl_pw_aff *pwaff);
1890         __isl_give isl_map *isl_map_from_pw_aff(
1891                 __isl_take isl_pw_aff *pwaff);
1892         __isl_give isl_basic_map *isl_basic_map_from_aff_list(
1893                 __isl_take isl_space *domain_space,
1894                 __isl_take isl_aff_list *list);
1895         __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
1896                 __isl_take isl_multi_aff *maff)
1897         __isl_give isl_map *isl_map_from_multi_aff(
1898                 __isl_take isl_multi_aff *maff)
1899         __isl_give isl_set *isl_set_from_pw_multi_aff(
1900                 __isl_take isl_pw_multi_aff *pma);
1901         __isl_give isl_map *isl_map_from_pw_multi_aff(
1902                 __isl_take isl_pw_multi_aff *pma);
1903         __isl_give isl_set *isl_set_from_multi_pw_aff(
1904                 __isl_take isl_multi_pw_aff *mpa);
1905         __isl_give isl_map *isl_map_from_multi_pw_aff(
1906                 __isl_take isl_multi_pw_aff *mpa);
1907         __isl_give isl_union_map *
1908         isl_union_map_from_union_pw_multi_aff(
1909                 __isl_take isl_union_pw_multi_aff *upma);
1911 The C<domain_space> argument describes the domain of the resulting
1912 basic relation.  It is required because the C<list> may consist
1913 of zero affine expressions.
1915 =head2 Inspecting Sets and Relations
1917 Usually, the user should not have to care about the actual constraints
1918 of the sets and maps, but should instead apply the abstract operations
1919 explained in the following sections.
1920 Occasionally, however, it may be required to inspect the individual
1921 coefficients of the constraints.  This section explains how to do so.
1922 In these cases, it may also be useful to have C<isl> compute
1923 an explicit representation of the existentially quantified variables.
1925         __isl_give isl_set *isl_set_compute_divs(
1926                 __isl_take isl_set *set);
1927         __isl_give isl_map *isl_map_compute_divs(
1928                 __isl_take isl_map *map);
1929         __isl_give isl_union_set *isl_union_set_compute_divs(
1930                 __isl_take isl_union_set *uset);
1931         __isl_give isl_union_map *isl_union_map_compute_divs(
1932                 __isl_take isl_union_map *umap);
1934 This explicit representation defines the existentially quantified
1935 variables as integer divisions of the other variables, possibly
1936 including earlier existentially quantified variables.
1937 An explicitly represented existentially quantified variable therefore
1938 has a unique value when the values of the other variables are known.
1939 If, furthermore, the same existentials, i.e., existentials
1940 with the same explicit representations, should appear in the
1941 same order in each of the disjuncts of a set or map, then the user should call
1942 either of the following functions.
1944         __isl_give isl_set *isl_set_align_divs(
1945                 __isl_take isl_set *set);
1946         __isl_give isl_map *isl_map_align_divs(
1947                 __isl_take isl_map *map);
1949 Alternatively, the existentially quantified variables can be removed
1950 using the following functions, which compute an overapproximation.
1952         __isl_give isl_basic_set *isl_basic_set_remove_divs(
1953                 __isl_take isl_basic_set *bset);
1954         __isl_give isl_basic_map *isl_basic_map_remove_divs(
1955                 __isl_take isl_basic_map *bmap);
1956         __isl_give isl_set *isl_set_remove_divs(
1957                 __isl_take isl_set *set);
1958         __isl_give isl_map *isl_map_remove_divs(
1959                 __isl_take isl_map *map);
1961 It is also possible to only remove those divs that are defined
1962 in terms of a given range of dimensions or only those for which
1963 no explicit representation is known.
1965         __isl_give isl_basic_set *
1966         isl_basic_set_remove_divs_involving_dims(
1967                 __isl_take isl_basic_set *bset,
1968                 enum isl_dim_type type,
1969                 unsigned first, unsigned n);
1970         __isl_give isl_basic_map *
1971         isl_basic_map_remove_divs_involving_dims(
1972                 __isl_take isl_basic_map *bmap,
1973                 enum isl_dim_type type,
1974                 unsigned first, unsigned n);
1975         __isl_give isl_set *isl_set_remove_divs_involving_dims(
1976                 __isl_take isl_set *set, enum isl_dim_type type,
1977                 unsigned first, unsigned n);
1978         __isl_give isl_map *isl_map_remove_divs_involving_dims(
1979                 __isl_take isl_map *map, enum isl_dim_type type,
1980                 unsigned first, unsigned n);
1982         __isl_give isl_basic_set *
1983         isl_basic_set_remove_unknown_divs(
1984                 __isl_take isl_basic_set *bset);
1985         __isl_give isl_set *isl_set_remove_unknown_divs(
1986                 __isl_take isl_set *set);
1987         __isl_give isl_map *isl_map_remove_unknown_divs(
1988                 __isl_take isl_map *map);
1990 To iterate over all the sets or maps in a union set or map, use
1992         int isl_union_set_foreach_set(__isl_keep isl_union_set *uset,
1993                 int (*fn)(__isl_take isl_set *set, void *user),
1994                 void *user);
1995         int isl_union_map_foreach_map(__isl_keep isl_union_map *umap,
1996                 int (*fn)(__isl_take isl_map *map, void *user),
1997                 void *user);
1999 The number of sets or maps in a union set or map can be obtained
2000 from
2002         int isl_union_set_n_set(__isl_keep isl_union_set *uset);
2003         int isl_union_map_n_map(__isl_keep isl_union_map *umap);
2005 To extract the set or map in a given space from a union, use
2007         __isl_give isl_set *isl_union_set_extract_set(
2008                 __isl_keep isl_union_set *uset,
2009                 __isl_take isl_space *space);
2010         __isl_give isl_map *isl_union_map_extract_map(
2011                 __isl_keep isl_union_map *umap,
2012                 __isl_take isl_space *space);
2014 To iterate over all the basic sets or maps in a set or map, use
2016         int isl_set_foreach_basic_set(__isl_keep isl_set *set,
2017                 int (*fn)(__isl_take isl_basic_set *bset, void *user),
2018                 void *user);
2019         int isl_map_foreach_basic_map(__isl_keep isl_map *map,
2020                 int (*fn)(__isl_take isl_basic_map *bmap, void *user),
2021                 void *user);
2023 The callback function C<fn> should return 0 if successful and
2024 -1 if an error occurs.  In the latter case, or if any other error
2025 occurs, the above functions will return -1.
2027 It should be noted that C<isl> does not guarantee that
2028 the basic sets or maps passed to C<fn> are disjoint.
2029 If this is required, then the user should call one of
2030 the following functions first.
2032         __isl_give isl_set *isl_set_make_disjoint(
2033                 __isl_take isl_set *set);
2034         __isl_give isl_map *isl_map_make_disjoint(
2035                 __isl_take isl_map *map);
2037 The number of basic sets in a set can be obtained
2038 or the number of basic maps in a map can be obtained
2039 from
2041         #include <isl/set.h>
2042         int isl_set_n_basic_set(__isl_keep isl_set *set);
2044         #include <isl/map.h>
2045         int isl_map_n_basic_map(__isl_keep isl_map *map);
2047 To iterate over the constraints of a basic set or map, use
2049         #include <isl/constraint.h>
2051         int isl_basic_set_n_constraint(
2052                 __isl_keep isl_basic_set *bset);
2053         int isl_basic_set_foreach_constraint(
2054                 __isl_keep isl_basic_set *bset,
2055                 int (*fn)(__isl_take isl_constraint *c, void *user),
2056                 void *user);
2057         int isl_basic_map_n_constraint(
2058                 __isl_keep isl_basic_map *bmap);
2059         int isl_basic_map_foreach_constraint(
2060                 __isl_keep isl_basic_map *bmap,
2061                 int (*fn)(__isl_take isl_constraint *c, void *user),
2062                 void *user);
2063         __isl_null isl_constraint *isl_constraint_free(
2064                 __isl_take isl_constraint *c);
2066 Again, the callback function C<fn> should return 0 if successful and
2067 -1 if an error occurs.  In the latter case, or if any other error
2068 occurs, the above functions will return -1.
2069 The constraint C<c> represents either an equality or an inequality.
2070 Use the following function to find out whether a constraint
2071 represents an equality.  If not, it represents an inequality.
2073         int isl_constraint_is_equality(
2074                 __isl_keep isl_constraint *constraint);
2076 It is also possible to obtain a list of constraints from a basic
2077 map or set
2079         #include <isl/constraint.h>
2080         __isl_give isl_constraint_list *
2081         isl_basic_map_get_constraint_list(
2082                 __isl_keep isl_basic_map *bmap);
2083         __isl_give isl_constraint_list *
2084         isl_basic_set_get_constraint_list(
2085                 __isl_keep isl_basic_set *bset);
2087 These functions require that all existentially quantified variables
2088 have an explicit representation.
2089 The returned list can be manipulated using the functions in L<"Lists">.
2091 The coefficients of the constraints can be inspected using
2092 the following functions.
2094         int isl_constraint_is_lower_bound(
2095                 __isl_keep isl_constraint *constraint,
2096                 enum isl_dim_type type, unsigned pos);
2097         int isl_constraint_is_upper_bound(
2098                 __isl_keep isl_constraint *constraint,
2099                 enum isl_dim_type type, unsigned pos);
2100         __isl_give isl_val *isl_constraint_get_constant_val(
2101                 __isl_keep isl_constraint *constraint);
2102         __isl_give isl_val *isl_constraint_get_coefficient_val(
2103                 __isl_keep isl_constraint *constraint,
2104                 enum isl_dim_type type, int pos);
2106 The explicit representations of the existentially quantified
2107 variables can be inspected using the following function.
2108 Note that the user is only allowed to use this function
2109 if the inspected set or map is the result of a call
2110 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2111 The existentially quantified variable is equal to the floor
2112 of the returned affine expression.  The affine expression
2113 itself can be inspected using the functions in
2114 L</"Functions">.
2116         __isl_give isl_aff *isl_constraint_get_div(
2117                 __isl_keep isl_constraint *constraint, int pos);
2119 To obtain the constraints of a basic set or map in matrix
2120 form, use the following functions.
2122         __isl_give isl_mat *isl_basic_set_equalities_matrix(
2123                 __isl_keep isl_basic_set *bset,
2124                 enum isl_dim_type c1, enum isl_dim_type c2,
2125                 enum isl_dim_type c3, enum isl_dim_type c4);
2126         __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2127                 __isl_keep isl_basic_set *bset,
2128                 enum isl_dim_type c1, enum isl_dim_type c2,
2129                 enum isl_dim_type c3, enum isl_dim_type c4);
2130         __isl_give isl_mat *isl_basic_map_equalities_matrix(
2131                 __isl_keep isl_basic_map *bmap,
2132                 enum isl_dim_type c1,
2133                 enum isl_dim_type c2, enum isl_dim_type c3,
2134                 enum isl_dim_type c4, enum isl_dim_type c5);
2135         __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2136                 __isl_keep isl_basic_map *bmap,
2137                 enum isl_dim_type c1,
2138                 enum isl_dim_type c2, enum isl_dim_type c3,
2139                 enum isl_dim_type c4, enum isl_dim_type c5);
2141 The C<isl_dim_type> arguments dictate the order in which
2142 different kinds of variables appear in the resulting matrix.
2143 For set inputs, they should be a permutation of
2144 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2145 For map inputs, they should be a permutation of
2146 C<isl_dim_cst>, C<isl_dim_param>,
2147 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2149 =head2 Points
2151 Points are elements of a set.  They can be used to construct
2152 simple sets (boxes) or they can be used to represent the
2153 individual elements of a set.
2154 The zero point (the origin) can be created using
2156         __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2158 The coordinates of a point can be inspected, set and changed
2159 using
2161         __isl_give isl_val *isl_point_get_coordinate_val(
2162                 __isl_keep isl_point *pnt,
2163                 enum isl_dim_type type, int pos);
2164         __isl_give isl_point *isl_point_set_coordinate_val(
2165                 __isl_take isl_point *pnt,
2166                 enum isl_dim_type type, int pos,
2167                 __isl_take isl_val *v);
2169         __isl_give isl_point *isl_point_add_ui(
2170                 __isl_take isl_point *pnt,
2171                 enum isl_dim_type type, int pos, unsigned val);
2172         __isl_give isl_point *isl_point_sub_ui(
2173                 __isl_take isl_point *pnt,
2174                 enum isl_dim_type type, int pos, unsigned val);
2176 Points can be copied or freed using
2178         __isl_give isl_point *isl_point_copy(
2179                 __isl_keep isl_point *pnt);
2180         void isl_point_free(__isl_take isl_point *pnt);
2182 A singleton set can be created from a point using
2184         __isl_give isl_basic_set *isl_basic_set_from_point(
2185                 __isl_take isl_point *pnt);
2186         __isl_give isl_set *isl_set_from_point(
2187                 __isl_take isl_point *pnt);
2189 and a box can be created from two opposite extremal points using
2191         __isl_give isl_basic_set *isl_basic_set_box_from_points(
2192                 __isl_take isl_point *pnt1,
2193                 __isl_take isl_point *pnt2);
2194         __isl_give isl_set *isl_set_box_from_points(
2195                 __isl_take isl_point *pnt1,
2196                 __isl_take isl_point *pnt2);
2198 All elements of a B<bounded> (union) set can be enumerated using
2199 the following functions.
2201         int isl_set_foreach_point(__isl_keep isl_set *set,
2202                 int (*fn)(__isl_take isl_point *pnt, void *user),
2203                 void *user);
2204         int isl_union_set_foreach_point(__isl_keep isl_union_set *uset,
2205                 int (*fn)(__isl_take isl_point *pnt, void *user),
2206                 void *user);
2208 The function C<fn> is called for each integer point in
2209 C<set> with as second argument the last argument of
2210 the C<isl_set_foreach_point> call.  The function C<fn>
2211 should return C<0> on success and C<-1> on failure.
2212 In the latter case, C<isl_set_foreach_point> will stop
2213 enumerating and return C<-1> as well.
2214 If the enumeration is performed successfully and to completion,
2215 then C<isl_set_foreach_point> returns C<0>.
2217 To obtain a single point of a (basic) set, use
2219         __isl_give isl_point *isl_basic_set_sample_point(
2220                 __isl_take isl_basic_set *bset);
2221         __isl_give isl_point *isl_set_sample_point(
2222                 __isl_take isl_set *set);
2224 If C<set> does not contain any (integer) points, then the
2225 resulting point will be ``void'', a property that can be
2226 tested using
2228         int isl_point_is_void(__isl_keep isl_point *pnt);
2230 =head2 Functions
2232 Besides sets and relation, C<isl> also supports various types of functions.
2233 Each of these types is derived from the value type (see L</"Values">)
2234 or from one of two primitive function types
2235 through the application of zero or more type constructors.
2236 We first describe the primitive type and then we describe
2237 the types derived from these primitive types.
2239 =head3 Primitive Functions
2241 C<isl> support two primitive function types, quasi-affine
2242 expressions and quasipolynomials.
2243 A quasi-affine expression is defined either over a parameter
2244 space or over a set and is composed of integer constants,
2245 parameters and set variables, addition, subtraction and
2246 integer division by an integer constant.
2247 For example, the quasi-affine expression
2249         [n] -> { [x] -> [2*floor((4 n + x)/9] }
2251 maps C<x> to C<2*floor((4 n + x)/9>.
2252 A quasipolynomial is a polynomial expression in quasi-affine
2253 expression.  That is, it additionally allows for multiplication.
2254 Note, though, that it is not allowed to construct an integer
2255 division of an expression involving multiplications.
2256 Here is an example of a quasipolynomial that is not
2257 quasi-affine expression
2259         [n] -> { [x] -> (n*floor((4 n + x)/9) }
2261 Note that the external representations of quasi-affine expressions
2262 and quasipolynomials are different.  Quasi-affine expressions
2263 use a notation with square brackets just like binary relations,
2264 while quasipolynomials do not.  This might change at some point.
2266 If a primitive function is defined over a parameter space,
2267 then the space of the function itself is that of a set.
2268 If it is defined over a set, then the space of the function
2269 is that of a relation.  In both cases, the set space (or
2270 the output space) is single-dimensional, anonymous and unstructured.
2271 To create functions with multiple dimensions or with other kinds
2272 of set or output spaces, use multiple expressions
2273 (see L</"Multiple Expressions">).
2275 =over
2277 =item * Quasi-affine Expressions
2279 Besides the expressions described above, a quasi-affine
2280 expression can also be set to NaN.  Such expressions
2281 typically represent a failure to represent a result
2282 as a quasi-affine expression.
2284 The zero quasi affine expression or the quasi affine expression
2285 that is equal to a given value or
2286 a specified dimension on a given domain can be created using
2288         #include <isl/aff.h>
2289         __isl_give isl_aff *isl_aff_zero_on_domain(
2290                 __isl_take isl_local_space *ls);
2291         __isl_give isl_aff *isl_aff_val_on_domain(
2292                 __isl_take isl_local_space *ls,
2293                 __isl_take isl_val *val);
2294         __isl_give isl_aff *isl_aff_var_on_domain(
2295                 __isl_take isl_local_space *ls,
2296                 enum isl_dim_type type, unsigned pos);
2297         __isl_give isl_aff *isl_aff_nan_on_domain(
2298                 __isl_take isl_local_space *ls);
2300 Quasi affine expressions can be copied and freed using
2302         #include <isl/aff.h>
2303         __isl_give isl_aff *isl_aff_copy(
2304                 __isl_keep isl_aff *aff);
2305         __isl_null isl_aff *isl_aff_free(
2306                 __isl_take isl_aff *aff);
2308 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2309 using the following function.  The constraint is required to have
2310 a non-zero coefficient for the specified dimension.
2312         #include <isl/constraint.h>
2313         __isl_give isl_aff *isl_constraint_get_bound(
2314                 __isl_keep isl_constraint *constraint,
2315                 enum isl_dim_type type, int pos);
2317 The entire affine expression of the constraint can also be extracted
2318 using the following function.
2320         #include <isl/constraint.h>
2321         __isl_give isl_aff *isl_constraint_get_aff(
2322                 __isl_keep isl_constraint *constraint);
2324 Conversely, an equality constraint equating
2325 the affine expression to zero or an inequality constraint enforcing
2326 the affine expression to be non-negative, can be constructed using
2328         __isl_give isl_constraint *isl_equality_from_aff(
2329                 __isl_take isl_aff *aff);
2330         __isl_give isl_constraint *isl_inequality_from_aff(
2331                 __isl_take isl_aff *aff);
2333 The coefficients and the integer divisions of an affine expression
2334 can be inspected using the following functions.
2336         #include <isl/aff.h>
2337         __isl_give isl_val *isl_aff_get_constant_val(
2338                 __isl_keep isl_aff *aff);
2339         __isl_give isl_val *isl_aff_get_coefficient_val(
2340                 __isl_keep isl_aff *aff,
2341                 enum isl_dim_type type, int pos);
2342         int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2343                 enum isl_dim_type type, int pos);
2344         __isl_give isl_val *isl_aff_get_denominator_val(
2345                 __isl_keep isl_aff *aff);
2346         __isl_give isl_aff *isl_aff_get_div(
2347                 __isl_keep isl_aff *aff, int pos);
2349 They can be modified using the following functions.
2351         #include <isl/aff.h>
2352         __isl_give isl_aff *isl_aff_set_constant_si(
2353                 __isl_take isl_aff *aff, int v);
2354         __isl_give isl_aff *isl_aff_set_constant_val(
2355                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2356         __isl_give isl_aff *isl_aff_set_coefficient_si(
2357                 __isl_take isl_aff *aff,
2358                 enum isl_dim_type type, int pos, int v);
2359         __isl_give isl_aff *isl_aff_set_coefficient_val(
2360                 __isl_take isl_aff *aff,
2361                 enum isl_dim_type type, int pos,
2362                 __isl_take isl_val *v);
2364         __isl_give isl_aff *isl_aff_add_constant_si(
2365                 __isl_take isl_aff *aff, int v);
2366         __isl_give isl_aff *isl_aff_add_constant_val(
2367                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2368         __isl_give isl_aff *isl_aff_add_constant_num_si(
2369                 __isl_take isl_aff *aff, int v);
2370         __isl_give isl_aff *isl_aff_add_coefficient_si(
2371                 __isl_take isl_aff *aff,
2372                 enum isl_dim_type type, int pos, int v);
2373         __isl_give isl_aff *isl_aff_add_coefficient_val(
2374                 __isl_take isl_aff *aff,
2375                 enum isl_dim_type type, int pos,
2376                 __isl_take isl_val *v);
2378 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2379 set the I<numerator> of the constant or coefficient, while
2380 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2381 the constant or coefficient as a whole.
2382 The C<add_constant> and C<add_coefficient> functions add an integer
2383 or rational value to
2384 the possibly rational constant or coefficient.
2385 The C<add_constant_num> functions add an integer value to
2386 the numerator.
2388 =item * Quasipolynomials
2390 Some simple quasipolynomials can be created using the following functions.
2392         #include <isl/polynomial.h>
2393         __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2394                 __isl_take isl_space *domain);
2395         __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2396                 __isl_take isl_space *domain);
2397         __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2398                 __isl_take isl_space *domain);
2399         __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2400                 __isl_take isl_space *domain);
2401         __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2402                 __isl_take isl_space *domain);
2403         __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2404                 __isl_take isl_space *domain,
2405                 __isl_take isl_val *val);
2406         __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2407                 __isl_take isl_space *domain,
2408                 enum isl_dim_type type, unsigned pos);
2409         __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2410                 __isl_take isl_aff *aff);
2412 Recall that the space in which a quasipolynomial lives is a map space
2413 with a one-dimensional range.  The C<domain> argument in some of
2414 the functions above corresponds to the domain of this map space.
2416 Quasipolynomials can be copied and freed again using the following
2417 functions.
2419         #include <isl/polynomial.h>
2420         __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2421                 __isl_keep isl_qpolynomial *qp);
2422         __isl_null isl_qpolynomial *isl_qpolynomial_free(
2423                 __isl_take isl_qpolynomial *qp);
2425 The constant term of a quasipolynomial can be extracted using
2427         __isl_give isl_val *isl_qpolynomial_get_constant_val(
2428                 __isl_keep isl_qpolynomial *qp);
2430 To iterate over all terms in a quasipolynomial,
2433         int isl_qpolynomial_foreach_term(
2434                 __isl_keep isl_qpolynomial *qp,
2435                 int (*fn)(__isl_take isl_term *term,
2436                           void *user), void *user);
2438 The terms themselves can be inspected and freed using
2439 these functions
2441         unsigned isl_term_dim(__isl_keep isl_term *term,
2442                 enum isl_dim_type type);
2443         __isl_give isl_val *isl_term_get_coefficient_val(
2444                 __isl_keep isl_term *term);
2445         int isl_term_get_exp(__isl_keep isl_term *term,
2446                 enum isl_dim_type type, unsigned pos);
2447         __isl_give isl_aff *isl_term_get_div(
2448                 __isl_keep isl_term *term, unsigned pos);
2449         void isl_term_free(__isl_take isl_term *term);
2451 Each term is a product of parameters, set variables and
2452 integer divisions.  The function C<isl_term_get_exp>
2453 returns the exponent of a given dimensions in the given term.
2455 =back
2457 =head3 Reductions
2459 A reduction represents a maximum or a minimum of its
2460 base expressions.
2461 The only reduction type defined by C<isl> is
2462 C<isl_qpolynomial_fold>.
2464 There are currently no functions to directly create such
2465 objects, but they do appear in the piecewise quasipolynomial
2466 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2468 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2470 Reductions can be copied and freed using
2471 the following functions.
2473         #include <isl/polynomial.h>
2474         __isl_give isl_qpolynomial_fold *
2475         isl_qpolynomial_fold_copy(
2476                 __isl_keep isl_qpolynomial_fold *fold);
2477         void isl_qpolynomial_fold_free(
2478                 __isl_take isl_qpolynomial_fold *fold);
2480 To iterate over all quasipolynomials in a reduction, use
2482         int isl_qpolynomial_fold_foreach_qpolynomial(
2483                 __isl_keep isl_qpolynomial_fold *fold,
2484                 int (*fn)(__isl_take isl_qpolynomial *qp,
2485                           void *user), void *user);
2487 =head3 Multiple Expressions
2489 A multiple expression represents a sequence of zero or
2490 more base expressions, all defined on the same domain space.
2491 The domain space of the multiple expression is the same
2492 as that of the base expressions, but the range space
2493 can be any space.  In case the base expressions have
2494 a set space, the corresponding multiple expression
2495 also has a set space.
2496 Objects of the value type do not have an associated space.
2497 The space of a multiple value is therefore always a set space.
2499 The multiple expression types defined by C<isl>
2500 are C<isl_multi_val>, C<isl_multi_aff> and C<isl_multi_pw_aff>.
2502 A multiple expression with the value zero for
2503 each output (or set) dimension can be created
2504 using the following functions.
2506         #include <isl/val.h>
2507         __isl_give isl_multi_val *isl_multi_val_zero(
2508                 __isl_take isl_space *space);
2510         #include <isl/aff.h>
2511         __isl_give isl_multi_aff *isl_multi_aff_zero(
2512                 __isl_take isl_space *space);
2513         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2514                 __isl_take isl_space *space);
2516 An identity function can be created using the following
2517 functions.  The space needs to be that of a relation
2518 with the same number of input and output dimensions.
2520         #include <isl/aff.h>
2521         __isl_give isl_multi_aff *isl_multi_aff_identity(
2522                 __isl_take isl_space *space);
2523         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2524                 __isl_take isl_space *space);
2526 A function that performs a projection on a universe
2527 relation or set can be created using the following functions.
2528 See also the corresponding
2529 projection operations in L</"Unary Operations">.
2531         #include <isl/aff.h>
2532         __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2533                 __isl_take isl_space *space);
2534         __isl_give isl_multi_aff *isl_multi_aff_range_map(
2535                 __isl_take isl_space *space);
2536         __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2537                 __isl_take isl_space *space,
2538                 enum isl_dim_type type,
2539                 unsigned first, unsigned n);
2541 A multiple expression can be created from a single
2542 base expression using the following functions.
2543 The space of the created multiple expression is the same
2544 as that of the base expression.
2546         #include <isl/aff.h>
2547         __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2548                 __isl_take isl_aff *aff);
2549         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2550                 __isl_take isl_pw_aff *pa);
2552 A multiple expression can be created from a list
2553 of base expression in a specified space.
2554 The domain of this space needs to be the same
2555 as the domains of the base expressions in the list.
2556 If the base expressions have a set space (or no associated space),
2557 then this space also needs to be a set space.
2559         #include <isl/val.h>
2560         __isl_give isl_multi_val *isl_multi_val_from_val_list(
2561                 __isl_take isl_space *space,
2562                 __isl_take isl_val_list *list);
2564         #include <isl/aff.h>
2565         __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2566                 __isl_take isl_space *space,
2567                 __isl_take isl_aff_list *list);
2569 As a convenience, a multiple piecewise expression can
2570 also be created from a multiple expression.
2571 Each piecewise expression in the result has a single
2572 universe cell.
2574         #include <isl/aff.h>
2575         __isl_give isl_multi_pw_aff *
2576         isl_multi_pw_aff_from_multi_aff(
2577                 __isl_take isl_multi_aff *ma);
2579 A multiple quasi-affine expression can be created from
2580 a multiple value with a given domain space using the following
2581 function.
2583         #include <isl/aff.h>
2584         __isl_give isl_multi_aff *
2585         isl_multi_aff_multi_val_on_space(
2586                 __isl_take isl_space *space,
2587                 __isl_take isl_multi_val *mv);
2589 Multiple expressions can be copied and freed using
2590 the following functions.
2592         #include <isl/val.h>
2593         __isl_give isl_multi_val *isl_multi_val_copy(
2594                 __isl_keep isl_multi_val *mv);
2595         __isl_null isl_multi_val *isl_multi_val_free(
2596                 __isl_take isl_multi_val *mv);
2598         #include <isl/aff.h>
2599         __isl_give isl_multi_aff *isl_multi_aff_copy(
2600                 __isl_keep isl_multi_aff *maff);
2601         __isl_null isl_multi_aff *isl_multi_aff_free(
2602                 __isl_take isl_multi_aff *maff);
2603         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2604                 __isl_keep isl_multi_pw_aff *mpa);
2605         __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2606                 __isl_take isl_multi_pw_aff *mpa);
2608 The base expression at a given position of a multiple
2609 expression can be extracted using the following functions.
2611         #include <isl/val.h>
2612         __isl_give isl_val *isl_multi_val_get_val(
2613                 __isl_keep isl_multi_val *mv, int pos);
2615         #include <isl/aff.h>
2616         __isl_give isl_aff *isl_multi_aff_get_aff(
2617                 __isl_keep isl_multi_aff *multi, int pos);
2618         __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2619                 __isl_keep isl_multi_pw_aff *mpa, int pos);
2621 It can be replaced using the following functions.
2623         #include <isl/val.h>
2624         __isl_give isl_multi_val *isl_multi_val_set_val(
2625                 __isl_take isl_multi_val *mv, int pos,
2626                 __isl_take isl_val *val);
2628         #include <isl/aff.h>
2629         __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2630                 __isl_take isl_multi_aff *multi, int pos,
2631                 __isl_take isl_aff *aff);
2633 =head3 Piecewise Expressions
2635 A piecewise expression is an expression that is described
2636 using zero or more base expression defined over the same
2637 number of cells in the domain space of the base expressions.
2638 All base expressions are defined over the same
2639 domain space and the cells are disjoint.
2640 The space of a piecewise expression is the same as
2641 that of the base expressions.
2642 If the union of the cells is a strict subset of the domain
2643 space, then the value of the piecewise expression outside
2644 this union is different for types derived from quasi-affine
2645 expressions and those derived from quasipolynomials.
2646 Piecewise expressions derived from quasi-affine expressions
2647 are considered to be undefined outside the union of their cells.
2648 Piecewise expressions derived from quasipolynomials
2649 are considered to be zero outside the union of their cells.
2651 Piecewise quasipolynomials are mainly used by the C<barvinok>
2652 library for representing the number of elements in a parametric set or map.
2653 For example, the piecewise quasipolynomial
2655         [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
2657 represents the number of points in the map
2659         [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
2661 The piecewise expression types defined by C<isl>
2662 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
2663 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
2665 A piecewise expression with no cells can be created using
2666 the following functions.
2668         #include <isl/aff.h>
2669         __isl_give isl_pw_aff *isl_pw_aff_empty(
2670                 __isl_take isl_space *space);
2671         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
2672                 __isl_take isl_space *space);
2674 A piecewise expression with a single universe cell can be
2675 created using the following functions.
2677         #include <isl/aff.h>
2678         __isl_give isl_pw_aff *isl_pw_aff_from_aff(
2679                 __isl_take isl_aff *aff);
2680         __isl_give isl_pw_multi_aff *
2681         isl_pw_multi_aff_from_multi_aff(
2682                 __isl_take isl_multi_aff *ma);
2684         #include <isl/polynomial.h>
2685         __isl_give isl_pw_qpolynomial *
2686         isl_pw_qpolynomial_from_qpolynomial(
2687                 __isl_take isl_qpolynomial *qp);
2689 A piecewise expression with a single specified cell can be
2690 created using the following functions.
2692         #include <isl/aff.h>
2693         __isl_give isl_pw_aff *isl_pw_aff_alloc(
2694                 __isl_take isl_set *set, __isl_take isl_aff *aff);
2695         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
2696                 __isl_take isl_set *set,
2697                 __isl_take isl_multi_aff *maff);
2699         #include <isl/polynomial.h>
2700         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
2701                 __isl_take isl_set *set,
2702                 __isl_take isl_qpolynomial *qp);
2704 The following convenience functions first create a base expression and
2705 then create a piecewise expression over a universe domain.
2707         #include <isl/aff.h>
2708         __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
2709                 __isl_take isl_local_space *ls);
2710         __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
2711                 __isl_take isl_local_space *ls,
2712                 enum isl_dim_type type, unsigned pos);
2713         __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
2714                 __isl_take isl_local_space *ls);
2715         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
2716                 __isl_take isl_space *space);
2717         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
2718                 __isl_take isl_space *space);
2719         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
2720                 __isl_take isl_space *space);
2721         __isl_give isl_pw_multi_aff *
2722         isl_pw_multi_aff_project_out_map(
2723                 __isl_take isl_space *space,
2724                 enum isl_dim_type type,
2725                 unsigned first, unsigned n);
2727         #include <isl/polynomial.h>
2728         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
2729                 __isl_take isl_space *space);
2731 The following convenience functions first create a base expression and
2732 then create a piecewise expression over a given domain.
2734         #include <isl/aff.h>
2735         __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
2736                 __isl_take isl_set *domain,
2737                 __isl_take isl_val *v);
2738         __isl_give isl_pw_multi_aff *
2739         isl_pw_multi_aff_multi_val_on_domain(
2740                 __isl_take isl_set *domain,
2741                 __isl_take isl_multi_val *mv);
2743 As a convenience, a piecewise multiple expression can
2744 also be created from a piecewise expression.
2745 Each multiple expression in the result is derived
2746 from the corresponding base expression.
2748         #include <isl/aff.h>
2749         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
2750                 __isl_take isl_pw_aff *pa);
2752 Similarly, a piecewise quasipolynomial can be
2753 created from a piecewise quasi-affine expression using
2754 the following function.
2756         #include <isl/polynomial.h>
2757         __isl_give isl_pw_qpolynomial *
2758         isl_pw_qpolynomial_from_pw_aff(
2759                 __isl_take isl_pw_aff *pwaff);
2761 Piecewise expressions can be copied and freed using the following functions.
2763         #include <isl/aff.h>
2764         __isl_give isl_pw_aff *isl_pw_aff_copy(
2765                 __isl_keep isl_pw_aff *pwaff);
2766         __isl_null isl_pw_aff *isl_pw_aff_free(
2767                 __isl_take isl_pw_aff *pwaff);
2768         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
2769                 __isl_keep isl_pw_multi_aff *pma);
2770         __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
2771                 __isl_take isl_pw_multi_aff *pma);
2773         #include <isl/polynomial.h>
2774         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
2775                 __isl_keep isl_pw_qpolynomial *pwqp);
2776         __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
2777                 __isl_take isl_pw_qpolynomial *pwqp);
2778         __isl_give isl_pw_qpolynomial_fold *
2779         isl_pw_qpolynomial_fold_copy(
2780                 __isl_keep isl_pw_qpolynomial_fold *pwf);
2781         __isl_null isl_pw_qpolynomial_fold *
2782         isl_pw_qpolynomial_fold_free(
2783                 __isl_take isl_pw_qpolynomial_fold *pwf);
2785 To iterate over the different cells of a piecewise expression,
2786 use the following functions.
2788         #include <isl/aff.h>
2789         int isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
2790         int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
2791         int isl_pw_aff_foreach_piece(__isl_keep isl_pw_aff *pwaff,
2792                 int (*fn)(__isl_take isl_set *set,
2793                           __isl_take isl_aff *aff,
2794                           void *user), void *user);
2795         int isl_pw_multi_aff_foreach_piece(
2796                 __isl_keep isl_pw_multi_aff *pma,
2797                 int (*fn)(__isl_take isl_set *set,
2798                             __isl_take isl_multi_aff *maff,
2799                             void *user), void *user);
2801         #include <isl/polynomial.h>
2802         int isl_pw_qpolynomial_foreach_piece(
2803                 __isl_keep isl_pw_qpolynomial *pwqp,
2804                 int (*fn)(__isl_take isl_set *set,
2805                           __isl_take isl_qpolynomial *qp,
2806                           void *user), void *user);
2807         int isl_pw_qpolynomial_foreach_lifted_piece(
2808                 __isl_keep isl_pw_qpolynomial *pwqp,
2809                 int (*fn)(__isl_take isl_set *set,
2810                           __isl_take isl_qpolynomial *qp,
2811                           void *user), void *user);
2812         int isl_pw_qpolynomial_fold_foreach_piece(
2813                 __isl_keep isl_pw_qpolynomial_fold *pwf,
2814                 int (*fn)(__isl_take isl_set *set,
2815                           __isl_take isl_qpolynomial_fold *fold,
2816                           void *user), void *user);
2817         int isl_pw_qpolynomial_fold_foreach_lifted_piece(
2818                 __isl_keep isl_pw_qpolynomial_fold *pwf,
2819                 int (*fn)(__isl_take isl_set *set,
2820                           __isl_take isl_qpolynomial_fold *fold,
2821                           void *user), void *user);
2823 As usual, the function C<fn> should return C<0> on success
2824 and C<-1> on failure.  The difference between
2825 C<isl_pw_qpolynomial_foreach_piece> and
2826 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
2827 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
2828 compute unique representations for all existentially quantified
2829 variables and then turn these existentially quantified variables
2830 into extra set variables, adapting the associated quasipolynomial
2831 accordingly.  This means that the C<set> passed to C<fn>
2832 will not have any existentially quantified variables, but that
2833 the dimensions of the sets may be different for different
2834 invocations of C<fn>.
2835 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
2836 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
2838 A piecewise expression consisting of the expressions at a given
2839 position of a piecewise multiple expression can be extracted
2840 using the following function.
2842         #include <isl/aff.h>
2843         __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
2844                 __isl_keep isl_pw_multi_aff *pma, int pos);
2846 These expressions can be replaced using the following function.
2848         #include <isl/aff.h>
2849         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
2850                 __isl_take isl_pw_multi_aff *pma, unsigned pos,
2851                 __isl_take isl_pw_aff *pa);
2853 Note that there is a difference between C<isl_multi_pw_aff> and
2854 C<isl_pw_multi_aff> objects.  The first is a sequence of piecewise
2855 affine expressions, while the second is a piecewise sequence
2856 of affine expressions.  In particular, each of the piecewise
2857 affine expressions in an C<isl_multi_pw_aff> may have a different
2858 domain, while all multiple expressions associated to a cell
2859 in an C<isl_pw_multi_aff> have the same domain.
2860 It is possible to convert between the two, but when converting
2861 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
2862 of the result is the intersection of the domains of the input.
2863 The reverse conversion is exact.
2865         #include <isl/aff.h>
2866         __isl_give isl_pw_multi_aff *
2867         isl_pw_multi_aff_from_multi_pw_aff(
2868                 __isl_take isl_multi_pw_aff *mpa);
2869         __isl_give isl_multi_pw_aff *
2870         isl_multi_pw_aff_from_pw_multi_aff(
2871                 __isl_take isl_pw_multi_aff *pma);
2873 =head3 Union Expressions
2875 A union expression collects base expressions defined
2876 over different domains.  The space of a union expression
2877 is that of the shared parameter space.
2879 The union expression types defined by C<isl>
2880 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
2881 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
2883 An empty union expression can be created using the following functions.
2885         #include <isl/aff.h>
2886         __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
2887                 __isl_take isl_space *space);
2888         __isl_give isl_union_pw_multi_aff *
2889         isl_union_pw_multi_aff_empty(
2890                 __isl_take isl_space *space);
2892         #include <isl/polynomial.h>
2893         __isl_give isl_union_pw_qpolynomial *
2894         isl_union_pw_qpolynomial_zero(
2895                 __isl_take isl_space *space);
2897 A union expression containing a single base expression
2898 can be created using the following functions.
2900         #include <isl/aff.h>
2901         __isl_give isl_union_pw_aff *
2902         isl_union_pw_aff_from_pw_aff(
2903                 __isl_take isl_pw_aff *pa);
2904         __isl_give isl_union_pw_multi_aff *
2905         isl_union_pw_multi_aff_from_aff(
2906                 __isl_take isl_aff *aff);
2907         __isl_give isl_union_pw_multi_aff *
2908         isl_union_pw_multi_aff_from_pw_multi_aff(
2909                 __isl_take isl_pw_multi_aff *pma);
2911         #include <isl/polynomial.h>
2912         __isl_give isl_union_pw_qpolynomial *
2913         isl_union_pw_qpolynomial_from_pw_qpolynomial(
2914                 __isl_take isl_pw_qpolynomial *pwqp);
2916 The following functions create a base expression on each
2917 of the sets in the union set and collect the results.
2919         #include <isl/aff.h>
2920         __isl_give isl_union_pw_aff *
2921         isl_union_pw_multi_aff_get_union_pw_aff(
2922                 __isl_keep isl_union_pw_multi_aff *upma, int pos);
2923         __isl_give isl_union_pw_aff *
2924         isl_union_pw_aff_val_on_domain(
2925                 __isl_take isl_union_set *domain,
2926                 __isl_take isl_val *v);
2927         __isl_give isl_union_pw_multi_aff *
2928         isl_union_pw_multi_aff_multi_val_on_domain(
2929                 __isl_take isl_union_set *domain,
2930                 __isl_take isl_multi_val *mv);
2932 An C<isl_union_pw_aff> that is equal to a (parametric) affine
2933 expression on a given domain can be created using the following
2934 function.
2936         #include <isl/aff.h>
2937         __isl_give isl_union_pw_aff *
2938         isl_union_pw_aff_aff_on_domain(
2939                 __isl_take isl_union_set *domain,
2940                 __isl_take isl_aff *aff);
2942 A base expression can be added to a union expression using
2943 the following functions.
2945         #include <isl/aff.h>
2946         __isl_give isl_union_pw_aff *
2947         isl_union_pw_aff_add_pw_aff(
2948                 __isl_take isl_union_pw_aff *upa,
2949                 __isl_take isl_pw_aff *pa);
2950         __isl_give isl_union_pw_multi_aff *
2951         isl_union_pw_multi_aff_add_pw_multi_aff(
2952                 __isl_take isl_union_pw_multi_aff *upma,
2953                 __isl_take isl_pw_multi_aff *pma);
2955         #include <isl/polynomial.h>
2956         __isl_give isl_union_pw_qpolynomial *
2957         isl_union_pw_qpolynomial_add_pw_qpolynomial(
2958                 __isl_take isl_union_pw_qpolynomial *upwqp,
2959                 __isl_take isl_pw_qpolynomial *pwqp);
2961 Union expressions can be copied and freed using
2962 the following functions.
2964         #include <isl/aff.h>
2965         __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
2966                 __isl_keep isl_union_pw_aff *upa);
2967         __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
2968                 __isl_take isl_union_pw_aff *upa);
2969         __isl_give isl_union_pw_multi_aff *
2970         isl_union_pw_multi_aff_copy(
2971                 __isl_keep isl_union_pw_multi_aff *upma);
2972         __isl_null isl_union_pw_multi_aff *
2973         isl_union_pw_multi_aff_free(
2974                 __isl_take isl_union_pw_multi_aff *upma);
2976         #include <isl/polynomial.h>
2977         __isl_give isl_union_pw_qpolynomial *
2978         isl_union_pw_qpolynomial_copy(
2979                 __isl_keep isl_union_pw_qpolynomial *upwqp);
2980         __isl_null isl_union_pw_qpolynomial *
2981         isl_union_pw_qpolynomial_free(
2982                 __isl_take isl_union_pw_qpolynomial *upwqp);
2983         __isl_give isl_union_pw_qpolynomial_fold *
2984         isl_union_pw_qpolynomial_fold_copy(
2985                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
2986         __isl_null isl_union_pw_qpolynomial_fold *
2987         isl_union_pw_qpolynomial_fold_free(
2988                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
2990 To iterate over the base expressions in a union expression,
2991 use the following functions.
2993         #include <isl/aff.h>
2994         int isl_union_pw_aff_n_pw_multi_aff(
2995                 __isl_keep isl_union_pw_aff *upa);
2996         int isl_union_pw_aff_foreach_pw_aff(
2997                 __isl_keep isl_union_pw_aff *upa,
2998                 int (*fn)(__isl_take isl_pw_aff *ma, void *user),
2999                         void *user);
3000         int isl_union_pw_multi_aff_n_pw_multi_aff(
3001                 __isl_keep isl_union_pw_multi_aff *upma);
3002         int isl_union_pw_multi_aff_foreach_pw_multi_aff(
3003                 __isl_keep isl_union_pw_multi_aff *upma,
3004                 int (*fn)(__isl_take isl_pw_multi_aff *pma,
3005                             void *user), void *user);
3007         #include <isl/polynomial.h>
3008         int isl_union_pw_qplynomial_n_pw_qpolynomial(
3009                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3010         int isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3011                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3012                 int (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3013                             void *user), void *user);
3014         int isl_union_pw_qplynomial_fold_n_pw_qpolynomial_fold(
3015                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3016         int isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3017                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3018                 int (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3019                             void *user), void *user);
3021 To extract the base expression in a given space from a union, use
3022 the following functions.
3024         #include <isl/aff.h>
3025         __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3026                 __isl_keep isl_union_pw_aff *upa,
3027                 __isl_take isl_space *space);
3028         __isl_give isl_pw_multi_aff *
3029         isl_union_pw_multi_aff_extract_pw_multi_aff(
3030                 __isl_keep isl_union_pw_multi_aff *upma,
3031                 __isl_take isl_space *space);
3033         #include <isl/polynomial.h>
3034         __isl_give isl_pw_qpolynomial *
3035         isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3036                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3037                 __isl_take isl_space *space);
3039 =head2 Input and Output
3041 For set and relation,
3042 C<isl> supports its own input/output format, which is similar
3043 to the C<Omega> format, but also supports the C<PolyLib> format
3044 in some cases.
3045 For other object types, typically only an C<isl> format is supported.
3047 =head3 C<isl> format
3049 The C<isl> format is similar to that of C<Omega>, but has a different
3050 syntax for describing the parameters and allows for the definition
3051 of an existentially quantified variable as the integer division
3052 of an affine expression.
3053 For example, the set of integers C<i> between C<0> and C<n>
3054 such that C<i % 10 <= 6> can be described as
3056         [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3057                                 i - 10 a <= 6) }
3059 A set or relation can have several disjuncts, separated
3060 by the keyword C<or>.  Each disjunct is either a conjunction
3061 of constraints or a projection (C<exists>) of a conjunction
3062 of constraints.  The constraints are separated by the keyword
3063 C<and>.
3065 =head3 C<PolyLib> format
3067 If the represented set is a union, then the first line
3068 contains a single number representing the number of disjuncts.
3069 Otherwise, a line containing the number C<1> is optional.
3071 Each disjunct is represented by a matrix of constraints.
3072 The first line contains two numbers representing
3073 the number of rows and columns,
3074 where the number of rows is equal to the number of constraints
3075 and the number of columns is equal to two plus the number of variables.
3076 The following lines contain the actual rows of the constraint matrix.
3077 In each row, the first column indicates whether the constraint
3078 is an equality (C<0>) or inequality (C<1>).  The final column
3079 corresponds to the constant term.
3081 If the set is parametric, then the coefficients of the parameters
3082 appear in the last columns before the constant column.
3083 The coefficients of any existentially quantified variables appear
3084 between those of the set variables and those of the parameters.
3086 =head3 Extended C<PolyLib> format
3088 The extended C<PolyLib> format is nearly identical to the
3089 C<PolyLib> format.  The only difference is that the line
3090 containing the number of rows and columns of a constraint matrix
3091 also contains four additional numbers:
3092 the number of output dimensions, the number of input dimensions,
3093 the number of local dimensions (i.e., the number of existentially
3094 quantified variables) and the number of parameters.
3095 For sets, the number of ``output'' dimensions is equal
3096 to the number of set dimensions, while the number of ``input''
3097 dimensions is zero.
3099 =head3 Input
3101 Objects can be read from input using the following functions.
3103         #include <isl/val.h>
3104         __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3105                 const char *str);
3106         __isl_give isl_multi_val *isl_multi_val_read_from_str(
3107                 isl_ctx *ctx, const char *str);
3109         #include <isl/set.h>
3110         __isl_give isl_basic_set *isl_basic_set_read_from_file(
3111                 isl_ctx *ctx, FILE *input);
3112         __isl_give isl_basic_set *isl_basic_set_read_from_str(
3113                 isl_ctx *ctx, const char *str);
3114         __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3115                 FILE *input);
3116         __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3117                 const char *str);
3119         #include <isl/map.h>
3120         __isl_give isl_basic_map *isl_basic_map_read_from_file(
3121                 isl_ctx *ctx, FILE *input);
3122         __isl_give isl_basic_map *isl_basic_map_read_from_str(
3123                 isl_ctx *ctx, const char *str);
3124         __isl_give isl_map *isl_map_read_from_file(
3125                 isl_ctx *ctx, FILE *input);
3126         __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3127                 const char *str);
3129         #include <isl/union_set.h>
3130         __isl_give isl_union_set *isl_union_set_read_from_file(
3131                 isl_ctx *ctx, FILE *input);
3132         __isl_give isl_union_set *isl_union_set_read_from_str(
3133                 isl_ctx *ctx, const char *str);
3135         #include <isl/union_map.h>
3136         __isl_give isl_union_map *isl_union_map_read_from_file(
3137                 isl_ctx *ctx, FILE *input);
3138         __isl_give isl_union_map *isl_union_map_read_from_str(
3139                 isl_ctx *ctx, const char *str);
3141         #include <isl/aff.h>
3142         __isl_give isl_aff *isl_aff_read_from_str(
3143                 isl_ctx *ctx, const char *str);
3144         __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3145                 isl_ctx *ctx, const char *str);
3146         __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3147                 isl_ctx *ctx, const char *str);
3148         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3149                 isl_ctx *ctx, const char *str);
3150         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3151                 isl_ctx *ctx, const char *str);
3152         __isl_give isl_union_pw_multi_aff *
3153         isl_union_pw_multi_aff_read_from_str(
3154                 isl_ctx *ctx, const char *str);
3156         #include <isl/polynomial.h>
3157         __isl_give isl_union_pw_qpolynomial *
3158         isl_union_pw_qpolynomial_read_from_str(
3159                 isl_ctx *ctx, const char *str);
3161 For sets and relations,
3162 the input format is autodetected and may be either the C<PolyLib> format
3163 or the C<isl> format.
3165 =head3 Output
3167 Before anything can be printed, an C<isl_printer> needs to
3168 be created.
3170         __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3171                 FILE *file);
3172         __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3173         __isl_null isl_printer *isl_printer_free(
3174                 __isl_take isl_printer *printer);
3175         __isl_give char *isl_printer_get_str(
3176                 __isl_keep isl_printer *printer);
3178 The printer can be inspected using the following functions.
3180         FILE *isl_printer_get_file(
3181                 __isl_keep isl_printer *printer);
3182         int isl_printer_get_output_format(
3183                 __isl_keep isl_printer *p);
3185 The behavior of the printer can be modified in various ways
3187         __isl_give isl_printer *isl_printer_set_output_format(
3188                 __isl_take isl_printer *p, int output_format);
3189         __isl_give isl_printer *isl_printer_set_indent(
3190                 __isl_take isl_printer *p, int indent);
3191         __isl_give isl_printer *isl_printer_set_indent_prefix(
3192                 __isl_take isl_printer *p, const char *prefix);
3193         __isl_give isl_printer *isl_printer_indent(
3194                 __isl_take isl_printer *p, int indent);
3195         __isl_give isl_printer *isl_printer_set_prefix(
3196                 __isl_take isl_printer *p, const char *prefix);
3197         __isl_give isl_printer *isl_printer_set_suffix(
3198                 __isl_take isl_printer *p, const char *suffix);
3200 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3201 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3202 and defaults to C<ISL_FORMAT_ISL>.
3203 Each line in the output is prefixed by C<indent_prefix>,
3204 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3205 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3206 In the C<PolyLib> format output,
3207 the coefficients of the existentially quantified variables
3208 appear between those of the set variables and those
3209 of the parameters.
3210 The function C<isl_printer_indent> increases the indentation
3211 by the specified amount (which may be negative).
3213 To actually print something, use
3215         #include <isl/printer.h>
3216         __isl_give isl_printer *isl_printer_print_double(
3217                 __isl_take isl_printer *p, double d);
3219         #include <isl/val.h>
3220         __isl_give isl_printer *isl_printer_print_val(
3221                 __isl_take isl_printer *p, __isl_keep isl_val *v);
3223         #include <isl/set.h>
3224         __isl_give isl_printer *isl_printer_print_basic_set(
3225                 __isl_take isl_printer *printer,
3226                 __isl_keep isl_basic_set *bset);
3227         __isl_give isl_printer *isl_printer_print_set(
3228                 __isl_take isl_printer *printer,
3229                 __isl_keep isl_set *set);
3231         #include <isl/map.h>
3232         __isl_give isl_printer *isl_printer_print_basic_map(
3233                 __isl_take isl_printer *printer,
3234                 __isl_keep isl_basic_map *bmap);
3235         __isl_give isl_printer *isl_printer_print_map(
3236                 __isl_take isl_printer *printer,
3237                 __isl_keep isl_map *map);
3239         #include <isl/union_set.h>
3240         __isl_give isl_printer *isl_printer_print_union_set(
3241                 __isl_take isl_printer *p,
3242                 __isl_keep isl_union_set *uset);
3244         #include <isl/union_map.h>
3245         __isl_give isl_printer *isl_printer_print_union_map(
3246                 __isl_take isl_printer *p,
3247                 __isl_keep isl_union_map *umap);
3249         #include <isl/val.h>
3250         __isl_give isl_printer *isl_printer_print_multi_val(
3251                 __isl_take isl_printer *p,
3252                 __isl_keep isl_multi_val *mv);
3254         #include <isl/aff.h>
3255         __isl_give isl_printer *isl_printer_print_aff(
3256                 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3257         __isl_give isl_printer *isl_printer_print_multi_aff(
3258                 __isl_take isl_printer *p,
3259                 __isl_keep isl_multi_aff *maff);
3260         __isl_give isl_printer *isl_printer_print_pw_aff(
3261                 __isl_take isl_printer *p,
3262                 __isl_keep isl_pw_aff *pwaff);
3263         __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3264                 __isl_take isl_printer *p,
3265                 __isl_keep isl_pw_multi_aff *pma);
3266         __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3267                 __isl_take isl_printer *p,
3268                 __isl_keep isl_multi_pw_aff *mpa);
3269         __isl_give isl_printer *isl_printer_print_union_pw_aff(
3270                 __isl_take isl_printer *p,
3271                 __isl_keep isl_union_pw_aff *upa);
3272         __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3273                 __isl_take isl_printer *p,
3274                 __isl_keep isl_union_pw_multi_aff *upma);
3276         #include <isl/polynomial.h>
3277         __isl_give isl_printer *isl_printer_print_qpolynomial(
3278                 __isl_take isl_printer *p,
3279                 __isl_keep isl_qpolynomial *qp);
3280         __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3281                 __isl_take isl_printer *p,
3282                 __isl_keep isl_pw_qpolynomial *pwqp);
3283         __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3284                 __isl_take isl_printer *p,
3285                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3287         __isl_give isl_printer *
3288         isl_printer_print_pw_qpolynomial_fold(
3289                 __isl_take isl_printer *p,
3290                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3291         __isl_give isl_printer *
3292         isl_printer_print_union_pw_qpolynomial_fold(
3293                 __isl_take isl_printer *p,
3294                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3296 For C<isl_printer_print_qpolynomial>,
3297 C<isl_printer_print_pw_qpolynomial> and
3298 C<isl_printer_print_pw_qpolynomial_fold>,
3299 the output format of the printer
3300 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3301 For C<isl_printer_print_union_pw_qpolynomial> and
3302 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3303 is supported.
3304 In case of printing in C<ISL_FORMAT_C>, the user may want
3305 to set the names of all dimensions first.
3307 When called on a file printer, the following function flushes
3308 the file.  When called on a string printer, the buffer is cleared.
3310         __isl_give isl_printer *isl_printer_flush(
3311                 __isl_take isl_printer *p);
3313 Alternatively, a string representation can be obtained
3314 directly using the following functions, which always print
3315 in isl format.
3317         #include <isl/space.h>
3318         __isl_give char *isl_space_to_str(
3319                 __isl_keep isl_space *space);
3321         #include <isl/val.h>
3322         __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3323         __isl_give char *isl_multi_val_to_str(
3324                 __isl_keep isl_multi_val *mv);
3326         #include <isl/set.h>
3327         __isl_give char *isl_set_to_str(
3328                 __isl_keep isl_set *set);
3330         #include <isl/union_set.h>
3331         __isl_give char *isl_union_set_to_str(
3332                 __isl_keep isl_union_set *uset);
3334         #include <isl/map.h>
3335         __isl_give char *isl_map_to_str(
3336                 __isl_keep isl_map *map);
3338         #include <isl/union_map.h>
3339         __isl_give char *isl_union_map_to_str(
3340                 __isl_keep isl_union_map *umap);
3342         #include <isl/aff.h>
3343         __isl_give char *isl_multi_aff_to_str(
3344                 __isl_keep isl_multi_aff *aff);
3345         __isl_give char *isl_union_pw_aff_to_str(
3346                 __isl_keep isl_union_pw_aff *upa);
3347         __isl_give char *isl_union_pw_multi_aff_to_str(
3348                 __isl_keep isl_union_pw_multi_aff *upma);
3350 =head2 Properties
3352 =head3 Unary Properties
3354 =over
3356 =item * Emptiness
3358 The following functions test whether the given set or relation
3359 contains any integer points.  The ``plain'' variants do not perform
3360 any computations, but simply check if the given set or relation
3361 is already known to be empty.
3363         int isl_basic_set_plain_is_empty(__isl_keep isl_basic_set *bset);
3364         int isl_basic_set_is_empty(__isl_keep isl_basic_set *bset);
3365         int isl_set_plain_is_empty(__isl_keep isl_set *set);
3366         int isl_set_is_empty(__isl_keep isl_set *set);
3367         int isl_union_set_is_empty(__isl_keep isl_union_set *uset);
3368         int isl_basic_map_plain_is_empty(__isl_keep isl_basic_map *bmap);
3369         int isl_basic_map_is_empty(__isl_keep isl_basic_map *bmap);
3370         int isl_map_plain_is_empty(__isl_keep isl_map *map);
3371         int isl_map_is_empty(__isl_keep isl_map *map);
3372         int isl_union_map_is_empty(__isl_keep isl_union_map *umap);
3374 =item * Universality
3376         int isl_basic_set_is_universe(__isl_keep isl_basic_set *bset);
3377         int isl_basic_map_is_universe(__isl_keep isl_basic_map *bmap);
3378         int isl_set_plain_is_universe(__isl_keep isl_set *set);
3380 =item * Single-valuedness
3382         #include <isl/set.h>
3383         int isl_set_is_singleton(__isl_keep isl_set *set);
3385         #include <isl/map.h>
3386         int isl_basic_map_is_single_valued(
3387                 __isl_keep isl_basic_map *bmap);
3388         int isl_map_plain_is_single_valued(
3389                 __isl_keep isl_map *map);
3390         int isl_map_is_single_valued(__isl_keep isl_map *map);
3392         #include <isl/union_map.h>
3393         int isl_union_map_is_single_valued(__isl_keep isl_union_map *umap);
3395 =item * Injectivity
3397         int isl_map_plain_is_injective(__isl_keep isl_map *map);
3398         int isl_map_is_injective(__isl_keep isl_map *map);
3399         int isl_union_map_plain_is_injective(
3400                 __isl_keep isl_union_map *umap);
3401         int isl_union_map_is_injective(
3402                 __isl_keep isl_union_map *umap);
3404 =item * Bijectivity
3406         int isl_map_is_bijective(__isl_keep isl_map *map);
3407         int isl_union_map_is_bijective(__isl_keep isl_union_map *umap);
3409 =item * Position
3411         __isl_give isl_val *
3412         isl_basic_map_plain_get_val_if_fixed(
3413                 __isl_keep isl_basic_map *bmap,
3414                 enum isl_dim_type type, unsigned pos);
3415         __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3416                 __isl_keep isl_set *set,
3417                 enum isl_dim_type type, unsigned pos);
3418         __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3419                 __isl_keep isl_map *map,
3420                 enum isl_dim_type type, unsigned pos);
3422 If the set or relation obviously lies on a hyperplane where the given dimension
3423 has a fixed value, then return that value.
3424 Otherwise return NaN.
3426 =item * Stride
3428         int isl_set_dim_residue_class_val(
3429                 __isl_keep isl_set *set,
3430                 int pos, __isl_give isl_val **modulo,
3431                 __isl_give isl_val **residue);
3433 Check if the values of the given set dimension are equal to a fixed
3434 value modulo some integer value.  If so, assign the modulo to C<*modulo>
3435 and the fixed value to C<*residue>.  If the given dimension attains only
3436 a single value, then assign C<0> to C<*modulo> and the fixed value to
3437 C<*residue>.
3438 If the dimension does not attain only a single value and if no modulo
3439 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3441 =item * Dependence
3443 To check whether the description of a set, relation or function depends
3444 on one or more given dimensions,
3445 the following functions can be used.
3447         #include <isl/constraint.h>
3448         int isl_constraint_involves_dims(
3449                 __isl_keep isl_constraint *constraint,
3450                 enum isl_dim_type type, unsigned first, unsigned n);
3452         #include <isl/set.h>
3453         int isl_basic_set_involves_dims(
3454                 __isl_keep isl_basic_set *bset,
3455                 enum isl_dim_type type, unsigned first, unsigned n);
3456         int isl_set_involves_dims(__isl_keep isl_set *set,
3457                 enum isl_dim_type type, unsigned first, unsigned n);
3459         #include <isl/map.h>
3460         int isl_basic_map_involves_dims(
3461                 __isl_keep isl_basic_map *bmap,
3462                 enum isl_dim_type type, unsigned first, unsigned n);
3463         int isl_map_involves_dims(__isl_keep isl_map *map,
3464                 enum isl_dim_type type, unsigned first, unsigned n);
3466         #include <isl/union_map.h>
3467         int isl_union_map_involves_dims(
3468                 __isl_keep isl_union_map *umap,
3469                 enum isl_dim_type type, unsigned first, unsigned n);
3471         #include <isl/aff.h>
3472         int isl_aff_involves_dims(__isl_keep isl_aff *aff,
3473                 enum isl_dim_type type, unsigned first, unsigned n);
3474         int isl_pw_aff_involves_dims(__isl_keep isl_pw_aff *pwaff,
3475                 enum isl_dim_type type, unsigned first, unsigned n);
3476         int isl_multi_aff_involves_dims(
3477                 __isl_keep isl_multi_aff *ma,
3478                 enum isl_dim_type type, unsigned first, unsigned n);
3479         int isl_multi_pw_aff_involves_dims(
3480                 __isl_keep isl_multi_pw_aff *mpa,
3481                 enum isl_dim_type type, unsigned first, unsigned n);
3483 Similarly, the following functions can be used to check whether
3484 a given dimension is involved in any lower or upper bound.
3486         #include <isl/set.h>
3487         int isl_set_dim_has_any_lower_bound(__isl_keep isl_set *set,
3488                 enum isl_dim_type type, unsigned pos);
3489         int isl_set_dim_has_any_upper_bound(__isl_keep isl_set *set,
3490                 enum isl_dim_type type, unsigned pos);
3492 Note that these functions return true even if there is a bound on
3493 the dimension on only some of the basic sets of C<set>.
3494 To check if they have a bound for all of the basic sets in C<set>,
3495 use the following functions instead.
3497         #include <isl/set.h>
3498         int isl_set_dim_has_lower_bound(__isl_keep isl_set *set,
3499                 enum isl_dim_type type, unsigned pos);
3500         int isl_set_dim_has_upper_bound(__isl_keep isl_set *set,
3501                 enum isl_dim_type type, unsigned pos);
3503 =item * Space
3505 To check whether a set is a parameter domain, use this function:
3507         int isl_set_is_params(__isl_keep isl_set *set);
3508         int isl_union_set_is_params(
3509                 __isl_keep isl_union_set *uset);
3511 =item * Wrapping
3513 The following functions check whether the space of the given
3514 (basic) set or relation range is a wrapped relation.
3516         #include <isl/space.h>
3517         int isl_space_is_wrapping(
3518                 __isl_keep isl_space *space);
3519         int isl_space_domain_is_wrapping(
3520                 __isl_keep isl_space *space);
3521         int isl_space_range_is_wrapping(
3522                 __isl_keep isl_space *space);
3524         #include <isl/set.h>
3525         int isl_basic_set_is_wrapping(
3526                 __isl_keep isl_basic_set *bset);
3527         int isl_set_is_wrapping(__isl_keep isl_set *set);
3529         #include <isl/map.h>
3530         int isl_map_domain_is_wrapping(
3531                 __isl_keep isl_map *map);
3532         int isl_map_range_is_wrapping(
3533                 __isl_keep isl_map *map);
3535         #include <isl/val.h>
3536         int isl_multi_val_range_is_wrapping(
3537                 __isl_keep isl_multi_val *mv);
3539         #include <isl/aff.h>
3540         int isl_multi_aff_range_is_wrapping(
3541                 __isl_keep isl_multi_aff *ma);
3542         int isl_multi_pw_aff_range_is_wrapping(
3543                 __isl_keep isl_multi_pw_aff *mpa);
3545 The input to C<isl_space_is_wrapping> should
3546 be the space of a set, while that of
3547 C<isl_space_domain_is_wrapping> and
3548 C<isl_space_range_is_wrapping> should be the space of a relation.
3550 =item * Internal Product
3552         int isl_basic_map_can_zip(
3553                 __isl_keep isl_basic_map *bmap);
3554         int isl_map_can_zip(__isl_keep isl_map *map);
3556 Check whether the product of domain and range of the given relation
3557 can be computed,
3558 i.e., whether both domain and range are nested relations.
3560 =item * Currying
3562         int isl_basic_map_can_curry(
3563                 __isl_keep isl_basic_map *bmap);
3564         int isl_map_can_curry(__isl_keep isl_map *map);
3566 Check whether the domain of the (basic) relation is a wrapped relation.
3568         int isl_basic_map_can_uncurry(
3569                 __isl_keep isl_basic_map *bmap);
3570         int isl_map_can_uncurry(__isl_keep isl_map *map);
3572 Check whether the range of the (basic) relation is a wrapped relation.
3574 =item * Special Values
3576         #include <isl/aff.h>
3577         int isl_aff_is_cst(__isl_keep isl_aff *aff);
3578         int isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
3580 Check whether the given expression is a constant.
3582         #include <isl/aff.h>
3583         int isl_aff_is_nan(__isl_keep isl_aff *aff);
3584         int isl_pw_aff_involves_nan(__isl_keep isl_pw_aff *pa);
3586 Check whether the given expression is equal to or involves NaN.
3588         #include <isl/aff.h>
3589         int isl_aff_plain_is_zero(__isl_keep isl_aff *aff);
3591 Check whether the affine expression is obviously zero.
3593 =back
3595 =head3 Binary Properties
3597 =over
3599 =item * Equality
3601 The following functions check whether two objects
3602 represent the same set, relation or function.
3603 The C<plain> variants only return true if the objects
3604 are obviously the same.  That is, they may return false
3605 even if the objects are the same, but they will never
3606 return true if the objects are not the same.
3608         #include <isl/set.h>
3609         int isl_basic_set_plain_is_equal(
3610                 __isl_keep isl_basic_set *bset1,
3611                 __isl_keep isl_basic_set *bset2);
3612         int isl_set_plain_is_equal(__isl_keep isl_set *set1,
3613                 __isl_keep isl_set *set2);
3614         int isl_set_is_equal(__isl_keep isl_set *set1,
3615                 __isl_keep isl_set *set2);
3617         #include <isl/map.h>
3618         int isl_basic_map_is_equal(
3619                 __isl_keep isl_basic_map *bmap1,
3620                 __isl_keep isl_basic_map *bmap2);
3621         int isl_map_is_equal(__isl_keep isl_map *map1,
3622                 __isl_keep isl_map *map2);
3623         int isl_map_plain_is_equal(__isl_keep isl_map *map1,
3624                 __isl_keep isl_map *map2);
3626         #include <isl/union_set.h>
3627         int isl_union_set_is_equal(
3628                 __isl_keep isl_union_set *uset1,
3629                 __isl_keep isl_union_set *uset2);
3631         #include <isl/union_map.h>
3632         int isl_union_map_is_equal(
3633                 __isl_keep isl_union_map *umap1,
3634                 __isl_keep isl_union_map *umap2);
3636         #include <isl/aff.h>
3637         int isl_aff_plain_is_equal(__isl_keep isl_aff *aff1,
3638                 __isl_keep isl_aff *aff2);
3639         int isl_multi_aff_plain_is_equal(
3640                 __isl_keep isl_multi_aff *maff1,
3641                 __isl_keep isl_multi_aff *maff2);
3642         int isl_pw_aff_plain_is_equal(
3643                 __isl_keep isl_pw_aff *pwaff1,
3644                 __isl_keep isl_pw_aff *pwaff2);
3645         int isl_pw_multi_aff_plain_is_equal(
3646                 __isl_keep isl_pw_multi_aff *pma1,
3647                 __isl_keep isl_pw_multi_aff *pma2);
3648         int isl_multi_pw_aff_plain_is_equal(
3649                 __isl_keep isl_multi_pw_aff *mpa1,
3650                 __isl_keep isl_multi_pw_aff *mpa2);
3651         int isl_multi_pw_aff_is_equal(
3652                 __isl_keep isl_multi_pw_aff *mpa1,
3653                 __isl_keep isl_multi_pw_aff *mpa2);
3654         int isl_union_pw_aff_plain_is_equal(
3655                 __isl_keep isl_union_pw_aff *upa1,
3656                 __isl_keep isl_union_pw_aff *upa2);
3657         int isl_union_pw_multi_aff_plain_is_equal(
3658                 __isl_keep isl_union_pw_multi_aff *upma1,
3659                 __isl_keep isl_union_pw_multi_aff *upma2);
3661         #include <isl/polynomial.h>
3662         int isl_union_pw_qpolynomial_plain_is_equal(
3663                 __isl_keep isl_union_pw_qpolynomial *upwqp1,
3664                 __isl_keep isl_union_pw_qpolynomial *upwqp2);
3665         int isl_union_pw_qpolynomial_fold_plain_is_equal(
3666                 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
3667                 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
3669 =item * Disjointness
3671         #include <isl/set.h>
3672         int isl_basic_set_is_disjoint(
3673                 __isl_keep isl_basic_set *bset1,
3674                 __isl_keep isl_basic_set *bset2);
3675         int isl_set_plain_is_disjoint(__isl_keep isl_set *set1,
3676                 __isl_keep isl_set *set2);
3677         int isl_set_is_disjoint(__isl_keep isl_set *set1,
3678                 __isl_keep isl_set *set2);
3680         #include <isl/map.h>
3681         int isl_basic_map_is_disjoint(
3682                 __isl_keep isl_basic_map *bmap1,
3683                 __isl_keep isl_basic_map *bmap2);
3684         int isl_map_is_disjoint(__isl_keep isl_map *map1,
3685                 __isl_keep isl_map *map2);
3687         #include <isl/union_set.h>
3688         int isl_union_set_is_disjoint(
3689                 __isl_keep isl_union_set *uset1,
3690                 __isl_keep isl_union_set *uset2);
3692         #include <isl/union_map.h>
3693         int isl_union_map_is_disjoint(
3694                 __isl_keep isl_union_map *umap1,
3695                 __isl_keep isl_union_map *umap2);
3697 =item * Subset
3699         int isl_basic_set_is_subset(
3700                 __isl_keep isl_basic_set *bset1,
3701                 __isl_keep isl_basic_set *bset2);
3702         int isl_set_is_subset(__isl_keep isl_set *set1,
3703                 __isl_keep isl_set *set2);
3704         int isl_set_is_strict_subset(
3705                 __isl_keep isl_set *set1,
3706                 __isl_keep isl_set *set2);
3707         int isl_union_set_is_subset(
3708                 __isl_keep isl_union_set *uset1,
3709                 __isl_keep isl_union_set *uset2);
3710         int isl_union_set_is_strict_subset(
3711                 __isl_keep isl_union_set *uset1,
3712                 __isl_keep isl_union_set *uset2);
3713         int isl_basic_map_is_subset(
3714                 __isl_keep isl_basic_map *bmap1,
3715                 __isl_keep isl_basic_map *bmap2);
3716         int isl_basic_map_is_strict_subset(
3717                 __isl_keep isl_basic_map *bmap1,
3718                 __isl_keep isl_basic_map *bmap2);
3719         int isl_map_is_subset(
3720                 __isl_keep isl_map *map1,
3721                 __isl_keep isl_map *map2);
3722         int isl_map_is_strict_subset(
3723                 __isl_keep isl_map *map1,
3724                 __isl_keep isl_map *map2);
3725         int isl_union_map_is_subset(
3726                 __isl_keep isl_union_map *umap1,
3727                 __isl_keep isl_union_map *umap2);
3728         int isl_union_map_is_strict_subset(
3729                 __isl_keep isl_union_map *umap1,
3730                 __isl_keep isl_union_map *umap2);
3732 Check whether the first argument is a (strict) subset of the
3733 second argument.
3735 =item * Order
3737 Every comparison function returns a negative value if the first
3738 argument is considered smaller than the second, a positive value
3739 if the first argument is considered greater and zero if the two
3740 constraints are considered the same by the comparison criterion.
3742         #include <isl/constraint.h>
3743         int isl_constraint_plain_cmp(
3744                 __isl_keep isl_constraint *c1,
3745                 __isl_keep isl_constraint *c2);
3747 This function is useful for sorting C<isl_constraint>s.
3748 The order depends on the internal representation of the inputs.
3749 The order is fixed over different calls to the function (assuming
3750 the internal representation of the inputs has not changed), but may
3751 change over different versions of C<isl>.
3753         #include <isl/constraint.h>
3754         int isl_constraint_cmp_last_non_zero(
3755                 __isl_keep isl_constraint *c1,
3756                 __isl_keep isl_constraint *c2);
3758 This function can be used to sort constraints that live in the same
3759 local space.  Constraints that involve ``earlier'' dimensions or
3760 that have a smaller coefficient for the shared latest dimension
3761 are considered smaller than other constraints.
3762 This function only defines a B<partial> order.
3764         #include <isl/set.h>
3765         int isl_set_plain_cmp(__isl_keep isl_set *set1,
3766                 __isl_keep isl_set *set2);
3768 This function is useful for sorting C<isl_set>s.
3769 The order depends on the internal representation of the inputs.
3770 The order is fixed over different calls to the function (assuming
3771 the internal representation of the inputs has not changed), but may
3772 change over different versions of C<isl>.
3774         #include <isl/aff.h>
3775         int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
3776                 __isl_keep isl_pw_aff *pa2);
3778 The function C<isl_pw_aff_plain_cmp> can be used to sort
3779 C<isl_pw_aff>s.  The order is not strictly defined.
3780 The current order sorts expressions that only involve
3781 earlier dimensions before those that involve later dimensions.
3783 =back
3785 =head2 Unary Operations
3787 =over
3789 =item * Complement
3791         __isl_give isl_set *isl_set_complement(
3792                 __isl_take isl_set *set);
3793         __isl_give isl_map *isl_map_complement(
3794                 __isl_take isl_map *map);
3796 =item * Inverse map
3798         #include <isl/space.h>
3799         __isl_give isl_space *isl_space_reverse(
3800                 __isl_take isl_space *space);
3802         #include <isl/map.h>
3803         __isl_give isl_basic_map *isl_basic_map_reverse(
3804                 __isl_take isl_basic_map *bmap);
3805         __isl_give isl_map *isl_map_reverse(
3806                 __isl_take isl_map *map);
3808         #include <isl/union_map.h>
3809         __isl_give isl_union_map *isl_union_map_reverse(
3810                 __isl_take isl_union_map *umap);
3812 =item * Projection
3814         #include <isl/space.h>
3815         __isl_give isl_space *isl_space_domain(
3816                 __isl_take isl_space *space);
3817         __isl_give isl_space *isl_space_range(
3818                 __isl_take isl_space *space);
3819         __isl_give isl_space *isl_space_params(
3820                 __isl_take isl_space *space);
3822         #include <isl/local_space.h>
3823         __isl_give isl_local_space *isl_local_space_domain(
3824                 __isl_take isl_local_space *ls);
3825         __isl_give isl_local_space *isl_local_space_range(
3826                 __isl_take isl_local_space *ls);
3828         #include <isl/set.h>
3829         __isl_give isl_basic_set *isl_basic_set_project_out(
3830                 __isl_take isl_basic_set *bset,
3831                 enum isl_dim_type type, unsigned first, unsigned n);
3832         __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
3833                 enum isl_dim_type type, unsigned first, unsigned n);
3834         __isl_give isl_basic_set *isl_basic_set_params(
3835                 __isl_take isl_basic_set *bset);
3836         __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
3838         #include <isl/map.h>
3839         __isl_give isl_basic_map *isl_basic_map_project_out(
3840                 __isl_take isl_basic_map *bmap,
3841                 enum isl_dim_type type, unsigned first, unsigned n);
3842         __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
3843                 enum isl_dim_type type, unsigned first, unsigned n);
3844         __isl_give isl_basic_set *isl_basic_map_domain(
3845                 __isl_take isl_basic_map *bmap);
3846         __isl_give isl_basic_set *isl_basic_map_range(
3847                 __isl_take isl_basic_map *bmap);
3848         __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
3849         __isl_give isl_set *isl_map_domain(
3850                 __isl_take isl_map *bmap);
3851         __isl_give isl_set *isl_map_range(
3852                 __isl_take isl_map *map);
3854         #include <isl/union_set.h>
3855         __isl_give isl_union_set *isl_union_set_project_out(
3856                 __isl_take isl_union_set *uset,
3857                 enum isl_dim_type type,
3858                 unsigned first, unsigned n);
3859         __isl_give isl_set *isl_union_set_params(
3860                 __isl_take isl_union_set *uset);
3862 The function C<isl_union_set_project_out> can only project out
3863 parameters.
3865         #include <isl/union_map.h>
3866         __isl_give isl_union_map *isl_union_map_project_out(
3867                 __isl_take isl_union_map *umap,
3868                 enum isl_dim_type type, unsigned first, unsigned n);
3869         __isl_give isl_set *isl_union_map_params(
3870                 __isl_take isl_union_map *umap);
3871         __isl_give isl_union_set *isl_union_map_domain(
3872                 __isl_take isl_union_map *umap);
3873         __isl_give isl_union_set *isl_union_map_range(
3874                 __isl_take isl_union_map *umap);
3876 The function C<isl_union_map_project_out> can only project out
3877 parameters.
3879         #include <isl/aff.h>
3880         __isl_give isl_aff *isl_aff_project_domain_on_params(
3881                 __isl_take isl_aff *aff);
3882         __isl_give isl_pw_multi_aff *
3883         isl_pw_multi_aff_project_domain_on_params(
3884                 __isl_take isl_pw_multi_aff *pma);
3885         __isl_give isl_set *isl_pw_aff_domain(
3886                 __isl_take isl_pw_aff *pwaff);
3887         __isl_give isl_set *isl_pw_multi_aff_domain(
3888                 __isl_take isl_pw_multi_aff *pma);
3889         __isl_give isl_set *isl_multi_pw_aff_domain(
3890                 __isl_take isl_multi_pw_aff *mpa);
3891         __isl_give isl_union_set *isl_union_pw_aff_domain(
3892                 __isl_take isl_union_pw_aff *upa);
3893         __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
3894                 __isl_take isl_union_pw_multi_aff *upma);
3895         __isl_give isl_set *isl_pw_aff_params(
3896                 __isl_take isl_pw_aff *pwa);
3898         #include <isl/polynomial.h>
3899         __isl_give isl_qpolynomial *
3900         isl_qpolynomial_project_domain_on_params(
3901                 __isl_take isl_qpolynomial *qp);
3902         __isl_give isl_pw_qpolynomial *
3903         isl_pw_qpolynomial_project_domain_on_params(
3904                 __isl_take isl_pw_qpolynomial *pwqp);
3905         __isl_give isl_pw_qpolynomial_fold *
3906         isl_pw_qpolynomial_fold_project_domain_on_params(
3907                 __isl_take isl_pw_qpolynomial_fold *pwf);
3908         __isl_give isl_set *isl_pw_qpolynomial_domain(
3909                 __isl_take isl_pw_qpolynomial *pwqp);
3910         __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
3911                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3912         __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
3913                 __isl_take isl_union_pw_qpolynomial *upwqp);
3915         #include <isl/space.h>
3916         __isl_give isl_space *isl_space_domain_map(
3917                 __isl_take isl_space *space);
3918         __isl_give isl_space *isl_space_range_map(
3919                 __isl_take isl_space *space);
3921         #include <isl/map.h>
3922         __isl_give isl_map *isl_set_wrapped_domain_map(
3923                 __isl_take isl_set *set);
3924         __isl_give isl_basic_map *isl_basic_map_domain_map(
3925                 __isl_take isl_basic_map *bmap);
3926         __isl_give isl_basic_map *isl_basic_map_range_map(
3927                 __isl_take isl_basic_map *bmap);
3928         __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
3929         __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
3931         #include <isl/union_map.h>
3932         __isl_give isl_union_map *isl_union_map_domain_map(
3933                 __isl_take isl_union_map *umap);
3934         __isl_give isl_union_pw_multi_aff *
3935         isl_union_map_domain_map_union_pw_multi_aff(
3936                 __isl_take isl_union_map *umap);
3937         __isl_give isl_union_map *isl_union_map_range_map(
3938                 __isl_take isl_union_map *umap);
3939         __isl_give isl_union_map *
3940         isl_union_set_wrapped_domain_map(
3941                 __isl_take isl_union_set *uset);
3943 The functions above construct a (basic, regular or union) relation
3944 that maps (a wrapped version of) the input relation to its domain or range.
3945 C<isl_set_wrapped_domain_map> maps the input set to the domain
3946 of its wrapped relation.
3948 =item * Elimination
3950         __isl_give isl_basic_set *isl_basic_set_eliminate(
3951                 __isl_take isl_basic_set *bset,
3952                 enum isl_dim_type type,
3953                 unsigned first, unsigned n);
3954         __isl_give isl_set *isl_set_eliminate(
3955                 __isl_take isl_set *set, enum isl_dim_type type,
3956                 unsigned first, unsigned n);
3957         __isl_give isl_basic_map *isl_basic_map_eliminate(
3958                 __isl_take isl_basic_map *bmap,
3959                 enum isl_dim_type type,
3960                 unsigned first, unsigned n);
3961         __isl_give isl_map *isl_map_eliminate(
3962                 __isl_take isl_map *map, enum isl_dim_type type,
3963                 unsigned first, unsigned n);
3965 Eliminate the coefficients for the given dimensions from the constraints,
3966 without removing the dimensions.
3968 =item * Constructing a set from a parameter domain
3970 A zero-dimensional space or (basic) set can be constructed
3971 on a given parameter domain using the following functions.
3973         #include <isl/space.h>
3974         __isl_give isl_space *isl_space_set_from_params(
3975                 __isl_take isl_space *space);
3977         #include <isl/set.h>
3978         __isl_give isl_basic_set *isl_basic_set_from_params(
3979                 __isl_take isl_basic_set *bset);
3980         __isl_give isl_set *isl_set_from_params(
3981                 __isl_take isl_set *set);
3983 =item * Constructing a relation from a set
3985 Create a relation with the given set as domain or range.
3986 The range or domain of the created relation is a zero-dimensional
3987 flat anonymous space.
3989         #include <isl/space.h>
3990         __isl_give isl_space *isl_space_from_domain(
3991                 __isl_take isl_space *space);
3992         __isl_give isl_space *isl_space_from_range(
3993                 __isl_take isl_space *space);
3994         __isl_give isl_space *isl_space_map_from_set(
3995                 __isl_take isl_space *space);
3996         __isl_give isl_space *isl_space_map_from_domain_and_range(
3997                 __isl_take isl_space *domain,
3998                 __isl_take isl_space *range);
4000         #include <isl/local_space.h>
4001         __isl_give isl_local_space *isl_local_space_from_domain(
4002                 __isl_take isl_local_space *ls);
4004         #include <isl/map.h>
4005         __isl_give isl_map *isl_map_from_domain(
4006                 __isl_take isl_set *set);
4007         __isl_give isl_map *isl_map_from_range(
4008                 __isl_take isl_set *set);
4010         #include <isl/val.h>
4011         __isl_give isl_multi_val *isl_multi_val_from_range(
4012                 __isl_take isl_multi_val *mv);
4014         #include <isl/aff.h>
4015         __isl_give isl_multi_aff *isl_multi_aff_from_range(
4016                 __isl_take isl_multi_aff *ma);
4017         __isl_give isl_pw_aff *isl_pw_aff_from_range(
4018                 __isl_take isl_pw_aff *pwa);
4019         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
4020                 __isl_take isl_multi_pw_aff *mpa);
4021         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
4022                 __isl_take isl_set *set);
4023         __isl_give isl_union_pw_multi_aff *
4024         isl_union_pw_multi_aff_from_domain(
4025                 __isl_take isl_union_set *uset);
4027 =item * Slicing
4029         #include <isl/set.h>
4030         __isl_give isl_basic_set *isl_basic_set_fix_si(
4031                 __isl_take isl_basic_set *bset,
4032                 enum isl_dim_type type, unsigned pos, int value);
4033         __isl_give isl_basic_set *isl_basic_set_fix_val(
4034                 __isl_take isl_basic_set *bset,
4035                 enum isl_dim_type type, unsigned pos,
4036                 __isl_take isl_val *v);
4037         __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
4038                 enum isl_dim_type type, unsigned pos, int value);
4039         __isl_give isl_set *isl_set_fix_val(
4040                 __isl_take isl_set *set,
4041                 enum isl_dim_type type, unsigned pos,
4042                 __isl_take isl_val *v);
4044         #include <isl/map.h>
4045         __isl_give isl_basic_map *isl_basic_map_fix_si(
4046                 __isl_take isl_basic_map *bmap,
4047                 enum isl_dim_type type, unsigned pos, int value);
4048         __isl_give isl_basic_map *isl_basic_map_fix_val(
4049                 __isl_take isl_basic_map *bmap,
4050                 enum isl_dim_type type, unsigned pos,
4051                 __isl_take isl_val *v);
4052         __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
4053                 enum isl_dim_type type, unsigned pos, int value);
4054         __isl_give isl_map *isl_map_fix_val(
4055                 __isl_take isl_map *map,
4056                 enum isl_dim_type type, unsigned pos,
4057                 __isl_take isl_val *v);
4059         #include <isl/aff.h>
4060         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
4061                 __isl_take isl_pw_multi_aff *pma,
4062                 enum isl_dim_type type, unsigned pos, int value);
4064         #include <isl/polynomial.h>
4065         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
4066                 __isl_take isl_pw_qpolynomial *pwqp,
4067                 enum isl_dim_type type, unsigned n,
4068                 __isl_take isl_val *v);
4070 Intersect the set, relation or function domain
4071 with the hyperplane where the given
4072 dimension has the fixed given value.
4074         __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
4075                 __isl_take isl_basic_map *bmap,
4076                 enum isl_dim_type type, unsigned pos, int value);
4077         __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
4078                 __isl_take isl_basic_map *bmap,
4079                 enum isl_dim_type type, unsigned pos, int value);
4080         __isl_give isl_set *isl_set_lower_bound_si(
4081                 __isl_take isl_set *set,
4082                 enum isl_dim_type type, unsigned pos, int value);
4083         __isl_give isl_set *isl_set_lower_bound_val(
4084                 __isl_take isl_set *set,
4085                 enum isl_dim_type type, unsigned pos,
4086                 __isl_take isl_val *value);
4087         __isl_give isl_map *isl_map_lower_bound_si(
4088                 __isl_take isl_map *map,
4089                 enum isl_dim_type type, unsigned pos, int value);
4090         __isl_give isl_set *isl_set_upper_bound_si(
4091                 __isl_take isl_set *set,
4092                 enum isl_dim_type type, unsigned pos, int value);
4093         __isl_give isl_set *isl_set_upper_bound_val(
4094                 __isl_take isl_set *set,
4095                 enum isl_dim_type type, unsigned pos,
4096                 __isl_take isl_val *value);
4097         __isl_give isl_map *isl_map_upper_bound_si(
4098                 __isl_take isl_map *map,
4099                 enum isl_dim_type type, unsigned pos, int value);
4101 Intersect the set or relation with the half-space where the given
4102 dimension has a value bounded by the fixed given integer value.
4104         __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
4105                 enum isl_dim_type type1, int pos1,
4106                 enum isl_dim_type type2, int pos2);
4107         __isl_give isl_basic_map *isl_basic_map_equate(
4108                 __isl_take isl_basic_map *bmap,
4109                 enum isl_dim_type type1, int pos1,
4110                 enum isl_dim_type type2, int pos2);
4111         __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
4112                 enum isl_dim_type type1, int pos1,
4113                 enum isl_dim_type type2, int pos2);
4115 Intersect the set or relation with the hyperplane where the given
4116 dimensions are equal to each other.
4118         __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4119                 enum isl_dim_type type1, int pos1,
4120                 enum isl_dim_type type2, int pos2);
4122 Intersect the relation with the hyperplane where the given
4123 dimensions have opposite values.
4125         __isl_give isl_map *isl_map_order_le(
4126                 __isl_take isl_map *map,
4127                 enum isl_dim_type type1, int pos1,
4128                 enum isl_dim_type type2, int pos2);
4129         __isl_give isl_basic_map *isl_basic_map_order_ge(
4130                 __isl_take isl_basic_map *bmap,
4131                 enum isl_dim_type type1, int pos1,
4132                 enum isl_dim_type type2, int pos2);
4133         __isl_give isl_map *isl_map_order_ge(
4134                 __isl_take isl_map *map,
4135                 enum isl_dim_type type1, int pos1,
4136                 enum isl_dim_type type2, int pos2);
4137         __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4138                 enum isl_dim_type type1, int pos1,
4139                 enum isl_dim_type type2, int pos2);
4140         __isl_give isl_basic_map *isl_basic_map_order_gt(
4141                 __isl_take isl_basic_map *bmap,
4142                 enum isl_dim_type type1, int pos1,
4143                 enum isl_dim_type type2, int pos2);
4144         __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4145                 enum isl_dim_type type1, int pos1,
4146                 enum isl_dim_type type2, int pos2);
4148 Intersect the relation with the half-space where the given
4149 dimensions satisfy the given ordering.
4151 =item * Locus
4153         #include <isl/aff.h>
4154         __isl_give isl_basic_set *isl_aff_zero_basic_set(
4155                 __isl_take isl_aff *aff);
4156         __isl_give isl_basic_set *isl_aff_neg_basic_set(
4157                 __isl_take isl_aff *aff);
4158         __isl_give isl_set *isl_pw_aff_pos_set(
4159                 __isl_take isl_pw_aff *pa);
4160         __isl_give isl_set *isl_pw_aff_nonneg_set(
4161                 __isl_take isl_pw_aff *pwaff);
4162         __isl_give isl_set *isl_pw_aff_zero_set(
4163                 __isl_take isl_pw_aff *pwaff);
4164         __isl_give isl_set *isl_pw_aff_non_zero_set(
4165                 __isl_take isl_pw_aff *pwaff);
4167 The function C<isl_aff_neg_basic_set> returns a basic set
4168 containing those elements in the domain space
4169 of C<aff> where C<aff> is negative.
4170 The function C<isl_pw_aff_nonneg_set> returns a set
4171 containing those elements in the domain
4172 of C<pwaff> where C<pwaff> is non-negative.
4174 =item * Identity
4176         __isl_give isl_map *isl_set_identity(
4177                 __isl_take isl_set *set);
4178         __isl_give isl_union_map *isl_union_set_identity(
4179                 __isl_take isl_union_set *uset);
4180         __isl_give isl_union_pw_multi_aff *
4181         isl_union_set_identity_union_pw_multi_aff(
4182                 __isl_take isl_union_set *uset);
4184 Construct an identity relation on the given (union) set.
4186 =item * Function Extraction
4188 A piecewise quasi affine expression that is equal to 1 on a set
4189 and 0 outside the set can be created using the following function.
4191         #include <isl/aff.h>
4192         __isl_give isl_pw_aff *isl_set_indicator_function(
4193                 __isl_take isl_set *set);
4195 A piecewise multiple quasi affine expression can be extracted
4196 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4197 and the C<isl_map> is single-valued.
4198 In case of a conversion from an C<isl_union_map>
4199 to an C<isl_union_pw_multi_aff>, these properties need to hold
4200 in each domain space.
4202         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4203                 __isl_take isl_set *set);
4204         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4205                 __isl_take isl_map *map);
4207         __isl_give isl_union_pw_multi_aff *
4208         isl_union_pw_multi_aff_from_union_set(
4209                 __isl_take isl_union_set *uset);
4210         __isl_give isl_union_pw_multi_aff *
4211         isl_union_pw_multi_aff_from_union_map(
4212                 __isl_take isl_union_map *umap);
4214 =item * Deltas
4216         __isl_give isl_basic_set *isl_basic_map_deltas(
4217                 __isl_take isl_basic_map *bmap);
4218         __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
4219         __isl_give isl_union_set *isl_union_map_deltas(
4220                 __isl_take isl_union_map *umap);
4222 These functions return a (basic) set containing the differences
4223 between image elements and corresponding domain elements in the input.
4225         __isl_give isl_basic_map *isl_basic_map_deltas_map(
4226                 __isl_take isl_basic_map *bmap);
4227         __isl_give isl_map *isl_map_deltas_map(
4228                 __isl_take isl_map *map);
4229         __isl_give isl_union_map *isl_union_map_deltas_map(
4230                 __isl_take isl_union_map *umap);
4232 The functions above construct a (basic, regular or union) relation
4233 that maps (a wrapped version of) the input relation to its delta set.
4235 =item * Coalescing
4237 Simplify the representation of a set, relation or functions by trying
4238 to combine pairs of basic sets or relations into a single
4239 basic set or relation.
4241         #include <isl/set.h>
4242         __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
4244         #include <isl/map.h>
4245         __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
4247         #include <isl/union_set.h>
4248         __isl_give isl_union_set *isl_union_set_coalesce(
4249                 __isl_take isl_union_set *uset);
4251         #include <isl/union_map.h>
4252         __isl_give isl_union_map *isl_union_map_coalesce(
4253                 __isl_take isl_union_map *umap);
4255         #include <isl/aff.h>
4256         __isl_give isl_pw_aff *isl_pw_aff_coalesce(
4257                 __isl_take isl_pw_aff *pwqp);
4258         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
4259                 __isl_take isl_pw_multi_aff *pma);
4260         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
4261                 __isl_take isl_multi_pw_aff *mpa);
4262         __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
4263                 __isl_take isl_union_pw_aff *upa);
4264         __isl_give isl_union_pw_multi_aff *
4265         isl_union_pw_multi_aff_coalesce(
4266                 __isl_take isl_union_pw_multi_aff *upma);
4268         #include <isl/polynomial.h>
4269         __isl_give isl_pw_qpolynomial_fold *
4270         isl_pw_qpolynomial_fold_coalesce(
4271                 __isl_take isl_pw_qpolynomial_fold *pwf);
4272         __isl_give isl_union_pw_qpolynomial *
4273         isl_union_pw_qpolynomial_coalesce(
4274                 __isl_take isl_union_pw_qpolynomial *upwqp);
4275         __isl_give isl_union_pw_qpolynomial_fold *
4276         isl_union_pw_qpolynomial_fold_coalesce(
4277                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4279 One of the methods for combining pairs of basic sets or relations
4280 can result in coefficients that are much larger than those that appear
4281 in the constraints of the input.  By default, the coefficients are
4282 not allowed to grow larger, but this can be changed by unsetting
4283 the following option.
4285         int isl_options_set_coalesce_bounded_wrapping(
4286                 isl_ctx *ctx, int val);
4287         int isl_options_get_coalesce_bounded_wrapping(
4288                 isl_ctx *ctx);
4290 =item * Detecting equalities
4292         __isl_give isl_basic_set *isl_basic_set_detect_equalities(
4293                 __isl_take isl_basic_set *bset);
4294         __isl_give isl_basic_map *isl_basic_map_detect_equalities(
4295                 __isl_take isl_basic_map *bmap);
4296         __isl_give isl_set *isl_set_detect_equalities(
4297                 __isl_take isl_set *set);
4298         __isl_give isl_map *isl_map_detect_equalities(
4299                 __isl_take isl_map *map);
4300         __isl_give isl_union_set *isl_union_set_detect_equalities(
4301                 __isl_take isl_union_set *uset);
4302         __isl_give isl_union_map *isl_union_map_detect_equalities(
4303                 __isl_take isl_union_map *umap);
4305 Simplify the representation of a set or relation by detecting implicit
4306 equalities.
4308 =item * Removing redundant constraints
4310         #include <isl/set.h>
4311         __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
4312                 __isl_take isl_basic_set *bset);
4313         __isl_give isl_set *isl_set_remove_redundancies(
4314                 __isl_take isl_set *set);
4316         #include <isl/union_set.h>
4317         __isl_give isl_union_set *
4318         isl_union_set_remove_redundancies(
4319                 __isl_take isl_union_set *uset);
4321         #include <isl/map.h>
4322         __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
4323                 __isl_take isl_basic_map *bmap);
4324         __isl_give isl_map *isl_map_remove_redundancies(
4325                 __isl_take isl_map *map);
4327         #include <isl/union_map.h>
4328         __isl_give isl_union_map *
4329         isl_union_map_remove_redundancies(
4330                 __isl_take isl_union_map *umap);
4332 =item * Convex hull
4334         __isl_give isl_basic_set *isl_set_convex_hull(
4335                 __isl_take isl_set *set);
4336         __isl_give isl_basic_map *isl_map_convex_hull(
4337                 __isl_take isl_map *map);
4339 If the input set or relation has any existentially quantified
4340 variables, then the result of these operations is currently undefined.
4342 =item * Simple hull
4344         #include <isl/set.h>
4345         __isl_give isl_basic_set *
4346         isl_set_unshifted_simple_hull(
4347                 __isl_take isl_set *set);
4348         __isl_give isl_basic_set *isl_set_simple_hull(
4349                 __isl_take isl_set *set);
4350         __isl_give isl_basic_set *
4351         isl_set_unshifted_simple_hull_from_set_list(
4352                 __isl_take isl_set *set,
4353                 __isl_take isl_set_list *list);
4355         #include <isl/map.h>
4356         __isl_give isl_basic_map *
4357         isl_map_unshifted_simple_hull(
4358                 __isl_take isl_map *map);
4359         __isl_give isl_basic_map *isl_map_simple_hull(
4360                 __isl_take isl_map *map);
4361         __isl_give isl_basic_map *
4362         isl_map_unshifted_simple_hull_from_map_list(
4363                 __isl_take isl_map *map,
4364                 __isl_take isl_map_list *list);
4366         #include <isl/union_map.h>
4367         __isl_give isl_union_map *isl_union_map_simple_hull(
4368                 __isl_take isl_union_map *umap);
4370 These functions compute a single basic set or relation
4371 that contains the whole input set or relation.
4372 In particular, the output is described by translates
4373 of the constraints describing the basic sets or relations in the input.
4374 In case of C<isl_set_unshifted_simple_hull>, only the original
4375 constraints are used, without any translation.
4376 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
4377 C<isl_map_unshifted_simple_hull_from_map_list>, the
4378 constraints are taken from the elements of the second argument.
4380 =begin latex
4382 (See \autoref{s:simple hull}.)
4384 =end latex
4386 =item * Affine hull
4388         __isl_give isl_basic_set *isl_basic_set_affine_hull(
4389                 __isl_take isl_basic_set *bset);
4390         __isl_give isl_basic_set *isl_set_affine_hull(
4391                 __isl_take isl_set *set);
4392         __isl_give isl_union_set *isl_union_set_affine_hull(
4393                 __isl_take isl_union_set *uset);
4394         __isl_give isl_basic_map *isl_basic_map_affine_hull(
4395                 __isl_take isl_basic_map *bmap);
4396         __isl_give isl_basic_map *isl_map_affine_hull(
4397                 __isl_take isl_map *map);
4398         __isl_give isl_union_map *isl_union_map_affine_hull(
4399                 __isl_take isl_union_map *umap);
4401 In case of union sets and relations, the affine hull is computed
4402 per space.
4404 =item * Polyhedral hull
4406         __isl_give isl_basic_set *isl_set_polyhedral_hull(
4407                 __isl_take isl_set *set);
4408         __isl_give isl_basic_map *isl_map_polyhedral_hull(
4409                 __isl_take isl_map *map);
4410         __isl_give isl_union_set *isl_union_set_polyhedral_hull(
4411                 __isl_take isl_union_set *uset);
4412         __isl_give isl_union_map *isl_union_map_polyhedral_hull(
4413                 __isl_take isl_union_map *umap);
4415 These functions compute a single basic set or relation
4416 not involving any existentially quantified variables
4417 that contains the whole input set or relation.
4418 In case of union sets and relations, the polyhedral hull is computed
4419 per space.
4421 =item * Other approximations
4423         #include <isl/set.h>
4424         __isl_give isl_basic_set *
4425         isl_basic_set_drop_constraints_involving_dims(
4426                 __isl_take isl_basic_set *bset,
4427                 enum isl_dim_type type,
4428                 unsigned first, unsigned n);
4429         __isl_give isl_basic_set *
4430         isl_basic_set_drop_constraints_not_involving_dims(
4431                 __isl_take isl_basic_set *bset,
4432                 enum isl_dim_type type,
4433                 unsigned first, unsigned n);
4434         __isl_give isl_set *
4435         isl_set_drop_constraints_involving_dims(
4436                 __isl_take isl_set *set,
4437                 enum isl_dim_type type,
4438                 unsigned first, unsigned n);
4440         #include <isl/map.h>
4441         __isl_give isl_basic_map *
4442         isl_basic_map_drop_constraints_involving_dims(
4443                 __isl_take isl_basic_map *bmap,
4444                 enum isl_dim_type type,
4445                 unsigned first, unsigned n);
4446         __isl_give isl_map *
4447         isl_map_drop_constraints_involving_dims(
4448                 __isl_take isl_map *map,
4449                 enum isl_dim_type type,
4450                 unsigned first, unsigned n);
4452 These functions drop any constraints (not) involving the specified dimensions.
4453 Note that the result depends on the representation of the input.
4455         #include <isl/polynomial.h>
4456         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
4457                 __isl_take isl_pw_qpolynomial *pwqp, int sign);
4458         __isl_give isl_union_pw_qpolynomial *
4459         isl_union_pw_qpolynomial_to_polynomial(
4460                 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
4462 Approximate each quasipolynomial by a polynomial.  If C<sign> is positive,
4463 the polynomial will be an overapproximation.  If C<sign> is negative,
4464 it will be an underapproximation.  If C<sign> is zero, the approximation
4465 will lie somewhere in between.
4467 =item * Feasibility
4469         __isl_give isl_basic_set *isl_basic_set_sample(
4470                 __isl_take isl_basic_set *bset);
4471         __isl_give isl_basic_set *isl_set_sample(
4472                 __isl_take isl_set *set);
4473         __isl_give isl_basic_map *isl_basic_map_sample(
4474                 __isl_take isl_basic_map *bmap);
4475         __isl_give isl_basic_map *isl_map_sample(
4476                 __isl_take isl_map *map);
4478 If the input (basic) set or relation is non-empty, then return
4479 a singleton subset of the input.  Otherwise, return an empty set.
4481 =item * Optimization
4483         #include <isl/ilp.h>
4484         __isl_give isl_val *isl_basic_set_max_val(
4485                 __isl_keep isl_basic_set *bset,
4486                 __isl_keep isl_aff *obj);
4487         __isl_give isl_val *isl_set_min_val(
4488                 __isl_keep isl_set *set,
4489                 __isl_keep isl_aff *obj);
4490         __isl_give isl_val *isl_set_max_val(
4491                 __isl_keep isl_set *set,
4492                 __isl_keep isl_aff *obj);
4494 Compute the minimum or maximum of the integer affine expression C<obj>
4495 over the points in C<set>, returning the result in C<opt>.
4496 The result is C<NULL> in case of an error, the optimal value in case
4497 there is one, negative infinity or infinity if the problem is unbounded and
4498 NaN if the problem is empty.
4500 =item * Parametric optimization
4502         __isl_give isl_pw_aff *isl_set_dim_min(
4503                 __isl_take isl_set *set, int pos);
4504         __isl_give isl_pw_aff *isl_set_dim_max(
4505                 __isl_take isl_set *set, int pos);
4506         __isl_give isl_pw_aff *isl_map_dim_max(
4507                 __isl_take isl_map *map, int pos);
4509 Compute the minimum or maximum of the given set or output dimension
4510 as a function of the parameters (and input dimensions), but independently
4511 of the other set or output dimensions.
4512 For lexicographic optimization, see L<"Lexicographic Optimization">.
4514 =item * Dual
4516 The following functions compute either the set of (rational) coefficient
4517 values of valid constraints for the given set or the set of (rational)
4518 values satisfying the constraints with coefficients from the given set.
4519 Internally, these two sets of functions perform essentially the
4520 same operations, except that the set of coefficients is assumed to
4521 be a cone, while the set of values may be any polyhedron.
4522 The current implementation is based on the Farkas lemma and
4523 Fourier-Motzkin elimination, but this may change or be made optional
4524 in future.  In particular, future implementations may use different
4525 dualization algorithms or skip the elimination step.
4527         __isl_give isl_basic_set *isl_basic_set_coefficients(
4528                 __isl_take isl_basic_set *bset);
4529         __isl_give isl_basic_set *isl_set_coefficients(
4530                 __isl_take isl_set *set);
4531         __isl_give isl_union_set *isl_union_set_coefficients(
4532                 __isl_take isl_union_set *bset);
4533         __isl_give isl_basic_set *isl_basic_set_solutions(
4534                 __isl_take isl_basic_set *bset);
4535         __isl_give isl_basic_set *isl_set_solutions(
4536                 __isl_take isl_set *set);
4537         __isl_give isl_union_set *isl_union_set_solutions(
4538                 __isl_take isl_union_set *bset);
4540 =item * Power
4542         __isl_give isl_map *isl_map_fixed_power_val(
4543                 __isl_take isl_map *map,
4544                 __isl_take isl_val *exp);
4545         __isl_give isl_union_map *
4546         isl_union_map_fixed_power_val(
4547                 __isl_take isl_union_map *umap,
4548                 __isl_take isl_val *exp);
4550 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
4551 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
4552 of C<map> is computed.
4554         __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
4555                 int *exact);
4556         __isl_give isl_union_map *isl_union_map_power(
4557                 __isl_take isl_union_map *umap, int *exact);
4559 Compute a parametric representation for all positive powers I<k> of C<map>.
4560 The result maps I<k> to a nested relation corresponding to the
4561 I<k>th power of C<map>.
4562 The result may be an overapproximation.  If the result is known to be exact,
4563 then C<*exact> is set to C<1>.
4565 =item * Transitive closure
4567         __isl_give isl_map *isl_map_transitive_closure(
4568                 __isl_take isl_map *map, int *exact);
4569         __isl_give isl_union_map *isl_union_map_transitive_closure(
4570                 __isl_take isl_union_map *umap, int *exact);
4572 Compute the transitive closure of C<map>.
4573 The result may be an overapproximation.  If the result is known to be exact,
4574 then C<*exact> is set to C<1>.
4576 =item * Reaching path lengths
4578         __isl_give isl_map *isl_map_reaching_path_lengths(
4579                 __isl_take isl_map *map, int *exact);
4581 Compute a relation that maps each element in the range of C<map>
4582 to the lengths of all paths composed of edges in C<map> that
4583 end up in the given element.
4584 The result may be an overapproximation.  If the result is known to be exact,
4585 then C<*exact> is set to C<1>.
4586 To compute the I<maximal> path length, the resulting relation
4587 should be postprocessed by C<isl_map_lexmax>.
4588 In particular, if the input relation is a dependence relation
4589 (mapping sources to sinks), then the maximal path length corresponds
4590 to the free schedule.
4591 Note, however, that C<isl_map_lexmax> expects the maximum to be
4592 finite, so if the path lengths are unbounded (possibly due to
4593 the overapproximation), then you will get an error message.
4595 =item * Wrapping
4597         #include <isl/space.h>
4598         __isl_give isl_space *isl_space_wrap(
4599                 __isl_take isl_space *space);
4600         __isl_give isl_space *isl_space_unwrap(
4601                 __isl_take isl_space *space);
4603         #include <isl/local_space.h>
4604         __isl_give isl_local_space *isl_local_space_wrap(
4605                 __isl_take isl_local_space *ls);
4607         #include <isl/set.h>
4608         __isl_give isl_basic_map *isl_basic_set_unwrap(
4609                 __isl_take isl_basic_set *bset);
4610         __isl_give isl_map *isl_set_unwrap(
4611                 __isl_take isl_set *set);
4613         #include <isl/map.h>
4614         __isl_give isl_basic_set *isl_basic_map_wrap(
4615                 __isl_take isl_basic_map *bmap);
4616         __isl_give isl_set *isl_map_wrap(
4617                 __isl_take isl_map *map);
4619         #include <isl/union_set.h>
4620         __isl_give isl_union_map *isl_union_set_unwrap(
4621                 __isl_take isl_union_set *uset);
4623         #include <isl/union_map.h>
4624         __isl_give isl_union_set *isl_union_map_wrap(
4625                 __isl_take isl_union_map *umap);
4627 The input to C<isl_space_unwrap> should
4628 be the space of a set, while that of
4629 C<isl_space_wrap> should be the space of a relation.
4630 Conversely, the output of C<isl_space_unwrap> is the space
4631 of a relation, while that of C<isl_space_wrap> is the space of a set.
4633 =item * Flattening
4635 Remove any internal structure of domain (and range) of the given
4636 set or relation.  If there is any such internal structure in the input,
4637 then the name of the space is also removed.
4639         #include <isl/local_space.h>
4640         __isl_give isl_local_space *
4641         isl_local_space_flatten_domain(
4642                 __isl_take isl_local_space *ls);
4643         __isl_give isl_local_space *
4644         isl_local_space_flatten_range(
4645                 __isl_take isl_local_space *ls);
4647         #include <isl/set.h>
4648         __isl_give isl_basic_set *isl_basic_set_flatten(
4649                 __isl_take isl_basic_set *bset);
4650         __isl_give isl_set *isl_set_flatten(
4651                 __isl_take isl_set *set);
4653         #include <isl/map.h>
4654         __isl_give isl_basic_map *isl_basic_map_flatten_domain(
4655                 __isl_take isl_basic_map *bmap);
4656         __isl_give isl_basic_map *isl_basic_map_flatten_range(
4657                 __isl_take isl_basic_map *bmap);
4658         __isl_give isl_map *isl_map_flatten_range(
4659                 __isl_take isl_map *map);
4660         __isl_give isl_map *isl_map_flatten_domain(
4661                 __isl_take isl_map *map);
4662         __isl_give isl_basic_map *isl_basic_map_flatten(
4663                 __isl_take isl_basic_map *bmap);
4664         __isl_give isl_map *isl_map_flatten(
4665                 __isl_take isl_map *map);
4667         #include <isl/val.h>
4668         __isl_give isl_multi_val *isl_multi_val_flatten_range(
4669                 __isl_take isl_multi_val *mv);
4671         #include <isl/aff.h>
4672         __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
4673                 __isl_take isl_multi_aff *ma);
4674         __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
4675                 __isl_take isl_multi_aff *ma);
4676         __isl_give isl_multi_pw_aff *
4677         isl_multi_pw_aff_flatten_range(
4678                 __isl_take isl_multi_pw_aff *mpa);
4680         #include <isl/map.h>
4681         __isl_give isl_map *isl_set_flatten_map(
4682                 __isl_take isl_set *set);
4684 The function above constructs a relation
4685 that maps the input set to a flattened version of the set.
4687 =item * Lifting
4689 Lift the input set to a space with extra dimensions corresponding
4690 to the existentially quantified variables in the input.
4691 In particular, the result lives in a wrapped map where the domain
4692 is the original space and the range corresponds to the original
4693 existentially quantified variables.
4695         #include <isl/set.h>
4696         __isl_give isl_basic_set *isl_basic_set_lift(
4697                 __isl_take isl_basic_set *bset);
4698         __isl_give isl_set *isl_set_lift(
4699                 __isl_take isl_set *set);
4700         __isl_give isl_union_set *isl_union_set_lift(
4701                 __isl_take isl_union_set *uset);
4703 Given a local space that contains the existentially quantified
4704 variables of a set, a basic relation that, when applied to
4705 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
4706 can be constructed using the following function.
4708         #include <isl/local_space.h>
4709         __isl_give isl_basic_map *isl_local_space_lifting(
4710                 __isl_take isl_local_space *ls);
4712         #include <isl/aff.h>
4713         __isl_give isl_multi_aff *isl_multi_aff_lift(
4714                 __isl_take isl_multi_aff *maff,
4715                 __isl_give isl_local_space **ls);
4717 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
4718 then it is assigned the local space that lies at the basis of
4719 the lifting applied.
4721 =item * Internal Product
4723         #include <isl/space.h>
4724         __isl_give isl_space *isl_space_zip(
4725                 __isl_take isl_space *space);
4727         #include <isl/map.h>
4728         __isl_give isl_basic_map *isl_basic_map_zip(
4729                 __isl_take isl_basic_map *bmap);
4730         __isl_give isl_map *isl_map_zip(
4731                 __isl_take isl_map *map);
4733         #include <isl/union_map.h>
4734         __isl_give isl_union_map *isl_union_map_zip(
4735                 __isl_take isl_union_map *umap);
4737 Given a relation with nested relations for domain and range,
4738 interchange the range of the domain with the domain of the range.
4740 =item * Currying
4742         #include <isl/space.h>
4743         __isl_give isl_space *isl_space_curry(
4744                 __isl_take isl_space *space);
4745         __isl_give isl_space *isl_space_uncurry(
4746                 __isl_take isl_space *space);
4748         #include <isl/map.h>
4749         __isl_give isl_basic_map *isl_basic_map_curry(
4750                 __isl_take isl_basic_map *bmap);
4751         __isl_give isl_basic_map *isl_basic_map_uncurry(
4752                 __isl_take isl_basic_map *bmap);
4753         __isl_give isl_map *isl_map_curry(
4754                 __isl_take isl_map *map);
4755         __isl_give isl_map *isl_map_uncurry(
4756                 __isl_take isl_map *map);
4758         #include <isl/union_map.h>
4759         __isl_give isl_union_map *isl_union_map_curry(
4760                 __isl_take isl_union_map *umap);
4761         __isl_give isl_union_map *isl_union_map_uncurry(
4762                 __isl_take isl_union_map *umap);
4764 Given a relation with a nested relation for domain,
4765 the C<curry> functions
4766 move the range of the nested relation out of the domain
4767 and use it as the domain of a nested relation in the range,
4768 with the original range as range of this nested relation.
4769 The C<uncurry> functions perform the inverse operation.
4771 =item * Aligning parameters
4773 Change the order of the parameters of the given set, relation
4774 or function
4775 such that the first parameters match those of C<model>.
4776 This may involve the introduction of extra parameters.
4777 All parameters need to be named.
4779         #include <isl/space.h>
4780         __isl_give isl_space *isl_space_align_params(
4781                 __isl_take isl_space *space1,
4782                 __isl_take isl_space *space2)
4784         #include <isl/set.h>
4785         __isl_give isl_basic_set *isl_basic_set_align_params(
4786                 __isl_take isl_basic_set *bset,
4787                 __isl_take isl_space *model);
4788         __isl_give isl_set *isl_set_align_params(
4789                 __isl_take isl_set *set,
4790                 __isl_take isl_space *model);
4792         #include <isl/map.h>
4793         __isl_give isl_basic_map *isl_basic_map_align_params(
4794                 __isl_take isl_basic_map *bmap,
4795                 __isl_take isl_space *model);
4796         __isl_give isl_map *isl_map_align_params(
4797                 __isl_take isl_map *map,
4798                 __isl_take isl_space *model);
4800         #include <isl/val.h>
4801         __isl_give isl_multi_val *isl_multi_val_align_params(
4802                 __isl_take isl_multi_val *mv,
4803                 __isl_take isl_space *model);
4805         #include <isl/aff.h>
4806         __isl_give isl_aff *isl_aff_align_params(
4807                 __isl_take isl_aff *aff,
4808                 __isl_take isl_space *model);
4809         __isl_give isl_multi_aff *isl_multi_aff_align_params(
4810                 __isl_take isl_multi_aff *multi,
4811                 __isl_take isl_space *model);
4812         __isl_give isl_pw_aff *isl_pw_aff_align_params(
4813                 __isl_take isl_pw_aff *pwaff,
4814                 __isl_take isl_space *model);
4815         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
4816                 __isl_take isl_pw_multi_aff *pma,
4817                 __isl_take isl_space *model);
4818         __isl_give isl_union_pw_aff *
4819         isl_union_pw_aff_align_params(
4820                 __isl_take isl_union_pw_aff *upa,
4821                 __isl_take isl_space *model);
4822         __isl_give isl_union_pw_multi_aff *
4823         isl_union_pw_multi_aff_align_params(
4824                 __isl_take isl_union_pw_multi_aff *upma,
4825                 __isl_take isl_space *model);
4827         #include <isl/polynomial.h>
4828         __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
4829                 __isl_take isl_qpolynomial *qp,
4830                 __isl_take isl_space *model);
4832 =item * Unary Arithmethic Operations
4834         #include <isl/val.h>
4835         __isl_give isl_multi_val *isl_multi_val_neg(
4836                 __isl_take isl_multi_val *mv);
4838         #include <isl/aff.h>
4839         __isl_give isl_aff *isl_aff_neg(
4840                 __isl_take isl_aff *aff);
4841         __isl_give isl_multi_aff *isl_multi_aff_neg(
4842                 __isl_take isl_multi_aff *ma);
4843         __isl_give isl_pw_aff *isl_pw_aff_neg(
4844                 __isl_take isl_pw_aff *pwaff);
4845         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
4846                 __isl_take isl_pw_multi_aff *pma);
4847         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
4848                 __isl_take isl_multi_pw_aff *mpa);
4849         __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
4850                 __isl_take isl_union_pw_aff *upa);
4851         __isl_give isl_union_pw_multi_aff *
4852         isl_union_pw_multi_aff_neg(
4853                 __isl_take isl_union_pw_multi_aff *upma);
4854         __isl_give isl_aff *isl_aff_ceil(
4855                 __isl_take isl_aff *aff);
4856         __isl_give isl_pw_aff *isl_pw_aff_ceil(
4857                 __isl_take isl_pw_aff *pwaff);
4858         __isl_give isl_aff *isl_aff_floor(
4859                 __isl_take isl_aff *aff);
4860         __isl_give isl_multi_aff *isl_multi_aff_floor(
4861                 __isl_take isl_multi_aff *ma);
4862         __isl_give isl_pw_aff *isl_pw_aff_floor(
4863                 __isl_take isl_pw_aff *pwaff);
4864         __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
4865                 __isl_take isl_union_pw_aff *upa);
4867         #include <isl/aff.h>
4868         __isl_give isl_pw_aff *isl_pw_aff_list_min(
4869                 __isl_take isl_pw_aff_list *list);
4870         __isl_give isl_pw_aff *isl_pw_aff_list_max(
4871                 __isl_take isl_pw_aff_list *list);
4873         #include <isl/polynomial.h>
4874         __isl_give isl_qpolynomial *isl_qpolynomial_neg(
4875                 __isl_take isl_qpolynomial *qp);
4876         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
4877                 __isl_take isl_pw_qpolynomial *pwqp);
4878         __isl_give isl_union_pw_qpolynomial *
4879         isl_union_pw_qpolynomial_neg(
4880                 __isl_take isl_union_pw_qpolynomial *upwqp);
4881         __isl_give isl_qpolynomial *isl_qpolynomial_pow(
4882                 __isl_take isl_qpolynomial *qp,
4883                 unsigned exponent);
4884         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
4885                 __isl_take isl_pw_qpolynomial *pwqp,
4886                 unsigned exponent);
4888 =item * Evaluation
4890 The following functions evaluate a function in a point.
4892         #include <isl/polynomial.h>
4893         __isl_give isl_val *isl_pw_qpolynomial_eval(
4894                 __isl_take isl_pw_qpolynomial *pwqp,
4895                 __isl_take isl_point *pnt);
4896         __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
4897                 __isl_take isl_pw_qpolynomial_fold *pwf,
4898                 __isl_take isl_point *pnt);
4899         __isl_give isl_val *isl_union_pw_qpolynomial_eval(
4900                 __isl_take isl_union_pw_qpolynomial *upwqp,
4901                 __isl_take isl_point *pnt);
4902         __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
4903                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
4904                 __isl_take isl_point *pnt);
4906 =item * Dimension manipulation
4908 It is usually not advisable to directly change the (input or output)
4909 space of a set or a relation as this removes the name and the internal
4910 structure of the space.  However, the functions below can be useful
4911 to add new parameters, assuming
4912 C<isl_set_align_params> and C<isl_map_align_params>
4913 are not sufficient.
4915         #include <isl/space.h>
4916         __isl_give isl_space *isl_space_add_dims(
4917                 __isl_take isl_space *space,
4918                 enum isl_dim_type type, unsigned n);
4919         __isl_give isl_space *isl_space_insert_dims(
4920                 __isl_take isl_space *space,
4921                 enum isl_dim_type type, unsigned pos, unsigned n);
4922         __isl_give isl_space *isl_space_drop_dims(
4923                 __isl_take isl_space *space,
4924                 enum isl_dim_type type, unsigned first, unsigned n);
4925         __isl_give isl_space *isl_space_move_dims(
4926                 __isl_take isl_space *space,
4927                 enum isl_dim_type dst_type, unsigned dst_pos,
4928                 enum isl_dim_type src_type, unsigned src_pos,
4929                 unsigned n);
4931         #include <isl/local_space.h>
4932         __isl_give isl_local_space *isl_local_space_add_dims(
4933                 __isl_take isl_local_space *ls,
4934                 enum isl_dim_type type, unsigned n);
4935         __isl_give isl_local_space *isl_local_space_insert_dims(
4936                 __isl_take isl_local_space *ls,
4937                 enum isl_dim_type type, unsigned first, unsigned n);
4938         __isl_give isl_local_space *isl_local_space_drop_dims(
4939                 __isl_take isl_local_space *ls,
4940                 enum isl_dim_type type, unsigned first, unsigned n);
4942         #include <isl/set.h>
4943         __isl_give isl_basic_set *isl_basic_set_add_dims(
4944                 __isl_take isl_basic_set *bset,
4945                 enum isl_dim_type type, unsigned n);
4946         __isl_give isl_set *isl_set_add_dims(
4947                 __isl_take isl_set *set,
4948                 enum isl_dim_type type, unsigned n);
4949         __isl_give isl_basic_set *isl_basic_set_insert_dims(
4950                 __isl_take isl_basic_set *bset,
4951                 enum isl_dim_type type, unsigned pos,
4952                 unsigned n);
4953         __isl_give isl_set *isl_set_insert_dims(
4954                 __isl_take isl_set *set,
4955                 enum isl_dim_type type, unsigned pos, unsigned n);
4956         __isl_give isl_basic_set *isl_basic_set_move_dims(
4957                 __isl_take isl_basic_set *bset,
4958                 enum isl_dim_type dst_type, unsigned dst_pos,
4959                 enum isl_dim_type src_type, unsigned src_pos,
4960                 unsigned n);
4961         __isl_give isl_set *isl_set_move_dims(
4962                 __isl_take isl_set *set,
4963                 enum isl_dim_type dst_type, unsigned dst_pos,
4964                 enum isl_dim_type src_type, unsigned src_pos,
4965                 unsigned n);
4967         #include <isl/map.h>
4968         __isl_give isl_map *isl_map_add_dims(
4969                 __isl_take isl_map *map,
4970                 enum isl_dim_type type, unsigned n);
4971         __isl_give isl_basic_map *isl_basic_map_insert_dims(
4972                 __isl_take isl_basic_map *bmap,
4973                 enum isl_dim_type type, unsigned pos,
4974                 unsigned n);
4975         __isl_give isl_map *isl_map_insert_dims(
4976                 __isl_take isl_map *map,
4977                 enum isl_dim_type type, unsigned pos, unsigned n);
4978         __isl_give isl_basic_map *isl_basic_map_move_dims(
4979                 __isl_take isl_basic_map *bmap,
4980                 enum isl_dim_type dst_type, unsigned dst_pos,
4981                 enum isl_dim_type src_type, unsigned src_pos,
4982                 unsigned n);
4983         __isl_give isl_map *isl_map_move_dims(
4984                 __isl_take isl_map *map,
4985                 enum isl_dim_type dst_type, unsigned dst_pos,
4986                 enum isl_dim_type src_type, unsigned src_pos,
4987                 unsigned n);
4989         #include <isl/val.h>
4990         __isl_give isl_multi_val *isl_multi_val_insert_dims(
4991                 __isl_take isl_multi_val *mv,
4992                 enum isl_dim_type type, unsigned first, unsigned n);
4993         __isl_give isl_multi_val *isl_multi_val_add_dims(
4994                 __isl_take isl_multi_val *mv,
4995                 enum isl_dim_type type, unsigned n);
4996         __isl_give isl_multi_val *isl_multi_val_drop_dims(
4997                 __isl_take isl_multi_val *mv,
4998                 enum isl_dim_type type, unsigned first, unsigned n);
5000         #include <isl/aff.h>
5001         __isl_give isl_aff *isl_aff_insert_dims(
5002                 __isl_take isl_aff *aff,
5003                 enum isl_dim_type type, unsigned first, unsigned n);
5004         __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
5005                 __isl_take isl_multi_aff *ma,
5006                 enum isl_dim_type type, unsigned first, unsigned n);
5007         __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
5008                 __isl_take isl_pw_aff *pwaff,
5009                 enum isl_dim_type type, unsigned first, unsigned n);
5010         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
5011                 __isl_take isl_multi_pw_aff *mpa,
5012                 enum isl_dim_type type, unsigned first, unsigned n);
5013         __isl_give isl_aff *isl_aff_add_dims(
5014                 __isl_take isl_aff *aff,
5015                 enum isl_dim_type type, unsigned n);
5016         __isl_give isl_multi_aff *isl_multi_aff_add_dims(
5017                 __isl_take isl_multi_aff *ma,
5018                 enum isl_dim_type type, unsigned n);
5019         __isl_give isl_pw_aff *isl_pw_aff_add_dims(
5020                 __isl_take isl_pw_aff *pwaff,
5021                 enum isl_dim_type type, unsigned n);
5022         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
5023                 __isl_take isl_multi_pw_aff *mpa,
5024                 enum isl_dim_type type, unsigned n);
5025         __isl_give isl_aff *isl_aff_drop_dims(
5026                 __isl_take isl_aff *aff,
5027                 enum isl_dim_type type, unsigned first, unsigned n);
5028         __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
5029                 __isl_take isl_multi_aff *maff,
5030                 enum isl_dim_type type, unsigned first, unsigned n);
5031         __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
5032                 __isl_take isl_pw_aff *pwaff,
5033                 enum isl_dim_type type, unsigned first, unsigned n);
5034         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
5035                 __isl_take isl_pw_multi_aff *pma,
5036                 enum isl_dim_type type, unsigned first, unsigned n);
5037         __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
5038                 __isl_take isl_union_pw_aff *upa,
5039                 enum isl_dim_type type, unsigned first, unsigned n);
5040         __isl_give isl_union_pw_multi_aff *
5041                 isl_union_pw_multi_aff_drop_dims(
5042                 __isl_take isl_union_pw_multi_aff *upma,
5043                 enum isl_dim_type type,
5044                 unsigned first, unsigned n);
5045         __isl_give isl_aff *isl_aff_move_dims(
5046                 __isl_take isl_aff *aff,
5047                 enum isl_dim_type dst_type, unsigned dst_pos,
5048                 enum isl_dim_type src_type, unsigned src_pos,
5049                 unsigned n);
5050         __isl_give isl_multi_aff *isl_multi_aff_move_dims(
5051                 __isl_take isl_multi_aff *ma,
5052                 enum isl_dim_type dst_type, unsigned dst_pos,
5053                 enum isl_dim_type src_type, unsigned src_pos,
5054                 unsigned n);
5055         __isl_give isl_pw_aff *isl_pw_aff_move_dims(
5056                 __isl_take isl_pw_aff *pa,
5057                 enum isl_dim_type dst_type, unsigned dst_pos,
5058                 enum isl_dim_type src_type, unsigned src_pos,
5059                 unsigned n);
5060         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
5061                 __isl_take isl_multi_pw_aff *pma,
5062                 enum isl_dim_type dst_type, unsigned dst_pos,
5063                 enum isl_dim_type src_type, unsigned src_pos,
5064                 unsigned n);
5066         #include <isl/polynomial.h>
5067         __isl_give isl_union_pw_qpolynomial *
5068         isl_union_pw_qpolynomial_drop_dims(
5069                 __isl_take isl_union_pw_qpolynomial *upwqp,
5070                 enum isl_dim_type type,
5071                 unsigned first, unsigned n);
5072         __isl_give isl_union_pw_qpolynomial_fold *
5073                 isl_union_pw_qpolynomial_fold_drop_dims(
5074                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5075                 enum isl_dim_type type,
5076                 unsigned first, unsigned n);
5078 The operations on union expressions can only manipulate parameters.
5080 =back
5082 =head2 Binary Operations
5084 The two arguments of a binary operation not only need to live
5085 in the same C<isl_ctx>, they currently also need to have
5086 the same (number of) parameters.
5088 =head3 Basic Operations
5090 =over
5092 =item * Intersection
5094         #include <isl/local_space.h>
5095         __isl_give isl_local_space *isl_local_space_intersect(
5096                 __isl_take isl_local_space *ls1,
5097                 __isl_take isl_local_space *ls2);
5099         #include <isl/set.h>
5100         __isl_give isl_basic_set *isl_basic_set_intersect_params(
5101                 __isl_take isl_basic_set *bset1,
5102                 __isl_take isl_basic_set *bset2);
5103         __isl_give isl_basic_set *isl_basic_set_intersect(
5104                 __isl_take isl_basic_set *bset1,
5105                 __isl_take isl_basic_set *bset2);
5106         __isl_give isl_basic_set *isl_basic_set_list_intersect(
5107                 __isl_take struct isl_basic_set_list *list);
5108         __isl_give isl_set *isl_set_intersect_params(
5109                 __isl_take isl_set *set,
5110                 __isl_take isl_set *params);
5111         __isl_give isl_set *isl_set_intersect(
5112                 __isl_take isl_set *set1,
5113                 __isl_take isl_set *set2);
5115         #include <isl/map.h>
5116         __isl_give isl_basic_map *isl_basic_map_intersect_domain(
5117                 __isl_take isl_basic_map *bmap,
5118                 __isl_take isl_basic_set *bset);
5119         __isl_give isl_basic_map *isl_basic_map_intersect_range(
5120                 __isl_take isl_basic_map *bmap,
5121                 __isl_take isl_basic_set *bset);
5122         __isl_give isl_basic_map *isl_basic_map_intersect(
5123                 __isl_take isl_basic_map *bmap1,
5124                 __isl_take isl_basic_map *bmap2);
5125         __isl_give isl_basic_map *isl_basic_map_list_intersect(
5126                 __isl_take isl_basic_map_list *list);
5127         __isl_give isl_map *isl_map_intersect_params(
5128                 __isl_take isl_map *map,
5129                 __isl_take isl_set *params);
5130         __isl_give isl_map *isl_map_intersect_domain(
5131                 __isl_take isl_map *map,
5132                 __isl_take isl_set *set);
5133         __isl_give isl_map *isl_map_intersect_range(
5134                 __isl_take isl_map *map,
5135                 __isl_take isl_set *set);
5136         __isl_give isl_map *isl_map_intersect(
5137                 __isl_take isl_map *map1,
5138                 __isl_take isl_map *map2);
5140         #include <isl/union_set.h>
5141         __isl_give isl_union_set *isl_union_set_intersect_params(
5142                 __isl_take isl_union_set *uset,
5143                 __isl_take isl_set *set);
5144         __isl_give isl_union_set *isl_union_set_intersect(
5145                 __isl_take isl_union_set *uset1,
5146                 __isl_take isl_union_set *uset2);
5148         #include <isl/union_map.h>
5149         __isl_give isl_union_map *isl_union_map_intersect_params(
5150                 __isl_take isl_union_map *umap,
5151                 __isl_take isl_set *set);
5152         __isl_give isl_union_map *isl_union_map_intersect_domain(
5153                 __isl_take isl_union_map *umap,
5154                 __isl_take isl_union_set *uset);
5155         __isl_give isl_union_map *isl_union_map_intersect_range(
5156                 __isl_take isl_union_map *umap,
5157                 __isl_take isl_union_set *uset);
5158         __isl_give isl_union_map *isl_union_map_intersect(
5159                 __isl_take isl_union_map *umap1,
5160                 __isl_take isl_union_map *umap2);
5162         #include <isl/aff.h>
5163         __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
5164                 __isl_take isl_pw_aff *pa,
5165                 __isl_take isl_set *set);
5166         __isl_give isl_multi_pw_aff *
5167         isl_multi_pw_aff_intersect_domain(
5168                 __isl_take isl_multi_pw_aff *mpa,
5169                 __isl_take isl_set *domain);
5170         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
5171                 __isl_take isl_pw_multi_aff *pma,
5172                 __isl_take isl_set *set);
5173         __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
5174                 __isl_take isl_union_pw_aff *upa,
5175                 __isl_take isl_union_set *uset);
5176         __isl_give isl_union_pw_multi_aff *
5177         isl_union_pw_multi_aff_intersect_domain(
5178                 __isl_take isl_union_pw_multi_aff *upma,
5179                 __isl_take isl_union_set *uset);
5180         __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
5181                 __isl_take isl_pw_aff *pa,
5182                 __isl_take isl_set *set);
5183         __isl_give isl_multi_pw_aff *
5184         isl_multi_pw_aff_intersect_params(
5185                 __isl_take isl_multi_pw_aff *mpa,
5186                 __isl_take isl_set *set);
5187         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
5188                 __isl_take isl_pw_multi_aff *pma,
5189                 __isl_take isl_set *set);
5190         __isl_give isl_union_pw_aff *
5191         isl_union_pw_aff_intersect_params(
5192                 __isl_take isl_union_pw_aff *upa,
5193         __isl_give isl_union_pw_multi_aff *
5194         isl_union_pw_multi_aff_intersect_params(
5195                 __isl_take isl_union_pw_multi_aff *upma,
5196                 __isl_take isl_set *set);
5198         #include <isl/polynomial.h>
5199         __isl_give isl_pw_qpolynomial *
5200         isl_pw_qpolynomial_intersect_domain(
5201                 __isl_take isl_pw_qpolynomial *pwpq,
5202                 __isl_take isl_set *set);
5203         __isl_give isl_union_pw_qpolynomial *
5204         isl_union_pw_qpolynomial_intersect_domain(
5205                 __isl_take isl_union_pw_qpolynomial *upwpq,
5206                 __isl_take isl_union_set *uset);
5207         __isl_give isl_union_pw_qpolynomial_fold *
5208         isl_union_pw_qpolynomial_fold_intersect_domain(
5209                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5210                 __isl_take isl_union_set *uset);
5211         __isl_give isl_pw_qpolynomial *
5212         isl_pw_qpolynomial_intersect_params(
5213                 __isl_take isl_pw_qpolynomial *pwpq,
5214                 __isl_take isl_set *set);
5215         __isl_give isl_pw_qpolynomial_fold *
5216         isl_pw_qpolynomial_fold_intersect_params(
5217                 __isl_take isl_pw_qpolynomial_fold *pwf,
5218                 __isl_take isl_set *set);
5219         __isl_give isl_union_pw_qpolynomial *
5220         isl_union_pw_qpolynomial_intersect_params(
5221                 __isl_take isl_union_pw_qpolynomial *upwpq,
5222                 __isl_take isl_set *set);
5223         __isl_give isl_union_pw_qpolynomial_fold *
5224         isl_union_pw_qpolynomial_fold_intersect_params(
5225                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5226                 __isl_take isl_set *set);
5228 The second argument to the C<_params> functions needs to be
5229 a parametric (basic) set.  For the other functions, a parametric set
5230 for either argument is only allowed if the other argument is
5231 a parametric set as well.
5232 The list passed to C<isl_basic_set_list_intersect> needs to have
5233 at least one element and all elements need to live in the same space.
5235 =item * Union
5237         #include <isl/set.h>
5238         __isl_give isl_set *isl_basic_set_union(
5239                 __isl_take isl_basic_set *bset1,
5240                 __isl_take isl_basic_set *bset2);
5241         __isl_give isl_set *isl_set_union(
5242                 __isl_take isl_set *set1,
5243                 __isl_take isl_set *set2);
5245         #include <isl/map.h>
5246         __isl_give isl_map *isl_basic_map_union(
5247                 __isl_take isl_basic_map *bmap1,
5248                 __isl_take isl_basic_map *bmap2);
5249         __isl_give isl_map *isl_map_union(
5250                 __isl_take isl_map *map1,
5251                 __isl_take isl_map *map2);
5253         #include <isl/union_set.h>
5254         __isl_give isl_union_set *isl_union_set_union(
5255                 __isl_take isl_union_set *uset1,
5256                 __isl_take isl_union_set *uset2);
5257         __isl_give isl_union_set *isl_union_set_list_union(
5258                 __isl_take isl_union_set_list *list);
5260         #include <isl/union_map.h>
5261         __isl_give isl_union_map *isl_union_map_union(
5262                 __isl_take isl_union_map *umap1,
5263                 __isl_take isl_union_map *umap2);
5265 =item * Set difference
5267         #include <isl/set.h>
5268         __isl_give isl_set *isl_set_subtract(
5269                 __isl_take isl_set *set1,
5270                 __isl_take isl_set *set2);
5272         #include <isl/map.h>
5273         __isl_give isl_map *isl_map_subtract(
5274                 __isl_take isl_map *map1,
5275                 __isl_take isl_map *map2);
5276         __isl_give isl_map *isl_map_subtract_domain(
5277                 __isl_take isl_map *map,
5278                 __isl_take isl_set *dom);
5279         __isl_give isl_map *isl_map_subtract_range(
5280                 __isl_take isl_map *map,
5281                 __isl_take isl_set *dom);
5283         #include <isl/union_set.h>
5284         __isl_give isl_union_set *isl_union_set_subtract(
5285                 __isl_take isl_union_set *uset1,
5286                 __isl_take isl_union_set *uset2);
5288         #include <isl/union_map.h>
5289         __isl_give isl_union_map *isl_union_map_subtract(
5290                 __isl_take isl_union_map *umap1,
5291                 __isl_take isl_union_map *umap2);
5292         __isl_give isl_union_map *isl_union_map_subtract_domain(
5293                 __isl_take isl_union_map *umap,
5294                 __isl_take isl_union_set *dom);
5295         __isl_give isl_union_map *isl_union_map_subtract_range(
5296                 __isl_take isl_union_map *umap,
5297                 __isl_take isl_union_set *dom);
5299         #include <isl/aff.h>
5300         __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
5301                 __isl_take isl_pw_aff *pa,
5302                 __isl_take isl_set *set);
5303         __isl_give isl_pw_multi_aff *
5304         isl_pw_multi_aff_subtract_domain(
5305                 __isl_take isl_pw_multi_aff *pma,
5306                 __isl_take isl_set *set);
5307         __isl_give isl_union_pw_aff *
5308         isl_union_pw_aff_subtract_domain(
5309                 __isl_take isl_union_pw_aff *upa,
5310                 __isl_take isl_union_set *uset);
5311         __isl_give isl_union_pw_multi_aff *
5312         isl_union_pw_multi_aff_subtract_domain(
5313                 __isl_take isl_union_pw_multi_aff *upma,
5314                 __isl_take isl_set *set);
5316         #include <isl/polynomial.h>
5317         __isl_give isl_pw_qpolynomial *
5318         isl_pw_qpolynomial_subtract_domain(
5319                 __isl_take isl_pw_qpolynomial *pwpq,
5320                 __isl_take isl_set *set);
5321         __isl_give isl_pw_qpolynomial_fold *
5322         isl_pw_qpolynomial_fold_subtract_domain(
5323                 __isl_take isl_pw_qpolynomial_fold *pwf,
5324                 __isl_take isl_set *set);
5325         __isl_give isl_union_pw_qpolynomial *
5326         isl_union_pw_qpolynomial_subtract_domain(
5327                 __isl_take isl_union_pw_qpolynomial *upwpq,
5328                 __isl_take isl_union_set *uset);
5329         __isl_give isl_union_pw_qpolynomial_fold *
5330         isl_union_pw_qpolynomial_fold_subtract_domain(
5331                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5332                 __isl_take isl_union_set *uset);
5334 =item * Application
5336         #include <isl/space.h>
5337         __isl_give isl_space *isl_space_join(
5338                 __isl_take isl_space *left,
5339                 __isl_take isl_space *right);
5341         #include <isl/map.h>
5342         __isl_give isl_basic_set *isl_basic_set_apply(
5343                 __isl_take isl_basic_set *bset,
5344                 __isl_take isl_basic_map *bmap);
5345         __isl_give isl_set *isl_set_apply(
5346                 __isl_take isl_set *set,
5347                 __isl_take isl_map *map);
5348         __isl_give isl_union_set *isl_union_set_apply(
5349                 __isl_take isl_union_set *uset,
5350                 __isl_take isl_union_map *umap);
5351         __isl_give isl_basic_map *isl_basic_map_apply_domain(
5352                 __isl_take isl_basic_map *bmap1,
5353                 __isl_take isl_basic_map *bmap2);
5354         __isl_give isl_basic_map *isl_basic_map_apply_range(
5355                 __isl_take isl_basic_map *bmap1,
5356                 __isl_take isl_basic_map *bmap2);
5357         __isl_give isl_map *isl_map_apply_domain(
5358                 __isl_take isl_map *map1,
5359                 __isl_take isl_map *map2);
5360         __isl_give isl_map *isl_map_apply_range(
5361                 __isl_take isl_map *map1,
5362                 __isl_take isl_map *map2);
5364         #include <isl/union_map.h>
5365         __isl_give isl_union_map *isl_union_map_apply_domain(
5366                 __isl_take isl_union_map *umap1,
5367                 __isl_take isl_union_map *umap2);
5368         __isl_give isl_union_map *isl_union_map_apply_range(
5369                 __isl_take isl_union_map *umap1,
5370                 __isl_take isl_union_map *umap2);
5372         #include <isl/polynomial.h>
5373         __isl_give isl_pw_qpolynomial_fold *
5374         isl_set_apply_pw_qpolynomial_fold(
5375                 __isl_take isl_set *set,
5376                 __isl_take isl_pw_qpolynomial_fold *pwf,
5377                 int *tight);
5378         __isl_give isl_pw_qpolynomial_fold *
5379         isl_map_apply_pw_qpolynomial_fold(
5380                 __isl_take isl_map *map,
5381                 __isl_take isl_pw_qpolynomial_fold *pwf,
5382                 int *tight);
5383         __isl_give isl_union_pw_qpolynomial_fold *
5384         isl_union_set_apply_union_pw_qpolynomial_fold(
5385                 __isl_take isl_union_set *uset,
5386                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5387                 int *tight);
5388         __isl_give isl_union_pw_qpolynomial_fold *
5389         isl_union_map_apply_union_pw_qpolynomial_fold(
5390                 __isl_take isl_union_map *umap,
5391                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5392                 int *tight);
5394 The functions taking a map
5395 compose the given map with the given piecewise quasipolynomial reduction.
5396 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
5397 over all elements in the intersection of the range of the map
5398 and the domain of the piecewise quasipolynomial reduction
5399 as a function of an element in the domain of the map.
5400 The functions taking a set compute a bound over all elements in the
5401 intersection of the set and the domain of the
5402 piecewise quasipolynomial reduction.
5404 =item * Preimage
5406         #include <isl/set.h>
5407         __isl_give isl_basic_set *
5408         isl_basic_set_preimage_multi_aff(
5409                 __isl_take isl_basic_set *bset,
5410                 __isl_take isl_multi_aff *ma);
5411         __isl_give isl_set *isl_set_preimage_multi_aff(
5412                 __isl_take isl_set *set,
5413                 __isl_take isl_multi_aff *ma);
5414         __isl_give isl_set *isl_set_preimage_pw_multi_aff(
5415                 __isl_take isl_set *set,
5416                 __isl_take isl_pw_multi_aff *pma);
5417         __isl_give isl_set *isl_set_preimage_multi_pw_aff(
5418                 __isl_take isl_set *set,
5419                 __isl_take isl_multi_pw_aff *mpa);
5421         #include <isl/union_set.h>
5422         __isl_give isl_union_set *
5423         isl_union_set_preimage_multi_aff(
5424                 __isl_take isl_union_set *uset,
5425                 __isl_take isl_multi_aff *ma);
5426         __isl_give isl_union_set *
5427         isl_union_set_preimage_pw_multi_aff(
5428                 __isl_take isl_union_set *uset,
5429                 __isl_take isl_pw_multi_aff *pma);
5430         __isl_give isl_union_set *
5431         isl_union_set_preimage_union_pw_multi_aff(
5432                 __isl_take isl_union_set *uset,
5433                 __isl_take isl_union_pw_multi_aff *upma);
5435         #include <isl/map.h>
5436         __isl_give isl_basic_map *
5437         isl_basic_map_preimage_domain_multi_aff(
5438                 __isl_take isl_basic_map *bmap,
5439                 __isl_take isl_multi_aff *ma);
5440         __isl_give isl_map *isl_map_preimage_domain_multi_aff(
5441                 __isl_take isl_map *map,
5442                 __isl_take isl_multi_aff *ma);
5443         __isl_give isl_map *isl_map_preimage_range_multi_aff(
5444                 __isl_take isl_map *map,
5445                 __isl_take isl_multi_aff *ma);
5446         __isl_give isl_map *
5447         isl_map_preimage_domain_pw_multi_aff(
5448                 __isl_take isl_map *map,
5449                 __isl_take isl_pw_multi_aff *pma);
5450         __isl_give isl_map *
5451         isl_map_preimage_range_pw_multi_aff(
5452                 __isl_take isl_map *map,
5453                 __isl_take isl_pw_multi_aff *pma);
5454         __isl_give isl_map *
5455         isl_map_preimage_domain_multi_pw_aff(
5456                 __isl_take isl_map *map,
5457                 __isl_take isl_multi_pw_aff *mpa);
5458         __isl_give isl_basic_map *
5459         isl_basic_map_preimage_range_multi_aff(
5460                 __isl_take isl_basic_map *bmap,
5461                 __isl_take isl_multi_aff *ma);
5463         #include <isl/union_map.h>
5464         __isl_give isl_union_map *
5465         isl_union_map_preimage_domain_multi_aff(
5466                 __isl_take isl_union_map *umap,
5467                 __isl_take isl_multi_aff *ma);
5468         __isl_give isl_union_map *
5469         isl_union_map_preimage_range_multi_aff(
5470                 __isl_take isl_union_map *umap,
5471                 __isl_take isl_multi_aff *ma);
5472         __isl_give isl_union_map *
5473         isl_union_map_preimage_domain_pw_multi_aff(
5474                 __isl_take isl_union_map *umap,
5475                 __isl_take isl_pw_multi_aff *pma);
5476         __isl_give isl_union_map *
5477         isl_union_map_preimage_range_pw_multi_aff(
5478                 __isl_take isl_union_map *umap,
5479                 __isl_take isl_pw_multi_aff *pma);
5480         __isl_give isl_union_map *
5481         isl_union_map_preimage_domain_union_pw_multi_aff(
5482                 __isl_take isl_union_map *umap,
5483                 __isl_take isl_union_pw_multi_aff *upma);
5484         __isl_give isl_union_map *
5485         isl_union_map_preimage_range_union_pw_multi_aff(
5486                 __isl_take isl_union_map *umap,
5487                 __isl_take isl_union_pw_multi_aff *upma);
5489 These functions compute the preimage of the given set or map domain/range under
5490 the given function.  In other words, the expression is plugged
5491 into the set description or into the domain/range of the map.
5493 =item * Pullback
5495         #include <isl/aff.h>
5496         __isl_give isl_aff *isl_aff_pullback_aff(
5497                 __isl_take isl_aff *aff1,
5498                 __isl_take isl_aff *aff2);
5499         __isl_give isl_aff *isl_aff_pullback_multi_aff(
5500                 __isl_take isl_aff *aff,
5501                 __isl_take isl_multi_aff *ma);
5502         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
5503                 __isl_take isl_pw_aff *pa,
5504                 __isl_take isl_multi_aff *ma);
5505         __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
5506                 __isl_take isl_pw_aff *pa,
5507                 __isl_take isl_pw_multi_aff *pma);
5508         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
5509                 __isl_take isl_pw_aff *pa,
5510                 __isl_take isl_multi_pw_aff *mpa);
5511         __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
5512                 __isl_take isl_multi_aff *ma1,
5513                 __isl_take isl_multi_aff *ma2);
5514         __isl_give isl_pw_multi_aff *
5515         isl_pw_multi_aff_pullback_multi_aff(
5516                 __isl_take isl_pw_multi_aff *pma,
5517                 __isl_take isl_multi_aff *ma);
5518         __isl_give isl_multi_pw_aff *
5519         isl_multi_pw_aff_pullback_multi_aff(
5520                 __isl_take isl_multi_pw_aff *mpa,
5521                 __isl_take isl_multi_aff *ma);
5522         __isl_give isl_pw_multi_aff *
5523         isl_pw_multi_aff_pullback_pw_multi_aff(
5524                 __isl_take isl_pw_multi_aff *pma1,
5525                 __isl_take isl_pw_multi_aff *pma2);
5526         __isl_give isl_multi_pw_aff *
5527         isl_multi_pw_aff_pullback_pw_multi_aff(
5528                 __isl_take isl_multi_pw_aff *mpa,
5529                 __isl_take isl_pw_multi_aff *pma);
5530         __isl_give isl_multi_pw_aff *
5531         isl_multi_pw_aff_pullback_multi_pw_aff(
5532                 __isl_take isl_multi_pw_aff *mpa1,
5533                 __isl_take isl_multi_pw_aff *mpa2);
5534         __isl_give isl_union_pw_multi_aff *
5535         isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
5536                 __isl_take isl_union_pw_multi_aff *upma1,
5537                 __isl_take isl_union_pw_multi_aff *upma2);
5539 These functions precompose the first expression by the second function.
5540 In other words, the second function is plugged
5541 into the first expression.
5543 =item * Locus
5545         #include <isl/aff.h>
5546         __isl_give isl_basic_set *isl_aff_le_basic_set(
5547                 __isl_take isl_aff *aff1,
5548                 __isl_take isl_aff *aff2);
5549         __isl_give isl_basic_set *isl_aff_ge_basic_set(
5550                 __isl_take isl_aff *aff1,
5551                 __isl_take isl_aff *aff2);
5552         __isl_give isl_set *isl_pw_aff_eq_set(
5553                 __isl_take isl_pw_aff *pwaff1,
5554                 __isl_take isl_pw_aff *pwaff2);
5555         __isl_give isl_set *isl_pw_aff_ne_set(
5556                 __isl_take isl_pw_aff *pwaff1,
5557                 __isl_take isl_pw_aff *pwaff2);
5558         __isl_give isl_set *isl_pw_aff_le_set(
5559                 __isl_take isl_pw_aff *pwaff1,
5560                 __isl_take isl_pw_aff *pwaff2);
5561         __isl_give isl_set *isl_pw_aff_lt_set(
5562                 __isl_take isl_pw_aff *pwaff1,
5563                 __isl_take isl_pw_aff *pwaff2);
5564         __isl_give isl_set *isl_pw_aff_ge_set(
5565                 __isl_take isl_pw_aff *pwaff1,
5566                 __isl_take isl_pw_aff *pwaff2);
5567         __isl_give isl_set *isl_pw_aff_gt_set(
5568                 __isl_take isl_pw_aff *pwaff1,
5569                 __isl_take isl_pw_aff *pwaff2);
5571         __isl_give isl_set *isl_multi_aff_lex_le_set(
5572                 __isl_take isl_multi_aff *ma1,
5573                 __isl_take isl_multi_aff *ma2);
5574         __isl_give isl_set *isl_multi_aff_lex_ge_set(
5575                 __isl_take isl_multi_aff *ma1,
5576                 __isl_take isl_multi_aff *ma2);
5578         __isl_give isl_set *isl_pw_aff_list_eq_set(
5579                 __isl_take isl_pw_aff_list *list1,
5580                 __isl_take isl_pw_aff_list *list2);
5581         __isl_give isl_set *isl_pw_aff_list_ne_set(
5582                 __isl_take isl_pw_aff_list *list1,
5583                 __isl_take isl_pw_aff_list *list2);
5584         __isl_give isl_set *isl_pw_aff_list_le_set(
5585                 __isl_take isl_pw_aff_list *list1,
5586                 __isl_take isl_pw_aff_list *list2);
5587         __isl_give isl_set *isl_pw_aff_list_lt_set(
5588                 __isl_take isl_pw_aff_list *list1,
5589                 __isl_take isl_pw_aff_list *list2);
5590         __isl_give isl_set *isl_pw_aff_list_ge_set(
5591                 __isl_take isl_pw_aff_list *list1,
5592                 __isl_take isl_pw_aff_list *list2);
5593         __isl_give isl_set *isl_pw_aff_list_gt_set(
5594                 __isl_take isl_pw_aff_list *list1,
5595                 __isl_take isl_pw_aff_list *list2);
5597 The function C<isl_aff_ge_basic_set> returns a basic set
5598 containing those elements in the shared space
5599 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
5600 The function C<isl_pw_aff_ge_set> returns a set
5601 containing those elements in the shared domain
5602 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
5603 greater than or equal to C<pwaff2>.
5604 The function C<isl_multi_aff_lex_le_set> returns a set
5605 containing those elements in the shared domain space
5606 where C<ma1> is lexicographically smaller than or
5607 equal to C<ma2>.
5608 The functions operating on C<isl_pw_aff_list> apply the corresponding
5609 C<isl_pw_aff> function to each pair of elements in the two lists.
5611 =item * Cartesian Product
5613         #include <isl/space.h>
5614         __isl_give isl_space *isl_space_product(
5615                 __isl_take isl_space *space1,
5616                 __isl_take isl_space *space2);
5617         __isl_give isl_space *isl_space_domain_product(
5618                 __isl_take isl_space *space1,
5619                 __isl_take isl_space *space2);
5620         __isl_give isl_space *isl_space_range_product(
5621                 __isl_take isl_space *space1,
5622                 __isl_take isl_space *space2);
5624 The functions
5625 C<isl_space_product>, C<isl_space_domain_product>
5626 and C<isl_space_range_product> take pairs or relation spaces and
5627 produce a single relations space, where either the domain, the range
5628 or both domain and range are wrapped spaces of relations between
5629 the domains and/or ranges of the input spaces.
5630 If the product is only constructed over the domain or the range
5631 then the ranges or the domains of the inputs should be the same.
5632 The function C<isl_space_product> also accepts a pair of set spaces,
5633 in which case it returns a wrapped space of a relation between the
5634 two input spaces.
5636         #include <isl/set.h>
5637         __isl_give isl_set *isl_set_product(
5638                 __isl_take isl_set *set1,
5639                 __isl_take isl_set *set2);
5641         #include <isl/map.h>
5642         __isl_give isl_basic_map *isl_basic_map_domain_product(
5643                 __isl_take isl_basic_map *bmap1,
5644                 __isl_take isl_basic_map *bmap2);
5645         __isl_give isl_basic_map *isl_basic_map_range_product(
5646                 __isl_take isl_basic_map *bmap1,
5647                 __isl_take isl_basic_map *bmap2);
5648         __isl_give isl_basic_map *isl_basic_map_product(
5649                 __isl_take isl_basic_map *bmap1,
5650                 __isl_take isl_basic_map *bmap2);
5651         __isl_give isl_map *isl_map_domain_product(
5652                 __isl_take isl_map *map1,
5653                 __isl_take isl_map *map2);
5654         __isl_give isl_map *isl_map_range_product(
5655                 __isl_take isl_map *map1,
5656                 __isl_take isl_map *map2);
5657         __isl_give isl_map *isl_map_product(
5658                 __isl_take isl_map *map1,
5659                 __isl_take isl_map *map2);
5661         #include <isl/union_set.h>
5662         __isl_give isl_union_set *isl_union_set_product(
5663                 __isl_take isl_union_set *uset1,
5664                 __isl_take isl_union_set *uset2);
5666         #include <isl/union_map.h>
5667         __isl_give isl_union_map *isl_union_map_domain_product(
5668                 __isl_take isl_union_map *umap1,
5669                 __isl_take isl_union_map *umap2);
5670         __isl_give isl_union_map *isl_union_map_range_product(
5671                 __isl_take isl_union_map *umap1,
5672                 __isl_take isl_union_map *umap2);
5673         __isl_give isl_union_map *isl_union_map_product(
5674                 __isl_take isl_union_map *umap1,
5675                 __isl_take isl_union_map *umap2);
5677         #include <isl/val.h>
5678         __isl_give isl_multi_val *isl_multi_val_range_product(
5679                 __isl_take isl_multi_val *mv1,
5680                 __isl_take isl_multi_val *mv2);
5681         __isl_give isl_multi_val *isl_multi_val_product(
5682                 __isl_take isl_multi_val *mv1,
5683                 __isl_take isl_multi_val *mv2);
5685         #include <isl/aff.h>
5686         __isl_give isl_multi_aff *isl_multi_aff_range_product(
5687                 __isl_take isl_multi_aff *ma1,
5688                 __isl_take isl_multi_aff *ma2);
5689         __isl_give isl_multi_aff *isl_multi_aff_product(
5690                 __isl_take isl_multi_aff *ma1,
5691                 __isl_take isl_multi_aff *ma2);
5692         __isl_give isl_multi_pw_aff *
5693         isl_multi_pw_aff_range_product(
5694                 __isl_take isl_multi_pw_aff *mpa1,
5695                 __isl_take isl_multi_pw_aff *mpa2);
5696         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
5697                 __isl_take isl_multi_pw_aff *mpa1,
5698                 __isl_take isl_multi_pw_aff *mpa2);
5699         __isl_give isl_pw_multi_aff *
5700         isl_pw_multi_aff_range_product(
5701                 __isl_take isl_pw_multi_aff *pma1,
5702                 __isl_take isl_pw_multi_aff *pma2);
5703         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
5704                 __isl_take isl_pw_multi_aff *pma1,
5705                 __isl_take isl_pw_multi_aff *pma2);
5707 The above functions compute the cross product of the given
5708 sets, relations or functions.  The domains and ranges of the results
5709 are wrapped maps between domains and ranges of the inputs.
5710 To obtain a ``flat'' product, use the following functions
5711 instead.
5713         #include <isl/set.h>
5714         __isl_give isl_basic_set *isl_basic_set_flat_product(
5715                 __isl_take isl_basic_set *bset1,
5716                 __isl_take isl_basic_set *bset2);
5717         __isl_give isl_set *isl_set_flat_product(
5718                 __isl_take isl_set *set1,
5719                 __isl_take isl_set *set2);
5721         #include <isl/map.h>
5722         __isl_give isl_basic_map *isl_basic_map_flat_range_product(
5723                 __isl_take isl_basic_map *bmap1,
5724                 __isl_take isl_basic_map *bmap2);
5725         __isl_give isl_map *isl_map_flat_domain_product(
5726                 __isl_take isl_map *map1,
5727                 __isl_take isl_map *map2);
5728         __isl_give isl_map *isl_map_flat_range_product(
5729                 __isl_take isl_map *map1,
5730                 __isl_take isl_map *map2);
5731         __isl_give isl_basic_map *isl_basic_map_flat_product(
5732                 __isl_take isl_basic_map *bmap1,
5733                 __isl_take isl_basic_map *bmap2);
5734         __isl_give isl_map *isl_map_flat_product(
5735                 __isl_take isl_map *map1,
5736                 __isl_take isl_map *map2);
5738         #include <isl/union_map.h>
5739         __isl_give isl_union_map *
5740         isl_union_map_flat_domain_product(
5741                 __isl_take isl_union_map *umap1,
5742                 __isl_take isl_union_map *umap2);
5743         __isl_give isl_union_map *
5744         isl_union_map_flat_range_product(
5745                 __isl_take isl_union_map *umap1,
5746                 __isl_take isl_union_map *umap2);
5748         #include <isl/val.h>
5749         __isl_give isl_multi_val *isl_multi_val_flat_range_product(
5750                 __isl_take isl_multi_val *mv1,
5751                 __isl_take isl_multi_aff *mv2);
5753         #include <isl/aff.h>
5754         __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
5755                 __isl_take isl_multi_aff *ma1,
5756                 __isl_take isl_multi_aff *ma2);
5757         __isl_give isl_pw_multi_aff *
5758         isl_pw_multi_aff_flat_range_product(
5759                 __isl_take isl_pw_multi_aff *pma1,
5760                 __isl_take isl_pw_multi_aff *pma2);
5761         __isl_give isl_multi_pw_aff *
5762         isl_multi_pw_aff_flat_range_product(
5763                 __isl_take isl_multi_pw_aff *mpa1,
5764                 __isl_take isl_multi_pw_aff *mpa2);
5765         __isl_give isl_union_pw_multi_aff *
5766         isl_union_pw_multi_aff_flat_range_product(
5767                 __isl_take isl_union_pw_multi_aff *upma1,
5768                 __isl_take isl_union_pw_multi_aff *upma2);
5770         #include <isl/space.h>
5771         __isl_give isl_space *isl_space_factor_domain(
5772                 __isl_take isl_space *space);
5773         __isl_give isl_space *isl_space_factor_range(
5774                 __isl_take isl_space *space);
5775         __isl_give isl_space *isl_space_domain_factor_domain(
5776                 __isl_take isl_space *space);
5777         __isl_give isl_space *isl_space_domain_factor_range(
5778                 __isl_take isl_space *space);
5779         __isl_give isl_space *isl_space_range_factor_domain(
5780                 __isl_take isl_space *space);
5781         __isl_give isl_space *isl_space_range_factor_range(
5782                 __isl_take isl_space *space);
5784 The functions C<isl_space_range_factor_domain> and
5785 C<isl_space_range_factor_range> extract the two arguments from
5786 the result of a call to C<isl_space_range_product>.
5788 The arguments of a call to C<isl_map_range_product> can be extracted
5789 from the result using the following functions.
5791         #include <isl/map.h>
5792         __isl_give isl_map *isl_map_factor_domain(
5793                 __isl_take isl_map *map);
5794         __isl_give isl_map *isl_map_factor_range(
5795                 __isl_take isl_map *map);
5796         __isl_give isl_map *isl_map_domain_factor_domain(
5797                 __isl_take isl_map *map);
5798         __isl_give isl_map *isl_map_domain_factor_range(
5799                 __isl_take isl_map *map);
5800         __isl_give isl_map *isl_map_range_factor_domain(
5801                 __isl_take isl_map *map);
5802         __isl_give isl_map *isl_map_range_factor_range(
5803                 __isl_take isl_map *map);
5805         #include <isl/union_map.h>
5806         __isl_give isl_union_map *isl_union_map_factor_domain(
5807                 __isl_take isl_union_map *umap);
5808         __isl_give isl_union_map *isl_union_map_factor_range(
5809                 __isl_take isl_union_map *umap);
5810         __isl_give isl_union_map *
5811         isl_union_map_domain_factor_domain(
5812                 __isl_take isl_union_map *umap);
5813         __isl_give isl_union_map *
5814         isl_union_map_domain_factor_range(
5815                 __isl_take isl_union_map *umap);
5816         __isl_give isl_union_map *
5817         isl_union_map_range_factor_range(
5818                 __isl_take isl_union_map *umap);
5820         #include <isl/val.h>
5821         __isl_give isl_multi_val *
5822         isl_multi_val_range_factor_domain(
5823                 __isl_take isl_multi_val *mv);
5824         __isl_give isl_multi_val *
5825         isl_multi_val_range_factor_range(
5826                 __isl_take isl_multi_val *mv);
5828         #include <isl/aff.h>
5829         __isl_give isl_multi_aff *
5830         isl_multi_aff_range_factor_domain(
5831                 __isl_take isl_multi_aff *ma);
5832         __isl_give isl_multi_aff *
5833         isl_multi_aff_range_factor_range(
5834                 __isl_take isl_multi_aff *ma);
5835         __isl_give isl_multi_pw_aff *
5836         isl_multi_pw_aff_range_factor_domain(
5837                 __isl_take isl_multi_pw_aff *mpa);
5838         __isl_give isl_multi_pw_aff *
5839         isl_multi_pw_aff_range_factor_range(
5840                 __isl_take isl_multi_pw_aff *mpa);
5842 The splice functions are a generalization of the flat product functions,
5843 where the second argument may be inserted at any position inside
5844 the first argument rather than being placed at the end.
5846         #include <isl/val.h>
5847         __isl_give isl_multi_val *isl_multi_val_range_splice(
5848                 __isl_take isl_multi_val *mv1, unsigned pos,
5849                 __isl_take isl_multi_val *mv2);
5851         #include <isl/aff.h>
5852         __isl_give isl_multi_aff *isl_multi_aff_range_splice(
5853                 __isl_take isl_multi_aff *ma1, unsigned pos,
5854                 __isl_take isl_multi_aff *ma2);
5855         __isl_give isl_multi_aff *isl_multi_aff_splice(
5856                 __isl_take isl_multi_aff *ma1,
5857                 unsigned in_pos, unsigned out_pos,
5858                 __isl_take isl_multi_aff *ma2);
5859         __isl_give isl_multi_pw_aff *
5860         isl_multi_pw_aff_range_splice(
5861                 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
5862                 __isl_take isl_multi_pw_aff *mpa2);
5863         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
5864                 __isl_take isl_multi_pw_aff *mpa1,
5865                 unsigned in_pos, unsigned out_pos,
5866                 __isl_take isl_multi_pw_aff *mpa2);
5868 =item * Simplification
5870 When applied to a set or relation,
5871 the gist operation returns a set or relation that has the
5872 same intersection with the context as the input set or relation.
5873 Any implicit equality in the intersection is made explicit in the result,
5874 while all inequalities that are redundant with respect to the intersection
5875 are removed.
5876 In case of union sets and relations, the gist operation is performed
5877 per space.
5879 When applied to a function,
5880 the gist operation applies the set gist operation to each of
5881 the cells in the domain of the input piecewise expression.
5882 The context is also exploited
5883 to simplify the expression associated to each cell.
5885         #include <isl/set.h>
5886         __isl_give isl_basic_set *isl_basic_set_gist(
5887                 __isl_take isl_basic_set *bset,
5888                 __isl_take isl_basic_set *context);
5889         __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
5890                 __isl_take isl_set *context);
5891         __isl_give isl_set *isl_set_gist_params(
5892                 __isl_take isl_set *set,
5893                 __isl_take isl_set *context);
5895         #include <isl/map.h>
5896         __isl_give isl_basic_map *isl_basic_map_gist(
5897                 __isl_take isl_basic_map *bmap,
5898                 __isl_take isl_basic_map *context);
5899         __isl_give isl_basic_map *isl_basic_map_gist_domain(
5900                 __isl_take isl_basic_map *bmap,
5901                 __isl_take isl_basic_set *context);
5902         __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
5903                 __isl_take isl_map *context);
5904         __isl_give isl_map *isl_map_gist_params(
5905                 __isl_take isl_map *map,
5906                 __isl_take isl_set *context);
5907         __isl_give isl_map *isl_map_gist_domain(
5908                 __isl_take isl_map *map,
5909                 __isl_take isl_set *context);
5910         __isl_give isl_map *isl_map_gist_range(
5911                 __isl_take isl_map *map,
5912                 __isl_take isl_set *context);
5914         #include <isl/union_set.h>
5915         __isl_give isl_union_set *isl_union_set_gist(
5916                 __isl_take isl_union_set *uset,
5917                 __isl_take isl_union_set *context);
5918         __isl_give isl_union_set *isl_union_set_gist_params(
5919                 __isl_take isl_union_set *uset,
5920                 __isl_take isl_set *set);
5922         #include <isl/union_map.h>
5923         __isl_give isl_union_map *isl_union_map_gist(
5924                 __isl_take isl_union_map *umap,
5925                 __isl_take isl_union_map *context);
5926         __isl_give isl_union_map *isl_union_map_gist_params(
5927                 __isl_take isl_union_map *umap,
5928                 __isl_take isl_set *set);
5929         __isl_give isl_union_map *isl_union_map_gist_domain(
5930                 __isl_take isl_union_map *umap,
5931                 __isl_take isl_union_set *uset);
5932         __isl_give isl_union_map *isl_union_map_gist_range(
5933                 __isl_take isl_union_map *umap,
5934                 __isl_take isl_union_set *uset);
5936         #include <isl/aff.h>
5937         __isl_give isl_aff *isl_aff_gist_params(
5938                 __isl_take isl_aff *aff,
5939                 __isl_take isl_set *context);
5940         __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
5941                 __isl_take isl_set *context);
5942         __isl_give isl_multi_aff *isl_multi_aff_gist_params(
5943                 __isl_take isl_multi_aff *maff,
5944                 __isl_take isl_set *context);
5945         __isl_give isl_multi_aff *isl_multi_aff_gist(
5946                 __isl_take isl_multi_aff *maff,
5947                 __isl_take isl_set *context);
5948         __isl_give isl_pw_aff *isl_pw_aff_gist_params(
5949                 __isl_take isl_pw_aff *pwaff,
5950                 __isl_take isl_set *context);
5951         __isl_give isl_pw_aff *isl_pw_aff_gist(
5952                 __isl_take isl_pw_aff *pwaff,
5953                 __isl_take isl_set *context);
5954         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
5955                 __isl_take isl_pw_multi_aff *pma,
5956                 __isl_take isl_set *set);
5957         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
5958                 __isl_take isl_pw_multi_aff *pma,
5959                 __isl_take isl_set *set);
5960         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
5961                 __isl_take isl_multi_pw_aff *mpa,
5962                 __isl_take isl_set *set);
5963         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
5964                 __isl_take isl_multi_pw_aff *mpa,
5965                 __isl_take isl_set *set);
5966         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
5967                 __isl_take isl_union_pw_aff *upa,
5968                 __isl_take isl_union_set *context);
5969         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
5970                 __isl_take isl_union_pw_aff *upa,
5971                 __isl_take isl_set *context);
5972         __isl_give isl_union_pw_multi_aff *
5973         isl_union_pw_multi_aff_gist_params(
5974                 __isl_take isl_union_pw_multi_aff *upma,
5975                 __isl_take isl_set *context);
5976         __isl_give isl_union_pw_multi_aff *
5977         isl_union_pw_multi_aff_gist(
5978                 __isl_take isl_union_pw_multi_aff *upma,
5979                 __isl_take isl_union_set *context);
5981         #include <isl/polynomial.h>
5982         __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
5983                 __isl_take isl_qpolynomial *qp,
5984                 __isl_take isl_set *context);
5985         __isl_give isl_qpolynomial *isl_qpolynomial_gist(
5986                 __isl_take isl_qpolynomial *qp,
5987                 __isl_take isl_set *context);
5988         __isl_give isl_qpolynomial_fold *
5989         isl_qpolynomial_fold_gist_params(
5990                 __isl_take isl_qpolynomial_fold *fold,
5991                 __isl_take isl_set *context);
5992         __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
5993                 __isl_take isl_qpolynomial_fold *fold,
5994                 __isl_take isl_set *context);
5995         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
5996                 __isl_take isl_pw_qpolynomial *pwqp,
5997                 __isl_take isl_set *context);
5998         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
5999                 __isl_take isl_pw_qpolynomial *pwqp,
6000                 __isl_take isl_set *context);
6001         __isl_give isl_pw_qpolynomial_fold *
6002         isl_pw_qpolynomial_fold_gist(
6003                 __isl_take isl_pw_qpolynomial_fold *pwf,
6004                 __isl_take isl_set *context);
6005         __isl_give isl_pw_qpolynomial_fold *
6006         isl_pw_qpolynomial_fold_gist_params(
6007                 __isl_take isl_pw_qpolynomial_fold *pwf,
6008                 __isl_take isl_set *context);
6009         __isl_give isl_union_pw_qpolynomial *
6010         isl_union_pw_qpolynomial_gist_params(
6011                 __isl_take isl_union_pw_qpolynomial *upwqp,
6012                 __isl_take isl_set *context);
6013         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
6014                 __isl_take isl_union_pw_qpolynomial *upwqp,
6015                 __isl_take isl_union_set *context);
6016         __isl_give isl_union_pw_qpolynomial_fold *
6017         isl_union_pw_qpolynomial_fold_gist(
6018                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6019                 __isl_take isl_union_set *context);
6020         __isl_give isl_union_pw_qpolynomial_fold *
6021         isl_union_pw_qpolynomial_fold_gist_params(
6022                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6023                 __isl_take isl_set *context);
6025 =item * Binary Arithmethic Operations
6027         #include <isl/val.h>
6028         __isl_give isl_multi_val *isl_multi_val_sub(
6029                 __isl_take isl_multi_val *mv1,
6030                 __isl_take isl_multi_val *mv2);
6032         #include <isl/aff.h>
6033         __isl_give isl_aff *isl_aff_add(
6034                 __isl_take isl_aff *aff1,
6035                 __isl_take isl_aff *aff2);
6036         __isl_give isl_multi_aff *isl_multi_aff_add(
6037                 __isl_take isl_multi_aff *maff1,
6038                 __isl_take isl_multi_aff *maff2);
6039         __isl_give isl_pw_aff *isl_pw_aff_add(
6040                 __isl_take isl_pw_aff *pwaff1,
6041                 __isl_take isl_pw_aff *pwaff2);
6042         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
6043                 __isl_take isl_pw_multi_aff *pma1,
6044                 __isl_take isl_pw_multi_aff *pma2);
6045         __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
6046                 __isl_take isl_union_pw_aff *upa1,
6047                 __isl_take isl_union_pw_aff *upa2);
6048         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
6049                 __isl_take isl_union_pw_multi_aff *upma1,
6050                 __isl_take isl_union_pw_multi_aff *upma2);
6051         __isl_give isl_pw_aff *isl_pw_aff_min(
6052                 __isl_take isl_pw_aff *pwaff1,
6053                 __isl_take isl_pw_aff *pwaff2);
6054         __isl_give isl_pw_aff *isl_pw_aff_max(
6055                 __isl_take isl_pw_aff *pwaff1,
6056                 __isl_take isl_pw_aff *pwaff2);
6057         __isl_give isl_aff *isl_aff_sub(
6058                 __isl_take isl_aff *aff1,
6059                 __isl_take isl_aff *aff2);
6060         __isl_give isl_multi_aff *isl_multi_aff_sub(
6061                 __isl_take isl_multi_aff *ma1,
6062                 __isl_take isl_multi_aff *ma2);
6063         __isl_give isl_pw_aff *isl_pw_aff_sub(
6064                 __isl_take isl_pw_aff *pwaff1,
6065                 __isl_take isl_pw_aff *pwaff2);
6066         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
6067                 __isl_take isl_multi_pw_aff *mpa1,
6068                 __isl_take isl_multi_pw_aff *mpa2);
6069         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
6070                 __isl_take isl_pw_multi_aff *pma1,
6071                 __isl_take isl_pw_multi_aff *pma2);
6072         __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
6073                 __isl_take isl_union_pw_aff *upa1,
6074                 __isl_take isl_union_pw_aff *upa2);
6075         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
6076                 __isl_take isl_union_pw_multi_aff *upma1,
6077                 __isl_take isl_union_pw_multi_aff *upma2);
6079 C<isl_aff_sub> subtracts the second argument from the first.
6081         #include <isl/polynomial.h>
6082         __isl_give isl_qpolynomial *isl_qpolynomial_add(
6083                 __isl_take isl_qpolynomial *qp1,
6084                 __isl_take isl_qpolynomial *qp2);
6085         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
6086                 __isl_take isl_pw_qpolynomial *pwqp1,
6087                 __isl_take isl_pw_qpolynomial *pwqp2);
6088         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
6089                 __isl_take isl_pw_qpolynomial *pwqp1,
6090                 __isl_take isl_pw_qpolynomial *pwqp2);
6091         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
6092                 __isl_take isl_pw_qpolynomial_fold *pwf1,
6093                 __isl_take isl_pw_qpolynomial_fold *pwf2);
6094         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
6095                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6096                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6097         __isl_give isl_qpolynomial *isl_qpolynomial_sub(
6098                 __isl_take isl_qpolynomial *qp1,
6099                 __isl_take isl_qpolynomial *qp2);
6100         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
6101                 __isl_take isl_pw_qpolynomial *pwqp1,
6102                 __isl_take isl_pw_qpolynomial *pwqp2);
6103         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
6104                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6105                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6106         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
6107                 __isl_take isl_pw_qpolynomial_fold *pwf1,
6108                 __isl_take isl_pw_qpolynomial_fold *pwf2);
6109         __isl_give isl_union_pw_qpolynomial_fold *
6110         isl_union_pw_qpolynomial_fold_fold(
6111                 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
6112                 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
6114         #include <isl/aff.h>
6115         __isl_give isl_pw_aff *isl_pw_aff_union_add(
6116                 __isl_take isl_pw_aff *pwaff1,
6117                 __isl_take isl_pw_aff *pwaff2);
6118         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
6119                 __isl_take isl_pw_multi_aff *pma1,
6120                 __isl_take isl_pw_multi_aff *pma2);
6121         __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
6122                 __isl_take isl_union_pw_aff *upa1,
6123                 __isl_take isl_union_pw_aff *upa2);
6124         __isl_give isl_union_pw_multi_aff *
6125         isl_union_pw_multi_aff_union_add(
6126                 __isl_take isl_union_pw_multi_aff *upma1,
6127                 __isl_take isl_union_pw_multi_aff *upma2);
6128         __isl_give isl_pw_aff *isl_pw_aff_union_min(
6129                 __isl_take isl_pw_aff *pwaff1,
6130                 __isl_take isl_pw_aff *pwaff2);
6131         __isl_give isl_pw_aff *isl_pw_aff_union_max(
6132                 __isl_take isl_pw_aff *pwaff1,
6133                 __isl_take isl_pw_aff *pwaff2);
6135 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
6136 expression with a domain that is the union of those of C<pwaff1> and
6137 C<pwaff2> and such that on each cell, the quasi-affine expression is
6138 the maximum of those of C<pwaff1> and C<pwaff2>.  If only one of
6139 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
6140 associated expression is the defined one.
6141 This in contrast to the C<isl_pw_aff_max> function, which is
6142 only defined on the shared definition domain of the arguments.
6144         #include <isl/val.h>
6145         __isl_give isl_multi_val *isl_multi_val_add_val(
6146                 __isl_take isl_multi_val *mv,
6147                 __isl_take isl_val *v);
6148         __isl_give isl_multi_val *isl_multi_val_mod_val(
6149                 __isl_take isl_multi_val *mv,
6150                 __isl_take isl_val *v);
6151         __isl_give isl_multi_val *isl_multi_val_scale_val(
6152                 __isl_take isl_multi_val *mv,
6153                 __isl_take isl_val *v);
6154         __isl_give isl_multi_val *isl_multi_val_scale_down_val(
6155                 __isl_take isl_multi_val *mv,
6156                 __isl_take isl_val *v);
6158         #include <isl/aff.h>
6159         __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
6160                 __isl_take isl_val *mod);
6161         __isl_give isl_pw_aff *isl_pw_aff_mod_val(
6162                 __isl_take isl_pw_aff *pa,
6163                 __isl_take isl_val *mod);
6164         __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
6165                 __isl_take isl_union_pw_aff *upa,
6166                 __isl_take isl_val *f);
6167         __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
6168                 __isl_take isl_val *v);
6169         __isl_give isl_multi_aff *isl_multi_aff_scale_val(
6170                 __isl_take isl_multi_aff *ma,
6171                 __isl_take isl_val *v);
6172         __isl_give isl_pw_aff *isl_pw_aff_scale_val(
6173                 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
6174         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
6175                 __isl_take isl_multi_pw_aff *mpa,
6176                 __isl_take isl_val *v);
6177         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
6178                 __isl_take isl_pw_multi_aff *pma,
6179                 __isl_take isl_val *v);
6180         __isl_give isl_union_pw_multi_aff *
6181         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
6182                 __isl_take isl_union_pw_aff *upa,
6183                 __isl_take isl_val *f);
6184         isl_union_pw_multi_aff_scale_val(
6185                 __isl_take isl_union_pw_multi_aff *upma,
6186                 __isl_take isl_val *val);
6187         __isl_give isl_aff *isl_aff_scale_down_ui(
6188                 __isl_take isl_aff *aff, unsigned f);
6189         __isl_give isl_aff *isl_aff_scale_down_val(
6190                 __isl_take isl_aff *aff, __isl_take isl_val *v);
6191         __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
6192                 __isl_take isl_multi_aff *ma,
6193                 __isl_take isl_val *v);
6194         __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
6195                 __isl_take isl_pw_aff *pa,
6196                 __isl_take isl_val *f);
6197         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
6198                 __isl_take isl_multi_pw_aff *mpa,
6199                 __isl_take isl_val *v);
6200         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
6201                 __isl_take isl_pw_multi_aff *pma,
6202                 __isl_take isl_val *v);
6203         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
6204                 __isl_take isl_union_pw_aff *upa,
6205                 __isl_take isl_val *v);
6206         __isl_give isl_union_pw_multi_aff *
6207         isl_union_pw_multi_aff_scale_down_val(
6208                 __isl_take isl_union_pw_multi_aff *upma,
6209                 __isl_take isl_val *val);
6211         #include <isl/polynomial.h>
6212         __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
6213                 __isl_take isl_qpolynomial *qp,
6214                 __isl_take isl_val *v);
6215         __isl_give isl_qpolynomial_fold *
6216         isl_qpolynomial_fold_scale_val(
6217                 __isl_take isl_qpolynomial_fold *fold,
6218                 __isl_take isl_val *v);
6219         __isl_give isl_pw_qpolynomial *
6220         isl_pw_qpolynomial_scale_val(
6221                 __isl_take isl_pw_qpolynomial *pwqp,
6222                 __isl_take isl_val *v);
6223         __isl_give isl_pw_qpolynomial_fold *
6224         isl_pw_qpolynomial_fold_scale_val(
6225                 __isl_take isl_pw_qpolynomial_fold *pwf,
6226                 __isl_take isl_val *v);
6227         __isl_give isl_union_pw_qpolynomial *
6228         isl_union_pw_qpolynomial_scale_val(
6229                 __isl_take isl_union_pw_qpolynomial *upwqp,
6230                 __isl_take isl_val *v);
6231         __isl_give isl_union_pw_qpolynomial_fold *
6232         isl_union_pw_qpolynomial_fold_scale_val(
6233                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6234                 __isl_take isl_val *v);
6235         __isl_give isl_qpolynomial *
6236         isl_qpolynomial_scale_down_val(
6237                 __isl_take isl_qpolynomial *qp,
6238                 __isl_take isl_val *v);
6239         __isl_give isl_qpolynomial_fold *
6240         isl_qpolynomial_fold_scale_down_val(
6241                 __isl_take isl_qpolynomial_fold *fold,
6242                 __isl_take isl_val *v);
6243         __isl_give isl_pw_qpolynomial *
6244         isl_pw_qpolynomial_scale_down_val(
6245                 __isl_take isl_pw_qpolynomial *pwqp,
6246                 __isl_take isl_val *v);
6247         __isl_give isl_pw_qpolynomial_fold *
6248         isl_pw_qpolynomial_fold_scale_down_val(
6249                 __isl_take isl_pw_qpolynomial_fold *pwf,
6250                 __isl_take isl_val *v);
6251         __isl_give isl_union_pw_qpolynomial *
6252         isl_union_pw_qpolynomial_scale_down_val(
6253                 __isl_take isl_union_pw_qpolynomial *upwqp,
6254                 __isl_take isl_val *v);
6255         __isl_give isl_union_pw_qpolynomial_fold *
6256         isl_union_pw_qpolynomial_fold_scale_down_val(
6257                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6258                 __isl_take isl_val *v);
6260         #include <isl/val.h>
6261         __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
6262                 __isl_take isl_multi_val *mv1,
6263                 __isl_take isl_multi_val *mv2);
6264         __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
6265                 __isl_take isl_multi_val *mv1,
6266                 __isl_take isl_multi_val *mv2);
6267         __isl_give isl_multi_val *
6268         isl_multi_val_scale_down_multi_val(
6269                 __isl_take isl_multi_val *mv1,
6270                 __isl_take isl_multi_val *mv2);
6272         #include <isl/aff.h>
6273         __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
6274                 __isl_take isl_multi_aff *ma,
6275                 __isl_take isl_multi_val *mv);
6276         __isl_give isl_multi_pw_aff *
6277         isl_multi_pw_aff_mod_multi_val(
6278                 __isl_take isl_multi_pw_aff *mpa,
6279                 __isl_take isl_multi_val *mv);
6280         __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
6281                 __isl_take isl_multi_aff *ma,
6282                 __isl_take isl_multi_val *mv);
6283         __isl_give isl_pw_multi_aff *
6284         isl_pw_multi_aff_scale_multi_val(
6285                 __isl_take isl_pw_multi_aff *pma,
6286                 __isl_take isl_multi_val *mv);
6287         __isl_give isl_multi_pw_aff *
6288         isl_multi_pw_aff_scale_multi_val(
6289                 __isl_take isl_multi_pw_aff *mpa,
6290                 __isl_take isl_multi_val *mv);
6291         __isl_give isl_union_pw_multi_aff *
6292         isl_union_pw_multi_aff_scale_multi_val(
6293                 __isl_take isl_union_pw_multi_aff *upma,
6294                 __isl_take isl_multi_val *mv);
6295         __isl_give isl_multi_aff *
6296         isl_multi_aff_scale_down_multi_val(
6297                 __isl_take isl_multi_aff *ma,
6298                 __isl_take isl_multi_val *mv);
6299         __isl_give isl_multi_pw_aff *
6300         isl_multi_pw_aff_scale_down_multi_val(
6301                 __isl_take isl_multi_pw_aff *mpa,
6302                 __isl_take isl_multi_val *mv);
6304 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
6305 by the corresponding elements of C<mv>.
6307         #include <isl/aff.h>
6308         __isl_give isl_aff *isl_aff_mul(
6309                 __isl_take isl_aff *aff1,
6310                 __isl_take isl_aff *aff2);
6311         __isl_give isl_aff *isl_aff_div(
6312                 __isl_take isl_aff *aff1,
6313                 __isl_take isl_aff *aff2);
6314         __isl_give isl_pw_aff *isl_pw_aff_mul(
6315                 __isl_take isl_pw_aff *pwaff1,
6316                 __isl_take isl_pw_aff *pwaff2);
6317         __isl_give isl_pw_aff *isl_pw_aff_div(
6318                 __isl_take isl_pw_aff *pa1,
6319                 __isl_take isl_pw_aff *pa2);
6320         __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
6321                 __isl_take isl_pw_aff *pa1,
6322                 __isl_take isl_pw_aff *pa2);
6323         __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
6324                 __isl_take isl_pw_aff *pa1,
6325                 __isl_take isl_pw_aff *pa2);
6327 When multiplying two affine expressions, at least one of the two needs
6328 to be a constant.  Similarly, when dividing an affine expression by another,
6329 the second expression needs to be a constant.
6330 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
6331 rounding towards zero.  C<isl_pw_aff_tdiv_r> computes the corresponding
6332 remainder.
6334         #include <isl/polynomial.h>
6335         __isl_give isl_qpolynomial *isl_qpolynomial_mul(
6336                 __isl_take isl_qpolynomial *qp1,
6337                 __isl_take isl_qpolynomial *qp2);
6338         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
6339                 __isl_take isl_pw_qpolynomial *pwqp1,
6340                 __isl_take isl_pw_qpolynomial *pwqp2);
6341         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
6342                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6343                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6345 =back
6347 =head3 Lexicographic Optimization
6349 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
6350 the following functions
6351 compute a set that contains the lexicographic minimum or maximum
6352 of the elements in C<set> (or C<bset>) for those values of the parameters
6353 that satisfy C<dom>.
6354 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6355 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
6356 has no elements.
6357 In other words, the union of the parameter values
6358 for which the result is non-empty and of C<*empty>
6359 is equal to C<dom>.
6361         #include <isl/set.h>
6362         __isl_give isl_set *isl_basic_set_partial_lexmin(
6363                 __isl_take isl_basic_set *bset,
6364                 __isl_take isl_basic_set *dom,
6365                 __isl_give isl_set **empty);
6366         __isl_give isl_set *isl_basic_set_partial_lexmax(
6367                 __isl_take isl_basic_set *bset,
6368                 __isl_take isl_basic_set *dom,
6369                 __isl_give isl_set **empty);
6370         __isl_give isl_set *isl_set_partial_lexmin(
6371                 __isl_take isl_set *set, __isl_take isl_set *dom,
6372                 __isl_give isl_set **empty);
6373         __isl_give isl_set *isl_set_partial_lexmax(
6374                 __isl_take isl_set *set, __isl_take isl_set *dom,
6375                 __isl_give isl_set **empty);
6377 Given a (basic) set C<set> (or C<bset>), the following functions simply
6378 return a set containing the lexicographic minimum or maximum
6379 of the elements in C<set> (or C<bset>).
6380 In case of union sets, the optimum is computed per space.
6382         #include <isl/set.h>
6383         __isl_give isl_set *isl_basic_set_lexmin(
6384                 __isl_take isl_basic_set *bset);
6385         __isl_give isl_set *isl_basic_set_lexmax(
6386                 __isl_take isl_basic_set *bset);
6387         __isl_give isl_set *isl_set_lexmin(
6388                 __isl_take isl_set *set);
6389         __isl_give isl_set *isl_set_lexmax(
6390                 __isl_take isl_set *set);
6391         __isl_give isl_union_set *isl_union_set_lexmin(
6392                 __isl_take isl_union_set *uset);
6393         __isl_give isl_union_set *isl_union_set_lexmax(
6394                 __isl_take isl_union_set *uset);
6396 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
6397 the following functions
6398 compute a relation that maps each element of C<dom>
6399 to the single lexicographic minimum or maximum
6400 of the elements that are associated to that same
6401 element in C<map> (or C<bmap>).
6402 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6403 that contains the elements in C<dom> that do not map
6404 to any elements in C<map> (or C<bmap>).
6405 In other words, the union of the domain of the result and of C<*empty>
6406 is equal to C<dom>.
6408         #include <isl/map.h>
6409         __isl_give isl_map *isl_basic_map_partial_lexmax(
6410                 __isl_take isl_basic_map *bmap,
6411                 __isl_take isl_basic_set *dom,
6412                 __isl_give isl_set **empty);
6413         __isl_give isl_map *isl_basic_map_partial_lexmin(
6414                 __isl_take isl_basic_map *bmap,
6415                 __isl_take isl_basic_set *dom,
6416                 __isl_give isl_set **empty);
6417         __isl_give isl_map *isl_map_partial_lexmax(
6418                 __isl_take isl_map *map, __isl_take isl_set *dom,
6419                 __isl_give isl_set **empty);
6420         __isl_give isl_map *isl_map_partial_lexmin(
6421                 __isl_take isl_map *map, __isl_take isl_set *dom,
6422                 __isl_give isl_set **empty);
6424 Given a (basic) map C<map> (or C<bmap>), the following functions simply
6425 return a map mapping each element in the domain of
6426 C<map> (or C<bmap>) to the lexicographic minimum or maximum
6427 of all elements associated to that element.
6428 In case of union relations, the optimum is computed per space.
6430         #include <isl/map.h>
6431         __isl_give isl_map *isl_basic_map_lexmin(
6432                 __isl_take isl_basic_map *bmap);
6433         __isl_give isl_map *isl_basic_map_lexmax(
6434                 __isl_take isl_basic_map *bmap);
6435         __isl_give isl_map *isl_map_lexmin(
6436                 __isl_take isl_map *map);
6437         __isl_give isl_map *isl_map_lexmax(
6438                 __isl_take isl_map *map);
6439         __isl_give isl_union_map *isl_union_map_lexmin(
6440                 __isl_take isl_union_map *umap);
6441         __isl_give isl_union_map *isl_union_map_lexmax(
6442                 __isl_take isl_union_map *umap);
6444 The following functions return their result in the form of
6445 a piecewise multi-affine expression,
6446 but are otherwise equivalent to the corresponding functions
6447 returning a basic set or relation.
6449         #include <isl/set.h>
6450         __isl_give isl_pw_multi_aff *
6451         isl_basic_set_partial_lexmin_pw_multi_aff(
6452                 __isl_take isl_basic_set *bset,
6453                 __isl_take isl_basic_set *dom,
6454                 __isl_give isl_set **empty);
6455         __isl_give isl_pw_multi_aff *
6456         isl_basic_set_partial_lexmax_pw_multi_aff(
6457                 __isl_take isl_basic_set *bset,
6458                 __isl_take isl_basic_set *dom,
6459                 __isl_give isl_set **empty);
6460         __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
6461                 __isl_take isl_set *set);
6462         __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
6463                 __isl_take isl_set *set);
6465         #include <isl/map.h>
6466         __isl_give isl_pw_multi_aff *
6467         isl_basic_map_lexmin_pw_multi_aff(
6468                 __isl_take isl_basic_map *bmap);
6469         __isl_give isl_pw_multi_aff *
6470         isl_basic_map_partial_lexmin_pw_multi_aff(
6471                 __isl_take isl_basic_map *bmap,
6472                 __isl_take isl_basic_set *dom,
6473                 __isl_give isl_set **empty);
6474         __isl_give isl_pw_multi_aff *
6475         isl_basic_map_partial_lexmax_pw_multi_aff(
6476                 __isl_take isl_basic_map *bmap,
6477                 __isl_take isl_basic_set *dom,
6478                 __isl_give isl_set **empty);
6479         __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
6480                 __isl_take isl_map *map);
6481         __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
6482                 __isl_take isl_map *map);
6484 The following functions return the lexicographic minimum or maximum
6485 on the shared domain of the inputs and the single defined function
6486 on those parts of the domain where only a single function is defined.
6488         #include <isl/aff.h>
6489         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
6490                 __isl_take isl_pw_multi_aff *pma1,
6491                 __isl_take isl_pw_multi_aff *pma2);
6492         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
6493                 __isl_take isl_pw_multi_aff *pma1,
6494                 __isl_take isl_pw_multi_aff *pma2);
6496 =head2 Ternary Operations
6498         #include <isl/aff.h>
6499         __isl_give isl_pw_aff *isl_pw_aff_cond(
6500                 __isl_take isl_pw_aff *cond,
6501                 __isl_take isl_pw_aff *pwaff_true,
6502                 __isl_take isl_pw_aff *pwaff_false);
6504 The function C<isl_pw_aff_cond> performs a conditional operator
6505 and returns an expression that is equal to C<pwaff_true>
6506 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
6507 where C<cond> is zero.
6509 =head2 Lists
6511 Lists are defined over several element types, including
6512 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_union_pw_aff>,
6513 C<isl_union_pw_multi_aff>, C<isl_constraint>,
6514 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
6515 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
6516 Here we take lists of C<isl_set>s as an example.
6517 Lists can be created, copied, modified and freed using the following functions.
6519         #include <isl/set.h>
6520         __isl_give isl_set_list *isl_set_list_from_set(
6521                 __isl_take isl_set *el);
6522         __isl_give isl_set_list *isl_set_list_alloc(
6523                 isl_ctx *ctx, int n);
6524         __isl_give isl_set_list *isl_set_list_copy(
6525                 __isl_keep isl_set_list *list);
6526         __isl_give isl_set_list *isl_set_list_insert(
6527                 __isl_take isl_set_list *list, unsigned pos,
6528                 __isl_take isl_set *el);
6529         __isl_give isl_set_list *isl_set_list_add(
6530                 __isl_take isl_set_list *list,
6531                 __isl_take isl_set *el);
6532         __isl_give isl_set_list *isl_set_list_drop(
6533                 __isl_take isl_set_list *list,
6534                 unsigned first, unsigned n);
6535         __isl_give isl_set_list *isl_set_list_set_set(
6536                 __isl_take isl_set_list *list, int index,
6537                 __isl_take isl_set *set);
6538         __isl_give isl_set_list *isl_set_list_concat(
6539                 __isl_take isl_set_list *list1,
6540                 __isl_take isl_set_list *list2);
6541         __isl_give isl_set_list *isl_set_list_sort(
6542                 __isl_take isl_set_list *list,
6543                 int (*cmp)(__isl_keep isl_set *a,
6544                         __isl_keep isl_set *b, void *user),
6545                 void *user);
6546         __isl_null isl_set_list *isl_set_list_free(
6547                 __isl_take isl_set_list *list);
6549 C<isl_set_list_alloc> creates an empty list with an initial capacity
6550 for C<n> elements.  C<isl_set_list_insert> and C<isl_set_list_add>
6551 add elements to a list, increasing its capacity as needed.
6552 C<isl_set_list_from_set> creates a list with a single element.
6554 Lists can be inspected using the following functions.
6556         #include <isl/set.h>
6557         int isl_set_list_n_set(__isl_keep isl_set_list *list);
6558         __isl_give isl_set *isl_set_list_get_set(
6559                 __isl_keep isl_set_list *list, int index);
6560         int isl_set_list_foreach(__isl_keep isl_set_list *list,
6561                 int (*fn)(__isl_take isl_set *el, void *user),
6562                 void *user);
6563         int isl_set_list_foreach_scc(__isl_keep isl_set_list *list,
6564                 int (*follows)(__isl_keep isl_set *a,
6565                         __isl_keep isl_set *b, void *user),
6566                 void *follows_user
6567                 int (*fn)(__isl_take isl_set *el, void *user),
6568                 void *fn_user);
6570 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
6571 strongly connected components of the graph with as vertices the elements
6572 of C<list> and a directed edge from vertex C<b> to vertex C<a>
6573 iff C<follows(a, b)> returns C<1>.  The callbacks C<follows> and C<fn>
6574 should return C<-1> on error.
6576 Lists can be printed using
6578         #include <isl/set.h>
6579         __isl_give isl_printer *isl_printer_print_set_list(
6580                 __isl_take isl_printer *p,
6581                 __isl_keep isl_set_list *list);
6583 =head2 Associative arrays
6585 Associative arrays map isl objects of a specific type to isl objects
6586 of some (other) specific type.  They are defined for several pairs
6587 of types, including (C<isl_map>, C<isl_basic_set>),
6588 (C<isl_id>, C<isl_ast_expr>) and.
6589 (C<isl_id>, C<isl_pw_aff>).
6590 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
6591 as an example.
6593 Associative arrays can be created, copied and freed using
6594 the following functions.
6596         #include <isl/id_to_ast_expr.h>
6597         __isl_give id_to_ast_expr *isl_id_to_ast_expr_alloc(
6598                 isl_ctx *ctx, int min_size);
6599         __isl_give id_to_ast_expr *isl_id_to_ast_expr_copy(
6600                 __isl_keep id_to_ast_expr *id2expr);
6601         __isl_null id_to_ast_expr *isl_id_to_ast_expr_free(
6602                 __isl_take id_to_ast_expr *id2expr);
6604 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
6605 to specify the expected size of the associative array.
6606 The associative array will be grown automatically as needed.
6608 Associative arrays can be inspected using the following functions.
6610         #include <isl/id_to_ast_expr.h>
6611         int isl_id_to_ast_expr_has(
6612                 __isl_keep id_to_ast_expr *id2expr,
6613                 __isl_keep isl_id *key);
6614         __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
6615                 __isl_keep id_to_ast_expr *id2expr,
6616                 __isl_take isl_id *key);
6617         int isl_id_to_ast_expr_foreach(
6618                 __isl_keep id_to_ast_expr *id2expr,
6619                 int (*fn)(__isl_take isl_id *key,
6620                         __isl_take isl_ast_expr *val, void *user),
6621                 void *user);
6623 They can be modified using the following function.
6625         #include <isl/id_to_ast_expr.h>
6626         __isl_give id_to_ast_expr *isl_id_to_ast_expr_set(
6627                 __isl_take id_to_ast_expr *id2expr,
6628                 __isl_take isl_id *key,
6629                 __isl_take isl_ast_expr *val);
6630         __isl_give id_to_ast_expr *isl_id_to_ast_expr_drop(
6631                 __isl_take id_to_ast_expr *id2expr,
6632                 __isl_take isl_id *key);
6634 Associative arrays can be printed using the following function.
6636         #include <isl/id_to_ast_expr.h>
6637         __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
6638                 __isl_take isl_printer *p,
6639                 __isl_keep id_to_ast_expr *id2expr);
6641 =head2 Vectors
6643 Vectors can be created, copied and freed using the following functions.
6645         #include <isl/vec.h>
6646         __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
6647                 unsigned size);
6648         __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
6649         __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
6651 Note that the elements of a newly created vector may have arbitrary values.
6652 The elements can be changed and inspected using the following functions.
6654         int isl_vec_size(__isl_keep isl_vec *vec);
6655         __isl_give isl_val *isl_vec_get_element_val(
6656                 __isl_keep isl_vec *vec, int pos);
6657         __isl_give isl_vec *isl_vec_set_element_si(
6658                 __isl_take isl_vec *vec, int pos, int v);
6659         __isl_give isl_vec *isl_vec_set_element_val(
6660                 __isl_take isl_vec *vec, int pos,
6661                 __isl_take isl_val *v);
6662         __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
6663                 int v);
6664         __isl_give isl_vec *isl_vec_set_val(
6665                 __isl_take isl_vec *vec, __isl_take isl_val *v);
6666         int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
6667                 __isl_keep isl_vec *vec2, int pos);
6669 C<isl_vec_get_element> will return a negative value if anything went wrong.
6670 In that case, the value of C<*v> is undefined.
6672 The following function can be used to concatenate two vectors.
6674         __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
6675                 __isl_take isl_vec *vec2);
6677 =head2 Matrices
6679 Matrices can be created, copied and freed using the following functions.
6681         #include <isl/mat.h>
6682         __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
6683                 unsigned n_row, unsigned n_col);
6684         __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
6685         __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
6687 Note that the elements of a newly created matrix may have arbitrary values.
6688 The elements can be changed and inspected using the following functions.
6690         int isl_mat_rows(__isl_keep isl_mat *mat);
6691         int isl_mat_cols(__isl_keep isl_mat *mat);
6692         __isl_give isl_val *isl_mat_get_element_val(
6693                 __isl_keep isl_mat *mat, int row, int col);
6694         __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
6695                 int row, int col, int v);
6696         __isl_give isl_mat *isl_mat_set_element_val(
6697                 __isl_take isl_mat *mat, int row, int col,
6698                 __isl_take isl_val *v);
6700 C<isl_mat_get_element> will return a negative value if anything went wrong.
6701 In that case, the value of C<*v> is undefined.
6703 The following function can be used to compute the (right) inverse
6704 of a matrix, i.e., a matrix such that the product of the original
6705 and the inverse (in that order) is a multiple of the identity matrix.
6706 The input matrix is assumed to be of full row-rank.
6708         __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
6710 The following function can be used to compute the (right) kernel
6711 (or null space) of a matrix, i.e., a matrix such that the product of
6712 the original and the kernel (in that order) is the zero matrix.
6714         __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
6716 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
6718 The following functions determine
6719 an upper or lower bound on a quasipolynomial over its domain.
6721         __isl_give isl_pw_qpolynomial_fold *
6722         isl_pw_qpolynomial_bound(
6723                 __isl_take isl_pw_qpolynomial *pwqp,
6724                 enum isl_fold type, int *tight);
6726         __isl_give isl_union_pw_qpolynomial_fold *
6727         isl_union_pw_qpolynomial_bound(
6728                 __isl_take isl_union_pw_qpolynomial *upwqp,
6729                 enum isl_fold type, int *tight);
6731 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
6732 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
6733 is the returned bound is known be tight, i.e., for each value
6734 of the parameters there is at least
6735 one element in the domain that reaches the bound.
6736 If the domain of C<pwqp> is not wrapping, then the bound is computed
6737 over all elements in that domain and the result has a purely parametric
6738 domain.  If the domain of C<pwqp> is wrapping, then the bound is
6739 computed over the range of the wrapped relation.  The domain of the
6740 wrapped relation becomes the domain of the result.
6742 =head2 Parametric Vertex Enumeration
6744 The parametric vertex enumeration described in this section
6745 is mainly intended to be used internally and by the C<barvinok>
6746 library.
6748         #include <isl/vertices.h>
6749         __isl_give isl_vertices *isl_basic_set_compute_vertices(
6750                 __isl_keep isl_basic_set *bset);
6752 The function C<isl_basic_set_compute_vertices> performs the
6753 actual computation of the parametric vertices and the chamber
6754 decomposition and store the result in an C<isl_vertices> object.
6755 This information can be queried by either iterating over all
6756 the vertices or iterating over all the chambers or cells
6757 and then iterating over all vertices that are active on the chamber.
6759         int isl_vertices_foreach_vertex(
6760                 __isl_keep isl_vertices *vertices,
6761                 int (*fn)(__isl_take isl_vertex *vertex, void *user),
6762                 void *user);
6764         int isl_vertices_foreach_cell(
6765                 __isl_keep isl_vertices *vertices,
6766                 int (*fn)(__isl_take isl_cell *cell, void *user),
6767                 void *user);
6768         int isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
6769                 int (*fn)(__isl_take isl_vertex *vertex, void *user),
6770                 void *user);
6772 Other operations that can be performed on an C<isl_vertices> object are
6773 the following.
6775         int isl_vertices_get_n_vertices(
6776                 __isl_keep isl_vertices *vertices);
6777         void isl_vertices_free(__isl_take isl_vertices *vertices);
6779 Vertices can be inspected and destroyed using the following functions.
6781         int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
6782         __isl_give isl_basic_set *isl_vertex_get_domain(
6783                 __isl_keep isl_vertex *vertex);
6784         __isl_give isl_multi_aff *isl_vertex_get_expr(
6785                 __isl_keep isl_vertex *vertex);
6786         void isl_vertex_free(__isl_take isl_vertex *vertex);
6788 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
6789 describing the vertex in terms of the parameters,
6790 while C<isl_vertex_get_domain> returns the activity domain
6791 of the vertex.
6793 Chambers can be inspected and destroyed using the following functions.
6795         __isl_give isl_basic_set *isl_cell_get_domain(
6796                 __isl_keep isl_cell *cell);
6797         void isl_cell_free(__isl_take isl_cell *cell);
6799 =head1 Polyhedral Compilation Library
6801 This section collects functionality in C<isl> that has been specifically
6802 designed for use during polyhedral compilation.
6804 =head2 Dependence Analysis
6806 C<isl> contains specialized functionality for performing
6807 array dataflow analysis.  That is, given a I<sink> access relation
6808 and a collection of possible I<source> access relations,
6809 C<isl> can compute relations that describe
6810 for each iteration of the sink access, which iteration
6811 of which of the source access relations was the last
6812 to access the same data element before the given iteration
6813 of the sink access.
6814 The resulting dependence relations map source iterations
6815 to the corresponding sink iterations.
6816 To compute standard flow dependences, the sink should be
6817 a read, while the sources should be writes.
6818 If any of the source accesses are marked as being I<may>
6819 accesses, then there will be a dependence from the last
6820 I<must> access B<and> from any I<may> access that follows
6821 this last I<must> access.
6822 In particular, if I<all> sources are I<may> accesses,
6823 then memory based dependence analysis is performed.
6824 If, on the other hand, all sources are I<must> accesses,
6825 then value based dependence analysis is performed.
6827         #include <isl/flow.h>
6829         typedef int (*isl_access_level_before)(void *first, void *second);
6831         __isl_give isl_access_info *isl_access_info_alloc(
6832                 __isl_take isl_map *sink,
6833                 void *sink_user, isl_access_level_before fn,
6834                 int max_source);
6835         __isl_give isl_access_info *isl_access_info_add_source(
6836                 __isl_take isl_access_info *acc,
6837                 __isl_take isl_map *source, int must,
6838                 void *source_user);
6839         __isl_null isl_access_info *isl_access_info_free(
6840                 __isl_take isl_access_info *acc);
6842         __isl_give isl_flow *isl_access_info_compute_flow(
6843                 __isl_take isl_access_info *acc);
6845         int isl_flow_foreach(__isl_keep isl_flow *deps,
6846                 int (*fn)(__isl_take isl_map *dep, int must,
6847                           void *dep_user, void *user),
6848                 void *user);
6849         __isl_give isl_map *isl_flow_get_no_source(
6850                 __isl_keep isl_flow *deps, int must);
6851         void isl_flow_free(__isl_take isl_flow *deps);
6853 The function C<isl_access_info_compute_flow> performs the actual
6854 dependence analysis.  The other functions are used to construct
6855 the input for this function or to read off the output.
6857 The input is collected in an C<isl_access_info>, which can
6858 be created through a call to C<isl_access_info_alloc>.
6859 The arguments to this functions are the sink access relation
6860 C<sink>, a token C<sink_user> used to identify the sink
6861 access to the user, a callback function for specifying the
6862 relative order of source and sink accesses, and the number
6863 of source access relations that will be added.
6864 The callback function has type C<int (*)(void *first, void *second)>.
6865 The function is called with two user supplied tokens identifying
6866 either a source or the sink and it should return the shared nesting
6867 level and the relative order of the two accesses.
6868 In particular, let I<n> be the number of loops shared by
6869 the two accesses.  If C<first> precedes C<second> textually,
6870 then the function should return I<2 * n + 1>; otherwise,
6871 it should return I<2 * n>.
6872 The sources can be added to the C<isl_access_info> by performing
6873 (at most) C<max_source> calls to C<isl_access_info_add_source>.
6874 C<must> indicates whether the source is a I<must> access
6875 or a I<may> access.  Note that a multi-valued access relation
6876 should only be marked I<must> if every iteration in the domain
6877 of the relation accesses I<all> elements in its image.
6878 The C<source_user> token is again used to identify
6879 the source access.  The range of the source access relation
6880 C<source> should have the same dimension as the range
6881 of the sink access relation.
6882 The C<isl_access_info_free> function should usually not be
6883 called explicitly, because it is called implicitly by
6884 C<isl_access_info_compute_flow>.
6886 The result of the dependence analysis is collected in an
6887 C<isl_flow>.  There may be elements of
6888 the sink access for which no preceding source access could be
6889 found or for which all preceding sources are I<may> accesses.
6890 The relations containing these elements can be obtained through
6891 calls to C<isl_flow_get_no_source>, the first with C<must> set
6892 and the second with C<must> unset.
6893 In the case of standard flow dependence analysis,
6894 with the sink a read and the sources I<must> writes,
6895 the first relation corresponds to the reads from uninitialized
6896 array elements and the second relation is empty.
6897 The actual flow dependences can be extracted using
6898 C<isl_flow_foreach>.  This function will call the user-specified
6899 callback function C<fn> for each B<non-empty> dependence between
6900 a source and the sink.  The callback function is called
6901 with four arguments, the actual flow dependence relation
6902 mapping source iterations to sink iterations, a boolean that
6903 indicates whether it is a I<must> or I<may> dependence, a token
6904 identifying the source and an additional C<void *> with value
6905 equal to the third argument of the C<isl_flow_foreach> call.
6906 A dependence is marked I<must> if it originates from a I<must>
6907 source and if it is not followed by any I<may> sources.
6909 After finishing with an C<isl_flow>, the user should call
6910 C<isl_flow_free> to free all associated memory.
6912 A higher-level interface to dependence analysis is provided
6913 by the following function.
6915         #include <isl/flow.h>
6917         int isl_union_map_compute_flow(__isl_take isl_union_map *sink,
6918                 __isl_take isl_union_map *must_source,
6919                 __isl_take isl_union_map *may_source,
6920                 __isl_take isl_union_map *schedule,
6921                 __isl_give isl_union_map **must_dep,
6922                 __isl_give isl_union_map **may_dep,
6923                 __isl_give isl_union_map **must_no_source,
6924                 __isl_give isl_union_map **may_no_source);
6926 The arrays are identified by the tuple names of the ranges
6927 of the accesses.  The iteration domains by the tuple names
6928 of the domains of the accesses and of the schedule.
6929 The relative order of the iteration domains is given by the
6930 schedule.  The relations returned through C<must_no_source>
6931 and C<may_no_source> are subsets of C<sink>.
6932 Any of C<must_dep>, C<may_dep>, C<must_no_source>
6933 or C<may_no_source> may be C<NULL>, but a C<NULL> value for
6934 any of the other arguments is treated as an error.
6936 =head3 Interaction with Dependence Analysis
6938 During the dependence analysis, we frequently need to perform
6939 the following operation.  Given a relation between sink iterations
6940 and potential source iterations from a particular source domain,
6941 what is the last potential source iteration corresponding to each
6942 sink iteration.  It can sometimes be convenient to adjust
6943 the set of potential source iterations before or after each such operation.
6944 The prototypical example is fuzzy array dataflow analysis,
6945 where we need to analyze if, based on data-dependent constraints,
6946 the sink iteration can ever be executed without one or more of
6947 the corresponding potential source iterations being executed.
6948 If so, we can introduce extra parameters and select an unknown
6949 but fixed source iteration from the potential source iterations.
6950 To be able to perform such manipulations, C<isl> provides the following
6951 function.
6953         #include <isl/flow.h>
6955         typedef __isl_give isl_restriction *(*isl_access_restrict)(
6956                 __isl_keep isl_map *source_map,
6957                 __isl_keep isl_set *sink, void *source_user,
6958                 void *user);
6959         __isl_give isl_access_info *isl_access_info_set_restrict(
6960                 __isl_take isl_access_info *acc,
6961                 isl_access_restrict fn, void *user);
6963 The function C<isl_access_info_set_restrict> should be called
6964 before calling C<isl_access_info_compute_flow> and registers a callback function
6965 that will be called any time C<isl> is about to compute the last
6966 potential source.  The first argument is the (reverse) proto-dependence,
6967 mapping sink iterations to potential source iterations.
6968 The second argument represents the sink iterations for which
6969 we want to compute the last source iteration.
6970 The third argument is the token corresponding to the source
6971 and the final argument is the token passed to C<isl_access_info_set_restrict>.
6972 The callback is expected to return a restriction on either the input or
6973 the output of the operation computing the last potential source.
6974 If the input needs to be restricted then restrictions are needed
6975 for both the source and the sink iterations.  The sink iterations
6976 and the potential source iterations will be intersected with these sets.
6977 If the output needs to be restricted then only a restriction on the source
6978 iterations is required.
6979 If any error occurs, the callback should return C<NULL>.
6980 An C<isl_restriction> object can be created, freed and inspected
6981 using the following functions.
6983         #include <isl/flow.h>
6985         __isl_give isl_restriction *isl_restriction_input(
6986                 __isl_take isl_set *source_restr,
6987                 __isl_take isl_set *sink_restr);
6988         __isl_give isl_restriction *isl_restriction_output(
6989                 __isl_take isl_set *source_restr);
6990         __isl_give isl_restriction *isl_restriction_none(
6991                 __isl_take isl_map *source_map);
6992         __isl_give isl_restriction *isl_restriction_empty(
6993                 __isl_take isl_map *source_map);
6994         __isl_null isl_restriction *isl_restriction_free(
6995                 __isl_take isl_restriction *restr);
6997 C<isl_restriction_none> and C<isl_restriction_empty> are special
6998 cases of C<isl_restriction_input>.  C<isl_restriction_none>
6999 is essentially equivalent to
7001         isl_restriction_input(isl_set_universe(
7002             isl_space_range(isl_map_get_space(source_map))),
7003                             isl_set_universe(
7004             isl_space_domain(isl_map_get_space(source_map))));
7006 whereas C<isl_restriction_empty> is essentially equivalent to
7008         isl_restriction_input(isl_set_empty(
7009             isl_space_range(isl_map_get_space(source_map))),
7010                             isl_set_universe(
7011             isl_space_domain(isl_map_get_space(source_map))));
7013 =head2 Scheduling
7015 B<The functionality described in this section is fairly new
7016 and may be subject to change.>
7018         #include <isl/schedule.h>
7019         __isl_give isl_schedule *
7020         isl_schedule_constraints_compute_schedule(
7021                 __isl_take isl_schedule_constraints *sc);
7022         __isl_null isl_schedule *isl_schedule_free(
7023                 __isl_take isl_schedule *sched);
7025 The function C<isl_schedule_constraints_compute_schedule> can be
7026 used to compute a schedule that satisfies the given schedule constraints.
7027 These schedule constraints include the iteration domain for which
7028 a schedule should be computed and dependences between pairs of
7029 iterations.  In particular, these dependences include
7030 I<validity> dependences and I<proximity> dependences.
7031 By default, the algorithm used to construct the schedule is similar
7032 to that of C<Pluto>.
7033 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
7034 be selected.
7035 The generated schedule respects all validity dependences.
7036 That is, all dependence distances over these dependences in the
7037 scheduled space are lexicographically positive.
7038 The default algorithm tries to ensure that the dependence distances
7039 over coincidence constraints are zero and to minimize the
7040 dependence distances over proximity dependences.
7041 Moreover, it tries to obtain sequences (bands) of schedule dimensions
7042 for groups of domains where the dependence distances over validity
7043 dependences have only non-negative values.
7044 When using Feautrier's algorithm, the coincidence and proximity constraints
7045 are only taken into account during the extension to a
7046 full-dimensional schedule.
7048 An C<isl_schedule_constraints> object can be constructed
7049 and manipulated using the following functions.
7051         #include <isl/schedule.h>
7052         __isl_give isl_schedule_constraints *
7053         isl_schedule_constraints_copy(
7054                 __isl_keep isl_schedule_constraints *sc);
7055         __isl_give isl_schedule_constraints *
7056         isl_schedule_constraints_on_domain(
7057                 __isl_take isl_union_set *domain);
7058         __isl_give isl_schedule_constraints *
7059         isl_schedule_constraints_set_validity(
7060                 __isl_take isl_schedule_constraints *sc,
7061                 __isl_take isl_union_map *validity);
7062         __isl_give isl_schedule_constraints *
7063         isl_schedule_constraints_set_coincidence(
7064                 __isl_take isl_schedule_constraints *sc,
7065                 __isl_take isl_union_map *coincidence);
7066         __isl_give isl_schedule_constraints *
7067         isl_schedule_constraints_set_proximity(
7068                 __isl_take isl_schedule_constraints *sc,
7069                 __isl_take isl_union_map *proximity);
7070         __isl_give isl_schedule_constraints *
7071         isl_schedule_constraints_set_conditional_validity(
7072                 __isl_take isl_schedule_constraints *sc,
7073                 __isl_take isl_union_map *condition,
7074                 __isl_take isl_union_map *validity);
7075         __isl_null isl_schedule_constraints *
7076         isl_schedule_constraints_free(
7077                 __isl_take isl_schedule_constraints *sc);
7079 The initial C<isl_schedule_constraints> object created by
7080 C<isl_schedule_constraints_on_domain> does not impose any constraints.
7081 That is, it has an empty set of dependences.
7082 The function C<isl_schedule_constraints_set_validity> replaces the
7083 validity dependences, mapping domain elements I<i> to domain
7084 elements that should be scheduled after I<i>.
7085 The function C<isl_schedule_constraints_set_coincidence> replaces the
7086 coincidence dependences, mapping domain elements I<i> to domain
7087 elements that should be scheduled together with I<I>, if possible.
7088 The function C<isl_schedule_constraints_set_proximity> replaces the
7089 proximity dependences, mapping domain elements I<i> to domain
7090 elements that should be scheduled either before I<I>
7091 or as early as possible after I<i>.
7093 The function C<isl_schedule_constraints_set_conditional_validity>
7094 replaces the conditional validity constraints.
7095 A conditional validity constraint is only imposed when any of the corresponding
7096 conditions is satisfied, i.e., when any of them is non-zero.
7097 That is, the scheduler ensures that within each band if the dependence
7098 distances over the condition constraints are not all zero
7099 then all corresponding conditional validity constraints are respected.
7100 A conditional validity constraint corresponds to a condition
7101 if the two are adjacent, i.e., if the domain of one relation intersect
7102 the range of the other relation.
7103 The typical use case of conditional validity constraints is
7104 to allow order constraints between live ranges to be violated
7105 as long as the live ranges themselves are local to the band.
7106 To allow more fine-grained control over which conditions correspond
7107 to which conditional validity constraints, the domains and ranges
7108 of these relations may include I<tags>.  That is, the domains and
7109 ranges of those relation may themselves be wrapped relations
7110 where the iteration domain appears in the domain of those wrapped relations
7111 and the range of the wrapped relations can be arbitrarily chosen
7112 by the user.  Conditions and conditional validity constraints are only
7113 considered adjacent to each other if the entire wrapped relation matches.
7114 In particular, a relation with a tag will never be considered adjacent
7115 to a relation without a tag.
7117 The following function computes a schedule directly from
7118 an iteration domain and validity and proximity dependences
7119 and is implemented in terms of the functions described above.
7120 The use of C<isl_union_set_compute_schedule> is discouraged.
7122         #include <isl/schedule.h>
7123         __isl_give isl_schedule *isl_union_set_compute_schedule(
7124                 __isl_take isl_union_set *domain,
7125                 __isl_take isl_union_map *validity,
7126                 __isl_take isl_union_map *proximity);
7128 A mapping from the domains to the scheduled space can be obtained
7129 from an C<isl_schedule> using the following function.
7131         __isl_give isl_union_map *isl_schedule_get_map(
7132                 __isl_keep isl_schedule *sched);
7134 A representation of the schedule can be printed using
7135          
7136         __isl_give isl_printer *isl_printer_print_schedule(
7137                 __isl_take isl_printer *p,
7138                 __isl_keep isl_schedule *schedule);
7140 A representation of the schedule as a forest of bands can be obtained
7141 using the following function.
7143         __isl_give isl_band_list *isl_schedule_get_band_forest(
7144                 __isl_keep isl_schedule *schedule);
7146 The individual bands can be visited in depth-first post-order
7147 using the following function.
7149         #include <isl/schedule.h>
7150         int isl_schedule_foreach_band(
7151                 __isl_keep isl_schedule *sched,
7152                 int (*fn)(__isl_keep isl_band *band, void *user),
7153                 void *user);
7155 The list can be manipulated as explained in L<"Lists">.
7156 The bands inside the list can be copied and freed using the following
7157 functions.
7159         #include <isl/band.h>
7160         __isl_give isl_band *isl_band_copy(
7161                 __isl_keep isl_band *band);
7162         __isl_null isl_band *isl_band_free(
7163                 __isl_take isl_band *band);
7165 Each band contains zero or more scheduling dimensions.
7166 These are referred to as the members of the band.
7167 The section of the schedule that corresponds to the band is
7168 referred to as the partial schedule of the band.
7169 For those nodes that participate in a band, the outer scheduling
7170 dimensions form the prefix schedule, while the inner scheduling
7171 dimensions form the suffix schedule.
7172 That is, if we take a cut of the band forest, then the union of
7173 the concatenations of the prefix, partial and suffix schedules of
7174 each band in the cut is equal to the entire schedule (modulo
7175 some possible padding at the end with zero scheduling dimensions).
7176 The properties of a band can be inspected using the following functions.
7178         #include <isl/band.h>
7179         int isl_band_has_children(__isl_keep isl_band *band);
7180         __isl_give isl_band_list *isl_band_get_children(
7181                 __isl_keep isl_band *band);
7183         __isl_give isl_union_map *isl_band_get_prefix_schedule(
7184                 __isl_keep isl_band *band);
7185         __isl_give isl_union_map *isl_band_get_partial_schedule(
7186                 __isl_keep isl_band *band);
7187         __isl_give isl_union_map *isl_band_get_suffix_schedule(
7188                 __isl_keep isl_band *band);
7190         int isl_band_n_member(__isl_keep isl_band *band);
7191         int isl_band_member_is_coincident(
7192                 __isl_keep isl_band *band, int pos);
7194         int isl_band_list_foreach_band(
7195                 __isl_keep isl_band_list *list,
7196                 int (*fn)(__isl_keep isl_band *band, void *user),
7197                 void *user);
7199 Note that a scheduling dimension is considered to be ``coincident''
7200 if it satisfies the coincidence constraints within its band.
7201 That is, if the dependence distances of the coincidence
7202 constraints are all zero in that direction (for fixed
7203 iterations of outer bands).
7204 Like C<isl_schedule_foreach_band>,
7205 the function C<isl_band_list_foreach_band> calls C<fn> on the bands
7206 in depth-first post-order.
7208 A band can be tiled using the following function.
7210         #include <isl/band.h>
7211         int isl_band_tile(__isl_keep isl_band *band,
7212                 __isl_take isl_vec *sizes);
7214         int isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
7215                 int val);
7216         int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
7217         int isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
7218                 int val);
7219         int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
7221 The C<isl_band_tile> function tiles the band using the given tile sizes
7222 inside its schedule.
7223 A new child band is created to represent the point loops and it is
7224 inserted between the modified band and its children.
7225 The C<tile_scale_tile_loops> option specifies whether the tile
7226 loops iterators should be scaled by the tile sizes.
7227 If the C<tile_shift_point_loops> option is set, then the point loops
7228 are shifted to start at zero.
7230 A band can be split into two nested bands using the following function.
7232         int isl_band_split(__isl_keep isl_band *band, int pos);
7234 The resulting outer band contains the first C<pos> dimensions of C<band>
7235 while the inner band contains the remaining dimensions.
7237 A representation of the band can be printed using
7239         #include <isl/band.h>
7240         __isl_give isl_printer *isl_printer_print_band(
7241                 __isl_take isl_printer *p,
7242                 __isl_keep isl_band *band);
7244 =head3 Options
7246         #include <isl/schedule.h>
7247         int isl_options_set_schedule_max_coefficient(
7248                 isl_ctx *ctx, int val);
7249         int isl_options_get_schedule_max_coefficient(
7250                 isl_ctx *ctx);
7251         int isl_options_set_schedule_max_constant_term(
7252                 isl_ctx *ctx, int val);
7253         int isl_options_get_schedule_max_constant_term(
7254                 isl_ctx *ctx);
7255         int isl_options_set_schedule_fuse(isl_ctx *ctx, int val);
7256         int isl_options_get_schedule_fuse(isl_ctx *ctx);
7257         int isl_options_set_schedule_maximize_band_depth(
7258                 isl_ctx *ctx, int val);
7259         int isl_options_get_schedule_maximize_band_depth(
7260                 isl_ctx *ctx);
7261         int isl_options_set_schedule_outer_coincidence(
7262                 isl_ctx *ctx, int val);
7263         int isl_options_get_schedule_outer_coincidence(
7264                 isl_ctx *ctx);
7265         int isl_options_set_schedule_split_scaled(
7266                 isl_ctx *ctx, int val);
7267         int isl_options_get_schedule_split_scaled(
7268                 isl_ctx *ctx);
7269         int isl_options_set_schedule_algorithm(
7270                 isl_ctx *ctx, int val);
7271         int isl_options_get_schedule_algorithm(
7272                 isl_ctx *ctx);
7273         int isl_options_set_schedule_separate_components(
7274                 isl_ctx *ctx, int val);
7275         int isl_options_get_schedule_separate_components(
7276                 isl_ctx *ctx);
7278 =over
7280 =item * schedule_max_coefficient
7282 This option enforces that the coefficients for variable and parameter
7283 dimensions in the calculated schedule are not larger than the specified value.
7284 This option can significantly increase the speed of the scheduling calculation
7285 and may also prevent fusing of unrelated dimensions. A value of -1 means that
7286 this option does not introduce bounds on the variable or parameter
7287 coefficients.
7289 =item * schedule_max_constant_term
7291 This option enforces that the constant coefficients in the calculated schedule
7292 are not larger than the maximal constant term. This option can significantly
7293 increase the speed of the scheduling calculation and may also prevent fusing of
7294 unrelated dimensions. A value of -1 means that this option does not introduce
7295 bounds on the constant coefficients.
7297 =item * schedule_fuse
7299 This option controls the level of fusion.
7300 If this option is set to C<ISL_SCHEDULE_FUSE_MIN>, then loops in the
7301 resulting schedule will be distributed as much as possible.
7302 If this option is set to C<ISL_SCHEDULE_FUSE_MAX>, then C<isl> will
7303 try to fuse loops in the resulting schedule.
7305 =item * schedule_maximize_band_depth
7307 If this option is set, we do not split bands at the point
7308 where we detect splitting is necessary. Instead, we
7309 backtrack and split bands as early as possible. This
7310 reduces the number of splits and maximizes the width of
7311 the bands. Wider bands give more possibilities for tiling.
7312 Note that if the C<schedule_fuse> option is set to C<ISL_SCHEDULE_FUSE_MIN>,
7313 then bands will be split as early as possible, even if there is no need.
7314 The C<schedule_maximize_band_depth> option therefore has no effect in this case.
7316 =item * schedule_outer_coincidence
7318 If this option is set, then we try to construct schedules
7319 where the outermost scheduling dimension in each band
7320 satisfies the coincidence constraints.
7322 =item * schedule_split_scaled
7324 If this option is set, then we try to construct schedules in which the
7325 constant term is split off from the linear part if the linear parts of
7326 the scheduling rows for all nodes in the graphs have a common non-trivial
7327 divisor.
7328 The constant term is then placed in a separate band and the linear
7329 part is reduced.
7331 =item * schedule_algorithm
7333 Selects the scheduling algorithm to be used.
7334 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
7335 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
7337 =item * schedule_separate_components
7339 If at any point the dependence graph contains any (weakly connected) components,
7340 then these components are scheduled separately.
7341 If this option is not set, then some iterations of the domains
7342 in these components may be scheduled together.
7343 If this option is set, then the components are given consecutive
7344 schedules.
7346 =back
7348 =head2 AST Generation
7350 This section describes the C<isl> functionality for generating
7351 ASTs that visit all the elements
7352 in a domain in an order specified by a schedule.
7353 In particular, given a C<isl_union_map>, an AST is generated
7354 that visits all the elements in the domain of the C<isl_union_map>
7355 according to the lexicographic order of the corresponding image
7356 element(s).  If the range of the C<isl_union_map> consists of
7357 elements in more than one space, then each of these spaces is handled
7358 separately in an arbitrary order.
7359 It should be noted that the image elements only specify the I<order>
7360 in which the corresponding domain elements should be visited.
7361 No direct relation between the image elements and the loop iterators
7362 in the generated AST should be assumed.
7364 Each AST is generated within a build.  The initial build
7365 simply specifies the constraints on the parameters (if any)
7366 and can be created, inspected, copied and freed using the following functions.
7368         #include <isl/ast_build.h>
7369         __isl_give isl_ast_build *isl_ast_build_from_context(
7370                 __isl_take isl_set *set);
7371         __isl_give isl_ast_build *isl_ast_build_copy(
7372                 __isl_keep isl_ast_build *build);
7373         __isl_null isl_ast_build *isl_ast_build_free(
7374                 __isl_take isl_ast_build *build);
7376 The C<set> argument is usually a parameter set with zero or more parameters.
7377 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
7378 and L</"Fine-grained Control over AST Generation">.
7379 Finally, the AST itself can be constructed using the following
7380 function.
7382         #include <isl/ast_build.h>
7383         __isl_give isl_ast_node *isl_ast_build_ast_from_schedule(
7384                 __isl_keep isl_ast_build *build,
7385                 __isl_take isl_union_map *schedule);
7387 =head3 Inspecting the AST
7389 The basic properties of an AST node can be obtained as follows.
7391         #include <isl/ast.h>
7392         enum isl_ast_node_type isl_ast_node_get_type(
7393                 __isl_keep isl_ast_node *node);
7395 The type of an AST node is one of
7396 C<isl_ast_node_for>,
7397 C<isl_ast_node_if>,
7398 C<isl_ast_node_block> or
7399 C<isl_ast_node_user>.
7400 An C<isl_ast_node_for> represents a for node.
7401 An C<isl_ast_node_if> represents an if node.
7402 An C<isl_ast_node_block> represents a compound node.
7403 An C<isl_ast_node_user> represents an expression statement.
7404 An expression statement typically corresponds to a domain element, i.e.,
7405 one of the elements that is visited by the AST.
7407 Each type of node has its own additional properties.
7409         #include <isl/ast.h>
7410         __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
7411                 __isl_keep isl_ast_node *node);
7412         __isl_give isl_ast_expr *isl_ast_node_for_get_init(
7413                 __isl_keep isl_ast_node *node);
7414         __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
7415                 __isl_keep isl_ast_node *node);
7416         __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
7417                 __isl_keep isl_ast_node *node);
7418         __isl_give isl_ast_node *isl_ast_node_for_get_body(
7419                 __isl_keep isl_ast_node *node);
7420         int isl_ast_node_for_is_degenerate(
7421                 __isl_keep isl_ast_node *node);
7423 An C<isl_ast_for> is considered degenerate if it is known to execute
7424 exactly once.
7426         #include <isl/ast.h>
7427         __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
7428                 __isl_keep isl_ast_node *node);
7429         __isl_give isl_ast_node *isl_ast_node_if_get_then(
7430                 __isl_keep isl_ast_node *node);
7431         int isl_ast_node_if_has_else(
7432                 __isl_keep isl_ast_node *node);
7433         __isl_give isl_ast_node *isl_ast_node_if_get_else(
7434                 __isl_keep isl_ast_node *node);
7436         __isl_give isl_ast_node_list *
7437         isl_ast_node_block_get_children(
7438                 __isl_keep isl_ast_node *node);
7440         __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
7441                 __isl_keep isl_ast_node *node);
7443 Each of the returned C<isl_ast_expr>s can in turn be inspected using
7444 the following functions.
7446         #include <isl/ast.h>
7447         enum isl_ast_expr_type isl_ast_expr_get_type(
7448                 __isl_keep isl_ast_expr *expr);
7450 The type of an AST expression is one of
7451 C<isl_ast_expr_op>,
7452 C<isl_ast_expr_id> or
7453 C<isl_ast_expr_int>.
7454 An C<isl_ast_expr_op> represents the result of an operation.
7455 An C<isl_ast_expr_id> represents an identifier.
7456 An C<isl_ast_expr_int> represents an integer value.
7458 Each type of expression has its own additional properties.
7460         #include <isl/ast.h>
7461         enum isl_ast_op_type isl_ast_expr_get_op_type(
7462                 __isl_keep isl_ast_expr *expr);
7463         int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
7464         __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
7465                 __isl_keep isl_ast_expr *expr, int pos);
7466         int isl_ast_node_foreach_ast_op_type(
7467                 __isl_keep isl_ast_node *node,
7468                 int (*fn)(enum isl_ast_op_type type, void *user),
7469                 void *user);
7471 C<isl_ast_expr_get_op_type> returns the type of the operation
7472 performed.  C<isl_ast_expr_get_op_n_arg> returns the number of
7473 arguments.  C<isl_ast_expr_get_op_arg> returns the specified
7474 argument.
7475 C<isl_ast_node_foreach_ast_op_type> calls C<fn> for each distinct
7476 C<isl_ast_op_type> that appears in C<node>.
7477 The operation type is one of the following.
7479 =over
7481 =item C<isl_ast_op_and>
7483 Logical I<and> of two arguments.
7484 Both arguments can be evaluated.
7486 =item C<isl_ast_op_and_then>
7488 Logical I<and> of two arguments.
7489 The second argument can only be evaluated if the first evaluates to true.
7491 =item C<isl_ast_op_or>
7493 Logical I<or> of two arguments.
7494 Both arguments can be evaluated.
7496 =item C<isl_ast_op_or_else>
7498 Logical I<or> of two arguments.
7499 The second argument can only be evaluated if the first evaluates to false.
7501 =item C<isl_ast_op_max>
7503 Maximum of two or more arguments.
7505 =item C<isl_ast_op_min>
7507 Minimum of two or more arguments.
7509 =item C<isl_ast_op_minus>
7511 Change sign.
7513 =item C<isl_ast_op_add>
7515 Sum of two arguments.
7517 =item C<isl_ast_op_sub>
7519 Difference of two arguments.
7521 =item C<isl_ast_op_mul>
7523 Product of two arguments.
7525 =item C<isl_ast_op_div>
7527 Exact division.  That is, the result is known to be an integer.
7529 =item C<isl_ast_op_fdiv_q>
7531 Result of integer division, rounded towards negative
7532 infinity.
7534 =item C<isl_ast_op_pdiv_q>
7536 Result of integer division, where dividend is known to be non-negative.
7538 =item C<isl_ast_op_pdiv_r>
7540 Remainder of integer division, where dividend is known to be non-negative.
7542 =item C<isl_ast_op_zdiv_r>
7544 Equal to zero iff the remainder on integer division is zero.
7546 =item C<isl_ast_op_cond>
7548 Conditional operator defined on three arguments.
7549 If the first argument evaluates to true, then the result
7550 is equal to the second argument.  Otherwise, the result
7551 is equal to the third argument.
7552 The second and third argument may only be evaluated if
7553 the first argument evaluates to true and false, respectively.
7554 Corresponds to C<a ? b : c> in C.
7556 =item C<isl_ast_op_select>
7558 Conditional operator defined on three arguments.
7559 If the first argument evaluates to true, then the result
7560 is equal to the second argument.  Otherwise, the result
7561 is equal to the third argument.
7562 The second and third argument may be evaluated independently
7563 of the value of the first argument.
7564 Corresponds to C<a * b + (1 - a) * c> in C.
7566 =item C<isl_ast_op_eq>
7568 Equality relation.
7570 =item C<isl_ast_op_le>
7572 Less than or equal relation.
7574 =item C<isl_ast_op_lt>
7576 Less than relation.
7578 =item C<isl_ast_op_ge>
7580 Greater than or equal relation.
7582 =item C<isl_ast_op_gt>
7584 Greater than relation.
7586 =item C<isl_ast_op_call>
7588 A function call.
7589 The number of arguments of the C<isl_ast_expr> is one more than
7590 the number of arguments in the function call, the first argument
7591 representing the function being called.
7593 =item C<isl_ast_op_access>
7595 An array access.
7596 The number of arguments of the C<isl_ast_expr> is one more than
7597 the number of index expressions in the array access, the first argument
7598 representing the array being accessed.
7600 =item C<isl_ast_op_member>
7602 A member access.
7603 This operation has two arguments, a structure and the name of
7604 the member of the structure being accessed.
7606 =back
7608         #include <isl/ast.h>
7609         __isl_give isl_id *isl_ast_expr_get_id(
7610                 __isl_keep isl_ast_expr *expr);
7612 Return the identifier represented by the AST expression.
7614         #include <isl/ast.h>
7615         __isl_give isl_val *isl_ast_expr_get_val(
7616                 __isl_keep isl_ast_expr *expr);
7618 Return the integer represented by the AST expression.
7620 =head3 Properties of ASTs
7622         #include <isl/ast.h>
7623         int isl_ast_expr_is_equal(__isl_keep isl_ast_expr *expr1,
7624                 __isl_keep isl_ast_expr *expr2);
7626 Check if two C<isl_ast_expr>s are equal to each other.
7628 =head3 Manipulating and printing the AST
7630 AST nodes can be copied and freed using the following functions.
7632         #include <isl/ast.h>
7633         __isl_give isl_ast_node *isl_ast_node_copy(
7634                 __isl_keep isl_ast_node *node);
7635         __isl_null isl_ast_node *isl_ast_node_free(
7636                 __isl_take isl_ast_node *node);
7638 AST expressions can be copied and freed using the following functions.
7640         #include <isl/ast.h>
7641         __isl_give isl_ast_expr *isl_ast_expr_copy(
7642                 __isl_keep isl_ast_expr *expr);
7643         __isl_null isl_ast_expr *isl_ast_expr_free(
7644                 __isl_take isl_ast_expr *expr);
7646 New AST expressions can be created either directly or within
7647 the context of an C<isl_ast_build>.
7649         #include <isl/ast.h>
7650         __isl_give isl_ast_expr *isl_ast_expr_from_val(
7651                 __isl_take isl_val *v);
7652         __isl_give isl_ast_expr *isl_ast_expr_from_id(
7653                 __isl_take isl_id *id);
7654         __isl_give isl_ast_expr *isl_ast_expr_neg(
7655                 __isl_take isl_ast_expr *expr);
7656         __isl_give isl_ast_expr *isl_ast_expr_address_of(
7657                 __isl_take isl_ast_expr *expr);
7658         __isl_give isl_ast_expr *isl_ast_expr_add(
7659                 __isl_take isl_ast_expr *expr1,
7660                 __isl_take isl_ast_expr *expr2);
7661         __isl_give isl_ast_expr *isl_ast_expr_sub(
7662                 __isl_take isl_ast_expr *expr1,
7663                 __isl_take isl_ast_expr *expr2);
7664         __isl_give isl_ast_expr *isl_ast_expr_mul(
7665                 __isl_take isl_ast_expr *expr1,
7666                 __isl_take isl_ast_expr *expr2);
7667         __isl_give isl_ast_expr *isl_ast_expr_div(
7668                 __isl_take isl_ast_expr *expr1,
7669                 __isl_take isl_ast_expr *expr2);
7670         __isl_give isl_ast_expr *isl_ast_expr_and(
7671                 __isl_take isl_ast_expr *expr1,
7672                 __isl_take isl_ast_expr *expr2)
7673         __isl_give isl_ast_expr *isl_ast_expr_or(
7674                 __isl_take isl_ast_expr *expr1,
7675                 __isl_take isl_ast_expr *expr2)
7676         __isl_give isl_ast_expr *isl_ast_expr_eq(
7677                 __isl_take isl_ast_expr *expr1,
7678                 __isl_take isl_ast_expr *expr2);
7679         __isl_give isl_ast_expr *isl_ast_expr_le(
7680                 __isl_take isl_ast_expr *expr1,
7681                 __isl_take isl_ast_expr *expr2);
7682         __isl_give isl_ast_expr *isl_ast_expr_lt(
7683                 __isl_take isl_ast_expr *expr1,
7684                 __isl_take isl_ast_expr *expr2);
7685         __isl_give isl_ast_expr *isl_ast_expr_ge(
7686                 __isl_take isl_ast_expr *expr1,
7687                 __isl_take isl_ast_expr *expr2);
7688         __isl_give isl_ast_expr *isl_ast_expr_gt(
7689                 __isl_take isl_ast_expr *expr1,
7690                 __isl_take isl_ast_expr *expr2);
7691         __isl_give isl_ast_expr *isl_ast_expr_access(
7692                 __isl_take isl_ast_expr *array,
7693                 __isl_take isl_ast_expr_list *indices);
7695 The function C<isl_ast_expr_address_of> can be applied to an
7696 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
7697 to represent the address of the C<isl_ast_expr_access>.
7699         #include <isl/ast_build.h>
7700         __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
7701                 __isl_keep isl_ast_build *build,
7702                 __isl_take isl_pw_aff *pa);
7703         __isl_give isl_ast_expr *
7704         isl_ast_build_access_from_pw_multi_aff(
7705                 __isl_keep isl_ast_build *build,
7706                 __isl_take isl_pw_multi_aff *pma);
7707         __isl_give isl_ast_expr *
7708         isl_ast_build_access_from_multi_pw_aff(
7709                 __isl_keep isl_ast_build *build,
7710                 __isl_take isl_multi_pw_aff *mpa);
7711         __isl_give isl_ast_expr *
7712         isl_ast_build_call_from_pw_multi_aff(
7713                 __isl_keep isl_ast_build *build,
7714                 __isl_take isl_pw_multi_aff *pma);
7715         __isl_give isl_ast_expr *
7716         isl_ast_build_call_from_multi_pw_aff(
7717                 __isl_keep isl_ast_build *build,
7718                 __isl_take isl_multi_pw_aff *mpa);
7720 The domains of C<pa>, C<mpa> and C<pma> should correspond
7721 to the schedule space of C<build>.
7722 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
7723 the function being called.
7724 If the accessed space is a nested relation, then it is taken
7725 to represent an access of the member specified by the range
7726 of this nested relation of the structure specified by the domain
7727 of the nested relation.
7729 The following functions can be used to modify an C<isl_ast_expr>.
7731         #include <isl/ast.h>
7732         __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
7733                 __isl_take isl_ast_expr *expr, int pos,
7734                 __isl_take isl_ast_expr *arg);
7736 Replace the argument of C<expr> at position C<pos> by C<arg>.
7738         #include <isl/ast.h>
7739         __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
7740                 __isl_take isl_ast_expr *expr,
7741                 __isl_take isl_id_to_ast_expr *id2expr);
7743 The function C<isl_ast_expr_substitute_ids> replaces the
7744 subexpressions of C<expr> of type C<isl_ast_expr_id>
7745 by the corresponding expression in C<id2expr>, if there is any.
7748 User specified data can be attached to an C<isl_ast_node> and obtained
7749 from the same C<isl_ast_node> using the following functions.
7751         #include <isl/ast.h>
7752         __isl_give isl_ast_node *isl_ast_node_set_annotation(
7753                 __isl_take isl_ast_node *node,
7754                 __isl_take isl_id *annotation);
7755         __isl_give isl_id *isl_ast_node_get_annotation(
7756                 __isl_keep isl_ast_node *node);
7758 Basic printing can be performed using the following functions.
7760         #include <isl/ast.h>
7761         __isl_give isl_printer *isl_printer_print_ast_expr(
7762                 __isl_take isl_printer *p,
7763                 __isl_keep isl_ast_expr *expr);
7764         __isl_give isl_printer *isl_printer_print_ast_node(
7765                 __isl_take isl_printer *p,
7766                 __isl_keep isl_ast_node *node);
7767         __isl_give char *isl_ast_expr_to_str(
7768                 __isl_keep isl_ast_expr *expr);
7770 More advanced printing can be performed using the following functions.
7772         #include <isl/ast.h>
7773         __isl_give isl_printer *isl_ast_op_type_print_macro(
7774                 enum isl_ast_op_type type,
7775                 __isl_take isl_printer *p);
7776         __isl_give isl_printer *isl_ast_node_print_macros(
7777                 __isl_keep isl_ast_node *node,
7778                 __isl_take isl_printer *p);
7779         __isl_give isl_printer *isl_ast_node_print(
7780                 __isl_keep isl_ast_node *node,
7781                 __isl_take isl_printer *p,
7782                 __isl_take isl_ast_print_options *options);
7783         __isl_give isl_printer *isl_ast_node_for_print(
7784                 __isl_keep isl_ast_node *node,
7785                 __isl_take isl_printer *p,
7786                 __isl_take isl_ast_print_options *options);
7787         __isl_give isl_printer *isl_ast_node_if_print(
7788                 __isl_keep isl_ast_node *node,
7789                 __isl_take isl_printer *p,
7790                 __isl_take isl_ast_print_options *options);
7792 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
7793 C<isl> may print out an AST that makes use of macros such
7794 as C<floord>, C<min> and C<max>.
7795 C<isl_ast_op_type_print_macro> prints out the macro
7796 corresponding to a specific C<isl_ast_op_type>.
7797 C<isl_ast_node_print_macros> scans the C<isl_ast_node>
7798 for expressions where these macros would be used and prints
7799 out the required macro definitions.
7800 Essentially, C<isl_ast_node_print_macros> calls
7801 C<isl_ast_node_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
7802 as function argument.
7803 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
7804 C<isl_ast_node_if_print> print an C<isl_ast_node>
7805 in C<ISL_FORMAT_C>, but allow for some extra control
7806 through an C<isl_ast_print_options> object.
7807 This object can be created using the following functions.
7809         #include <isl/ast.h>
7810         __isl_give isl_ast_print_options *
7811         isl_ast_print_options_alloc(isl_ctx *ctx);
7812         __isl_give isl_ast_print_options *
7813         isl_ast_print_options_copy(
7814                 __isl_keep isl_ast_print_options *options);
7815         __isl_null isl_ast_print_options *
7816         isl_ast_print_options_free(
7817                 __isl_take isl_ast_print_options *options);
7819         __isl_give isl_ast_print_options *
7820         isl_ast_print_options_set_print_user(
7821                 __isl_take isl_ast_print_options *options,
7822                 __isl_give isl_printer *(*print_user)(
7823                         __isl_take isl_printer *p,
7824                         __isl_take isl_ast_print_options *options,
7825                         __isl_keep isl_ast_node *node, void *user),
7826                 void *user);
7827         __isl_give isl_ast_print_options *
7828         isl_ast_print_options_set_print_for(
7829                 __isl_take isl_ast_print_options *options,
7830                 __isl_give isl_printer *(*print_for)(
7831                         __isl_take isl_printer *p,
7832                         __isl_take isl_ast_print_options *options,
7833                         __isl_keep isl_ast_node *node, void *user),
7834                 void *user);
7836 The callback set by C<isl_ast_print_options_set_print_user>
7837 is called whenever a node of type C<isl_ast_node_user> needs to
7838 be printed.
7839 The callback set by C<isl_ast_print_options_set_print_for>
7840 is called whenever a node of type C<isl_ast_node_for> needs to
7841 be printed.
7842 Note that C<isl_ast_node_for_print> will I<not> call the
7843 callback set by C<isl_ast_print_options_set_print_for> on the node
7844 on which C<isl_ast_node_for_print> is called, but only on nested
7845 nodes of type C<isl_ast_node_for>.  It is therefore safe to
7846 call C<isl_ast_node_for_print> from within the callback set by
7847 C<isl_ast_print_options_set_print_for>.
7849 The following option determines the type to be used for iterators
7850 while printing the AST.
7852         int isl_options_set_ast_iterator_type(
7853                 isl_ctx *ctx, const char *val);
7854         const char *isl_options_get_ast_iterator_type(
7855                 isl_ctx *ctx);
7857 The AST printer only prints body nodes as blocks if these
7858 blocks cannot be safely omitted.
7859 For example, a C<for> node with one body node will not be
7860 surrounded with braces in C<ISL_FORMAT_C>.
7861 A block will always be printed by setting the following option.
7863         int isl_options_set_ast_always_print_block(isl_ctx *ctx,
7864                 int val);
7865         int isl_options_get_ast_always_print_block(isl_ctx *ctx);
7867 =head3 Options
7869         #include <isl/ast_build.h>
7870         int isl_options_set_ast_build_atomic_upper_bound(
7871                 isl_ctx *ctx, int val);
7872         int isl_options_get_ast_build_atomic_upper_bound(
7873                 isl_ctx *ctx);
7874         int isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
7875                 int val);
7876         int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
7877         int isl_options_set_ast_build_exploit_nested_bounds(
7878                 isl_ctx *ctx, int val);
7879         int isl_options_get_ast_build_exploit_nested_bounds(
7880                 isl_ctx *ctx);
7881         int isl_options_set_ast_build_group_coscheduled(
7882                 isl_ctx *ctx, int val);
7883         int isl_options_get_ast_build_group_coscheduled(
7884                 isl_ctx *ctx);
7885         int isl_options_set_ast_build_scale_strides(
7886                 isl_ctx *ctx, int val);
7887         int isl_options_get_ast_build_scale_strides(
7888                 isl_ctx *ctx);
7889         int isl_options_set_ast_build_allow_else(isl_ctx *ctx,
7890                 int val);
7891         int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
7892         int isl_options_set_ast_build_allow_or(isl_ctx *ctx,
7893                 int val);
7894         int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
7896 =over
7898 =item * ast_build_atomic_upper_bound
7900 Generate loop upper bounds that consist of the current loop iterator,
7901 an operator and an expression not involving the iterator.
7902 If this option is not set, then the current loop iterator may appear
7903 several times in the upper bound.
7904 For example, when this option is turned off, AST generation
7905 for the schedule
7907         [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
7909 produces
7911         for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
7912           A(c0);
7914 When the option is turned on, the following AST is generated
7916         for (int c0 = 0; c0 <= min(100, n); c0 += 1)
7917           A(c0);
7919 =item * ast_build_prefer_pdiv
7921 If this option is turned off, then the AST generation will
7922 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
7923 operators, but no C<isl_ast_op_pdiv_q> or
7924 C<isl_ast_op_pdiv_r> operators.
7925 If this options is turned on, then C<isl> will try to convert
7926 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
7927 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
7929 =item * ast_build_exploit_nested_bounds
7931 Simplify conditions based on bounds of nested for loops.
7932 In particular, remove conditions that are implied by the fact
7933 that one or more nested loops have at least one iteration,
7934 meaning that the upper bound is at least as large as the lower bound.
7935 For example, when this option is turned off, AST generation
7936 for the schedule
7938         [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
7939                                         0 <= j <= M }
7941 produces
7943         if (M >= 0)
7944           for (int c0 = 0; c0 <= N; c0 += 1)
7945             for (int c1 = 0; c1 <= M; c1 += 1)
7946               A(c0, c1);
7948 When the option is turned on, the following AST is generated
7950         for (int c0 = 0; c0 <= N; c0 += 1)
7951           for (int c1 = 0; c1 <= M; c1 += 1)
7952             A(c0, c1);
7954 =item * ast_build_group_coscheduled
7956 If two domain elements are assigned the same schedule point, then
7957 they may be executed in any order and they may even appear in different
7958 loops.  If this options is set, then the AST generator will make
7959 sure that coscheduled domain elements do not appear in separate parts
7960 of the AST.  This is useful in case of nested AST generation
7961 if the outer AST generation is given only part of a schedule
7962 and the inner AST generation should handle the domains that are
7963 coscheduled by this initial part of the schedule together.
7964 For example if an AST is generated for a schedule
7966         { A[i] -> [0]; B[i] -> [0] }
7968 then the C<isl_ast_build_set_create_leaf> callback described
7969 below may get called twice, once for each domain.
7970 Setting this option ensures that the callback is only called once
7971 on both domains together.
7973 =item * ast_build_separation_bounds
7975 This option specifies which bounds to use during separation.
7976 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
7977 then all (possibly implicit) bounds on the current dimension will
7978 be used during separation.
7979 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
7980 then only those bounds that are explicitly available will
7981 be used during separation.
7983 =item * ast_build_scale_strides
7985 This option specifies whether the AST generator is allowed
7986 to scale down iterators of strided loops.
7988 =item * ast_build_allow_else
7990 This option specifies whether the AST generator is allowed
7991 to construct if statements with else branches.
7993 =item * ast_build_allow_or
7995 This option specifies whether the AST generator is allowed
7996 to construct if conditions with disjunctions.
7998 =back
8000 =head3 Fine-grained Control over AST Generation
8002 Besides specifying the constraints on the parameters,
8003 an C<isl_ast_build> object can be used to control
8004 various aspects of the AST generation process.
8005 The most prominent way of control is through ``options'',
8006 which can be set using the following function.
8008         #include <isl/ast_build.h>
8009         __isl_give isl_ast_build *
8010         isl_ast_build_set_options(
8011                 __isl_take isl_ast_build *control,
8012                 __isl_take isl_union_map *options);
8014 The options are encoded in an C<isl_union_map>.
8015 The domain of this union relation refers to the schedule domain,
8016 i.e., the range of the schedule passed to C<isl_ast_build_ast_from_schedule>.
8017 In the case of nested AST generation (see L</"Nested AST Generation">),
8018 the domain of C<options> should refer to the extra piece of the schedule.
8019 That is, it should be equal to the range of the wrapped relation in the
8020 range of the schedule.
8021 The range of the options can consist of elements in one or more spaces,
8022 the names of which determine the effect of the option.
8023 The values of the range typically also refer to the schedule dimension
8024 to which the option applies.  In case of nested AST generation
8025 (see L</"Nested AST Generation">), these values refer to the position
8026 of the schedule dimension within the innermost AST generation.
8027 The constraints on the domain elements of
8028 the option should only refer to this dimension and earlier dimensions.
8029 We consider the following spaces.
8031 =over
8033 =item C<separation_class>
8035 This space is a wrapped relation between two one dimensional spaces.
8036 The input space represents the schedule dimension to which the option
8037 applies and the output space represents the separation class.
8038 While constructing a loop corresponding to the specified schedule
8039 dimension(s), the AST generator will try to generate separate loops
8040 for domain elements that are assigned different classes.
8041 If only some of the elements are assigned a class, then those elements
8042 that are not assigned any class will be treated as belonging to a class
8043 that is separate from the explicitly assigned classes.
8044 The typical use case for this option is to separate full tiles from
8045 partial tiles.
8046 The other options, described below, are applied after the separation
8047 into classes.
8049 As an example, consider the separation into full and partial tiles
8050 of a tiling of a triangular domain.
8051 Take, for example, the domain
8053         { A[i,j] : 0 <= i,j and i + j <= 100 }
8055 and a tiling into tiles of 10 by 10.  The input to the AST generator
8056 is then the schedule
8058         { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
8059                                                 i + j <= 100 }
8061 Without any options, the following AST is generated
8063         for (int c0 = 0; c0 <= 10; c0 += 1)
8064           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
8065             for (int c2 = 10 * c0;
8066                  c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
8067                  c2 += 1)
8068               for (int c3 = 10 * c1;
8069                    c3 <= min(10 * c1 + 9, -c2 + 100);
8070                    c3 += 1)
8071                 A(c2, c3);
8073 Separation into full and partial tiles can be obtained by assigning
8074 a class, say C<0>, to the full tiles.  The full tiles are represented by those
8075 values of the first and second schedule dimensions for which there are
8076 values of the third and fourth dimensions to cover an entire tile.
8077 That is, we need to specify the following option
8079         { [a,b,c,d] -> separation_class[[0]->[0]] :
8080                 exists b': 0 <= 10a,10b' and
8081                            10a+9+10b'+9 <= 100;
8082           [a,b,c,d] -> separation_class[[1]->[0]] :
8083                 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
8085 which simplifies to
8087         { [a, b, c, d] -> separation_class[[1] -> [0]] :
8088                 a >= 0 and b >= 0 and b <= 8 - a;
8089           [a, b, c, d] -> separation_class[[0] -> [0]] :
8090                 a >= 0 and a <= 8 }
8092 With this option, the generated AST is as follows
8094         {
8095           for (int c0 = 0; c0 <= 8; c0 += 1) {
8096             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
8097               for (int c2 = 10 * c0;
8098                    c2 <= 10 * c0 + 9; c2 += 1)
8099                 for (int c3 = 10 * c1;
8100                      c3 <= 10 * c1 + 9; c3 += 1)
8101                   A(c2, c3);
8102             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
8103               for (int c2 = 10 * c0;
8104                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
8105                    c2 += 1)
8106                 for (int c3 = 10 * c1;
8107                      c3 <= min(-c2 + 100, 10 * c1 + 9);
8108                      c3 += 1)
8109                   A(c2, c3);
8110           }
8111           for (int c0 = 9; c0 <= 10; c0 += 1)
8112             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
8113               for (int c2 = 10 * c0;
8114                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
8115                    c2 += 1)
8116                 for (int c3 = 10 * c1;
8117                      c3 <= min(10 * c1 + 9, -c2 + 100);
8118                      c3 += 1)
8119                   A(c2, c3);
8120         }
8122 =item C<separate>
8124 This is a single-dimensional space representing the schedule dimension(s)
8125 to which ``separation'' should be applied.  Separation tries to split
8126 a loop into several pieces if this can avoid the generation of guards
8127 inside the loop.
8128 See also the C<atomic> option.
8130 =item C<atomic>
8132 This is a single-dimensional space representing the schedule dimension(s)
8133 for which the domains should be considered ``atomic''.  That is, the
8134 AST generator will make sure that any given domain space will only appear
8135 in a single loop at the specified level.
8137 Consider the following schedule
8139         { a[i] -> [i] : 0 <= i < 10;
8140           b[i] -> [i+1] : 0 <= i < 10 }
8142 If the following option is specified
8144         { [i] -> separate[x] }
8146 then the following AST will be generated
8148         {
8149           a(0);
8150           for (int c0 = 1; c0 <= 9; c0 += 1) {
8151             a(c0);
8152             b(c0 - 1);
8153           }
8154           b(9);
8155         }
8157 If, on the other hand, the following option is specified
8159         { [i] -> atomic[x] }
8161 then the following AST will be generated
8163         for (int c0 = 0; c0 <= 10; c0 += 1) {
8164           if (c0 <= 9)
8165             a(c0);
8166           if (c0 >= 1)
8167             b(c0 - 1);
8168         }
8170 If neither C<atomic> nor C<separate> is specified, then the AST generator
8171 may produce either of these two results or some intermediate form.
8173 =item C<unroll>
8175 This is a single-dimensional space representing the schedule dimension(s)
8176 that should be I<completely> unrolled.
8177 To obtain a partial unrolling, the user should apply an additional
8178 strip-mining to the schedule and fully unroll the inner loop.
8180 =back
8182 Additional control is available through the following functions.
8184         #include <isl/ast_build.h>
8185         __isl_give isl_ast_build *
8186         isl_ast_build_set_iterators(
8187                 __isl_take isl_ast_build *control,
8188                 __isl_take isl_id_list *iterators);
8190 The function C<isl_ast_build_set_iterators> allows the user to
8191 specify a list of iterator C<isl_id>s to be used as iterators.
8192 If the input schedule is injective, then
8193 the number of elements in this list should be as large as the dimension
8194 of the schedule space, but no direct correspondence should be assumed
8195 between dimensions and elements.
8196 If the input schedule is not injective, then an additional number
8197 of C<isl_id>s equal to the largest dimension of the input domains
8198 may be required.
8199 If the number of provided C<isl_id>s is insufficient, then additional
8200 names are automatically generated.
8202         #include <isl/ast_build.h>
8203         __isl_give isl_ast_build *
8204         isl_ast_build_set_create_leaf(
8205                 __isl_take isl_ast_build *control,
8206                 __isl_give isl_ast_node *(*fn)(
8207                         __isl_take isl_ast_build *build,
8208                         void *user), void *user);
8211 C<isl_ast_build_set_create_leaf> function allows for the
8212 specification of a callback that should be called whenever the AST
8213 generator arrives at an element of the schedule domain.
8214 The callback should return an AST node that should be inserted
8215 at the corresponding position of the AST.  The default action (when
8216 the callback is not set) is to continue generating parts of the AST to scan
8217 all the domain elements associated to the schedule domain element
8218 and to insert user nodes, ``calling'' the domain element, for each of them.
8219 The C<build> argument contains the current state of the C<isl_ast_build>.
8220 To ease nested AST generation (see L</"Nested AST Generation">),
8221 all control information that is
8222 specific to the current AST generation such as the options and
8223 the callbacks has been removed from this C<isl_ast_build>.
8224 The callback would typically return the result of a nested
8225 AST generation or a
8226 user defined node created using the following function.
8228         #include <isl/ast.h>
8229         __isl_give isl_ast_node *isl_ast_node_alloc_user(
8230                 __isl_take isl_ast_expr *expr);
8232         #include <isl/ast_build.h>
8233         __isl_give isl_ast_build *
8234         isl_ast_build_set_at_each_domain(
8235                 __isl_take isl_ast_build *build,
8236                 __isl_give isl_ast_node *(*fn)(
8237                         __isl_take isl_ast_node *node,
8238                         __isl_keep isl_ast_build *build,
8239                         void *user), void *user);
8240         __isl_give isl_ast_build *
8241         isl_ast_build_set_before_each_for(
8242                 __isl_take isl_ast_build *build,
8243                 __isl_give isl_id *(*fn)(
8244                         __isl_keep isl_ast_build *build,
8245                         void *user), void *user);
8246         __isl_give isl_ast_build *
8247         isl_ast_build_set_after_each_for(
8248                 __isl_take isl_ast_build *build,
8249                 __isl_give isl_ast_node *(*fn)(
8250                         __isl_take isl_ast_node *node,
8251                         __isl_keep isl_ast_build *build,
8252                         void *user), void *user);
8254 The callback set by C<isl_ast_build_set_at_each_domain> will
8255 be called for each domain AST node.
8256 The callbacks set by C<isl_ast_build_set_before_each_for>
8257 and C<isl_ast_build_set_after_each_for> will be called
8258 for each for AST node.  The first will be called in depth-first
8259 pre-order, while the second will be called in depth-first post-order.
8260 Since C<isl_ast_build_set_before_each_for> is called before the for
8261 node is actually constructed, it is only passed an C<isl_ast_build>.
8262 The returned C<isl_id> will be added as an annotation (using
8263 C<isl_ast_node_set_annotation>) to the constructed for node.
8264 In particular, if the user has also specified an C<after_each_for>
8265 callback, then the annotation can be retrieved from the node passed to
8266 that callback using C<isl_ast_node_get_annotation>.
8267 All callbacks should C<NULL> on failure.
8268 The given C<isl_ast_build> can be used to create new
8269 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
8270 or C<isl_ast_build_call_from_pw_multi_aff>.
8272 =head3 Nested AST Generation
8274 C<isl> allows the user to create an AST within the context
8275 of another AST.  These nested ASTs are created using the
8276 same C<isl_ast_build_ast_from_schedule> function that is used to create the
8277 outer AST.  The C<build> argument should be an C<isl_ast_build>
8278 passed to a callback set by
8279 C<isl_ast_build_set_create_leaf>.
8280 The space of the range of the C<schedule> argument should refer
8281 to this build.  In particular, the space should be a wrapped
8282 relation and the domain of this wrapped relation should be the
8283 same as that of the range of the schedule returned by
8284 C<isl_ast_build_get_schedule> below.
8285 In practice, the new schedule is typically
8286 created by calling C<isl_union_map_range_product> on the old schedule
8287 and some extra piece of the schedule.
8288 The space of the schedule domain is also available from
8289 the C<isl_ast_build>.
8291         #include <isl/ast_build.h>
8292         __isl_give isl_union_map *isl_ast_build_get_schedule(
8293                 __isl_keep isl_ast_build *build);
8294         __isl_give isl_space *isl_ast_build_get_schedule_space(
8295                 __isl_keep isl_ast_build *build);
8296         __isl_give isl_ast_build *isl_ast_build_restrict(
8297                 __isl_take isl_ast_build *build,
8298                 __isl_take isl_set *set);
8300 The C<isl_ast_build_get_schedule> function returns a (partial)
8301 schedule for the domains elements for which part of the AST still needs to
8302 be generated in the current build.
8303 In particular, the domain elements are mapped to those iterations of the loops
8304 enclosing the current point of the AST generation inside which
8305 the domain elements are executed.
8306 No direct correspondence between
8307 the input schedule and this schedule should be assumed.
8308 The space obtained from C<isl_ast_build_get_schedule_space> can be used
8309 to create a set for C<isl_ast_build_restrict> to intersect
8310 with the current build.  In particular, the set passed to
8311 C<isl_ast_build_restrict> can have additional parameters.
8312 The ids of the set dimensions in the space returned by
8313 C<isl_ast_build_get_schedule_space> correspond to the
8314 iterators of the already generated loops.
8315 The user should not rely on the ids of the output dimensions
8316 of the relations in the union relation returned by
8317 C<isl_ast_build_get_schedule> having any particular value.
8319 =head1 Applications
8321 Although C<isl> is mainly meant to be used as a library,
8322 it also contains some basic applications that use some
8323 of the functionality of C<isl>.
8324 The input may be specified in either the L<isl format>
8325 or the L<PolyLib format>.
8327 =head2 C<isl_polyhedron_sample>
8329 C<isl_polyhedron_sample> takes a polyhedron as input and prints
8330 an integer element of the polyhedron, if there is any.
8331 The first column in the output is the denominator and is always
8332 equal to 1.  If the polyhedron contains no integer points,
8333 then a vector of length zero is printed.
8335 =head2 C<isl_pip>
8337 C<isl_pip> takes the same input as the C<example> program
8338 from the C<piplib> distribution, i.e., a set of constraints
8339 on the parameters, a line containing only -1 and finally a set
8340 of constraints on a parametric polyhedron.
8341 The coefficients of the parameters appear in the last columns
8342 (but before the final constant column).
8343 The output is the lexicographic minimum of the parametric polyhedron.
8344 As C<isl> currently does not have its own output format, the output
8345 is just a dump of the internal state.
8347 =head2 C<isl_polyhedron_minimize>
8349 C<isl_polyhedron_minimize> computes the minimum of some linear
8350 or affine objective function over the integer points in a polyhedron.
8351 If an affine objective function
8352 is given, then the constant should appear in the last column.
8354 =head2 C<isl_polytope_scan>
8356 Given a polytope, C<isl_polytope_scan> prints
8357 all integer points in the polytope.
8359 =head2 C<isl_codegen>
8361 Given a schedule, a context set and an options relation,
8362 C<isl_codegen> prints out an AST that scans the domain elements
8363 of the schedule in the order of their image(s) taking into account
8364 the constraints in the context set.