add isl_schedule_sequence and isl_schedule_set
[isl.git] / doc / user.pod
blob9293accab42054a10fd81e4034bbafd1d2292ba4
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 =item * Band forests have been replaced by schedule trees.
227 =back
229 =head1 License
231 C<isl> is released under the MIT license.
233 =over
235 Permission is hereby granted, free of charge, to any person obtaining a copy of
236 this software and associated documentation files (the "Software"), to deal in
237 the Software without restriction, including without limitation the rights to
238 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
239 of the Software, and to permit persons to whom the Software is furnished to do
240 so, subject to the following conditions:
242 The above copyright notice and this permission notice shall be included in all
243 copies or substantial portions of the Software.
245 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
246 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
247 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
248 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
249 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
250 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
251 SOFTWARE.
253 =back
255 Note that by default C<isl> requires C<GMP>, which is released
256 under the GNU Lesser General Public License (LGPL).  This means
257 that code linked against C<isl> is also linked against LGPL code.
259 When configuring with C<--with-int=imath>, C<isl> will link against C<imath>, a
260 library for exact integer arithmetic released under the MIT license.
262 =head1 Installation
264 The source of C<isl> can be obtained either as a tarball
265 or from the git repository.  Both are available from
266 L<http://freshmeat.net/projects/isl/>.
267 The installation process depends on how you obtained
268 the source.
270 =head2 Installation from the git repository
272 =over
274 =item 1 Clone or update the repository
276 The first time the source is obtained, you need to clone
277 the repository.
279         git clone git://repo.or.cz/isl.git
281 To obtain updates, you need to pull in the latest changes
283         git pull
285 =item 2 Optionally get C<imath> submodule
287 To build C<isl> with C<imath>, you need to obtain the C<imath>
288 submodule by running in the git source tree of C<isl>
290        git submodule init
291        git submodule update
293 This will fetch the required version of C<imath> in a subdirectory of C<isl>.
295 =item 2 Generate C<configure>
297         ./autogen.sh
299 =back
301 After performing the above steps, continue
302 with the L<Common installation instructions>.
304 =head2 Common installation instructions
306 =over
308 =item 1 Obtain C<GMP>
310 By default, building C<isl> requires C<GMP>, including its headers files.
311 Your distribution may not provide these header files by default
312 and you may need to install a package called C<gmp-devel> or something
313 similar.  Alternatively, C<GMP> can be built from
314 source, available from L<http://gmplib.org/>.
315 C<GMP> is not needed if you build C<isl> with C<imath>.
317 =item 2 Configure
319 C<isl> uses the standard C<autoconf> C<configure> script.
320 To run it, just type
322         ./configure
324 optionally followed by some configure options.
325 A complete list of options can be obtained by running
327         ./configure --help
329 Below we discuss some of the more common options.
331 =over
333 =item C<--prefix>
335 Installation prefix for C<isl>
337 =item C<--with-int=[gmp|imath]>
339 Select the integer library to be used by C<isl>, the default is C<gmp>.
340 Note that C<isl> may run significantly slower if you use C<imath>.
342 =item C<--with-gmp-prefix>
344 Installation prefix for C<GMP> (architecture-independent files).
346 =item C<--with-gmp-exec-prefix>
348 Installation prefix for C<GMP> (architecture-dependent files).
350 =back
352 =item 3 Compile
354         make
356 =item 4 Install (optional)
358         make install
360 =back
362 =head1 Integer Set Library
364 =head2 Memory Management
366 Since a high-level operation on isl objects usually involves
367 several substeps and since the user is usually not interested in
368 the intermediate results, most functions that return a new object
369 will also release all the objects passed as arguments.
370 If the user still wants to use one or more of these arguments
371 after the function call, she should pass along a copy of the
372 object rather than the object itself.
373 The user is then responsible for making sure that the original
374 object gets used somewhere else or is explicitly freed.
376 The arguments and return values of all documented functions are
377 annotated to make clear which arguments are released and which
378 arguments are preserved.  In particular, the following annotations
379 are used
381 =over
383 =item C<__isl_give>
385 C<__isl_give> means that a new object is returned.
386 The user should make sure that the returned pointer is
387 used exactly once as a value for an C<__isl_take> argument.
388 In between, it can be used as a value for as many
389 C<__isl_keep> arguments as the user likes.
390 There is one exception, and that is the case where the
391 pointer returned is C<NULL>.  Is this case, the user
392 is free to use it as an C<__isl_take> argument or not.
393 When applied to a C<char *>, the returned pointer needs to be
394 freed using C<free>.
396 =item C<__isl_null>
398 C<__isl_null> means that a C<NULL> value is returned.
400 =item C<__isl_take>
402 C<__isl_take> means that the object the argument points to
403 is taken over by the function and may no longer be used
404 by the user as an argument to any other function.
405 The pointer value must be one returned by a function
406 returning an C<__isl_give> pointer.
407 If the user passes in a C<NULL> value, then this will
408 be treated as an error in the sense that the function will
409 not perform its usual operation.  However, it will still
410 make sure that all the other C<__isl_take> arguments
411 are released.
413 =item C<__isl_keep>
415 C<__isl_keep> means that the function will only use the object
416 temporarily.  After the function has finished, the user
417 can still use it as an argument to other functions.
418 A C<NULL> value will be treated in the same way as
419 a C<NULL> value for an C<__isl_take> argument.
420 This annotation may also be used on return values of
421 type C<const char *>, in which case the returned pointer should
422 not be freed by the user and is only valid until the object
423 from which it was derived is updated or freed.
425 =back
427 =head2 Initialization
429 All manipulations of integer sets and relations occur within
430 the context of an C<isl_ctx>.
431 A given C<isl_ctx> can only be used within a single thread.
432 All arguments of a function are required to have been allocated
433 within the same context.
434 There are currently no functions available for moving an object
435 from one C<isl_ctx> to another C<isl_ctx>.  This means that
436 there is currently no way of safely moving an object from one
437 thread to another, unless the whole C<isl_ctx> is moved.
439 An C<isl_ctx> can be allocated using C<isl_ctx_alloc> and
440 freed using C<isl_ctx_free>.
441 All objects allocated within an C<isl_ctx> should be freed
442 before the C<isl_ctx> itself is freed.
444         isl_ctx *isl_ctx_alloc();
445         void isl_ctx_free(isl_ctx *ctx);
447 The user can impose a bound on the number of low-level I<operations>
448 that can be performed by an C<isl_ctx>.  This bound can be set and
449 retrieved using the following functions.  A bound of zero means that
450 no bound is imposed.  The number of operations performed can be
451 reset using C<isl_ctx_reset_operations>.  Note that the number
452 of low-level operations needed to perform a high-level computation
453 may differ significantly across different versions
454 of C<isl>, but it should be the same across different platforms
455 for the same version of C<isl>.
457 Warning: This feature is experimental.  C<isl> has good support to abort and
458 bail out during the computation, but this feature may exercise error code paths
459 that are normally not used that much. Consequently, it is not unlikely that
460 hidden bugs will be exposed.
462         void isl_ctx_set_max_operations(isl_ctx *ctx,
463                 unsigned long max_operations);
464         unsigned long isl_ctx_get_max_operations(isl_ctx *ctx);
465         void isl_ctx_reset_operations(isl_ctx *ctx);
467 In order to be able to create an object in the same context
468 as another object, most object types (described later in
469 this document) provide a function to obtain the context
470 in which the object was created.
472         #include <isl/val.h>
473         isl_ctx *isl_val_get_ctx(__isl_keep isl_val *val);
474         isl_ctx *isl_multi_val_get_ctx(
475                 __isl_keep isl_multi_val *mv);
477         #include <isl/id.h>
478         isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
480         #include <isl/local_space.h>
481         isl_ctx *isl_local_space_get_ctx(
482                 __isl_keep isl_local_space *ls);
484         #include <isl/set.h>
485         isl_ctx *isl_set_list_get_ctx(
486                 __isl_keep isl_set_list *list);
488         #include <isl/aff.h>
489         isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
490         isl_ctx *isl_multi_aff_get_ctx(
491                 __isl_keep isl_multi_aff *maff);
492         isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pa);
493         isl_ctx *isl_pw_multi_aff_get_ctx(
494                 __isl_keep isl_pw_multi_aff *pma);
495         isl_ctx *isl_multi_pw_aff_get_ctx(
496                 __isl_keep isl_multi_pw_aff *mpa);
497         isl_ctx *isl_union_pw_aff_get_ctx(
498                 __isl_keep isl_union_pw_aff *upa);
499         isl_ctx *isl_union_pw_multi_aff_get_ctx(
500                 __isl_keep isl_union_pw_multi_aff *upma);
501         isl_ctx *isl_multi_union_pw_aff_get_ctx(
502                 __isl_keep isl_multi_union_pw_aff *mupa);
504         #include <isl/id_to_ast_expr.h>
505         isl_ctx *isl_id_to_ast_expr_get_ctx(
506                 __isl_keep isl_id_to_ast_expr *id2expr);
508         #include <isl/point.h>
509         isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
511         #include <isl/vec.h>
512         isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
514         #include <isl/mat.h>
515         isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
517         #include <isl/vertices.h>
518         isl_ctx *isl_vertices_get_ctx(
519                 __isl_keep isl_vertices *vertices);
520         isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
521         isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
523         #include <isl/flow.h>
524         isl_ctx *isl_restriction_get_ctx(
525                 __isl_keep isl_restriction *restr);
527         #include <isl/schedule.h>
528         isl_ctx *isl_schedule_get_ctx(
529                 __isl_keep isl_schedule *sched);
530         isl_ctx *isl_schedule_constraints_get_ctx(
531                 __isl_keep isl_schedule_constraints *sc);
533         #include <isl/schedule_node.h>
534         isl_ctx *isl_schedule_node_get_ctx(
535                 __isl_keep isl_schedule_node *node);
537         #include <isl/band.h>
538         isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band);
540         #include <isl/ast_build.h>
541         isl_ctx *isl_ast_build_get_ctx(
542                 __isl_keep isl_ast_build *build);
544         #include <isl/ast.h>
545         isl_ctx *isl_ast_expr_get_ctx(
546                 __isl_keep isl_ast_expr *expr);
547         isl_ctx *isl_ast_node_get_ctx(
548                 __isl_keep isl_ast_node *node);
550 =head2 Values
552 An C<isl_val> represents an integer value, a rational value
553 or one of three special values, infinity, negative infinity and NaN.
554 Some predefined values can be created using the following functions.
556         #include <isl/val.h>
557         __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
558         __isl_give isl_val *isl_val_one(isl_ctx *ctx);
559         __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
560         __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
561         __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
562         __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
564 Specific integer values can be created using the following functions.
566         #include <isl/val.h>
567         __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
568                 long i);
569         __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
570                 unsigned long u);
571         __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
572                 size_t n, size_t size, const void *chunks);
574 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
575 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
576 The least significant digit is assumed to be stored first.
578 Value objects can be copied and freed using the following functions.
580         #include <isl/val.h>
581         __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
582         __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
584 They can be inspected using the following functions.
586         #include <isl/val.h>
587         long isl_val_get_num_si(__isl_keep isl_val *v);
588         long isl_val_get_den_si(__isl_keep isl_val *v);
589         double isl_val_get_d(__isl_keep isl_val *v);
590         size_t isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
591                 size_t size);
592         int isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
593                 size_t size, void *chunks);
595 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
596 of C<size> bytes needed to store the absolute value of the
597 numerator of C<v>.
598 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
599 which is assumed to have been preallocated by the caller.
600 The least significant digit is stored first.
601 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
602 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
603 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
605 An C<isl_val> can be modified using the following function.
607         #include <isl/val.h>
608         __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
609                 long i);
611 The following unary properties are defined on C<isl_val>s.
613         #include <isl/val.h>
614         int isl_val_sgn(__isl_keep isl_val *v);
615         int isl_val_is_zero(__isl_keep isl_val *v);
616         int isl_val_is_one(__isl_keep isl_val *v);
617         int isl_val_is_negone(__isl_keep isl_val *v);
618         int isl_val_is_nonneg(__isl_keep isl_val *v);
619         int isl_val_is_nonpos(__isl_keep isl_val *v);
620         int isl_val_is_pos(__isl_keep isl_val *v);
621         int isl_val_is_neg(__isl_keep isl_val *v);
622         int isl_val_is_int(__isl_keep isl_val *v);
623         int isl_val_is_rat(__isl_keep isl_val *v);
624         int isl_val_is_nan(__isl_keep isl_val *v);
625         int isl_val_is_infty(__isl_keep isl_val *v);
626         int isl_val_is_neginfty(__isl_keep isl_val *v);
628 Note that the sign of NaN is undefined.
630 The following binary properties are defined on pairs of C<isl_val>s.
632         #include <isl/val.h>
633         int isl_val_lt(__isl_keep isl_val *v1,
634                 __isl_keep isl_val *v2);
635         int isl_val_le(__isl_keep isl_val *v1,
636                 __isl_keep isl_val *v2);
637         int isl_val_gt(__isl_keep isl_val *v1,
638                 __isl_keep isl_val *v2);
639         int isl_val_ge(__isl_keep isl_val *v1,
640                 __isl_keep isl_val *v2);
641         int isl_val_eq(__isl_keep isl_val *v1,
642                 __isl_keep isl_val *v2);
643         int isl_val_ne(__isl_keep isl_val *v1,
644                 __isl_keep isl_val *v2);
645         int isl_val_abs_eq(__isl_keep isl_val *v1,
646                 __isl_keep isl_val *v2);
648 The function C<isl_val_abs_eq> checks whether its two arguments
649 are equal in absolute value.
651 For integer C<isl_val>s we additionally have the following binary property.
653         #include <isl/val.h>
654         int isl_val_is_divisible_by(__isl_keep isl_val *v1,
655                 __isl_keep isl_val *v2);
657 An C<isl_val> can also be compared to an integer using the following
658 function.  The result is undefined for NaN.
660         #include <isl/val.h>
661         int isl_val_cmp_si(__isl_keep isl_val *v, long i);
663 The following unary operations are available on C<isl_val>s.
665         #include <isl/val.h>
666         __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
667         __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
668         __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
669         __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
670         __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
671         __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
672         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
674 The following binary operations are available on C<isl_val>s.
676         #include <isl/val.h>
677         __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
678                 __isl_take isl_val *v2);
679         __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
680                 __isl_take isl_val *v2);
681         __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
682                 __isl_take isl_val *v2);
683         __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
684                 unsigned long v2);
685         __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
686                 __isl_take isl_val *v2);
687         __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
688                 unsigned long v2);
689         __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
690                 __isl_take isl_val *v2);
691         __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
692                 unsigned long v2);
693         __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
694                 __isl_take isl_val *v2);
696 On integer values, we additionally have the following operations.
698         #include <isl/val.h>
699         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
700         __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
701                 __isl_take isl_val *v2);
702         __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
703                 __isl_take isl_val *v2);
704         __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
705                 __isl_take isl_val *v2, __isl_give isl_val **x,
706                 __isl_give isl_val **y);
708 The function C<isl_val_gcdext> returns the greatest common divisor g
709 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
710 that C<*x> * C<v1> + C<*y> * C<v2> = g.
712 =head3 GMP specific functions
714 These functions are only available if C<isl> has been compiled with C<GMP>
715 support.
717 Specific integer and rational values can be created from C<GMP> values using
718 the following functions.
720         #include <isl/val_gmp.h>
721         __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
722                 mpz_t z);
723         __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
724                 const mpz_t n, const mpz_t d);
726 The numerator and denominator of a rational value can be extracted as
727 C<GMP> values using the following functions.
729         #include <isl/val_gmp.h>
730         int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
731         int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
733 =head2 Sets and Relations
735 C<isl> uses six types of objects for representing sets and relations,
736 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
737 C<isl_union_set> and C<isl_union_map>.
738 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
739 can be described as a conjunction of affine constraints, while
740 C<isl_set> and C<isl_map> represent unions of
741 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
742 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
743 to live in the same space.  C<isl_union_set>s and C<isl_union_map>s
744 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
745 where spaces are considered different if they have a different number
746 of dimensions and/or different names (see L<"Spaces">).
747 The difference between sets and relations (maps) is that sets have
748 one set of variables, while relations have two sets of variables,
749 input variables and output variables.
751 =head2 Error Handling
753 C<isl> supports different ways to react in case a runtime error is triggered.
754 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
755 with two maps that have incompatible spaces. There are three possible ways
756 to react on error: to warn, to continue or to abort.
758 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
759 the last error in the corresponding C<isl_ctx> and the function in which the
760 error was triggered returns C<NULL>. An error does not corrupt internal state,
761 such that isl can continue to be used. C<isl> also provides functions to
762 read the last error and to reset the memory that stores the last error. The
763 last error is only stored for information purposes. Its presence does not
764 change the behavior of C<isl>. Hence, resetting an error is not required to
765 continue to use isl, but only to observe new errors.
767         #include <isl/ctx.h>
768         enum isl_error isl_ctx_last_error(isl_ctx *ctx);
769         void isl_ctx_reset_error(isl_ctx *ctx);
771 Another option is to continue on error. This is similar to warn on error mode,
772 except that C<isl> does not print any warning. This allows a program to
773 implement its own error reporting.
775 The last option is to directly abort the execution of the program from within
776 the isl library. This makes it obviously impossible to recover from an error,
777 but it allows to directly spot the error location. By aborting on error,
778 debuggers break at the location the error occurred and can provide a stack
779 trace. Other tools that automatically provide stack traces on abort or that do
780 not want to continue execution after an error was triggered may also prefer to
781 abort on error.
783 The on error behavior of isl can be specified by calling
784 C<isl_options_set_on_error> or by setting the command line option
785 C<--isl-on-error>. Valid arguments for the function call are
786 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
787 choices for the command line option are C<warn>, C<continue> and C<abort>.
788 It is also possible to query the current error mode.
790         #include <isl/options.h>
791         int isl_options_set_on_error(isl_ctx *ctx, int val);
792         int isl_options_get_on_error(isl_ctx *ctx);
794 =head2 Identifiers
796 Identifiers are used to identify both individual dimensions
797 and tuples of dimensions.  They consist of an optional name and an optional
798 user pointer.  The name and the user pointer cannot both be C<NULL>, however.
799 Identifiers with the same name but different pointer values
800 are considered to be distinct.
801 Similarly, identifiers with different names but the same pointer value
802 are also considered to be distinct.
803 Equal identifiers are represented using the same object.
804 Pairs of identifiers can therefore be tested for equality using the
805 C<==> operator.
806 Identifiers can be constructed, copied, freed, inspected and printed
807 using the following functions.
809         #include <isl/id.h>
810         __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
811                 __isl_keep const char *name, void *user);
812         __isl_give isl_id *isl_id_set_free_user(
813                 __isl_take isl_id *id,
814                 __isl_give void (*free_user)(void *user));
815         __isl_give isl_id *isl_id_copy(isl_id *id);
816         __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
818         void *isl_id_get_user(__isl_keep isl_id *id);
819         __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
821         __isl_give isl_printer *isl_printer_print_id(
822                 __isl_take isl_printer *p, __isl_keep isl_id *id);
824 The callback set by C<isl_id_set_free_user> is called on the user
825 pointer when the last reference to the C<isl_id> is freed.
826 Note that C<isl_id_get_name> returns a pointer to some internal
827 data structure, so the result can only be used while the
828 corresponding C<isl_id> is alive.
830 =head2 Spaces
832 Whenever a new set, relation or similar object is created from scratch,
833 the space in which it lives needs to be specified using an C<isl_space>.
834 Each space involves zero or more parameters and zero, one or two
835 tuples of set or input/output dimensions.  The parameters and dimensions
836 are identified by an C<isl_dim_type> and a position.
837 The type C<isl_dim_param> refers to parameters,
838 the type C<isl_dim_set> refers to set dimensions (for spaces
839 with a single tuple of dimensions) and the types C<isl_dim_in>
840 and C<isl_dim_out> refer to input and output dimensions
841 (for spaces with two tuples of dimensions).
842 Local spaces (see L</"Local Spaces">) also contain dimensions
843 of type C<isl_dim_div>.
844 Note that parameters are only identified by their position within
845 a given object.  Across different objects, parameters are (usually)
846 identified by their names or identifiers.  Only unnamed parameters
847 are identified by their positions across objects.  The use of unnamed
848 parameters is discouraged.
850         #include <isl/space.h>
851         __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
852                 unsigned nparam, unsigned n_in, unsigned n_out);
853         __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
854                 unsigned nparam);
855         __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
856                 unsigned nparam, unsigned dim);
857         __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
858         __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
860 The space used for creating a parameter domain
861 needs to be created using C<isl_space_params_alloc>.
862 For other sets, the space
863 needs to be created using C<isl_space_set_alloc>, while
864 for a relation, the space
865 needs to be created using C<isl_space_alloc>.
867 To check whether a given space is that of a set or a map
868 or whether it is a parameter space, use these functions:
870         #include <isl/space.h>
871         int isl_space_is_params(__isl_keep isl_space *space);
872         int isl_space_is_set(__isl_keep isl_space *space);
873         int isl_space_is_map(__isl_keep isl_space *space);
875 Spaces can be compared using the following functions:
877         #include <isl/space.h>
878         int isl_space_is_equal(__isl_keep isl_space *space1,
879                 __isl_keep isl_space *space2);
880         int isl_space_is_domain(__isl_keep isl_space *space1,
881                 __isl_keep isl_space *space2);
882         int isl_space_is_range(__isl_keep isl_space *space1,
883                 __isl_keep isl_space *space2);
884         int isl_space_tuple_is_equal(
885                 __isl_keep isl_space *space1,
886                 enum isl_dim_type type1,
887                 __isl_keep isl_space *space2,
888                 enum isl_dim_type type2);
890 C<isl_space_is_domain> checks whether the first argument is equal
891 to the domain of the second argument.  This requires in particular that
892 the first argument is a set space and that the second argument
893 is a map space.  C<isl_space_tuple_is_equal> checks whether the given
894 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
895 spaces are the same.  That is, it checks if they have the same
896 identifier (if any), the same dimension and the same internal structure
897 (if any).
899 It is often useful to create objects that live in the
900 same space as some other object.  This can be accomplished
901 by creating the new objects
902 (see L</"Creating New Sets and Relations"> or
903 L</"Functions">) based on the space
904 of the original object.
906         #include <isl/set.h>
907         __isl_give isl_space *isl_basic_set_get_space(
908                 __isl_keep isl_basic_set *bset);
909         __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
911         #include <isl/union_set.h>
912         __isl_give isl_space *isl_union_set_get_space(
913                 __isl_keep isl_union_set *uset);
915         #include <isl/map.h>
916         __isl_give isl_space *isl_basic_map_get_space(
917                 __isl_keep isl_basic_map *bmap);
918         __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
920         #include <isl/union_map.h>
921         __isl_give isl_space *isl_union_map_get_space(
922                 __isl_keep isl_union_map *umap);
924         #include <isl/constraint.h>
925         __isl_give isl_space *isl_constraint_get_space(
926                 __isl_keep isl_constraint *constraint);
928         #include <isl/polynomial.h>
929         __isl_give isl_space *isl_qpolynomial_get_domain_space(
930                 __isl_keep isl_qpolynomial *qp);
931         __isl_give isl_space *isl_qpolynomial_get_space(
932                 __isl_keep isl_qpolynomial *qp);
933         __isl_give isl_space *isl_qpolynomial_fold_get_space(
934                 __isl_keep isl_qpolynomial_fold *fold);
935         __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
936                 __isl_keep isl_pw_qpolynomial *pwqp);
937         __isl_give isl_space *isl_pw_qpolynomial_get_space(
938                 __isl_keep isl_pw_qpolynomial *pwqp);
939         __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
940                 __isl_keep isl_pw_qpolynomial_fold *pwf);
941         __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
942                 __isl_keep isl_pw_qpolynomial_fold *pwf);
943         __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
944                 __isl_keep isl_union_pw_qpolynomial *upwqp);
945         __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
946                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
948         #include <isl/val.h>
949         __isl_give isl_space *isl_multi_val_get_space(
950                 __isl_keep isl_multi_val *mv);
952         #include <isl/aff.h>
953         __isl_give isl_space *isl_aff_get_domain_space(
954                 __isl_keep isl_aff *aff);
955         __isl_give isl_space *isl_aff_get_space(
956                 __isl_keep isl_aff *aff);
957         __isl_give isl_space *isl_pw_aff_get_domain_space(
958                 __isl_keep isl_pw_aff *pwaff);
959         __isl_give isl_space *isl_pw_aff_get_space(
960                 __isl_keep isl_pw_aff *pwaff);
961         __isl_give isl_space *isl_multi_aff_get_domain_space(
962                 __isl_keep isl_multi_aff *maff);
963         __isl_give isl_space *isl_multi_aff_get_space(
964                 __isl_keep isl_multi_aff *maff);
965         __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
966                 __isl_keep isl_pw_multi_aff *pma);
967         __isl_give isl_space *isl_pw_multi_aff_get_space(
968                 __isl_keep isl_pw_multi_aff *pma);
969         __isl_give isl_space *isl_union_pw_aff_get_space(
970                 __isl_keep isl_union_pw_aff *upa);
971         __isl_give isl_space *isl_union_pw_multi_aff_get_space(
972                 __isl_keep isl_union_pw_multi_aff *upma);
973         __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
974                 __isl_keep isl_multi_pw_aff *mpa);
975         __isl_give isl_space *isl_multi_pw_aff_get_space(
976                 __isl_keep isl_multi_pw_aff *mpa);
977         __isl_give isl_space *
978         isl_multi_union_pw_aff_get_domain_space(
979                 __isl_keep isl_multi_union_pw_aff *mupa);
980         __isl_give isl_space *
981         isl_multi_union_pw_aff_get_space(
982                 __isl_keep isl_multi_union_pw_aff *mupa);
984         #include <isl/point.h>
985         __isl_give isl_space *isl_point_get_space(
986                 __isl_keep isl_point *pnt);
988 The number of dimensions of a given type of space
989 may be read off from a space or an object that lives
990 in a space using the following functions.
991 In case of C<isl_space_dim>, type may be
992 C<isl_dim_param>, C<isl_dim_in> (only for relations),
993 C<isl_dim_out> (only for relations), C<isl_dim_set>
994 (only for sets) or C<isl_dim_all>.
996         #include <isl/space.h>
997         unsigned isl_space_dim(__isl_keep isl_space *space,
998                 enum isl_dim_type type);
1000         #include <isl/local_space.h>
1001         int isl_local_space_dim(__isl_keep isl_local_space *ls,
1002                 enum isl_dim_type type);
1004         #include <isl/set.h>
1005         unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1006                 enum isl_dim_type type);
1007         unsigned isl_set_dim(__isl_keep isl_set *set,
1008                 enum isl_dim_type type);
1010         #include <isl/union_set.h>
1011         unsigned isl_union_set_dim(__isl_keep isl_union_set *uset,
1012                 enum isl_dim_type type);
1014         #include <isl/map.h>
1015         unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1016                 enum isl_dim_type type);
1017         unsigned isl_map_dim(__isl_keep isl_map *map,
1018                 enum isl_dim_type type);
1020         #include <isl/union_map.h>
1021         unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
1022                 enum isl_dim_type type);
1024         #include <isl/val.h>
1025         unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1026                 enum isl_dim_type type);
1028         #include <isl/aff.h>
1029         int isl_aff_dim(__isl_keep isl_aff *aff,
1030                 enum isl_dim_type type);
1031         unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1032                 enum isl_dim_type type);
1033         unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1034                 enum isl_dim_type type);
1035         unsigned isl_pw_multi_aff_dim(
1036                 __isl_keep isl_pw_multi_aff *pma,
1037                 enum isl_dim_type type);
1038         unsigned isl_multi_pw_aff_dim(
1039                 __isl_keep isl_multi_pw_aff *mpa,
1040                 enum isl_dim_type type);
1041         unsigned isl_union_pw_aff_dim(
1042                 __isl_keep isl_union_pw_aff *upa,
1043                 enum isl_dim_type type);
1044         unsigned isl_union_pw_multi_aff_dim(
1045                 __isl_keep isl_union_pw_multi_aff *upma,
1046                 enum isl_dim_type type);
1047         unsigned isl_multi_union_pw_aff_dim(
1048                 __isl_keep isl_multi_union_pw_aff *mupa,
1049                 enum isl_dim_type type);
1051         #include <isl/polynomial.h>
1052         unsigned isl_union_pw_qpolynomial_dim(
1053                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1054                 enum isl_dim_type type);
1055         unsigned isl_union_pw_qpolynomial_fold_dim(
1056                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1057                 enum isl_dim_type type);
1059 Note that an C<isl_union_set>, an C<isl_union_map>,
1060 an C<isl_union_pw_multi_aff>,
1061 an C<isl_union_pw_qpolynomial> and
1062 an C<isl_union_pw_qpolynomial_fold>
1063 only have parameters.
1065 The identifiers or names of the individual dimensions of spaces
1066 may be set or read off using the following functions on spaces
1067 or objects that live in spaces.
1068 These functions are mostly useful to obtain the identifiers, positions
1069 or names of the parameters.  Identifiers of individual dimensions are
1070 essentially only useful for printing.  They are ignored by all other
1071 operations and may not be preserved across those operations.
1073         #include <isl/space.h>
1074         __isl_give isl_space *isl_space_set_dim_id(
1075                 __isl_take isl_space *space,
1076                 enum isl_dim_type type, unsigned pos,
1077                 __isl_take isl_id *id);
1078         int isl_space_has_dim_id(__isl_keep isl_space *space,
1079                 enum isl_dim_type type, unsigned pos);
1080         __isl_give isl_id *isl_space_get_dim_id(
1081                 __isl_keep isl_space *space,
1082                 enum isl_dim_type type, unsigned pos);
1083         __isl_give isl_space *isl_space_set_dim_name(
1084                 __isl_take isl_space *space,
1085                  enum isl_dim_type type, unsigned pos,
1086                  __isl_keep const char *name);
1087         int isl_space_has_dim_name(__isl_keep isl_space *space,
1088                 enum isl_dim_type type, unsigned pos);
1089         __isl_keep const char *isl_space_get_dim_name(
1090                 __isl_keep isl_space *space,
1091                 enum isl_dim_type type, unsigned pos);
1093         #include <isl/local_space.h>
1094         __isl_give isl_local_space *isl_local_space_set_dim_id(
1095                 __isl_take isl_local_space *ls,
1096                 enum isl_dim_type type, unsigned pos,
1097                 __isl_take isl_id *id);
1098         int isl_local_space_has_dim_id(
1099                 __isl_keep isl_local_space *ls,
1100                 enum isl_dim_type type, unsigned pos);
1101         __isl_give isl_id *isl_local_space_get_dim_id(
1102                 __isl_keep isl_local_space *ls,
1103                 enum isl_dim_type type, unsigned pos);
1104         __isl_give isl_local_space *isl_local_space_set_dim_name(
1105                 __isl_take isl_local_space *ls,
1106                 enum isl_dim_type type, unsigned pos, const char *s);
1107         int isl_local_space_has_dim_name(
1108                 __isl_keep isl_local_space *ls,
1109                 enum isl_dim_type type, unsigned pos)
1110         const char *isl_local_space_get_dim_name(
1111                 __isl_keep isl_local_space *ls,
1112                 enum isl_dim_type type, unsigned pos);
1114         #include <isl/constraint.h>
1115         const char *isl_constraint_get_dim_name(
1116                 __isl_keep isl_constraint *constraint,
1117                 enum isl_dim_type type, unsigned pos);
1119         #include <isl/set.h>
1120         __isl_give isl_id *isl_basic_set_get_dim_id(
1121                 __isl_keep isl_basic_set *bset,
1122                 enum isl_dim_type type, unsigned pos);
1123         __isl_give isl_set *isl_set_set_dim_id(
1124                 __isl_take isl_set *set, enum isl_dim_type type,
1125                 unsigned pos, __isl_take isl_id *id);
1126         int isl_set_has_dim_id(__isl_keep isl_set *set,
1127                 enum isl_dim_type type, unsigned pos);
1128         __isl_give isl_id *isl_set_get_dim_id(
1129                 __isl_keep isl_set *set, enum isl_dim_type type,
1130                 unsigned pos);
1131         const char *isl_basic_set_get_dim_name(
1132                 __isl_keep isl_basic_set *bset,
1133                 enum isl_dim_type type, unsigned pos);
1134         int isl_set_has_dim_name(__isl_keep isl_set *set,
1135                 enum isl_dim_type type, unsigned pos);
1136         const char *isl_set_get_dim_name(
1137                 __isl_keep isl_set *set,
1138                 enum isl_dim_type type, unsigned pos);
1140         #include <isl/map.h>
1141         __isl_give isl_map *isl_map_set_dim_id(
1142                 __isl_take isl_map *map, enum isl_dim_type type,
1143                 unsigned pos, __isl_take isl_id *id);
1144         int isl_basic_map_has_dim_id(
1145                 __isl_keep isl_basic_map *bmap,
1146                 enum isl_dim_type type, unsigned pos);
1147         int isl_map_has_dim_id(__isl_keep isl_map *map,
1148                 enum isl_dim_type type, unsigned pos);
1149         __isl_give isl_id *isl_map_get_dim_id(
1150                 __isl_keep isl_map *map, enum isl_dim_type type,
1151                 unsigned pos);
1152         __isl_give isl_id *isl_union_map_get_dim_id(
1153                 __isl_keep isl_union_map *umap,
1154                 enum isl_dim_type type, unsigned pos);
1155         const char *isl_basic_map_get_dim_name(
1156                 __isl_keep isl_basic_map *bmap,
1157                 enum isl_dim_type type, unsigned pos);
1158         int isl_map_has_dim_name(__isl_keep isl_map *map,
1159                 enum isl_dim_type type, unsigned pos);
1160         const char *isl_map_get_dim_name(
1161                 __isl_keep isl_map *map,
1162                 enum isl_dim_type type, unsigned pos);
1164         #include <isl/val.h>
1165         __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1166                 __isl_take isl_multi_val *mv,
1167                 enum isl_dim_type type, unsigned pos,
1168                 __isl_take isl_id *id);
1169         __isl_give isl_id *isl_multi_val_get_dim_id(
1170                 __isl_keep isl_multi_val *mv,
1171                 enum isl_dim_type type, unsigned pos);
1172         __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1173                 __isl_take isl_multi_val *mv,
1174                 enum isl_dim_type type, unsigned pos, const char *s);
1176         #include <isl/aff.h>
1177         __isl_give isl_aff *isl_aff_set_dim_id(
1178                 __isl_take isl_aff *aff, enum isl_dim_type type,
1179                 unsigned pos, __isl_take isl_id *id);
1180         __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1181                 __isl_take isl_multi_aff *maff,
1182                 enum isl_dim_type type, unsigned pos,
1183                 __isl_take isl_id *id);
1184         __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1185                 __isl_take isl_pw_aff *pma,
1186                 enum isl_dim_type type, unsigned pos,
1187                 __isl_take isl_id *id);
1188         __isl_give isl_multi_pw_aff *
1189         isl_multi_pw_aff_set_dim_id(
1190                 __isl_take isl_multi_pw_aff *mpa,
1191                 enum isl_dim_type type, unsigned pos,
1192                 __isl_take isl_id *id);
1193         __isl_give isl_multi_union_pw_aff *
1194         isl_multi_union_pw_aff_set_dim_id(
1195                 __isl_take isl_multi_union_pw_aff *mupa,
1196                 enum isl_dim_type type, unsigned pos,
1197                 __isl_take isl_id *id);
1198         __isl_give isl_id *isl_multi_aff_get_dim_id(
1199                 __isl_keep isl_multi_aff *ma,
1200                 enum isl_dim_type type, unsigned pos);
1201         int isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1202                 enum isl_dim_type type, unsigned pos);
1203         __isl_give isl_id *isl_pw_aff_get_dim_id(
1204                 __isl_keep isl_pw_aff *pa,
1205                 enum isl_dim_type type, unsigned pos);
1206         __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1207                 __isl_keep isl_pw_multi_aff *pma,
1208                 enum isl_dim_type type, unsigned pos);
1209         __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1210                 __isl_keep isl_multi_pw_aff *mpa,
1211                 enum isl_dim_type type, unsigned pos);
1212         __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1213                 __isl_keep isl_multi_union_pw_aff *mupa,
1214                 enum isl_dim_type type, unsigned pos);
1215         __isl_give isl_aff *isl_aff_set_dim_name(
1216                 __isl_take isl_aff *aff, enum isl_dim_type type,
1217                 unsigned pos, const char *s);
1218         __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1219                 __isl_take isl_multi_aff *maff,
1220                 enum isl_dim_type type, unsigned pos, const char *s);
1221         __isl_give isl_multi_pw_aff *
1222         isl_multi_pw_aff_set_dim_name(
1223                 __isl_take isl_multi_pw_aff *mpa,
1224                 enum isl_dim_type type, unsigned pos, const char *s);
1225         __isl_give isl_union_pw_aff *
1226         isl_union_pw_aff_set_dim_name(
1227                 __isl_take isl_union_pw_aff *upa,
1228                 enum isl_dim_type type, unsigned pos,
1229                 const char *s);
1230         __isl_give isl_union_pw_multi_aff *
1231         isl_union_pw_multi_aff_set_dim_name(
1232                 __isl_take isl_union_pw_multi_aff *upma,
1233                 enum isl_dim_type type, unsigned pos,
1234                 const char *s);
1235         __isl_give isl_multi_union_pw_aff *
1236         isl_multi_union_pw_aff_set_dim_name(
1237                 __isl_take isl_multi_union_pw_aff *mupa,
1238                 enum isl_dim_type type, unsigned pos,
1239         const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1240                 enum isl_dim_type type, unsigned pos);
1241         const char *isl_pw_aff_get_dim_name(
1242                 __isl_keep isl_pw_aff *pa,
1243                 enum isl_dim_type type, unsigned pos);
1244         const char *isl_pw_multi_aff_get_dim_name(
1245                 __isl_keep isl_pw_multi_aff *pma,
1246                 enum isl_dim_type type, unsigned pos);
1248         #include <isl/polynomial.h>
1249         __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1250                 __isl_take isl_qpolynomial *qp,
1251                 enum isl_dim_type type, unsigned pos,
1252                 const char *s);
1253         __isl_give isl_pw_qpolynomial *
1254         isl_pw_qpolynomial_set_dim_name(
1255                 __isl_take isl_pw_qpolynomial *pwqp,
1256                 enum isl_dim_type type, unsigned pos,
1257                 const char *s);
1258         __isl_give isl_pw_qpolynomial_fold *
1259         isl_pw_qpolynomial_fold_set_dim_name(
1260                 __isl_take isl_pw_qpolynomial_fold *pwf,
1261                 enum isl_dim_type type, unsigned pos,
1262                 const char *s);
1263         __isl_give isl_union_pw_qpolynomial *
1264         isl_union_pw_qpolynomial_set_dim_name(
1265                 __isl_take isl_union_pw_qpolynomial *upwqp,
1266                 enum isl_dim_type type, unsigned pos,
1267                 const char *s);
1268         __isl_give isl_union_pw_qpolynomial_fold *
1269         isl_union_pw_qpolynomial_fold_set_dim_name(
1270                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1271                 enum isl_dim_type type, unsigned pos,
1272                 const char *s);
1274 Note that C<isl_space_get_name> returns a pointer to some internal
1275 data structure, so the result can only be used while the
1276 corresponding C<isl_space> is alive.
1277 Also note that every function that operates on two sets or relations
1278 requires that both arguments have the same parameters.  This also
1279 means that if one of the arguments has named parameters, then the
1280 other needs to have named parameters too and the names need to match.
1281 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1282 arguments may have different parameters (as long as they are named),
1283 in which case the result will have as parameters the union of the parameters of
1284 the arguments.
1286 Given the identifier or name of a dimension (typically a parameter),
1287 its position can be obtained from the following functions.
1289         #include <isl/space.h>
1290         int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1291                 enum isl_dim_type type, __isl_keep isl_id *id);
1292         int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1293                 enum isl_dim_type type, const char *name);
1295         #include <isl/local_space.h>
1296         int isl_local_space_find_dim_by_name(
1297                 __isl_keep isl_local_space *ls,
1298                 enum isl_dim_type type, const char *name);
1300         #include <isl/val.h>
1301         int isl_multi_val_find_dim_by_id(
1302                 __isl_keep isl_multi_val *mv,
1303                 enum isl_dim_type type, __isl_keep isl_id *id);
1304         int isl_multi_val_find_dim_by_name(
1305                 __isl_keep isl_multi_val *mv,
1306                 enum isl_dim_type type, const char *name);
1308         #include <isl/set.h>
1309         int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1310                 enum isl_dim_type type, __isl_keep isl_id *id);
1311         int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1312                 enum isl_dim_type type, const char *name);
1314         #include <isl/map.h>
1315         int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1316                 enum isl_dim_type type, __isl_keep isl_id *id);
1317         int isl_basic_map_find_dim_by_name(
1318                 __isl_keep isl_basic_map *bmap,
1319                 enum isl_dim_type type, const char *name);
1320         int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1321                 enum isl_dim_type type, const char *name);
1322         int isl_union_map_find_dim_by_name(
1323                 __isl_keep isl_union_map *umap,
1324                 enum isl_dim_type type, const char *name);
1326         #include <isl/aff.h>
1327         int isl_multi_aff_find_dim_by_id(
1328                 __isl_keep isl_multi_aff *ma,
1329                 enum isl_dim_type type, __isl_keep isl_id *id);
1330         int isl_multi_pw_aff_find_dim_by_id(
1331                 __isl_keep isl_multi_pw_aff *mpa,
1332                 enum isl_dim_type type, __isl_keep isl_id *id);
1333         int isl_multi_union_pw_aff_find_dim_by_id(
1334                 __isl_keep isl_union_multi_pw_aff *mupa,
1335                 enum isl_dim_type type, __isl_keep isl_id *id);
1336         int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1337                 enum isl_dim_type type, const char *name);
1338         int isl_multi_aff_find_dim_by_name(
1339                 __isl_keep isl_multi_aff *ma,
1340                 enum isl_dim_type type, const char *name);
1341         int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1342                 enum isl_dim_type type, const char *name);
1343         int isl_multi_pw_aff_find_dim_by_name(
1344                 __isl_keep isl_multi_pw_aff *mpa,
1345                 enum isl_dim_type type, const char *name);
1346         int isl_pw_multi_aff_find_dim_by_name(
1347                 __isl_keep isl_pw_multi_aff *pma,
1348                 enum isl_dim_type type, const char *name);
1349         int isl_union_pw_aff_find_dim_by_name(
1350                 __isl_keep isl_union_pw_aff *upa,
1351                 enum isl_dim_type type, const char *name);
1352         int isl_union_pw_multi_aff_find_dim_by_name(
1353                 __isl_keep isl_union_pw_multi_aff *upma,
1354                 enum isl_dim_type type, const char *name);
1355         int isl_multi_union_pw_aff_find_dim_by_name(
1356                 __isl_keep isl_multi_union_pw_aff *mupa,
1357                 enum isl_dim_type type, const char *name);
1359         #include <isl/polynomial.h>
1360         int isl_pw_qpolynomial_find_dim_by_name(
1361                 __isl_keep isl_pw_qpolynomial *pwqp,
1362                 enum isl_dim_type type, const char *name);
1363         int isl_pw_qpolynomial_fold_find_dim_by_name(
1364                 __isl_keep isl_pw_qpolynomial_fold *pwf,
1365                 enum isl_dim_type type, const char *name);
1366         int isl_union_pw_qpolynomial_find_dim_by_name(
1367                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1368                 enum isl_dim_type type, const char *name);
1369         int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1370                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1371                 enum isl_dim_type type, const char *name);
1373 The identifiers or names of entire spaces may be set or read off
1374 using the following functions.
1376         #include <isl/space.h>
1377         __isl_give isl_space *isl_space_set_tuple_id(
1378                 __isl_take isl_space *space,
1379                 enum isl_dim_type type, __isl_take isl_id *id);
1380         __isl_give isl_space *isl_space_reset_tuple_id(
1381                 __isl_take isl_space *space, enum isl_dim_type type);
1382         int isl_space_has_tuple_id(__isl_keep isl_space *space,
1383                 enum isl_dim_type type);
1384         __isl_give isl_id *isl_space_get_tuple_id(
1385                 __isl_keep isl_space *space, enum isl_dim_type type);
1386         __isl_give isl_space *isl_space_set_tuple_name(
1387                 __isl_take isl_space *space,
1388                 enum isl_dim_type type, const char *s);
1389         int isl_space_has_tuple_name(__isl_keep isl_space *space,
1390                 enum isl_dim_type type);
1391         const char *isl_space_get_tuple_name(__isl_keep isl_space *space,
1392                 enum isl_dim_type type);
1394         #include <isl/local_space.h>
1395         __isl_give isl_local_space *isl_local_space_set_tuple_id(
1396                 __isl_take isl_local_space *ls,
1397                 enum isl_dim_type type, __isl_take isl_id *id);
1399         #include <isl/set.h>
1400         __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1401                 __isl_take isl_basic_set *bset,
1402                 __isl_take isl_id *id);
1403         __isl_give isl_set *isl_set_set_tuple_id(
1404                 __isl_take isl_set *set, __isl_take isl_id *id);
1405         __isl_give isl_set *isl_set_reset_tuple_id(
1406                 __isl_take isl_set *set);
1407         int isl_set_has_tuple_id(__isl_keep isl_set *set);
1408         __isl_give isl_id *isl_set_get_tuple_id(
1409                 __isl_keep isl_set *set);
1410         __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1411                 __isl_take isl_basic_set *set, const char *s);
1412         __isl_give isl_set *isl_set_set_tuple_name(
1413                 __isl_take isl_set *set, const char *s);
1414         const char *isl_basic_set_get_tuple_name(
1415                 __isl_keep isl_basic_set *bset);
1416         int isl_set_has_tuple_name(__isl_keep isl_set *set);
1417         const char *isl_set_get_tuple_name(
1418                 __isl_keep isl_set *set);
1420         #include <isl/map.h>
1421         __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1422                 __isl_take isl_basic_map *bmap,
1423                 enum isl_dim_type type, __isl_take isl_id *id);
1424         __isl_give isl_map *isl_map_set_tuple_id(
1425                 __isl_take isl_map *map, enum isl_dim_type type,
1426                 __isl_take isl_id *id);
1427         __isl_give isl_map *isl_map_reset_tuple_id(
1428                 __isl_take isl_map *map, enum isl_dim_type type);
1429         int isl_map_has_tuple_id(__isl_keep isl_map *map,
1430                 enum isl_dim_type type);
1431         __isl_give isl_id *isl_map_get_tuple_id(
1432                 __isl_keep isl_map *map, enum isl_dim_type type);
1433         __isl_give isl_map *isl_map_set_tuple_name(
1434                 __isl_take isl_map *map,
1435                 enum isl_dim_type type, const char *s);
1436         const char *isl_basic_map_get_tuple_name(
1437                 __isl_keep isl_basic_map *bmap,
1438                 enum isl_dim_type type);
1439         __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1440                 __isl_take isl_basic_map *bmap,
1441                 enum isl_dim_type type, const char *s);
1442         int isl_map_has_tuple_name(__isl_keep isl_map *map,
1443                 enum isl_dim_type type);
1444         const char *isl_map_get_tuple_name(
1445                 __isl_keep isl_map *map,
1446                 enum isl_dim_type type);
1448         #include <isl/val.h>
1449         __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1450                 __isl_take isl_multi_val *mv,
1451                 enum isl_dim_type type, __isl_take isl_id *id);
1452         __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1453                 __isl_take isl_multi_val *mv,
1454                 enum isl_dim_type type);
1455         int isl_multi_val_has_tuple_id(__isl_keep isl_multi_val *mv,
1456                 enum isl_dim_type type);
1457         __isl_give isl_id *isl_multi_val_get_tuple_id(
1458                 __isl_keep isl_multi_val *mv,
1459                 enum isl_dim_type type);
1460         __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1461                 __isl_take isl_multi_val *mv,
1462                 enum isl_dim_type type, const char *s);
1463         const char *isl_multi_val_get_tuple_name(
1464                 __isl_keep isl_multi_val *mv,
1465                 enum isl_dim_type type);
1467         #include <isl/aff.h>
1468         __isl_give isl_aff *isl_aff_set_tuple_id(
1469                 __isl_take isl_aff *aff,
1470                 enum isl_dim_type type, __isl_take isl_id *id);
1471         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1472                 __isl_take isl_multi_aff *maff,
1473                 enum isl_dim_type type, __isl_take isl_id *id);
1474         __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1475                 __isl_take isl_pw_aff *pwaff,
1476                 enum isl_dim_type type, __isl_take isl_id *id);
1477         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1478                 __isl_take isl_pw_multi_aff *pma,
1479                 enum isl_dim_type type, __isl_take isl_id *id);
1480         __isl_give isl_multi_union_pw_aff *
1481         isl_multi_union_pw_aff_set_tuple_id(
1482                 __isl_take isl_multi_union_pw_aff *mupa,
1483                 enum isl_dim_type type, __isl_take isl_id *id);
1484         __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1485                 __isl_take isl_multi_aff *ma,
1486                 enum isl_dim_type type);
1487         __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1488                 __isl_take isl_pw_aff *pa,
1489                 enum isl_dim_type type);
1490         __isl_give isl_multi_pw_aff *
1491         isl_multi_pw_aff_reset_tuple_id(
1492                 __isl_take isl_multi_pw_aff *mpa,
1493                 enum isl_dim_type type);
1494         __isl_give isl_pw_multi_aff *
1495         isl_pw_multi_aff_reset_tuple_id(
1496                 __isl_take isl_pw_multi_aff *pma,
1497                 enum isl_dim_type type);
1498         __isl_give isl_multi_union_pw_aff *
1499         isl_multi_union_pw_aff_reset_tuple_id(
1500                 __isl_take isl_multi_union_pw_aff *mupa,
1501                 enum isl_dim_type type);
1502         int isl_multi_aff_has_tuple_id(__isl_keep isl_multi_aff *ma,
1503                 enum isl_dim_type type);
1504         __isl_give isl_id *isl_multi_aff_get_tuple_id(
1505                 __isl_keep isl_multi_aff *ma,
1506                 enum isl_dim_type type);
1507         int isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1508                 enum isl_dim_type type);
1509         __isl_give isl_id *isl_pw_aff_get_tuple_id(
1510                 __isl_keep isl_pw_aff *pa,
1511                 enum isl_dim_type type);
1512         int isl_pw_multi_aff_has_tuple_id(
1513                 __isl_keep isl_pw_multi_aff *pma,
1514                 enum isl_dim_type type);
1515         __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1516                 __isl_keep isl_pw_multi_aff *pma,
1517                 enum isl_dim_type type);
1518         int isl_multi_pw_aff_has_tuple_id(
1519                 __isl_keep isl_multi_pw_aff *mpa,
1520                 enum isl_dim_type type);
1521         __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1522                 __isl_keep isl_multi_pw_aff *mpa,
1523                 enum isl_dim_type type);
1524         int isl_multi_union_pw_aff_has_tuple_id(
1525                 __isl_keep isl_multi_union_pw_aff *mupa,
1526                 enum isl_dim_type type);
1527         __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1528                 __isl_keep isl_multi_union_pw_aff *mupa,
1529                 enum isl_dim_type type);
1530         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1531                 __isl_take isl_multi_aff *maff,
1532                 enum isl_dim_type type, const char *s);
1533         __isl_give isl_multi_pw_aff *
1534         isl_multi_pw_aff_set_tuple_name(
1535                 __isl_take isl_multi_pw_aff *mpa,
1536                 enum isl_dim_type type, const char *s);
1537         __isl_give isl_multi_union_pw_aff *
1538         isl_multi_union_pw_aff_set_tuple_name(
1539                 __isl_take isl_multi_union_pw_aff *mupa,
1540                 enum isl_dim_type type, const char *s);
1541         const char *isl_multi_aff_get_tuple_name(
1542                 __isl_keep isl_multi_aff *multi,
1543                 enum isl_dim_type type);
1544         int isl_pw_multi_aff_has_tuple_name(
1545                 __isl_keep isl_pw_multi_aff *pma,
1546                 enum isl_dim_type type);
1547         const char *isl_pw_multi_aff_get_tuple_name(
1548                 __isl_keep isl_pw_multi_aff *pma,
1549                 enum isl_dim_type type);
1550         const char *isl_multi_union_pw_aff_get_tuple_name(
1551                 __isl_keep isl_multi_union_pw_aff *mupa,
1552                 enum isl_dim_type type);
1554 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1555 or C<isl_dim_set>.  As with C<isl_space_get_name>,
1556 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1557 data structure.
1558 Binary operations require the corresponding spaces of their arguments
1559 to have the same name.
1561 To keep the names of all parameters and tuples, but reset the user pointers
1562 of all the corresponding identifiers, use the following function.
1564         #include <isl/space.h>
1565         __isl_give isl_space *isl_space_reset_user(
1566                 __isl_take isl_space *space);
1568         #include <isl/set.h>
1569         __isl_give isl_set *isl_set_reset_user(
1570                 __isl_take isl_set *set);
1572         #include <isl/map.h>
1573         __isl_give isl_map *isl_map_reset_user(
1574                 __isl_take isl_map *map);
1576         #include <isl/union_set.h>
1577         __isl_give isl_union_set *isl_union_set_reset_user(
1578                 __isl_take isl_union_set *uset);
1580         #include <isl/union_map.h>
1581         __isl_give isl_union_map *isl_union_map_reset_user(
1582                 __isl_take isl_union_map *umap);
1584         #include <isl/val.h>
1585         __isl_give isl_multi_val *isl_multi_val_reset_user(
1586                 __isl_take isl_multi_val *mv);
1588         #include <isl/aff.h>
1589         __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1590                 __isl_take isl_multi_aff *ma);
1591         __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1592                 __isl_take isl_pw_aff *pa);
1593         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1594                 __isl_take isl_multi_pw_aff *mpa);
1595         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1596                 __isl_take isl_pw_multi_aff *pma);
1597         __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1598                 __isl_take isl_union_pw_aff *upa);
1599         __isl_give isl_multi_union_pw_aff *
1600         isl_multi_union_pw_aff_reset_user(
1601                 __isl_take isl_multi_union_pw_aff *mupa);
1602         __isl_give isl_union_pw_multi_aff *
1603         isl_union_pw_multi_aff_reset_user(
1604                 __isl_take isl_union_pw_multi_aff *upma);
1606         #include <isl/polynomial.h>
1607         __isl_give isl_pw_qpolynomial *
1608         isl_pw_qpolynomial_reset_user(
1609                 __isl_take isl_pw_qpolynomial *pwqp);
1610         __isl_give isl_union_pw_qpolynomial *
1611         isl_union_pw_qpolynomial_reset_user(
1612                 __isl_take isl_union_pw_qpolynomial *upwqp);
1613         __isl_give isl_pw_qpolynomial_fold *
1614         isl_pw_qpolynomial_fold_reset_user(
1615                 __isl_take isl_pw_qpolynomial_fold *pwf);
1616         __isl_give isl_union_pw_qpolynomial_fold *
1617         isl_union_pw_qpolynomial_fold_reset_user(
1618                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1620 Spaces can be nested.  In particular, the domain of a set or
1621 the domain or range of a relation can be a nested relation.
1622 This process is also called I<wrapping>.
1623 The functions for detecting, constructing and deconstructing
1624 such nested spaces can be found in the wrapping properties
1625 of L</"Unary Properties">, the wrapping operations
1626 of L</"Unary Operations"> and the Cartesian product operations
1627 of L</"Basic Operations">.
1629 Spaces can be created from other spaces
1630 using the functions described in L</"Unary Operations">
1631 and L</"Binary Operations">.
1633 =head2 Local Spaces
1635 A local space is essentially a space with
1636 zero or more existentially quantified variables.
1637 The local space of various objects can be obtained
1638 using the following functions.
1640         #include <isl/constraint.h>
1641         __isl_give isl_local_space *isl_constraint_get_local_space(
1642                 __isl_keep isl_constraint *constraint);
1644         #include <isl/set.h>
1645         __isl_give isl_local_space *isl_basic_set_get_local_space(
1646                 __isl_keep isl_basic_set *bset);
1648         #include <isl/map.h>
1649         __isl_give isl_local_space *isl_basic_map_get_local_space(
1650                 __isl_keep isl_basic_map *bmap);
1652         #include <isl/aff.h>
1653         __isl_give isl_local_space *isl_aff_get_domain_local_space(
1654                 __isl_keep isl_aff *aff);
1655         __isl_give isl_local_space *isl_aff_get_local_space(
1656                 __isl_keep isl_aff *aff);
1658 A new local space can be created from a space using
1660         #include <isl/local_space.h>
1661         __isl_give isl_local_space *isl_local_space_from_space(
1662                 __isl_take isl_space *space);
1664 They can be inspected, modified, copied and freed using the following functions.
1666         #include <isl/local_space.h>
1667         int isl_local_space_is_params(
1668                 __isl_keep isl_local_space *ls);
1669         int isl_local_space_is_set(__isl_keep isl_local_space *ls);
1670         __isl_give isl_space *isl_local_space_get_space(
1671                 __isl_keep isl_local_space *ls);
1672         __isl_give isl_aff *isl_local_space_get_div(
1673                 __isl_keep isl_local_space *ls, int pos);
1674         __isl_give isl_local_space *isl_local_space_copy(
1675                 __isl_keep isl_local_space *ls);
1676         __isl_null isl_local_space *isl_local_space_free(
1677                 __isl_take isl_local_space *ls);
1679 Note that C<isl_local_space_get_div> can only be used on local spaces
1680 of sets.
1682 Two local spaces can be compared using
1684         int isl_local_space_is_equal(__isl_keep isl_local_space *ls1,
1685                 __isl_keep isl_local_space *ls2);
1687 Local spaces can be created from other local spaces
1688 using the functions described in L</"Unary Operations">
1689 and L</"Binary Operations">.
1691 =head2 Creating New Sets and Relations
1693 C<isl> has functions for creating some standard sets and relations.
1695 =over
1697 =item * Empty sets and relations
1699         __isl_give isl_basic_set *isl_basic_set_empty(
1700                 __isl_take isl_space *space);
1701         __isl_give isl_basic_map *isl_basic_map_empty(
1702                 __isl_take isl_space *space);
1703         __isl_give isl_set *isl_set_empty(
1704                 __isl_take isl_space *space);
1705         __isl_give isl_map *isl_map_empty(
1706                 __isl_take isl_space *space);
1707         __isl_give isl_union_set *isl_union_set_empty(
1708                 __isl_take isl_space *space);
1709         __isl_give isl_union_map *isl_union_map_empty(
1710                 __isl_take isl_space *space);
1712 For C<isl_union_set>s and C<isl_union_map>s, the space
1713 is only used to specify the parameters.
1715 =item * Universe sets and relations
1717         __isl_give isl_basic_set *isl_basic_set_universe(
1718                 __isl_take isl_space *space);
1719         __isl_give isl_basic_map *isl_basic_map_universe(
1720                 __isl_take isl_space *space);
1721         __isl_give isl_set *isl_set_universe(
1722                 __isl_take isl_space *space);
1723         __isl_give isl_map *isl_map_universe(
1724                 __isl_take isl_space *space);
1725         __isl_give isl_union_set *isl_union_set_universe(
1726                 __isl_take isl_union_set *uset);
1727         __isl_give isl_union_map *isl_union_map_universe(
1728                 __isl_take isl_union_map *umap);
1730 The sets and relations constructed by the functions above
1731 contain all integer values, while those constructed by the
1732 functions below only contain non-negative values.
1734         __isl_give isl_basic_set *isl_basic_set_nat_universe(
1735                 __isl_take isl_space *space);
1736         __isl_give isl_basic_map *isl_basic_map_nat_universe(
1737                 __isl_take isl_space *space);
1738         __isl_give isl_set *isl_set_nat_universe(
1739                 __isl_take isl_space *space);
1740         __isl_give isl_map *isl_map_nat_universe(
1741                 __isl_take isl_space *space);
1743 =item * Identity relations
1745         __isl_give isl_basic_map *isl_basic_map_identity(
1746                 __isl_take isl_space *space);
1747         __isl_give isl_map *isl_map_identity(
1748                 __isl_take isl_space *space);
1750 The number of input and output dimensions in C<space> needs
1751 to be the same.
1753 =item * Lexicographic order
1755         __isl_give isl_map *isl_map_lex_lt(
1756                 __isl_take isl_space *set_space);
1757         __isl_give isl_map *isl_map_lex_le(
1758                 __isl_take isl_space *set_space);
1759         __isl_give isl_map *isl_map_lex_gt(
1760                 __isl_take isl_space *set_space);
1761         __isl_give isl_map *isl_map_lex_ge(
1762                 __isl_take isl_space *set_space);
1763         __isl_give isl_map *isl_map_lex_lt_first(
1764                 __isl_take isl_space *space, unsigned n);
1765         __isl_give isl_map *isl_map_lex_le_first(
1766                 __isl_take isl_space *space, unsigned n);
1767         __isl_give isl_map *isl_map_lex_gt_first(
1768                 __isl_take isl_space *space, unsigned n);
1769         __isl_give isl_map *isl_map_lex_ge_first(
1770                 __isl_take isl_space *space, unsigned n);
1772 The first four functions take a space for a B<set>
1773 and return relations that express that the elements in the domain
1774 are lexicographically less
1775 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1776 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1777 than the elements in the range.
1778 The last four functions take a space for a map
1779 and return relations that express that the first C<n> dimensions
1780 in the domain are lexicographically less
1781 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1782 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1783 than the first C<n> dimensions in the range.
1785 =back
1787 A basic set or relation can be converted to a set or relation
1788 using the following functions.
1790         __isl_give isl_set *isl_set_from_basic_set(
1791                 __isl_take isl_basic_set *bset);
1792         __isl_give isl_map *isl_map_from_basic_map(
1793                 __isl_take isl_basic_map *bmap);
1795 Sets and relations can be converted to union sets and relations
1796 using the following functions.
1798         __isl_give isl_union_set *isl_union_set_from_basic_set(
1799                 __isl_take isl_basic_set *bset);
1800         __isl_give isl_union_map *isl_union_map_from_basic_map(
1801                 __isl_take isl_basic_map *bmap);
1802         __isl_give isl_union_set *isl_union_set_from_set(
1803                 __isl_take isl_set *set);
1804         __isl_give isl_union_map *isl_union_map_from_map(
1805                 __isl_take isl_map *map);
1807 The inverse conversions below can only be used if the input
1808 union set or relation is known to contain elements in exactly one
1809 space.
1811         __isl_give isl_set *isl_set_from_union_set(
1812                 __isl_take isl_union_set *uset);
1813         __isl_give isl_map *isl_map_from_union_map(
1814                 __isl_take isl_union_map *umap);
1816 Sets and relations can be copied and freed again using the following
1817 functions.
1819         __isl_give isl_basic_set *isl_basic_set_copy(
1820                 __isl_keep isl_basic_set *bset);
1821         __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1822         __isl_give isl_union_set *isl_union_set_copy(
1823                 __isl_keep isl_union_set *uset);
1824         __isl_give isl_basic_map *isl_basic_map_copy(
1825                 __isl_keep isl_basic_map *bmap);
1826         __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1827         __isl_give isl_union_map *isl_union_map_copy(
1828                 __isl_keep isl_union_map *umap);
1829         __isl_null isl_basic_set *isl_basic_set_free(
1830                 __isl_take isl_basic_set *bset);
1831         __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1832         __isl_null isl_union_set *isl_union_set_free(
1833                 __isl_take isl_union_set *uset);
1834         __isl_null isl_basic_map *isl_basic_map_free(
1835                 __isl_take isl_basic_map *bmap);
1836         __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1837         __isl_null isl_union_map *isl_union_map_free(
1838                 __isl_take isl_union_map *umap);
1840 Other sets and relations can be constructed by starting
1841 from a universe set or relation, adding equality and/or
1842 inequality constraints and then projecting out the
1843 existentially quantified variables, if any.
1844 Constraints can be constructed, manipulated and
1845 added to (or removed from) (basic) sets and relations
1846 using the following functions.
1848         #include <isl/constraint.h>
1849         __isl_give isl_constraint *isl_equality_alloc(
1850                 __isl_take isl_local_space *ls);
1851         __isl_give isl_constraint *isl_inequality_alloc(
1852                 __isl_take isl_local_space *ls);
1853         __isl_give isl_constraint *isl_constraint_set_constant_si(
1854                 __isl_take isl_constraint *constraint, int v);
1855         __isl_give isl_constraint *isl_constraint_set_constant_val(
1856                 __isl_take isl_constraint *constraint,
1857                 __isl_take isl_val *v);
1858         __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1859                 __isl_take isl_constraint *constraint,
1860                 enum isl_dim_type type, int pos, int v);
1861         __isl_give isl_constraint *
1862         isl_constraint_set_coefficient_val(
1863                 __isl_take isl_constraint *constraint,
1864                 enum isl_dim_type type, int pos,
1865                 __isl_take isl_val *v);
1866         __isl_give isl_basic_map *isl_basic_map_add_constraint(
1867                 __isl_take isl_basic_map *bmap,
1868                 __isl_take isl_constraint *constraint);
1869         __isl_give isl_basic_set *isl_basic_set_add_constraint(
1870                 __isl_take isl_basic_set *bset,
1871                 __isl_take isl_constraint *constraint);
1872         __isl_give isl_map *isl_map_add_constraint(
1873                 __isl_take isl_map *map,
1874                 __isl_take isl_constraint *constraint);
1875         __isl_give isl_set *isl_set_add_constraint(
1876                 __isl_take isl_set *set,
1877                 __isl_take isl_constraint *constraint);
1878         __isl_give isl_basic_set *isl_basic_set_drop_constraint(
1879                 __isl_take isl_basic_set *bset,
1880                 __isl_take isl_constraint *constraint);
1882 For example, to create a set containing the even integers
1883 between 10 and 42, you would use the following code.
1885         isl_space *space;
1886         isl_local_space *ls;
1887         isl_constraint *c;
1888         isl_basic_set *bset;
1890         space = isl_space_set_alloc(ctx, 0, 2);
1891         bset = isl_basic_set_universe(isl_space_copy(space));
1892         ls = isl_local_space_from_space(space);
1894         c = isl_equality_alloc(isl_local_space_copy(ls));
1895         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1896         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
1897         bset = isl_basic_set_add_constraint(bset, c);
1899         c = isl_inequality_alloc(isl_local_space_copy(ls));
1900         c = isl_constraint_set_constant_si(c, -10);
1901         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
1902         bset = isl_basic_set_add_constraint(bset, c);
1904         c = isl_inequality_alloc(ls);
1905         c = isl_constraint_set_constant_si(c, 42);
1906         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1907         bset = isl_basic_set_add_constraint(bset, c);
1909         bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
1911 Or, alternatively,
1913         isl_basic_set *bset;
1914         bset = isl_basic_set_read_from_str(ctx,
1915                 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
1917 A basic set or relation can also be constructed from two matrices
1918 describing the equalities and the inequalities.
1920         __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
1921                 __isl_take isl_space *space,
1922                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1923                 enum isl_dim_type c1,
1924                 enum isl_dim_type c2, enum isl_dim_type c3,
1925                 enum isl_dim_type c4);
1926         __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
1927                 __isl_take isl_space *space,
1928                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1929                 enum isl_dim_type c1,
1930                 enum isl_dim_type c2, enum isl_dim_type c3,
1931                 enum isl_dim_type c4, enum isl_dim_type c5);
1933 The C<isl_dim_type> arguments indicate the order in which
1934 different kinds of variables appear in the input matrices
1935 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
1936 C<isl_dim_set> and C<isl_dim_div> for sets and
1937 of C<isl_dim_cst>, C<isl_dim_param>,
1938 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
1940 A (basic or union) set or relation can also be constructed from a
1941 (union) (piecewise) (multiple) affine expression
1942 or a list of affine expressions
1943 (See L</"Functions">).
1945         __isl_give isl_basic_map *isl_basic_map_from_aff(
1946                 __isl_take isl_aff *aff);
1947         __isl_give isl_map *isl_map_from_aff(
1948                 __isl_take isl_aff *aff);
1949         __isl_give isl_set *isl_set_from_pw_aff(
1950                 __isl_take isl_pw_aff *pwaff);
1951         __isl_give isl_map *isl_map_from_pw_aff(
1952                 __isl_take isl_pw_aff *pwaff);
1953         __isl_give isl_basic_map *isl_basic_map_from_aff_list(
1954                 __isl_take isl_space *domain_space,
1955                 __isl_take isl_aff_list *list);
1956         __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
1957                 __isl_take isl_multi_aff *maff)
1958         __isl_give isl_map *isl_map_from_multi_aff(
1959                 __isl_take isl_multi_aff *maff)
1960         __isl_give isl_set *isl_set_from_pw_multi_aff(
1961                 __isl_take isl_pw_multi_aff *pma);
1962         __isl_give isl_map *isl_map_from_pw_multi_aff(
1963                 __isl_take isl_pw_multi_aff *pma);
1964         __isl_give isl_set *isl_set_from_multi_pw_aff(
1965                 __isl_take isl_multi_pw_aff *mpa);
1966         __isl_give isl_map *isl_map_from_multi_pw_aff(
1967                 __isl_take isl_multi_pw_aff *mpa);
1968         __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
1969                 __isl_take isl_union_pw_aff *upa);
1970         __isl_give isl_union_map *
1971         isl_union_map_from_union_pw_multi_aff(
1972                 __isl_take isl_union_pw_multi_aff *upma);
1973         __isl_give isl_union_map *
1974         isl_union_map_from_multi_union_pw_aff(
1975                 __isl_take isl_multi_union_pw_aff *mupa);
1977 The C<domain_space> argument describes the domain of the resulting
1978 basic relation.  It is required because the C<list> may consist
1979 of zero affine expressions.
1980 The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
1981 is not allowed to be zero-dimensional.  The domain of the result
1982 is the shared domain of the union piecewise affine elements.
1984 =head2 Inspecting Sets and Relations
1986 Usually, the user should not have to care about the actual constraints
1987 of the sets and maps, but should instead apply the abstract operations
1988 explained in the following sections.
1989 Occasionally, however, it may be required to inspect the individual
1990 coefficients of the constraints.  This section explains how to do so.
1991 In these cases, it may also be useful to have C<isl> compute
1992 an explicit representation of the existentially quantified variables.
1994         __isl_give isl_set *isl_set_compute_divs(
1995                 __isl_take isl_set *set);
1996         __isl_give isl_map *isl_map_compute_divs(
1997                 __isl_take isl_map *map);
1998         __isl_give isl_union_set *isl_union_set_compute_divs(
1999                 __isl_take isl_union_set *uset);
2000         __isl_give isl_union_map *isl_union_map_compute_divs(
2001                 __isl_take isl_union_map *umap);
2003 This explicit representation defines the existentially quantified
2004 variables as integer divisions of the other variables, possibly
2005 including earlier existentially quantified variables.
2006 An explicitly represented existentially quantified variable therefore
2007 has a unique value when the values of the other variables are known.
2008 If, furthermore, the same existentials, i.e., existentials
2009 with the same explicit representations, should appear in the
2010 same order in each of the disjuncts of a set or map, then the user should call
2011 either of the following functions.
2013         __isl_give isl_set *isl_set_align_divs(
2014                 __isl_take isl_set *set);
2015         __isl_give isl_map *isl_map_align_divs(
2016                 __isl_take isl_map *map);
2018 Alternatively, the existentially quantified variables can be removed
2019 using the following functions, which compute an overapproximation.
2021         __isl_give isl_basic_set *isl_basic_set_remove_divs(
2022                 __isl_take isl_basic_set *bset);
2023         __isl_give isl_basic_map *isl_basic_map_remove_divs(
2024                 __isl_take isl_basic_map *bmap);
2025         __isl_give isl_set *isl_set_remove_divs(
2026                 __isl_take isl_set *set);
2027         __isl_give isl_map *isl_map_remove_divs(
2028                 __isl_take isl_map *map);
2030 It is also possible to only remove those divs that are defined
2031 in terms of a given range of dimensions or only those for which
2032 no explicit representation is known.
2034         __isl_give isl_basic_set *
2035         isl_basic_set_remove_divs_involving_dims(
2036                 __isl_take isl_basic_set *bset,
2037                 enum isl_dim_type type,
2038                 unsigned first, unsigned n);
2039         __isl_give isl_basic_map *
2040         isl_basic_map_remove_divs_involving_dims(
2041                 __isl_take isl_basic_map *bmap,
2042                 enum isl_dim_type type,
2043                 unsigned first, unsigned n);
2044         __isl_give isl_set *isl_set_remove_divs_involving_dims(
2045                 __isl_take isl_set *set, enum isl_dim_type type,
2046                 unsigned first, unsigned n);
2047         __isl_give isl_map *isl_map_remove_divs_involving_dims(
2048                 __isl_take isl_map *map, enum isl_dim_type type,
2049                 unsigned first, unsigned n);
2051         __isl_give isl_basic_set *
2052         isl_basic_set_remove_unknown_divs(
2053                 __isl_take isl_basic_set *bset);
2054         __isl_give isl_set *isl_set_remove_unknown_divs(
2055                 __isl_take isl_set *set);
2056         __isl_give isl_map *isl_map_remove_unknown_divs(
2057                 __isl_take isl_map *map);
2059 To iterate over all the sets or maps in a union set or map, use
2061         int isl_union_set_foreach_set(__isl_keep isl_union_set *uset,
2062                 int (*fn)(__isl_take isl_set *set, void *user),
2063                 void *user);
2064         int isl_union_map_foreach_map(__isl_keep isl_union_map *umap,
2065                 int (*fn)(__isl_take isl_map *map, void *user),
2066                 void *user);
2068 The number of sets or maps in a union set or map can be obtained
2069 from
2071         int isl_union_set_n_set(__isl_keep isl_union_set *uset);
2072         int isl_union_map_n_map(__isl_keep isl_union_map *umap);
2074 To extract the set or map in a given space from a union, use
2076         __isl_give isl_set *isl_union_set_extract_set(
2077                 __isl_keep isl_union_set *uset,
2078                 __isl_take isl_space *space);
2079         __isl_give isl_map *isl_union_map_extract_map(
2080                 __isl_keep isl_union_map *umap,
2081                 __isl_take isl_space *space);
2083 To iterate over all the basic sets or maps in a set or map, use
2085         int isl_set_foreach_basic_set(__isl_keep isl_set *set,
2086                 int (*fn)(__isl_take isl_basic_set *bset, void *user),
2087                 void *user);
2088         int isl_map_foreach_basic_map(__isl_keep isl_map *map,
2089                 int (*fn)(__isl_take isl_basic_map *bmap, void *user),
2090                 void *user);
2092 The callback function C<fn> should return 0 if successful and
2093 -1 if an error occurs.  In the latter case, or if any other error
2094 occurs, the above functions will return -1.
2096 It should be noted that C<isl> does not guarantee that
2097 the basic sets or maps passed to C<fn> are disjoint.
2098 If this is required, then the user should call one of
2099 the following functions first.
2101         __isl_give isl_set *isl_set_make_disjoint(
2102                 __isl_take isl_set *set);
2103         __isl_give isl_map *isl_map_make_disjoint(
2104                 __isl_take isl_map *map);
2106 The number of basic sets in a set can be obtained
2107 or the number of basic maps in a map can be obtained
2108 from
2110         #include <isl/set.h>
2111         int isl_set_n_basic_set(__isl_keep isl_set *set);
2113         #include <isl/map.h>
2114         int isl_map_n_basic_map(__isl_keep isl_map *map);
2116 To iterate over the constraints of a basic set or map, use
2118         #include <isl/constraint.h>
2120         int isl_basic_set_n_constraint(
2121                 __isl_keep isl_basic_set *bset);
2122         int isl_basic_set_foreach_constraint(
2123                 __isl_keep isl_basic_set *bset,
2124                 int (*fn)(__isl_take isl_constraint *c, void *user),
2125                 void *user);
2126         int isl_basic_map_n_constraint(
2127                 __isl_keep isl_basic_map *bmap);
2128         int isl_basic_map_foreach_constraint(
2129                 __isl_keep isl_basic_map *bmap,
2130                 int (*fn)(__isl_take isl_constraint *c, void *user),
2131                 void *user);
2132         __isl_null isl_constraint *isl_constraint_free(
2133                 __isl_take isl_constraint *c);
2135 Again, the callback function C<fn> should return 0 if successful and
2136 -1 if an error occurs.  In the latter case, or if any other error
2137 occurs, the above functions will return -1.
2138 The constraint C<c> represents either an equality or an inequality.
2139 Use the following function to find out whether a constraint
2140 represents an equality.  If not, it represents an inequality.
2142         int isl_constraint_is_equality(
2143                 __isl_keep isl_constraint *constraint);
2145 It is also possible to obtain a list of constraints from a basic
2146 map or set
2148         #include <isl/constraint.h>
2149         __isl_give isl_constraint_list *
2150         isl_basic_map_get_constraint_list(
2151                 __isl_keep isl_basic_map *bmap);
2152         __isl_give isl_constraint_list *
2153         isl_basic_set_get_constraint_list(
2154                 __isl_keep isl_basic_set *bset);
2156 These functions require that all existentially quantified variables
2157 have an explicit representation.
2158 The returned list can be manipulated using the functions in L<"Lists">.
2160 The coefficients of the constraints can be inspected using
2161 the following functions.
2163         int isl_constraint_is_lower_bound(
2164                 __isl_keep isl_constraint *constraint,
2165                 enum isl_dim_type type, unsigned pos);
2166         int isl_constraint_is_upper_bound(
2167                 __isl_keep isl_constraint *constraint,
2168                 enum isl_dim_type type, unsigned pos);
2169         __isl_give isl_val *isl_constraint_get_constant_val(
2170                 __isl_keep isl_constraint *constraint);
2171         __isl_give isl_val *isl_constraint_get_coefficient_val(
2172                 __isl_keep isl_constraint *constraint,
2173                 enum isl_dim_type type, int pos);
2175 The explicit representations of the existentially quantified
2176 variables can be inspected using the following function.
2177 Note that the user is only allowed to use this function
2178 if the inspected set or map is the result of a call
2179 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2180 The existentially quantified variable is equal to the floor
2181 of the returned affine expression.  The affine expression
2182 itself can be inspected using the functions in
2183 L</"Functions">.
2185         __isl_give isl_aff *isl_constraint_get_div(
2186                 __isl_keep isl_constraint *constraint, int pos);
2188 To obtain the constraints of a basic set or map in matrix
2189 form, use the following functions.
2191         __isl_give isl_mat *isl_basic_set_equalities_matrix(
2192                 __isl_keep isl_basic_set *bset,
2193                 enum isl_dim_type c1, enum isl_dim_type c2,
2194                 enum isl_dim_type c3, enum isl_dim_type c4);
2195         __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2196                 __isl_keep isl_basic_set *bset,
2197                 enum isl_dim_type c1, enum isl_dim_type c2,
2198                 enum isl_dim_type c3, enum isl_dim_type c4);
2199         __isl_give isl_mat *isl_basic_map_equalities_matrix(
2200                 __isl_keep isl_basic_map *bmap,
2201                 enum isl_dim_type c1,
2202                 enum isl_dim_type c2, enum isl_dim_type c3,
2203                 enum isl_dim_type c4, enum isl_dim_type c5);
2204         __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2205                 __isl_keep isl_basic_map *bmap,
2206                 enum isl_dim_type c1,
2207                 enum isl_dim_type c2, enum isl_dim_type c3,
2208                 enum isl_dim_type c4, enum isl_dim_type c5);
2210 The C<isl_dim_type> arguments dictate the order in which
2211 different kinds of variables appear in the resulting matrix.
2212 For set inputs, they should be a permutation of
2213 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2214 For map inputs, they should be a permutation of
2215 C<isl_dim_cst>, C<isl_dim_param>,
2216 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2218 =head2 Points
2220 Points are elements of a set.  They can be used to construct
2221 simple sets (boxes) or they can be used to represent the
2222 individual elements of a set.
2223 The zero point (the origin) can be created using
2225         __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2227 The coordinates of a point can be inspected, set and changed
2228 using
2230         __isl_give isl_val *isl_point_get_coordinate_val(
2231                 __isl_keep isl_point *pnt,
2232                 enum isl_dim_type type, int pos);
2233         __isl_give isl_point *isl_point_set_coordinate_val(
2234                 __isl_take isl_point *pnt,
2235                 enum isl_dim_type type, int pos,
2236                 __isl_take isl_val *v);
2238         __isl_give isl_point *isl_point_add_ui(
2239                 __isl_take isl_point *pnt,
2240                 enum isl_dim_type type, int pos, unsigned val);
2241         __isl_give isl_point *isl_point_sub_ui(
2242                 __isl_take isl_point *pnt,
2243                 enum isl_dim_type type, int pos, unsigned val);
2245 Points can be copied or freed using
2247         __isl_give isl_point *isl_point_copy(
2248                 __isl_keep isl_point *pnt);
2249         void isl_point_free(__isl_take isl_point *pnt);
2251 A singleton set can be created from a point using
2253         __isl_give isl_basic_set *isl_basic_set_from_point(
2254                 __isl_take isl_point *pnt);
2255         __isl_give isl_set *isl_set_from_point(
2256                 __isl_take isl_point *pnt);
2258 and a box can be created from two opposite extremal points using
2260         __isl_give isl_basic_set *isl_basic_set_box_from_points(
2261                 __isl_take isl_point *pnt1,
2262                 __isl_take isl_point *pnt2);
2263         __isl_give isl_set *isl_set_box_from_points(
2264                 __isl_take isl_point *pnt1,
2265                 __isl_take isl_point *pnt2);
2267 All elements of a B<bounded> (union) set can be enumerated using
2268 the following functions.
2270         int isl_set_foreach_point(__isl_keep isl_set *set,
2271                 int (*fn)(__isl_take isl_point *pnt, void *user),
2272                 void *user);
2273         int isl_union_set_foreach_point(__isl_keep isl_union_set *uset,
2274                 int (*fn)(__isl_take isl_point *pnt, void *user),
2275                 void *user);
2277 The function C<fn> is called for each integer point in
2278 C<set> with as second argument the last argument of
2279 the C<isl_set_foreach_point> call.  The function C<fn>
2280 should return C<0> on success and C<-1> on failure.
2281 In the latter case, C<isl_set_foreach_point> will stop
2282 enumerating and return C<-1> as well.
2283 If the enumeration is performed successfully and to completion,
2284 then C<isl_set_foreach_point> returns C<0>.
2286 To obtain a single point of a (basic) set, use
2288         __isl_give isl_point *isl_basic_set_sample_point(
2289                 __isl_take isl_basic_set *bset);
2290         __isl_give isl_point *isl_set_sample_point(
2291                 __isl_take isl_set *set);
2293 If C<set> does not contain any (integer) points, then the
2294 resulting point will be ``void'', a property that can be
2295 tested using
2297         int isl_point_is_void(__isl_keep isl_point *pnt);
2299 =head2 Functions
2301 Besides sets and relation, C<isl> also supports various types of functions.
2302 Each of these types is derived from the value type (see L</"Values">)
2303 or from one of two primitive function types
2304 through the application of zero or more type constructors.
2305 We first describe the primitive type and then we describe
2306 the types derived from these primitive types.
2308 =head3 Primitive Functions
2310 C<isl> support two primitive function types, quasi-affine
2311 expressions and quasipolynomials.
2312 A quasi-affine expression is defined either over a parameter
2313 space or over a set and is composed of integer constants,
2314 parameters and set variables, addition, subtraction and
2315 integer division by an integer constant.
2316 For example, the quasi-affine expression
2318         [n] -> { [x] -> [2*floor((4 n + x)/9] }
2320 maps C<x> to C<2*floor((4 n + x)/9>.
2321 A quasipolynomial is a polynomial expression in quasi-affine
2322 expression.  That is, it additionally allows for multiplication.
2323 Note, though, that it is not allowed to construct an integer
2324 division of an expression involving multiplications.
2325 Here is an example of a quasipolynomial that is not
2326 quasi-affine expression
2328         [n] -> { [x] -> (n*floor((4 n + x)/9) }
2330 Note that the external representations of quasi-affine expressions
2331 and quasipolynomials are different.  Quasi-affine expressions
2332 use a notation with square brackets just like binary relations,
2333 while quasipolynomials do not.  This might change at some point.
2335 If a primitive function is defined over a parameter space,
2336 then the space of the function itself is that of a set.
2337 If it is defined over a set, then the space of the function
2338 is that of a relation.  In both cases, the set space (or
2339 the output space) is single-dimensional, anonymous and unstructured.
2340 To create functions with multiple dimensions or with other kinds
2341 of set or output spaces, use multiple expressions
2342 (see L</"Multiple Expressions">).
2344 =over
2346 =item * Quasi-affine Expressions
2348 Besides the expressions described above, a quasi-affine
2349 expression can also be set to NaN.  Such expressions
2350 typically represent a failure to represent a result
2351 as a quasi-affine expression.
2353 The zero quasi affine expression or the quasi affine expression
2354 that is equal to a given value or
2355 a specified dimension on a given domain can be created using
2357         #include <isl/aff.h>
2358         __isl_give isl_aff *isl_aff_zero_on_domain(
2359                 __isl_take isl_local_space *ls);
2360         __isl_give isl_aff *isl_aff_val_on_domain(
2361                 __isl_take isl_local_space *ls,
2362                 __isl_take isl_val *val);
2363         __isl_give isl_aff *isl_aff_var_on_domain(
2364                 __isl_take isl_local_space *ls,
2365                 enum isl_dim_type type, unsigned pos);
2366         __isl_give isl_aff *isl_aff_nan_on_domain(
2367                 __isl_take isl_local_space *ls);
2369 Quasi affine expressions can be copied and freed using
2371         #include <isl/aff.h>
2372         __isl_give isl_aff *isl_aff_copy(
2373                 __isl_keep isl_aff *aff);
2374         __isl_null isl_aff *isl_aff_free(
2375                 __isl_take isl_aff *aff);
2377 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2378 using the following function.  The constraint is required to have
2379 a non-zero coefficient for the specified dimension.
2381         #include <isl/constraint.h>
2382         __isl_give isl_aff *isl_constraint_get_bound(
2383                 __isl_keep isl_constraint *constraint,
2384                 enum isl_dim_type type, int pos);
2386 The entire affine expression of the constraint can also be extracted
2387 using the following function.
2389         #include <isl/constraint.h>
2390         __isl_give isl_aff *isl_constraint_get_aff(
2391                 __isl_keep isl_constraint *constraint);
2393 Conversely, an equality constraint equating
2394 the affine expression to zero or an inequality constraint enforcing
2395 the affine expression to be non-negative, can be constructed using
2397         __isl_give isl_constraint *isl_equality_from_aff(
2398                 __isl_take isl_aff *aff);
2399         __isl_give isl_constraint *isl_inequality_from_aff(
2400                 __isl_take isl_aff *aff);
2402 The coefficients and the integer divisions of an affine expression
2403 can be inspected using the following functions.
2405         #include <isl/aff.h>
2406         __isl_give isl_val *isl_aff_get_constant_val(
2407                 __isl_keep isl_aff *aff);
2408         __isl_give isl_val *isl_aff_get_coefficient_val(
2409                 __isl_keep isl_aff *aff,
2410                 enum isl_dim_type type, int pos);
2411         int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2412                 enum isl_dim_type type, int pos);
2413         __isl_give isl_val *isl_aff_get_denominator_val(
2414                 __isl_keep isl_aff *aff);
2415         __isl_give isl_aff *isl_aff_get_div(
2416                 __isl_keep isl_aff *aff, int pos);
2418 They can be modified using the following functions.
2420         #include <isl/aff.h>
2421         __isl_give isl_aff *isl_aff_set_constant_si(
2422                 __isl_take isl_aff *aff, int v);
2423         __isl_give isl_aff *isl_aff_set_constant_val(
2424                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2425         __isl_give isl_aff *isl_aff_set_coefficient_si(
2426                 __isl_take isl_aff *aff,
2427                 enum isl_dim_type type, int pos, int v);
2428         __isl_give isl_aff *isl_aff_set_coefficient_val(
2429                 __isl_take isl_aff *aff,
2430                 enum isl_dim_type type, int pos,
2431                 __isl_take isl_val *v);
2433         __isl_give isl_aff *isl_aff_add_constant_si(
2434                 __isl_take isl_aff *aff, int v);
2435         __isl_give isl_aff *isl_aff_add_constant_val(
2436                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2437         __isl_give isl_aff *isl_aff_add_constant_num_si(
2438                 __isl_take isl_aff *aff, int v);
2439         __isl_give isl_aff *isl_aff_add_coefficient_si(
2440                 __isl_take isl_aff *aff,
2441                 enum isl_dim_type type, int pos, int v);
2442         __isl_give isl_aff *isl_aff_add_coefficient_val(
2443                 __isl_take isl_aff *aff,
2444                 enum isl_dim_type type, int pos,
2445                 __isl_take isl_val *v);
2447 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2448 set the I<numerator> of the constant or coefficient, while
2449 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2450 the constant or coefficient as a whole.
2451 The C<add_constant> and C<add_coefficient> functions add an integer
2452 or rational value to
2453 the possibly rational constant or coefficient.
2454 The C<add_constant_num> functions add an integer value to
2455 the numerator.
2457 =item * Quasipolynomials
2459 Some simple quasipolynomials can be created using the following functions.
2461         #include <isl/polynomial.h>
2462         __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2463                 __isl_take isl_space *domain);
2464         __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2465                 __isl_take isl_space *domain);
2466         __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2467                 __isl_take isl_space *domain);
2468         __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2469                 __isl_take isl_space *domain);
2470         __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2471                 __isl_take isl_space *domain);
2472         __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2473                 __isl_take isl_space *domain,
2474                 __isl_take isl_val *val);
2475         __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2476                 __isl_take isl_space *domain,
2477                 enum isl_dim_type type, unsigned pos);
2478         __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2479                 __isl_take isl_aff *aff);
2481 Recall that the space in which a quasipolynomial lives is a map space
2482 with a one-dimensional range.  The C<domain> argument in some of
2483 the functions above corresponds to the domain of this map space.
2485 Quasipolynomials can be copied and freed again using the following
2486 functions.
2488         #include <isl/polynomial.h>
2489         __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2490                 __isl_keep isl_qpolynomial *qp);
2491         __isl_null isl_qpolynomial *isl_qpolynomial_free(
2492                 __isl_take isl_qpolynomial *qp);
2494 The constant term of a quasipolynomial can be extracted using
2496         __isl_give isl_val *isl_qpolynomial_get_constant_val(
2497                 __isl_keep isl_qpolynomial *qp);
2499 To iterate over all terms in a quasipolynomial,
2502         int isl_qpolynomial_foreach_term(
2503                 __isl_keep isl_qpolynomial *qp,
2504                 int (*fn)(__isl_take isl_term *term,
2505                           void *user), void *user);
2507 The terms themselves can be inspected and freed using
2508 these functions
2510         unsigned isl_term_dim(__isl_keep isl_term *term,
2511                 enum isl_dim_type type);
2512         __isl_give isl_val *isl_term_get_coefficient_val(
2513                 __isl_keep isl_term *term);
2514         int isl_term_get_exp(__isl_keep isl_term *term,
2515                 enum isl_dim_type type, unsigned pos);
2516         __isl_give isl_aff *isl_term_get_div(
2517                 __isl_keep isl_term *term, unsigned pos);
2518         void isl_term_free(__isl_take isl_term *term);
2520 Each term is a product of parameters, set variables and
2521 integer divisions.  The function C<isl_term_get_exp>
2522 returns the exponent of a given dimensions in the given term.
2524 =back
2526 =head3 Reductions
2528 A reduction represents a maximum or a minimum of its
2529 base expressions.
2530 The only reduction type defined by C<isl> is
2531 C<isl_qpolynomial_fold>.
2533 There are currently no functions to directly create such
2534 objects, but they do appear in the piecewise quasipolynomial
2535 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2537 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2539 Reductions can be copied and freed using
2540 the following functions.
2542         #include <isl/polynomial.h>
2543         __isl_give isl_qpolynomial_fold *
2544         isl_qpolynomial_fold_copy(
2545                 __isl_keep isl_qpolynomial_fold *fold);
2546         void isl_qpolynomial_fold_free(
2547                 __isl_take isl_qpolynomial_fold *fold);
2549 To iterate over all quasipolynomials in a reduction, use
2551         int isl_qpolynomial_fold_foreach_qpolynomial(
2552                 __isl_keep isl_qpolynomial_fold *fold,
2553                 int (*fn)(__isl_take isl_qpolynomial *qp,
2554                           void *user), void *user);
2556 =head3 Multiple Expressions
2558 A multiple expression represents a sequence of zero or
2559 more base expressions, all defined on the same domain space.
2560 The domain space of the multiple expression is the same
2561 as that of the base expressions, but the range space
2562 can be any space.  In case the base expressions have
2563 a set space, the corresponding multiple expression
2564 also has a set space.
2565 Objects of the value type do not have an associated space.
2566 The space of a multiple value is therefore always a set space.
2567 Similarly, the space of a multiple union piecewise
2568 affine expression is always a set space.
2570 The multiple expression types defined by C<isl>
2571 are C<isl_multi_val>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
2572 C<isl_multi_union_pw_aff>.
2574 A multiple expression with the value zero for
2575 each output (or set) dimension can be created
2576 using the following functions.
2578         #include <isl/val.h>
2579         __isl_give isl_multi_val *isl_multi_val_zero(
2580                 __isl_take isl_space *space);
2582         #include <isl/aff.h>
2583         __isl_give isl_multi_aff *isl_multi_aff_zero(
2584                 __isl_take isl_space *space);
2585         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2586                 __isl_take isl_space *space);
2587         __isl_give isl_multi_union_pw_aff *
2588         isl_multi_union_pw_aff_zero(
2589                 __isl_take isl_space *space);
2591 Since there is no canonical way of representing a zero
2592 value of type C<isl_union_pw_aff>, the space passed
2593 to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
2595 An identity function can be created using the following
2596 functions.  The space needs to be that of a relation
2597 with the same number of input and output dimensions.
2599         #include <isl/aff.h>
2600         __isl_give isl_multi_aff *isl_multi_aff_identity(
2601                 __isl_take isl_space *space);
2602         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2603                 __isl_take isl_space *space);
2605 A function that performs a projection on a universe
2606 relation or set can be created using the following functions.
2607 See also the corresponding
2608 projection operations in L</"Unary Operations">.
2610         #include <isl/aff.h>
2611         __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2612                 __isl_take isl_space *space);
2613         __isl_give isl_multi_aff *isl_multi_aff_range_map(
2614                 __isl_take isl_space *space);
2615         __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2616                 __isl_take isl_space *space,
2617                 enum isl_dim_type type,
2618                 unsigned first, unsigned n);
2620 A multiple expression can be created from a single
2621 base expression using the following functions.
2622 The space of the created multiple expression is the same
2623 as that of the base expression, except for
2624 C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
2625 lives in a parameter space and the output lives
2626 in a single-dimensional set space.
2628         #include <isl/aff.h>
2629         __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2630                 __isl_take isl_aff *aff);
2631         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2632                 __isl_take isl_pw_aff *pa);
2633         __isl_give isl_multi_union_pw_aff *
2634         isl_multi_union_pw_aff_from_union_pw_aff(
2635                 __isl_take isl_union_pw_aff *upa);
2637 A multiple expression can be created from a list
2638 of base expression in a specified space.
2639 The domain of this space needs to be the same
2640 as the domains of the base expressions in the list.
2641 If the base expressions have a set space (or no associated space),
2642 then this space also needs to be a set space.
2644         #include <isl/val.h>
2645         __isl_give isl_multi_val *isl_multi_val_from_val_list(
2646                 __isl_take isl_space *space,
2647                 __isl_take isl_val_list *list);
2649         #include <isl/aff.h>
2650         __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2651                 __isl_take isl_space *space,
2652                 __isl_take isl_aff_list *list);
2653         __isl_give isl_multi_union_pw_aff *
2654         isl_multi_union_pw_aff_from_union_pw_aff_list(
2655                 __isl_take isl_space *space,
2656                 __isl_take isl_union_pw_aff_list *list);
2658 As a convenience, a multiple piecewise expression can
2659 also be created from a multiple expression.
2660 Each piecewise expression in the result has a single
2661 universe cell.
2663         #include <isl/aff.h>
2664         __isl_give isl_multi_pw_aff *
2665         isl_multi_pw_aff_from_multi_aff(
2666                 __isl_take isl_multi_aff *ma);
2668 Similarly, a multiple union expression can be
2669 created from a multiple expression.
2671         #include <isl/aff.h>
2672         __isl_give isl_multi_union_pw_aff *
2673         isl_multi_union_pw_aff_from_multi_aff(
2674                 __isl_take isl_multi_aff *ma);
2675         __isl_give isl_multi_union_pw_aff *
2676         isl_multi_union_pw_aff_from_multi_pw_aff(
2677                 __isl_take isl_multi_pw_aff *mpa);
2679 A multiple quasi-affine expression can be created from
2680 a multiple value with a given domain space using the following
2681 function.
2683         #include <isl/aff.h>
2684         __isl_give isl_multi_aff *
2685         isl_multi_aff_multi_val_on_space(
2686                 __isl_take isl_space *space,
2687                 __isl_take isl_multi_val *mv);
2689 Similarly,
2690 a multiple union piecewise affine expression can be created from
2691 a multiple value with a given domain or
2692 a multiple affine expression with a given domain
2693 using the following functions.
2695         #include <isl/aff.h>
2696         __isl_give isl_multi_union_pw_aff *
2697         isl_multi_union_pw_aff_multi_val_on_domain(
2698                 __isl_take isl_union_set *domain,
2699                 __isl_take isl_multi_val *mv);
2700         __isl_give isl_multi_union_pw_aff *
2701         isl_multi_union_pw_aff_multi_aff_on_domain(
2702                 __isl_take isl_union_set *domain,
2703                 __isl_take isl_multi_aff *ma);
2705 Multiple expressions can be copied and freed using
2706 the following functions.
2708         #include <isl/val.h>
2709         __isl_give isl_multi_val *isl_multi_val_copy(
2710                 __isl_keep isl_multi_val *mv);
2711         __isl_null isl_multi_val *isl_multi_val_free(
2712                 __isl_take isl_multi_val *mv);
2714         #include <isl/aff.h>
2715         __isl_give isl_multi_aff *isl_multi_aff_copy(
2716                 __isl_keep isl_multi_aff *maff);
2717         __isl_null isl_multi_aff *isl_multi_aff_free(
2718                 __isl_take isl_multi_aff *maff);
2719         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2720                 __isl_keep isl_multi_pw_aff *mpa);
2721         __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2722                 __isl_take isl_multi_pw_aff *mpa);
2723         __isl_give isl_multi_union_pw_aff *
2724         isl_multi_union_pw_aff_copy(
2725                 __isl_keep isl_multi_union_pw_aff *mupa);
2726         __isl_null isl_multi_union_pw_aff *
2727         isl_multi_union_pw_aff_free(
2728                 __isl_take isl_multi_union_pw_aff *mupa);
2730 The base expression at a given position of a multiple
2731 expression can be extracted using the following functions.
2733         #include <isl/val.h>
2734         __isl_give isl_val *isl_multi_val_get_val(
2735                 __isl_keep isl_multi_val *mv, int pos);
2737         #include <isl/aff.h>
2738         __isl_give isl_aff *isl_multi_aff_get_aff(
2739                 __isl_keep isl_multi_aff *multi, int pos);
2740         __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2741                 __isl_keep isl_multi_pw_aff *mpa, int pos);
2742         __isl_give isl_union_pw_aff *
2743         isl_multi_union_pw_aff_get_union_pw_aff(
2744                 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
2746 It can be replaced using the following functions.
2748         #include <isl/val.h>
2749         __isl_give isl_multi_val *isl_multi_val_set_val(
2750                 __isl_take isl_multi_val *mv, int pos,
2751                 __isl_take isl_val *val);
2753         #include <isl/aff.h>
2754         __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2755                 __isl_take isl_multi_aff *multi, int pos,
2756                 __isl_take isl_aff *aff);
2757         __isl_give isl_multi_union_pw_aff *
2758         isl_multi_union_pw_aff_set_union_pw_aff(
2759                 __isl_take isl_multi_union_pw_aff *mupa, int pos,
2760                 __isl_take isl_union_pw_aff *upa);
2762 As a convenience, a sequence of base expressions that have
2763 their domains in a given space can be extracted from a sequence
2764 of union expressions using the following function.
2766         #include <isl/aff.h>
2767         __isl_give isl_multi_pw_aff *
2768         isl_multi_union_pw_aff_extract_multi_pw_aff(
2769                 __isl_keep isl_multi_union_pw_aff *mupa,
2770                 __isl_take isl_space *space);
2772 Note that there is a difference between C<isl_multi_union_pw_aff>
2773 and C<isl_union_pw_multi_aff> objects.  The first is a sequence
2774 of unions of piecewise expressions, while the second is a union
2775 of piecewise sequences.  In particular, multiple affine expressions
2776 in an C<isl_union_pw_multi_aff> may live in different spaces,
2777 while there is only a single multiple expression in
2778 an C<isl_multi_union_pw_aff>, which can therefore only live
2779 in a single space.  This means that not every
2780 C<isl_union_pw_multi_aff> can be converted to
2781 an C<isl_multi_union_pw_aff>.  Conversely, a zero-dimensional
2782 C<isl_multi_union_pw_aff> carries no information
2783 about any possible domain and therefore cannot be converted
2784 to an C<isl_union_pw_multi_aff>.  Moreover, the elements
2785 of an C<isl_multi_union_pw_aff> may be defined over different domains,
2786 while each multiple expression inside an C<isl_union_pw_multi_aff>
2787 has a single domain.  The conversion of an C<isl_union_pw_multi_aff>
2788 of dimension greater than one may therefore not be exact.
2789 The following functions can
2790 be used to perform these conversions when they are possible.
2792         #include <isl/aff.h>
2793         __isl_give isl_multi_union_pw_aff *
2794         isl_multi_union_pw_aff_from_union_pw_multi_aff(
2795                 __isl_take isl_union_pw_multi_aff *upma);
2796         __isl_give isl_union_pw_multi_aff *
2797         isl_union_pw_multi_aff_from_multi_union_pw_aff(
2798                 __isl_take isl_multi_union_pw_aff *mupa);
2800 =head3 Piecewise Expressions
2802 A piecewise expression is an expression that is described
2803 using zero or more base expression defined over the same
2804 number of cells in the domain space of the base expressions.
2805 All base expressions are defined over the same
2806 domain space and the cells are disjoint.
2807 The space of a piecewise expression is the same as
2808 that of the base expressions.
2809 If the union of the cells is a strict subset of the domain
2810 space, then the value of the piecewise expression outside
2811 this union is different for types derived from quasi-affine
2812 expressions and those derived from quasipolynomials.
2813 Piecewise expressions derived from quasi-affine expressions
2814 are considered to be undefined outside the union of their cells.
2815 Piecewise expressions derived from quasipolynomials
2816 are considered to be zero outside the union of their cells.
2818 Piecewise quasipolynomials are mainly used by the C<barvinok>
2819 library for representing the number of elements in a parametric set or map.
2820 For example, the piecewise quasipolynomial
2822         [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
2824 represents the number of points in the map
2826         [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
2828 The piecewise expression types defined by C<isl>
2829 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
2830 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
2832 A piecewise expression with no cells can be created using
2833 the following functions.
2835         #include <isl/aff.h>
2836         __isl_give isl_pw_aff *isl_pw_aff_empty(
2837                 __isl_take isl_space *space);
2838         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
2839                 __isl_take isl_space *space);
2841 A piecewise expression with a single universe cell can be
2842 created using the following functions.
2844         #include <isl/aff.h>
2845         __isl_give isl_pw_aff *isl_pw_aff_from_aff(
2846                 __isl_take isl_aff *aff);
2847         __isl_give isl_pw_multi_aff *
2848         isl_pw_multi_aff_from_multi_aff(
2849                 __isl_take isl_multi_aff *ma);
2851         #include <isl/polynomial.h>
2852         __isl_give isl_pw_qpolynomial *
2853         isl_pw_qpolynomial_from_qpolynomial(
2854                 __isl_take isl_qpolynomial *qp);
2856 A piecewise expression with a single specified cell can be
2857 created using the following functions.
2859         #include <isl/aff.h>
2860         __isl_give isl_pw_aff *isl_pw_aff_alloc(
2861                 __isl_take isl_set *set, __isl_take isl_aff *aff);
2862         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
2863                 __isl_take isl_set *set,
2864                 __isl_take isl_multi_aff *maff);
2866         #include <isl/polynomial.h>
2867         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
2868                 __isl_take isl_set *set,
2869                 __isl_take isl_qpolynomial *qp);
2871 The following convenience functions first create a base expression and
2872 then create a piecewise expression over a universe domain.
2874         #include <isl/aff.h>
2875         __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
2876                 __isl_take isl_local_space *ls);
2877         __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
2878                 __isl_take isl_local_space *ls,
2879                 enum isl_dim_type type, unsigned pos);
2880         __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
2881                 __isl_take isl_local_space *ls);
2882         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
2883                 __isl_take isl_space *space);
2884         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
2885                 __isl_take isl_space *space);
2886         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
2887                 __isl_take isl_space *space);
2888         __isl_give isl_pw_multi_aff *
2889         isl_pw_multi_aff_project_out_map(
2890                 __isl_take isl_space *space,
2891                 enum isl_dim_type type,
2892                 unsigned first, unsigned n);
2894         #include <isl/polynomial.h>
2895         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
2896                 __isl_take isl_space *space);
2898 The following convenience functions first create a base expression and
2899 then create a piecewise expression over a given domain.
2901         #include <isl/aff.h>
2902         __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
2903                 __isl_take isl_set *domain,
2904                 __isl_take isl_val *v);
2905         __isl_give isl_pw_multi_aff *
2906         isl_pw_multi_aff_multi_val_on_domain(
2907                 __isl_take isl_set *domain,
2908                 __isl_take isl_multi_val *mv);
2910 As a convenience, a piecewise multiple expression can
2911 also be created from a piecewise expression.
2912 Each multiple expression in the result is derived
2913 from the corresponding base expression.
2915         #include <isl/aff.h>
2916         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
2917                 __isl_take isl_pw_aff *pa);
2919 Similarly, a piecewise quasipolynomial can be
2920 created from a piecewise quasi-affine expression using
2921 the following function.
2923         #include <isl/polynomial.h>
2924         __isl_give isl_pw_qpolynomial *
2925         isl_pw_qpolynomial_from_pw_aff(
2926                 __isl_take isl_pw_aff *pwaff);
2928 Piecewise expressions can be copied and freed using the following functions.
2930         #include <isl/aff.h>
2931         __isl_give isl_pw_aff *isl_pw_aff_copy(
2932                 __isl_keep isl_pw_aff *pwaff);
2933         __isl_null isl_pw_aff *isl_pw_aff_free(
2934                 __isl_take isl_pw_aff *pwaff);
2935         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
2936                 __isl_keep isl_pw_multi_aff *pma);
2937         __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
2938                 __isl_take isl_pw_multi_aff *pma);
2940         #include <isl/polynomial.h>
2941         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
2942                 __isl_keep isl_pw_qpolynomial *pwqp);
2943         __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
2944                 __isl_take isl_pw_qpolynomial *pwqp);
2945         __isl_give isl_pw_qpolynomial_fold *
2946         isl_pw_qpolynomial_fold_copy(
2947                 __isl_keep isl_pw_qpolynomial_fold *pwf);
2948         __isl_null isl_pw_qpolynomial_fold *
2949         isl_pw_qpolynomial_fold_free(
2950                 __isl_take isl_pw_qpolynomial_fold *pwf);
2952 To iterate over the different cells of a piecewise expression,
2953 use the following functions.
2955         #include <isl/aff.h>
2956         int isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
2957         int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
2958         int isl_pw_aff_foreach_piece(__isl_keep isl_pw_aff *pwaff,
2959                 int (*fn)(__isl_take isl_set *set,
2960                           __isl_take isl_aff *aff,
2961                           void *user), void *user);
2962         int isl_pw_multi_aff_foreach_piece(
2963                 __isl_keep isl_pw_multi_aff *pma,
2964                 int (*fn)(__isl_take isl_set *set,
2965                             __isl_take isl_multi_aff *maff,
2966                             void *user), void *user);
2968         #include <isl/polynomial.h>
2969         int isl_pw_qpolynomial_foreach_piece(
2970                 __isl_keep isl_pw_qpolynomial *pwqp,
2971                 int (*fn)(__isl_take isl_set *set,
2972                           __isl_take isl_qpolynomial *qp,
2973                           void *user), void *user);
2974         int isl_pw_qpolynomial_foreach_lifted_piece(
2975                 __isl_keep isl_pw_qpolynomial *pwqp,
2976                 int (*fn)(__isl_take isl_set *set,
2977                           __isl_take isl_qpolynomial *qp,
2978                           void *user), void *user);
2979         int isl_pw_qpolynomial_fold_foreach_piece(
2980                 __isl_keep isl_pw_qpolynomial_fold *pwf,
2981                 int (*fn)(__isl_take isl_set *set,
2982                           __isl_take isl_qpolynomial_fold *fold,
2983                           void *user), void *user);
2984         int isl_pw_qpolynomial_fold_foreach_lifted_piece(
2985                 __isl_keep isl_pw_qpolynomial_fold *pwf,
2986                 int (*fn)(__isl_take isl_set *set,
2987                           __isl_take isl_qpolynomial_fold *fold,
2988                           void *user), void *user);
2990 As usual, the function C<fn> should return C<0> on success
2991 and C<-1> on failure.  The difference between
2992 C<isl_pw_qpolynomial_foreach_piece> and
2993 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
2994 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
2995 compute unique representations for all existentially quantified
2996 variables and then turn these existentially quantified variables
2997 into extra set variables, adapting the associated quasipolynomial
2998 accordingly.  This means that the C<set> passed to C<fn>
2999 will not have any existentially quantified variables, but that
3000 the dimensions of the sets may be different for different
3001 invocations of C<fn>.
3002 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
3003 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
3005 A piecewise expression consisting of the expressions at a given
3006 position of a piecewise multiple expression can be extracted
3007 using the following function.
3009         #include <isl/aff.h>
3010         __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3011                 __isl_keep isl_pw_multi_aff *pma, int pos);
3013 These expressions can be replaced using the following function.
3015         #include <isl/aff.h>
3016         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3017                 __isl_take isl_pw_multi_aff *pma, unsigned pos,
3018                 __isl_take isl_pw_aff *pa);
3020 Note that there is a difference between C<isl_multi_pw_aff> and
3021 C<isl_pw_multi_aff> objects.  The first is a sequence of piecewise
3022 affine expressions, while the second is a piecewise sequence
3023 of affine expressions.  In particular, each of the piecewise
3024 affine expressions in an C<isl_multi_pw_aff> may have a different
3025 domain, while all multiple expressions associated to a cell
3026 in an C<isl_pw_multi_aff> have the same domain.
3027 It is possible to convert between the two, but when converting
3028 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3029 of the result is the intersection of the domains of the input.
3030 The reverse conversion is exact.
3032         #include <isl/aff.h>
3033         __isl_give isl_pw_multi_aff *
3034         isl_pw_multi_aff_from_multi_pw_aff(
3035                 __isl_take isl_multi_pw_aff *mpa);
3036         __isl_give isl_multi_pw_aff *
3037         isl_multi_pw_aff_from_pw_multi_aff(
3038                 __isl_take isl_pw_multi_aff *pma);
3040 =head3 Union Expressions
3042 A union expression collects base expressions defined
3043 over different domains.  The space of a union expression
3044 is that of the shared parameter space.
3046 The union expression types defined by C<isl>
3047 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3048 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3050 An empty union expression can be created using the following functions.
3052         #include <isl/aff.h>
3053         __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
3054                 __isl_take isl_space *space);
3055         __isl_give isl_union_pw_multi_aff *
3056         isl_union_pw_multi_aff_empty(
3057                 __isl_take isl_space *space);
3059         #include <isl/polynomial.h>
3060         __isl_give isl_union_pw_qpolynomial *
3061         isl_union_pw_qpolynomial_zero(
3062                 __isl_take isl_space *space);
3064 A union expression containing a single base expression
3065 can be created using the following functions.
3067         #include <isl/aff.h>
3068         __isl_give isl_union_pw_aff *
3069         isl_union_pw_aff_from_pw_aff(
3070                 __isl_take isl_pw_aff *pa);
3071         __isl_give isl_union_pw_multi_aff *
3072         isl_union_pw_multi_aff_from_aff(
3073                 __isl_take isl_aff *aff);
3074         __isl_give isl_union_pw_multi_aff *
3075         isl_union_pw_multi_aff_from_pw_multi_aff(
3076                 __isl_take isl_pw_multi_aff *pma);
3078         #include <isl/polynomial.h>
3079         __isl_give isl_union_pw_qpolynomial *
3080         isl_union_pw_qpolynomial_from_pw_qpolynomial(
3081                 __isl_take isl_pw_qpolynomial *pwqp);
3083 The following functions create a base expression on each
3084 of the sets in the union set and collect the results.
3086         #include <isl/aff.h>
3087         __isl_give isl_union_pw_multi_aff *
3088         isl_union_pw_multi_aff_from_union_pw_aff(
3089                 __isl_take isl_union_pw_aff *upa);
3090         __isl_give isl_union_pw_aff *
3091         isl_union_pw_multi_aff_get_union_pw_aff(
3092                 __isl_keep isl_union_pw_multi_aff *upma, int pos);
3093         __isl_give isl_union_pw_aff *
3094         isl_union_pw_aff_val_on_domain(
3095                 __isl_take isl_union_set *domain,
3096                 __isl_take isl_val *v);
3097         __isl_give isl_union_pw_multi_aff *
3098         isl_union_pw_multi_aff_multi_val_on_domain(
3099                 __isl_take isl_union_set *domain,
3100                 __isl_take isl_multi_val *mv);
3102 An C<isl_union_pw_aff> that is equal to a (parametric) affine
3103 expression on a given domain can be created using the following
3104 function.
3106         #include <isl/aff.h>
3107         __isl_give isl_union_pw_aff *
3108         isl_union_pw_aff_aff_on_domain(
3109                 __isl_take isl_union_set *domain,
3110                 __isl_take isl_aff *aff);
3112 A base expression can be added to a union expression using
3113 the following functions.
3115         #include <isl/aff.h>
3116         __isl_give isl_union_pw_aff *
3117         isl_union_pw_aff_add_pw_aff(
3118                 __isl_take isl_union_pw_aff *upa,
3119                 __isl_take isl_pw_aff *pa);
3120         __isl_give isl_union_pw_multi_aff *
3121         isl_union_pw_multi_aff_add_pw_multi_aff(
3122                 __isl_take isl_union_pw_multi_aff *upma,
3123                 __isl_take isl_pw_multi_aff *pma);
3125         #include <isl/polynomial.h>
3126         __isl_give isl_union_pw_qpolynomial *
3127         isl_union_pw_qpolynomial_add_pw_qpolynomial(
3128                 __isl_take isl_union_pw_qpolynomial *upwqp,
3129                 __isl_take isl_pw_qpolynomial *pwqp);
3131 Union expressions can be copied and freed using
3132 the following functions.
3134         #include <isl/aff.h>
3135         __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
3136                 __isl_keep isl_union_pw_aff *upa);
3137         __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
3138                 __isl_take isl_union_pw_aff *upa);
3139         __isl_give isl_union_pw_multi_aff *
3140         isl_union_pw_multi_aff_copy(
3141                 __isl_keep isl_union_pw_multi_aff *upma);
3142         __isl_null isl_union_pw_multi_aff *
3143         isl_union_pw_multi_aff_free(
3144                 __isl_take isl_union_pw_multi_aff *upma);
3146         #include <isl/polynomial.h>
3147         __isl_give isl_union_pw_qpolynomial *
3148         isl_union_pw_qpolynomial_copy(
3149                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3150         __isl_null isl_union_pw_qpolynomial *
3151         isl_union_pw_qpolynomial_free(
3152                 __isl_take isl_union_pw_qpolynomial *upwqp);
3153         __isl_give isl_union_pw_qpolynomial_fold *
3154         isl_union_pw_qpolynomial_fold_copy(
3155                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3156         __isl_null isl_union_pw_qpolynomial_fold *
3157         isl_union_pw_qpolynomial_fold_free(
3158                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3160 To iterate over the base expressions in a union expression,
3161 use the following functions.
3163         #include <isl/aff.h>
3164         int isl_union_pw_aff_n_pw_aff(
3165                 __isl_keep isl_union_pw_aff *upa);
3166         int isl_union_pw_aff_foreach_pw_aff(
3167                 __isl_keep isl_union_pw_aff *upa,
3168                 int (*fn)(__isl_take isl_pw_aff *ma, void *user),
3169                         void *user);
3170         int isl_union_pw_multi_aff_n_pw_multi_aff(
3171                 __isl_keep isl_union_pw_multi_aff *upma);
3172         int isl_union_pw_multi_aff_foreach_pw_multi_aff(
3173                 __isl_keep isl_union_pw_multi_aff *upma,
3174                 int (*fn)(__isl_take isl_pw_multi_aff *pma,
3175                             void *user), void *user);
3177         #include <isl/polynomial.h>
3178         int isl_union_pw_qpolynomial_n_pw_qpolynomial(
3179                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3180         int isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3181                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3182                 int (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3183                             void *user), void *user);
3184         int isl_union_pw_qpolynomial_fold_n_pw_qpolynomial_fold(
3185                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3186         int isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3187                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3188                 int (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3189                             void *user), void *user);
3191 To extract the base expression in a given space from a union, use
3192 the following functions.
3194         #include <isl/aff.h>
3195         __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3196                 __isl_keep isl_union_pw_aff *upa,
3197                 __isl_take isl_space *space);
3198         __isl_give isl_pw_multi_aff *
3199         isl_union_pw_multi_aff_extract_pw_multi_aff(
3200                 __isl_keep isl_union_pw_multi_aff *upma,
3201                 __isl_take isl_space *space);
3203         #include <isl/polynomial.h>
3204         __isl_give isl_pw_qpolynomial *
3205         isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3206                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3207                 __isl_take isl_space *space);
3209 =head2 Input and Output
3211 For set and relation,
3212 C<isl> supports its own input/output format, which is similar
3213 to the C<Omega> format, but also supports the C<PolyLib> format
3214 in some cases.
3215 For other object types, typically only an C<isl> format is supported.
3217 =head3 C<isl> format
3219 The C<isl> format is similar to that of C<Omega>, but has a different
3220 syntax for describing the parameters and allows for the definition
3221 of an existentially quantified variable as the integer division
3222 of an affine expression.
3223 For example, the set of integers C<i> between C<0> and C<n>
3224 such that C<i % 10 <= 6> can be described as
3226         [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3227                                 i - 10 a <= 6) }
3229 A set or relation can have several disjuncts, separated
3230 by the keyword C<or>.  Each disjunct is either a conjunction
3231 of constraints or a projection (C<exists>) of a conjunction
3232 of constraints.  The constraints are separated by the keyword
3233 C<and>.
3235 =head3 C<PolyLib> format
3237 If the represented set is a union, then the first line
3238 contains a single number representing the number of disjuncts.
3239 Otherwise, a line containing the number C<1> is optional.
3241 Each disjunct is represented by a matrix of constraints.
3242 The first line contains two numbers representing
3243 the number of rows and columns,
3244 where the number of rows is equal to the number of constraints
3245 and the number of columns is equal to two plus the number of variables.
3246 The following lines contain the actual rows of the constraint matrix.
3247 In each row, the first column indicates whether the constraint
3248 is an equality (C<0>) or inequality (C<1>).  The final column
3249 corresponds to the constant term.
3251 If the set is parametric, then the coefficients of the parameters
3252 appear in the last columns before the constant column.
3253 The coefficients of any existentially quantified variables appear
3254 between those of the set variables and those of the parameters.
3256 =head3 Extended C<PolyLib> format
3258 The extended C<PolyLib> format is nearly identical to the
3259 C<PolyLib> format.  The only difference is that the line
3260 containing the number of rows and columns of a constraint matrix
3261 also contains four additional numbers:
3262 the number of output dimensions, the number of input dimensions,
3263 the number of local dimensions (i.e., the number of existentially
3264 quantified variables) and the number of parameters.
3265 For sets, the number of ``output'' dimensions is equal
3266 to the number of set dimensions, while the number of ``input''
3267 dimensions is zero.
3269 =head3 Input
3271 Objects can be read from input using the following functions.
3273         #include <isl/val.h>
3274         __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3275                 const char *str);
3276         __isl_give isl_multi_val *isl_multi_val_read_from_str(
3277                 isl_ctx *ctx, const char *str);
3279         #include <isl/set.h>
3280         __isl_give isl_basic_set *isl_basic_set_read_from_file(
3281                 isl_ctx *ctx, FILE *input);
3282         __isl_give isl_basic_set *isl_basic_set_read_from_str(
3283                 isl_ctx *ctx, const char *str);
3284         __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3285                 FILE *input);
3286         __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3287                 const char *str);
3289         #include <isl/map.h>
3290         __isl_give isl_basic_map *isl_basic_map_read_from_file(
3291                 isl_ctx *ctx, FILE *input);
3292         __isl_give isl_basic_map *isl_basic_map_read_from_str(
3293                 isl_ctx *ctx, const char *str);
3294         __isl_give isl_map *isl_map_read_from_file(
3295                 isl_ctx *ctx, FILE *input);
3296         __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3297                 const char *str);
3299         #include <isl/union_set.h>
3300         __isl_give isl_union_set *isl_union_set_read_from_file(
3301                 isl_ctx *ctx, FILE *input);
3302         __isl_give isl_union_set *isl_union_set_read_from_str(
3303                 isl_ctx *ctx, const char *str);
3305         #include <isl/union_map.h>
3306         __isl_give isl_union_map *isl_union_map_read_from_file(
3307                 isl_ctx *ctx, FILE *input);
3308         __isl_give isl_union_map *isl_union_map_read_from_str(
3309                 isl_ctx *ctx, const char *str);
3311         #include <isl/aff.h>
3312         __isl_give isl_aff *isl_aff_read_from_str(
3313                 isl_ctx *ctx, const char *str);
3314         __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3315                 isl_ctx *ctx, const char *str);
3316         __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3317                 isl_ctx *ctx, const char *str);
3318         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3319                 isl_ctx *ctx, const char *str);
3320         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3321                 isl_ctx *ctx, const char *str);
3322         __isl_give isl_union_pw_multi_aff *
3323         isl_union_pw_multi_aff_read_from_str(
3324                 isl_ctx *ctx, const char *str);
3325         __isl_give isl_multi_union_pw_aff *
3326         isl_multi_union_pw_aff_read_from_str(
3327                 isl_ctx *ctx, const char *str);
3329         #include <isl/polynomial.h>
3330         __isl_give isl_union_pw_qpolynomial *
3331         isl_union_pw_qpolynomial_read_from_str(
3332                 isl_ctx *ctx, const char *str);
3334 For sets and relations,
3335 the input format is autodetected and may be either the C<PolyLib> format
3336 or the C<isl> format.
3338 =head3 Output
3340 Before anything can be printed, an C<isl_printer> needs to
3341 be created.
3343         __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3344                 FILE *file);
3345         __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3346         __isl_null isl_printer *isl_printer_free(
3347                 __isl_take isl_printer *printer);
3348         __isl_give char *isl_printer_get_str(
3349                 __isl_keep isl_printer *printer);
3351 The printer can be inspected using the following functions.
3353         FILE *isl_printer_get_file(
3354                 __isl_keep isl_printer *printer);
3355         int isl_printer_get_output_format(
3356                 __isl_keep isl_printer *p);
3357         int isl_printer_get_yaml_style(__isl_keep isl_printer *p);
3359 The behavior of the printer can be modified in various ways
3361         __isl_give isl_printer *isl_printer_set_output_format(
3362                 __isl_take isl_printer *p, int output_format);
3363         __isl_give isl_printer *isl_printer_set_indent(
3364                 __isl_take isl_printer *p, int indent);
3365         __isl_give isl_printer *isl_printer_set_indent_prefix(
3366                 __isl_take isl_printer *p, const char *prefix);
3367         __isl_give isl_printer *isl_printer_indent(
3368                 __isl_take isl_printer *p, int indent);
3369         __isl_give isl_printer *isl_printer_set_prefix(
3370                 __isl_take isl_printer *p, const char *prefix);
3371         __isl_give isl_printer *isl_printer_set_suffix(
3372                 __isl_take isl_printer *p, const char *suffix);
3373         __isl_give isl_printer *isl_printer_set_yaml_style(
3374                 __isl_take isl_printer *p, int yaml_style);
3376 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3377 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3378 and defaults to C<ISL_FORMAT_ISL>.
3379 Each line in the output is prefixed by C<indent_prefix>,
3380 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3381 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3382 In the C<PolyLib> format output,
3383 the coefficients of the existentially quantified variables
3384 appear between those of the set variables and those
3385 of the parameters.
3386 The function C<isl_printer_indent> increases the indentation
3387 by the specified amount (which may be negative).
3388 The YAML style may be either C<ISL_YAML_STYLE_BLOCK> or
3389 C<ISL_YAML_STYLE_FLOW> and when we are printing something
3390 in YAML format.
3392 To actually print something, use
3394         #include <isl/printer.h>
3395         __isl_give isl_printer *isl_printer_print_double(
3396                 __isl_take isl_printer *p, double d);
3398         #include <isl/val.h>
3399         __isl_give isl_printer *isl_printer_print_val(
3400                 __isl_take isl_printer *p, __isl_keep isl_val *v);
3402         #include <isl/set.h>
3403         __isl_give isl_printer *isl_printer_print_basic_set(
3404                 __isl_take isl_printer *printer,
3405                 __isl_keep isl_basic_set *bset);
3406         __isl_give isl_printer *isl_printer_print_set(
3407                 __isl_take isl_printer *printer,
3408                 __isl_keep isl_set *set);
3410         #include <isl/map.h>
3411         __isl_give isl_printer *isl_printer_print_basic_map(
3412                 __isl_take isl_printer *printer,
3413                 __isl_keep isl_basic_map *bmap);
3414         __isl_give isl_printer *isl_printer_print_map(
3415                 __isl_take isl_printer *printer,
3416                 __isl_keep isl_map *map);
3418         #include <isl/union_set.h>
3419         __isl_give isl_printer *isl_printer_print_union_set(
3420                 __isl_take isl_printer *p,
3421                 __isl_keep isl_union_set *uset);
3423         #include <isl/union_map.h>
3424         __isl_give isl_printer *isl_printer_print_union_map(
3425                 __isl_take isl_printer *p,
3426                 __isl_keep isl_union_map *umap);
3428         #include <isl/val.h>
3429         __isl_give isl_printer *isl_printer_print_multi_val(
3430                 __isl_take isl_printer *p,
3431                 __isl_keep isl_multi_val *mv);
3433         #include <isl/aff.h>
3434         __isl_give isl_printer *isl_printer_print_aff(
3435                 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3436         __isl_give isl_printer *isl_printer_print_multi_aff(
3437                 __isl_take isl_printer *p,
3438                 __isl_keep isl_multi_aff *maff);
3439         __isl_give isl_printer *isl_printer_print_pw_aff(
3440                 __isl_take isl_printer *p,
3441                 __isl_keep isl_pw_aff *pwaff);
3442         __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3443                 __isl_take isl_printer *p,
3444                 __isl_keep isl_pw_multi_aff *pma);
3445         __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3446                 __isl_take isl_printer *p,
3447                 __isl_keep isl_multi_pw_aff *mpa);
3448         __isl_give isl_printer *isl_printer_print_union_pw_aff(
3449                 __isl_take isl_printer *p,
3450                 __isl_keep isl_union_pw_aff *upa);
3451         __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3452                 __isl_take isl_printer *p,
3453                 __isl_keep isl_union_pw_multi_aff *upma);
3454         __isl_give isl_printer *
3455         isl_printer_print_multi_union_pw_aff(
3456                 __isl_take isl_printer *p,
3457                 __isl_keep isl_multi_union_pw_aff *mupa);
3459         #include <isl/polynomial.h>
3460         __isl_give isl_printer *isl_printer_print_qpolynomial(
3461                 __isl_take isl_printer *p,
3462                 __isl_keep isl_qpolynomial *qp);
3463         __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3464                 __isl_take isl_printer *p,
3465                 __isl_keep isl_pw_qpolynomial *pwqp);
3466         __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3467                 __isl_take isl_printer *p,
3468                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3470         __isl_give isl_printer *
3471         isl_printer_print_pw_qpolynomial_fold(
3472                 __isl_take isl_printer *p,
3473                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3474         __isl_give isl_printer *
3475         isl_printer_print_union_pw_qpolynomial_fold(
3476                 __isl_take isl_printer *p,
3477                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3479 For C<isl_printer_print_qpolynomial>,
3480 C<isl_printer_print_pw_qpolynomial> and
3481 C<isl_printer_print_pw_qpolynomial_fold>,
3482 the output format of the printer
3483 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3484 For C<isl_printer_print_union_pw_qpolynomial> and
3485 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3486 is supported.
3487 In case of printing in C<ISL_FORMAT_C>, the user may want
3488 to set the names of all dimensions first.
3490 C<isl> also provides limited support for printing YAML documents,
3491 just enough for the internal use for printing such documents.
3493         #include <isl/printer.h>
3494         __isl_give isl_printer *isl_printer_yaml_start_mapping(
3495                 __isl_take isl_printer *p);
3496         __isl_give isl_printer *isl_printer_yaml_end_mapping(
3497                 __isl_take isl_printer *p);
3498         __isl_give isl_printer *isl_printer_yaml_start_sequence(
3499                 __isl_take isl_printer *p);
3500         __isl_give isl_printer *isl_printer_yaml_end_sequence(
3501                 __isl_take isl_printer *p);
3502         __isl_give isl_printer *isl_printer_yaml_next(
3503                 __isl_take isl_printer *p);
3505 A document is started by a call to either
3506 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3507 Anything printed to the printer after such a call belong to the
3508 first key of the mapping or the first element in the sequence.
3509 The function C<isl_printer_yaml_next> moves to the value if
3510 we are currently printing a mapping key, the next key if we
3511 are printing a value or the next element if we are printing
3512 an element in a sequence.
3513 Nested mappings and sequences are initiated by the same
3514 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3515 Each call to these functions needs to have a corresponding call to
3516 C<isl_printer_yaml_end_mapping> or C<isl_printer_yaml_end_sequence>.
3518 When called on a file printer, the following function flushes
3519 the file.  When called on a string printer, the buffer is cleared.
3521         __isl_give isl_printer *isl_printer_flush(
3522                 __isl_take isl_printer *p);
3524 Alternatively, a string representation can be obtained
3525 directly using the following functions, which always print
3526 in isl format.
3528         #include <isl/space.h>
3529         __isl_give char *isl_space_to_str(
3530                 __isl_keep isl_space *space);
3532         #include <isl/val.h>
3533         __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3534         __isl_give char *isl_multi_val_to_str(
3535                 __isl_keep isl_multi_val *mv);
3537         #include <isl/set.h>
3538         __isl_give char *isl_set_to_str(
3539                 __isl_keep isl_set *set);
3541         #include <isl/union_set.h>
3542         __isl_give char *isl_union_set_to_str(
3543                 __isl_keep isl_union_set *uset);
3545         #include <isl/map.h>
3546         __isl_give char *isl_map_to_str(
3547                 __isl_keep isl_map *map);
3549         #include <isl/union_map.h>
3550         __isl_give char *isl_union_map_to_str(
3551                 __isl_keep isl_union_map *umap);
3553         #include <isl/aff.h>
3554         __isl_give char *isl_multi_aff_to_str(
3555                 __isl_keep isl_multi_aff *aff);
3556         __isl_give char *isl_union_pw_aff_to_str(
3557                 __isl_keep isl_union_pw_aff *upa);
3558         __isl_give char *isl_union_pw_multi_aff_to_str(
3559                 __isl_keep isl_union_pw_multi_aff *upma);
3560         __isl_give char *isl_multi_union_pw_aff_to_str(
3561                 __isl_keep isl_multi_union_pw_aff *mupa);
3563 =head2 Properties
3565 =head3 Unary Properties
3567 =over
3569 =item * Emptiness
3571 The following functions test whether the given set or relation
3572 contains any integer points.  The ``plain'' variants do not perform
3573 any computations, but simply check if the given set or relation
3574 is already known to be empty.
3576         int isl_basic_set_plain_is_empty(__isl_keep isl_basic_set *bset);
3577         int isl_basic_set_is_empty(__isl_keep isl_basic_set *bset);
3578         int isl_set_plain_is_empty(__isl_keep isl_set *set);
3579         int isl_set_is_empty(__isl_keep isl_set *set);
3580         int isl_union_set_is_empty(__isl_keep isl_union_set *uset);
3581         int isl_basic_map_plain_is_empty(__isl_keep isl_basic_map *bmap);
3582         int isl_basic_map_is_empty(__isl_keep isl_basic_map *bmap);
3583         int isl_map_plain_is_empty(__isl_keep isl_map *map);
3584         int isl_map_is_empty(__isl_keep isl_map *map);
3585         int isl_union_map_is_empty(__isl_keep isl_union_map *umap);
3587 =item * Universality
3589         int isl_basic_set_is_universe(__isl_keep isl_basic_set *bset);
3590         int isl_basic_map_is_universe(__isl_keep isl_basic_map *bmap);
3591         int isl_set_plain_is_universe(__isl_keep isl_set *set);
3593 =item * Single-valuedness
3595         #include <isl/set.h>
3596         int isl_set_is_singleton(__isl_keep isl_set *set);
3598         #include <isl/map.h>
3599         int isl_basic_map_is_single_valued(
3600                 __isl_keep isl_basic_map *bmap);
3601         int isl_map_plain_is_single_valued(
3602                 __isl_keep isl_map *map);
3603         int isl_map_is_single_valued(__isl_keep isl_map *map);
3605         #include <isl/union_map.h>
3606         int isl_union_map_is_single_valued(__isl_keep isl_union_map *umap);
3608 =item * Injectivity
3610         int isl_map_plain_is_injective(__isl_keep isl_map *map);
3611         int isl_map_is_injective(__isl_keep isl_map *map);
3612         int isl_union_map_plain_is_injective(
3613                 __isl_keep isl_union_map *umap);
3614         int isl_union_map_is_injective(
3615                 __isl_keep isl_union_map *umap);
3617 =item * Bijectivity
3619         int isl_map_is_bijective(__isl_keep isl_map *map);
3620         int isl_union_map_is_bijective(__isl_keep isl_union_map *umap);
3622 =item * Position
3624         __isl_give isl_val *
3625         isl_basic_map_plain_get_val_if_fixed(
3626                 __isl_keep isl_basic_map *bmap,
3627                 enum isl_dim_type type, unsigned pos);
3628         __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3629                 __isl_keep isl_set *set,
3630                 enum isl_dim_type type, unsigned pos);
3631         __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3632                 __isl_keep isl_map *map,
3633                 enum isl_dim_type type, unsigned pos);
3635 If the set or relation obviously lies on a hyperplane where the given dimension
3636 has a fixed value, then return that value.
3637 Otherwise return NaN.
3639 =item * Stride
3641         int isl_set_dim_residue_class_val(
3642                 __isl_keep isl_set *set,
3643                 int pos, __isl_give isl_val **modulo,
3644                 __isl_give isl_val **residue);
3646 Check if the values of the given set dimension are equal to a fixed
3647 value modulo some integer value.  If so, assign the modulo to C<*modulo>
3648 and the fixed value to C<*residue>.  If the given dimension attains only
3649 a single value, then assign C<0> to C<*modulo> and the fixed value to
3650 C<*residue>.
3651 If the dimension does not attain only a single value and if no modulo
3652 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3654 =item * Dependence
3656 To check whether the description of a set, relation or function depends
3657 on one or more given dimensions,
3658 the following functions can be used.
3660         #include <isl/constraint.h>
3661         int isl_constraint_involves_dims(
3662                 __isl_keep isl_constraint *constraint,
3663                 enum isl_dim_type type, unsigned first, unsigned n);
3665         #include <isl/set.h>
3666         int isl_basic_set_involves_dims(
3667                 __isl_keep isl_basic_set *bset,
3668                 enum isl_dim_type type, unsigned first, unsigned n);
3669         int isl_set_involves_dims(__isl_keep isl_set *set,
3670                 enum isl_dim_type type, unsigned first, unsigned n);
3672         #include <isl/map.h>
3673         int isl_basic_map_involves_dims(
3674                 __isl_keep isl_basic_map *bmap,
3675                 enum isl_dim_type type, unsigned first, unsigned n);
3676         int isl_map_involves_dims(__isl_keep isl_map *map,
3677                 enum isl_dim_type type, unsigned first, unsigned n);
3679         #include <isl/union_map.h>
3680         int isl_union_map_involves_dims(
3681                 __isl_keep isl_union_map *umap,
3682                 enum isl_dim_type type, unsigned first, unsigned n);
3684         #include <isl/aff.h>
3685         int isl_aff_involves_dims(__isl_keep isl_aff *aff,
3686                 enum isl_dim_type type, unsigned first, unsigned n);
3687         int isl_pw_aff_involves_dims(__isl_keep isl_pw_aff *pwaff,
3688                 enum isl_dim_type type, unsigned first, unsigned n);
3689         int isl_multi_aff_involves_dims(
3690                 __isl_keep isl_multi_aff *ma,
3691                 enum isl_dim_type type, unsigned first, unsigned n);
3692         int isl_multi_pw_aff_involves_dims(
3693                 __isl_keep isl_multi_pw_aff *mpa,
3694                 enum isl_dim_type type, unsigned first, unsigned n);
3696 Similarly, the following functions can be used to check whether
3697 a given dimension is involved in any lower or upper bound.
3699         #include <isl/set.h>
3700         int isl_set_dim_has_any_lower_bound(__isl_keep isl_set *set,
3701                 enum isl_dim_type type, unsigned pos);
3702         int isl_set_dim_has_any_upper_bound(__isl_keep isl_set *set,
3703                 enum isl_dim_type type, unsigned pos);
3705 Note that these functions return true even if there is a bound on
3706 the dimension on only some of the basic sets of C<set>.
3707 To check if they have a bound for all of the basic sets in C<set>,
3708 use the following functions instead.
3710         #include <isl/set.h>
3711         int isl_set_dim_has_lower_bound(__isl_keep isl_set *set,
3712                 enum isl_dim_type type, unsigned pos);
3713         int isl_set_dim_has_upper_bound(__isl_keep isl_set *set,
3714                 enum isl_dim_type type, unsigned pos);
3716 =item * Space
3718 To check whether a set is a parameter domain, use this function:
3720         int isl_set_is_params(__isl_keep isl_set *set);
3721         int isl_union_set_is_params(
3722                 __isl_keep isl_union_set *uset);
3724 =item * Wrapping
3726 The following functions check whether the space of the given
3727 (basic) set or relation range is a wrapped relation.
3729         #include <isl/space.h>
3730         int isl_space_is_wrapping(
3731                 __isl_keep isl_space *space);
3732         int isl_space_domain_is_wrapping(
3733                 __isl_keep isl_space *space);
3734         int isl_space_range_is_wrapping(
3735                 __isl_keep isl_space *space);
3737         #include <isl/set.h>
3738         int isl_basic_set_is_wrapping(
3739                 __isl_keep isl_basic_set *bset);
3740         int isl_set_is_wrapping(__isl_keep isl_set *set);
3742         #include <isl/map.h>
3743         int isl_map_domain_is_wrapping(
3744                 __isl_keep isl_map *map);
3745         int isl_map_range_is_wrapping(
3746                 __isl_keep isl_map *map);
3748         #include <isl/val.h>
3749         int isl_multi_val_range_is_wrapping(
3750                 __isl_keep isl_multi_val *mv);
3752         #include <isl/aff.h>
3753         int isl_multi_aff_range_is_wrapping(
3754                 __isl_keep isl_multi_aff *ma);
3755         int isl_multi_pw_aff_range_is_wrapping(
3756                 __isl_keep isl_multi_pw_aff *mpa);
3757         int isl_multi_union_pw_aff_range_is_wrapping(
3758                 __isl_keep isl_multi_union_pw_aff *mupa);
3760 The input to C<isl_space_is_wrapping> should
3761 be the space of a set, while that of
3762 C<isl_space_domain_is_wrapping> and
3763 C<isl_space_range_is_wrapping> should be the space of a relation.
3765 =item * Internal Product
3767         int isl_basic_map_can_zip(
3768                 __isl_keep isl_basic_map *bmap);
3769         int isl_map_can_zip(__isl_keep isl_map *map);
3771 Check whether the product of domain and range of the given relation
3772 can be computed,
3773 i.e., whether both domain and range are nested relations.
3775 =item * Currying
3777         int isl_basic_map_can_curry(
3778                 __isl_keep isl_basic_map *bmap);
3779         int isl_map_can_curry(__isl_keep isl_map *map);
3781 Check whether the domain of the (basic) relation is a wrapped relation.
3783         int isl_basic_map_can_uncurry(
3784                 __isl_keep isl_basic_map *bmap);
3785         int isl_map_can_uncurry(__isl_keep isl_map *map);
3787 Check whether the range of the (basic) relation is a wrapped relation.
3789 =item * Special Values
3791         #include <isl/aff.h>
3792         int isl_aff_is_cst(__isl_keep isl_aff *aff);
3793         int isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
3795 Check whether the given expression is a constant.
3797         #include <isl/aff.h>
3798         int isl_aff_is_nan(__isl_keep isl_aff *aff);
3799         int isl_pw_aff_involves_nan(__isl_keep isl_pw_aff *pa);
3801 Check whether the given expression is equal to or involves NaN.
3803         #include <isl/aff.h>
3804         int isl_aff_plain_is_zero(__isl_keep isl_aff *aff);
3806 Check whether the affine expression is obviously zero.
3808 =back
3810 =head3 Binary Properties
3812 =over
3814 =item * Equality
3816 The following functions check whether two objects
3817 represent the same set, relation or function.
3818 The C<plain> variants only return true if the objects
3819 are obviously the same.  That is, they may return false
3820 even if the objects are the same, but they will never
3821 return true if the objects are not the same.
3823         #include <isl/set.h>
3824         int isl_basic_set_plain_is_equal(
3825                 __isl_keep isl_basic_set *bset1,
3826                 __isl_keep isl_basic_set *bset2);
3827         int isl_set_plain_is_equal(__isl_keep isl_set *set1,
3828                 __isl_keep isl_set *set2);
3829         int isl_set_is_equal(__isl_keep isl_set *set1,
3830                 __isl_keep isl_set *set2);
3832         #include <isl/map.h>
3833         int isl_basic_map_is_equal(
3834                 __isl_keep isl_basic_map *bmap1,
3835                 __isl_keep isl_basic_map *bmap2);
3836         int isl_map_is_equal(__isl_keep isl_map *map1,
3837                 __isl_keep isl_map *map2);
3838         int isl_map_plain_is_equal(__isl_keep isl_map *map1,
3839                 __isl_keep isl_map *map2);
3841         #include <isl/union_set.h>
3842         int isl_union_set_is_equal(
3843                 __isl_keep isl_union_set *uset1,
3844                 __isl_keep isl_union_set *uset2);
3846         #include <isl/union_map.h>
3847         int isl_union_map_is_equal(
3848                 __isl_keep isl_union_map *umap1,
3849                 __isl_keep isl_union_map *umap2);
3851         #include <isl/aff.h>
3852         int isl_aff_plain_is_equal(__isl_keep isl_aff *aff1,
3853                 __isl_keep isl_aff *aff2);
3854         int isl_multi_aff_plain_is_equal(
3855                 __isl_keep isl_multi_aff *maff1,
3856                 __isl_keep isl_multi_aff *maff2);
3857         int isl_pw_aff_plain_is_equal(
3858                 __isl_keep isl_pw_aff *pwaff1,
3859                 __isl_keep isl_pw_aff *pwaff2);
3860         int isl_pw_multi_aff_plain_is_equal(
3861                 __isl_keep isl_pw_multi_aff *pma1,
3862                 __isl_keep isl_pw_multi_aff *pma2);
3863         int isl_multi_pw_aff_plain_is_equal(
3864                 __isl_keep isl_multi_pw_aff *mpa1,
3865                 __isl_keep isl_multi_pw_aff *mpa2);
3866         int isl_multi_pw_aff_is_equal(
3867                 __isl_keep isl_multi_pw_aff *mpa1,
3868                 __isl_keep isl_multi_pw_aff *mpa2);
3869         int isl_union_pw_aff_plain_is_equal(
3870                 __isl_keep isl_union_pw_aff *upa1,
3871                 __isl_keep isl_union_pw_aff *upa2);
3872         int isl_union_pw_multi_aff_plain_is_equal(
3873                 __isl_keep isl_union_pw_multi_aff *upma1,
3874                 __isl_keep isl_union_pw_multi_aff *upma2);
3875         int isl_multi_union_pw_aff_plain_is_equal(
3876                 __isl_keep isl_multi_union_pw_aff *mupa1,
3877                 __isl_keep isl_multi_union_pw_aff *mupa2);
3879         #include <isl/polynomial.h>
3880         int isl_union_pw_qpolynomial_plain_is_equal(
3881                 __isl_keep isl_union_pw_qpolynomial *upwqp1,
3882                 __isl_keep isl_union_pw_qpolynomial *upwqp2);
3883         int isl_union_pw_qpolynomial_fold_plain_is_equal(
3884                 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
3885                 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
3887 =item * Disjointness
3889         #include <isl/set.h>
3890         int isl_basic_set_is_disjoint(
3891                 __isl_keep isl_basic_set *bset1,
3892                 __isl_keep isl_basic_set *bset2);
3893         int isl_set_plain_is_disjoint(__isl_keep isl_set *set1,
3894                 __isl_keep isl_set *set2);
3895         int isl_set_is_disjoint(__isl_keep isl_set *set1,
3896                 __isl_keep isl_set *set2);
3898         #include <isl/map.h>
3899         int isl_basic_map_is_disjoint(
3900                 __isl_keep isl_basic_map *bmap1,
3901                 __isl_keep isl_basic_map *bmap2);
3902         int isl_map_is_disjoint(__isl_keep isl_map *map1,
3903                 __isl_keep isl_map *map2);
3905         #include <isl/union_set.h>
3906         int isl_union_set_is_disjoint(
3907                 __isl_keep isl_union_set *uset1,
3908                 __isl_keep isl_union_set *uset2);
3910         #include <isl/union_map.h>
3911         int isl_union_map_is_disjoint(
3912                 __isl_keep isl_union_map *umap1,
3913                 __isl_keep isl_union_map *umap2);
3915 =item * Subset
3917         int isl_basic_set_is_subset(
3918                 __isl_keep isl_basic_set *bset1,
3919                 __isl_keep isl_basic_set *bset2);
3920         int isl_set_is_subset(__isl_keep isl_set *set1,
3921                 __isl_keep isl_set *set2);
3922         int isl_set_is_strict_subset(
3923                 __isl_keep isl_set *set1,
3924                 __isl_keep isl_set *set2);
3925         int isl_union_set_is_subset(
3926                 __isl_keep isl_union_set *uset1,
3927                 __isl_keep isl_union_set *uset2);
3928         int isl_union_set_is_strict_subset(
3929                 __isl_keep isl_union_set *uset1,
3930                 __isl_keep isl_union_set *uset2);
3931         int isl_basic_map_is_subset(
3932                 __isl_keep isl_basic_map *bmap1,
3933                 __isl_keep isl_basic_map *bmap2);
3934         int isl_basic_map_is_strict_subset(
3935                 __isl_keep isl_basic_map *bmap1,
3936                 __isl_keep isl_basic_map *bmap2);
3937         int isl_map_is_subset(
3938                 __isl_keep isl_map *map1,
3939                 __isl_keep isl_map *map2);
3940         int isl_map_is_strict_subset(
3941                 __isl_keep isl_map *map1,
3942                 __isl_keep isl_map *map2);
3943         int isl_union_map_is_subset(
3944                 __isl_keep isl_union_map *umap1,
3945                 __isl_keep isl_union_map *umap2);
3946         int isl_union_map_is_strict_subset(
3947                 __isl_keep isl_union_map *umap1,
3948                 __isl_keep isl_union_map *umap2);
3950 Check whether the first argument is a (strict) subset of the
3951 second argument.
3953 =item * Order
3955 Every comparison function returns a negative value if the first
3956 argument is considered smaller than the second, a positive value
3957 if the first argument is considered greater and zero if the two
3958 constraints are considered the same by the comparison criterion.
3960         #include <isl/constraint.h>
3961         int isl_constraint_plain_cmp(
3962                 __isl_keep isl_constraint *c1,
3963                 __isl_keep isl_constraint *c2);
3965 This function is useful for sorting C<isl_constraint>s.
3966 The order depends on the internal representation of the inputs.
3967 The order is fixed over different calls to the function (assuming
3968 the internal representation of the inputs has not changed), but may
3969 change over different versions of C<isl>.
3971         #include <isl/constraint.h>
3972         int isl_constraint_cmp_last_non_zero(
3973                 __isl_keep isl_constraint *c1,
3974                 __isl_keep isl_constraint *c2);
3976 This function can be used to sort constraints that live in the same
3977 local space.  Constraints that involve ``earlier'' dimensions or
3978 that have a smaller coefficient for the shared latest dimension
3979 are considered smaller than other constraints.
3980 This function only defines a B<partial> order.
3982         #include <isl/set.h>
3983         int isl_set_plain_cmp(__isl_keep isl_set *set1,
3984                 __isl_keep isl_set *set2);
3986 This function is useful for sorting C<isl_set>s.
3987 The order depends on the internal representation of the inputs.
3988 The order is fixed over different calls to the function (assuming
3989 the internal representation of the inputs has not changed), but may
3990 change over different versions of C<isl>.
3992         #include <isl/aff.h>
3993         int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
3994                 __isl_keep isl_pw_aff *pa2);
3996 The function C<isl_pw_aff_plain_cmp> can be used to sort
3997 C<isl_pw_aff>s.  The order is not strictly defined.
3998 The current order sorts expressions that only involve
3999 earlier dimensions before those that involve later dimensions.
4001 =back
4003 =head2 Unary Operations
4005 =over
4007 =item * Complement
4009         __isl_give isl_set *isl_set_complement(
4010                 __isl_take isl_set *set);
4011         __isl_give isl_map *isl_map_complement(
4012                 __isl_take isl_map *map);
4014 =item * Inverse map
4016         #include <isl/space.h>
4017         __isl_give isl_space *isl_space_reverse(
4018                 __isl_take isl_space *space);
4020         #include <isl/map.h>
4021         __isl_give isl_basic_map *isl_basic_map_reverse(
4022                 __isl_take isl_basic_map *bmap);
4023         __isl_give isl_map *isl_map_reverse(
4024                 __isl_take isl_map *map);
4026         #include <isl/union_map.h>
4027         __isl_give isl_union_map *isl_union_map_reverse(
4028                 __isl_take isl_union_map *umap);
4030 =item * Projection
4032         #include <isl/space.h>
4033         __isl_give isl_space *isl_space_domain(
4034                 __isl_take isl_space *space);
4035         __isl_give isl_space *isl_space_range(
4036                 __isl_take isl_space *space);
4037         __isl_give isl_space *isl_space_params(
4038                 __isl_take isl_space *space);
4040         #include <isl/local_space.h>
4041         __isl_give isl_local_space *isl_local_space_domain(
4042                 __isl_take isl_local_space *ls);
4043         __isl_give isl_local_space *isl_local_space_range(
4044                 __isl_take isl_local_space *ls);
4046         #include <isl/set.h>
4047         __isl_give isl_basic_set *isl_basic_set_project_out(
4048                 __isl_take isl_basic_set *bset,
4049                 enum isl_dim_type type, unsigned first, unsigned n);
4050         __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
4051                 enum isl_dim_type type, unsigned first, unsigned n);
4052         __isl_give isl_basic_set *isl_basic_set_params(
4053                 __isl_take isl_basic_set *bset);
4054         __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
4056         #include <isl/map.h>
4057         __isl_give isl_basic_map *isl_basic_map_project_out(
4058                 __isl_take isl_basic_map *bmap,
4059                 enum isl_dim_type type, unsigned first, unsigned n);
4060         __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
4061                 enum isl_dim_type type, unsigned first, unsigned n);
4062         __isl_give isl_basic_set *isl_basic_map_domain(
4063                 __isl_take isl_basic_map *bmap);
4064         __isl_give isl_basic_set *isl_basic_map_range(
4065                 __isl_take isl_basic_map *bmap);
4066         __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
4067         __isl_give isl_set *isl_map_domain(
4068                 __isl_take isl_map *bmap);
4069         __isl_give isl_set *isl_map_range(
4070                 __isl_take isl_map *map);
4072         #include <isl/union_set.h>
4073         __isl_give isl_union_set *isl_union_set_project_out(
4074                 __isl_take isl_union_set *uset,
4075                 enum isl_dim_type type,
4076                 unsigned first, unsigned n);
4077         __isl_give isl_set *isl_union_set_params(
4078                 __isl_take isl_union_set *uset);
4080 The function C<isl_union_set_project_out> can only project out
4081 parameters.
4083         #include <isl/union_map.h>
4084         __isl_give isl_union_map *isl_union_map_project_out(
4085                 __isl_take isl_union_map *umap,
4086                 enum isl_dim_type type, unsigned first, unsigned n);
4087         __isl_give isl_set *isl_union_map_params(
4088                 __isl_take isl_union_map *umap);
4089         __isl_give isl_union_set *isl_union_map_domain(
4090                 __isl_take isl_union_map *umap);
4091         __isl_give isl_union_set *isl_union_map_range(
4092                 __isl_take isl_union_map *umap);
4094 The function C<isl_union_map_project_out> can only project out
4095 parameters.
4097         #include <isl/aff.h>
4098         __isl_give isl_aff *isl_aff_project_domain_on_params(
4099                 __isl_take isl_aff *aff);
4100         __isl_give isl_pw_multi_aff *
4101         isl_pw_multi_aff_project_domain_on_params(
4102                 __isl_take isl_pw_multi_aff *pma);
4103         __isl_give isl_set *isl_pw_aff_domain(
4104                 __isl_take isl_pw_aff *pwaff);
4105         __isl_give isl_set *isl_pw_multi_aff_domain(
4106                 __isl_take isl_pw_multi_aff *pma);
4107         __isl_give isl_set *isl_multi_pw_aff_domain(
4108                 __isl_take isl_multi_pw_aff *mpa);
4109         __isl_give isl_union_set *isl_union_pw_aff_domain(
4110                 __isl_take isl_union_pw_aff *upa);
4111         __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
4112                 __isl_take isl_union_pw_multi_aff *upma);
4113         __isl_give isl_union_set *
4114         isl_multi_union_pw_aff_domain(
4115                 __isl_take isl_multi_union_pw_aff *mupa);
4116         __isl_give isl_set *isl_pw_aff_params(
4117                 __isl_take isl_pw_aff *pwa);
4119 The function C<isl_multi_union_pw_aff_domain> requires its
4120 input to have at least one set dimension.
4122         #include <isl/polynomial.h>
4123         __isl_give isl_qpolynomial *
4124         isl_qpolynomial_project_domain_on_params(
4125                 __isl_take isl_qpolynomial *qp);
4126         __isl_give isl_pw_qpolynomial *
4127         isl_pw_qpolynomial_project_domain_on_params(
4128                 __isl_take isl_pw_qpolynomial *pwqp);
4129         __isl_give isl_pw_qpolynomial_fold *
4130         isl_pw_qpolynomial_fold_project_domain_on_params(
4131                 __isl_take isl_pw_qpolynomial_fold *pwf);
4132         __isl_give isl_set *isl_pw_qpolynomial_domain(
4133                 __isl_take isl_pw_qpolynomial *pwqp);
4134         __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
4135                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4136         __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
4137                 __isl_take isl_union_pw_qpolynomial *upwqp);
4139         #include <isl/space.h>
4140         __isl_give isl_space *isl_space_domain_map(
4141                 __isl_take isl_space *space);
4142         __isl_give isl_space *isl_space_range_map(
4143                 __isl_take isl_space *space);
4145         #include <isl/map.h>
4146         __isl_give isl_map *isl_set_wrapped_domain_map(
4147                 __isl_take isl_set *set);
4148         __isl_give isl_basic_map *isl_basic_map_domain_map(
4149                 __isl_take isl_basic_map *bmap);
4150         __isl_give isl_basic_map *isl_basic_map_range_map(
4151                 __isl_take isl_basic_map *bmap);
4152         __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
4153         __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
4155         #include <isl/union_map.h>
4156         __isl_give isl_union_map *isl_union_map_domain_map(
4157                 __isl_take isl_union_map *umap);
4158         __isl_give isl_union_pw_multi_aff *
4159         isl_union_map_domain_map_union_pw_multi_aff(
4160                 __isl_take isl_union_map *umap);
4161         __isl_give isl_union_map *isl_union_map_range_map(
4162                 __isl_take isl_union_map *umap);
4163         __isl_give isl_union_map *
4164         isl_union_set_wrapped_domain_map(
4165                 __isl_take isl_union_set *uset);
4167 The functions above construct a (basic, regular or union) relation
4168 that maps (a wrapped version of) the input relation to its domain or range.
4169 C<isl_set_wrapped_domain_map> maps the input set to the domain
4170 of its wrapped relation.
4172 =item * Elimination
4174         __isl_give isl_basic_set *isl_basic_set_eliminate(
4175                 __isl_take isl_basic_set *bset,
4176                 enum isl_dim_type type,
4177                 unsigned first, unsigned n);
4178         __isl_give isl_set *isl_set_eliminate(
4179                 __isl_take isl_set *set, enum isl_dim_type type,
4180                 unsigned first, unsigned n);
4181         __isl_give isl_basic_map *isl_basic_map_eliminate(
4182                 __isl_take isl_basic_map *bmap,
4183                 enum isl_dim_type type,
4184                 unsigned first, unsigned n);
4185         __isl_give isl_map *isl_map_eliminate(
4186                 __isl_take isl_map *map, enum isl_dim_type type,
4187                 unsigned first, unsigned n);
4189 Eliminate the coefficients for the given dimensions from the constraints,
4190 without removing the dimensions.
4192 =item * Constructing a set from a parameter domain
4194 A zero-dimensional space or (basic) set can be constructed
4195 on a given parameter domain using the following functions.
4197         #include <isl/space.h>
4198         __isl_give isl_space *isl_space_set_from_params(
4199                 __isl_take isl_space *space);
4201         #include <isl/set.h>
4202         __isl_give isl_basic_set *isl_basic_set_from_params(
4203                 __isl_take isl_basic_set *bset);
4204         __isl_give isl_set *isl_set_from_params(
4205                 __isl_take isl_set *set);
4207 =item * Constructing a relation from a set
4209 Create a relation with the given set as domain or range.
4210 The range or domain of the created relation is a zero-dimensional
4211 flat anonymous space.
4213         #include <isl/space.h>
4214         __isl_give isl_space *isl_space_from_domain(
4215                 __isl_take isl_space *space);
4216         __isl_give isl_space *isl_space_from_range(
4217                 __isl_take isl_space *space);
4218         __isl_give isl_space *isl_space_map_from_set(
4219                 __isl_take isl_space *space);
4220         __isl_give isl_space *isl_space_map_from_domain_and_range(
4221                 __isl_take isl_space *domain,
4222                 __isl_take isl_space *range);
4224         #include <isl/local_space.h>
4225         __isl_give isl_local_space *isl_local_space_from_domain(
4226                 __isl_take isl_local_space *ls);
4228         #include <isl/map.h>
4229         __isl_give isl_map *isl_map_from_domain(
4230                 __isl_take isl_set *set);
4231         __isl_give isl_map *isl_map_from_range(
4232                 __isl_take isl_set *set);
4234         #include <isl/val.h>
4235         __isl_give isl_multi_val *isl_multi_val_from_range(
4236                 __isl_take isl_multi_val *mv);
4238         #include <isl/aff.h>
4239         __isl_give isl_multi_aff *isl_multi_aff_from_range(
4240                 __isl_take isl_multi_aff *ma);
4241         __isl_give isl_pw_aff *isl_pw_aff_from_range(
4242                 __isl_take isl_pw_aff *pwa);
4243         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
4244                 __isl_take isl_multi_pw_aff *mpa);
4245         __isl_give isl_multi_union_pw_aff *
4246         isl_multi_union_pw_aff_from_range(
4247                 __isl_take isl_multi_union_pw_aff *mupa);
4248         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
4249                 __isl_take isl_set *set);
4250         __isl_give isl_union_pw_multi_aff *
4251         isl_union_pw_multi_aff_from_domain(
4252                 __isl_take isl_union_set *uset);
4254 =item * Slicing
4256         #include <isl/set.h>
4257         __isl_give isl_basic_set *isl_basic_set_fix_si(
4258                 __isl_take isl_basic_set *bset,
4259                 enum isl_dim_type type, unsigned pos, int value);
4260         __isl_give isl_basic_set *isl_basic_set_fix_val(
4261                 __isl_take isl_basic_set *bset,
4262                 enum isl_dim_type type, unsigned pos,
4263                 __isl_take isl_val *v);
4264         __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
4265                 enum isl_dim_type type, unsigned pos, int value);
4266         __isl_give isl_set *isl_set_fix_val(
4267                 __isl_take isl_set *set,
4268                 enum isl_dim_type type, unsigned pos,
4269                 __isl_take isl_val *v);
4271         #include <isl/map.h>
4272         __isl_give isl_basic_map *isl_basic_map_fix_si(
4273                 __isl_take isl_basic_map *bmap,
4274                 enum isl_dim_type type, unsigned pos, int value);
4275         __isl_give isl_basic_map *isl_basic_map_fix_val(
4276                 __isl_take isl_basic_map *bmap,
4277                 enum isl_dim_type type, unsigned pos,
4278                 __isl_take isl_val *v);
4279         __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
4280                 enum isl_dim_type type, unsigned pos, int value);
4281         __isl_give isl_map *isl_map_fix_val(
4282                 __isl_take isl_map *map,
4283                 enum isl_dim_type type, unsigned pos,
4284                 __isl_take isl_val *v);
4286         #include <isl/aff.h>
4287         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
4288                 __isl_take isl_pw_multi_aff *pma,
4289                 enum isl_dim_type type, unsigned pos, int value);
4291         #include <isl/polynomial.h>
4292         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
4293                 __isl_take isl_pw_qpolynomial *pwqp,
4294                 enum isl_dim_type type, unsigned n,
4295                 __isl_take isl_val *v);
4297 Intersect the set, relation or function domain
4298 with the hyperplane where the given
4299 dimension has the fixed given value.
4301         __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
4302                 __isl_take isl_basic_map *bmap,
4303                 enum isl_dim_type type, unsigned pos, int value);
4304         __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
4305                 __isl_take isl_basic_map *bmap,
4306                 enum isl_dim_type type, unsigned pos, int value);
4307         __isl_give isl_set *isl_set_lower_bound_si(
4308                 __isl_take isl_set *set,
4309                 enum isl_dim_type type, unsigned pos, int value);
4310         __isl_give isl_set *isl_set_lower_bound_val(
4311                 __isl_take isl_set *set,
4312                 enum isl_dim_type type, unsigned pos,
4313                 __isl_take isl_val *value);
4314         __isl_give isl_map *isl_map_lower_bound_si(
4315                 __isl_take isl_map *map,
4316                 enum isl_dim_type type, unsigned pos, int value);
4317         __isl_give isl_set *isl_set_upper_bound_si(
4318                 __isl_take isl_set *set,
4319                 enum isl_dim_type type, unsigned pos, int value);
4320         __isl_give isl_set *isl_set_upper_bound_val(
4321                 __isl_take isl_set *set,
4322                 enum isl_dim_type type, unsigned pos,
4323                 __isl_take isl_val *value);
4324         __isl_give isl_map *isl_map_upper_bound_si(
4325                 __isl_take isl_map *map,
4326                 enum isl_dim_type type, unsigned pos, int value);
4328 Intersect the set or relation with the half-space where the given
4329 dimension has a value bounded by the fixed given integer value.
4331         __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
4332                 enum isl_dim_type type1, int pos1,
4333                 enum isl_dim_type type2, int pos2);
4334         __isl_give isl_basic_map *isl_basic_map_equate(
4335                 __isl_take isl_basic_map *bmap,
4336                 enum isl_dim_type type1, int pos1,
4337                 enum isl_dim_type type2, int pos2);
4338         __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
4339                 enum isl_dim_type type1, int pos1,
4340                 enum isl_dim_type type2, int pos2);
4342 Intersect the set or relation with the hyperplane where the given
4343 dimensions are equal to each other.
4345         __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4346                 enum isl_dim_type type1, int pos1,
4347                 enum isl_dim_type type2, int pos2);
4349 Intersect the relation with the hyperplane where the given
4350 dimensions have opposite values.
4352         __isl_give isl_map *isl_map_order_le(
4353                 __isl_take isl_map *map,
4354                 enum isl_dim_type type1, int pos1,
4355                 enum isl_dim_type type2, int pos2);
4356         __isl_give isl_basic_map *isl_basic_map_order_ge(
4357                 __isl_take isl_basic_map *bmap,
4358                 enum isl_dim_type type1, int pos1,
4359                 enum isl_dim_type type2, int pos2);
4360         __isl_give isl_map *isl_map_order_ge(
4361                 __isl_take isl_map *map,
4362                 enum isl_dim_type type1, int pos1,
4363                 enum isl_dim_type type2, int pos2);
4364         __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4365                 enum isl_dim_type type1, int pos1,
4366                 enum isl_dim_type type2, int pos2);
4367         __isl_give isl_basic_map *isl_basic_map_order_gt(
4368                 __isl_take isl_basic_map *bmap,
4369                 enum isl_dim_type type1, int pos1,
4370                 enum isl_dim_type type2, int pos2);
4371         __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4372                 enum isl_dim_type type1, int pos1,
4373                 enum isl_dim_type type2, int pos2);
4375 Intersect the relation with the half-space where the given
4376 dimensions satisfy the given ordering.
4378 =item * Locus
4380         #include <isl/aff.h>
4381         __isl_give isl_basic_set *isl_aff_zero_basic_set(
4382                 __isl_take isl_aff *aff);
4383         __isl_give isl_basic_set *isl_aff_neg_basic_set(
4384                 __isl_take isl_aff *aff);
4385         __isl_give isl_set *isl_pw_aff_pos_set(
4386                 __isl_take isl_pw_aff *pa);
4387         __isl_give isl_set *isl_pw_aff_nonneg_set(
4388                 __isl_take isl_pw_aff *pwaff);
4389         __isl_give isl_set *isl_pw_aff_zero_set(
4390                 __isl_take isl_pw_aff *pwaff);
4391         __isl_give isl_set *isl_pw_aff_non_zero_set(
4392                 __isl_take isl_pw_aff *pwaff);
4393         __isl_give isl_union_set *
4394         isl_union_pw_aff_zero_union_set(
4395                 __isl_take isl_union_pw_aff *upa);
4396         __isl_give isl_union_set *
4397         isl_multi_union_pw_aff_zero_union_set(
4398                 __isl_take isl_multi_union_pw_aff *mupa);
4400 The function C<isl_aff_neg_basic_set> returns a basic set
4401 containing those elements in the domain space
4402 of C<aff> where C<aff> is negative.
4403 The function C<isl_pw_aff_nonneg_set> returns a set
4404 containing those elements in the domain
4405 of C<pwaff> where C<pwaff> is non-negative.
4406 The function C<isl_multi_union_pw_aff_zero_union_set>
4407 returns a union set containing those elements
4408 in the domains of its elements where they are all zero.
4410 =item * Identity
4412         __isl_give isl_map *isl_set_identity(
4413                 __isl_take isl_set *set);
4414         __isl_give isl_union_map *isl_union_set_identity(
4415                 __isl_take isl_union_set *uset);
4416         __isl_give isl_union_pw_multi_aff *
4417         isl_union_set_identity_union_pw_multi_aff(
4418                 __isl_take isl_union_set *uset);
4420 Construct an identity relation on the given (union) set.
4422 =item * Function Extraction
4424 A piecewise quasi affine expression that is equal to 1 on a set
4425 and 0 outside the set can be created using the following function.
4427         #include <isl/aff.h>
4428         __isl_give isl_pw_aff *isl_set_indicator_function(
4429                 __isl_take isl_set *set);
4431 A piecewise multiple quasi affine expression can be extracted
4432 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4433 and the C<isl_map> is single-valued.
4434 In case of a conversion from an C<isl_union_map>
4435 to an C<isl_union_pw_multi_aff>, these properties need to hold
4436 in each domain space.
4437 A conversion to a C<isl_multi_union_pw_aff> additionally
4438 requires that the input is non-empty and involves only a single
4439 range space.
4441         #include <isl/aff.h>
4442         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4443                 __isl_take isl_set *set);
4444         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4445                 __isl_take isl_map *map);
4447         __isl_give isl_union_pw_multi_aff *
4448         isl_union_pw_multi_aff_from_union_set(
4449                 __isl_take isl_union_set *uset);
4450         __isl_give isl_union_pw_multi_aff *
4451         isl_union_pw_multi_aff_from_union_map(
4452                 __isl_take isl_union_map *umap);
4454         __isl_give isl_multi_union_pw_aff *
4455         isl_multi_union_pw_aff_from_union_map(
4456                 __isl_take isl_union_map *umap);
4458 =item * Deltas
4460         __isl_give isl_basic_set *isl_basic_map_deltas(
4461                 __isl_take isl_basic_map *bmap);
4462         __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
4463         __isl_give isl_union_set *isl_union_map_deltas(
4464                 __isl_take isl_union_map *umap);
4466 These functions return a (basic) set containing the differences
4467 between image elements and corresponding domain elements in the input.
4469         __isl_give isl_basic_map *isl_basic_map_deltas_map(
4470                 __isl_take isl_basic_map *bmap);
4471         __isl_give isl_map *isl_map_deltas_map(
4472                 __isl_take isl_map *map);
4473         __isl_give isl_union_map *isl_union_map_deltas_map(
4474                 __isl_take isl_union_map *umap);
4476 The functions above construct a (basic, regular or union) relation
4477 that maps (a wrapped version of) the input relation to its delta set.
4479 =item * Coalescing
4481 Simplify the representation of a set, relation or functions by trying
4482 to combine pairs of basic sets or relations into a single
4483 basic set or relation.
4485         #include <isl/set.h>
4486         __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
4488         #include <isl/map.h>
4489         __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
4491         #include <isl/union_set.h>
4492         __isl_give isl_union_set *isl_union_set_coalesce(
4493                 __isl_take isl_union_set *uset);
4495         #include <isl/union_map.h>
4496         __isl_give isl_union_map *isl_union_map_coalesce(
4497                 __isl_take isl_union_map *umap);
4499         #include <isl/aff.h>
4500         __isl_give isl_pw_aff *isl_pw_aff_coalesce(
4501                 __isl_take isl_pw_aff *pwqp);
4502         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
4503                 __isl_take isl_pw_multi_aff *pma);
4504         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
4505                 __isl_take isl_multi_pw_aff *mpa);
4506         __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
4507                 __isl_take isl_union_pw_aff *upa);
4508         __isl_give isl_union_pw_multi_aff *
4509         isl_union_pw_multi_aff_coalesce(
4510                 __isl_take isl_union_pw_multi_aff *upma);
4512         #include <isl/polynomial.h>
4513         __isl_give isl_pw_qpolynomial_fold *
4514         isl_pw_qpolynomial_fold_coalesce(
4515                 __isl_take isl_pw_qpolynomial_fold *pwf);
4516         __isl_give isl_union_pw_qpolynomial *
4517         isl_union_pw_qpolynomial_coalesce(
4518                 __isl_take isl_union_pw_qpolynomial *upwqp);
4519         __isl_give isl_union_pw_qpolynomial_fold *
4520         isl_union_pw_qpolynomial_fold_coalesce(
4521                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4523 One of the methods for combining pairs of basic sets or relations
4524 can result in coefficients that are much larger than those that appear
4525 in the constraints of the input.  By default, the coefficients are
4526 not allowed to grow larger, but this can be changed by unsetting
4527 the following option.
4529         int isl_options_set_coalesce_bounded_wrapping(
4530                 isl_ctx *ctx, int val);
4531         int isl_options_get_coalesce_bounded_wrapping(
4532                 isl_ctx *ctx);
4534 =item * Detecting equalities
4536         __isl_give isl_basic_set *isl_basic_set_detect_equalities(
4537                 __isl_take isl_basic_set *bset);
4538         __isl_give isl_basic_map *isl_basic_map_detect_equalities(
4539                 __isl_take isl_basic_map *bmap);
4540         __isl_give isl_set *isl_set_detect_equalities(
4541                 __isl_take isl_set *set);
4542         __isl_give isl_map *isl_map_detect_equalities(
4543                 __isl_take isl_map *map);
4544         __isl_give isl_union_set *isl_union_set_detect_equalities(
4545                 __isl_take isl_union_set *uset);
4546         __isl_give isl_union_map *isl_union_map_detect_equalities(
4547                 __isl_take isl_union_map *umap);
4549 Simplify the representation of a set or relation by detecting implicit
4550 equalities.
4552 =item * Removing redundant constraints
4554         #include <isl/set.h>
4555         __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
4556                 __isl_take isl_basic_set *bset);
4557         __isl_give isl_set *isl_set_remove_redundancies(
4558                 __isl_take isl_set *set);
4560         #include <isl/union_set.h>
4561         __isl_give isl_union_set *
4562         isl_union_set_remove_redundancies(
4563                 __isl_take isl_union_set *uset);
4565         #include <isl/map.h>
4566         __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
4567                 __isl_take isl_basic_map *bmap);
4568         __isl_give isl_map *isl_map_remove_redundancies(
4569                 __isl_take isl_map *map);
4571         #include <isl/union_map.h>
4572         __isl_give isl_union_map *
4573         isl_union_map_remove_redundancies(
4574                 __isl_take isl_union_map *umap);
4576 =item * Convex hull
4578         __isl_give isl_basic_set *isl_set_convex_hull(
4579                 __isl_take isl_set *set);
4580         __isl_give isl_basic_map *isl_map_convex_hull(
4581                 __isl_take isl_map *map);
4583 If the input set or relation has any existentially quantified
4584 variables, then the result of these operations is currently undefined.
4586 =item * Simple hull
4588         #include <isl/set.h>
4589         __isl_give isl_basic_set *
4590         isl_set_unshifted_simple_hull(
4591                 __isl_take isl_set *set);
4592         __isl_give isl_basic_set *isl_set_simple_hull(
4593                 __isl_take isl_set *set);
4594         __isl_give isl_basic_set *
4595         isl_set_unshifted_simple_hull_from_set_list(
4596                 __isl_take isl_set *set,
4597                 __isl_take isl_set_list *list);
4599         #include <isl/map.h>
4600         __isl_give isl_basic_map *
4601         isl_map_unshifted_simple_hull(
4602                 __isl_take isl_map *map);
4603         __isl_give isl_basic_map *isl_map_simple_hull(
4604                 __isl_take isl_map *map);
4605         __isl_give isl_basic_map *
4606         isl_map_unshifted_simple_hull_from_map_list(
4607                 __isl_take isl_map *map,
4608                 __isl_take isl_map_list *list);
4610         #include <isl/union_map.h>
4611         __isl_give isl_union_map *isl_union_map_simple_hull(
4612                 __isl_take isl_union_map *umap);
4614 These functions compute a single basic set or relation
4615 that contains the whole input set or relation.
4616 In particular, the output is described by translates
4617 of the constraints describing the basic sets or relations in the input.
4618 In case of C<isl_set_unshifted_simple_hull>, only the original
4619 constraints are used, without any translation.
4620 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
4621 C<isl_map_unshifted_simple_hull_from_map_list>, the
4622 constraints are taken from the elements of the second argument.
4624 =begin latex
4626 (See \autoref{s:simple hull}.)
4628 =end latex
4630 =item * Affine hull
4632         __isl_give isl_basic_set *isl_basic_set_affine_hull(
4633                 __isl_take isl_basic_set *bset);
4634         __isl_give isl_basic_set *isl_set_affine_hull(
4635                 __isl_take isl_set *set);
4636         __isl_give isl_union_set *isl_union_set_affine_hull(
4637                 __isl_take isl_union_set *uset);
4638         __isl_give isl_basic_map *isl_basic_map_affine_hull(
4639                 __isl_take isl_basic_map *bmap);
4640         __isl_give isl_basic_map *isl_map_affine_hull(
4641                 __isl_take isl_map *map);
4642         __isl_give isl_union_map *isl_union_map_affine_hull(
4643                 __isl_take isl_union_map *umap);
4645 In case of union sets and relations, the affine hull is computed
4646 per space.
4648 =item * Polyhedral hull
4650         __isl_give isl_basic_set *isl_set_polyhedral_hull(
4651                 __isl_take isl_set *set);
4652         __isl_give isl_basic_map *isl_map_polyhedral_hull(
4653                 __isl_take isl_map *map);
4654         __isl_give isl_union_set *isl_union_set_polyhedral_hull(
4655                 __isl_take isl_union_set *uset);
4656         __isl_give isl_union_map *isl_union_map_polyhedral_hull(
4657                 __isl_take isl_union_map *umap);
4659 These functions compute a single basic set or relation
4660 not involving any existentially quantified variables
4661 that contains the whole input set or relation.
4662 In case of union sets and relations, the polyhedral hull is computed
4663 per space.
4665 =item * Other approximations
4667         #include <isl/set.h>
4668         __isl_give isl_basic_set *
4669         isl_basic_set_drop_constraints_involving_dims(
4670                 __isl_take isl_basic_set *bset,
4671                 enum isl_dim_type type,
4672                 unsigned first, unsigned n);
4673         __isl_give isl_basic_set *
4674         isl_basic_set_drop_constraints_not_involving_dims(
4675                 __isl_take isl_basic_set *bset,
4676                 enum isl_dim_type type,
4677                 unsigned first, unsigned n);
4678         __isl_give isl_set *
4679         isl_set_drop_constraints_involving_dims(
4680                 __isl_take isl_set *set,
4681                 enum isl_dim_type type,
4682                 unsigned first, unsigned n);
4684         #include <isl/map.h>
4685         __isl_give isl_basic_map *
4686         isl_basic_map_drop_constraints_involving_dims(
4687                 __isl_take isl_basic_map *bmap,
4688                 enum isl_dim_type type,
4689                 unsigned first, unsigned n);
4690         __isl_give isl_map *
4691         isl_map_drop_constraints_involving_dims(
4692                 __isl_take isl_map *map,
4693                 enum isl_dim_type type,
4694                 unsigned first, unsigned n);
4696 These functions drop any constraints (not) involving the specified dimensions.
4697 Note that the result depends on the representation of the input.
4699         #include <isl/polynomial.h>
4700         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
4701                 __isl_take isl_pw_qpolynomial *pwqp, int sign);
4702         __isl_give isl_union_pw_qpolynomial *
4703         isl_union_pw_qpolynomial_to_polynomial(
4704                 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
4706 Approximate each quasipolynomial by a polynomial.  If C<sign> is positive,
4707 the polynomial will be an overapproximation.  If C<sign> is negative,
4708 it will be an underapproximation.  If C<sign> is zero, the approximation
4709 will lie somewhere in between.
4711 =item * Feasibility
4713         __isl_give isl_basic_set *isl_basic_set_sample(
4714                 __isl_take isl_basic_set *bset);
4715         __isl_give isl_basic_set *isl_set_sample(
4716                 __isl_take isl_set *set);
4717         __isl_give isl_basic_map *isl_basic_map_sample(
4718                 __isl_take isl_basic_map *bmap);
4719         __isl_give isl_basic_map *isl_map_sample(
4720                 __isl_take isl_map *map);
4722 If the input (basic) set or relation is non-empty, then return
4723 a singleton subset of the input.  Otherwise, return an empty set.
4725 =item * Optimization
4727         #include <isl/ilp.h>
4728         __isl_give isl_val *isl_basic_set_max_val(
4729                 __isl_keep isl_basic_set *bset,
4730                 __isl_keep isl_aff *obj);
4731         __isl_give isl_val *isl_set_min_val(
4732                 __isl_keep isl_set *set,
4733                 __isl_keep isl_aff *obj);
4734         __isl_give isl_val *isl_set_max_val(
4735                 __isl_keep isl_set *set,
4736                 __isl_keep isl_aff *obj);
4738 Compute the minimum or maximum of the integer affine expression C<obj>
4739 over the points in C<set>, returning the result in C<opt>.
4740 The result is C<NULL> in case of an error, the optimal value in case
4741 there is one, negative infinity or infinity if the problem is unbounded and
4742 NaN if the problem is empty.
4744 =item * Parametric optimization
4746         __isl_give isl_pw_aff *isl_set_dim_min(
4747                 __isl_take isl_set *set, int pos);
4748         __isl_give isl_pw_aff *isl_set_dim_max(
4749                 __isl_take isl_set *set, int pos);
4750         __isl_give isl_pw_aff *isl_map_dim_max(
4751                 __isl_take isl_map *map, int pos);
4753 Compute the minimum or maximum of the given set or output dimension
4754 as a function of the parameters (and input dimensions), but independently
4755 of the other set or output dimensions.
4756 For lexicographic optimization, see L<"Lexicographic Optimization">.
4758 =item * Dual
4760 The following functions compute either the set of (rational) coefficient
4761 values of valid constraints for the given set or the set of (rational)
4762 values satisfying the constraints with coefficients from the given set.
4763 Internally, these two sets of functions perform essentially the
4764 same operations, except that the set of coefficients is assumed to
4765 be a cone, while the set of values may be any polyhedron.
4766 The current implementation is based on the Farkas lemma and
4767 Fourier-Motzkin elimination, but this may change or be made optional
4768 in future.  In particular, future implementations may use different
4769 dualization algorithms or skip the elimination step.
4771         __isl_give isl_basic_set *isl_basic_set_coefficients(
4772                 __isl_take isl_basic_set *bset);
4773         __isl_give isl_basic_set *isl_set_coefficients(
4774                 __isl_take isl_set *set);
4775         __isl_give isl_union_set *isl_union_set_coefficients(
4776                 __isl_take isl_union_set *bset);
4777         __isl_give isl_basic_set *isl_basic_set_solutions(
4778                 __isl_take isl_basic_set *bset);
4779         __isl_give isl_basic_set *isl_set_solutions(
4780                 __isl_take isl_set *set);
4781         __isl_give isl_union_set *isl_union_set_solutions(
4782                 __isl_take isl_union_set *bset);
4784 =item * Power
4786         __isl_give isl_map *isl_map_fixed_power_val(
4787                 __isl_take isl_map *map,
4788                 __isl_take isl_val *exp);
4789         __isl_give isl_union_map *
4790         isl_union_map_fixed_power_val(
4791                 __isl_take isl_union_map *umap,
4792                 __isl_take isl_val *exp);
4794 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
4795 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
4796 of C<map> is computed.
4798         __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
4799                 int *exact);
4800         __isl_give isl_union_map *isl_union_map_power(
4801                 __isl_take isl_union_map *umap, int *exact);
4803 Compute a parametric representation for all positive powers I<k> of C<map>.
4804 The result maps I<k> to a nested relation corresponding to the
4805 I<k>th power of C<map>.
4806 The result may be an overapproximation.  If the result is known to be exact,
4807 then C<*exact> is set to C<1>.
4809 =item * Transitive closure
4811         __isl_give isl_map *isl_map_transitive_closure(
4812                 __isl_take isl_map *map, int *exact);
4813         __isl_give isl_union_map *isl_union_map_transitive_closure(
4814                 __isl_take isl_union_map *umap, int *exact);
4816 Compute the transitive closure of C<map>.
4817 The result may be an overapproximation.  If the result is known to be exact,
4818 then C<*exact> is set to C<1>.
4820 =item * Reaching path lengths
4822         __isl_give isl_map *isl_map_reaching_path_lengths(
4823                 __isl_take isl_map *map, int *exact);
4825 Compute a relation that maps each element in the range of C<map>
4826 to the lengths of all paths composed of edges in C<map> that
4827 end up in the given element.
4828 The result may be an overapproximation.  If the result is known to be exact,
4829 then C<*exact> is set to C<1>.
4830 To compute the I<maximal> path length, the resulting relation
4831 should be postprocessed by C<isl_map_lexmax>.
4832 In particular, if the input relation is a dependence relation
4833 (mapping sources to sinks), then the maximal path length corresponds
4834 to the free schedule.
4835 Note, however, that C<isl_map_lexmax> expects the maximum to be
4836 finite, so if the path lengths are unbounded (possibly due to
4837 the overapproximation), then you will get an error message.
4839 =item * Wrapping
4841         #include <isl/space.h>
4842         __isl_give isl_space *isl_space_wrap(
4843                 __isl_take isl_space *space);
4844         __isl_give isl_space *isl_space_unwrap(
4845                 __isl_take isl_space *space);
4847         #include <isl/local_space.h>
4848         __isl_give isl_local_space *isl_local_space_wrap(
4849                 __isl_take isl_local_space *ls);
4851         #include <isl/set.h>
4852         __isl_give isl_basic_map *isl_basic_set_unwrap(
4853                 __isl_take isl_basic_set *bset);
4854         __isl_give isl_map *isl_set_unwrap(
4855                 __isl_take isl_set *set);
4857         #include <isl/map.h>
4858         __isl_give isl_basic_set *isl_basic_map_wrap(
4859                 __isl_take isl_basic_map *bmap);
4860         __isl_give isl_set *isl_map_wrap(
4861                 __isl_take isl_map *map);
4863         #include <isl/union_set.h>
4864         __isl_give isl_union_map *isl_union_set_unwrap(
4865                 __isl_take isl_union_set *uset);
4867         #include <isl/union_map.h>
4868         __isl_give isl_union_set *isl_union_map_wrap(
4869                 __isl_take isl_union_map *umap);
4871 The input to C<isl_space_unwrap> should
4872 be the space of a set, while that of
4873 C<isl_space_wrap> should be the space of a relation.
4874 Conversely, the output of C<isl_space_unwrap> is the space
4875 of a relation, while that of C<isl_space_wrap> is the space of a set.
4877 =item * Flattening
4879 Remove any internal structure of domain (and range) of the given
4880 set or relation.  If there is any such internal structure in the input,
4881 then the name of the space is also removed.
4883         #include <isl/local_space.h>
4884         __isl_give isl_local_space *
4885         isl_local_space_flatten_domain(
4886                 __isl_take isl_local_space *ls);
4887         __isl_give isl_local_space *
4888         isl_local_space_flatten_range(
4889                 __isl_take isl_local_space *ls);
4891         #include <isl/set.h>
4892         __isl_give isl_basic_set *isl_basic_set_flatten(
4893                 __isl_take isl_basic_set *bset);
4894         __isl_give isl_set *isl_set_flatten(
4895                 __isl_take isl_set *set);
4897         #include <isl/map.h>
4898         __isl_give isl_basic_map *isl_basic_map_flatten_domain(
4899                 __isl_take isl_basic_map *bmap);
4900         __isl_give isl_basic_map *isl_basic_map_flatten_range(
4901                 __isl_take isl_basic_map *bmap);
4902         __isl_give isl_map *isl_map_flatten_range(
4903                 __isl_take isl_map *map);
4904         __isl_give isl_map *isl_map_flatten_domain(
4905                 __isl_take isl_map *map);
4906         __isl_give isl_basic_map *isl_basic_map_flatten(
4907                 __isl_take isl_basic_map *bmap);
4908         __isl_give isl_map *isl_map_flatten(
4909                 __isl_take isl_map *map);
4911         #include <isl/val.h>
4912         __isl_give isl_multi_val *isl_multi_val_flatten_range(
4913                 __isl_take isl_multi_val *mv);
4915         #include <isl/aff.h>
4916         __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
4917                 __isl_take isl_multi_aff *ma);
4918         __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
4919                 __isl_take isl_multi_aff *ma);
4920         __isl_give isl_multi_pw_aff *
4921         isl_multi_pw_aff_flatten_range(
4922                 __isl_take isl_multi_pw_aff *mpa);
4923         __isl_give isl_multi_union_pw_aff *
4924         isl_multi_union_pw_aff_flatten_range(
4925                 __isl_take isl_multi_union_pw_aff *mupa);
4927         #include <isl/map.h>
4928         __isl_give isl_map *isl_set_flatten_map(
4929                 __isl_take isl_set *set);
4931 The function above constructs a relation
4932 that maps the input set to a flattened version of the set.
4934 =item * Lifting
4936 Lift the input set to a space with extra dimensions corresponding
4937 to the existentially quantified variables in the input.
4938 In particular, the result lives in a wrapped map where the domain
4939 is the original space and the range corresponds to the original
4940 existentially quantified variables.
4942         #include <isl/set.h>
4943         __isl_give isl_basic_set *isl_basic_set_lift(
4944                 __isl_take isl_basic_set *bset);
4945         __isl_give isl_set *isl_set_lift(
4946                 __isl_take isl_set *set);
4947         __isl_give isl_union_set *isl_union_set_lift(
4948                 __isl_take isl_union_set *uset);
4950 Given a local space that contains the existentially quantified
4951 variables of a set, a basic relation that, when applied to
4952 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
4953 can be constructed using the following function.
4955         #include <isl/local_space.h>
4956         __isl_give isl_basic_map *isl_local_space_lifting(
4957                 __isl_take isl_local_space *ls);
4959         #include <isl/aff.h>
4960         __isl_give isl_multi_aff *isl_multi_aff_lift(
4961                 __isl_take isl_multi_aff *maff,
4962                 __isl_give isl_local_space **ls);
4964 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
4965 then it is assigned the local space that lies at the basis of
4966 the lifting applied.
4968 =item * Internal Product
4970         #include <isl/space.h>
4971         __isl_give isl_space *isl_space_zip(
4972                 __isl_take isl_space *space);
4974         #include <isl/map.h>
4975         __isl_give isl_basic_map *isl_basic_map_zip(
4976                 __isl_take isl_basic_map *bmap);
4977         __isl_give isl_map *isl_map_zip(
4978                 __isl_take isl_map *map);
4980         #include <isl/union_map.h>
4981         __isl_give isl_union_map *isl_union_map_zip(
4982                 __isl_take isl_union_map *umap);
4984 Given a relation with nested relations for domain and range,
4985 interchange the range of the domain with the domain of the range.
4987 =item * Currying
4989         #include <isl/space.h>
4990         __isl_give isl_space *isl_space_curry(
4991                 __isl_take isl_space *space);
4992         __isl_give isl_space *isl_space_uncurry(
4993                 __isl_take isl_space *space);
4995         #include <isl/map.h>
4996         __isl_give isl_basic_map *isl_basic_map_curry(
4997                 __isl_take isl_basic_map *bmap);
4998         __isl_give isl_basic_map *isl_basic_map_uncurry(
4999                 __isl_take isl_basic_map *bmap);
5000         __isl_give isl_map *isl_map_curry(
5001                 __isl_take isl_map *map);
5002         __isl_give isl_map *isl_map_uncurry(
5003                 __isl_take isl_map *map);
5005         #include <isl/union_map.h>
5006         __isl_give isl_union_map *isl_union_map_curry(
5007                 __isl_take isl_union_map *umap);
5008         __isl_give isl_union_map *isl_union_map_uncurry(
5009                 __isl_take isl_union_map *umap);
5011 Given a relation with a nested relation for domain,
5012 the C<curry> functions
5013 move the range of the nested relation out of the domain
5014 and use it as the domain of a nested relation in the range,
5015 with the original range as range of this nested relation.
5016 The C<uncurry> functions perform the inverse operation.
5018 =item * Aligning parameters
5020 Change the order of the parameters of the given set, relation
5021 or function
5022 such that the first parameters match those of C<model>.
5023 This may involve the introduction of extra parameters.
5024 All parameters need to be named.
5026         #include <isl/space.h>
5027         __isl_give isl_space *isl_space_align_params(
5028                 __isl_take isl_space *space1,
5029                 __isl_take isl_space *space2)
5031         #include <isl/set.h>
5032         __isl_give isl_basic_set *isl_basic_set_align_params(
5033                 __isl_take isl_basic_set *bset,
5034                 __isl_take isl_space *model);
5035         __isl_give isl_set *isl_set_align_params(
5036                 __isl_take isl_set *set,
5037                 __isl_take isl_space *model);
5039         #include <isl/map.h>
5040         __isl_give isl_basic_map *isl_basic_map_align_params(
5041                 __isl_take isl_basic_map *bmap,
5042                 __isl_take isl_space *model);
5043         __isl_give isl_map *isl_map_align_params(
5044                 __isl_take isl_map *map,
5045                 __isl_take isl_space *model);
5047         #include <isl/val.h>
5048         __isl_give isl_multi_val *isl_multi_val_align_params(
5049                 __isl_take isl_multi_val *mv,
5050                 __isl_take isl_space *model);
5052         #include <isl/aff.h>
5053         __isl_give isl_aff *isl_aff_align_params(
5054                 __isl_take isl_aff *aff,
5055                 __isl_take isl_space *model);
5056         __isl_give isl_multi_aff *isl_multi_aff_align_params(
5057                 __isl_take isl_multi_aff *multi,
5058                 __isl_take isl_space *model);
5059         __isl_give isl_pw_aff *isl_pw_aff_align_params(
5060                 __isl_take isl_pw_aff *pwaff,
5061                 __isl_take isl_space *model);
5062         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
5063                 __isl_take isl_pw_multi_aff *pma,
5064                 __isl_take isl_space *model);
5065         __isl_give isl_union_pw_aff *
5066         isl_union_pw_aff_align_params(
5067                 __isl_take isl_union_pw_aff *upa,
5068                 __isl_take isl_space *model);
5069         __isl_give isl_union_pw_multi_aff *
5070         isl_union_pw_multi_aff_align_params(
5071                 __isl_take isl_union_pw_multi_aff *upma,
5072                 __isl_take isl_space *model);
5073         __isl_give isl_multi_union_pw_aff *
5074         isl_multi_union_pw_aff_align_params(
5075                 __isl_take isl_multi_union_pw_aff *mupa,
5076                 __isl_take isl_space *model);
5078         #include <isl/polynomial.h>
5079         __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
5080                 __isl_take isl_qpolynomial *qp,
5081                 __isl_take isl_space *model);
5083 =item * Unary Arithmethic Operations
5085         #include <isl/val.h>
5086         __isl_give isl_multi_val *isl_multi_val_neg(
5087                 __isl_take isl_multi_val *mv);
5089         #include <isl/aff.h>
5090         __isl_give isl_aff *isl_aff_neg(
5091                 __isl_take isl_aff *aff);
5092         __isl_give isl_multi_aff *isl_multi_aff_neg(
5093                 __isl_take isl_multi_aff *ma);
5094         __isl_give isl_pw_aff *isl_pw_aff_neg(
5095                 __isl_take isl_pw_aff *pwaff);
5096         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
5097                 __isl_take isl_pw_multi_aff *pma);
5098         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
5099                 __isl_take isl_multi_pw_aff *mpa);
5100         __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
5101                 __isl_take isl_union_pw_aff *upa);
5102         __isl_give isl_union_pw_multi_aff *
5103         isl_union_pw_multi_aff_neg(
5104                 __isl_take isl_union_pw_multi_aff *upma);
5105         __isl_give isl_multi_union_pw_aff *
5106         isl_multi_union_pw_aff_neg(
5107                 __isl_take isl_multi_union_pw_aff *mupa);
5108         __isl_give isl_aff *isl_aff_ceil(
5109                 __isl_take isl_aff *aff);
5110         __isl_give isl_pw_aff *isl_pw_aff_ceil(
5111                 __isl_take isl_pw_aff *pwaff);
5112         __isl_give isl_aff *isl_aff_floor(
5113                 __isl_take isl_aff *aff);
5114         __isl_give isl_multi_aff *isl_multi_aff_floor(
5115                 __isl_take isl_multi_aff *ma);
5116         __isl_give isl_pw_aff *isl_pw_aff_floor(
5117                 __isl_take isl_pw_aff *pwaff);
5118         __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
5119                 __isl_take isl_union_pw_aff *upa);
5120         __isl_give isl_multi_union_pw_aff *
5121         isl_multi_union_pw_aff_floor(
5122                 __isl_take isl_multi_union_pw_aff *mupa);
5124         #include <isl/aff.h>
5125         __isl_give isl_pw_aff *isl_pw_aff_list_min(
5126                 __isl_take isl_pw_aff_list *list);
5127         __isl_give isl_pw_aff *isl_pw_aff_list_max(
5128                 __isl_take isl_pw_aff_list *list);
5130         #include <isl/polynomial.h>
5131         __isl_give isl_qpolynomial *isl_qpolynomial_neg(
5132                 __isl_take isl_qpolynomial *qp);
5133         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
5134                 __isl_take isl_pw_qpolynomial *pwqp);
5135         __isl_give isl_union_pw_qpolynomial *
5136         isl_union_pw_qpolynomial_neg(
5137                 __isl_take isl_union_pw_qpolynomial *upwqp);
5138         __isl_give isl_qpolynomial *isl_qpolynomial_pow(
5139                 __isl_take isl_qpolynomial *qp,
5140                 unsigned exponent);
5141         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
5142                 __isl_take isl_pw_qpolynomial *pwqp,
5143                 unsigned exponent);
5145 =item * Evaluation
5147 The following functions evaluate a function in a point.
5149         #include <isl/polynomial.h>
5150         __isl_give isl_val *isl_pw_qpolynomial_eval(
5151                 __isl_take isl_pw_qpolynomial *pwqp,
5152                 __isl_take isl_point *pnt);
5153         __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
5154                 __isl_take isl_pw_qpolynomial_fold *pwf,
5155                 __isl_take isl_point *pnt);
5156         __isl_give isl_val *isl_union_pw_qpolynomial_eval(
5157                 __isl_take isl_union_pw_qpolynomial *upwqp,
5158                 __isl_take isl_point *pnt);
5159         __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
5160                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5161                 __isl_take isl_point *pnt);
5163 =item * Dimension manipulation
5165 It is usually not advisable to directly change the (input or output)
5166 space of a set or a relation as this removes the name and the internal
5167 structure of the space.  However, the functions below can be useful
5168 to add new parameters, assuming
5169 C<isl_set_align_params> and C<isl_map_align_params>
5170 are not sufficient.
5172         #include <isl/space.h>
5173         __isl_give isl_space *isl_space_add_dims(
5174                 __isl_take isl_space *space,
5175                 enum isl_dim_type type, unsigned n);
5176         __isl_give isl_space *isl_space_insert_dims(
5177                 __isl_take isl_space *space,
5178                 enum isl_dim_type type, unsigned pos, unsigned n);
5179         __isl_give isl_space *isl_space_drop_dims(
5180                 __isl_take isl_space *space,
5181                 enum isl_dim_type type, unsigned first, unsigned n);
5182         __isl_give isl_space *isl_space_move_dims(
5183                 __isl_take isl_space *space,
5184                 enum isl_dim_type dst_type, unsigned dst_pos,
5185                 enum isl_dim_type src_type, unsigned src_pos,
5186                 unsigned n);
5188         #include <isl/local_space.h>
5189         __isl_give isl_local_space *isl_local_space_add_dims(
5190                 __isl_take isl_local_space *ls,
5191                 enum isl_dim_type type, unsigned n);
5192         __isl_give isl_local_space *isl_local_space_insert_dims(
5193                 __isl_take isl_local_space *ls,
5194                 enum isl_dim_type type, unsigned first, unsigned n);
5195         __isl_give isl_local_space *isl_local_space_drop_dims(
5196                 __isl_take isl_local_space *ls,
5197                 enum isl_dim_type type, unsigned first, unsigned n);
5199         #include <isl/set.h>
5200         __isl_give isl_basic_set *isl_basic_set_add_dims(
5201                 __isl_take isl_basic_set *bset,
5202                 enum isl_dim_type type, unsigned n);
5203         __isl_give isl_set *isl_set_add_dims(
5204                 __isl_take isl_set *set,
5205                 enum isl_dim_type type, unsigned n);
5206         __isl_give isl_basic_set *isl_basic_set_insert_dims(
5207                 __isl_take isl_basic_set *bset,
5208                 enum isl_dim_type type, unsigned pos,
5209                 unsigned n);
5210         __isl_give isl_set *isl_set_insert_dims(
5211                 __isl_take isl_set *set,
5212                 enum isl_dim_type type, unsigned pos, unsigned n);
5213         __isl_give isl_basic_set *isl_basic_set_move_dims(
5214                 __isl_take isl_basic_set *bset,
5215                 enum isl_dim_type dst_type, unsigned dst_pos,
5216                 enum isl_dim_type src_type, unsigned src_pos,
5217                 unsigned n);
5218         __isl_give isl_set *isl_set_move_dims(
5219                 __isl_take isl_set *set,
5220                 enum isl_dim_type dst_type, unsigned dst_pos,
5221                 enum isl_dim_type src_type, unsigned src_pos,
5222                 unsigned n);
5224         #include <isl/map.h>
5225         __isl_give isl_map *isl_map_add_dims(
5226                 __isl_take isl_map *map,
5227                 enum isl_dim_type type, unsigned n);
5228         __isl_give isl_basic_map *isl_basic_map_insert_dims(
5229                 __isl_take isl_basic_map *bmap,
5230                 enum isl_dim_type type, unsigned pos,
5231                 unsigned n);
5232         __isl_give isl_map *isl_map_insert_dims(
5233                 __isl_take isl_map *map,
5234                 enum isl_dim_type type, unsigned pos, unsigned n);
5235         __isl_give isl_basic_map *isl_basic_map_move_dims(
5236                 __isl_take isl_basic_map *bmap,
5237                 enum isl_dim_type dst_type, unsigned dst_pos,
5238                 enum isl_dim_type src_type, unsigned src_pos,
5239                 unsigned n);
5240         __isl_give isl_map *isl_map_move_dims(
5241                 __isl_take isl_map *map,
5242                 enum isl_dim_type dst_type, unsigned dst_pos,
5243                 enum isl_dim_type src_type, unsigned src_pos,
5244                 unsigned n);
5246         #include <isl/val.h>
5247         __isl_give isl_multi_val *isl_multi_val_insert_dims(
5248                 __isl_take isl_multi_val *mv,
5249                 enum isl_dim_type type, unsigned first, unsigned n);
5250         __isl_give isl_multi_val *isl_multi_val_add_dims(
5251                 __isl_take isl_multi_val *mv,
5252                 enum isl_dim_type type, unsigned n);
5253         __isl_give isl_multi_val *isl_multi_val_drop_dims(
5254                 __isl_take isl_multi_val *mv,
5255                 enum isl_dim_type type, unsigned first, unsigned n);
5257         #include <isl/aff.h>
5258         __isl_give isl_aff *isl_aff_insert_dims(
5259                 __isl_take isl_aff *aff,
5260                 enum isl_dim_type type, unsigned first, unsigned n);
5261         __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
5262                 __isl_take isl_multi_aff *ma,
5263                 enum isl_dim_type type, unsigned first, unsigned n);
5264         __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
5265                 __isl_take isl_pw_aff *pwaff,
5266                 enum isl_dim_type type, unsigned first, unsigned n);
5267         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
5268                 __isl_take isl_multi_pw_aff *mpa,
5269                 enum isl_dim_type type, unsigned first, unsigned n);
5270         __isl_give isl_aff *isl_aff_add_dims(
5271                 __isl_take isl_aff *aff,
5272                 enum isl_dim_type type, unsigned n);
5273         __isl_give isl_multi_aff *isl_multi_aff_add_dims(
5274                 __isl_take isl_multi_aff *ma,
5275                 enum isl_dim_type type, unsigned n);
5276         __isl_give isl_pw_aff *isl_pw_aff_add_dims(
5277                 __isl_take isl_pw_aff *pwaff,
5278                 enum isl_dim_type type, unsigned n);
5279         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
5280                 __isl_take isl_multi_pw_aff *mpa,
5281                 enum isl_dim_type type, unsigned n);
5282         __isl_give isl_aff *isl_aff_drop_dims(
5283                 __isl_take isl_aff *aff,
5284                 enum isl_dim_type type, unsigned first, unsigned n);
5285         __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
5286                 __isl_take isl_multi_aff *maff,
5287                 enum isl_dim_type type, unsigned first, unsigned n);
5288         __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
5289                 __isl_take isl_pw_aff *pwaff,
5290                 enum isl_dim_type type, unsigned first, unsigned n);
5291         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
5292                 __isl_take isl_pw_multi_aff *pma,
5293                 enum isl_dim_type type, unsigned first, unsigned n);
5294         __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
5295                 __isl_take isl_union_pw_aff *upa,
5296                 enum isl_dim_type type, unsigned first, unsigned n);
5297         __isl_give isl_union_pw_multi_aff *
5298                 isl_union_pw_multi_aff_drop_dims(
5299                 __isl_take isl_union_pw_multi_aff *upma,
5300                 enum isl_dim_type type,
5301                 unsigned first, unsigned n);
5302         __isl_give isl_multi_union_pw_aff *
5303         isl_multi_union_pw_aff_drop_dims(
5304                 __isl_take isl_multi_union_pw_aff *mupa,
5305                 enum isl_dim_type type, unsigned first,
5306                 unsigned n);
5307         __isl_give isl_aff *isl_aff_move_dims(
5308                 __isl_take isl_aff *aff,
5309                 enum isl_dim_type dst_type, unsigned dst_pos,
5310                 enum isl_dim_type src_type, unsigned src_pos,
5311                 unsigned n);
5312         __isl_give isl_multi_aff *isl_multi_aff_move_dims(
5313                 __isl_take isl_multi_aff *ma,
5314                 enum isl_dim_type dst_type, unsigned dst_pos,
5315                 enum isl_dim_type src_type, unsigned src_pos,
5316                 unsigned n);
5317         __isl_give isl_pw_aff *isl_pw_aff_move_dims(
5318                 __isl_take isl_pw_aff *pa,
5319                 enum isl_dim_type dst_type, unsigned dst_pos,
5320                 enum isl_dim_type src_type, unsigned src_pos,
5321                 unsigned n);
5322         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
5323                 __isl_take isl_multi_pw_aff *pma,
5324                 enum isl_dim_type dst_type, unsigned dst_pos,
5325                 enum isl_dim_type src_type, unsigned src_pos,
5326                 unsigned n);
5328         #include <isl/polynomial.h>
5329         __isl_give isl_union_pw_qpolynomial *
5330         isl_union_pw_qpolynomial_drop_dims(
5331                 __isl_take isl_union_pw_qpolynomial *upwqp,
5332                 enum isl_dim_type type,
5333                 unsigned first, unsigned n);
5334         __isl_give isl_union_pw_qpolynomial_fold *
5335                 isl_union_pw_qpolynomial_fold_drop_dims(
5336                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5337                 enum isl_dim_type type,
5338                 unsigned first, unsigned n);
5340 The operations on union expressions can only manipulate parameters.
5342 =back
5344 =head2 Binary Operations
5346 The two arguments of a binary operation not only need to live
5347 in the same C<isl_ctx>, they currently also need to have
5348 the same (number of) parameters.
5350 =head3 Basic Operations
5352 =over
5354 =item * Intersection
5356         #include <isl/local_space.h>
5357         __isl_give isl_local_space *isl_local_space_intersect(
5358                 __isl_take isl_local_space *ls1,
5359                 __isl_take isl_local_space *ls2);
5361         #include <isl/set.h>
5362         __isl_give isl_basic_set *isl_basic_set_intersect_params(
5363                 __isl_take isl_basic_set *bset1,
5364                 __isl_take isl_basic_set *bset2);
5365         __isl_give isl_basic_set *isl_basic_set_intersect(
5366                 __isl_take isl_basic_set *bset1,
5367                 __isl_take isl_basic_set *bset2);
5368         __isl_give isl_basic_set *isl_basic_set_list_intersect(
5369                 __isl_take struct isl_basic_set_list *list);
5370         __isl_give isl_set *isl_set_intersect_params(
5371                 __isl_take isl_set *set,
5372                 __isl_take isl_set *params);
5373         __isl_give isl_set *isl_set_intersect(
5374                 __isl_take isl_set *set1,
5375                 __isl_take isl_set *set2);
5377         #include <isl/map.h>
5378         __isl_give isl_basic_map *isl_basic_map_intersect_domain(
5379                 __isl_take isl_basic_map *bmap,
5380                 __isl_take isl_basic_set *bset);
5381         __isl_give isl_basic_map *isl_basic_map_intersect_range(
5382                 __isl_take isl_basic_map *bmap,
5383                 __isl_take isl_basic_set *bset);
5384         __isl_give isl_basic_map *isl_basic_map_intersect(
5385                 __isl_take isl_basic_map *bmap1,
5386                 __isl_take isl_basic_map *bmap2);
5387         __isl_give isl_basic_map *isl_basic_map_list_intersect(
5388                 __isl_take isl_basic_map_list *list);
5389         __isl_give isl_map *isl_map_intersect_params(
5390                 __isl_take isl_map *map,
5391                 __isl_take isl_set *params);
5392         __isl_give isl_map *isl_map_intersect_domain(
5393                 __isl_take isl_map *map,
5394                 __isl_take isl_set *set);
5395         __isl_give isl_map *isl_map_intersect_range(
5396                 __isl_take isl_map *map,
5397                 __isl_take isl_set *set);
5398         __isl_give isl_map *isl_map_intersect(
5399                 __isl_take isl_map *map1,
5400                 __isl_take isl_map *map2);
5402         #include <isl/union_set.h>
5403         __isl_give isl_union_set *isl_union_set_intersect_params(
5404                 __isl_take isl_union_set *uset,
5405                 __isl_take isl_set *set);
5406         __isl_give isl_union_set *isl_union_set_intersect(
5407                 __isl_take isl_union_set *uset1,
5408                 __isl_take isl_union_set *uset2);
5410         #include <isl/union_map.h>
5411         __isl_give isl_union_map *isl_union_map_intersect_params(
5412                 __isl_take isl_union_map *umap,
5413                 __isl_take isl_set *set);
5414         __isl_give isl_union_map *isl_union_map_intersect_domain(
5415                 __isl_take isl_union_map *umap,
5416                 __isl_take isl_union_set *uset);
5417         __isl_give isl_union_map *isl_union_map_intersect_range(
5418                 __isl_take isl_union_map *umap,
5419                 __isl_take isl_union_set *uset);
5420         __isl_give isl_union_map *isl_union_map_intersect(
5421                 __isl_take isl_union_map *umap1,
5422                 __isl_take isl_union_map *umap2);
5424         #include <isl/aff.h>
5425         __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
5426                 __isl_take isl_pw_aff *pa,
5427                 __isl_take isl_set *set);
5428         __isl_give isl_multi_pw_aff *
5429         isl_multi_pw_aff_intersect_domain(
5430                 __isl_take isl_multi_pw_aff *mpa,
5431                 __isl_take isl_set *domain);
5432         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
5433                 __isl_take isl_pw_multi_aff *pma,
5434                 __isl_take isl_set *set);
5435         __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
5436                 __isl_take isl_union_pw_aff *upa,
5437                 __isl_take isl_union_set *uset);
5438         __isl_give isl_union_pw_multi_aff *
5439         isl_union_pw_multi_aff_intersect_domain(
5440                 __isl_take isl_union_pw_multi_aff *upma,
5441                 __isl_take isl_union_set *uset);
5442         __isl_give isl_multi_union_pw_aff *
5443         isl_multi_union_pw_aff_intersect_domain(
5444                 __isl_take isl_multi_union_pw_aff *mupa,
5445                 __isl_take isl_union_set *uset);
5446         __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
5447                 __isl_take isl_pw_aff *pa,
5448                 __isl_take isl_set *set);
5449         __isl_give isl_multi_pw_aff *
5450         isl_multi_pw_aff_intersect_params(
5451                 __isl_take isl_multi_pw_aff *mpa,
5452                 __isl_take isl_set *set);
5453         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
5454                 __isl_take isl_pw_multi_aff *pma,
5455                 __isl_take isl_set *set);
5456         __isl_give isl_union_pw_aff *
5457         isl_union_pw_aff_intersect_params(
5458                 __isl_take isl_union_pw_aff *upa,
5459         __isl_give isl_union_pw_multi_aff *
5460         isl_union_pw_multi_aff_intersect_params(
5461                 __isl_take isl_union_pw_multi_aff *upma,
5462                 __isl_take isl_set *set);
5463         __isl_give isl_multi_union_pw_aff *
5464         isl_multi_union_pw_aff_intersect_params(
5465                 __isl_take isl_multi_union_pw_aff *mupa,
5466                 __isl_take isl_set *params);
5467         isl_multi_union_pw_aff_intersect_range(
5468                 __isl_take isl_multi_union_pw_aff *mupa,
5469                 __isl_take isl_set *set);
5471         #include <isl/polynomial.h>
5472         __isl_give isl_pw_qpolynomial *
5473         isl_pw_qpolynomial_intersect_domain(
5474                 __isl_take isl_pw_qpolynomial *pwpq,
5475                 __isl_take isl_set *set);
5476         __isl_give isl_union_pw_qpolynomial *
5477         isl_union_pw_qpolynomial_intersect_domain(
5478                 __isl_take isl_union_pw_qpolynomial *upwpq,
5479                 __isl_take isl_union_set *uset);
5480         __isl_give isl_union_pw_qpolynomial_fold *
5481         isl_union_pw_qpolynomial_fold_intersect_domain(
5482                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5483                 __isl_take isl_union_set *uset);
5484         __isl_give isl_pw_qpolynomial *
5485         isl_pw_qpolynomial_intersect_params(
5486                 __isl_take isl_pw_qpolynomial *pwpq,
5487                 __isl_take isl_set *set);
5488         __isl_give isl_pw_qpolynomial_fold *
5489         isl_pw_qpolynomial_fold_intersect_params(
5490                 __isl_take isl_pw_qpolynomial_fold *pwf,
5491                 __isl_take isl_set *set);
5492         __isl_give isl_union_pw_qpolynomial *
5493         isl_union_pw_qpolynomial_intersect_params(
5494                 __isl_take isl_union_pw_qpolynomial *upwpq,
5495                 __isl_take isl_set *set);
5496         __isl_give isl_union_pw_qpolynomial_fold *
5497         isl_union_pw_qpolynomial_fold_intersect_params(
5498                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5499                 __isl_take isl_set *set);
5501 The second argument to the C<_params> functions needs to be
5502 a parametric (basic) set.  For the other functions, a parametric set
5503 for either argument is only allowed if the other argument is
5504 a parametric set as well.
5505 The list passed to C<isl_basic_set_list_intersect> needs to have
5506 at least one element and all elements need to live in the same space.
5507 The function C<isl_multi_union_pw_aff_intersect_range>
5508 restricts the input function to those shared domain elements
5509 that map to the specified range.
5511 =item * Union
5513         #include <isl/set.h>
5514         __isl_give isl_set *isl_basic_set_union(
5515                 __isl_take isl_basic_set *bset1,
5516                 __isl_take isl_basic_set *bset2);
5517         __isl_give isl_set *isl_set_union(
5518                 __isl_take isl_set *set1,
5519                 __isl_take isl_set *set2);
5521         #include <isl/map.h>
5522         __isl_give isl_map *isl_basic_map_union(
5523                 __isl_take isl_basic_map *bmap1,
5524                 __isl_take isl_basic_map *bmap2);
5525         __isl_give isl_map *isl_map_union(
5526                 __isl_take isl_map *map1,
5527                 __isl_take isl_map *map2);
5529         #include <isl/union_set.h>
5530         __isl_give isl_union_set *isl_union_set_union(
5531                 __isl_take isl_union_set *uset1,
5532                 __isl_take isl_union_set *uset2);
5533         __isl_give isl_union_set *isl_union_set_list_union(
5534                 __isl_take isl_union_set_list *list);
5536         #include <isl/union_map.h>
5537         __isl_give isl_union_map *isl_union_map_union(
5538                 __isl_take isl_union_map *umap1,
5539                 __isl_take isl_union_map *umap2);
5541 =item * Set difference
5543         #include <isl/set.h>
5544         __isl_give isl_set *isl_set_subtract(
5545                 __isl_take isl_set *set1,
5546                 __isl_take isl_set *set2);
5548         #include <isl/map.h>
5549         __isl_give isl_map *isl_map_subtract(
5550                 __isl_take isl_map *map1,
5551                 __isl_take isl_map *map2);
5552         __isl_give isl_map *isl_map_subtract_domain(
5553                 __isl_take isl_map *map,
5554                 __isl_take isl_set *dom);
5555         __isl_give isl_map *isl_map_subtract_range(
5556                 __isl_take isl_map *map,
5557                 __isl_take isl_set *dom);
5559         #include <isl/union_set.h>
5560         __isl_give isl_union_set *isl_union_set_subtract(
5561                 __isl_take isl_union_set *uset1,
5562                 __isl_take isl_union_set *uset2);
5564         #include <isl/union_map.h>
5565         __isl_give isl_union_map *isl_union_map_subtract(
5566                 __isl_take isl_union_map *umap1,
5567                 __isl_take isl_union_map *umap2);
5568         __isl_give isl_union_map *isl_union_map_subtract_domain(
5569                 __isl_take isl_union_map *umap,
5570                 __isl_take isl_union_set *dom);
5571         __isl_give isl_union_map *isl_union_map_subtract_range(
5572                 __isl_take isl_union_map *umap,
5573                 __isl_take isl_union_set *dom);
5575         #include <isl/aff.h>
5576         __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
5577                 __isl_take isl_pw_aff *pa,
5578                 __isl_take isl_set *set);
5579         __isl_give isl_pw_multi_aff *
5580         isl_pw_multi_aff_subtract_domain(
5581                 __isl_take isl_pw_multi_aff *pma,
5582                 __isl_take isl_set *set);
5583         __isl_give isl_union_pw_aff *
5584         isl_union_pw_aff_subtract_domain(
5585                 __isl_take isl_union_pw_aff *upa,
5586                 __isl_take isl_union_set *uset);
5587         __isl_give isl_union_pw_multi_aff *
5588         isl_union_pw_multi_aff_subtract_domain(
5589                 __isl_take isl_union_pw_multi_aff *upma,
5590                 __isl_take isl_set *set);
5592         #include <isl/polynomial.h>
5593         __isl_give isl_pw_qpolynomial *
5594         isl_pw_qpolynomial_subtract_domain(
5595                 __isl_take isl_pw_qpolynomial *pwpq,
5596                 __isl_take isl_set *set);
5597         __isl_give isl_pw_qpolynomial_fold *
5598         isl_pw_qpolynomial_fold_subtract_domain(
5599                 __isl_take isl_pw_qpolynomial_fold *pwf,
5600                 __isl_take isl_set *set);
5601         __isl_give isl_union_pw_qpolynomial *
5602         isl_union_pw_qpolynomial_subtract_domain(
5603                 __isl_take isl_union_pw_qpolynomial *upwpq,
5604                 __isl_take isl_union_set *uset);
5605         __isl_give isl_union_pw_qpolynomial_fold *
5606         isl_union_pw_qpolynomial_fold_subtract_domain(
5607                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5608                 __isl_take isl_union_set *uset);
5610 =item * Application
5612         #include <isl/space.h>
5613         __isl_give isl_space *isl_space_join(
5614                 __isl_take isl_space *left,
5615                 __isl_take isl_space *right);
5617         #include <isl/map.h>
5618         __isl_give isl_basic_set *isl_basic_set_apply(
5619                 __isl_take isl_basic_set *bset,
5620                 __isl_take isl_basic_map *bmap);
5621         __isl_give isl_set *isl_set_apply(
5622                 __isl_take isl_set *set,
5623                 __isl_take isl_map *map);
5624         __isl_give isl_union_set *isl_union_set_apply(
5625                 __isl_take isl_union_set *uset,
5626                 __isl_take isl_union_map *umap);
5627         __isl_give isl_basic_map *isl_basic_map_apply_domain(
5628                 __isl_take isl_basic_map *bmap1,
5629                 __isl_take isl_basic_map *bmap2);
5630         __isl_give isl_basic_map *isl_basic_map_apply_range(
5631                 __isl_take isl_basic_map *bmap1,
5632                 __isl_take isl_basic_map *bmap2);
5633         __isl_give isl_map *isl_map_apply_domain(
5634                 __isl_take isl_map *map1,
5635                 __isl_take isl_map *map2);
5636         __isl_give isl_map *isl_map_apply_range(
5637                 __isl_take isl_map *map1,
5638                 __isl_take isl_map *map2);
5640         #include <isl/union_map.h>
5641         __isl_give isl_union_map *isl_union_map_apply_domain(
5642                 __isl_take isl_union_map *umap1,
5643                 __isl_take isl_union_map *umap2);
5644         __isl_give isl_union_map *isl_union_map_apply_range(
5645                 __isl_take isl_union_map *umap1,
5646                 __isl_take isl_union_map *umap2);
5648         #include <isl/aff.h>
5649         __isl_give isl_union_pw_aff *
5650         isl_multi_union_pw_aff_apply_aff(
5651                 __isl_take isl_multi_union_pw_aff *mupa,
5652                 __isl_take isl_aff *aff);
5653         __isl_give isl_union_pw_aff *
5654         isl_multi_union_pw_aff_apply_pw_aff(
5655                 __isl_take isl_multi_union_pw_aff *mupa,
5656                 __isl_take isl_pw_aff *pa);
5657         __isl_give isl_multi_union_pw_aff *
5658         isl_multi_union_pw_aff_apply_multi_aff(
5659                 __isl_take isl_multi_union_pw_aff *mupa,
5660                 __isl_take isl_multi_aff *ma);
5661         __isl_give isl_multi_union_pw_aff *
5662         isl_multi_union_pw_aff_apply_pw_multi_aff(
5663                 __isl_take isl_multi_union_pw_aff *mupa,
5664                 __isl_take isl_pw_multi_aff *pma);
5666 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
5667 over the shared domain of the elements of the input.  The dimension is
5668 required to be greater than zero.
5669 The C<isl_multi_union_pw_aff> argument of
5670 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
5671 but only if the range of the C<isl_multi_aff> argument
5672 is also zero-dimensional.
5673 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
5675         #include <isl/polynomial.h>
5676         __isl_give isl_pw_qpolynomial_fold *
5677         isl_set_apply_pw_qpolynomial_fold(
5678                 __isl_take isl_set *set,
5679                 __isl_take isl_pw_qpolynomial_fold *pwf,
5680                 int *tight);
5681         __isl_give isl_pw_qpolynomial_fold *
5682         isl_map_apply_pw_qpolynomial_fold(
5683                 __isl_take isl_map *map,
5684                 __isl_take isl_pw_qpolynomial_fold *pwf,
5685                 int *tight);
5686         __isl_give isl_union_pw_qpolynomial_fold *
5687         isl_union_set_apply_union_pw_qpolynomial_fold(
5688                 __isl_take isl_union_set *uset,
5689                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5690                 int *tight);
5691         __isl_give isl_union_pw_qpolynomial_fold *
5692         isl_union_map_apply_union_pw_qpolynomial_fold(
5693                 __isl_take isl_union_map *umap,
5694                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5695                 int *tight);
5697 The functions taking a map
5698 compose the given map with the given piecewise quasipolynomial reduction.
5699 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
5700 over all elements in the intersection of the range of the map
5701 and the domain of the piecewise quasipolynomial reduction
5702 as a function of an element in the domain of the map.
5703 The functions taking a set compute a bound over all elements in the
5704 intersection of the set and the domain of the
5705 piecewise quasipolynomial reduction.
5707 =item * Preimage
5709         #include <isl/set.h>
5710         __isl_give isl_basic_set *
5711         isl_basic_set_preimage_multi_aff(
5712                 __isl_take isl_basic_set *bset,
5713                 __isl_take isl_multi_aff *ma);
5714         __isl_give isl_set *isl_set_preimage_multi_aff(
5715                 __isl_take isl_set *set,
5716                 __isl_take isl_multi_aff *ma);
5717         __isl_give isl_set *isl_set_preimage_pw_multi_aff(
5718                 __isl_take isl_set *set,
5719                 __isl_take isl_pw_multi_aff *pma);
5720         __isl_give isl_set *isl_set_preimage_multi_pw_aff(
5721                 __isl_take isl_set *set,
5722                 __isl_take isl_multi_pw_aff *mpa);
5724         #include <isl/union_set.h>
5725         __isl_give isl_union_set *
5726         isl_union_set_preimage_multi_aff(
5727                 __isl_take isl_union_set *uset,
5728                 __isl_take isl_multi_aff *ma);
5729         __isl_give isl_union_set *
5730         isl_union_set_preimage_pw_multi_aff(
5731                 __isl_take isl_union_set *uset,
5732                 __isl_take isl_pw_multi_aff *pma);
5733         __isl_give isl_union_set *
5734         isl_union_set_preimage_union_pw_multi_aff(
5735                 __isl_take isl_union_set *uset,
5736                 __isl_take isl_union_pw_multi_aff *upma);
5738         #include <isl/map.h>
5739         __isl_give isl_basic_map *
5740         isl_basic_map_preimage_domain_multi_aff(
5741                 __isl_take isl_basic_map *bmap,
5742                 __isl_take isl_multi_aff *ma);
5743         __isl_give isl_map *isl_map_preimage_domain_multi_aff(
5744                 __isl_take isl_map *map,
5745                 __isl_take isl_multi_aff *ma);
5746         __isl_give isl_map *isl_map_preimage_range_multi_aff(
5747                 __isl_take isl_map *map,
5748                 __isl_take isl_multi_aff *ma);
5749         __isl_give isl_map *
5750         isl_map_preimage_domain_pw_multi_aff(
5751                 __isl_take isl_map *map,
5752                 __isl_take isl_pw_multi_aff *pma);
5753         __isl_give isl_map *
5754         isl_map_preimage_range_pw_multi_aff(
5755                 __isl_take isl_map *map,
5756                 __isl_take isl_pw_multi_aff *pma);
5757         __isl_give isl_map *
5758         isl_map_preimage_domain_multi_pw_aff(
5759                 __isl_take isl_map *map,
5760                 __isl_take isl_multi_pw_aff *mpa);
5761         __isl_give isl_basic_map *
5762         isl_basic_map_preimage_range_multi_aff(
5763                 __isl_take isl_basic_map *bmap,
5764                 __isl_take isl_multi_aff *ma);
5766         #include <isl/union_map.h>
5767         __isl_give isl_union_map *
5768         isl_union_map_preimage_domain_multi_aff(
5769                 __isl_take isl_union_map *umap,
5770                 __isl_take isl_multi_aff *ma);
5771         __isl_give isl_union_map *
5772         isl_union_map_preimage_range_multi_aff(
5773                 __isl_take isl_union_map *umap,
5774                 __isl_take isl_multi_aff *ma);
5775         __isl_give isl_union_map *
5776         isl_union_map_preimage_domain_pw_multi_aff(
5777                 __isl_take isl_union_map *umap,
5778                 __isl_take isl_pw_multi_aff *pma);
5779         __isl_give isl_union_map *
5780         isl_union_map_preimage_range_pw_multi_aff(
5781                 __isl_take isl_union_map *umap,
5782                 __isl_take isl_pw_multi_aff *pma);
5783         __isl_give isl_union_map *
5784         isl_union_map_preimage_domain_union_pw_multi_aff(
5785                 __isl_take isl_union_map *umap,
5786                 __isl_take isl_union_pw_multi_aff *upma);
5787         __isl_give isl_union_map *
5788         isl_union_map_preimage_range_union_pw_multi_aff(
5789                 __isl_take isl_union_map *umap,
5790                 __isl_take isl_union_pw_multi_aff *upma);
5792 These functions compute the preimage of the given set or map domain/range under
5793 the given function.  In other words, the expression is plugged
5794 into the set description or into the domain/range of the map.
5796 =item * Pullback
5798         #include <isl/aff.h>
5799         __isl_give isl_aff *isl_aff_pullback_aff(
5800                 __isl_take isl_aff *aff1,
5801                 __isl_take isl_aff *aff2);
5802         __isl_give isl_aff *isl_aff_pullback_multi_aff(
5803                 __isl_take isl_aff *aff,
5804                 __isl_take isl_multi_aff *ma);
5805         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
5806                 __isl_take isl_pw_aff *pa,
5807                 __isl_take isl_multi_aff *ma);
5808         __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
5809                 __isl_take isl_pw_aff *pa,
5810                 __isl_take isl_pw_multi_aff *pma);
5811         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
5812                 __isl_take isl_pw_aff *pa,
5813                 __isl_take isl_multi_pw_aff *mpa);
5814         __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
5815                 __isl_take isl_multi_aff *ma1,
5816                 __isl_take isl_multi_aff *ma2);
5817         __isl_give isl_pw_multi_aff *
5818         isl_pw_multi_aff_pullback_multi_aff(
5819                 __isl_take isl_pw_multi_aff *pma,
5820                 __isl_take isl_multi_aff *ma);
5821         __isl_give isl_multi_pw_aff *
5822         isl_multi_pw_aff_pullback_multi_aff(
5823                 __isl_take isl_multi_pw_aff *mpa,
5824                 __isl_take isl_multi_aff *ma);
5825         __isl_give isl_pw_multi_aff *
5826         isl_pw_multi_aff_pullback_pw_multi_aff(
5827                 __isl_take isl_pw_multi_aff *pma1,
5828                 __isl_take isl_pw_multi_aff *pma2);
5829         __isl_give isl_multi_pw_aff *
5830         isl_multi_pw_aff_pullback_pw_multi_aff(
5831                 __isl_take isl_multi_pw_aff *mpa,
5832                 __isl_take isl_pw_multi_aff *pma);
5833         __isl_give isl_multi_pw_aff *
5834         isl_multi_pw_aff_pullback_multi_pw_aff(
5835                 __isl_take isl_multi_pw_aff *mpa1,
5836                 __isl_take isl_multi_pw_aff *mpa2);
5837         __isl_give isl_union_pw_aff *
5838         isl_union_pw_aff_pullback_union_pw_multi_aff(
5839                 __isl_take isl_union_pw_aff *upa,
5840                 __isl_take isl_union_pw_multi_aff *upma);
5841         __isl_give isl_union_pw_multi_aff *
5842         isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
5843                 __isl_take isl_union_pw_multi_aff *upma1,
5844                 __isl_take isl_union_pw_multi_aff *upma2);
5845         __isl_give isl_multi_union_pw_aff *
5846         isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
5847                 __isl_take isl_multi_union_pw_aff *mupa,
5848                 __isl_take isl_union_pw_multi_aff *upma);
5850 These functions precompose the first expression by the second function.
5851 In other words, the second function is plugged
5852 into the first expression.
5854 =item * Locus
5856         #include <isl/aff.h>
5857         __isl_give isl_basic_set *isl_aff_le_basic_set(
5858                 __isl_take isl_aff *aff1,
5859                 __isl_take isl_aff *aff2);
5860         __isl_give isl_basic_set *isl_aff_ge_basic_set(
5861                 __isl_take isl_aff *aff1,
5862                 __isl_take isl_aff *aff2);
5863         __isl_give isl_set *isl_pw_aff_eq_set(
5864                 __isl_take isl_pw_aff *pwaff1,
5865                 __isl_take isl_pw_aff *pwaff2);
5866         __isl_give isl_set *isl_pw_aff_ne_set(
5867                 __isl_take isl_pw_aff *pwaff1,
5868                 __isl_take isl_pw_aff *pwaff2);
5869         __isl_give isl_set *isl_pw_aff_le_set(
5870                 __isl_take isl_pw_aff *pwaff1,
5871                 __isl_take isl_pw_aff *pwaff2);
5872         __isl_give isl_set *isl_pw_aff_lt_set(
5873                 __isl_take isl_pw_aff *pwaff1,
5874                 __isl_take isl_pw_aff *pwaff2);
5875         __isl_give isl_set *isl_pw_aff_ge_set(
5876                 __isl_take isl_pw_aff *pwaff1,
5877                 __isl_take isl_pw_aff *pwaff2);
5878         __isl_give isl_set *isl_pw_aff_gt_set(
5879                 __isl_take isl_pw_aff *pwaff1,
5880                 __isl_take isl_pw_aff *pwaff2);
5882         __isl_give isl_set *isl_multi_aff_lex_le_set(
5883                 __isl_take isl_multi_aff *ma1,
5884                 __isl_take isl_multi_aff *ma2);
5885         __isl_give isl_set *isl_multi_aff_lex_ge_set(
5886                 __isl_take isl_multi_aff *ma1,
5887                 __isl_take isl_multi_aff *ma2);
5889         __isl_give isl_set *isl_pw_aff_list_eq_set(
5890                 __isl_take isl_pw_aff_list *list1,
5891                 __isl_take isl_pw_aff_list *list2);
5892         __isl_give isl_set *isl_pw_aff_list_ne_set(
5893                 __isl_take isl_pw_aff_list *list1,
5894                 __isl_take isl_pw_aff_list *list2);
5895         __isl_give isl_set *isl_pw_aff_list_le_set(
5896                 __isl_take isl_pw_aff_list *list1,
5897                 __isl_take isl_pw_aff_list *list2);
5898         __isl_give isl_set *isl_pw_aff_list_lt_set(
5899                 __isl_take isl_pw_aff_list *list1,
5900                 __isl_take isl_pw_aff_list *list2);
5901         __isl_give isl_set *isl_pw_aff_list_ge_set(
5902                 __isl_take isl_pw_aff_list *list1,
5903                 __isl_take isl_pw_aff_list *list2);
5904         __isl_give isl_set *isl_pw_aff_list_gt_set(
5905                 __isl_take isl_pw_aff_list *list1,
5906                 __isl_take isl_pw_aff_list *list2);
5908 The function C<isl_aff_ge_basic_set> returns a basic set
5909 containing those elements in the shared space
5910 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
5911 The function C<isl_pw_aff_ge_set> returns a set
5912 containing those elements in the shared domain
5913 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
5914 greater than or equal to C<pwaff2>.
5915 The function C<isl_multi_aff_lex_le_set> returns a set
5916 containing those elements in the shared domain space
5917 where C<ma1> is lexicographically smaller than or
5918 equal to C<ma2>.
5919 The functions operating on C<isl_pw_aff_list> apply the corresponding
5920 C<isl_pw_aff> function to each pair of elements in the two lists.
5922         #include <isl/aff.h>
5923         __isl_give isl_map *isl_pw_aff_eq_map(
5924                 __isl_take isl_pw_aff *pa1,
5925                 __isl_take isl_pw_aff *pa2);
5926         __isl_give isl_map *isl_pw_aff_lt_map(
5927                 __isl_take isl_pw_aff *pa1,
5928                 __isl_take isl_pw_aff *pa2);
5929         __isl_give isl_map *isl_pw_aff_gt_map(
5930                 __isl_take isl_pw_aff *pa1,
5931                 __isl_take isl_pw_aff *pa2);
5933         __isl_give isl_map *isl_multi_pw_aff_eq_map(
5934                 __isl_take isl_multi_pw_aff *mpa1,
5935                 __isl_take isl_multi_pw_aff *mpa2);
5936         __isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
5937                 __isl_take isl_multi_pw_aff *mpa1,
5938                 __isl_take isl_multi_pw_aff *mpa2);
5939         __isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
5940                 __isl_take isl_multi_pw_aff *mpa1,
5941                 __isl_take isl_multi_pw_aff *mpa2);
5943 These functions return a map between domain elements of the arguments
5944 where the function values satisfy the given relation.
5946         #include <isl/union_map.h>
5947         __isl_give isl_union_map *
5948         isl_union_map_eq_at_multi_union_pw_aff(
5949                 __isl_take isl_union_map *umap,
5950                 __isl_take isl_multi_union_pw_aff *mupa);
5951         __isl_give isl_union_map *
5952         isl_union_map_lex_lt_at_multi_union_pw_aff(
5953                 __isl_take isl_union_map *umap,
5954                 __isl_take isl_multi_union_pw_aff *mupa);
5955         __isl_give isl_union_map *
5956         isl_union_map_lex_gt_at_multi_union_pw_aff(
5957                 __isl_take isl_union_map *umap,
5958                 __isl_take isl_multi_union_pw_aff *mupa);
5960 These functions select the subset of elements in the union map
5961 that have an equal or lexicographically smaller function value.
5963 =item * Cartesian Product
5965         #include <isl/space.h>
5966         __isl_give isl_space *isl_space_product(
5967                 __isl_take isl_space *space1,
5968                 __isl_take isl_space *space2);
5969         __isl_give isl_space *isl_space_domain_product(
5970                 __isl_take isl_space *space1,
5971                 __isl_take isl_space *space2);
5972         __isl_give isl_space *isl_space_range_product(
5973                 __isl_take isl_space *space1,
5974                 __isl_take isl_space *space2);
5976 The functions
5977 C<isl_space_product>, C<isl_space_domain_product>
5978 and C<isl_space_range_product> take pairs or relation spaces and
5979 produce a single relations space, where either the domain, the range
5980 or both domain and range are wrapped spaces of relations between
5981 the domains and/or ranges of the input spaces.
5982 If the product is only constructed over the domain or the range
5983 then the ranges or the domains of the inputs should be the same.
5984 The function C<isl_space_product> also accepts a pair of set spaces,
5985 in which case it returns a wrapped space of a relation between the
5986 two input spaces.
5988         #include <isl/set.h>
5989         __isl_give isl_set *isl_set_product(
5990                 __isl_take isl_set *set1,
5991                 __isl_take isl_set *set2);
5993         #include <isl/map.h>
5994         __isl_give isl_basic_map *isl_basic_map_domain_product(
5995                 __isl_take isl_basic_map *bmap1,
5996                 __isl_take isl_basic_map *bmap2);
5997         __isl_give isl_basic_map *isl_basic_map_range_product(
5998                 __isl_take isl_basic_map *bmap1,
5999                 __isl_take isl_basic_map *bmap2);
6000         __isl_give isl_basic_map *isl_basic_map_product(
6001                 __isl_take isl_basic_map *bmap1,
6002                 __isl_take isl_basic_map *bmap2);
6003         __isl_give isl_map *isl_map_domain_product(
6004                 __isl_take isl_map *map1,
6005                 __isl_take isl_map *map2);
6006         __isl_give isl_map *isl_map_range_product(
6007                 __isl_take isl_map *map1,
6008                 __isl_take isl_map *map2);
6009         __isl_give isl_map *isl_map_product(
6010                 __isl_take isl_map *map1,
6011                 __isl_take isl_map *map2);
6013         #include <isl/union_set.h>
6014         __isl_give isl_union_set *isl_union_set_product(
6015                 __isl_take isl_union_set *uset1,
6016                 __isl_take isl_union_set *uset2);
6018         #include <isl/union_map.h>
6019         __isl_give isl_union_map *isl_union_map_domain_product(
6020                 __isl_take isl_union_map *umap1,
6021                 __isl_take isl_union_map *umap2);
6022         __isl_give isl_union_map *isl_union_map_range_product(
6023                 __isl_take isl_union_map *umap1,
6024                 __isl_take isl_union_map *umap2);
6025         __isl_give isl_union_map *isl_union_map_product(
6026                 __isl_take isl_union_map *umap1,
6027                 __isl_take isl_union_map *umap2);
6029         #include <isl/val.h>
6030         __isl_give isl_multi_val *isl_multi_val_range_product(
6031                 __isl_take isl_multi_val *mv1,
6032                 __isl_take isl_multi_val *mv2);
6033         __isl_give isl_multi_val *isl_multi_val_product(
6034                 __isl_take isl_multi_val *mv1,
6035                 __isl_take isl_multi_val *mv2);
6037         #include <isl/aff.h>
6038         __isl_give isl_multi_aff *isl_multi_aff_range_product(
6039                 __isl_take isl_multi_aff *ma1,
6040                 __isl_take isl_multi_aff *ma2);
6041         __isl_give isl_multi_aff *isl_multi_aff_product(
6042                 __isl_take isl_multi_aff *ma1,
6043                 __isl_take isl_multi_aff *ma2);
6044         __isl_give isl_multi_pw_aff *
6045         isl_multi_pw_aff_range_product(
6046                 __isl_take isl_multi_pw_aff *mpa1,
6047                 __isl_take isl_multi_pw_aff *mpa2);
6048         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
6049                 __isl_take isl_multi_pw_aff *mpa1,
6050                 __isl_take isl_multi_pw_aff *mpa2);
6051         __isl_give isl_pw_multi_aff *
6052         isl_pw_multi_aff_range_product(
6053                 __isl_take isl_pw_multi_aff *pma1,
6054                 __isl_take isl_pw_multi_aff *pma2);
6055         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
6056                 __isl_take isl_pw_multi_aff *pma1,
6057                 __isl_take isl_pw_multi_aff *pma2);
6058         __isl_give isl_multi_union_pw_aff *
6059         isl_multi_union_pw_aff_range_product(
6060                 __isl_take isl_multi_union_pw_aff *mupa1,
6061                 __isl_take isl_multi_union_pw_aff *mupa2);
6063 The above functions compute the cross product of the given
6064 sets, relations or functions.  The domains and ranges of the results
6065 are wrapped maps between domains and ranges of the inputs.
6066 To obtain a ``flat'' product, use the following functions
6067 instead.
6069         #include <isl/set.h>
6070         __isl_give isl_basic_set *isl_basic_set_flat_product(
6071                 __isl_take isl_basic_set *bset1,
6072                 __isl_take isl_basic_set *bset2);
6073         __isl_give isl_set *isl_set_flat_product(
6074                 __isl_take isl_set *set1,
6075                 __isl_take isl_set *set2);
6077         #include <isl/map.h>
6078         __isl_give isl_basic_map *isl_basic_map_flat_range_product(
6079                 __isl_take isl_basic_map *bmap1,
6080                 __isl_take isl_basic_map *bmap2);
6081         __isl_give isl_map *isl_map_flat_domain_product(
6082                 __isl_take isl_map *map1,
6083                 __isl_take isl_map *map2);
6084         __isl_give isl_map *isl_map_flat_range_product(
6085                 __isl_take isl_map *map1,
6086                 __isl_take isl_map *map2);
6087         __isl_give isl_basic_map *isl_basic_map_flat_product(
6088                 __isl_take isl_basic_map *bmap1,
6089                 __isl_take isl_basic_map *bmap2);
6090         __isl_give isl_map *isl_map_flat_product(
6091                 __isl_take isl_map *map1,
6092                 __isl_take isl_map *map2);
6094         #include <isl/union_map.h>
6095         __isl_give isl_union_map *
6096         isl_union_map_flat_domain_product(
6097                 __isl_take isl_union_map *umap1,
6098                 __isl_take isl_union_map *umap2);
6099         __isl_give isl_union_map *
6100         isl_union_map_flat_range_product(
6101                 __isl_take isl_union_map *umap1,
6102                 __isl_take isl_union_map *umap2);
6104         #include <isl/val.h>
6105         __isl_give isl_multi_val *isl_multi_val_flat_range_product(
6106                 __isl_take isl_multi_val *mv1,
6107                 __isl_take isl_multi_aff *mv2);
6109         #include <isl/aff.h>
6110         __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
6111                 __isl_take isl_multi_aff *ma1,
6112                 __isl_take isl_multi_aff *ma2);
6113         __isl_give isl_pw_multi_aff *
6114         isl_pw_multi_aff_flat_range_product(
6115                 __isl_take isl_pw_multi_aff *pma1,
6116                 __isl_take isl_pw_multi_aff *pma2);
6117         __isl_give isl_multi_pw_aff *
6118         isl_multi_pw_aff_flat_range_product(
6119                 __isl_take isl_multi_pw_aff *mpa1,
6120                 __isl_take isl_multi_pw_aff *mpa2);
6121         __isl_give isl_union_pw_multi_aff *
6122         isl_union_pw_multi_aff_flat_range_product(
6123                 __isl_take isl_union_pw_multi_aff *upma1,
6124                 __isl_take isl_union_pw_multi_aff *upma2);
6125         __isl_give isl_multi_union_pw_aff *
6126         isl_multi_union_pw_aff_flat_range_product(
6127                 __isl_take isl_multi_union_pw_aff *mupa1,
6128                 __isl_take isl_multi_union_pw_aff *mupa2);
6130         #include <isl/space.h>
6131         __isl_give isl_space *isl_space_factor_domain(
6132                 __isl_take isl_space *space);
6133         __isl_give isl_space *isl_space_factor_range(
6134                 __isl_take isl_space *space);
6135         __isl_give isl_space *isl_space_domain_factor_domain(
6136                 __isl_take isl_space *space);
6137         __isl_give isl_space *isl_space_domain_factor_range(
6138                 __isl_take isl_space *space);
6139         __isl_give isl_space *isl_space_range_factor_domain(
6140                 __isl_take isl_space *space);
6141         __isl_give isl_space *isl_space_range_factor_range(
6142                 __isl_take isl_space *space);
6144 The functions C<isl_space_range_factor_domain> and
6145 C<isl_space_range_factor_range> extract the two arguments from
6146 the result of a call to C<isl_space_range_product>.
6148 The arguments of a call to C<isl_map_range_product> can be extracted
6149 from the result using the following functions.
6151         #include <isl/map.h>
6152         __isl_give isl_map *isl_map_factor_domain(
6153                 __isl_take isl_map *map);
6154         __isl_give isl_map *isl_map_factor_range(
6155                 __isl_take isl_map *map);
6156         __isl_give isl_map *isl_map_domain_factor_domain(
6157                 __isl_take isl_map *map);
6158         __isl_give isl_map *isl_map_domain_factor_range(
6159                 __isl_take isl_map *map);
6160         __isl_give isl_map *isl_map_range_factor_domain(
6161                 __isl_take isl_map *map);
6162         __isl_give isl_map *isl_map_range_factor_range(
6163                 __isl_take isl_map *map);
6165         #include <isl/union_map.h>
6166         __isl_give isl_union_map *isl_union_map_factor_domain(
6167                 __isl_take isl_union_map *umap);
6168         __isl_give isl_union_map *isl_union_map_factor_range(
6169                 __isl_take isl_union_map *umap);
6170         __isl_give isl_union_map *
6171         isl_union_map_domain_factor_domain(
6172                 __isl_take isl_union_map *umap);
6173         __isl_give isl_union_map *
6174         isl_union_map_domain_factor_range(
6175                 __isl_take isl_union_map *umap);
6176         __isl_give isl_union_map *
6177         isl_union_map_range_factor_range(
6178                 __isl_take isl_union_map *umap);
6180         #include <isl/val.h>
6181         __isl_give isl_multi_val *
6182         isl_multi_val_range_factor_domain(
6183                 __isl_take isl_multi_val *mv);
6184         __isl_give isl_multi_val *
6185         isl_multi_val_range_factor_range(
6186                 __isl_take isl_multi_val *mv);
6188         #include <isl/aff.h>
6189         __isl_give isl_multi_aff *
6190         isl_multi_aff_range_factor_domain(
6191                 __isl_take isl_multi_aff *ma);
6192         __isl_give isl_multi_aff *
6193         isl_multi_aff_range_factor_range(
6194                 __isl_take isl_multi_aff *ma);
6195         __isl_give isl_multi_pw_aff *
6196         isl_multi_pw_aff_range_factor_domain(
6197                 __isl_take isl_multi_pw_aff *mpa);
6198         __isl_give isl_multi_pw_aff *
6199         isl_multi_pw_aff_range_factor_range(
6200                 __isl_take isl_multi_pw_aff *mpa);
6201         __isl_give isl_multi_union_pw_aff *
6202         isl_multi_union_pw_aff_range_factor_domain(
6203                 __isl_take isl_multi_union_pw_aff *mupa);
6204         __isl_give isl_multi_union_pw_aff *
6205         isl_multi_union_pw_aff_range_factor_range(
6206                 __isl_take isl_multi_union_pw_aff *mupa);
6208 The splice functions are a generalization of the flat product functions,
6209 where the second argument may be inserted at any position inside
6210 the first argument rather than being placed at the end.
6212         #include <isl/val.h>
6213         __isl_give isl_multi_val *isl_multi_val_range_splice(
6214                 __isl_take isl_multi_val *mv1, unsigned pos,
6215                 __isl_take isl_multi_val *mv2);
6217         #include <isl/aff.h>
6218         __isl_give isl_multi_aff *isl_multi_aff_range_splice(
6219                 __isl_take isl_multi_aff *ma1, unsigned pos,
6220                 __isl_take isl_multi_aff *ma2);
6221         __isl_give isl_multi_aff *isl_multi_aff_splice(
6222                 __isl_take isl_multi_aff *ma1,
6223                 unsigned in_pos, unsigned out_pos,
6224                 __isl_take isl_multi_aff *ma2);
6225         __isl_give isl_multi_pw_aff *
6226         isl_multi_pw_aff_range_splice(
6227                 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
6228                 __isl_take isl_multi_pw_aff *mpa2);
6229         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
6230                 __isl_take isl_multi_pw_aff *mpa1,
6231                 unsigned in_pos, unsigned out_pos,
6232                 __isl_take isl_multi_pw_aff *mpa2);
6233         __isl_give isl_multi_union_pw_aff *
6234         isl_multi_union_pw_aff_range_splice(
6235                 __isl_take isl_multi_union_pw_aff *mupa1,
6236                 unsigned pos,
6237                 __isl_take isl_multi_union_pw_aff *mupa2);
6239 =item * Simplification
6241 When applied to a set or relation,
6242 the gist operation returns a set or relation that has the
6243 same intersection with the context as the input set or relation.
6244 Any implicit equality in the intersection is made explicit in the result,
6245 while all inequalities that are redundant with respect to the intersection
6246 are removed.
6247 In case of union sets and relations, the gist operation is performed
6248 per space.
6250 When applied to a function,
6251 the gist operation applies the set gist operation to each of
6252 the cells in the domain of the input piecewise expression.
6253 The context is also exploited
6254 to simplify the expression associated to each cell.
6256         #include <isl/set.h>
6257         __isl_give isl_basic_set *isl_basic_set_gist(
6258                 __isl_take isl_basic_set *bset,
6259                 __isl_take isl_basic_set *context);
6260         __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
6261                 __isl_take isl_set *context);
6262         __isl_give isl_set *isl_set_gist_params(
6263                 __isl_take isl_set *set,
6264                 __isl_take isl_set *context);
6266         #include <isl/map.h>
6267         __isl_give isl_basic_map *isl_basic_map_gist(
6268                 __isl_take isl_basic_map *bmap,
6269                 __isl_take isl_basic_map *context);
6270         __isl_give isl_basic_map *isl_basic_map_gist_domain(
6271                 __isl_take isl_basic_map *bmap,
6272                 __isl_take isl_basic_set *context);
6273         __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
6274                 __isl_take isl_map *context);
6275         __isl_give isl_map *isl_map_gist_params(
6276                 __isl_take isl_map *map,
6277                 __isl_take isl_set *context);
6278         __isl_give isl_map *isl_map_gist_domain(
6279                 __isl_take isl_map *map,
6280                 __isl_take isl_set *context);
6281         __isl_give isl_map *isl_map_gist_range(
6282                 __isl_take isl_map *map,
6283                 __isl_take isl_set *context);
6285         #include <isl/union_set.h>
6286         __isl_give isl_union_set *isl_union_set_gist(
6287                 __isl_take isl_union_set *uset,
6288                 __isl_take isl_union_set *context);
6289         __isl_give isl_union_set *isl_union_set_gist_params(
6290                 __isl_take isl_union_set *uset,
6291                 __isl_take isl_set *set);
6293         #include <isl/union_map.h>
6294         __isl_give isl_union_map *isl_union_map_gist(
6295                 __isl_take isl_union_map *umap,
6296                 __isl_take isl_union_map *context);
6297         __isl_give isl_union_map *isl_union_map_gist_params(
6298                 __isl_take isl_union_map *umap,
6299                 __isl_take isl_set *set);
6300         __isl_give isl_union_map *isl_union_map_gist_domain(
6301                 __isl_take isl_union_map *umap,
6302                 __isl_take isl_union_set *uset);
6303         __isl_give isl_union_map *isl_union_map_gist_range(
6304                 __isl_take isl_union_map *umap,
6305                 __isl_take isl_union_set *uset);
6307         #include <isl/aff.h>
6308         __isl_give isl_aff *isl_aff_gist_params(
6309                 __isl_take isl_aff *aff,
6310                 __isl_take isl_set *context);
6311         __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
6312                 __isl_take isl_set *context);
6313         __isl_give isl_multi_aff *isl_multi_aff_gist_params(
6314                 __isl_take isl_multi_aff *maff,
6315                 __isl_take isl_set *context);
6316         __isl_give isl_multi_aff *isl_multi_aff_gist(
6317                 __isl_take isl_multi_aff *maff,
6318                 __isl_take isl_set *context);
6319         __isl_give isl_pw_aff *isl_pw_aff_gist_params(
6320                 __isl_take isl_pw_aff *pwaff,
6321                 __isl_take isl_set *context);
6322         __isl_give isl_pw_aff *isl_pw_aff_gist(
6323                 __isl_take isl_pw_aff *pwaff,
6324                 __isl_take isl_set *context);
6325         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
6326                 __isl_take isl_pw_multi_aff *pma,
6327                 __isl_take isl_set *set);
6328         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
6329                 __isl_take isl_pw_multi_aff *pma,
6330                 __isl_take isl_set *set);
6331         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
6332                 __isl_take isl_multi_pw_aff *mpa,
6333                 __isl_take isl_set *set);
6334         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
6335                 __isl_take isl_multi_pw_aff *mpa,
6336                 __isl_take isl_set *set);
6337         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
6338                 __isl_take isl_union_pw_aff *upa,
6339                 __isl_take isl_union_set *context);
6340         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
6341                 __isl_take isl_union_pw_aff *upa,
6342                 __isl_take isl_set *context);
6343         __isl_give isl_union_pw_multi_aff *
6344         isl_union_pw_multi_aff_gist_params(
6345                 __isl_take isl_union_pw_multi_aff *upma,
6346                 __isl_take isl_set *context);
6347         __isl_give isl_union_pw_multi_aff *
6348         isl_union_pw_multi_aff_gist(
6349                 __isl_take isl_union_pw_multi_aff *upma,
6350                 __isl_take isl_union_set *context);
6351         __isl_give isl_multi_union_pw_aff *
6352         isl_multi_union_pw_aff_gist_params(
6353                 __isl_take isl_multi_union_pw_aff *aff,
6354                 __isl_take isl_set *context);
6355         __isl_give isl_multi_union_pw_aff *
6356         isl_multi_union_pw_aff_gist(
6357                 __isl_take isl_multi_union_pw_aff *aff,
6358                 __isl_take isl_union_set *context);
6360         #include <isl/polynomial.h>
6361         __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
6362                 __isl_take isl_qpolynomial *qp,
6363                 __isl_take isl_set *context);
6364         __isl_give isl_qpolynomial *isl_qpolynomial_gist(
6365                 __isl_take isl_qpolynomial *qp,
6366                 __isl_take isl_set *context);
6367         __isl_give isl_qpolynomial_fold *
6368         isl_qpolynomial_fold_gist_params(
6369                 __isl_take isl_qpolynomial_fold *fold,
6370                 __isl_take isl_set *context);
6371         __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
6372                 __isl_take isl_qpolynomial_fold *fold,
6373                 __isl_take isl_set *context);
6374         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
6375                 __isl_take isl_pw_qpolynomial *pwqp,
6376                 __isl_take isl_set *context);
6377         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
6378                 __isl_take isl_pw_qpolynomial *pwqp,
6379                 __isl_take isl_set *context);
6380         __isl_give isl_pw_qpolynomial_fold *
6381         isl_pw_qpolynomial_fold_gist(
6382                 __isl_take isl_pw_qpolynomial_fold *pwf,
6383                 __isl_take isl_set *context);
6384         __isl_give isl_pw_qpolynomial_fold *
6385         isl_pw_qpolynomial_fold_gist_params(
6386                 __isl_take isl_pw_qpolynomial_fold *pwf,
6387                 __isl_take isl_set *context);
6388         __isl_give isl_union_pw_qpolynomial *
6389         isl_union_pw_qpolynomial_gist_params(
6390                 __isl_take isl_union_pw_qpolynomial *upwqp,
6391                 __isl_take isl_set *context);
6392         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
6393                 __isl_take isl_union_pw_qpolynomial *upwqp,
6394                 __isl_take isl_union_set *context);
6395         __isl_give isl_union_pw_qpolynomial_fold *
6396         isl_union_pw_qpolynomial_fold_gist(
6397                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6398                 __isl_take isl_union_set *context);
6399         __isl_give isl_union_pw_qpolynomial_fold *
6400         isl_union_pw_qpolynomial_fold_gist_params(
6401                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6402                 __isl_take isl_set *context);
6404 =item * Binary Arithmethic Operations
6406         #include <isl/val.h>
6407         __isl_give isl_multi_val *isl_multi_val_sub(
6408                 __isl_take isl_multi_val *mv1,
6409                 __isl_take isl_multi_val *mv2);
6411         #include <isl/aff.h>
6412         __isl_give isl_aff *isl_aff_add(
6413                 __isl_take isl_aff *aff1,
6414                 __isl_take isl_aff *aff2);
6415         __isl_give isl_multi_aff *isl_multi_aff_add(
6416                 __isl_take isl_multi_aff *maff1,
6417                 __isl_take isl_multi_aff *maff2);
6418         __isl_give isl_pw_aff *isl_pw_aff_add(
6419                 __isl_take isl_pw_aff *pwaff1,
6420                 __isl_take isl_pw_aff *pwaff2);
6421         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
6422                 __isl_take isl_pw_multi_aff *pma1,
6423                 __isl_take isl_pw_multi_aff *pma2);
6424         __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
6425                 __isl_take isl_union_pw_aff *upa1,
6426                 __isl_take isl_union_pw_aff *upa2);
6427         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
6428                 __isl_take isl_union_pw_multi_aff *upma1,
6429                 __isl_take isl_union_pw_multi_aff *upma2);
6430         __isl_give isl_pw_aff *isl_pw_aff_min(
6431                 __isl_take isl_pw_aff *pwaff1,
6432                 __isl_take isl_pw_aff *pwaff2);
6433         __isl_give isl_pw_aff *isl_pw_aff_max(
6434                 __isl_take isl_pw_aff *pwaff1,
6435                 __isl_take isl_pw_aff *pwaff2);
6436         __isl_give isl_aff *isl_aff_sub(
6437                 __isl_take isl_aff *aff1,
6438                 __isl_take isl_aff *aff2);
6439         __isl_give isl_multi_aff *isl_multi_aff_sub(
6440                 __isl_take isl_multi_aff *ma1,
6441                 __isl_take isl_multi_aff *ma2);
6442         __isl_give isl_pw_aff *isl_pw_aff_sub(
6443                 __isl_take isl_pw_aff *pwaff1,
6444                 __isl_take isl_pw_aff *pwaff2);
6445         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
6446                 __isl_take isl_multi_pw_aff *mpa1,
6447                 __isl_take isl_multi_pw_aff *mpa2);
6448         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
6449                 __isl_take isl_pw_multi_aff *pma1,
6450                 __isl_take isl_pw_multi_aff *pma2);
6451         __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
6452                 __isl_take isl_union_pw_aff *upa1,
6453                 __isl_take isl_union_pw_aff *upa2);
6454         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
6455                 __isl_take isl_union_pw_multi_aff *upma1,
6456                 __isl_take isl_union_pw_multi_aff *upma2);
6457         __isl_give isl_multi_union_pw_aff *
6458         isl_multi_union_pw_aff_sub(
6459                 __isl_take isl_multi_union_pw_aff *mupa1,
6460                 __isl_take isl_multi_union_pw_aff *mupa2);
6462 C<isl_aff_sub> subtracts the second argument from the first.
6464         #include <isl/polynomial.h>
6465         __isl_give isl_qpolynomial *isl_qpolynomial_add(
6466                 __isl_take isl_qpolynomial *qp1,
6467                 __isl_take isl_qpolynomial *qp2);
6468         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
6469                 __isl_take isl_pw_qpolynomial *pwqp1,
6470                 __isl_take isl_pw_qpolynomial *pwqp2);
6471         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
6472                 __isl_take isl_pw_qpolynomial *pwqp1,
6473                 __isl_take isl_pw_qpolynomial *pwqp2);
6474         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
6475                 __isl_take isl_pw_qpolynomial_fold *pwf1,
6476                 __isl_take isl_pw_qpolynomial_fold *pwf2);
6477         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
6478                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6479                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6480         __isl_give isl_qpolynomial *isl_qpolynomial_sub(
6481                 __isl_take isl_qpolynomial *qp1,
6482                 __isl_take isl_qpolynomial *qp2);
6483         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
6484                 __isl_take isl_pw_qpolynomial *pwqp1,
6485                 __isl_take isl_pw_qpolynomial *pwqp2);
6486         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
6487                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6488                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6489         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
6490                 __isl_take isl_pw_qpolynomial_fold *pwf1,
6491                 __isl_take isl_pw_qpolynomial_fold *pwf2);
6492         __isl_give isl_union_pw_qpolynomial_fold *
6493         isl_union_pw_qpolynomial_fold_fold(
6494                 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
6495                 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
6497         #include <isl/aff.h>
6498         __isl_give isl_pw_aff *isl_pw_aff_union_add(
6499                 __isl_take isl_pw_aff *pwaff1,
6500                 __isl_take isl_pw_aff *pwaff2);
6501         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
6502                 __isl_take isl_pw_multi_aff *pma1,
6503                 __isl_take isl_pw_multi_aff *pma2);
6504         __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
6505                 __isl_take isl_union_pw_aff *upa1,
6506                 __isl_take isl_union_pw_aff *upa2);
6507         __isl_give isl_union_pw_multi_aff *
6508         isl_union_pw_multi_aff_union_add(
6509                 __isl_take isl_union_pw_multi_aff *upma1,
6510                 __isl_take isl_union_pw_multi_aff *upma2);
6511         __isl_give isl_multi_union_pw_aff *
6512         isl_multi_union_pw_aff_union_add(
6513                 __isl_take isl_multi_union_pw_aff *mupa1,
6514                 __isl_take isl_multi_union_pw_aff *mupa2);
6515         __isl_give isl_pw_aff *isl_pw_aff_union_min(
6516                 __isl_take isl_pw_aff *pwaff1,
6517                 __isl_take isl_pw_aff *pwaff2);
6518         __isl_give isl_pw_aff *isl_pw_aff_union_max(
6519                 __isl_take isl_pw_aff *pwaff1,
6520                 __isl_take isl_pw_aff *pwaff2);
6522 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
6523 expression with a domain that is the union of those of C<pwaff1> and
6524 C<pwaff2> and such that on each cell, the quasi-affine expression is
6525 the maximum of those of C<pwaff1> and C<pwaff2>.  If only one of
6526 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
6527 associated expression is the defined one.
6528 This in contrast to the C<isl_pw_aff_max> function, which is
6529 only defined on the shared definition domain of the arguments.
6531         #include <isl/val.h>
6532         __isl_give isl_multi_val *isl_multi_val_add_val(
6533                 __isl_take isl_multi_val *mv,
6534                 __isl_take isl_val *v);
6535         __isl_give isl_multi_val *isl_multi_val_mod_val(
6536                 __isl_take isl_multi_val *mv,
6537                 __isl_take isl_val *v);
6538         __isl_give isl_multi_val *isl_multi_val_scale_val(
6539                 __isl_take isl_multi_val *mv,
6540                 __isl_take isl_val *v);
6541         __isl_give isl_multi_val *isl_multi_val_scale_down_val(
6542                 __isl_take isl_multi_val *mv,
6543                 __isl_take isl_val *v);
6545         #include <isl/aff.h>
6546         __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
6547                 __isl_take isl_val *mod);
6548         __isl_give isl_pw_aff *isl_pw_aff_mod_val(
6549                 __isl_take isl_pw_aff *pa,
6550                 __isl_take isl_val *mod);
6551         __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
6552                 __isl_take isl_union_pw_aff *upa,
6553                 __isl_take isl_val *f);
6554         __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
6555                 __isl_take isl_val *v);
6556         __isl_give isl_multi_aff *isl_multi_aff_scale_val(
6557                 __isl_take isl_multi_aff *ma,
6558                 __isl_take isl_val *v);
6559         __isl_give isl_pw_aff *isl_pw_aff_scale_val(
6560                 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
6561         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
6562                 __isl_take isl_multi_pw_aff *mpa,
6563                 __isl_take isl_val *v);
6564         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
6565                 __isl_take isl_pw_multi_aff *pma,
6566                 __isl_take isl_val *v);
6567         __isl_give isl_union_pw_multi_aff *
6568         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
6569                 __isl_take isl_union_pw_aff *upa,
6570                 __isl_take isl_val *f);
6571         isl_union_pw_multi_aff_scale_val(
6572                 __isl_take isl_union_pw_multi_aff *upma,
6573                 __isl_take isl_val *val);
6574         __isl_give isl_multi_union_pw_aff *
6575         isl_multi_union_pw_aff_scale_val(
6576                 __isl_take isl_multi_union_pw_aff *mupa,
6577                 __isl_take isl_val *v);
6578         __isl_give isl_aff *isl_aff_scale_down_ui(
6579                 __isl_take isl_aff *aff, unsigned f);
6580         __isl_give isl_aff *isl_aff_scale_down_val(
6581                 __isl_take isl_aff *aff, __isl_take isl_val *v);
6582         __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
6583                 __isl_take isl_multi_aff *ma,
6584                 __isl_take isl_val *v);
6585         __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
6586                 __isl_take isl_pw_aff *pa,
6587                 __isl_take isl_val *f);
6588         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
6589                 __isl_take isl_multi_pw_aff *mpa,
6590                 __isl_take isl_val *v);
6591         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
6592                 __isl_take isl_pw_multi_aff *pma,
6593                 __isl_take isl_val *v);
6594         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
6595                 __isl_take isl_union_pw_aff *upa,
6596                 __isl_take isl_val *v);
6597         __isl_give isl_union_pw_multi_aff *
6598         isl_union_pw_multi_aff_scale_down_val(
6599                 __isl_take isl_union_pw_multi_aff *upma,
6600                 __isl_take isl_val *val);
6601         __isl_give isl_multi_union_pw_aff *
6602         isl_multi_union_pw_aff_scale_down_val(
6603                 __isl_take isl_multi_union_pw_aff *mupa,
6604                 __isl_take isl_val *v);
6606         #include <isl/polynomial.h>
6607         __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
6608                 __isl_take isl_qpolynomial *qp,
6609                 __isl_take isl_val *v);
6610         __isl_give isl_qpolynomial_fold *
6611         isl_qpolynomial_fold_scale_val(
6612                 __isl_take isl_qpolynomial_fold *fold,
6613                 __isl_take isl_val *v);
6614         __isl_give isl_pw_qpolynomial *
6615         isl_pw_qpolynomial_scale_val(
6616                 __isl_take isl_pw_qpolynomial *pwqp,
6617                 __isl_take isl_val *v);
6618         __isl_give isl_pw_qpolynomial_fold *
6619         isl_pw_qpolynomial_fold_scale_val(
6620                 __isl_take isl_pw_qpolynomial_fold *pwf,
6621                 __isl_take isl_val *v);
6622         __isl_give isl_union_pw_qpolynomial *
6623         isl_union_pw_qpolynomial_scale_val(
6624                 __isl_take isl_union_pw_qpolynomial *upwqp,
6625                 __isl_take isl_val *v);
6626         __isl_give isl_union_pw_qpolynomial_fold *
6627         isl_union_pw_qpolynomial_fold_scale_val(
6628                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6629                 __isl_take isl_val *v);
6630         __isl_give isl_qpolynomial *
6631         isl_qpolynomial_scale_down_val(
6632                 __isl_take isl_qpolynomial *qp,
6633                 __isl_take isl_val *v);
6634         __isl_give isl_qpolynomial_fold *
6635         isl_qpolynomial_fold_scale_down_val(
6636                 __isl_take isl_qpolynomial_fold *fold,
6637                 __isl_take isl_val *v);
6638         __isl_give isl_pw_qpolynomial *
6639         isl_pw_qpolynomial_scale_down_val(
6640                 __isl_take isl_pw_qpolynomial *pwqp,
6641                 __isl_take isl_val *v);
6642         __isl_give isl_pw_qpolynomial_fold *
6643         isl_pw_qpolynomial_fold_scale_down_val(
6644                 __isl_take isl_pw_qpolynomial_fold *pwf,
6645                 __isl_take isl_val *v);
6646         __isl_give isl_union_pw_qpolynomial *
6647         isl_union_pw_qpolynomial_scale_down_val(
6648                 __isl_take isl_union_pw_qpolynomial *upwqp,
6649                 __isl_take isl_val *v);
6650         __isl_give isl_union_pw_qpolynomial_fold *
6651         isl_union_pw_qpolynomial_fold_scale_down_val(
6652                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6653                 __isl_take isl_val *v);
6655         #include <isl/val.h>
6656         __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
6657                 __isl_take isl_multi_val *mv1,
6658                 __isl_take isl_multi_val *mv2);
6659         __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
6660                 __isl_take isl_multi_val *mv1,
6661                 __isl_take isl_multi_val *mv2);
6662         __isl_give isl_multi_val *
6663         isl_multi_val_scale_down_multi_val(
6664                 __isl_take isl_multi_val *mv1,
6665                 __isl_take isl_multi_val *mv2);
6667         #include <isl/aff.h>
6668         __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
6669                 __isl_take isl_multi_aff *ma,
6670                 __isl_take isl_multi_val *mv);
6671         __isl_give isl_multi_union_pw_aff *
6672         isl_multi_union_pw_aff_mod_multi_val(
6673                 __isl_take isl_multi_union_pw_aff *upma,
6674                 __isl_take isl_multi_val *mv);
6675         __isl_give isl_multi_pw_aff *
6676         isl_multi_pw_aff_mod_multi_val(
6677                 __isl_take isl_multi_pw_aff *mpa,
6678                 __isl_take isl_multi_val *mv);
6679         __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
6680                 __isl_take isl_multi_aff *ma,
6681                 __isl_take isl_multi_val *mv);
6682         __isl_give isl_pw_multi_aff *
6683         isl_pw_multi_aff_scale_multi_val(
6684                 __isl_take isl_pw_multi_aff *pma,
6685                 __isl_take isl_multi_val *mv);
6686         __isl_give isl_multi_pw_aff *
6687         isl_multi_pw_aff_scale_multi_val(
6688                 __isl_take isl_multi_pw_aff *mpa,
6689                 __isl_take isl_multi_val *mv);
6690         __isl_give isl_multi_union_pw_aff *
6691         isl_multi_union_pw_aff_scale_multi_val(
6692                 __isl_take isl_multi_union_pw_aff *mupa,
6693                 __isl_take isl_multi_val *mv);
6694         __isl_give isl_union_pw_multi_aff *
6695         isl_union_pw_multi_aff_scale_multi_val(
6696                 __isl_take isl_union_pw_multi_aff *upma,
6697                 __isl_take isl_multi_val *mv);
6698         __isl_give isl_multi_aff *
6699         isl_multi_aff_scale_down_multi_val(
6700                 __isl_take isl_multi_aff *ma,
6701                 __isl_take isl_multi_val *mv);
6702         __isl_give isl_multi_pw_aff *
6703         isl_multi_pw_aff_scale_down_multi_val(
6704                 __isl_take isl_multi_pw_aff *mpa,
6705                 __isl_take isl_multi_val *mv);
6706         __isl_give isl_multi_union_pw_aff *
6707         isl_multi_union_pw_aff_scale_down_multi_val(
6708                 __isl_take isl_multi_union_pw_aff *mupa,
6709                 __isl_take isl_multi_val *mv);
6711 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
6712 by the corresponding elements of C<mv>.
6714         #include <isl/aff.h>
6715         __isl_give isl_aff *isl_aff_mul(
6716                 __isl_take isl_aff *aff1,
6717                 __isl_take isl_aff *aff2);
6718         __isl_give isl_aff *isl_aff_div(
6719                 __isl_take isl_aff *aff1,
6720                 __isl_take isl_aff *aff2);
6721         __isl_give isl_pw_aff *isl_pw_aff_mul(
6722                 __isl_take isl_pw_aff *pwaff1,
6723                 __isl_take isl_pw_aff *pwaff2);
6724         __isl_give isl_pw_aff *isl_pw_aff_div(
6725                 __isl_take isl_pw_aff *pa1,
6726                 __isl_take isl_pw_aff *pa2);
6727         __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
6728                 __isl_take isl_pw_aff *pa1,
6729                 __isl_take isl_pw_aff *pa2);
6730         __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
6731                 __isl_take isl_pw_aff *pa1,
6732                 __isl_take isl_pw_aff *pa2);
6734 When multiplying two affine expressions, at least one of the two needs
6735 to be a constant.  Similarly, when dividing an affine expression by another,
6736 the second expression needs to be a constant.
6737 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
6738 rounding towards zero.  C<isl_pw_aff_tdiv_r> computes the corresponding
6739 remainder.
6741         #include <isl/polynomial.h>
6742         __isl_give isl_qpolynomial *isl_qpolynomial_mul(
6743                 __isl_take isl_qpolynomial *qp1,
6744                 __isl_take isl_qpolynomial *qp2);
6745         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
6746                 __isl_take isl_pw_qpolynomial *pwqp1,
6747                 __isl_take isl_pw_qpolynomial *pwqp2);
6748         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
6749                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6750                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6752 =back
6754 =head3 Lexicographic Optimization
6756 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
6757 the following functions
6758 compute a set that contains the lexicographic minimum or maximum
6759 of the elements in C<set> (or C<bset>) for those values of the parameters
6760 that satisfy C<dom>.
6761 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6762 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
6763 has no elements.
6764 In other words, the union of the parameter values
6765 for which the result is non-empty and of C<*empty>
6766 is equal to C<dom>.
6768         #include <isl/set.h>
6769         __isl_give isl_set *isl_basic_set_partial_lexmin(
6770                 __isl_take isl_basic_set *bset,
6771                 __isl_take isl_basic_set *dom,
6772                 __isl_give isl_set **empty);
6773         __isl_give isl_set *isl_basic_set_partial_lexmax(
6774                 __isl_take isl_basic_set *bset,
6775                 __isl_take isl_basic_set *dom,
6776                 __isl_give isl_set **empty);
6777         __isl_give isl_set *isl_set_partial_lexmin(
6778                 __isl_take isl_set *set, __isl_take isl_set *dom,
6779                 __isl_give isl_set **empty);
6780         __isl_give isl_set *isl_set_partial_lexmax(
6781                 __isl_take isl_set *set, __isl_take isl_set *dom,
6782                 __isl_give isl_set **empty);
6784 Given a (basic) set C<set> (or C<bset>), the following functions simply
6785 return a set containing the lexicographic minimum or maximum
6786 of the elements in C<set> (or C<bset>).
6787 In case of union sets, the optimum is computed per space.
6789         #include <isl/set.h>
6790         __isl_give isl_set *isl_basic_set_lexmin(
6791                 __isl_take isl_basic_set *bset);
6792         __isl_give isl_set *isl_basic_set_lexmax(
6793                 __isl_take isl_basic_set *bset);
6794         __isl_give isl_set *isl_set_lexmin(
6795                 __isl_take isl_set *set);
6796         __isl_give isl_set *isl_set_lexmax(
6797                 __isl_take isl_set *set);
6798         __isl_give isl_union_set *isl_union_set_lexmin(
6799                 __isl_take isl_union_set *uset);
6800         __isl_give isl_union_set *isl_union_set_lexmax(
6801                 __isl_take isl_union_set *uset);
6803 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
6804 the following functions
6805 compute a relation that maps each element of C<dom>
6806 to the single lexicographic minimum or maximum
6807 of the elements that are associated to that same
6808 element in C<map> (or C<bmap>).
6809 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6810 that contains the elements in C<dom> that do not map
6811 to any elements in C<map> (or C<bmap>).
6812 In other words, the union of the domain of the result and of C<*empty>
6813 is equal to C<dom>.
6815         #include <isl/map.h>
6816         __isl_give isl_map *isl_basic_map_partial_lexmax(
6817                 __isl_take isl_basic_map *bmap,
6818                 __isl_take isl_basic_set *dom,
6819                 __isl_give isl_set **empty);
6820         __isl_give isl_map *isl_basic_map_partial_lexmin(
6821                 __isl_take isl_basic_map *bmap,
6822                 __isl_take isl_basic_set *dom,
6823                 __isl_give isl_set **empty);
6824         __isl_give isl_map *isl_map_partial_lexmax(
6825                 __isl_take isl_map *map, __isl_take isl_set *dom,
6826                 __isl_give isl_set **empty);
6827         __isl_give isl_map *isl_map_partial_lexmin(
6828                 __isl_take isl_map *map, __isl_take isl_set *dom,
6829                 __isl_give isl_set **empty);
6831 Given a (basic) map C<map> (or C<bmap>), the following functions simply
6832 return a map mapping each element in the domain of
6833 C<map> (or C<bmap>) to the lexicographic minimum or maximum
6834 of all elements associated to that element.
6835 In case of union relations, the optimum is computed per space.
6837         #include <isl/map.h>
6838         __isl_give isl_map *isl_basic_map_lexmin(
6839                 __isl_take isl_basic_map *bmap);
6840         __isl_give isl_map *isl_basic_map_lexmax(
6841                 __isl_take isl_basic_map *bmap);
6842         __isl_give isl_map *isl_map_lexmin(
6843                 __isl_take isl_map *map);
6844         __isl_give isl_map *isl_map_lexmax(
6845                 __isl_take isl_map *map);
6846         __isl_give isl_union_map *isl_union_map_lexmin(
6847                 __isl_take isl_union_map *umap);
6848         __isl_give isl_union_map *isl_union_map_lexmax(
6849                 __isl_take isl_union_map *umap);
6851 The following functions return their result in the form of
6852 a piecewise multi-affine expression,
6853 but are otherwise equivalent to the corresponding functions
6854 returning a basic set or relation.
6856         #include <isl/set.h>
6857         __isl_give isl_pw_multi_aff *
6858         isl_basic_set_partial_lexmin_pw_multi_aff(
6859                 __isl_take isl_basic_set *bset,
6860                 __isl_take isl_basic_set *dom,
6861                 __isl_give isl_set **empty);
6862         __isl_give isl_pw_multi_aff *
6863         isl_basic_set_partial_lexmax_pw_multi_aff(
6864                 __isl_take isl_basic_set *bset,
6865                 __isl_take isl_basic_set *dom,
6866                 __isl_give isl_set **empty);
6867         __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
6868                 __isl_take isl_set *set);
6869         __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
6870                 __isl_take isl_set *set);
6872         #include <isl/map.h>
6873         __isl_give isl_pw_multi_aff *
6874         isl_basic_map_lexmin_pw_multi_aff(
6875                 __isl_take isl_basic_map *bmap);
6876         __isl_give isl_pw_multi_aff *
6877         isl_basic_map_partial_lexmin_pw_multi_aff(
6878                 __isl_take isl_basic_map *bmap,
6879                 __isl_take isl_basic_set *dom,
6880                 __isl_give isl_set **empty);
6881         __isl_give isl_pw_multi_aff *
6882         isl_basic_map_partial_lexmax_pw_multi_aff(
6883                 __isl_take isl_basic_map *bmap,
6884                 __isl_take isl_basic_set *dom,
6885                 __isl_give isl_set **empty);
6886         __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
6887                 __isl_take isl_map *map);
6888         __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
6889                 __isl_take isl_map *map);
6891 The following functions return the lexicographic minimum or maximum
6892 on the shared domain of the inputs and the single defined function
6893 on those parts of the domain where only a single function is defined.
6895         #include <isl/aff.h>
6896         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
6897                 __isl_take isl_pw_multi_aff *pma1,
6898                 __isl_take isl_pw_multi_aff *pma2);
6899         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
6900                 __isl_take isl_pw_multi_aff *pma1,
6901                 __isl_take isl_pw_multi_aff *pma2);
6903 =head2 Ternary Operations
6905         #include <isl/aff.h>
6906         __isl_give isl_pw_aff *isl_pw_aff_cond(
6907                 __isl_take isl_pw_aff *cond,
6908                 __isl_take isl_pw_aff *pwaff_true,
6909                 __isl_take isl_pw_aff *pwaff_false);
6911 The function C<isl_pw_aff_cond> performs a conditional operator
6912 and returns an expression that is equal to C<pwaff_true>
6913 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
6914 where C<cond> is zero.
6916 =head2 Lists
6918 Lists are defined over several element types, including
6919 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_union_pw_aff>,
6920 C<isl_union_pw_multi_aff>, C<isl_constraint>,
6921 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
6922 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
6923 Here we take lists of C<isl_set>s as an example.
6924 Lists can be created, copied, modified and freed using the following functions.
6926         #include <isl/set.h>
6927         __isl_give isl_set_list *isl_set_list_from_set(
6928                 __isl_take isl_set *el);
6929         __isl_give isl_set_list *isl_set_list_alloc(
6930                 isl_ctx *ctx, int n);
6931         __isl_give isl_set_list *isl_set_list_copy(
6932                 __isl_keep isl_set_list *list);
6933         __isl_give isl_set_list *isl_set_list_insert(
6934                 __isl_take isl_set_list *list, unsigned pos,
6935                 __isl_take isl_set *el);
6936         __isl_give isl_set_list *isl_set_list_add(
6937                 __isl_take isl_set_list *list,
6938                 __isl_take isl_set *el);
6939         __isl_give isl_set_list *isl_set_list_drop(
6940                 __isl_take isl_set_list *list,
6941                 unsigned first, unsigned n);
6942         __isl_give isl_set_list *isl_set_list_set_set(
6943                 __isl_take isl_set_list *list, int index,
6944                 __isl_take isl_set *set);
6945         __isl_give isl_set_list *isl_set_list_concat(
6946                 __isl_take isl_set_list *list1,
6947                 __isl_take isl_set_list *list2);
6948         __isl_give isl_set_list *isl_set_list_sort(
6949                 __isl_take isl_set_list *list,
6950                 int (*cmp)(__isl_keep isl_set *a,
6951                         __isl_keep isl_set *b, void *user),
6952                 void *user);
6953         __isl_null isl_set_list *isl_set_list_free(
6954                 __isl_take isl_set_list *list);
6956 C<isl_set_list_alloc> creates an empty list with an initial capacity
6957 for C<n> elements.  C<isl_set_list_insert> and C<isl_set_list_add>
6958 add elements to a list, increasing its capacity as needed.
6959 C<isl_set_list_from_set> creates a list with a single element.
6961 Lists can be inspected using the following functions.
6963         #include <isl/set.h>
6964         int isl_set_list_n_set(__isl_keep isl_set_list *list);
6965         __isl_give isl_set *isl_set_list_get_set(
6966                 __isl_keep isl_set_list *list, int index);
6967         int isl_set_list_foreach(__isl_keep isl_set_list *list,
6968                 int (*fn)(__isl_take isl_set *el, void *user),
6969                 void *user);
6970         int isl_set_list_foreach_scc(__isl_keep isl_set_list *list,
6971                 int (*follows)(__isl_keep isl_set *a,
6972                         __isl_keep isl_set *b, void *user),
6973                 void *follows_user
6974                 int (*fn)(__isl_take isl_set *el, void *user),
6975                 void *fn_user);
6977 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
6978 strongly connected components of the graph with as vertices the elements
6979 of C<list> and a directed edge from vertex C<b> to vertex C<a>
6980 iff C<follows(a, b)> returns C<1>.  The callbacks C<follows> and C<fn>
6981 should return C<-1> on error.
6983 Lists can be printed using
6985         #include <isl/set.h>
6986         __isl_give isl_printer *isl_printer_print_set_list(
6987                 __isl_take isl_printer *p,
6988                 __isl_keep isl_set_list *list);
6990 =head2 Associative arrays
6992 Associative arrays map isl objects of a specific type to isl objects
6993 of some (other) specific type.  They are defined for several pairs
6994 of types, including (C<isl_map>, C<isl_basic_set>),
6995 (C<isl_id>, C<isl_ast_expr>) and.
6996 (C<isl_id>, C<isl_pw_aff>).
6997 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
6998 as an example.
7000 Associative arrays can be created, copied and freed using
7001 the following functions.
7003         #include <isl/id_to_ast_expr.h>
7004         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
7005                 isl_ctx *ctx, int min_size);
7006         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
7007                 __isl_keep isl_id_to_ast_expr *id2expr);
7008         __isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
7009                 __isl_take isl_id_to_ast_expr *id2expr);
7011 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
7012 to specify the expected size of the associative array.
7013 The associative array will be grown automatically as needed.
7015 Associative arrays can be inspected using the following functions.
7017         #include <isl/id_to_ast_expr.h>
7018         int isl_id_to_ast_expr_has(
7019                 __isl_keep isl_id_to_ast_expr *id2expr,
7020                 __isl_keep isl_id *key);
7021         __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
7022                 __isl_keep isl_id_to_ast_expr *id2expr,
7023                 __isl_take isl_id *key);
7024         int isl_id_to_ast_expr_foreach(
7025                 __isl_keep isl_id_to_ast_expr *id2expr,
7026                 int (*fn)(__isl_take isl_id *key,
7027                         __isl_take isl_ast_expr *val, void *user),
7028                 void *user);
7030 They can be modified using the following function.
7032         #include <isl/id_to_ast_expr.h>
7033         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
7034                 __isl_take isl_id_to_ast_expr *id2expr,
7035                 __isl_take isl_id *key,
7036                 __isl_take isl_ast_expr *val);
7037         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
7038                 __isl_take isl_id_to_ast_expr *id2expr,
7039                 __isl_take isl_id *key);
7041 Associative arrays can be printed using the following function.
7043         #include <isl/id_to_ast_expr.h>
7044         __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
7045                 __isl_take isl_printer *p,
7046                 __isl_keep isl_id_to_ast_expr *id2expr);
7048 =head2 Vectors
7050 Vectors can be created, copied and freed using the following functions.
7052         #include <isl/vec.h>
7053         __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
7054                 unsigned size);
7055         __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
7056         __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
7058 Note that the elements of a newly created vector may have arbitrary values.
7059 The elements can be changed and inspected using the following functions.
7061         int isl_vec_size(__isl_keep isl_vec *vec);
7062         __isl_give isl_val *isl_vec_get_element_val(
7063                 __isl_keep isl_vec *vec, int pos);
7064         __isl_give isl_vec *isl_vec_set_element_si(
7065                 __isl_take isl_vec *vec, int pos, int v);
7066         __isl_give isl_vec *isl_vec_set_element_val(
7067                 __isl_take isl_vec *vec, int pos,
7068                 __isl_take isl_val *v);
7069         __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
7070                 int v);
7071         __isl_give isl_vec *isl_vec_set_val(
7072                 __isl_take isl_vec *vec, __isl_take isl_val *v);
7073         int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
7074                 __isl_keep isl_vec *vec2, int pos);
7076 C<isl_vec_get_element> will return a negative value if anything went wrong.
7077 In that case, the value of C<*v> is undefined.
7079 The following function can be used to concatenate two vectors.
7081         __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
7082                 __isl_take isl_vec *vec2);
7084 =head2 Matrices
7086 Matrices can be created, copied and freed using the following functions.
7088         #include <isl/mat.h>
7089         __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
7090                 unsigned n_row, unsigned n_col);
7091         __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
7092         __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
7094 Note that the elements of a newly created matrix may have arbitrary values.
7095 The elements can be changed and inspected using the following functions.
7097         int isl_mat_rows(__isl_keep isl_mat *mat);
7098         int isl_mat_cols(__isl_keep isl_mat *mat);
7099         __isl_give isl_val *isl_mat_get_element_val(
7100                 __isl_keep isl_mat *mat, int row, int col);
7101         __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
7102                 int row, int col, int v);
7103         __isl_give isl_mat *isl_mat_set_element_val(
7104                 __isl_take isl_mat *mat, int row, int col,
7105                 __isl_take isl_val *v);
7107 C<isl_mat_get_element> will return a negative value if anything went wrong.
7108 In that case, the value of C<*v> is undefined.
7110 The following function can be used to compute the (right) inverse
7111 of a matrix, i.e., a matrix such that the product of the original
7112 and the inverse (in that order) is a multiple of the identity matrix.
7113 The input matrix is assumed to be of full row-rank.
7115         __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
7117 The following function can be used to compute the (right) kernel
7118 (or null space) of a matrix, i.e., a matrix such that the product of
7119 the original and the kernel (in that order) is the zero matrix.
7121         __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
7123 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
7125 The following functions determine
7126 an upper or lower bound on a quasipolynomial over its domain.
7128         __isl_give isl_pw_qpolynomial_fold *
7129         isl_pw_qpolynomial_bound(
7130                 __isl_take isl_pw_qpolynomial *pwqp,
7131                 enum isl_fold type, int *tight);
7133         __isl_give isl_union_pw_qpolynomial_fold *
7134         isl_union_pw_qpolynomial_bound(
7135                 __isl_take isl_union_pw_qpolynomial *upwqp,
7136                 enum isl_fold type, int *tight);
7138 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
7139 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
7140 is the returned bound is known be tight, i.e., for each value
7141 of the parameters there is at least
7142 one element in the domain that reaches the bound.
7143 If the domain of C<pwqp> is not wrapping, then the bound is computed
7144 over all elements in that domain and the result has a purely parametric
7145 domain.  If the domain of C<pwqp> is wrapping, then the bound is
7146 computed over the range of the wrapped relation.  The domain of the
7147 wrapped relation becomes the domain of the result.
7149 =head2 Parametric Vertex Enumeration
7151 The parametric vertex enumeration described in this section
7152 is mainly intended to be used internally and by the C<barvinok>
7153 library.
7155         #include <isl/vertices.h>
7156         __isl_give isl_vertices *isl_basic_set_compute_vertices(
7157                 __isl_keep isl_basic_set *bset);
7159 The function C<isl_basic_set_compute_vertices> performs the
7160 actual computation of the parametric vertices and the chamber
7161 decomposition and store the result in an C<isl_vertices> object.
7162 This information can be queried by either iterating over all
7163 the vertices or iterating over all the chambers or cells
7164 and then iterating over all vertices that are active on the chamber.
7166         int isl_vertices_foreach_vertex(
7167                 __isl_keep isl_vertices *vertices,
7168                 int (*fn)(__isl_take isl_vertex *vertex, void *user),
7169                 void *user);
7171         int isl_vertices_foreach_cell(
7172                 __isl_keep isl_vertices *vertices,
7173                 int (*fn)(__isl_take isl_cell *cell, void *user),
7174                 void *user);
7175         int isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
7176                 int (*fn)(__isl_take isl_vertex *vertex, void *user),
7177                 void *user);
7179 Other operations that can be performed on an C<isl_vertices> object are
7180 the following.
7182         int isl_vertices_get_n_vertices(
7183                 __isl_keep isl_vertices *vertices);
7184         void isl_vertices_free(__isl_take isl_vertices *vertices);
7186 Vertices can be inspected and destroyed using the following functions.
7188         int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
7189         __isl_give isl_basic_set *isl_vertex_get_domain(
7190                 __isl_keep isl_vertex *vertex);
7191         __isl_give isl_multi_aff *isl_vertex_get_expr(
7192                 __isl_keep isl_vertex *vertex);
7193         void isl_vertex_free(__isl_take isl_vertex *vertex);
7195 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
7196 describing the vertex in terms of the parameters,
7197 while C<isl_vertex_get_domain> returns the activity domain
7198 of the vertex.
7200 Chambers can be inspected and destroyed using the following functions.
7202         __isl_give isl_basic_set *isl_cell_get_domain(
7203                 __isl_keep isl_cell *cell);
7204         void isl_cell_free(__isl_take isl_cell *cell);
7206 =head1 Polyhedral Compilation Library
7208 This section collects functionality in C<isl> that has been specifically
7209 designed for use during polyhedral compilation.
7211 =head2 Schedule Trees
7213 A schedule tree is a structured representation of a schedule,
7214 assigning a relative order to a set of domain elements.
7215 The relative order expressed by the schedule tree is
7216 defined recursively.  In particular, the order between
7217 two domain elements is determined by the node that is closest
7218 to the root that refers to both elements and that orders them apart.
7219 Each node in the tree is of one of several types.
7220 The root node is always of type C<isl_schedule_node_domain>
7221 and it describes the domain elements to which the schedule applies.
7222 The other types of nodes are as follows.
7224 =over
7226 =item C<isl_schedule_node_band>
7228 A band of schedule dimensions.  Each schedule dimension is represented
7229 by a union piecewise quasi-affine expression.  If this expression
7230 assigns a different value to two domain elements, while all previous
7231 schedule dimensions in the same band assign them the same value,
7232 then the two domain elements are ordered according to these two
7233 different values.
7235 =item C<isl_schedule_node_filter>
7237 A filter node does not impose any ordering, but rather intersects
7238 the set of domain elements that the current subtree refers to
7239 with a given union set.  The subtree of the filter node only
7240 refers to domain elements in the intersection.
7241 A filter node is typically only used a child of a sequence or
7242 set node.
7244 =item C<isl_schedule_node_leaf>
7246 A leaf of the schedule tree.  Leaf nodes do not impose any ordering.
7248 =item C<isl_schedule_node_sequence>
7250 A sequence node has one or more children, each of which is a filter node.
7251 The filters on these filter nodes form a partition of
7252 the domain elements that the current subtree refers to.
7253 If two domain elements appear in distinct filters then the sequence
7254 node orders them according to the child positions of the corresponding
7255 filter nodes.
7257 =item C<isl_schedule_node_set>
7259 A set node is similar to a sequence node, except that
7260 it expresses that domain elements appearing in distinct filters
7261 may have any order.  The order of the children of a set node
7262 is therefore also immaterial.
7264 =back
7266 A schedule tree is encapsulated in an C<isl_schedule> object.
7267 The simplest such objects, those with a tree consisting of single domain node,
7268 can be created using the following functions with either an empty
7269 domain or a given domain.
7271         #include <isl/schedule.h>
7272         __isl_give isl_schedule *isl_schedule_empty(
7273                 __isl_take isl_space *space);
7274         __isl_give isl_schedule *isl_schedule_from_domain(
7275                 __isl_take isl_union_set *domain);
7277 The function C<isl_schedule_constraints_compute_schedule> described
7278 in L</"Scheduling"> can also be used to construct schedules.
7280 C<isl_schedule> objects may be copied and freed using the following functions.
7282         #include <isl/schedule.h>
7283         __isl_give isl_schedule *isl_schedule_copy(
7284                 __isl_keep isl_schedule *sched);
7285         __isl_null isl_schedule *isl_schedule_free(
7286                 __isl_take isl_schedule *sched);
7288 The following functions checks whether two C<isl_schedule> objects
7289 are obviously the same.
7291         #include <isl/schedule.h>
7292         int isl_schedule_plain_is_equal(
7293                 __isl_keep isl_schedule *schedule1,
7294                 __isl_keep isl_schedule *schedule2);
7296 The domain of the schedule, i.e., the domain described by the root node,
7297 can be obtained using the following function.
7299         #include <isl/schedule.h>
7300         __isl_give isl_union_set *isl_schedule_get_domain(
7301                 __isl_keep isl_schedule *schedule);
7303 An extra top-level band node (right underneath the domain node) can
7304 be introduced into the schedule using the following function.
7306         #include <isl/schedule.h>
7307         __isl_give isl_schedule *
7308         isl_schedule_insert_partial_schedule(
7309                 __isl_take isl_schedule *schedule,
7310                 __isl_take isl_multi_union_pw_aff *partial);
7312 A schedule that combines two schedules either in the given
7313 order or in an arbitrary order, i.e., with an C<isl_schedule_node_sequence>
7314 or an C<isl_schedule_node_set> node,
7315 can be created using the following functions.
7317         #include <isl/schedule.h>
7318         __isl_give isl_schedule *isl_schedule_sequence(
7319                 __isl_take isl_schedule *schedule1,
7320                 __isl_take isl_schedule *schedule2);
7321         __isl_give isl_schedule *isl_schedule_set(
7322                 __isl_take isl_schedule *schedule1,
7323                 __isl_take isl_schedule *schedule2);
7325 The domains of the two input schedules need to be disjoint.
7327 An C<isl_union_map> representation of the schedule can be obtained
7328 from an C<isl_schedule> using the following function.
7330         #include <isl/schedule.h>
7331         __isl_give isl_union_map *isl_schedule_get_map(
7332                 __isl_keep isl_schedule *sched);
7334 The resulting relation encodes the same relative ordering as
7335 the schedule by mapping the domain elements to a common schedule space.
7336 If the schedule_separate_components option is set, then the order
7337 of the children of a set node is explicitly encoded in the result.
7339 Schedules can be read from input using the following functions.
7341         #include <isl/schedule.h>
7342         __isl_give isl_schedule *isl_schedule_read_from_file(
7343                 isl_ctx *ctx, FILE *input);
7344         __isl_give isl_schedule *isl_schedule_read_from_str(
7345                 isl_ctx *ctx, const char *str);
7347 A representation of the schedule can be printed using
7349         #include <isl/schedule.h>
7350         __isl_give isl_printer *isl_printer_print_schedule(
7351                 __isl_take isl_printer *p,
7352                 __isl_keep isl_schedule *schedule);
7354 The schedule tree can be traversed through the use of
7355 C<isl_schedule_node> objects that point to a particular
7356 position in the schedule tree.  Whenever a C<isl_schedule_node>
7357 is use to modify a node in the schedule tree, the original schedule
7358 tree is left untouched and the modifications are performed to a copy
7359 of the tree.  The returned C<isl_schedule_node> then points to
7360 this modified copy of the tree.
7362 The root of the schedule tree can be obtained using the following function.
7364         #include <isl/schedule.h>
7365         __isl_give isl_schedule_node *isl_schedule_get_root(
7366                 __isl_keep isl_schedule *schedule);
7368 A pointer to a newly created schedule tree with a single domain
7369 node can be created using the following function.
7371         #include <isl/schedule_node.h>
7372         __isl_give isl_schedule_node *
7373         isl_schedule_node_from_domain(
7374                 __isl_take isl_union_set *domain);
7376 Schedule nodes can be copied and freed using the following functions.
7378         #include <isl/schedule_node.h>
7379         __isl_give isl_schedule_node *isl_schedule_node_copy(
7380                 __isl_keep isl_schedule_node *node);
7381         __isl_null isl_schedule_node *isl_schedule_node_free(
7382                 __isl_take isl_schedule_node *node);
7384 The following properties can be obtained from a schedule node.
7386         #include <isl/schedule_node.h>
7387         enum isl_schedule_node_type isl_schedule_node_get_type(
7388                 __isl_keep isl_schedule_node *node);
7389         enum isl_schedule_node_type
7390         isl_schedule_node_get_parent_type(
7391                 __isl_keep isl_schedule_node *node);
7392         __isl_give isl_schedule *isl_schedule_node_get_schedule(
7393                 __isl_keep isl_schedule_node *node);
7395 The function C<isl_schedule_node_get_type> returns the type of
7396 the node, while C<isl_schedule_node_get_parent_type> returns
7397 type of the parent of the node, which is required to exist.
7398 The function C<isl_schedule_node_get_schedule> returns a copy
7399 to the schedule to which the node belongs.
7401 The following functions can be used to move the schedule node
7402 to a different position in the tree or to check if such a position
7403 exists.
7405         #include <isl/schedule_node.h>
7406         int isl_schedule_node_has_parent(
7407                 __isl_keep isl_schedule_node *node);
7408         __isl_give isl_schedule_node *isl_schedule_node_parent(
7409                 __isl_take isl_schedule_node *node);
7410         int isl_schedule_node_n_children(
7411                 __isl_keep isl_schedule_node *node);
7412         __isl_give isl_schedule_node *isl_schedule_node_child(
7413                 __isl_take isl_schedule_node *node, int pos);
7414         int isl_schedule_node_has_children(
7415                 __isl_keep isl_schedule_node *node);
7416         __isl_give isl_schedule_node *isl_schedule_node_first_child(
7417                 __isl_take isl_schedule_node *node);
7418         int isl_schedule_node_has_previous_sibling(
7419                 __isl_keep isl_schedule_node *node);
7420         __isl_give isl_schedule_node *
7421         isl_schedule_node_previous_sibling(
7422                 __isl_take isl_schedule_node *node);
7423         int isl_schedule_node_has_next_sibling(
7424                 __isl_keep isl_schedule_node *node);
7425         __isl_give isl_schedule_node *
7426         isl_schedule_node_next_sibling(
7427                 __isl_take isl_schedule_node *node);
7429 It is also possible to query the number of ancestors of a node,
7430 the position of the current node
7431 within the children of its parent or to obtain a copy of a given
7432 child without destroying the current node.
7434         #include <isl/schedule_node.h>
7435         int isl_schedule_node_get_tree_depth(
7436                 __isl_keep isl_schedule_node *node);
7437         int isl_schedule_node_get_child_position(
7438                 __isl_keep isl_schedule_node *node);
7439         __isl_give isl_schedule_node *isl_schedule_node_get_child(
7440                 __isl_keep isl_schedule_node *node, int pos);
7442 All nodes in a schedule tree or
7443 all descendants of a specific node (including the node) can be visited
7444 in depth-first pre-order using the following functions.
7446         #include <isl/schedule.h>
7447         int isl_schedule_foreach_schedule_node(
7448                 __isl_keep isl_schedule *sched,
7449                 int (*fn)(__isl_keep isl_schedule_node *node,
7450                         void *user), void *user);
7452         #include <isl/schedule_node.h>
7453         int isl_schedule_node_foreach_descendant(
7454                 __isl_keep isl_schedule_node *node,
7455                 int (*fn)(__isl_keep isl_schedule_node *node,
7456                         void *user), void *user);
7458 The callback function is slightly different from the usual
7459 callbacks in that it not only indicates success (non-negative result)
7460 or failure (negative result), but also indicates whether the children
7461 of the given node should be visited.  In particular, if the callback
7462 returns a positive value, then the children are visited, but if
7463 the callback returns zero, then the children are not visited.
7465 The following functions allows for a depth-first post-order
7466 traversal of the nodes in a schedule tree or
7467 of the descendants of a specific node (including the node
7468 itself), where the user callback is allowed to modify the
7469 visited node.
7471         #include <isl/schedule.h>
7472         __isl_give isl_schedule *isl_schedule_map_schedule_node(
7473                 __isl_take isl_schedule *schedule,
7474                 __isl_give isl_schedule_node *(*fn)(
7475                         __isl_take isl_schedule_node *node,
7476                         void *user), void *user);
7478         #include <isl/schedule_node.h>
7479         __isl_give isl_schedule_node *
7480         isl_schedule_node_map_descendant(
7481                 __isl_take isl_schedule_node *node,
7482                 __isl_give isl_schedule_node *(*fn)(
7483                         __isl_take isl_schedule_node *node,
7484                         void *user), void *user);
7486 The traversal continues from the node returned by the callback function.
7487 It is the responsibility of the user to ensure that this does not
7488 lead to an infinite loop.  It is safest to always return a pointer
7489 to the same position (same ancestors and child positions) as the input node.
7491 Several node types have their own functions for querying
7492 (and in some cases setting) some node type specific properties.
7494         #include <isl/schedule_node.h>
7495         __isl_give isl_space *isl_schedule_node_band_get_space(
7496                 __isl_keep isl_schedule_node *node);
7497         __isl_give isl_multi_union_pw_aff *
7498         isl_schedule_node_band_get_partial_schedule(
7499                 __isl_keep isl_schedule_node *node);
7500         __isl_give isl_union_map *
7501         isl_schedule_node_band_get_partial_schedule_union_map(
7502                 __isl_keep isl_schedule_node *node);
7503         unsigned isl_schedule_node_band_n_member(
7504                 __isl_keep isl_schedule_node *node);
7505         int isl_schedule_node_band_member_get_coincident(
7506                 __isl_keep isl_schedule_node *node, int pos);
7507         __isl_give isl_schedule_node *
7508         isl_schedule_node_band_member_set_coincident(
7509                 __isl_take isl_schedule_node *node, int pos,
7510                 int coincident);
7511         int isl_schedule_node_band_get_permutable(
7512                 __isl_keep isl_schedule_node *node);
7513         __isl_give isl_schedule_node *
7514         isl_schedule_node_band_set_permutable(
7515                 __isl_take isl_schedule_node *node, int permutable);
7517 The function C<isl_schedule_node_band_get_space> returns the space
7518 of the partial schedule of the band.
7519 The function C<isl_schedule_node_band_get_partial_schedule_union_map>
7520 returns a representation of the partial schedule of the band node
7521 in the form of an C<isl_union_map>.
7522 The coincident and permutable properties are set by
7523 C<isl_schedule_constraints_compute_schedule> on the schedule tree
7524 it produces.
7525 A scheduling dimension is considered to be ``coincident''
7526 if it satisfies the coincidence constraints within its band.
7527 That is, if the dependence distances of the coincidence
7528 constraints are all zero in that direction (for fixed
7529 iterations of outer bands).
7530 A band is marked permutable if it was produced using the Pluto-like scheduler.
7531 Note that the scheduler may have to resort to a Feautrier style scheduling
7532 step even if the default scheduler is used.
7534         #include <isl/schedule_node.h>
7535         __isl_give isl_union_set *
7536         isl_schedule_node_domain_get_domain(
7537                 __isl_keep isl_schedule_node *node);
7539         #include <isl/schedule_node.h>
7540         __isl_give isl_union_set *
7541         isl_schedule_node_filter_get_filter(
7542                 __isl_keep isl_schedule_node *node);
7544 The following functions can be used to obtain an C<isl_union_pw_multi_aff>
7545 or C<isl_union_map> representation of partial schedules related to the node.
7547         #include <isl/schedule_node.h>
7548         __isl_give isl_union_pw_multi_aff *
7549         isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(
7550                 __isl_keep isl_schedule_node *node);
7551         __isl_give isl_union_map *
7552         isl_schedule_node_get_prefix_schedule_union_map(
7553                 __isl_keep isl_schedule_node *node);
7554         __isl_give isl_union_map *
7555         isl_schedule_node_get_subtree_schedule_union_map(
7556                 __isl_keep isl_schedule_node *node);
7558 In particular, the functions
7559 C<isl_schedule_node_get_prefix_schedule_union_pw_multi_aff>
7560 and C<isl_schedule_node_get_prefix_schedule_union_map>
7561 return a relative ordering on the domain elements that reach the given
7562 node determined by its ancestors.
7563 The function C<isl_schedule_node_get_subtree_schedule_union_map>
7564 returns a representation of the partial schedule defined by the
7565 subtree rooted at the given node.
7567 The following function returns the union of universes in the spaces that
7568 contain elements that reach the given node.
7570         #include <isl/schedule_node.h>
7571         __isl_give isl_union_set *
7572         isl_schedule_node_get_universe_domain(
7573                 __isl_keep isl_schedule_node *node);
7575 The following functions can be used to introduce additional nodes
7576 in the schedule tree.  The new node is introduced at the point
7577 in the tree where the C<isl_schedule_node> points to and
7578 the results points to the new node.
7580         #include <isl/schedule_node.h>
7581         __isl_give isl_schedule_node *
7582         isl_schedule_node_insert_partial_schedule(
7583                 __isl_take isl_schedule_node *node,
7584                 __isl_take isl_multi_union_pw_aff *schedule);
7586 This function inserts a new band node with (the greatest integer
7587 part of) the given partial schedule.
7589         #include <isl/schedule_node.h>
7590         __isl_give isl_schedule_node *
7591         isl_schedule_node_insert_filter(
7592                 __isl_take isl_schedule_node *node,
7593                 __isl_take isl_union_set *filter);
7595 This function inserts a new filter node with the given filter.
7596 If the original node already pointed to a filter node, then the
7597 two filter nodes are merged into one.
7599         #include <isl/schedule_node.h>
7600         __isl_give isl_schedule_node *
7601         isl_schedule_node_insert_sequence(
7602                 __isl_take isl_schedule_node *node,
7603                 __isl_take isl_union_set_list *filters);
7604         __isl_give isl_schedule_node *
7605         isl_schedule_node_insert_set(
7606                 __isl_take isl_schedule_node *node,
7607                 __isl_take isl_union_set_list *filters);
7609 These functions insert a new sequence or set node with the given
7610 filters as children.
7612 The partial schedule of a band node can be scaled (down) using
7613 the following functions.
7615         #include <isl/schedule_node.h>
7616         __isl_give isl_schedule_node *
7617         isl_schedule_node_band_scale(
7618                 __isl_take isl_schedule_node *node,
7619                 __isl_take isl_multi_val *mv);
7620         __isl_give isl_schedule_node *
7621         isl_schedule_node_band_scale_down(
7622                 __isl_take isl_schedule_node *node,
7623                 __isl_take isl_multi_val *mv);
7625 The spaces of the two arguments need to match.
7626 After scaling, the partial schedule is replaced by its greatest
7627 integer part to ensure that the schedule remains integral.
7629 A band node can be tiled using the following function.
7631         #include <isl/schedule_node.h>
7632         __isl_give isl_schedule_node *isl_schedule_node_band_tile(
7633                 __isl_take isl_schedule_node *node,
7634                 __isl_take isl_multi_val *sizes);
7636         int isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
7637                 int val);
7638         int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
7639         int isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
7640                 int val);
7641         int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
7643 The C<isl_schedule_node_band_tile> function tiles
7644 the band using the given tile sizes inside its schedule.
7645 A new child band node is created to represent the point loops and it is
7646 inserted between the modified band and its children.
7647 The C<tile_scale_tile_loops> option specifies whether the tile
7648 loops iterators should be scaled by the tile sizes.
7649 If the C<tile_shift_point_loops> option is set, then the point loops
7650 are shifted to start at zero.
7652 A band node can be split into two nested band nodes
7653 using the following function.
7655         #include <isl/schedule_node.h>
7656         __isl_give isl_schedule_node *isl_schedule_node_band_split(
7657                 __isl_take isl_schedule_node *node, int pos);
7659 The resulting outer band node contains the first C<pos> dimensions of
7660 the schedule of C<node> while the inner band contains the remaining dimensions.
7661 The schedules of the two band nodes live in anonymous spaces.
7663 A band node can be moved down to the leaves of the subtree rooted
7664 at the band node using the following function.
7666         #include <isl/schedule_node.h>
7667         __isl_give isl_schedule_node *isl_schedule_node_band_sink(
7668                 __isl_take isl_schedule_node *node);
7670 The result points to the node in the resulting tree that is in the same
7671 position as the node pointed to by C<node> in the original tree.
7673 A representation of the schedule node can be printed using
7675         #include <isl/schedule_node.h>
7676         __isl_give isl_printer *isl_printer_print_schedule_node(
7677                 __isl_take isl_printer *p,
7678                 __isl_keep isl_schedule_node *node);
7680 =head2 Dependence Analysis
7682 C<isl> contains specialized functionality for performing
7683 array dataflow analysis.  That is, given a I<sink> access relation
7684 and a collection of possible I<source> access relations,
7685 C<isl> can compute relations that describe
7686 for each iteration of the sink access, which iteration
7687 of which of the source access relations was the last
7688 to access the same data element before the given iteration
7689 of the sink access.
7690 The resulting dependence relations map source iterations
7691 to the corresponding sink iterations.
7692 To compute standard flow dependences, the sink should be
7693 a read, while the sources should be writes.
7694 If any of the source accesses are marked as being I<may>
7695 accesses, then there will be a dependence from the last
7696 I<must> access B<and> from any I<may> access that follows
7697 this last I<must> access.
7698 In particular, if I<all> sources are I<may> accesses,
7699 then memory based dependence analysis is performed.
7700 If, on the other hand, all sources are I<must> accesses,
7701 then value based dependence analysis is performed.
7703         #include <isl/flow.h>
7705         typedef int (*isl_access_level_before)(void *first, void *second);
7707         __isl_give isl_access_info *isl_access_info_alloc(
7708                 __isl_take isl_map *sink,
7709                 void *sink_user, isl_access_level_before fn,
7710                 int max_source);
7711         __isl_give isl_access_info *isl_access_info_add_source(
7712                 __isl_take isl_access_info *acc,
7713                 __isl_take isl_map *source, int must,
7714                 void *source_user);
7715         __isl_null isl_access_info *isl_access_info_free(
7716                 __isl_take isl_access_info *acc);
7718         __isl_give isl_flow *isl_access_info_compute_flow(
7719                 __isl_take isl_access_info *acc);
7721         int isl_flow_foreach(__isl_keep isl_flow *deps,
7722                 int (*fn)(__isl_take isl_map *dep, int must,
7723                           void *dep_user, void *user),
7724                 void *user);
7725         __isl_give isl_map *isl_flow_get_no_source(
7726                 __isl_keep isl_flow *deps, int must);
7727         void isl_flow_free(__isl_take isl_flow *deps);
7729 The function C<isl_access_info_compute_flow> performs the actual
7730 dependence analysis.  The other functions are used to construct
7731 the input for this function or to read off the output.
7733 The input is collected in an C<isl_access_info>, which can
7734 be created through a call to C<isl_access_info_alloc>.
7735 The arguments to this functions are the sink access relation
7736 C<sink>, a token C<sink_user> used to identify the sink
7737 access to the user, a callback function for specifying the
7738 relative order of source and sink accesses, and the number
7739 of source access relations that will be added.
7740 The callback function has type C<int (*)(void *first, void *second)>.
7741 The function is called with two user supplied tokens identifying
7742 either a source or the sink and it should return the shared nesting
7743 level and the relative order of the two accesses.
7744 In particular, let I<n> be the number of loops shared by
7745 the two accesses.  If C<first> precedes C<second> textually,
7746 then the function should return I<2 * n + 1>; otherwise,
7747 it should return I<2 * n>.
7748 The sources can be added to the C<isl_access_info> by performing
7749 (at most) C<max_source> calls to C<isl_access_info_add_source>.
7750 C<must> indicates whether the source is a I<must> access
7751 or a I<may> access.  Note that a multi-valued access relation
7752 should only be marked I<must> if every iteration in the domain
7753 of the relation accesses I<all> elements in its image.
7754 The C<source_user> token is again used to identify
7755 the source access.  The range of the source access relation
7756 C<source> should have the same dimension as the range
7757 of the sink access relation.
7758 The C<isl_access_info_free> function should usually not be
7759 called explicitly, because it is called implicitly by
7760 C<isl_access_info_compute_flow>.
7762 The result of the dependence analysis is collected in an
7763 C<isl_flow>.  There may be elements of
7764 the sink access for which no preceding source access could be
7765 found or for which all preceding sources are I<may> accesses.
7766 The relations containing these elements can be obtained through
7767 calls to C<isl_flow_get_no_source>, the first with C<must> set
7768 and the second with C<must> unset.
7769 In the case of standard flow dependence analysis,
7770 with the sink a read and the sources I<must> writes,
7771 the first relation corresponds to the reads from uninitialized
7772 array elements and the second relation is empty.
7773 The actual flow dependences can be extracted using
7774 C<isl_flow_foreach>.  This function will call the user-specified
7775 callback function C<fn> for each B<non-empty> dependence between
7776 a source and the sink.  The callback function is called
7777 with four arguments, the actual flow dependence relation
7778 mapping source iterations to sink iterations, a boolean that
7779 indicates whether it is a I<must> or I<may> dependence, a token
7780 identifying the source and an additional C<void *> with value
7781 equal to the third argument of the C<isl_flow_foreach> call.
7782 A dependence is marked I<must> if it originates from a I<must>
7783 source and if it is not followed by any I<may> sources.
7785 After finishing with an C<isl_flow>, the user should call
7786 C<isl_flow_free> to free all associated memory.
7788 A higher-level interface to dependence analysis is provided
7789 by the following function.
7791         #include <isl/flow.h>
7793         int isl_union_map_compute_flow(__isl_take isl_union_map *sink,
7794                 __isl_take isl_union_map *must_source,
7795                 __isl_take isl_union_map *may_source,
7796                 __isl_take isl_union_map *schedule,
7797                 __isl_give isl_union_map **must_dep,
7798                 __isl_give isl_union_map **may_dep,
7799                 __isl_give isl_union_map **must_no_source,
7800                 __isl_give isl_union_map **may_no_source);
7802 The arrays are identified by the tuple names of the ranges
7803 of the accesses.  The iteration domains by the tuple names
7804 of the domains of the accesses and of the schedule.
7805 The relative order of the iteration domains is given by the
7806 schedule.  The relations returned through C<must_no_source>
7807 and C<may_no_source> are subsets of C<sink>.
7808 Any of C<must_dep>, C<may_dep>, C<must_no_source>
7809 or C<may_no_source> may be C<NULL>, but a C<NULL> value for
7810 any of the other arguments is treated as an error.
7812 =head3 Interaction with Dependence Analysis
7814 During the dependence analysis, we frequently need to perform
7815 the following operation.  Given a relation between sink iterations
7816 and potential source iterations from a particular source domain,
7817 what is the last potential source iteration corresponding to each
7818 sink iteration.  It can sometimes be convenient to adjust
7819 the set of potential source iterations before or after each such operation.
7820 The prototypical example is fuzzy array dataflow analysis,
7821 where we need to analyze if, based on data-dependent constraints,
7822 the sink iteration can ever be executed without one or more of
7823 the corresponding potential source iterations being executed.
7824 If so, we can introduce extra parameters and select an unknown
7825 but fixed source iteration from the potential source iterations.
7826 To be able to perform such manipulations, C<isl> provides the following
7827 function.
7829         #include <isl/flow.h>
7831         typedef __isl_give isl_restriction *(*isl_access_restrict)(
7832                 __isl_keep isl_map *source_map,
7833                 __isl_keep isl_set *sink, void *source_user,
7834                 void *user);
7835         __isl_give isl_access_info *isl_access_info_set_restrict(
7836                 __isl_take isl_access_info *acc,
7837                 isl_access_restrict fn, void *user);
7839 The function C<isl_access_info_set_restrict> should be called
7840 before calling C<isl_access_info_compute_flow> and registers a callback function
7841 that will be called any time C<isl> is about to compute the last
7842 potential source.  The first argument is the (reverse) proto-dependence,
7843 mapping sink iterations to potential source iterations.
7844 The second argument represents the sink iterations for which
7845 we want to compute the last source iteration.
7846 The third argument is the token corresponding to the source
7847 and the final argument is the token passed to C<isl_access_info_set_restrict>.
7848 The callback is expected to return a restriction on either the input or
7849 the output of the operation computing the last potential source.
7850 If the input needs to be restricted then restrictions are needed
7851 for both the source and the sink iterations.  The sink iterations
7852 and the potential source iterations will be intersected with these sets.
7853 If the output needs to be restricted then only a restriction on the source
7854 iterations is required.
7855 If any error occurs, the callback should return C<NULL>.
7856 An C<isl_restriction> object can be created, freed and inspected
7857 using the following functions.
7859         #include <isl/flow.h>
7861         __isl_give isl_restriction *isl_restriction_input(
7862                 __isl_take isl_set *source_restr,
7863                 __isl_take isl_set *sink_restr);
7864         __isl_give isl_restriction *isl_restriction_output(
7865                 __isl_take isl_set *source_restr);
7866         __isl_give isl_restriction *isl_restriction_none(
7867                 __isl_take isl_map *source_map);
7868         __isl_give isl_restriction *isl_restriction_empty(
7869                 __isl_take isl_map *source_map);
7870         __isl_null isl_restriction *isl_restriction_free(
7871                 __isl_take isl_restriction *restr);
7873 C<isl_restriction_none> and C<isl_restriction_empty> are special
7874 cases of C<isl_restriction_input>.  C<isl_restriction_none>
7875 is essentially equivalent to
7877         isl_restriction_input(isl_set_universe(
7878             isl_space_range(isl_map_get_space(source_map))),
7879                             isl_set_universe(
7880             isl_space_domain(isl_map_get_space(source_map))));
7882 whereas C<isl_restriction_empty> is essentially equivalent to
7884         isl_restriction_input(isl_set_empty(
7885             isl_space_range(isl_map_get_space(source_map))),
7886                             isl_set_universe(
7887             isl_space_domain(isl_map_get_space(source_map))));
7889 =head2 Scheduling
7891 B<The functionality described in this section is fairly new
7892 and may be subject to change.>
7894         #include <isl/schedule.h>
7895         __isl_give isl_schedule *
7896         isl_schedule_constraints_compute_schedule(
7897                 __isl_take isl_schedule_constraints *sc);
7899 The function C<isl_schedule_constraints_compute_schedule> can be
7900 used to compute a schedule that satisfies the given schedule constraints.
7901 These schedule constraints include the iteration domain for which
7902 a schedule should be computed and dependences between pairs of
7903 iterations.  In particular, these dependences include
7904 I<validity> dependences and I<proximity> dependences.
7905 By default, the algorithm used to construct the schedule is similar
7906 to that of C<Pluto>.
7907 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
7908 be selected.
7909 The generated schedule respects all validity dependences.
7910 That is, all dependence distances over these dependences in the
7911 scheduled space are lexicographically positive.
7912 The default algorithm tries to ensure that the dependence distances
7913 over coincidence constraints are zero and to minimize the
7914 dependence distances over proximity dependences.
7915 Moreover, it tries to obtain sequences (bands) of schedule dimensions
7916 for groups of domains where the dependence distances over validity
7917 dependences have only non-negative values.
7918 When using Feautrier's algorithm, the coincidence and proximity constraints
7919 are only taken into account during the extension to a
7920 full-dimensional schedule.
7922 An C<isl_schedule_constraints> object can be constructed
7923 and manipulated using the following functions.
7925         #include <isl/schedule.h>
7926         __isl_give isl_schedule_constraints *
7927         isl_schedule_constraints_copy(
7928                 __isl_keep isl_schedule_constraints *sc);
7929         __isl_give isl_schedule_constraints *
7930         isl_schedule_constraints_on_domain(
7931                 __isl_take isl_union_set *domain);
7932         __isl_give isl_schedule_constraints *
7933         isl_schedule_constraints_set_context(
7934                 __isl_take isl_schedule_constraints *sc,
7935                 __isl_take isl_set *context);
7936         __isl_give isl_schedule_constraints *
7937         isl_schedule_constraints_set_validity(
7938                 __isl_take isl_schedule_constraints *sc,
7939                 __isl_take isl_union_map *validity);
7940         __isl_give isl_schedule_constraints *
7941         isl_schedule_constraints_set_coincidence(
7942                 __isl_take isl_schedule_constraints *sc,
7943                 __isl_take isl_union_map *coincidence);
7944         __isl_give isl_schedule_constraints *
7945         isl_schedule_constraints_set_proximity(
7946                 __isl_take isl_schedule_constraints *sc,
7947                 __isl_take isl_union_map *proximity);
7948         __isl_give isl_schedule_constraints *
7949         isl_schedule_constraints_set_conditional_validity(
7950                 __isl_take isl_schedule_constraints *sc,
7951                 __isl_take isl_union_map *condition,
7952                 __isl_take isl_union_map *validity);
7953         __isl_null isl_schedule_constraints *
7954         isl_schedule_constraints_free(
7955                 __isl_take isl_schedule_constraints *sc);
7957 The initial C<isl_schedule_constraints> object created by
7958 C<isl_schedule_constraints_on_domain> does not impose any constraints.
7959 That is, it has an empty set of dependences.
7960 The function C<isl_schedule_constraints_set_context> allows the user
7961 to specify additional constraints on the parameters that may
7962 be assumed to hold during the construction of the schedule.
7963 The function C<isl_schedule_constraints_set_validity> replaces the
7964 validity dependences, mapping domain elements I<i> to domain
7965 elements that should be scheduled after I<i>.
7966 The function C<isl_schedule_constraints_set_coincidence> replaces the
7967 coincidence dependences, mapping domain elements I<i> to domain
7968 elements that should be scheduled together with I<I>, if possible.
7969 The function C<isl_schedule_constraints_set_proximity> replaces the
7970 proximity dependences, mapping domain elements I<i> to domain
7971 elements that should be scheduled either before I<I>
7972 or as early as possible after I<i>.
7974 The function C<isl_schedule_constraints_set_conditional_validity>
7975 replaces the conditional validity constraints.
7976 A conditional validity constraint is only imposed when any of the corresponding
7977 conditions is satisfied, i.e., when any of them is non-zero.
7978 That is, the scheduler ensures that within each band if the dependence
7979 distances over the condition constraints are not all zero
7980 then all corresponding conditional validity constraints are respected.
7981 A conditional validity constraint corresponds to a condition
7982 if the two are adjacent, i.e., if the domain of one relation intersect
7983 the range of the other relation.
7984 The typical use case of conditional validity constraints is
7985 to allow order constraints between live ranges to be violated
7986 as long as the live ranges themselves are local to the band.
7987 To allow more fine-grained control over which conditions correspond
7988 to which conditional validity constraints, the domains and ranges
7989 of these relations may include I<tags>.  That is, the domains and
7990 ranges of those relation may themselves be wrapped relations
7991 where the iteration domain appears in the domain of those wrapped relations
7992 and the range of the wrapped relations can be arbitrarily chosen
7993 by the user.  Conditions and conditional validity constraints are only
7994 considered adjacent to each other if the entire wrapped relation matches.
7995 In particular, a relation with a tag will never be considered adjacent
7996 to a relation without a tag.
7998 The following function computes a schedule directly from
7999 an iteration domain and validity and proximity dependences
8000 and is implemented in terms of the functions described above.
8001 The use of C<isl_union_set_compute_schedule> is discouraged.
8003         #include <isl/schedule.h>
8004         __isl_give isl_schedule *isl_union_set_compute_schedule(
8005                 __isl_take isl_union_set *domain,
8006                 __isl_take isl_union_map *validity,
8007                 __isl_take isl_union_map *proximity);
8009 The generated schedule represents a schedule tree.
8010 For more information on schedule trees, see
8011 L</"Schedule Trees">.
8013 =head3 Options
8015         #include <isl/schedule.h>
8016         int isl_options_set_schedule_max_coefficient(
8017                 isl_ctx *ctx, int val);
8018         int isl_options_get_schedule_max_coefficient(
8019                 isl_ctx *ctx);
8020         int isl_options_set_schedule_max_constant_term(
8021                 isl_ctx *ctx, int val);
8022         int isl_options_get_schedule_max_constant_term(
8023                 isl_ctx *ctx);
8024         int isl_options_set_schedule_fuse(isl_ctx *ctx, int val);
8025         int isl_options_get_schedule_fuse(isl_ctx *ctx);
8026         int isl_options_set_schedule_maximize_band_depth(
8027                 isl_ctx *ctx, int val);
8028         int isl_options_get_schedule_maximize_band_depth(
8029                 isl_ctx *ctx);
8030         int isl_options_set_schedule_outer_coincidence(
8031                 isl_ctx *ctx, int val);
8032         int isl_options_get_schedule_outer_coincidence(
8033                 isl_ctx *ctx);
8034         int isl_options_set_schedule_split_scaled(
8035                 isl_ctx *ctx, int val);
8036         int isl_options_get_schedule_split_scaled(
8037                 isl_ctx *ctx);
8038         int isl_options_set_schedule_algorithm(
8039                 isl_ctx *ctx, int val);
8040         int isl_options_get_schedule_algorithm(
8041                 isl_ctx *ctx);
8042         int isl_options_set_schedule_separate_components(
8043                 isl_ctx *ctx, int val);
8044         int isl_options_get_schedule_separate_components(
8045                 isl_ctx *ctx);
8047 =over
8049 =item * schedule_max_coefficient
8051 This option enforces that the coefficients for variable and parameter
8052 dimensions in the calculated schedule are not larger than the specified value.
8053 This option can significantly increase the speed of the scheduling calculation
8054 and may also prevent fusing of unrelated dimensions. A value of -1 means that
8055 this option does not introduce bounds on the variable or parameter
8056 coefficients.
8058 =item * schedule_max_constant_term
8060 This option enforces that the constant coefficients in the calculated schedule
8061 are not larger than the maximal constant term. This option can significantly
8062 increase the speed of the scheduling calculation and may also prevent fusing of
8063 unrelated dimensions. A value of -1 means that this option does not introduce
8064 bounds on the constant coefficients.
8066 =item * schedule_fuse
8068 This option controls the level of fusion.
8069 If this option is set to C<ISL_SCHEDULE_FUSE_MIN>, then loops in the
8070 resulting schedule will be distributed as much as possible.
8071 If this option is set to C<ISL_SCHEDULE_FUSE_MAX>, then C<isl> will
8072 try to fuse loops in the resulting schedule.
8074 =item * schedule_maximize_band_depth
8076 If this option is set, we do not split bands at the point
8077 where we detect splitting is necessary. Instead, we
8078 backtrack and split bands as early as possible. This
8079 reduces the number of splits and maximizes the width of
8080 the bands. Wider bands give more possibilities for tiling.
8081 Note that if the C<schedule_fuse> option is set to C<ISL_SCHEDULE_FUSE_MIN>,
8082 then bands will be split as early as possible, even if there is no need.
8083 The C<schedule_maximize_band_depth> option therefore has no effect in this case.
8085 =item * schedule_outer_coincidence
8087 If this option is set, then we try to construct schedules
8088 where the outermost scheduling dimension in each band
8089 satisfies the coincidence constraints.
8091 =item * schedule_split_scaled
8093 If this option is set, then we try to construct schedules in which the
8094 constant term is split off from the linear part if the linear parts of
8095 the scheduling rows for all nodes in the graphs have a common non-trivial
8096 divisor.
8097 The constant term is then placed in a separate band and the linear
8098 part is reduced.
8100 =item * schedule_algorithm
8102 Selects the scheduling algorithm to be used.
8103 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
8104 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
8106 =item * schedule_separate_components
8108 If this option is set then the function C<isl_schedule_get_map>
8109 will treat set nodes in the same way as sequence nodes.
8111 =back
8113 =head2 AST Generation
8115 This section describes the C<isl> functionality for generating
8116 ASTs that visit all the elements
8117 in a domain in an order specified by a schedule.
8118 In particular, given a C<isl_union_map>, an AST is generated
8119 that visits all the elements in the domain of the C<isl_union_map>
8120 according to the lexicographic order of the corresponding image
8121 element(s).  If the range of the C<isl_union_map> consists of
8122 elements in more than one space, then each of these spaces is handled
8123 separately in an arbitrary order.
8124 It should be noted that the image elements only specify the I<order>
8125 in which the corresponding domain elements should be visited.
8126 No direct relation between the image elements and the loop iterators
8127 in the generated AST should be assumed.
8129 Each AST is generated within a build.  The initial build
8130 simply specifies the constraints on the parameters (if any)
8131 and can be created, inspected, copied and freed using the following functions.
8133         #include <isl/ast_build.h>
8134         __isl_give isl_ast_build *isl_ast_build_from_context(
8135                 __isl_take isl_set *set);
8136         __isl_give isl_ast_build *isl_ast_build_copy(
8137                 __isl_keep isl_ast_build *build);
8138         __isl_null isl_ast_build *isl_ast_build_free(
8139                 __isl_take isl_ast_build *build);
8141 The C<set> argument is usually a parameter set with zero or more parameters.
8142 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
8143 and L</"Fine-grained Control over AST Generation">.
8144 Finally, the AST itself can be constructed using the following
8145 function.
8147         #include <isl/ast_build.h>
8148         __isl_give isl_ast_node *isl_ast_build_ast_from_schedule(
8149                 __isl_keep isl_ast_build *build,
8150                 __isl_take isl_union_map *schedule);
8152 =head3 Inspecting the AST
8154 The basic properties of an AST node can be obtained as follows.
8156         #include <isl/ast.h>
8157         enum isl_ast_node_type isl_ast_node_get_type(
8158                 __isl_keep isl_ast_node *node);
8160 The type of an AST node is one of
8161 C<isl_ast_node_for>,
8162 C<isl_ast_node_if>,
8163 C<isl_ast_node_block> or
8164 C<isl_ast_node_user>.
8165 An C<isl_ast_node_for> represents a for node.
8166 An C<isl_ast_node_if> represents an if node.
8167 An C<isl_ast_node_block> represents a compound node.
8168 An C<isl_ast_node_user> represents an expression statement.
8169 An expression statement typically corresponds to a domain element, i.e.,
8170 one of the elements that is visited by the AST.
8172 Each type of node has its own additional properties.
8174         #include <isl/ast.h>
8175         __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
8176                 __isl_keep isl_ast_node *node);
8177         __isl_give isl_ast_expr *isl_ast_node_for_get_init(
8178                 __isl_keep isl_ast_node *node);
8179         __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
8180                 __isl_keep isl_ast_node *node);
8181         __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
8182                 __isl_keep isl_ast_node *node);
8183         __isl_give isl_ast_node *isl_ast_node_for_get_body(
8184                 __isl_keep isl_ast_node *node);
8185         int isl_ast_node_for_is_degenerate(
8186                 __isl_keep isl_ast_node *node);
8188 An C<isl_ast_for> is considered degenerate if it is known to execute
8189 exactly once.
8191         #include <isl/ast.h>
8192         __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
8193                 __isl_keep isl_ast_node *node);
8194         __isl_give isl_ast_node *isl_ast_node_if_get_then(
8195                 __isl_keep isl_ast_node *node);
8196         int isl_ast_node_if_has_else(
8197                 __isl_keep isl_ast_node *node);
8198         __isl_give isl_ast_node *isl_ast_node_if_get_else(
8199                 __isl_keep isl_ast_node *node);
8201         __isl_give isl_ast_node_list *
8202         isl_ast_node_block_get_children(
8203                 __isl_keep isl_ast_node *node);
8205         __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
8206                 __isl_keep isl_ast_node *node);
8208 Each of the returned C<isl_ast_expr>s can in turn be inspected using
8209 the following functions.
8211         #include <isl/ast.h>
8212         enum isl_ast_expr_type isl_ast_expr_get_type(
8213                 __isl_keep isl_ast_expr *expr);
8215 The type of an AST expression is one of
8216 C<isl_ast_expr_op>,
8217 C<isl_ast_expr_id> or
8218 C<isl_ast_expr_int>.
8219 An C<isl_ast_expr_op> represents the result of an operation.
8220 An C<isl_ast_expr_id> represents an identifier.
8221 An C<isl_ast_expr_int> represents an integer value.
8223 Each type of expression has its own additional properties.
8225         #include <isl/ast.h>
8226         enum isl_ast_op_type isl_ast_expr_get_op_type(
8227                 __isl_keep isl_ast_expr *expr);
8228         int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
8229         __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
8230                 __isl_keep isl_ast_expr *expr, int pos);
8231         int isl_ast_node_foreach_ast_op_type(
8232                 __isl_keep isl_ast_node *node,
8233                 int (*fn)(enum isl_ast_op_type type, void *user),
8234                 void *user);
8236 C<isl_ast_expr_get_op_type> returns the type of the operation
8237 performed.  C<isl_ast_expr_get_op_n_arg> returns the number of
8238 arguments.  C<isl_ast_expr_get_op_arg> returns the specified
8239 argument.
8240 C<isl_ast_node_foreach_ast_op_type> calls C<fn> for each distinct
8241 C<isl_ast_op_type> that appears in C<node>.
8242 The operation type is one of the following.
8244 =over
8246 =item C<isl_ast_op_and>
8248 Logical I<and> of two arguments.
8249 Both arguments can be evaluated.
8251 =item C<isl_ast_op_and_then>
8253 Logical I<and> of two arguments.
8254 The second argument can only be evaluated if the first evaluates to true.
8256 =item C<isl_ast_op_or>
8258 Logical I<or> of two arguments.
8259 Both arguments can be evaluated.
8261 =item C<isl_ast_op_or_else>
8263 Logical I<or> of two arguments.
8264 The second argument can only be evaluated if the first evaluates to false.
8266 =item C<isl_ast_op_max>
8268 Maximum of two or more arguments.
8270 =item C<isl_ast_op_min>
8272 Minimum of two or more arguments.
8274 =item C<isl_ast_op_minus>
8276 Change sign.
8278 =item C<isl_ast_op_add>
8280 Sum of two arguments.
8282 =item C<isl_ast_op_sub>
8284 Difference of two arguments.
8286 =item C<isl_ast_op_mul>
8288 Product of two arguments.
8290 =item C<isl_ast_op_div>
8292 Exact division.  That is, the result is known to be an integer.
8294 =item C<isl_ast_op_fdiv_q>
8296 Result of integer division, rounded towards negative
8297 infinity.
8299 =item C<isl_ast_op_pdiv_q>
8301 Result of integer division, where dividend is known to be non-negative.
8303 =item C<isl_ast_op_pdiv_r>
8305 Remainder of integer division, where dividend is known to be non-negative.
8307 =item C<isl_ast_op_zdiv_r>
8309 Equal to zero iff the remainder on integer division is zero.
8311 =item C<isl_ast_op_cond>
8313 Conditional operator defined on three arguments.
8314 If the first argument evaluates to true, then the result
8315 is equal to the second argument.  Otherwise, the result
8316 is equal to the third argument.
8317 The second and third argument may only be evaluated if
8318 the first argument evaluates to true and false, respectively.
8319 Corresponds to C<a ? b : c> in C.
8321 =item C<isl_ast_op_select>
8323 Conditional operator defined on three arguments.
8324 If the first argument evaluates to true, then the result
8325 is equal to the second argument.  Otherwise, the result
8326 is equal to the third argument.
8327 The second and third argument may be evaluated independently
8328 of the value of the first argument.
8329 Corresponds to C<a * b + (1 - a) * c> in C.
8331 =item C<isl_ast_op_eq>
8333 Equality relation.
8335 =item C<isl_ast_op_le>
8337 Less than or equal relation.
8339 =item C<isl_ast_op_lt>
8341 Less than relation.
8343 =item C<isl_ast_op_ge>
8345 Greater than or equal relation.
8347 =item C<isl_ast_op_gt>
8349 Greater than relation.
8351 =item C<isl_ast_op_call>
8353 A function call.
8354 The number of arguments of the C<isl_ast_expr> is one more than
8355 the number of arguments in the function call, the first argument
8356 representing the function being called.
8358 =item C<isl_ast_op_access>
8360 An array access.
8361 The number of arguments of the C<isl_ast_expr> is one more than
8362 the number of index expressions in the array access, the first argument
8363 representing the array being accessed.
8365 =item C<isl_ast_op_member>
8367 A member access.
8368 This operation has two arguments, a structure and the name of
8369 the member of the structure being accessed.
8371 =back
8373         #include <isl/ast.h>
8374         __isl_give isl_id *isl_ast_expr_get_id(
8375                 __isl_keep isl_ast_expr *expr);
8377 Return the identifier represented by the AST expression.
8379         #include <isl/ast.h>
8380         __isl_give isl_val *isl_ast_expr_get_val(
8381                 __isl_keep isl_ast_expr *expr);
8383 Return the integer represented by the AST expression.
8385 =head3 Properties of ASTs
8387         #include <isl/ast.h>
8388         int isl_ast_expr_is_equal(__isl_keep isl_ast_expr *expr1,
8389                 __isl_keep isl_ast_expr *expr2);
8391 Check if two C<isl_ast_expr>s are equal to each other.
8393 =head3 Manipulating and printing the AST
8395 AST nodes can be copied and freed using the following functions.
8397         #include <isl/ast.h>
8398         __isl_give isl_ast_node *isl_ast_node_copy(
8399                 __isl_keep isl_ast_node *node);
8400         __isl_null isl_ast_node *isl_ast_node_free(
8401                 __isl_take isl_ast_node *node);
8403 AST expressions can be copied and freed using the following functions.
8405         #include <isl/ast.h>
8406         __isl_give isl_ast_expr *isl_ast_expr_copy(
8407                 __isl_keep isl_ast_expr *expr);
8408         __isl_null isl_ast_expr *isl_ast_expr_free(
8409                 __isl_take isl_ast_expr *expr);
8411 New AST expressions can be created either directly or within
8412 the context of an C<isl_ast_build>.
8414         #include <isl/ast.h>
8415         __isl_give isl_ast_expr *isl_ast_expr_from_val(
8416                 __isl_take isl_val *v);
8417         __isl_give isl_ast_expr *isl_ast_expr_from_id(
8418                 __isl_take isl_id *id);
8419         __isl_give isl_ast_expr *isl_ast_expr_neg(
8420                 __isl_take isl_ast_expr *expr);
8421         __isl_give isl_ast_expr *isl_ast_expr_address_of(
8422                 __isl_take isl_ast_expr *expr);
8423         __isl_give isl_ast_expr *isl_ast_expr_add(
8424                 __isl_take isl_ast_expr *expr1,
8425                 __isl_take isl_ast_expr *expr2);
8426         __isl_give isl_ast_expr *isl_ast_expr_sub(
8427                 __isl_take isl_ast_expr *expr1,
8428                 __isl_take isl_ast_expr *expr2);
8429         __isl_give isl_ast_expr *isl_ast_expr_mul(
8430                 __isl_take isl_ast_expr *expr1,
8431                 __isl_take isl_ast_expr *expr2);
8432         __isl_give isl_ast_expr *isl_ast_expr_div(
8433                 __isl_take isl_ast_expr *expr1,
8434                 __isl_take isl_ast_expr *expr2);
8435         __isl_give isl_ast_expr *isl_ast_expr_and(
8436                 __isl_take isl_ast_expr *expr1,
8437                 __isl_take isl_ast_expr *expr2)
8438         __isl_give isl_ast_expr *isl_ast_expr_or(
8439                 __isl_take isl_ast_expr *expr1,
8440                 __isl_take isl_ast_expr *expr2)
8441         __isl_give isl_ast_expr *isl_ast_expr_eq(
8442                 __isl_take isl_ast_expr *expr1,
8443                 __isl_take isl_ast_expr *expr2);
8444         __isl_give isl_ast_expr *isl_ast_expr_le(
8445                 __isl_take isl_ast_expr *expr1,
8446                 __isl_take isl_ast_expr *expr2);
8447         __isl_give isl_ast_expr *isl_ast_expr_lt(
8448                 __isl_take isl_ast_expr *expr1,
8449                 __isl_take isl_ast_expr *expr2);
8450         __isl_give isl_ast_expr *isl_ast_expr_ge(
8451                 __isl_take isl_ast_expr *expr1,
8452                 __isl_take isl_ast_expr *expr2);
8453         __isl_give isl_ast_expr *isl_ast_expr_gt(
8454                 __isl_take isl_ast_expr *expr1,
8455                 __isl_take isl_ast_expr *expr2);
8456         __isl_give isl_ast_expr *isl_ast_expr_access(
8457                 __isl_take isl_ast_expr *array,
8458                 __isl_take isl_ast_expr_list *indices);
8460 The function C<isl_ast_expr_address_of> can be applied to an
8461 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
8462 to represent the address of the C<isl_ast_expr_access>.
8464         #include <isl/ast_build.h>
8465         __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
8466                 __isl_keep isl_ast_build *build,
8467                 __isl_take isl_pw_aff *pa);
8468         __isl_give isl_ast_expr *
8469         isl_ast_build_access_from_pw_multi_aff(
8470                 __isl_keep isl_ast_build *build,
8471                 __isl_take isl_pw_multi_aff *pma);
8472         __isl_give isl_ast_expr *
8473         isl_ast_build_access_from_multi_pw_aff(
8474                 __isl_keep isl_ast_build *build,
8475                 __isl_take isl_multi_pw_aff *mpa);
8476         __isl_give isl_ast_expr *
8477         isl_ast_build_call_from_pw_multi_aff(
8478                 __isl_keep isl_ast_build *build,
8479                 __isl_take isl_pw_multi_aff *pma);
8480         __isl_give isl_ast_expr *
8481         isl_ast_build_call_from_multi_pw_aff(
8482                 __isl_keep isl_ast_build *build,
8483                 __isl_take isl_multi_pw_aff *mpa);
8485 The domains of C<pa>, C<mpa> and C<pma> should correspond
8486 to the schedule space of C<build>.
8487 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
8488 the function being called.
8489 If the accessed space is a nested relation, then it is taken
8490 to represent an access of the member specified by the range
8491 of this nested relation of the structure specified by the domain
8492 of the nested relation.
8494 The following functions can be used to modify an C<isl_ast_expr>.
8496         #include <isl/ast.h>
8497         __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
8498                 __isl_take isl_ast_expr *expr, int pos,
8499                 __isl_take isl_ast_expr *arg);
8501 Replace the argument of C<expr> at position C<pos> by C<arg>.
8503         #include <isl/ast.h>
8504         __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
8505                 __isl_take isl_ast_expr *expr,
8506                 __isl_take isl_id_to_ast_expr *id2expr);
8508 The function C<isl_ast_expr_substitute_ids> replaces the
8509 subexpressions of C<expr> of type C<isl_ast_expr_id>
8510 by the corresponding expression in C<id2expr>, if there is any.
8513 User specified data can be attached to an C<isl_ast_node> and obtained
8514 from the same C<isl_ast_node> using the following functions.
8516         #include <isl/ast.h>
8517         __isl_give isl_ast_node *isl_ast_node_set_annotation(
8518                 __isl_take isl_ast_node *node,
8519                 __isl_take isl_id *annotation);
8520         __isl_give isl_id *isl_ast_node_get_annotation(
8521                 __isl_keep isl_ast_node *node);
8523 Basic printing can be performed using the following functions.
8525         #include <isl/ast.h>
8526         __isl_give isl_printer *isl_printer_print_ast_expr(
8527                 __isl_take isl_printer *p,
8528                 __isl_keep isl_ast_expr *expr);
8529         __isl_give isl_printer *isl_printer_print_ast_node(
8530                 __isl_take isl_printer *p,
8531                 __isl_keep isl_ast_node *node);
8532         __isl_give char *isl_ast_expr_to_str(
8533                 __isl_keep isl_ast_expr *expr);
8535 More advanced printing can be performed using the following functions.
8537         #include <isl/ast.h>
8538         __isl_give isl_printer *isl_ast_op_type_print_macro(
8539                 enum isl_ast_op_type type,
8540                 __isl_take isl_printer *p);
8541         __isl_give isl_printer *isl_ast_node_print_macros(
8542                 __isl_keep isl_ast_node *node,
8543                 __isl_take isl_printer *p);
8544         __isl_give isl_printer *isl_ast_node_print(
8545                 __isl_keep isl_ast_node *node,
8546                 __isl_take isl_printer *p,
8547                 __isl_take isl_ast_print_options *options);
8548         __isl_give isl_printer *isl_ast_node_for_print(
8549                 __isl_keep isl_ast_node *node,
8550                 __isl_take isl_printer *p,
8551                 __isl_take isl_ast_print_options *options);
8552         __isl_give isl_printer *isl_ast_node_if_print(
8553                 __isl_keep isl_ast_node *node,
8554                 __isl_take isl_printer *p,
8555                 __isl_take isl_ast_print_options *options);
8557 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
8558 C<isl> may print out an AST that makes use of macros such
8559 as C<floord>, C<min> and C<max>.
8560 C<isl_ast_op_type_print_macro> prints out the macro
8561 corresponding to a specific C<isl_ast_op_type>.
8562 C<isl_ast_node_print_macros> scans the C<isl_ast_node>
8563 for expressions where these macros would be used and prints
8564 out the required macro definitions.
8565 Essentially, C<isl_ast_node_print_macros> calls
8566 C<isl_ast_node_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
8567 as function argument.
8568 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
8569 C<isl_ast_node_if_print> print an C<isl_ast_node>
8570 in C<ISL_FORMAT_C>, but allow for some extra control
8571 through an C<isl_ast_print_options> object.
8572 This object can be created using the following functions.
8574         #include <isl/ast.h>
8575         __isl_give isl_ast_print_options *
8576         isl_ast_print_options_alloc(isl_ctx *ctx);
8577         __isl_give isl_ast_print_options *
8578         isl_ast_print_options_copy(
8579                 __isl_keep isl_ast_print_options *options);
8580         __isl_null isl_ast_print_options *
8581         isl_ast_print_options_free(
8582                 __isl_take isl_ast_print_options *options);
8584         __isl_give isl_ast_print_options *
8585         isl_ast_print_options_set_print_user(
8586                 __isl_take isl_ast_print_options *options,
8587                 __isl_give isl_printer *(*print_user)(
8588                         __isl_take isl_printer *p,
8589                         __isl_take isl_ast_print_options *options,
8590                         __isl_keep isl_ast_node *node, void *user),
8591                 void *user);
8592         __isl_give isl_ast_print_options *
8593         isl_ast_print_options_set_print_for(
8594                 __isl_take isl_ast_print_options *options,
8595                 __isl_give isl_printer *(*print_for)(
8596                         __isl_take isl_printer *p,
8597                         __isl_take isl_ast_print_options *options,
8598                         __isl_keep isl_ast_node *node, void *user),
8599                 void *user);
8601 The callback set by C<isl_ast_print_options_set_print_user>
8602 is called whenever a node of type C<isl_ast_node_user> needs to
8603 be printed.
8604 The callback set by C<isl_ast_print_options_set_print_for>
8605 is called whenever a node of type C<isl_ast_node_for> needs to
8606 be printed.
8607 Note that C<isl_ast_node_for_print> will I<not> call the
8608 callback set by C<isl_ast_print_options_set_print_for> on the node
8609 on which C<isl_ast_node_for_print> is called, but only on nested
8610 nodes of type C<isl_ast_node_for>.  It is therefore safe to
8611 call C<isl_ast_node_for_print> from within the callback set by
8612 C<isl_ast_print_options_set_print_for>.
8614 The following option determines the type to be used for iterators
8615 while printing the AST.
8617         int isl_options_set_ast_iterator_type(
8618                 isl_ctx *ctx, const char *val);
8619         const char *isl_options_get_ast_iterator_type(
8620                 isl_ctx *ctx);
8622 The AST printer only prints body nodes as blocks if these
8623 blocks cannot be safely omitted.
8624 For example, a C<for> node with one body node will not be
8625 surrounded with braces in C<ISL_FORMAT_C>.
8626 A block will always be printed by setting the following option.
8628         int isl_options_set_ast_always_print_block(isl_ctx *ctx,
8629                 int val);
8630         int isl_options_get_ast_always_print_block(isl_ctx *ctx);
8632 =head3 Options
8634         #include <isl/ast_build.h>
8635         int isl_options_set_ast_build_atomic_upper_bound(
8636                 isl_ctx *ctx, int val);
8637         int isl_options_get_ast_build_atomic_upper_bound(
8638                 isl_ctx *ctx);
8639         int isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
8640                 int val);
8641         int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
8642         int isl_options_set_ast_build_exploit_nested_bounds(
8643                 isl_ctx *ctx, int val);
8644         int isl_options_get_ast_build_exploit_nested_bounds(
8645                 isl_ctx *ctx);
8646         int isl_options_set_ast_build_group_coscheduled(
8647                 isl_ctx *ctx, int val);
8648         int isl_options_get_ast_build_group_coscheduled(
8649                 isl_ctx *ctx);
8650         int isl_options_set_ast_build_scale_strides(
8651                 isl_ctx *ctx, int val);
8652         int isl_options_get_ast_build_scale_strides(
8653                 isl_ctx *ctx);
8654         int isl_options_set_ast_build_allow_else(isl_ctx *ctx,
8655                 int val);
8656         int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
8657         int isl_options_set_ast_build_allow_or(isl_ctx *ctx,
8658                 int val);
8659         int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
8661 =over
8663 =item * ast_build_atomic_upper_bound
8665 Generate loop upper bounds that consist of the current loop iterator,
8666 an operator and an expression not involving the iterator.
8667 If this option is not set, then the current loop iterator may appear
8668 several times in the upper bound.
8669 For example, when this option is turned off, AST generation
8670 for the schedule
8672         [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
8674 produces
8676         for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
8677           A(c0);
8679 When the option is turned on, the following AST is generated
8681         for (int c0 = 0; c0 <= min(100, n); c0 += 1)
8682           A(c0);
8684 =item * ast_build_prefer_pdiv
8686 If this option is turned off, then the AST generation will
8687 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
8688 operators, but no C<isl_ast_op_pdiv_q> or
8689 C<isl_ast_op_pdiv_r> operators.
8690 If this options is turned on, then C<isl> will try to convert
8691 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
8692 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
8694 =item * ast_build_exploit_nested_bounds
8696 Simplify conditions based on bounds of nested for loops.
8697 In particular, remove conditions that are implied by the fact
8698 that one or more nested loops have at least one iteration,
8699 meaning that the upper bound is at least as large as the lower bound.
8700 For example, when this option is turned off, AST generation
8701 for the schedule
8703         [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
8704                                         0 <= j <= M }
8706 produces
8708         if (M >= 0)
8709           for (int c0 = 0; c0 <= N; c0 += 1)
8710             for (int c1 = 0; c1 <= M; c1 += 1)
8711               A(c0, c1);
8713 When the option is turned on, the following AST is generated
8715         for (int c0 = 0; c0 <= N; c0 += 1)
8716           for (int c1 = 0; c1 <= M; c1 += 1)
8717             A(c0, c1);
8719 =item * ast_build_group_coscheduled
8721 If two domain elements are assigned the same schedule point, then
8722 they may be executed in any order and they may even appear in different
8723 loops.  If this options is set, then the AST generator will make
8724 sure that coscheduled domain elements do not appear in separate parts
8725 of the AST.  This is useful in case of nested AST generation
8726 if the outer AST generation is given only part of a schedule
8727 and the inner AST generation should handle the domains that are
8728 coscheduled by this initial part of the schedule together.
8729 For example if an AST is generated for a schedule
8731         { A[i] -> [0]; B[i] -> [0] }
8733 then the C<isl_ast_build_set_create_leaf> callback described
8734 below may get called twice, once for each domain.
8735 Setting this option ensures that the callback is only called once
8736 on both domains together.
8738 =item * ast_build_separation_bounds
8740 This option specifies which bounds to use during separation.
8741 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
8742 then all (possibly implicit) bounds on the current dimension will
8743 be used during separation.
8744 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
8745 then only those bounds that are explicitly available will
8746 be used during separation.
8748 =item * ast_build_scale_strides
8750 This option specifies whether the AST generator is allowed
8751 to scale down iterators of strided loops.
8753 =item * ast_build_allow_else
8755 This option specifies whether the AST generator is allowed
8756 to construct if statements with else branches.
8758 =item * ast_build_allow_or
8760 This option specifies whether the AST generator is allowed
8761 to construct if conditions with disjunctions.
8763 =back
8765 =head3 Fine-grained Control over AST Generation
8767 Besides specifying the constraints on the parameters,
8768 an C<isl_ast_build> object can be used to control
8769 various aspects of the AST generation process.
8770 The most prominent way of control is through ``options'',
8771 which can be set using the following function.
8773         #include <isl/ast_build.h>
8774         __isl_give isl_ast_build *
8775         isl_ast_build_set_options(
8776                 __isl_take isl_ast_build *control,
8777                 __isl_take isl_union_map *options);
8779 The options are encoded in an C<isl_union_map>.
8780 The domain of this union relation refers to the schedule domain,
8781 i.e., the range of the schedule passed to C<isl_ast_build_ast_from_schedule>.
8782 In the case of nested AST generation (see L</"Nested AST Generation">),
8783 the domain of C<options> should refer to the extra piece of the schedule.
8784 That is, it should be equal to the range of the wrapped relation in the
8785 range of the schedule.
8786 The range of the options can consist of elements in one or more spaces,
8787 the names of which determine the effect of the option.
8788 The values of the range typically also refer to the schedule dimension
8789 to which the option applies.  In case of nested AST generation
8790 (see L</"Nested AST Generation">), these values refer to the position
8791 of the schedule dimension within the innermost AST generation.
8792 The constraints on the domain elements of
8793 the option should only refer to this dimension and earlier dimensions.
8794 We consider the following spaces.
8796 =over
8798 =item C<separation_class>
8800 This space is a wrapped relation between two one dimensional spaces.
8801 The input space represents the schedule dimension to which the option
8802 applies and the output space represents the separation class.
8803 While constructing a loop corresponding to the specified schedule
8804 dimension(s), the AST generator will try to generate separate loops
8805 for domain elements that are assigned different classes.
8806 If only some of the elements are assigned a class, then those elements
8807 that are not assigned any class will be treated as belonging to a class
8808 that is separate from the explicitly assigned classes.
8809 The typical use case for this option is to separate full tiles from
8810 partial tiles.
8811 The other options, described below, are applied after the separation
8812 into classes.
8814 As an example, consider the separation into full and partial tiles
8815 of a tiling of a triangular domain.
8816 Take, for example, the domain
8818         { A[i,j] : 0 <= i,j and i + j <= 100 }
8820 and a tiling into tiles of 10 by 10.  The input to the AST generator
8821 is then the schedule
8823         { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
8824                                                 i + j <= 100 }
8826 Without any options, the following AST is generated
8828         for (int c0 = 0; c0 <= 10; c0 += 1)
8829           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
8830             for (int c2 = 10 * c0;
8831                  c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
8832                  c2 += 1)
8833               for (int c3 = 10 * c1;
8834                    c3 <= min(10 * c1 + 9, -c2 + 100);
8835                    c3 += 1)
8836                 A(c2, c3);
8838 Separation into full and partial tiles can be obtained by assigning
8839 a class, say C<0>, to the full tiles.  The full tiles are represented by those
8840 values of the first and second schedule dimensions for which there are
8841 values of the third and fourth dimensions to cover an entire tile.
8842 That is, we need to specify the following option
8844         { [a,b,c,d] -> separation_class[[0]->[0]] :
8845                 exists b': 0 <= 10a,10b' and
8846                            10a+9+10b'+9 <= 100;
8847           [a,b,c,d] -> separation_class[[1]->[0]] :
8848                 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
8850 which simplifies to
8852         { [a, b, c, d] -> separation_class[[1] -> [0]] :
8853                 a >= 0 and b >= 0 and b <= 8 - a;
8854           [a, b, c, d] -> separation_class[[0] -> [0]] :
8855                 a >= 0 and a <= 8 }
8857 With this option, the generated AST is as follows
8859         {
8860           for (int c0 = 0; c0 <= 8; c0 += 1) {
8861             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
8862               for (int c2 = 10 * c0;
8863                    c2 <= 10 * c0 + 9; c2 += 1)
8864                 for (int c3 = 10 * c1;
8865                      c3 <= 10 * c1 + 9; c3 += 1)
8866                   A(c2, c3);
8867             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
8868               for (int c2 = 10 * c0;
8869                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
8870                    c2 += 1)
8871                 for (int c3 = 10 * c1;
8872                      c3 <= min(-c2 + 100, 10 * c1 + 9);
8873                      c3 += 1)
8874                   A(c2, c3);
8875           }
8876           for (int c0 = 9; c0 <= 10; c0 += 1)
8877             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
8878               for (int c2 = 10 * c0;
8879                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
8880                    c2 += 1)
8881                 for (int c3 = 10 * c1;
8882                      c3 <= min(10 * c1 + 9, -c2 + 100);
8883                      c3 += 1)
8884                   A(c2, c3);
8885         }
8887 =item C<separate>
8889 This is a single-dimensional space representing the schedule dimension(s)
8890 to which ``separation'' should be applied.  Separation tries to split
8891 a loop into several pieces if this can avoid the generation of guards
8892 inside the loop.
8893 See also the C<atomic> option.
8895 =item C<atomic>
8897 This is a single-dimensional space representing the schedule dimension(s)
8898 for which the domains should be considered ``atomic''.  That is, the
8899 AST generator will make sure that any given domain space will only appear
8900 in a single loop at the specified level.
8902 Consider the following schedule
8904         { a[i] -> [i] : 0 <= i < 10;
8905           b[i] -> [i+1] : 0 <= i < 10 }
8907 If the following option is specified
8909         { [i] -> separate[x] }
8911 then the following AST will be generated
8913         {
8914           a(0);
8915           for (int c0 = 1; c0 <= 9; c0 += 1) {
8916             a(c0);
8917             b(c0 - 1);
8918           }
8919           b(9);
8920         }
8922 If, on the other hand, the following option is specified
8924         { [i] -> atomic[x] }
8926 then the following AST will be generated
8928         for (int c0 = 0; c0 <= 10; c0 += 1) {
8929           if (c0 <= 9)
8930             a(c0);
8931           if (c0 >= 1)
8932             b(c0 - 1);
8933         }
8935 If neither C<atomic> nor C<separate> is specified, then the AST generator
8936 may produce either of these two results or some intermediate form.
8938 =item C<unroll>
8940 This is a single-dimensional space representing the schedule dimension(s)
8941 that should be I<completely> unrolled.
8942 To obtain a partial unrolling, the user should apply an additional
8943 strip-mining to the schedule and fully unroll the inner loop.
8945 =back
8947 Additional control is available through the following functions.
8949         #include <isl/ast_build.h>
8950         __isl_give isl_ast_build *
8951         isl_ast_build_set_iterators(
8952                 __isl_take isl_ast_build *control,
8953                 __isl_take isl_id_list *iterators);
8955 The function C<isl_ast_build_set_iterators> allows the user to
8956 specify a list of iterator C<isl_id>s to be used as iterators.
8957 If the input schedule is injective, then
8958 the number of elements in this list should be as large as the dimension
8959 of the schedule space, but no direct correspondence should be assumed
8960 between dimensions and elements.
8961 If the input schedule is not injective, then an additional number
8962 of C<isl_id>s equal to the largest dimension of the input domains
8963 may be required.
8964 If the number of provided C<isl_id>s is insufficient, then additional
8965 names are automatically generated.
8967         #include <isl/ast_build.h>
8968         __isl_give isl_ast_build *
8969         isl_ast_build_set_create_leaf(
8970                 __isl_take isl_ast_build *control,
8971                 __isl_give isl_ast_node *(*fn)(
8972                         __isl_take isl_ast_build *build,
8973                         void *user), void *user);
8976 C<isl_ast_build_set_create_leaf> function allows for the
8977 specification of a callback that should be called whenever the AST
8978 generator arrives at an element of the schedule domain.
8979 The callback should return an AST node that should be inserted
8980 at the corresponding position of the AST.  The default action (when
8981 the callback is not set) is to continue generating parts of the AST to scan
8982 all the domain elements associated to the schedule domain element
8983 and to insert user nodes, ``calling'' the domain element, for each of them.
8984 The C<build> argument contains the current state of the C<isl_ast_build>.
8985 To ease nested AST generation (see L</"Nested AST Generation">),
8986 all control information that is
8987 specific to the current AST generation such as the options and
8988 the callbacks has been removed from this C<isl_ast_build>.
8989 The callback would typically return the result of a nested
8990 AST generation or a
8991 user defined node created using the following function.
8993         #include <isl/ast.h>
8994         __isl_give isl_ast_node *isl_ast_node_alloc_user(
8995                 __isl_take isl_ast_expr *expr);
8997         #include <isl/ast_build.h>
8998         __isl_give isl_ast_build *
8999         isl_ast_build_set_at_each_domain(
9000                 __isl_take isl_ast_build *build,
9001                 __isl_give isl_ast_node *(*fn)(
9002                         __isl_take isl_ast_node *node,
9003                         __isl_keep isl_ast_build *build,
9004                         void *user), void *user);
9005         __isl_give isl_ast_build *
9006         isl_ast_build_set_before_each_for(
9007                 __isl_take isl_ast_build *build,
9008                 __isl_give isl_id *(*fn)(
9009                         __isl_keep isl_ast_build *build,
9010                         void *user), void *user);
9011         __isl_give isl_ast_build *
9012         isl_ast_build_set_after_each_for(
9013                 __isl_take isl_ast_build *build,
9014                 __isl_give isl_ast_node *(*fn)(
9015                         __isl_take isl_ast_node *node,
9016                         __isl_keep isl_ast_build *build,
9017                         void *user), void *user);
9019 The callback set by C<isl_ast_build_set_at_each_domain> will
9020 be called for each domain AST node.
9021 The callbacks set by C<isl_ast_build_set_before_each_for>
9022 and C<isl_ast_build_set_after_each_for> will be called
9023 for each for AST node.  The first will be called in depth-first
9024 pre-order, while the second will be called in depth-first post-order.
9025 Since C<isl_ast_build_set_before_each_for> is called before the for
9026 node is actually constructed, it is only passed an C<isl_ast_build>.
9027 The returned C<isl_id> will be added as an annotation (using
9028 C<isl_ast_node_set_annotation>) to the constructed for node.
9029 In particular, if the user has also specified an C<after_each_for>
9030 callback, then the annotation can be retrieved from the node passed to
9031 that callback using C<isl_ast_node_get_annotation>.
9032 All callbacks should C<NULL> on failure.
9033 The given C<isl_ast_build> can be used to create new
9034 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
9035 or C<isl_ast_build_call_from_pw_multi_aff>.
9037 =head3 Nested AST Generation
9039 C<isl> allows the user to create an AST within the context
9040 of another AST.  These nested ASTs are created using the
9041 same C<isl_ast_build_ast_from_schedule> function that is used to create the
9042 outer AST.  The C<build> argument should be an C<isl_ast_build>
9043 passed to a callback set by
9044 C<isl_ast_build_set_create_leaf>.
9045 The space of the range of the C<schedule> argument should refer
9046 to this build.  In particular, the space should be a wrapped
9047 relation and the domain of this wrapped relation should be the
9048 same as that of the range of the schedule returned by
9049 C<isl_ast_build_get_schedule> below.
9050 In practice, the new schedule is typically
9051 created by calling C<isl_union_map_range_product> on the old schedule
9052 and some extra piece of the schedule.
9053 The space of the schedule domain is also available from
9054 the C<isl_ast_build>.
9056         #include <isl/ast_build.h>
9057         __isl_give isl_union_map *isl_ast_build_get_schedule(
9058                 __isl_keep isl_ast_build *build);
9059         __isl_give isl_space *isl_ast_build_get_schedule_space(
9060                 __isl_keep isl_ast_build *build);
9061         __isl_give isl_ast_build *isl_ast_build_restrict(
9062                 __isl_take isl_ast_build *build,
9063                 __isl_take isl_set *set);
9065 The C<isl_ast_build_get_schedule> function returns a (partial)
9066 schedule for the domains elements for which part of the AST still needs to
9067 be generated in the current build.
9068 In particular, the domain elements are mapped to those iterations of the loops
9069 enclosing the current point of the AST generation inside which
9070 the domain elements are executed.
9071 No direct correspondence between
9072 the input schedule and this schedule should be assumed.
9073 The space obtained from C<isl_ast_build_get_schedule_space> can be used
9074 to create a set for C<isl_ast_build_restrict> to intersect
9075 with the current build.  In particular, the set passed to
9076 C<isl_ast_build_restrict> can have additional parameters.
9077 The ids of the set dimensions in the space returned by
9078 C<isl_ast_build_get_schedule_space> correspond to the
9079 iterators of the already generated loops.
9080 The user should not rely on the ids of the output dimensions
9081 of the relations in the union relation returned by
9082 C<isl_ast_build_get_schedule> having any particular value.
9084 =head1 Applications
9086 Although C<isl> is mainly meant to be used as a library,
9087 it also contains some basic applications that use some
9088 of the functionality of C<isl>.
9089 The input may be specified in either the L<isl format>
9090 or the L<PolyLib format>.
9092 =head2 C<isl_polyhedron_sample>
9094 C<isl_polyhedron_sample> takes a polyhedron as input and prints
9095 an integer element of the polyhedron, if there is any.
9096 The first column in the output is the denominator and is always
9097 equal to 1.  If the polyhedron contains no integer points,
9098 then a vector of length zero is printed.
9100 =head2 C<isl_pip>
9102 C<isl_pip> takes the same input as the C<example> program
9103 from the C<piplib> distribution, i.e., a set of constraints
9104 on the parameters, a line containing only -1 and finally a set
9105 of constraints on a parametric polyhedron.
9106 The coefficients of the parameters appear in the last columns
9107 (but before the final constant column).
9108 The output is the lexicographic minimum of the parametric polyhedron.
9109 As C<isl> currently does not have its own output format, the output
9110 is just a dump of the internal state.
9112 =head2 C<isl_polyhedron_minimize>
9114 C<isl_polyhedron_minimize> computes the minimum of some linear
9115 or affine objective function over the integer points in a polyhedron.
9116 If an affine objective function
9117 is given, then the constant should appear in the last column.
9119 =head2 C<isl_polytope_scan>
9121 Given a polytope, C<isl_polytope_scan> prints
9122 all integer points in the polytope.
9124 =head2 C<isl_codegen>
9126 Given a schedule, a context set and an options relation,
9127 C<isl_codegen> prints out an AST that scans the domain elements
9128 of the schedule in the order of their image(s) taking into account
9129 the constraints in the context set.