add isl_schedule_map_schedule_node
[isl.git] / doc / user.pod
blob4bf502a4ce352916b97057d1a5db40ddbd236b62
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 isl_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_get_ctx(
527                 __isl_keep isl_schedule *sched);
528         isl_ctx *isl_schedule_constraints_get_ctx(
529                 __isl_keep isl_schedule_constraints *sc);
531         #include <isl/schedule_node.h>
532         isl_ctx *isl_schedule_node_get_ctx(
533                 __isl_keep isl_schedule_node *node);
535         #include <isl/band.h>
536         isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band);
538         #include <isl/ast_build.h>
539         isl_ctx *isl_ast_build_get_ctx(
540                 __isl_keep isl_ast_build *build);
542         #include <isl/ast.h>
543         isl_ctx *isl_ast_expr_get_ctx(
544                 __isl_keep isl_ast_expr *expr);
545         isl_ctx *isl_ast_node_get_ctx(
546                 __isl_keep isl_ast_node *node);
548 =head2 Values
550 An C<isl_val> represents an integer value, a rational value
551 or one of three special values, infinity, negative infinity and NaN.
552 Some predefined values can be created using the following functions.
554         #include <isl/val.h>
555         __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
556         __isl_give isl_val *isl_val_one(isl_ctx *ctx);
557         __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
558         __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
559         __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
560         __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
562 Specific integer values can be created using the following functions.
564         #include <isl/val.h>
565         __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
566                 long i);
567         __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
568                 unsigned long u);
569         __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
570                 size_t n, size_t size, const void *chunks);
572 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
573 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
574 The least significant digit is assumed to be stored first.
576 Value objects can be copied and freed using the following functions.
578         #include <isl/val.h>
579         __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
580         __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
582 They can be inspected using the following functions.
584         #include <isl/val.h>
585         long isl_val_get_num_si(__isl_keep isl_val *v);
586         long isl_val_get_den_si(__isl_keep isl_val *v);
587         double isl_val_get_d(__isl_keep isl_val *v);
588         size_t isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
589                 size_t size);
590         int isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
591                 size_t size, void *chunks);
593 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
594 of C<size> bytes needed to store the absolute value of the
595 numerator of C<v>.
596 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
597 which is assumed to have been preallocated by the caller.
598 The least significant digit is stored first.
599 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
600 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
601 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
603 An C<isl_val> can be modified using the following function.
605         #include <isl/val.h>
606         __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
607                 long i);
609 The following unary properties are defined on C<isl_val>s.
611         #include <isl/val.h>
612         int isl_val_sgn(__isl_keep isl_val *v);
613         int isl_val_is_zero(__isl_keep isl_val *v);
614         int isl_val_is_one(__isl_keep isl_val *v);
615         int isl_val_is_negone(__isl_keep isl_val *v);
616         int isl_val_is_nonneg(__isl_keep isl_val *v);
617         int isl_val_is_nonpos(__isl_keep isl_val *v);
618         int isl_val_is_pos(__isl_keep isl_val *v);
619         int isl_val_is_neg(__isl_keep isl_val *v);
620         int isl_val_is_int(__isl_keep isl_val *v);
621         int isl_val_is_rat(__isl_keep isl_val *v);
622         int isl_val_is_nan(__isl_keep isl_val *v);
623         int isl_val_is_infty(__isl_keep isl_val *v);
624         int isl_val_is_neginfty(__isl_keep isl_val *v);
626 Note that the sign of NaN is undefined.
628 The following binary properties are defined on pairs of C<isl_val>s.
630         #include <isl/val.h>
631         int isl_val_lt(__isl_keep isl_val *v1,
632                 __isl_keep isl_val *v2);
633         int isl_val_le(__isl_keep isl_val *v1,
634                 __isl_keep isl_val *v2);
635         int isl_val_gt(__isl_keep isl_val *v1,
636                 __isl_keep isl_val *v2);
637         int isl_val_ge(__isl_keep isl_val *v1,
638                 __isl_keep isl_val *v2);
639         int isl_val_eq(__isl_keep isl_val *v1,
640                 __isl_keep isl_val *v2);
641         int isl_val_ne(__isl_keep isl_val *v1,
642                 __isl_keep isl_val *v2);
643         int isl_val_abs_eq(__isl_keep isl_val *v1,
644                 __isl_keep isl_val *v2);
646 The function C<isl_val_abs_eq> checks whether its two arguments
647 are equal in absolute value.
649 For integer C<isl_val>s we additionally have the following binary property.
651         #include <isl/val.h>
652         int isl_val_is_divisible_by(__isl_keep isl_val *v1,
653                 __isl_keep isl_val *v2);
655 An C<isl_val> can also be compared to an integer using the following
656 function.  The result is undefined for NaN.
658         #include <isl/val.h>
659         int isl_val_cmp_si(__isl_keep isl_val *v, long i);
661 The following unary operations are available on C<isl_val>s.
663         #include <isl/val.h>
664         __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
665         __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
666         __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
667         __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
668         __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
669         __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
670         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
672 The following binary operations are available on C<isl_val>s.
674         #include <isl/val.h>
675         __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
676                 __isl_take isl_val *v2);
677         __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
678                 __isl_take isl_val *v2);
679         __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
680                 __isl_take isl_val *v2);
681         __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
682                 unsigned long v2);
683         __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
684                 __isl_take isl_val *v2);
685         __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
686                 unsigned long v2);
687         __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
688                 __isl_take isl_val *v2);
689         __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
690                 unsigned long v2);
691         __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
692                 __isl_take isl_val *v2);
694 On integer values, we additionally have the following operations.
696         #include <isl/val.h>
697         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
698         __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
699                 __isl_take isl_val *v2);
700         __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
701                 __isl_take isl_val *v2);
702         __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
703                 __isl_take isl_val *v2, __isl_give isl_val **x,
704                 __isl_give isl_val **y);
706 The function C<isl_val_gcdext> returns the greatest common divisor g
707 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
708 that C<*x> * C<v1> + C<*y> * C<v2> = g.
710 =head3 GMP specific functions
712 These functions are only available if C<isl> has been compiled with C<GMP>
713 support.
715 Specific integer and rational values can be created from C<GMP> values using
716 the following functions.
718         #include <isl/val_gmp.h>
719         __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
720                 mpz_t z);
721         __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
722                 const mpz_t n, const mpz_t d);
724 The numerator and denominator of a rational value can be extracted as
725 C<GMP> values using the following functions.
727         #include <isl/val_gmp.h>
728         int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
729         int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
731 =head2 Sets and Relations
733 C<isl> uses six types of objects for representing sets and relations,
734 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
735 C<isl_union_set> and C<isl_union_map>.
736 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
737 can be described as a conjunction of affine constraints, while
738 C<isl_set> and C<isl_map> represent unions of
739 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
740 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
741 to live in the same space.  C<isl_union_set>s and C<isl_union_map>s
742 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
743 where spaces are considered different if they have a different number
744 of dimensions and/or different names (see L<"Spaces">).
745 The difference between sets and relations (maps) is that sets have
746 one set of variables, while relations have two sets of variables,
747 input variables and output variables.
749 =head2 Error Handling
751 C<isl> supports different ways to react in case a runtime error is triggered.
752 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
753 with two maps that have incompatible spaces. There are three possible ways
754 to react on error: to warn, to continue or to abort.
756 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
757 the last error in the corresponding C<isl_ctx> and the function in which the
758 error was triggered returns C<NULL>. An error does not corrupt internal state,
759 such that isl can continue to be used. C<isl> also provides functions to
760 read the last error and to reset the memory that stores the last error. The
761 last error is only stored for information purposes. Its presence does not
762 change the behavior of C<isl>. Hence, resetting an error is not required to
763 continue to use isl, but only to observe new errors.
765         #include <isl/ctx.h>
766         enum isl_error isl_ctx_last_error(isl_ctx *ctx);
767         void isl_ctx_reset_error(isl_ctx *ctx);
769 Another option is to continue on error. This is similar to warn on error mode,
770 except that C<isl> does not print any warning. This allows a program to
771 implement its own error reporting.
773 The last option is to directly abort the execution of the program from within
774 the isl library. This makes it obviously impossible to recover from an error,
775 but it allows to directly spot the error location. By aborting on error,
776 debuggers break at the location the error occurred and can provide a stack
777 trace. Other tools that automatically provide stack traces on abort or that do
778 not want to continue execution after an error was triggered may also prefer to
779 abort on error.
781 The on error behavior of isl can be specified by calling
782 C<isl_options_set_on_error> or by setting the command line option
783 C<--isl-on-error>. Valid arguments for the function call are
784 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
785 choices for the command line option are C<warn>, C<continue> and C<abort>.
786 It is also possible to query the current error mode.
788         #include <isl/options.h>
789         int isl_options_set_on_error(isl_ctx *ctx, int val);
790         int isl_options_get_on_error(isl_ctx *ctx);
792 =head2 Identifiers
794 Identifiers are used to identify both individual dimensions
795 and tuples of dimensions.  They consist of an optional name and an optional
796 user pointer.  The name and the user pointer cannot both be C<NULL>, however.
797 Identifiers with the same name but different pointer values
798 are considered to be distinct.
799 Similarly, identifiers with different names but the same pointer value
800 are also considered to be distinct.
801 Equal identifiers are represented using the same object.
802 Pairs of identifiers can therefore be tested for equality using the
803 C<==> operator.
804 Identifiers can be constructed, copied, freed, inspected and printed
805 using the following functions.
807         #include <isl/id.h>
808         __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
809                 __isl_keep const char *name, void *user);
810         __isl_give isl_id *isl_id_set_free_user(
811                 __isl_take isl_id *id,
812                 __isl_give void (*free_user)(void *user));
813         __isl_give isl_id *isl_id_copy(isl_id *id);
814         __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
816         void *isl_id_get_user(__isl_keep isl_id *id);
817         __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
819         __isl_give isl_printer *isl_printer_print_id(
820                 __isl_take isl_printer *p, __isl_keep isl_id *id);
822 The callback set by C<isl_id_set_free_user> is called on the user
823 pointer when the last reference to the C<isl_id> is freed.
824 Note that C<isl_id_get_name> returns a pointer to some internal
825 data structure, so the result can only be used while the
826 corresponding C<isl_id> is alive.
828 =head2 Spaces
830 Whenever a new set, relation or similar object is created from scratch,
831 the space in which it lives needs to be specified using an C<isl_space>.
832 Each space involves zero or more parameters and zero, one or two
833 tuples of set or input/output dimensions.  The parameters and dimensions
834 are identified by an C<isl_dim_type> and a position.
835 The type C<isl_dim_param> refers to parameters,
836 the type C<isl_dim_set> refers to set dimensions (for spaces
837 with a single tuple of dimensions) and the types C<isl_dim_in>
838 and C<isl_dim_out> refer to input and output dimensions
839 (for spaces with two tuples of dimensions).
840 Local spaces (see L</"Local Spaces">) also contain dimensions
841 of type C<isl_dim_div>.
842 Note that parameters are only identified by their position within
843 a given object.  Across different objects, parameters are (usually)
844 identified by their names or identifiers.  Only unnamed parameters
845 are identified by their positions across objects.  The use of unnamed
846 parameters is discouraged.
848         #include <isl/space.h>
849         __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
850                 unsigned nparam, unsigned n_in, unsigned n_out);
851         __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
852                 unsigned nparam);
853         __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
854                 unsigned nparam, unsigned dim);
855         __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
856         __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
858 The space used for creating a parameter domain
859 needs to be created using C<isl_space_params_alloc>.
860 For other sets, the space
861 needs to be created using C<isl_space_set_alloc>, while
862 for a relation, the space
863 needs to be created using C<isl_space_alloc>.
865 To check whether a given space is that of a set or a map
866 or whether it is a parameter space, use these functions:
868         #include <isl/space.h>
869         int isl_space_is_params(__isl_keep isl_space *space);
870         int isl_space_is_set(__isl_keep isl_space *space);
871         int isl_space_is_map(__isl_keep isl_space *space);
873 Spaces can be compared using the following functions:
875         #include <isl/space.h>
876         int isl_space_is_equal(__isl_keep isl_space *space1,
877                 __isl_keep isl_space *space2);
878         int isl_space_is_domain(__isl_keep isl_space *space1,
879                 __isl_keep isl_space *space2);
880         int isl_space_is_range(__isl_keep isl_space *space1,
881                 __isl_keep isl_space *space2);
882         int isl_space_tuple_is_equal(
883                 __isl_keep isl_space *space1,
884                 enum isl_dim_type type1,
885                 __isl_keep isl_space *space2,
886                 enum isl_dim_type type2);
888 C<isl_space_is_domain> checks whether the first argument is equal
889 to the domain of the second argument.  This requires in particular that
890 the first argument is a set space and that the second argument
891 is a map space.  C<isl_space_tuple_is_equal> checks whether the given
892 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
893 spaces are the same.  That is, it checks if they have the same
894 identifier (if any), the same dimension and the same internal structure
895 (if any).
897 It is often useful to create objects that live in the
898 same space as some other object.  This can be accomplished
899 by creating the new objects
900 (see L</"Creating New Sets and Relations"> or
901 L</"Functions">) based on the space
902 of the original object.
904         #include <isl/set.h>
905         __isl_give isl_space *isl_basic_set_get_space(
906                 __isl_keep isl_basic_set *bset);
907         __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
909         #include <isl/union_set.h>
910         __isl_give isl_space *isl_union_set_get_space(
911                 __isl_keep isl_union_set *uset);
913         #include <isl/map.h>
914         __isl_give isl_space *isl_basic_map_get_space(
915                 __isl_keep isl_basic_map *bmap);
916         __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
918         #include <isl/union_map.h>
919         __isl_give isl_space *isl_union_map_get_space(
920                 __isl_keep isl_union_map *umap);
922         #include <isl/constraint.h>
923         __isl_give isl_space *isl_constraint_get_space(
924                 __isl_keep isl_constraint *constraint);
926         #include <isl/polynomial.h>
927         __isl_give isl_space *isl_qpolynomial_get_domain_space(
928                 __isl_keep isl_qpolynomial *qp);
929         __isl_give isl_space *isl_qpolynomial_get_space(
930                 __isl_keep isl_qpolynomial *qp);
931         __isl_give isl_space *isl_qpolynomial_fold_get_space(
932                 __isl_keep isl_qpolynomial_fold *fold);
933         __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
934                 __isl_keep isl_pw_qpolynomial *pwqp);
935         __isl_give isl_space *isl_pw_qpolynomial_get_space(
936                 __isl_keep isl_pw_qpolynomial *pwqp);
937         __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
938                 __isl_keep isl_pw_qpolynomial_fold *pwf);
939         __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
940                 __isl_keep isl_pw_qpolynomial_fold *pwf);
941         __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
942                 __isl_keep isl_union_pw_qpolynomial *upwqp);
943         __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
944                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
946         #include <isl/val.h>
947         __isl_give isl_space *isl_multi_val_get_space(
948                 __isl_keep isl_multi_val *mv);
950         #include <isl/aff.h>
951         __isl_give isl_space *isl_aff_get_domain_space(
952                 __isl_keep isl_aff *aff);
953         __isl_give isl_space *isl_aff_get_space(
954                 __isl_keep isl_aff *aff);
955         __isl_give isl_space *isl_pw_aff_get_domain_space(
956                 __isl_keep isl_pw_aff *pwaff);
957         __isl_give isl_space *isl_pw_aff_get_space(
958                 __isl_keep isl_pw_aff *pwaff);
959         __isl_give isl_space *isl_multi_aff_get_domain_space(
960                 __isl_keep isl_multi_aff *maff);
961         __isl_give isl_space *isl_multi_aff_get_space(
962                 __isl_keep isl_multi_aff *maff);
963         __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
964                 __isl_keep isl_pw_multi_aff *pma);
965         __isl_give isl_space *isl_pw_multi_aff_get_space(
966                 __isl_keep isl_pw_multi_aff *pma);
967         __isl_give isl_space *isl_union_pw_aff_get_space(
968                 __isl_keep isl_union_pw_aff *upa);
969         __isl_give isl_space *isl_union_pw_multi_aff_get_space(
970                 __isl_keep isl_union_pw_multi_aff *upma);
971         __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
972                 __isl_keep isl_multi_pw_aff *mpa);
973         __isl_give isl_space *isl_multi_pw_aff_get_space(
974                 __isl_keep isl_multi_pw_aff *mpa);
975         __isl_give isl_space *
976         isl_multi_union_pw_aff_get_domain_space(
977                 __isl_keep isl_multi_union_pw_aff *mupa);
978         __isl_give isl_space *
979         isl_multi_union_pw_aff_get_space(
980                 __isl_keep isl_multi_union_pw_aff *mupa);
982         #include <isl/point.h>
983         __isl_give isl_space *isl_point_get_space(
984                 __isl_keep isl_point *pnt);
986 The number of dimensions of a given type of space
987 may be read off from a space or an object that lives
988 in a space using the following functions.
989 In case of C<isl_space_dim>, type may be
990 C<isl_dim_param>, C<isl_dim_in> (only for relations),
991 C<isl_dim_out> (only for relations), C<isl_dim_set>
992 (only for sets) or C<isl_dim_all>.
994         #include <isl/space.h>
995         unsigned isl_space_dim(__isl_keep isl_space *space,
996                 enum isl_dim_type type);
998         #include <isl/local_space.h>
999         int isl_local_space_dim(__isl_keep isl_local_space *ls,
1000                 enum isl_dim_type type);
1002         #include <isl/set.h>
1003         unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1004                 enum isl_dim_type type);
1005         unsigned isl_set_dim(__isl_keep isl_set *set,
1006                 enum isl_dim_type type);
1008         #include <isl/union_set.h>
1009         unsigned isl_union_set_dim(__isl_keep isl_union_set *uset,
1010                 enum isl_dim_type type);
1012         #include <isl/map.h>
1013         unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1014                 enum isl_dim_type type);
1015         unsigned isl_map_dim(__isl_keep isl_map *map,
1016                 enum isl_dim_type type);
1018         #include <isl/union_map.h>
1019         unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
1020                 enum isl_dim_type type);
1022         #include <isl/val.h>
1023         unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1024                 enum isl_dim_type type);
1026         #include <isl/aff.h>
1027         int isl_aff_dim(__isl_keep isl_aff *aff,
1028                 enum isl_dim_type type);
1029         unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1030                 enum isl_dim_type type);
1031         unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1032                 enum isl_dim_type type);
1033         unsigned isl_pw_multi_aff_dim(
1034                 __isl_keep isl_pw_multi_aff *pma,
1035                 enum isl_dim_type type);
1036         unsigned isl_multi_pw_aff_dim(
1037                 __isl_keep isl_multi_pw_aff *mpa,
1038                 enum isl_dim_type type);
1039         unsigned isl_union_pw_aff_dim(
1040                 __isl_keep isl_union_pw_aff *upa,
1041                 enum isl_dim_type type);
1042         unsigned isl_union_pw_multi_aff_dim(
1043                 __isl_keep isl_union_pw_multi_aff *upma,
1044                 enum isl_dim_type type);
1045         unsigned isl_multi_union_pw_aff_dim(
1046                 __isl_keep isl_multi_union_pw_aff *mupa,
1047                 enum isl_dim_type type);
1049         #include <isl/polynomial.h>
1050         unsigned isl_union_pw_qpolynomial_dim(
1051                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1052                 enum isl_dim_type type);
1053         unsigned isl_union_pw_qpolynomial_fold_dim(
1054                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1055                 enum isl_dim_type type);
1057 Note that an C<isl_union_set>, an C<isl_union_map>,
1058 an C<isl_union_pw_multi_aff>,
1059 an C<isl_union_pw_qpolynomial> and
1060 an C<isl_union_pw_qpolynomial_fold>
1061 only have parameters.
1063 The identifiers or names of the individual dimensions of spaces
1064 may be set or read off using the following functions on spaces
1065 or objects that live in spaces.
1066 These functions are mostly useful to obtain the identifiers, positions
1067 or names of the parameters.  Identifiers of individual dimensions are
1068 essentially only useful for printing.  They are ignored by all other
1069 operations and may not be preserved across those operations.
1071         #include <isl/space.h>
1072         __isl_give isl_space *isl_space_set_dim_id(
1073                 __isl_take isl_space *space,
1074                 enum isl_dim_type type, unsigned pos,
1075                 __isl_take isl_id *id);
1076         int isl_space_has_dim_id(__isl_keep isl_space *space,
1077                 enum isl_dim_type type, unsigned pos);
1078         __isl_give isl_id *isl_space_get_dim_id(
1079                 __isl_keep isl_space *space,
1080                 enum isl_dim_type type, unsigned pos);
1081         __isl_give isl_space *isl_space_set_dim_name(
1082                 __isl_take isl_space *space,
1083                  enum isl_dim_type type, unsigned pos,
1084                  __isl_keep const char *name);
1085         int isl_space_has_dim_name(__isl_keep isl_space *space,
1086                 enum isl_dim_type type, unsigned pos);
1087         __isl_keep const char *isl_space_get_dim_name(
1088                 __isl_keep isl_space *space,
1089                 enum isl_dim_type type, unsigned pos);
1091         #include <isl/local_space.h>
1092         __isl_give isl_local_space *isl_local_space_set_dim_id(
1093                 __isl_take isl_local_space *ls,
1094                 enum isl_dim_type type, unsigned pos,
1095                 __isl_take isl_id *id);
1096         int isl_local_space_has_dim_id(
1097                 __isl_keep isl_local_space *ls,
1098                 enum isl_dim_type type, unsigned pos);
1099         __isl_give isl_id *isl_local_space_get_dim_id(
1100                 __isl_keep isl_local_space *ls,
1101                 enum isl_dim_type type, unsigned pos);
1102         __isl_give isl_local_space *isl_local_space_set_dim_name(
1103                 __isl_take isl_local_space *ls,
1104                 enum isl_dim_type type, unsigned pos, const char *s);
1105         int isl_local_space_has_dim_name(
1106                 __isl_keep isl_local_space *ls,
1107                 enum isl_dim_type type, unsigned pos)
1108         const char *isl_local_space_get_dim_name(
1109                 __isl_keep isl_local_space *ls,
1110                 enum isl_dim_type type, unsigned pos);
1112         #include <isl/constraint.h>
1113         const char *isl_constraint_get_dim_name(
1114                 __isl_keep isl_constraint *constraint,
1115                 enum isl_dim_type type, unsigned pos);
1117         #include <isl/set.h>
1118         __isl_give isl_id *isl_basic_set_get_dim_id(
1119                 __isl_keep isl_basic_set *bset,
1120                 enum isl_dim_type type, unsigned pos);
1121         __isl_give isl_set *isl_set_set_dim_id(
1122                 __isl_take isl_set *set, enum isl_dim_type type,
1123                 unsigned pos, __isl_take isl_id *id);
1124         int isl_set_has_dim_id(__isl_keep isl_set *set,
1125                 enum isl_dim_type type, unsigned pos);
1126         __isl_give isl_id *isl_set_get_dim_id(
1127                 __isl_keep isl_set *set, enum isl_dim_type type,
1128                 unsigned pos);
1129         const char *isl_basic_set_get_dim_name(
1130                 __isl_keep isl_basic_set *bset,
1131                 enum isl_dim_type type, unsigned pos);
1132         int isl_set_has_dim_name(__isl_keep isl_set *set,
1133                 enum isl_dim_type type, unsigned pos);
1134         const char *isl_set_get_dim_name(
1135                 __isl_keep isl_set *set,
1136                 enum isl_dim_type type, unsigned pos);
1138         #include <isl/map.h>
1139         __isl_give isl_map *isl_map_set_dim_id(
1140                 __isl_take isl_map *map, enum isl_dim_type type,
1141                 unsigned pos, __isl_take isl_id *id);
1142         int isl_basic_map_has_dim_id(
1143                 __isl_keep isl_basic_map *bmap,
1144                 enum isl_dim_type type, unsigned pos);
1145         int isl_map_has_dim_id(__isl_keep isl_map *map,
1146                 enum isl_dim_type type, unsigned pos);
1147         __isl_give isl_id *isl_map_get_dim_id(
1148                 __isl_keep isl_map *map, enum isl_dim_type type,
1149                 unsigned pos);
1150         __isl_give isl_id *isl_union_map_get_dim_id(
1151                 __isl_keep isl_union_map *umap,
1152                 enum isl_dim_type type, unsigned pos);
1153         const char *isl_basic_map_get_dim_name(
1154                 __isl_keep isl_basic_map *bmap,
1155                 enum isl_dim_type type, unsigned pos);
1156         int isl_map_has_dim_name(__isl_keep isl_map *map,
1157                 enum isl_dim_type type, unsigned pos);
1158         const char *isl_map_get_dim_name(
1159                 __isl_keep isl_map *map,
1160                 enum isl_dim_type type, unsigned pos);
1162         #include <isl/val.h>
1163         __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1164                 __isl_take isl_multi_val *mv,
1165                 enum isl_dim_type type, unsigned pos,
1166                 __isl_take isl_id *id);
1167         __isl_give isl_id *isl_multi_val_get_dim_id(
1168                 __isl_keep isl_multi_val *mv,
1169                 enum isl_dim_type type, unsigned pos);
1170         __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1171                 __isl_take isl_multi_val *mv,
1172                 enum isl_dim_type type, unsigned pos, const char *s);
1174         #include <isl/aff.h>
1175         __isl_give isl_aff *isl_aff_set_dim_id(
1176                 __isl_take isl_aff *aff, enum isl_dim_type type,
1177                 unsigned pos, __isl_take isl_id *id);
1178         __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1179                 __isl_take isl_multi_aff *maff,
1180                 enum isl_dim_type type, unsigned pos,
1181                 __isl_take isl_id *id);
1182         __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1183                 __isl_take isl_pw_aff *pma,
1184                 enum isl_dim_type type, unsigned pos,
1185                 __isl_take isl_id *id);
1186         __isl_give isl_multi_pw_aff *
1187         isl_multi_pw_aff_set_dim_id(
1188                 __isl_take isl_multi_pw_aff *mpa,
1189                 enum isl_dim_type type, unsigned pos,
1190                 __isl_take isl_id *id);
1191         __isl_give isl_multi_union_pw_aff *
1192         isl_multi_union_pw_aff_set_dim_id(
1193                 __isl_take isl_multi_union_pw_aff *mupa,
1194                 enum isl_dim_type type, unsigned pos,
1195                 __isl_take isl_id *id);
1196         __isl_give isl_id *isl_multi_aff_get_dim_id(
1197                 __isl_keep isl_multi_aff *ma,
1198                 enum isl_dim_type type, unsigned pos);
1199         int isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1200                 enum isl_dim_type type, unsigned pos);
1201         __isl_give isl_id *isl_pw_aff_get_dim_id(
1202                 __isl_keep isl_pw_aff *pa,
1203                 enum isl_dim_type type, unsigned pos);
1204         __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1205                 __isl_keep isl_pw_multi_aff *pma,
1206                 enum isl_dim_type type, unsigned pos);
1207         __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1208                 __isl_keep isl_multi_pw_aff *mpa,
1209                 enum isl_dim_type type, unsigned pos);
1210         __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1211                 __isl_keep isl_multi_union_pw_aff *mupa,
1212                 enum isl_dim_type type, unsigned pos);
1213         __isl_give isl_aff *isl_aff_set_dim_name(
1214                 __isl_take isl_aff *aff, enum isl_dim_type type,
1215                 unsigned pos, const char *s);
1216         __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1217                 __isl_take isl_multi_aff *maff,
1218                 enum isl_dim_type type, unsigned pos, const char *s);
1219         __isl_give isl_multi_pw_aff *
1220         isl_multi_pw_aff_set_dim_name(
1221                 __isl_take isl_multi_pw_aff *mpa,
1222                 enum isl_dim_type type, unsigned pos, const char *s);
1223         __isl_give isl_union_pw_aff *
1224         isl_union_pw_aff_set_dim_name(
1225                 __isl_take isl_union_pw_aff *upa,
1226                 enum isl_dim_type type, unsigned pos,
1227                 const char *s);
1228         __isl_give isl_union_pw_multi_aff *
1229         isl_union_pw_multi_aff_set_dim_name(
1230                 __isl_take isl_union_pw_multi_aff *upma,
1231                 enum isl_dim_type type, unsigned pos,
1232                 const char *s);
1233         __isl_give isl_multi_union_pw_aff *
1234         isl_multi_union_pw_aff_set_dim_name(
1235                 __isl_take isl_multi_union_pw_aff *mupa,
1236                 enum isl_dim_type type, unsigned pos,
1237         const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1238                 enum isl_dim_type type, unsigned pos);
1239         const char *isl_pw_aff_get_dim_name(
1240                 __isl_keep isl_pw_aff *pa,
1241                 enum isl_dim_type type, unsigned pos);
1242         const char *isl_pw_multi_aff_get_dim_name(
1243                 __isl_keep isl_pw_multi_aff *pma,
1244                 enum isl_dim_type type, unsigned pos);
1246         #include <isl/polynomial.h>
1247         __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1248                 __isl_take isl_qpolynomial *qp,
1249                 enum isl_dim_type type, unsigned pos,
1250                 const char *s);
1251         __isl_give isl_pw_qpolynomial *
1252         isl_pw_qpolynomial_set_dim_name(
1253                 __isl_take isl_pw_qpolynomial *pwqp,
1254                 enum isl_dim_type type, unsigned pos,
1255                 const char *s);
1256         __isl_give isl_pw_qpolynomial_fold *
1257         isl_pw_qpolynomial_fold_set_dim_name(
1258                 __isl_take isl_pw_qpolynomial_fold *pwf,
1259                 enum isl_dim_type type, unsigned pos,
1260                 const char *s);
1261         __isl_give isl_union_pw_qpolynomial *
1262         isl_union_pw_qpolynomial_set_dim_name(
1263                 __isl_take isl_union_pw_qpolynomial *upwqp,
1264                 enum isl_dim_type type, unsigned pos,
1265                 const char *s);
1266         __isl_give isl_union_pw_qpolynomial_fold *
1267         isl_union_pw_qpolynomial_fold_set_dim_name(
1268                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1269                 enum isl_dim_type type, unsigned pos,
1270                 const char *s);
1272 Note that C<isl_space_get_name> returns a pointer to some internal
1273 data structure, so the result can only be used while the
1274 corresponding C<isl_space> is alive.
1275 Also note that every function that operates on two sets or relations
1276 requires that both arguments have the same parameters.  This also
1277 means that if one of the arguments has named parameters, then the
1278 other needs to have named parameters too and the names need to match.
1279 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1280 arguments may have different parameters (as long as they are named),
1281 in which case the result will have as parameters the union of the parameters of
1282 the arguments.
1284 Given the identifier or name of a dimension (typically a parameter),
1285 its position can be obtained from the following functions.
1287         #include <isl/space.h>
1288         int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1289                 enum isl_dim_type type, __isl_keep isl_id *id);
1290         int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1291                 enum isl_dim_type type, const char *name);
1293         #include <isl/local_space.h>
1294         int isl_local_space_find_dim_by_name(
1295                 __isl_keep isl_local_space *ls,
1296                 enum isl_dim_type type, const char *name);
1298         #include <isl/val.h>
1299         int isl_multi_val_find_dim_by_id(
1300                 __isl_keep isl_multi_val *mv,
1301                 enum isl_dim_type type, __isl_keep isl_id *id);
1302         int isl_multi_val_find_dim_by_name(
1303                 __isl_keep isl_multi_val *mv,
1304                 enum isl_dim_type type, const char *name);
1306         #include <isl/set.h>
1307         int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1308                 enum isl_dim_type type, __isl_keep isl_id *id);
1309         int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1310                 enum isl_dim_type type, const char *name);
1312         #include <isl/map.h>
1313         int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1314                 enum isl_dim_type type, __isl_keep isl_id *id);
1315         int isl_basic_map_find_dim_by_name(
1316                 __isl_keep isl_basic_map *bmap,
1317                 enum isl_dim_type type, const char *name);
1318         int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1319                 enum isl_dim_type type, const char *name);
1320         int isl_union_map_find_dim_by_name(
1321                 __isl_keep isl_union_map *umap,
1322                 enum isl_dim_type type, const char *name);
1324         #include <isl/aff.h>
1325         int isl_multi_aff_find_dim_by_id(
1326                 __isl_keep isl_multi_aff *ma,
1327                 enum isl_dim_type type, __isl_keep isl_id *id);
1328         int isl_multi_pw_aff_find_dim_by_id(
1329                 __isl_keep isl_multi_pw_aff *mpa,
1330                 enum isl_dim_type type, __isl_keep isl_id *id);
1331         int isl_multi_union_pw_aff_find_dim_by_id(
1332                 __isl_keep isl_union_multi_pw_aff *mupa,
1333                 enum isl_dim_type type, __isl_keep isl_id *id);
1334         int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1335                 enum isl_dim_type type, const char *name);
1336         int isl_multi_aff_find_dim_by_name(
1337                 __isl_keep isl_multi_aff *ma,
1338                 enum isl_dim_type type, const char *name);
1339         int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1340                 enum isl_dim_type type, const char *name);
1341         int isl_multi_pw_aff_find_dim_by_name(
1342                 __isl_keep isl_multi_pw_aff *mpa,
1343                 enum isl_dim_type type, const char *name);
1344         int isl_pw_multi_aff_find_dim_by_name(
1345                 __isl_keep isl_pw_multi_aff *pma,
1346                 enum isl_dim_type type, const char *name);
1347         int isl_union_pw_aff_find_dim_by_name(
1348                 __isl_keep isl_union_pw_aff *upa,
1349                 enum isl_dim_type type, const char *name);
1350         int isl_union_pw_multi_aff_find_dim_by_name(
1351                 __isl_keep isl_union_pw_multi_aff *upma,
1352                 enum isl_dim_type type, const char *name);
1353         int isl_multi_union_pw_aff_find_dim_by_name(
1354                 __isl_keep isl_multi_union_pw_aff *mupa,
1355                 enum isl_dim_type type, const char *name);
1357         #include <isl/polynomial.h>
1358         int isl_pw_qpolynomial_find_dim_by_name(
1359                 __isl_keep isl_pw_qpolynomial *pwqp,
1360                 enum isl_dim_type type, const char *name);
1361         int isl_pw_qpolynomial_fold_find_dim_by_name(
1362                 __isl_keep isl_pw_qpolynomial_fold *pwf,
1363                 enum isl_dim_type type, const char *name);
1364         int isl_union_pw_qpolynomial_find_dim_by_name(
1365                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1366                 enum isl_dim_type type, const char *name);
1367         int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1368                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1369                 enum isl_dim_type type, const char *name);
1371 The identifiers or names of entire spaces may be set or read off
1372 using the following functions.
1374         #include <isl/space.h>
1375         __isl_give isl_space *isl_space_set_tuple_id(
1376                 __isl_take isl_space *space,
1377                 enum isl_dim_type type, __isl_take isl_id *id);
1378         __isl_give isl_space *isl_space_reset_tuple_id(
1379                 __isl_take isl_space *space, enum isl_dim_type type);
1380         int isl_space_has_tuple_id(__isl_keep isl_space *space,
1381                 enum isl_dim_type type);
1382         __isl_give isl_id *isl_space_get_tuple_id(
1383                 __isl_keep isl_space *space, enum isl_dim_type type);
1384         __isl_give isl_space *isl_space_set_tuple_name(
1385                 __isl_take isl_space *space,
1386                 enum isl_dim_type type, const char *s);
1387         int isl_space_has_tuple_name(__isl_keep isl_space *space,
1388                 enum isl_dim_type type);
1389         const char *isl_space_get_tuple_name(__isl_keep isl_space *space,
1390                 enum isl_dim_type type);
1392         #include <isl/local_space.h>
1393         __isl_give isl_local_space *isl_local_space_set_tuple_id(
1394                 __isl_take isl_local_space *ls,
1395                 enum isl_dim_type type, __isl_take isl_id *id);
1397         #include <isl/set.h>
1398         __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1399                 __isl_take isl_basic_set *bset,
1400                 __isl_take isl_id *id);
1401         __isl_give isl_set *isl_set_set_tuple_id(
1402                 __isl_take isl_set *set, __isl_take isl_id *id);
1403         __isl_give isl_set *isl_set_reset_tuple_id(
1404                 __isl_take isl_set *set);
1405         int isl_set_has_tuple_id(__isl_keep isl_set *set);
1406         __isl_give isl_id *isl_set_get_tuple_id(
1407                 __isl_keep isl_set *set);
1408         __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1409                 __isl_take isl_basic_set *set, const char *s);
1410         __isl_give isl_set *isl_set_set_tuple_name(
1411                 __isl_take isl_set *set, const char *s);
1412         const char *isl_basic_set_get_tuple_name(
1413                 __isl_keep isl_basic_set *bset);
1414         int isl_set_has_tuple_name(__isl_keep isl_set *set);
1415         const char *isl_set_get_tuple_name(
1416                 __isl_keep isl_set *set);
1418         #include <isl/map.h>
1419         __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1420                 __isl_take isl_basic_map *bmap,
1421                 enum isl_dim_type type, __isl_take isl_id *id);
1422         __isl_give isl_map *isl_map_set_tuple_id(
1423                 __isl_take isl_map *map, enum isl_dim_type type,
1424                 __isl_take isl_id *id);
1425         __isl_give isl_map *isl_map_reset_tuple_id(
1426                 __isl_take isl_map *map, enum isl_dim_type type);
1427         int isl_map_has_tuple_id(__isl_keep isl_map *map,
1428                 enum isl_dim_type type);
1429         __isl_give isl_id *isl_map_get_tuple_id(
1430                 __isl_keep isl_map *map, enum isl_dim_type type);
1431         __isl_give isl_map *isl_map_set_tuple_name(
1432                 __isl_take isl_map *map,
1433                 enum isl_dim_type type, const char *s);
1434         const char *isl_basic_map_get_tuple_name(
1435                 __isl_keep isl_basic_map *bmap,
1436                 enum isl_dim_type type);
1437         __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1438                 __isl_take isl_basic_map *bmap,
1439                 enum isl_dim_type type, const char *s);
1440         int isl_map_has_tuple_name(__isl_keep isl_map *map,
1441                 enum isl_dim_type type);
1442         const char *isl_map_get_tuple_name(
1443                 __isl_keep isl_map *map,
1444                 enum isl_dim_type type);
1446         #include <isl/val.h>
1447         __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1448                 __isl_take isl_multi_val *mv,
1449                 enum isl_dim_type type, __isl_take isl_id *id);
1450         __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1451                 __isl_take isl_multi_val *mv,
1452                 enum isl_dim_type type);
1453         int isl_multi_val_has_tuple_id(__isl_keep isl_multi_val *mv,
1454                 enum isl_dim_type type);
1455         __isl_give isl_id *isl_multi_val_get_tuple_id(
1456                 __isl_keep isl_multi_val *mv,
1457                 enum isl_dim_type type);
1458         __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1459                 __isl_take isl_multi_val *mv,
1460                 enum isl_dim_type type, const char *s);
1461         const char *isl_multi_val_get_tuple_name(
1462                 __isl_keep isl_multi_val *mv,
1463                 enum isl_dim_type type);
1465         #include <isl/aff.h>
1466         __isl_give isl_aff *isl_aff_set_tuple_id(
1467                 __isl_take isl_aff *aff,
1468                 enum isl_dim_type type, __isl_take isl_id *id);
1469         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1470                 __isl_take isl_multi_aff *maff,
1471                 enum isl_dim_type type, __isl_take isl_id *id);
1472         __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1473                 __isl_take isl_pw_aff *pwaff,
1474                 enum isl_dim_type type, __isl_take isl_id *id);
1475         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1476                 __isl_take isl_pw_multi_aff *pma,
1477                 enum isl_dim_type type, __isl_take isl_id *id);
1478         __isl_give isl_multi_union_pw_aff *
1479         isl_multi_union_pw_aff_set_tuple_id(
1480                 __isl_take isl_multi_union_pw_aff *mupa,
1481                 enum isl_dim_type type, __isl_take isl_id *id);
1482         __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1483                 __isl_take isl_multi_aff *ma,
1484                 enum isl_dim_type type);
1485         __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1486                 __isl_take isl_pw_aff *pa,
1487                 enum isl_dim_type type);
1488         __isl_give isl_multi_pw_aff *
1489         isl_multi_pw_aff_reset_tuple_id(
1490                 __isl_take isl_multi_pw_aff *mpa,
1491                 enum isl_dim_type type);
1492         __isl_give isl_pw_multi_aff *
1493         isl_pw_multi_aff_reset_tuple_id(
1494                 __isl_take isl_pw_multi_aff *pma,
1495                 enum isl_dim_type type);
1496         __isl_give isl_multi_union_pw_aff *
1497         isl_multi_union_pw_aff_reset_tuple_id(
1498                 __isl_take isl_multi_union_pw_aff *mupa,
1499                 enum isl_dim_type type);
1500         int isl_multi_aff_has_tuple_id(__isl_keep isl_multi_aff *ma,
1501                 enum isl_dim_type type);
1502         __isl_give isl_id *isl_multi_aff_get_tuple_id(
1503                 __isl_keep isl_multi_aff *ma,
1504                 enum isl_dim_type type);
1505         int isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1506                 enum isl_dim_type type);
1507         __isl_give isl_id *isl_pw_aff_get_tuple_id(
1508                 __isl_keep isl_pw_aff *pa,
1509                 enum isl_dim_type type);
1510         int isl_pw_multi_aff_has_tuple_id(
1511                 __isl_keep isl_pw_multi_aff *pma,
1512                 enum isl_dim_type type);
1513         __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1514                 __isl_keep isl_pw_multi_aff *pma,
1515                 enum isl_dim_type type);
1516         int isl_multi_pw_aff_has_tuple_id(
1517                 __isl_keep isl_multi_pw_aff *mpa,
1518                 enum isl_dim_type type);
1519         __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1520                 __isl_keep isl_multi_pw_aff *mpa,
1521                 enum isl_dim_type type);
1522         int isl_multi_union_pw_aff_has_tuple_id(
1523                 __isl_keep isl_multi_union_pw_aff *mupa,
1524                 enum isl_dim_type type);
1525         __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1526                 __isl_keep isl_multi_union_pw_aff *mupa,
1527                 enum isl_dim_type type);
1528         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1529                 __isl_take isl_multi_aff *maff,
1530                 enum isl_dim_type type, const char *s);
1531         __isl_give isl_multi_pw_aff *
1532         isl_multi_pw_aff_set_tuple_name(
1533                 __isl_take isl_multi_pw_aff *mpa,
1534                 enum isl_dim_type type, const char *s);
1535         __isl_give isl_multi_union_pw_aff *
1536         isl_multi_union_pw_aff_set_tuple_name(
1537                 __isl_take isl_multi_union_pw_aff *mupa,
1538                 enum isl_dim_type type, const char *s);
1539         const char *isl_multi_aff_get_tuple_name(
1540                 __isl_keep isl_multi_aff *multi,
1541                 enum isl_dim_type type);
1542         int isl_pw_multi_aff_has_tuple_name(
1543                 __isl_keep isl_pw_multi_aff *pma,
1544                 enum isl_dim_type type);
1545         const char *isl_pw_multi_aff_get_tuple_name(
1546                 __isl_keep isl_pw_multi_aff *pma,
1547                 enum isl_dim_type type);
1548         const char *isl_multi_union_pw_aff_get_tuple_name(
1549                 __isl_keep isl_multi_union_pw_aff *mupa,
1550                 enum isl_dim_type type);
1552 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1553 or C<isl_dim_set>.  As with C<isl_space_get_name>,
1554 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1555 data structure.
1556 Binary operations require the corresponding spaces of their arguments
1557 to have the same name.
1559 To keep the names of all parameters and tuples, but reset the user pointers
1560 of all the corresponding identifiers, use the following function.
1562         #include <isl/space.h>
1563         __isl_give isl_space *isl_space_reset_user(
1564                 __isl_take isl_space *space);
1566         #include <isl/set.h>
1567         __isl_give isl_set *isl_set_reset_user(
1568                 __isl_take isl_set *set);
1570         #include <isl/map.h>
1571         __isl_give isl_map *isl_map_reset_user(
1572                 __isl_take isl_map *map);
1574         #include <isl/union_set.h>
1575         __isl_give isl_union_set *isl_union_set_reset_user(
1576                 __isl_take isl_union_set *uset);
1578         #include <isl/union_map.h>
1579         __isl_give isl_union_map *isl_union_map_reset_user(
1580                 __isl_take isl_union_map *umap);
1582         #include <isl/val.h>
1583         __isl_give isl_multi_val *isl_multi_val_reset_user(
1584                 __isl_take isl_multi_val *mv);
1586         #include <isl/aff.h>
1587         __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1588                 __isl_take isl_multi_aff *ma);
1589         __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1590                 __isl_take isl_pw_aff *pa);
1591         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1592                 __isl_take isl_multi_pw_aff *mpa);
1593         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1594                 __isl_take isl_pw_multi_aff *pma);
1595         __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1596                 __isl_take isl_union_pw_aff *upa);
1597         __isl_give isl_multi_union_pw_aff *
1598         isl_multi_union_pw_aff_reset_user(
1599                 __isl_take isl_multi_union_pw_aff *mupa);
1600         __isl_give isl_union_pw_multi_aff *
1601         isl_union_pw_multi_aff_reset_user(
1602                 __isl_take isl_union_pw_multi_aff *upma);
1604         #include <isl/polynomial.h>
1605         __isl_give isl_pw_qpolynomial *
1606         isl_pw_qpolynomial_reset_user(
1607                 __isl_take isl_pw_qpolynomial *pwqp);
1608         __isl_give isl_union_pw_qpolynomial *
1609         isl_union_pw_qpolynomial_reset_user(
1610                 __isl_take isl_union_pw_qpolynomial *upwqp);
1611         __isl_give isl_pw_qpolynomial_fold *
1612         isl_pw_qpolynomial_fold_reset_user(
1613                 __isl_take isl_pw_qpolynomial_fold *pwf);
1614         __isl_give isl_union_pw_qpolynomial_fold *
1615         isl_union_pw_qpolynomial_fold_reset_user(
1616                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1618 Spaces can be nested.  In particular, the domain of a set or
1619 the domain or range of a relation can be a nested relation.
1620 This process is also called I<wrapping>.
1621 The functions for detecting, constructing and deconstructing
1622 such nested spaces can be found in the wrapping properties
1623 of L</"Unary Properties">, the wrapping operations
1624 of L</"Unary Operations"> and the Cartesian product operations
1625 of L</"Basic Operations">.
1627 Spaces can be created from other spaces
1628 using the functions described in L</"Unary Operations">
1629 and L</"Binary Operations">.
1631 =head2 Local Spaces
1633 A local space is essentially a space with
1634 zero or more existentially quantified variables.
1635 The local space of various objects can be obtained
1636 using the following functions.
1638         #include <isl/constraint.h>
1639         __isl_give isl_local_space *isl_constraint_get_local_space(
1640                 __isl_keep isl_constraint *constraint);
1642         #include <isl/set.h>
1643         __isl_give isl_local_space *isl_basic_set_get_local_space(
1644                 __isl_keep isl_basic_set *bset);
1646         #include <isl/map.h>
1647         __isl_give isl_local_space *isl_basic_map_get_local_space(
1648                 __isl_keep isl_basic_map *bmap);
1650         #include <isl/aff.h>
1651         __isl_give isl_local_space *isl_aff_get_domain_local_space(
1652                 __isl_keep isl_aff *aff);
1653         __isl_give isl_local_space *isl_aff_get_local_space(
1654                 __isl_keep isl_aff *aff);
1656 A new local space can be created from a space using
1658         #include <isl/local_space.h>
1659         __isl_give isl_local_space *isl_local_space_from_space(
1660                 __isl_take isl_space *space);
1662 They can be inspected, modified, copied and freed using the following functions.
1664         #include <isl/local_space.h>
1665         int isl_local_space_is_params(
1666                 __isl_keep isl_local_space *ls);
1667         int isl_local_space_is_set(__isl_keep isl_local_space *ls);
1668         __isl_give isl_space *isl_local_space_get_space(
1669                 __isl_keep isl_local_space *ls);
1670         __isl_give isl_aff *isl_local_space_get_div(
1671                 __isl_keep isl_local_space *ls, int pos);
1672         __isl_give isl_local_space *isl_local_space_copy(
1673                 __isl_keep isl_local_space *ls);
1674         __isl_null isl_local_space *isl_local_space_free(
1675                 __isl_take isl_local_space *ls);
1677 Note that C<isl_local_space_get_div> can only be used on local spaces
1678 of sets.
1680 Two local spaces can be compared using
1682         int isl_local_space_is_equal(__isl_keep isl_local_space *ls1,
1683                 __isl_keep isl_local_space *ls2);
1685 Local spaces can be created from other local spaces
1686 using the functions described in L</"Unary Operations">
1687 and L</"Binary Operations">.
1689 =head2 Creating New Sets and Relations
1691 C<isl> has functions for creating some standard sets and relations.
1693 =over
1695 =item * Empty sets and relations
1697         __isl_give isl_basic_set *isl_basic_set_empty(
1698                 __isl_take isl_space *space);
1699         __isl_give isl_basic_map *isl_basic_map_empty(
1700                 __isl_take isl_space *space);
1701         __isl_give isl_set *isl_set_empty(
1702                 __isl_take isl_space *space);
1703         __isl_give isl_map *isl_map_empty(
1704                 __isl_take isl_space *space);
1705         __isl_give isl_union_set *isl_union_set_empty(
1706                 __isl_take isl_space *space);
1707         __isl_give isl_union_map *isl_union_map_empty(
1708                 __isl_take isl_space *space);
1710 For C<isl_union_set>s and C<isl_union_map>s, the space
1711 is only used to specify the parameters.
1713 =item * Universe sets and relations
1715         __isl_give isl_basic_set *isl_basic_set_universe(
1716                 __isl_take isl_space *space);
1717         __isl_give isl_basic_map *isl_basic_map_universe(
1718                 __isl_take isl_space *space);
1719         __isl_give isl_set *isl_set_universe(
1720                 __isl_take isl_space *space);
1721         __isl_give isl_map *isl_map_universe(
1722                 __isl_take isl_space *space);
1723         __isl_give isl_union_set *isl_union_set_universe(
1724                 __isl_take isl_union_set *uset);
1725         __isl_give isl_union_map *isl_union_map_universe(
1726                 __isl_take isl_union_map *umap);
1728 The sets and relations constructed by the functions above
1729 contain all integer values, while those constructed by the
1730 functions below only contain non-negative values.
1732         __isl_give isl_basic_set *isl_basic_set_nat_universe(
1733                 __isl_take isl_space *space);
1734         __isl_give isl_basic_map *isl_basic_map_nat_universe(
1735                 __isl_take isl_space *space);
1736         __isl_give isl_set *isl_set_nat_universe(
1737                 __isl_take isl_space *space);
1738         __isl_give isl_map *isl_map_nat_universe(
1739                 __isl_take isl_space *space);
1741 =item * Identity relations
1743         __isl_give isl_basic_map *isl_basic_map_identity(
1744                 __isl_take isl_space *space);
1745         __isl_give isl_map *isl_map_identity(
1746                 __isl_take isl_space *space);
1748 The number of input and output dimensions in C<space> needs
1749 to be the same.
1751 =item * Lexicographic order
1753         __isl_give isl_map *isl_map_lex_lt(
1754                 __isl_take isl_space *set_space);
1755         __isl_give isl_map *isl_map_lex_le(
1756                 __isl_take isl_space *set_space);
1757         __isl_give isl_map *isl_map_lex_gt(
1758                 __isl_take isl_space *set_space);
1759         __isl_give isl_map *isl_map_lex_ge(
1760                 __isl_take isl_space *set_space);
1761         __isl_give isl_map *isl_map_lex_lt_first(
1762                 __isl_take isl_space *space, unsigned n);
1763         __isl_give isl_map *isl_map_lex_le_first(
1764                 __isl_take isl_space *space, unsigned n);
1765         __isl_give isl_map *isl_map_lex_gt_first(
1766                 __isl_take isl_space *space, unsigned n);
1767         __isl_give isl_map *isl_map_lex_ge_first(
1768                 __isl_take isl_space *space, unsigned n);
1770 The first four functions take a space for a B<set>
1771 and return relations that express that the elements in the domain
1772 are lexicographically less
1773 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1774 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1775 than the elements in the range.
1776 The last four functions take a space for a map
1777 and return relations that express that the first C<n> dimensions
1778 in the domain are lexicographically less
1779 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1780 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1781 than the first C<n> dimensions in the range.
1783 =back
1785 A basic set or relation can be converted to a set or relation
1786 using the following functions.
1788         __isl_give isl_set *isl_set_from_basic_set(
1789                 __isl_take isl_basic_set *bset);
1790         __isl_give isl_map *isl_map_from_basic_map(
1791                 __isl_take isl_basic_map *bmap);
1793 Sets and relations can be converted to union sets and relations
1794 using the following functions.
1796         __isl_give isl_union_set *isl_union_set_from_basic_set(
1797                 __isl_take isl_basic_set *bset);
1798         __isl_give isl_union_map *isl_union_map_from_basic_map(
1799                 __isl_take isl_basic_map *bmap);
1800         __isl_give isl_union_set *isl_union_set_from_set(
1801                 __isl_take isl_set *set);
1802         __isl_give isl_union_map *isl_union_map_from_map(
1803                 __isl_take isl_map *map);
1805 The inverse conversions below can only be used if the input
1806 union set or relation is known to contain elements in exactly one
1807 space.
1809         __isl_give isl_set *isl_set_from_union_set(
1810                 __isl_take isl_union_set *uset);
1811         __isl_give isl_map *isl_map_from_union_map(
1812                 __isl_take isl_union_map *umap);
1814 Sets and relations can be copied and freed again using the following
1815 functions.
1817         __isl_give isl_basic_set *isl_basic_set_copy(
1818                 __isl_keep isl_basic_set *bset);
1819         __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1820         __isl_give isl_union_set *isl_union_set_copy(
1821                 __isl_keep isl_union_set *uset);
1822         __isl_give isl_basic_map *isl_basic_map_copy(
1823                 __isl_keep isl_basic_map *bmap);
1824         __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1825         __isl_give isl_union_map *isl_union_map_copy(
1826                 __isl_keep isl_union_map *umap);
1827         __isl_null isl_basic_set *isl_basic_set_free(
1828                 __isl_take isl_basic_set *bset);
1829         __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1830         __isl_null isl_union_set *isl_union_set_free(
1831                 __isl_take isl_union_set *uset);
1832         __isl_null isl_basic_map *isl_basic_map_free(
1833                 __isl_take isl_basic_map *bmap);
1834         __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1835         __isl_null isl_union_map *isl_union_map_free(
1836                 __isl_take isl_union_map *umap);
1838 Other sets and relations can be constructed by starting
1839 from a universe set or relation, adding equality and/or
1840 inequality constraints and then projecting out the
1841 existentially quantified variables, if any.
1842 Constraints can be constructed, manipulated and
1843 added to (or removed from) (basic) sets and relations
1844 using the following functions.
1846         #include <isl/constraint.h>
1847         __isl_give isl_constraint *isl_equality_alloc(
1848                 __isl_take isl_local_space *ls);
1849         __isl_give isl_constraint *isl_inequality_alloc(
1850                 __isl_take isl_local_space *ls);
1851         __isl_give isl_constraint *isl_constraint_set_constant_si(
1852                 __isl_take isl_constraint *constraint, int v);
1853         __isl_give isl_constraint *isl_constraint_set_constant_val(
1854                 __isl_take isl_constraint *constraint,
1855                 __isl_take isl_val *v);
1856         __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1857                 __isl_take isl_constraint *constraint,
1858                 enum isl_dim_type type, int pos, int v);
1859         __isl_give isl_constraint *
1860         isl_constraint_set_coefficient_val(
1861                 __isl_take isl_constraint *constraint,
1862                 enum isl_dim_type type, int pos,
1863                 __isl_take isl_val *v);
1864         __isl_give isl_basic_map *isl_basic_map_add_constraint(
1865                 __isl_take isl_basic_map *bmap,
1866                 __isl_take isl_constraint *constraint);
1867         __isl_give isl_basic_set *isl_basic_set_add_constraint(
1868                 __isl_take isl_basic_set *bset,
1869                 __isl_take isl_constraint *constraint);
1870         __isl_give isl_map *isl_map_add_constraint(
1871                 __isl_take isl_map *map,
1872                 __isl_take isl_constraint *constraint);
1873         __isl_give isl_set *isl_set_add_constraint(
1874                 __isl_take isl_set *set,
1875                 __isl_take isl_constraint *constraint);
1876         __isl_give isl_basic_set *isl_basic_set_drop_constraint(
1877                 __isl_take isl_basic_set *bset,
1878                 __isl_take isl_constraint *constraint);
1880 For example, to create a set containing the even integers
1881 between 10 and 42, you would use the following code.
1883         isl_space *space;
1884         isl_local_space *ls;
1885         isl_constraint *c;
1886         isl_basic_set *bset;
1888         space = isl_space_set_alloc(ctx, 0, 2);
1889         bset = isl_basic_set_universe(isl_space_copy(space));
1890         ls = isl_local_space_from_space(space);
1892         c = isl_equality_alloc(isl_local_space_copy(ls));
1893         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1894         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
1895         bset = isl_basic_set_add_constraint(bset, c);
1897         c = isl_inequality_alloc(isl_local_space_copy(ls));
1898         c = isl_constraint_set_constant_si(c, -10);
1899         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
1900         bset = isl_basic_set_add_constraint(bset, c);
1902         c = isl_inequality_alloc(ls);
1903         c = isl_constraint_set_constant_si(c, 42);
1904         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1905         bset = isl_basic_set_add_constraint(bset, c);
1907         bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
1909 Or, alternatively,
1911         isl_basic_set *bset;
1912         bset = isl_basic_set_read_from_str(ctx,
1913                 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
1915 A basic set or relation can also be constructed from two matrices
1916 describing the equalities and the inequalities.
1918         __isl_give isl_basic_set *isl_basic_set_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);
1924         __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
1925                 __isl_take isl_space *space,
1926                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1927                 enum isl_dim_type c1,
1928                 enum isl_dim_type c2, enum isl_dim_type c3,
1929                 enum isl_dim_type c4, enum isl_dim_type c5);
1931 The C<isl_dim_type> arguments indicate the order in which
1932 different kinds of variables appear in the input matrices
1933 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
1934 C<isl_dim_set> and C<isl_dim_div> for sets and
1935 of C<isl_dim_cst>, C<isl_dim_param>,
1936 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
1938 A (basic or union) set or relation can also be constructed from a
1939 (union) (piecewise) (multiple) affine expression
1940 or a list of affine expressions
1941 (See L</"Functions">).
1943         __isl_give isl_basic_map *isl_basic_map_from_aff(
1944                 __isl_take isl_aff *aff);
1945         __isl_give isl_map *isl_map_from_aff(
1946                 __isl_take isl_aff *aff);
1947         __isl_give isl_set *isl_set_from_pw_aff(
1948                 __isl_take isl_pw_aff *pwaff);
1949         __isl_give isl_map *isl_map_from_pw_aff(
1950                 __isl_take isl_pw_aff *pwaff);
1951         __isl_give isl_basic_map *isl_basic_map_from_aff_list(
1952                 __isl_take isl_space *domain_space,
1953                 __isl_take isl_aff_list *list);
1954         __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
1955                 __isl_take isl_multi_aff *maff)
1956         __isl_give isl_map *isl_map_from_multi_aff(
1957                 __isl_take isl_multi_aff *maff)
1958         __isl_give isl_set *isl_set_from_pw_multi_aff(
1959                 __isl_take isl_pw_multi_aff *pma);
1960         __isl_give isl_map *isl_map_from_pw_multi_aff(
1961                 __isl_take isl_pw_multi_aff *pma);
1962         __isl_give isl_set *isl_set_from_multi_pw_aff(
1963                 __isl_take isl_multi_pw_aff *mpa);
1964         __isl_give isl_map *isl_map_from_multi_pw_aff(
1965                 __isl_take isl_multi_pw_aff *mpa);
1966         __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
1967                 __isl_take isl_union_pw_aff *upa);
1968         __isl_give isl_union_map *
1969         isl_union_map_from_union_pw_multi_aff(
1970                 __isl_take isl_union_pw_multi_aff *upma);
1971         __isl_give isl_union_map *
1972         isl_union_map_from_multi_union_pw_aff(
1973                 __isl_take isl_multi_union_pw_aff *mupa);
1975 The C<domain_space> argument describes the domain of the resulting
1976 basic relation.  It is required because the C<list> may consist
1977 of zero affine expressions.
1978 The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
1979 is not allowed to be zero-dimensional.  The domain of the result
1980 is the shared domain of the union piecewise affine elements.
1982 =head2 Inspecting Sets and Relations
1984 Usually, the user should not have to care about the actual constraints
1985 of the sets and maps, but should instead apply the abstract operations
1986 explained in the following sections.
1987 Occasionally, however, it may be required to inspect the individual
1988 coefficients of the constraints.  This section explains how to do so.
1989 In these cases, it may also be useful to have C<isl> compute
1990 an explicit representation of the existentially quantified variables.
1992         __isl_give isl_set *isl_set_compute_divs(
1993                 __isl_take isl_set *set);
1994         __isl_give isl_map *isl_map_compute_divs(
1995                 __isl_take isl_map *map);
1996         __isl_give isl_union_set *isl_union_set_compute_divs(
1997                 __isl_take isl_union_set *uset);
1998         __isl_give isl_union_map *isl_union_map_compute_divs(
1999                 __isl_take isl_union_map *umap);
2001 This explicit representation defines the existentially quantified
2002 variables as integer divisions of the other variables, possibly
2003 including earlier existentially quantified variables.
2004 An explicitly represented existentially quantified variable therefore
2005 has a unique value when the values of the other variables are known.
2006 If, furthermore, the same existentials, i.e., existentials
2007 with the same explicit representations, should appear in the
2008 same order in each of the disjuncts of a set or map, then the user should call
2009 either of the following functions.
2011         __isl_give isl_set *isl_set_align_divs(
2012                 __isl_take isl_set *set);
2013         __isl_give isl_map *isl_map_align_divs(
2014                 __isl_take isl_map *map);
2016 Alternatively, the existentially quantified variables can be removed
2017 using the following functions, which compute an overapproximation.
2019         __isl_give isl_basic_set *isl_basic_set_remove_divs(
2020                 __isl_take isl_basic_set *bset);
2021         __isl_give isl_basic_map *isl_basic_map_remove_divs(
2022                 __isl_take isl_basic_map *bmap);
2023         __isl_give isl_set *isl_set_remove_divs(
2024                 __isl_take isl_set *set);
2025         __isl_give isl_map *isl_map_remove_divs(
2026                 __isl_take isl_map *map);
2028 It is also possible to only remove those divs that are defined
2029 in terms of a given range of dimensions or only those for which
2030 no explicit representation is known.
2032         __isl_give isl_basic_set *
2033         isl_basic_set_remove_divs_involving_dims(
2034                 __isl_take isl_basic_set *bset,
2035                 enum isl_dim_type type,
2036                 unsigned first, unsigned n);
2037         __isl_give isl_basic_map *
2038         isl_basic_map_remove_divs_involving_dims(
2039                 __isl_take isl_basic_map *bmap,
2040                 enum isl_dim_type type,
2041                 unsigned first, unsigned n);
2042         __isl_give isl_set *isl_set_remove_divs_involving_dims(
2043                 __isl_take isl_set *set, enum isl_dim_type type,
2044                 unsigned first, unsigned n);
2045         __isl_give isl_map *isl_map_remove_divs_involving_dims(
2046                 __isl_take isl_map *map, enum isl_dim_type type,
2047                 unsigned first, unsigned n);
2049         __isl_give isl_basic_set *
2050         isl_basic_set_remove_unknown_divs(
2051                 __isl_take isl_basic_set *bset);
2052         __isl_give isl_set *isl_set_remove_unknown_divs(
2053                 __isl_take isl_set *set);
2054         __isl_give isl_map *isl_map_remove_unknown_divs(
2055                 __isl_take isl_map *map);
2057 To iterate over all the sets or maps in a union set or map, use
2059         int isl_union_set_foreach_set(__isl_keep isl_union_set *uset,
2060                 int (*fn)(__isl_take isl_set *set, void *user),
2061                 void *user);
2062         int isl_union_map_foreach_map(__isl_keep isl_union_map *umap,
2063                 int (*fn)(__isl_take isl_map *map, void *user),
2064                 void *user);
2066 The number of sets or maps in a union set or map can be obtained
2067 from
2069         int isl_union_set_n_set(__isl_keep isl_union_set *uset);
2070         int isl_union_map_n_map(__isl_keep isl_union_map *umap);
2072 To extract the set or map in a given space from a union, use
2074         __isl_give isl_set *isl_union_set_extract_set(
2075                 __isl_keep isl_union_set *uset,
2076                 __isl_take isl_space *space);
2077         __isl_give isl_map *isl_union_map_extract_map(
2078                 __isl_keep isl_union_map *umap,
2079                 __isl_take isl_space *space);
2081 To iterate over all the basic sets or maps in a set or map, use
2083         int isl_set_foreach_basic_set(__isl_keep isl_set *set,
2084                 int (*fn)(__isl_take isl_basic_set *bset, void *user),
2085                 void *user);
2086         int isl_map_foreach_basic_map(__isl_keep isl_map *map,
2087                 int (*fn)(__isl_take isl_basic_map *bmap, void *user),
2088                 void *user);
2090 The callback function C<fn> should return 0 if successful and
2091 -1 if an error occurs.  In the latter case, or if any other error
2092 occurs, the above functions will return -1.
2094 It should be noted that C<isl> does not guarantee that
2095 the basic sets or maps passed to C<fn> are disjoint.
2096 If this is required, then the user should call one of
2097 the following functions first.
2099         __isl_give isl_set *isl_set_make_disjoint(
2100                 __isl_take isl_set *set);
2101         __isl_give isl_map *isl_map_make_disjoint(
2102                 __isl_take isl_map *map);
2104 The number of basic sets in a set can be obtained
2105 or the number of basic maps in a map can be obtained
2106 from
2108         #include <isl/set.h>
2109         int isl_set_n_basic_set(__isl_keep isl_set *set);
2111         #include <isl/map.h>
2112         int isl_map_n_basic_map(__isl_keep isl_map *map);
2114 To iterate over the constraints of a basic set or map, use
2116         #include <isl/constraint.h>
2118         int isl_basic_set_n_constraint(
2119                 __isl_keep isl_basic_set *bset);
2120         int isl_basic_set_foreach_constraint(
2121                 __isl_keep isl_basic_set *bset,
2122                 int (*fn)(__isl_take isl_constraint *c, void *user),
2123                 void *user);
2124         int isl_basic_map_n_constraint(
2125                 __isl_keep isl_basic_map *bmap);
2126         int isl_basic_map_foreach_constraint(
2127                 __isl_keep isl_basic_map *bmap,
2128                 int (*fn)(__isl_take isl_constraint *c, void *user),
2129                 void *user);
2130         __isl_null isl_constraint *isl_constraint_free(
2131                 __isl_take isl_constraint *c);
2133 Again, the callback function C<fn> should return 0 if successful and
2134 -1 if an error occurs.  In the latter case, or if any other error
2135 occurs, the above functions will return -1.
2136 The constraint C<c> represents either an equality or an inequality.
2137 Use the following function to find out whether a constraint
2138 represents an equality.  If not, it represents an inequality.
2140         int isl_constraint_is_equality(
2141                 __isl_keep isl_constraint *constraint);
2143 It is also possible to obtain a list of constraints from a basic
2144 map or set
2146         #include <isl/constraint.h>
2147         __isl_give isl_constraint_list *
2148         isl_basic_map_get_constraint_list(
2149                 __isl_keep isl_basic_map *bmap);
2150         __isl_give isl_constraint_list *
2151         isl_basic_set_get_constraint_list(
2152                 __isl_keep isl_basic_set *bset);
2154 These functions require that all existentially quantified variables
2155 have an explicit representation.
2156 The returned list can be manipulated using the functions in L<"Lists">.
2158 The coefficients of the constraints can be inspected using
2159 the following functions.
2161         int isl_constraint_is_lower_bound(
2162                 __isl_keep isl_constraint *constraint,
2163                 enum isl_dim_type type, unsigned pos);
2164         int isl_constraint_is_upper_bound(
2165                 __isl_keep isl_constraint *constraint,
2166                 enum isl_dim_type type, unsigned pos);
2167         __isl_give isl_val *isl_constraint_get_constant_val(
2168                 __isl_keep isl_constraint *constraint);
2169         __isl_give isl_val *isl_constraint_get_coefficient_val(
2170                 __isl_keep isl_constraint *constraint,
2171                 enum isl_dim_type type, int pos);
2173 The explicit representations of the existentially quantified
2174 variables can be inspected using the following function.
2175 Note that the user is only allowed to use this function
2176 if the inspected set or map is the result of a call
2177 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2178 The existentially quantified variable is equal to the floor
2179 of the returned affine expression.  The affine expression
2180 itself can be inspected using the functions in
2181 L</"Functions">.
2183         __isl_give isl_aff *isl_constraint_get_div(
2184                 __isl_keep isl_constraint *constraint, int pos);
2186 To obtain the constraints of a basic set or map in matrix
2187 form, use the following functions.
2189         __isl_give isl_mat *isl_basic_set_equalities_matrix(
2190                 __isl_keep isl_basic_set *bset,
2191                 enum isl_dim_type c1, enum isl_dim_type c2,
2192                 enum isl_dim_type c3, enum isl_dim_type c4);
2193         __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2194                 __isl_keep isl_basic_set *bset,
2195                 enum isl_dim_type c1, enum isl_dim_type c2,
2196                 enum isl_dim_type c3, enum isl_dim_type c4);
2197         __isl_give isl_mat *isl_basic_map_equalities_matrix(
2198                 __isl_keep isl_basic_map *bmap,
2199                 enum isl_dim_type c1,
2200                 enum isl_dim_type c2, enum isl_dim_type c3,
2201                 enum isl_dim_type c4, enum isl_dim_type c5);
2202         __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2203                 __isl_keep isl_basic_map *bmap,
2204                 enum isl_dim_type c1,
2205                 enum isl_dim_type c2, enum isl_dim_type c3,
2206                 enum isl_dim_type c4, enum isl_dim_type c5);
2208 The C<isl_dim_type> arguments dictate the order in which
2209 different kinds of variables appear in the resulting matrix.
2210 For set inputs, they should be a permutation of
2211 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2212 For map inputs, they should be a permutation of
2213 C<isl_dim_cst>, C<isl_dim_param>,
2214 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2216 =head2 Points
2218 Points are elements of a set.  They can be used to construct
2219 simple sets (boxes) or they can be used to represent the
2220 individual elements of a set.
2221 The zero point (the origin) can be created using
2223         __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2225 The coordinates of a point can be inspected, set and changed
2226 using
2228         __isl_give isl_val *isl_point_get_coordinate_val(
2229                 __isl_keep isl_point *pnt,
2230                 enum isl_dim_type type, int pos);
2231         __isl_give isl_point *isl_point_set_coordinate_val(
2232                 __isl_take isl_point *pnt,
2233                 enum isl_dim_type type, int pos,
2234                 __isl_take isl_val *v);
2236         __isl_give isl_point *isl_point_add_ui(
2237                 __isl_take isl_point *pnt,
2238                 enum isl_dim_type type, int pos, unsigned val);
2239         __isl_give isl_point *isl_point_sub_ui(
2240                 __isl_take isl_point *pnt,
2241                 enum isl_dim_type type, int pos, unsigned val);
2243 Points can be copied or freed using
2245         __isl_give isl_point *isl_point_copy(
2246                 __isl_keep isl_point *pnt);
2247         void isl_point_free(__isl_take isl_point *pnt);
2249 A singleton set can be created from a point using
2251         __isl_give isl_basic_set *isl_basic_set_from_point(
2252                 __isl_take isl_point *pnt);
2253         __isl_give isl_set *isl_set_from_point(
2254                 __isl_take isl_point *pnt);
2256 and a box can be created from two opposite extremal points using
2258         __isl_give isl_basic_set *isl_basic_set_box_from_points(
2259                 __isl_take isl_point *pnt1,
2260                 __isl_take isl_point *pnt2);
2261         __isl_give isl_set *isl_set_box_from_points(
2262                 __isl_take isl_point *pnt1,
2263                 __isl_take isl_point *pnt2);
2265 All elements of a B<bounded> (union) set can be enumerated using
2266 the following functions.
2268         int isl_set_foreach_point(__isl_keep isl_set *set,
2269                 int (*fn)(__isl_take isl_point *pnt, void *user),
2270                 void *user);
2271         int isl_union_set_foreach_point(__isl_keep isl_union_set *uset,
2272                 int (*fn)(__isl_take isl_point *pnt, void *user),
2273                 void *user);
2275 The function C<fn> is called for each integer point in
2276 C<set> with as second argument the last argument of
2277 the C<isl_set_foreach_point> call.  The function C<fn>
2278 should return C<0> on success and C<-1> on failure.
2279 In the latter case, C<isl_set_foreach_point> will stop
2280 enumerating and return C<-1> as well.
2281 If the enumeration is performed successfully and to completion,
2282 then C<isl_set_foreach_point> returns C<0>.
2284 To obtain a single point of a (basic) set, use
2286         __isl_give isl_point *isl_basic_set_sample_point(
2287                 __isl_take isl_basic_set *bset);
2288         __isl_give isl_point *isl_set_sample_point(
2289                 __isl_take isl_set *set);
2291 If C<set> does not contain any (integer) points, then the
2292 resulting point will be ``void'', a property that can be
2293 tested using
2295         int isl_point_is_void(__isl_keep isl_point *pnt);
2297 =head2 Functions
2299 Besides sets and relation, C<isl> also supports various types of functions.
2300 Each of these types is derived from the value type (see L</"Values">)
2301 or from one of two primitive function types
2302 through the application of zero or more type constructors.
2303 We first describe the primitive type and then we describe
2304 the types derived from these primitive types.
2306 =head3 Primitive Functions
2308 C<isl> support two primitive function types, quasi-affine
2309 expressions and quasipolynomials.
2310 A quasi-affine expression is defined either over a parameter
2311 space or over a set and is composed of integer constants,
2312 parameters and set variables, addition, subtraction and
2313 integer division by an integer constant.
2314 For example, the quasi-affine expression
2316         [n] -> { [x] -> [2*floor((4 n + x)/9] }
2318 maps C<x> to C<2*floor((4 n + x)/9>.
2319 A quasipolynomial is a polynomial expression in quasi-affine
2320 expression.  That is, it additionally allows for multiplication.
2321 Note, though, that it is not allowed to construct an integer
2322 division of an expression involving multiplications.
2323 Here is an example of a quasipolynomial that is not
2324 quasi-affine expression
2326         [n] -> { [x] -> (n*floor((4 n + x)/9) }
2328 Note that the external representations of quasi-affine expressions
2329 and quasipolynomials are different.  Quasi-affine expressions
2330 use a notation with square brackets just like binary relations,
2331 while quasipolynomials do not.  This might change at some point.
2333 If a primitive function is defined over a parameter space,
2334 then the space of the function itself is that of a set.
2335 If it is defined over a set, then the space of the function
2336 is that of a relation.  In both cases, the set space (or
2337 the output space) is single-dimensional, anonymous and unstructured.
2338 To create functions with multiple dimensions or with other kinds
2339 of set or output spaces, use multiple expressions
2340 (see L</"Multiple Expressions">).
2342 =over
2344 =item * Quasi-affine Expressions
2346 Besides the expressions described above, a quasi-affine
2347 expression can also be set to NaN.  Such expressions
2348 typically represent a failure to represent a result
2349 as a quasi-affine expression.
2351 The zero quasi affine expression or the quasi affine expression
2352 that is equal to a given value or
2353 a specified dimension on a given domain can be created using
2355         #include <isl/aff.h>
2356         __isl_give isl_aff *isl_aff_zero_on_domain(
2357                 __isl_take isl_local_space *ls);
2358         __isl_give isl_aff *isl_aff_val_on_domain(
2359                 __isl_take isl_local_space *ls,
2360                 __isl_take isl_val *val);
2361         __isl_give isl_aff *isl_aff_var_on_domain(
2362                 __isl_take isl_local_space *ls,
2363                 enum isl_dim_type type, unsigned pos);
2364         __isl_give isl_aff *isl_aff_nan_on_domain(
2365                 __isl_take isl_local_space *ls);
2367 Quasi affine expressions can be copied and freed using
2369         #include <isl/aff.h>
2370         __isl_give isl_aff *isl_aff_copy(
2371                 __isl_keep isl_aff *aff);
2372         __isl_null isl_aff *isl_aff_free(
2373                 __isl_take isl_aff *aff);
2375 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2376 using the following function.  The constraint is required to have
2377 a non-zero coefficient for the specified dimension.
2379         #include <isl/constraint.h>
2380         __isl_give isl_aff *isl_constraint_get_bound(
2381                 __isl_keep isl_constraint *constraint,
2382                 enum isl_dim_type type, int pos);
2384 The entire affine expression of the constraint can also be extracted
2385 using the following function.
2387         #include <isl/constraint.h>
2388         __isl_give isl_aff *isl_constraint_get_aff(
2389                 __isl_keep isl_constraint *constraint);
2391 Conversely, an equality constraint equating
2392 the affine expression to zero or an inequality constraint enforcing
2393 the affine expression to be non-negative, can be constructed using
2395         __isl_give isl_constraint *isl_equality_from_aff(
2396                 __isl_take isl_aff *aff);
2397         __isl_give isl_constraint *isl_inequality_from_aff(
2398                 __isl_take isl_aff *aff);
2400 The coefficients and the integer divisions of an affine expression
2401 can be inspected using the following functions.
2403         #include <isl/aff.h>
2404         __isl_give isl_val *isl_aff_get_constant_val(
2405                 __isl_keep isl_aff *aff);
2406         __isl_give isl_val *isl_aff_get_coefficient_val(
2407                 __isl_keep isl_aff *aff,
2408                 enum isl_dim_type type, int pos);
2409         int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2410                 enum isl_dim_type type, int pos);
2411         __isl_give isl_val *isl_aff_get_denominator_val(
2412                 __isl_keep isl_aff *aff);
2413         __isl_give isl_aff *isl_aff_get_div(
2414                 __isl_keep isl_aff *aff, int pos);
2416 They can be modified using the following functions.
2418         #include <isl/aff.h>
2419         __isl_give isl_aff *isl_aff_set_constant_si(
2420                 __isl_take isl_aff *aff, int v);
2421         __isl_give isl_aff *isl_aff_set_constant_val(
2422                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2423         __isl_give isl_aff *isl_aff_set_coefficient_si(
2424                 __isl_take isl_aff *aff,
2425                 enum isl_dim_type type, int pos, int v);
2426         __isl_give isl_aff *isl_aff_set_coefficient_val(
2427                 __isl_take isl_aff *aff,
2428                 enum isl_dim_type type, int pos,
2429                 __isl_take isl_val *v);
2431         __isl_give isl_aff *isl_aff_add_constant_si(
2432                 __isl_take isl_aff *aff, int v);
2433         __isl_give isl_aff *isl_aff_add_constant_val(
2434                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2435         __isl_give isl_aff *isl_aff_add_constant_num_si(
2436                 __isl_take isl_aff *aff, int v);
2437         __isl_give isl_aff *isl_aff_add_coefficient_si(
2438                 __isl_take isl_aff *aff,
2439                 enum isl_dim_type type, int pos, int v);
2440         __isl_give isl_aff *isl_aff_add_coefficient_val(
2441                 __isl_take isl_aff *aff,
2442                 enum isl_dim_type type, int pos,
2443                 __isl_take isl_val *v);
2445 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2446 set the I<numerator> of the constant or coefficient, while
2447 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2448 the constant or coefficient as a whole.
2449 The C<add_constant> and C<add_coefficient> functions add an integer
2450 or rational value to
2451 the possibly rational constant or coefficient.
2452 The C<add_constant_num> functions add an integer value to
2453 the numerator.
2455 =item * Quasipolynomials
2457 Some simple quasipolynomials can be created using the following functions.
2459         #include <isl/polynomial.h>
2460         __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2461                 __isl_take isl_space *domain);
2462         __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2463                 __isl_take isl_space *domain);
2464         __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2465                 __isl_take isl_space *domain);
2466         __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2467                 __isl_take isl_space *domain);
2468         __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2469                 __isl_take isl_space *domain);
2470         __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2471                 __isl_take isl_space *domain,
2472                 __isl_take isl_val *val);
2473         __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2474                 __isl_take isl_space *domain,
2475                 enum isl_dim_type type, unsigned pos);
2476         __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2477                 __isl_take isl_aff *aff);
2479 Recall that the space in which a quasipolynomial lives is a map space
2480 with a one-dimensional range.  The C<domain> argument in some of
2481 the functions above corresponds to the domain of this map space.
2483 Quasipolynomials can be copied and freed again using the following
2484 functions.
2486         #include <isl/polynomial.h>
2487         __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2488                 __isl_keep isl_qpolynomial *qp);
2489         __isl_null isl_qpolynomial *isl_qpolynomial_free(
2490                 __isl_take isl_qpolynomial *qp);
2492 The constant term of a quasipolynomial can be extracted using
2494         __isl_give isl_val *isl_qpolynomial_get_constant_val(
2495                 __isl_keep isl_qpolynomial *qp);
2497 To iterate over all terms in a quasipolynomial,
2500         int isl_qpolynomial_foreach_term(
2501                 __isl_keep isl_qpolynomial *qp,
2502                 int (*fn)(__isl_take isl_term *term,
2503                           void *user), void *user);
2505 The terms themselves can be inspected and freed using
2506 these functions
2508         unsigned isl_term_dim(__isl_keep isl_term *term,
2509                 enum isl_dim_type type);
2510         __isl_give isl_val *isl_term_get_coefficient_val(
2511                 __isl_keep isl_term *term);
2512         int isl_term_get_exp(__isl_keep isl_term *term,
2513                 enum isl_dim_type type, unsigned pos);
2514         __isl_give isl_aff *isl_term_get_div(
2515                 __isl_keep isl_term *term, unsigned pos);
2516         void isl_term_free(__isl_take isl_term *term);
2518 Each term is a product of parameters, set variables and
2519 integer divisions.  The function C<isl_term_get_exp>
2520 returns the exponent of a given dimensions in the given term.
2522 =back
2524 =head3 Reductions
2526 A reduction represents a maximum or a minimum of its
2527 base expressions.
2528 The only reduction type defined by C<isl> is
2529 C<isl_qpolynomial_fold>.
2531 There are currently no functions to directly create such
2532 objects, but they do appear in the piecewise quasipolynomial
2533 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2535 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2537 Reductions can be copied and freed using
2538 the following functions.
2540         #include <isl/polynomial.h>
2541         __isl_give isl_qpolynomial_fold *
2542         isl_qpolynomial_fold_copy(
2543                 __isl_keep isl_qpolynomial_fold *fold);
2544         void isl_qpolynomial_fold_free(
2545                 __isl_take isl_qpolynomial_fold *fold);
2547 To iterate over all quasipolynomials in a reduction, use
2549         int isl_qpolynomial_fold_foreach_qpolynomial(
2550                 __isl_keep isl_qpolynomial_fold *fold,
2551                 int (*fn)(__isl_take isl_qpolynomial *qp,
2552                           void *user), void *user);
2554 =head3 Multiple Expressions
2556 A multiple expression represents a sequence of zero or
2557 more base expressions, all defined on the same domain space.
2558 The domain space of the multiple expression is the same
2559 as that of the base expressions, but the range space
2560 can be any space.  In case the base expressions have
2561 a set space, the corresponding multiple expression
2562 also has a set space.
2563 Objects of the value type do not have an associated space.
2564 The space of a multiple value is therefore always a set space.
2565 Similarly, the space of a multiple union piecewise
2566 affine expression is always a set space.
2568 The multiple expression types defined by C<isl>
2569 are C<isl_multi_val>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
2570 C<isl_multi_union_pw_aff>.
2572 A multiple expression with the value zero for
2573 each output (or set) dimension can be created
2574 using the following functions.
2576         #include <isl/val.h>
2577         __isl_give isl_multi_val *isl_multi_val_zero(
2578                 __isl_take isl_space *space);
2580         #include <isl/aff.h>
2581         __isl_give isl_multi_aff *isl_multi_aff_zero(
2582                 __isl_take isl_space *space);
2583         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2584                 __isl_take isl_space *space);
2585         __isl_give isl_multi_union_pw_aff *
2586         isl_multi_union_pw_aff_zero(
2587                 __isl_take isl_space *space);
2589 Since there is no canonical way of representing a zero
2590 value of type C<isl_union_pw_aff>, the space passed
2591 to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
2593 An identity function can be created using the following
2594 functions.  The space needs to be that of a relation
2595 with the same number of input and output dimensions.
2597         #include <isl/aff.h>
2598         __isl_give isl_multi_aff *isl_multi_aff_identity(
2599                 __isl_take isl_space *space);
2600         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2601                 __isl_take isl_space *space);
2603 A function that performs a projection on a universe
2604 relation or set can be created using the following functions.
2605 See also the corresponding
2606 projection operations in L</"Unary Operations">.
2608         #include <isl/aff.h>
2609         __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2610                 __isl_take isl_space *space);
2611         __isl_give isl_multi_aff *isl_multi_aff_range_map(
2612                 __isl_take isl_space *space);
2613         __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2614                 __isl_take isl_space *space,
2615                 enum isl_dim_type type,
2616                 unsigned first, unsigned n);
2618 A multiple expression can be created from a single
2619 base expression using the following functions.
2620 The space of the created multiple expression is the same
2621 as that of the base expression, except for
2622 C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
2623 lives in a parameter space and the output lives
2624 in a single-dimensional set space.
2626         #include <isl/aff.h>
2627         __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2628                 __isl_take isl_aff *aff);
2629         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2630                 __isl_take isl_pw_aff *pa);
2631         __isl_give isl_multi_union_pw_aff *
2632         isl_multi_union_pw_aff_from_union_pw_aff(
2633                 __isl_take isl_union_pw_aff *upa);
2635 A multiple expression can be created from a list
2636 of base expression in a specified space.
2637 The domain of this space needs to be the same
2638 as the domains of the base expressions in the list.
2639 If the base expressions have a set space (or no associated space),
2640 then this space also needs to be a set space.
2642         #include <isl/val.h>
2643         __isl_give isl_multi_val *isl_multi_val_from_val_list(
2644                 __isl_take isl_space *space,
2645                 __isl_take isl_val_list *list);
2647         #include <isl/aff.h>
2648         __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2649                 __isl_take isl_space *space,
2650                 __isl_take isl_aff_list *list);
2651         __isl_give isl_multi_union_pw_aff *
2652         isl_multi_union_pw_aff_from_union_pw_aff_list(
2653                 __isl_take isl_space *space,
2654                 __isl_take isl_union_pw_aff_list *list);
2656 As a convenience, a multiple piecewise expression can
2657 also be created from a multiple expression.
2658 Each piecewise expression in the result has a single
2659 universe cell.
2661         #include <isl/aff.h>
2662         __isl_give isl_multi_pw_aff *
2663         isl_multi_pw_aff_from_multi_aff(
2664                 __isl_take isl_multi_aff *ma);
2666 Similarly, a multiple union expression can be
2667 created from a multiple expression.
2669         #include <isl/aff.h>
2670         __isl_give isl_multi_union_pw_aff *
2671         isl_multi_union_pw_aff_from_multi_aff(
2672                 __isl_take isl_multi_aff *ma);
2673         __isl_give isl_multi_union_pw_aff *
2674         isl_multi_union_pw_aff_from_multi_pw_aff(
2675                 __isl_take isl_multi_pw_aff *mpa);
2677 A multiple quasi-affine expression can be created from
2678 a multiple value with a given domain space using the following
2679 function.
2681         #include <isl/aff.h>
2682         __isl_give isl_multi_aff *
2683         isl_multi_aff_multi_val_on_space(
2684                 __isl_take isl_space *space,
2685                 __isl_take isl_multi_val *mv);
2687 Similarly,
2688 a multiple union piecewise affine expression can be created from
2689 a multiple value with a given domain or
2690 a multiple affine expression with a given domain
2691 using the following functions.
2693         #include <isl/aff.h>
2694         __isl_give isl_multi_union_pw_aff *
2695         isl_multi_union_pw_aff_multi_val_on_domain(
2696                 __isl_take isl_union_set *domain,
2697                 __isl_take isl_multi_val *mv);
2698         __isl_give isl_multi_union_pw_aff *
2699         isl_multi_union_pw_aff_multi_aff_on_domain(
2700                 __isl_take isl_union_set *domain,
2701                 __isl_take isl_multi_aff *ma);
2703 Multiple expressions can be copied and freed using
2704 the following functions.
2706         #include <isl/val.h>
2707         __isl_give isl_multi_val *isl_multi_val_copy(
2708                 __isl_keep isl_multi_val *mv);
2709         __isl_null isl_multi_val *isl_multi_val_free(
2710                 __isl_take isl_multi_val *mv);
2712         #include <isl/aff.h>
2713         __isl_give isl_multi_aff *isl_multi_aff_copy(
2714                 __isl_keep isl_multi_aff *maff);
2715         __isl_null isl_multi_aff *isl_multi_aff_free(
2716                 __isl_take isl_multi_aff *maff);
2717         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2718                 __isl_keep isl_multi_pw_aff *mpa);
2719         __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2720                 __isl_take isl_multi_pw_aff *mpa);
2721         __isl_give isl_multi_union_pw_aff *
2722         isl_multi_union_pw_aff_copy(
2723                 __isl_keep isl_multi_union_pw_aff *mupa);
2724         __isl_null isl_multi_union_pw_aff *
2725         isl_multi_union_pw_aff_free(
2726                 __isl_take isl_multi_union_pw_aff *mupa);
2728 The base expression at a given position of a multiple
2729 expression can be extracted using the following functions.
2731         #include <isl/val.h>
2732         __isl_give isl_val *isl_multi_val_get_val(
2733                 __isl_keep isl_multi_val *mv, int pos);
2735         #include <isl/aff.h>
2736         __isl_give isl_aff *isl_multi_aff_get_aff(
2737                 __isl_keep isl_multi_aff *multi, int pos);
2738         __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2739                 __isl_keep isl_multi_pw_aff *mpa, int pos);
2740         __isl_give isl_union_pw_aff *
2741         isl_multi_union_pw_aff_get_union_pw_aff(
2742                 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
2744 It can be replaced using the following functions.
2746         #include <isl/val.h>
2747         __isl_give isl_multi_val *isl_multi_val_set_val(
2748                 __isl_take isl_multi_val *mv, int pos,
2749                 __isl_take isl_val *val);
2751         #include <isl/aff.h>
2752         __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2753                 __isl_take isl_multi_aff *multi, int pos,
2754                 __isl_take isl_aff *aff);
2755         __isl_give isl_multi_union_pw_aff *
2756         isl_multi_union_pw_aff_set_union_pw_aff(
2757                 __isl_take isl_multi_union_pw_aff *mupa, int pos,
2758                 __isl_take isl_union_pw_aff *upa);
2760 As a convenience, a sequence of base expressions that have
2761 their domains in a given space can be extracted from a sequence
2762 of union expressions using the following function.
2764         #include <isl/aff.h>
2765         __isl_give isl_multi_pw_aff *
2766         isl_multi_union_pw_aff_extract_multi_pw_aff(
2767                 __isl_keep isl_multi_union_pw_aff *mupa,
2768                 __isl_take isl_space *space);
2770 Note that there is a difference between C<isl_multi_union_pw_aff>
2771 and C<isl_union_pw_multi_aff> objects.  The first is a sequence
2772 of unions of piecewise expressions, while the second is a union
2773 of piecewise sequences.  In particular, multiple affine expressions
2774 in an C<isl_union_pw_multi_aff> may live in different spaces,
2775 while there is only a single multiple expression in
2776 an C<isl_multi_union_pw_aff>, which can therefore only live
2777 in a single space.  This means that not every
2778 C<isl_union_pw_multi_aff> can be converted to
2779 an C<isl_multi_union_pw_aff>.  Conversely, a zero-dimensional
2780 C<isl_multi_union_pw_aff> carries no information
2781 about any possible domain and therefore cannot be converted
2782 to an C<isl_union_pw_multi_aff>.  Moreover, the elements
2783 of an C<isl_multi_union_pw_aff> may be defined over different domains,
2784 while each multiple expression inside an C<isl_union_pw_multi_aff>
2785 has a single domain.  The conversion of an C<isl_union_pw_multi_aff>
2786 of dimension greater than one may therefore not be exact.
2787 The following functions can
2788 be used to perform these conversions when they are possible.
2790         #include <isl/aff.h>
2791         __isl_give isl_multi_union_pw_aff *
2792         isl_multi_union_pw_aff_from_union_pw_multi_aff(
2793                 __isl_take isl_union_pw_multi_aff *upma);
2794         __isl_give isl_union_pw_multi_aff *
2795         isl_union_pw_multi_aff_from_multi_union_pw_aff(
2796                 __isl_take isl_multi_union_pw_aff *mupa);
2798 =head3 Piecewise Expressions
2800 A piecewise expression is an expression that is described
2801 using zero or more base expression defined over the same
2802 number of cells in the domain space of the base expressions.
2803 All base expressions are defined over the same
2804 domain space and the cells are disjoint.
2805 The space of a piecewise expression is the same as
2806 that of the base expressions.
2807 If the union of the cells is a strict subset of the domain
2808 space, then the value of the piecewise expression outside
2809 this union is different for types derived from quasi-affine
2810 expressions and those derived from quasipolynomials.
2811 Piecewise expressions derived from quasi-affine expressions
2812 are considered to be undefined outside the union of their cells.
2813 Piecewise expressions derived from quasipolynomials
2814 are considered to be zero outside the union of their cells.
2816 Piecewise quasipolynomials are mainly used by the C<barvinok>
2817 library for representing the number of elements in a parametric set or map.
2818 For example, the piecewise quasipolynomial
2820         [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
2822 represents the number of points in the map
2824         [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
2826 The piecewise expression types defined by C<isl>
2827 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
2828 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
2830 A piecewise expression with no cells can be created using
2831 the following functions.
2833         #include <isl/aff.h>
2834         __isl_give isl_pw_aff *isl_pw_aff_empty(
2835                 __isl_take isl_space *space);
2836         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
2837                 __isl_take isl_space *space);
2839 A piecewise expression with a single universe cell can be
2840 created using the following functions.
2842         #include <isl/aff.h>
2843         __isl_give isl_pw_aff *isl_pw_aff_from_aff(
2844                 __isl_take isl_aff *aff);
2845         __isl_give isl_pw_multi_aff *
2846         isl_pw_multi_aff_from_multi_aff(
2847                 __isl_take isl_multi_aff *ma);
2849         #include <isl/polynomial.h>
2850         __isl_give isl_pw_qpolynomial *
2851         isl_pw_qpolynomial_from_qpolynomial(
2852                 __isl_take isl_qpolynomial *qp);
2854 A piecewise expression with a single specified cell can be
2855 created using the following functions.
2857         #include <isl/aff.h>
2858         __isl_give isl_pw_aff *isl_pw_aff_alloc(
2859                 __isl_take isl_set *set, __isl_take isl_aff *aff);
2860         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
2861                 __isl_take isl_set *set,
2862                 __isl_take isl_multi_aff *maff);
2864         #include <isl/polynomial.h>
2865         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
2866                 __isl_take isl_set *set,
2867                 __isl_take isl_qpolynomial *qp);
2869 The following convenience functions first create a base expression and
2870 then create a piecewise expression over a universe domain.
2872         #include <isl/aff.h>
2873         __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
2874                 __isl_take isl_local_space *ls);
2875         __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
2876                 __isl_take isl_local_space *ls,
2877                 enum isl_dim_type type, unsigned pos);
2878         __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
2879                 __isl_take isl_local_space *ls);
2880         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
2881                 __isl_take isl_space *space);
2882         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
2883                 __isl_take isl_space *space);
2884         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
2885                 __isl_take isl_space *space);
2886         __isl_give isl_pw_multi_aff *
2887         isl_pw_multi_aff_project_out_map(
2888                 __isl_take isl_space *space,
2889                 enum isl_dim_type type,
2890                 unsigned first, unsigned n);
2892         #include <isl/polynomial.h>
2893         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
2894                 __isl_take isl_space *space);
2896 The following convenience functions first create a base expression and
2897 then create a piecewise expression over a given domain.
2899         #include <isl/aff.h>
2900         __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
2901                 __isl_take isl_set *domain,
2902                 __isl_take isl_val *v);
2903         __isl_give isl_pw_multi_aff *
2904         isl_pw_multi_aff_multi_val_on_domain(
2905                 __isl_take isl_set *domain,
2906                 __isl_take isl_multi_val *mv);
2908 As a convenience, a piecewise multiple expression can
2909 also be created from a piecewise expression.
2910 Each multiple expression in the result is derived
2911 from the corresponding base expression.
2913         #include <isl/aff.h>
2914         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
2915                 __isl_take isl_pw_aff *pa);
2917 Similarly, a piecewise quasipolynomial can be
2918 created from a piecewise quasi-affine expression using
2919 the following function.
2921         #include <isl/polynomial.h>
2922         __isl_give isl_pw_qpolynomial *
2923         isl_pw_qpolynomial_from_pw_aff(
2924                 __isl_take isl_pw_aff *pwaff);
2926 Piecewise expressions can be copied and freed using the following functions.
2928         #include <isl/aff.h>
2929         __isl_give isl_pw_aff *isl_pw_aff_copy(
2930                 __isl_keep isl_pw_aff *pwaff);
2931         __isl_null isl_pw_aff *isl_pw_aff_free(
2932                 __isl_take isl_pw_aff *pwaff);
2933         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
2934                 __isl_keep isl_pw_multi_aff *pma);
2935         __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
2936                 __isl_take isl_pw_multi_aff *pma);
2938         #include <isl/polynomial.h>
2939         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
2940                 __isl_keep isl_pw_qpolynomial *pwqp);
2941         __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
2942                 __isl_take isl_pw_qpolynomial *pwqp);
2943         __isl_give isl_pw_qpolynomial_fold *
2944         isl_pw_qpolynomial_fold_copy(
2945                 __isl_keep isl_pw_qpolynomial_fold *pwf);
2946         __isl_null isl_pw_qpolynomial_fold *
2947         isl_pw_qpolynomial_fold_free(
2948                 __isl_take isl_pw_qpolynomial_fold *pwf);
2950 To iterate over the different cells of a piecewise expression,
2951 use the following functions.
2953         #include <isl/aff.h>
2954         int isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
2955         int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
2956         int isl_pw_aff_foreach_piece(__isl_keep isl_pw_aff *pwaff,
2957                 int (*fn)(__isl_take isl_set *set,
2958                           __isl_take isl_aff *aff,
2959                           void *user), void *user);
2960         int isl_pw_multi_aff_foreach_piece(
2961                 __isl_keep isl_pw_multi_aff *pma,
2962                 int (*fn)(__isl_take isl_set *set,
2963                             __isl_take isl_multi_aff *maff,
2964                             void *user), void *user);
2966         #include <isl/polynomial.h>
2967         int isl_pw_qpolynomial_foreach_piece(
2968                 __isl_keep isl_pw_qpolynomial *pwqp,
2969                 int (*fn)(__isl_take isl_set *set,
2970                           __isl_take isl_qpolynomial *qp,
2971                           void *user), void *user);
2972         int isl_pw_qpolynomial_foreach_lifted_piece(
2973                 __isl_keep isl_pw_qpolynomial *pwqp,
2974                 int (*fn)(__isl_take isl_set *set,
2975                           __isl_take isl_qpolynomial *qp,
2976                           void *user), void *user);
2977         int isl_pw_qpolynomial_fold_foreach_piece(
2978                 __isl_keep isl_pw_qpolynomial_fold *pwf,
2979                 int (*fn)(__isl_take isl_set *set,
2980                           __isl_take isl_qpolynomial_fold *fold,
2981                           void *user), void *user);
2982         int isl_pw_qpolynomial_fold_foreach_lifted_piece(
2983                 __isl_keep isl_pw_qpolynomial_fold *pwf,
2984                 int (*fn)(__isl_take isl_set *set,
2985                           __isl_take isl_qpolynomial_fold *fold,
2986                           void *user), void *user);
2988 As usual, the function C<fn> should return C<0> on success
2989 and C<-1> on failure.  The difference between
2990 C<isl_pw_qpolynomial_foreach_piece> and
2991 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
2992 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
2993 compute unique representations for all existentially quantified
2994 variables and then turn these existentially quantified variables
2995 into extra set variables, adapting the associated quasipolynomial
2996 accordingly.  This means that the C<set> passed to C<fn>
2997 will not have any existentially quantified variables, but that
2998 the dimensions of the sets may be different for different
2999 invocations of C<fn>.
3000 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
3001 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
3003 A piecewise expression consisting of the expressions at a given
3004 position of a piecewise multiple expression can be extracted
3005 using the following function.
3007         #include <isl/aff.h>
3008         __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3009                 __isl_keep isl_pw_multi_aff *pma, int pos);
3011 These expressions can be replaced using the following function.
3013         #include <isl/aff.h>
3014         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3015                 __isl_take isl_pw_multi_aff *pma, unsigned pos,
3016                 __isl_take isl_pw_aff *pa);
3018 Note that there is a difference between C<isl_multi_pw_aff> and
3019 C<isl_pw_multi_aff> objects.  The first is a sequence of piecewise
3020 affine expressions, while the second is a piecewise sequence
3021 of affine expressions.  In particular, each of the piecewise
3022 affine expressions in an C<isl_multi_pw_aff> may have a different
3023 domain, while all multiple expressions associated to a cell
3024 in an C<isl_pw_multi_aff> have the same domain.
3025 It is possible to convert between the two, but when converting
3026 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3027 of the result is the intersection of the domains of the input.
3028 The reverse conversion is exact.
3030         #include <isl/aff.h>
3031         __isl_give isl_pw_multi_aff *
3032         isl_pw_multi_aff_from_multi_pw_aff(
3033                 __isl_take isl_multi_pw_aff *mpa);
3034         __isl_give isl_multi_pw_aff *
3035         isl_multi_pw_aff_from_pw_multi_aff(
3036                 __isl_take isl_pw_multi_aff *pma);
3038 =head3 Union Expressions
3040 A union expression collects base expressions defined
3041 over different domains.  The space of a union expression
3042 is that of the shared parameter space.
3044 The union expression types defined by C<isl>
3045 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3046 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3048 An empty union expression can be created using the following functions.
3050         #include <isl/aff.h>
3051         __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
3052                 __isl_take isl_space *space);
3053         __isl_give isl_union_pw_multi_aff *
3054         isl_union_pw_multi_aff_empty(
3055                 __isl_take isl_space *space);
3057         #include <isl/polynomial.h>
3058         __isl_give isl_union_pw_qpolynomial *
3059         isl_union_pw_qpolynomial_zero(
3060                 __isl_take isl_space *space);
3062 A union expression containing a single base expression
3063 can be created using the following functions.
3065         #include <isl/aff.h>
3066         __isl_give isl_union_pw_aff *
3067         isl_union_pw_aff_from_pw_aff(
3068                 __isl_take isl_pw_aff *pa);
3069         __isl_give isl_union_pw_multi_aff *
3070         isl_union_pw_multi_aff_from_aff(
3071                 __isl_take isl_aff *aff);
3072         __isl_give isl_union_pw_multi_aff *
3073         isl_union_pw_multi_aff_from_pw_multi_aff(
3074                 __isl_take isl_pw_multi_aff *pma);
3076         #include <isl/polynomial.h>
3077         __isl_give isl_union_pw_qpolynomial *
3078         isl_union_pw_qpolynomial_from_pw_qpolynomial(
3079                 __isl_take isl_pw_qpolynomial *pwqp);
3081 The following functions create a base expression on each
3082 of the sets in the union set and collect the results.
3084         #include <isl/aff.h>
3085         __isl_give isl_union_pw_multi_aff *
3086         isl_union_pw_multi_aff_from_union_pw_aff(
3087                 __isl_take isl_union_pw_aff *upa);
3088         __isl_give isl_union_pw_aff *
3089         isl_union_pw_multi_aff_get_union_pw_aff(
3090                 __isl_keep isl_union_pw_multi_aff *upma, int pos);
3091         __isl_give isl_union_pw_aff *
3092         isl_union_pw_aff_val_on_domain(
3093                 __isl_take isl_union_set *domain,
3094                 __isl_take isl_val *v);
3095         __isl_give isl_union_pw_multi_aff *
3096         isl_union_pw_multi_aff_multi_val_on_domain(
3097                 __isl_take isl_union_set *domain,
3098                 __isl_take isl_multi_val *mv);
3100 An C<isl_union_pw_aff> that is equal to a (parametric) affine
3101 expression on a given domain can be created using the following
3102 function.
3104         #include <isl/aff.h>
3105         __isl_give isl_union_pw_aff *
3106         isl_union_pw_aff_aff_on_domain(
3107                 __isl_take isl_union_set *domain,
3108                 __isl_take isl_aff *aff);
3110 A base expression can be added to a union expression using
3111 the following functions.
3113         #include <isl/aff.h>
3114         __isl_give isl_union_pw_aff *
3115         isl_union_pw_aff_add_pw_aff(
3116                 __isl_take isl_union_pw_aff *upa,
3117                 __isl_take isl_pw_aff *pa);
3118         __isl_give isl_union_pw_multi_aff *
3119         isl_union_pw_multi_aff_add_pw_multi_aff(
3120                 __isl_take isl_union_pw_multi_aff *upma,
3121                 __isl_take isl_pw_multi_aff *pma);
3123         #include <isl/polynomial.h>
3124         __isl_give isl_union_pw_qpolynomial *
3125         isl_union_pw_qpolynomial_add_pw_qpolynomial(
3126                 __isl_take isl_union_pw_qpolynomial *upwqp,
3127                 __isl_take isl_pw_qpolynomial *pwqp);
3129 Union expressions can be copied and freed using
3130 the following functions.
3132         #include <isl/aff.h>
3133         __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
3134                 __isl_keep isl_union_pw_aff *upa);
3135         __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
3136                 __isl_take isl_union_pw_aff *upa);
3137         __isl_give isl_union_pw_multi_aff *
3138         isl_union_pw_multi_aff_copy(
3139                 __isl_keep isl_union_pw_multi_aff *upma);
3140         __isl_null isl_union_pw_multi_aff *
3141         isl_union_pw_multi_aff_free(
3142                 __isl_take isl_union_pw_multi_aff *upma);
3144         #include <isl/polynomial.h>
3145         __isl_give isl_union_pw_qpolynomial *
3146         isl_union_pw_qpolynomial_copy(
3147                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3148         __isl_null isl_union_pw_qpolynomial *
3149         isl_union_pw_qpolynomial_free(
3150                 __isl_take isl_union_pw_qpolynomial *upwqp);
3151         __isl_give isl_union_pw_qpolynomial_fold *
3152         isl_union_pw_qpolynomial_fold_copy(
3153                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3154         __isl_null isl_union_pw_qpolynomial_fold *
3155         isl_union_pw_qpolynomial_fold_free(
3156                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3158 To iterate over the base expressions in a union expression,
3159 use the following functions.
3161         #include <isl/aff.h>
3162         int isl_union_pw_aff_n_pw_aff(
3163                 __isl_keep isl_union_pw_aff *upa);
3164         int isl_union_pw_aff_foreach_pw_aff(
3165                 __isl_keep isl_union_pw_aff *upa,
3166                 int (*fn)(__isl_take isl_pw_aff *ma, void *user),
3167                         void *user);
3168         int isl_union_pw_multi_aff_n_pw_multi_aff(
3169                 __isl_keep isl_union_pw_multi_aff *upma);
3170         int isl_union_pw_multi_aff_foreach_pw_multi_aff(
3171                 __isl_keep isl_union_pw_multi_aff *upma,
3172                 int (*fn)(__isl_take isl_pw_multi_aff *pma,
3173                             void *user), void *user);
3175         #include <isl/polynomial.h>
3176         int isl_union_pw_qpolynomial_n_pw_qpolynomial(
3177                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3178         int isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3179                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3180                 int (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3181                             void *user), void *user);
3182         int isl_union_pw_qpolynomial_fold_n_pw_qpolynomial_fold(
3183                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3184         int isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3185                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3186                 int (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3187                             void *user), void *user);
3189 To extract the base expression in a given space from a union, use
3190 the following functions.
3192         #include <isl/aff.h>
3193         __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3194                 __isl_keep isl_union_pw_aff *upa,
3195                 __isl_take isl_space *space);
3196         __isl_give isl_pw_multi_aff *
3197         isl_union_pw_multi_aff_extract_pw_multi_aff(
3198                 __isl_keep isl_union_pw_multi_aff *upma,
3199                 __isl_take isl_space *space);
3201         #include <isl/polynomial.h>
3202         __isl_give isl_pw_qpolynomial *
3203         isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3204                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3205                 __isl_take isl_space *space);
3207 =head2 Input and Output
3209 For set and relation,
3210 C<isl> supports its own input/output format, which is similar
3211 to the C<Omega> format, but also supports the C<PolyLib> format
3212 in some cases.
3213 For other object types, typically only an C<isl> format is supported.
3215 =head3 C<isl> format
3217 The C<isl> format is similar to that of C<Omega>, but has a different
3218 syntax for describing the parameters and allows for the definition
3219 of an existentially quantified variable as the integer division
3220 of an affine expression.
3221 For example, the set of integers C<i> between C<0> and C<n>
3222 such that C<i % 10 <= 6> can be described as
3224         [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3225                                 i - 10 a <= 6) }
3227 A set or relation can have several disjuncts, separated
3228 by the keyword C<or>.  Each disjunct is either a conjunction
3229 of constraints or a projection (C<exists>) of a conjunction
3230 of constraints.  The constraints are separated by the keyword
3231 C<and>.
3233 =head3 C<PolyLib> format
3235 If the represented set is a union, then the first line
3236 contains a single number representing the number of disjuncts.
3237 Otherwise, a line containing the number C<1> is optional.
3239 Each disjunct is represented by a matrix of constraints.
3240 The first line contains two numbers representing
3241 the number of rows and columns,
3242 where the number of rows is equal to the number of constraints
3243 and the number of columns is equal to two plus the number of variables.
3244 The following lines contain the actual rows of the constraint matrix.
3245 In each row, the first column indicates whether the constraint
3246 is an equality (C<0>) or inequality (C<1>).  The final column
3247 corresponds to the constant term.
3249 If the set is parametric, then the coefficients of the parameters
3250 appear in the last columns before the constant column.
3251 The coefficients of any existentially quantified variables appear
3252 between those of the set variables and those of the parameters.
3254 =head3 Extended C<PolyLib> format
3256 The extended C<PolyLib> format is nearly identical to the
3257 C<PolyLib> format.  The only difference is that the line
3258 containing the number of rows and columns of a constraint matrix
3259 also contains four additional numbers:
3260 the number of output dimensions, the number of input dimensions,
3261 the number of local dimensions (i.e., the number of existentially
3262 quantified variables) and the number of parameters.
3263 For sets, the number of ``output'' dimensions is equal
3264 to the number of set dimensions, while the number of ``input''
3265 dimensions is zero.
3267 =head3 Input
3269 Objects can be read from input using the following functions.
3271         #include <isl/val.h>
3272         __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3273                 const char *str);
3274         __isl_give isl_multi_val *isl_multi_val_read_from_str(
3275                 isl_ctx *ctx, const char *str);
3277         #include <isl/set.h>
3278         __isl_give isl_basic_set *isl_basic_set_read_from_file(
3279                 isl_ctx *ctx, FILE *input);
3280         __isl_give isl_basic_set *isl_basic_set_read_from_str(
3281                 isl_ctx *ctx, const char *str);
3282         __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3283                 FILE *input);
3284         __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3285                 const char *str);
3287         #include <isl/map.h>
3288         __isl_give isl_basic_map *isl_basic_map_read_from_file(
3289                 isl_ctx *ctx, FILE *input);
3290         __isl_give isl_basic_map *isl_basic_map_read_from_str(
3291                 isl_ctx *ctx, const char *str);
3292         __isl_give isl_map *isl_map_read_from_file(
3293                 isl_ctx *ctx, FILE *input);
3294         __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3295                 const char *str);
3297         #include <isl/union_set.h>
3298         __isl_give isl_union_set *isl_union_set_read_from_file(
3299                 isl_ctx *ctx, FILE *input);
3300         __isl_give isl_union_set *isl_union_set_read_from_str(
3301                 isl_ctx *ctx, const char *str);
3303         #include <isl/union_map.h>
3304         __isl_give isl_union_map *isl_union_map_read_from_file(
3305                 isl_ctx *ctx, FILE *input);
3306         __isl_give isl_union_map *isl_union_map_read_from_str(
3307                 isl_ctx *ctx, const char *str);
3309         #include <isl/aff.h>
3310         __isl_give isl_aff *isl_aff_read_from_str(
3311                 isl_ctx *ctx, const char *str);
3312         __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3313                 isl_ctx *ctx, const char *str);
3314         __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3315                 isl_ctx *ctx, const char *str);
3316         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3317                 isl_ctx *ctx, const char *str);
3318         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3319                 isl_ctx *ctx, const char *str);
3320         __isl_give isl_union_pw_multi_aff *
3321         isl_union_pw_multi_aff_read_from_str(
3322                 isl_ctx *ctx, const char *str);
3323         __isl_give isl_multi_union_pw_aff *
3324         isl_multi_union_pw_aff_read_from_str(
3325                 isl_ctx *ctx, const char *str);
3327         #include <isl/polynomial.h>
3328         __isl_give isl_union_pw_qpolynomial *
3329         isl_union_pw_qpolynomial_read_from_str(
3330                 isl_ctx *ctx, const char *str);
3332 For sets and relations,
3333 the input format is autodetected and may be either the C<PolyLib> format
3334 or the C<isl> format.
3336 =head3 Output
3338 Before anything can be printed, an C<isl_printer> needs to
3339 be created.
3341         __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3342                 FILE *file);
3343         __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3344         __isl_null isl_printer *isl_printer_free(
3345                 __isl_take isl_printer *printer);
3346         __isl_give char *isl_printer_get_str(
3347                 __isl_keep isl_printer *printer);
3349 The printer can be inspected using the following functions.
3351         FILE *isl_printer_get_file(
3352                 __isl_keep isl_printer *printer);
3353         int isl_printer_get_output_format(
3354                 __isl_keep isl_printer *p);
3355         int isl_printer_get_yaml_style(__isl_keep isl_printer *p);
3357 The behavior of the printer can be modified in various ways
3359         __isl_give isl_printer *isl_printer_set_output_format(
3360                 __isl_take isl_printer *p, int output_format);
3361         __isl_give isl_printer *isl_printer_set_indent(
3362                 __isl_take isl_printer *p, int indent);
3363         __isl_give isl_printer *isl_printer_set_indent_prefix(
3364                 __isl_take isl_printer *p, const char *prefix);
3365         __isl_give isl_printer *isl_printer_indent(
3366                 __isl_take isl_printer *p, int indent);
3367         __isl_give isl_printer *isl_printer_set_prefix(
3368                 __isl_take isl_printer *p, const char *prefix);
3369         __isl_give isl_printer *isl_printer_set_suffix(
3370                 __isl_take isl_printer *p, const char *suffix);
3371         __isl_give isl_printer *isl_printer_set_yaml_style(
3372                 __isl_take isl_printer *p, int yaml_style);
3374 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3375 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3376 and defaults to C<ISL_FORMAT_ISL>.
3377 Each line in the output is prefixed by C<indent_prefix>,
3378 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3379 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3380 In the C<PolyLib> format output,
3381 the coefficients of the existentially quantified variables
3382 appear between those of the set variables and those
3383 of the parameters.
3384 The function C<isl_printer_indent> increases the indentation
3385 by the specified amount (which may be negative).
3386 The YAML style may be either C<ISL_YAML_STYLE_BLOCK> or
3387 C<ISL_YAML_STYLE_FLOW> and when we are printing something
3388 in YAML format.
3390 To actually print something, use
3392         #include <isl/printer.h>
3393         __isl_give isl_printer *isl_printer_print_double(
3394                 __isl_take isl_printer *p, double d);
3396         #include <isl/val.h>
3397         __isl_give isl_printer *isl_printer_print_val(
3398                 __isl_take isl_printer *p, __isl_keep isl_val *v);
3400         #include <isl/set.h>
3401         __isl_give isl_printer *isl_printer_print_basic_set(
3402                 __isl_take isl_printer *printer,
3403                 __isl_keep isl_basic_set *bset);
3404         __isl_give isl_printer *isl_printer_print_set(
3405                 __isl_take isl_printer *printer,
3406                 __isl_keep isl_set *set);
3408         #include <isl/map.h>
3409         __isl_give isl_printer *isl_printer_print_basic_map(
3410                 __isl_take isl_printer *printer,
3411                 __isl_keep isl_basic_map *bmap);
3412         __isl_give isl_printer *isl_printer_print_map(
3413                 __isl_take isl_printer *printer,
3414                 __isl_keep isl_map *map);
3416         #include <isl/union_set.h>
3417         __isl_give isl_printer *isl_printer_print_union_set(
3418                 __isl_take isl_printer *p,
3419                 __isl_keep isl_union_set *uset);
3421         #include <isl/union_map.h>
3422         __isl_give isl_printer *isl_printer_print_union_map(
3423                 __isl_take isl_printer *p,
3424                 __isl_keep isl_union_map *umap);
3426         #include <isl/val.h>
3427         __isl_give isl_printer *isl_printer_print_multi_val(
3428                 __isl_take isl_printer *p,
3429                 __isl_keep isl_multi_val *mv);
3431         #include <isl/aff.h>
3432         __isl_give isl_printer *isl_printer_print_aff(
3433                 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3434         __isl_give isl_printer *isl_printer_print_multi_aff(
3435                 __isl_take isl_printer *p,
3436                 __isl_keep isl_multi_aff *maff);
3437         __isl_give isl_printer *isl_printer_print_pw_aff(
3438                 __isl_take isl_printer *p,
3439                 __isl_keep isl_pw_aff *pwaff);
3440         __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3441                 __isl_take isl_printer *p,
3442                 __isl_keep isl_pw_multi_aff *pma);
3443         __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3444                 __isl_take isl_printer *p,
3445                 __isl_keep isl_multi_pw_aff *mpa);
3446         __isl_give isl_printer *isl_printer_print_union_pw_aff(
3447                 __isl_take isl_printer *p,
3448                 __isl_keep isl_union_pw_aff *upa);
3449         __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3450                 __isl_take isl_printer *p,
3451                 __isl_keep isl_union_pw_multi_aff *upma);
3452         __isl_give isl_printer *
3453         isl_printer_print_multi_union_pw_aff(
3454                 __isl_take isl_printer *p,
3455                 __isl_keep isl_multi_union_pw_aff *mupa);
3457         #include <isl/polynomial.h>
3458         __isl_give isl_printer *isl_printer_print_qpolynomial(
3459                 __isl_take isl_printer *p,
3460                 __isl_keep isl_qpolynomial *qp);
3461         __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3462                 __isl_take isl_printer *p,
3463                 __isl_keep isl_pw_qpolynomial *pwqp);
3464         __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3465                 __isl_take isl_printer *p,
3466                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3468         __isl_give isl_printer *
3469         isl_printer_print_pw_qpolynomial_fold(
3470                 __isl_take isl_printer *p,
3471                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3472         __isl_give isl_printer *
3473         isl_printer_print_union_pw_qpolynomial_fold(
3474                 __isl_take isl_printer *p,
3475                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3477 For C<isl_printer_print_qpolynomial>,
3478 C<isl_printer_print_pw_qpolynomial> and
3479 C<isl_printer_print_pw_qpolynomial_fold>,
3480 the output format of the printer
3481 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3482 For C<isl_printer_print_union_pw_qpolynomial> and
3483 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3484 is supported.
3485 In case of printing in C<ISL_FORMAT_C>, the user may want
3486 to set the names of all dimensions first.
3488 C<isl> also provides limited support for printing YAML documents,
3489 just enough for the internal use for printing such documents.
3491         #include <isl/printer.h>
3492         __isl_give isl_printer *isl_printer_yaml_start_mapping(
3493                 __isl_take isl_printer *p);
3494         __isl_give isl_printer *isl_printer_yaml_end_mapping(
3495                 __isl_take isl_printer *p);
3496         __isl_give isl_printer *isl_printer_yaml_start_sequence(
3497                 __isl_take isl_printer *p);
3498         __isl_give isl_printer *isl_printer_yaml_end_sequence(
3499                 __isl_take isl_printer *p);
3500         __isl_give isl_printer *isl_printer_yaml_next(
3501                 __isl_take isl_printer *p);
3503 A document is started by a call to either
3504 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3505 Anything printed to the printer after such a call belong to the
3506 first key of the mapping or the first element in the sequence.
3507 The function C<isl_printer_yaml_next> moves to the value if
3508 we are currently printing a mapping key, the next key if we
3509 are printing a value or the next element if we are printing
3510 an element in a sequence.
3511 Nested mappings and sequences are initiated by the same
3512 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3513 Each call to these functions needs to have a corresponding call to
3514 C<isl_printer_yaml_end_mapping> or C<isl_printer_yaml_end_sequence>.
3516 When called on a file printer, the following function flushes
3517 the file.  When called on a string printer, the buffer is cleared.
3519         __isl_give isl_printer *isl_printer_flush(
3520                 __isl_take isl_printer *p);
3522 Alternatively, a string representation can be obtained
3523 directly using the following functions, which always print
3524 in isl format.
3526         #include <isl/space.h>
3527         __isl_give char *isl_space_to_str(
3528                 __isl_keep isl_space *space);
3530         #include <isl/val.h>
3531         __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3532         __isl_give char *isl_multi_val_to_str(
3533                 __isl_keep isl_multi_val *mv);
3535         #include <isl/set.h>
3536         __isl_give char *isl_set_to_str(
3537                 __isl_keep isl_set *set);
3539         #include <isl/union_set.h>
3540         __isl_give char *isl_union_set_to_str(
3541                 __isl_keep isl_union_set *uset);
3543         #include <isl/map.h>
3544         __isl_give char *isl_map_to_str(
3545                 __isl_keep isl_map *map);
3547         #include <isl/union_map.h>
3548         __isl_give char *isl_union_map_to_str(
3549                 __isl_keep isl_union_map *umap);
3551         #include <isl/aff.h>
3552         __isl_give char *isl_multi_aff_to_str(
3553                 __isl_keep isl_multi_aff *aff);
3554         __isl_give char *isl_union_pw_aff_to_str(
3555                 __isl_keep isl_union_pw_aff *upa);
3556         __isl_give char *isl_union_pw_multi_aff_to_str(
3557                 __isl_keep isl_union_pw_multi_aff *upma);
3558         __isl_give char *isl_multi_union_pw_aff_to_str(
3559                 __isl_keep isl_multi_union_pw_aff *mupa);
3561 =head2 Properties
3563 =head3 Unary Properties
3565 =over
3567 =item * Emptiness
3569 The following functions test whether the given set or relation
3570 contains any integer points.  The ``plain'' variants do not perform
3571 any computations, but simply check if the given set or relation
3572 is already known to be empty.
3574         int isl_basic_set_plain_is_empty(__isl_keep isl_basic_set *bset);
3575         int isl_basic_set_is_empty(__isl_keep isl_basic_set *bset);
3576         int isl_set_plain_is_empty(__isl_keep isl_set *set);
3577         int isl_set_is_empty(__isl_keep isl_set *set);
3578         int isl_union_set_is_empty(__isl_keep isl_union_set *uset);
3579         int isl_basic_map_plain_is_empty(__isl_keep isl_basic_map *bmap);
3580         int isl_basic_map_is_empty(__isl_keep isl_basic_map *bmap);
3581         int isl_map_plain_is_empty(__isl_keep isl_map *map);
3582         int isl_map_is_empty(__isl_keep isl_map *map);
3583         int isl_union_map_is_empty(__isl_keep isl_union_map *umap);
3585 =item * Universality
3587         int isl_basic_set_is_universe(__isl_keep isl_basic_set *bset);
3588         int isl_basic_map_is_universe(__isl_keep isl_basic_map *bmap);
3589         int isl_set_plain_is_universe(__isl_keep isl_set *set);
3591 =item * Single-valuedness
3593         #include <isl/set.h>
3594         int isl_set_is_singleton(__isl_keep isl_set *set);
3596         #include <isl/map.h>
3597         int isl_basic_map_is_single_valued(
3598                 __isl_keep isl_basic_map *bmap);
3599         int isl_map_plain_is_single_valued(
3600                 __isl_keep isl_map *map);
3601         int isl_map_is_single_valued(__isl_keep isl_map *map);
3603         #include <isl/union_map.h>
3604         int isl_union_map_is_single_valued(__isl_keep isl_union_map *umap);
3606 =item * Injectivity
3608         int isl_map_plain_is_injective(__isl_keep isl_map *map);
3609         int isl_map_is_injective(__isl_keep isl_map *map);
3610         int isl_union_map_plain_is_injective(
3611                 __isl_keep isl_union_map *umap);
3612         int isl_union_map_is_injective(
3613                 __isl_keep isl_union_map *umap);
3615 =item * Bijectivity
3617         int isl_map_is_bijective(__isl_keep isl_map *map);
3618         int isl_union_map_is_bijective(__isl_keep isl_union_map *umap);
3620 =item * Position
3622         __isl_give isl_val *
3623         isl_basic_map_plain_get_val_if_fixed(
3624                 __isl_keep isl_basic_map *bmap,
3625                 enum isl_dim_type type, unsigned pos);
3626         __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3627                 __isl_keep isl_set *set,
3628                 enum isl_dim_type type, unsigned pos);
3629         __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3630                 __isl_keep isl_map *map,
3631                 enum isl_dim_type type, unsigned pos);
3633 If the set or relation obviously lies on a hyperplane where the given dimension
3634 has a fixed value, then return that value.
3635 Otherwise return NaN.
3637 =item * Stride
3639         int isl_set_dim_residue_class_val(
3640                 __isl_keep isl_set *set,
3641                 int pos, __isl_give isl_val **modulo,
3642                 __isl_give isl_val **residue);
3644 Check if the values of the given set dimension are equal to a fixed
3645 value modulo some integer value.  If so, assign the modulo to C<*modulo>
3646 and the fixed value to C<*residue>.  If the given dimension attains only
3647 a single value, then assign C<0> to C<*modulo> and the fixed value to
3648 C<*residue>.
3649 If the dimension does not attain only a single value and if no modulo
3650 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3652 =item * Dependence
3654 To check whether the description of a set, relation or function depends
3655 on one or more given dimensions,
3656 the following functions can be used.
3658         #include <isl/constraint.h>
3659         int isl_constraint_involves_dims(
3660                 __isl_keep isl_constraint *constraint,
3661                 enum isl_dim_type type, unsigned first, unsigned n);
3663         #include <isl/set.h>
3664         int isl_basic_set_involves_dims(
3665                 __isl_keep isl_basic_set *bset,
3666                 enum isl_dim_type type, unsigned first, unsigned n);
3667         int isl_set_involves_dims(__isl_keep isl_set *set,
3668                 enum isl_dim_type type, unsigned first, unsigned n);
3670         #include <isl/map.h>
3671         int isl_basic_map_involves_dims(
3672                 __isl_keep isl_basic_map *bmap,
3673                 enum isl_dim_type type, unsigned first, unsigned n);
3674         int isl_map_involves_dims(__isl_keep isl_map *map,
3675                 enum isl_dim_type type, unsigned first, unsigned n);
3677         #include <isl/union_map.h>
3678         int isl_union_map_involves_dims(
3679                 __isl_keep isl_union_map *umap,
3680                 enum isl_dim_type type, unsigned first, unsigned n);
3682         #include <isl/aff.h>
3683         int isl_aff_involves_dims(__isl_keep isl_aff *aff,
3684                 enum isl_dim_type type, unsigned first, unsigned n);
3685         int isl_pw_aff_involves_dims(__isl_keep isl_pw_aff *pwaff,
3686                 enum isl_dim_type type, unsigned first, unsigned n);
3687         int isl_multi_aff_involves_dims(
3688                 __isl_keep isl_multi_aff *ma,
3689                 enum isl_dim_type type, unsigned first, unsigned n);
3690         int isl_multi_pw_aff_involves_dims(
3691                 __isl_keep isl_multi_pw_aff *mpa,
3692                 enum isl_dim_type type, unsigned first, unsigned n);
3694 Similarly, the following functions can be used to check whether
3695 a given dimension is involved in any lower or upper bound.
3697         #include <isl/set.h>
3698         int isl_set_dim_has_any_lower_bound(__isl_keep isl_set *set,
3699                 enum isl_dim_type type, unsigned pos);
3700         int isl_set_dim_has_any_upper_bound(__isl_keep isl_set *set,
3701                 enum isl_dim_type type, unsigned pos);
3703 Note that these functions return true even if there is a bound on
3704 the dimension on only some of the basic sets of C<set>.
3705 To check if they have a bound for all of the basic sets in C<set>,
3706 use the following functions instead.
3708         #include <isl/set.h>
3709         int isl_set_dim_has_lower_bound(__isl_keep isl_set *set,
3710                 enum isl_dim_type type, unsigned pos);
3711         int isl_set_dim_has_upper_bound(__isl_keep isl_set *set,
3712                 enum isl_dim_type type, unsigned pos);
3714 =item * Space
3716 To check whether a set is a parameter domain, use this function:
3718         int isl_set_is_params(__isl_keep isl_set *set);
3719         int isl_union_set_is_params(
3720                 __isl_keep isl_union_set *uset);
3722 =item * Wrapping
3724 The following functions check whether the space of the given
3725 (basic) set or relation range is a wrapped relation.
3727         #include <isl/space.h>
3728         int isl_space_is_wrapping(
3729                 __isl_keep isl_space *space);
3730         int isl_space_domain_is_wrapping(
3731                 __isl_keep isl_space *space);
3732         int isl_space_range_is_wrapping(
3733                 __isl_keep isl_space *space);
3735         #include <isl/set.h>
3736         int isl_basic_set_is_wrapping(
3737                 __isl_keep isl_basic_set *bset);
3738         int isl_set_is_wrapping(__isl_keep isl_set *set);
3740         #include <isl/map.h>
3741         int isl_map_domain_is_wrapping(
3742                 __isl_keep isl_map *map);
3743         int isl_map_range_is_wrapping(
3744                 __isl_keep isl_map *map);
3746         #include <isl/val.h>
3747         int isl_multi_val_range_is_wrapping(
3748                 __isl_keep isl_multi_val *mv);
3750         #include <isl/aff.h>
3751         int isl_multi_aff_range_is_wrapping(
3752                 __isl_keep isl_multi_aff *ma);
3753         int isl_multi_pw_aff_range_is_wrapping(
3754                 __isl_keep isl_multi_pw_aff *mpa);
3755         int isl_multi_union_pw_aff_range_is_wrapping(
3756                 __isl_keep isl_multi_union_pw_aff *mupa);
3758 The input to C<isl_space_is_wrapping> should
3759 be the space of a set, while that of
3760 C<isl_space_domain_is_wrapping> and
3761 C<isl_space_range_is_wrapping> should be the space of a relation.
3763 =item * Internal Product
3765         int isl_basic_map_can_zip(
3766                 __isl_keep isl_basic_map *bmap);
3767         int isl_map_can_zip(__isl_keep isl_map *map);
3769 Check whether the product of domain and range of the given relation
3770 can be computed,
3771 i.e., whether both domain and range are nested relations.
3773 =item * Currying
3775         int isl_basic_map_can_curry(
3776                 __isl_keep isl_basic_map *bmap);
3777         int isl_map_can_curry(__isl_keep isl_map *map);
3779 Check whether the domain of the (basic) relation is a wrapped relation.
3781         int isl_basic_map_can_uncurry(
3782                 __isl_keep isl_basic_map *bmap);
3783         int isl_map_can_uncurry(__isl_keep isl_map *map);
3785 Check whether the range of the (basic) relation is a wrapped relation.
3787 =item * Special Values
3789         #include <isl/aff.h>
3790         int isl_aff_is_cst(__isl_keep isl_aff *aff);
3791         int isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
3793 Check whether the given expression is a constant.
3795         #include <isl/aff.h>
3796         int isl_aff_is_nan(__isl_keep isl_aff *aff);
3797         int isl_pw_aff_involves_nan(__isl_keep isl_pw_aff *pa);
3799 Check whether the given expression is equal to or involves NaN.
3801         #include <isl/aff.h>
3802         int isl_aff_plain_is_zero(__isl_keep isl_aff *aff);
3804 Check whether the affine expression is obviously zero.
3806 =back
3808 =head3 Binary Properties
3810 =over
3812 =item * Equality
3814 The following functions check whether two objects
3815 represent the same set, relation or function.
3816 The C<plain> variants only return true if the objects
3817 are obviously the same.  That is, they may return false
3818 even if the objects are the same, but they will never
3819 return true if the objects are not the same.
3821         #include <isl/set.h>
3822         int isl_basic_set_plain_is_equal(
3823                 __isl_keep isl_basic_set *bset1,
3824                 __isl_keep isl_basic_set *bset2);
3825         int isl_set_plain_is_equal(__isl_keep isl_set *set1,
3826                 __isl_keep isl_set *set2);
3827         int isl_set_is_equal(__isl_keep isl_set *set1,
3828                 __isl_keep isl_set *set2);
3830         #include <isl/map.h>
3831         int isl_basic_map_is_equal(
3832                 __isl_keep isl_basic_map *bmap1,
3833                 __isl_keep isl_basic_map *bmap2);
3834         int isl_map_is_equal(__isl_keep isl_map *map1,
3835                 __isl_keep isl_map *map2);
3836         int isl_map_plain_is_equal(__isl_keep isl_map *map1,
3837                 __isl_keep isl_map *map2);
3839         #include <isl/union_set.h>
3840         int isl_union_set_is_equal(
3841                 __isl_keep isl_union_set *uset1,
3842                 __isl_keep isl_union_set *uset2);
3844         #include <isl/union_map.h>
3845         int isl_union_map_is_equal(
3846                 __isl_keep isl_union_map *umap1,
3847                 __isl_keep isl_union_map *umap2);
3849         #include <isl/aff.h>
3850         int isl_aff_plain_is_equal(__isl_keep isl_aff *aff1,
3851                 __isl_keep isl_aff *aff2);
3852         int isl_multi_aff_plain_is_equal(
3853                 __isl_keep isl_multi_aff *maff1,
3854                 __isl_keep isl_multi_aff *maff2);
3855         int isl_pw_aff_plain_is_equal(
3856                 __isl_keep isl_pw_aff *pwaff1,
3857                 __isl_keep isl_pw_aff *pwaff2);
3858         int isl_pw_multi_aff_plain_is_equal(
3859                 __isl_keep isl_pw_multi_aff *pma1,
3860                 __isl_keep isl_pw_multi_aff *pma2);
3861         int isl_multi_pw_aff_plain_is_equal(
3862                 __isl_keep isl_multi_pw_aff *mpa1,
3863                 __isl_keep isl_multi_pw_aff *mpa2);
3864         int isl_multi_pw_aff_is_equal(
3865                 __isl_keep isl_multi_pw_aff *mpa1,
3866                 __isl_keep isl_multi_pw_aff *mpa2);
3867         int isl_union_pw_aff_plain_is_equal(
3868                 __isl_keep isl_union_pw_aff *upa1,
3869                 __isl_keep isl_union_pw_aff *upa2);
3870         int isl_union_pw_multi_aff_plain_is_equal(
3871                 __isl_keep isl_union_pw_multi_aff *upma1,
3872                 __isl_keep isl_union_pw_multi_aff *upma2);
3873         int isl_multi_union_pw_aff_plain_is_equal(
3874                 __isl_keep isl_multi_union_pw_aff *mupa1,
3875                 __isl_keep isl_multi_union_pw_aff *mupa2);
3877         #include <isl/polynomial.h>
3878         int isl_union_pw_qpolynomial_plain_is_equal(
3879                 __isl_keep isl_union_pw_qpolynomial *upwqp1,
3880                 __isl_keep isl_union_pw_qpolynomial *upwqp2);
3881         int isl_union_pw_qpolynomial_fold_plain_is_equal(
3882                 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
3883                 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
3885 =item * Disjointness
3887         #include <isl/set.h>
3888         int isl_basic_set_is_disjoint(
3889                 __isl_keep isl_basic_set *bset1,
3890                 __isl_keep isl_basic_set *bset2);
3891         int isl_set_plain_is_disjoint(__isl_keep isl_set *set1,
3892                 __isl_keep isl_set *set2);
3893         int isl_set_is_disjoint(__isl_keep isl_set *set1,
3894                 __isl_keep isl_set *set2);
3896         #include <isl/map.h>
3897         int isl_basic_map_is_disjoint(
3898                 __isl_keep isl_basic_map *bmap1,
3899                 __isl_keep isl_basic_map *bmap2);
3900         int isl_map_is_disjoint(__isl_keep isl_map *map1,
3901                 __isl_keep isl_map *map2);
3903         #include <isl/union_set.h>
3904         int isl_union_set_is_disjoint(
3905                 __isl_keep isl_union_set *uset1,
3906                 __isl_keep isl_union_set *uset2);
3908         #include <isl/union_map.h>
3909         int isl_union_map_is_disjoint(
3910                 __isl_keep isl_union_map *umap1,
3911                 __isl_keep isl_union_map *umap2);
3913 =item * Subset
3915         int isl_basic_set_is_subset(
3916                 __isl_keep isl_basic_set *bset1,
3917                 __isl_keep isl_basic_set *bset2);
3918         int isl_set_is_subset(__isl_keep isl_set *set1,
3919                 __isl_keep isl_set *set2);
3920         int isl_set_is_strict_subset(
3921                 __isl_keep isl_set *set1,
3922                 __isl_keep isl_set *set2);
3923         int isl_union_set_is_subset(
3924                 __isl_keep isl_union_set *uset1,
3925                 __isl_keep isl_union_set *uset2);
3926         int isl_union_set_is_strict_subset(
3927                 __isl_keep isl_union_set *uset1,
3928                 __isl_keep isl_union_set *uset2);
3929         int isl_basic_map_is_subset(
3930                 __isl_keep isl_basic_map *bmap1,
3931                 __isl_keep isl_basic_map *bmap2);
3932         int isl_basic_map_is_strict_subset(
3933                 __isl_keep isl_basic_map *bmap1,
3934                 __isl_keep isl_basic_map *bmap2);
3935         int isl_map_is_subset(
3936                 __isl_keep isl_map *map1,
3937                 __isl_keep isl_map *map2);
3938         int isl_map_is_strict_subset(
3939                 __isl_keep isl_map *map1,
3940                 __isl_keep isl_map *map2);
3941         int isl_union_map_is_subset(
3942                 __isl_keep isl_union_map *umap1,
3943                 __isl_keep isl_union_map *umap2);
3944         int isl_union_map_is_strict_subset(
3945                 __isl_keep isl_union_map *umap1,
3946                 __isl_keep isl_union_map *umap2);
3948 Check whether the first argument is a (strict) subset of the
3949 second argument.
3951 =item * Order
3953 Every comparison function returns a negative value if the first
3954 argument is considered smaller than the second, a positive value
3955 if the first argument is considered greater and zero if the two
3956 constraints are considered the same by the comparison criterion.
3958         #include <isl/constraint.h>
3959         int isl_constraint_plain_cmp(
3960                 __isl_keep isl_constraint *c1,
3961                 __isl_keep isl_constraint *c2);
3963 This function is useful for sorting C<isl_constraint>s.
3964 The order depends on the internal representation of the inputs.
3965 The order is fixed over different calls to the function (assuming
3966 the internal representation of the inputs has not changed), but may
3967 change over different versions of C<isl>.
3969         #include <isl/constraint.h>
3970         int isl_constraint_cmp_last_non_zero(
3971                 __isl_keep isl_constraint *c1,
3972                 __isl_keep isl_constraint *c2);
3974 This function can be used to sort constraints that live in the same
3975 local space.  Constraints that involve ``earlier'' dimensions or
3976 that have a smaller coefficient for the shared latest dimension
3977 are considered smaller than other constraints.
3978 This function only defines a B<partial> order.
3980         #include <isl/set.h>
3981         int isl_set_plain_cmp(__isl_keep isl_set *set1,
3982                 __isl_keep isl_set *set2);
3984 This function is useful for sorting C<isl_set>s.
3985 The order depends on the internal representation of the inputs.
3986 The order is fixed over different calls to the function (assuming
3987 the internal representation of the inputs has not changed), but may
3988 change over different versions of C<isl>.
3990         #include <isl/aff.h>
3991         int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
3992                 __isl_keep isl_pw_aff *pa2);
3994 The function C<isl_pw_aff_plain_cmp> can be used to sort
3995 C<isl_pw_aff>s.  The order is not strictly defined.
3996 The current order sorts expressions that only involve
3997 earlier dimensions before those that involve later dimensions.
3999 =back
4001 =head2 Unary Operations
4003 =over
4005 =item * Complement
4007         __isl_give isl_set *isl_set_complement(
4008                 __isl_take isl_set *set);
4009         __isl_give isl_map *isl_map_complement(
4010                 __isl_take isl_map *map);
4012 =item * Inverse map
4014         #include <isl/space.h>
4015         __isl_give isl_space *isl_space_reverse(
4016                 __isl_take isl_space *space);
4018         #include <isl/map.h>
4019         __isl_give isl_basic_map *isl_basic_map_reverse(
4020                 __isl_take isl_basic_map *bmap);
4021         __isl_give isl_map *isl_map_reverse(
4022                 __isl_take isl_map *map);
4024         #include <isl/union_map.h>
4025         __isl_give isl_union_map *isl_union_map_reverse(
4026                 __isl_take isl_union_map *umap);
4028 =item * Projection
4030         #include <isl/space.h>
4031         __isl_give isl_space *isl_space_domain(
4032                 __isl_take isl_space *space);
4033         __isl_give isl_space *isl_space_range(
4034                 __isl_take isl_space *space);
4035         __isl_give isl_space *isl_space_params(
4036                 __isl_take isl_space *space);
4038         #include <isl/local_space.h>
4039         __isl_give isl_local_space *isl_local_space_domain(
4040                 __isl_take isl_local_space *ls);
4041         __isl_give isl_local_space *isl_local_space_range(
4042                 __isl_take isl_local_space *ls);
4044         #include <isl/set.h>
4045         __isl_give isl_basic_set *isl_basic_set_project_out(
4046                 __isl_take isl_basic_set *bset,
4047                 enum isl_dim_type type, unsigned first, unsigned n);
4048         __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
4049                 enum isl_dim_type type, unsigned first, unsigned n);
4050         __isl_give isl_basic_set *isl_basic_set_params(
4051                 __isl_take isl_basic_set *bset);
4052         __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
4054         #include <isl/map.h>
4055         __isl_give isl_basic_map *isl_basic_map_project_out(
4056                 __isl_take isl_basic_map *bmap,
4057                 enum isl_dim_type type, unsigned first, unsigned n);
4058         __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
4059                 enum isl_dim_type type, unsigned first, unsigned n);
4060         __isl_give isl_basic_set *isl_basic_map_domain(
4061                 __isl_take isl_basic_map *bmap);
4062         __isl_give isl_basic_set *isl_basic_map_range(
4063                 __isl_take isl_basic_map *bmap);
4064         __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
4065         __isl_give isl_set *isl_map_domain(
4066                 __isl_take isl_map *bmap);
4067         __isl_give isl_set *isl_map_range(
4068                 __isl_take isl_map *map);
4070         #include <isl/union_set.h>
4071         __isl_give isl_union_set *isl_union_set_project_out(
4072                 __isl_take isl_union_set *uset,
4073                 enum isl_dim_type type,
4074                 unsigned first, unsigned n);
4075         __isl_give isl_set *isl_union_set_params(
4076                 __isl_take isl_union_set *uset);
4078 The function C<isl_union_set_project_out> can only project out
4079 parameters.
4081         #include <isl/union_map.h>
4082         __isl_give isl_union_map *isl_union_map_project_out(
4083                 __isl_take isl_union_map *umap,
4084                 enum isl_dim_type type, unsigned first, unsigned n);
4085         __isl_give isl_set *isl_union_map_params(
4086                 __isl_take isl_union_map *umap);
4087         __isl_give isl_union_set *isl_union_map_domain(
4088                 __isl_take isl_union_map *umap);
4089         __isl_give isl_union_set *isl_union_map_range(
4090                 __isl_take isl_union_map *umap);
4092 The function C<isl_union_map_project_out> can only project out
4093 parameters.
4095         #include <isl/aff.h>
4096         __isl_give isl_aff *isl_aff_project_domain_on_params(
4097                 __isl_take isl_aff *aff);
4098         __isl_give isl_pw_multi_aff *
4099         isl_pw_multi_aff_project_domain_on_params(
4100                 __isl_take isl_pw_multi_aff *pma);
4101         __isl_give isl_set *isl_pw_aff_domain(
4102                 __isl_take isl_pw_aff *pwaff);
4103         __isl_give isl_set *isl_pw_multi_aff_domain(
4104                 __isl_take isl_pw_multi_aff *pma);
4105         __isl_give isl_set *isl_multi_pw_aff_domain(
4106                 __isl_take isl_multi_pw_aff *mpa);
4107         __isl_give isl_union_set *isl_union_pw_aff_domain(
4108                 __isl_take isl_union_pw_aff *upa);
4109         __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
4110                 __isl_take isl_union_pw_multi_aff *upma);
4111         __isl_give isl_union_set *
4112         isl_multi_union_pw_aff_domain(
4113                 __isl_take isl_multi_union_pw_aff *mupa);
4114         __isl_give isl_set *isl_pw_aff_params(
4115                 __isl_take isl_pw_aff *pwa);
4117 The function C<isl_multi_union_pw_aff_domain> requires its
4118 input to have at least one set dimension.
4120         #include <isl/polynomial.h>
4121         __isl_give isl_qpolynomial *
4122         isl_qpolynomial_project_domain_on_params(
4123                 __isl_take isl_qpolynomial *qp);
4124         __isl_give isl_pw_qpolynomial *
4125         isl_pw_qpolynomial_project_domain_on_params(
4126                 __isl_take isl_pw_qpolynomial *pwqp);
4127         __isl_give isl_pw_qpolynomial_fold *
4128         isl_pw_qpolynomial_fold_project_domain_on_params(
4129                 __isl_take isl_pw_qpolynomial_fold *pwf);
4130         __isl_give isl_set *isl_pw_qpolynomial_domain(
4131                 __isl_take isl_pw_qpolynomial *pwqp);
4132         __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
4133                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4134         __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
4135                 __isl_take isl_union_pw_qpolynomial *upwqp);
4137         #include <isl/space.h>
4138         __isl_give isl_space *isl_space_domain_map(
4139                 __isl_take isl_space *space);
4140         __isl_give isl_space *isl_space_range_map(
4141                 __isl_take isl_space *space);
4143         #include <isl/map.h>
4144         __isl_give isl_map *isl_set_wrapped_domain_map(
4145                 __isl_take isl_set *set);
4146         __isl_give isl_basic_map *isl_basic_map_domain_map(
4147                 __isl_take isl_basic_map *bmap);
4148         __isl_give isl_basic_map *isl_basic_map_range_map(
4149                 __isl_take isl_basic_map *bmap);
4150         __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
4151         __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
4153         #include <isl/union_map.h>
4154         __isl_give isl_union_map *isl_union_map_domain_map(
4155                 __isl_take isl_union_map *umap);
4156         __isl_give isl_union_pw_multi_aff *
4157         isl_union_map_domain_map_union_pw_multi_aff(
4158                 __isl_take isl_union_map *umap);
4159         __isl_give isl_union_map *isl_union_map_range_map(
4160                 __isl_take isl_union_map *umap);
4161         __isl_give isl_union_map *
4162         isl_union_set_wrapped_domain_map(
4163                 __isl_take isl_union_set *uset);
4165 The functions above construct a (basic, regular or union) relation
4166 that maps (a wrapped version of) the input relation to its domain or range.
4167 C<isl_set_wrapped_domain_map> maps the input set to the domain
4168 of its wrapped relation.
4170 =item * Elimination
4172         __isl_give isl_basic_set *isl_basic_set_eliminate(
4173                 __isl_take isl_basic_set *bset,
4174                 enum isl_dim_type type,
4175                 unsigned first, unsigned n);
4176         __isl_give isl_set *isl_set_eliminate(
4177                 __isl_take isl_set *set, enum isl_dim_type type,
4178                 unsigned first, unsigned n);
4179         __isl_give isl_basic_map *isl_basic_map_eliminate(
4180                 __isl_take isl_basic_map *bmap,
4181                 enum isl_dim_type type,
4182                 unsigned first, unsigned n);
4183         __isl_give isl_map *isl_map_eliminate(
4184                 __isl_take isl_map *map, enum isl_dim_type type,
4185                 unsigned first, unsigned n);
4187 Eliminate the coefficients for the given dimensions from the constraints,
4188 without removing the dimensions.
4190 =item * Constructing a set from a parameter domain
4192 A zero-dimensional space or (basic) set can be constructed
4193 on a given parameter domain using the following functions.
4195         #include <isl/space.h>
4196         __isl_give isl_space *isl_space_set_from_params(
4197                 __isl_take isl_space *space);
4199         #include <isl/set.h>
4200         __isl_give isl_basic_set *isl_basic_set_from_params(
4201                 __isl_take isl_basic_set *bset);
4202         __isl_give isl_set *isl_set_from_params(
4203                 __isl_take isl_set *set);
4205 =item * Constructing a relation from a set
4207 Create a relation with the given set as domain or range.
4208 The range or domain of the created relation is a zero-dimensional
4209 flat anonymous space.
4211         #include <isl/space.h>
4212         __isl_give isl_space *isl_space_from_domain(
4213                 __isl_take isl_space *space);
4214         __isl_give isl_space *isl_space_from_range(
4215                 __isl_take isl_space *space);
4216         __isl_give isl_space *isl_space_map_from_set(
4217                 __isl_take isl_space *space);
4218         __isl_give isl_space *isl_space_map_from_domain_and_range(
4219                 __isl_take isl_space *domain,
4220                 __isl_take isl_space *range);
4222         #include <isl/local_space.h>
4223         __isl_give isl_local_space *isl_local_space_from_domain(
4224                 __isl_take isl_local_space *ls);
4226         #include <isl/map.h>
4227         __isl_give isl_map *isl_map_from_domain(
4228                 __isl_take isl_set *set);
4229         __isl_give isl_map *isl_map_from_range(
4230                 __isl_take isl_set *set);
4232         #include <isl/val.h>
4233         __isl_give isl_multi_val *isl_multi_val_from_range(
4234                 __isl_take isl_multi_val *mv);
4236         #include <isl/aff.h>
4237         __isl_give isl_multi_aff *isl_multi_aff_from_range(
4238                 __isl_take isl_multi_aff *ma);
4239         __isl_give isl_pw_aff *isl_pw_aff_from_range(
4240                 __isl_take isl_pw_aff *pwa);
4241         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
4242                 __isl_take isl_multi_pw_aff *mpa);
4243         __isl_give isl_multi_union_pw_aff *
4244         isl_multi_union_pw_aff_from_range(
4245                 __isl_take isl_multi_union_pw_aff *mupa);
4246         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
4247                 __isl_take isl_set *set);
4248         __isl_give isl_union_pw_multi_aff *
4249         isl_union_pw_multi_aff_from_domain(
4250                 __isl_take isl_union_set *uset);
4252 =item * Slicing
4254         #include <isl/set.h>
4255         __isl_give isl_basic_set *isl_basic_set_fix_si(
4256                 __isl_take isl_basic_set *bset,
4257                 enum isl_dim_type type, unsigned pos, int value);
4258         __isl_give isl_basic_set *isl_basic_set_fix_val(
4259                 __isl_take isl_basic_set *bset,
4260                 enum isl_dim_type type, unsigned pos,
4261                 __isl_take isl_val *v);
4262         __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
4263                 enum isl_dim_type type, unsigned pos, int value);
4264         __isl_give isl_set *isl_set_fix_val(
4265                 __isl_take isl_set *set,
4266                 enum isl_dim_type type, unsigned pos,
4267                 __isl_take isl_val *v);
4269         #include <isl/map.h>
4270         __isl_give isl_basic_map *isl_basic_map_fix_si(
4271                 __isl_take isl_basic_map *bmap,
4272                 enum isl_dim_type type, unsigned pos, int value);
4273         __isl_give isl_basic_map *isl_basic_map_fix_val(
4274                 __isl_take isl_basic_map *bmap,
4275                 enum isl_dim_type type, unsigned pos,
4276                 __isl_take isl_val *v);
4277         __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
4278                 enum isl_dim_type type, unsigned pos, int value);
4279         __isl_give isl_map *isl_map_fix_val(
4280                 __isl_take isl_map *map,
4281                 enum isl_dim_type type, unsigned pos,
4282                 __isl_take isl_val *v);
4284         #include <isl/aff.h>
4285         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
4286                 __isl_take isl_pw_multi_aff *pma,
4287                 enum isl_dim_type type, unsigned pos, int value);
4289         #include <isl/polynomial.h>
4290         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
4291                 __isl_take isl_pw_qpolynomial *pwqp,
4292                 enum isl_dim_type type, unsigned n,
4293                 __isl_take isl_val *v);
4295 Intersect the set, relation or function domain
4296 with the hyperplane where the given
4297 dimension has the fixed given value.
4299         __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
4300                 __isl_take isl_basic_map *bmap,
4301                 enum isl_dim_type type, unsigned pos, int value);
4302         __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
4303                 __isl_take isl_basic_map *bmap,
4304                 enum isl_dim_type type, unsigned pos, int value);
4305         __isl_give isl_set *isl_set_lower_bound_si(
4306                 __isl_take isl_set *set,
4307                 enum isl_dim_type type, unsigned pos, int value);
4308         __isl_give isl_set *isl_set_lower_bound_val(
4309                 __isl_take isl_set *set,
4310                 enum isl_dim_type type, unsigned pos,
4311                 __isl_take isl_val *value);
4312         __isl_give isl_map *isl_map_lower_bound_si(
4313                 __isl_take isl_map *map,
4314                 enum isl_dim_type type, unsigned pos, int value);
4315         __isl_give isl_set *isl_set_upper_bound_si(
4316                 __isl_take isl_set *set,
4317                 enum isl_dim_type type, unsigned pos, int value);
4318         __isl_give isl_set *isl_set_upper_bound_val(
4319                 __isl_take isl_set *set,
4320                 enum isl_dim_type type, unsigned pos,
4321                 __isl_take isl_val *value);
4322         __isl_give isl_map *isl_map_upper_bound_si(
4323                 __isl_take isl_map *map,
4324                 enum isl_dim_type type, unsigned pos, int value);
4326 Intersect the set or relation with the half-space where the given
4327 dimension has a value bounded by the fixed given integer value.
4329         __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
4330                 enum isl_dim_type type1, int pos1,
4331                 enum isl_dim_type type2, int pos2);
4332         __isl_give isl_basic_map *isl_basic_map_equate(
4333                 __isl_take isl_basic_map *bmap,
4334                 enum isl_dim_type type1, int pos1,
4335                 enum isl_dim_type type2, int pos2);
4336         __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
4337                 enum isl_dim_type type1, int pos1,
4338                 enum isl_dim_type type2, int pos2);
4340 Intersect the set or relation with the hyperplane where the given
4341 dimensions are equal to each other.
4343         __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4344                 enum isl_dim_type type1, int pos1,
4345                 enum isl_dim_type type2, int pos2);
4347 Intersect the relation with the hyperplane where the given
4348 dimensions have opposite values.
4350         __isl_give isl_map *isl_map_order_le(
4351                 __isl_take isl_map *map,
4352                 enum isl_dim_type type1, int pos1,
4353                 enum isl_dim_type type2, int pos2);
4354         __isl_give isl_basic_map *isl_basic_map_order_ge(
4355                 __isl_take isl_basic_map *bmap,
4356                 enum isl_dim_type type1, int pos1,
4357                 enum isl_dim_type type2, int pos2);
4358         __isl_give isl_map *isl_map_order_ge(
4359                 __isl_take isl_map *map,
4360                 enum isl_dim_type type1, int pos1,
4361                 enum isl_dim_type type2, int pos2);
4362         __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4363                 enum isl_dim_type type1, int pos1,
4364                 enum isl_dim_type type2, int pos2);
4365         __isl_give isl_basic_map *isl_basic_map_order_gt(
4366                 __isl_take isl_basic_map *bmap,
4367                 enum isl_dim_type type1, int pos1,
4368                 enum isl_dim_type type2, int pos2);
4369         __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4370                 enum isl_dim_type type1, int pos1,
4371                 enum isl_dim_type type2, int pos2);
4373 Intersect the relation with the half-space where the given
4374 dimensions satisfy the given ordering.
4376 =item * Locus
4378         #include <isl/aff.h>
4379         __isl_give isl_basic_set *isl_aff_zero_basic_set(
4380                 __isl_take isl_aff *aff);
4381         __isl_give isl_basic_set *isl_aff_neg_basic_set(
4382                 __isl_take isl_aff *aff);
4383         __isl_give isl_set *isl_pw_aff_pos_set(
4384                 __isl_take isl_pw_aff *pa);
4385         __isl_give isl_set *isl_pw_aff_nonneg_set(
4386                 __isl_take isl_pw_aff *pwaff);
4387         __isl_give isl_set *isl_pw_aff_zero_set(
4388                 __isl_take isl_pw_aff *pwaff);
4389         __isl_give isl_set *isl_pw_aff_non_zero_set(
4390                 __isl_take isl_pw_aff *pwaff);
4391         __isl_give isl_union_set *
4392         isl_union_pw_aff_zero_union_set(
4393                 __isl_take isl_union_pw_aff *upa);
4394         __isl_give isl_union_set *
4395         isl_multi_union_pw_aff_zero_union_set(
4396                 __isl_take isl_multi_union_pw_aff *mupa);
4398 The function C<isl_aff_neg_basic_set> returns a basic set
4399 containing those elements in the domain space
4400 of C<aff> where C<aff> is negative.
4401 The function C<isl_pw_aff_nonneg_set> returns a set
4402 containing those elements in the domain
4403 of C<pwaff> where C<pwaff> is non-negative.
4404 The function C<isl_multi_union_pw_aff_zero_union_set>
4405 returns a union set containing those elements
4406 in the domains of its elements where they are all zero.
4408 =item * Identity
4410         __isl_give isl_map *isl_set_identity(
4411                 __isl_take isl_set *set);
4412         __isl_give isl_union_map *isl_union_set_identity(
4413                 __isl_take isl_union_set *uset);
4414         __isl_give isl_union_pw_multi_aff *
4415         isl_union_set_identity_union_pw_multi_aff(
4416                 __isl_take isl_union_set *uset);
4418 Construct an identity relation on the given (union) set.
4420 =item * Function Extraction
4422 A piecewise quasi affine expression that is equal to 1 on a set
4423 and 0 outside the set can be created using the following function.
4425         #include <isl/aff.h>
4426         __isl_give isl_pw_aff *isl_set_indicator_function(
4427                 __isl_take isl_set *set);
4429 A piecewise multiple quasi affine expression can be extracted
4430 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4431 and the C<isl_map> is single-valued.
4432 In case of a conversion from an C<isl_union_map>
4433 to an C<isl_union_pw_multi_aff>, these properties need to hold
4434 in each domain space.
4435 A conversion to a C<isl_multi_union_pw_aff> additionally
4436 requires that the input is non-empty and involves only a single
4437 range space.
4439         #include <isl/aff.h>
4440         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4441                 __isl_take isl_set *set);
4442         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4443                 __isl_take isl_map *map);
4445         __isl_give isl_union_pw_multi_aff *
4446         isl_union_pw_multi_aff_from_union_set(
4447                 __isl_take isl_union_set *uset);
4448         __isl_give isl_union_pw_multi_aff *
4449         isl_union_pw_multi_aff_from_union_map(
4450                 __isl_take isl_union_map *umap);
4452         __isl_give isl_multi_union_pw_aff *
4453         isl_multi_union_pw_aff_from_union_map(
4454                 __isl_take isl_union_map *umap);
4456 =item * Deltas
4458         __isl_give isl_basic_set *isl_basic_map_deltas(
4459                 __isl_take isl_basic_map *bmap);
4460         __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
4461         __isl_give isl_union_set *isl_union_map_deltas(
4462                 __isl_take isl_union_map *umap);
4464 These functions return a (basic) set containing the differences
4465 between image elements and corresponding domain elements in the input.
4467         __isl_give isl_basic_map *isl_basic_map_deltas_map(
4468                 __isl_take isl_basic_map *bmap);
4469         __isl_give isl_map *isl_map_deltas_map(
4470                 __isl_take isl_map *map);
4471         __isl_give isl_union_map *isl_union_map_deltas_map(
4472                 __isl_take isl_union_map *umap);
4474 The functions above construct a (basic, regular or union) relation
4475 that maps (a wrapped version of) the input relation to its delta set.
4477 =item * Coalescing
4479 Simplify the representation of a set, relation or functions by trying
4480 to combine pairs of basic sets or relations into a single
4481 basic set or relation.
4483         #include <isl/set.h>
4484         __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
4486         #include <isl/map.h>
4487         __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
4489         #include <isl/union_set.h>
4490         __isl_give isl_union_set *isl_union_set_coalesce(
4491                 __isl_take isl_union_set *uset);
4493         #include <isl/union_map.h>
4494         __isl_give isl_union_map *isl_union_map_coalesce(
4495                 __isl_take isl_union_map *umap);
4497         #include <isl/aff.h>
4498         __isl_give isl_pw_aff *isl_pw_aff_coalesce(
4499                 __isl_take isl_pw_aff *pwqp);
4500         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
4501                 __isl_take isl_pw_multi_aff *pma);
4502         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
4503                 __isl_take isl_multi_pw_aff *mpa);
4504         __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
4505                 __isl_take isl_union_pw_aff *upa);
4506         __isl_give isl_union_pw_multi_aff *
4507         isl_union_pw_multi_aff_coalesce(
4508                 __isl_take isl_union_pw_multi_aff *upma);
4510         #include <isl/polynomial.h>
4511         __isl_give isl_pw_qpolynomial_fold *
4512         isl_pw_qpolynomial_fold_coalesce(
4513                 __isl_take isl_pw_qpolynomial_fold *pwf);
4514         __isl_give isl_union_pw_qpolynomial *
4515         isl_union_pw_qpolynomial_coalesce(
4516                 __isl_take isl_union_pw_qpolynomial *upwqp);
4517         __isl_give isl_union_pw_qpolynomial_fold *
4518         isl_union_pw_qpolynomial_fold_coalesce(
4519                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4521 One of the methods for combining pairs of basic sets or relations
4522 can result in coefficients that are much larger than those that appear
4523 in the constraints of the input.  By default, the coefficients are
4524 not allowed to grow larger, but this can be changed by unsetting
4525 the following option.
4527         int isl_options_set_coalesce_bounded_wrapping(
4528                 isl_ctx *ctx, int val);
4529         int isl_options_get_coalesce_bounded_wrapping(
4530                 isl_ctx *ctx);
4532 =item * Detecting equalities
4534         __isl_give isl_basic_set *isl_basic_set_detect_equalities(
4535                 __isl_take isl_basic_set *bset);
4536         __isl_give isl_basic_map *isl_basic_map_detect_equalities(
4537                 __isl_take isl_basic_map *bmap);
4538         __isl_give isl_set *isl_set_detect_equalities(
4539                 __isl_take isl_set *set);
4540         __isl_give isl_map *isl_map_detect_equalities(
4541                 __isl_take isl_map *map);
4542         __isl_give isl_union_set *isl_union_set_detect_equalities(
4543                 __isl_take isl_union_set *uset);
4544         __isl_give isl_union_map *isl_union_map_detect_equalities(
4545                 __isl_take isl_union_map *umap);
4547 Simplify the representation of a set or relation by detecting implicit
4548 equalities.
4550 =item * Removing redundant constraints
4552         #include <isl/set.h>
4553         __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
4554                 __isl_take isl_basic_set *bset);
4555         __isl_give isl_set *isl_set_remove_redundancies(
4556                 __isl_take isl_set *set);
4558         #include <isl/union_set.h>
4559         __isl_give isl_union_set *
4560         isl_union_set_remove_redundancies(
4561                 __isl_take isl_union_set *uset);
4563         #include <isl/map.h>
4564         __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
4565                 __isl_take isl_basic_map *bmap);
4566         __isl_give isl_map *isl_map_remove_redundancies(
4567                 __isl_take isl_map *map);
4569         #include <isl/union_map.h>
4570         __isl_give isl_union_map *
4571         isl_union_map_remove_redundancies(
4572                 __isl_take isl_union_map *umap);
4574 =item * Convex hull
4576         __isl_give isl_basic_set *isl_set_convex_hull(
4577                 __isl_take isl_set *set);
4578         __isl_give isl_basic_map *isl_map_convex_hull(
4579                 __isl_take isl_map *map);
4581 If the input set or relation has any existentially quantified
4582 variables, then the result of these operations is currently undefined.
4584 =item * Simple hull
4586         #include <isl/set.h>
4587         __isl_give isl_basic_set *
4588         isl_set_unshifted_simple_hull(
4589                 __isl_take isl_set *set);
4590         __isl_give isl_basic_set *isl_set_simple_hull(
4591                 __isl_take isl_set *set);
4592         __isl_give isl_basic_set *
4593         isl_set_unshifted_simple_hull_from_set_list(
4594                 __isl_take isl_set *set,
4595                 __isl_take isl_set_list *list);
4597         #include <isl/map.h>
4598         __isl_give isl_basic_map *
4599         isl_map_unshifted_simple_hull(
4600                 __isl_take isl_map *map);
4601         __isl_give isl_basic_map *isl_map_simple_hull(
4602                 __isl_take isl_map *map);
4603         __isl_give isl_basic_map *
4604         isl_map_unshifted_simple_hull_from_map_list(
4605                 __isl_take isl_map *map,
4606                 __isl_take isl_map_list *list);
4608         #include <isl/union_map.h>
4609         __isl_give isl_union_map *isl_union_map_simple_hull(
4610                 __isl_take isl_union_map *umap);
4612 These functions compute a single basic set or relation
4613 that contains the whole input set or relation.
4614 In particular, the output is described by translates
4615 of the constraints describing the basic sets or relations in the input.
4616 In case of C<isl_set_unshifted_simple_hull>, only the original
4617 constraints are used, without any translation.
4618 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
4619 C<isl_map_unshifted_simple_hull_from_map_list>, the
4620 constraints are taken from the elements of the second argument.
4622 =begin latex
4624 (See \autoref{s:simple hull}.)
4626 =end latex
4628 =item * Affine hull
4630         __isl_give isl_basic_set *isl_basic_set_affine_hull(
4631                 __isl_take isl_basic_set *bset);
4632         __isl_give isl_basic_set *isl_set_affine_hull(
4633                 __isl_take isl_set *set);
4634         __isl_give isl_union_set *isl_union_set_affine_hull(
4635                 __isl_take isl_union_set *uset);
4636         __isl_give isl_basic_map *isl_basic_map_affine_hull(
4637                 __isl_take isl_basic_map *bmap);
4638         __isl_give isl_basic_map *isl_map_affine_hull(
4639                 __isl_take isl_map *map);
4640         __isl_give isl_union_map *isl_union_map_affine_hull(
4641                 __isl_take isl_union_map *umap);
4643 In case of union sets and relations, the affine hull is computed
4644 per space.
4646 =item * Polyhedral hull
4648         __isl_give isl_basic_set *isl_set_polyhedral_hull(
4649                 __isl_take isl_set *set);
4650         __isl_give isl_basic_map *isl_map_polyhedral_hull(
4651                 __isl_take isl_map *map);
4652         __isl_give isl_union_set *isl_union_set_polyhedral_hull(
4653                 __isl_take isl_union_set *uset);
4654         __isl_give isl_union_map *isl_union_map_polyhedral_hull(
4655                 __isl_take isl_union_map *umap);
4657 These functions compute a single basic set or relation
4658 not involving any existentially quantified variables
4659 that contains the whole input set or relation.
4660 In case of union sets and relations, the polyhedral hull is computed
4661 per space.
4663 =item * Other approximations
4665         #include <isl/set.h>
4666         __isl_give isl_basic_set *
4667         isl_basic_set_drop_constraints_involving_dims(
4668                 __isl_take isl_basic_set *bset,
4669                 enum isl_dim_type type,
4670                 unsigned first, unsigned n);
4671         __isl_give isl_basic_set *
4672         isl_basic_set_drop_constraints_not_involving_dims(
4673                 __isl_take isl_basic_set *bset,
4674                 enum isl_dim_type type,
4675                 unsigned first, unsigned n);
4676         __isl_give isl_set *
4677         isl_set_drop_constraints_involving_dims(
4678                 __isl_take isl_set *set,
4679                 enum isl_dim_type type,
4680                 unsigned first, unsigned n);
4682         #include <isl/map.h>
4683         __isl_give isl_basic_map *
4684         isl_basic_map_drop_constraints_involving_dims(
4685                 __isl_take isl_basic_map *bmap,
4686                 enum isl_dim_type type,
4687                 unsigned first, unsigned n);
4688         __isl_give isl_map *
4689         isl_map_drop_constraints_involving_dims(
4690                 __isl_take isl_map *map,
4691                 enum isl_dim_type type,
4692                 unsigned first, unsigned n);
4694 These functions drop any constraints (not) involving the specified dimensions.
4695 Note that the result depends on the representation of the input.
4697         #include <isl/polynomial.h>
4698         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
4699                 __isl_take isl_pw_qpolynomial *pwqp, int sign);
4700         __isl_give isl_union_pw_qpolynomial *
4701         isl_union_pw_qpolynomial_to_polynomial(
4702                 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
4704 Approximate each quasipolynomial by a polynomial.  If C<sign> is positive,
4705 the polynomial will be an overapproximation.  If C<sign> is negative,
4706 it will be an underapproximation.  If C<sign> is zero, the approximation
4707 will lie somewhere in between.
4709 =item * Feasibility
4711         __isl_give isl_basic_set *isl_basic_set_sample(
4712                 __isl_take isl_basic_set *bset);
4713         __isl_give isl_basic_set *isl_set_sample(
4714                 __isl_take isl_set *set);
4715         __isl_give isl_basic_map *isl_basic_map_sample(
4716                 __isl_take isl_basic_map *bmap);
4717         __isl_give isl_basic_map *isl_map_sample(
4718                 __isl_take isl_map *map);
4720 If the input (basic) set or relation is non-empty, then return
4721 a singleton subset of the input.  Otherwise, return an empty set.
4723 =item * Optimization
4725         #include <isl/ilp.h>
4726         __isl_give isl_val *isl_basic_set_max_val(
4727                 __isl_keep isl_basic_set *bset,
4728                 __isl_keep isl_aff *obj);
4729         __isl_give isl_val *isl_set_min_val(
4730                 __isl_keep isl_set *set,
4731                 __isl_keep isl_aff *obj);
4732         __isl_give isl_val *isl_set_max_val(
4733                 __isl_keep isl_set *set,
4734                 __isl_keep isl_aff *obj);
4736 Compute the minimum or maximum of the integer affine expression C<obj>
4737 over the points in C<set>, returning the result in C<opt>.
4738 The result is C<NULL> in case of an error, the optimal value in case
4739 there is one, negative infinity or infinity if the problem is unbounded and
4740 NaN if the problem is empty.
4742 =item * Parametric optimization
4744         __isl_give isl_pw_aff *isl_set_dim_min(
4745                 __isl_take isl_set *set, int pos);
4746         __isl_give isl_pw_aff *isl_set_dim_max(
4747                 __isl_take isl_set *set, int pos);
4748         __isl_give isl_pw_aff *isl_map_dim_max(
4749                 __isl_take isl_map *map, int pos);
4751 Compute the minimum or maximum of the given set or output dimension
4752 as a function of the parameters (and input dimensions), but independently
4753 of the other set or output dimensions.
4754 For lexicographic optimization, see L<"Lexicographic Optimization">.
4756 =item * Dual
4758 The following functions compute either the set of (rational) coefficient
4759 values of valid constraints for the given set or the set of (rational)
4760 values satisfying the constraints with coefficients from the given set.
4761 Internally, these two sets of functions perform essentially the
4762 same operations, except that the set of coefficients is assumed to
4763 be a cone, while the set of values may be any polyhedron.
4764 The current implementation is based on the Farkas lemma and
4765 Fourier-Motzkin elimination, but this may change or be made optional
4766 in future.  In particular, future implementations may use different
4767 dualization algorithms or skip the elimination step.
4769         __isl_give isl_basic_set *isl_basic_set_coefficients(
4770                 __isl_take isl_basic_set *bset);
4771         __isl_give isl_basic_set *isl_set_coefficients(
4772                 __isl_take isl_set *set);
4773         __isl_give isl_union_set *isl_union_set_coefficients(
4774                 __isl_take isl_union_set *bset);
4775         __isl_give isl_basic_set *isl_basic_set_solutions(
4776                 __isl_take isl_basic_set *bset);
4777         __isl_give isl_basic_set *isl_set_solutions(
4778                 __isl_take isl_set *set);
4779         __isl_give isl_union_set *isl_union_set_solutions(
4780                 __isl_take isl_union_set *bset);
4782 =item * Power
4784         __isl_give isl_map *isl_map_fixed_power_val(
4785                 __isl_take isl_map *map,
4786                 __isl_take isl_val *exp);
4787         __isl_give isl_union_map *
4788         isl_union_map_fixed_power_val(
4789                 __isl_take isl_union_map *umap,
4790                 __isl_take isl_val *exp);
4792 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
4793 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
4794 of C<map> is computed.
4796         __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
4797                 int *exact);
4798         __isl_give isl_union_map *isl_union_map_power(
4799                 __isl_take isl_union_map *umap, int *exact);
4801 Compute a parametric representation for all positive powers I<k> of C<map>.
4802 The result maps I<k> to a nested relation corresponding to the
4803 I<k>th power of C<map>.
4804 The result may be an overapproximation.  If the result is known to be exact,
4805 then C<*exact> is set to C<1>.
4807 =item * Transitive closure
4809         __isl_give isl_map *isl_map_transitive_closure(
4810                 __isl_take isl_map *map, int *exact);
4811         __isl_give isl_union_map *isl_union_map_transitive_closure(
4812                 __isl_take isl_union_map *umap, int *exact);
4814 Compute the transitive closure of C<map>.
4815 The result may be an overapproximation.  If the result is known to be exact,
4816 then C<*exact> is set to C<1>.
4818 =item * Reaching path lengths
4820         __isl_give isl_map *isl_map_reaching_path_lengths(
4821                 __isl_take isl_map *map, int *exact);
4823 Compute a relation that maps each element in the range of C<map>
4824 to the lengths of all paths composed of edges in C<map> that
4825 end up in the given element.
4826 The result may be an overapproximation.  If the result is known to be exact,
4827 then C<*exact> is set to C<1>.
4828 To compute the I<maximal> path length, the resulting relation
4829 should be postprocessed by C<isl_map_lexmax>.
4830 In particular, if the input relation is a dependence relation
4831 (mapping sources to sinks), then the maximal path length corresponds
4832 to the free schedule.
4833 Note, however, that C<isl_map_lexmax> expects the maximum to be
4834 finite, so if the path lengths are unbounded (possibly due to
4835 the overapproximation), then you will get an error message.
4837 =item * Wrapping
4839         #include <isl/space.h>
4840         __isl_give isl_space *isl_space_wrap(
4841                 __isl_take isl_space *space);
4842         __isl_give isl_space *isl_space_unwrap(
4843                 __isl_take isl_space *space);
4845         #include <isl/local_space.h>
4846         __isl_give isl_local_space *isl_local_space_wrap(
4847                 __isl_take isl_local_space *ls);
4849         #include <isl/set.h>
4850         __isl_give isl_basic_map *isl_basic_set_unwrap(
4851                 __isl_take isl_basic_set *bset);
4852         __isl_give isl_map *isl_set_unwrap(
4853                 __isl_take isl_set *set);
4855         #include <isl/map.h>
4856         __isl_give isl_basic_set *isl_basic_map_wrap(
4857                 __isl_take isl_basic_map *bmap);
4858         __isl_give isl_set *isl_map_wrap(
4859                 __isl_take isl_map *map);
4861         #include <isl/union_set.h>
4862         __isl_give isl_union_map *isl_union_set_unwrap(
4863                 __isl_take isl_union_set *uset);
4865         #include <isl/union_map.h>
4866         __isl_give isl_union_set *isl_union_map_wrap(
4867                 __isl_take isl_union_map *umap);
4869 The input to C<isl_space_unwrap> should
4870 be the space of a set, while that of
4871 C<isl_space_wrap> should be the space of a relation.
4872 Conversely, the output of C<isl_space_unwrap> is the space
4873 of a relation, while that of C<isl_space_wrap> is the space of a set.
4875 =item * Flattening
4877 Remove any internal structure of domain (and range) of the given
4878 set or relation.  If there is any such internal structure in the input,
4879 then the name of the space is also removed.
4881         #include <isl/local_space.h>
4882         __isl_give isl_local_space *
4883         isl_local_space_flatten_domain(
4884                 __isl_take isl_local_space *ls);
4885         __isl_give isl_local_space *
4886         isl_local_space_flatten_range(
4887                 __isl_take isl_local_space *ls);
4889         #include <isl/set.h>
4890         __isl_give isl_basic_set *isl_basic_set_flatten(
4891                 __isl_take isl_basic_set *bset);
4892         __isl_give isl_set *isl_set_flatten(
4893                 __isl_take isl_set *set);
4895         #include <isl/map.h>
4896         __isl_give isl_basic_map *isl_basic_map_flatten_domain(
4897                 __isl_take isl_basic_map *bmap);
4898         __isl_give isl_basic_map *isl_basic_map_flatten_range(
4899                 __isl_take isl_basic_map *bmap);
4900         __isl_give isl_map *isl_map_flatten_range(
4901                 __isl_take isl_map *map);
4902         __isl_give isl_map *isl_map_flatten_domain(
4903                 __isl_take isl_map *map);
4904         __isl_give isl_basic_map *isl_basic_map_flatten(
4905                 __isl_take isl_basic_map *bmap);
4906         __isl_give isl_map *isl_map_flatten(
4907                 __isl_take isl_map *map);
4909         #include <isl/val.h>
4910         __isl_give isl_multi_val *isl_multi_val_flatten_range(
4911                 __isl_take isl_multi_val *mv);
4913         #include <isl/aff.h>
4914         __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
4915                 __isl_take isl_multi_aff *ma);
4916         __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
4917                 __isl_take isl_multi_aff *ma);
4918         __isl_give isl_multi_pw_aff *
4919         isl_multi_pw_aff_flatten_range(
4920                 __isl_take isl_multi_pw_aff *mpa);
4921         __isl_give isl_multi_union_pw_aff *
4922         isl_multi_union_pw_aff_flatten_range(
4923                 __isl_take isl_multi_union_pw_aff *mupa);
4925         #include <isl/map.h>
4926         __isl_give isl_map *isl_set_flatten_map(
4927                 __isl_take isl_set *set);
4929 The function above constructs a relation
4930 that maps the input set to a flattened version of the set.
4932 =item * Lifting
4934 Lift the input set to a space with extra dimensions corresponding
4935 to the existentially quantified variables in the input.
4936 In particular, the result lives in a wrapped map where the domain
4937 is the original space and the range corresponds to the original
4938 existentially quantified variables.
4940         #include <isl/set.h>
4941         __isl_give isl_basic_set *isl_basic_set_lift(
4942                 __isl_take isl_basic_set *bset);
4943         __isl_give isl_set *isl_set_lift(
4944                 __isl_take isl_set *set);
4945         __isl_give isl_union_set *isl_union_set_lift(
4946                 __isl_take isl_union_set *uset);
4948 Given a local space that contains the existentially quantified
4949 variables of a set, a basic relation that, when applied to
4950 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
4951 can be constructed using the following function.
4953         #include <isl/local_space.h>
4954         __isl_give isl_basic_map *isl_local_space_lifting(
4955                 __isl_take isl_local_space *ls);
4957         #include <isl/aff.h>
4958         __isl_give isl_multi_aff *isl_multi_aff_lift(
4959                 __isl_take isl_multi_aff *maff,
4960                 __isl_give isl_local_space **ls);
4962 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
4963 then it is assigned the local space that lies at the basis of
4964 the lifting applied.
4966 =item * Internal Product
4968         #include <isl/space.h>
4969         __isl_give isl_space *isl_space_zip(
4970                 __isl_take isl_space *space);
4972         #include <isl/map.h>
4973         __isl_give isl_basic_map *isl_basic_map_zip(
4974                 __isl_take isl_basic_map *bmap);
4975         __isl_give isl_map *isl_map_zip(
4976                 __isl_take isl_map *map);
4978         #include <isl/union_map.h>
4979         __isl_give isl_union_map *isl_union_map_zip(
4980                 __isl_take isl_union_map *umap);
4982 Given a relation with nested relations for domain and range,
4983 interchange the range of the domain with the domain of the range.
4985 =item * Currying
4987         #include <isl/space.h>
4988         __isl_give isl_space *isl_space_curry(
4989                 __isl_take isl_space *space);
4990         __isl_give isl_space *isl_space_uncurry(
4991                 __isl_take isl_space *space);
4993         #include <isl/map.h>
4994         __isl_give isl_basic_map *isl_basic_map_curry(
4995                 __isl_take isl_basic_map *bmap);
4996         __isl_give isl_basic_map *isl_basic_map_uncurry(
4997                 __isl_take isl_basic_map *bmap);
4998         __isl_give isl_map *isl_map_curry(
4999                 __isl_take isl_map *map);
5000         __isl_give isl_map *isl_map_uncurry(
5001                 __isl_take isl_map *map);
5003         #include <isl/union_map.h>
5004         __isl_give isl_union_map *isl_union_map_curry(
5005                 __isl_take isl_union_map *umap);
5006         __isl_give isl_union_map *isl_union_map_uncurry(
5007                 __isl_take isl_union_map *umap);
5009 Given a relation with a nested relation for domain,
5010 the C<curry> functions
5011 move the range of the nested relation out of the domain
5012 and use it as the domain of a nested relation in the range,
5013 with the original range as range of this nested relation.
5014 The C<uncurry> functions perform the inverse operation.
5016 =item * Aligning parameters
5018 Change the order of the parameters of the given set, relation
5019 or function
5020 such that the first parameters match those of C<model>.
5021 This may involve the introduction of extra parameters.
5022 All parameters need to be named.
5024         #include <isl/space.h>
5025         __isl_give isl_space *isl_space_align_params(
5026                 __isl_take isl_space *space1,
5027                 __isl_take isl_space *space2)
5029         #include <isl/set.h>
5030         __isl_give isl_basic_set *isl_basic_set_align_params(
5031                 __isl_take isl_basic_set *bset,
5032                 __isl_take isl_space *model);
5033         __isl_give isl_set *isl_set_align_params(
5034                 __isl_take isl_set *set,
5035                 __isl_take isl_space *model);
5037         #include <isl/map.h>
5038         __isl_give isl_basic_map *isl_basic_map_align_params(
5039                 __isl_take isl_basic_map *bmap,
5040                 __isl_take isl_space *model);
5041         __isl_give isl_map *isl_map_align_params(
5042                 __isl_take isl_map *map,
5043                 __isl_take isl_space *model);
5045         #include <isl/val.h>
5046         __isl_give isl_multi_val *isl_multi_val_align_params(
5047                 __isl_take isl_multi_val *mv,
5048                 __isl_take isl_space *model);
5050         #include <isl/aff.h>
5051         __isl_give isl_aff *isl_aff_align_params(
5052                 __isl_take isl_aff *aff,
5053                 __isl_take isl_space *model);
5054         __isl_give isl_multi_aff *isl_multi_aff_align_params(
5055                 __isl_take isl_multi_aff *multi,
5056                 __isl_take isl_space *model);
5057         __isl_give isl_pw_aff *isl_pw_aff_align_params(
5058                 __isl_take isl_pw_aff *pwaff,
5059                 __isl_take isl_space *model);
5060         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
5061                 __isl_take isl_pw_multi_aff *pma,
5062                 __isl_take isl_space *model);
5063         __isl_give isl_union_pw_aff *
5064         isl_union_pw_aff_align_params(
5065                 __isl_take isl_union_pw_aff *upa,
5066                 __isl_take isl_space *model);
5067         __isl_give isl_union_pw_multi_aff *
5068         isl_union_pw_multi_aff_align_params(
5069                 __isl_take isl_union_pw_multi_aff *upma,
5070                 __isl_take isl_space *model);
5071         __isl_give isl_multi_union_pw_aff *
5072         isl_multi_union_pw_aff_align_params(
5073                 __isl_take isl_multi_union_pw_aff *mupa,
5074                 __isl_take isl_space *model);
5076         #include <isl/polynomial.h>
5077         __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
5078                 __isl_take isl_qpolynomial *qp,
5079                 __isl_take isl_space *model);
5081 =item * Unary Arithmethic Operations
5083         #include <isl/val.h>
5084         __isl_give isl_multi_val *isl_multi_val_neg(
5085                 __isl_take isl_multi_val *mv);
5087         #include <isl/aff.h>
5088         __isl_give isl_aff *isl_aff_neg(
5089                 __isl_take isl_aff *aff);
5090         __isl_give isl_multi_aff *isl_multi_aff_neg(
5091                 __isl_take isl_multi_aff *ma);
5092         __isl_give isl_pw_aff *isl_pw_aff_neg(
5093                 __isl_take isl_pw_aff *pwaff);
5094         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
5095                 __isl_take isl_pw_multi_aff *pma);
5096         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
5097                 __isl_take isl_multi_pw_aff *mpa);
5098         __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
5099                 __isl_take isl_union_pw_aff *upa);
5100         __isl_give isl_union_pw_multi_aff *
5101         isl_union_pw_multi_aff_neg(
5102                 __isl_take isl_union_pw_multi_aff *upma);
5103         __isl_give isl_multi_union_pw_aff *
5104         isl_multi_union_pw_aff_neg(
5105                 __isl_take isl_multi_union_pw_aff *mupa);
5106         __isl_give isl_aff *isl_aff_ceil(
5107                 __isl_take isl_aff *aff);
5108         __isl_give isl_pw_aff *isl_pw_aff_ceil(
5109                 __isl_take isl_pw_aff *pwaff);
5110         __isl_give isl_aff *isl_aff_floor(
5111                 __isl_take isl_aff *aff);
5112         __isl_give isl_multi_aff *isl_multi_aff_floor(
5113                 __isl_take isl_multi_aff *ma);
5114         __isl_give isl_pw_aff *isl_pw_aff_floor(
5115                 __isl_take isl_pw_aff *pwaff);
5116         __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
5117                 __isl_take isl_union_pw_aff *upa);
5118         __isl_give isl_multi_union_pw_aff *
5119         isl_multi_union_pw_aff_floor(
5120                 __isl_take isl_multi_union_pw_aff *mupa);
5122         #include <isl/aff.h>
5123         __isl_give isl_pw_aff *isl_pw_aff_list_min(
5124                 __isl_take isl_pw_aff_list *list);
5125         __isl_give isl_pw_aff *isl_pw_aff_list_max(
5126                 __isl_take isl_pw_aff_list *list);
5128         #include <isl/polynomial.h>
5129         __isl_give isl_qpolynomial *isl_qpolynomial_neg(
5130                 __isl_take isl_qpolynomial *qp);
5131         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
5132                 __isl_take isl_pw_qpolynomial *pwqp);
5133         __isl_give isl_union_pw_qpolynomial *
5134         isl_union_pw_qpolynomial_neg(
5135                 __isl_take isl_union_pw_qpolynomial *upwqp);
5136         __isl_give isl_qpolynomial *isl_qpolynomial_pow(
5137                 __isl_take isl_qpolynomial *qp,
5138                 unsigned exponent);
5139         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
5140                 __isl_take isl_pw_qpolynomial *pwqp,
5141                 unsigned exponent);
5143 =item * Evaluation
5145 The following functions evaluate a function in a point.
5147         #include <isl/polynomial.h>
5148         __isl_give isl_val *isl_pw_qpolynomial_eval(
5149                 __isl_take isl_pw_qpolynomial *pwqp,
5150                 __isl_take isl_point *pnt);
5151         __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
5152                 __isl_take isl_pw_qpolynomial_fold *pwf,
5153                 __isl_take isl_point *pnt);
5154         __isl_give isl_val *isl_union_pw_qpolynomial_eval(
5155                 __isl_take isl_union_pw_qpolynomial *upwqp,
5156                 __isl_take isl_point *pnt);
5157         __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
5158                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5159                 __isl_take isl_point *pnt);
5161 =item * Dimension manipulation
5163 It is usually not advisable to directly change the (input or output)
5164 space of a set or a relation as this removes the name and the internal
5165 structure of the space.  However, the functions below can be useful
5166 to add new parameters, assuming
5167 C<isl_set_align_params> and C<isl_map_align_params>
5168 are not sufficient.
5170         #include <isl/space.h>
5171         __isl_give isl_space *isl_space_add_dims(
5172                 __isl_take isl_space *space,
5173                 enum isl_dim_type type, unsigned n);
5174         __isl_give isl_space *isl_space_insert_dims(
5175                 __isl_take isl_space *space,
5176                 enum isl_dim_type type, unsigned pos, unsigned n);
5177         __isl_give isl_space *isl_space_drop_dims(
5178                 __isl_take isl_space *space,
5179                 enum isl_dim_type type, unsigned first, unsigned n);
5180         __isl_give isl_space *isl_space_move_dims(
5181                 __isl_take isl_space *space,
5182                 enum isl_dim_type dst_type, unsigned dst_pos,
5183                 enum isl_dim_type src_type, unsigned src_pos,
5184                 unsigned n);
5186         #include <isl/local_space.h>
5187         __isl_give isl_local_space *isl_local_space_add_dims(
5188                 __isl_take isl_local_space *ls,
5189                 enum isl_dim_type type, unsigned n);
5190         __isl_give isl_local_space *isl_local_space_insert_dims(
5191                 __isl_take isl_local_space *ls,
5192                 enum isl_dim_type type, unsigned first, unsigned n);
5193         __isl_give isl_local_space *isl_local_space_drop_dims(
5194                 __isl_take isl_local_space *ls,
5195                 enum isl_dim_type type, unsigned first, unsigned n);
5197         #include <isl/set.h>
5198         __isl_give isl_basic_set *isl_basic_set_add_dims(
5199                 __isl_take isl_basic_set *bset,
5200                 enum isl_dim_type type, unsigned n);
5201         __isl_give isl_set *isl_set_add_dims(
5202                 __isl_take isl_set *set,
5203                 enum isl_dim_type type, unsigned n);
5204         __isl_give isl_basic_set *isl_basic_set_insert_dims(
5205                 __isl_take isl_basic_set *bset,
5206                 enum isl_dim_type type, unsigned pos,
5207                 unsigned n);
5208         __isl_give isl_set *isl_set_insert_dims(
5209                 __isl_take isl_set *set,
5210                 enum isl_dim_type type, unsigned pos, unsigned n);
5211         __isl_give isl_basic_set *isl_basic_set_move_dims(
5212                 __isl_take isl_basic_set *bset,
5213                 enum isl_dim_type dst_type, unsigned dst_pos,
5214                 enum isl_dim_type src_type, unsigned src_pos,
5215                 unsigned n);
5216         __isl_give isl_set *isl_set_move_dims(
5217                 __isl_take isl_set *set,
5218                 enum isl_dim_type dst_type, unsigned dst_pos,
5219                 enum isl_dim_type src_type, unsigned src_pos,
5220                 unsigned n);
5222         #include <isl/map.h>
5223         __isl_give isl_map *isl_map_add_dims(
5224                 __isl_take isl_map *map,
5225                 enum isl_dim_type type, unsigned n);
5226         __isl_give isl_basic_map *isl_basic_map_insert_dims(
5227                 __isl_take isl_basic_map *bmap,
5228                 enum isl_dim_type type, unsigned pos,
5229                 unsigned n);
5230         __isl_give isl_map *isl_map_insert_dims(
5231                 __isl_take isl_map *map,
5232                 enum isl_dim_type type, unsigned pos, unsigned n);
5233         __isl_give isl_basic_map *isl_basic_map_move_dims(
5234                 __isl_take isl_basic_map *bmap,
5235                 enum isl_dim_type dst_type, unsigned dst_pos,
5236                 enum isl_dim_type src_type, unsigned src_pos,
5237                 unsigned n);
5238         __isl_give isl_map *isl_map_move_dims(
5239                 __isl_take isl_map *map,
5240                 enum isl_dim_type dst_type, unsigned dst_pos,
5241                 enum isl_dim_type src_type, unsigned src_pos,
5242                 unsigned n);
5244         #include <isl/val.h>
5245         __isl_give isl_multi_val *isl_multi_val_insert_dims(
5246                 __isl_take isl_multi_val *mv,
5247                 enum isl_dim_type type, unsigned first, unsigned n);
5248         __isl_give isl_multi_val *isl_multi_val_add_dims(
5249                 __isl_take isl_multi_val *mv,
5250                 enum isl_dim_type type, unsigned n);
5251         __isl_give isl_multi_val *isl_multi_val_drop_dims(
5252                 __isl_take isl_multi_val *mv,
5253                 enum isl_dim_type type, unsigned first, unsigned n);
5255         #include <isl/aff.h>
5256         __isl_give isl_aff *isl_aff_insert_dims(
5257                 __isl_take isl_aff *aff,
5258                 enum isl_dim_type type, unsigned first, unsigned n);
5259         __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
5260                 __isl_take isl_multi_aff *ma,
5261                 enum isl_dim_type type, unsigned first, unsigned n);
5262         __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
5263                 __isl_take isl_pw_aff *pwaff,
5264                 enum isl_dim_type type, unsigned first, unsigned n);
5265         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
5266                 __isl_take isl_multi_pw_aff *mpa,
5267                 enum isl_dim_type type, unsigned first, unsigned n);
5268         __isl_give isl_aff *isl_aff_add_dims(
5269                 __isl_take isl_aff *aff,
5270                 enum isl_dim_type type, unsigned n);
5271         __isl_give isl_multi_aff *isl_multi_aff_add_dims(
5272                 __isl_take isl_multi_aff *ma,
5273                 enum isl_dim_type type, unsigned n);
5274         __isl_give isl_pw_aff *isl_pw_aff_add_dims(
5275                 __isl_take isl_pw_aff *pwaff,
5276                 enum isl_dim_type type, unsigned n);
5277         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
5278                 __isl_take isl_multi_pw_aff *mpa,
5279                 enum isl_dim_type type, unsigned n);
5280         __isl_give isl_aff *isl_aff_drop_dims(
5281                 __isl_take isl_aff *aff,
5282                 enum isl_dim_type type, unsigned first, unsigned n);
5283         __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
5284                 __isl_take isl_multi_aff *maff,
5285                 enum isl_dim_type type, unsigned first, unsigned n);
5286         __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
5287                 __isl_take isl_pw_aff *pwaff,
5288                 enum isl_dim_type type, unsigned first, unsigned n);
5289         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
5290                 __isl_take isl_pw_multi_aff *pma,
5291                 enum isl_dim_type type, unsigned first, unsigned n);
5292         __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
5293                 __isl_take isl_union_pw_aff *upa,
5294                 enum isl_dim_type type, unsigned first, unsigned n);
5295         __isl_give isl_union_pw_multi_aff *
5296                 isl_union_pw_multi_aff_drop_dims(
5297                 __isl_take isl_union_pw_multi_aff *upma,
5298                 enum isl_dim_type type,
5299                 unsigned first, unsigned n);
5300         __isl_give isl_multi_union_pw_aff *
5301         isl_multi_union_pw_aff_drop_dims(
5302                 __isl_take isl_multi_union_pw_aff *mupa,
5303                 enum isl_dim_type type, unsigned first,
5304                 unsigned n);
5305         __isl_give isl_aff *isl_aff_move_dims(
5306                 __isl_take isl_aff *aff,
5307                 enum isl_dim_type dst_type, unsigned dst_pos,
5308                 enum isl_dim_type src_type, unsigned src_pos,
5309                 unsigned n);
5310         __isl_give isl_multi_aff *isl_multi_aff_move_dims(
5311                 __isl_take isl_multi_aff *ma,
5312                 enum isl_dim_type dst_type, unsigned dst_pos,
5313                 enum isl_dim_type src_type, unsigned src_pos,
5314                 unsigned n);
5315         __isl_give isl_pw_aff *isl_pw_aff_move_dims(
5316                 __isl_take isl_pw_aff *pa,
5317                 enum isl_dim_type dst_type, unsigned dst_pos,
5318                 enum isl_dim_type src_type, unsigned src_pos,
5319                 unsigned n);
5320         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
5321                 __isl_take isl_multi_pw_aff *pma,
5322                 enum isl_dim_type dst_type, unsigned dst_pos,
5323                 enum isl_dim_type src_type, unsigned src_pos,
5324                 unsigned n);
5326         #include <isl/polynomial.h>
5327         __isl_give isl_union_pw_qpolynomial *
5328         isl_union_pw_qpolynomial_drop_dims(
5329                 __isl_take isl_union_pw_qpolynomial *upwqp,
5330                 enum isl_dim_type type,
5331                 unsigned first, unsigned n);
5332         __isl_give isl_union_pw_qpolynomial_fold *
5333                 isl_union_pw_qpolynomial_fold_drop_dims(
5334                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5335                 enum isl_dim_type type,
5336                 unsigned first, unsigned n);
5338 The operations on union expressions can only manipulate parameters.
5340 =back
5342 =head2 Binary Operations
5344 The two arguments of a binary operation not only need to live
5345 in the same C<isl_ctx>, they currently also need to have
5346 the same (number of) parameters.
5348 =head3 Basic Operations
5350 =over
5352 =item * Intersection
5354         #include <isl/local_space.h>
5355         __isl_give isl_local_space *isl_local_space_intersect(
5356                 __isl_take isl_local_space *ls1,
5357                 __isl_take isl_local_space *ls2);
5359         #include <isl/set.h>
5360         __isl_give isl_basic_set *isl_basic_set_intersect_params(
5361                 __isl_take isl_basic_set *bset1,
5362                 __isl_take isl_basic_set *bset2);
5363         __isl_give isl_basic_set *isl_basic_set_intersect(
5364                 __isl_take isl_basic_set *bset1,
5365                 __isl_take isl_basic_set *bset2);
5366         __isl_give isl_basic_set *isl_basic_set_list_intersect(
5367                 __isl_take struct isl_basic_set_list *list);
5368         __isl_give isl_set *isl_set_intersect_params(
5369                 __isl_take isl_set *set,
5370                 __isl_take isl_set *params);
5371         __isl_give isl_set *isl_set_intersect(
5372                 __isl_take isl_set *set1,
5373                 __isl_take isl_set *set2);
5375         #include <isl/map.h>
5376         __isl_give isl_basic_map *isl_basic_map_intersect_domain(
5377                 __isl_take isl_basic_map *bmap,
5378                 __isl_take isl_basic_set *bset);
5379         __isl_give isl_basic_map *isl_basic_map_intersect_range(
5380                 __isl_take isl_basic_map *bmap,
5381                 __isl_take isl_basic_set *bset);
5382         __isl_give isl_basic_map *isl_basic_map_intersect(
5383                 __isl_take isl_basic_map *bmap1,
5384                 __isl_take isl_basic_map *bmap2);
5385         __isl_give isl_basic_map *isl_basic_map_list_intersect(
5386                 __isl_take isl_basic_map_list *list);
5387         __isl_give isl_map *isl_map_intersect_params(
5388                 __isl_take isl_map *map,
5389                 __isl_take isl_set *params);
5390         __isl_give isl_map *isl_map_intersect_domain(
5391                 __isl_take isl_map *map,
5392                 __isl_take isl_set *set);
5393         __isl_give isl_map *isl_map_intersect_range(
5394                 __isl_take isl_map *map,
5395                 __isl_take isl_set *set);
5396         __isl_give isl_map *isl_map_intersect(
5397                 __isl_take isl_map *map1,
5398                 __isl_take isl_map *map2);
5400         #include <isl/union_set.h>
5401         __isl_give isl_union_set *isl_union_set_intersect_params(
5402                 __isl_take isl_union_set *uset,
5403                 __isl_take isl_set *set);
5404         __isl_give isl_union_set *isl_union_set_intersect(
5405                 __isl_take isl_union_set *uset1,
5406                 __isl_take isl_union_set *uset2);
5408         #include <isl/union_map.h>
5409         __isl_give isl_union_map *isl_union_map_intersect_params(
5410                 __isl_take isl_union_map *umap,
5411                 __isl_take isl_set *set);
5412         __isl_give isl_union_map *isl_union_map_intersect_domain(
5413                 __isl_take isl_union_map *umap,
5414                 __isl_take isl_union_set *uset);
5415         __isl_give isl_union_map *isl_union_map_intersect_range(
5416                 __isl_take isl_union_map *umap,
5417                 __isl_take isl_union_set *uset);
5418         __isl_give isl_union_map *isl_union_map_intersect(
5419                 __isl_take isl_union_map *umap1,
5420                 __isl_take isl_union_map *umap2);
5422         #include <isl/aff.h>
5423         __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
5424                 __isl_take isl_pw_aff *pa,
5425                 __isl_take isl_set *set);
5426         __isl_give isl_multi_pw_aff *
5427         isl_multi_pw_aff_intersect_domain(
5428                 __isl_take isl_multi_pw_aff *mpa,
5429                 __isl_take isl_set *domain);
5430         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
5431                 __isl_take isl_pw_multi_aff *pma,
5432                 __isl_take isl_set *set);
5433         __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
5434                 __isl_take isl_union_pw_aff *upa,
5435                 __isl_take isl_union_set *uset);
5436         __isl_give isl_union_pw_multi_aff *
5437         isl_union_pw_multi_aff_intersect_domain(
5438                 __isl_take isl_union_pw_multi_aff *upma,
5439                 __isl_take isl_union_set *uset);
5440         __isl_give isl_multi_union_pw_aff *
5441         isl_multi_union_pw_aff_intersect_domain(
5442                 __isl_take isl_multi_union_pw_aff *mupa,
5443                 __isl_take isl_union_set *uset);
5444         __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
5445                 __isl_take isl_pw_aff *pa,
5446                 __isl_take isl_set *set);
5447         __isl_give isl_multi_pw_aff *
5448         isl_multi_pw_aff_intersect_params(
5449                 __isl_take isl_multi_pw_aff *mpa,
5450                 __isl_take isl_set *set);
5451         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
5452                 __isl_take isl_pw_multi_aff *pma,
5453                 __isl_take isl_set *set);
5454         __isl_give isl_union_pw_aff *
5455         isl_union_pw_aff_intersect_params(
5456                 __isl_take isl_union_pw_aff *upa,
5457         __isl_give isl_union_pw_multi_aff *
5458         isl_union_pw_multi_aff_intersect_params(
5459                 __isl_take isl_union_pw_multi_aff *upma,
5460                 __isl_take isl_set *set);
5461         __isl_give isl_multi_union_pw_aff *
5462         isl_multi_union_pw_aff_intersect_params(
5463                 __isl_take isl_multi_union_pw_aff *mupa,
5464                 __isl_take isl_set *params);
5465         isl_multi_union_pw_aff_intersect_range(
5466                 __isl_take isl_multi_union_pw_aff *mupa,
5467                 __isl_take isl_set *set);
5469         #include <isl/polynomial.h>
5470         __isl_give isl_pw_qpolynomial *
5471         isl_pw_qpolynomial_intersect_domain(
5472                 __isl_take isl_pw_qpolynomial *pwpq,
5473                 __isl_take isl_set *set);
5474         __isl_give isl_union_pw_qpolynomial *
5475         isl_union_pw_qpolynomial_intersect_domain(
5476                 __isl_take isl_union_pw_qpolynomial *upwpq,
5477                 __isl_take isl_union_set *uset);
5478         __isl_give isl_union_pw_qpolynomial_fold *
5479         isl_union_pw_qpolynomial_fold_intersect_domain(
5480                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5481                 __isl_take isl_union_set *uset);
5482         __isl_give isl_pw_qpolynomial *
5483         isl_pw_qpolynomial_intersect_params(
5484                 __isl_take isl_pw_qpolynomial *pwpq,
5485                 __isl_take isl_set *set);
5486         __isl_give isl_pw_qpolynomial_fold *
5487         isl_pw_qpolynomial_fold_intersect_params(
5488                 __isl_take isl_pw_qpolynomial_fold *pwf,
5489                 __isl_take isl_set *set);
5490         __isl_give isl_union_pw_qpolynomial *
5491         isl_union_pw_qpolynomial_intersect_params(
5492                 __isl_take isl_union_pw_qpolynomial *upwpq,
5493                 __isl_take isl_set *set);
5494         __isl_give isl_union_pw_qpolynomial_fold *
5495         isl_union_pw_qpolynomial_fold_intersect_params(
5496                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5497                 __isl_take isl_set *set);
5499 The second argument to the C<_params> functions needs to be
5500 a parametric (basic) set.  For the other functions, a parametric set
5501 for either argument is only allowed if the other argument is
5502 a parametric set as well.
5503 The list passed to C<isl_basic_set_list_intersect> needs to have
5504 at least one element and all elements need to live in the same space.
5505 The function C<isl_multi_union_pw_aff_intersect_range>
5506 restricts the input function to those shared domain elements
5507 that map to the specified range.
5509 =item * Union
5511         #include <isl/set.h>
5512         __isl_give isl_set *isl_basic_set_union(
5513                 __isl_take isl_basic_set *bset1,
5514                 __isl_take isl_basic_set *bset2);
5515         __isl_give isl_set *isl_set_union(
5516                 __isl_take isl_set *set1,
5517                 __isl_take isl_set *set2);
5519         #include <isl/map.h>
5520         __isl_give isl_map *isl_basic_map_union(
5521                 __isl_take isl_basic_map *bmap1,
5522                 __isl_take isl_basic_map *bmap2);
5523         __isl_give isl_map *isl_map_union(
5524                 __isl_take isl_map *map1,
5525                 __isl_take isl_map *map2);
5527         #include <isl/union_set.h>
5528         __isl_give isl_union_set *isl_union_set_union(
5529                 __isl_take isl_union_set *uset1,
5530                 __isl_take isl_union_set *uset2);
5531         __isl_give isl_union_set *isl_union_set_list_union(
5532                 __isl_take isl_union_set_list *list);
5534         #include <isl/union_map.h>
5535         __isl_give isl_union_map *isl_union_map_union(
5536                 __isl_take isl_union_map *umap1,
5537                 __isl_take isl_union_map *umap2);
5539 =item * Set difference
5541         #include <isl/set.h>
5542         __isl_give isl_set *isl_set_subtract(
5543                 __isl_take isl_set *set1,
5544                 __isl_take isl_set *set2);
5546         #include <isl/map.h>
5547         __isl_give isl_map *isl_map_subtract(
5548                 __isl_take isl_map *map1,
5549                 __isl_take isl_map *map2);
5550         __isl_give isl_map *isl_map_subtract_domain(
5551                 __isl_take isl_map *map,
5552                 __isl_take isl_set *dom);
5553         __isl_give isl_map *isl_map_subtract_range(
5554                 __isl_take isl_map *map,
5555                 __isl_take isl_set *dom);
5557         #include <isl/union_set.h>
5558         __isl_give isl_union_set *isl_union_set_subtract(
5559                 __isl_take isl_union_set *uset1,
5560                 __isl_take isl_union_set *uset2);
5562         #include <isl/union_map.h>
5563         __isl_give isl_union_map *isl_union_map_subtract(
5564                 __isl_take isl_union_map *umap1,
5565                 __isl_take isl_union_map *umap2);
5566         __isl_give isl_union_map *isl_union_map_subtract_domain(
5567                 __isl_take isl_union_map *umap,
5568                 __isl_take isl_union_set *dom);
5569         __isl_give isl_union_map *isl_union_map_subtract_range(
5570                 __isl_take isl_union_map *umap,
5571                 __isl_take isl_union_set *dom);
5573         #include <isl/aff.h>
5574         __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
5575                 __isl_take isl_pw_aff *pa,
5576                 __isl_take isl_set *set);
5577         __isl_give isl_pw_multi_aff *
5578         isl_pw_multi_aff_subtract_domain(
5579                 __isl_take isl_pw_multi_aff *pma,
5580                 __isl_take isl_set *set);
5581         __isl_give isl_union_pw_aff *
5582         isl_union_pw_aff_subtract_domain(
5583                 __isl_take isl_union_pw_aff *upa,
5584                 __isl_take isl_union_set *uset);
5585         __isl_give isl_union_pw_multi_aff *
5586         isl_union_pw_multi_aff_subtract_domain(
5587                 __isl_take isl_union_pw_multi_aff *upma,
5588                 __isl_take isl_set *set);
5590         #include <isl/polynomial.h>
5591         __isl_give isl_pw_qpolynomial *
5592         isl_pw_qpolynomial_subtract_domain(
5593                 __isl_take isl_pw_qpolynomial *pwpq,
5594                 __isl_take isl_set *set);
5595         __isl_give isl_pw_qpolynomial_fold *
5596         isl_pw_qpolynomial_fold_subtract_domain(
5597                 __isl_take isl_pw_qpolynomial_fold *pwf,
5598                 __isl_take isl_set *set);
5599         __isl_give isl_union_pw_qpolynomial *
5600         isl_union_pw_qpolynomial_subtract_domain(
5601                 __isl_take isl_union_pw_qpolynomial *upwpq,
5602                 __isl_take isl_union_set *uset);
5603         __isl_give isl_union_pw_qpolynomial_fold *
5604         isl_union_pw_qpolynomial_fold_subtract_domain(
5605                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5606                 __isl_take isl_union_set *uset);
5608 =item * Application
5610         #include <isl/space.h>
5611         __isl_give isl_space *isl_space_join(
5612                 __isl_take isl_space *left,
5613                 __isl_take isl_space *right);
5615         #include <isl/map.h>
5616         __isl_give isl_basic_set *isl_basic_set_apply(
5617                 __isl_take isl_basic_set *bset,
5618                 __isl_take isl_basic_map *bmap);
5619         __isl_give isl_set *isl_set_apply(
5620                 __isl_take isl_set *set,
5621                 __isl_take isl_map *map);
5622         __isl_give isl_union_set *isl_union_set_apply(
5623                 __isl_take isl_union_set *uset,
5624                 __isl_take isl_union_map *umap);
5625         __isl_give isl_basic_map *isl_basic_map_apply_domain(
5626                 __isl_take isl_basic_map *bmap1,
5627                 __isl_take isl_basic_map *bmap2);
5628         __isl_give isl_basic_map *isl_basic_map_apply_range(
5629                 __isl_take isl_basic_map *bmap1,
5630                 __isl_take isl_basic_map *bmap2);
5631         __isl_give isl_map *isl_map_apply_domain(
5632                 __isl_take isl_map *map1,
5633                 __isl_take isl_map *map2);
5634         __isl_give isl_map *isl_map_apply_range(
5635                 __isl_take isl_map *map1,
5636                 __isl_take isl_map *map2);
5638         #include <isl/union_map.h>
5639         __isl_give isl_union_map *isl_union_map_apply_domain(
5640                 __isl_take isl_union_map *umap1,
5641                 __isl_take isl_union_map *umap2);
5642         __isl_give isl_union_map *isl_union_map_apply_range(
5643                 __isl_take isl_union_map *umap1,
5644                 __isl_take isl_union_map *umap2);
5646         #include <isl/aff.h>
5647         __isl_give isl_union_pw_aff *
5648         isl_multi_union_pw_aff_apply_aff(
5649                 __isl_take isl_multi_union_pw_aff *mupa,
5650                 __isl_take isl_aff *aff);
5651         __isl_give isl_union_pw_aff *
5652         isl_multi_union_pw_aff_apply_pw_aff(
5653                 __isl_take isl_multi_union_pw_aff *mupa,
5654                 __isl_take isl_pw_aff *pa);
5655         __isl_give isl_multi_union_pw_aff *
5656         isl_multi_union_pw_aff_apply_multi_aff(
5657                 __isl_take isl_multi_union_pw_aff *mupa,
5658                 __isl_take isl_multi_aff *ma);
5659         __isl_give isl_multi_union_pw_aff *
5660         isl_multi_union_pw_aff_apply_pw_multi_aff(
5661                 __isl_take isl_multi_union_pw_aff *mupa,
5662                 __isl_take isl_pw_multi_aff *pma);
5664 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
5665 over the shared domain of the elements of the input.  The dimension is
5666 required to be greater than zero.
5667 The C<isl_multi_union_pw_aff> argument of
5668 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
5669 but only if the range of the C<isl_multi_aff> argument
5670 is also zero-dimensional.
5671 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
5673         #include <isl/polynomial.h>
5674         __isl_give isl_pw_qpolynomial_fold *
5675         isl_set_apply_pw_qpolynomial_fold(
5676                 __isl_take isl_set *set,
5677                 __isl_take isl_pw_qpolynomial_fold *pwf,
5678                 int *tight);
5679         __isl_give isl_pw_qpolynomial_fold *
5680         isl_map_apply_pw_qpolynomial_fold(
5681                 __isl_take isl_map *map,
5682                 __isl_take isl_pw_qpolynomial_fold *pwf,
5683                 int *tight);
5684         __isl_give isl_union_pw_qpolynomial_fold *
5685         isl_union_set_apply_union_pw_qpolynomial_fold(
5686                 __isl_take isl_union_set *uset,
5687                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5688                 int *tight);
5689         __isl_give isl_union_pw_qpolynomial_fold *
5690         isl_union_map_apply_union_pw_qpolynomial_fold(
5691                 __isl_take isl_union_map *umap,
5692                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5693                 int *tight);
5695 The functions taking a map
5696 compose the given map with the given piecewise quasipolynomial reduction.
5697 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
5698 over all elements in the intersection of the range of the map
5699 and the domain of the piecewise quasipolynomial reduction
5700 as a function of an element in the domain of the map.
5701 The functions taking a set compute a bound over all elements in the
5702 intersection of the set and the domain of the
5703 piecewise quasipolynomial reduction.
5705 =item * Preimage
5707         #include <isl/set.h>
5708         __isl_give isl_basic_set *
5709         isl_basic_set_preimage_multi_aff(
5710                 __isl_take isl_basic_set *bset,
5711                 __isl_take isl_multi_aff *ma);
5712         __isl_give isl_set *isl_set_preimage_multi_aff(
5713                 __isl_take isl_set *set,
5714                 __isl_take isl_multi_aff *ma);
5715         __isl_give isl_set *isl_set_preimage_pw_multi_aff(
5716                 __isl_take isl_set *set,
5717                 __isl_take isl_pw_multi_aff *pma);
5718         __isl_give isl_set *isl_set_preimage_multi_pw_aff(
5719                 __isl_take isl_set *set,
5720                 __isl_take isl_multi_pw_aff *mpa);
5722         #include <isl/union_set.h>
5723         __isl_give isl_union_set *
5724         isl_union_set_preimage_multi_aff(
5725                 __isl_take isl_union_set *uset,
5726                 __isl_take isl_multi_aff *ma);
5727         __isl_give isl_union_set *
5728         isl_union_set_preimage_pw_multi_aff(
5729                 __isl_take isl_union_set *uset,
5730                 __isl_take isl_pw_multi_aff *pma);
5731         __isl_give isl_union_set *
5732         isl_union_set_preimage_union_pw_multi_aff(
5733                 __isl_take isl_union_set *uset,
5734                 __isl_take isl_union_pw_multi_aff *upma);
5736         #include <isl/map.h>
5737         __isl_give isl_basic_map *
5738         isl_basic_map_preimage_domain_multi_aff(
5739                 __isl_take isl_basic_map *bmap,
5740                 __isl_take isl_multi_aff *ma);
5741         __isl_give isl_map *isl_map_preimage_domain_multi_aff(
5742                 __isl_take isl_map *map,
5743                 __isl_take isl_multi_aff *ma);
5744         __isl_give isl_map *isl_map_preimage_range_multi_aff(
5745                 __isl_take isl_map *map,
5746                 __isl_take isl_multi_aff *ma);
5747         __isl_give isl_map *
5748         isl_map_preimage_domain_pw_multi_aff(
5749                 __isl_take isl_map *map,
5750                 __isl_take isl_pw_multi_aff *pma);
5751         __isl_give isl_map *
5752         isl_map_preimage_range_pw_multi_aff(
5753                 __isl_take isl_map *map,
5754                 __isl_take isl_pw_multi_aff *pma);
5755         __isl_give isl_map *
5756         isl_map_preimage_domain_multi_pw_aff(
5757                 __isl_take isl_map *map,
5758                 __isl_take isl_multi_pw_aff *mpa);
5759         __isl_give isl_basic_map *
5760         isl_basic_map_preimage_range_multi_aff(
5761                 __isl_take isl_basic_map *bmap,
5762                 __isl_take isl_multi_aff *ma);
5764         #include <isl/union_map.h>
5765         __isl_give isl_union_map *
5766         isl_union_map_preimage_domain_multi_aff(
5767                 __isl_take isl_union_map *umap,
5768                 __isl_take isl_multi_aff *ma);
5769         __isl_give isl_union_map *
5770         isl_union_map_preimage_range_multi_aff(
5771                 __isl_take isl_union_map *umap,
5772                 __isl_take isl_multi_aff *ma);
5773         __isl_give isl_union_map *
5774         isl_union_map_preimage_domain_pw_multi_aff(
5775                 __isl_take isl_union_map *umap,
5776                 __isl_take isl_pw_multi_aff *pma);
5777         __isl_give isl_union_map *
5778         isl_union_map_preimage_range_pw_multi_aff(
5779                 __isl_take isl_union_map *umap,
5780                 __isl_take isl_pw_multi_aff *pma);
5781         __isl_give isl_union_map *
5782         isl_union_map_preimage_domain_union_pw_multi_aff(
5783                 __isl_take isl_union_map *umap,
5784                 __isl_take isl_union_pw_multi_aff *upma);
5785         __isl_give isl_union_map *
5786         isl_union_map_preimage_range_union_pw_multi_aff(
5787                 __isl_take isl_union_map *umap,
5788                 __isl_take isl_union_pw_multi_aff *upma);
5790 These functions compute the preimage of the given set or map domain/range under
5791 the given function.  In other words, the expression is plugged
5792 into the set description or into the domain/range of the map.
5794 =item * Pullback
5796         #include <isl/aff.h>
5797         __isl_give isl_aff *isl_aff_pullback_aff(
5798                 __isl_take isl_aff *aff1,
5799                 __isl_take isl_aff *aff2);
5800         __isl_give isl_aff *isl_aff_pullback_multi_aff(
5801                 __isl_take isl_aff *aff,
5802                 __isl_take isl_multi_aff *ma);
5803         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
5804                 __isl_take isl_pw_aff *pa,
5805                 __isl_take isl_multi_aff *ma);
5806         __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
5807                 __isl_take isl_pw_aff *pa,
5808                 __isl_take isl_pw_multi_aff *pma);
5809         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
5810                 __isl_take isl_pw_aff *pa,
5811                 __isl_take isl_multi_pw_aff *mpa);
5812         __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
5813                 __isl_take isl_multi_aff *ma1,
5814                 __isl_take isl_multi_aff *ma2);
5815         __isl_give isl_pw_multi_aff *
5816         isl_pw_multi_aff_pullback_multi_aff(
5817                 __isl_take isl_pw_multi_aff *pma,
5818                 __isl_take isl_multi_aff *ma);
5819         __isl_give isl_multi_pw_aff *
5820         isl_multi_pw_aff_pullback_multi_aff(
5821                 __isl_take isl_multi_pw_aff *mpa,
5822                 __isl_take isl_multi_aff *ma);
5823         __isl_give isl_pw_multi_aff *
5824         isl_pw_multi_aff_pullback_pw_multi_aff(
5825                 __isl_take isl_pw_multi_aff *pma1,
5826                 __isl_take isl_pw_multi_aff *pma2);
5827         __isl_give isl_multi_pw_aff *
5828         isl_multi_pw_aff_pullback_pw_multi_aff(
5829                 __isl_take isl_multi_pw_aff *mpa,
5830                 __isl_take isl_pw_multi_aff *pma);
5831         __isl_give isl_multi_pw_aff *
5832         isl_multi_pw_aff_pullback_multi_pw_aff(
5833                 __isl_take isl_multi_pw_aff *mpa1,
5834                 __isl_take isl_multi_pw_aff *mpa2);
5835         __isl_give isl_union_pw_aff *
5836         isl_union_pw_aff_pullback_union_pw_multi_aff(
5837                 __isl_take isl_union_pw_aff *upa,
5838                 __isl_take isl_union_pw_multi_aff *upma);
5839         __isl_give isl_union_pw_multi_aff *
5840         isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
5841                 __isl_take isl_union_pw_multi_aff *upma1,
5842                 __isl_take isl_union_pw_multi_aff *upma2);
5843         __isl_give isl_multi_union_pw_aff *
5844         isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
5845                 __isl_take isl_multi_union_pw_aff *mupa,
5846                 __isl_take isl_union_pw_multi_aff *upma);
5848 These functions precompose the first expression by the second function.
5849 In other words, the second function is plugged
5850 into the first expression.
5852 =item * Locus
5854         #include <isl/aff.h>
5855         __isl_give isl_basic_set *isl_aff_le_basic_set(
5856                 __isl_take isl_aff *aff1,
5857                 __isl_take isl_aff *aff2);
5858         __isl_give isl_basic_set *isl_aff_ge_basic_set(
5859                 __isl_take isl_aff *aff1,
5860                 __isl_take isl_aff *aff2);
5861         __isl_give isl_set *isl_pw_aff_eq_set(
5862                 __isl_take isl_pw_aff *pwaff1,
5863                 __isl_take isl_pw_aff *pwaff2);
5864         __isl_give isl_set *isl_pw_aff_ne_set(
5865                 __isl_take isl_pw_aff *pwaff1,
5866                 __isl_take isl_pw_aff *pwaff2);
5867         __isl_give isl_set *isl_pw_aff_le_set(
5868                 __isl_take isl_pw_aff *pwaff1,
5869                 __isl_take isl_pw_aff *pwaff2);
5870         __isl_give isl_set *isl_pw_aff_lt_set(
5871                 __isl_take isl_pw_aff *pwaff1,
5872                 __isl_take isl_pw_aff *pwaff2);
5873         __isl_give isl_set *isl_pw_aff_ge_set(
5874                 __isl_take isl_pw_aff *pwaff1,
5875                 __isl_take isl_pw_aff *pwaff2);
5876         __isl_give isl_set *isl_pw_aff_gt_set(
5877                 __isl_take isl_pw_aff *pwaff1,
5878                 __isl_take isl_pw_aff *pwaff2);
5880         __isl_give isl_set *isl_multi_aff_lex_le_set(
5881                 __isl_take isl_multi_aff *ma1,
5882                 __isl_take isl_multi_aff *ma2);
5883         __isl_give isl_set *isl_multi_aff_lex_ge_set(
5884                 __isl_take isl_multi_aff *ma1,
5885                 __isl_take isl_multi_aff *ma2);
5887         __isl_give isl_set *isl_pw_aff_list_eq_set(
5888                 __isl_take isl_pw_aff_list *list1,
5889                 __isl_take isl_pw_aff_list *list2);
5890         __isl_give isl_set *isl_pw_aff_list_ne_set(
5891                 __isl_take isl_pw_aff_list *list1,
5892                 __isl_take isl_pw_aff_list *list2);
5893         __isl_give isl_set *isl_pw_aff_list_le_set(
5894                 __isl_take isl_pw_aff_list *list1,
5895                 __isl_take isl_pw_aff_list *list2);
5896         __isl_give isl_set *isl_pw_aff_list_lt_set(
5897                 __isl_take isl_pw_aff_list *list1,
5898                 __isl_take isl_pw_aff_list *list2);
5899         __isl_give isl_set *isl_pw_aff_list_ge_set(
5900                 __isl_take isl_pw_aff_list *list1,
5901                 __isl_take isl_pw_aff_list *list2);
5902         __isl_give isl_set *isl_pw_aff_list_gt_set(
5903                 __isl_take isl_pw_aff_list *list1,
5904                 __isl_take isl_pw_aff_list *list2);
5906 The function C<isl_aff_ge_basic_set> returns a basic set
5907 containing those elements in the shared space
5908 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
5909 The function C<isl_pw_aff_ge_set> returns a set
5910 containing those elements in the shared domain
5911 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
5912 greater than or equal to C<pwaff2>.
5913 The function C<isl_multi_aff_lex_le_set> returns a set
5914 containing those elements in the shared domain space
5915 where C<ma1> is lexicographically smaller than or
5916 equal to C<ma2>.
5917 The functions operating on C<isl_pw_aff_list> apply the corresponding
5918 C<isl_pw_aff> function to each pair of elements in the two lists.
5920         #include <isl/aff.h>
5921         __isl_give isl_map *isl_pw_aff_eq_map(
5922                 __isl_take isl_pw_aff *pa1,
5923                 __isl_take isl_pw_aff *pa2);
5924         __isl_give isl_map *isl_pw_aff_lt_map(
5925                 __isl_take isl_pw_aff *pa1,
5926                 __isl_take isl_pw_aff *pa2);
5927         __isl_give isl_map *isl_pw_aff_gt_map(
5928                 __isl_take isl_pw_aff *pa1,
5929                 __isl_take isl_pw_aff *pa2);
5931         __isl_give isl_map *isl_multi_pw_aff_eq_map(
5932                 __isl_take isl_multi_pw_aff *mpa1,
5933                 __isl_take isl_multi_pw_aff *mpa2);
5934         __isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
5935                 __isl_take isl_multi_pw_aff *mpa1,
5936                 __isl_take isl_multi_pw_aff *mpa2);
5937         __isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
5938                 __isl_take isl_multi_pw_aff *mpa1,
5939                 __isl_take isl_multi_pw_aff *mpa2);
5941 These functions return a map between domain elements of the arguments
5942 where the function values satisfy the given relation.
5944         #include <isl/union_map.h>
5945         __isl_give isl_union_map *
5946         isl_union_map_eq_at_multi_union_pw_aff(
5947                 __isl_take isl_union_map *umap,
5948                 __isl_take isl_multi_union_pw_aff *mupa);
5949         __isl_give isl_union_map *
5950         isl_union_map_lex_lt_at_multi_union_pw_aff(
5951                 __isl_take isl_union_map *umap,
5952                 __isl_take isl_multi_union_pw_aff *mupa);
5953         __isl_give isl_union_map *
5954         isl_union_map_lex_gt_at_multi_union_pw_aff(
5955                 __isl_take isl_union_map *umap,
5956                 __isl_take isl_multi_union_pw_aff *mupa);
5958 These functions select the subset of elements in the union map
5959 that have an equal or lexicographically smaller function value.
5961 =item * Cartesian Product
5963         #include <isl/space.h>
5964         __isl_give isl_space *isl_space_product(
5965                 __isl_take isl_space *space1,
5966                 __isl_take isl_space *space2);
5967         __isl_give isl_space *isl_space_domain_product(
5968                 __isl_take isl_space *space1,
5969                 __isl_take isl_space *space2);
5970         __isl_give isl_space *isl_space_range_product(
5971                 __isl_take isl_space *space1,
5972                 __isl_take isl_space *space2);
5974 The functions
5975 C<isl_space_product>, C<isl_space_domain_product>
5976 and C<isl_space_range_product> take pairs or relation spaces and
5977 produce a single relations space, where either the domain, the range
5978 or both domain and range are wrapped spaces of relations between
5979 the domains and/or ranges of the input spaces.
5980 If the product is only constructed over the domain or the range
5981 then the ranges or the domains of the inputs should be the same.
5982 The function C<isl_space_product> also accepts a pair of set spaces,
5983 in which case it returns a wrapped space of a relation between the
5984 two input spaces.
5986         #include <isl/set.h>
5987         __isl_give isl_set *isl_set_product(
5988                 __isl_take isl_set *set1,
5989                 __isl_take isl_set *set2);
5991         #include <isl/map.h>
5992         __isl_give isl_basic_map *isl_basic_map_domain_product(
5993                 __isl_take isl_basic_map *bmap1,
5994                 __isl_take isl_basic_map *bmap2);
5995         __isl_give isl_basic_map *isl_basic_map_range_product(
5996                 __isl_take isl_basic_map *bmap1,
5997                 __isl_take isl_basic_map *bmap2);
5998         __isl_give isl_basic_map *isl_basic_map_product(
5999                 __isl_take isl_basic_map *bmap1,
6000                 __isl_take isl_basic_map *bmap2);
6001         __isl_give isl_map *isl_map_domain_product(
6002                 __isl_take isl_map *map1,
6003                 __isl_take isl_map *map2);
6004         __isl_give isl_map *isl_map_range_product(
6005                 __isl_take isl_map *map1,
6006                 __isl_take isl_map *map2);
6007         __isl_give isl_map *isl_map_product(
6008                 __isl_take isl_map *map1,
6009                 __isl_take isl_map *map2);
6011         #include <isl/union_set.h>
6012         __isl_give isl_union_set *isl_union_set_product(
6013                 __isl_take isl_union_set *uset1,
6014                 __isl_take isl_union_set *uset2);
6016         #include <isl/union_map.h>
6017         __isl_give isl_union_map *isl_union_map_domain_product(
6018                 __isl_take isl_union_map *umap1,
6019                 __isl_take isl_union_map *umap2);
6020         __isl_give isl_union_map *isl_union_map_range_product(
6021                 __isl_take isl_union_map *umap1,
6022                 __isl_take isl_union_map *umap2);
6023         __isl_give isl_union_map *isl_union_map_product(
6024                 __isl_take isl_union_map *umap1,
6025                 __isl_take isl_union_map *umap2);
6027         #include <isl/val.h>
6028         __isl_give isl_multi_val *isl_multi_val_range_product(
6029                 __isl_take isl_multi_val *mv1,
6030                 __isl_take isl_multi_val *mv2);
6031         __isl_give isl_multi_val *isl_multi_val_product(
6032                 __isl_take isl_multi_val *mv1,
6033                 __isl_take isl_multi_val *mv2);
6035         #include <isl/aff.h>
6036         __isl_give isl_multi_aff *isl_multi_aff_range_product(
6037                 __isl_take isl_multi_aff *ma1,
6038                 __isl_take isl_multi_aff *ma2);
6039         __isl_give isl_multi_aff *isl_multi_aff_product(
6040                 __isl_take isl_multi_aff *ma1,
6041                 __isl_take isl_multi_aff *ma2);
6042         __isl_give isl_multi_pw_aff *
6043         isl_multi_pw_aff_range_product(
6044                 __isl_take isl_multi_pw_aff *mpa1,
6045                 __isl_take isl_multi_pw_aff *mpa2);
6046         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
6047                 __isl_take isl_multi_pw_aff *mpa1,
6048                 __isl_take isl_multi_pw_aff *mpa2);
6049         __isl_give isl_pw_multi_aff *
6050         isl_pw_multi_aff_range_product(
6051                 __isl_take isl_pw_multi_aff *pma1,
6052                 __isl_take isl_pw_multi_aff *pma2);
6053         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
6054                 __isl_take isl_pw_multi_aff *pma1,
6055                 __isl_take isl_pw_multi_aff *pma2);
6056         __isl_give isl_multi_union_pw_aff *
6057         isl_multi_union_pw_aff_range_product(
6058                 __isl_take isl_multi_union_pw_aff *mupa1,
6059                 __isl_take isl_multi_union_pw_aff *mupa2);
6061 The above functions compute the cross product of the given
6062 sets, relations or functions.  The domains and ranges of the results
6063 are wrapped maps between domains and ranges of the inputs.
6064 To obtain a ``flat'' product, use the following functions
6065 instead.
6067         #include <isl/set.h>
6068         __isl_give isl_basic_set *isl_basic_set_flat_product(
6069                 __isl_take isl_basic_set *bset1,
6070                 __isl_take isl_basic_set *bset2);
6071         __isl_give isl_set *isl_set_flat_product(
6072                 __isl_take isl_set *set1,
6073                 __isl_take isl_set *set2);
6075         #include <isl/map.h>
6076         __isl_give isl_basic_map *isl_basic_map_flat_range_product(
6077                 __isl_take isl_basic_map *bmap1,
6078                 __isl_take isl_basic_map *bmap2);
6079         __isl_give isl_map *isl_map_flat_domain_product(
6080                 __isl_take isl_map *map1,
6081                 __isl_take isl_map *map2);
6082         __isl_give isl_map *isl_map_flat_range_product(
6083                 __isl_take isl_map *map1,
6084                 __isl_take isl_map *map2);
6085         __isl_give isl_basic_map *isl_basic_map_flat_product(
6086                 __isl_take isl_basic_map *bmap1,
6087                 __isl_take isl_basic_map *bmap2);
6088         __isl_give isl_map *isl_map_flat_product(
6089                 __isl_take isl_map *map1,
6090                 __isl_take isl_map *map2);
6092         #include <isl/union_map.h>
6093         __isl_give isl_union_map *
6094         isl_union_map_flat_domain_product(
6095                 __isl_take isl_union_map *umap1,
6096                 __isl_take isl_union_map *umap2);
6097         __isl_give isl_union_map *
6098         isl_union_map_flat_range_product(
6099                 __isl_take isl_union_map *umap1,
6100                 __isl_take isl_union_map *umap2);
6102         #include <isl/val.h>
6103         __isl_give isl_multi_val *isl_multi_val_flat_range_product(
6104                 __isl_take isl_multi_val *mv1,
6105                 __isl_take isl_multi_aff *mv2);
6107         #include <isl/aff.h>
6108         __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
6109                 __isl_take isl_multi_aff *ma1,
6110                 __isl_take isl_multi_aff *ma2);
6111         __isl_give isl_pw_multi_aff *
6112         isl_pw_multi_aff_flat_range_product(
6113                 __isl_take isl_pw_multi_aff *pma1,
6114                 __isl_take isl_pw_multi_aff *pma2);
6115         __isl_give isl_multi_pw_aff *
6116         isl_multi_pw_aff_flat_range_product(
6117                 __isl_take isl_multi_pw_aff *mpa1,
6118                 __isl_take isl_multi_pw_aff *mpa2);
6119         __isl_give isl_union_pw_multi_aff *
6120         isl_union_pw_multi_aff_flat_range_product(
6121                 __isl_take isl_union_pw_multi_aff *upma1,
6122                 __isl_take isl_union_pw_multi_aff *upma2);
6123         __isl_give isl_multi_union_pw_aff *
6124         isl_multi_union_pw_aff_flat_range_product(
6125                 __isl_take isl_multi_union_pw_aff *mupa1,
6126                 __isl_take isl_multi_union_pw_aff *mupa2);
6128         #include <isl/space.h>
6129         __isl_give isl_space *isl_space_factor_domain(
6130                 __isl_take isl_space *space);
6131         __isl_give isl_space *isl_space_factor_range(
6132                 __isl_take isl_space *space);
6133         __isl_give isl_space *isl_space_domain_factor_domain(
6134                 __isl_take isl_space *space);
6135         __isl_give isl_space *isl_space_domain_factor_range(
6136                 __isl_take isl_space *space);
6137         __isl_give isl_space *isl_space_range_factor_domain(
6138                 __isl_take isl_space *space);
6139         __isl_give isl_space *isl_space_range_factor_range(
6140                 __isl_take isl_space *space);
6142 The functions C<isl_space_range_factor_domain> and
6143 C<isl_space_range_factor_range> extract the two arguments from
6144 the result of a call to C<isl_space_range_product>.
6146 The arguments of a call to C<isl_map_range_product> can be extracted
6147 from the result using the following functions.
6149         #include <isl/map.h>
6150         __isl_give isl_map *isl_map_factor_domain(
6151                 __isl_take isl_map *map);
6152         __isl_give isl_map *isl_map_factor_range(
6153                 __isl_take isl_map *map);
6154         __isl_give isl_map *isl_map_domain_factor_domain(
6155                 __isl_take isl_map *map);
6156         __isl_give isl_map *isl_map_domain_factor_range(
6157                 __isl_take isl_map *map);
6158         __isl_give isl_map *isl_map_range_factor_domain(
6159                 __isl_take isl_map *map);
6160         __isl_give isl_map *isl_map_range_factor_range(
6161                 __isl_take isl_map *map);
6163         #include <isl/union_map.h>
6164         __isl_give isl_union_map *isl_union_map_factor_domain(
6165                 __isl_take isl_union_map *umap);
6166         __isl_give isl_union_map *isl_union_map_factor_range(
6167                 __isl_take isl_union_map *umap);
6168         __isl_give isl_union_map *
6169         isl_union_map_domain_factor_domain(
6170                 __isl_take isl_union_map *umap);
6171         __isl_give isl_union_map *
6172         isl_union_map_domain_factor_range(
6173                 __isl_take isl_union_map *umap);
6174         __isl_give isl_union_map *
6175         isl_union_map_range_factor_range(
6176                 __isl_take isl_union_map *umap);
6178         #include <isl/val.h>
6179         __isl_give isl_multi_val *
6180         isl_multi_val_range_factor_domain(
6181                 __isl_take isl_multi_val *mv);
6182         __isl_give isl_multi_val *
6183         isl_multi_val_range_factor_range(
6184                 __isl_take isl_multi_val *mv);
6186         #include <isl/aff.h>
6187         __isl_give isl_multi_aff *
6188         isl_multi_aff_range_factor_domain(
6189                 __isl_take isl_multi_aff *ma);
6190         __isl_give isl_multi_aff *
6191         isl_multi_aff_range_factor_range(
6192                 __isl_take isl_multi_aff *ma);
6193         __isl_give isl_multi_pw_aff *
6194         isl_multi_pw_aff_range_factor_domain(
6195                 __isl_take isl_multi_pw_aff *mpa);
6196         __isl_give isl_multi_pw_aff *
6197         isl_multi_pw_aff_range_factor_range(
6198                 __isl_take isl_multi_pw_aff *mpa);
6199         __isl_give isl_multi_union_pw_aff *
6200         isl_multi_union_pw_aff_range_factor_domain(
6201                 __isl_take isl_multi_union_pw_aff *mupa);
6202         __isl_give isl_multi_union_pw_aff *
6203         isl_multi_union_pw_aff_range_factor_range(
6204                 __isl_take isl_multi_union_pw_aff *mupa);
6206 The splice functions are a generalization of the flat product functions,
6207 where the second argument may be inserted at any position inside
6208 the first argument rather than being placed at the end.
6210         #include <isl/val.h>
6211         __isl_give isl_multi_val *isl_multi_val_range_splice(
6212                 __isl_take isl_multi_val *mv1, unsigned pos,
6213                 __isl_take isl_multi_val *mv2);
6215         #include <isl/aff.h>
6216         __isl_give isl_multi_aff *isl_multi_aff_range_splice(
6217                 __isl_take isl_multi_aff *ma1, unsigned pos,
6218                 __isl_take isl_multi_aff *ma2);
6219         __isl_give isl_multi_aff *isl_multi_aff_splice(
6220                 __isl_take isl_multi_aff *ma1,
6221                 unsigned in_pos, unsigned out_pos,
6222                 __isl_take isl_multi_aff *ma2);
6223         __isl_give isl_multi_pw_aff *
6224         isl_multi_pw_aff_range_splice(
6225                 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
6226                 __isl_take isl_multi_pw_aff *mpa2);
6227         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
6228                 __isl_take isl_multi_pw_aff *mpa1,
6229                 unsigned in_pos, unsigned out_pos,
6230                 __isl_take isl_multi_pw_aff *mpa2);
6231         __isl_give isl_multi_union_pw_aff *
6232         isl_multi_union_pw_aff_range_splice(
6233                 __isl_take isl_multi_union_pw_aff *mupa1,
6234                 unsigned pos,
6235                 __isl_take isl_multi_union_pw_aff *mupa2);
6237 =item * Simplification
6239 When applied to a set or relation,
6240 the gist operation returns a set or relation that has the
6241 same intersection with the context as the input set or relation.
6242 Any implicit equality in the intersection is made explicit in the result,
6243 while all inequalities that are redundant with respect to the intersection
6244 are removed.
6245 In case of union sets and relations, the gist operation is performed
6246 per space.
6248 When applied to a function,
6249 the gist operation applies the set gist operation to each of
6250 the cells in the domain of the input piecewise expression.
6251 The context is also exploited
6252 to simplify the expression associated to each cell.
6254         #include <isl/set.h>
6255         __isl_give isl_basic_set *isl_basic_set_gist(
6256                 __isl_take isl_basic_set *bset,
6257                 __isl_take isl_basic_set *context);
6258         __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
6259                 __isl_take isl_set *context);
6260         __isl_give isl_set *isl_set_gist_params(
6261                 __isl_take isl_set *set,
6262                 __isl_take isl_set *context);
6264         #include <isl/map.h>
6265         __isl_give isl_basic_map *isl_basic_map_gist(
6266                 __isl_take isl_basic_map *bmap,
6267                 __isl_take isl_basic_map *context);
6268         __isl_give isl_basic_map *isl_basic_map_gist_domain(
6269                 __isl_take isl_basic_map *bmap,
6270                 __isl_take isl_basic_set *context);
6271         __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
6272                 __isl_take isl_map *context);
6273         __isl_give isl_map *isl_map_gist_params(
6274                 __isl_take isl_map *map,
6275                 __isl_take isl_set *context);
6276         __isl_give isl_map *isl_map_gist_domain(
6277                 __isl_take isl_map *map,
6278                 __isl_take isl_set *context);
6279         __isl_give isl_map *isl_map_gist_range(
6280                 __isl_take isl_map *map,
6281                 __isl_take isl_set *context);
6283         #include <isl/union_set.h>
6284         __isl_give isl_union_set *isl_union_set_gist(
6285                 __isl_take isl_union_set *uset,
6286                 __isl_take isl_union_set *context);
6287         __isl_give isl_union_set *isl_union_set_gist_params(
6288                 __isl_take isl_union_set *uset,
6289                 __isl_take isl_set *set);
6291         #include <isl/union_map.h>
6292         __isl_give isl_union_map *isl_union_map_gist(
6293                 __isl_take isl_union_map *umap,
6294                 __isl_take isl_union_map *context);
6295         __isl_give isl_union_map *isl_union_map_gist_params(
6296                 __isl_take isl_union_map *umap,
6297                 __isl_take isl_set *set);
6298         __isl_give isl_union_map *isl_union_map_gist_domain(
6299                 __isl_take isl_union_map *umap,
6300                 __isl_take isl_union_set *uset);
6301         __isl_give isl_union_map *isl_union_map_gist_range(
6302                 __isl_take isl_union_map *umap,
6303                 __isl_take isl_union_set *uset);
6305         #include <isl/aff.h>
6306         __isl_give isl_aff *isl_aff_gist_params(
6307                 __isl_take isl_aff *aff,
6308                 __isl_take isl_set *context);
6309         __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
6310                 __isl_take isl_set *context);
6311         __isl_give isl_multi_aff *isl_multi_aff_gist_params(
6312                 __isl_take isl_multi_aff *maff,
6313                 __isl_take isl_set *context);
6314         __isl_give isl_multi_aff *isl_multi_aff_gist(
6315                 __isl_take isl_multi_aff *maff,
6316                 __isl_take isl_set *context);
6317         __isl_give isl_pw_aff *isl_pw_aff_gist_params(
6318                 __isl_take isl_pw_aff *pwaff,
6319                 __isl_take isl_set *context);
6320         __isl_give isl_pw_aff *isl_pw_aff_gist(
6321                 __isl_take isl_pw_aff *pwaff,
6322                 __isl_take isl_set *context);
6323         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
6324                 __isl_take isl_pw_multi_aff *pma,
6325                 __isl_take isl_set *set);
6326         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
6327                 __isl_take isl_pw_multi_aff *pma,
6328                 __isl_take isl_set *set);
6329         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
6330                 __isl_take isl_multi_pw_aff *mpa,
6331                 __isl_take isl_set *set);
6332         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
6333                 __isl_take isl_multi_pw_aff *mpa,
6334                 __isl_take isl_set *set);
6335         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
6336                 __isl_take isl_union_pw_aff *upa,
6337                 __isl_take isl_union_set *context);
6338         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
6339                 __isl_take isl_union_pw_aff *upa,
6340                 __isl_take isl_set *context);
6341         __isl_give isl_union_pw_multi_aff *
6342         isl_union_pw_multi_aff_gist_params(
6343                 __isl_take isl_union_pw_multi_aff *upma,
6344                 __isl_take isl_set *context);
6345         __isl_give isl_union_pw_multi_aff *
6346         isl_union_pw_multi_aff_gist(
6347                 __isl_take isl_union_pw_multi_aff *upma,
6348                 __isl_take isl_union_set *context);
6349         __isl_give isl_multi_union_pw_aff *
6350         isl_multi_union_pw_aff_gist_params(
6351                 __isl_take isl_multi_union_pw_aff *aff,
6352                 __isl_take isl_set *context);
6353         __isl_give isl_multi_union_pw_aff *
6354         isl_multi_union_pw_aff_gist(
6355                 __isl_take isl_multi_union_pw_aff *aff,
6356                 __isl_take isl_union_set *context);
6358         #include <isl/polynomial.h>
6359         __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
6360                 __isl_take isl_qpolynomial *qp,
6361                 __isl_take isl_set *context);
6362         __isl_give isl_qpolynomial *isl_qpolynomial_gist(
6363                 __isl_take isl_qpolynomial *qp,
6364                 __isl_take isl_set *context);
6365         __isl_give isl_qpolynomial_fold *
6366         isl_qpolynomial_fold_gist_params(
6367                 __isl_take isl_qpolynomial_fold *fold,
6368                 __isl_take isl_set *context);
6369         __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
6370                 __isl_take isl_qpolynomial_fold *fold,
6371                 __isl_take isl_set *context);
6372         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
6373                 __isl_take isl_pw_qpolynomial *pwqp,
6374                 __isl_take isl_set *context);
6375         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
6376                 __isl_take isl_pw_qpolynomial *pwqp,
6377                 __isl_take isl_set *context);
6378         __isl_give isl_pw_qpolynomial_fold *
6379         isl_pw_qpolynomial_fold_gist(
6380                 __isl_take isl_pw_qpolynomial_fold *pwf,
6381                 __isl_take isl_set *context);
6382         __isl_give isl_pw_qpolynomial_fold *
6383         isl_pw_qpolynomial_fold_gist_params(
6384                 __isl_take isl_pw_qpolynomial_fold *pwf,
6385                 __isl_take isl_set *context);
6386         __isl_give isl_union_pw_qpolynomial *
6387         isl_union_pw_qpolynomial_gist_params(
6388                 __isl_take isl_union_pw_qpolynomial *upwqp,
6389                 __isl_take isl_set *context);
6390         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
6391                 __isl_take isl_union_pw_qpolynomial *upwqp,
6392                 __isl_take isl_union_set *context);
6393         __isl_give isl_union_pw_qpolynomial_fold *
6394         isl_union_pw_qpolynomial_fold_gist(
6395                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6396                 __isl_take isl_union_set *context);
6397         __isl_give isl_union_pw_qpolynomial_fold *
6398         isl_union_pw_qpolynomial_fold_gist_params(
6399                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6400                 __isl_take isl_set *context);
6402 =item * Binary Arithmethic Operations
6404         #include <isl/val.h>
6405         __isl_give isl_multi_val *isl_multi_val_sub(
6406                 __isl_take isl_multi_val *mv1,
6407                 __isl_take isl_multi_val *mv2);
6409         #include <isl/aff.h>
6410         __isl_give isl_aff *isl_aff_add(
6411                 __isl_take isl_aff *aff1,
6412                 __isl_take isl_aff *aff2);
6413         __isl_give isl_multi_aff *isl_multi_aff_add(
6414                 __isl_take isl_multi_aff *maff1,
6415                 __isl_take isl_multi_aff *maff2);
6416         __isl_give isl_pw_aff *isl_pw_aff_add(
6417                 __isl_take isl_pw_aff *pwaff1,
6418                 __isl_take isl_pw_aff *pwaff2);
6419         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
6420                 __isl_take isl_pw_multi_aff *pma1,
6421                 __isl_take isl_pw_multi_aff *pma2);
6422         __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
6423                 __isl_take isl_union_pw_aff *upa1,
6424                 __isl_take isl_union_pw_aff *upa2);
6425         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
6426                 __isl_take isl_union_pw_multi_aff *upma1,
6427                 __isl_take isl_union_pw_multi_aff *upma2);
6428         __isl_give isl_pw_aff *isl_pw_aff_min(
6429                 __isl_take isl_pw_aff *pwaff1,
6430                 __isl_take isl_pw_aff *pwaff2);
6431         __isl_give isl_pw_aff *isl_pw_aff_max(
6432                 __isl_take isl_pw_aff *pwaff1,
6433                 __isl_take isl_pw_aff *pwaff2);
6434         __isl_give isl_aff *isl_aff_sub(
6435                 __isl_take isl_aff *aff1,
6436                 __isl_take isl_aff *aff2);
6437         __isl_give isl_multi_aff *isl_multi_aff_sub(
6438                 __isl_take isl_multi_aff *ma1,
6439                 __isl_take isl_multi_aff *ma2);
6440         __isl_give isl_pw_aff *isl_pw_aff_sub(
6441                 __isl_take isl_pw_aff *pwaff1,
6442                 __isl_take isl_pw_aff *pwaff2);
6443         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
6444                 __isl_take isl_multi_pw_aff *mpa1,
6445                 __isl_take isl_multi_pw_aff *mpa2);
6446         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
6447                 __isl_take isl_pw_multi_aff *pma1,
6448                 __isl_take isl_pw_multi_aff *pma2);
6449         __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
6450                 __isl_take isl_union_pw_aff *upa1,
6451                 __isl_take isl_union_pw_aff *upa2);
6452         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
6453                 __isl_take isl_union_pw_multi_aff *upma1,
6454                 __isl_take isl_union_pw_multi_aff *upma2);
6455         __isl_give isl_multi_union_pw_aff *
6456         isl_multi_union_pw_aff_sub(
6457                 __isl_take isl_multi_union_pw_aff *mupa1,
6458                 __isl_take isl_multi_union_pw_aff *mupa2);
6460 C<isl_aff_sub> subtracts the second argument from the first.
6462         #include <isl/polynomial.h>
6463         __isl_give isl_qpolynomial *isl_qpolynomial_add(
6464                 __isl_take isl_qpolynomial *qp1,
6465                 __isl_take isl_qpolynomial *qp2);
6466         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
6467                 __isl_take isl_pw_qpolynomial *pwqp1,
6468                 __isl_take isl_pw_qpolynomial *pwqp2);
6469         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
6470                 __isl_take isl_pw_qpolynomial *pwqp1,
6471                 __isl_take isl_pw_qpolynomial *pwqp2);
6472         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
6473                 __isl_take isl_pw_qpolynomial_fold *pwf1,
6474                 __isl_take isl_pw_qpolynomial_fold *pwf2);
6475         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
6476                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6477                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6478         __isl_give isl_qpolynomial *isl_qpolynomial_sub(
6479                 __isl_take isl_qpolynomial *qp1,
6480                 __isl_take isl_qpolynomial *qp2);
6481         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
6482                 __isl_take isl_pw_qpolynomial *pwqp1,
6483                 __isl_take isl_pw_qpolynomial *pwqp2);
6484         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
6485                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6486                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6487         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
6488                 __isl_take isl_pw_qpolynomial_fold *pwf1,
6489                 __isl_take isl_pw_qpolynomial_fold *pwf2);
6490         __isl_give isl_union_pw_qpolynomial_fold *
6491         isl_union_pw_qpolynomial_fold_fold(
6492                 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
6493                 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
6495         #include <isl/aff.h>
6496         __isl_give isl_pw_aff *isl_pw_aff_union_add(
6497                 __isl_take isl_pw_aff *pwaff1,
6498                 __isl_take isl_pw_aff *pwaff2);
6499         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
6500                 __isl_take isl_pw_multi_aff *pma1,
6501                 __isl_take isl_pw_multi_aff *pma2);
6502         __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
6503                 __isl_take isl_union_pw_aff *upa1,
6504                 __isl_take isl_union_pw_aff *upa2);
6505         __isl_give isl_union_pw_multi_aff *
6506         isl_union_pw_multi_aff_union_add(
6507                 __isl_take isl_union_pw_multi_aff *upma1,
6508                 __isl_take isl_union_pw_multi_aff *upma2);
6509         __isl_give isl_multi_union_pw_aff *
6510         isl_multi_union_pw_aff_union_add(
6511                 __isl_take isl_multi_union_pw_aff *mupa1,
6512                 __isl_take isl_multi_union_pw_aff *mupa2);
6513         __isl_give isl_pw_aff *isl_pw_aff_union_min(
6514                 __isl_take isl_pw_aff *pwaff1,
6515                 __isl_take isl_pw_aff *pwaff2);
6516         __isl_give isl_pw_aff *isl_pw_aff_union_max(
6517                 __isl_take isl_pw_aff *pwaff1,
6518                 __isl_take isl_pw_aff *pwaff2);
6520 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
6521 expression with a domain that is the union of those of C<pwaff1> and
6522 C<pwaff2> and such that on each cell, the quasi-affine expression is
6523 the maximum of those of C<pwaff1> and C<pwaff2>.  If only one of
6524 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
6525 associated expression is the defined one.
6526 This in contrast to the C<isl_pw_aff_max> function, which is
6527 only defined on the shared definition domain of the arguments.
6529         #include <isl/val.h>
6530         __isl_give isl_multi_val *isl_multi_val_add_val(
6531                 __isl_take isl_multi_val *mv,
6532                 __isl_take isl_val *v);
6533         __isl_give isl_multi_val *isl_multi_val_mod_val(
6534                 __isl_take isl_multi_val *mv,
6535                 __isl_take isl_val *v);
6536         __isl_give isl_multi_val *isl_multi_val_scale_val(
6537                 __isl_take isl_multi_val *mv,
6538                 __isl_take isl_val *v);
6539         __isl_give isl_multi_val *isl_multi_val_scale_down_val(
6540                 __isl_take isl_multi_val *mv,
6541                 __isl_take isl_val *v);
6543         #include <isl/aff.h>
6544         __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
6545                 __isl_take isl_val *mod);
6546         __isl_give isl_pw_aff *isl_pw_aff_mod_val(
6547                 __isl_take isl_pw_aff *pa,
6548                 __isl_take isl_val *mod);
6549         __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
6550                 __isl_take isl_union_pw_aff *upa,
6551                 __isl_take isl_val *f);
6552         __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
6553                 __isl_take isl_val *v);
6554         __isl_give isl_multi_aff *isl_multi_aff_scale_val(
6555                 __isl_take isl_multi_aff *ma,
6556                 __isl_take isl_val *v);
6557         __isl_give isl_pw_aff *isl_pw_aff_scale_val(
6558                 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
6559         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
6560                 __isl_take isl_multi_pw_aff *mpa,
6561                 __isl_take isl_val *v);
6562         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
6563                 __isl_take isl_pw_multi_aff *pma,
6564                 __isl_take isl_val *v);
6565         __isl_give isl_union_pw_multi_aff *
6566         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
6567                 __isl_take isl_union_pw_aff *upa,
6568                 __isl_take isl_val *f);
6569         isl_union_pw_multi_aff_scale_val(
6570                 __isl_take isl_union_pw_multi_aff *upma,
6571                 __isl_take isl_val *val);
6572         __isl_give isl_multi_union_pw_aff *
6573         isl_multi_union_pw_aff_scale_val(
6574                 __isl_take isl_multi_union_pw_aff *mupa,
6575                 __isl_take isl_val *v);
6576         __isl_give isl_aff *isl_aff_scale_down_ui(
6577                 __isl_take isl_aff *aff, unsigned f);
6578         __isl_give isl_aff *isl_aff_scale_down_val(
6579                 __isl_take isl_aff *aff, __isl_take isl_val *v);
6580         __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
6581                 __isl_take isl_multi_aff *ma,
6582                 __isl_take isl_val *v);
6583         __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
6584                 __isl_take isl_pw_aff *pa,
6585                 __isl_take isl_val *f);
6586         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
6587                 __isl_take isl_multi_pw_aff *mpa,
6588                 __isl_take isl_val *v);
6589         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
6590                 __isl_take isl_pw_multi_aff *pma,
6591                 __isl_take isl_val *v);
6592         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
6593                 __isl_take isl_union_pw_aff *upa,
6594                 __isl_take isl_val *v);
6595         __isl_give isl_union_pw_multi_aff *
6596         isl_union_pw_multi_aff_scale_down_val(
6597                 __isl_take isl_union_pw_multi_aff *upma,
6598                 __isl_take isl_val *val);
6599         __isl_give isl_multi_union_pw_aff *
6600         isl_multi_union_pw_aff_scale_down_val(
6601                 __isl_take isl_multi_union_pw_aff *mupa,
6602                 __isl_take isl_val *v);
6604         #include <isl/polynomial.h>
6605         __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
6606                 __isl_take isl_qpolynomial *qp,
6607                 __isl_take isl_val *v);
6608         __isl_give isl_qpolynomial_fold *
6609         isl_qpolynomial_fold_scale_val(
6610                 __isl_take isl_qpolynomial_fold *fold,
6611                 __isl_take isl_val *v);
6612         __isl_give isl_pw_qpolynomial *
6613         isl_pw_qpolynomial_scale_val(
6614                 __isl_take isl_pw_qpolynomial *pwqp,
6615                 __isl_take isl_val *v);
6616         __isl_give isl_pw_qpolynomial_fold *
6617         isl_pw_qpolynomial_fold_scale_val(
6618                 __isl_take isl_pw_qpolynomial_fold *pwf,
6619                 __isl_take isl_val *v);
6620         __isl_give isl_union_pw_qpolynomial *
6621         isl_union_pw_qpolynomial_scale_val(
6622                 __isl_take isl_union_pw_qpolynomial *upwqp,
6623                 __isl_take isl_val *v);
6624         __isl_give isl_union_pw_qpolynomial_fold *
6625         isl_union_pw_qpolynomial_fold_scale_val(
6626                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6627                 __isl_take isl_val *v);
6628         __isl_give isl_qpolynomial *
6629         isl_qpolynomial_scale_down_val(
6630                 __isl_take isl_qpolynomial *qp,
6631                 __isl_take isl_val *v);
6632         __isl_give isl_qpolynomial_fold *
6633         isl_qpolynomial_fold_scale_down_val(
6634                 __isl_take isl_qpolynomial_fold *fold,
6635                 __isl_take isl_val *v);
6636         __isl_give isl_pw_qpolynomial *
6637         isl_pw_qpolynomial_scale_down_val(
6638                 __isl_take isl_pw_qpolynomial *pwqp,
6639                 __isl_take isl_val *v);
6640         __isl_give isl_pw_qpolynomial_fold *
6641         isl_pw_qpolynomial_fold_scale_down_val(
6642                 __isl_take isl_pw_qpolynomial_fold *pwf,
6643                 __isl_take isl_val *v);
6644         __isl_give isl_union_pw_qpolynomial *
6645         isl_union_pw_qpolynomial_scale_down_val(
6646                 __isl_take isl_union_pw_qpolynomial *upwqp,
6647                 __isl_take isl_val *v);
6648         __isl_give isl_union_pw_qpolynomial_fold *
6649         isl_union_pw_qpolynomial_fold_scale_down_val(
6650                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6651                 __isl_take isl_val *v);
6653         #include <isl/val.h>
6654         __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
6655                 __isl_take isl_multi_val *mv1,
6656                 __isl_take isl_multi_val *mv2);
6657         __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
6658                 __isl_take isl_multi_val *mv1,
6659                 __isl_take isl_multi_val *mv2);
6660         __isl_give isl_multi_val *
6661         isl_multi_val_scale_down_multi_val(
6662                 __isl_take isl_multi_val *mv1,
6663                 __isl_take isl_multi_val *mv2);
6665         #include <isl/aff.h>
6666         __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
6667                 __isl_take isl_multi_aff *ma,
6668                 __isl_take isl_multi_val *mv);
6669         __isl_give isl_multi_union_pw_aff *
6670         isl_multi_union_pw_aff_mod_multi_val(
6671                 __isl_take isl_multi_union_pw_aff *upma,
6672                 __isl_take isl_multi_val *mv);
6673         __isl_give isl_multi_pw_aff *
6674         isl_multi_pw_aff_mod_multi_val(
6675                 __isl_take isl_multi_pw_aff *mpa,
6676                 __isl_take isl_multi_val *mv);
6677         __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
6678                 __isl_take isl_multi_aff *ma,
6679                 __isl_take isl_multi_val *mv);
6680         __isl_give isl_pw_multi_aff *
6681         isl_pw_multi_aff_scale_multi_val(
6682                 __isl_take isl_pw_multi_aff *pma,
6683                 __isl_take isl_multi_val *mv);
6684         __isl_give isl_multi_pw_aff *
6685         isl_multi_pw_aff_scale_multi_val(
6686                 __isl_take isl_multi_pw_aff *mpa,
6687                 __isl_take isl_multi_val *mv);
6688         __isl_give isl_multi_union_pw_aff *
6689         isl_multi_union_pw_aff_scale_multi_val(
6690                 __isl_take isl_multi_union_pw_aff *mupa,
6691                 __isl_take isl_multi_val *mv);
6692         __isl_give isl_union_pw_multi_aff *
6693         isl_union_pw_multi_aff_scale_multi_val(
6694                 __isl_take isl_union_pw_multi_aff *upma,
6695                 __isl_take isl_multi_val *mv);
6696         __isl_give isl_multi_aff *
6697         isl_multi_aff_scale_down_multi_val(
6698                 __isl_take isl_multi_aff *ma,
6699                 __isl_take isl_multi_val *mv);
6700         __isl_give isl_multi_pw_aff *
6701         isl_multi_pw_aff_scale_down_multi_val(
6702                 __isl_take isl_multi_pw_aff *mpa,
6703                 __isl_take isl_multi_val *mv);
6704         __isl_give isl_multi_union_pw_aff *
6705         isl_multi_union_pw_aff_scale_down_multi_val(
6706                 __isl_take isl_multi_union_pw_aff *mupa,
6707                 __isl_take isl_multi_val *mv);
6709 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
6710 by the corresponding elements of C<mv>.
6712         #include <isl/aff.h>
6713         __isl_give isl_aff *isl_aff_mul(
6714                 __isl_take isl_aff *aff1,
6715                 __isl_take isl_aff *aff2);
6716         __isl_give isl_aff *isl_aff_div(
6717                 __isl_take isl_aff *aff1,
6718                 __isl_take isl_aff *aff2);
6719         __isl_give isl_pw_aff *isl_pw_aff_mul(
6720                 __isl_take isl_pw_aff *pwaff1,
6721                 __isl_take isl_pw_aff *pwaff2);
6722         __isl_give isl_pw_aff *isl_pw_aff_div(
6723                 __isl_take isl_pw_aff *pa1,
6724                 __isl_take isl_pw_aff *pa2);
6725         __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
6726                 __isl_take isl_pw_aff *pa1,
6727                 __isl_take isl_pw_aff *pa2);
6728         __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
6729                 __isl_take isl_pw_aff *pa1,
6730                 __isl_take isl_pw_aff *pa2);
6732 When multiplying two affine expressions, at least one of the two needs
6733 to be a constant.  Similarly, when dividing an affine expression by another,
6734 the second expression needs to be a constant.
6735 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
6736 rounding towards zero.  C<isl_pw_aff_tdiv_r> computes the corresponding
6737 remainder.
6739         #include <isl/polynomial.h>
6740         __isl_give isl_qpolynomial *isl_qpolynomial_mul(
6741                 __isl_take isl_qpolynomial *qp1,
6742                 __isl_take isl_qpolynomial *qp2);
6743         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
6744                 __isl_take isl_pw_qpolynomial *pwqp1,
6745                 __isl_take isl_pw_qpolynomial *pwqp2);
6746         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
6747                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6748                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6750 =back
6752 =head3 Lexicographic Optimization
6754 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
6755 the following functions
6756 compute a set that contains the lexicographic minimum or maximum
6757 of the elements in C<set> (or C<bset>) for those values of the parameters
6758 that satisfy C<dom>.
6759 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6760 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
6761 has no elements.
6762 In other words, the union of the parameter values
6763 for which the result is non-empty and of C<*empty>
6764 is equal to C<dom>.
6766         #include <isl/set.h>
6767         __isl_give isl_set *isl_basic_set_partial_lexmin(
6768                 __isl_take isl_basic_set *bset,
6769                 __isl_take isl_basic_set *dom,
6770                 __isl_give isl_set **empty);
6771         __isl_give isl_set *isl_basic_set_partial_lexmax(
6772                 __isl_take isl_basic_set *bset,
6773                 __isl_take isl_basic_set *dom,
6774                 __isl_give isl_set **empty);
6775         __isl_give isl_set *isl_set_partial_lexmin(
6776                 __isl_take isl_set *set, __isl_take isl_set *dom,
6777                 __isl_give isl_set **empty);
6778         __isl_give isl_set *isl_set_partial_lexmax(
6779                 __isl_take isl_set *set, __isl_take isl_set *dom,
6780                 __isl_give isl_set **empty);
6782 Given a (basic) set C<set> (or C<bset>), the following functions simply
6783 return a set containing the lexicographic minimum or maximum
6784 of the elements in C<set> (or C<bset>).
6785 In case of union sets, the optimum is computed per space.
6787         #include <isl/set.h>
6788         __isl_give isl_set *isl_basic_set_lexmin(
6789                 __isl_take isl_basic_set *bset);
6790         __isl_give isl_set *isl_basic_set_lexmax(
6791                 __isl_take isl_basic_set *bset);
6792         __isl_give isl_set *isl_set_lexmin(
6793                 __isl_take isl_set *set);
6794         __isl_give isl_set *isl_set_lexmax(
6795                 __isl_take isl_set *set);
6796         __isl_give isl_union_set *isl_union_set_lexmin(
6797                 __isl_take isl_union_set *uset);
6798         __isl_give isl_union_set *isl_union_set_lexmax(
6799                 __isl_take isl_union_set *uset);
6801 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
6802 the following functions
6803 compute a relation that maps each element of C<dom>
6804 to the single lexicographic minimum or maximum
6805 of the elements that are associated to that same
6806 element in C<map> (or C<bmap>).
6807 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6808 that contains the elements in C<dom> that do not map
6809 to any elements in C<map> (or C<bmap>).
6810 In other words, the union of the domain of the result and of C<*empty>
6811 is equal to C<dom>.
6813         #include <isl/map.h>
6814         __isl_give isl_map *isl_basic_map_partial_lexmax(
6815                 __isl_take isl_basic_map *bmap,
6816                 __isl_take isl_basic_set *dom,
6817                 __isl_give isl_set **empty);
6818         __isl_give isl_map *isl_basic_map_partial_lexmin(
6819                 __isl_take isl_basic_map *bmap,
6820                 __isl_take isl_basic_set *dom,
6821                 __isl_give isl_set **empty);
6822         __isl_give isl_map *isl_map_partial_lexmax(
6823                 __isl_take isl_map *map, __isl_take isl_set *dom,
6824                 __isl_give isl_set **empty);
6825         __isl_give isl_map *isl_map_partial_lexmin(
6826                 __isl_take isl_map *map, __isl_take isl_set *dom,
6827                 __isl_give isl_set **empty);
6829 Given a (basic) map C<map> (or C<bmap>), the following functions simply
6830 return a map mapping each element in the domain of
6831 C<map> (or C<bmap>) to the lexicographic minimum or maximum
6832 of all elements associated to that element.
6833 In case of union relations, the optimum is computed per space.
6835         #include <isl/map.h>
6836         __isl_give isl_map *isl_basic_map_lexmin(
6837                 __isl_take isl_basic_map *bmap);
6838         __isl_give isl_map *isl_basic_map_lexmax(
6839                 __isl_take isl_basic_map *bmap);
6840         __isl_give isl_map *isl_map_lexmin(
6841                 __isl_take isl_map *map);
6842         __isl_give isl_map *isl_map_lexmax(
6843                 __isl_take isl_map *map);
6844         __isl_give isl_union_map *isl_union_map_lexmin(
6845                 __isl_take isl_union_map *umap);
6846         __isl_give isl_union_map *isl_union_map_lexmax(
6847                 __isl_take isl_union_map *umap);
6849 The following functions return their result in the form of
6850 a piecewise multi-affine expression,
6851 but are otherwise equivalent to the corresponding functions
6852 returning a basic set or relation.
6854         #include <isl/set.h>
6855         __isl_give isl_pw_multi_aff *
6856         isl_basic_set_partial_lexmin_pw_multi_aff(
6857                 __isl_take isl_basic_set *bset,
6858                 __isl_take isl_basic_set *dom,
6859                 __isl_give isl_set **empty);
6860         __isl_give isl_pw_multi_aff *
6861         isl_basic_set_partial_lexmax_pw_multi_aff(
6862                 __isl_take isl_basic_set *bset,
6863                 __isl_take isl_basic_set *dom,
6864                 __isl_give isl_set **empty);
6865         __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
6866                 __isl_take isl_set *set);
6867         __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
6868                 __isl_take isl_set *set);
6870         #include <isl/map.h>
6871         __isl_give isl_pw_multi_aff *
6872         isl_basic_map_lexmin_pw_multi_aff(
6873                 __isl_take isl_basic_map *bmap);
6874         __isl_give isl_pw_multi_aff *
6875         isl_basic_map_partial_lexmin_pw_multi_aff(
6876                 __isl_take isl_basic_map *bmap,
6877                 __isl_take isl_basic_set *dom,
6878                 __isl_give isl_set **empty);
6879         __isl_give isl_pw_multi_aff *
6880         isl_basic_map_partial_lexmax_pw_multi_aff(
6881                 __isl_take isl_basic_map *bmap,
6882                 __isl_take isl_basic_set *dom,
6883                 __isl_give isl_set **empty);
6884         __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
6885                 __isl_take isl_map *map);
6886         __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
6887                 __isl_take isl_map *map);
6889 The following functions return the lexicographic minimum or maximum
6890 on the shared domain of the inputs and the single defined function
6891 on those parts of the domain where only a single function is defined.
6893         #include <isl/aff.h>
6894         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
6895                 __isl_take isl_pw_multi_aff *pma1,
6896                 __isl_take isl_pw_multi_aff *pma2);
6897         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
6898                 __isl_take isl_pw_multi_aff *pma1,
6899                 __isl_take isl_pw_multi_aff *pma2);
6901 =head2 Ternary Operations
6903         #include <isl/aff.h>
6904         __isl_give isl_pw_aff *isl_pw_aff_cond(
6905                 __isl_take isl_pw_aff *cond,
6906                 __isl_take isl_pw_aff *pwaff_true,
6907                 __isl_take isl_pw_aff *pwaff_false);
6909 The function C<isl_pw_aff_cond> performs a conditional operator
6910 and returns an expression that is equal to C<pwaff_true>
6911 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
6912 where C<cond> is zero.
6914 =head2 Lists
6916 Lists are defined over several element types, including
6917 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_union_pw_aff>,
6918 C<isl_union_pw_multi_aff>, C<isl_constraint>,
6919 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
6920 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
6921 Here we take lists of C<isl_set>s as an example.
6922 Lists can be created, copied, modified and freed using the following functions.
6924         #include <isl/set.h>
6925         __isl_give isl_set_list *isl_set_list_from_set(
6926                 __isl_take isl_set *el);
6927         __isl_give isl_set_list *isl_set_list_alloc(
6928                 isl_ctx *ctx, int n);
6929         __isl_give isl_set_list *isl_set_list_copy(
6930                 __isl_keep isl_set_list *list);
6931         __isl_give isl_set_list *isl_set_list_insert(
6932                 __isl_take isl_set_list *list, unsigned pos,
6933                 __isl_take isl_set *el);
6934         __isl_give isl_set_list *isl_set_list_add(
6935                 __isl_take isl_set_list *list,
6936                 __isl_take isl_set *el);
6937         __isl_give isl_set_list *isl_set_list_drop(
6938                 __isl_take isl_set_list *list,
6939                 unsigned first, unsigned n);
6940         __isl_give isl_set_list *isl_set_list_set_set(
6941                 __isl_take isl_set_list *list, int index,
6942                 __isl_take isl_set *set);
6943         __isl_give isl_set_list *isl_set_list_concat(
6944                 __isl_take isl_set_list *list1,
6945                 __isl_take isl_set_list *list2);
6946         __isl_give isl_set_list *isl_set_list_sort(
6947                 __isl_take isl_set_list *list,
6948                 int (*cmp)(__isl_keep isl_set *a,
6949                         __isl_keep isl_set *b, void *user),
6950                 void *user);
6951         __isl_null isl_set_list *isl_set_list_free(
6952                 __isl_take isl_set_list *list);
6954 C<isl_set_list_alloc> creates an empty list with an initial capacity
6955 for C<n> elements.  C<isl_set_list_insert> and C<isl_set_list_add>
6956 add elements to a list, increasing its capacity as needed.
6957 C<isl_set_list_from_set> creates a list with a single element.
6959 Lists can be inspected using the following functions.
6961         #include <isl/set.h>
6962         int isl_set_list_n_set(__isl_keep isl_set_list *list);
6963         __isl_give isl_set *isl_set_list_get_set(
6964                 __isl_keep isl_set_list *list, int index);
6965         int isl_set_list_foreach(__isl_keep isl_set_list *list,
6966                 int (*fn)(__isl_take isl_set *el, void *user),
6967                 void *user);
6968         int isl_set_list_foreach_scc(__isl_keep isl_set_list *list,
6969                 int (*follows)(__isl_keep isl_set *a,
6970                         __isl_keep isl_set *b, void *user),
6971                 void *follows_user
6972                 int (*fn)(__isl_take isl_set *el, void *user),
6973                 void *fn_user);
6975 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
6976 strongly connected components of the graph with as vertices the elements
6977 of C<list> and a directed edge from vertex C<b> to vertex C<a>
6978 iff C<follows(a, b)> returns C<1>.  The callbacks C<follows> and C<fn>
6979 should return C<-1> on error.
6981 Lists can be printed using
6983         #include <isl/set.h>
6984         __isl_give isl_printer *isl_printer_print_set_list(
6985                 __isl_take isl_printer *p,
6986                 __isl_keep isl_set_list *list);
6988 =head2 Associative arrays
6990 Associative arrays map isl objects of a specific type to isl objects
6991 of some (other) specific type.  They are defined for several pairs
6992 of types, including (C<isl_map>, C<isl_basic_set>),
6993 (C<isl_id>, C<isl_ast_expr>) and.
6994 (C<isl_id>, C<isl_pw_aff>).
6995 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
6996 as an example.
6998 Associative arrays can be created, copied and freed using
6999 the following functions.
7001         #include <isl/id_to_ast_expr.h>
7002         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
7003                 isl_ctx *ctx, int min_size);
7004         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
7005                 __isl_keep isl_id_to_ast_expr *id2expr);
7006         __isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
7007                 __isl_take isl_id_to_ast_expr *id2expr);
7009 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
7010 to specify the expected size of the associative array.
7011 The associative array will be grown automatically as needed.
7013 Associative arrays can be inspected using the following functions.
7015         #include <isl/id_to_ast_expr.h>
7016         int isl_id_to_ast_expr_has(
7017                 __isl_keep isl_id_to_ast_expr *id2expr,
7018                 __isl_keep isl_id *key);
7019         __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
7020                 __isl_keep isl_id_to_ast_expr *id2expr,
7021                 __isl_take isl_id *key);
7022         int isl_id_to_ast_expr_foreach(
7023                 __isl_keep isl_id_to_ast_expr *id2expr,
7024                 int (*fn)(__isl_take isl_id *key,
7025                         __isl_take isl_ast_expr *val, void *user),
7026                 void *user);
7028 They can be modified using the following function.
7030         #include <isl/id_to_ast_expr.h>
7031         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
7032                 __isl_take isl_id_to_ast_expr *id2expr,
7033                 __isl_take isl_id *key,
7034                 __isl_take isl_ast_expr *val);
7035         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
7036                 __isl_take isl_id_to_ast_expr *id2expr,
7037                 __isl_take isl_id *key);
7039 Associative arrays can be printed using the following function.
7041         #include <isl/id_to_ast_expr.h>
7042         __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
7043                 __isl_take isl_printer *p,
7044                 __isl_keep isl_id_to_ast_expr *id2expr);
7046 =head2 Vectors
7048 Vectors can be created, copied and freed using the following functions.
7050         #include <isl/vec.h>
7051         __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
7052                 unsigned size);
7053         __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
7054         __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
7056 Note that the elements of a newly created vector may have arbitrary values.
7057 The elements can be changed and inspected using the following functions.
7059         int isl_vec_size(__isl_keep isl_vec *vec);
7060         __isl_give isl_val *isl_vec_get_element_val(
7061                 __isl_keep isl_vec *vec, int pos);
7062         __isl_give isl_vec *isl_vec_set_element_si(
7063                 __isl_take isl_vec *vec, int pos, int v);
7064         __isl_give isl_vec *isl_vec_set_element_val(
7065                 __isl_take isl_vec *vec, int pos,
7066                 __isl_take isl_val *v);
7067         __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
7068                 int v);
7069         __isl_give isl_vec *isl_vec_set_val(
7070                 __isl_take isl_vec *vec, __isl_take isl_val *v);
7071         int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
7072                 __isl_keep isl_vec *vec2, int pos);
7074 C<isl_vec_get_element> will return a negative value if anything went wrong.
7075 In that case, the value of C<*v> is undefined.
7077 The following function can be used to concatenate two vectors.
7079         __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
7080                 __isl_take isl_vec *vec2);
7082 =head2 Matrices
7084 Matrices can be created, copied and freed using the following functions.
7086         #include <isl/mat.h>
7087         __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
7088                 unsigned n_row, unsigned n_col);
7089         __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
7090         __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
7092 Note that the elements of a newly created matrix may have arbitrary values.
7093 The elements can be changed and inspected using the following functions.
7095         int isl_mat_rows(__isl_keep isl_mat *mat);
7096         int isl_mat_cols(__isl_keep isl_mat *mat);
7097         __isl_give isl_val *isl_mat_get_element_val(
7098                 __isl_keep isl_mat *mat, int row, int col);
7099         __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
7100                 int row, int col, int v);
7101         __isl_give isl_mat *isl_mat_set_element_val(
7102                 __isl_take isl_mat *mat, int row, int col,
7103                 __isl_take isl_val *v);
7105 C<isl_mat_get_element> will return a negative value if anything went wrong.
7106 In that case, the value of C<*v> is undefined.
7108 The following function can be used to compute the (right) inverse
7109 of a matrix, i.e., a matrix such that the product of the original
7110 and the inverse (in that order) is a multiple of the identity matrix.
7111 The input matrix is assumed to be of full row-rank.
7113         __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
7115 The following function can be used to compute the (right) kernel
7116 (or null space) of a matrix, i.e., a matrix such that the product of
7117 the original and the kernel (in that order) is the zero matrix.
7119         __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
7121 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
7123 The following functions determine
7124 an upper or lower bound on a quasipolynomial over its domain.
7126         __isl_give isl_pw_qpolynomial_fold *
7127         isl_pw_qpolynomial_bound(
7128                 __isl_take isl_pw_qpolynomial *pwqp,
7129                 enum isl_fold type, int *tight);
7131         __isl_give isl_union_pw_qpolynomial_fold *
7132         isl_union_pw_qpolynomial_bound(
7133                 __isl_take isl_union_pw_qpolynomial *upwqp,
7134                 enum isl_fold type, int *tight);
7136 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
7137 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
7138 is the returned bound is known be tight, i.e., for each value
7139 of the parameters there is at least
7140 one element in the domain that reaches the bound.
7141 If the domain of C<pwqp> is not wrapping, then the bound is computed
7142 over all elements in that domain and the result has a purely parametric
7143 domain.  If the domain of C<pwqp> is wrapping, then the bound is
7144 computed over the range of the wrapped relation.  The domain of the
7145 wrapped relation becomes the domain of the result.
7147 =head2 Parametric Vertex Enumeration
7149 The parametric vertex enumeration described in this section
7150 is mainly intended to be used internally and by the C<barvinok>
7151 library.
7153         #include <isl/vertices.h>
7154         __isl_give isl_vertices *isl_basic_set_compute_vertices(
7155                 __isl_keep isl_basic_set *bset);
7157 The function C<isl_basic_set_compute_vertices> performs the
7158 actual computation of the parametric vertices and the chamber
7159 decomposition and store the result in an C<isl_vertices> object.
7160 This information can be queried by either iterating over all
7161 the vertices or iterating over all the chambers or cells
7162 and then iterating over all vertices that are active on the chamber.
7164         int isl_vertices_foreach_vertex(
7165                 __isl_keep isl_vertices *vertices,
7166                 int (*fn)(__isl_take isl_vertex *vertex, void *user),
7167                 void *user);
7169         int isl_vertices_foreach_cell(
7170                 __isl_keep isl_vertices *vertices,
7171                 int (*fn)(__isl_take isl_cell *cell, void *user),
7172                 void *user);
7173         int isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
7174                 int (*fn)(__isl_take isl_vertex *vertex, void *user),
7175                 void *user);
7177 Other operations that can be performed on an C<isl_vertices> object are
7178 the following.
7180         int isl_vertices_get_n_vertices(
7181                 __isl_keep isl_vertices *vertices);
7182         void isl_vertices_free(__isl_take isl_vertices *vertices);
7184 Vertices can be inspected and destroyed using the following functions.
7186         int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
7187         __isl_give isl_basic_set *isl_vertex_get_domain(
7188                 __isl_keep isl_vertex *vertex);
7189         __isl_give isl_multi_aff *isl_vertex_get_expr(
7190                 __isl_keep isl_vertex *vertex);
7191         void isl_vertex_free(__isl_take isl_vertex *vertex);
7193 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
7194 describing the vertex in terms of the parameters,
7195 while C<isl_vertex_get_domain> returns the activity domain
7196 of the vertex.
7198 Chambers can be inspected and destroyed using the following functions.
7200         __isl_give isl_basic_set *isl_cell_get_domain(
7201                 __isl_keep isl_cell *cell);
7202         void isl_cell_free(__isl_take isl_cell *cell);
7204 =head1 Polyhedral Compilation Library
7206 This section collects functionality in C<isl> that has been specifically
7207 designed for use during polyhedral compilation.
7209 =head2 Schedule Trees
7211 A schedule tree is a structured representation of a schedule,
7212 assigning a relative order to a set of domain elements.
7213 The relative order expressed by the schedule tree is
7214 defined recursively.  In particular, the order between
7215 two domain elements is determined by the node that is closest
7216 to the root that refers to both elements and that orders them apart.
7217 Each node in the tree is of one of several types.
7218 The root node is always of type C<isl_schedule_node_domain>
7219 and it describes the domain elements to which the schedule applies.
7220 The other types of nodes are as follows.
7222 =over
7224 =item C<isl_schedule_node_band>
7226 A band of schedule dimensions.  Each schedule dimension is represented
7227 by a union piecewise quasi-affine expression.  If this expression
7228 assigns a different value to two domain elements, while all previous
7229 schedule dimensions in the same band assign them the same value,
7230 then the two domain elements are ordered according to these two
7231 different values.
7233 =item C<isl_schedule_node_filter>
7235 A filter node does not impose any ordering, but rather intersects
7236 the set of domain elements that the current subtree refers to
7237 with a given union set.  The subtree of the filter node only
7238 refers to domain elements in the intersection.
7239 A filter node is typically only used a child of a sequence or
7240 set node.
7242 =item C<isl_schedule_node_leaf>
7244 A leaf of the schedule tree.  Leaf nodes do not impose any ordering.
7246 =item C<isl_schedule_node_sequence>
7248 A sequence node has one or more children, each of which is a filter node.
7249 The filters on these filter nodes form a partition of
7250 the domain elements that the current subtree refers to.
7251 If two domain elements appear in distinct filters then the sequence
7252 node orders them according to the child positions of the corresponding
7253 filter nodes.
7255 =item C<isl_schedule_node_set>
7257 A set node is similar to a sequence node, except that
7258 it expresses that domain elements appearing in distinct filters
7259 may have any order.  The order of the children of a set node
7260 is therefore also immaterial.
7262 =back
7264 A schedule tree is encapsulated in an C<isl_schedule> object.
7265 The simplest such objects, those with a tree consisting of single domain node,
7266 can be created using the following functions with either an empty
7267 domain or a given domain.
7269         #include <isl/schedule.h>
7270         __isl_give isl_schedule *isl_schedule_empty(
7271                 __isl_take isl_space *space);
7272         __isl_give isl_schedule *isl_schedule_from_domain(
7273                 __isl_take isl_union_set *domain);
7275 The function C<isl_schedule_constraints_compute_schedule> described
7276 in L</"Scheduling"> can also be used to construct schedules.
7278 C<isl_schedule> objects may be copied and freed using the following functions.
7280         #include <isl/schedule.h>
7281         __isl_give isl_schedule *isl_schedule_copy(
7282                 __isl_keep isl_schedule *sched);
7283         __isl_null isl_schedule *isl_schedule_free(
7284                 __isl_take isl_schedule *sched);
7286 The domain of the schedule, i.e., the domain described by the root node,
7287 can be obtained using the following function.
7289         #include <isl/schedule.h>
7290         __isl_give isl_union_set *isl_schedule_get_domain(
7291                 __isl_keep isl_schedule *schedule);
7293 An C<isl_union_map> representation of the schedule can be obtained
7294 from an C<isl_schedule> using the following function.
7296         #include <isl/schedule.h>
7297         __isl_give isl_union_map *isl_schedule_get_map(
7298                 __isl_keep isl_schedule *sched);
7300 The resulting relation encodes the same relative ordering as
7301 the schedule by mapping the domain elements to a common schedule space.
7302 If the schedule_separate_components option is set, then the order
7303 of the children of a set node is explicitly encoded in the result.
7305 A representation of the schedule can be printed using
7307         #include <isl/schedule.h>
7308         __isl_give isl_printer *isl_printer_print_schedule(
7309                 __isl_take isl_printer *p,
7310                 __isl_keep isl_schedule *schedule);
7312 The schedule tree can be traversed through the use of
7313 C<isl_schedule_node> objects that point to a particular
7314 position in the schedule tree.  Whenever a C<isl_schedule_node>
7315 is use to modify a node in the schedule tree, the original schedule
7316 tree is left untouched and the modifications are performed to a copy
7317 of the tree.  The returned C<isl_schedule_node> then points to
7318 this modified copy of the tree.
7320 The root of the schedule tree can be obtained using the following function.
7322         #include <isl/schedule.h>
7323         __isl_give isl_schedule_node *isl_schedule_get_root(
7324                 __isl_keep isl_schedule *schedule);
7326 A pointer to a newly created schedule tree with a single domain
7327 node can be created using the following function.
7329         #include <isl/schedule_node.h>
7330         __isl_give isl_schedule_node *
7331         isl_schedule_node_from_domain(
7332                 __isl_take isl_union_set *domain);
7334 Schedule nodes can be copied and freed using the following functions.
7336         #include <isl/schedule_node.h>
7337         __isl_give isl_schedule_node *isl_schedule_node_copy(
7338                 __isl_keep isl_schedule_node *node);
7339         __isl_null isl_schedule_node *isl_schedule_node_free(
7340                 __isl_take isl_schedule_node *node);
7342 The following properties can be obtained from a schedule node.
7344         #include <isl/schedule_node.h>
7345         enum isl_schedule_node_type isl_schedule_node_get_type(
7346                 __isl_keep isl_schedule_node *node);
7347         enum isl_schedule_node_type
7348         isl_schedule_node_get_parent_type(
7349                 __isl_keep isl_schedule_node *node);
7350         __isl_give isl_schedule *isl_schedule_node_get_schedule(
7351                 __isl_keep isl_schedule_node *node);
7353 The function C<isl_schedule_node_get_type> returns the type of
7354 the node, while C<isl_schedule_node_get_parent_type> returns
7355 type of the parent of the node, which is required to exist.
7356 The function C<isl_schedule_node_get_schedule> returns a copy
7357 to the schedule to which the node belongs.
7359 The following functions can be used to move the schedule node
7360 to a different position in the tree or to check if such a position
7361 exists.
7363         #include <isl/schedule_node.h>
7364         int isl_schedule_node_has_parent(
7365                 __isl_keep isl_schedule_node *node);
7366         __isl_give isl_schedule_node *isl_schedule_node_parent(
7367                 __isl_take isl_schedule_node *node);
7368         int isl_schedule_node_n_children(
7369                 __isl_keep isl_schedule_node *node);
7370         __isl_give isl_schedule_node *isl_schedule_node_child(
7371                 __isl_take isl_schedule_node *node, int pos);
7372         int isl_schedule_node_has_children(
7373                 __isl_keep isl_schedule_node *node);
7374         __isl_give isl_schedule_node *isl_schedule_node_first_child(
7375                 __isl_take isl_schedule_node *node);
7376         int isl_schedule_node_has_previous_sibling(
7377                 __isl_keep isl_schedule_node *node);
7378         __isl_give isl_schedule_node *
7379         isl_schedule_node_previous_sibling(
7380                 __isl_take isl_schedule_node *node);
7381         int isl_schedule_node_has_next_sibling(
7382                 __isl_keep isl_schedule_node *node);
7383         __isl_give isl_schedule_node *
7384         isl_schedule_node_next_sibling(
7385                 __isl_take isl_schedule_node *node);
7387 It is also possible to query the number of ancestors of a node,
7388 the position of the current node
7389 within the children of its parent or to obtain a copy of a given
7390 child without destroying the current node.
7392         #include <isl/schedule_node.h>
7393         int isl_schedule_node_get_tree_depth(
7394                 __isl_keep isl_schedule_node *node);
7395         int isl_schedule_node_get_child_position(
7396                 __isl_keep isl_schedule_node *node);
7397         __isl_give isl_schedule_node *isl_schedule_node_get_child(
7398                 __isl_keep isl_schedule_node *node, int pos);
7400 All nodes in a schedule tree or
7401 all descendants of a specific node (including the node) can be visited
7402 in depth-first pre-order using the following functions.
7404         #include <isl/schedule.h>
7405         int isl_schedule_foreach_schedule_node(
7406                 __isl_keep isl_schedule *sched,
7407                 int (*fn)(__isl_keep isl_schedule_node *node,
7408                         void *user), void *user);
7410         #include <isl/schedule_node.h>
7411         int isl_schedule_node_foreach_descendant(
7412                 __isl_keep isl_schedule_node *node,
7413                 int (*fn)(__isl_keep isl_schedule_node *node,
7414                         void *user), void *user);
7416 The callback function is slightly different from the usual
7417 callbacks in that it not only indicates success (non-negative result)
7418 or failure (negative result), but also indicates whether the children
7419 of the given node should be visited.  In particular, if the callback
7420 returns a positive value, then the children are visited, but if
7421 the callback returns zero, then the children are not visited.
7423 The following functions allows for a depth-first post-order
7424 traversal of the nodes in a schedule tree or
7425 of the descendants of a specific node (including the node
7426 itself), where the user callback is allowed to modify the
7427 visited node.
7429         #include <isl/schedule.h>
7430         __isl_give isl_schedule *isl_schedule_map_schedule_node(
7431                 __isl_take isl_schedule *schedule,
7432                 __isl_give isl_schedule_node *(*fn)(
7433                         __isl_take isl_schedule_node *node,
7434                         void *user), void *user);
7436         #include <isl/schedule_node.h>
7437         __isl_give isl_schedule_node *
7438         isl_schedule_node_map_descendant(
7439                 __isl_take isl_schedule_node *node,
7440                 __isl_give isl_schedule_node *(*fn)(
7441                         __isl_take isl_schedule_node *node,
7442                         void *user), void *user);
7444 The traversal continues from the node returned by the callback function.
7445 It is the responsibility of the user to ensure that this does not
7446 lead to an infinite loop.  It is safest to always return a pointer
7447 to the same position (same ancestors and child positions) as the input node.
7449 Several node types have their own functions for querying
7450 (and in some cases setting) some node type specific properties.
7452         #include <isl/schedule_node.h>
7453         __isl_give isl_space *isl_schedule_node_band_get_space(
7454                 __isl_keep isl_schedule_node *node);
7455         __isl_give isl_multi_union_pw_aff *
7456         isl_schedule_node_band_get_partial_schedule(
7457                 __isl_keep isl_schedule_node *node);
7458         __isl_give isl_union_map *
7459         isl_schedule_node_band_get_partial_schedule_union_map(
7460                 __isl_keep isl_schedule_node *node);
7461         unsigned isl_schedule_node_band_n_member(
7462                 __isl_keep isl_schedule_node *node);
7463         int isl_schedule_node_band_member_get_coincident(
7464                 __isl_keep isl_schedule_node *node, int pos);
7465         __isl_give isl_schedule_node *
7466         isl_schedule_node_band_member_set_coincident(
7467                 __isl_take isl_schedule_node *node, int pos,
7468                 int coincident);
7469         int isl_schedule_node_band_get_permutable(
7470                 __isl_keep isl_schedule_node *node);
7471         __isl_give isl_schedule_node *
7472         isl_schedule_node_band_set_permutable(
7473                 __isl_take isl_schedule_node *node, int permutable);
7475 The function C<isl_schedule_node_band_get_space> returns the space
7476 of the partial schedule of the band.
7477 The function C<isl_schedule_node_band_get_partial_schedule_union_map>
7478 returns a representation of the partial schedule of the band node
7479 in the form of an C<isl_union_map>.
7480 The coincident and permutable properties are set by
7481 C<isl_schedule_constraints_compute_schedule> on the schedule tree
7482 it produces.
7483 A scheduling dimension is considered to be ``coincident''
7484 if it satisfies the coincidence constraints within its band.
7485 That is, if the dependence distances of the coincidence
7486 constraints are all zero in that direction (for fixed
7487 iterations of outer bands).
7488 A band is marked permutable if it was produced using the Pluto-like scheduler.
7489 Note that the scheduler may have to resort to a Feautrier style scheduling
7490 step even if the default scheduler is used.
7492         #include <isl/schedule_node.h>
7493         __isl_give isl_union_set *
7494         isl_schedule_node_domain_get_domain(
7495                 __isl_keep isl_schedule_node *node);
7497         #include <isl/schedule_node.h>
7498         __isl_give isl_union_set *
7499         isl_schedule_node_filter_get_filter(
7500                 __isl_keep isl_schedule_node *node);
7502 The following functions can be used to obtain an C<isl_union_pw_multi_aff>
7503 or C<isl_union_map> representation of partial schedules related to the node.
7505         #include <isl/schedule_node.h>
7506         __isl_give isl_union_pw_multi_aff *
7507         isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(
7508                 __isl_keep isl_schedule_node *node);
7509         __isl_give isl_union_map *
7510         isl_schedule_node_get_prefix_schedule_union_map(
7511                 __isl_keep isl_schedule_node *node);
7512         __isl_give isl_union_map *
7513         isl_schedule_node_get_subtree_schedule_union_map(
7514                 __isl_keep isl_schedule_node *node);
7516 In particular, the functions
7517 C<isl_schedule_node_get_prefix_schedule_union_pw_multi_aff>
7518 and C<isl_schedule_node_get_prefix_schedule_union_map>
7519 return a relative ordering on the domain elements that reach the given
7520 node determined by its ancestors.
7521 The function C<isl_schedule_node_get_subtree_schedule_union_map>
7522 returns a representation of the partial schedule defined by the
7523 subtree rooted at the given node.
7525 The following function returns the union of universes in the spaces that
7526 contain elements that reach the given node.
7528         #include <isl/schedule_node.h>
7529         __isl_give isl_union_set *
7530         isl_schedule_node_get_universe_domain(
7531                 __isl_keep isl_schedule_node *node);
7533 The following functions can be used to introduce additional nodes
7534 in the schedule tree.  The new node is introduced at the point
7535 in the tree where the C<isl_schedule_node> points to and
7536 the results points to the new node.
7538         #include <isl/schedule_node.h>
7539         __isl_give isl_schedule_node *
7540         isl_schedule_node_insert_partial_schedule(
7541                 __isl_take isl_schedule_node *node,
7542                 __isl_take isl_multi_union_pw_aff *schedule);
7544 This function inserts a new band node with (the greatest integer
7545 part of) the given partial schedule.
7547         #include <isl/schedule_node.h>
7548         __isl_give isl_schedule_node *
7549         isl_schedule_node_insert_filter(
7550                 __isl_take isl_schedule_node *node,
7551                 __isl_take isl_union_set *filter);
7553 This function inserts a new filter node with the given filter.
7554 If the original node already pointed to a filter node, then the
7555 two filter nodes are merged into one.
7557         #include <isl/schedule_node.h>
7558         __isl_give isl_schedule_node *
7559         isl_schedule_node_insert_sequence(
7560                 __isl_take isl_schedule_node *node,
7561                 __isl_take isl_union_set_list *filters);
7562         __isl_give isl_schedule_node *
7563         isl_schedule_node_insert_set(
7564                 __isl_take isl_schedule_node *node,
7565                 __isl_take isl_union_set_list *filters);
7567 These functions insert a new sequence or set node with the given
7568 filters as children.
7570 The partial schedule of a band node can be scaled (down) using
7571 the following functions.
7573         #include <isl/schedule_node.h>
7574         __isl_give isl_schedule_node *
7575         isl_schedule_node_band_scale(
7576                 __isl_take isl_schedule_node *node,
7577                 __isl_take isl_multi_val *mv);
7578         __isl_give isl_schedule_node *
7579         isl_schedule_node_band_scale_down(
7580                 __isl_take isl_schedule_node *node,
7581                 __isl_take isl_multi_val *mv);
7583 The spaces of the two arguments need to match.
7584 After scaling, the partial schedule is replaced by its greatest
7585 integer part to ensure that the schedule remains integral.
7587 A band node can be tiled using the following function.
7589         #include <isl/schedule_node.h>
7590         __isl_give isl_schedule_node *isl_schedule_node_band_tile(
7591                 __isl_take isl_schedule_node *node,
7592                 __isl_take isl_multi_val *sizes);
7594         int isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
7595                 int val);
7596         int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
7597         int isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
7598                 int val);
7599         int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
7601 The C<isl_schedule_node_band_tile> function tiles
7602 the band using the given tile sizes inside its schedule.
7603 A new child band node is created to represent the point loops and it is
7604 inserted between the modified band and its children.
7605 The C<tile_scale_tile_loops> option specifies whether the tile
7606 loops iterators should be scaled by the tile sizes.
7607 If the C<tile_shift_point_loops> option is set, then the point loops
7608 are shifted to start at zero.
7610 A band node can be split into two nested band nodes
7611 using the following function.
7613         #include <isl/schedule_node.h>
7614         __isl_give isl_schedule_node *isl_schedule_node_band_split(
7615                 __isl_take isl_schedule_node *node, int pos);
7617 The resulting outer band node contains the first C<pos> dimensions of
7618 the schedule of C<node> while the inner band contains the remaining dimensions.
7619 The schedules of the two band nodes live in anonymous spaces.
7621 A band node can be moved down to the leaves of the subtree rooted
7622 at the band node using the following function.
7624         #include <isl/schedule_node.h>
7625         __isl_give isl_schedule_node *isl_schedule_node_band_sink(
7626                 __isl_take isl_schedule_node *node);
7628 The result points to the node in the resulting tree that is in the same
7629 position as the node pointed to by C<node> in the original tree.
7631 A representation of the schedule node can be printed using
7633         #include <isl/schedule_node.h>
7634         __isl_give isl_printer *isl_printer_print_schedule_node(
7635                 __isl_take isl_printer *p,
7636                 __isl_keep isl_schedule_node *node);
7638 =head2 Dependence Analysis
7640 C<isl> contains specialized functionality for performing
7641 array dataflow analysis.  That is, given a I<sink> access relation
7642 and a collection of possible I<source> access relations,
7643 C<isl> can compute relations that describe
7644 for each iteration of the sink access, which iteration
7645 of which of the source access relations was the last
7646 to access the same data element before the given iteration
7647 of the sink access.
7648 The resulting dependence relations map source iterations
7649 to the corresponding sink iterations.
7650 To compute standard flow dependences, the sink should be
7651 a read, while the sources should be writes.
7652 If any of the source accesses are marked as being I<may>
7653 accesses, then there will be a dependence from the last
7654 I<must> access B<and> from any I<may> access that follows
7655 this last I<must> access.
7656 In particular, if I<all> sources are I<may> accesses,
7657 then memory based dependence analysis is performed.
7658 If, on the other hand, all sources are I<must> accesses,
7659 then value based dependence analysis is performed.
7661         #include <isl/flow.h>
7663         typedef int (*isl_access_level_before)(void *first, void *second);
7665         __isl_give isl_access_info *isl_access_info_alloc(
7666                 __isl_take isl_map *sink,
7667                 void *sink_user, isl_access_level_before fn,
7668                 int max_source);
7669         __isl_give isl_access_info *isl_access_info_add_source(
7670                 __isl_take isl_access_info *acc,
7671                 __isl_take isl_map *source, int must,
7672                 void *source_user);
7673         __isl_null isl_access_info *isl_access_info_free(
7674                 __isl_take isl_access_info *acc);
7676         __isl_give isl_flow *isl_access_info_compute_flow(
7677                 __isl_take isl_access_info *acc);
7679         int isl_flow_foreach(__isl_keep isl_flow *deps,
7680                 int (*fn)(__isl_take isl_map *dep, int must,
7681                           void *dep_user, void *user),
7682                 void *user);
7683         __isl_give isl_map *isl_flow_get_no_source(
7684                 __isl_keep isl_flow *deps, int must);
7685         void isl_flow_free(__isl_take isl_flow *deps);
7687 The function C<isl_access_info_compute_flow> performs the actual
7688 dependence analysis.  The other functions are used to construct
7689 the input for this function or to read off the output.
7691 The input is collected in an C<isl_access_info>, which can
7692 be created through a call to C<isl_access_info_alloc>.
7693 The arguments to this functions are the sink access relation
7694 C<sink>, a token C<sink_user> used to identify the sink
7695 access to the user, a callback function for specifying the
7696 relative order of source and sink accesses, and the number
7697 of source access relations that will be added.
7698 The callback function has type C<int (*)(void *first, void *second)>.
7699 The function is called with two user supplied tokens identifying
7700 either a source or the sink and it should return the shared nesting
7701 level and the relative order of the two accesses.
7702 In particular, let I<n> be the number of loops shared by
7703 the two accesses.  If C<first> precedes C<second> textually,
7704 then the function should return I<2 * n + 1>; otherwise,
7705 it should return I<2 * n>.
7706 The sources can be added to the C<isl_access_info> by performing
7707 (at most) C<max_source> calls to C<isl_access_info_add_source>.
7708 C<must> indicates whether the source is a I<must> access
7709 or a I<may> access.  Note that a multi-valued access relation
7710 should only be marked I<must> if every iteration in the domain
7711 of the relation accesses I<all> elements in its image.
7712 The C<source_user> token is again used to identify
7713 the source access.  The range of the source access relation
7714 C<source> should have the same dimension as the range
7715 of the sink access relation.
7716 The C<isl_access_info_free> function should usually not be
7717 called explicitly, because it is called implicitly by
7718 C<isl_access_info_compute_flow>.
7720 The result of the dependence analysis is collected in an
7721 C<isl_flow>.  There may be elements of
7722 the sink access for which no preceding source access could be
7723 found or for which all preceding sources are I<may> accesses.
7724 The relations containing these elements can be obtained through
7725 calls to C<isl_flow_get_no_source>, the first with C<must> set
7726 and the second with C<must> unset.
7727 In the case of standard flow dependence analysis,
7728 with the sink a read and the sources I<must> writes,
7729 the first relation corresponds to the reads from uninitialized
7730 array elements and the second relation is empty.
7731 The actual flow dependences can be extracted using
7732 C<isl_flow_foreach>.  This function will call the user-specified
7733 callback function C<fn> for each B<non-empty> dependence between
7734 a source and the sink.  The callback function is called
7735 with four arguments, the actual flow dependence relation
7736 mapping source iterations to sink iterations, a boolean that
7737 indicates whether it is a I<must> or I<may> dependence, a token
7738 identifying the source and an additional C<void *> with value
7739 equal to the third argument of the C<isl_flow_foreach> call.
7740 A dependence is marked I<must> if it originates from a I<must>
7741 source and if it is not followed by any I<may> sources.
7743 After finishing with an C<isl_flow>, the user should call
7744 C<isl_flow_free> to free all associated memory.
7746 A higher-level interface to dependence analysis is provided
7747 by the following function.
7749         #include <isl/flow.h>
7751         int isl_union_map_compute_flow(__isl_take isl_union_map *sink,
7752                 __isl_take isl_union_map *must_source,
7753                 __isl_take isl_union_map *may_source,
7754                 __isl_take isl_union_map *schedule,
7755                 __isl_give isl_union_map **must_dep,
7756                 __isl_give isl_union_map **may_dep,
7757                 __isl_give isl_union_map **must_no_source,
7758                 __isl_give isl_union_map **may_no_source);
7760 The arrays are identified by the tuple names of the ranges
7761 of the accesses.  The iteration domains by the tuple names
7762 of the domains of the accesses and of the schedule.
7763 The relative order of the iteration domains is given by the
7764 schedule.  The relations returned through C<must_no_source>
7765 and C<may_no_source> are subsets of C<sink>.
7766 Any of C<must_dep>, C<may_dep>, C<must_no_source>
7767 or C<may_no_source> may be C<NULL>, but a C<NULL> value for
7768 any of the other arguments is treated as an error.
7770 =head3 Interaction with Dependence Analysis
7772 During the dependence analysis, we frequently need to perform
7773 the following operation.  Given a relation between sink iterations
7774 and potential source iterations from a particular source domain,
7775 what is the last potential source iteration corresponding to each
7776 sink iteration.  It can sometimes be convenient to adjust
7777 the set of potential source iterations before or after each such operation.
7778 The prototypical example is fuzzy array dataflow analysis,
7779 where we need to analyze if, based on data-dependent constraints,
7780 the sink iteration can ever be executed without one or more of
7781 the corresponding potential source iterations being executed.
7782 If so, we can introduce extra parameters and select an unknown
7783 but fixed source iteration from the potential source iterations.
7784 To be able to perform such manipulations, C<isl> provides the following
7785 function.
7787         #include <isl/flow.h>
7789         typedef __isl_give isl_restriction *(*isl_access_restrict)(
7790                 __isl_keep isl_map *source_map,
7791                 __isl_keep isl_set *sink, void *source_user,
7792                 void *user);
7793         __isl_give isl_access_info *isl_access_info_set_restrict(
7794                 __isl_take isl_access_info *acc,
7795                 isl_access_restrict fn, void *user);
7797 The function C<isl_access_info_set_restrict> should be called
7798 before calling C<isl_access_info_compute_flow> and registers a callback function
7799 that will be called any time C<isl> is about to compute the last
7800 potential source.  The first argument is the (reverse) proto-dependence,
7801 mapping sink iterations to potential source iterations.
7802 The second argument represents the sink iterations for which
7803 we want to compute the last source iteration.
7804 The third argument is the token corresponding to the source
7805 and the final argument is the token passed to C<isl_access_info_set_restrict>.
7806 The callback is expected to return a restriction on either the input or
7807 the output of the operation computing the last potential source.
7808 If the input needs to be restricted then restrictions are needed
7809 for both the source and the sink iterations.  The sink iterations
7810 and the potential source iterations will be intersected with these sets.
7811 If the output needs to be restricted then only a restriction on the source
7812 iterations is required.
7813 If any error occurs, the callback should return C<NULL>.
7814 An C<isl_restriction> object can be created, freed and inspected
7815 using the following functions.
7817         #include <isl/flow.h>
7819         __isl_give isl_restriction *isl_restriction_input(
7820                 __isl_take isl_set *source_restr,
7821                 __isl_take isl_set *sink_restr);
7822         __isl_give isl_restriction *isl_restriction_output(
7823                 __isl_take isl_set *source_restr);
7824         __isl_give isl_restriction *isl_restriction_none(
7825                 __isl_take isl_map *source_map);
7826         __isl_give isl_restriction *isl_restriction_empty(
7827                 __isl_take isl_map *source_map);
7828         __isl_null isl_restriction *isl_restriction_free(
7829                 __isl_take isl_restriction *restr);
7831 C<isl_restriction_none> and C<isl_restriction_empty> are special
7832 cases of C<isl_restriction_input>.  C<isl_restriction_none>
7833 is essentially equivalent to
7835         isl_restriction_input(isl_set_universe(
7836             isl_space_range(isl_map_get_space(source_map))),
7837                             isl_set_universe(
7838             isl_space_domain(isl_map_get_space(source_map))));
7840 whereas C<isl_restriction_empty> is essentially equivalent to
7842         isl_restriction_input(isl_set_empty(
7843             isl_space_range(isl_map_get_space(source_map))),
7844                             isl_set_universe(
7845             isl_space_domain(isl_map_get_space(source_map))));
7847 =head2 Scheduling
7849 B<The functionality described in this section is fairly new
7850 and may be subject to change.>
7852         #include <isl/schedule.h>
7853         __isl_give isl_schedule *
7854         isl_schedule_constraints_compute_schedule(
7855                 __isl_take isl_schedule_constraints *sc);
7857 The function C<isl_schedule_constraints_compute_schedule> can be
7858 used to compute a schedule that satisfies the given schedule constraints.
7859 These schedule constraints include the iteration domain for which
7860 a schedule should be computed and dependences between pairs of
7861 iterations.  In particular, these dependences include
7862 I<validity> dependences and I<proximity> dependences.
7863 By default, the algorithm used to construct the schedule is similar
7864 to that of C<Pluto>.
7865 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
7866 be selected.
7867 The generated schedule respects all validity dependences.
7868 That is, all dependence distances over these dependences in the
7869 scheduled space are lexicographically positive.
7870 The default algorithm tries to ensure that the dependence distances
7871 over coincidence constraints are zero and to minimize the
7872 dependence distances over proximity dependences.
7873 Moreover, it tries to obtain sequences (bands) of schedule dimensions
7874 for groups of domains where the dependence distances over validity
7875 dependences have only non-negative values.
7876 When using Feautrier's algorithm, the coincidence and proximity constraints
7877 are only taken into account during the extension to a
7878 full-dimensional schedule.
7880 An C<isl_schedule_constraints> object can be constructed
7881 and manipulated using the following functions.
7883         #include <isl/schedule.h>
7884         __isl_give isl_schedule_constraints *
7885         isl_schedule_constraints_copy(
7886                 __isl_keep isl_schedule_constraints *sc);
7887         __isl_give isl_schedule_constraints *
7888         isl_schedule_constraints_on_domain(
7889                 __isl_take isl_union_set *domain);
7890         __isl_give isl_schedule_constraints *
7891         isl_schedule_constraints_set_context(
7892                 __isl_take isl_schedule_constraints *sc,
7893                 __isl_take isl_set *context);
7894         __isl_give isl_schedule_constraints *
7895         isl_schedule_constraints_set_validity(
7896                 __isl_take isl_schedule_constraints *sc,
7897                 __isl_take isl_union_map *validity);
7898         __isl_give isl_schedule_constraints *
7899         isl_schedule_constraints_set_coincidence(
7900                 __isl_take isl_schedule_constraints *sc,
7901                 __isl_take isl_union_map *coincidence);
7902         __isl_give isl_schedule_constraints *
7903         isl_schedule_constraints_set_proximity(
7904                 __isl_take isl_schedule_constraints *sc,
7905                 __isl_take isl_union_map *proximity);
7906         __isl_give isl_schedule_constraints *
7907         isl_schedule_constraints_set_conditional_validity(
7908                 __isl_take isl_schedule_constraints *sc,
7909                 __isl_take isl_union_map *condition,
7910                 __isl_take isl_union_map *validity);
7911         __isl_null isl_schedule_constraints *
7912         isl_schedule_constraints_free(
7913                 __isl_take isl_schedule_constraints *sc);
7915 The initial C<isl_schedule_constraints> object created by
7916 C<isl_schedule_constraints_on_domain> does not impose any constraints.
7917 That is, it has an empty set of dependences.
7918 The function C<isl_schedule_constraints_set_context> allows the user
7919 to specify additional constraints on the parameters that may
7920 be assumed to hold during the construction of the schedule.
7921 The function C<isl_schedule_constraints_set_validity> replaces the
7922 validity dependences, mapping domain elements I<i> to domain
7923 elements that should be scheduled after I<i>.
7924 The function C<isl_schedule_constraints_set_coincidence> replaces the
7925 coincidence dependences, mapping domain elements I<i> to domain
7926 elements that should be scheduled together with I<I>, if possible.
7927 The function C<isl_schedule_constraints_set_proximity> replaces the
7928 proximity dependences, mapping domain elements I<i> to domain
7929 elements that should be scheduled either before I<I>
7930 or as early as possible after I<i>.
7932 The function C<isl_schedule_constraints_set_conditional_validity>
7933 replaces the conditional validity constraints.
7934 A conditional validity constraint is only imposed when any of the corresponding
7935 conditions is satisfied, i.e., when any of them is non-zero.
7936 That is, the scheduler ensures that within each band if the dependence
7937 distances over the condition constraints are not all zero
7938 then all corresponding conditional validity constraints are respected.
7939 A conditional validity constraint corresponds to a condition
7940 if the two are adjacent, i.e., if the domain of one relation intersect
7941 the range of the other relation.
7942 The typical use case of conditional validity constraints is
7943 to allow order constraints between live ranges to be violated
7944 as long as the live ranges themselves are local to the band.
7945 To allow more fine-grained control over which conditions correspond
7946 to which conditional validity constraints, the domains and ranges
7947 of these relations may include I<tags>.  That is, the domains and
7948 ranges of those relation may themselves be wrapped relations
7949 where the iteration domain appears in the domain of those wrapped relations
7950 and the range of the wrapped relations can be arbitrarily chosen
7951 by the user.  Conditions and conditional validity constraints are only
7952 considered adjacent to each other if the entire wrapped relation matches.
7953 In particular, a relation with a tag will never be considered adjacent
7954 to a relation without a tag.
7956 The following function computes a schedule directly from
7957 an iteration domain and validity and proximity dependences
7958 and is implemented in terms of the functions described above.
7959 The use of C<isl_union_set_compute_schedule> is discouraged.
7961         #include <isl/schedule.h>
7962         __isl_give isl_schedule *isl_union_set_compute_schedule(
7963                 __isl_take isl_union_set *domain,
7964                 __isl_take isl_union_map *validity,
7965                 __isl_take isl_union_map *proximity);
7967 The generated schedule represents a schedule tree.
7968 For more information on schedule trees, see
7969 L</"Schedule Trees">.
7971 A representation of the schedule as a forest of bands can be obtained
7972 using the following function.
7974         __isl_give isl_band_list *isl_schedule_get_band_forest(
7975                 __isl_keep isl_schedule *schedule);
7977 If the input schedule is represented by a schedule tree, then a call
7978 to C<isl_schedule_get_band_forest> replaces the internal schedule tree
7979 representation by a band forest representation.
7981 The individual bands can be visited in depth-first post-order
7982 using the following function.
7984         #include <isl/schedule.h>
7985         int isl_schedule_foreach_band(
7986                 __isl_keep isl_schedule *sched,
7987                 int (*fn)(__isl_keep isl_band *band, void *user),
7988                 void *user);
7990 The list can be manipulated as explained in L<"Lists">.
7991 The bands inside the list can be copied and freed using the following
7992 functions.
7994         #include <isl/band.h>
7995         __isl_give isl_band *isl_band_copy(
7996                 __isl_keep isl_band *band);
7997         __isl_null isl_band *isl_band_free(
7998                 __isl_take isl_band *band);
8000 Each band contains zero or more scheduling dimensions.
8001 These are referred to as the members of the band.
8002 The section of the schedule that corresponds to the band is
8003 referred to as the partial schedule of the band.
8004 For those nodes that participate in a band, the outer scheduling
8005 dimensions form the prefix schedule, while the inner scheduling
8006 dimensions form the suffix schedule.
8007 That is, if we take a cut of the band forest, then the union of
8008 the concatenations of the prefix, partial and suffix schedules of
8009 each band in the cut is equal to the entire schedule (modulo
8010 some possible padding at the end with zero scheduling dimensions).
8011 The properties of a band can be inspected using the following functions.
8013         #include <isl/band.h>
8014         int isl_band_has_children(__isl_keep isl_band *band);
8015         __isl_give isl_band_list *isl_band_get_children(
8016                 __isl_keep isl_band *band);
8018         __isl_give isl_union_map *isl_band_get_prefix_schedule(
8019                 __isl_keep isl_band *band);
8020         __isl_give isl_union_map *isl_band_get_partial_schedule(
8021                 __isl_keep isl_band *band);
8022         __isl_give isl_union_map *isl_band_get_suffix_schedule(
8023                 __isl_keep isl_band *band);
8025         int isl_band_n_member(__isl_keep isl_band *band);
8026         int isl_band_member_is_coincident(
8027                 __isl_keep isl_band *band, int pos);
8029         int isl_band_list_foreach_band(
8030                 __isl_keep isl_band_list *list,
8031                 int (*fn)(__isl_keep isl_band *band, void *user),
8032                 void *user);
8034 Note that a scheduling dimension is considered to be ``coincident''
8035 if it satisfies the coincidence constraints within its band.
8036 That is, if the dependence distances of the coincidence
8037 constraints are all zero in that direction (for fixed
8038 iterations of outer bands).
8039 Like C<isl_schedule_foreach_band>,
8040 the function C<isl_band_list_foreach_band> calls C<fn> on the bands
8041 in depth-first post-order.
8043 A band can be tiled using the following function.
8045         #include <isl/band.h>
8046         int isl_band_tile(__isl_keep isl_band *band,
8047                 __isl_take isl_vec *sizes);
8049         int isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
8050                 int val);
8051         int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
8052         int isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
8053                 int val);
8054         int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
8056 The C<isl_band_tile> function tiles the band using the given tile sizes
8057 inside its schedule.
8058 A new child band is created to represent the point loops and it is
8059 inserted between the modified band and its children.
8060 The C<tile_scale_tile_loops> option specifies whether the tile
8061 loops iterators should be scaled by the tile sizes.
8062 If the C<tile_shift_point_loops> option is set, then the point loops
8063 are shifted to start at zero.
8065 A band can be split into two nested bands using the following function.
8067         int isl_band_split(__isl_keep isl_band *band, int pos);
8069 The resulting outer band contains the first C<pos> dimensions of C<band>
8070 while the inner band contains the remaining dimensions.
8072 A representation of the band can be printed using
8074         #include <isl/band.h>
8075         __isl_give isl_printer *isl_printer_print_band(
8076                 __isl_take isl_printer *p,
8077                 __isl_keep isl_band *band);
8079 =head3 Options
8081         #include <isl/schedule.h>
8082         int isl_options_set_schedule_max_coefficient(
8083                 isl_ctx *ctx, int val);
8084         int isl_options_get_schedule_max_coefficient(
8085                 isl_ctx *ctx);
8086         int isl_options_set_schedule_max_constant_term(
8087                 isl_ctx *ctx, int val);
8088         int isl_options_get_schedule_max_constant_term(
8089                 isl_ctx *ctx);
8090         int isl_options_set_schedule_fuse(isl_ctx *ctx, int val);
8091         int isl_options_get_schedule_fuse(isl_ctx *ctx);
8092         int isl_options_set_schedule_maximize_band_depth(
8093                 isl_ctx *ctx, int val);
8094         int isl_options_get_schedule_maximize_band_depth(
8095                 isl_ctx *ctx);
8096         int isl_options_set_schedule_outer_coincidence(
8097                 isl_ctx *ctx, int val);
8098         int isl_options_get_schedule_outer_coincidence(
8099                 isl_ctx *ctx);
8100         int isl_options_set_schedule_split_scaled(
8101                 isl_ctx *ctx, int val);
8102         int isl_options_get_schedule_split_scaled(
8103                 isl_ctx *ctx);
8104         int isl_options_set_schedule_algorithm(
8105                 isl_ctx *ctx, int val);
8106         int isl_options_get_schedule_algorithm(
8107                 isl_ctx *ctx);
8108         int isl_options_set_schedule_separate_components(
8109                 isl_ctx *ctx, int val);
8110         int isl_options_get_schedule_separate_components(
8111                 isl_ctx *ctx);
8113 =over
8115 =item * schedule_max_coefficient
8117 This option enforces that the coefficients for variable and parameter
8118 dimensions in the calculated schedule are not larger than the specified value.
8119 This option can significantly increase the speed of the scheduling calculation
8120 and may also prevent fusing of unrelated dimensions. A value of -1 means that
8121 this option does not introduce bounds on the variable or parameter
8122 coefficients.
8124 =item * schedule_max_constant_term
8126 This option enforces that the constant coefficients in the calculated schedule
8127 are not larger than the maximal constant term. This option can significantly
8128 increase the speed of the scheduling calculation and may also prevent fusing of
8129 unrelated dimensions. A value of -1 means that this option does not introduce
8130 bounds on the constant coefficients.
8132 =item * schedule_fuse
8134 This option controls the level of fusion.
8135 If this option is set to C<ISL_SCHEDULE_FUSE_MIN>, then loops in the
8136 resulting schedule will be distributed as much as possible.
8137 If this option is set to C<ISL_SCHEDULE_FUSE_MAX>, then C<isl> will
8138 try to fuse loops in the resulting schedule.
8140 =item * schedule_maximize_band_depth
8142 If this option is set, we do not split bands at the point
8143 where we detect splitting is necessary. Instead, we
8144 backtrack and split bands as early as possible. This
8145 reduces the number of splits and maximizes the width of
8146 the bands. Wider bands give more possibilities for tiling.
8147 Note that if the C<schedule_fuse> option is set to C<ISL_SCHEDULE_FUSE_MIN>,
8148 then bands will be split as early as possible, even if there is no need.
8149 The C<schedule_maximize_band_depth> option therefore has no effect in this case.
8151 =item * schedule_outer_coincidence
8153 If this option is set, then we try to construct schedules
8154 where the outermost scheduling dimension in each band
8155 satisfies the coincidence constraints.
8157 =item * schedule_split_scaled
8159 If this option is set, then we try to construct schedules in which the
8160 constant term is split off from the linear part if the linear parts of
8161 the scheduling rows for all nodes in the graphs have a common non-trivial
8162 divisor.
8163 The constant term is then placed in a separate band and the linear
8164 part is reduced.
8166 =item * schedule_algorithm
8168 Selects the scheduling algorithm to be used.
8169 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
8170 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
8172 =item * schedule_separate_components
8174 If this option is set then the function C<isl_schedule_get_map>
8175 will treat set nodes in the same way as sequence nodes.
8177 =back
8179 =head2 AST Generation
8181 This section describes the C<isl> functionality for generating
8182 ASTs that visit all the elements
8183 in a domain in an order specified by a schedule.
8184 In particular, given a C<isl_union_map>, an AST is generated
8185 that visits all the elements in the domain of the C<isl_union_map>
8186 according to the lexicographic order of the corresponding image
8187 element(s).  If the range of the C<isl_union_map> consists of
8188 elements in more than one space, then each of these spaces is handled
8189 separately in an arbitrary order.
8190 It should be noted that the image elements only specify the I<order>
8191 in which the corresponding domain elements should be visited.
8192 No direct relation between the image elements and the loop iterators
8193 in the generated AST should be assumed.
8195 Each AST is generated within a build.  The initial build
8196 simply specifies the constraints on the parameters (if any)
8197 and can be created, inspected, copied and freed using the following functions.
8199         #include <isl/ast_build.h>
8200         __isl_give isl_ast_build *isl_ast_build_from_context(
8201                 __isl_take isl_set *set);
8202         __isl_give isl_ast_build *isl_ast_build_copy(
8203                 __isl_keep isl_ast_build *build);
8204         __isl_null isl_ast_build *isl_ast_build_free(
8205                 __isl_take isl_ast_build *build);
8207 The C<set> argument is usually a parameter set with zero or more parameters.
8208 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
8209 and L</"Fine-grained Control over AST Generation">.
8210 Finally, the AST itself can be constructed using the following
8211 function.
8213         #include <isl/ast_build.h>
8214         __isl_give isl_ast_node *isl_ast_build_ast_from_schedule(
8215                 __isl_keep isl_ast_build *build,
8216                 __isl_take isl_union_map *schedule);
8218 =head3 Inspecting the AST
8220 The basic properties of an AST node can be obtained as follows.
8222         #include <isl/ast.h>
8223         enum isl_ast_node_type isl_ast_node_get_type(
8224                 __isl_keep isl_ast_node *node);
8226 The type of an AST node is one of
8227 C<isl_ast_node_for>,
8228 C<isl_ast_node_if>,
8229 C<isl_ast_node_block> or
8230 C<isl_ast_node_user>.
8231 An C<isl_ast_node_for> represents a for node.
8232 An C<isl_ast_node_if> represents an if node.
8233 An C<isl_ast_node_block> represents a compound node.
8234 An C<isl_ast_node_user> represents an expression statement.
8235 An expression statement typically corresponds to a domain element, i.e.,
8236 one of the elements that is visited by the AST.
8238 Each type of node has its own additional properties.
8240         #include <isl/ast.h>
8241         __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
8242                 __isl_keep isl_ast_node *node);
8243         __isl_give isl_ast_expr *isl_ast_node_for_get_init(
8244                 __isl_keep isl_ast_node *node);
8245         __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
8246                 __isl_keep isl_ast_node *node);
8247         __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
8248                 __isl_keep isl_ast_node *node);
8249         __isl_give isl_ast_node *isl_ast_node_for_get_body(
8250                 __isl_keep isl_ast_node *node);
8251         int isl_ast_node_for_is_degenerate(
8252                 __isl_keep isl_ast_node *node);
8254 An C<isl_ast_for> is considered degenerate if it is known to execute
8255 exactly once.
8257         #include <isl/ast.h>
8258         __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
8259                 __isl_keep isl_ast_node *node);
8260         __isl_give isl_ast_node *isl_ast_node_if_get_then(
8261                 __isl_keep isl_ast_node *node);
8262         int isl_ast_node_if_has_else(
8263                 __isl_keep isl_ast_node *node);
8264         __isl_give isl_ast_node *isl_ast_node_if_get_else(
8265                 __isl_keep isl_ast_node *node);
8267         __isl_give isl_ast_node_list *
8268         isl_ast_node_block_get_children(
8269                 __isl_keep isl_ast_node *node);
8271         __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
8272                 __isl_keep isl_ast_node *node);
8274 Each of the returned C<isl_ast_expr>s can in turn be inspected using
8275 the following functions.
8277         #include <isl/ast.h>
8278         enum isl_ast_expr_type isl_ast_expr_get_type(
8279                 __isl_keep isl_ast_expr *expr);
8281 The type of an AST expression is one of
8282 C<isl_ast_expr_op>,
8283 C<isl_ast_expr_id> or
8284 C<isl_ast_expr_int>.
8285 An C<isl_ast_expr_op> represents the result of an operation.
8286 An C<isl_ast_expr_id> represents an identifier.
8287 An C<isl_ast_expr_int> represents an integer value.
8289 Each type of expression has its own additional properties.
8291         #include <isl/ast.h>
8292         enum isl_ast_op_type isl_ast_expr_get_op_type(
8293                 __isl_keep isl_ast_expr *expr);
8294         int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
8295         __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
8296                 __isl_keep isl_ast_expr *expr, int pos);
8297         int isl_ast_node_foreach_ast_op_type(
8298                 __isl_keep isl_ast_node *node,
8299                 int (*fn)(enum isl_ast_op_type type, void *user),
8300                 void *user);
8302 C<isl_ast_expr_get_op_type> returns the type of the operation
8303 performed.  C<isl_ast_expr_get_op_n_arg> returns the number of
8304 arguments.  C<isl_ast_expr_get_op_arg> returns the specified
8305 argument.
8306 C<isl_ast_node_foreach_ast_op_type> calls C<fn> for each distinct
8307 C<isl_ast_op_type> that appears in C<node>.
8308 The operation type is one of the following.
8310 =over
8312 =item C<isl_ast_op_and>
8314 Logical I<and> of two arguments.
8315 Both arguments can be evaluated.
8317 =item C<isl_ast_op_and_then>
8319 Logical I<and> of two arguments.
8320 The second argument can only be evaluated if the first evaluates to true.
8322 =item C<isl_ast_op_or>
8324 Logical I<or> of two arguments.
8325 Both arguments can be evaluated.
8327 =item C<isl_ast_op_or_else>
8329 Logical I<or> of two arguments.
8330 The second argument can only be evaluated if the first evaluates to false.
8332 =item C<isl_ast_op_max>
8334 Maximum of two or more arguments.
8336 =item C<isl_ast_op_min>
8338 Minimum of two or more arguments.
8340 =item C<isl_ast_op_minus>
8342 Change sign.
8344 =item C<isl_ast_op_add>
8346 Sum of two arguments.
8348 =item C<isl_ast_op_sub>
8350 Difference of two arguments.
8352 =item C<isl_ast_op_mul>
8354 Product of two arguments.
8356 =item C<isl_ast_op_div>
8358 Exact division.  That is, the result is known to be an integer.
8360 =item C<isl_ast_op_fdiv_q>
8362 Result of integer division, rounded towards negative
8363 infinity.
8365 =item C<isl_ast_op_pdiv_q>
8367 Result of integer division, where dividend is known to be non-negative.
8369 =item C<isl_ast_op_pdiv_r>
8371 Remainder of integer division, where dividend is known to be non-negative.
8373 =item C<isl_ast_op_zdiv_r>
8375 Equal to zero iff the remainder on integer division is zero.
8377 =item C<isl_ast_op_cond>
8379 Conditional operator defined on three arguments.
8380 If the first argument evaluates to true, then the result
8381 is equal to the second argument.  Otherwise, the result
8382 is equal to the third argument.
8383 The second and third argument may only be evaluated if
8384 the first argument evaluates to true and false, respectively.
8385 Corresponds to C<a ? b : c> in C.
8387 =item C<isl_ast_op_select>
8389 Conditional operator defined on three arguments.
8390 If the first argument evaluates to true, then the result
8391 is equal to the second argument.  Otherwise, the result
8392 is equal to the third argument.
8393 The second and third argument may be evaluated independently
8394 of the value of the first argument.
8395 Corresponds to C<a * b + (1 - a) * c> in C.
8397 =item C<isl_ast_op_eq>
8399 Equality relation.
8401 =item C<isl_ast_op_le>
8403 Less than or equal relation.
8405 =item C<isl_ast_op_lt>
8407 Less than relation.
8409 =item C<isl_ast_op_ge>
8411 Greater than or equal relation.
8413 =item C<isl_ast_op_gt>
8415 Greater than relation.
8417 =item C<isl_ast_op_call>
8419 A function call.
8420 The number of arguments of the C<isl_ast_expr> is one more than
8421 the number of arguments in the function call, the first argument
8422 representing the function being called.
8424 =item C<isl_ast_op_access>
8426 An array access.
8427 The number of arguments of the C<isl_ast_expr> is one more than
8428 the number of index expressions in the array access, the first argument
8429 representing the array being accessed.
8431 =item C<isl_ast_op_member>
8433 A member access.
8434 This operation has two arguments, a structure and the name of
8435 the member of the structure being accessed.
8437 =back
8439         #include <isl/ast.h>
8440         __isl_give isl_id *isl_ast_expr_get_id(
8441                 __isl_keep isl_ast_expr *expr);
8443 Return the identifier represented by the AST expression.
8445         #include <isl/ast.h>
8446         __isl_give isl_val *isl_ast_expr_get_val(
8447                 __isl_keep isl_ast_expr *expr);
8449 Return the integer represented by the AST expression.
8451 =head3 Properties of ASTs
8453         #include <isl/ast.h>
8454         int isl_ast_expr_is_equal(__isl_keep isl_ast_expr *expr1,
8455                 __isl_keep isl_ast_expr *expr2);
8457 Check if two C<isl_ast_expr>s are equal to each other.
8459 =head3 Manipulating and printing the AST
8461 AST nodes can be copied and freed using the following functions.
8463         #include <isl/ast.h>
8464         __isl_give isl_ast_node *isl_ast_node_copy(
8465                 __isl_keep isl_ast_node *node);
8466         __isl_null isl_ast_node *isl_ast_node_free(
8467                 __isl_take isl_ast_node *node);
8469 AST expressions can be copied and freed using the following functions.
8471         #include <isl/ast.h>
8472         __isl_give isl_ast_expr *isl_ast_expr_copy(
8473                 __isl_keep isl_ast_expr *expr);
8474         __isl_null isl_ast_expr *isl_ast_expr_free(
8475                 __isl_take isl_ast_expr *expr);
8477 New AST expressions can be created either directly or within
8478 the context of an C<isl_ast_build>.
8480         #include <isl/ast.h>
8481         __isl_give isl_ast_expr *isl_ast_expr_from_val(
8482                 __isl_take isl_val *v);
8483         __isl_give isl_ast_expr *isl_ast_expr_from_id(
8484                 __isl_take isl_id *id);
8485         __isl_give isl_ast_expr *isl_ast_expr_neg(
8486                 __isl_take isl_ast_expr *expr);
8487         __isl_give isl_ast_expr *isl_ast_expr_address_of(
8488                 __isl_take isl_ast_expr *expr);
8489         __isl_give isl_ast_expr *isl_ast_expr_add(
8490                 __isl_take isl_ast_expr *expr1,
8491                 __isl_take isl_ast_expr *expr2);
8492         __isl_give isl_ast_expr *isl_ast_expr_sub(
8493                 __isl_take isl_ast_expr *expr1,
8494                 __isl_take isl_ast_expr *expr2);
8495         __isl_give isl_ast_expr *isl_ast_expr_mul(
8496                 __isl_take isl_ast_expr *expr1,
8497                 __isl_take isl_ast_expr *expr2);
8498         __isl_give isl_ast_expr *isl_ast_expr_div(
8499                 __isl_take isl_ast_expr *expr1,
8500                 __isl_take isl_ast_expr *expr2);
8501         __isl_give isl_ast_expr *isl_ast_expr_and(
8502                 __isl_take isl_ast_expr *expr1,
8503                 __isl_take isl_ast_expr *expr2)
8504         __isl_give isl_ast_expr *isl_ast_expr_or(
8505                 __isl_take isl_ast_expr *expr1,
8506                 __isl_take isl_ast_expr *expr2)
8507         __isl_give isl_ast_expr *isl_ast_expr_eq(
8508                 __isl_take isl_ast_expr *expr1,
8509                 __isl_take isl_ast_expr *expr2);
8510         __isl_give isl_ast_expr *isl_ast_expr_le(
8511                 __isl_take isl_ast_expr *expr1,
8512                 __isl_take isl_ast_expr *expr2);
8513         __isl_give isl_ast_expr *isl_ast_expr_lt(
8514                 __isl_take isl_ast_expr *expr1,
8515                 __isl_take isl_ast_expr *expr2);
8516         __isl_give isl_ast_expr *isl_ast_expr_ge(
8517                 __isl_take isl_ast_expr *expr1,
8518                 __isl_take isl_ast_expr *expr2);
8519         __isl_give isl_ast_expr *isl_ast_expr_gt(
8520                 __isl_take isl_ast_expr *expr1,
8521                 __isl_take isl_ast_expr *expr2);
8522         __isl_give isl_ast_expr *isl_ast_expr_access(
8523                 __isl_take isl_ast_expr *array,
8524                 __isl_take isl_ast_expr_list *indices);
8526 The function C<isl_ast_expr_address_of> can be applied to an
8527 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
8528 to represent the address of the C<isl_ast_expr_access>.
8530         #include <isl/ast_build.h>
8531         __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
8532                 __isl_keep isl_ast_build *build,
8533                 __isl_take isl_pw_aff *pa);
8534         __isl_give isl_ast_expr *
8535         isl_ast_build_access_from_pw_multi_aff(
8536                 __isl_keep isl_ast_build *build,
8537                 __isl_take isl_pw_multi_aff *pma);
8538         __isl_give isl_ast_expr *
8539         isl_ast_build_access_from_multi_pw_aff(
8540                 __isl_keep isl_ast_build *build,
8541                 __isl_take isl_multi_pw_aff *mpa);
8542         __isl_give isl_ast_expr *
8543         isl_ast_build_call_from_pw_multi_aff(
8544                 __isl_keep isl_ast_build *build,
8545                 __isl_take isl_pw_multi_aff *pma);
8546         __isl_give isl_ast_expr *
8547         isl_ast_build_call_from_multi_pw_aff(
8548                 __isl_keep isl_ast_build *build,
8549                 __isl_take isl_multi_pw_aff *mpa);
8551 The domains of C<pa>, C<mpa> and C<pma> should correspond
8552 to the schedule space of C<build>.
8553 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
8554 the function being called.
8555 If the accessed space is a nested relation, then it is taken
8556 to represent an access of the member specified by the range
8557 of this nested relation of the structure specified by the domain
8558 of the nested relation.
8560 The following functions can be used to modify an C<isl_ast_expr>.
8562         #include <isl/ast.h>
8563         __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
8564                 __isl_take isl_ast_expr *expr, int pos,
8565                 __isl_take isl_ast_expr *arg);
8567 Replace the argument of C<expr> at position C<pos> by C<arg>.
8569         #include <isl/ast.h>
8570         __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
8571                 __isl_take isl_ast_expr *expr,
8572                 __isl_take isl_id_to_ast_expr *id2expr);
8574 The function C<isl_ast_expr_substitute_ids> replaces the
8575 subexpressions of C<expr> of type C<isl_ast_expr_id>
8576 by the corresponding expression in C<id2expr>, if there is any.
8579 User specified data can be attached to an C<isl_ast_node> and obtained
8580 from the same C<isl_ast_node> using the following functions.
8582         #include <isl/ast.h>
8583         __isl_give isl_ast_node *isl_ast_node_set_annotation(
8584                 __isl_take isl_ast_node *node,
8585                 __isl_take isl_id *annotation);
8586         __isl_give isl_id *isl_ast_node_get_annotation(
8587                 __isl_keep isl_ast_node *node);
8589 Basic printing can be performed using the following functions.
8591         #include <isl/ast.h>
8592         __isl_give isl_printer *isl_printer_print_ast_expr(
8593                 __isl_take isl_printer *p,
8594                 __isl_keep isl_ast_expr *expr);
8595         __isl_give isl_printer *isl_printer_print_ast_node(
8596                 __isl_take isl_printer *p,
8597                 __isl_keep isl_ast_node *node);
8598         __isl_give char *isl_ast_expr_to_str(
8599                 __isl_keep isl_ast_expr *expr);
8601 More advanced printing can be performed using the following functions.
8603         #include <isl/ast.h>
8604         __isl_give isl_printer *isl_ast_op_type_print_macro(
8605                 enum isl_ast_op_type type,
8606                 __isl_take isl_printer *p);
8607         __isl_give isl_printer *isl_ast_node_print_macros(
8608                 __isl_keep isl_ast_node *node,
8609                 __isl_take isl_printer *p);
8610         __isl_give isl_printer *isl_ast_node_print(
8611                 __isl_keep isl_ast_node *node,
8612                 __isl_take isl_printer *p,
8613                 __isl_take isl_ast_print_options *options);
8614         __isl_give isl_printer *isl_ast_node_for_print(
8615                 __isl_keep isl_ast_node *node,
8616                 __isl_take isl_printer *p,
8617                 __isl_take isl_ast_print_options *options);
8618         __isl_give isl_printer *isl_ast_node_if_print(
8619                 __isl_keep isl_ast_node *node,
8620                 __isl_take isl_printer *p,
8621                 __isl_take isl_ast_print_options *options);
8623 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
8624 C<isl> may print out an AST that makes use of macros such
8625 as C<floord>, C<min> and C<max>.
8626 C<isl_ast_op_type_print_macro> prints out the macro
8627 corresponding to a specific C<isl_ast_op_type>.
8628 C<isl_ast_node_print_macros> scans the C<isl_ast_node>
8629 for expressions where these macros would be used and prints
8630 out the required macro definitions.
8631 Essentially, C<isl_ast_node_print_macros> calls
8632 C<isl_ast_node_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
8633 as function argument.
8634 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
8635 C<isl_ast_node_if_print> print an C<isl_ast_node>
8636 in C<ISL_FORMAT_C>, but allow for some extra control
8637 through an C<isl_ast_print_options> object.
8638 This object can be created using the following functions.
8640         #include <isl/ast.h>
8641         __isl_give isl_ast_print_options *
8642         isl_ast_print_options_alloc(isl_ctx *ctx);
8643         __isl_give isl_ast_print_options *
8644         isl_ast_print_options_copy(
8645                 __isl_keep isl_ast_print_options *options);
8646         __isl_null isl_ast_print_options *
8647         isl_ast_print_options_free(
8648                 __isl_take isl_ast_print_options *options);
8650         __isl_give isl_ast_print_options *
8651         isl_ast_print_options_set_print_user(
8652                 __isl_take isl_ast_print_options *options,
8653                 __isl_give isl_printer *(*print_user)(
8654                         __isl_take isl_printer *p,
8655                         __isl_take isl_ast_print_options *options,
8656                         __isl_keep isl_ast_node *node, void *user),
8657                 void *user);
8658         __isl_give isl_ast_print_options *
8659         isl_ast_print_options_set_print_for(
8660                 __isl_take isl_ast_print_options *options,
8661                 __isl_give isl_printer *(*print_for)(
8662                         __isl_take isl_printer *p,
8663                         __isl_take isl_ast_print_options *options,
8664                         __isl_keep isl_ast_node *node, void *user),
8665                 void *user);
8667 The callback set by C<isl_ast_print_options_set_print_user>
8668 is called whenever a node of type C<isl_ast_node_user> needs to
8669 be printed.
8670 The callback set by C<isl_ast_print_options_set_print_for>
8671 is called whenever a node of type C<isl_ast_node_for> needs to
8672 be printed.
8673 Note that C<isl_ast_node_for_print> will I<not> call the
8674 callback set by C<isl_ast_print_options_set_print_for> on the node
8675 on which C<isl_ast_node_for_print> is called, but only on nested
8676 nodes of type C<isl_ast_node_for>.  It is therefore safe to
8677 call C<isl_ast_node_for_print> from within the callback set by
8678 C<isl_ast_print_options_set_print_for>.
8680 The following option determines the type to be used for iterators
8681 while printing the AST.
8683         int isl_options_set_ast_iterator_type(
8684                 isl_ctx *ctx, const char *val);
8685         const char *isl_options_get_ast_iterator_type(
8686                 isl_ctx *ctx);
8688 The AST printer only prints body nodes as blocks if these
8689 blocks cannot be safely omitted.
8690 For example, a C<for> node with one body node will not be
8691 surrounded with braces in C<ISL_FORMAT_C>.
8692 A block will always be printed by setting the following option.
8694         int isl_options_set_ast_always_print_block(isl_ctx *ctx,
8695                 int val);
8696         int isl_options_get_ast_always_print_block(isl_ctx *ctx);
8698 =head3 Options
8700         #include <isl/ast_build.h>
8701         int isl_options_set_ast_build_atomic_upper_bound(
8702                 isl_ctx *ctx, int val);
8703         int isl_options_get_ast_build_atomic_upper_bound(
8704                 isl_ctx *ctx);
8705         int isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
8706                 int val);
8707         int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
8708         int isl_options_set_ast_build_exploit_nested_bounds(
8709                 isl_ctx *ctx, int val);
8710         int isl_options_get_ast_build_exploit_nested_bounds(
8711                 isl_ctx *ctx);
8712         int isl_options_set_ast_build_group_coscheduled(
8713                 isl_ctx *ctx, int val);
8714         int isl_options_get_ast_build_group_coscheduled(
8715                 isl_ctx *ctx);
8716         int isl_options_set_ast_build_scale_strides(
8717                 isl_ctx *ctx, int val);
8718         int isl_options_get_ast_build_scale_strides(
8719                 isl_ctx *ctx);
8720         int isl_options_set_ast_build_allow_else(isl_ctx *ctx,
8721                 int val);
8722         int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
8723         int isl_options_set_ast_build_allow_or(isl_ctx *ctx,
8724                 int val);
8725         int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
8727 =over
8729 =item * ast_build_atomic_upper_bound
8731 Generate loop upper bounds that consist of the current loop iterator,
8732 an operator and an expression not involving the iterator.
8733 If this option is not set, then the current loop iterator may appear
8734 several times in the upper bound.
8735 For example, when this option is turned off, AST generation
8736 for the schedule
8738         [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
8740 produces
8742         for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
8743           A(c0);
8745 When the option is turned on, the following AST is generated
8747         for (int c0 = 0; c0 <= min(100, n); c0 += 1)
8748           A(c0);
8750 =item * ast_build_prefer_pdiv
8752 If this option is turned off, then the AST generation will
8753 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
8754 operators, but no C<isl_ast_op_pdiv_q> or
8755 C<isl_ast_op_pdiv_r> operators.
8756 If this options is turned on, then C<isl> will try to convert
8757 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
8758 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
8760 =item * ast_build_exploit_nested_bounds
8762 Simplify conditions based on bounds of nested for loops.
8763 In particular, remove conditions that are implied by the fact
8764 that one or more nested loops have at least one iteration,
8765 meaning that the upper bound is at least as large as the lower bound.
8766 For example, when this option is turned off, AST generation
8767 for the schedule
8769         [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
8770                                         0 <= j <= M }
8772 produces
8774         if (M >= 0)
8775           for (int c0 = 0; c0 <= N; c0 += 1)
8776             for (int c1 = 0; c1 <= M; c1 += 1)
8777               A(c0, c1);
8779 When the option is turned on, the following AST is generated
8781         for (int c0 = 0; c0 <= N; c0 += 1)
8782           for (int c1 = 0; c1 <= M; c1 += 1)
8783             A(c0, c1);
8785 =item * ast_build_group_coscheduled
8787 If two domain elements are assigned the same schedule point, then
8788 they may be executed in any order and they may even appear in different
8789 loops.  If this options is set, then the AST generator will make
8790 sure that coscheduled domain elements do not appear in separate parts
8791 of the AST.  This is useful in case of nested AST generation
8792 if the outer AST generation is given only part of a schedule
8793 and the inner AST generation should handle the domains that are
8794 coscheduled by this initial part of the schedule together.
8795 For example if an AST is generated for a schedule
8797         { A[i] -> [0]; B[i] -> [0] }
8799 then the C<isl_ast_build_set_create_leaf> callback described
8800 below may get called twice, once for each domain.
8801 Setting this option ensures that the callback is only called once
8802 on both domains together.
8804 =item * ast_build_separation_bounds
8806 This option specifies which bounds to use during separation.
8807 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
8808 then all (possibly implicit) bounds on the current dimension will
8809 be used during separation.
8810 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
8811 then only those bounds that are explicitly available will
8812 be used during separation.
8814 =item * ast_build_scale_strides
8816 This option specifies whether the AST generator is allowed
8817 to scale down iterators of strided loops.
8819 =item * ast_build_allow_else
8821 This option specifies whether the AST generator is allowed
8822 to construct if statements with else branches.
8824 =item * ast_build_allow_or
8826 This option specifies whether the AST generator is allowed
8827 to construct if conditions with disjunctions.
8829 =back
8831 =head3 Fine-grained Control over AST Generation
8833 Besides specifying the constraints on the parameters,
8834 an C<isl_ast_build> object can be used to control
8835 various aspects of the AST generation process.
8836 The most prominent way of control is through ``options'',
8837 which can be set using the following function.
8839         #include <isl/ast_build.h>
8840         __isl_give isl_ast_build *
8841         isl_ast_build_set_options(
8842                 __isl_take isl_ast_build *control,
8843                 __isl_take isl_union_map *options);
8845 The options are encoded in an C<isl_union_map>.
8846 The domain of this union relation refers to the schedule domain,
8847 i.e., the range of the schedule passed to C<isl_ast_build_ast_from_schedule>.
8848 In the case of nested AST generation (see L</"Nested AST Generation">),
8849 the domain of C<options> should refer to the extra piece of the schedule.
8850 That is, it should be equal to the range of the wrapped relation in the
8851 range of the schedule.
8852 The range of the options can consist of elements in one or more spaces,
8853 the names of which determine the effect of the option.
8854 The values of the range typically also refer to the schedule dimension
8855 to which the option applies.  In case of nested AST generation
8856 (see L</"Nested AST Generation">), these values refer to the position
8857 of the schedule dimension within the innermost AST generation.
8858 The constraints on the domain elements of
8859 the option should only refer to this dimension and earlier dimensions.
8860 We consider the following spaces.
8862 =over
8864 =item C<separation_class>
8866 This space is a wrapped relation between two one dimensional spaces.
8867 The input space represents the schedule dimension to which the option
8868 applies and the output space represents the separation class.
8869 While constructing a loop corresponding to the specified schedule
8870 dimension(s), the AST generator will try to generate separate loops
8871 for domain elements that are assigned different classes.
8872 If only some of the elements are assigned a class, then those elements
8873 that are not assigned any class will be treated as belonging to a class
8874 that is separate from the explicitly assigned classes.
8875 The typical use case for this option is to separate full tiles from
8876 partial tiles.
8877 The other options, described below, are applied after the separation
8878 into classes.
8880 As an example, consider the separation into full and partial tiles
8881 of a tiling of a triangular domain.
8882 Take, for example, the domain
8884         { A[i,j] : 0 <= i,j and i + j <= 100 }
8886 and a tiling into tiles of 10 by 10.  The input to the AST generator
8887 is then the schedule
8889         { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
8890                                                 i + j <= 100 }
8892 Without any options, the following AST is generated
8894         for (int c0 = 0; c0 <= 10; c0 += 1)
8895           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
8896             for (int c2 = 10 * c0;
8897                  c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
8898                  c2 += 1)
8899               for (int c3 = 10 * c1;
8900                    c3 <= min(10 * c1 + 9, -c2 + 100);
8901                    c3 += 1)
8902                 A(c2, c3);
8904 Separation into full and partial tiles can be obtained by assigning
8905 a class, say C<0>, to the full tiles.  The full tiles are represented by those
8906 values of the first and second schedule dimensions for which there are
8907 values of the third and fourth dimensions to cover an entire tile.
8908 That is, we need to specify the following option
8910         { [a,b,c,d] -> separation_class[[0]->[0]] :
8911                 exists b': 0 <= 10a,10b' and
8912                            10a+9+10b'+9 <= 100;
8913           [a,b,c,d] -> separation_class[[1]->[0]] :
8914                 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
8916 which simplifies to
8918         { [a, b, c, d] -> separation_class[[1] -> [0]] :
8919                 a >= 0 and b >= 0 and b <= 8 - a;
8920           [a, b, c, d] -> separation_class[[0] -> [0]] :
8921                 a >= 0 and a <= 8 }
8923 With this option, the generated AST is as follows
8925         {
8926           for (int c0 = 0; c0 <= 8; c0 += 1) {
8927             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
8928               for (int c2 = 10 * c0;
8929                    c2 <= 10 * c0 + 9; c2 += 1)
8930                 for (int c3 = 10 * c1;
8931                      c3 <= 10 * c1 + 9; c3 += 1)
8932                   A(c2, c3);
8933             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
8934               for (int c2 = 10 * c0;
8935                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
8936                    c2 += 1)
8937                 for (int c3 = 10 * c1;
8938                      c3 <= min(-c2 + 100, 10 * c1 + 9);
8939                      c3 += 1)
8940                   A(c2, c3);
8941           }
8942           for (int c0 = 9; c0 <= 10; c0 += 1)
8943             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
8944               for (int c2 = 10 * c0;
8945                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
8946                    c2 += 1)
8947                 for (int c3 = 10 * c1;
8948                      c3 <= min(10 * c1 + 9, -c2 + 100);
8949                      c3 += 1)
8950                   A(c2, c3);
8951         }
8953 =item C<separate>
8955 This is a single-dimensional space representing the schedule dimension(s)
8956 to which ``separation'' should be applied.  Separation tries to split
8957 a loop into several pieces if this can avoid the generation of guards
8958 inside the loop.
8959 See also the C<atomic> option.
8961 =item C<atomic>
8963 This is a single-dimensional space representing the schedule dimension(s)
8964 for which the domains should be considered ``atomic''.  That is, the
8965 AST generator will make sure that any given domain space will only appear
8966 in a single loop at the specified level.
8968 Consider the following schedule
8970         { a[i] -> [i] : 0 <= i < 10;
8971           b[i] -> [i+1] : 0 <= i < 10 }
8973 If the following option is specified
8975         { [i] -> separate[x] }
8977 then the following AST will be generated
8979         {
8980           a(0);
8981           for (int c0 = 1; c0 <= 9; c0 += 1) {
8982             a(c0);
8983             b(c0 - 1);
8984           }
8985           b(9);
8986         }
8988 If, on the other hand, the following option is specified
8990         { [i] -> atomic[x] }
8992 then the following AST will be generated
8994         for (int c0 = 0; c0 <= 10; c0 += 1) {
8995           if (c0 <= 9)
8996             a(c0);
8997           if (c0 >= 1)
8998             b(c0 - 1);
8999         }
9001 If neither C<atomic> nor C<separate> is specified, then the AST generator
9002 may produce either of these two results or some intermediate form.
9004 =item C<unroll>
9006 This is a single-dimensional space representing the schedule dimension(s)
9007 that should be I<completely> unrolled.
9008 To obtain a partial unrolling, the user should apply an additional
9009 strip-mining to the schedule and fully unroll the inner loop.
9011 =back
9013 Additional control is available through the following functions.
9015         #include <isl/ast_build.h>
9016         __isl_give isl_ast_build *
9017         isl_ast_build_set_iterators(
9018                 __isl_take isl_ast_build *control,
9019                 __isl_take isl_id_list *iterators);
9021 The function C<isl_ast_build_set_iterators> allows the user to
9022 specify a list of iterator C<isl_id>s to be used as iterators.
9023 If the input schedule is injective, then
9024 the number of elements in this list should be as large as the dimension
9025 of the schedule space, but no direct correspondence should be assumed
9026 between dimensions and elements.
9027 If the input schedule is not injective, then an additional number
9028 of C<isl_id>s equal to the largest dimension of the input domains
9029 may be required.
9030 If the number of provided C<isl_id>s is insufficient, then additional
9031 names are automatically generated.
9033         #include <isl/ast_build.h>
9034         __isl_give isl_ast_build *
9035         isl_ast_build_set_create_leaf(
9036                 __isl_take isl_ast_build *control,
9037                 __isl_give isl_ast_node *(*fn)(
9038                         __isl_take isl_ast_build *build,
9039                         void *user), void *user);
9042 C<isl_ast_build_set_create_leaf> function allows for the
9043 specification of a callback that should be called whenever the AST
9044 generator arrives at an element of the schedule domain.
9045 The callback should return an AST node that should be inserted
9046 at the corresponding position of the AST.  The default action (when
9047 the callback is not set) is to continue generating parts of the AST to scan
9048 all the domain elements associated to the schedule domain element
9049 and to insert user nodes, ``calling'' the domain element, for each of them.
9050 The C<build> argument contains the current state of the C<isl_ast_build>.
9051 To ease nested AST generation (see L</"Nested AST Generation">),
9052 all control information that is
9053 specific to the current AST generation such as the options and
9054 the callbacks has been removed from this C<isl_ast_build>.
9055 The callback would typically return the result of a nested
9056 AST generation or a
9057 user defined node created using the following function.
9059         #include <isl/ast.h>
9060         __isl_give isl_ast_node *isl_ast_node_alloc_user(
9061                 __isl_take isl_ast_expr *expr);
9063         #include <isl/ast_build.h>
9064         __isl_give isl_ast_build *
9065         isl_ast_build_set_at_each_domain(
9066                 __isl_take isl_ast_build *build,
9067                 __isl_give isl_ast_node *(*fn)(
9068                         __isl_take isl_ast_node *node,
9069                         __isl_keep isl_ast_build *build,
9070                         void *user), void *user);
9071         __isl_give isl_ast_build *
9072         isl_ast_build_set_before_each_for(
9073                 __isl_take isl_ast_build *build,
9074                 __isl_give isl_id *(*fn)(
9075                         __isl_keep isl_ast_build *build,
9076                         void *user), void *user);
9077         __isl_give isl_ast_build *
9078         isl_ast_build_set_after_each_for(
9079                 __isl_take isl_ast_build *build,
9080                 __isl_give isl_ast_node *(*fn)(
9081                         __isl_take isl_ast_node *node,
9082                         __isl_keep isl_ast_build *build,
9083                         void *user), void *user);
9085 The callback set by C<isl_ast_build_set_at_each_domain> will
9086 be called for each domain AST node.
9087 The callbacks set by C<isl_ast_build_set_before_each_for>
9088 and C<isl_ast_build_set_after_each_for> will be called
9089 for each for AST node.  The first will be called in depth-first
9090 pre-order, while the second will be called in depth-first post-order.
9091 Since C<isl_ast_build_set_before_each_for> is called before the for
9092 node is actually constructed, it is only passed an C<isl_ast_build>.
9093 The returned C<isl_id> will be added as an annotation (using
9094 C<isl_ast_node_set_annotation>) to the constructed for node.
9095 In particular, if the user has also specified an C<after_each_for>
9096 callback, then the annotation can be retrieved from the node passed to
9097 that callback using C<isl_ast_node_get_annotation>.
9098 All callbacks should C<NULL> on failure.
9099 The given C<isl_ast_build> can be used to create new
9100 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
9101 or C<isl_ast_build_call_from_pw_multi_aff>.
9103 =head3 Nested AST Generation
9105 C<isl> allows the user to create an AST within the context
9106 of another AST.  These nested ASTs are created using the
9107 same C<isl_ast_build_ast_from_schedule> function that is used to create the
9108 outer AST.  The C<build> argument should be an C<isl_ast_build>
9109 passed to a callback set by
9110 C<isl_ast_build_set_create_leaf>.
9111 The space of the range of the C<schedule> argument should refer
9112 to this build.  In particular, the space should be a wrapped
9113 relation and the domain of this wrapped relation should be the
9114 same as that of the range of the schedule returned by
9115 C<isl_ast_build_get_schedule> below.
9116 In practice, the new schedule is typically
9117 created by calling C<isl_union_map_range_product> on the old schedule
9118 and some extra piece of the schedule.
9119 The space of the schedule domain is also available from
9120 the C<isl_ast_build>.
9122         #include <isl/ast_build.h>
9123         __isl_give isl_union_map *isl_ast_build_get_schedule(
9124                 __isl_keep isl_ast_build *build);
9125         __isl_give isl_space *isl_ast_build_get_schedule_space(
9126                 __isl_keep isl_ast_build *build);
9127         __isl_give isl_ast_build *isl_ast_build_restrict(
9128                 __isl_take isl_ast_build *build,
9129                 __isl_take isl_set *set);
9131 The C<isl_ast_build_get_schedule> function returns a (partial)
9132 schedule for the domains elements for which part of the AST still needs to
9133 be generated in the current build.
9134 In particular, the domain elements are mapped to those iterations of the loops
9135 enclosing the current point of the AST generation inside which
9136 the domain elements are executed.
9137 No direct correspondence between
9138 the input schedule and this schedule should be assumed.
9139 The space obtained from C<isl_ast_build_get_schedule_space> can be used
9140 to create a set for C<isl_ast_build_restrict> to intersect
9141 with the current build.  In particular, the set passed to
9142 C<isl_ast_build_restrict> can have additional parameters.
9143 The ids of the set dimensions in the space returned by
9144 C<isl_ast_build_get_schedule_space> correspond to the
9145 iterators of the already generated loops.
9146 The user should not rely on the ids of the output dimensions
9147 of the relations in the union relation returned by
9148 C<isl_ast_build_get_schedule> having any particular value.
9150 =head1 Applications
9152 Although C<isl> is mainly meant to be used as a library,
9153 it also contains some basic applications that use some
9154 of the functionality of C<isl>.
9155 The input may be specified in either the L<isl format>
9156 or the L<PolyLib format>.
9158 =head2 C<isl_polyhedron_sample>
9160 C<isl_polyhedron_sample> takes a polyhedron as input and prints
9161 an integer element of the polyhedron, if there is any.
9162 The first column in the output is the denominator and is always
9163 equal to 1.  If the polyhedron contains no integer points,
9164 then a vector of length zero is printed.
9166 =head2 C<isl_pip>
9168 C<isl_pip> takes the same input as the C<example> program
9169 from the C<piplib> distribution, i.e., a set of constraints
9170 on the parameters, a line containing only -1 and finally a set
9171 of constraints on a parametric polyhedron.
9172 The coefficients of the parameters appear in the last columns
9173 (but before the final constant column).
9174 The output is the lexicographic minimum of the parametric polyhedron.
9175 As C<isl> currently does not have its own output format, the output
9176 is just a dump of the internal state.
9178 =head2 C<isl_polyhedron_minimize>
9180 C<isl_polyhedron_minimize> computes the minimum of some linear
9181 or affine objective function over the integer points in a polyhedron.
9182 If an affine objective function
9183 is given, then the constant should appear in the last column.
9185 =head2 C<isl_polytope_scan>
9187 Given a polytope, C<isl_polytope_scan> prints
9188 all integer points in the polytope.
9190 =head2 C<isl_codegen>
9192 Given a schedule, a context set and an options relation,
9193 C<isl_codegen> prints out an AST that scans the domain elements
9194 of the schedule in the order of their image(s) taking into account
9195 the constraints in the context set.