add isl_multi_pw_aff_eq_map
[isl.git] / doc / user.pod
blob47c0db7c250dfe4be3d65e0f5d4a76863a2af87d
1 =head1 Introduction
3 C<isl> is a thread-safe C library for manipulating
4 sets and relations of integer points bounded by affine constraints.
5 The descriptions of the sets and relations may involve
6 both parameters and existentially quantified variables.
7 All computations are performed in exact integer arithmetic
8 using C<GMP> or C<imath>.
9 The C<isl> library offers functionality that is similar
10 to that offered by the C<Omega> and C<Omega+> libraries,
11 but the underlying algorithms are in most cases completely different.
13 The library is by no means complete and some fairly basic
14 functionality is still missing.
15 Still, even in its current form, the library has been successfully
16 used as a backend polyhedral library for the polyhedral
17 scanner C<CLooG> and as part of an equivalence checker of
18 static affine programs.
19 For bug reports, feature requests and questions,
20 visit the discussion group at
21 L<http://groups.google.com/group/isl-development>.
23 =head2 Backward Incompatible Changes
25 =head3 Changes since isl-0.02
27 =over
29 =item * The old printing functions have been deprecated
30 and replaced by C<isl_printer> functions, see L<Input and Output>.
32 =item * Most functions related to dependence analysis have acquired
33 an extra C<must> argument.  To obtain the old behavior, this argument
34 should be given the value 1.  See L<Dependence Analysis>.
36 =back
38 =head3 Changes since isl-0.03
40 =over
42 =item * The function C<isl_pw_qpolynomial_fold_add> has been
43 renamed to C<isl_pw_qpolynomial_fold_fold>.
44 Similarly, C<isl_union_pw_qpolynomial_fold_add> has been
45 renamed to C<isl_union_pw_qpolynomial_fold_fold>.
47 =back
49 =head3 Changes since isl-0.04
51 =over
53 =item * All header files have been renamed from C<isl_header.h>
54 to C<isl/header.h>.
56 =back
58 =head3 Changes since isl-0.05
60 =over
62 =item * The functions C<isl_printer_print_basic_set> and
63 C<isl_printer_print_basic_map> no longer print a newline.
65 =item * The functions C<isl_flow_get_no_source>
66 and C<isl_union_map_compute_flow> now return
67 the accesses for which no source could be found instead of
68 the iterations where those accesses occur.
70 =item * The functions C<isl_basic_map_identity> and
71 C<isl_map_identity> now take a B<map> space as input.  An old call
72 C<isl_map_identity(space)> can be rewritten to
73 C<isl_map_identity(isl_space_map_from_set(space))>.
75 =item * The function C<isl_map_power> no longer takes
76 a parameter position as input.  Instead, the exponent
77 is now expressed as the domain of the resulting relation.
79 =back
81 =head3 Changes since isl-0.06
83 =over
85 =item * The format of C<isl_printer_print_qpolynomial>'s
86 C<ISL_FORMAT_ISL> output has changed.
87 Use C<ISL_FORMAT_C> to obtain the old output.
89 =item * The C<*_fast_*> functions have been renamed to C<*_plain_*>.
90 Some of the old names have been kept for backward compatibility,
91 but they will be removed in the future.
93 =back
95 =head3 Changes since isl-0.07
97 =over
99 =item * The function C<isl_pw_aff_max> has been renamed to
100 C<isl_pw_aff_union_max>.
101 Similarly, the function C<isl_pw_aff_add> has been renamed to
102 C<isl_pw_aff_union_add>.
104 =item * The C<isl_dim> type has been renamed to C<isl_space>
105 along with the associated functions.
106 Some of the old names have been kept for backward compatibility,
107 but they will be removed in the future.
109 =item * Spaces of maps, sets and parameter domains are now
110 treated differently.  The distinction between map spaces and set spaces
111 has always been made on a conceptual level, but proper use of such spaces
112 was never checked.  Furthermore, up until isl-0.07 there was no way
113 of explicitly creating a parameter space.  These can now be created
114 directly using C<isl_space_params_alloc> or from other spaces using
115 C<isl_space_params>.
117 =item * The space in which C<isl_aff>, C<isl_pw_aff>, C<isl_qpolynomial>,
118 C<isl_pw_qpolynomial>, C<isl_qpolynomial_fold> and C<isl_pw_qpolynomial_fold>
119 objects live is now a map space
120 instead of a set space.  This means, for example, that the dimensions
121 of the domain of an C<isl_aff> are now considered to be of type
122 C<isl_dim_in> instead of C<isl_dim_set>.  Extra functions have been
123 added to obtain the domain space.  Some of the constructors still
124 take a domain space and have therefore been renamed.
126 =item * The functions C<isl_equality_alloc> and C<isl_inequality_alloc>
127 now take an C<isl_local_space> instead of an C<isl_space>.
128 An C<isl_local_space> can be created from an C<isl_space>
129 using C<isl_local_space_from_space>.
131 =item * The C<isl_div> type has been removed.  Functions that used
132 to return an C<isl_div> now return an C<isl_aff>.
133 Note that the space of an C<isl_aff> is that of relation.
134 When replacing a call to C<isl_div_get_coefficient> by a call to
135 C<isl_aff_get_coefficient> any C<isl_dim_set> argument needs
136 to be replaced by C<isl_dim_in>.
137 A call to C<isl_aff_from_div> can be replaced by a call
138 to C<isl_aff_floor>.
139 A call to C<isl_qpolynomial_div(div)> call be replaced by
140 the nested call
142         isl_qpolynomial_from_aff(isl_aff_floor(div))
144 The function C<isl_constraint_div> has also been renamed
145 to C<isl_constraint_get_div>.
147 =item * The C<nparam> argument has been removed from
148 C<isl_map_read_from_str> and similar functions.
149 When reading input in the original PolyLib format,
150 the result will have no parameters.
151 If parameters are expected, the caller may want to perform
152 dimension manipulation on the result.
154 =back
156 =head3 Changes since isl-0.09
158 =over
160 =item * The C<schedule_split_parallel> option has been replaced
161 by the C<schedule_split_scaled> option.
163 =item * The first argument of C<isl_pw_aff_cond> is now
164 an C<isl_pw_aff> instead of an C<isl_set>.
165 A call C<isl_pw_aff_cond(a, b, c)> can be replaced by
167         isl_pw_aff_cond(isl_set_indicator_function(a), b, c)
169 =back
171 =head3 Changes since isl-0.10
173 =over
175 =item * The functions C<isl_set_dim_has_lower_bound> and
176 C<isl_set_dim_has_upper_bound> have been renamed to
177 C<isl_set_dim_has_any_lower_bound> and
178 C<isl_set_dim_has_any_upper_bound>.
179 The new C<isl_set_dim_has_lower_bound> and
180 C<isl_set_dim_has_upper_bound> have slightly different meanings.
182 =back
184 =head3 Changes since isl-0.12
186 =over
188 =item * C<isl_int> has been replaced by C<isl_val>.
189 Some of the old functions are still available in C<isl/deprecated/*.h>
190 but they will be removed in the future.
192 =item * The functions C<isl_pw_qpolynomial_eval>,
193 C<isl_union_pw_qpolynomial_eval>, C<isl_pw_qpolynomial_fold_eval>
194 and C<isl_union_pw_qpolynomial_fold_eval> have been changed to return
195 an C<isl_val> instead of an C<isl_qpolynomial>.
197 =item * The function C<isl_band_member_is_zero_distance>
198 has been removed.  Essentially the same functionality is available
199 through C<isl_band_member_is_coincident>, except that is requires
200 setting up coincidence constraints.
201 The option C<schedule_outer_zero_distance> has accordingly been
202 replaced by the option C<schedule_outer_coincidence>.
204 =item * The function C<isl_vertex_get_expr> has been changed
205 to return an C<isl_multi_aff> instead of a rational C<isl_basic_set>.
206 The function C<isl_vertex_get_domain> has been changed to return
207 a regular basic set, rather than a rational basic set.
209 =back
211 =head3 Changes since isl-0.14
213 =over
215 =item * Objects of type C<isl_union_pw_multi_aff> can no longer contain
216 two or more C<isl_pw_multi_aff> objects with the same domain space.
218 =item * The function C<isl_union_pw_multi_aff_add> now consistently
219 computes the sum on the shared definition domain.
220 The function C<isl_union_pw_multi_aff_union_add> has been added
221 to compute the sum on the union of definition domains.
222 The original behavior of C<isl_union_pw_multi_aff_add> was
223 confused and is no longer available.
225 =back
227 =head1 License
229 C<isl> is released under the MIT license.
231 =over
233 Permission is hereby granted, free of charge, to any person obtaining a copy of
234 this software and associated documentation files (the "Software"), to deal in
235 the Software without restriction, including without limitation the rights to
236 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
237 of the Software, and to permit persons to whom the Software is furnished to do
238 so, subject to the following conditions:
240 The above copyright notice and this permission notice shall be included in all
241 copies or substantial portions of the Software.
243 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
244 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
245 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
246 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
247 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
248 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
249 SOFTWARE.
251 =back
253 Note that by default C<isl> requires C<GMP>, which is released
254 under the GNU Lesser General Public License (LGPL).  This means
255 that code linked against C<isl> is also linked against LGPL code.
257 When configuring with C<--with-int=imath>, C<isl> will link against C<imath>, a
258 library for exact integer arithmetic released under the MIT license.
260 =head1 Installation
262 The source of C<isl> can be obtained either as a tarball
263 or from the git repository.  Both are available from
264 L<http://freshmeat.net/projects/isl/>.
265 The installation process depends on how you obtained
266 the source.
268 =head2 Installation from the git repository
270 =over
272 =item 1 Clone or update the repository
274 The first time the source is obtained, you need to clone
275 the repository.
277         git clone git://repo.or.cz/isl.git
279 To obtain updates, you need to pull in the latest changes
281         git pull
283 =item 2 Optionally get C<imath> submodule
285 To build C<isl> with C<imath>, you need to obtain the C<imath>
286 submodule by running in the git source tree of C<isl>
288        git submodule init
289        git submodule update
291 This will fetch the required version of C<imath> in a subdirectory of C<isl>.
293 =item 2 Generate C<configure>
295         ./autogen.sh
297 =back
299 After performing the above steps, continue
300 with the L<Common installation instructions>.
302 =head2 Common installation instructions
304 =over
306 =item 1 Obtain C<GMP>
308 By default, building C<isl> requires C<GMP>, including its headers files.
309 Your distribution may not provide these header files by default
310 and you may need to install a package called C<gmp-devel> or something
311 similar.  Alternatively, C<GMP> can be built from
312 source, available from L<http://gmplib.org/>.
313 C<GMP> is not needed if you build C<isl> with C<imath>.
315 =item 2 Configure
317 C<isl> uses the standard C<autoconf> C<configure> script.
318 To run it, just type
320         ./configure
322 optionally followed by some configure options.
323 A complete list of options can be obtained by running
325         ./configure --help
327 Below we discuss some of the more common options.
329 =over
331 =item C<--prefix>
333 Installation prefix for C<isl>
335 =item C<--with-int=[gmp|imath]>
337 Select the integer library to be used by C<isl>, the default is C<gmp>.
338 Note that C<isl> may run significantly slower if you use C<imath>.
340 =item C<--with-gmp-prefix>
342 Installation prefix for C<GMP> (architecture-independent files).
344 =item C<--with-gmp-exec-prefix>
346 Installation prefix for C<GMP> (architecture-dependent files).
348 =back
350 =item 3 Compile
352         make
354 =item 4 Install (optional)
356         make install
358 =back
360 =head1 Integer Set Library
362 =head2 Memory Management
364 Since a high-level operation on isl objects usually involves
365 several substeps and since the user is usually not interested in
366 the intermediate results, most functions that return a new object
367 will also release all the objects passed as arguments.
368 If the user still wants to use one or more of these arguments
369 after the function call, she should pass along a copy of the
370 object rather than the object itself.
371 The user is then responsible for making sure that the original
372 object gets used somewhere else or is explicitly freed.
374 The arguments and return values of all documented functions are
375 annotated to make clear which arguments are released and which
376 arguments are preserved.  In particular, the following annotations
377 are used
379 =over
381 =item C<__isl_give>
383 C<__isl_give> means that a new object is returned.
384 The user should make sure that the returned pointer is
385 used exactly once as a value for an C<__isl_take> argument.
386 In between, it can be used as a value for as many
387 C<__isl_keep> arguments as the user likes.
388 There is one exception, and that is the case where the
389 pointer returned is C<NULL>.  Is this case, the user
390 is free to use it as an C<__isl_take> argument or not.
391 When applied to a C<char *>, the returned pointer needs to be
392 freed using C<free>.
394 =item C<__isl_null>
396 C<__isl_null> means that a C<NULL> value is returned.
398 =item C<__isl_take>
400 C<__isl_take> means that the object the argument points to
401 is taken over by the function and may no longer be used
402 by the user as an argument to any other function.
403 The pointer value must be one returned by a function
404 returning an C<__isl_give> pointer.
405 If the user passes in a C<NULL> value, then this will
406 be treated as an error in the sense that the function will
407 not perform its usual operation.  However, it will still
408 make sure that all the other C<__isl_take> arguments
409 are released.
411 =item C<__isl_keep>
413 C<__isl_keep> means that the function will only use the object
414 temporarily.  After the function has finished, the user
415 can still use it as an argument to other functions.
416 A C<NULL> value will be treated in the same way as
417 a C<NULL> value for an C<__isl_take> argument.
418 This annotation may also be used on return values of
419 type C<const char *>, in which case the returned pointer should
420 not be freed by the user and is only valid until the object
421 from which it was derived is updated or freed.
423 =back
425 =head2 Initialization
427 All manipulations of integer sets and relations occur within
428 the context of an C<isl_ctx>.
429 A given C<isl_ctx> can only be used within a single thread.
430 All arguments of a function are required to have been allocated
431 within the same context.
432 There are currently no functions available for moving an object
433 from one C<isl_ctx> to another C<isl_ctx>.  This means that
434 there is currently no way of safely moving an object from one
435 thread to another, unless the whole C<isl_ctx> is moved.
437 An C<isl_ctx> can be allocated using C<isl_ctx_alloc> and
438 freed using C<isl_ctx_free>.
439 All objects allocated within an C<isl_ctx> should be freed
440 before the C<isl_ctx> itself is freed.
442         isl_ctx *isl_ctx_alloc();
443         void isl_ctx_free(isl_ctx *ctx);
445 The user can impose a bound on the number of low-level I<operations>
446 that can be performed by an C<isl_ctx>.  This bound can be set and
447 retrieved using the following functions.  A bound of zero means that
448 no bound is imposed.  The number of operations performed can be
449 reset using C<isl_ctx_reset_operations>.  Note that the number
450 of low-level operations needed to perform a high-level computation
451 may differ significantly across different versions
452 of C<isl>, but it should be the same across different platforms
453 for the same version of C<isl>.
455 Warning: This feature is experimental.  C<isl> has good support to abort and
456 bail out during the computation, but this feature may exercise error code paths
457 that are normally not used that much. Consequently, it is not unlikely that
458 hidden bugs will be exposed.
460         void isl_ctx_set_max_operations(isl_ctx *ctx,
461                 unsigned long max_operations);
462         unsigned long isl_ctx_get_max_operations(isl_ctx *ctx);
463         void isl_ctx_reset_operations(isl_ctx *ctx);
465 In order to be able to create an object in the same context
466 as another object, most object types (described later in
467 this document) provide a function to obtain the context
468 in which the object was created.
470         #include <isl/val.h>
471         isl_ctx *isl_val_get_ctx(__isl_keep isl_val *val);
472         isl_ctx *isl_multi_val_get_ctx(
473                 __isl_keep isl_multi_val *mv);
475         #include <isl/id.h>
476         isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
478         #include <isl/local_space.h>
479         isl_ctx *isl_local_space_get_ctx(
480                 __isl_keep isl_local_space *ls);
482         #include <isl/set.h>
483         isl_ctx *isl_set_list_get_ctx(
484                 __isl_keep isl_set_list *list);
486         #include <isl/aff.h>
487         isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
488         isl_ctx *isl_multi_aff_get_ctx(
489                 __isl_keep isl_multi_aff *maff);
490         isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pa);
491         isl_ctx *isl_pw_multi_aff_get_ctx(
492                 __isl_keep isl_pw_multi_aff *pma);
493         isl_ctx *isl_multi_pw_aff_get_ctx(
494                 __isl_keep isl_multi_pw_aff *mpa);
495         isl_ctx *isl_union_pw_aff_get_ctx(
496                 __isl_keep isl_union_pw_aff *upa);
497         isl_ctx *isl_union_pw_multi_aff_get_ctx(
498                 __isl_keep isl_union_pw_multi_aff *upma);
499         isl_ctx *isl_multi_union_pw_aff_get_ctx(
500                 __isl_keep isl_multi_union_pw_aff *mupa);
502         #include <isl/id_to_ast_expr.h>
503         isl_ctx *isl_id_to_ast_expr_get_ctx(
504                 __isl_keep id_to_ast_expr *id2expr);
506         #include <isl/point.h>
507         isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
509         #include <isl/vec.h>
510         isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
512         #include <isl/mat.h>
513         isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
515         #include <isl/vertices.h>
516         isl_ctx *isl_vertices_get_ctx(
517                 __isl_keep isl_vertices *vertices);
518         isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
519         isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
521         #include <isl/flow.h>
522         isl_ctx *isl_restriction_get_ctx(
523                 __isl_keep isl_restriction *restr);
525         #include <isl/schedule.h>
526         isl_ctx *isl_schedule_constraints_get_ctx(
527                 __isl_keep isl_schedule_constraints *sc);
529         #include <isl/band.h>
530         isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band);
532         #include <isl/ast_build.h>
533         isl_ctx *isl_ast_build_get_ctx(
534                 __isl_keep isl_ast_build *build);
536         #include <isl/ast.h>
537         isl_ctx *isl_ast_expr_get_ctx(
538                 __isl_keep isl_ast_expr *expr);
539         isl_ctx *isl_ast_node_get_ctx(
540                 __isl_keep isl_ast_node *node);
542 =head2 Values
544 An C<isl_val> represents an integer value, a rational value
545 or one of three special values, infinity, negative infinity and NaN.
546 Some predefined values can be created using the following functions.
548         #include <isl/val.h>
549         __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
550         __isl_give isl_val *isl_val_one(isl_ctx *ctx);
551         __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
552         __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
553         __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
554         __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
556 Specific integer values can be created using the following functions.
558         #include <isl/val.h>
559         __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
560                 long i);
561         __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
562                 unsigned long u);
563         __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
564                 size_t n, size_t size, const void *chunks);
566 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
567 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
568 The least significant digit is assumed to be stored first.
570 Value objects can be copied and freed using the following functions.
572         #include <isl/val.h>
573         __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
574         __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
576 They can be inspected using the following functions.
578         #include <isl/val.h>
579         long isl_val_get_num_si(__isl_keep isl_val *v);
580         long isl_val_get_den_si(__isl_keep isl_val *v);
581         double isl_val_get_d(__isl_keep isl_val *v);
582         size_t isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
583                 size_t size);
584         int isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
585                 size_t size, void *chunks);
587 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
588 of C<size> bytes needed to store the absolute value of the
589 numerator of C<v>.
590 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
591 which is assumed to have been preallocated by the caller.
592 The least significant digit is stored first.
593 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
594 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
595 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
597 An C<isl_val> can be modified using the following function.
599         #include <isl/val.h>
600         __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
601                 long i);
603 The following unary properties are defined on C<isl_val>s.
605         #include <isl/val.h>
606         int isl_val_sgn(__isl_keep isl_val *v);
607         int isl_val_is_zero(__isl_keep isl_val *v);
608         int isl_val_is_one(__isl_keep isl_val *v);
609         int isl_val_is_negone(__isl_keep isl_val *v);
610         int isl_val_is_nonneg(__isl_keep isl_val *v);
611         int isl_val_is_nonpos(__isl_keep isl_val *v);
612         int isl_val_is_pos(__isl_keep isl_val *v);
613         int isl_val_is_neg(__isl_keep isl_val *v);
614         int isl_val_is_int(__isl_keep isl_val *v);
615         int isl_val_is_rat(__isl_keep isl_val *v);
616         int isl_val_is_nan(__isl_keep isl_val *v);
617         int isl_val_is_infty(__isl_keep isl_val *v);
618         int isl_val_is_neginfty(__isl_keep isl_val *v);
620 Note that the sign of NaN is undefined.
622 The following binary properties are defined on pairs of C<isl_val>s.
624         #include <isl/val.h>
625         int isl_val_lt(__isl_keep isl_val *v1,
626                 __isl_keep isl_val *v2);
627         int isl_val_le(__isl_keep isl_val *v1,
628                 __isl_keep isl_val *v2);
629         int isl_val_gt(__isl_keep isl_val *v1,
630                 __isl_keep isl_val *v2);
631         int isl_val_ge(__isl_keep isl_val *v1,
632                 __isl_keep isl_val *v2);
633         int isl_val_eq(__isl_keep isl_val *v1,
634                 __isl_keep isl_val *v2);
635         int isl_val_ne(__isl_keep isl_val *v1,
636                 __isl_keep isl_val *v2);
637         int isl_val_abs_eq(__isl_keep isl_val *v1,
638                 __isl_keep isl_val *v2);
640 The function C<isl_val_abs_eq> checks whether its two arguments
641 are equal in absolute value.
643 For integer C<isl_val>s we additionally have the following binary property.
645         #include <isl/val.h>
646         int isl_val_is_divisible_by(__isl_keep isl_val *v1,
647                 __isl_keep isl_val *v2);
649 An C<isl_val> can also be compared to an integer using the following
650 function.  The result is undefined for NaN.
652         #include <isl/val.h>
653         int isl_val_cmp_si(__isl_keep isl_val *v, long i);
655 The following unary operations are available on C<isl_val>s.
657         #include <isl/val.h>
658         __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
659         __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
660         __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
661         __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
662         __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
663         __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
664         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
666 The following binary operations are available on C<isl_val>s.
668         #include <isl/val.h>
669         __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
670                 __isl_take isl_val *v2);
671         __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
672                 __isl_take isl_val *v2);
673         __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
674                 __isl_take isl_val *v2);
675         __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
676                 unsigned long v2);
677         __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
678                 __isl_take isl_val *v2);
679         __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
680                 unsigned long v2);
681         __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
682                 __isl_take isl_val *v2);
683         __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
684                 unsigned long v2);
685         __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
686                 __isl_take isl_val *v2);
688 On integer values, we additionally have the following operations.
690         #include <isl/val.h>
691         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
692         __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
693                 __isl_take isl_val *v2);
694         __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
695                 __isl_take isl_val *v2);
696         __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
697                 __isl_take isl_val *v2, __isl_give isl_val **x,
698                 __isl_give isl_val **y);
700 The function C<isl_val_gcdext> returns the greatest common divisor g
701 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
702 that C<*x> * C<v1> + C<*y> * C<v2> = g.
704 =head3 GMP specific functions
706 These functions are only available if C<isl> has been compiled with C<GMP>
707 support.
709 Specific integer and rational values can be created from C<GMP> values using
710 the following functions.
712         #include <isl/val_gmp.h>
713         __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
714                 mpz_t z);
715         __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
716                 const mpz_t n, const mpz_t d);
718 The numerator and denominator of a rational value can be extracted as
719 C<GMP> values using the following functions.
721         #include <isl/val_gmp.h>
722         int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
723         int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
725 =head2 Sets and Relations
727 C<isl> uses six types of objects for representing sets and relations,
728 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
729 C<isl_union_set> and C<isl_union_map>.
730 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
731 can be described as a conjunction of affine constraints, while
732 C<isl_set> and C<isl_map> represent unions of
733 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
734 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
735 to live in the same space.  C<isl_union_set>s and C<isl_union_map>s
736 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
737 where spaces are considered different if they have a different number
738 of dimensions and/or different names (see L<"Spaces">).
739 The difference between sets and relations (maps) is that sets have
740 one set of variables, while relations have two sets of variables,
741 input variables and output variables.
743 =head2 Error Handling
745 C<isl> supports different ways to react in case a runtime error is triggered.
746 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
747 with two maps that have incompatible spaces. There are three possible ways
748 to react on error: to warn, to continue or to abort.
750 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
751 the last error in the corresponding C<isl_ctx> and the function in which the
752 error was triggered returns C<NULL>. An error does not corrupt internal state,
753 such that isl can continue to be used. C<isl> also provides functions to
754 read the last error and to reset the memory that stores the last error. The
755 last error is only stored for information purposes. Its presence does not
756 change the behavior of C<isl>. Hence, resetting an error is not required to
757 continue to use isl, but only to observe new errors.
759         #include <isl/ctx.h>
760         enum isl_error isl_ctx_last_error(isl_ctx *ctx);
761         void isl_ctx_reset_error(isl_ctx *ctx);
763 Another option is to continue on error. This is similar to warn on error mode,
764 except that C<isl> does not print any warning. This allows a program to
765 implement its own error reporting.
767 The last option is to directly abort the execution of the program from within
768 the isl library. This makes it obviously impossible to recover from an error,
769 but it allows to directly spot the error location. By aborting on error,
770 debuggers break at the location the error occurred and can provide a stack
771 trace. Other tools that automatically provide stack traces on abort or that do
772 not want to continue execution after an error was triggered may also prefer to
773 abort on error.
775 The on error behavior of isl can be specified by calling
776 C<isl_options_set_on_error> or by setting the command line option
777 C<--isl-on-error>. Valid arguments for the function call are
778 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
779 choices for the command line option are C<warn>, C<continue> and C<abort>.
780 It is also possible to query the current error mode.
782         #include <isl/options.h>
783         int isl_options_set_on_error(isl_ctx *ctx, int val);
784         int isl_options_get_on_error(isl_ctx *ctx);
786 =head2 Identifiers
788 Identifiers are used to identify both individual dimensions
789 and tuples of dimensions.  They consist of an optional name and an optional
790 user pointer.  The name and the user pointer cannot both be C<NULL>, however.
791 Identifiers with the same name but different pointer values
792 are considered to be distinct.
793 Similarly, identifiers with different names but the same pointer value
794 are also considered to be distinct.
795 Equal identifiers are represented using the same object.
796 Pairs of identifiers can therefore be tested for equality using the
797 C<==> operator.
798 Identifiers can be constructed, copied, freed, inspected and printed
799 using the following functions.
801         #include <isl/id.h>
802         __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
803                 __isl_keep const char *name, void *user);
804         __isl_give isl_id *isl_id_set_free_user(
805                 __isl_take isl_id *id,
806                 __isl_give void (*free_user)(void *user));
807         __isl_give isl_id *isl_id_copy(isl_id *id);
808         __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
810         void *isl_id_get_user(__isl_keep isl_id *id);
811         __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
813         __isl_give isl_printer *isl_printer_print_id(
814                 __isl_take isl_printer *p, __isl_keep isl_id *id);
816 The callback set by C<isl_id_set_free_user> is called on the user
817 pointer when the last reference to the C<isl_id> is freed.
818 Note that C<isl_id_get_name> returns a pointer to some internal
819 data structure, so the result can only be used while the
820 corresponding C<isl_id> is alive.
822 =head2 Spaces
824 Whenever a new set, relation or similar object is created from scratch,
825 the space in which it lives needs to be specified using an C<isl_space>.
826 Each space involves zero or more parameters and zero, one or two
827 tuples of set or input/output dimensions.  The parameters and dimensions
828 are identified by an C<isl_dim_type> and a position.
829 The type C<isl_dim_param> refers to parameters,
830 the type C<isl_dim_set> refers to set dimensions (for spaces
831 with a single tuple of dimensions) and the types C<isl_dim_in>
832 and C<isl_dim_out> refer to input and output dimensions
833 (for spaces with two tuples of dimensions).
834 Local spaces (see L</"Local Spaces">) also contain dimensions
835 of type C<isl_dim_div>.
836 Note that parameters are only identified by their position within
837 a given object.  Across different objects, parameters are (usually)
838 identified by their names or identifiers.  Only unnamed parameters
839 are identified by their positions across objects.  The use of unnamed
840 parameters is discouraged.
842         #include <isl/space.h>
843         __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
844                 unsigned nparam, unsigned n_in, unsigned n_out);
845         __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
846                 unsigned nparam);
847         __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
848                 unsigned nparam, unsigned dim);
849         __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
850         __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
852 The space used for creating a parameter domain
853 needs to be created using C<isl_space_params_alloc>.
854 For other sets, the space
855 needs to be created using C<isl_space_set_alloc>, while
856 for a relation, the space
857 needs to be created using C<isl_space_alloc>.
859 To check whether a given space is that of a set or a map
860 or whether it is a parameter space, use these functions:
862         #include <isl/space.h>
863         int isl_space_is_params(__isl_keep isl_space *space);
864         int isl_space_is_set(__isl_keep isl_space *space);
865         int isl_space_is_map(__isl_keep isl_space *space);
867 Spaces can be compared using the following functions:
869         #include <isl/space.h>
870         int isl_space_is_equal(__isl_keep isl_space *space1,
871                 __isl_keep isl_space *space2);
872         int isl_space_is_domain(__isl_keep isl_space *space1,
873                 __isl_keep isl_space *space2);
874         int isl_space_is_range(__isl_keep isl_space *space1,
875                 __isl_keep isl_space *space2);
876         int isl_space_tuple_is_equal(
877                 __isl_keep isl_space *space1,
878                 enum isl_dim_type type1,
879                 __isl_keep isl_space *space2,
880                 enum isl_dim_type type2);
882 C<isl_space_is_domain> checks whether the first argument is equal
883 to the domain of the second argument.  This requires in particular that
884 the first argument is a set space and that the second argument
885 is a map space.  C<isl_space_tuple_is_equal> checks whether the given
886 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
887 spaces are the same.  That is, it checks if they have the same
888 identifier (if any), the same dimension and the same internal structure
889 (if any).
891 It is often useful to create objects that live in the
892 same space as some other object.  This can be accomplished
893 by creating the new objects
894 (see L</"Creating New Sets and Relations"> or
895 L</"Functions">) based on the space
896 of the original object.
898         #include <isl/set.h>
899         __isl_give isl_space *isl_basic_set_get_space(
900                 __isl_keep isl_basic_set *bset);
901         __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
903         #include <isl/union_set.h>
904         __isl_give isl_space *isl_union_set_get_space(
905                 __isl_keep isl_union_set *uset);
907         #include <isl/map.h>
908         __isl_give isl_space *isl_basic_map_get_space(
909                 __isl_keep isl_basic_map *bmap);
910         __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
912         #include <isl/union_map.h>
913         __isl_give isl_space *isl_union_map_get_space(
914                 __isl_keep isl_union_map *umap);
916         #include <isl/constraint.h>
917         __isl_give isl_space *isl_constraint_get_space(
918                 __isl_keep isl_constraint *constraint);
920         #include <isl/polynomial.h>
921         __isl_give isl_space *isl_qpolynomial_get_domain_space(
922                 __isl_keep isl_qpolynomial *qp);
923         __isl_give isl_space *isl_qpolynomial_get_space(
924                 __isl_keep isl_qpolynomial *qp);
925         __isl_give isl_space *isl_qpolynomial_fold_get_space(
926                 __isl_keep isl_qpolynomial_fold *fold);
927         __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
928                 __isl_keep isl_pw_qpolynomial *pwqp);
929         __isl_give isl_space *isl_pw_qpolynomial_get_space(
930                 __isl_keep isl_pw_qpolynomial *pwqp);
931         __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
932                 __isl_keep isl_pw_qpolynomial_fold *pwf);
933         __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
934                 __isl_keep isl_pw_qpolynomial_fold *pwf);
935         __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
936                 __isl_keep isl_union_pw_qpolynomial *upwqp);
937         __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
938                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
940         #include <isl/val.h>
941         __isl_give isl_space *isl_multi_val_get_space(
942                 __isl_keep isl_multi_val *mv);
944         #include <isl/aff.h>
945         __isl_give isl_space *isl_aff_get_domain_space(
946                 __isl_keep isl_aff *aff);
947         __isl_give isl_space *isl_aff_get_space(
948                 __isl_keep isl_aff *aff);
949         __isl_give isl_space *isl_pw_aff_get_domain_space(
950                 __isl_keep isl_pw_aff *pwaff);
951         __isl_give isl_space *isl_pw_aff_get_space(
952                 __isl_keep isl_pw_aff *pwaff);
953         __isl_give isl_space *isl_multi_aff_get_domain_space(
954                 __isl_keep isl_multi_aff *maff);
955         __isl_give isl_space *isl_multi_aff_get_space(
956                 __isl_keep isl_multi_aff *maff);
957         __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
958                 __isl_keep isl_pw_multi_aff *pma);
959         __isl_give isl_space *isl_pw_multi_aff_get_space(
960                 __isl_keep isl_pw_multi_aff *pma);
961         __isl_give isl_space *isl_union_pw_aff_get_space(
962                 __isl_keep isl_union_pw_aff *upa);
963         __isl_give isl_space *isl_union_pw_multi_aff_get_space(
964                 __isl_keep isl_union_pw_multi_aff *upma);
965         __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
966                 __isl_keep isl_multi_pw_aff *mpa);
967         __isl_give isl_space *isl_multi_pw_aff_get_space(
968                 __isl_keep isl_multi_pw_aff *mpa);
969         __isl_give isl_space *
970         isl_multi_union_pw_aff_get_domain_space(
971                 __isl_keep isl_multi_union_pw_aff *mupa);
972         __isl_give isl_space *
973         isl_multi_union_pw_aff_get_space(
974                 __isl_keep isl_multi_union_pw_aff *mupa);
976         #include <isl/point.h>
977         __isl_give isl_space *isl_point_get_space(
978                 __isl_keep isl_point *pnt);
980 The number of dimensions of a given type of space
981 may be read off from a space or an object that lives
982 in a space using the following functions.
983 In case of C<isl_space_dim>, type may be
984 C<isl_dim_param>, C<isl_dim_in> (only for relations),
985 C<isl_dim_out> (only for relations), C<isl_dim_set>
986 (only for sets) or C<isl_dim_all>.
988         #include <isl/space.h>
989         unsigned isl_space_dim(__isl_keep isl_space *space,
990                 enum isl_dim_type type);
992         #include <isl/local_space.h>
993         int isl_local_space_dim(__isl_keep isl_local_space *ls,
994                 enum isl_dim_type type);
996         #include <isl/set.h>
997         unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
998                 enum isl_dim_type type);
999         unsigned isl_set_dim(__isl_keep isl_set *set,
1000                 enum isl_dim_type type);
1002         #include <isl/union_set.h>
1003         unsigned isl_union_set_dim(__isl_keep isl_union_set *uset,
1004                 enum isl_dim_type type);
1006         #include <isl/map.h>
1007         unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1008                 enum isl_dim_type type);
1009         unsigned isl_map_dim(__isl_keep isl_map *map,
1010                 enum isl_dim_type type);
1012         #include <isl/union_map.h>
1013         unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
1014                 enum isl_dim_type type);
1016         #include <isl/val.h>
1017         unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1018                 enum isl_dim_type type);
1020         #include <isl/aff.h>
1021         int isl_aff_dim(__isl_keep isl_aff *aff,
1022                 enum isl_dim_type type);
1023         unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1024                 enum isl_dim_type type);
1025         unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1026                 enum isl_dim_type type);
1027         unsigned isl_pw_multi_aff_dim(
1028                 __isl_keep isl_pw_multi_aff *pma,
1029                 enum isl_dim_type type);
1030         unsigned isl_multi_pw_aff_dim(
1031                 __isl_keep isl_multi_pw_aff *mpa,
1032                 enum isl_dim_type type);
1033         unsigned isl_union_pw_aff_dim(
1034                 __isl_keep isl_union_pw_aff *upa,
1035                 enum isl_dim_type type);
1036         unsigned isl_union_pw_multi_aff_dim(
1037                 __isl_keep isl_union_pw_multi_aff *upma,
1038                 enum isl_dim_type type);
1039         unsigned isl_multi_union_pw_aff_dim(
1040                 __isl_keep isl_multi_union_pw_aff *mupa,
1041                 enum isl_dim_type type);
1043         #include <isl/polynomial.h>
1044         unsigned isl_union_pw_qpolynomial_dim(
1045                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1046                 enum isl_dim_type type);
1047         unsigned isl_union_pw_qpolynomial_fold_dim(
1048                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1049                 enum isl_dim_type type);
1051 Note that an C<isl_union_set>, an C<isl_union_map>,
1052 an C<isl_union_pw_multi_aff>,
1053 an C<isl_union_pw_qpolynomial> and
1054 an C<isl_union_pw_qpolynomial_fold>
1055 only have parameters.
1057 The identifiers or names of the individual dimensions of spaces
1058 may be set or read off using the following functions on spaces
1059 or objects that live in spaces.
1060 These functions are mostly useful to obtain the identifiers, positions
1061 or names of the parameters.  Identifiers of individual dimensions are
1062 essentially only useful for printing.  They are ignored by all other
1063 operations and may not be preserved across those operations.
1065         #include <isl/space.h>
1066         __isl_give isl_space *isl_space_set_dim_id(
1067                 __isl_take isl_space *space,
1068                 enum isl_dim_type type, unsigned pos,
1069                 __isl_take isl_id *id);
1070         int isl_space_has_dim_id(__isl_keep isl_space *space,
1071                 enum isl_dim_type type, unsigned pos);
1072         __isl_give isl_id *isl_space_get_dim_id(
1073                 __isl_keep isl_space *space,
1074                 enum isl_dim_type type, unsigned pos);
1075         __isl_give isl_space *isl_space_set_dim_name(
1076                 __isl_take isl_space *space,
1077                  enum isl_dim_type type, unsigned pos,
1078                  __isl_keep const char *name);
1079         int isl_space_has_dim_name(__isl_keep isl_space *space,
1080                 enum isl_dim_type type, unsigned pos);
1081         __isl_keep const char *isl_space_get_dim_name(
1082                 __isl_keep isl_space *space,
1083                 enum isl_dim_type type, unsigned pos);
1085         #include <isl/local_space.h>
1086         __isl_give isl_local_space *isl_local_space_set_dim_id(
1087                 __isl_take isl_local_space *ls,
1088                 enum isl_dim_type type, unsigned pos,
1089                 __isl_take isl_id *id);
1090         int isl_local_space_has_dim_id(
1091                 __isl_keep isl_local_space *ls,
1092                 enum isl_dim_type type, unsigned pos);
1093         __isl_give isl_id *isl_local_space_get_dim_id(
1094                 __isl_keep isl_local_space *ls,
1095                 enum isl_dim_type type, unsigned pos);
1096         __isl_give isl_local_space *isl_local_space_set_dim_name(
1097                 __isl_take isl_local_space *ls,
1098                 enum isl_dim_type type, unsigned pos, const char *s);
1099         int isl_local_space_has_dim_name(
1100                 __isl_keep isl_local_space *ls,
1101                 enum isl_dim_type type, unsigned pos)
1102         const char *isl_local_space_get_dim_name(
1103                 __isl_keep isl_local_space *ls,
1104                 enum isl_dim_type type, unsigned pos);
1106         #include <isl/constraint.h>
1107         const char *isl_constraint_get_dim_name(
1108                 __isl_keep isl_constraint *constraint,
1109                 enum isl_dim_type type, unsigned pos);
1111         #include <isl/set.h>
1112         __isl_give isl_id *isl_basic_set_get_dim_id(
1113                 __isl_keep isl_basic_set *bset,
1114                 enum isl_dim_type type, unsigned pos);
1115         __isl_give isl_set *isl_set_set_dim_id(
1116                 __isl_take isl_set *set, enum isl_dim_type type,
1117                 unsigned pos, __isl_take isl_id *id);
1118         int isl_set_has_dim_id(__isl_keep isl_set *set,
1119                 enum isl_dim_type type, unsigned pos);
1120         __isl_give isl_id *isl_set_get_dim_id(
1121                 __isl_keep isl_set *set, enum isl_dim_type type,
1122                 unsigned pos);
1123         const char *isl_basic_set_get_dim_name(
1124                 __isl_keep isl_basic_set *bset,
1125                 enum isl_dim_type type, unsigned pos);
1126         int isl_set_has_dim_name(__isl_keep isl_set *set,
1127                 enum isl_dim_type type, unsigned pos);
1128         const char *isl_set_get_dim_name(
1129                 __isl_keep isl_set *set,
1130                 enum isl_dim_type type, unsigned pos);
1132         #include <isl/map.h>
1133         __isl_give isl_map *isl_map_set_dim_id(
1134                 __isl_take isl_map *map, enum isl_dim_type type,
1135                 unsigned pos, __isl_take isl_id *id);
1136         int isl_basic_map_has_dim_id(
1137                 __isl_keep isl_basic_map *bmap,
1138                 enum isl_dim_type type, unsigned pos);
1139         int isl_map_has_dim_id(__isl_keep isl_map *map,
1140                 enum isl_dim_type type, unsigned pos);
1141         __isl_give isl_id *isl_map_get_dim_id(
1142                 __isl_keep isl_map *map, enum isl_dim_type type,
1143                 unsigned pos);
1144         __isl_give isl_id *isl_union_map_get_dim_id(
1145                 __isl_keep isl_union_map *umap,
1146                 enum isl_dim_type type, unsigned pos);
1147         const char *isl_basic_map_get_dim_name(
1148                 __isl_keep isl_basic_map *bmap,
1149                 enum isl_dim_type type, unsigned pos);
1150         int isl_map_has_dim_name(__isl_keep isl_map *map,
1151                 enum isl_dim_type type, unsigned pos);
1152         const char *isl_map_get_dim_name(
1153                 __isl_keep isl_map *map,
1154                 enum isl_dim_type type, unsigned pos);
1156         #include <isl/val.h>
1157         __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1158                 __isl_take isl_multi_val *mv,
1159                 enum isl_dim_type type, unsigned pos,
1160                 __isl_take isl_id *id);
1161         __isl_give isl_id *isl_multi_val_get_dim_id(
1162                 __isl_keep isl_multi_val *mv,
1163                 enum isl_dim_type type, unsigned pos);
1164         __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1165                 __isl_take isl_multi_val *mv,
1166                 enum isl_dim_type type, unsigned pos, const char *s);
1168         #include <isl/aff.h>
1169         __isl_give isl_aff *isl_aff_set_dim_id(
1170                 __isl_take isl_aff *aff, enum isl_dim_type type,
1171                 unsigned pos, __isl_take isl_id *id);
1172         __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1173                 __isl_take isl_multi_aff *maff,
1174                 enum isl_dim_type type, unsigned pos,
1175                 __isl_take isl_id *id);
1176         __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1177                 __isl_take isl_pw_aff *pma,
1178                 enum isl_dim_type type, unsigned pos,
1179                 __isl_take isl_id *id);
1180         __isl_give isl_multi_pw_aff *
1181         isl_multi_pw_aff_set_dim_id(
1182                 __isl_take isl_multi_pw_aff *mpa,
1183                 enum isl_dim_type type, unsigned pos,
1184                 __isl_take isl_id *id);
1185         __isl_give isl_multi_union_pw_aff *
1186         isl_multi_union_pw_aff_set_dim_id(
1187                 __isl_take isl_multi_union_pw_aff *mupa,
1188                 enum isl_dim_type type, unsigned pos,
1189                 __isl_take isl_id *id);
1190         __isl_give isl_id *isl_multi_aff_get_dim_id(
1191                 __isl_keep isl_multi_aff *ma,
1192                 enum isl_dim_type type, unsigned pos);
1193         int isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1194                 enum isl_dim_type type, unsigned pos);
1195         __isl_give isl_id *isl_pw_aff_get_dim_id(
1196                 __isl_keep isl_pw_aff *pa,
1197                 enum isl_dim_type type, unsigned pos);
1198         __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1199                 __isl_keep isl_pw_multi_aff *pma,
1200                 enum isl_dim_type type, unsigned pos);
1201         __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1202                 __isl_keep isl_multi_pw_aff *mpa,
1203                 enum isl_dim_type type, unsigned pos);
1204         __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1205                 __isl_keep isl_multi_union_pw_aff *mupa,
1206                 enum isl_dim_type type, unsigned pos);
1207         __isl_give isl_aff *isl_aff_set_dim_name(
1208                 __isl_take isl_aff *aff, enum isl_dim_type type,
1209                 unsigned pos, const char *s);
1210         __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1211                 __isl_take isl_multi_aff *maff,
1212                 enum isl_dim_type type, unsigned pos, const char *s);
1213         __isl_give isl_multi_pw_aff *
1214         isl_multi_pw_aff_set_dim_name(
1215                 __isl_take isl_multi_pw_aff *mpa,
1216                 enum isl_dim_type type, unsigned pos, const char *s);
1217         __isl_give isl_union_pw_aff *
1218         isl_union_pw_aff_set_dim_name(
1219                 __isl_take isl_union_pw_aff *upa,
1220                 enum isl_dim_type type, unsigned pos,
1221                 const char *s);
1222         __isl_give isl_union_pw_multi_aff *
1223         isl_union_pw_multi_aff_set_dim_name(
1224                 __isl_take isl_union_pw_multi_aff *upma,
1225                 enum isl_dim_type type, unsigned pos,
1226                 const char *s);
1227         __isl_give isl_multi_union_pw_aff *
1228         isl_multi_union_pw_aff_set_dim_name(
1229                 __isl_take isl_multi_union_pw_aff *mupa,
1230                 enum isl_dim_type type, unsigned pos,
1231         const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1232                 enum isl_dim_type type, unsigned pos);
1233         const char *isl_pw_aff_get_dim_name(
1234                 __isl_keep isl_pw_aff *pa,
1235                 enum isl_dim_type type, unsigned pos);
1236         const char *isl_pw_multi_aff_get_dim_name(
1237                 __isl_keep isl_pw_multi_aff *pma,
1238                 enum isl_dim_type type, unsigned pos);
1240         #include <isl/polynomial.h>
1241         __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1242                 __isl_take isl_qpolynomial *qp,
1243                 enum isl_dim_type type, unsigned pos,
1244                 const char *s);
1245         __isl_give isl_pw_qpolynomial *
1246         isl_pw_qpolynomial_set_dim_name(
1247                 __isl_take isl_pw_qpolynomial *pwqp,
1248                 enum isl_dim_type type, unsigned pos,
1249                 const char *s);
1250         __isl_give isl_pw_qpolynomial_fold *
1251         isl_pw_qpolynomial_fold_set_dim_name(
1252                 __isl_take isl_pw_qpolynomial_fold *pwf,
1253                 enum isl_dim_type type, unsigned pos,
1254                 const char *s);
1255         __isl_give isl_union_pw_qpolynomial *
1256         isl_union_pw_qpolynomial_set_dim_name(
1257                 __isl_take isl_union_pw_qpolynomial *upwqp,
1258                 enum isl_dim_type type, unsigned pos,
1259                 const char *s);
1260         __isl_give isl_union_pw_qpolynomial_fold *
1261         isl_union_pw_qpolynomial_fold_set_dim_name(
1262                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1263                 enum isl_dim_type type, unsigned pos,
1264                 const char *s);
1266 Note that C<isl_space_get_name> returns a pointer to some internal
1267 data structure, so the result can only be used while the
1268 corresponding C<isl_space> is alive.
1269 Also note that every function that operates on two sets or relations
1270 requires that both arguments have the same parameters.  This also
1271 means that if one of the arguments has named parameters, then the
1272 other needs to have named parameters too and the names need to match.
1273 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1274 arguments may have different parameters (as long as they are named),
1275 in which case the result will have as parameters the union of the parameters of
1276 the arguments.
1278 Given the identifier or name of a dimension (typically a parameter),
1279 its position can be obtained from the following functions.
1281         #include <isl/space.h>
1282         int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1283                 enum isl_dim_type type, __isl_keep isl_id *id);
1284         int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1285                 enum isl_dim_type type, const char *name);
1287         #include <isl/local_space.h>
1288         int isl_local_space_find_dim_by_name(
1289                 __isl_keep isl_local_space *ls,
1290                 enum isl_dim_type type, const char *name);
1292         #include <isl/val.h>
1293         int isl_multi_val_find_dim_by_id(
1294                 __isl_keep isl_multi_val *mv,
1295                 enum isl_dim_type type, __isl_keep isl_id *id);
1296         int isl_multi_val_find_dim_by_name(
1297                 __isl_keep isl_multi_val *mv,
1298                 enum isl_dim_type type, const char *name);
1300         #include <isl/set.h>
1301         int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1302                 enum isl_dim_type type, __isl_keep isl_id *id);
1303         int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1304                 enum isl_dim_type type, const char *name);
1306         #include <isl/map.h>
1307         int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1308                 enum isl_dim_type type, __isl_keep isl_id *id);
1309         int isl_basic_map_find_dim_by_name(
1310                 __isl_keep isl_basic_map *bmap,
1311                 enum isl_dim_type type, const char *name);
1312         int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1313                 enum isl_dim_type type, const char *name);
1314         int isl_union_map_find_dim_by_name(
1315                 __isl_keep isl_union_map *umap,
1316                 enum isl_dim_type type, const char *name);
1318         #include <isl/aff.h>
1319         int isl_multi_aff_find_dim_by_id(
1320                 __isl_keep isl_multi_aff *ma,
1321                 enum isl_dim_type type, __isl_keep isl_id *id);
1322         int isl_multi_pw_aff_find_dim_by_id(
1323                 __isl_keep isl_multi_pw_aff *mpa,
1324                 enum isl_dim_type type, __isl_keep isl_id *id);
1325         int isl_multi_union_pw_aff_find_dim_by_id(
1326                 __isl_keep isl_union_multi_pw_aff *mupa,
1327                 enum isl_dim_type type, __isl_keep isl_id *id);
1328         int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1329                 enum isl_dim_type type, const char *name);
1330         int isl_multi_aff_find_dim_by_name(
1331                 __isl_keep isl_multi_aff *ma,
1332                 enum isl_dim_type type, const char *name);
1333         int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1334                 enum isl_dim_type type, const char *name);
1335         int isl_multi_pw_aff_find_dim_by_name(
1336                 __isl_keep isl_multi_pw_aff *mpa,
1337                 enum isl_dim_type type, const char *name);
1338         int isl_pw_multi_aff_find_dim_by_name(
1339                 __isl_keep isl_pw_multi_aff *pma,
1340                 enum isl_dim_type type, const char *name);
1341         int isl_union_pw_aff_find_dim_by_name(
1342                 __isl_keep isl_union_pw_aff *upa,
1343                 enum isl_dim_type type, const char *name);
1344         int isl_union_pw_multi_aff_find_dim_by_name(
1345                 __isl_keep isl_union_pw_multi_aff *upma,
1346                 enum isl_dim_type type, const char *name);
1347         int isl_multi_union_pw_aff_find_dim_by_name(
1348                 __isl_keep isl_multi_union_pw_aff *mupa,
1349                 enum isl_dim_type type, const char *name);
1351         #include <isl/polynomial.h>
1352         int isl_pw_qpolynomial_find_dim_by_name(
1353                 __isl_keep isl_pw_qpolynomial *pwqp,
1354                 enum isl_dim_type type, const char *name);
1355         int isl_pw_qpolynomial_fold_find_dim_by_name(
1356                 __isl_keep isl_pw_qpolynomial_fold *pwf,
1357                 enum isl_dim_type type, const char *name);
1358         int isl_union_pw_qpolynomial_find_dim_by_name(
1359                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1360                 enum isl_dim_type type, const char *name);
1361         int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1362                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1363                 enum isl_dim_type type, const char *name);
1365 The identifiers or names of entire spaces may be set or read off
1366 using the following functions.
1368         #include <isl/space.h>
1369         __isl_give isl_space *isl_space_set_tuple_id(
1370                 __isl_take isl_space *space,
1371                 enum isl_dim_type type, __isl_take isl_id *id);
1372         __isl_give isl_space *isl_space_reset_tuple_id(
1373                 __isl_take isl_space *space, enum isl_dim_type type);
1374         int isl_space_has_tuple_id(__isl_keep isl_space *space,
1375                 enum isl_dim_type type);
1376         __isl_give isl_id *isl_space_get_tuple_id(
1377                 __isl_keep isl_space *space, enum isl_dim_type type);
1378         __isl_give isl_space *isl_space_set_tuple_name(
1379                 __isl_take isl_space *space,
1380                 enum isl_dim_type type, const char *s);
1381         int isl_space_has_tuple_name(__isl_keep isl_space *space,
1382                 enum isl_dim_type type);
1383         const char *isl_space_get_tuple_name(__isl_keep isl_space *space,
1384                 enum isl_dim_type type);
1386         #include <isl/local_space.h>
1387         __isl_give isl_local_space *isl_local_space_set_tuple_id(
1388                 __isl_take isl_local_space *ls,
1389                 enum isl_dim_type type, __isl_take isl_id *id);
1391         #include <isl/set.h>
1392         __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1393                 __isl_take isl_basic_set *bset,
1394                 __isl_take isl_id *id);
1395         __isl_give isl_set *isl_set_set_tuple_id(
1396                 __isl_take isl_set *set, __isl_take isl_id *id);
1397         __isl_give isl_set *isl_set_reset_tuple_id(
1398                 __isl_take isl_set *set);
1399         int isl_set_has_tuple_id(__isl_keep isl_set *set);
1400         __isl_give isl_id *isl_set_get_tuple_id(
1401                 __isl_keep isl_set *set);
1402         __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1403                 __isl_take isl_basic_set *set, const char *s);
1404         __isl_give isl_set *isl_set_set_tuple_name(
1405                 __isl_take isl_set *set, const char *s);
1406         const char *isl_basic_set_get_tuple_name(
1407                 __isl_keep isl_basic_set *bset);
1408         int isl_set_has_tuple_name(__isl_keep isl_set *set);
1409         const char *isl_set_get_tuple_name(
1410                 __isl_keep isl_set *set);
1412         #include <isl/map.h>
1413         __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1414                 __isl_take isl_basic_map *bmap,
1415                 enum isl_dim_type type, __isl_take isl_id *id);
1416         __isl_give isl_map *isl_map_set_tuple_id(
1417                 __isl_take isl_map *map, enum isl_dim_type type,
1418                 __isl_take isl_id *id);
1419         __isl_give isl_map *isl_map_reset_tuple_id(
1420                 __isl_take isl_map *map, enum isl_dim_type type);
1421         int isl_map_has_tuple_id(__isl_keep isl_map *map,
1422                 enum isl_dim_type type);
1423         __isl_give isl_id *isl_map_get_tuple_id(
1424                 __isl_keep isl_map *map, enum isl_dim_type type);
1425         __isl_give isl_map *isl_map_set_tuple_name(
1426                 __isl_take isl_map *map,
1427                 enum isl_dim_type type, const char *s);
1428         const char *isl_basic_map_get_tuple_name(
1429                 __isl_keep isl_basic_map *bmap,
1430                 enum isl_dim_type type);
1431         __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1432                 __isl_take isl_basic_map *bmap,
1433                 enum isl_dim_type type, const char *s);
1434         int isl_map_has_tuple_name(__isl_keep isl_map *map,
1435                 enum isl_dim_type type);
1436         const char *isl_map_get_tuple_name(
1437                 __isl_keep isl_map *map,
1438                 enum isl_dim_type type);
1440         #include <isl/val.h>
1441         __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1442                 __isl_take isl_multi_val *mv,
1443                 enum isl_dim_type type, __isl_take isl_id *id);
1444         __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1445                 __isl_take isl_multi_val *mv,
1446                 enum isl_dim_type type);
1447         int isl_multi_val_has_tuple_id(__isl_keep isl_multi_val *mv,
1448                 enum isl_dim_type type);
1449         __isl_give isl_id *isl_multi_val_get_tuple_id(
1450                 __isl_keep isl_multi_val *mv,
1451                 enum isl_dim_type type);
1452         __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1453                 __isl_take isl_multi_val *mv,
1454                 enum isl_dim_type type, const char *s);
1455         const char *isl_multi_val_get_tuple_name(
1456                 __isl_keep isl_multi_val *mv,
1457                 enum isl_dim_type type);
1459         #include <isl/aff.h>
1460         __isl_give isl_aff *isl_aff_set_tuple_id(
1461                 __isl_take isl_aff *aff,
1462                 enum isl_dim_type type, __isl_take isl_id *id);
1463         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1464                 __isl_take isl_multi_aff *maff,
1465                 enum isl_dim_type type, __isl_take isl_id *id);
1466         __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1467                 __isl_take isl_pw_aff *pwaff,
1468                 enum isl_dim_type type, __isl_take isl_id *id);
1469         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1470                 __isl_take isl_pw_multi_aff *pma,
1471                 enum isl_dim_type type, __isl_take isl_id *id);
1472         __isl_give isl_multi_union_pw_aff *
1473         isl_multi_union_pw_aff_set_tuple_id(
1474                 __isl_take isl_multi_union_pw_aff *mupa,
1475                 enum isl_dim_type type, __isl_take isl_id *id);
1476         __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1477                 __isl_take isl_multi_aff *ma,
1478                 enum isl_dim_type type);
1479         __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1480                 __isl_take isl_pw_aff *pa,
1481                 enum isl_dim_type type);
1482         __isl_give isl_multi_pw_aff *
1483         isl_multi_pw_aff_reset_tuple_id(
1484                 __isl_take isl_multi_pw_aff *mpa,
1485                 enum isl_dim_type type);
1486         __isl_give isl_pw_multi_aff *
1487         isl_pw_multi_aff_reset_tuple_id(
1488                 __isl_take isl_pw_multi_aff *pma,
1489                 enum isl_dim_type type);
1490         __isl_give isl_multi_union_pw_aff *
1491         isl_multi_union_pw_aff_reset_tuple_id(
1492                 __isl_take isl_multi_union_pw_aff *mupa,
1493                 enum isl_dim_type type);
1494         int isl_multi_aff_has_tuple_id(__isl_keep isl_multi_aff *ma,
1495                 enum isl_dim_type type);
1496         __isl_give isl_id *isl_multi_aff_get_tuple_id(
1497                 __isl_keep isl_multi_aff *ma,
1498                 enum isl_dim_type type);
1499         int isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1500                 enum isl_dim_type type);
1501         __isl_give isl_id *isl_pw_aff_get_tuple_id(
1502                 __isl_keep isl_pw_aff *pa,
1503                 enum isl_dim_type type);
1504         int isl_pw_multi_aff_has_tuple_id(
1505                 __isl_keep isl_pw_multi_aff *pma,
1506                 enum isl_dim_type type);
1507         __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1508                 __isl_keep isl_pw_multi_aff *pma,
1509                 enum isl_dim_type type);
1510         int isl_multi_pw_aff_has_tuple_id(
1511                 __isl_keep isl_multi_pw_aff *mpa,
1512                 enum isl_dim_type type);
1513         __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1514                 __isl_keep isl_multi_pw_aff *mpa,
1515                 enum isl_dim_type type);
1516         int isl_multi_union_pw_aff_has_tuple_id(
1517                 __isl_keep isl_multi_union_pw_aff *mupa,
1518                 enum isl_dim_type type);
1519         __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1520                 __isl_keep isl_multi_union_pw_aff *mupa,
1521                 enum isl_dim_type type);
1522         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1523                 __isl_take isl_multi_aff *maff,
1524                 enum isl_dim_type type, const char *s);
1525         __isl_give isl_multi_pw_aff *
1526         isl_multi_pw_aff_set_tuple_name(
1527                 __isl_take isl_multi_pw_aff *mpa,
1528                 enum isl_dim_type type, const char *s);
1529         __isl_give isl_multi_union_pw_aff *
1530         isl_multi_union_pw_aff_set_tuple_name(
1531                 __isl_take isl_multi_union_pw_aff *mupa,
1532                 enum isl_dim_type type, const char *s);
1533         const char *isl_multi_aff_get_tuple_name(
1534                 __isl_keep isl_multi_aff *multi,
1535                 enum isl_dim_type type);
1536         int isl_pw_multi_aff_has_tuple_name(
1537                 __isl_keep isl_pw_multi_aff *pma,
1538                 enum isl_dim_type type);
1539         const char *isl_pw_multi_aff_get_tuple_name(
1540                 __isl_keep isl_pw_multi_aff *pma,
1541                 enum isl_dim_type type);
1542         const char *isl_multi_union_pw_aff_get_tuple_name(
1543                 __isl_keep isl_multi_union_pw_aff *mupa,
1544                 enum isl_dim_type type);
1546 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1547 or C<isl_dim_set>.  As with C<isl_space_get_name>,
1548 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1549 data structure.
1550 Binary operations require the corresponding spaces of their arguments
1551 to have the same name.
1553 To keep the names of all parameters and tuples, but reset the user pointers
1554 of all the corresponding identifiers, use the following function.
1556         #include <isl/space.h>
1557         __isl_give isl_space *isl_space_reset_user(
1558                 __isl_take isl_space *space);
1560         #include <isl/set.h>
1561         __isl_give isl_set *isl_set_reset_user(
1562                 __isl_take isl_set *set);
1564         #include <isl/map.h>
1565         __isl_give isl_map *isl_map_reset_user(
1566                 __isl_take isl_map *map);
1568         #include <isl/union_set.h>
1569         __isl_give isl_union_set *isl_union_set_reset_user(
1570                 __isl_take isl_union_set *uset);
1572         #include <isl/union_map.h>
1573         __isl_give isl_union_map *isl_union_map_reset_user(
1574                 __isl_take isl_union_map *umap);
1576         #include <isl/val.h>
1577         __isl_give isl_multi_val *isl_multi_val_reset_user(
1578                 __isl_take isl_multi_val *mv);
1580         #include <isl/aff.h>
1581         __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1582                 __isl_take isl_multi_aff *ma);
1583         __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1584                 __isl_take isl_pw_aff *pa);
1585         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1586                 __isl_take isl_multi_pw_aff *mpa);
1587         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1588                 __isl_take isl_pw_multi_aff *pma);
1589         __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1590                 __isl_take isl_union_pw_aff *upa);
1591         __isl_give isl_multi_union_pw_aff *
1592         isl_multi_union_pw_aff_reset_user(
1593                 __isl_take isl_multi_union_pw_aff *mupa);
1594         __isl_give isl_union_pw_multi_aff *
1595         isl_union_pw_multi_aff_reset_user(
1596                 __isl_take isl_union_pw_multi_aff *upma);
1598         #include <isl/polynomial.h>
1599         __isl_give isl_pw_qpolynomial *
1600         isl_pw_qpolynomial_reset_user(
1601                 __isl_take isl_pw_qpolynomial *pwqp);
1602         __isl_give isl_union_pw_qpolynomial *
1603         isl_union_pw_qpolynomial_reset_user(
1604                 __isl_take isl_union_pw_qpolynomial *upwqp);
1605         __isl_give isl_pw_qpolynomial_fold *
1606         isl_pw_qpolynomial_fold_reset_user(
1607                 __isl_take isl_pw_qpolynomial_fold *pwf);
1608         __isl_give isl_union_pw_qpolynomial_fold *
1609         isl_union_pw_qpolynomial_fold_reset_user(
1610                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1612 Spaces can be nested.  In particular, the domain of a set or
1613 the domain or range of a relation can be a nested relation.
1614 This process is also called I<wrapping>.
1615 The functions for detecting, constructing and deconstructing
1616 such nested spaces can be found in the wrapping properties
1617 of L</"Unary Properties">, the wrapping operations
1618 of L</"Unary Operations"> and the Cartesian product operations
1619 of L</"Basic Operations">.
1621 Spaces can be created from other spaces
1622 using the functions described in L</"Unary Operations">
1623 and L</"Binary Operations">.
1625 =head2 Local Spaces
1627 A local space is essentially a space with
1628 zero or more existentially quantified variables.
1629 The local space of various objects can be obtained
1630 using the following functions.
1632         #include <isl/constraint.h>
1633         __isl_give isl_local_space *isl_constraint_get_local_space(
1634                 __isl_keep isl_constraint *constraint);
1636         #include <isl/set.h>
1637         __isl_give isl_local_space *isl_basic_set_get_local_space(
1638                 __isl_keep isl_basic_set *bset);
1640         #include <isl/map.h>
1641         __isl_give isl_local_space *isl_basic_map_get_local_space(
1642                 __isl_keep isl_basic_map *bmap);
1644         #include <isl/aff.h>
1645         __isl_give isl_local_space *isl_aff_get_domain_local_space(
1646                 __isl_keep isl_aff *aff);
1647         __isl_give isl_local_space *isl_aff_get_local_space(
1648                 __isl_keep isl_aff *aff);
1650 A new local space can be created from a space using
1652         #include <isl/local_space.h>
1653         __isl_give isl_local_space *isl_local_space_from_space(
1654                 __isl_take isl_space *space);
1656 They can be inspected, modified, copied and freed using the following functions.
1658         #include <isl/local_space.h>
1659         int isl_local_space_is_params(
1660                 __isl_keep isl_local_space *ls);
1661         int isl_local_space_is_set(__isl_keep isl_local_space *ls);
1662         __isl_give isl_space *isl_local_space_get_space(
1663                 __isl_keep isl_local_space *ls);
1664         __isl_give isl_aff *isl_local_space_get_div(
1665                 __isl_keep isl_local_space *ls, int pos);
1666         __isl_give isl_local_space *isl_local_space_copy(
1667                 __isl_keep isl_local_space *ls);
1668         __isl_null isl_local_space *isl_local_space_free(
1669                 __isl_take isl_local_space *ls);
1671 Note that C<isl_local_space_get_div> can only be used on local spaces
1672 of sets.
1674 Two local spaces can be compared using
1676         int isl_local_space_is_equal(__isl_keep isl_local_space *ls1,
1677                 __isl_keep isl_local_space *ls2);
1679 Local spaces can be created from other local spaces
1680 using the functions described in L</"Unary Operations">
1681 and L</"Binary Operations">.
1683 =head2 Creating New Sets and Relations
1685 C<isl> has functions for creating some standard sets and relations.
1687 =over
1689 =item * Empty sets and relations
1691         __isl_give isl_basic_set *isl_basic_set_empty(
1692                 __isl_take isl_space *space);
1693         __isl_give isl_basic_map *isl_basic_map_empty(
1694                 __isl_take isl_space *space);
1695         __isl_give isl_set *isl_set_empty(
1696                 __isl_take isl_space *space);
1697         __isl_give isl_map *isl_map_empty(
1698                 __isl_take isl_space *space);
1699         __isl_give isl_union_set *isl_union_set_empty(
1700                 __isl_take isl_space *space);
1701         __isl_give isl_union_map *isl_union_map_empty(
1702                 __isl_take isl_space *space);
1704 For C<isl_union_set>s and C<isl_union_map>s, the space
1705 is only used to specify the parameters.
1707 =item * Universe sets and relations
1709         __isl_give isl_basic_set *isl_basic_set_universe(
1710                 __isl_take isl_space *space);
1711         __isl_give isl_basic_map *isl_basic_map_universe(
1712                 __isl_take isl_space *space);
1713         __isl_give isl_set *isl_set_universe(
1714                 __isl_take isl_space *space);
1715         __isl_give isl_map *isl_map_universe(
1716                 __isl_take isl_space *space);
1717         __isl_give isl_union_set *isl_union_set_universe(
1718                 __isl_take isl_union_set *uset);
1719         __isl_give isl_union_map *isl_union_map_universe(
1720                 __isl_take isl_union_map *umap);
1722 The sets and relations constructed by the functions above
1723 contain all integer values, while those constructed by the
1724 functions below only contain non-negative values.
1726         __isl_give isl_basic_set *isl_basic_set_nat_universe(
1727                 __isl_take isl_space *space);
1728         __isl_give isl_basic_map *isl_basic_map_nat_universe(
1729                 __isl_take isl_space *space);
1730         __isl_give isl_set *isl_set_nat_universe(
1731                 __isl_take isl_space *space);
1732         __isl_give isl_map *isl_map_nat_universe(
1733                 __isl_take isl_space *space);
1735 =item * Identity relations
1737         __isl_give isl_basic_map *isl_basic_map_identity(
1738                 __isl_take isl_space *space);
1739         __isl_give isl_map *isl_map_identity(
1740                 __isl_take isl_space *space);
1742 The number of input and output dimensions in C<space> needs
1743 to be the same.
1745 =item * Lexicographic order
1747         __isl_give isl_map *isl_map_lex_lt(
1748                 __isl_take isl_space *set_space);
1749         __isl_give isl_map *isl_map_lex_le(
1750                 __isl_take isl_space *set_space);
1751         __isl_give isl_map *isl_map_lex_gt(
1752                 __isl_take isl_space *set_space);
1753         __isl_give isl_map *isl_map_lex_ge(
1754                 __isl_take isl_space *set_space);
1755         __isl_give isl_map *isl_map_lex_lt_first(
1756                 __isl_take isl_space *space, unsigned n);
1757         __isl_give isl_map *isl_map_lex_le_first(
1758                 __isl_take isl_space *space, unsigned n);
1759         __isl_give isl_map *isl_map_lex_gt_first(
1760                 __isl_take isl_space *space, unsigned n);
1761         __isl_give isl_map *isl_map_lex_ge_first(
1762                 __isl_take isl_space *space, unsigned n);
1764 The first four functions take a space for a B<set>
1765 and return relations that express that the elements in the domain
1766 are lexicographically less
1767 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1768 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1769 than the elements in the range.
1770 The last four functions take a space for a map
1771 and return relations that express that the first C<n> dimensions
1772 in the domain are lexicographically less
1773 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1774 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1775 than the first C<n> dimensions in the range.
1777 =back
1779 A basic set or relation can be converted to a set or relation
1780 using the following functions.
1782         __isl_give isl_set *isl_set_from_basic_set(
1783                 __isl_take isl_basic_set *bset);
1784         __isl_give isl_map *isl_map_from_basic_map(
1785                 __isl_take isl_basic_map *bmap);
1787 Sets and relations can be converted to union sets and relations
1788 using the following functions.
1790         __isl_give isl_union_set *isl_union_set_from_basic_set(
1791                 __isl_take isl_basic_set *bset);
1792         __isl_give isl_union_map *isl_union_map_from_basic_map(
1793                 __isl_take isl_basic_map *bmap);
1794         __isl_give isl_union_set *isl_union_set_from_set(
1795                 __isl_take isl_set *set);
1796         __isl_give isl_union_map *isl_union_map_from_map(
1797                 __isl_take isl_map *map);
1799 The inverse conversions below can only be used if the input
1800 union set or relation is known to contain elements in exactly one
1801 space.
1803         __isl_give isl_set *isl_set_from_union_set(
1804                 __isl_take isl_union_set *uset);
1805         __isl_give isl_map *isl_map_from_union_map(
1806                 __isl_take isl_union_map *umap);
1808 Sets and relations can be copied and freed again using the following
1809 functions.
1811         __isl_give isl_basic_set *isl_basic_set_copy(
1812                 __isl_keep isl_basic_set *bset);
1813         __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1814         __isl_give isl_union_set *isl_union_set_copy(
1815                 __isl_keep isl_union_set *uset);
1816         __isl_give isl_basic_map *isl_basic_map_copy(
1817                 __isl_keep isl_basic_map *bmap);
1818         __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1819         __isl_give isl_union_map *isl_union_map_copy(
1820                 __isl_keep isl_union_map *umap);
1821         __isl_null isl_basic_set *isl_basic_set_free(
1822                 __isl_take isl_basic_set *bset);
1823         __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1824         __isl_null isl_union_set *isl_union_set_free(
1825                 __isl_take isl_union_set *uset);
1826         __isl_null isl_basic_map *isl_basic_map_free(
1827                 __isl_take isl_basic_map *bmap);
1828         __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1829         __isl_null isl_union_map *isl_union_map_free(
1830                 __isl_take isl_union_map *umap);
1832 Other sets and relations can be constructed by starting
1833 from a universe set or relation, adding equality and/or
1834 inequality constraints and then projecting out the
1835 existentially quantified variables, if any.
1836 Constraints can be constructed, manipulated and
1837 added to (or removed from) (basic) sets and relations
1838 using the following functions.
1840         #include <isl/constraint.h>
1841         __isl_give isl_constraint *isl_equality_alloc(
1842                 __isl_take isl_local_space *ls);
1843         __isl_give isl_constraint *isl_inequality_alloc(
1844                 __isl_take isl_local_space *ls);
1845         __isl_give isl_constraint *isl_constraint_set_constant_si(
1846                 __isl_take isl_constraint *constraint, int v);
1847         __isl_give isl_constraint *isl_constraint_set_constant_val(
1848                 __isl_take isl_constraint *constraint,
1849                 __isl_take isl_val *v);
1850         __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1851                 __isl_take isl_constraint *constraint,
1852                 enum isl_dim_type type, int pos, int v);
1853         __isl_give isl_constraint *
1854         isl_constraint_set_coefficient_val(
1855                 __isl_take isl_constraint *constraint,
1856                 enum isl_dim_type type, int pos,
1857                 __isl_take isl_val *v);
1858         __isl_give isl_basic_map *isl_basic_map_add_constraint(
1859                 __isl_take isl_basic_map *bmap,
1860                 __isl_take isl_constraint *constraint);
1861         __isl_give isl_basic_set *isl_basic_set_add_constraint(
1862                 __isl_take isl_basic_set *bset,
1863                 __isl_take isl_constraint *constraint);
1864         __isl_give isl_map *isl_map_add_constraint(
1865                 __isl_take isl_map *map,
1866                 __isl_take isl_constraint *constraint);
1867         __isl_give isl_set *isl_set_add_constraint(
1868                 __isl_take isl_set *set,
1869                 __isl_take isl_constraint *constraint);
1870         __isl_give isl_basic_set *isl_basic_set_drop_constraint(
1871                 __isl_take isl_basic_set *bset,
1872                 __isl_take isl_constraint *constraint);
1874 For example, to create a set containing the even integers
1875 between 10 and 42, you would use the following code.
1877         isl_space *space;
1878         isl_local_space *ls;
1879         isl_constraint *c;
1880         isl_basic_set *bset;
1882         space = isl_space_set_alloc(ctx, 0, 2);
1883         bset = isl_basic_set_universe(isl_space_copy(space));
1884         ls = isl_local_space_from_space(space);
1886         c = isl_equality_alloc(isl_local_space_copy(ls));
1887         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1888         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
1889         bset = isl_basic_set_add_constraint(bset, c);
1891         c = isl_inequality_alloc(isl_local_space_copy(ls));
1892         c = isl_constraint_set_constant_si(c, -10);
1893         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
1894         bset = isl_basic_set_add_constraint(bset, c);
1896         c = isl_inequality_alloc(ls);
1897         c = isl_constraint_set_constant_si(c, 42);
1898         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1899         bset = isl_basic_set_add_constraint(bset, c);
1901         bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
1903 Or, alternatively,
1905         isl_basic_set *bset;
1906         bset = isl_basic_set_read_from_str(ctx,
1907                 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
1909 A basic set or relation can also be constructed from two matrices
1910 describing the equalities and the inequalities.
1912         __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
1913                 __isl_take isl_space *space,
1914                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1915                 enum isl_dim_type c1,
1916                 enum isl_dim_type c2, enum isl_dim_type c3,
1917                 enum isl_dim_type c4);
1918         __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
1919                 __isl_take isl_space *space,
1920                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1921                 enum isl_dim_type c1,
1922                 enum isl_dim_type c2, enum isl_dim_type c3,
1923                 enum isl_dim_type c4, enum isl_dim_type c5);
1925 The C<isl_dim_type> arguments indicate the order in which
1926 different kinds of variables appear in the input matrices
1927 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
1928 C<isl_dim_set> and C<isl_dim_div> for sets and
1929 of C<isl_dim_cst>, C<isl_dim_param>,
1930 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
1932 A (basic or union) set or relation can also be constructed from a
1933 (union) (piecewise) (multiple) affine expression
1934 or a list of affine expressions
1935 (See L</"Functions">).
1937         __isl_give isl_basic_map *isl_basic_map_from_aff(
1938                 __isl_take isl_aff *aff);
1939         __isl_give isl_map *isl_map_from_aff(
1940                 __isl_take isl_aff *aff);
1941         __isl_give isl_set *isl_set_from_pw_aff(
1942                 __isl_take isl_pw_aff *pwaff);
1943         __isl_give isl_map *isl_map_from_pw_aff(
1944                 __isl_take isl_pw_aff *pwaff);
1945         __isl_give isl_basic_map *isl_basic_map_from_aff_list(
1946                 __isl_take isl_space *domain_space,
1947                 __isl_take isl_aff_list *list);
1948         __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
1949                 __isl_take isl_multi_aff *maff)
1950         __isl_give isl_map *isl_map_from_multi_aff(
1951                 __isl_take isl_multi_aff *maff)
1952         __isl_give isl_set *isl_set_from_pw_multi_aff(
1953                 __isl_take isl_pw_multi_aff *pma);
1954         __isl_give isl_map *isl_map_from_pw_multi_aff(
1955                 __isl_take isl_pw_multi_aff *pma);
1956         __isl_give isl_set *isl_set_from_multi_pw_aff(
1957                 __isl_take isl_multi_pw_aff *mpa);
1958         __isl_give isl_map *isl_map_from_multi_pw_aff(
1959                 __isl_take isl_multi_pw_aff *mpa);
1960         __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
1961                 __isl_take isl_union_pw_aff *upa);
1962         __isl_give isl_union_map *
1963         isl_union_map_from_union_pw_multi_aff(
1964                 __isl_take isl_union_pw_multi_aff *upma);
1965         __isl_give isl_union_map *
1966         isl_union_map_from_multi_union_pw_aff(
1967                 __isl_take isl_multi_union_pw_aff *mupa);
1969 The C<domain_space> argument describes the domain of the resulting
1970 basic relation.  It is required because the C<list> may consist
1971 of zero affine expressions.
1972 The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
1973 is not allowed to be zero-dimensional.  The domain of the result
1974 is the shared domain of the union piecewise affine elements.
1976 =head2 Inspecting Sets and Relations
1978 Usually, the user should not have to care about the actual constraints
1979 of the sets and maps, but should instead apply the abstract operations
1980 explained in the following sections.
1981 Occasionally, however, it may be required to inspect the individual
1982 coefficients of the constraints.  This section explains how to do so.
1983 In these cases, it may also be useful to have C<isl> compute
1984 an explicit representation of the existentially quantified variables.
1986         __isl_give isl_set *isl_set_compute_divs(
1987                 __isl_take isl_set *set);
1988         __isl_give isl_map *isl_map_compute_divs(
1989                 __isl_take isl_map *map);
1990         __isl_give isl_union_set *isl_union_set_compute_divs(
1991                 __isl_take isl_union_set *uset);
1992         __isl_give isl_union_map *isl_union_map_compute_divs(
1993                 __isl_take isl_union_map *umap);
1995 This explicit representation defines the existentially quantified
1996 variables as integer divisions of the other variables, possibly
1997 including earlier existentially quantified variables.
1998 An explicitly represented existentially quantified variable therefore
1999 has a unique value when the values of the other variables are known.
2000 If, furthermore, the same existentials, i.e., existentials
2001 with the same explicit representations, should appear in the
2002 same order in each of the disjuncts of a set or map, then the user should call
2003 either of the following functions.
2005         __isl_give isl_set *isl_set_align_divs(
2006                 __isl_take isl_set *set);
2007         __isl_give isl_map *isl_map_align_divs(
2008                 __isl_take isl_map *map);
2010 Alternatively, the existentially quantified variables can be removed
2011 using the following functions, which compute an overapproximation.
2013         __isl_give isl_basic_set *isl_basic_set_remove_divs(
2014                 __isl_take isl_basic_set *bset);
2015         __isl_give isl_basic_map *isl_basic_map_remove_divs(
2016                 __isl_take isl_basic_map *bmap);
2017         __isl_give isl_set *isl_set_remove_divs(
2018                 __isl_take isl_set *set);
2019         __isl_give isl_map *isl_map_remove_divs(
2020                 __isl_take isl_map *map);
2022 It is also possible to only remove those divs that are defined
2023 in terms of a given range of dimensions or only those for which
2024 no explicit representation is known.
2026         __isl_give isl_basic_set *
2027         isl_basic_set_remove_divs_involving_dims(
2028                 __isl_take isl_basic_set *bset,
2029                 enum isl_dim_type type,
2030                 unsigned first, unsigned n);
2031         __isl_give isl_basic_map *
2032         isl_basic_map_remove_divs_involving_dims(
2033                 __isl_take isl_basic_map *bmap,
2034                 enum isl_dim_type type,
2035                 unsigned first, unsigned n);
2036         __isl_give isl_set *isl_set_remove_divs_involving_dims(
2037                 __isl_take isl_set *set, enum isl_dim_type type,
2038                 unsigned first, unsigned n);
2039         __isl_give isl_map *isl_map_remove_divs_involving_dims(
2040                 __isl_take isl_map *map, enum isl_dim_type type,
2041                 unsigned first, unsigned n);
2043         __isl_give isl_basic_set *
2044         isl_basic_set_remove_unknown_divs(
2045                 __isl_take isl_basic_set *bset);
2046         __isl_give isl_set *isl_set_remove_unknown_divs(
2047                 __isl_take isl_set *set);
2048         __isl_give isl_map *isl_map_remove_unknown_divs(
2049                 __isl_take isl_map *map);
2051 To iterate over all the sets or maps in a union set or map, use
2053         int isl_union_set_foreach_set(__isl_keep isl_union_set *uset,
2054                 int (*fn)(__isl_take isl_set *set, void *user),
2055                 void *user);
2056         int isl_union_map_foreach_map(__isl_keep isl_union_map *umap,
2057                 int (*fn)(__isl_take isl_map *map, void *user),
2058                 void *user);
2060 The number of sets or maps in a union set or map can be obtained
2061 from
2063         int isl_union_set_n_set(__isl_keep isl_union_set *uset);
2064         int isl_union_map_n_map(__isl_keep isl_union_map *umap);
2066 To extract the set or map in a given space from a union, use
2068         __isl_give isl_set *isl_union_set_extract_set(
2069                 __isl_keep isl_union_set *uset,
2070                 __isl_take isl_space *space);
2071         __isl_give isl_map *isl_union_map_extract_map(
2072                 __isl_keep isl_union_map *umap,
2073                 __isl_take isl_space *space);
2075 To iterate over all the basic sets or maps in a set or map, use
2077         int isl_set_foreach_basic_set(__isl_keep isl_set *set,
2078                 int (*fn)(__isl_take isl_basic_set *bset, void *user),
2079                 void *user);
2080         int isl_map_foreach_basic_map(__isl_keep isl_map *map,
2081                 int (*fn)(__isl_take isl_basic_map *bmap, void *user),
2082                 void *user);
2084 The callback function C<fn> should return 0 if successful and
2085 -1 if an error occurs.  In the latter case, or if any other error
2086 occurs, the above functions will return -1.
2088 It should be noted that C<isl> does not guarantee that
2089 the basic sets or maps passed to C<fn> are disjoint.
2090 If this is required, then the user should call one of
2091 the following functions first.
2093         __isl_give isl_set *isl_set_make_disjoint(
2094                 __isl_take isl_set *set);
2095         __isl_give isl_map *isl_map_make_disjoint(
2096                 __isl_take isl_map *map);
2098 The number of basic sets in a set can be obtained
2099 or the number of basic maps in a map can be obtained
2100 from
2102         #include <isl/set.h>
2103         int isl_set_n_basic_set(__isl_keep isl_set *set);
2105         #include <isl/map.h>
2106         int isl_map_n_basic_map(__isl_keep isl_map *map);
2108 To iterate over the constraints of a basic set or map, use
2110         #include <isl/constraint.h>
2112         int isl_basic_set_n_constraint(
2113                 __isl_keep isl_basic_set *bset);
2114         int isl_basic_set_foreach_constraint(
2115                 __isl_keep isl_basic_set *bset,
2116                 int (*fn)(__isl_take isl_constraint *c, void *user),
2117                 void *user);
2118         int isl_basic_map_n_constraint(
2119                 __isl_keep isl_basic_map *bmap);
2120         int isl_basic_map_foreach_constraint(
2121                 __isl_keep isl_basic_map *bmap,
2122                 int (*fn)(__isl_take isl_constraint *c, void *user),
2123                 void *user);
2124         __isl_null isl_constraint *isl_constraint_free(
2125                 __isl_take isl_constraint *c);
2127 Again, the callback function C<fn> should return 0 if successful and
2128 -1 if an error occurs.  In the latter case, or if any other error
2129 occurs, the above functions will return -1.
2130 The constraint C<c> represents either an equality or an inequality.
2131 Use the following function to find out whether a constraint
2132 represents an equality.  If not, it represents an inequality.
2134         int isl_constraint_is_equality(
2135                 __isl_keep isl_constraint *constraint);
2137 It is also possible to obtain a list of constraints from a basic
2138 map or set
2140         #include <isl/constraint.h>
2141         __isl_give isl_constraint_list *
2142         isl_basic_map_get_constraint_list(
2143                 __isl_keep isl_basic_map *bmap);
2144         __isl_give isl_constraint_list *
2145         isl_basic_set_get_constraint_list(
2146                 __isl_keep isl_basic_set *bset);
2148 These functions require that all existentially quantified variables
2149 have an explicit representation.
2150 The returned list can be manipulated using the functions in L<"Lists">.
2152 The coefficients of the constraints can be inspected using
2153 the following functions.
2155         int isl_constraint_is_lower_bound(
2156                 __isl_keep isl_constraint *constraint,
2157                 enum isl_dim_type type, unsigned pos);
2158         int isl_constraint_is_upper_bound(
2159                 __isl_keep isl_constraint *constraint,
2160                 enum isl_dim_type type, unsigned pos);
2161         __isl_give isl_val *isl_constraint_get_constant_val(
2162                 __isl_keep isl_constraint *constraint);
2163         __isl_give isl_val *isl_constraint_get_coefficient_val(
2164                 __isl_keep isl_constraint *constraint,
2165                 enum isl_dim_type type, int pos);
2167 The explicit representations of the existentially quantified
2168 variables can be inspected using the following function.
2169 Note that the user is only allowed to use this function
2170 if the inspected set or map is the result of a call
2171 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2172 The existentially quantified variable is equal to the floor
2173 of the returned affine expression.  The affine expression
2174 itself can be inspected using the functions in
2175 L</"Functions">.
2177         __isl_give isl_aff *isl_constraint_get_div(
2178                 __isl_keep isl_constraint *constraint, int pos);
2180 To obtain the constraints of a basic set or map in matrix
2181 form, use the following functions.
2183         __isl_give isl_mat *isl_basic_set_equalities_matrix(
2184                 __isl_keep isl_basic_set *bset,
2185                 enum isl_dim_type c1, enum isl_dim_type c2,
2186                 enum isl_dim_type c3, enum isl_dim_type c4);
2187         __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2188                 __isl_keep isl_basic_set *bset,
2189                 enum isl_dim_type c1, enum isl_dim_type c2,
2190                 enum isl_dim_type c3, enum isl_dim_type c4);
2191         __isl_give isl_mat *isl_basic_map_equalities_matrix(
2192                 __isl_keep isl_basic_map *bmap,
2193                 enum isl_dim_type c1,
2194                 enum isl_dim_type c2, enum isl_dim_type c3,
2195                 enum isl_dim_type c4, enum isl_dim_type c5);
2196         __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2197                 __isl_keep isl_basic_map *bmap,
2198                 enum isl_dim_type c1,
2199                 enum isl_dim_type c2, enum isl_dim_type c3,
2200                 enum isl_dim_type c4, enum isl_dim_type c5);
2202 The C<isl_dim_type> arguments dictate the order in which
2203 different kinds of variables appear in the resulting matrix.
2204 For set inputs, they should be a permutation of
2205 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2206 For map inputs, they should be a permutation of
2207 C<isl_dim_cst>, C<isl_dim_param>,
2208 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2210 =head2 Points
2212 Points are elements of a set.  They can be used to construct
2213 simple sets (boxes) or they can be used to represent the
2214 individual elements of a set.
2215 The zero point (the origin) can be created using
2217         __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2219 The coordinates of a point can be inspected, set and changed
2220 using
2222         __isl_give isl_val *isl_point_get_coordinate_val(
2223                 __isl_keep isl_point *pnt,
2224                 enum isl_dim_type type, int pos);
2225         __isl_give isl_point *isl_point_set_coordinate_val(
2226                 __isl_take isl_point *pnt,
2227                 enum isl_dim_type type, int pos,
2228                 __isl_take isl_val *v);
2230         __isl_give isl_point *isl_point_add_ui(
2231                 __isl_take isl_point *pnt,
2232                 enum isl_dim_type type, int pos, unsigned val);
2233         __isl_give isl_point *isl_point_sub_ui(
2234                 __isl_take isl_point *pnt,
2235                 enum isl_dim_type type, int pos, unsigned val);
2237 Points can be copied or freed using
2239         __isl_give isl_point *isl_point_copy(
2240                 __isl_keep isl_point *pnt);
2241         void isl_point_free(__isl_take isl_point *pnt);
2243 A singleton set can be created from a point using
2245         __isl_give isl_basic_set *isl_basic_set_from_point(
2246                 __isl_take isl_point *pnt);
2247         __isl_give isl_set *isl_set_from_point(
2248                 __isl_take isl_point *pnt);
2250 and a box can be created from two opposite extremal points using
2252         __isl_give isl_basic_set *isl_basic_set_box_from_points(
2253                 __isl_take isl_point *pnt1,
2254                 __isl_take isl_point *pnt2);
2255         __isl_give isl_set *isl_set_box_from_points(
2256                 __isl_take isl_point *pnt1,
2257                 __isl_take isl_point *pnt2);
2259 All elements of a B<bounded> (union) set can be enumerated using
2260 the following functions.
2262         int isl_set_foreach_point(__isl_keep isl_set *set,
2263                 int (*fn)(__isl_take isl_point *pnt, void *user),
2264                 void *user);
2265         int isl_union_set_foreach_point(__isl_keep isl_union_set *uset,
2266                 int (*fn)(__isl_take isl_point *pnt, void *user),
2267                 void *user);
2269 The function C<fn> is called for each integer point in
2270 C<set> with as second argument the last argument of
2271 the C<isl_set_foreach_point> call.  The function C<fn>
2272 should return C<0> on success and C<-1> on failure.
2273 In the latter case, C<isl_set_foreach_point> will stop
2274 enumerating and return C<-1> as well.
2275 If the enumeration is performed successfully and to completion,
2276 then C<isl_set_foreach_point> returns C<0>.
2278 To obtain a single point of a (basic) set, use
2280         __isl_give isl_point *isl_basic_set_sample_point(
2281                 __isl_take isl_basic_set *bset);
2282         __isl_give isl_point *isl_set_sample_point(
2283                 __isl_take isl_set *set);
2285 If C<set> does not contain any (integer) points, then the
2286 resulting point will be ``void'', a property that can be
2287 tested using
2289         int isl_point_is_void(__isl_keep isl_point *pnt);
2291 =head2 Functions
2293 Besides sets and relation, C<isl> also supports various types of functions.
2294 Each of these types is derived from the value type (see L</"Values">)
2295 or from one of two primitive function types
2296 through the application of zero or more type constructors.
2297 We first describe the primitive type and then we describe
2298 the types derived from these primitive types.
2300 =head3 Primitive Functions
2302 C<isl> support two primitive function types, quasi-affine
2303 expressions and quasipolynomials.
2304 A quasi-affine expression is defined either over a parameter
2305 space or over a set and is composed of integer constants,
2306 parameters and set variables, addition, subtraction and
2307 integer division by an integer constant.
2308 For example, the quasi-affine expression
2310         [n] -> { [x] -> [2*floor((4 n + x)/9] }
2312 maps C<x> to C<2*floor((4 n + x)/9>.
2313 A quasipolynomial is a polynomial expression in quasi-affine
2314 expression.  That is, it additionally allows for multiplication.
2315 Note, though, that it is not allowed to construct an integer
2316 division of an expression involving multiplications.
2317 Here is an example of a quasipolynomial that is not
2318 quasi-affine expression
2320         [n] -> { [x] -> (n*floor((4 n + x)/9) }
2322 Note that the external representations of quasi-affine expressions
2323 and quasipolynomials are different.  Quasi-affine expressions
2324 use a notation with square brackets just like binary relations,
2325 while quasipolynomials do not.  This might change at some point.
2327 If a primitive function is defined over a parameter space,
2328 then the space of the function itself is that of a set.
2329 If it is defined over a set, then the space of the function
2330 is that of a relation.  In both cases, the set space (or
2331 the output space) is single-dimensional, anonymous and unstructured.
2332 To create functions with multiple dimensions or with other kinds
2333 of set or output spaces, use multiple expressions
2334 (see L</"Multiple Expressions">).
2336 =over
2338 =item * Quasi-affine Expressions
2340 Besides the expressions described above, a quasi-affine
2341 expression can also be set to NaN.  Such expressions
2342 typically represent a failure to represent a result
2343 as a quasi-affine expression.
2345 The zero quasi affine expression or the quasi affine expression
2346 that is equal to a given value or
2347 a specified dimension on a given domain can be created using
2349         #include <isl/aff.h>
2350         __isl_give isl_aff *isl_aff_zero_on_domain(
2351                 __isl_take isl_local_space *ls);
2352         __isl_give isl_aff *isl_aff_val_on_domain(
2353                 __isl_take isl_local_space *ls,
2354                 __isl_take isl_val *val);
2355         __isl_give isl_aff *isl_aff_var_on_domain(
2356                 __isl_take isl_local_space *ls,
2357                 enum isl_dim_type type, unsigned pos);
2358         __isl_give isl_aff *isl_aff_nan_on_domain(
2359                 __isl_take isl_local_space *ls);
2361 Quasi affine expressions can be copied and freed using
2363         #include <isl/aff.h>
2364         __isl_give isl_aff *isl_aff_copy(
2365                 __isl_keep isl_aff *aff);
2366         __isl_null isl_aff *isl_aff_free(
2367                 __isl_take isl_aff *aff);
2369 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2370 using the following function.  The constraint is required to have
2371 a non-zero coefficient for the specified dimension.
2373         #include <isl/constraint.h>
2374         __isl_give isl_aff *isl_constraint_get_bound(
2375                 __isl_keep isl_constraint *constraint,
2376                 enum isl_dim_type type, int pos);
2378 The entire affine expression of the constraint can also be extracted
2379 using the following function.
2381         #include <isl/constraint.h>
2382         __isl_give isl_aff *isl_constraint_get_aff(
2383                 __isl_keep isl_constraint *constraint);
2385 Conversely, an equality constraint equating
2386 the affine expression to zero or an inequality constraint enforcing
2387 the affine expression to be non-negative, can be constructed using
2389         __isl_give isl_constraint *isl_equality_from_aff(
2390                 __isl_take isl_aff *aff);
2391         __isl_give isl_constraint *isl_inequality_from_aff(
2392                 __isl_take isl_aff *aff);
2394 The coefficients and the integer divisions of an affine expression
2395 can be inspected using the following functions.
2397         #include <isl/aff.h>
2398         __isl_give isl_val *isl_aff_get_constant_val(
2399                 __isl_keep isl_aff *aff);
2400         __isl_give isl_val *isl_aff_get_coefficient_val(
2401                 __isl_keep isl_aff *aff,
2402                 enum isl_dim_type type, int pos);
2403         int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2404                 enum isl_dim_type type, int pos);
2405         __isl_give isl_val *isl_aff_get_denominator_val(
2406                 __isl_keep isl_aff *aff);
2407         __isl_give isl_aff *isl_aff_get_div(
2408                 __isl_keep isl_aff *aff, int pos);
2410 They can be modified using the following functions.
2412         #include <isl/aff.h>
2413         __isl_give isl_aff *isl_aff_set_constant_si(
2414                 __isl_take isl_aff *aff, int v);
2415         __isl_give isl_aff *isl_aff_set_constant_val(
2416                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2417         __isl_give isl_aff *isl_aff_set_coefficient_si(
2418                 __isl_take isl_aff *aff,
2419                 enum isl_dim_type type, int pos, int v);
2420         __isl_give isl_aff *isl_aff_set_coefficient_val(
2421                 __isl_take isl_aff *aff,
2422                 enum isl_dim_type type, int pos,
2423                 __isl_take isl_val *v);
2425         __isl_give isl_aff *isl_aff_add_constant_si(
2426                 __isl_take isl_aff *aff, int v);
2427         __isl_give isl_aff *isl_aff_add_constant_val(
2428                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2429         __isl_give isl_aff *isl_aff_add_constant_num_si(
2430                 __isl_take isl_aff *aff, int v);
2431         __isl_give isl_aff *isl_aff_add_coefficient_si(
2432                 __isl_take isl_aff *aff,
2433                 enum isl_dim_type type, int pos, int v);
2434         __isl_give isl_aff *isl_aff_add_coefficient_val(
2435                 __isl_take isl_aff *aff,
2436                 enum isl_dim_type type, int pos,
2437                 __isl_take isl_val *v);
2439 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2440 set the I<numerator> of the constant or coefficient, while
2441 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2442 the constant or coefficient as a whole.
2443 The C<add_constant> and C<add_coefficient> functions add an integer
2444 or rational value to
2445 the possibly rational constant or coefficient.
2446 The C<add_constant_num> functions add an integer value to
2447 the numerator.
2449 =item * Quasipolynomials
2451 Some simple quasipolynomials can be created using the following functions.
2453         #include <isl/polynomial.h>
2454         __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2455                 __isl_take isl_space *domain);
2456         __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2457                 __isl_take isl_space *domain);
2458         __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2459                 __isl_take isl_space *domain);
2460         __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2461                 __isl_take isl_space *domain);
2462         __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2463                 __isl_take isl_space *domain);
2464         __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2465                 __isl_take isl_space *domain,
2466                 __isl_take isl_val *val);
2467         __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2468                 __isl_take isl_space *domain,
2469                 enum isl_dim_type type, unsigned pos);
2470         __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2471                 __isl_take isl_aff *aff);
2473 Recall that the space in which a quasipolynomial lives is a map space
2474 with a one-dimensional range.  The C<domain> argument in some of
2475 the functions above corresponds to the domain of this map space.
2477 Quasipolynomials can be copied and freed again using the following
2478 functions.
2480         #include <isl/polynomial.h>
2481         __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2482                 __isl_keep isl_qpolynomial *qp);
2483         __isl_null isl_qpolynomial *isl_qpolynomial_free(
2484                 __isl_take isl_qpolynomial *qp);
2486 The constant term of a quasipolynomial can be extracted using
2488         __isl_give isl_val *isl_qpolynomial_get_constant_val(
2489                 __isl_keep isl_qpolynomial *qp);
2491 To iterate over all terms in a quasipolynomial,
2494         int isl_qpolynomial_foreach_term(
2495                 __isl_keep isl_qpolynomial *qp,
2496                 int (*fn)(__isl_take isl_term *term,
2497                           void *user), void *user);
2499 The terms themselves can be inspected and freed using
2500 these functions
2502         unsigned isl_term_dim(__isl_keep isl_term *term,
2503                 enum isl_dim_type type);
2504         __isl_give isl_val *isl_term_get_coefficient_val(
2505                 __isl_keep isl_term *term);
2506         int isl_term_get_exp(__isl_keep isl_term *term,
2507                 enum isl_dim_type type, unsigned pos);
2508         __isl_give isl_aff *isl_term_get_div(
2509                 __isl_keep isl_term *term, unsigned pos);
2510         void isl_term_free(__isl_take isl_term *term);
2512 Each term is a product of parameters, set variables and
2513 integer divisions.  The function C<isl_term_get_exp>
2514 returns the exponent of a given dimensions in the given term.
2516 =back
2518 =head3 Reductions
2520 A reduction represents a maximum or a minimum of its
2521 base expressions.
2522 The only reduction type defined by C<isl> is
2523 C<isl_qpolynomial_fold>.
2525 There are currently no functions to directly create such
2526 objects, but they do appear in the piecewise quasipolynomial
2527 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2529 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2531 Reductions can be copied and freed using
2532 the following functions.
2534         #include <isl/polynomial.h>
2535         __isl_give isl_qpolynomial_fold *
2536         isl_qpolynomial_fold_copy(
2537                 __isl_keep isl_qpolynomial_fold *fold);
2538         void isl_qpolynomial_fold_free(
2539                 __isl_take isl_qpolynomial_fold *fold);
2541 To iterate over all quasipolynomials in a reduction, use
2543         int isl_qpolynomial_fold_foreach_qpolynomial(
2544                 __isl_keep isl_qpolynomial_fold *fold,
2545                 int (*fn)(__isl_take isl_qpolynomial *qp,
2546                           void *user), void *user);
2548 =head3 Multiple Expressions
2550 A multiple expression represents a sequence of zero or
2551 more base expressions, all defined on the same domain space.
2552 The domain space of the multiple expression is the same
2553 as that of the base expressions, but the range space
2554 can be any space.  In case the base expressions have
2555 a set space, the corresponding multiple expression
2556 also has a set space.
2557 Objects of the value type do not have an associated space.
2558 The space of a multiple value is therefore always a set space.
2559 Similarly, the space of a multiple union piecewise
2560 affine expression is always a set space.
2562 The multiple expression types defined by C<isl>
2563 are C<isl_multi_val>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
2564 C<isl_multi_union_pw_aff>.
2566 A multiple expression with the value zero for
2567 each output (or set) dimension can be created
2568 using the following functions.
2570         #include <isl/val.h>
2571         __isl_give isl_multi_val *isl_multi_val_zero(
2572                 __isl_take isl_space *space);
2574         #include <isl/aff.h>
2575         __isl_give isl_multi_aff *isl_multi_aff_zero(
2576                 __isl_take isl_space *space);
2577         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2578                 __isl_take isl_space *space);
2579         __isl_give isl_multi_union_pw_aff *
2580         isl_multi_union_pw_aff_zero(
2581                 __isl_take isl_space *space);
2583 Since there is no canonical way of representing a zero
2584 value of type C<isl_union_pw_aff>, the space passed
2585 to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
2587 An identity function can be created using the following
2588 functions.  The space needs to be that of a relation
2589 with the same number of input and output dimensions.
2591         #include <isl/aff.h>
2592         __isl_give isl_multi_aff *isl_multi_aff_identity(
2593                 __isl_take isl_space *space);
2594         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2595                 __isl_take isl_space *space);
2597 A function that performs a projection on a universe
2598 relation or set can be created using the following functions.
2599 See also the corresponding
2600 projection operations in L</"Unary Operations">.
2602         #include <isl/aff.h>
2603         __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2604                 __isl_take isl_space *space);
2605         __isl_give isl_multi_aff *isl_multi_aff_range_map(
2606                 __isl_take isl_space *space);
2607         __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2608                 __isl_take isl_space *space,
2609                 enum isl_dim_type type,
2610                 unsigned first, unsigned n);
2612 A multiple expression can be created from a single
2613 base expression using the following functions.
2614 The space of the created multiple expression is the same
2615 as that of the base expression, except for
2616 C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
2617 lives in a parameter space and the output lives
2618 in a single-dimensional set space.
2620         #include <isl/aff.h>
2621         __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2622                 __isl_take isl_aff *aff);
2623         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2624                 __isl_take isl_pw_aff *pa);
2625         __isl_give isl_multi_union_pw_aff *
2626         isl_multi_union_pw_aff_from_union_pw_aff(
2627                 __isl_take isl_union_pw_aff *upa);
2629 A multiple expression can be created from a list
2630 of base expression in a specified space.
2631 The domain of this space needs to be the same
2632 as the domains of the base expressions in the list.
2633 If the base expressions have a set space (or no associated space),
2634 then this space also needs to be a set space.
2636         #include <isl/val.h>
2637         __isl_give isl_multi_val *isl_multi_val_from_val_list(
2638                 __isl_take isl_space *space,
2639                 __isl_take isl_val_list *list);
2641         #include <isl/aff.h>
2642         __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2643                 __isl_take isl_space *space,
2644                 __isl_take isl_aff_list *list);
2645         __isl_give isl_multi_union_pw_aff *
2646         isl_multi_union_pw_aff_from_union_pw_aff_list(
2647                 __isl_take isl_space *space,
2648                 __isl_take isl_union_pw_aff_list *list);
2650 As a convenience, a multiple piecewise expression can
2651 also be created from a multiple expression.
2652 Each piecewise expression in the result has a single
2653 universe cell.
2655         #include <isl/aff.h>
2656         __isl_give isl_multi_pw_aff *
2657         isl_multi_pw_aff_from_multi_aff(
2658                 __isl_take isl_multi_aff *ma);
2660 Similarly, a multiple union expression can be
2661 created from a multiple expression.
2663         #include <isl/aff.h>
2664         __isl_give isl_multi_union_pw_aff *
2665         isl_multi_union_pw_aff_from_multi_aff(
2666                 __isl_take isl_multi_aff *ma);
2667         __isl_give isl_multi_union_pw_aff *
2668         isl_multi_union_pw_aff_from_multi_pw_aff(
2669                 __isl_take isl_multi_pw_aff *mpa);
2671 A multiple quasi-affine expression can be created from
2672 a multiple value with a given domain space using the following
2673 function.
2675         #include <isl/aff.h>
2676         __isl_give isl_multi_aff *
2677         isl_multi_aff_multi_val_on_space(
2678                 __isl_take isl_space *space,
2679                 __isl_take isl_multi_val *mv);
2681 Similarly,
2682 a multiple union piecewise affine expression can be created from
2683 a multiple value with a given domain or
2684 a multiple affine expression with a given domain
2685 using the following functions.
2687         #include <isl/aff.h>
2688         __isl_give isl_multi_union_pw_aff *
2689         isl_multi_union_pw_aff_multi_val_on_domain(
2690                 __isl_take isl_union_set *domain,
2691                 __isl_take isl_multi_val *mv);
2692         __isl_give isl_multi_union_pw_aff *
2693         isl_multi_union_pw_aff_multi_aff_on_domain(
2694                 __isl_take isl_union_set *domain,
2695                 __isl_take isl_multi_aff *ma);
2697 Multiple expressions can be copied and freed using
2698 the following functions.
2700         #include <isl/val.h>
2701         __isl_give isl_multi_val *isl_multi_val_copy(
2702                 __isl_keep isl_multi_val *mv);
2703         __isl_null isl_multi_val *isl_multi_val_free(
2704                 __isl_take isl_multi_val *mv);
2706         #include <isl/aff.h>
2707         __isl_give isl_multi_aff *isl_multi_aff_copy(
2708                 __isl_keep isl_multi_aff *maff);
2709         __isl_null isl_multi_aff *isl_multi_aff_free(
2710                 __isl_take isl_multi_aff *maff);
2711         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2712                 __isl_keep isl_multi_pw_aff *mpa);
2713         __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2714                 __isl_take isl_multi_pw_aff *mpa);
2715         __isl_give isl_multi_union_pw_aff *
2716         isl_multi_union_pw_aff_copy(
2717                 __isl_keep isl_multi_union_pw_aff *mupa);
2718         __isl_null isl_multi_union_pw_aff *
2719         isl_multi_union_pw_aff_free(
2720                 __isl_take isl_multi_union_pw_aff *mupa);
2722 The base expression at a given position of a multiple
2723 expression can be extracted using the following functions.
2725         #include <isl/val.h>
2726         __isl_give isl_val *isl_multi_val_get_val(
2727                 __isl_keep isl_multi_val *mv, int pos);
2729         #include <isl/aff.h>
2730         __isl_give isl_aff *isl_multi_aff_get_aff(
2731                 __isl_keep isl_multi_aff *multi, int pos);
2732         __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2733                 __isl_keep isl_multi_pw_aff *mpa, int pos);
2734         __isl_give isl_union_pw_aff *
2735         isl_multi_union_pw_aff_get_union_pw_aff(
2736                 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
2738 It can be replaced using the following functions.
2740         #include <isl/val.h>
2741         __isl_give isl_multi_val *isl_multi_val_set_val(
2742                 __isl_take isl_multi_val *mv, int pos,
2743                 __isl_take isl_val *val);
2745         #include <isl/aff.h>
2746         __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2747                 __isl_take isl_multi_aff *multi, int pos,
2748                 __isl_take isl_aff *aff);
2749         __isl_give isl_multi_union_pw_aff *
2750         isl_multi_union_pw_aff_set_union_pw_aff(
2751                 __isl_take isl_multi_union_pw_aff *mupa, int pos,
2752                 __isl_take isl_union_pw_aff *upa);
2754 As a convenience, a sequence of base expressions that have
2755 their domains in a given space can be extracted from a sequence
2756 of union expressions using the following function.
2758         #include <isl/aff.h>
2759         __isl_give isl_multi_pw_aff *
2760         isl_multi_union_pw_aff_extract_multi_pw_aff(
2761                 __isl_keep isl_multi_union_pw_aff *mupa,
2762                 __isl_take isl_space *space);
2764 Note that there is a difference between C<isl_multi_union_pw_aff>
2765 and C<isl_union_pw_multi_aff> objects.  The first is a sequence
2766 of unions of piecewise expressions, while the second is a union
2767 of piecewise sequences.  In particular, multiple affine expressions
2768 in an C<isl_union_pw_multi_aff> may live in different spaces,
2769 while there is only a single multiple expression in
2770 an C<isl_multi_union_pw_aff>, which can therefore only live
2771 in a single space.  This means that not every
2772 C<isl_union_pw_multi_aff> can be converted to
2773 an C<isl_multi_union_pw_aff>.  Conversely, a zero-dimensional
2774 C<isl_multi_union_pw_aff> carries no information
2775 about any possible domain and therefore cannot be converted
2776 to an C<isl_union_pw_multi_aff>.  Moreover, the elements
2777 of an C<isl_multi_union_pw_aff> may be defined over different domains,
2778 while each multiple expression inside an C<isl_union_pw_multi_aff>
2779 has a single domain.  The conversion of an C<isl_union_pw_multi_aff>
2780 of dimension greater than one may therefore not be exact.
2781 The following functions can
2782 be used to perform these conversions when they are possible.
2784         #include <isl/aff.h>
2785         __isl_give isl_multi_union_pw_aff *
2786         isl_multi_union_pw_aff_from_union_pw_multi_aff(
2787                 __isl_take isl_union_pw_multi_aff *upma);
2788         __isl_give isl_union_pw_multi_aff *
2789         isl_union_pw_multi_aff_from_multi_union_pw_aff(
2790                 __isl_take isl_multi_union_pw_aff *mupa);
2792 =head3 Piecewise Expressions
2794 A piecewise expression is an expression that is described
2795 using zero or more base expression defined over the same
2796 number of cells in the domain space of the base expressions.
2797 All base expressions are defined over the same
2798 domain space and the cells are disjoint.
2799 The space of a piecewise expression is the same as
2800 that of the base expressions.
2801 If the union of the cells is a strict subset of the domain
2802 space, then the value of the piecewise expression outside
2803 this union is different for types derived from quasi-affine
2804 expressions and those derived from quasipolynomials.
2805 Piecewise expressions derived from quasi-affine expressions
2806 are considered to be undefined outside the union of their cells.
2807 Piecewise expressions derived from quasipolynomials
2808 are considered to be zero outside the union of their cells.
2810 Piecewise quasipolynomials are mainly used by the C<barvinok>
2811 library for representing the number of elements in a parametric set or map.
2812 For example, the piecewise quasipolynomial
2814         [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
2816 represents the number of points in the map
2818         [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
2820 The piecewise expression types defined by C<isl>
2821 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
2822 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
2824 A piecewise expression with no cells can be created using
2825 the following functions.
2827         #include <isl/aff.h>
2828         __isl_give isl_pw_aff *isl_pw_aff_empty(
2829                 __isl_take isl_space *space);
2830         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
2831                 __isl_take isl_space *space);
2833 A piecewise expression with a single universe cell can be
2834 created using the following functions.
2836         #include <isl/aff.h>
2837         __isl_give isl_pw_aff *isl_pw_aff_from_aff(
2838                 __isl_take isl_aff *aff);
2839         __isl_give isl_pw_multi_aff *
2840         isl_pw_multi_aff_from_multi_aff(
2841                 __isl_take isl_multi_aff *ma);
2843         #include <isl/polynomial.h>
2844         __isl_give isl_pw_qpolynomial *
2845         isl_pw_qpolynomial_from_qpolynomial(
2846                 __isl_take isl_qpolynomial *qp);
2848 A piecewise expression with a single specified cell can be
2849 created using the following functions.
2851         #include <isl/aff.h>
2852         __isl_give isl_pw_aff *isl_pw_aff_alloc(
2853                 __isl_take isl_set *set, __isl_take isl_aff *aff);
2854         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
2855                 __isl_take isl_set *set,
2856                 __isl_take isl_multi_aff *maff);
2858         #include <isl/polynomial.h>
2859         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
2860                 __isl_take isl_set *set,
2861                 __isl_take isl_qpolynomial *qp);
2863 The following convenience functions first create a base expression and
2864 then create a piecewise expression over a universe domain.
2866         #include <isl/aff.h>
2867         __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
2868                 __isl_take isl_local_space *ls);
2869         __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
2870                 __isl_take isl_local_space *ls,
2871                 enum isl_dim_type type, unsigned pos);
2872         __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
2873                 __isl_take isl_local_space *ls);
2874         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
2875                 __isl_take isl_space *space);
2876         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
2877                 __isl_take isl_space *space);
2878         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
2879                 __isl_take isl_space *space);
2880         __isl_give isl_pw_multi_aff *
2881         isl_pw_multi_aff_project_out_map(
2882                 __isl_take isl_space *space,
2883                 enum isl_dim_type type,
2884                 unsigned first, unsigned n);
2886         #include <isl/polynomial.h>
2887         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
2888                 __isl_take isl_space *space);
2890 The following convenience functions first create a base expression and
2891 then create a piecewise expression over a given domain.
2893         #include <isl/aff.h>
2894         __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
2895                 __isl_take isl_set *domain,
2896                 __isl_take isl_val *v);
2897         __isl_give isl_pw_multi_aff *
2898         isl_pw_multi_aff_multi_val_on_domain(
2899                 __isl_take isl_set *domain,
2900                 __isl_take isl_multi_val *mv);
2902 As a convenience, a piecewise multiple expression can
2903 also be created from a piecewise expression.
2904 Each multiple expression in the result is derived
2905 from the corresponding base expression.
2907         #include <isl/aff.h>
2908         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
2909                 __isl_take isl_pw_aff *pa);
2911 Similarly, a piecewise quasipolynomial can be
2912 created from a piecewise quasi-affine expression using
2913 the following function.
2915         #include <isl/polynomial.h>
2916         __isl_give isl_pw_qpolynomial *
2917         isl_pw_qpolynomial_from_pw_aff(
2918                 __isl_take isl_pw_aff *pwaff);
2920 Piecewise expressions can be copied and freed using the following functions.
2922         #include <isl/aff.h>
2923         __isl_give isl_pw_aff *isl_pw_aff_copy(
2924                 __isl_keep isl_pw_aff *pwaff);
2925         __isl_null isl_pw_aff *isl_pw_aff_free(
2926                 __isl_take isl_pw_aff *pwaff);
2927         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
2928                 __isl_keep isl_pw_multi_aff *pma);
2929         __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
2930                 __isl_take isl_pw_multi_aff *pma);
2932         #include <isl/polynomial.h>
2933         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
2934                 __isl_keep isl_pw_qpolynomial *pwqp);
2935         __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
2936                 __isl_take isl_pw_qpolynomial *pwqp);
2937         __isl_give isl_pw_qpolynomial_fold *
2938         isl_pw_qpolynomial_fold_copy(
2939                 __isl_keep isl_pw_qpolynomial_fold *pwf);
2940         __isl_null isl_pw_qpolynomial_fold *
2941         isl_pw_qpolynomial_fold_free(
2942                 __isl_take isl_pw_qpolynomial_fold *pwf);
2944 To iterate over the different cells of a piecewise expression,
2945 use the following functions.
2947         #include <isl/aff.h>
2948         int isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
2949         int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
2950         int isl_pw_aff_foreach_piece(__isl_keep isl_pw_aff *pwaff,
2951                 int (*fn)(__isl_take isl_set *set,
2952                           __isl_take isl_aff *aff,
2953                           void *user), void *user);
2954         int isl_pw_multi_aff_foreach_piece(
2955                 __isl_keep isl_pw_multi_aff *pma,
2956                 int (*fn)(__isl_take isl_set *set,
2957                             __isl_take isl_multi_aff *maff,
2958                             void *user), void *user);
2960         #include <isl/polynomial.h>
2961         int isl_pw_qpolynomial_foreach_piece(
2962                 __isl_keep isl_pw_qpolynomial *pwqp,
2963                 int (*fn)(__isl_take isl_set *set,
2964                           __isl_take isl_qpolynomial *qp,
2965                           void *user), void *user);
2966         int isl_pw_qpolynomial_foreach_lifted_piece(
2967                 __isl_keep isl_pw_qpolynomial *pwqp,
2968                 int (*fn)(__isl_take isl_set *set,
2969                           __isl_take isl_qpolynomial *qp,
2970                           void *user), void *user);
2971         int isl_pw_qpolynomial_fold_foreach_piece(
2972                 __isl_keep isl_pw_qpolynomial_fold *pwf,
2973                 int (*fn)(__isl_take isl_set *set,
2974                           __isl_take isl_qpolynomial_fold *fold,
2975                           void *user), void *user);
2976         int isl_pw_qpolynomial_fold_foreach_lifted_piece(
2977                 __isl_keep isl_pw_qpolynomial_fold *pwf,
2978                 int (*fn)(__isl_take isl_set *set,
2979                           __isl_take isl_qpolynomial_fold *fold,
2980                           void *user), void *user);
2982 As usual, the function C<fn> should return C<0> on success
2983 and C<-1> on failure.  The difference between
2984 C<isl_pw_qpolynomial_foreach_piece> and
2985 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
2986 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
2987 compute unique representations for all existentially quantified
2988 variables and then turn these existentially quantified variables
2989 into extra set variables, adapting the associated quasipolynomial
2990 accordingly.  This means that the C<set> passed to C<fn>
2991 will not have any existentially quantified variables, but that
2992 the dimensions of the sets may be different for different
2993 invocations of C<fn>.
2994 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
2995 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
2997 A piecewise expression consisting of the expressions at a given
2998 position of a piecewise multiple expression can be extracted
2999 using the following function.
3001         #include <isl/aff.h>
3002         __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3003                 __isl_keep isl_pw_multi_aff *pma, int pos);
3005 These expressions can be replaced using the following function.
3007         #include <isl/aff.h>
3008         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3009                 __isl_take isl_pw_multi_aff *pma, unsigned pos,
3010                 __isl_take isl_pw_aff *pa);
3012 Note that there is a difference between C<isl_multi_pw_aff> and
3013 C<isl_pw_multi_aff> objects.  The first is a sequence of piecewise
3014 affine expressions, while the second is a piecewise sequence
3015 of affine expressions.  In particular, each of the piecewise
3016 affine expressions in an C<isl_multi_pw_aff> may have a different
3017 domain, while all multiple expressions associated to a cell
3018 in an C<isl_pw_multi_aff> have the same domain.
3019 It is possible to convert between the two, but when converting
3020 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3021 of the result is the intersection of the domains of the input.
3022 The reverse conversion is exact.
3024         #include <isl/aff.h>
3025         __isl_give isl_pw_multi_aff *
3026         isl_pw_multi_aff_from_multi_pw_aff(
3027                 __isl_take isl_multi_pw_aff *mpa);
3028         __isl_give isl_multi_pw_aff *
3029         isl_multi_pw_aff_from_pw_multi_aff(
3030                 __isl_take isl_pw_multi_aff *pma);
3032 =head3 Union Expressions
3034 A union expression collects base expressions defined
3035 over different domains.  The space of a union expression
3036 is that of the shared parameter space.
3038 The union expression types defined by C<isl>
3039 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3040 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3042 An empty union expression can be created using the following functions.
3044         #include <isl/aff.h>
3045         __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
3046                 __isl_take isl_space *space);
3047         __isl_give isl_union_pw_multi_aff *
3048         isl_union_pw_multi_aff_empty(
3049                 __isl_take isl_space *space);
3051         #include <isl/polynomial.h>
3052         __isl_give isl_union_pw_qpolynomial *
3053         isl_union_pw_qpolynomial_zero(
3054                 __isl_take isl_space *space);
3056 A union expression containing a single base expression
3057 can be created using the following functions.
3059         #include <isl/aff.h>
3060         __isl_give isl_union_pw_aff *
3061         isl_union_pw_aff_from_pw_aff(
3062                 __isl_take isl_pw_aff *pa);
3063         __isl_give isl_union_pw_multi_aff *
3064         isl_union_pw_multi_aff_from_aff(
3065                 __isl_take isl_aff *aff);
3066         __isl_give isl_union_pw_multi_aff *
3067         isl_union_pw_multi_aff_from_pw_multi_aff(
3068                 __isl_take isl_pw_multi_aff *pma);
3070         #include <isl/polynomial.h>
3071         __isl_give isl_union_pw_qpolynomial *
3072         isl_union_pw_qpolynomial_from_pw_qpolynomial(
3073                 __isl_take isl_pw_qpolynomial *pwqp);
3075 The following functions create a base expression on each
3076 of the sets in the union set and collect the results.
3078         #include <isl/aff.h>
3079         __isl_give isl_union_pw_multi_aff *
3080         isl_union_pw_multi_aff_from_union_pw_aff(
3081                 __isl_take isl_union_pw_aff *upa);
3082         __isl_give isl_union_pw_aff *
3083         isl_union_pw_multi_aff_get_union_pw_aff(
3084                 __isl_keep isl_union_pw_multi_aff *upma, int pos);
3085         __isl_give isl_union_pw_aff *
3086         isl_union_pw_aff_val_on_domain(
3087                 __isl_take isl_union_set *domain,
3088                 __isl_take isl_val *v);
3089         __isl_give isl_union_pw_multi_aff *
3090         isl_union_pw_multi_aff_multi_val_on_domain(
3091                 __isl_take isl_union_set *domain,
3092                 __isl_take isl_multi_val *mv);
3094 An C<isl_union_pw_aff> that is equal to a (parametric) affine
3095 expression on a given domain can be created using the following
3096 function.
3098         #include <isl/aff.h>
3099         __isl_give isl_union_pw_aff *
3100         isl_union_pw_aff_aff_on_domain(
3101                 __isl_take isl_union_set *domain,
3102                 __isl_take isl_aff *aff);
3104 A base expression can be added to a union expression using
3105 the following functions.
3107         #include <isl/aff.h>
3108         __isl_give isl_union_pw_aff *
3109         isl_union_pw_aff_add_pw_aff(
3110                 __isl_take isl_union_pw_aff *upa,
3111                 __isl_take isl_pw_aff *pa);
3112         __isl_give isl_union_pw_multi_aff *
3113         isl_union_pw_multi_aff_add_pw_multi_aff(
3114                 __isl_take isl_union_pw_multi_aff *upma,
3115                 __isl_take isl_pw_multi_aff *pma);
3117         #include <isl/polynomial.h>
3118         __isl_give isl_union_pw_qpolynomial *
3119         isl_union_pw_qpolynomial_add_pw_qpolynomial(
3120                 __isl_take isl_union_pw_qpolynomial *upwqp,
3121                 __isl_take isl_pw_qpolynomial *pwqp);
3123 Union expressions can be copied and freed using
3124 the following functions.
3126         #include <isl/aff.h>
3127         __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
3128                 __isl_keep isl_union_pw_aff *upa);
3129         __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
3130                 __isl_take isl_union_pw_aff *upa);
3131         __isl_give isl_union_pw_multi_aff *
3132         isl_union_pw_multi_aff_copy(
3133                 __isl_keep isl_union_pw_multi_aff *upma);
3134         __isl_null isl_union_pw_multi_aff *
3135         isl_union_pw_multi_aff_free(
3136                 __isl_take isl_union_pw_multi_aff *upma);
3138         #include <isl/polynomial.h>
3139         __isl_give isl_union_pw_qpolynomial *
3140         isl_union_pw_qpolynomial_copy(
3141                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3142         __isl_null isl_union_pw_qpolynomial *
3143         isl_union_pw_qpolynomial_free(
3144                 __isl_take isl_union_pw_qpolynomial *upwqp);
3145         __isl_give isl_union_pw_qpolynomial_fold *
3146         isl_union_pw_qpolynomial_fold_copy(
3147                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3148         __isl_null isl_union_pw_qpolynomial_fold *
3149         isl_union_pw_qpolynomial_fold_free(
3150                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3152 To iterate over the base expressions in a union expression,
3153 use the following functions.
3155         #include <isl/aff.h>
3156         int isl_union_pw_aff_n_pw_multi_aff(
3157                 __isl_keep isl_union_pw_aff *upa);
3158         int isl_union_pw_aff_foreach_pw_aff(
3159                 __isl_keep isl_union_pw_aff *upa,
3160                 int (*fn)(__isl_take isl_pw_aff *ma, void *user),
3161                         void *user);
3162         int isl_union_pw_multi_aff_n_pw_multi_aff(
3163                 __isl_keep isl_union_pw_multi_aff *upma);
3164         int isl_union_pw_multi_aff_foreach_pw_multi_aff(
3165                 __isl_keep isl_union_pw_multi_aff *upma,
3166                 int (*fn)(__isl_take isl_pw_multi_aff *pma,
3167                             void *user), void *user);
3169         #include <isl/polynomial.h>
3170         int isl_union_pw_qplynomial_n_pw_qpolynomial(
3171                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3172         int isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3173                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3174                 int (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3175                             void *user), void *user);
3176         int isl_union_pw_qplynomial_fold_n_pw_qpolynomial_fold(
3177                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3178         int isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3179                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3180                 int (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3181                             void *user), void *user);
3183 To extract the base expression in a given space from a union, use
3184 the following functions.
3186         #include <isl/aff.h>
3187         __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3188                 __isl_keep isl_union_pw_aff *upa,
3189                 __isl_take isl_space *space);
3190         __isl_give isl_pw_multi_aff *
3191         isl_union_pw_multi_aff_extract_pw_multi_aff(
3192                 __isl_keep isl_union_pw_multi_aff *upma,
3193                 __isl_take isl_space *space);
3195         #include <isl/polynomial.h>
3196         __isl_give isl_pw_qpolynomial *
3197         isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3198                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3199                 __isl_take isl_space *space);
3201 =head2 Input and Output
3203 For set and relation,
3204 C<isl> supports its own input/output format, which is similar
3205 to the C<Omega> format, but also supports the C<PolyLib> format
3206 in some cases.
3207 For other object types, typically only an C<isl> format is supported.
3209 =head3 C<isl> format
3211 The C<isl> format is similar to that of C<Omega>, but has a different
3212 syntax for describing the parameters and allows for the definition
3213 of an existentially quantified variable as the integer division
3214 of an affine expression.
3215 For example, the set of integers C<i> between C<0> and C<n>
3216 such that C<i % 10 <= 6> can be described as
3218         [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3219                                 i - 10 a <= 6) }
3221 A set or relation can have several disjuncts, separated
3222 by the keyword C<or>.  Each disjunct is either a conjunction
3223 of constraints or a projection (C<exists>) of a conjunction
3224 of constraints.  The constraints are separated by the keyword
3225 C<and>.
3227 =head3 C<PolyLib> format
3229 If the represented set is a union, then the first line
3230 contains a single number representing the number of disjuncts.
3231 Otherwise, a line containing the number C<1> is optional.
3233 Each disjunct is represented by a matrix of constraints.
3234 The first line contains two numbers representing
3235 the number of rows and columns,
3236 where the number of rows is equal to the number of constraints
3237 and the number of columns is equal to two plus the number of variables.
3238 The following lines contain the actual rows of the constraint matrix.
3239 In each row, the first column indicates whether the constraint
3240 is an equality (C<0>) or inequality (C<1>).  The final column
3241 corresponds to the constant term.
3243 If the set is parametric, then the coefficients of the parameters
3244 appear in the last columns before the constant column.
3245 The coefficients of any existentially quantified variables appear
3246 between those of the set variables and those of the parameters.
3248 =head3 Extended C<PolyLib> format
3250 The extended C<PolyLib> format is nearly identical to the
3251 C<PolyLib> format.  The only difference is that the line
3252 containing the number of rows and columns of a constraint matrix
3253 also contains four additional numbers:
3254 the number of output dimensions, the number of input dimensions,
3255 the number of local dimensions (i.e., the number of existentially
3256 quantified variables) and the number of parameters.
3257 For sets, the number of ``output'' dimensions is equal
3258 to the number of set dimensions, while the number of ``input''
3259 dimensions is zero.
3261 =head3 Input
3263 Objects can be read from input using the following functions.
3265         #include <isl/val.h>
3266         __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3267                 const char *str);
3268         __isl_give isl_multi_val *isl_multi_val_read_from_str(
3269                 isl_ctx *ctx, const char *str);
3271         #include <isl/set.h>
3272         __isl_give isl_basic_set *isl_basic_set_read_from_file(
3273                 isl_ctx *ctx, FILE *input);
3274         __isl_give isl_basic_set *isl_basic_set_read_from_str(
3275                 isl_ctx *ctx, const char *str);
3276         __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3277                 FILE *input);
3278         __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3279                 const char *str);
3281         #include <isl/map.h>
3282         __isl_give isl_basic_map *isl_basic_map_read_from_file(
3283                 isl_ctx *ctx, FILE *input);
3284         __isl_give isl_basic_map *isl_basic_map_read_from_str(
3285                 isl_ctx *ctx, const char *str);
3286         __isl_give isl_map *isl_map_read_from_file(
3287                 isl_ctx *ctx, FILE *input);
3288         __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3289                 const char *str);
3291         #include <isl/union_set.h>
3292         __isl_give isl_union_set *isl_union_set_read_from_file(
3293                 isl_ctx *ctx, FILE *input);
3294         __isl_give isl_union_set *isl_union_set_read_from_str(
3295                 isl_ctx *ctx, const char *str);
3297         #include <isl/union_map.h>
3298         __isl_give isl_union_map *isl_union_map_read_from_file(
3299                 isl_ctx *ctx, FILE *input);
3300         __isl_give isl_union_map *isl_union_map_read_from_str(
3301                 isl_ctx *ctx, const char *str);
3303         #include <isl/aff.h>
3304         __isl_give isl_aff *isl_aff_read_from_str(
3305                 isl_ctx *ctx, const char *str);
3306         __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3307                 isl_ctx *ctx, const char *str);
3308         __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3309                 isl_ctx *ctx, const char *str);
3310         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3311                 isl_ctx *ctx, const char *str);
3312         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3313                 isl_ctx *ctx, const char *str);
3314         __isl_give isl_union_pw_multi_aff *
3315         isl_union_pw_multi_aff_read_from_str(
3316                 isl_ctx *ctx, const char *str);
3317         __isl_give isl_multi_union_pw_aff *
3318         isl_multi_union_pw_aff_read_from_str(
3319                 isl_ctx *ctx, const char *str);
3321         #include <isl/polynomial.h>
3322         __isl_give isl_union_pw_qpolynomial *
3323         isl_union_pw_qpolynomial_read_from_str(
3324                 isl_ctx *ctx, const char *str);
3326 For sets and relations,
3327 the input format is autodetected and may be either the C<PolyLib> format
3328 or the C<isl> format.
3330 =head3 Output
3332 Before anything can be printed, an C<isl_printer> needs to
3333 be created.
3335         __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3336                 FILE *file);
3337         __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3338         __isl_null isl_printer *isl_printer_free(
3339                 __isl_take isl_printer *printer);
3340         __isl_give char *isl_printer_get_str(
3341                 __isl_keep isl_printer *printer);
3343 The printer can be inspected using the following functions.
3345         FILE *isl_printer_get_file(
3346                 __isl_keep isl_printer *printer);
3347         int isl_printer_get_output_format(
3348                 __isl_keep isl_printer *p);
3350 The behavior of the printer can be modified in various ways
3352         __isl_give isl_printer *isl_printer_set_output_format(
3353                 __isl_take isl_printer *p, int output_format);
3354         __isl_give isl_printer *isl_printer_set_indent(
3355                 __isl_take isl_printer *p, int indent);
3356         __isl_give isl_printer *isl_printer_set_indent_prefix(
3357                 __isl_take isl_printer *p, const char *prefix);
3358         __isl_give isl_printer *isl_printer_indent(
3359                 __isl_take isl_printer *p, int indent);
3360         __isl_give isl_printer *isl_printer_set_prefix(
3361                 __isl_take isl_printer *p, const char *prefix);
3362         __isl_give isl_printer *isl_printer_set_suffix(
3363                 __isl_take isl_printer *p, const char *suffix);
3365 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3366 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3367 and defaults to C<ISL_FORMAT_ISL>.
3368 Each line in the output is prefixed by C<indent_prefix>,
3369 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3370 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3371 In the C<PolyLib> format output,
3372 the coefficients of the existentially quantified variables
3373 appear between those of the set variables and those
3374 of the parameters.
3375 The function C<isl_printer_indent> increases the indentation
3376 by the specified amount (which may be negative).
3378 To actually print something, use
3380         #include <isl/printer.h>
3381         __isl_give isl_printer *isl_printer_print_double(
3382                 __isl_take isl_printer *p, double d);
3384         #include <isl/val.h>
3385         __isl_give isl_printer *isl_printer_print_val(
3386                 __isl_take isl_printer *p, __isl_keep isl_val *v);
3388         #include <isl/set.h>
3389         __isl_give isl_printer *isl_printer_print_basic_set(
3390                 __isl_take isl_printer *printer,
3391                 __isl_keep isl_basic_set *bset);
3392         __isl_give isl_printer *isl_printer_print_set(
3393                 __isl_take isl_printer *printer,
3394                 __isl_keep isl_set *set);
3396         #include <isl/map.h>
3397         __isl_give isl_printer *isl_printer_print_basic_map(
3398                 __isl_take isl_printer *printer,
3399                 __isl_keep isl_basic_map *bmap);
3400         __isl_give isl_printer *isl_printer_print_map(
3401                 __isl_take isl_printer *printer,
3402                 __isl_keep isl_map *map);
3404         #include <isl/union_set.h>
3405         __isl_give isl_printer *isl_printer_print_union_set(
3406                 __isl_take isl_printer *p,
3407                 __isl_keep isl_union_set *uset);
3409         #include <isl/union_map.h>
3410         __isl_give isl_printer *isl_printer_print_union_map(
3411                 __isl_take isl_printer *p,
3412                 __isl_keep isl_union_map *umap);
3414         #include <isl/val.h>
3415         __isl_give isl_printer *isl_printer_print_multi_val(
3416                 __isl_take isl_printer *p,
3417                 __isl_keep isl_multi_val *mv);
3419         #include <isl/aff.h>
3420         __isl_give isl_printer *isl_printer_print_aff(
3421                 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3422         __isl_give isl_printer *isl_printer_print_multi_aff(
3423                 __isl_take isl_printer *p,
3424                 __isl_keep isl_multi_aff *maff);
3425         __isl_give isl_printer *isl_printer_print_pw_aff(
3426                 __isl_take isl_printer *p,
3427                 __isl_keep isl_pw_aff *pwaff);
3428         __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3429                 __isl_take isl_printer *p,
3430                 __isl_keep isl_pw_multi_aff *pma);
3431         __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3432                 __isl_take isl_printer *p,
3433                 __isl_keep isl_multi_pw_aff *mpa);
3434         __isl_give isl_printer *isl_printer_print_union_pw_aff(
3435                 __isl_take isl_printer *p,
3436                 __isl_keep isl_union_pw_aff *upa);
3437         __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3438                 __isl_take isl_printer *p,
3439                 __isl_keep isl_union_pw_multi_aff *upma);
3440         __isl_give isl_printer *
3441         isl_printer_print_multi_union_pw_aff(
3442                 __isl_take isl_printer *p,
3443                 __isl_keep isl_multi_union_pw_aff *mupa);
3445         #include <isl/polynomial.h>
3446         __isl_give isl_printer *isl_printer_print_qpolynomial(
3447                 __isl_take isl_printer *p,
3448                 __isl_keep isl_qpolynomial *qp);
3449         __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3450                 __isl_take isl_printer *p,
3451                 __isl_keep isl_pw_qpolynomial *pwqp);
3452         __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3453                 __isl_take isl_printer *p,
3454                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3456         __isl_give isl_printer *
3457         isl_printer_print_pw_qpolynomial_fold(
3458                 __isl_take isl_printer *p,
3459                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3460         __isl_give isl_printer *
3461         isl_printer_print_union_pw_qpolynomial_fold(
3462                 __isl_take isl_printer *p,
3463                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3465 For C<isl_printer_print_qpolynomial>,
3466 C<isl_printer_print_pw_qpolynomial> and
3467 C<isl_printer_print_pw_qpolynomial_fold>,
3468 the output format of the printer
3469 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3470 For C<isl_printer_print_union_pw_qpolynomial> and
3471 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3472 is supported.
3473 In case of printing in C<ISL_FORMAT_C>, the user may want
3474 to set the names of all dimensions first.
3476 When called on a file printer, the following function flushes
3477 the file.  When called on a string printer, the buffer is cleared.
3479         __isl_give isl_printer *isl_printer_flush(
3480                 __isl_take isl_printer *p);
3482 Alternatively, a string representation can be obtained
3483 directly using the following functions, which always print
3484 in isl format.
3486         #include <isl/space.h>
3487         __isl_give char *isl_space_to_str(
3488                 __isl_keep isl_space *space);
3490         #include <isl/val.h>
3491         __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3492         __isl_give char *isl_multi_val_to_str(
3493                 __isl_keep isl_multi_val *mv);
3495         #include <isl/set.h>
3496         __isl_give char *isl_set_to_str(
3497                 __isl_keep isl_set *set);
3499         #include <isl/union_set.h>
3500         __isl_give char *isl_union_set_to_str(
3501                 __isl_keep isl_union_set *uset);
3503         #include <isl/map.h>
3504         __isl_give char *isl_map_to_str(
3505                 __isl_keep isl_map *map);
3507         #include <isl/union_map.h>
3508         __isl_give char *isl_union_map_to_str(
3509                 __isl_keep isl_union_map *umap);
3511         #include <isl/aff.h>
3512         __isl_give char *isl_multi_aff_to_str(
3513                 __isl_keep isl_multi_aff *aff);
3514         __isl_give char *isl_union_pw_aff_to_str(
3515                 __isl_keep isl_union_pw_aff *upa);
3516         __isl_give char *isl_union_pw_multi_aff_to_str(
3517                 __isl_keep isl_union_pw_multi_aff *upma);
3518         __isl_give char *isl_multi_union_pw_aff_to_str(
3519                 __isl_keep isl_multi_union_pw_aff *mupa);
3521 =head2 Properties
3523 =head3 Unary Properties
3525 =over
3527 =item * Emptiness
3529 The following functions test whether the given set or relation
3530 contains any integer points.  The ``plain'' variants do not perform
3531 any computations, but simply check if the given set or relation
3532 is already known to be empty.
3534         int isl_basic_set_plain_is_empty(__isl_keep isl_basic_set *bset);
3535         int isl_basic_set_is_empty(__isl_keep isl_basic_set *bset);
3536         int isl_set_plain_is_empty(__isl_keep isl_set *set);
3537         int isl_set_is_empty(__isl_keep isl_set *set);
3538         int isl_union_set_is_empty(__isl_keep isl_union_set *uset);
3539         int isl_basic_map_plain_is_empty(__isl_keep isl_basic_map *bmap);
3540         int isl_basic_map_is_empty(__isl_keep isl_basic_map *bmap);
3541         int isl_map_plain_is_empty(__isl_keep isl_map *map);
3542         int isl_map_is_empty(__isl_keep isl_map *map);
3543         int isl_union_map_is_empty(__isl_keep isl_union_map *umap);
3545 =item * Universality
3547         int isl_basic_set_is_universe(__isl_keep isl_basic_set *bset);
3548         int isl_basic_map_is_universe(__isl_keep isl_basic_map *bmap);
3549         int isl_set_plain_is_universe(__isl_keep isl_set *set);
3551 =item * Single-valuedness
3553         #include <isl/set.h>
3554         int isl_set_is_singleton(__isl_keep isl_set *set);
3556         #include <isl/map.h>
3557         int isl_basic_map_is_single_valued(
3558                 __isl_keep isl_basic_map *bmap);
3559         int isl_map_plain_is_single_valued(
3560                 __isl_keep isl_map *map);
3561         int isl_map_is_single_valued(__isl_keep isl_map *map);
3563         #include <isl/union_map.h>
3564         int isl_union_map_is_single_valued(__isl_keep isl_union_map *umap);
3566 =item * Injectivity
3568         int isl_map_plain_is_injective(__isl_keep isl_map *map);
3569         int isl_map_is_injective(__isl_keep isl_map *map);
3570         int isl_union_map_plain_is_injective(
3571                 __isl_keep isl_union_map *umap);
3572         int isl_union_map_is_injective(
3573                 __isl_keep isl_union_map *umap);
3575 =item * Bijectivity
3577         int isl_map_is_bijective(__isl_keep isl_map *map);
3578         int isl_union_map_is_bijective(__isl_keep isl_union_map *umap);
3580 =item * Position
3582         __isl_give isl_val *
3583         isl_basic_map_plain_get_val_if_fixed(
3584                 __isl_keep isl_basic_map *bmap,
3585                 enum isl_dim_type type, unsigned pos);
3586         __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3587                 __isl_keep isl_set *set,
3588                 enum isl_dim_type type, unsigned pos);
3589         __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3590                 __isl_keep isl_map *map,
3591                 enum isl_dim_type type, unsigned pos);
3593 If the set or relation obviously lies on a hyperplane where the given dimension
3594 has a fixed value, then return that value.
3595 Otherwise return NaN.
3597 =item * Stride
3599         int isl_set_dim_residue_class_val(
3600                 __isl_keep isl_set *set,
3601                 int pos, __isl_give isl_val **modulo,
3602                 __isl_give isl_val **residue);
3604 Check if the values of the given set dimension are equal to a fixed
3605 value modulo some integer value.  If so, assign the modulo to C<*modulo>
3606 and the fixed value to C<*residue>.  If the given dimension attains only
3607 a single value, then assign C<0> to C<*modulo> and the fixed value to
3608 C<*residue>.
3609 If the dimension does not attain only a single value and if no modulo
3610 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3612 =item * Dependence
3614 To check whether the description of a set, relation or function depends
3615 on one or more given dimensions,
3616 the following functions can be used.
3618         #include <isl/constraint.h>
3619         int isl_constraint_involves_dims(
3620                 __isl_keep isl_constraint *constraint,
3621                 enum isl_dim_type type, unsigned first, unsigned n);
3623         #include <isl/set.h>
3624         int isl_basic_set_involves_dims(
3625                 __isl_keep isl_basic_set *bset,
3626                 enum isl_dim_type type, unsigned first, unsigned n);
3627         int isl_set_involves_dims(__isl_keep isl_set *set,
3628                 enum isl_dim_type type, unsigned first, unsigned n);
3630         #include <isl/map.h>
3631         int isl_basic_map_involves_dims(
3632                 __isl_keep isl_basic_map *bmap,
3633                 enum isl_dim_type type, unsigned first, unsigned n);
3634         int isl_map_involves_dims(__isl_keep isl_map *map,
3635                 enum isl_dim_type type, unsigned first, unsigned n);
3637         #include <isl/union_map.h>
3638         int isl_union_map_involves_dims(
3639                 __isl_keep isl_union_map *umap,
3640                 enum isl_dim_type type, unsigned first, unsigned n);
3642         #include <isl/aff.h>
3643         int isl_aff_involves_dims(__isl_keep isl_aff *aff,
3644                 enum isl_dim_type type, unsigned first, unsigned n);
3645         int isl_pw_aff_involves_dims(__isl_keep isl_pw_aff *pwaff,
3646                 enum isl_dim_type type, unsigned first, unsigned n);
3647         int isl_multi_aff_involves_dims(
3648                 __isl_keep isl_multi_aff *ma,
3649                 enum isl_dim_type type, unsigned first, unsigned n);
3650         int isl_multi_pw_aff_involves_dims(
3651                 __isl_keep isl_multi_pw_aff *mpa,
3652                 enum isl_dim_type type, unsigned first, unsigned n);
3654 Similarly, the following functions can be used to check whether
3655 a given dimension is involved in any lower or upper bound.
3657         #include <isl/set.h>
3658         int isl_set_dim_has_any_lower_bound(__isl_keep isl_set *set,
3659                 enum isl_dim_type type, unsigned pos);
3660         int isl_set_dim_has_any_upper_bound(__isl_keep isl_set *set,
3661                 enum isl_dim_type type, unsigned pos);
3663 Note that these functions return true even if there is a bound on
3664 the dimension on only some of the basic sets of C<set>.
3665 To check if they have a bound for all of the basic sets in C<set>,
3666 use the following functions instead.
3668         #include <isl/set.h>
3669         int isl_set_dim_has_lower_bound(__isl_keep isl_set *set,
3670                 enum isl_dim_type type, unsigned pos);
3671         int isl_set_dim_has_upper_bound(__isl_keep isl_set *set,
3672                 enum isl_dim_type type, unsigned pos);
3674 =item * Space
3676 To check whether a set is a parameter domain, use this function:
3678         int isl_set_is_params(__isl_keep isl_set *set);
3679         int isl_union_set_is_params(
3680                 __isl_keep isl_union_set *uset);
3682 =item * Wrapping
3684 The following functions check whether the space of the given
3685 (basic) set or relation range is a wrapped relation.
3687         #include <isl/space.h>
3688         int isl_space_is_wrapping(
3689                 __isl_keep isl_space *space);
3690         int isl_space_domain_is_wrapping(
3691                 __isl_keep isl_space *space);
3692         int isl_space_range_is_wrapping(
3693                 __isl_keep isl_space *space);
3695         #include <isl/set.h>
3696         int isl_basic_set_is_wrapping(
3697                 __isl_keep isl_basic_set *bset);
3698         int isl_set_is_wrapping(__isl_keep isl_set *set);
3700         #include <isl/map.h>
3701         int isl_map_domain_is_wrapping(
3702                 __isl_keep isl_map *map);
3703         int isl_map_range_is_wrapping(
3704                 __isl_keep isl_map *map);
3706         #include <isl/val.h>
3707         int isl_multi_val_range_is_wrapping(
3708                 __isl_keep isl_multi_val *mv);
3710         #include <isl/aff.h>
3711         int isl_multi_aff_range_is_wrapping(
3712                 __isl_keep isl_multi_aff *ma);
3713         int isl_multi_pw_aff_range_is_wrapping(
3714                 __isl_keep isl_multi_pw_aff *mpa);
3715         int isl_multi_union_pw_aff_range_is_wrapping(
3716                 __isl_keep isl_multi_union_pw_aff *mupa);
3718 The input to C<isl_space_is_wrapping> should
3719 be the space of a set, while that of
3720 C<isl_space_domain_is_wrapping> and
3721 C<isl_space_range_is_wrapping> should be the space of a relation.
3723 =item * Internal Product
3725         int isl_basic_map_can_zip(
3726                 __isl_keep isl_basic_map *bmap);
3727         int isl_map_can_zip(__isl_keep isl_map *map);
3729 Check whether the product of domain and range of the given relation
3730 can be computed,
3731 i.e., whether both domain and range are nested relations.
3733 =item * Currying
3735         int isl_basic_map_can_curry(
3736                 __isl_keep isl_basic_map *bmap);
3737         int isl_map_can_curry(__isl_keep isl_map *map);
3739 Check whether the domain of the (basic) relation is a wrapped relation.
3741         int isl_basic_map_can_uncurry(
3742                 __isl_keep isl_basic_map *bmap);
3743         int isl_map_can_uncurry(__isl_keep isl_map *map);
3745 Check whether the range of the (basic) relation is a wrapped relation.
3747 =item * Special Values
3749         #include <isl/aff.h>
3750         int isl_aff_is_cst(__isl_keep isl_aff *aff);
3751         int isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
3753 Check whether the given expression is a constant.
3755         #include <isl/aff.h>
3756         int isl_aff_is_nan(__isl_keep isl_aff *aff);
3757         int isl_pw_aff_involves_nan(__isl_keep isl_pw_aff *pa);
3759 Check whether the given expression is equal to or involves NaN.
3761         #include <isl/aff.h>
3762         int isl_aff_plain_is_zero(__isl_keep isl_aff *aff);
3764 Check whether the affine expression is obviously zero.
3766 =back
3768 =head3 Binary Properties
3770 =over
3772 =item * Equality
3774 The following functions check whether two objects
3775 represent the same set, relation or function.
3776 The C<plain> variants only return true if the objects
3777 are obviously the same.  That is, they may return false
3778 even if the objects are the same, but they will never
3779 return true if the objects are not the same.
3781         #include <isl/set.h>
3782         int isl_basic_set_plain_is_equal(
3783                 __isl_keep isl_basic_set *bset1,
3784                 __isl_keep isl_basic_set *bset2);
3785         int isl_set_plain_is_equal(__isl_keep isl_set *set1,
3786                 __isl_keep isl_set *set2);
3787         int isl_set_is_equal(__isl_keep isl_set *set1,
3788                 __isl_keep isl_set *set2);
3790         #include <isl/map.h>
3791         int isl_basic_map_is_equal(
3792                 __isl_keep isl_basic_map *bmap1,
3793                 __isl_keep isl_basic_map *bmap2);
3794         int isl_map_is_equal(__isl_keep isl_map *map1,
3795                 __isl_keep isl_map *map2);
3796         int isl_map_plain_is_equal(__isl_keep isl_map *map1,
3797                 __isl_keep isl_map *map2);
3799         #include <isl/union_set.h>
3800         int isl_union_set_is_equal(
3801                 __isl_keep isl_union_set *uset1,
3802                 __isl_keep isl_union_set *uset2);
3804         #include <isl/union_map.h>
3805         int isl_union_map_is_equal(
3806                 __isl_keep isl_union_map *umap1,
3807                 __isl_keep isl_union_map *umap2);
3809         #include <isl/aff.h>
3810         int isl_aff_plain_is_equal(__isl_keep isl_aff *aff1,
3811                 __isl_keep isl_aff *aff2);
3812         int isl_multi_aff_plain_is_equal(
3813                 __isl_keep isl_multi_aff *maff1,
3814                 __isl_keep isl_multi_aff *maff2);
3815         int isl_pw_aff_plain_is_equal(
3816                 __isl_keep isl_pw_aff *pwaff1,
3817                 __isl_keep isl_pw_aff *pwaff2);
3818         int isl_pw_multi_aff_plain_is_equal(
3819                 __isl_keep isl_pw_multi_aff *pma1,
3820                 __isl_keep isl_pw_multi_aff *pma2);
3821         int isl_multi_pw_aff_plain_is_equal(
3822                 __isl_keep isl_multi_pw_aff *mpa1,
3823                 __isl_keep isl_multi_pw_aff *mpa2);
3824         int isl_multi_pw_aff_is_equal(
3825                 __isl_keep isl_multi_pw_aff *mpa1,
3826                 __isl_keep isl_multi_pw_aff *mpa2);
3827         int isl_union_pw_aff_plain_is_equal(
3828                 __isl_keep isl_union_pw_aff *upa1,
3829                 __isl_keep isl_union_pw_aff *upa2);
3830         int isl_union_pw_multi_aff_plain_is_equal(
3831                 __isl_keep isl_union_pw_multi_aff *upma1,
3832                 __isl_keep isl_union_pw_multi_aff *upma2);
3833         int isl_multi_union_pw_aff_plain_is_equal(
3834                 __isl_keep isl_multi_union_pw_aff *mupa1,
3835                 __isl_keep isl_multi_union_pw_aff *mupa2);
3837         #include <isl/polynomial.h>
3838         int isl_union_pw_qpolynomial_plain_is_equal(
3839                 __isl_keep isl_union_pw_qpolynomial *upwqp1,
3840                 __isl_keep isl_union_pw_qpolynomial *upwqp2);
3841         int isl_union_pw_qpolynomial_fold_plain_is_equal(
3842                 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
3843                 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
3845 =item * Disjointness
3847         #include <isl/set.h>
3848         int isl_basic_set_is_disjoint(
3849                 __isl_keep isl_basic_set *bset1,
3850                 __isl_keep isl_basic_set *bset2);
3851         int isl_set_plain_is_disjoint(__isl_keep isl_set *set1,
3852                 __isl_keep isl_set *set2);
3853         int isl_set_is_disjoint(__isl_keep isl_set *set1,
3854                 __isl_keep isl_set *set2);
3856         #include <isl/map.h>
3857         int isl_basic_map_is_disjoint(
3858                 __isl_keep isl_basic_map *bmap1,
3859                 __isl_keep isl_basic_map *bmap2);
3860         int isl_map_is_disjoint(__isl_keep isl_map *map1,
3861                 __isl_keep isl_map *map2);
3863         #include <isl/union_set.h>
3864         int isl_union_set_is_disjoint(
3865                 __isl_keep isl_union_set *uset1,
3866                 __isl_keep isl_union_set *uset2);
3868         #include <isl/union_map.h>
3869         int isl_union_map_is_disjoint(
3870                 __isl_keep isl_union_map *umap1,
3871                 __isl_keep isl_union_map *umap2);
3873 =item * Subset
3875         int isl_basic_set_is_subset(
3876                 __isl_keep isl_basic_set *bset1,
3877                 __isl_keep isl_basic_set *bset2);
3878         int isl_set_is_subset(__isl_keep isl_set *set1,
3879                 __isl_keep isl_set *set2);
3880         int isl_set_is_strict_subset(
3881                 __isl_keep isl_set *set1,
3882                 __isl_keep isl_set *set2);
3883         int isl_union_set_is_subset(
3884                 __isl_keep isl_union_set *uset1,
3885                 __isl_keep isl_union_set *uset2);
3886         int isl_union_set_is_strict_subset(
3887                 __isl_keep isl_union_set *uset1,
3888                 __isl_keep isl_union_set *uset2);
3889         int isl_basic_map_is_subset(
3890                 __isl_keep isl_basic_map *bmap1,
3891                 __isl_keep isl_basic_map *bmap2);
3892         int isl_basic_map_is_strict_subset(
3893                 __isl_keep isl_basic_map *bmap1,
3894                 __isl_keep isl_basic_map *bmap2);
3895         int isl_map_is_subset(
3896                 __isl_keep isl_map *map1,
3897                 __isl_keep isl_map *map2);
3898         int isl_map_is_strict_subset(
3899                 __isl_keep isl_map *map1,
3900                 __isl_keep isl_map *map2);
3901         int isl_union_map_is_subset(
3902                 __isl_keep isl_union_map *umap1,
3903                 __isl_keep isl_union_map *umap2);
3904         int isl_union_map_is_strict_subset(
3905                 __isl_keep isl_union_map *umap1,
3906                 __isl_keep isl_union_map *umap2);
3908 Check whether the first argument is a (strict) subset of the
3909 second argument.
3911 =item * Order
3913 Every comparison function returns a negative value if the first
3914 argument is considered smaller than the second, a positive value
3915 if the first argument is considered greater and zero if the two
3916 constraints are considered the same by the comparison criterion.
3918         #include <isl/constraint.h>
3919         int isl_constraint_plain_cmp(
3920                 __isl_keep isl_constraint *c1,
3921                 __isl_keep isl_constraint *c2);
3923 This function is useful for sorting C<isl_constraint>s.
3924 The order depends on the internal representation of the inputs.
3925 The order is fixed over different calls to the function (assuming
3926 the internal representation of the inputs has not changed), but may
3927 change over different versions of C<isl>.
3929         #include <isl/constraint.h>
3930         int isl_constraint_cmp_last_non_zero(
3931                 __isl_keep isl_constraint *c1,
3932                 __isl_keep isl_constraint *c2);
3934 This function can be used to sort constraints that live in the same
3935 local space.  Constraints that involve ``earlier'' dimensions or
3936 that have a smaller coefficient for the shared latest dimension
3937 are considered smaller than other constraints.
3938 This function only defines a B<partial> order.
3940         #include <isl/set.h>
3941         int isl_set_plain_cmp(__isl_keep isl_set *set1,
3942                 __isl_keep isl_set *set2);
3944 This function is useful for sorting C<isl_set>s.
3945 The order depends on the internal representation of the inputs.
3946 The order is fixed over different calls to the function (assuming
3947 the internal representation of the inputs has not changed), but may
3948 change over different versions of C<isl>.
3950         #include <isl/aff.h>
3951         int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
3952                 __isl_keep isl_pw_aff *pa2);
3954 The function C<isl_pw_aff_plain_cmp> can be used to sort
3955 C<isl_pw_aff>s.  The order is not strictly defined.
3956 The current order sorts expressions that only involve
3957 earlier dimensions before those that involve later dimensions.
3959 =back
3961 =head2 Unary Operations
3963 =over
3965 =item * Complement
3967         __isl_give isl_set *isl_set_complement(
3968                 __isl_take isl_set *set);
3969         __isl_give isl_map *isl_map_complement(
3970                 __isl_take isl_map *map);
3972 =item * Inverse map
3974         #include <isl/space.h>
3975         __isl_give isl_space *isl_space_reverse(
3976                 __isl_take isl_space *space);
3978         #include <isl/map.h>
3979         __isl_give isl_basic_map *isl_basic_map_reverse(
3980                 __isl_take isl_basic_map *bmap);
3981         __isl_give isl_map *isl_map_reverse(
3982                 __isl_take isl_map *map);
3984         #include <isl/union_map.h>
3985         __isl_give isl_union_map *isl_union_map_reverse(
3986                 __isl_take isl_union_map *umap);
3988 =item * Projection
3990         #include <isl/space.h>
3991         __isl_give isl_space *isl_space_domain(
3992                 __isl_take isl_space *space);
3993         __isl_give isl_space *isl_space_range(
3994                 __isl_take isl_space *space);
3995         __isl_give isl_space *isl_space_params(
3996                 __isl_take isl_space *space);
3998         #include <isl/local_space.h>
3999         __isl_give isl_local_space *isl_local_space_domain(
4000                 __isl_take isl_local_space *ls);
4001         __isl_give isl_local_space *isl_local_space_range(
4002                 __isl_take isl_local_space *ls);
4004         #include <isl/set.h>
4005         __isl_give isl_basic_set *isl_basic_set_project_out(
4006                 __isl_take isl_basic_set *bset,
4007                 enum isl_dim_type type, unsigned first, unsigned n);
4008         __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
4009                 enum isl_dim_type type, unsigned first, unsigned n);
4010         __isl_give isl_basic_set *isl_basic_set_params(
4011                 __isl_take isl_basic_set *bset);
4012         __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
4014         #include <isl/map.h>
4015         __isl_give isl_basic_map *isl_basic_map_project_out(
4016                 __isl_take isl_basic_map *bmap,
4017                 enum isl_dim_type type, unsigned first, unsigned n);
4018         __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
4019                 enum isl_dim_type type, unsigned first, unsigned n);
4020         __isl_give isl_basic_set *isl_basic_map_domain(
4021                 __isl_take isl_basic_map *bmap);
4022         __isl_give isl_basic_set *isl_basic_map_range(
4023                 __isl_take isl_basic_map *bmap);
4024         __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
4025         __isl_give isl_set *isl_map_domain(
4026                 __isl_take isl_map *bmap);
4027         __isl_give isl_set *isl_map_range(
4028                 __isl_take isl_map *map);
4030         #include <isl/union_set.h>
4031         __isl_give isl_union_set *isl_union_set_project_out(
4032                 __isl_take isl_union_set *uset,
4033                 enum isl_dim_type type,
4034                 unsigned first, unsigned n);
4035         __isl_give isl_set *isl_union_set_params(
4036                 __isl_take isl_union_set *uset);
4038 The function C<isl_union_set_project_out> can only project out
4039 parameters.
4041         #include <isl/union_map.h>
4042         __isl_give isl_union_map *isl_union_map_project_out(
4043                 __isl_take isl_union_map *umap,
4044                 enum isl_dim_type type, unsigned first, unsigned n);
4045         __isl_give isl_set *isl_union_map_params(
4046                 __isl_take isl_union_map *umap);
4047         __isl_give isl_union_set *isl_union_map_domain(
4048                 __isl_take isl_union_map *umap);
4049         __isl_give isl_union_set *isl_union_map_range(
4050                 __isl_take isl_union_map *umap);
4052 The function C<isl_union_map_project_out> can only project out
4053 parameters.
4055         #include <isl/aff.h>
4056         __isl_give isl_aff *isl_aff_project_domain_on_params(
4057                 __isl_take isl_aff *aff);
4058         __isl_give isl_pw_multi_aff *
4059         isl_pw_multi_aff_project_domain_on_params(
4060                 __isl_take isl_pw_multi_aff *pma);
4061         __isl_give isl_set *isl_pw_aff_domain(
4062                 __isl_take isl_pw_aff *pwaff);
4063         __isl_give isl_set *isl_pw_multi_aff_domain(
4064                 __isl_take isl_pw_multi_aff *pma);
4065         __isl_give isl_set *isl_multi_pw_aff_domain(
4066                 __isl_take isl_multi_pw_aff *mpa);
4067         __isl_give isl_union_set *isl_union_pw_aff_domain(
4068                 __isl_take isl_union_pw_aff *upa);
4069         __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
4070                 __isl_take isl_union_pw_multi_aff *upma);
4071         __isl_give isl_union_set *
4072         isl_multi_union_pw_aff_domain(
4073                 __isl_take isl_multi_union_pw_aff *mupa);
4074         __isl_give isl_set *isl_pw_aff_params(
4075                 __isl_take isl_pw_aff *pwa);
4077 The function C<isl_multi_union_pw_aff_domain> requires its
4078 input to have at least one set dimension.
4080         #include <isl/polynomial.h>
4081         __isl_give isl_qpolynomial *
4082         isl_qpolynomial_project_domain_on_params(
4083                 __isl_take isl_qpolynomial *qp);
4084         __isl_give isl_pw_qpolynomial *
4085         isl_pw_qpolynomial_project_domain_on_params(
4086                 __isl_take isl_pw_qpolynomial *pwqp);
4087         __isl_give isl_pw_qpolynomial_fold *
4088         isl_pw_qpolynomial_fold_project_domain_on_params(
4089                 __isl_take isl_pw_qpolynomial_fold *pwf);
4090         __isl_give isl_set *isl_pw_qpolynomial_domain(
4091                 __isl_take isl_pw_qpolynomial *pwqp);
4092         __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
4093                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4094         __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
4095                 __isl_take isl_union_pw_qpolynomial *upwqp);
4097         #include <isl/space.h>
4098         __isl_give isl_space *isl_space_domain_map(
4099                 __isl_take isl_space *space);
4100         __isl_give isl_space *isl_space_range_map(
4101                 __isl_take isl_space *space);
4103         #include <isl/map.h>
4104         __isl_give isl_map *isl_set_wrapped_domain_map(
4105                 __isl_take isl_set *set);
4106         __isl_give isl_basic_map *isl_basic_map_domain_map(
4107                 __isl_take isl_basic_map *bmap);
4108         __isl_give isl_basic_map *isl_basic_map_range_map(
4109                 __isl_take isl_basic_map *bmap);
4110         __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
4111         __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
4113         #include <isl/union_map.h>
4114         __isl_give isl_union_map *isl_union_map_domain_map(
4115                 __isl_take isl_union_map *umap);
4116         __isl_give isl_union_pw_multi_aff *
4117         isl_union_map_domain_map_union_pw_multi_aff(
4118                 __isl_take isl_union_map *umap);
4119         __isl_give isl_union_map *isl_union_map_range_map(
4120                 __isl_take isl_union_map *umap);
4121         __isl_give isl_union_map *
4122         isl_union_set_wrapped_domain_map(
4123                 __isl_take isl_union_set *uset);
4125 The functions above construct a (basic, regular or union) relation
4126 that maps (a wrapped version of) the input relation to its domain or range.
4127 C<isl_set_wrapped_domain_map> maps the input set to the domain
4128 of its wrapped relation.
4130 =item * Elimination
4132         __isl_give isl_basic_set *isl_basic_set_eliminate(
4133                 __isl_take isl_basic_set *bset,
4134                 enum isl_dim_type type,
4135                 unsigned first, unsigned n);
4136         __isl_give isl_set *isl_set_eliminate(
4137                 __isl_take isl_set *set, enum isl_dim_type type,
4138                 unsigned first, unsigned n);
4139         __isl_give isl_basic_map *isl_basic_map_eliminate(
4140                 __isl_take isl_basic_map *bmap,
4141                 enum isl_dim_type type,
4142                 unsigned first, unsigned n);
4143         __isl_give isl_map *isl_map_eliminate(
4144                 __isl_take isl_map *map, enum isl_dim_type type,
4145                 unsigned first, unsigned n);
4147 Eliminate the coefficients for the given dimensions from the constraints,
4148 without removing the dimensions.
4150 =item * Constructing a set from a parameter domain
4152 A zero-dimensional space or (basic) set can be constructed
4153 on a given parameter domain using the following functions.
4155         #include <isl/space.h>
4156         __isl_give isl_space *isl_space_set_from_params(
4157                 __isl_take isl_space *space);
4159         #include <isl/set.h>
4160         __isl_give isl_basic_set *isl_basic_set_from_params(
4161                 __isl_take isl_basic_set *bset);
4162         __isl_give isl_set *isl_set_from_params(
4163                 __isl_take isl_set *set);
4165 =item * Constructing a relation from a set
4167 Create a relation with the given set as domain or range.
4168 The range or domain of the created relation is a zero-dimensional
4169 flat anonymous space.
4171         #include <isl/space.h>
4172         __isl_give isl_space *isl_space_from_domain(
4173                 __isl_take isl_space *space);
4174         __isl_give isl_space *isl_space_from_range(
4175                 __isl_take isl_space *space);
4176         __isl_give isl_space *isl_space_map_from_set(
4177                 __isl_take isl_space *space);
4178         __isl_give isl_space *isl_space_map_from_domain_and_range(
4179                 __isl_take isl_space *domain,
4180                 __isl_take isl_space *range);
4182         #include <isl/local_space.h>
4183         __isl_give isl_local_space *isl_local_space_from_domain(
4184                 __isl_take isl_local_space *ls);
4186         #include <isl/map.h>
4187         __isl_give isl_map *isl_map_from_domain(
4188                 __isl_take isl_set *set);
4189         __isl_give isl_map *isl_map_from_range(
4190                 __isl_take isl_set *set);
4192         #include <isl/val.h>
4193         __isl_give isl_multi_val *isl_multi_val_from_range(
4194                 __isl_take isl_multi_val *mv);
4196         #include <isl/aff.h>
4197         __isl_give isl_multi_aff *isl_multi_aff_from_range(
4198                 __isl_take isl_multi_aff *ma);
4199         __isl_give isl_pw_aff *isl_pw_aff_from_range(
4200                 __isl_take isl_pw_aff *pwa);
4201         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
4202                 __isl_take isl_multi_pw_aff *mpa);
4203         __isl_give isl_multi_union_pw_aff *
4204         isl_multi_union_pw_aff_from_range(
4205                 __isl_take isl_multi_union_pw_aff *mupa);
4206         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
4207                 __isl_take isl_set *set);
4208         __isl_give isl_union_pw_multi_aff *
4209         isl_union_pw_multi_aff_from_domain(
4210                 __isl_take isl_union_set *uset);
4212 =item * Slicing
4214         #include <isl/set.h>
4215         __isl_give isl_basic_set *isl_basic_set_fix_si(
4216                 __isl_take isl_basic_set *bset,
4217                 enum isl_dim_type type, unsigned pos, int value);
4218         __isl_give isl_basic_set *isl_basic_set_fix_val(
4219                 __isl_take isl_basic_set *bset,
4220                 enum isl_dim_type type, unsigned pos,
4221                 __isl_take isl_val *v);
4222         __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
4223                 enum isl_dim_type type, unsigned pos, int value);
4224         __isl_give isl_set *isl_set_fix_val(
4225                 __isl_take isl_set *set,
4226                 enum isl_dim_type type, unsigned pos,
4227                 __isl_take isl_val *v);
4229         #include <isl/map.h>
4230         __isl_give isl_basic_map *isl_basic_map_fix_si(
4231                 __isl_take isl_basic_map *bmap,
4232                 enum isl_dim_type type, unsigned pos, int value);
4233         __isl_give isl_basic_map *isl_basic_map_fix_val(
4234                 __isl_take isl_basic_map *bmap,
4235                 enum isl_dim_type type, unsigned pos,
4236                 __isl_take isl_val *v);
4237         __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
4238                 enum isl_dim_type type, unsigned pos, int value);
4239         __isl_give isl_map *isl_map_fix_val(
4240                 __isl_take isl_map *map,
4241                 enum isl_dim_type type, unsigned pos,
4242                 __isl_take isl_val *v);
4244         #include <isl/aff.h>
4245         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
4246                 __isl_take isl_pw_multi_aff *pma,
4247                 enum isl_dim_type type, unsigned pos, int value);
4249         #include <isl/polynomial.h>
4250         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
4251                 __isl_take isl_pw_qpolynomial *pwqp,
4252                 enum isl_dim_type type, unsigned n,
4253                 __isl_take isl_val *v);
4255 Intersect the set, relation or function domain
4256 with the hyperplane where the given
4257 dimension has the fixed given value.
4259         __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
4260                 __isl_take isl_basic_map *bmap,
4261                 enum isl_dim_type type, unsigned pos, int value);
4262         __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
4263                 __isl_take isl_basic_map *bmap,
4264                 enum isl_dim_type type, unsigned pos, int value);
4265         __isl_give isl_set *isl_set_lower_bound_si(
4266                 __isl_take isl_set *set,
4267                 enum isl_dim_type type, unsigned pos, int value);
4268         __isl_give isl_set *isl_set_lower_bound_val(
4269                 __isl_take isl_set *set,
4270                 enum isl_dim_type type, unsigned pos,
4271                 __isl_take isl_val *value);
4272         __isl_give isl_map *isl_map_lower_bound_si(
4273                 __isl_take isl_map *map,
4274                 enum isl_dim_type type, unsigned pos, int value);
4275         __isl_give isl_set *isl_set_upper_bound_si(
4276                 __isl_take isl_set *set,
4277                 enum isl_dim_type type, unsigned pos, int value);
4278         __isl_give isl_set *isl_set_upper_bound_val(
4279                 __isl_take isl_set *set,
4280                 enum isl_dim_type type, unsigned pos,
4281                 __isl_take isl_val *value);
4282         __isl_give isl_map *isl_map_upper_bound_si(
4283                 __isl_take isl_map *map,
4284                 enum isl_dim_type type, unsigned pos, int value);
4286 Intersect the set or relation with the half-space where the given
4287 dimension has a value bounded by the fixed given integer value.
4289         __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
4290                 enum isl_dim_type type1, int pos1,
4291                 enum isl_dim_type type2, int pos2);
4292         __isl_give isl_basic_map *isl_basic_map_equate(
4293                 __isl_take isl_basic_map *bmap,
4294                 enum isl_dim_type type1, int pos1,
4295                 enum isl_dim_type type2, int pos2);
4296         __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
4297                 enum isl_dim_type type1, int pos1,
4298                 enum isl_dim_type type2, int pos2);
4300 Intersect the set or relation with the hyperplane where the given
4301 dimensions are equal to each other.
4303         __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4304                 enum isl_dim_type type1, int pos1,
4305                 enum isl_dim_type type2, int pos2);
4307 Intersect the relation with the hyperplane where the given
4308 dimensions have opposite values.
4310         __isl_give isl_map *isl_map_order_le(
4311                 __isl_take isl_map *map,
4312                 enum isl_dim_type type1, int pos1,
4313                 enum isl_dim_type type2, int pos2);
4314         __isl_give isl_basic_map *isl_basic_map_order_ge(
4315                 __isl_take isl_basic_map *bmap,
4316                 enum isl_dim_type type1, int pos1,
4317                 enum isl_dim_type type2, int pos2);
4318         __isl_give isl_map *isl_map_order_ge(
4319                 __isl_take isl_map *map,
4320                 enum isl_dim_type type1, int pos1,
4321                 enum isl_dim_type type2, int pos2);
4322         __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4323                 enum isl_dim_type type1, int pos1,
4324                 enum isl_dim_type type2, int pos2);
4325         __isl_give isl_basic_map *isl_basic_map_order_gt(
4326                 __isl_take isl_basic_map *bmap,
4327                 enum isl_dim_type type1, int pos1,
4328                 enum isl_dim_type type2, int pos2);
4329         __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4330                 enum isl_dim_type type1, int pos1,
4331                 enum isl_dim_type type2, int pos2);
4333 Intersect the relation with the half-space where the given
4334 dimensions satisfy the given ordering.
4336 =item * Locus
4338         #include <isl/aff.h>
4339         __isl_give isl_basic_set *isl_aff_zero_basic_set(
4340                 __isl_take isl_aff *aff);
4341         __isl_give isl_basic_set *isl_aff_neg_basic_set(
4342                 __isl_take isl_aff *aff);
4343         __isl_give isl_set *isl_pw_aff_pos_set(
4344                 __isl_take isl_pw_aff *pa);
4345         __isl_give isl_set *isl_pw_aff_nonneg_set(
4346                 __isl_take isl_pw_aff *pwaff);
4347         __isl_give isl_set *isl_pw_aff_zero_set(
4348                 __isl_take isl_pw_aff *pwaff);
4349         __isl_give isl_set *isl_pw_aff_non_zero_set(
4350                 __isl_take isl_pw_aff *pwaff);
4351         __isl_give isl_union_set *
4352         isl_union_pw_aff_zero_union_set(
4353                 __isl_take isl_union_pw_aff *upa);
4354         __isl_give isl_union_set *
4355         isl_multi_union_pw_aff_zero_union_set(
4356                 __isl_take isl_multi_union_pw_aff *mupa);
4358 The function C<isl_aff_neg_basic_set> returns a basic set
4359 containing those elements in the domain space
4360 of C<aff> where C<aff> is negative.
4361 The function C<isl_pw_aff_nonneg_set> returns a set
4362 containing those elements in the domain
4363 of C<pwaff> where C<pwaff> is non-negative.
4364 The function C<isl_multi_union_pw_aff_zero_union_set>
4365 returns a union set containing those elements
4366 in the domains of its elements where they are all zero.
4368 =item * Identity
4370         __isl_give isl_map *isl_set_identity(
4371                 __isl_take isl_set *set);
4372         __isl_give isl_union_map *isl_union_set_identity(
4373                 __isl_take isl_union_set *uset);
4374         __isl_give isl_union_pw_multi_aff *
4375         isl_union_set_identity_union_pw_multi_aff(
4376                 __isl_take isl_union_set *uset);
4378 Construct an identity relation on the given (union) set.
4380 =item * Function Extraction
4382 A piecewise quasi affine expression that is equal to 1 on a set
4383 and 0 outside the set can be created using the following function.
4385         #include <isl/aff.h>
4386         __isl_give isl_pw_aff *isl_set_indicator_function(
4387                 __isl_take isl_set *set);
4389 A piecewise multiple quasi affine expression can be extracted
4390 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4391 and the C<isl_map> is single-valued.
4392 In case of a conversion from an C<isl_union_map>
4393 to an C<isl_union_pw_multi_aff>, these properties need to hold
4394 in each domain space.
4395 A conversion to a C<isl_multi_union_pw_aff> additionally
4396 requires that the input is non-empty and involves only a single
4397 range space.
4399         #include <isl/aff.h>
4400         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4401                 __isl_take isl_set *set);
4402         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4403                 __isl_take isl_map *map);
4405         __isl_give isl_union_pw_multi_aff *
4406         isl_union_pw_multi_aff_from_union_set(
4407                 __isl_take isl_union_set *uset);
4408         __isl_give isl_union_pw_multi_aff *
4409         isl_union_pw_multi_aff_from_union_map(
4410                 __isl_take isl_union_map *umap);
4412         __isl_give isl_multi_union_pw_aff *
4413         isl_multi_union_pw_aff_from_union_map(
4414                 __isl_take isl_union_map *umap);
4416 =item * Deltas
4418         __isl_give isl_basic_set *isl_basic_map_deltas(
4419                 __isl_take isl_basic_map *bmap);
4420         __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
4421         __isl_give isl_union_set *isl_union_map_deltas(
4422                 __isl_take isl_union_map *umap);
4424 These functions return a (basic) set containing the differences
4425 between image elements and corresponding domain elements in the input.
4427         __isl_give isl_basic_map *isl_basic_map_deltas_map(
4428                 __isl_take isl_basic_map *bmap);
4429         __isl_give isl_map *isl_map_deltas_map(
4430                 __isl_take isl_map *map);
4431         __isl_give isl_union_map *isl_union_map_deltas_map(
4432                 __isl_take isl_union_map *umap);
4434 The functions above construct a (basic, regular or union) relation
4435 that maps (a wrapped version of) the input relation to its delta set.
4437 =item * Coalescing
4439 Simplify the representation of a set, relation or functions by trying
4440 to combine pairs of basic sets or relations into a single
4441 basic set or relation.
4443         #include <isl/set.h>
4444         __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
4446         #include <isl/map.h>
4447         __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
4449         #include <isl/union_set.h>
4450         __isl_give isl_union_set *isl_union_set_coalesce(
4451                 __isl_take isl_union_set *uset);
4453         #include <isl/union_map.h>
4454         __isl_give isl_union_map *isl_union_map_coalesce(
4455                 __isl_take isl_union_map *umap);
4457         #include <isl/aff.h>
4458         __isl_give isl_pw_aff *isl_pw_aff_coalesce(
4459                 __isl_take isl_pw_aff *pwqp);
4460         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
4461                 __isl_take isl_pw_multi_aff *pma);
4462         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
4463                 __isl_take isl_multi_pw_aff *mpa);
4464         __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
4465                 __isl_take isl_union_pw_aff *upa);
4466         __isl_give isl_union_pw_multi_aff *
4467         isl_union_pw_multi_aff_coalesce(
4468                 __isl_take isl_union_pw_multi_aff *upma);
4470         #include <isl/polynomial.h>
4471         __isl_give isl_pw_qpolynomial_fold *
4472         isl_pw_qpolynomial_fold_coalesce(
4473                 __isl_take isl_pw_qpolynomial_fold *pwf);
4474         __isl_give isl_union_pw_qpolynomial *
4475         isl_union_pw_qpolynomial_coalesce(
4476                 __isl_take isl_union_pw_qpolynomial *upwqp);
4477         __isl_give isl_union_pw_qpolynomial_fold *
4478         isl_union_pw_qpolynomial_fold_coalesce(
4479                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4481 One of the methods for combining pairs of basic sets or relations
4482 can result in coefficients that are much larger than those that appear
4483 in the constraints of the input.  By default, the coefficients are
4484 not allowed to grow larger, but this can be changed by unsetting
4485 the following option.
4487         int isl_options_set_coalesce_bounded_wrapping(
4488                 isl_ctx *ctx, int val);
4489         int isl_options_get_coalesce_bounded_wrapping(
4490                 isl_ctx *ctx);
4492 =item * Detecting equalities
4494         __isl_give isl_basic_set *isl_basic_set_detect_equalities(
4495                 __isl_take isl_basic_set *bset);
4496         __isl_give isl_basic_map *isl_basic_map_detect_equalities(
4497                 __isl_take isl_basic_map *bmap);
4498         __isl_give isl_set *isl_set_detect_equalities(
4499                 __isl_take isl_set *set);
4500         __isl_give isl_map *isl_map_detect_equalities(
4501                 __isl_take isl_map *map);
4502         __isl_give isl_union_set *isl_union_set_detect_equalities(
4503                 __isl_take isl_union_set *uset);
4504         __isl_give isl_union_map *isl_union_map_detect_equalities(
4505                 __isl_take isl_union_map *umap);
4507 Simplify the representation of a set or relation by detecting implicit
4508 equalities.
4510 =item * Removing redundant constraints
4512         #include <isl/set.h>
4513         __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
4514                 __isl_take isl_basic_set *bset);
4515         __isl_give isl_set *isl_set_remove_redundancies(
4516                 __isl_take isl_set *set);
4518         #include <isl/union_set.h>
4519         __isl_give isl_union_set *
4520         isl_union_set_remove_redundancies(
4521                 __isl_take isl_union_set *uset);
4523         #include <isl/map.h>
4524         __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
4525                 __isl_take isl_basic_map *bmap);
4526         __isl_give isl_map *isl_map_remove_redundancies(
4527                 __isl_take isl_map *map);
4529         #include <isl/union_map.h>
4530         __isl_give isl_union_map *
4531         isl_union_map_remove_redundancies(
4532                 __isl_take isl_union_map *umap);
4534 =item * Convex hull
4536         __isl_give isl_basic_set *isl_set_convex_hull(
4537                 __isl_take isl_set *set);
4538         __isl_give isl_basic_map *isl_map_convex_hull(
4539                 __isl_take isl_map *map);
4541 If the input set or relation has any existentially quantified
4542 variables, then the result of these operations is currently undefined.
4544 =item * Simple hull
4546         #include <isl/set.h>
4547         __isl_give isl_basic_set *
4548         isl_set_unshifted_simple_hull(
4549                 __isl_take isl_set *set);
4550         __isl_give isl_basic_set *isl_set_simple_hull(
4551                 __isl_take isl_set *set);
4552         __isl_give isl_basic_set *
4553         isl_set_unshifted_simple_hull_from_set_list(
4554                 __isl_take isl_set *set,
4555                 __isl_take isl_set_list *list);
4557         #include <isl/map.h>
4558         __isl_give isl_basic_map *
4559         isl_map_unshifted_simple_hull(
4560                 __isl_take isl_map *map);
4561         __isl_give isl_basic_map *isl_map_simple_hull(
4562                 __isl_take isl_map *map);
4563         __isl_give isl_basic_map *
4564         isl_map_unshifted_simple_hull_from_map_list(
4565                 __isl_take isl_map *map,
4566                 __isl_take isl_map_list *list);
4568         #include <isl/union_map.h>
4569         __isl_give isl_union_map *isl_union_map_simple_hull(
4570                 __isl_take isl_union_map *umap);
4572 These functions compute a single basic set or relation
4573 that contains the whole input set or relation.
4574 In particular, the output is described by translates
4575 of the constraints describing the basic sets or relations in the input.
4576 In case of C<isl_set_unshifted_simple_hull>, only the original
4577 constraints are used, without any translation.
4578 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
4579 C<isl_map_unshifted_simple_hull_from_map_list>, the
4580 constraints are taken from the elements of the second argument.
4582 =begin latex
4584 (See \autoref{s:simple hull}.)
4586 =end latex
4588 =item * Affine hull
4590         __isl_give isl_basic_set *isl_basic_set_affine_hull(
4591                 __isl_take isl_basic_set *bset);
4592         __isl_give isl_basic_set *isl_set_affine_hull(
4593                 __isl_take isl_set *set);
4594         __isl_give isl_union_set *isl_union_set_affine_hull(
4595                 __isl_take isl_union_set *uset);
4596         __isl_give isl_basic_map *isl_basic_map_affine_hull(
4597                 __isl_take isl_basic_map *bmap);
4598         __isl_give isl_basic_map *isl_map_affine_hull(
4599                 __isl_take isl_map *map);
4600         __isl_give isl_union_map *isl_union_map_affine_hull(
4601                 __isl_take isl_union_map *umap);
4603 In case of union sets and relations, the affine hull is computed
4604 per space.
4606 =item * Polyhedral hull
4608         __isl_give isl_basic_set *isl_set_polyhedral_hull(
4609                 __isl_take isl_set *set);
4610         __isl_give isl_basic_map *isl_map_polyhedral_hull(
4611                 __isl_take isl_map *map);
4612         __isl_give isl_union_set *isl_union_set_polyhedral_hull(
4613                 __isl_take isl_union_set *uset);
4614         __isl_give isl_union_map *isl_union_map_polyhedral_hull(
4615                 __isl_take isl_union_map *umap);
4617 These functions compute a single basic set or relation
4618 not involving any existentially quantified variables
4619 that contains the whole input set or relation.
4620 In case of union sets and relations, the polyhedral hull is computed
4621 per space.
4623 =item * Other approximations
4625         #include <isl/set.h>
4626         __isl_give isl_basic_set *
4627         isl_basic_set_drop_constraints_involving_dims(
4628                 __isl_take isl_basic_set *bset,
4629                 enum isl_dim_type type,
4630                 unsigned first, unsigned n);
4631         __isl_give isl_basic_set *
4632         isl_basic_set_drop_constraints_not_involving_dims(
4633                 __isl_take isl_basic_set *bset,
4634                 enum isl_dim_type type,
4635                 unsigned first, unsigned n);
4636         __isl_give isl_set *
4637         isl_set_drop_constraints_involving_dims(
4638                 __isl_take isl_set *set,
4639                 enum isl_dim_type type,
4640                 unsigned first, unsigned n);
4642         #include <isl/map.h>
4643         __isl_give isl_basic_map *
4644         isl_basic_map_drop_constraints_involving_dims(
4645                 __isl_take isl_basic_map *bmap,
4646                 enum isl_dim_type type,
4647                 unsigned first, unsigned n);
4648         __isl_give isl_map *
4649         isl_map_drop_constraints_involving_dims(
4650                 __isl_take isl_map *map,
4651                 enum isl_dim_type type,
4652                 unsigned first, unsigned n);
4654 These functions drop any constraints (not) involving the specified dimensions.
4655 Note that the result depends on the representation of the input.
4657         #include <isl/polynomial.h>
4658         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
4659                 __isl_take isl_pw_qpolynomial *pwqp, int sign);
4660         __isl_give isl_union_pw_qpolynomial *
4661         isl_union_pw_qpolynomial_to_polynomial(
4662                 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
4664 Approximate each quasipolynomial by a polynomial.  If C<sign> is positive,
4665 the polynomial will be an overapproximation.  If C<sign> is negative,
4666 it will be an underapproximation.  If C<sign> is zero, the approximation
4667 will lie somewhere in between.
4669 =item * Feasibility
4671         __isl_give isl_basic_set *isl_basic_set_sample(
4672                 __isl_take isl_basic_set *bset);
4673         __isl_give isl_basic_set *isl_set_sample(
4674                 __isl_take isl_set *set);
4675         __isl_give isl_basic_map *isl_basic_map_sample(
4676                 __isl_take isl_basic_map *bmap);
4677         __isl_give isl_basic_map *isl_map_sample(
4678                 __isl_take isl_map *map);
4680 If the input (basic) set or relation is non-empty, then return
4681 a singleton subset of the input.  Otherwise, return an empty set.
4683 =item * Optimization
4685         #include <isl/ilp.h>
4686         __isl_give isl_val *isl_basic_set_max_val(
4687                 __isl_keep isl_basic_set *bset,
4688                 __isl_keep isl_aff *obj);
4689         __isl_give isl_val *isl_set_min_val(
4690                 __isl_keep isl_set *set,
4691                 __isl_keep isl_aff *obj);
4692         __isl_give isl_val *isl_set_max_val(
4693                 __isl_keep isl_set *set,
4694                 __isl_keep isl_aff *obj);
4696 Compute the minimum or maximum of the integer affine expression C<obj>
4697 over the points in C<set>, returning the result in C<opt>.
4698 The result is C<NULL> in case of an error, the optimal value in case
4699 there is one, negative infinity or infinity if the problem is unbounded and
4700 NaN if the problem is empty.
4702 =item * Parametric optimization
4704         __isl_give isl_pw_aff *isl_set_dim_min(
4705                 __isl_take isl_set *set, int pos);
4706         __isl_give isl_pw_aff *isl_set_dim_max(
4707                 __isl_take isl_set *set, int pos);
4708         __isl_give isl_pw_aff *isl_map_dim_max(
4709                 __isl_take isl_map *map, int pos);
4711 Compute the minimum or maximum of the given set or output dimension
4712 as a function of the parameters (and input dimensions), but independently
4713 of the other set or output dimensions.
4714 For lexicographic optimization, see L<"Lexicographic Optimization">.
4716 =item * Dual
4718 The following functions compute either the set of (rational) coefficient
4719 values of valid constraints for the given set or the set of (rational)
4720 values satisfying the constraints with coefficients from the given set.
4721 Internally, these two sets of functions perform essentially the
4722 same operations, except that the set of coefficients is assumed to
4723 be a cone, while the set of values may be any polyhedron.
4724 The current implementation is based on the Farkas lemma and
4725 Fourier-Motzkin elimination, but this may change or be made optional
4726 in future.  In particular, future implementations may use different
4727 dualization algorithms or skip the elimination step.
4729         __isl_give isl_basic_set *isl_basic_set_coefficients(
4730                 __isl_take isl_basic_set *bset);
4731         __isl_give isl_basic_set *isl_set_coefficients(
4732                 __isl_take isl_set *set);
4733         __isl_give isl_union_set *isl_union_set_coefficients(
4734                 __isl_take isl_union_set *bset);
4735         __isl_give isl_basic_set *isl_basic_set_solutions(
4736                 __isl_take isl_basic_set *bset);
4737         __isl_give isl_basic_set *isl_set_solutions(
4738                 __isl_take isl_set *set);
4739         __isl_give isl_union_set *isl_union_set_solutions(
4740                 __isl_take isl_union_set *bset);
4742 =item * Power
4744         __isl_give isl_map *isl_map_fixed_power_val(
4745                 __isl_take isl_map *map,
4746                 __isl_take isl_val *exp);
4747         __isl_give isl_union_map *
4748         isl_union_map_fixed_power_val(
4749                 __isl_take isl_union_map *umap,
4750                 __isl_take isl_val *exp);
4752 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
4753 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
4754 of C<map> is computed.
4756         __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
4757                 int *exact);
4758         __isl_give isl_union_map *isl_union_map_power(
4759                 __isl_take isl_union_map *umap, int *exact);
4761 Compute a parametric representation for all positive powers I<k> of C<map>.
4762 The result maps I<k> to a nested relation corresponding to the
4763 I<k>th power of C<map>.
4764 The result may be an overapproximation.  If the result is known to be exact,
4765 then C<*exact> is set to C<1>.
4767 =item * Transitive closure
4769         __isl_give isl_map *isl_map_transitive_closure(
4770                 __isl_take isl_map *map, int *exact);
4771         __isl_give isl_union_map *isl_union_map_transitive_closure(
4772                 __isl_take isl_union_map *umap, int *exact);
4774 Compute the transitive closure of C<map>.
4775 The result may be an overapproximation.  If the result is known to be exact,
4776 then C<*exact> is set to C<1>.
4778 =item * Reaching path lengths
4780         __isl_give isl_map *isl_map_reaching_path_lengths(
4781                 __isl_take isl_map *map, int *exact);
4783 Compute a relation that maps each element in the range of C<map>
4784 to the lengths of all paths composed of edges in C<map> that
4785 end up in the given element.
4786 The result may be an overapproximation.  If the result is known to be exact,
4787 then C<*exact> is set to C<1>.
4788 To compute the I<maximal> path length, the resulting relation
4789 should be postprocessed by C<isl_map_lexmax>.
4790 In particular, if the input relation is a dependence relation
4791 (mapping sources to sinks), then the maximal path length corresponds
4792 to the free schedule.
4793 Note, however, that C<isl_map_lexmax> expects the maximum to be
4794 finite, so if the path lengths are unbounded (possibly due to
4795 the overapproximation), then you will get an error message.
4797 =item * Wrapping
4799         #include <isl/space.h>
4800         __isl_give isl_space *isl_space_wrap(
4801                 __isl_take isl_space *space);
4802         __isl_give isl_space *isl_space_unwrap(
4803                 __isl_take isl_space *space);
4805         #include <isl/local_space.h>
4806         __isl_give isl_local_space *isl_local_space_wrap(
4807                 __isl_take isl_local_space *ls);
4809         #include <isl/set.h>
4810         __isl_give isl_basic_map *isl_basic_set_unwrap(
4811                 __isl_take isl_basic_set *bset);
4812         __isl_give isl_map *isl_set_unwrap(
4813                 __isl_take isl_set *set);
4815         #include <isl/map.h>
4816         __isl_give isl_basic_set *isl_basic_map_wrap(
4817                 __isl_take isl_basic_map *bmap);
4818         __isl_give isl_set *isl_map_wrap(
4819                 __isl_take isl_map *map);
4821         #include <isl/union_set.h>
4822         __isl_give isl_union_map *isl_union_set_unwrap(
4823                 __isl_take isl_union_set *uset);
4825         #include <isl/union_map.h>
4826         __isl_give isl_union_set *isl_union_map_wrap(
4827                 __isl_take isl_union_map *umap);
4829 The input to C<isl_space_unwrap> should
4830 be the space of a set, while that of
4831 C<isl_space_wrap> should be the space of a relation.
4832 Conversely, the output of C<isl_space_unwrap> is the space
4833 of a relation, while that of C<isl_space_wrap> is the space of a set.
4835 =item * Flattening
4837 Remove any internal structure of domain (and range) of the given
4838 set or relation.  If there is any such internal structure in the input,
4839 then the name of the space is also removed.
4841         #include <isl/local_space.h>
4842         __isl_give isl_local_space *
4843         isl_local_space_flatten_domain(
4844                 __isl_take isl_local_space *ls);
4845         __isl_give isl_local_space *
4846         isl_local_space_flatten_range(
4847                 __isl_take isl_local_space *ls);
4849         #include <isl/set.h>
4850         __isl_give isl_basic_set *isl_basic_set_flatten(
4851                 __isl_take isl_basic_set *bset);
4852         __isl_give isl_set *isl_set_flatten(
4853                 __isl_take isl_set *set);
4855         #include <isl/map.h>
4856         __isl_give isl_basic_map *isl_basic_map_flatten_domain(
4857                 __isl_take isl_basic_map *bmap);
4858         __isl_give isl_basic_map *isl_basic_map_flatten_range(
4859                 __isl_take isl_basic_map *bmap);
4860         __isl_give isl_map *isl_map_flatten_range(
4861                 __isl_take isl_map *map);
4862         __isl_give isl_map *isl_map_flatten_domain(
4863                 __isl_take isl_map *map);
4864         __isl_give isl_basic_map *isl_basic_map_flatten(
4865                 __isl_take isl_basic_map *bmap);
4866         __isl_give isl_map *isl_map_flatten(
4867                 __isl_take isl_map *map);
4869         #include <isl/val.h>
4870         __isl_give isl_multi_val *isl_multi_val_flatten_range(
4871                 __isl_take isl_multi_val *mv);
4873         #include <isl/aff.h>
4874         __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
4875                 __isl_take isl_multi_aff *ma);
4876         __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
4877                 __isl_take isl_multi_aff *ma);
4878         __isl_give isl_multi_pw_aff *
4879         isl_multi_pw_aff_flatten_range(
4880                 __isl_take isl_multi_pw_aff *mpa);
4881         __isl_give isl_multi_union_pw_aff *
4882         isl_multi_union_pw_aff_flatten_range(
4883                 __isl_take isl_multi_union_pw_aff *mupa);
4885         #include <isl/map.h>
4886         __isl_give isl_map *isl_set_flatten_map(
4887                 __isl_take isl_set *set);
4889 The function above constructs a relation
4890 that maps the input set to a flattened version of the set.
4892 =item * Lifting
4894 Lift the input set to a space with extra dimensions corresponding
4895 to the existentially quantified variables in the input.
4896 In particular, the result lives in a wrapped map where the domain
4897 is the original space and the range corresponds to the original
4898 existentially quantified variables.
4900         #include <isl/set.h>
4901         __isl_give isl_basic_set *isl_basic_set_lift(
4902                 __isl_take isl_basic_set *bset);
4903         __isl_give isl_set *isl_set_lift(
4904                 __isl_take isl_set *set);
4905         __isl_give isl_union_set *isl_union_set_lift(
4906                 __isl_take isl_union_set *uset);
4908 Given a local space that contains the existentially quantified
4909 variables of a set, a basic relation that, when applied to
4910 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
4911 can be constructed using the following function.
4913         #include <isl/local_space.h>
4914         __isl_give isl_basic_map *isl_local_space_lifting(
4915                 __isl_take isl_local_space *ls);
4917         #include <isl/aff.h>
4918         __isl_give isl_multi_aff *isl_multi_aff_lift(
4919                 __isl_take isl_multi_aff *maff,
4920                 __isl_give isl_local_space **ls);
4922 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
4923 then it is assigned the local space that lies at the basis of
4924 the lifting applied.
4926 =item * Internal Product
4928         #include <isl/space.h>
4929         __isl_give isl_space *isl_space_zip(
4930                 __isl_take isl_space *space);
4932         #include <isl/map.h>
4933         __isl_give isl_basic_map *isl_basic_map_zip(
4934                 __isl_take isl_basic_map *bmap);
4935         __isl_give isl_map *isl_map_zip(
4936                 __isl_take isl_map *map);
4938         #include <isl/union_map.h>
4939         __isl_give isl_union_map *isl_union_map_zip(
4940                 __isl_take isl_union_map *umap);
4942 Given a relation with nested relations for domain and range,
4943 interchange the range of the domain with the domain of the range.
4945 =item * Currying
4947         #include <isl/space.h>
4948         __isl_give isl_space *isl_space_curry(
4949                 __isl_take isl_space *space);
4950         __isl_give isl_space *isl_space_uncurry(
4951                 __isl_take isl_space *space);
4953         #include <isl/map.h>
4954         __isl_give isl_basic_map *isl_basic_map_curry(
4955                 __isl_take isl_basic_map *bmap);
4956         __isl_give isl_basic_map *isl_basic_map_uncurry(
4957                 __isl_take isl_basic_map *bmap);
4958         __isl_give isl_map *isl_map_curry(
4959                 __isl_take isl_map *map);
4960         __isl_give isl_map *isl_map_uncurry(
4961                 __isl_take isl_map *map);
4963         #include <isl/union_map.h>
4964         __isl_give isl_union_map *isl_union_map_curry(
4965                 __isl_take isl_union_map *umap);
4966         __isl_give isl_union_map *isl_union_map_uncurry(
4967                 __isl_take isl_union_map *umap);
4969 Given a relation with a nested relation for domain,
4970 the C<curry> functions
4971 move the range of the nested relation out of the domain
4972 and use it as the domain of a nested relation in the range,
4973 with the original range as range of this nested relation.
4974 The C<uncurry> functions perform the inverse operation.
4976 =item * Aligning parameters
4978 Change the order of the parameters of the given set, relation
4979 or function
4980 such that the first parameters match those of C<model>.
4981 This may involve the introduction of extra parameters.
4982 All parameters need to be named.
4984         #include <isl/space.h>
4985         __isl_give isl_space *isl_space_align_params(
4986                 __isl_take isl_space *space1,
4987                 __isl_take isl_space *space2)
4989         #include <isl/set.h>
4990         __isl_give isl_basic_set *isl_basic_set_align_params(
4991                 __isl_take isl_basic_set *bset,
4992                 __isl_take isl_space *model);
4993         __isl_give isl_set *isl_set_align_params(
4994                 __isl_take isl_set *set,
4995                 __isl_take isl_space *model);
4997         #include <isl/map.h>
4998         __isl_give isl_basic_map *isl_basic_map_align_params(
4999                 __isl_take isl_basic_map *bmap,
5000                 __isl_take isl_space *model);
5001         __isl_give isl_map *isl_map_align_params(
5002                 __isl_take isl_map *map,
5003                 __isl_take isl_space *model);
5005         #include <isl/val.h>
5006         __isl_give isl_multi_val *isl_multi_val_align_params(
5007                 __isl_take isl_multi_val *mv,
5008                 __isl_take isl_space *model);
5010         #include <isl/aff.h>
5011         __isl_give isl_aff *isl_aff_align_params(
5012                 __isl_take isl_aff *aff,
5013                 __isl_take isl_space *model);
5014         __isl_give isl_multi_aff *isl_multi_aff_align_params(
5015                 __isl_take isl_multi_aff *multi,
5016                 __isl_take isl_space *model);
5017         __isl_give isl_pw_aff *isl_pw_aff_align_params(
5018                 __isl_take isl_pw_aff *pwaff,
5019                 __isl_take isl_space *model);
5020         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
5021                 __isl_take isl_pw_multi_aff *pma,
5022                 __isl_take isl_space *model);
5023         __isl_give isl_union_pw_aff *
5024         isl_union_pw_aff_align_params(
5025                 __isl_take isl_union_pw_aff *upa,
5026                 __isl_take isl_space *model);
5027         __isl_give isl_union_pw_multi_aff *
5028         isl_union_pw_multi_aff_align_params(
5029                 __isl_take isl_union_pw_multi_aff *upma,
5030                 __isl_take isl_space *model);
5031         __isl_give isl_multi_union_pw_aff *
5032         isl_multi_union_pw_aff_align_params(
5033                 __isl_take isl_multi_union_pw_aff *mupa,
5034                 __isl_take isl_space *model);
5036         #include <isl/polynomial.h>
5037         __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
5038                 __isl_take isl_qpolynomial *qp,
5039                 __isl_take isl_space *model);
5041 =item * Unary Arithmethic Operations
5043         #include <isl/val.h>
5044         __isl_give isl_multi_val *isl_multi_val_neg(
5045                 __isl_take isl_multi_val *mv);
5047         #include <isl/aff.h>
5048         __isl_give isl_aff *isl_aff_neg(
5049                 __isl_take isl_aff *aff);
5050         __isl_give isl_multi_aff *isl_multi_aff_neg(
5051                 __isl_take isl_multi_aff *ma);
5052         __isl_give isl_pw_aff *isl_pw_aff_neg(
5053                 __isl_take isl_pw_aff *pwaff);
5054         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
5055                 __isl_take isl_pw_multi_aff *pma);
5056         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
5057                 __isl_take isl_multi_pw_aff *mpa);
5058         __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
5059                 __isl_take isl_union_pw_aff *upa);
5060         __isl_give isl_union_pw_multi_aff *
5061         isl_union_pw_multi_aff_neg(
5062                 __isl_take isl_union_pw_multi_aff *upma);
5063         __isl_give isl_multi_union_pw_aff *
5064         isl_multi_union_pw_aff_neg(
5065                 __isl_take isl_multi_union_pw_aff *mupa);
5066         __isl_give isl_aff *isl_aff_ceil(
5067                 __isl_take isl_aff *aff);
5068         __isl_give isl_pw_aff *isl_pw_aff_ceil(
5069                 __isl_take isl_pw_aff *pwaff);
5070         __isl_give isl_aff *isl_aff_floor(
5071                 __isl_take isl_aff *aff);
5072         __isl_give isl_multi_aff *isl_multi_aff_floor(
5073                 __isl_take isl_multi_aff *ma);
5074         __isl_give isl_pw_aff *isl_pw_aff_floor(
5075                 __isl_take isl_pw_aff *pwaff);
5076         __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
5077                 __isl_take isl_union_pw_aff *upa);
5078         __isl_give isl_multi_union_pw_aff *
5079         isl_multi_union_pw_aff_floor(
5080                 __isl_take isl_multi_union_pw_aff *mupa);
5082         #include <isl/aff.h>
5083         __isl_give isl_pw_aff *isl_pw_aff_list_min(
5084                 __isl_take isl_pw_aff_list *list);
5085         __isl_give isl_pw_aff *isl_pw_aff_list_max(
5086                 __isl_take isl_pw_aff_list *list);
5088         #include <isl/polynomial.h>
5089         __isl_give isl_qpolynomial *isl_qpolynomial_neg(
5090                 __isl_take isl_qpolynomial *qp);
5091         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
5092                 __isl_take isl_pw_qpolynomial *pwqp);
5093         __isl_give isl_union_pw_qpolynomial *
5094         isl_union_pw_qpolynomial_neg(
5095                 __isl_take isl_union_pw_qpolynomial *upwqp);
5096         __isl_give isl_qpolynomial *isl_qpolynomial_pow(
5097                 __isl_take isl_qpolynomial *qp,
5098                 unsigned exponent);
5099         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
5100                 __isl_take isl_pw_qpolynomial *pwqp,
5101                 unsigned exponent);
5103 =item * Evaluation
5105 The following functions evaluate a function in a point.
5107         #include <isl/polynomial.h>
5108         __isl_give isl_val *isl_pw_qpolynomial_eval(
5109                 __isl_take isl_pw_qpolynomial *pwqp,
5110                 __isl_take isl_point *pnt);
5111         __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
5112                 __isl_take isl_pw_qpolynomial_fold *pwf,
5113                 __isl_take isl_point *pnt);
5114         __isl_give isl_val *isl_union_pw_qpolynomial_eval(
5115                 __isl_take isl_union_pw_qpolynomial *upwqp,
5116                 __isl_take isl_point *pnt);
5117         __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
5118                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5119                 __isl_take isl_point *pnt);
5121 =item * Dimension manipulation
5123 It is usually not advisable to directly change the (input or output)
5124 space of a set or a relation as this removes the name and the internal
5125 structure of the space.  However, the functions below can be useful
5126 to add new parameters, assuming
5127 C<isl_set_align_params> and C<isl_map_align_params>
5128 are not sufficient.
5130         #include <isl/space.h>
5131         __isl_give isl_space *isl_space_add_dims(
5132                 __isl_take isl_space *space,
5133                 enum isl_dim_type type, unsigned n);
5134         __isl_give isl_space *isl_space_insert_dims(
5135                 __isl_take isl_space *space,
5136                 enum isl_dim_type type, unsigned pos, unsigned n);
5137         __isl_give isl_space *isl_space_drop_dims(
5138                 __isl_take isl_space *space,
5139                 enum isl_dim_type type, unsigned first, unsigned n);
5140         __isl_give isl_space *isl_space_move_dims(
5141                 __isl_take isl_space *space,
5142                 enum isl_dim_type dst_type, unsigned dst_pos,
5143                 enum isl_dim_type src_type, unsigned src_pos,
5144                 unsigned n);
5146         #include <isl/local_space.h>
5147         __isl_give isl_local_space *isl_local_space_add_dims(
5148                 __isl_take isl_local_space *ls,
5149                 enum isl_dim_type type, unsigned n);
5150         __isl_give isl_local_space *isl_local_space_insert_dims(
5151                 __isl_take isl_local_space *ls,
5152                 enum isl_dim_type type, unsigned first, unsigned n);
5153         __isl_give isl_local_space *isl_local_space_drop_dims(
5154                 __isl_take isl_local_space *ls,
5155                 enum isl_dim_type type, unsigned first, unsigned n);
5157         #include <isl/set.h>
5158         __isl_give isl_basic_set *isl_basic_set_add_dims(
5159                 __isl_take isl_basic_set *bset,
5160                 enum isl_dim_type type, unsigned n);
5161         __isl_give isl_set *isl_set_add_dims(
5162                 __isl_take isl_set *set,
5163                 enum isl_dim_type type, unsigned n);
5164         __isl_give isl_basic_set *isl_basic_set_insert_dims(
5165                 __isl_take isl_basic_set *bset,
5166                 enum isl_dim_type type, unsigned pos,
5167                 unsigned n);
5168         __isl_give isl_set *isl_set_insert_dims(
5169                 __isl_take isl_set *set,
5170                 enum isl_dim_type type, unsigned pos, unsigned n);
5171         __isl_give isl_basic_set *isl_basic_set_move_dims(
5172                 __isl_take isl_basic_set *bset,
5173                 enum isl_dim_type dst_type, unsigned dst_pos,
5174                 enum isl_dim_type src_type, unsigned src_pos,
5175                 unsigned n);
5176         __isl_give isl_set *isl_set_move_dims(
5177                 __isl_take isl_set *set,
5178                 enum isl_dim_type dst_type, unsigned dst_pos,
5179                 enum isl_dim_type src_type, unsigned src_pos,
5180                 unsigned n);
5182         #include <isl/map.h>
5183         __isl_give isl_map *isl_map_add_dims(
5184                 __isl_take isl_map *map,
5185                 enum isl_dim_type type, unsigned n);
5186         __isl_give isl_basic_map *isl_basic_map_insert_dims(
5187                 __isl_take isl_basic_map *bmap,
5188                 enum isl_dim_type type, unsigned pos,
5189                 unsigned n);
5190         __isl_give isl_map *isl_map_insert_dims(
5191                 __isl_take isl_map *map,
5192                 enum isl_dim_type type, unsigned pos, unsigned n);
5193         __isl_give isl_basic_map *isl_basic_map_move_dims(
5194                 __isl_take isl_basic_map *bmap,
5195                 enum isl_dim_type dst_type, unsigned dst_pos,
5196                 enum isl_dim_type src_type, unsigned src_pos,
5197                 unsigned n);
5198         __isl_give isl_map *isl_map_move_dims(
5199                 __isl_take isl_map *map,
5200                 enum isl_dim_type dst_type, unsigned dst_pos,
5201                 enum isl_dim_type src_type, unsigned src_pos,
5202                 unsigned n);
5204         #include <isl/val.h>
5205         __isl_give isl_multi_val *isl_multi_val_insert_dims(
5206                 __isl_take isl_multi_val *mv,
5207                 enum isl_dim_type type, unsigned first, unsigned n);
5208         __isl_give isl_multi_val *isl_multi_val_add_dims(
5209                 __isl_take isl_multi_val *mv,
5210                 enum isl_dim_type type, unsigned n);
5211         __isl_give isl_multi_val *isl_multi_val_drop_dims(
5212                 __isl_take isl_multi_val *mv,
5213                 enum isl_dim_type type, unsigned first, unsigned n);
5215         #include <isl/aff.h>
5216         __isl_give isl_aff *isl_aff_insert_dims(
5217                 __isl_take isl_aff *aff,
5218                 enum isl_dim_type type, unsigned first, unsigned n);
5219         __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
5220                 __isl_take isl_multi_aff *ma,
5221                 enum isl_dim_type type, unsigned first, unsigned n);
5222         __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
5223                 __isl_take isl_pw_aff *pwaff,
5224                 enum isl_dim_type type, unsigned first, unsigned n);
5225         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
5226                 __isl_take isl_multi_pw_aff *mpa,
5227                 enum isl_dim_type type, unsigned first, unsigned n);
5228         __isl_give isl_aff *isl_aff_add_dims(
5229                 __isl_take isl_aff *aff,
5230                 enum isl_dim_type type, unsigned n);
5231         __isl_give isl_multi_aff *isl_multi_aff_add_dims(
5232                 __isl_take isl_multi_aff *ma,
5233                 enum isl_dim_type type, unsigned n);
5234         __isl_give isl_pw_aff *isl_pw_aff_add_dims(
5235                 __isl_take isl_pw_aff *pwaff,
5236                 enum isl_dim_type type, unsigned n);
5237         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
5238                 __isl_take isl_multi_pw_aff *mpa,
5239                 enum isl_dim_type type, unsigned n);
5240         __isl_give isl_aff *isl_aff_drop_dims(
5241                 __isl_take isl_aff *aff,
5242                 enum isl_dim_type type, unsigned first, unsigned n);
5243         __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
5244                 __isl_take isl_multi_aff *maff,
5245                 enum isl_dim_type type, unsigned first, unsigned n);
5246         __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
5247                 __isl_take isl_pw_aff *pwaff,
5248                 enum isl_dim_type type, unsigned first, unsigned n);
5249         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
5250                 __isl_take isl_pw_multi_aff *pma,
5251                 enum isl_dim_type type, unsigned first, unsigned n);
5252         __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
5253                 __isl_take isl_union_pw_aff *upa,
5254                 enum isl_dim_type type, unsigned first, unsigned n);
5255         __isl_give isl_union_pw_multi_aff *
5256                 isl_union_pw_multi_aff_drop_dims(
5257                 __isl_take isl_union_pw_multi_aff *upma,
5258                 enum isl_dim_type type,
5259                 unsigned first, unsigned n);
5260         __isl_give isl_multi_union_pw_aff *
5261         isl_multi_union_pw_aff_drop_dims(
5262                 __isl_take isl_multi_union_pw_aff *mupa,
5263                 enum isl_dim_type type, unsigned first,
5264                 unsigned n);
5265         __isl_give isl_aff *isl_aff_move_dims(
5266                 __isl_take isl_aff *aff,
5267                 enum isl_dim_type dst_type, unsigned dst_pos,
5268                 enum isl_dim_type src_type, unsigned src_pos,
5269                 unsigned n);
5270         __isl_give isl_multi_aff *isl_multi_aff_move_dims(
5271                 __isl_take isl_multi_aff *ma,
5272                 enum isl_dim_type dst_type, unsigned dst_pos,
5273                 enum isl_dim_type src_type, unsigned src_pos,
5274                 unsigned n);
5275         __isl_give isl_pw_aff *isl_pw_aff_move_dims(
5276                 __isl_take isl_pw_aff *pa,
5277                 enum isl_dim_type dst_type, unsigned dst_pos,
5278                 enum isl_dim_type src_type, unsigned src_pos,
5279                 unsigned n);
5280         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
5281                 __isl_take isl_multi_pw_aff *pma,
5282                 enum isl_dim_type dst_type, unsigned dst_pos,
5283                 enum isl_dim_type src_type, unsigned src_pos,
5284                 unsigned n);
5286         #include <isl/polynomial.h>
5287         __isl_give isl_union_pw_qpolynomial *
5288         isl_union_pw_qpolynomial_drop_dims(
5289                 __isl_take isl_union_pw_qpolynomial *upwqp,
5290                 enum isl_dim_type type,
5291                 unsigned first, unsigned n);
5292         __isl_give isl_union_pw_qpolynomial_fold *
5293                 isl_union_pw_qpolynomial_fold_drop_dims(
5294                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5295                 enum isl_dim_type type,
5296                 unsigned first, unsigned n);
5298 The operations on union expressions can only manipulate parameters.
5300 =back
5302 =head2 Binary Operations
5304 The two arguments of a binary operation not only need to live
5305 in the same C<isl_ctx>, they currently also need to have
5306 the same (number of) parameters.
5308 =head3 Basic Operations
5310 =over
5312 =item * Intersection
5314         #include <isl/local_space.h>
5315         __isl_give isl_local_space *isl_local_space_intersect(
5316                 __isl_take isl_local_space *ls1,
5317                 __isl_take isl_local_space *ls2);
5319         #include <isl/set.h>
5320         __isl_give isl_basic_set *isl_basic_set_intersect_params(
5321                 __isl_take isl_basic_set *bset1,
5322                 __isl_take isl_basic_set *bset2);
5323         __isl_give isl_basic_set *isl_basic_set_intersect(
5324                 __isl_take isl_basic_set *bset1,
5325                 __isl_take isl_basic_set *bset2);
5326         __isl_give isl_basic_set *isl_basic_set_list_intersect(
5327                 __isl_take struct isl_basic_set_list *list);
5328         __isl_give isl_set *isl_set_intersect_params(
5329                 __isl_take isl_set *set,
5330                 __isl_take isl_set *params);
5331         __isl_give isl_set *isl_set_intersect(
5332                 __isl_take isl_set *set1,
5333                 __isl_take isl_set *set2);
5335         #include <isl/map.h>
5336         __isl_give isl_basic_map *isl_basic_map_intersect_domain(
5337                 __isl_take isl_basic_map *bmap,
5338                 __isl_take isl_basic_set *bset);
5339         __isl_give isl_basic_map *isl_basic_map_intersect_range(
5340                 __isl_take isl_basic_map *bmap,
5341                 __isl_take isl_basic_set *bset);
5342         __isl_give isl_basic_map *isl_basic_map_intersect(
5343                 __isl_take isl_basic_map *bmap1,
5344                 __isl_take isl_basic_map *bmap2);
5345         __isl_give isl_basic_map *isl_basic_map_list_intersect(
5346                 __isl_take isl_basic_map_list *list);
5347         __isl_give isl_map *isl_map_intersect_params(
5348                 __isl_take isl_map *map,
5349                 __isl_take isl_set *params);
5350         __isl_give isl_map *isl_map_intersect_domain(
5351                 __isl_take isl_map *map,
5352                 __isl_take isl_set *set);
5353         __isl_give isl_map *isl_map_intersect_range(
5354                 __isl_take isl_map *map,
5355                 __isl_take isl_set *set);
5356         __isl_give isl_map *isl_map_intersect(
5357                 __isl_take isl_map *map1,
5358                 __isl_take isl_map *map2);
5360         #include <isl/union_set.h>
5361         __isl_give isl_union_set *isl_union_set_intersect_params(
5362                 __isl_take isl_union_set *uset,
5363                 __isl_take isl_set *set);
5364         __isl_give isl_union_set *isl_union_set_intersect(
5365                 __isl_take isl_union_set *uset1,
5366                 __isl_take isl_union_set *uset2);
5368         #include <isl/union_map.h>
5369         __isl_give isl_union_map *isl_union_map_intersect_params(
5370                 __isl_take isl_union_map *umap,
5371                 __isl_take isl_set *set);
5372         __isl_give isl_union_map *isl_union_map_intersect_domain(
5373                 __isl_take isl_union_map *umap,
5374                 __isl_take isl_union_set *uset);
5375         __isl_give isl_union_map *isl_union_map_intersect_range(
5376                 __isl_take isl_union_map *umap,
5377                 __isl_take isl_union_set *uset);
5378         __isl_give isl_union_map *isl_union_map_intersect(
5379                 __isl_take isl_union_map *umap1,
5380                 __isl_take isl_union_map *umap2);
5382         #include <isl/aff.h>
5383         __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
5384                 __isl_take isl_pw_aff *pa,
5385                 __isl_take isl_set *set);
5386         __isl_give isl_multi_pw_aff *
5387         isl_multi_pw_aff_intersect_domain(
5388                 __isl_take isl_multi_pw_aff *mpa,
5389                 __isl_take isl_set *domain);
5390         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
5391                 __isl_take isl_pw_multi_aff *pma,
5392                 __isl_take isl_set *set);
5393         __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
5394                 __isl_take isl_union_pw_aff *upa,
5395                 __isl_take isl_union_set *uset);
5396         __isl_give isl_union_pw_multi_aff *
5397         isl_union_pw_multi_aff_intersect_domain(
5398                 __isl_take isl_union_pw_multi_aff *upma,
5399                 __isl_take isl_union_set *uset);
5400         __isl_give isl_multi_union_pw_aff *
5401         isl_multi_union_pw_aff_intersect_domain(
5402                 __isl_take isl_multi_union_pw_aff *mupa,
5403                 __isl_take isl_union_set *uset);
5404         __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
5405                 __isl_take isl_pw_aff *pa,
5406                 __isl_take isl_set *set);
5407         __isl_give isl_multi_pw_aff *
5408         isl_multi_pw_aff_intersect_params(
5409                 __isl_take isl_multi_pw_aff *mpa,
5410                 __isl_take isl_set *set);
5411         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
5412                 __isl_take isl_pw_multi_aff *pma,
5413                 __isl_take isl_set *set);
5414         __isl_give isl_union_pw_aff *
5415         isl_union_pw_aff_intersect_params(
5416                 __isl_take isl_union_pw_aff *upa,
5417         __isl_give isl_union_pw_multi_aff *
5418         isl_union_pw_multi_aff_intersect_params(
5419                 __isl_take isl_union_pw_multi_aff *upma,
5420                 __isl_take isl_set *set);
5421         __isl_give isl_multi_union_pw_aff *
5422         isl_multi_union_pw_aff_intersect_params(
5423                 __isl_take isl_multi_union_pw_aff *mupa,
5424                 __isl_take isl_set *params);
5425         isl_multi_union_pw_aff_intersect_range(
5426                 __isl_take isl_multi_union_pw_aff *mupa,
5427                 __isl_take isl_set *set);
5429         #include <isl/polynomial.h>
5430         __isl_give isl_pw_qpolynomial *
5431         isl_pw_qpolynomial_intersect_domain(
5432                 __isl_take isl_pw_qpolynomial *pwpq,
5433                 __isl_take isl_set *set);
5434         __isl_give isl_union_pw_qpolynomial *
5435         isl_union_pw_qpolynomial_intersect_domain(
5436                 __isl_take isl_union_pw_qpolynomial *upwpq,
5437                 __isl_take isl_union_set *uset);
5438         __isl_give isl_union_pw_qpolynomial_fold *
5439         isl_union_pw_qpolynomial_fold_intersect_domain(
5440                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5441                 __isl_take isl_union_set *uset);
5442         __isl_give isl_pw_qpolynomial *
5443         isl_pw_qpolynomial_intersect_params(
5444                 __isl_take isl_pw_qpolynomial *pwpq,
5445                 __isl_take isl_set *set);
5446         __isl_give isl_pw_qpolynomial_fold *
5447         isl_pw_qpolynomial_fold_intersect_params(
5448                 __isl_take isl_pw_qpolynomial_fold *pwf,
5449                 __isl_take isl_set *set);
5450         __isl_give isl_union_pw_qpolynomial *
5451         isl_union_pw_qpolynomial_intersect_params(
5452                 __isl_take isl_union_pw_qpolynomial *upwpq,
5453                 __isl_take isl_set *set);
5454         __isl_give isl_union_pw_qpolynomial_fold *
5455         isl_union_pw_qpolynomial_fold_intersect_params(
5456                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5457                 __isl_take isl_set *set);
5459 The second argument to the C<_params> functions needs to be
5460 a parametric (basic) set.  For the other functions, a parametric set
5461 for either argument is only allowed if the other argument is
5462 a parametric set as well.
5463 The list passed to C<isl_basic_set_list_intersect> needs to have
5464 at least one element and all elements need to live in the same space.
5465 The function C<isl_multi_union_pw_aff_intersect_range>
5466 restricts the input function to those shared domain elements
5467 that map to the specified range.
5469 =item * Union
5471         #include <isl/set.h>
5472         __isl_give isl_set *isl_basic_set_union(
5473                 __isl_take isl_basic_set *bset1,
5474                 __isl_take isl_basic_set *bset2);
5475         __isl_give isl_set *isl_set_union(
5476                 __isl_take isl_set *set1,
5477                 __isl_take isl_set *set2);
5479         #include <isl/map.h>
5480         __isl_give isl_map *isl_basic_map_union(
5481                 __isl_take isl_basic_map *bmap1,
5482                 __isl_take isl_basic_map *bmap2);
5483         __isl_give isl_map *isl_map_union(
5484                 __isl_take isl_map *map1,
5485                 __isl_take isl_map *map2);
5487         #include <isl/union_set.h>
5488         __isl_give isl_union_set *isl_union_set_union(
5489                 __isl_take isl_union_set *uset1,
5490                 __isl_take isl_union_set *uset2);
5491         __isl_give isl_union_set *isl_union_set_list_union(
5492                 __isl_take isl_union_set_list *list);
5494         #include <isl/union_map.h>
5495         __isl_give isl_union_map *isl_union_map_union(
5496                 __isl_take isl_union_map *umap1,
5497                 __isl_take isl_union_map *umap2);
5499 =item * Set difference
5501         #include <isl/set.h>
5502         __isl_give isl_set *isl_set_subtract(
5503                 __isl_take isl_set *set1,
5504                 __isl_take isl_set *set2);
5506         #include <isl/map.h>
5507         __isl_give isl_map *isl_map_subtract(
5508                 __isl_take isl_map *map1,
5509                 __isl_take isl_map *map2);
5510         __isl_give isl_map *isl_map_subtract_domain(
5511                 __isl_take isl_map *map,
5512                 __isl_take isl_set *dom);
5513         __isl_give isl_map *isl_map_subtract_range(
5514                 __isl_take isl_map *map,
5515                 __isl_take isl_set *dom);
5517         #include <isl/union_set.h>
5518         __isl_give isl_union_set *isl_union_set_subtract(
5519                 __isl_take isl_union_set *uset1,
5520                 __isl_take isl_union_set *uset2);
5522         #include <isl/union_map.h>
5523         __isl_give isl_union_map *isl_union_map_subtract(
5524                 __isl_take isl_union_map *umap1,
5525                 __isl_take isl_union_map *umap2);
5526         __isl_give isl_union_map *isl_union_map_subtract_domain(
5527                 __isl_take isl_union_map *umap,
5528                 __isl_take isl_union_set *dom);
5529         __isl_give isl_union_map *isl_union_map_subtract_range(
5530                 __isl_take isl_union_map *umap,
5531                 __isl_take isl_union_set *dom);
5533         #include <isl/aff.h>
5534         __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
5535                 __isl_take isl_pw_aff *pa,
5536                 __isl_take isl_set *set);
5537         __isl_give isl_pw_multi_aff *
5538         isl_pw_multi_aff_subtract_domain(
5539                 __isl_take isl_pw_multi_aff *pma,
5540                 __isl_take isl_set *set);
5541         __isl_give isl_union_pw_aff *
5542         isl_union_pw_aff_subtract_domain(
5543                 __isl_take isl_union_pw_aff *upa,
5544                 __isl_take isl_union_set *uset);
5545         __isl_give isl_union_pw_multi_aff *
5546         isl_union_pw_multi_aff_subtract_domain(
5547                 __isl_take isl_union_pw_multi_aff *upma,
5548                 __isl_take isl_set *set);
5550         #include <isl/polynomial.h>
5551         __isl_give isl_pw_qpolynomial *
5552         isl_pw_qpolynomial_subtract_domain(
5553                 __isl_take isl_pw_qpolynomial *pwpq,
5554                 __isl_take isl_set *set);
5555         __isl_give isl_pw_qpolynomial_fold *
5556         isl_pw_qpolynomial_fold_subtract_domain(
5557                 __isl_take isl_pw_qpolynomial_fold *pwf,
5558                 __isl_take isl_set *set);
5559         __isl_give isl_union_pw_qpolynomial *
5560         isl_union_pw_qpolynomial_subtract_domain(
5561                 __isl_take isl_union_pw_qpolynomial *upwpq,
5562                 __isl_take isl_union_set *uset);
5563         __isl_give isl_union_pw_qpolynomial_fold *
5564         isl_union_pw_qpolynomial_fold_subtract_domain(
5565                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5566                 __isl_take isl_union_set *uset);
5568 =item * Application
5570         #include <isl/space.h>
5571         __isl_give isl_space *isl_space_join(
5572                 __isl_take isl_space *left,
5573                 __isl_take isl_space *right);
5575         #include <isl/map.h>
5576         __isl_give isl_basic_set *isl_basic_set_apply(
5577                 __isl_take isl_basic_set *bset,
5578                 __isl_take isl_basic_map *bmap);
5579         __isl_give isl_set *isl_set_apply(
5580                 __isl_take isl_set *set,
5581                 __isl_take isl_map *map);
5582         __isl_give isl_union_set *isl_union_set_apply(
5583                 __isl_take isl_union_set *uset,
5584                 __isl_take isl_union_map *umap);
5585         __isl_give isl_basic_map *isl_basic_map_apply_domain(
5586                 __isl_take isl_basic_map *bmap1,
5587                 __isl_take isl_basic_map *bmap2);
5588         __isl_give isl_basic_map *isl_basic_map_apply_range(
5589                 __isl_take isl_basic_map *bmap1,
5590                 __isl_take isl_basic_map *bmap2);
5591         __isl_give isl_map *isl_map_apply_domain(
5592                 __isl_take isl_map *map1,
5593                 __isl_take isl_map *map2);
5594         __isl_give isl_map *isl_map_apply_range(
5595                 __isl_take isl_map *map1,
5596                 __isl_take isl_map *map2);
5598         #include <isl/union_map.h>
5599         __isl_give isl_union_map *isl_union_map_apply_domain(
5600                 __isl_take isl_union_map *umap1,
5601                 __isl_take isl_union_map *umap2);
5602         __isl_give isl_union_map *isl_union_map_apply_range(
5603                 __isl_take isl_union_map *umap1,
5604                 __isl_take isl_union_map *umap2);
5606         #include <isl/aff.h>
5607         __isl_give isl_union_pw_aff *
5608         isl_multi_union_pw_aff_apply_aff(
5609                 __isl_take isl_multi_union_pw_aff *mupa,
5610                 __isl_take isl_aff *aff);
5611         __isl_give isl_union_pw_aff *
5612         isl_multi_union_pw_aff_apply_pw_aff(
5613                 __isl_take isl_multi_union_pw_aff *mupa,
5614                 __isl_take isl_pw_aff *pa);
5615         __isl_give isl_multi_union_pw_aff *
5616         isl_multi_union_pw_aff_apply_multi_aff(
5617                 __isl_take isl_multi_union_pw_aff *mupa,
5618                 __isl_take isl_multi_aff *ma);
5619         __isl_give isl_multi_union_pw_aff *
5620         isl_multi_union_pw_aff_apply_pw_multi_aff(
5621                 __isl_take isl_multi_union_pw_aff *mupa,
5622                 __isl_take isl_pw_multi_aff *pma);
5624 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
5625 over the shared domain of the elements of the input.  The dimension is
5626 required to be greater than zero.
5627 The C<isl_multi_union_pw_aff> argument of
5628 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
5629 but only if the range of the C<isl_multi_aff> argument
5630 is also zero-dimensional.
5631 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
5633         #include <isl/polynomial.h>
5634         __isl_give isl_pw_qpolynomial_fold *
5635         isl_set_apply_pw_qpolynomial_fold(
5636                 __isl_take isl_set *set,
5637                 __isl_take isl_pw_qpolynomial_fold *pwf,
5638                 int *tight);
5639         __isl_give isl_pw_qpolynomial_fold *
5640         isl_map_apply_pw_qpolynomial_fold(
5641                 __isl_take isl_map *map,
5642                 __isl_take isl_pw_qpolynomial_fold *pwf,
5643                 int *tight);
5644         __isl_give isl_union_pw_qpolynomial_fold *
5645         isl_union_set_apply_union_pw_qpolynomial_fold(
5646                 __isl_take isl_union_set *uset,
5647                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5648                 int *tight);
5649         __isl_give isl_union_pw_qpolynomial_fold *
5650         isl_union_map_apply_union_pw_qpolynomial_fold(
5651                 __isl_take isl_union_map *umap,
5652                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5653                 int *tight);
5655 The functions taking a map
5656 compose the given map with the given piecewise quasipolynomial reduction.
5657 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
5658 over all elements in the intersection of the range of the map
5659 and the domain of the piecewise quasipolynomial reduction
5660 as a function of an element in the domain of the map.
5661 The functions taking a set compute a bound over all elements in the
5662 intersection of the set and the domain of the
5663 piecewise quasipolynomial reduction.
5665 =item * Preimage
5667         #include <isl/set.h>
5668         __isl_give isl_basic_set *
5669         isl_basic_set_preimage_multi_aff(
5670                 __isl_take isl_basic_set *bset,
5671                 __isl_take isl_multi_aff *ma);
5672         __isl_give isl_set *isl_set_preimage_multi_aff(
5673                 __isl_take isl_set *set,
5674                 __isl_take isl_multi_aff *ma);
5675         __isl_give isl_set *isl_set_preimage_pw_multi_aff(
5676                 __isl_take isl_set *set,
5677                 __isl_take isl_pw_multi_aff *pma);
5678         __isl_give isl_set *isl_set_preimage_multi_pw_aff(
5679                 __isl_take isl_set *set,
5680                 __isl_take isl_multi_pw_aff *mpa);
5682         #include <isl/union_set.h>
5683         __isl_give isl_union_set *
5684         isl_union_set_preimage_multi_aff(
5685                 __isl_take isl_union_set *uset,
5686                 __isl_take isl_multi_aff *ma);
5687         __isl_give isl_union_set *
5688         isl_union_set_preimage_pw_multi_aff(
5689                 __isl_take isl_union_set *uset,
5690                 __isl_take isl_pw_multi_aff *pma);
5691         __isl_give isl_union_set *
5692         isl_union_set_preimage_union_pw_multi_aff(
5693                 __isl_take isl_union_set *uset,
5694                 __isl_take isl_union_pw_multi_aff *upma);
5696         #include <isl/map.h>
5697         __isl_give isl_basic_map *
5698         isl_basic_map_preimage_domain_multi_aff(
5699                 __isl_take isl_basic_map *bmap,
5700                 __isl_take isl_multi_aff *ma);
5701         __isl_give isl_map *isl_map_preimage_domain_multi_aff(
5702                 __isl_take isl_map *map,
5703                 __isl_take isl_multi_aff *ma);
5704         __isl_give isl_map *isl_map_preimage_range_multi_aff(
5705                 __isl_take isl_map *map,
5706                 __isl_take isl_multi_aff *ma);
5707         __isl_give isl_map *
5708         isl_map_preimage_domain_pw_multi_aff(
5709                 __isl_take isl_map *map,
5710                 __isl_take isl_pw_multi_aff *pma);
5711         __isl_give isl_map *
5712         isl_map_preimage_range_pw_multi_aff(
5713                 __isl_take isl_map *map,
5714                 __isl_take isl_pw_multi_aff *pma);
5715         __isl_give isl_map *
5716         isl_map_preimage_domain_multi_pw_aff(
5717                 __isl_take isl_map *map,
5718                 __isl_take isl_multi_pw_aff *mpa);
5719         __isl_give isl_basic_map *
5720         isl_basic_map_preimage_range_multi_aff(
5721                 __isl_take isl_basic_map *bmap,
5722                 __isl_take isl_multi_aff *ma);
5724         #include <isl/union_map.h>
5725         __isl_give isl_union_map *
5726         isl_union_map_preimage_domain_multi_aff(
5727                 __isl_take isl_union_map *umap,
5728                 __isl_take isl_multi_aff *ma);
5729         __isl_give isl_union_map *
5730         isl_union_map_preimage_range_multi_aff(
5731                 __isl_take isl_union_map *umap,
5732                 __isl_take isl_multi_aff *ma);
5733         __isl_give isl_union_map *
5734         isl_union_map_preimage_domain_pw_multi_aff(
5735                 __isl_take isl_union_map *umap,
5736                 __isl_take isl_pw_multi_aff *pma);
5737         __isl_give isl_union_map *
5738         isl_union_map_preimage_range_pw_multi_aff(
5739                 __isl_take isl_union_map *umap,
5740                 __isl_take isl_pw_multi_aff *pma);
5741         __isl_give isl_union_map *
5742         isl_union_map_preimage_domain_union_pw_multi_aff(
5743                 __isl_take isl_union_map *umap,
5744                 __isl_take isl_union_pw_multi_aff *upma);
5745         __isl_give isl_union_map *
5746         isl_union_map_preimage_range_union_pw_multi_aff(
5747                 __isl_take isl_union_map *umap,
5748                 __isl_take isl_union_pw_multi_aff *upma);
5750 These functions compute the preimage of the given set or map domain/range under
5751 the given function.  In other words, the expression is plugged
5752 into the set description or into the domain/range of the map.
5754 =item * Pullback
5756         #include <isl/aff.h>
5757         __isl_give isl_aff *isl_aff_pullback_aff(
5758                 __isl_take isl_aff *aff1,
5759                 __isl_take isl_aff *aff2);
5760         __isl_give isl_aff *isl_aff_pullback_multi_aff(
5761                 __isl_take isl_aff *aff,
5762                 __isl_take isl_multi_aff *ma);
5763         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
5764                 __isl_take isl_pw_aff *pa,
5765                 __isl_take isl_multi_aff *ma);
5766         __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
5767                 __isl_take isl_pw_aff *pa,
5768                 __isl_take isl_pw_multi_aff *pma);
5769         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
5770                 __isl_take isl_pw_aff *pa,
5771                 __isl_take isl_multi_pw_aff *mpa);
5772         __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
5773                 __isl_take isl_multi_aff *ma1,
5774                 __isl_take isl_multi_aff *ma2);
5775         __isl_give isl_pw_multi_aff *
5776         isl_pw_multi_aff_pullback_multi_aff(
5777                 __isl_take isl_pw_multi_aff *pma,
5778                 __isl_take isl_multi_aff *ma);
5779         __isl_give isl_multi_pw_aff *
5780         isl_multi_pw_aff_pullback_multi_aff(
5781                 __isl_take isl_multi_pw_aff *mpa,
5782                 __isl_take isl_multi_aff *ma);
5783         __isl_give isl_pw_multi_aff *
5784         isl_pw_multi_aff_pullback_pw_multi_aff(
5785                 __isl_take isl_pw_multi_aff *pma1,
5786                 __isl_take isl_pw_multi_aff *pma2);
5787         __isl_give isl_multi_pw_aff *
5788         isl_multi_pw_aff_pullback_pw_multi_aff(
5789                 __isl_take isl_multi_pw_aff *mpa,
5790                 __isl_take isl_pw_multi_aff *pma);
5791         __isl_give isl_multi_pw_aff *
5792         isl_multi_pw_aff_pullback_multi_pw_aff(
5793                 __isl_take isl_multi_pw_aff *mpa1,
5794                 __isl_take isl_multi_pw_aff *mpa2);
5795         __isl_give isl_union_pw_aff *
5796         isl_union_pw_aff_pullback_union_pw_multi_aff(
5797                 __isl_take isl_union_pw_aff *upa,
5798                 __isl_take isl_union_pw_multi_aff *upma);
5799         __isl_give isl_union_pw_multi_aff *
5800         isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
5801                 __isl_take isl_union_pw_multi_aff *upma1,
5802                 __isl_take isl_union_pw_multi_aff *upma2);
5803         __isl_give isl_multi_union_pw_aff *
5804         isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
5805                 __isl_take isl_multi_union_pw_aff *mupa,
5806                 __isl_take isl_union_pw_multi_aff *upma);
5808 These functions precompose the first expression by the second function.
5809 In other words, the second function is plugged
5810 into the first expression.
5812 =item * Locus
5814         #include <isl/aff.h>
5815         __isl_give isl_basic_set *isl_aff_le_basic_set(
5816                 __isl_take isl_aff *aff1,
5817                 __isl_take isl_aff *aff2);
5818         __isl_give isl_basic_set *isl_aff_ge_basic_set(
5819                 __isl_take isl_aff *aff1,
5820                 __isl_take isl_aff *aff2);
5821         __isl_give isl_set *isl_pw_aff_eq_set(
5822                 __isl_take isl_pw_aff *pwaff1,
5823                 __isl_take isl_pw_aff *pwaff2);
5824         __isl_give isl_set *isl_pw_aff_ne_set(
5825                 __isl_take isl_pw_aff *pwaff1,
5826                 __isl_take isl_pw_aff *pwaff2);
5827         __isl_give isl_set *isl_pw_aff_le_set(
5828                 __isl_take isl_pw_aff *pwaff1,
5829                 __isl_take isl_pw_aff *pwaff2);
5830         __isl_give isl_set *isl_pw_aff_lt_set(
5831                 __isl_take isl_pw_aff *pwaff1,
5832                 __isl_take isl_pw_aff *pwaff2);
5833         __isl_give isl_set *isl_pw_aff_ge_set(
5834                 __isl_take isl_pw_aff *pwaff1,
5835                 __isl_take isl_pw_aff *pwaff2);
5836         __isl_give isl_set *isl_pw_aff_gt_set(
5837                 __isl_take isl_pw_aff *pwaff1,
5838                 __isl_take isl_pw_aff *pwaff2);
5840         __isl_give isl_set *isl_multi_aff_lex_le_set(
5841                 __isl_take isl_multi_aff *ma1,
5842                 __isl_take isl_multi_aff *ma2);
5843         __isl_give isl_set *isl_multi_aff_lex_ge_set(
5844                 __isl_take isl_multi_aff *ma1,
5845                 __isl_take isl_multi_aff *ma2);
5847         __isl_give isl_set *isl_pw_aff_list_eq_set(
5848                 __isl_take isl_pw_aff_list *list1,
5849                 __isl_take isl_pw_aff_list *list2);
5850         __isl_give isl_set *isl_pw_aff_list_ne_set(
5851                 __isl_take isl_pw_aff_list *list1,
5852                 __isl_take isl_pw_aff_list *list2);
5853         __isl_give isl_set *isl_pw_aff_list_le_set(
5854                 __isl_take isl_pw_aff_list *list1,
5855                 __isl_take isl_pw_aff_list *list2);
5856         __isl_give isl_set *isl_pw_aff_list_lt_set(
5857                 __isl_take isl_pw_aff_list *list1,
5858                 __isl_take isl_pw_aff_list *list2);
5859         __isl_give isl_set *isl_pw_aff_list_ge_set(
5860                 __isl_take isl_pw_aff_list *list1,
5861                 __isl_take isl_pw_aff_list *list2);
5862         __isl_give isl_set *isl_pw_aff_list_gt_set(
5863                 __isl_take isl_pw_aff_list *list1,
5864                 __isl_take isl_pw_aff_list *list2);
5866 The function C<isl_aff_ge_basic_set> returns a basic set
5867 containing those elements in the shared space
5868 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
5869 The function C<isl_pw_aff_ge_set> returns a set
5870 containing those elements in the shared domain
5871 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
5872 greater than or equal to C<pwaff2>.
5873 The function C<isl_multi_aff_lex_le_set> returns a set
5874 containing those elements in the shared domain space
5875 where C<ma1> is lexicographically smaller than or
5876 equal to C<ma2>.
5877 The functions operating on C<isl_pw_aff_list> apply the corresponding
5878 C<isl_pw_aff> function to each pair of elements in the two lists.
5880         #include <isl/aff.h>
5881         __isl_give isl_map *isl_pw_aff_eq_map(
5882                 __isl_take isl_pw_aff *pa1,
5883                 __isl_take isl_pw_aff *pa2);
5884         __isl_give isl_map *isl_pw_aff_lt_map(
5885                 __isl_take isl_pw_aff *pa1,
5886                 __isl_take isl_pw_aff *pa2);
5887         __isl_give isl_map *isl_pw_aff_gt_map(
5888                 __isl_take isl_pw_aff *pa1,
5889                 __isl_take isl_pw_aff *pa2);
5891         __isl_give isl_map *isl_multi_pw_aff_eq_map(
5892                 __isl_take isl_multi_pw_aff *mpa1,
5893                 __isl_take isl_multi_pw_aff *mpa2);
5895 These functions return a map between domain elements of the arguments
5896 where the function values satisfy the given relation.
5898 =item * Cartesian Product
5900         #include <isl/space.h>
5901         __isl_give isl_space *isl_space_product(
5902                 __isl_take isl_space *space1,
5903                 __isl_take isl_space *space2);
5904         __isl_give isl_space *isl_space_domain_product(
5905                 __isl_take isl_space *space1,
5906                 __isl_take isl_space *space2);
5907         __isl_give isl_space *isl_space_range_product(
5908                 __isl_take isl_space *space1,
5909                 __isl_take isl_space *space2);
5911 The functions
5912 C<isl_space_product>, C<isl_space_domain_product>
5913 and C<isl_space_range_product> take pairs or relation spaces and
5914 produce a single relations space, where either the domain, the range
5915 or both domain and range are wrapped spaces of relations between
5916 the domains and/or ranges of the input spaces.
5917 If the product is only constructed over the domain or the range
5918 then the ranges or the domains of the inputs should be the same.
5919 The function C<isl_space_product> also accepts a pair of set spaces,
5920 in which case it returns a wrapped space of a relation between the
5921 two input spaces.
5923         #include <isl/set.h>
5924         __isl_give isl_set *isl_set_product(
5925                 __isl_take isl_set *set1,
5926                 __isl_take isl_set *set2);
5928         #include <isl/map.h>
5929         __isl_give isl_basic_map *isl_basic_map_domain_product(
5930                 __isl_take isl_basic_map *bmap1,
5931                 __isl_take isl_basic_map *bmap2);
5932         __isl_give isl_basic_map *isl_basic_map_range_product(
5933                 __isl_take isl_basic_map *bmap1,
5934                 __isl_take isl_basic_map *bmap2);
5935         __isl_give isl_basic_map *isl_basic_map_product(
5936                 __isl_take isl_basic_map *bmap1,
5937                 __isl_take isl_basic_map *bmap2);
5938         __isl_give isl_map *isl_map_domain_product(
5939                 __isl_take isl_map *map1,
5940                 __isl_take isl_map *map2);
5941         __isl_give isl_map *isl_map_range_product(
5942                 __isl_take isl_map *map1,
5943                 __isl_take isl_map *map2);
5944         __isl_give isl_map *isl_map_product(
5945                 __isl_take isl_map *map1,
5946                 __isl_take isl_map *map2);
5948         #include <isl/union_set.h>
5949         __isl_give isl_union_set *isl_union_set_product(
5950                 __isl_take isl_union_set *uset1,
5951                 __isl_take isl_union_set *uset2);
5953         #include <isl/union_map.h>
5954         __isl_give isl_union_map *isl_union_map_domain_product(
5955                 __isl_take isl_union_map *umap1,
5956                 __isl_take isl_union_map *umap2);
5957         __isl_give isl_union_map *isl_union_map_range_product(
5958                 __isl_take isl_union_map *umap1,
5959                 __isl_take isl_union_map *umap2);
5960         __isl_give isl_union_map *isl_union_map_product(
5961                 __isl_take isl_union_map *umap1,
5962                 __isl_take isl_union_map *umap2);
5964         #include <isl/val.h>
5965         __isl_give isl_multi_val *isl_multi_val_range_product(
5966                 __isl_take isl_multi_val *mv1,
5967                 __isl_take isl_multi_val *mv2);
5968         __isl_give isl_multi_val *isl_multi_val_product(
5969                 __isl_take isl_multi_val *mv1,
5970                 __isl_take isl_multi_val *mv2);
5972         #include <isl/aff.h>
5973         __isl_give isl_multi_aff *isl_multi_aff_range_product(
5974                 __isl_take isl_multi_aff *ma1,
5975                 __isl_take isl_multi_aff *ma2);
5976         __isl_give isl_multi_aff *isl_multi_aff_product(
5977                 __isl_take isl_multi_aff *ma1,
5978                 __isl_take isl_multi_aff *ma2);
5979         __isl_give isl_multi_pw_aff *
5980         isl_multi_pw_aff_range_product(
5981                 __isl_take isl_multi_pw_aff *mpa1,
5982                 __isl_take isl_multi_pw_aff *mpa2);
5983         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
5984                 __isl_take isl_multi_pw_aff *mpa1,
5985                 __isl_take isl_multi_pw_aff *mpa2);
5986         __isl_give isl_pw_multi_aff *
5987         isl_pw_multi_aff_range_product(
5988                 __isl_take isl_pw_multi_aff *pma1,
5989                 __isl_take isl_pw_multi_aff *pma2);
5990         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
5991                 __isl_take isl_pw_multi_aff *pma1,
5992                 __isl_take isl_pw_multi_aff *pma2);
5993         __isl_give isl_multi_union_pw_aff *
5994         isl_multi_union_pw_aff_range_product(
5995                 __isl_take isl_multi_union_pw_aff *mupa1,
5996                 __isl_take isl_multi_union_pw_aff *mupa2);
5998 The above functions compute the cross product of the given
5999 sets, relations or functions.  The domains and ranges of the results
6000 are wrapped maps between domains and ranges of the inputs.
6001 To obtain a ``flat'' product, use the following functions
6002 instead.
6004         #include <isl/set.h>
6005         __isl_give isl_basic_set *isl_basic_set_flat_product(
6006                 __isl_take isl_basic_set *bset1,
6007                 __isl_take isl_basic_set *bset2);
6008         __isl_give isl_set *isl_set_flat_product(
6009                 __isl_take isl_set *set1,
6010                 __isl_take isl_set *set2);
6012         #include <isl/map.h>
6013         __isl_give isl_basic_map *isl_basic_map_flat_range_product(
6014                 __isl_take isl_basic_map *bmap1,
6015                 __isl_take isl_basic_map *bmap2);
6016         __isl_give isl_map *isl_map_flat_domain_product(
6017                 __isl_take isl_map *map1,
6018                 __isl_take isl_map *map2);
6019         __isl_give isl_map *isl_map_flat_range_product(
6020                 __isl_take isl_map *map1,
6021                 __isl_take isl_map *map2);
6022         __isl_give isl_basic_map *isl_basic_map_flat_product(
6023                 __isl_take isl_basic_map *bmap1,
6024                 __isl_take isl_basic_map *bmap2);
6025         __isl_give isl_map *isl_map_flat_product(
6026                 __isl_take isl_map *map1,
6027                 __isl_take isl_map *map2);
6029         #include <isl/union_map.h>
6030         __isl_give isl_union_map *
6031         isl_union_map_flat_domain_product(
6032                 __isl_take isl_union_map *umap1,
6033                 __isl_take isl_union_map *umap2);
6034         __isl_give isl_union_map *
6035         isl_union_map_flat_range_product(
6036                 __isl_take isl_union_map *umap1,
6037                 __isl_take isl_union_map *umap2);
6039         #include <isl/val.h>
6040         __isl_give isl_multi_val *isl_multi_val_flat_range_product(
6041                 __isl_take isl_multi_val *mv1,
6042                 __isl_take isl_multi_aff *mv2);
6044         #include <isl/aff.h>
6045         __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
6046                 __isl_take isl_multi_aff *ma1,
6047                 __isl_take isl_multi_aff *ma2);
6048         __isl_give isl_pw_multi_aff *
6049         isl_pw_multi_aff_flat_range_product(
6050                 __isl_take isl_pw_multi_aff *pma1,
6051                 __isl_take isl_pw_multi_aff *pma2);
6052         __isl_give isl_multi_pw_aff *
6053         isl_multi_pw_aff_flat_range_product(
6054                 __isl_take isl_multi_pw_aff *mpa1,
6055                 __isl_take isl_multi_pw_aff *mpa2);
6056         __isl_give isl_union_pw_multi_aff *
6057         isl_union_pw_multi_aff_flat_range_product(
6058                 __isl_take isl_union_pw_multi_aff *upma1,
6059                 __isl_take isl_union_pw_multi_aff *upma2);
6060         __isl_give isl_multi_union_pw_aff *
6061         isl_multi_union_pw_aff_flat_range_product(
6062                 __isl_take isl_multi_union_pw_aff *mupa1,
6063                 __isl_take isl_multi_union_pw_aff *mupa2);
6065         #include <isl/space.h>
6066         __isl_give isl_space *isl_space_factor_domain(
6067                 __isl_take isl_space *space);
6068         __isl_give isl_space *isl_space_factor_range(
6069                 __isl_take isl_space *space);
6070         __isl_give isl_space *isl_space_domain_factor_domain(
6071                 __isl_take isl_space *space);
6072         __isl_give isl_space *isl_space_domain_factor_range(
6073                 __isl_take isl_space *space);
6074         __isl_give isl_space *isl_space_range_factor_domain(
6075                 __isl_take isl_space *space);
6076         __isl_give isl_space *isl_space_range_factor_range(
6077                 __isl_take isl_space *space);
6079 The functions C<isl_space_range_factor_domain> and
6080 C<isl_space_range_factor_range> extract the two arguments from
6081 the result of a call to C<isl_space_range_product>.
6083 The arguments of a call to C<isl_map_range_product> can be extracted
6084 from the result using the following functions.
6086         #include <isl/map.h>
6087         __isl_give isl_map *isl_map_factor_domain(
6088                 __isl_take isl_map *map);
6089         __isl_give isl_map *isl_map_factor_range(
6090                 __isl_take isl_map *map);
6091         __isl_give isl_map *isl_map_domain_factor_domain(
6092                 __isl_take isl_map *map);
6093         __isl_give isl_map *isl_map_domain_factor_range(
6094                 __isl_take isl_map *map);
6095         __isl_give isl_map *isl_map_range_factor_domain(
6096                 __isl_take isl_map *map);
6097         __isl_give isl_map *isl_map_range_factor_range(
6098                 __isl_take isl_map *map);
6100         #include <isl/union_map.h>
6101         __isl_give isl_union_map *isl_union_map_factor_domain(
6102                 __isl_take isl_union_map *umap);
6103         __isl_give isl_union_map *isl_union_map_factor_range(
6104                 __isl_take isl_union_map *umap);
6105         __isl_give isl_union_map *
6106         isl_union_map_domain_factor_domain(
6107                 __isl_take isl_union_map *umap);
6108         __isl_give isl_union_map *
6109         isl_union_map_domain_factor_range(
6110                 __isl_take isl_union_map *umap);
6111         __isl_give isl_union_map *
6112         isl_union_map_range_factor_range(
6113                 __isl_take isl_union_map *umap);
6115         #include <isl/val.h>
6116         __isl_give isl_multi_val *
6117         isl_multi_val_range_factor_domain(
6118                 __isl_take isl_multi_val *mv);
6119         __isl_give isl_multi_val *
6120         isl_multi_val_range_factor_range(
6121                 __isl_take isl_multi_val *mv);
6123         #include <isl/aff.h>
6124         __isl_give isl_multi_aff *
6125         isl_multi_aff_range_factor_domain(
6126                 __isl_take isl_multi_aff *ma);
6127         __isl_give isl_multi_aff *
6128         isl_multi_aff_range_factor_range(
6129                 __isl_take isl_multi_aff *ma);
6130         __isl_give isl_multi_pw_aff *
6131         isl_multi_pw_aff_range_factor_domain(
6132                 __isl_take isl_multi_pw_aff *mpa);
6133         __isl_give isl_multi_pw_aff *
6134         isl_multi_pw_aff_range_factor_range(
6135                 __isl_take isl_multi_pw_aff *mpa);
6136         __isl_give isl_multi_union_pw_aff *
6137         isl_multi_union_pw_aff_range_factor_domain(
6138                 __isl_take isl_multi_union_pw_aff *mupa);
6139         __isl_give isl_multi_union_pw_aff *
6140         isl_multi_union_pw_aff_range_factor_range(
6141                 __isl_take isl_multi_union_pw_aff *mupa);
6143 The splice functions are a generalization of the flat product functions,
6144 where the second argument may be inserted at any position inside
6145 the first argument rather than being placed at the end.
6147         #include <isl/val.h>
6148         __isl_give isl_multi_val *isl_multi_val_range_splice(
6149                 __isl_take isl_multi_val *mv1, unsigned pos,
6150                 __isl_take isl_multi_val *mv2);
6152         #include <isl/aff.h>
6153         __isl_give isl_multi_aff *isl_multi_aff_range_splice(
6154                 __isl_take isl_multi_aff *ma1, unsigned pos,
6155                 __isl_take isl_multi_aff *ma2);
6156         __isl_give isl_multi_aff *isl_multi_aff_splice(
6157                 __isl_take isl_multi_aff *ma1,
6158                 unsigned in_pos, unsigned out_pos,
6159                 __isl_take isl_multi_aff *ma2);
6160         __isl_give isl_multi_pw_aff *
6161         isl_multi_pw_aff_range_splice(
6162                 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
6163                 __isl_take isl_multi_pw_aff *mpa2);
6164         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
6165                 __isl_take isl_multi_pw_aff *mpa1,
6166                 unsigned in_pos, unsigned out_pos,
6167                 __isl_take isl_multi_pw_aff *mpa2);
6168         __isl_give isl_multi_union_pw_aff *
6169         isl_multi_union_pw_aff_range_splice(
6170                 __isl_take isl_multi_union_pw_aff *mupa1,
6171                 unsigned pos,
6172                 __isl_take isl_multi_union_pw_aff *mupa2);
6174 =item * Simplification
6176 When applied to a set or relation,
6177 the gist operation returns a set or relation that has the
6178 same intersection with the context as the input set or relation.
6179 Any implicit equality in the intersection is made explicit in the result,
6180 while all inequalities that are redundant with respect to the intersection
6181 are removed.
6182 In case of union sets and relations, the gist operation is performed
6183 per space.
6185 When applied to a function,
6186 the gist operation applies the set gist operation to each of
6187 the cells in the domain of the input piecewise expression.
6188 The context is also exploited
6189 to simplify the expression associated to each cell.
6191         #include <isl/set.h>
6192         __isl_give isl_basic_set *isl_basic_set_gist(
6193                 __isl_take isl_basic_set *bset,
6194                 __isl_take isl_basic_set *context);
6195         __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
6196                 __isl_take isl_set *context);
6197         __isl_give isl_set *isl_set_gist_params(
6198                 __isl_take isl_set *set,
6199                 __isl_take isl_set *context);
6201         #include <isl/map.h>
6202         __isl_give isl_basic_map *isl_basic_map_gist(
6203                 __isl_take isl_basic_map *bmap,
6204                 __isl_take isl_basic_map *context);
6205         __isl_give isl_basic_map *isl_basic_map_gist_domain(
6206                 __isl_take isl_basic_map *bmap,
6207                 __isl_take isl_basic_set *context);
6208         __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
6209                 __isl_take isl_map *context);
6210         __isl_give isl_map *isl_map_gist_params(
6211                 __isl_take isl_map *map,
6212                 __isl_take isl_set *context);
6213         __isl_give isl_map *isl_map_gist_domain(
6214                 __isl_take isl_map *map,
6215                 __isl_take isl_set *context);
6216         __isl_give isl_map *isl_map_gist_range(
6217                 __isl_take isl_map *map,
6218                 __isl_take isl_set *context);
6220         #include <isl/union_set.h>
6221         __isl_give isl_union_set *isl_union_set_gist(
6222                 __isl_take isl_union_set *uset,
6223                 __isl_take isl_union_set *context);
6224         __isl_give isl_union_set *isl_union_set_gist_params(
6225                 __isl_take isl_union_set *uset,
6226                 __isl_take isl_set *set);
6228         #include <isl/union_map.h>
6229         __isl_give isl_union_map *isl_union_map_gist(
6230                 __isl_take isl_union_map *umap,
6231                 __isl_take isl_union_map *context);
6232         __isl_give isl_union_map *isl_union_map_gist_params(
6233                 __isl_take isl_union_map *umap,
6234                 __isl_take isl_set *set);
6235         __isl_give isl_union_map *isl_union_map_gist_domain(
6236                 __isl_take isl_union_map *umap,
6237                 __isl_take isl_union_set *uset);
6238         __isl_give isl_union_map *isl_union_map_gist_range(
6239                 __isl_take isl_union_map *umap,
6240                 __isl_take isl_union_set *uset);
6242         #include <isl/aff.h>
6243         __isl_give isl_aff *isl_aff_gist_params(
6244                 __isl_take isl_aff *aff,
6245                 __isl_take isl_set *context);
6246         __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
6247                 __isl_take isl_set *context);
6248         __isl_give isl_multi_aff *isl_multi_aff_gist_params(
6249                 __isl_take isl_multi_aff *maff,
6250                 __isl_take isl_set *context);
6251         __isl_give isl_multi_aff *isl_multi_aff_gist(
6252                 __isl_take isl_multi_aff *maff,
6253                 __isl_take isl_set *context);
6254         __isl_give isl_pw_aff *isl_pw_aff_gist_params(
6255                 __isl_take isl_pw_aff *pwaff,
6256                 __isl_take isl_set *context);
6257         __isl_give isl_pw_aff *isl_pw_aff_gist(
6258                 __isl_take isl_pw_aff *pwaff,
6259                 __isl_take isl_set *context);
6260         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
6261                 __isl_take isl_pw_multi_aff *pma,
6262                 __isl_take isl_set *set);
6263         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
6264                 __isl_take isl_pw_multi_aff *pma,
6265                 __isl_take isl_set *set);
6266         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
6267                 __isl_take isl_multi_pw_aff *mpa,
6268                 __isl_take isl_set *set);
6269         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
6270                 __isl_take isl_multi_pw_aff *mpa,
6271                 __isl_take isl_set *set);
6272         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
6273                 __isl_take isl_union_pw_aff *upa,
6274                 __isl_take isl_union_set *context);
6275         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
6276                 __isl_take isl_union_pw_aff *upa,
6277                 __isl_take isl_set *context);
6278         __isl_give isl_union_pw_multi_aff *
6279         isl_union_pw_multi_aff_gist_params(
6280                 __isl_take isl_union_pw_multi_aff *upma,
6281                 __isl_take isl_set *context);
6282         __isl_give isl_union_pw_multi_aff *
6283         isl_union_pw_multi_aff_gist(
6284                 __isl_take isl_union_pw_multi_aff *upma,
6285                 __isl_take isl_union_set *context);
6286         __isl_give isl_multi_union_pw_aff *
6287         isl_multi_union_pw_aff_gist_params(
6288                 __isl_take isl_multi_union_pw_aff *aff,
6289                 __isl_take isl_set *context);
6290         __isl_give isl_multi_union_pw_aff *
6291         isl_multi_union_pw_aff_gist(
6292                 __isl_take isl_multi_union_pw_aff *aff,
6293                 __isl_take isl_union_set *context);
6295         #include <isl/polynomial.h>
6296         __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
6297                 __isl_take isl_qpolynomial *qp,
6298                 __isl_take isl_set *context);
6299         __isl_give isl_qpolynomial *isl_qpolynomial_gist(
6300                 __isl_take isl_qpolynomial *qp,
6301                 __isl_take isl_set *context);
6302         __isl_give isl_qpolynomial_fold *
6303         isl_qpolynomial_fold_gist_params(
6304                 __isl_take isl_qpolynomial_fold *fold,
6305                 __isl_take isl_set *context);
6306         __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
6307                 __isl_take isl_qpolynomial_fold *fold,
6308                 __isl_take isl_set *context);
6309         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
6310                 __isl_take isl_pw_qpolynomial *pwqp,
6311                 __isl_take isl_set *context);
6312         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
6313                 __isl_take isl_pw_qpolynomial *pwqp,
6314                 __isl_take isl_set *context);
6315         __isl_give isl_pw_qpolynomial_fold *
6316         isl_pw_qpolynomial_fold_gist(
6317                 __isl_take isl_pw_qpolynomial_fold *pwf,
6318                 __isl_take isl_set *context);
6319         __isl_give isl_pw_qpolynomial_fold *
6320         isl_pw_qpolynomial_fold_gist_params(
6321                 __isl_take isl_pw_qpolynomial_fold *pwf,
6322                 __isl_take isl_set *context);
6323         __isl_give isl_union_pw_qpolynomial *
6324         isl_union_pw_qpolynomial_gist_params(
6325                 __isl_take isl_union_pw_qpolynomial *upwqp,
6326                 __isl_take isl_set *context);
6327         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
6328                 __isl_take isl_union_pw_qpolynomial *upwqp,
6329                 __isl_take isl_union_set *context);
6330         __isl_give isl_union_pw_qpolynomial_fold *
6331         isl_union_pw_qpolynomial_fold_gist(
6332                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6333                 __isl_take isl_union_set *context);
6334         __isl_give isl_union_pw_qpolynomial_fold *
6335         isl_union_pw_qpolynomial_fold_gist_params(
6336                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6337                 __isl_take isl_set *context);
6339 =item * Binary Arithmethic Operations
6341         #include <isl/val.h>
6342         __isl_give isl_multi_val *isl_multi_val_sub(
6343                 __isl_take isl_multi_val *mv1,
6344                 __isl_take isl_multi_val *mv2);
6346         #include <isl/aff.h>
6347         __isl_give isl_aff *isl_aff_add(
6348                 __isl_take isl_aff *aff1,
6349                 __isl_take isl_aff *aff2);
6350         __isl_give isl_multi_aff *isl_multi_aff_add(
6351                 __isl_take isl_multi_aff *maff1,
6352                 __isl_take isl_multi_aff *maff2);
6353         __isl_give isl_pw_aff *isl_pw_aff_add(
6354                 __isl_take isl_pw_aff *pwaff1,
6355                 __isl_take isl_pw_aff *pwaff2);
6356         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
6357                 __isl_take isl_pw_multi_aff *pma1,
6358                 __isl_take isl_pw_multi_aff *pma2);
6359         __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
6360                 __isl_take isl_union_pw_aff *upa1,
6361                 __isl_take isl_union_pw_aff *upa2);
6362         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
6363                 __isl_take isl_union_pw_multi_aff *upma1,
6364                 __isl_take isl_union_pw_multi_aff *upma2);
6365         __isl_give isl_pw_aff *isl_pw_aff_min(
6366                 __isl_take isl_pw_aff *pwaff1,
6367                 __isl_take isl_pw_aff *pwaff2);
6368         __isl_give isl_pw_aff *isl_pw_aff_max(
6369                 __isl_take isl_pw_aff *pwaff1,
6370                 __isl_take isl_pw_aff *pwaff2);
6371         __isl_give isl_aff *isl_aff_sub(
6372                 __isl_take isl_aff *aff1,
6373                 __isl_take isl_aff *aff2);
6374         __isl_give isl_multi_aff *isl_multi_aff_sub(
6375                 __isl_take isl_multi_aff *ma1,
6376                 __isl_take isl_multi_aff *ma2);
6377         __isl_give isl_pw_aff *isl_pw_aff_sub(
6378                 __isl_take isl_pw_aff *pwaff1,
6379                 __isl_take isl_pw_aff *pwaff2);
6380         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
6381                 __isl_take isl_multi_pw_aff *mpa1,
6382                 __isl_take isl_multi_pw_aff *mpa2);
6383         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
6384                 __isl_take isl_pw_multi_aff *pma1,
6385                 __isl_take isl_pw_multi_aff *pma2);
6386         __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
6387                 __isl_take isl_union_pw_aff *upa1,
6388                 __isl_take isl_union_pw_aff *upa2);
6389         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
6390                 __isl_take isl_union_pw_multi_aff *upma1,
6391                 __isl_take isl_union_pw_multi_aff *upma2);
6392         __isl_give isl_multi_union_pw_aff *
6393         isl_multi_union_pw_aff_sub(
6394                 __isl_take isl_multi_union_pw_aff *mupa1,
6395                 __isl_take isl_multi_union_pw_aff *mupa2);
6397 C<isl_aff_sub> subtracts the second argument from the first.
6399         #include <isl/polynomial.h>
6400         __isl_give isl_qpolynomial *isl_qpolynomial_add(
6401                 __isl_take isl_qpolynomial *qp1,
6402                 __isl_take isl_qpolynomial *qp2);
6403         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
6404                 __isl_take isl_pw_qpolynomial *pwqp1,
6405                 __isl_take isl_pw_qpolynomial *pwqp2);
6406         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
6407                 __isl_take isl_pw_qpolynomial *pwqp1,
6408                 __isl_take isl_pw_qpolynomial *pwqp2);
6409         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
6410                 __isl_take isl_pw_qpolynomial_fold *pwf1,
6411                 __isl_take isl_pw_qpolynomial_fold *pwf2);
6412         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
6413                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6414                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6415         __isl_give isl_qpolynomial *isl_qpolynomial_sub(
6416                 __isl_take isl_qpolynomial *qp1,
6417                 __isl_take isl_qpolynomial *qp2);
6418         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
6419                 __isl_take isl_pw_qpolynomial *pwqp1,
6420                 __isl_take isl_pw_qpolynomial *pwqp2);
6421         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
6422                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6423                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6424         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
6425                 __isl_take isl_pw_qpolynomial_fold *pwf1,
6426                 __isl_take isl_pw_qpolynomial_fold *pwf2);
6427         __isl_give isl_union_pw_qpolynomial_fold *
6428         isl_union_pw_qpolynomial_fold_fold(
6429                 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
6430                 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
6432         #include <isl/aff.h>
6433         __isl_give isl_pw_aff *isl_pw_aff_union_add(
6434                 __isl_take isl_pw_aff *pwaff1,
6435                 __isl_take isl_pw_aff *pwaff2);
6436         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
6437                 __isl_take isl_pw_multi_aff *pma1,
6438                 __isl_take isl_pw_multi_aff *pma2);
6439         __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
6440                 __isl_take isl_union_pw_aff *upa1,
6441                 __isl_take isl_union_pw_aff *upa2);
6442         __isl_give isl_union_pw_multi_aff *
6443         isl_union_pw_multi_aff_union_add(
6444                 __isl_take isl_union_pw_multi_aff *upma1,
6445                 __isl_take isl_union_pw_multi_aff *upma2);
6446         __isl_give isl_multi_union_pw_aff *
6447         isl_multi_union_pw_aff_union_add(
6448                 __isl_take isl_multi_union_pw_aff *mupa1,
6449                 __isl_take isl_multi_union_pw_aff *mupa2);
6450         __isl_give isl_pw_aff *isl_pw_aff_union_min(
6451                 __isl_take isl_pw_aff *pwaff1,
6452                 __isl_take isl_pw_aff *pwaff2);
6453         __isl_give isl_pw_aff *isl_pw_aff_union_max(
6454                 __isl_take isl_pw_aff *pwaff1,
6455                 __isl_take isl_pw_aff *pwaff2);
6457 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
6458 expression with a domain that is the union of those of C<pwaff1> and
6459 C<pwaff2> and such that on each cell, the quasi-affine expression is
6460 the maximum of those of C<pwaff1> and C<pwaff2>.  If only one of
6461 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
6462 associated expression is the defined one.
6463 This in contrast to the C<isl_pw_aff_max> function, which is
6464 only defined on the shared definition domain of the arguments.
6466         #include <isl/val.h>
6467         __isl_give isl_multi_val *isl_multi_val_add_val(
6468                 __isl_take isl_multi_val *mv,
6469                 __isl_take isl_val *v);
6470         __isl_give isl_multi_val *isl_multi_val_mod_val(
6471                 __isl_take isl_multi_val *mv,
6472                 __isl_take isl_val *v);
6473         __isl_give isl_multi_val *isl_multi_val_scale_val(
6474                 __isl_take isl_multi_val *mv,
6475                 __isl_take isl_val *v);
6476         __isl_give isl_multi_val *isl_multi_val_scale_down_val(
6477                 __isl_take isl_multi_val *mv,
6478                 __isl_take isl_val *v);
6480         #include <isl/aff.h>
6481         __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
6482                 __isl_take isl_val *mod);
6483         __isl_give isl_pw_aff *isl_pw_aff_mod_val(
6484                 __isl_take isl_pw_aff *pa,
6485                 __isl_take isl_val *mod);
6486         __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
6487                 __isl_take isl_union_pw_aff *upa,
6488                 __isl_take isl_val *f);
6489         __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
6490                 __isl_take isl_val *v);
6491         __isl_give isl_multi_aff *isl_multi_aff_scale_val(
6492                 __isl_take isl_multi_aff *ma,
6493                 __isl_take isl_val *v);
6494         __isl_give isl_pw_aff *isl_pw_aff_scale_val(
6495                 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
6496         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
6497                 __isl_take isl_multi_pw_aff *mpa,
6498                 __isl_take isl_val *v);
6499         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
6500                 __isl_take isl_pw_multi_aff *pma,
6501                 __isl_take isl_val *v);
6502         __isl_give isl_union_pw_multi_aff *
6503         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
6504                 __isl_take isl_union_pw_aff *upa,
6505                 __isl_take isl_val *f);
6506         isl_union_pw_multi_aff_scale_val(
6507                 __isl_take isl_union_pw_multi_aff *upma,
6508                 __isl_take isl_val *val);
6509         __isl_give isl_multi_union_pw_aff *
6510         isl_multi_union_pw_aff_scale_val(
6511                 __isl_take isl_multi_union_pw_aff *mupa,
6512                 __isl_take isl_val *v);
6513         __isl_give isl_aff *isl_aff_scale_down_ui(
6514                 __isl_take isl_aff *aff, unsigned f);
6515         __isl_give isl_aff *isl_aff_scale_down_val(
6516                 __isl_take isl_aff *aff, __isl_take isl_val *v);
6517         __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
6518                 __isl_take isl_multi_aff *ma,
6519                 __isl_take isl_val *v);
6520         __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
6521                 __isl_take isl_pw_aff *pa,
6522                 __isl_take isl_val *f);
6523         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
6524                 __isl_take isl_multi_pw_aff *mpa,
6525                 __isl_take isl_val *v);
6526         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
6527                 __isl_take isl_pw_multi_aff *pma,
6528                 __isl_take isl_val *v);
6529         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
6530                 __isl_take isl_union_pw_aff *upa,
6531                 __isl_take isl_val *v);
6532         __isl_give isl_union_pw_multi_aff *
6533         isl_union_pw_multi_aff_scale_down_val(
6534                 __isl_take isl_union_pw_multi_aff *upma,
6535                 __isl_take isl_val *val);
6536         __isl_give isl_multi_union_pw_aff *
6537         isl_multi_union_pw_aff_scale_down_val(
6538                 __isl_take isl_multi_union_pw_aff *mupa,
6539                 __isl_take isl_val *v);
6541         #include <isl/polynomial.h>
6542         __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
6543                 __isl_take isl_qpolynomial *qp,
6544                 __isl_take isl_val *v);
6545         __isl_give isl_qpolynomial_fold *
6546         isl_qpolynomial_fold_scale_val(
6547                 __isl_take isl_qpolynomial_fold *fold,
6548                 __isl_take isl_val *v);
6549         __isl_give isl_pw_qpolynomial *
6550         isl_pw_qpolynomial_scale_val(
6551                 __isl_take isl_pw_qpolynomial *pwqp,
6552                 __isl_take isl_val *v);
6553         __isl_give isl_pw_qpolynomial_fold *
6554         isl_pw_qpolynomial_fold_scale_val(
6555                 __isl_take isl_pw_qpolynomial_fold *pwf,
6556                 __isl_take isl_val *v);
6557         __isl_give isl_union_pw_qpolynomial *
6558         isl_union_pw_qpolynomial_scale_val(
6559                 __isl_take isl_union_pw_qpolynomial *upwqp,
6560                 __isl_take isl_val *v);
6561         __isl_give isl_union_pw_qpolynomial_fold *
6562         isl_union_pw_qpolynomial_fold_scale_val(
6563                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6564                 __isl_take isl_val *v);
6565         __isl_give isl_qpolynomial *
6566         isl_qpolynomial_scale_down_val(
6567                 __isl_take isl_qpolynomial *qp,
6568                 __isl_take isl_val *v);
6569         __isl_give isl_qpolynomial_fold *
6570         isl_qpolynomial_fold_scale_down_val(
6571                 __isl_take isl_qpolynomial_fold *fold,
6572                 __isl_take isl_val *v);
6573         __isl_give isl_pw_qpolynomial *
6574         isl_pw_qpolynomial_scale_down_val(
6575                 __isl_take isl_pw_qpolynomial *pwqp,
6576                 __isl_take isl_val *v);
6577         __isl_give isl_pw_qpolynomial_fold *
6578         isl_pw_qpolynomial_fold_scale_down_val(
6579                 __isl_take isl_pw_qpolynomial_fold *pwf,
6580                 __isl_take isl_val *v);
6581         __isl_give isl_union_pw_qpolynomial *
6582         isl_union_pw_qpolynomial_scale_down_val(
6583                 __isl_take isl_union_pw_qpolynomial *upwqp,
6584                 __isl_take isl_val *v);
6585         __isl_give isl_union_pw_qpolynomial_fold *
6586         isl_union_pw_qpolynomial_fold_scale_down_val(
6587                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6588                 __isl_take isl_val *v);
6590         #include <isl/val.h>
6591         __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
6592                 __isl_take isl_multi_val *mv1,
6593                 __isl_take isl_multi_val *mv2);
6594         __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
6595                 __isl_take isl_multi_val *mv1,
6596                 __isl_take isl_multi_val *mv2);
6597         __isl_give isl_multi_val *
6598         isl_multi_val_scale_down_multi_val(
6599                 __isl_take isl_multi_val *mv1,
6600                 __isl_take isl_multi_val *mv2);
6602         #include <isl/aff.h>
6603         __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
6604                 __isl_take isl_multi_aff *ma,
6605                 __isl_take isl_multi_val *mv);
6606         __isl_give isl_multi_union_pw_aff *
6607         isl_multi_union_pw_aff_mod_multi_val(
6608                 __isl_take isl_multi_union_pw_aff *upma,
6609                 __isl_take isl_multi_val *mv);
6610         __isl_give isl_multi_pw_aff *
6611         isl_multi_pw_aff_mod_multi_val(
6612                 __isl_take isl_multi_pw_aff *mpa,
6613                 __isl_take isl_multi_val *mv);
6614         __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
6615                 __isl_take isl_multi_aff *ma,
6616                 __isl_take isl_multi_val *mv);
6617         __isl_give isl_pw_multi_aff *
6618         isl_pw_multi_aff_scale_multi_val(
6619                 __isl_take isl_pw_multi_aff *pma,
6620                 __isl_take isl_multi_val *mv);
6621         __isl_give isl_multi_pw_aff *
6622         isl_multi_pw_aff_scale_multi_val(
6623                 __isl_take isl_multi_pw_aff *mpa,
6624                 __isl_take isl_multi_val *mv);
6625         __isl_give isl_multi_union_pw_aff *
6626         isl_multi_union_pw_aff_scale_multi_val(
6627                 __isl_take isl_multi_union_pw_aff *mupa,
6628                 __isl_take isl_multi_val *mv);
6629         __isl_give isl_union_pw_multi_aff *
6630         isl_union_pw_multi_aff_scale_multi_val(
6631                 __isl_take isl_union_pw_multi_aff *upma,
6632                 __isl_take isl_multi_val *mv);
6633         __isl_give isl_multi_aff *
6634         isl_multi_aff_scale_down_multi_val(
6635                 __isl_take isl_multi_aff *ma,
6636                 __isl_take isl_multi_val *mv);
6637         __isl_give isl_multi_pw_aff *
6638         isl_multi_pw_aff_scale_down_multi_val(
6639                 __isl_take isl_multi_pw_aff *mpa,
6640                 __isl_take isl_multi_val *mv);
6641         __isl_give isl_multi_union_pw_aff *
6642         isl_multi_union_pw_aff_scale_down_multi_val(
6643                 __isl_take isl_multi_union_pw_aff *mupa,
6644                 __isl_take isl_multi_val *mv);
6646 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
6647 by the corresponding elements of C<mv>.
6649         #include <isl/aff.h>
6650         __isl_give isl_aff *isl_aff_mul(
6651                 __isl_take isl_aff *aff1,
6652                 __isl_take isl_aff *aff2);
6653         __isl_give isl_aff *isl_aff_div(
6654                 __isl_take isl_aff *aff1,
6655                 __isl_take isl_aff *aff2);
6656         __isl_give isl_pw_aff *isl_pw_aff_mul(
6657                 __isl_take isl_pw_aff *pwaff1,
6658                 __isl_take isl_pw_aff *pwaff2);
6659         __isl_give isl_pw_aff *isl_pw_aff_div(
6660                 __isl_take isl_pw_aff *pa1,
6661                 __isl_take isl_pw_aff *pa2);
6662         __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
6663                 __isl_take isl_pw_aff *pa1,
6664                 __isl_take isl_pw_aff *pa2);
6665         __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
6666                 __isl_take isl_pw_aff *pa1,
6667                 __isl_take isl_pw_aff *pa2);
6669 When multiplying two affine expressions, at least one of the two needs
6670 to be a constant.  Similarly, when dividing an affine expression by another,
6671 the second expression needs to be a constant.
6672 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
6673 rounding towards zero.  C<isl_pw_aff_tdiv_r> computes the corresponding
6674 remainder.
6676         #include <isl/polynomial.h>
6677         __isl_give isl_qpolynomial *isl_qpolynomial_mul(
6678                 __isl_take isl_qpolynomial *qp1,
6679                 __isl_take isl_qpolynomial *qp2);
6680         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
6681                 __isl_take isl_pw_qpolynomial *pwqp1,
6682                 __isl_take isl_pw_qpolynomial *pwqp2);
6683         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
6684                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6685                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6687 =back
6689 =head3 Lexicographic Optimization
6691 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
6692 the following functions
6693 compute a set that contains the lexicographic minimum or maximum
6694 of the elements in C<set> (or C<bset>) for those values of the parameters
6695 that satisfy C<dom>.
6696 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6697 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
6698 has no elements.
6699 In other words, the union of the parameter values
6700 for which the result is non-empty and of C<*empty>
6701 is equal to C<dom>.
6703         #include <isl/set.h>
6704         __isl_give isl_set *isl_basic_set_partial_lexmin(
6705                 __isl_take isl_basic_set *bset,
6706                 __isl_take isl_basic_set *dom,
6707                 __isl_give isl_set **empty);
6708         __isl_give isl_set *isl_basic_set_partial_lexmax(
6709                 __isl_take isl_basic_set *bset,
6710                 __isl_take isl_basic_set *dom,
6711                 __isl_give isl_set **empty);
6712         __isl_give isl_set *isl_set_partial_lexmin(
6713                 __isl_take isl_set *set, __isl_take isl_set *dom,
6714                 __isl_give isl_set **empty);
6715         __isl_give isl_set *isl_set_partial_lexmax(
6716                 __isl_take isl_set *set, __isl_take isl_set *dom,
6717                 __isl_give isl_set **empty);
6719 Given a (basic) set C<set> (or C<bset>), the following functions simply
6720 return a set containing the lexicographic minimum or maximum
6721 of the elements in C<set> (or C<bset>).
6722 In case of union sets, the optimum is computed per space.
6724         #include <isl/set.h>
6725         __isl_give isl_set *isl_basic_set_lexmin(
6726                 __isl_take isl_basic_set *bset);
6727         __isl_give isl_set *isl_basic_set_lexmax(
6728                 __isl_take isl_basic_set *bset);
6729         __isl_give isl_set *isl_set_lexmin(
6730                 __isl_take isl_set *set);
6731         __isl_give isl_set *isl_set_lexmax(
6732                 __isl_take isl_set *set);
6733         __isl_give isl_union_set *isl_union_set_lexmin(
6734                 __isl_take isl_union_set *uset);
6735         __isl_give isl_union_set *isl_union_set_lexmax(
6736                 __isl_take isl_union_set *uset);
6738 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
6739 the following functions
6740 compute a relation that maps each element of C<dom>
6741 to the single lexicographic minimum or maximum
6742 of the elements that are associated to that same
6743 element in C<map> (or C<bmap>).
6744 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6745 that contains the elements in C<dom> that do not map
6746 to any elements in C<map> (or C<bmap>).
6747 In other words, the union of the domain of the result and of C<*empty>
6748 is equal to C<dom>.
6750         #include <isl/map.h>
6751         __isl_give isl_map *isl_basic_map_partial_lexmax(
6752                 __isl_take isl_basic_map *bmap,
6753                 __isl_take isl_basic_set *dom,
6754                 __isl_give isl_set **empty);
6755         __isl_give isl_map *isl_basic_map_partial_lexmin(
6756                 __isl_take isl_basic_map *bmap,
6757                 __isl_take isl_basic_set *dom,
6758                 __isl_give isl_set **empty);
6759         __isl_give isl_map *isl_map_partial_lexmax(
6760                 __isl_take isl_map *map, __isl_take isl_set *dom,
6761                 __isl_give isl_set **empty);
6762         __isl_give isl_map *isl_map_partial_lexmin(
6763                 __isl_take isl_map *map, __isl_take isl_set *dom,
6764                 __isl_give isl_set **empty);
6766 Given a (basic) map C<map> (or C<bmap>), the following functions simply
6767 return a map mapping each element in the domain of
6768 C<map> (or C<bmap>) to the lexicographic minimum or maximum
6769 of all elements associated to that element.
6770 In case of union relations, the optimum is computed per space.
6772         #include <isl/map.h>
6773         __isl_give isl_map *isl_basic_map_lexmin(
6774                 __isl_take isl_basic_map *bmap);
6775         __isl_give isl_map *isl_basic_map_lexmax(
6776                 __isl_take isl_basic_map *bmap);
6777         __isl_give isl_map *isl_map_lexmin(
6778                 __isl_take isl_map *map);
6779         __isl_give isl_map *isl_map_lexmax(
6780                 __isl_take isl_map *map);
6781         __isl_give isl_union_map *isl_union_map_lexmin(
6782                 __isl_take isl_union_map *umap);
6783         __isl_give isl_union_map *isl_union_map_lexmax(
6784                 __isl_take isl_union_map *umap);
6786 The following functions return their result in the form of
6787 a piecewise multi-affine expression,
6788 but are otherwise equivalent to the corresponding functions
6789 returning a basic set or relation.
6791         #include <isl/set.h>
6792         __isl_give isl_pw_multi_aff *
6793         isl_basic_set_partial_lexmin_pw_multi_aff(
6794                 __isl_take isl_basic_set *bset,
6795                 __isl_take isl_basic_set *dom,
6796                 __isl_give isl_set **empty);
6797         __isl_give isl_pw_multi_aff *
6798         isl_basic_set_partial_lexmax_pw_multi_aff(
6799                 __isl_take isl_basic_set *bset,
6800                 __isl_take isl_basic_set *dom,
6801                 __isl_give isl_set **empty);
6802         __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
6803                 __isl_take isl_set *set);
6804         __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
6805                 __isl_take isl_set *set);
6807         #include <isl/map.h>
6808         __isl_give isl_pw_multi_aff *
6809         isl_basic_map_lexmin_pw_multi_aff(
6810                 __isl_take isl_basic_map *bmap);
6811         __isl_give isl_pw_multi_aff *
6812         isl_basic_map_partial_lexmin_pw_multi_aff(
6813                 __isl_take isl_basic_map *bmap,
6814                 __isl_take isl_basic_set *dom,
6815                 __isl_give isl_set **empty);
6816         __isl_give isl_pw_multi_aff *
6817         isl_basic_map_partial_lexmax_pw_multi_aff(
6818                 __isl_take isl_basic_map *bmap,
6819                 __isl_take isl_basic_set *dom,
6820                 __isl_give isl_set **empty);
6821         __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
6822                 __isl_take isl_map *map);
6823         __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
6824                 __isl_take isl_map *map);
6826 The following functions return the lexicographic minimum or maximum
6827 on the shared domain of the inputs and the single defined function
6828 on those parts of the domain where only a single function is defined.
6830         #include <isl/aff.h>
6831         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
6832                 __isl_take isl_pw_multi_aff *pma1,
6833                 __isl_take isl_pw_multi_aff *pma2);
6834         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
6835                 __isl_take isl_pw_multi_aff *pma1,
6836                 __isl_take isl_pw_multi_aff *pma2);
6838 =head2 Ternary Operations
6840         #include <isl/aff.h>
6841         __isl_give isl_pw_aff *isl_pw_aff_cond(
6842                 __isl_take isl_pw_aff *cond,
6843                 __isl_take isl_pw_aff *pwaff_true,
6844                 __isl_take isl_pw_aff *pwaff_false);
6846 The function C<isl_pw_aff_cond> performs a conditional operator
6847 and returns an expression that is equal to C<pwaff_true>
6848 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
6849 where C<cond> is zero.
6851 =head2 Lists
6853 Lists are defined over several element types, including
6854 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_union_pw_aff>,
6855 C<isl_union_pw_multi_aff>, C<isl_constraint>,
6856 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
6857 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
6858 Here we take lists of C<isl_set>s as an example.
6859 Lists can be created, copied, modified and freed using the following functions.
6861         #include <isl/set.h>
6862         __isl_give isl_set_list *isl_set_list_from_set(
6863                 __isl_take isl_set *el);
6864         __isl_give isl_set_list *isl_set_list_alloc(
6865                 isl_ctx *ctx, int n);
6866         __isl_give isl_set_list *isl_set_list_copy(
6867                 __isl_keep isl_set_list *list);
6868         __isl_give isl_set_list *isl_set_list_insert(
6869                 __isl_take isl_set_list *list, unsigned pos,
6870                 __isl_take isl_set *el);
6871         __isl_give isl_set_list *isl_set_list_add(
6872                 __isl_take isl_set_list *list,
6873                 __isl_take isl_set *el);
6874         __isl_give isl_set_list *isl_set_list_drop(
6875                 __isl_take isl_set_list *list,
6876                 unsigned first, unsigned n);
6877         __isl_give isl_set_list *isl_set_list_set_set(
6878                 __isl_take isl_set_list *list, int index,
6879                 __isl_take isl_set *set);
6880         __isl_give isl_set_list *isl_set_list_concat(
6881                 __isl_take isl_set_list *list1,
6882                 __isl_take isl_set_list *list2);
6883         __isl_give isl_set_list *isl_set_list_sort(
6884                 __isl_take isl_set_list *list,
6885                 int (*cmp)(__isl_keep isl_set *a,
6886                         __isl_keep isl_set *b, void *user),
6887                 void *user);
6888         __isl_null isl_set_list *isl_set_list_free(
6889                 __isl_take isl_set_list *list);
6891 C<isl_set_list_alloc> creates an empty list with an initial capacity
6892 for C<n> elements.  C<isl_set_list_insert> and C<isl_set_list_add>
6893 add elements to a list, increasing its capacity as needed.
6894 C<isl_set_list_from_set> creates a list with a single element.
6896 Lists can be inspected using the following functions.
6898         #include <isl/set.h>
6899         int isl_set_list_n_set(__isl_keep isl_set_list *list);
6900         __isl_give isl_set *isl_set_list_get_set(
6901                 __isl_keep isl_set_list *list, int index);
6902         int isl_set_list_foreach(__isl_keep isl_set_list *list,
6903                 int (*fn)(__isl_take isl_set *el, void *user),
6904                 void *user);
6905         int isl_set_list_foreach_scc(__isl_keep isl_set_list *list,
6906                 int (*follows)(__isl_keep isl_set *a,
6907                         __isl_keep isl_set *b, void *user),
6908                 void *follows_user
6909                 int (*fn)(__isl_take isl_set *el, void *user),
6910                 void *fn_user);
6912 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
6913 strongly connected components of the graph with as vertices the elements
6914 of C<list> and a directed edge from vertex C<b> to vertex C<a>
6915 iff C<follows(a, b)> returns C<1>.  The callbacks C<follows> and C<fn>
6916 should return C<-1> on error.
6918 Lists can be printed using
6920         #include <isl/set.h>
6921         __isl_give isl_printer *isl_printer_print_set_list(
6922                 __isl_take isl_printer *p,
6923                 __isl_keep isl_set_list *list);
6925 =head2 Associative arrays
6927 Associative arrays map isl objects of a specific type to isl objects
6928 of some (other) specific type.  They are defined for several pairs
6929 of types, including (C<isl_map>, C<isl_basic_set>),
6930 (C<isl_id>, C<isl_ast_expr>) and.
6931 (C<isl_id>, C<isl_pw_aff>).
6932 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
6933 as an example.
6935 Associative arrays can be created, copied and freed using
6936 the following functions.
6938         #include <isl/id_to_ast_expr.h>
6939         __isl_give id_to_ast_expr *isl_id_to_ast_expr_alloc(
6940                 isl_ctx *ctx, int min_size);
6941         __isl_give id_to_ast_expr *isl_id_to_ast_expr_copy(
6942                 __isl_keep id_to_ast_expr *id2expr);
6943         __isl_null id_to_ast_expr *isl_id_to_ast_expr_free(
6944                 __isl_take id_to_ast_expr *id2expr);
6946 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
6947 to specify the expected size of the associative array.
6948 The associative array will be grown automatically as needed.
6950 Associative arrays can be inspected using the following functions.
6952         #include <isl/id_to_ast_expr.h>
6953         int isl_id_to_ast_expr_has(
6954                 __isl_keep id_to_ast_expr *id2expr,
6955                 __isl_keep isl_id *key);
6956         __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
6957                 __isl_keep id_to_ast_expr *id2expr,
6958                 __isl_take isl_id *key);
6959         int isl_id_to_ast_expr_foreach(
6960                 __isl_keep id_to_ast_expr *id2expr,
6961                 int (*fn)(__isl_take isl_id *key,
6962                         __isl_take isl_ast_expr *val, void *user),
6963                 void *user);
6965 They can be modified using the following function.
6967         #include <isl/id_to_ast_expr.h>
6968         __isl_give id_to_ast_expr *isl_id_to_ast_expr_set(
6969                 __isl_take id_to_ast_expr *id2expr,
6970                 __isl_take isl_id *key,
6971                 __isl_take isl_ast_expr *val);
6972         __isl_give id_to_ast_expr *isl_id_to_ast_expr_drop(
6973                 __isl_take id_to_ast_expr *id2expr,
6974                 __isl_take isl_id *key);
6976 Associative arrays can be printed using the following function.
6978         #include <isl/id_to_ast_expr.h>
6979         __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
6980                 __isl_take isl_printer *p,
6981                 __isl_keep id_to_ast_expr *id2expr);
6983 =head2 Vectors
6985 Vectors can be created, copied and freed using the following functions.
6987         #include <isl/vec.h>
6988         __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
6989                 unsigned size);
6990         __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
6991         __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
6993 Note that the elements of a newly created vector may have arbitrary values.
6994 The elements can be changed and inspected using the following functions.
6996         int isl_vec_size(__isl_keep isl_vec *vec);
6997         __isl_give isl_val *isl_vec_get_element_val(
6998                 __isl_keep isl_vec *vec, int pos);
6999         __isl_give isl_vec *isl_vec_set_element_si(
7000                 __isl_take isl_vec *vec, int pos, int v);
7001         __isl_give isl_vec *isl_vec_set_element_val(
7002                 __isl_take isl_vec *vec, int pos,
7003                 __isl_take isl_val *v);
7004         __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
7005                 int v);
7006         __isl_give isl_vec *isl_vec_set_val(
7007                 __isl_take isl_vec *vec, __isl_take isl_val *v);
7008         int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
7009                 __isl_keep isl_vec *vec2, int pos);
7011 C<isl_vec_get_element> will return a negative value if anything went wrong.
7012 In that case, the value of C<*v> is undefined.
7014 The following function can be used to concatenate two vectors.
7016         __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
7017                 __isl_take isl_vec *vec2);
7019 =head2 Matrices
7021 Matrices can be created, copied and freed using the following functions.
7023         #include <isl/mat.h>
7024         __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
7025                 unsigned n_row, unsigned n_col);
7026         __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
7027         __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
7029 Note that the elements of a newly created matrix may have arbitrary values.
7030 The elements can be changed and inspected using the following functions.
7032         int isl_mat_rows(__isl_keep isl_mat *mat);
7033         int isl_mat_cols(__isl_keep isl_mat *mat);
7034         __isl_give isl_val *isl_mat_get_element_val(
7035                 __isl_keep isl_mat *mat, int row, int col);
7036         __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
7037                 int row, int col, int v);
7038         __isl_give isl_mat *isl_mat_set_element_val(
7039                 __isl_take isl_mat *mat, int row, int col,
7040                 __isl_take isl_val *v);
7042 C<isl_mat_get_element> will return a negative value if anything went wrong.
7043 In that case, the value of C<*v> is undefined.
7045 The following function can be used to compute the (right) inverse
7046 of a matrix, i.e., a matrix such that the product of the original
7047 and the inverse (in that order) is a multiple of the identity matrix.
7048 The input matrix is assumed to be of full row-rank.
7050         __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
7052 The following function can be used to compute the (right) kernel
7053 (or null space) of a matrix, i.e., a matrix such that the product of
7054 the original and the kernel (in that order) is the zero matrix.
7056         __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
7058 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
7060 The following functions determine
7061 an upper or lower bound on a quasipolynomial over its domain.
7063         __isl_give isl_pw_qpolynomial_fold *
7064         isl_pw_qpolynomial_bound(
7065                 __isl_take isl_pw_qpolynomial *pwqp,
7066                 enum isl_fold type, int *tight);
7068         __isl_give isl_union_pw_qpolynomial_fold *
7069         isl_union_pw_qpolynomial_bound(
7070                 __isl_take isl_union_pw_qpolynomial *upwqp,
7071                 enum isl_fold type, int *tight);
7073 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
7074 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
7075 is the returned bound is known be tight, i.e., for each value
7076 of the parameters there is at least
7077 one element in the domain that reaches the bound.
7078 If the domain of C<pwqp> is not wrapping, then the bound is computed
7079 over all elements in that domain and the result has a purely parametric
7080 domain.  If the domain of C<pwqp> is wrapping, then the bound is
7081 computed over the range of the wrapped relation.  The domain of the
7082 wrapped relation becomes the domain of the result.
7084 =head2 Parametric Vertex Enumeration
7086 The parametric vertex enumeration described in this section
7087 is mainly intended to be used internally and by the C<barvinok>
7088 library.
7090         #include <isl/vertices.h>
7091         __isl_give isl_vertices *isl_basic_set_compute_vertices(
7092                 __isl_keep isl_basic_set *bset);
7094 The function C<isl_basic_set_compute_vertices> performs the
7095 actual computation of the parametric vertices and the chamber
7096 decomposition and store the result in an C<isl_vertices> object.
7097 This information can be queried by either iterating over all
7098 the vertices or iterating over all the chambers or cells
7099 and then iterating over all vertices that are active on the chamber.
7101         int isl_vertices_foreach_vertex(
7102                 __isl_keep isl_vertices *vertices,
7103                 int (*fn)(__isl_take isl_vertex *vertex, void *user),
7104                 void *user);
7106         int isl_vertices_foreach_cell(
7107                 __isl_keep isl_vertices *vertices,
7108                 int (*fn)(__isl_take isl_cell *cell, void *user),
7109                 void *user);
7110         int isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
7111                 int (*fn)(__isl_take isl_vertex *vertex, void *user),
7112                 void *user);
7114 Other operations that can be performed on an C<isl_vertices> object are
7115 the following.
7117         int isl_vertices_get_n_vertices(
7118                 __isl_keep isl_vertices *vertices);
7119         void isl_vertices_free(__isl_take isl_vertices *vertices);
7121 Vertices can be inspected and destroyed using the following functions.
7123         int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
7124         __isl_give isl_basic_set *isl_vertex_get_domain(
7125                 __isl_keep isl_vertex *vertex);
7126         __isl_give isl_multi_aff *isl_vertex_get_expr(
7127                 __isl_keep isl_vertex *vertex);
7128         void isl_vertex_free(__isl_take isl_vertex *vertex);
7130 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
7131 describing the vertex in terms of the parameters,
7132 while C<isl_vertex_get_domain> returns the activity domain
7133 of the vertex.
7135 Chambers can be inspected and destroyed using the following functions.
7137         __isl_give isl_basic_set *isl_cell_get_domain(
7138                 __isl_keep isl_cell *cell);
7139         void isl_cell_free(__isl_take isl_cell *cell);
7141 =head1 Polyhedral Compilation Library
7143 This section collects functionality in C<isl> that has been specifically
7144 designed for use during polyhedral compilation.
7146 =head2 Dependence Analysis
7148 C<isl> contains specialized functionality for performing
7149 array dataflow analysis.  That is, given a I<sink> access relation
7150 and a collection of possible I<source> access relations,
7151 C<isl> can compute relations that describe
7152 for each iteration of the sink access, which iteration
7153 of which of the source access relations was the last
7154 to access the same data element before the given iteration
7155 of the sink access.
7156 The resulting dependence relations map source iterations
7157 to the corresponding sink iterations.
7158 To compute standard flow dependences, the sink should be
7159 a read, while the sources should be writes.
7160 If any of the source accesses are marked as being I<may>
7161 accesses, then there will be a dependence from the last
7162 I<must> access B<and> from any I<may> access that follows
7163 this last I<must> access.
7164 In particular, if I<all> sources are I<may> accesses,
7165 then memory based dependence analysis is performed.
7166 If, on the other hand, all sources are I<must> accesses,
7167 then value based dependence analysis is performed.
7169         #include <isl/flow.h>
7171         typedef int (*isl_access_level_before)(void *first, void *second);
7173         __isl_give isl_access_info *isl_access_info_alloc(
7174                 __isl_take isl_map *sink,
7175                 void *sink_user, isl_access_level_before fn,
7176                 int max_source);
7177         __isl_give isl_access_info *isl_access_info_add_source(
7178                 __isl_take isl_access_info *acc,
7179                 __isl_take isl_map *source, int must,
7180                 void *source_user);
7181         __isl_null isl_access_info *isl_access_info_free(
7182                 __isl_take isl_access_info *acc);
7184         __isl_give isl_flow *isl_access_info_compute_flow(
7185                 __isl_take isl_access_info *acc);
7187         int isl_flow_foreach(__isl_keep isl_flow *deps,
7188                 int (*fn)(__isl_take isl_map *dep, int must,
7189                           void *dep_user, void *user),
7190                 void *user);
7191         __isl_give isl_map *isl_flow_get_no_source(
7192                 __isl_keep isl_flow *deps, int must);
7193         void isl_flow_free(__isl_take isl_flow *deps);
7195 The function C<isl_access_info_compute_flow> performs the actual
7196 dependence analysis.  The other functions are used to construct
7197 the input for this function or to read off the output.
7199 The input is collected in an C<isl_access_info>, which can
7200 be created through a call to C<isl_access_info_alloc>.
7201 The arguments to this functions are the sink access relation
7202 C<sink>, a token C<sink_user> used to identify the sink
7203 access to the user, a callback function for specifying the
7204 relative order of source and sink accesses, and the number
7205 of source access relations that will be added.
7206 The callback function has type C<int (*)(void *first, void *second)>.
7207 The function is called with two user supplied tokens identifying
7208 either a source or the sink and it should return the shared nesting
7209 level and the relative order of the two accesses.
7210 In particular, let I<n> be the number of loops shared by
7211 the two accesses.  If C<first> precedes C<second> textually,
7212 then the function should return I<2 * n + 1>; otherwise,
7213 it should return I<2 * n>.
7214 The sources can be added to the C<isl_access_info> by performing
7215 (at most) C<max_source> calls to C<isl_access_info_add_source>.
7216 C<must> indicates whether the source is a I<must> access
7217 or a I<may> access.  Note that a multi-valued access relation
7218 should only be marked I<must> if every iteration in the domain
7219 of the relation accesses I<all> elements in its image.
7220 The C<source_user> token is again used to identify
7221 the source access.  The range of the source access relation
7222 C<source> should have the same dimension as the range
7223 of the sink access relation.
7224 The C<isl_access_info_free> function should usually not be
7225 called explicitly, because it is called implicitly by
7226 C<isl_access_info_compute_flow>.
7228 The result of the dependence analysis is collected in an
7229 C<isl_flow>.  There may be elements of
7230 the sink access for which no preceding source access could be
7231 found or for which all preceding sources are I<may> accesses.
7232 The relations containing these elements can be obtained through
7233 calls to C<isl_flow_get_no_source>, the first with C<must> set
7234 and the second with C<must> unset.
7235 In the case of standard flow dependence analysis,
7236 with the sink a read and the sources I<must> writes,
7237 the first relation corresponds to the reads from uninitialized
7238 array elements and the second relation is empty.
7239 The actual flow dependences can be extracted using
7240 C<isl_flow_foreach>.  This function will call the user-specified
7241 callback function C<fn> for each B<non-empty> dependence between
7242 a source and the sink.  The callback function is called
7243 with four arguments, the actual flow dependence relation
7244 mapping source iterations to sink iterations, a boolean that
7245 indicates whether it is a I<must> or I<may> dependence, a token
7246 identifying the source and an additional C<void *> with value
7247 equal to the third argument of the C<isl_flow_foreach> call.
7248 A dependence is marked I<must> if it originates from a I<must>
7249 source and if it is not followed by any I<may> sources.
7251 After finishing with an C<isl_flow>, the user should call
7252 C<isl_flow_free> to free all associated memory.
7254 A higher-level interface to dependence analysis is provided
7255 by the following function.
7257         #include <isl/flow.h>
7259         int isl_union_map_compute_flow(__isl_take isl_union_map *sink,
7260                 __isl_take isl_union_map *must_source,
7261                 __isl_take isl_union_map *may_source,
7262                 __isl_take isl_union_map *schedule,
7263                 __isl_give isl_union_map **must_dep,
7264                 __isl_give isl_union_map **may_dep,
7265                 __isl_give isl_union_map **must_no_source,
7266                 __isl_give isl_union_map **may_no_source);
7268 The arrays are identified by the tuple names of the ranges
7269 of the accesses.  The iteration domains by the tuple names
7270 of the domains of the accesses and of the schedule.
7271 The relative order of the iteration domains is given by the
7272 schedule.  The relations returned through C<must_no_source>
7273 and C<may_no_source> are subsets of C<sink>.
7274 Any of C<must_dep>, C<may_dep>, C<must_no_source>
7275 or C<may_no_source> may be C<NULL>, but a C<NULL> value for
7276 any of the other arguments is treated as an error.
7278 =head3 Interaction with Dependence Analysis
7280 During the dependence analysis, we frequently need to perform
7281 the following operation.  Given a relation between sink iterations
7282 and potential source iterations from a particular source domain,
7283 what is the last potential source iteration corresponding to each
7284 sink iteration.  It can sometimes be convenient to adjust
7285 the set of potential source iterations before or after each such operation.
7286 The prototypical example is fuzzy array dataflow analysis,
7287 where we need to analyze if, based on data-dependent constraints,
7288 the sink iteration can ever be executed without one or more of
7289 the corresponding potential source iterations being executed.
7290 If so, we can introduce extra parameters and select an unknown
7291 but fixed source iteration from the potential source iterations.
7292 To be able to perform such manipulations, C<isl> provides the following
7293 function.
7295         #include <isl/flow.h>
7297         typedef __isl_give isl_restriction *(*isl_access_restrict)(
7298                 __isl_keep isl_map *source_map,
7299                 __isl_keep isl_set *sink, void *source_user,
7300                 void *user);
7301         __isl_give isl_access_info *isl_access_info_set_restrict(
7302                 __isl_take isl_access_info *acc,
7303                 isl_access_restrict fn, void *user);
7305 The function C<isl_access_info_set_restrict> should be called
7306 before calling C<isl_access_info_compute_flow> and registers a callback function
7307 that will be called any time C<isl> is about to compute the last
7308 potential source.  The first argument is the (reverse) proto-dependence,
7309 mapping sink iterations to potential source iterations.
7310 The second argument represents the sink iterations for which
7311 we want to compute the last source iteration.
7312 The third argument is the token corresponding to the source
7313 and the final argument is the token passed to C<isl_access_info_set_restrict>.
7314 The callback is expected to return a restriction on either the input or
7315 the output of the operation computing the last potential source.
7316 If the input needs to be restricted then restrictions are needed
7317 for both the source and the sink iterations.  The sink iterations
7318 and the potential source iterations will be intersected with these sets.
7319 If the output needs to be restricted then only a restriction on the source
7320 iterations is required.
7321 If any error occurs, the callback should return C<NULL>.
7322 An C<isl_restriction> object can be created, freed and inspected
7323 using the following functions.
7325         #include <isl/flow.h>
7327         __isl_give isl_restriction *isl_restriction_input(
7328                 __isl_take isl_set *source_restr,
7329                 __isl_take isl_set *sink_restr);
7330         __isl_give isl_restriction *isl_restriction_output(
7331                 __isl_take isl_set *source_restr);
7332         __isl_give isl_restriction *isl_restriction_none(
7333                 __isl_take isl_map *source_map);
7334         __isl_give isl_restriction *isl_restriction_empty(
7335                 __isl_take isl_map *source_map);
7336         __isl_null isl_restriction *isl_restriction_free(
7337                 __isl_take isl_restriction *restr);
7339 C<isl_restriction_none> and C<isl_restriction_empty> are special
7340 cases of C<isl_restriction_input>.  C<isl_restriction_none>
7341 is essentially equivalent to
7343         isl_restriction_input(isl_set_universe(
7344             isl_space_range(isl_map_get_space(source_map))),
7345                             isl_set_universe(
7346             isl_space_domain(isl_map_get_space(source_map))));
7348 whereas C<isl_restriction_empty> is essentially equivalent to
7350         isl_restriction_input(isl_set_empty(
7351             isl_space_range(isl_map_get_space(source_map))),
7352                             isl_set_universe(
7353             isl_space_domain(isl_map_get_space(source_map))));
7355 =head2 Scheduling
7357 B<The functionality described in this section is fairly new
7358 and may be subject to change.>
7360         #include <isl/schedule.h>
7361         __isl_give isl_schedule *
7362         isl_schedule_constraints_compute_schedule(
7363                 __isl_take isl_schedule_constraints *sc);
7364         __isl_null isl_schedule *isl_schedule_free(
7365                 __isl_take isl_schedule *sched);
7367 The function C<isl_schedule_constraints_compute_schedule> can be
7368 used to compute a schedule that satisfies the given schedule constraints.
7369 These schedule constraints include the iteration domain for which
7370 a schedule should be computed and dependences between pairs of
7371 iterations.  In particular, these dependences include
7372 I<validity> dependences and I<proximity> dependences.
7373 By default, the algorithm used to construct the schedule is similar
7374 to that of C<Pluto>.
7375 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
7376 be selected.
7377 The generated schedule respects all validity dependences.
7378 That is, all dependence distances over these dependences in the
7379 scheduled space are lexicographically positive.
7380 The default algorithm tries to ensure that the dependence distances
7381 over coincidence constraints are zero and to minimize the
7382 dependence distances over proximity dependences.
7383 Moreover, it tries to obtain sequences (bands) of schedule dimensions
7384 for groups of domains where the dependence distances over validity
7385 dependences have only non-negative values.
7386 When using Feautrier's algorithm, the coincidence and proximity constraints
7387 are only taken into account during the extension to a
7388 full-dimensional schedule.
7390 An C<isl_schedule_constraints> object can be constructed
7391 and manipulated using the following functions.
7393         #include <isl/schedule.h>
7394         __isl_give isl_schedule_constraints *
7395         isl_schedule_constraints_copy(
7396                 __isl_keep isl_schedule_constraints *sc);
7397         __isl_give isl_schedule_constraints *
7398         isl_schedule_constraints_on_domain(
7399                 __isl_take isl_union_set *domain);
7400         __isl_give isl_schedule_constraints *
7401         isl_schedule_constraints_set_validity(
7402                 __isl_take isl_schedule_constraints *sc,
7403                 __isl_take isl_union_map *validity);
7404         __isl_give isl_schedule_constraints *
7405         isl_schedule_constraints_set_coincidence(
7406                 __isl_take isl_schedule_constraints *sc,
7407                 __isl_take isl_union_map *coincidence);
7408         __isl_give isl_schedule_constraints *
7409         isl_schedule_constraints_set_proximity(
7410                 __isl_take isl_schedule_constraints *sc,
7411                 __isl_take isl_union_map *proximity);
7412         __isl_give isl_schedule_constraints *
7413         isl_schedule_constraints_set_conditional_validity(
7414                 __isl_take isl_schedule_constraints *sc,
7415                 __isl_take isl_union_map *condition,
7416                 __isl_take isl_union_map *validity);
7417         __isl_null isl_schedule_constraints *
7418         isl_schedule_constraints_free(
7419                 __isl_take isl_schedule_constraints *sc);
7421 The initial C<isl_schedule_constraints> object created by
7422 C<isl_schedule_constraints_on_domain> does not impose any constraints.
7423 That is, it has an empty set of dependences.
7424 The function C<isl_schedule_constraints_set_validity> replaces the
7425 validity dependences, mapping domain elements I<i> to domain
7426 elements that should be scheduled after I<i>.
7427 The function C<isl_schedule_constraints_set_coincidence> replaces the
7428 coincidence dependences, mapping domain elements I<i> to domain
7429 elements that should be scheduled together with I<I>, if possible.
7430 The function C<isl_schedule_constraints_set_proximity> replaces the
7431 proximity dependences, mapping domain elements I<i> to domain
7432 elements that should be scheduled either before I<I>
7433 or as early as possible after I<i>.
7435 The function C<isl_schedule_constraints_set_conditional_validity>
7436 replaces the conditional validity constraints.
7437 A conditional validity constraint is only imposed when any of the corresponding
7438 conditions is satisfied, i.e., when any of them is non-zero.
7439 That is, the scheduler ensures that within each band if the dependence
7440 distances over the condition constraints are not all zero
7441 then all corresponding conditional validity constraints are respected.
7442 A conditional validity constraint corresponds to a condition
7443 if the two are adjacent, i.e., if the domain of one relation intersect
7444 the range of the other relation.
7445 The typical use case of conditional validity constraints is
7446 to allow order constraints between live ranges to be violated
7447 as long as the live ranges themselves are local to the band.
7448 To allow more fine-grained control over which conditions correspond
7449 to which conditional validity constraints, the domains and ranges
7450 of these relations may include I<tags>.  That is, the domains and
7451 ranges of those relation may themselves be wrapped relations
7452 where the iteration domain appears in the domain of those wrapped relations
7453 and the range of the wrapped relations can be arbitrarily chosen
7454 by the user.  Conditions and conditional validity constraints are only
7455 considered adjacent to each other if the entire wrapped relation matches.
7456 In particular, a relation with a tag will never be considered adjacent
7457 to a relation without a tag.
7459 The following function computes a schedule directly from
7460 an iteration domain and validity and proximity dependences
7461 and is implemented in terms of the functions described above.
7462 The use of C<isl_union_set_compute_schedule> is discouraged.
7464         #include <isl/schedule.h>
7465         __isl_give isl_schedule *isl_union_set_compute_schedule(
7466                 __isl_take isl_union_set *domain,
7467                 __isl_take isl_union_map *validity,
7468                 __isl_take isl_union_map *proximity);
7470 A mapping from the domains to the scheduled space can be obtained
7471 from an C<isl_schedule> using the following function.
7473         __isl_give isl_union_map *isl_schedule_get_map(
7474                 __isl_keep isl_schedule *sched);
7476 A representation of the schedule can be printed using
7477          
7478         __isl_give isl_printer *isl_printer_print_schedule(
7479                 __isl_take isl_printer *p,
7480                 __isl_keep isl_schedule *schedule);
7482 A representation of the schedule as a forest of bands can be obtained
7483 using the following function.
7485         __isl_give isl_band_list *isl_schedule_get_band_forest(
7486                 __isl_keep isl_schedule *schedule);
7488 The individual bands can be visited in depth-first post-order
7489 using the following function.
7491         #include <isl/schedule.h>
7492         int isl_schedule_foreach_band(
7493                 __isl_keep isl_schedule *sched,
7494                 int (*fn)(__isl_keep isl_band *band, void *user),
7495                 void *user);
7497 The list can be manipulated as explained in L<"Lists">.
7498 The bands inside the list can be copied and freed using the following
7499 functions.
7501         #include <isl/band.h>
7502         __isl_give isl_band *isl_band_copy(
7503                 __isl_keep isl_band *band);
7504         __isl_null isl_band *isl_band_free(
7505                 __isl_take isl_band *band);
7507 Each band contains zero or more scheduling dimensions.
7508 These are referred to as the members of the band.
7509 The section of the schedule that corresponds to the band is
7510 referred to as the partial schedule of the band.
7511 For those nodes that participate in a band, the outer scheduling
7512 dimensions form the prefix schedule, while the inner scheduling
7513 dimensions form the suffix schedule.
7514 That is, if we take a cut of the band forest, then the union of
7515 the concatenations of the prefix, partial and suffix schedules of
7516 each band in the cut is equal to the entire schedule (modulo
7517 some possible padding at the end with zero scheduling dimensions).
7518 The properties of a band can be inspected using the following functions.
7520         #include <isl/band.h>
7521         int isl_band_has_children(__isl_keep isl_band *band);
7522         __isl_give isl_band_list *isl_band_get_children(
7523                 __isl_keep isl_band *band);
7525         __isl_give isl_union_map *isl_band_get_prefix_schedule(
7526                 __isl_keep isl_band *band);
7527         __isl_give isl_union_map *isl_band_get_partial_schedule(
7528                 __isl_keep isl_band *band);
7529         __isl_give isl_union_map *isl_band_get_suffix_schedule(
7530                 __isl_keep isl_band *band);
7532         int isl_band_n_member(__isl_keep isl_band *band);
7533         int isl_band_member_is_coincident(
7534                 __isl_keep isl_band *band, int pos);
7536         int isl_band_list_foreach_band(
7537                 __isl_keep isl_band_list *list,
7538                 int (*fn)(__isl_keep isl_band *band, void *user),
7539                 void *user);
7541 Note that a scheduling dimension is considered to be ``coincident''
7542 if it satisfies the coincidence constraints within its band.
7543 That is, if the dependence distances of the coincidence
7544 constraints are all zero in that direction (for fixed
7545 iterations of outer bands).
7546 Like C<isl_schedule_foreach_band>,
7547 the function C<isl_band_list_foreach_band> calls C<fn> on the bands
7548 in depth-first post-order.
7550 A band can be tiled using the following function.
7552         #include <isl/band.h>
7553         int isl_band_tile(__isl_keep isl_band *band,
7554                 __isl_take isl_vec *sizes);
7556         int isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
7557                 int val);
7558         int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
7559         int isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
7560                 int val);
7561         int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
7563 The C<isl_band_tile> function tiles the band using the given tile sizes
7564 inside its schedule.
7565 A new child band is created to represent the point loops and it is
7566 inserted between the modified band and its children.
7567 The C<tile_scale_tile_loops> option specifies whether the tile
7568 loops iterators should be scaled by the tile sizes.
7569 If the C<tile_shift_point_loops> option is set, then the point loops
7570 are shifted to start at zero.
7572 A band can be split into two nested bands using the following function.
7574         int isl_band_split(__isl_keep isl_band *band, int pos);
7576 The resulting outer band contains the first C<pos> dimensions of C<band>
7577 while the inner band contains the remaining dimensions.
7579 A representation of the band can be printed using
7581         #include <isl/band.h>
7582         __isl_give isl_printer *isl_printer_print_band(
7583                 __isl_take isl_printer *p,
7584                 __isl_keep isl_band *band);
7586 =head3 Options
7588         #include <isl/schedule.h>
7589         int isl_options_set_schedule_max_coefficient(
7590                 isl_ctx *ctx, int val);
7591         int isl_options_get_schedule_max_coefficient(
7592                 isl_ctx *ctx);
7593         int isl_options_set_schedule_max_constant_term(
7594                 isl_ctx *ctx, int val);
7595         int isl_options_get_schedule_max_constant_term(
7596                 isl_ctx *ctx);
7597         int isl_options_set_schedule_fuse(isl_ctx *ctx, int val);
7598         int isl_options_get_schedule_fuse(isl_ctx *ctx);
7599         int isl_options_set_schedule_maximize_band_depth(
7600                 isl_ctx *ctx, int val);
7601         int isl_options_get_schedule_maximize_band_depth(
7602                 isl_ctx *ctx);
7603         int isl_options_set_schedule_outer_coincidence(
7604                 isl_ctx *ctx, int val);
7605         int isl_options_get_schedule_outer_coincidence(
7606                 isl_ctx *ctx);
7607         int isl_options_set_schedule_split_scaled(
7608                 isl_ctx *ctx, int val);
7609         int isl_options_get_schedule_split_scaled(
7610                 isl_ctx *ctx);
7611         int isl_options_set_schedule_algorithm(
7612                 isl_ctx *ctx, int val);
7613         int isl_options_get_schedule_algorithm(
7614                 isl_ctx *ctx);
7615         int isl_options_set_schedule_separate_components(
7616                 isl_ctx *ctx, int val);
7617         int isl_options_get_schedule_separate_components(
7618                 isl_ctx *ctx);
7620 =over
7622 =item * schedule_max_coefficient
7624 This option enforces that the coefficients for variable and parameter
7625 dimensions in the calculated schedule are not larger than the specified value.
7626 This option can significantly increase the speed of the scheduling calculation
7627 and may also prevent fusing of unrelated dimensions. A value of -1 means that
7628 this option does not introduce bounds on the variable or parameter
7629 coefficients.
7631 =item * schedule_max_constant_term
7633 This option enforces that the constant coefficients in the calculated schedule
7634 are not larger than the maximal constant term. This option can significantly
7635 increase the speed of the scheduling calculation and may also prevent fusing of
7636 unrelated dimensions. A value of -1 means that this option does not introduce
7637 bounds on the constant coefficients.
7639 =item * schedule_fuse
7641 This option controls the level of fusion.
7642 If this option is set to C<ISL_SCHEDULE_FUSE_MIN>, then loops in the
7643 resulting schedule will be distributed as much as possible.
7644 If this option is set to C<ISL_SCHEDULE_FUSE_MAX>, then C<isl> will
7645 try to fuse loops in the resulting schedule.
7647 =item * schedule_maximize_band_depth
7649 If this option is set, we do not split bands at the point
7650 where we detect splitting is necessary. Instead, we
7651 backtrack and split bands as early as possible. This
7652 reduces the number of splits and maximizes the width of
7653 the bands. Wider bands give more possibilities for tiling.
7654 Note that if the C<schedule_fuse> option is set to C<ISL_SCHEDULE_FUSE_MIN>,
7655 then bands will be split as early as possible, even if there is no need.
7656 The C<schedule_maximize_band_depth> option therefore has no effect in this case.
7658 =item * schedule_outer_coincidence
7660 If this option is set, then we try to construct schedules
7661 where the outermost scheduling dimension in each band
7662 satisfies the coincidence constraints.
7664 =item * schedule_split_scaled
7666 If this option is set, then we try to construct schedules in which the
7667 constant term is split off from the linear part if the linear parts of
7668 the scheduling rows for all nodes in the graphs have a common non-trivial
7669 divisor.
7670 The constant term is then placed in a separate band and the linear
7671 part is reduced.
7673 =item * schedule_algorithm
7675 Selects the scheduling algorithm to be used.
7676 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
7677 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
7679 =item * schedule_separate_components
7681 If at any point the dependence graph contains any (weakly connected) components,
7682 then these components are scheduled separately.
7683 If this option is not set, then some iterations of the domains
7684 in these components may be scheduled together.
7685 If this option is set, then the components are given consecutive
7686 schedules.
7688 =back
7690 =head2 AST Generation
7692 This section describes the C<isl> functionality for generating
7693 ASTs that visit all the elements
7694 in a domain in an order specified by a schedule.
7695 In particular, given a C<isl_union_map>, an AST is generated
7696 that visits all the elements in the domain of the C<isl_union_map>
7697 according to the lexicographic order of the corresponding image
7698 element(s).  If the range of the C<isl_union_map> consists of
7699 elements in more than one space, then each of these spaces is handled
7700 separately in an arbitrary order.
7701 It should be noted that the image elements only specify the I<order>
7702 in which the corresponding domain elements should be visited.
7703 No direct relation between the image elements and the loop iterators
7704 in the generated AST should be assumed.
7706 Each AST is generated within a build.  The initial build
7707 simply specifies the constraints on the parameters (if any)
7708 and can be created, inspected, copied and freed using the following functions.
7710         #include <isl/ast_build.h>
7711         __isl_give isl_ast_build *isl_ast_build_from_context(
7712                 __isl_take isl_set *set);
7713         __isl_give isl_ast_build *isl_ast_build_copy(
7714                 __isl_keep isl_ast_build *build);
7715         __isl_null isl_ast_build *isl_ast_build_free(
7716                 __isl_take isl_ast_build *build);
7718 The C<set> argument is usually a parameter set with zero or more parameters.
7719 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
7720 and L</"Fine-grained Control over AST Generation">.
7721 Finally, the AST itself can be constructed using the following
7722 function.
7724         #include <isl/ast_build.h>
7725         __isl_give isl_ast_node *isl_ast_build_ast_from_schedule(
7726                 __isl_keep isl_ast_build *build,
7727                 __isl_take isl_union_map *schedule);
7729 =head3 Inspecting the AST
7731 The basic properties of an AST node can be obtained as follows.
7733         #include <isl/ast.h>
7734         enum isl_ast_node_type isl_ast_node_get_type(
7735                 __isl_keep isl_ast_node *node);
7737 The type of an AST node is one of
7738 C<isl_ast_node_for>,
7739 C<isl_ast_node_if>,
7740 C<isl_ast_node_block> or
7741 C<isl_ast_node_user>.
7742 An C<isl_ast_node_for> represents a for node.
7743 An C<isl_ast_node_if> represents an if node.
7744 An C<isl_ast_node_block> represents a compound node.
7745 An C<isl_ast_node_user> represents an expression statement.
7746 An expression statement typically corresponds to a domain element, i.e.,
7747 one of the elements that is visited by the AST.
7749 Each type of node has its own additional properties.
7751         #include <isl/ast.h>
7752         __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
7753                 __isl_keep isl_ast_node *node);
7754         __isl_give isl_ast_expr *isl_ast_node_for_get_init(
7755                 __isl_keep isl_ast_node *node);
7756         __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
7757                 __isl_keep isl_ast_node *node);
7758         __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
7759                 __isl_keep isl_ast_node *node);
7760         __isl_give isl_ast_node *isl_ast_node_for_get_body(
7761                 __isl_keep isl_ast_node *node);
7762         int isl_ast_node_for_is_degenerate(
7763                 __isl_keep isl_ast_node *node);
7765 An C<isl_ast_for> is considered degenerate if it is known to execute
7766 exactly once.
7768         #include <isl/ast.h>
7769         __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
7770                 __isl_keep isl_ast_node *node);
7771         __isl_give isl_ast_node *isl_ast_node_if_get_then(
7772                 __isl_keep isl_ast_node *node);
7773         int isl_ast_node_if_has_else(
7774                 __isl_keep isl_ast_node *node);
7775         __isl_give isl_ast_node *isl_ast_node_if_get_else(
7776                 __isl_keep isl_ast_node *node);
7778         __isl_give isl_ast_node_list *
7779         isl_ast_node_block_get_children(
7780                 __isl_keep isl_ast_node *node);
7782         __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
7783                 __isl_keep isl_ast_node *node);
7785 Each of the returned C<isl_ast_expr>s can in turn be inspected using
7786 the following functions.
7788         #include <isl/ast.h>
7789         enum isl_ast_expr_type isl_ast_expr_get_type(
7790                 __isl_keep isl_ast_expr *expr);
7792 The type of an AST expression is one of
7793 C<isl_ast_expr_op>,
7794 C<isl_ast_expr_id> or
7795 C<isl_ast_expr_int>.
7796 An C<isl_ast_expr_op> represents the result of an operation.
7797 An C<isl_ast_expr_id> represents an identifier.
7798 An C<isl_ast_expr_int> represents an integer value.
7800 Each type of expression has its own additional properties.
7802         #include <isl/ast.h>
7803         enum isl_ast_op_type isl_ast_expr_get_op_type(
7804                 __isl_keep isl_ast_expr *expr);
7805         int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
7806         __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
7807                 __isl_keep isl_ast_expr *expr, int pos);
7808         int isl_ast_node_foreach_ast_op_type(
7809                 __isl_keep isl_ast_node *node,
7810                 int (*fn)(enum isl_ast_op_type type, void *user),
7811                 void *user);
7813 C<isl_ast_expr_get_op_type> returns the type of the operation
7814 performed.  C<isl_ast_expr_get_op_n_arg> returns the number of
7815 arguments.  C<isl_ast_expr_get_op_arg> returns the specified
7816 argument.
7817 C<isl_ast_node_foreach_ast_op_type> calls C<fn> for each distinct
7818 C<isl_ast_op_type> that appears in C<node>.
7819 The operation type is one of the following.
7821 =over
7823 =item C<isl_ast_op_and>
7825 Logical I<and> of two arguments.
7826 Both arguments can be evaluated.
7828 =item C<isl_ast_op_and_then>
7830 Logical I<and> of two arguments.
7831 The second argument can only be evaluated if the first evaluates to true.
7833 =item C<isl_ast_op_or>
7835 Logical I<or> of two arguments.
7836 Both arguments can be evaluated.
7838 =item C<isl_ast_op_or_else>
7840 Logical I<or> of two arguments.
7841 The second argument can only be evaluated if the first evaluates to false.
7843 =item C<isl_ast_op_max>
7845 Maximum of two or more arguments.
7847 =item C<isl_ast_op_min>
7849 Minimum of two or more arguments.
7851 =item C<isl_ast_op_minus>
7853 Change sign.
7855 =item C<isl_ast_op_add>
7857 Sum of two arguments.
7859 =item C<isl_ast_op_sub>
7861 Difference of two arguments.
7863 =item C<isl_ast_op_mul>
7865 Product of two arguments.
7867 =item C<isl_ast_op_div>
7869 Exact division.  That is, the result is known to be an integer.
7871 =item C<isl_ast_op_fdiv_q>
7873 Result of integer division, rounded towards negative
7874 infinity.
7876 =item C<isl_ast_op_pdiv_q>
7878 Result of integer division, where dividend is known to be non-negative.
7880 =item C<isl_ast_op_pdiv_r>
7882 Remainder of integer division, where dividend is known to be non-negative.
7884 =item C<isl_ast_op_zdiv_r>
7886 Equal to zero iff the remainder on integer division is zero.
7888 =item C<isl_ast_op_cond>
7890 Conditional operator defined on three arguments.
7891 If the first argument evaluates to true, then the result
7892 is equal to the second argument.  Otherwise, the result
7893 is equal to the third argument.
7894 The second and third argument may only be evaluated if
7895 the first argument evaluates to true and false, respectively.
7896 Corresponds to C<a ? b : c> in C.
7898 =item C<isl_ast_op_select>
7900 Conditional operator defined on three arguments.
7901 If the first argument evaluates to true, then the result
7902 is equal to the second argument.  Otherwise, the result
7903 is equal to the third argument.
7904 The second and third argument may be evaluated independently
7905 of the value of the first argument.
7906 Corresponds to C<a * b + (1 - a) * c> in C.
7908 =item C<isl_ast_op_eq>
7910 Equality relation.
7912 =item C<isl_ast_op_le>
7914 Less than or equal relation.
7916 =item C<isl_ast_op_lt>
7918 Less than relation.
7920 =item C<isl_ast_op_ge>
7922 Greater than or equal relation.
7924 =item C<isl_ast_op_gt>
7926 Greater than relation.
7928 =item C<isl_ast_op_call>
7930 A function call.
7931 The number of arguments of the C<isl_ast_expr> is one more than
7932 the number of arguments in the function call, the first argument
7933 representing the function being called.
7935 =item C<isl_ast_op_access>
7937 An array access.
7938 The number of arguments of the C<isl_ast_expr> is one more than
7939 the number of index expressions in the array access, the first argument
7940 representing the array being accessed.
7942 =item C<isl_ast_op_member>
7944 A member access.
7945 This operation has two arguments, a structure and the name of
7946 the member of the structure being accessed.
7948 =back
7950         #include <isl/ast.h>
7951         __isl_give isl_id *isl_ast_expr_get_id(
7952                 __isl_keep isl_ast_expr *expr);
7954 Return the identifier represented by the AST expression.
7956         #include <isl/ast.h>
7957         __isl_give isl_val *isl_ast_expr_get_val(
7958                 __isl_keep isl_ast_expr *expr);
7960 Return the integer represented by the AST expression.
7962 =head3 Properties of ASTs
7964         #include <isl/ast.h>
7965         int isl_ast_expr_is_equal(__isl_keep isl_ast_expr *expr1,
7966                 __isl_keep isl_ast_expr *expr2);
7968 Check if two C<isl_ast_expr>s are equal to each other.
7970 =head3 Manipulating and printing the AST
7972 AST nodes can be copied and freed using the following functions.
7974         #include <isl/ast.h>
7975         __isl_give isl_ast_node *isl_ast_node_copy(
7976                 __isl_keep isl_ast_node *node);
7977         __isl_null isl_ast_node *isl_ast_node_free(
7978                 __isl_take isl_ast_node *node);
7980 AST expressions can be copied and freed using the following functions.
7982         #include <isl/ast.h>
7983         __isl_give isl_ast_expr *isl_ast_expr_copy(
7984                 __isl_keep isl_ast_expr *expr);
7985         __isl_null isl_ast_expr *isl_ast_expr_free(
7986                 __isl_take isl_ast_expr *expr);
7988 New AST expressions can be created either directly or within
7989 the context of an C<isl_ast_build>.
7991         #include <isl/ast.h>
7992         __isl_give isl_ast_expr *isl_ast_expr_from_val(
7993                 __isl_take isl_val *v);
7994         __isl_give isl_ast_expr *isl_ast_expr_from_id(
7995                 __isl_take isl_id *id);
7996         __isl_give isl_ast_expr *isl_ast_expr_neg(
7997                 __isl_take isl_ast_expr *expr);
7998         __isl_give isl_ast_expr *isl_ast_expr_address_of(
7999                 __isl_take isl_ast_expr *expr);
8000         __isl_give isl_ast_expr *isl_ast_expr_add(
8001                 __isl_take isl_ast_expr *expr1,
8002                 __isl_take isl_ast_expr *expr2);
8003         __isl_give isl_ast_expr *isl_ast_expr_sub(
8004                 __isl_take isl_ast_expr *expr1,
8005                 __isl_take isl_ast_expr *expr2);
8006         __isl_give isl_ast_expr *isl_ast_expr_mul(
8007                 __isl_take isl_ast_expr *expr1,
8008                 __isl_take isl_ast_expr *expr2);
8009         __isl_give isl_ast_expr *isl_ast_expr_div(
8010                 __isl_take isl_ast_expr *expr1,
8011                 __isl_take isl_ast_expr *expr2);
8012         __isl_give isl_ast_expr *isl_ast_expr_and(
8013                 __isl_take isl_ast_expr *expr1,
8014                 __isl_take isl_ast_expr *expr2)
8015         __isl_give isl_ast_expr *isl_ast_expr_or(
8016                 __isl_take isl_ast_expr *expr1,
8017                 __isl_take isl_ast_expr *expr2)
8018         __isl_give isl_ast_expr *isl_ast_expr_eq(
8019                 __isl_take isl_ast_expr *expr1,
8020                 __isl_take isl_ast_expr *expr2);
8021         __isl_give isl_ast_expr *isl_ast_expr_le(
8022                 __isl_take isl_ast_expr *expr1,
8023                 __isl_take isl_ast_expr *expr2);
8024         __isl_give isl_ast_expr *isl_ast_expr_lt(
8025                 __isl_take isl_ast_expr *expr1,
8026                 __isl_take isl_ast_expr *expr2);
8027         __isl_give isl_ast_expr *isl_ast_expr_ge(
8028                 __isl_take isl_ast_expr *expr1,
8029                 __isl_take isl_ast_expr *expr2);
8030         __isl_give isl_ast_expr *isl_ast_expr_gt(
8031                 __isl_take isl_ast_expr *expr1,
8032                 __isl_take isl_ast_expr *expr2);
8033         __isl_give isl_ast_expr *isl_ast_expr_access(
8034                 __isl_take isl_ast_expr *array,
8035                 __isl_take isl_ast_expr_list *indices);
8037 The function C<isl_ast_expr_address_of> can be applied to an
8038 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
8039 to represent the address of the C<isl_ast_expr_access>.
8041         #include <isl/ast_build.h>
8042         __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
8043                 __isl_keep isl_ast_build *build,
8044                 __isl_take isl_pw_aff *pa);
8045         __isl_give isl_ast_expr *
8046         isl_ast_build_access_from_pw_multi_aff(
8047                 __isl_keep isl_ast_build *build,
8048                 __isl_take isl_pw_multi_aff *pma);
8049         __isl_give isl_ast_expr *
8050         isl_ast_build_access_from_multi_pw_aff(
8051                 __isl_keep isl_ast_build *build,
8052                 __isl_take isl_multi_pw_aff *mpa);
8053         __isl_give isl_ast_expr *
8054         isl_ast_build_call_from_pw_multi_aff(
8055                 __isl_keep isl_ast_build *build,
8056                 __isl_take isl_pw_multi_aff *pma);
8057         __isl_give isl_ast_expr *
8058         isl_ast_build_call_from_multi_pw_aff(
8059                 __isl_keep isl_ast_build *build,
8060                 __isl_take isl_multi_pw_aff *mpa);
8062 The domains of C<pa>, C<mpa> and C<pma> should correspond
8063 to the schedule space of C<build>.
8064 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
8065 the function being called.
8066 If the accessed space is a nested relation, then it is taken
8067 to represent an access of the member specified by the range
8068 of this nested relation of the structure specified by the domain
8069 of the nested relation.
8071 The following functions can be used to modify an C<isl_ast_expr>.
8073         #include <isl/ast.h>
8074         __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
8075                 __isl_take isl_ast_expr *expr, int pos,
8076                 __isl_take isl_ast_expr *arg);
8078 Replace the argument of C<expr> at position C<pos> by C<arg>.
8080         #include <isl/ast.h>
8081         __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
8082                 __isl_take isl_ast_expr *expr,
8083                 __isl_take isl_id_to_ast_expr *id2expr);
8085 The function C<isl_ast_expr_substitute_ids> replaces the
8086 subexpressions of C<expr> of type C<isl_ast_expr_id>
8087 by the corresponding expression in C<id2expr>, if there is any.
8090 User specified data can be attached to an C<isl_ast_node> and obtained
8091 from the same C<isl_ast_node> using the following functions.
8093         #include <isl/ast.h>
8094         __isl_give isl_ast_node *isl_ast_node_set_annotation(
8095                 __isl_take isl_ast_node *node,
8096                 __isl_take isl_id *annotation);
8097         __isl_give isl_id *isl_ast_node_get_annotation(
8098                 __isl_keep isl_ast_node *node);
8100 Basic printing can be performed using the following functions.
8102         #include <isl/ast.h>
8103         __isl_give isl_printer *isl_printer_print_ast_expr(
8104                 __isl_take isl_printer *p,
8105                 __isl_keep isl_ast_expr *expr);
8106         __isl_give isl_printer *isl_printer_print_ast_node(
8107                 __isl_take isl_printer *p,
8108                 __isl_keep isl_ast_node *node);
8109         __isl_give char *isl_ast_expr_to_str(
8110                 __isl_keep isl_ast_expr *expr);
8112 More advanced printing can be performed using the following functions.
8114         #include <isl/ast.h>
8115         __isl_give isl_printer *isl_ast_op_type_print_macro(
8116                 enum isl_ast_op_type type,
8117                 __isl_take isl_printer *p);
8118         __isl_give isl_printer *isl_ast_node_print_macros(
8119                 __isl_keep isl_ast_node *node,
8120                 __isl_take isl_printer *p);
8121         __isl_give isl_printer *isl_ast_node_print(
8122                 __isl_keep isl_ast_node *node,
8123                 __isl_take isl_printer *p,
8124                 __isl_take isl_ast_print_options *options);
8125         __isl_give isl_printer *isl_ast_node_for_print(
8126                 __isl_keep isl_ast_node *node,
8127                 __isl_take isl_printer *p,
8128                 __isl_take isl_ast_print_options *options);
8129         __isl_give isl_printer *isl_ast_node_if_print(
8130                 __isl_keep isl_ast_node *node,
8131                 __isl_take isl_printer *p,
8132                 __isl_take isl_ast_print_options *options);
8134 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
8135 C<isl> may print out an AST that makes use of macros such
8136 as C<floord>, C<min> and C<max>.
8137 C<isl_ast_op_type_print_macro> prints out the macro
8138 corresponding to a specific C<isl_ast_op_type>.
8139 C<isl_ast_node_print_macros> scans the C<isl_ast_node>
8140 for expressions where these macros would be used and prints
8141 out the required macro definitions.
8142 Essentially, C<isl_ast_node_print_macros> calls
8143 C<isl_ast_node_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
8144 as function argument.
8145 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
8146 C<isl_ast_node_if_print> print an C<isl_ast_node>
8147 in C<ISL_FORMAT_C>, but allow for some extra control
8148 through an C<isl_ast_print_options> object.
8149 This object can be created using the following functions.
8151         #include <isl/ast.h>
8152         __isl_give isl_ast_print_options *
8153         isl_ast_print_options_alloc(isl_ctx *ctx);
8154         __isl_give isl_ast_print_options *
8155         isl_ast_print_options_copy(
8156                 __isl_keep isl_ast_print_options *options);
8157         __isl_null isl_ast_print_options *
8158         isl_ast_print_options_free(
8159                 __isl_take isl_ast_print_options *options);
8161         __isl_give isl_ast_print_options *
8162         isl_ast_print_options_set_print_user(
8163                 __isl_take isl_ast_print_options *options,
8164                 __isl_give isl_printer *(*print_user)(
8165                         __isl_take isl_printer *p,
8166                         __isl_take isl_ast_print_options *options,
8167                         __isl_keep isl_ast_node *node, void *user),
8168                 void *user);
8169         __isl_give isl_ast_print_options *
8170         isl_ast_print_options_set_print_for(
8171                 __isl_take isl_ast_print_options *options,
8172                 __isl_give isl_printer *(*print_for)(
8173                         __isl_take isl_printer *p,
8174                         __isl_take isl_ast_print_options *options,
8175                         __isl_keep isl_ast_node *node, void *user),
8176                 void *user);
8178 The callback set by C<isl_ast_print_options_set_print_user>
8179 is called whenever a node of type C<isl_ast_node_user> needs to
8180 be printed.
8181 The callback set by C<isl_ast_print_options_set_print_for>
8182 is called whenever a node of type C<isl_ast_node_for> needs to
8183 be printed.
8184 Note that C<isl_ast_node_for_print> will I<not> call the
8185 callback set by C<isl_ast_print_options_set_print_for> on the node
8186 on which C<isl_ast_node_for_print> is called, but only on nested
8187 nodes of type C<isl_ast_node_for>.  It is therefore safe to
8188 call C<isl_ast_node_for_print> from within the callback set by
8189 C<isl_ast_print_options_set_print_for>.
8191 The following option determines the type to be used for iterators
8192 while printing the AST.
8194         int isl_options_set_ast_iterator_type(
8195                 isl_ctx *ctx, const char *val);
8196         const char *isl_options_get_ast_iterator_type(
8197                 isl_ctx *ctx);
8199 The AST printer only prints body nodes as blocks if these
8200 blocks cannot be safely omitted.
8201 For example, a C<for> node with one body node will not be
8202 surrounded with braces in C<ISL_FORMAT_C>.
8203 A block will always be printed by setting the following option.
8205         int isl_options_set_ast_always_print_block(isl_ctx *ctx,
8206                 int val);
8207         int isl_options_get_ast_always_print_block(isl_ctx *ctx);
8209 =head3 Options
8211         #include <isl/ast_build.h>
8212         int isl_options_set_ast_build_atomic_upper_bound(
8213                 isl_ctx *ctx, int val);
8214         int isl_options_get_ast_build_atomic_upper_bound(
8215                 isl_ctx *ctx);
8216         int isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
8217                 int val);
8218         int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
8219         int isl_options_set_ast_build_exploit_nested_bounds(
8220                 isl_ctx *ctx, int val);
8221         int isl_options_get_ast_build_exploit_nested_bounds(
8222                 isl_ctx *ctx);
8223         int isl_options_set_ast_build_group_coscheduled(
8224                 isl_ctx *ctx, int val);
8225         int isl_options_get_ast_build_group_coscheduled(
8226                 isl_ctx *ctx);
8227         int isl_options_set_ast_build_scale_strides(
8228                 isl_ctx *ctx, int val);
8229         int isl_options_get_ast_build_scale_strides(
8230                 isl_ctx *ctx);
8231         int isl_options_set_ast_build_allow_else(isl_ctx *ctx,
8232                 int val);
8233         int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
8234         int isl_options_set_ast_build_allow_or(isl_ctx *ctx,
8235                 int val);
8236         int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
8238 =over
8240 =item * ast_build_atomic_upper_bound
8242 Generate loop upper bounds that consist of the current loop iterator,
8243 an operator and an expression not involving the iterator.
8244 If this option is not set, then the current loop iterator may appear
8245 several times in the upper bound.
8246 For example, when this option is turned off, AST generation
8247 for the schedule
8249         [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
8251 produces
8253         for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
8254           A(c0);
8256 When the option is turned on, the following AST is generated
8258         for (int c0 = 0; c0 <= min(100, n); c0 += 1)
8259           A(c0);
8261 =item * ast_build_prefer_pdiv
8263 If this option is turned off, then the AST generation will
8264 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
8265 operators, but no C<isl_ast_op_pdiv_q> or
8266 C<isl_ast_op_pdiv_r> operators.
8267 If this options is turned on, then C<isl> will try to convert
8268 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
8269 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
8271 =item * ast_build_exploit_nested_bounds
8273 Simplify conditions based on bounds of nested for loops.
8274 In particular, remove conditions that are implied by the fact
8275 that one or more nested loops have at least one iteration,
8276 meaning that the upper bound is at least as large as the lower bound.
8277 For example, when this option is turned off, AST generation
8278 for the schedule
8280         [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
8281                                         0 <= j <= M }
8283 produces
8285         if (M >= 0)
8286           for (int c0 = 0; c0 <= N; c0 += 1)
8287             for (int c1 = 0; c1 <= M; c1 += 1)
8288               A(c0, c1);
8290 When the option is turned on, the following AST is generated
8292         for (int c0 = 0; c0 <= N; c0 += 1)
8293           for (int c1 = 0; c1 <= M; c1 += 1)
8294             A(c0, c1);
8296 =item * ast_build_group_coscheduled
8298 If two domain elements are assigned the same schedule point, then
8299 they may be executed in any order and they may even appear in different
8300 loops.  If this options is set, then the AST generator will make
8301 sure that coscheduled domain elements do not appear in separate parts
8302 of the AST.  This is useful in case of nested AST generation
8303 if the outer AST generation is given only part of a schedule
8304 and the inner AST generation should handle the domains that are
8305 coscheduled by this initial part of the schedule together.
8306 For example if an AST is generated for a schedule
8308         { A[i] -> [0]; B[i] -> [0] }
8310 then the C<isl_ast_build_set_create_leaf> callback described
8311 below may get called twice, once for each domain.
8312 Setting this option ensures that the callback is only called once
8313 on both domains together.
8315 =item * ast_build_separation_bounds
8317 This option specifies which bounds to use during separation.
8318 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
8319 then all (possibly implicit) bounds on the current dimension will
8320 be used during separation.
8321 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
8322 then only those bounds that are explicitly available will
8323 be used during separation.
8325 =item * ast_build_scale_strides
8327 This option specifies whether the AST generator is allowed
8328 to scale down iterators of strided loops.
8330 =item * ast_build_allow_else
8332 This option specifies whether the AST generator is allowed
8333 to construct if statements with else branches.
8335 =item * ast_build_allow_or
8337 This option specifies whether the AST generator is allowed
8338 to construct if conditions with disjunctions.
8340 =back
8342 =head3 Fine-grained Control over AST Generation
8344 Besides specifying the constraints on the parameters,
8345 an C<isl_ast_build> object can be used to control
8346 various aspects of the AST generation process.
8347 The most prominent way of control is through ``options'',
8348 which can be set using the following function.
8350         #include <isl/ast_build.h>
8351         __isl_give isl_ast_build *
8352         isl_ast_build_set_options(
8353                 __isl_take isl_ast_build *control,
8354                 __isl_take isl_union_map *options);
8356 The options are encoded in an C<isl_union_map>.
8357 The domain of this union relation refers to the schedule domain,
8358 i.e., the range of the schedule passed to C<isl_ast_build_ast_from_schedule>.
8359 In the case of nested AST generation (see L</"Nested AST Generation">),
8360 the domain of C<options> should refer to the extra piece of the schedule.
8361 That is, it should be equal to the range of the wrapped relation in the
8362 range of the schedule.
8363 The range of the options can consist of elements in one or more spaces,
8364 the names of which determine the effect of the option.
8365 The values of the range typically also refer to the schedule dimension
8366 to which the option applies.  In case of nested AST generation
8367 (see L</"Nested AST Generation">), these values refer to the position
8368 of the schedule dimension within the innermost AST generation.
8369 The constraints on the domain elements of
8370 the option should only refer to this dimension and earlier dimensions.
8371 We consider the following spaces.
8373 =over
8375 =item C<separation_class>
8377 This space is a wrapped relation between two one dimensional spaces.
8378 The input space represents the schedule dimension to which the option
8379 applies and the output space represents the separation class.
8380 While constructing a loop corresponding to the specified schedule
8381 dimension(s), the AST generator will try to generate separate loops
8382 for domain elements that are assigned different classes.
8383 If only some of the elements are assigned a class, then those elements
8384 that are not assigned any class will be treated as belonging to a class
8385 that is separate from the explicitly assigned classes.
8386 The typical use case for this option is to separate full tiles from
8387 partial tiles.
8388 The other options, described below, are applied after the separation
8389 into classes.
8391 As an example, consider the separation into full and partial tiles
8392 of a tiling of a triangular domain.
8393 Take, for example, the domain
8395         { A[i,j] : 0 <= i,j and i + j <= 100 }
8397 and a tiling into tiles of 10 by 10.  The input to the AST generator
8398 is then the schedule
8400         { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
8401                                                 i + j <= 100 }
8403 Without any options, the following AST is generated
8405         for (int c0 = 0; c0 <= 10; c0 += 1)
8406           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
8407             for (int c2 = 10 * c0;
8408                  c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
8409                  c2 += 1)
8410               for (int c3 = 10 * c1;
8411                    c3 <= min(10 * c1 + 9, -c2 + 100);
8412                    c3 += 1)
8413                 A(c2, c3);
8415 Separation into full and partial tiles can be obtained by assigning
8416 a class, say C<0>, to the full tiles.  The full tiles are represented by those
8417 values of the first and second schedule dimensions for which there are
8418 values of the third and fourth dimensions to cover an entire tile.
8419 That is, we need to specify the following option
8421         { [a,b,c,d] -> separation_class[[0]->[0]] :
8422                 exists b': 0 <= 10a,10b' and
8423                            10a+9+10b'+9 <= 100;
8424           [a,b,c,d] -> separation_class[[1]->[0]] :
8425                 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
8427 which simplifies to
8429         { [a, b, c, d] -> separation_class[[1] -> [0]] :
8430                 a >= 0 and b >= 0 and b <= 8 - a;
8431           [a, b, c, d] -> separation_class[[0] -> [0]] :
8432                 a >= 0 and a <= 8 }
8434 With this option, the generated AST is as follows
8436         {
8437           for (int c0 = 0; c0 <= 8; c0 += 1) {
8438             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
8439               for (int c2 = 10 * c0;
8440                    c2 <= 10 * c0 + 9; c2 += 1)
8441                 for (int c3 = 10 * c1;
8442                      c3 <= 10 * c1 + 9; c3 += 1)
8443                   A(c2, c3);
8444             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
8445               for (int c2 = 10 * c0;
8446                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
8447                    c2 += 1)
8448                 for (int c3 = 10 * c1;
8449                      c3 <= min(-c2 + 100, 10 * c1 + 9);
8450                      c3 += 1)
8451                   A(c2, c3);
8452           }
8453           for (int c0 = 9; c0 <= 10; c0 += 1)
8454             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
8455               for (int c2 = 10 * c0;
8456                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
8457                    c2 += 1)
8458                 for (int c3 = 10 * c1;
8459                      c3 <= min(10 * c1 + 9, -c2 + 100);
8460                      c3 += 1)
8461                   A(c2, c3);
8462         }
8464 =item C<separate>
8466 This is a single-dimensional space representing the schedule dimension(s)
8467 to which ``separation'' should be applied.  Separation tries to split
8468 a loop into several pieces if this can avoid the generation of guards
8469 inside the loop.
8470 See also the C<atomic> option.
8472 =item C<atomic>
8474 This is a single-dimensional space representing the schedule dimension(s)
8475 for which the domains should be considered ``atomic''.  That is, the
8476 AST generator will make sure that any given domain space will only appear
8477 in a single loop at the specified level.
8479 Consider the following schedule
8481         { a[i] -> [i] : 0 <= i < 10;
8482           b[i] -> [i+1] : 0 <= i < 10 }
8484 If the following option is specified
8486         { [i] -> separate[x] }
8488 then the following AST will be generated
8490         {
8491           a(0);
8492           for (int c0 = 1; c0 <= 9; c0 += 1) {
8493             a(c0);
8494             b(c0 - 1);
8495           }
8496           b(9);
8497         }
8499 If, on the other hand, the following option is specified
8501         { [i] -> atomic[x] }
8503 then the following AST will be generated
8505         for (int c0 = 0; c0 <= 10; c0 += 1) {
8506           if (c0 <= 9)
8507             a(c0);
8508           if (c0 >= 1)
8509             b(c0 - 1);
8510         }
8512 If neither C<atomic> nor C<separate> is specified, then the AST generator
8513 may produce either of these two results or some intermediate form.
8515 =item C<unroll>
8517 This is a single-dimensional space representing the schedule dimension(s)
8518 that should be I<completely> unrolled.
8519 To obtain a partial unrolling, the user should apply an additional
8520 strip-mining to the schedule and fully unroll the inner loop.
8522 =back
8524 Additional control is available through the following functions.
8526         #include <isl/ast_build.h>
8527         __isl_give isl_ast_build *
8528         isl_ast_build_set_iterators(
8529                 __isl_take isl_ast_build *control,
8530                 __isl_take isl_id_list *iterators);
8532 The function C<isl_ast_build_set_iterators> allows the user to
8533 specify a list of iterator C<isl_id>s to be used as iterators.
8534 If the input schedule is injective, then
8535 the number of elements in this list should be as large as the dimension
8536 of the schedule space, but no direct correspondence should be assumed
8537 between dimensions and elements.
8538 If the input schedule is not injective, then an additional number
8539 of C<isl_id>s equal to the largest dimension of the input domains
8540 may be required.
8541 If the number of provided C<isl_id>s is insufficient, then additional
8542 names are automatically generated.
8544         #include <isl/ast_build.h>
8545         __isl_give isl_ast_build *
8546         isl_ast_build_set_create_leaf(
8547                 __isl_take isl_ast_build *control,
8548                 __isl_give isl_ast_node *(*fn)(
8549                         __isl_take isl_ast_build *build,
8550                         void *user), void *user);
8553 C<isl_ast_build_set_create_leaf> function allows for the
8554 specification of a callback that should be called whenever the AST
8555 generator arrives at an element of the schedule domain.
8556 The callback should return an AST node that should be inserted
8557 at the corresponding position of the AST.  The default action (when
8558 the callback is not set) is to continue generating parts of the AST to scan
8559 all the domain elements associated to the schedule domain element
8560 and to insert user nodes, ``calling'' the domain element, for each of them.
8561 The C<build> argument contains the current state of the C<isl_ast_build>.
8562 To ease nested AST generation (see L</"Nested AST Generation">),
8563 all control information that is
8564 specific to the current AST generation such as the options and
8565 the callbacks has been removed from this C<isl_ast_build>.
8566 The callback would typically return the result of a nested
8567 AST generation or a
8568 user defined node created using the following function.
8570         #include <isl/ast.h>
8571         __isl_give isl_ast_node *isl_ast_node_alloc_user(
8572                 __isl_take isl_ast_expr *expr);
8574         #include <isl/ast_build.h>
8575         __isl_give isl_ast_build *
8576         isl_ast_build_set_at_each_domain(
8577                 __isl_take isl_ast_build *build,
8578                 __isl_give isl_ast_node *(*fn)(
8579                         __isl_take isl_ast_node *node,
8580                         __isl_keep isl_ast_build *build,
8581                         void *user), void *user);
8582         __isl_give isl_ast_build *
8583         isl_ast_build_set_before_each_for(
8584                 __isl_take isl_ast_build *build,
8585                 __isl_give isl_id *(*fn)(
8586                         __isl_keep isl_ast_build *build,
8587                         void *user), void *user);
8588         __isl_give isl_ast_build *
8589         isl_ast_build_set_after_each_for(
8590                 __isl_take isl_ast_build *build,
8591                 __isl_give isl_ast_node *(*fn)(
8592                         __isl_take isl_ast_node *node,
8593                         __isl_keep isl_ast_build *build,
8594                         void *user), void *user);
8596 The callback set by C<isl_ast_build_set_at_each_domain> will
8597 be called for each domain AST node.
8598 The callbacks set by C<isl_ast_build_set_before_each_for>
8599 and C<isl_ast_build_set_after_each_for> will be called
8600 for each for AST node.  The first will be called in depth-first
8601 pre-order, while the second will be called in depth-first post-order.
8602 Since C<isl_ast_build_set_before_each_for> is called before the for
8603 node is actually constructed, it is only passed an C<isl_ast_build>.
8604 The returned C<isl_id> will be added as an annotation (using
8605 C<isl_ast_node_set_annotation>) to the constructed for node.
8606 In particular, if the user has also specified an C<after_each_for>
8607 callback, then the annotation can be retrieved from the node passed to
8608 that callback using C<isl_ast_node_get_annotation>.
8609 All callbacks should C<NULL> on failure.
8610 The given C<isl_ast_build> can be used to create new
8611 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
8612 or C<isl_ast_build_call_from_pw_multi_aff>.
8614 =head3 Nested AST Generation
8616 C<isl> allows the user to create an AST within the context
8617 of another AST.  These nested ASTs are created using the
8618 same C<isl_ast_build_ast_from_schedule> function that is used to create the
8619 outer AST.  The C<build> argument should be an C<isl_ast_build>
8620 passed to a callback set by
8621 C<isl_ast_build_set_create_leaf>.
8622 The space of the range of the C<schedule> argument should refer
8623 to this build.  In particular, the space should be a wrapped
8624 relation and the domain of this wrapped relation should be the
8625 same as that of the range of the schedule returned by
8626 C<isl_ast_build_get_schedule> below.
8627 In practice, the new schedule is typically
8628 created by calling C<isl_union_map_range_product> on the old schedule
8629 and some extra piece of the schedule.
8630 The space of the schedule domain is also available from
8631 the C<isl_ast_build>.
8633         #include <isl/ast_build.h>
8634         __isl_give isl_union_map *isl_ast_build_get_schedule(
8635                 __isl_keep isl_ast_build *build);
8636         __isl_give isl_space *isl_ast_build_get_schedule_space(
8637                 __isl_keep isl_ast_build *build);
8638         __isl_give isl_ast_build *isl_ast_build_restrict(
8639                 __isl_take isl_ast_build *build,
8640                 __isl_take isl_set *set);
8642 The C<isl_ast_build_get_schedule> function returns a (partial)
8643 schedule for the domains elements for which part of the AST still needs to
8644 be generated in the current build.
8645 In particular, the domain elements are mapped to those iterations of the loops
8646 enclosing the current point of the AST generation inside which
8647 the domain elements are executed.
8648 No direct correspondence between
8649 the input schedule and this schedule should be assumed.
8650 The space obtained from C<isl_ast_build_get_schedule_space> can be used
8651 to create a set for C<isl_ast_build_restrict> to intersect
8652 with the current build.  In particular, the set passed to
8653 C<isl_ast_build_restrict> can have additional parameters.
8654 The ids of the set dimensions in the space returned by
8655 C<isl_ast_build_get_schedule_space> correspond to the
8656 iterators of the already generated loops.
8657 The user should not rely on the ids of the output dimensions
8658 of the relations in the union relation returned by
8659 C<isl_ast_build_get_schedule> having any particular value.
8661 =head1 Applications
8663 Although C<isl> is mainly meant to be used as a library,
8664 it also contains some basic applications that use some
8665 of the functionality of C<isl>.
8666 The input may be specified in either the L<isl format>
8667 or the L<PolyLib format>.
8669 =head2 C<isl_polyhedron_sample>
8671 C<isl_polyhedron_sample> takes a polyhedron as input and prints
8672 an integer element of the polyhedron, if there is any.
8673 The first column in the output is the denominator and is always
8674 equal to 1.  If the polyhedron contains no integer points,
8675 then a vector of length zero is printed.
8677 =head2 C<isl_pip>
8679 C<isl_pip> takes the same input as the C<example> program
8680 from the C<piplib> distribution, i.e., a set of constraints
8681 on the parameters, a line containing only -1 and finally a set
8682 of constraints on a parametric polyhedron.
8683 The coefficients of the parameters appear in the last columns
8684 (but before the final constant column).
8685 The output is the lexicographic minimum of the parametric polyhedron.
8686 As C<isl> currently does not have its own output format, the output
8687 is just a dump of the internal state.
8689 =head2 C<isl_polyhedron_minimize>
8691 C<isl_polyhedron_minimize> computes the minimum of some linear
8692 or affine objective function over the integer points in a polyhedron.
8693 If an affine objective function
8694 is given, then the constant should appear in the last column.
8696 =head2 C<isl_polytope_scan>
8698 Given a polytope, C<isl_polytope_scan> prints
8699 all integer points in the polytope.
8701 =head2 C<isl_codegen>
8703 Given a schedule, a context set and an options relation,
8704 C<isl_codegen> prints out an AST that scans the domain elements
8705 of the schedule in the order of their image(s) taking into account
8706 the constraints in the context set.