doc: document isl_schedule_get_ctx
[isl.git] / doc / user.pod
blob3ea22d49557aad2ec51796c1ed918adff74f9aeb
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/band.h>
532         isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band);
534         #include <isl/ast_build.h>
535         isl_ctx *isl_ast_build_get_ctx(
536                 __isl_keep isl_ast_build *build);
538         #include <isl/ast.h>
539         isl_ctx *isl_ast_expr_get_ctx(
540                 __isl_keep isl_ast_expr *expr);
541         isl_ctx *isl_ast_node_get_ctx(
542                 __isl_keep isl_ast_node *node);
544 =head2 Values
546 An C<isl_val> represents an integer value, a rational value
547 or one of three special values, infinity, negative infinity and NaN.
548 Some predefined values can be created using the following functions.
550         #include <isl/val.h>
551         __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
552         __isl_give isl_val *isl_val_one(isl_ctx *ctx);
553         __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
554         __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
555         __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
556         __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
558 Specific integer values can be created using the following functions.
560         #include <isl/val.h>
561         __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
562                 long i);
563         __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
564                 unsigned long u);
565         __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
566                 size_t n, size_t size, const void *chunks);
568 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
569 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
570 The least significant digit is assumed to be stored first.
572 Value objects can be copied and freed using the following functions.
574         #include <isl/val.h>
575         __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
576         __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
578 They can be inspected using the following functions.
580         #include <isl/val.h>
581         long isl_val_get_num_si(__isl_keep isl_val *v);
582         long isl_val_get_den_si(__isl_keep isl_val *v);
583         double isl_val_get_d(__isl_keep isl_val *v);
584         size_t isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
585                 size_t size);
586         int isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
587                 size_t size, void *chunks);
589 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
590 of C<size> bytes needed to store the absolute value of the
591 numerator of C<v>.
592 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
593 which is assumed to have been preallocated by the caller.
594 The least significant digit is stored first.
595 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
596 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
597 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
599 An C<isl_val> can be modified using the following function.
601         #include <isl/val.h>
602         __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
603                 long i);
605 The following unary properties are defined on C<isl_val>s.
607         #include <isl/val.h>
608         int isl_val_sgn(__isl_keep isl_val *v);
609         int isl_val_is_zero(__isl_keep isl_val *v);
610         int isl_val_is_one(__isl_keep isl_val *v);
611         int isl_val_is_negone(__isl_keep isl_val *v);
612         int isl_val_is_nonneg(__isl_keep isl_val *v);
613         int isl_val_is_nonpos(__isl_keep isl_val *v);
614         int isl_val_is_pos(__isl_keep isl_val *v);
615         int isl_val_is_neg(__isl_keep isl_val *v);
616         int isl_val_is_int(__isl_keep isl_val *v);
617         int isl_val_is_rat(__isl_keep isl_val *v);
618         int isl_val_is_nan(__isl_keep isl_val *v);
619         int isl_val_is_infty(__isl_keep isl_val *v);
620         int isl_val_is_neginfty(__isl_keep isl_val *v);
622 Note that the sign of NaN is undefined.
624 The following binary properties are defined on pairs of C<isl_val>s.
626         #include <isl/val.h>
627         int isl_val_lt(__isl_keep isl_val *v1,
628                 __isl_keep isl_val *v2);
629         int isl_val_le(__isl_keep isl_val *v1,
630                 __isl_keep isl_val *v2);
631         int isl_val_gt(__isl_keep isl_val *v1,
632                 __isl_keep isl_val *v2);
633         int isl_val_ge(__isl_keep isl_val *v1,
634                 __isl_keep isl_val *v2);
635         int isl_val_eq(__isl_keep isl_val *v1,
636                 __isl_keep isl_val *v2);
637         int isl_val_ne(__isl_keep isl_val *v1,
638                 __isl_keep isl_val *v2);
639         int isl_val_abs_eq(__isl_keep isl_val *v1,
640                 __isl_keep isl_val *v2);
642 The function C<isl_val_abs_eq> checks whether its two arguments
643 are equal in absolute value.
645 For integer C<isl_val>s we additionally have the following binary property.
647         #include <isl/val.h>
648         int isl_val_is_divisible_by(__isl_keep isl_val *v1,
649                 __isl_keep isl_val *v2);
651 An C<isl_val> can also be compared to an integer using the following
652 function.  The result is undefined for NaN.
654         #include <isl/val.h>
655         int isl_val_cmp_si(__isl_keep isl_val *v, long i);
657 The following unary operations are available on C<isl_val>s.
659         #include <isl/val.h>
660         __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
661         __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
662         __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
663         __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
664         __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
665         __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
666         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
668 The following binary operations are available on C<isl_val>s.
670         #include <isl/val.h>
671         __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
672                 __isl_take isl_val *v2);
673         __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
674                 __isl_take isl_val *v2);
675         __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
676                 __isl_take isl_val *v2);
677         __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
678                 unsigned long v2);
679         __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
680                 __isl_take isl_val *v2);
681         __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
682                 unsigned long v2);
683         __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
684                 __isl_take isl_val *v2);
685         __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
686                 unsigned long v2);
687         __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
688                 __isl_take isl_val *v2);
690 On integer values, we additionally have the following operations.
692         #include <isl/val.h>
693         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
694         __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
695                 __isl_take isl_val *v2);
696         __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
697                 __isl_take isl_val *v2);
698         __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
699                 __isl_take isl_val *v2, __isl_give isl_val **x,
700                 __isl_give isl_val **y);
702 The function C<isl_val_gcdext> returns the greatest common divisor g
703 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
704 that C<*x> * C<v1> + C<*y> * C<v2> = g.
706 =head3 GMP specific functions
708 These functions are only available if C<isl> has been compiled with C<GMP>
709 support.
711 Specific integer and rational values can be created from C<GMP> values using
712 the following functions.
714         #include <isl/val_gmp.h>
715         __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
716                 mpz_t z);
717         __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
718                 const mpz_t n, const mpz_t d);
720 The numerator and denominator of a rational value can be extracted as
721 C<GMP> values using the following functions.
723         #include <isl/val_gmp.h>
724         int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
725         int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
727 =head2 Sets and Relations
729 C<isl> uses six types of objects for representing sets and relations,
730 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
731 C<isl_union_set> and C<isl_union_map>.
732 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
733 can be described as a conjunction of affine constraints, while
734 C<isl_set> and C<isl_map> represent unions of
735 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
736 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
737 to live in the same space.  C<isl_union_set>s and C<isl_union_map>s
738 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
739 where spaces are considered different if they have a different number
740 of dimensions and/or different names (see L<"Spaces">).
741 The difference between sets and relations (maps) is that sets have
742 one set of variables, while relations have two sets of variables,
743 input variables and output variables.
745 =head2 Error Handling
747 C<isl> supports different ways to react in case a runtime error is triggered.
748 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
749 with two maps that have incompatible spaces. There are three possible ways
750 to react on error: to warn, to continue or to abort.
752 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
753 the last error in the corresponding C<isl_ctx> and the function in which the
754 error was triggered returns C<NULL>. An error does not corrupt internal state,
755 such that isl can continue to be used. C<isl> also provides functions to
756 read the last error and to reset the memory that stores the last error. The
757 last error is only stored for information purposes. Its presence does not
758 change the behavior of C<isl>. Hence, resetting an error is not required to
759 continue to use isl, but only to observe new errors.
761         #include <isl/ctx.h>
762         enum isl_error isl_ctx_last_error(isl_ctx *ctx);
763         void isl_ctx_reset_error(isl_ctx *ctx);
765 Another option is to continue on error. This is similar to warn on error mode,
766 except that C<isl> does not print any warning. This allows a program to
767 implement its own error reporting.
769 The last option is to directly abort the execution of the program from within
770 the isl library. This makes it obviously impossible to recover from an error,
771 but it allows to directly spot the error location. By aborting on error,
772 debuggers break at the location the error occurred and can provide a stack
773 trace. Other tools that automatically provide stack traces on abort or that do
774 not want to continue execution after an error was triggered may also prefer to
775 abort on error.
777 The on error behavior of isl can be specified by calling
778 C<isl_options_set_on_error> or by setting the command line option
779 C<--isl-on-error>. Valid arguments for the function call are
780 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
781 choices for the command line option are C<warn>, C<continue> and C<abort>.
782 It is also possible to query the current error mode.
784         #include <isl/options.h>
785         int isl_options_set_on_error(isl_ctx *ctx, int val);
786         int isl_options_get_on_error(isl_ctx *ctx);
788 =head2 Identifiers
790 Identifiers are used to identify both individual dimensions
791 and tuples of dimensions.  They consist of an optional name and an optional
792 user pointer.  The name and the user pointer cannot both be C<NULL>, however.
793 Identifiers with the same name but different pointer values
794 are considered to be distinct.
795 Similarly, identifiers with different names but the same pointer value
796 are also considered to be distinct.
797 Equal identifiers are represented using the same object.
798 Pairs of identifiers can therefore be tested for equality using the
799 C<==> operator.
800 Identifiers can be constructed, copied, freed, inspected and printed
801 using the following functions.
803         #include <isl/id.h>
804         __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
805                 __isl_keep const char *name, void *user);
806         __isl_give isl_id *isl_id_set_free_user(
807                 __isl_take isl_id *id,
808                 __isl_give void (*free_user)(void *user));
809         __isl_give isl_id *isl_id_copy(isl_id *id);
810         __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
812         void *isl_id_get_user(__isl_keep isl_id *id);
813         __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
815         __isl_give isl_printer *isl_printer_print_id(
816                 __isl_take isl_printer *p, __isl_keep isl_id *id);
818 The callback set by C<isl_id_set_free_user> is called on the user
819 pointer when the last reference to the C<isl_id> is freed.
820 Note that C<isl_id_get_name> returns a pointer to some internal
821 data structure, so the result can only be used while the
822 corresponding C<isl_id> is alive.
824 =head2 Spaces
826 Whenever a new set, relation or similar object is created from scratch,
827 the space in which it lives needs to be specified using an C<isl_space>.
828 Each space involves zero or more parameters and zero, one or two
829 tuples of set or input/output dimensions.  The parameters and dimensions
830 are identified by an C<isl_dim_type> and a position.
831 The type C<isl_dim_param> refers to parameters,
832 the type C<isl_dim_set> refers to set dimensions (for spaces
833 with a single tuple of dimensions) and the types C<isl_dim_in>
834 and C<isl_dim_out> refer to input and output dimensions
835 (for spaces with two tuples of dimensions).
836 Local spaces (see L</"Local Spaces">) also contain dimensions
837 of type C<isl_dim_div>.
838 Note that parameters are only identified by their position within
839 a given object.  Across different objects, parameters are (usually)
840 identified by their names or identifiers.  Only unnamed parameters
841 are identified by their positions across objects.  The use of unnamed
842 parameters is discouraged.
844         #include <isl/space.h>
845         __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
846                 unsigned nparam, unsigned n_in, unsigned n_out);
847         __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
848                 unsigned nparam);
849         __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
850                 unsigned nparam, unsigned dim);
851         __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
852         __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
854 The space used for creating a parameter domain
855 needs to be created using C<isl_space_params_alloc>.
856 For other sets, the space
857 needs to be created using C<isl_space_set_alloc>, while
858 for a relation, the space
859 needs to be created using C<isl_space_alloc>.
861 To check whether a given space is that of a set or a map
862 or whether it is a parameter space, use these functions:
864         #include <isl/space.h>
865         int isl_space_is_params(__isl_keep isl_space *space);
866         int isl_space_is_set(__isl_keep isl_space *space);
867         int isl_space_is_map(__isl_keep isl_space *space);
869 Spaces can be compared using the following functions:
871         #include <isl/space.h>
872         int isl_space_is_equal(__isl_keep isl_space *space1,
873                 __isl_keep isl_space *space2);
874         int isl_space_is_domain(__isl_keep isl_space *space1,
875                 __isl_keep isl_space *space2);
876         int isl_space_is_range(__isl_keep isl_space *space1,
877                 __isl_keep isl_space *space2);
878         int isl_space_tuple_is_equal(
879                 __isl_keep isl_space *space1,
880                 enum isl_dim_type type1,
881                 __isl_keep isl_space *space2,
882                 enum isl_dim_type type2);
884 C<isl_space_is_domain> checks whether the first argument is equal
885 to the domain of the second argument.  This requires in particular that
886 the first argument is a set space and that the second argument
887 is a map space.  C<isl_space_tuple_is_equal> checks whether the given
888 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
889 spaces are the same.  That is, it checks if they have the same
890 identifier (if any), the same dimension and the same internal structure
891 (if any).
893 It is often useful to create objects that live in the
894 same space as some other object.  This can be accomplished
895 by creating the new objects
896 (see L</"Creating New Sets and Relations"> or
897 L</"Functions">) based on the space
898 of the original object.
900         #include <isl/set.h>
901         __isl_give isl_space *isl_basic_set_get_space(
902                 __isl_keep isl_basic_set *bset);
903         __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
905         #include <isl/union_set.h>
906         __isl_give isl_space *isl_union_set_get_space(
907                 __isl_keep isl_union_set *uset);
909         #include <isl/map.h>
910         __isl_give isl_space *isl_basic_map_get_space(
911                 __isl_keep isl_basic_map *bmap);
912         __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
914         #include <isl/union_map.h>
915         __isl_give isl_space *isl_union_map_get_space(
916                 __isl_keep isl_union_map *umap);
918         #include <isl/constraint.h>
919         __isl_give isl_space *isl_constraint_get_space(
920                 __isl_keep isl_constraint *constraint);
922         #include <isl/polynomial.h>
923         __isl_give isl_space *isl_qpolynomial_get_domain_space(
924                 __isl_keep isl_qpolynomial *qp);
925         __isl_give isl_space *isl_qpolynomial_get_space(
926                 __isl_keep isl_qpolynomial *qp);
927         __isl_give isl_space *isl_qpolynomial_fold_get_space(
928                 __isl_keep isl_qpolynomial_fold *fold);
929         __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
930                 __isl_keep isl_pw_qpolynomial *pwqp);
931         __isl_give isl_space *isl_pw_qpolynomial_get_space(
932                 __isl_keep isl_pw_qpolynomial *pwqp);
933         __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
934                 __isl_keep isl_pw_qpolynomial_fold *pwf);
935         __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
936                 __isl_keep isl_pw_qpolynomial_fold *pwf);
937         __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
938                 __isl_keep isl_union_pw_qpolynomial *upwqp);
939         __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
940                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
942         #include <isl/val.h>
943         __isl_give isl_space *isl_multi_val_get_space(
944                 __isl_keep isl_multi_val *mv);
946         #include <isl/aff.h>
947         __isl_give isl_space *isl_aff_get_domain_space(
948                 __isl_keep isl_aff *aff);
949         __isl_give isl_space *isl_aff_get_space(
950                 __isl_keep isl_aff *aff);
951         __isl_give isl_space *isl_pw_aff_get_domain_space(
952                 __isl_keep isl_pw_aff *pwaff);
953         __isl_give isl_space *isl_pw_aff_get_space(
954                 __isl_keep isl_pw_aff *pwaff);
955         __isl_give isl_space *isl_multi_aff_get_domain_space(
956                 __isl_keep isl_multi_aff *maff);
957         __isl_give isl_space *isl_multi_aff_get_space(
958                 __isl_keep isl_multi_aff *maff);
959         __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
960                 __isl_keep isl_pw_multi_aff *pma);
961         __isl_give isl_space *isl_pw_multi_aff_get_space(
962                 __isl_keep isl_pw_multi_aff *pma);
963         __isl_give isl_space *isl_union_pw_aff_get_space(
964                 __isl_keep isl_union_pw_aff *upa);
965         __isl_give isl_space *isl_union_pw_multi_aff_get_space(
966                 __isl_keep isl_union_pw_multi_aff *upma);
967         __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
968                 __isl_keep isl_multi_pw_aff *mpa);
969         __isl_give isl_space *isl_multi_pw_aff_get_space(
970                 __isl_keep isl_multi_pw_aff *mpa);
971         __isl_give isl_space *
972         isl_multi_union_pw_aff_get_domain_space(
973                 __isl_keep isl_multi_union_pw_aff *mupa);
974         __isl_give isl_space *
975         isl_multi_union_pw_aff_get_space(
976                 __isl_keep isl_multi_union_pw_aff *mupa);
978         #include <isl/point.h>
979         __isl_give isl_space *isl_point_get_space(
980                 __isl_keep isl_point *pnt);
982 The number of dimensions of a given type of space
983 may be read off from a space or an object that lives
984 in a space using the following functions.
985 In case of C<isl_space_dim>, type may be
986 C<isl_dim_param>, C<isl_dim_in> (only for relations),
987 C<isl_dim_out> (only for relations), C<isl_dim_set>
988 (only for sets) or C<isl_dim_all>.
990         #include <isl/space.h>
991         unsigned isl_space_dim(__isl_keep isl_space *space,
992                 enum isl_dim_type type);
994         #include <isl/local_space.h>
995         int isl_local_space_dim(__isl_keep isl_local_space *ls,
996                 enum isl_dim_type type);
998         #include <isl/set.h>
999         unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1000                 enum isl_dim_type type);
1001         unsigned isl_set_dim(__isl_keep isl_set *set,
1002                 enum isl_dim_type type);
1004         #include <isl/union_set.h>
1005         unsigned isl_union_set_dim(__isl_keep isl_union_set *uset,
1006                 enum isl_dim_type type);
1008         #include <isl/map.h>
1009         unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1010                 enum isl_dim_type type);
1011         unsigned isl_map_dim(__isl_keep isl_map *map,
1012                 enum isl_dim_type type);
1014         #include <isl/union_map.h>
1015         unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
1016                 enum isl_dim_type type);
1018         #include <isl/val.h>
1019         unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1020                 enum isl_dim_type type);
1022         #include <isl/aff.h>
1023         int isl_aff_dim(__isl_keep isl_aff *aff,
1024                 enum isl_dim_type type);
1025         unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1026                 enum isl_dim_type type);
1027         unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1028                 enum isl_dim_type type);
1029         unsigned isl_pw_multi_aff_dim(
1030                 __isl_keep isl_pw_multi_aff *pma,
1031                 enum isl_dim_type type);
1032         unsigned isl_multi_pw_aff_dim(
1033                 __isl_keep isl_multi_pw_aff *mpa,
1034                 enum isl_dim_type type);
1035         unsigned isl_union_pw_aff_dim(
1036                 __isl_keep isl_union_pw_aff *upa,
1037                 enum isl_dim_type type);
1038         unsigned isl_union_pw_multi_aff_dim(
1039                 __isl_keep isl_union_pw_multi_aff *upma,
1040                 enum isl_dim_type type);
1041         unsigned isl_multi_union_pw_aff_dim(
1042                 __isl_keep isl_multi_union_pw_aff *mupa,
1043                 enum isl_dim_type type);
1045         #include <isl/polynomial.h>
1046         unsigned isl_union_pw_qpolynomial_dim(
1047                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1048                 enum isl_dim_type type);
1049         unsigned isl_union_pw_qpolynomial_fold_dim(
1050                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1051                 enum isl_dim_type type);
1053 Note that an C<isl_union_set>, an C<isl_union_map>,
1054 an C<isl_union_pw_multi_aff>,
1055 an C<isl_union_pw_qpolynomial> and
1056 an C<isl_union_pw_qpolynomial_fold>
1057 only have parameters.
1059 The identifiers or names of the individual dimensions of spaces
1060 may be set or read off using the following functions on spaces
1061 or objects that live in spaces.
1062 These functions are mostly useful to obtain the identifiers, positions
1063 or names of the parameters.  Identifiers of individual dimensions are
1064 essentially only useful for printing.  They are ignored by all other
1065 operations and may not be preserved across those operations.
1067         #include <isl/space.h>
1068         __isl_give isl_space *isl_space_set_dim_id(
1069                 __isl_take isl_space *space,
1070                 enum isl_dim_type type, unsigned pos,
1071                 __isl_take isl_id *id);
1072         int isl_space_has_dim_id(__isl_keep isl_space *space,
1073                 enum isl_dim_type type, unsigned pos);
1074         __isl_give isl_id *isl_space_get_dim_id(
1075                 __isl_keep isl_space *space,
1076                 enum isl_dim_type type, unsigned pos);
1077         __isl_give isl_space *isl_space_set_dim_name(
1078                 __isl_take isl_space *space,
1079                  enum isl_dim_type type, unsigned pos,
1080                  __isl_keep const char *name);
1081         int isl_space_has_dim_name(__isl_keep isl_space *space,
1082                 enum isl_dim_type type, unsigned pos);
1083         __isl_keep const char *isl_space_get_dim_name(
1084                 __isl_keep isl_space *space,
1085                 enum isl_dim_type type, unsigned pos);
1087         #include <isl/local_space.h>
1088         __isl_give isl_local_space *isl_local_space_set_dim_id(
1089                 __isl_take isl_local_space *ls,
1090                 enum isl_dim_type type, unsigned pos,
1091                 __isl_take isl_id *id);
1092         int isl_local_space_has_dim_id(
1093                 __isl_keep isl_local_space *ls,
1094                 enum isl_dim_type type, unsigned pos);
1095         __isl_give isl_id *isl_local_space_get_dim_id(
1096                 __isl_keep isl_local_space *ls,
1097                 enum isl_dim_type type, unsigned pos);
1098         __isl_give isl_local_space *isl_local_space_set_dim_name(
1099                 __isl_take isl_local_space *ls,
1100                 enum isl_dim_type type, unsigned pos, const char *s);
1101         int isl_local_space_has_dim_name(
1102                 __isl_keep isl_local_space *ls,
1103                 enum isl_dim_type type, unsigned pos)
1104         const char *isl_local_space_get_dim_name(
1105                 __isl_keep isl_local_space *ls,
1106                 enum isl_dim_type type, unsigned pos);
1108         #include <isl/constraint.h>
1109         const char *isl_constraint_get_dim_name(
1110                 __isl_keep isl_constraint *constraint,
1111                 enum isl_dim_type type, unsigned pos);
1113         #include <isl/set.h>
1114         __isl_give isl_id *isl_basic_set_get_dim_id(
1115                 __isl_keep isl_basic_set *bset,
1116                 enum isl_dim_type type, unsigned pos);
1117         __isl_give isl_set *isl_set_set_dim_id(
1118                 __isl_take isl_set *set, enum isl_dim_type type,
1119                 unsigned pos, __isl_take isl_id *id);
1120         int isl_set_has_dim_id(__isl_keep isl_set *set,
1121                 enum isl_dim_type type, unsigned pos);
1122         __isl_give isl_id *isl_set_get_dim_id(
1123                 __isl_keep isl_set *set, enum isl_dim_type type,
1124                 unsigned pos);
1125         const char *isl_basic_set_get_dim_name(
1126                 __isl_keep isl_basic_set *bset,
1127                 enum isl_dim_type type, unsigned pos);
1128         int isl_set_has_dim_name(__isl_keep isl_set *set,
1129                 enum isl_dim_type type, unsigned pos);
1130         const char *isl_set_get_dim_name(
1131                 __isl_keep isl_set *set,
1132                 enum isl_dim_type type, unsigned pos);
1134         #include <isl/map.h>
1135         __isl_give isl_map *isl_map_set_dim_id(
1136                 __isl_take isl_map *map, enum isl_dim_type type,
1137                 unsigned pos, __isl_take isl_id *id);
1138         int isl_basic_map_has_dim_id(
1139                 __isl_keep isl_basic_map *bmap,
1140                 enum isl_dim_type type, unsigned pos);
1141         int isl_map_has_dim_id(__isl_keep isl_map *map,
1142                 enum isl_dim_type type, unsigned pos);
1143         __isl_give isl_id *isl_map_get_dim_id(
1144                 __isl_keep isl_map *map, enum isl_dim_type type,
1145                 unsigned pos);
1146         __isl_give isl_id *isl_union_map_get_dim_id(
1147                 __isl_keep isl_union_map *umap,
1148                 enum isl_dim_type type, unsigned pos);
1149         const char *isl_basic_map_get_dim_name(
1150                 __isl_keep isl_basic_map *bmap,
1151                 enum isl_dim_type type, unsigned pos);
1152         int isl_map_has_dim_name(__isl_keep isl_map *map,
1153                 enum isl_dim_type type, unsigned pos);
1154         const char *isl_map_get_dim_name(
1155                 __isl_keep isl_map *map,
1156                 enum isl_dim_type type, unsigned pos);
1158         #include <isl/val.h>
1159         __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1160                 __isl_take isl_multi_val *mv,
1161                 enum isl_dim_type type, unsigned pos,
1162                 __isl_take isl_id *id);
1163         __isl_give isl_id *isl_multi_val_get_dim_id(
1164                 __isl_keep isl_multi_val *mv,
1165                 enum isl_dim_type type, unsigned pos);
1166         __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1167                 __isl_take isl_multi_val *mv,
1168                 enum isl_dim_type type, unsigned pos, const char *s);
1170         #include <isl/aff.h>
1171         __isl_give isl_aff *isl_aff_set_dim_id(
1172                 __isl_take isl_aff *aff, enum isl_dim_type type,
1173                 unsigned pos, __isl_take isl_id *id);
1174         __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1175                 __isl_take isl_multi_aff *maff,
1176                 enum isl_dim_type type, unsigned pos,
1177                 __isl_take isl_id *id);
1178         __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1179                 __isl_take isl_pw_aff *pma,
1180                 enum isl_dim_type type, unsigned pos,
1181                 __isl_take isl_id *id);
1182         __isl_give isl_multi_pw_aff *
1183         isl_multi_pw_aff_set_dim_id(
1184                 __isl_take isl_multi_pw_aff *mpa,
1185                 enum isl_dim_type type, unsigned pos,
1186                 __isl_take isl_id *id);
1187         __isl_give isl_multi_union_pw_aff *
1188         isl_multi_union_pw_aff_set_dim_id(
1189                 __isl_take isl_multi_union_pw_aff *mupa,
1190                 enum isl_dim_type type, unsigned pos,
1191                 __isl_take isl_id *id);
1192         __isl_give isl_id *isl_multi_aff_get_dim_id(
1193                 __isl_keep isl_multi_aff *ma,
1194                 enum isl_dim_type type, unsigned pos);
1195         int isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1196                 enum isl_dim_type type, unsigned pos);
1197         __isl_give isl_id *isl_pw_aff_get_dim_id(
1198                 __isl_keep isl_pw_aff *pa,
1199                 enum isl_dim_type type, unsigned pos);
1200         __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1201                 __isl_keep isl_pw_multi_aff *pma,
1202                 enum isl_dim_type type, unsigned pos);
1203         __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1204                 __isl_keep isl_multi_pw_aff *mpa,
1205                 enum isl_dim_type type, unsigned pos);
1206         __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1207                 __isl_keep isl_multi_union_pw_aff *mupa,
1208                 enum isl_dim_type type, unsigned pos);
1209         __isl_give isl_aff *isl_aff_set_dim_name(
1210                 __isl_take isl_aff *aff, enum isl_dim_type type,
1211                 unsigned pos, const char *s);
1212         __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1213                 __isl_take isl_multi_aff *maff,
1214                 enum isl_dim_type type, unsigned pos, const char *s);
1215         __isl_give isl_multi_pw_aff *
1216         isl_multi_pw_aff_set_dim_name(
1217                 __isl_take isl_multi_pw_aff *mpa,
1218                 enum isl_dim_type type, unsigned pos, const char *s);
1219         __isl_give isl_union_pw_aff *
1220         isl_union_pw_aff_set_dim_name(
1221                 __isl_take isl_union_pw_aff *upa,
1222                 enum isl_dim_type type, unsigned pos,
1223                 const char *s);
1224         __isl_give isl_union_pw_multi_aff *
1225         isl_union_pw_multi_aff_set_dim_name(
1226                 __isl_take isl_union_pw_multi_aff *upma,
1227                 enum isl_dim_type type, unsigned pos,
1228                 const char *s);
1229         __isl_give isl_multi_union_pw_aff *
1230         isl_multi_union_pw_aff_set_dim_name(
1231                 __isl_take isl_multi_union_pw_aff *mupa,
1232                 enum isl_dim_type type, unsigned pos,
1233         const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1234                 enum isl_dim_type type, unsigned pos);
1235         const char *isl_pw_aff_get_dim_name(
1236                 __isl_keep isl_pw_aff *pa,
1237                 enum isl_dim_type type, unsigned pos);
1238         const char *isl_pw_multi_aff_get_dim_name(
1239                 __isl_keep isl_pw_multi_aff *pma,
1240                 enum isl_dim_type type, unsigned pos);
1242         #include <isl/polynomial.h>
1243         __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1244                 __isl_take isl_qpolynomial *qp,
1245                 enum isl_dim_type type, unsigned pos,
1246                 const char *s);
1247         __isl_give isl_pw_qpolynomial *
1248         isl_pw_qpolynomial_set_dim_name(
1249                 __isl_take isl_pw_qpolynomial *pwqp,
1250                 enum isl_dim_type type, unsigned pos,
1251                 const char *s);
1252         __isl_give isl_pw_qpolynomial_fold *
1253         isl_pw_qpolynomial_fold_set_dim_name(
1254                 __isl_take isl_pw_qpolynomial_fold *pwf,
1255                 enum isl_dim_type type, unsigned pos,
1256                 const char *s);
1257         __isl_give isl_union_pw_qpolynomial *
1258         isl_union_pw_qpolynomial_set_dim_name(
1259                 __isl_take isl_union_pw_qpolynomial *upwqp,
1260                 enum isl_dim_type type, unsigned pos,
1261                 const char *s);
1262         __isl_give isl_union_pw_qpolynomial_fold *
1263         isl_union_pw_qpolynomial_fold_set_dim_name(
1264                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1265                 enum isl_dim_type type, unsigned pos,
1266                 const char *s);
1268 Note that C<isl_space_get_name> returns a pointer to some internal
1269 data structure, so the result can only be used while the
1270 corresponding C<isl_space> is alive.
1271 Also note that every function that operates on two sets or relations
1272 requires that both arguments have the same parameters.  This also
1273 means that if one of the arguments has named parameters, then the
1274 other needs to have named parameters too and the names need to match.
1275 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1276 arguments may have different parameters (as long as they are named),
1277 in which case the result will have as parameters the union of the parameters of
1278 the arguments.
1280 Given the identifier or name of a dimension (typically a parameter),
1281 its position can be obtained from the following functions.
1283         #include <isl/space.h>
1284         int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1285                 enum isl_dim_type type, __isl_keep isl_id *id);
1286         int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1287                 enum isl_dim_type type, const char *name);
1289         #include <isl/local_space.h>
1290         int isl_local_space_find_dim_by_name(
1291                 __isl_keep isl_local_space *ls,
1292                 enum isl_dim_type type, const char *name);
1294         #include <isl/val.h>
1295         int isl_multi_val_find_dim_by_id(
1296                 __isl_keep isl_multi_val *mv,
1297                 enum isl_dim_type type, __isl_keep isl_id *id);
1298         int isl_multi_val_find_dim_by_name(
1299                 __isl_keep isl_multi_val *mv,
1300                 enum isl_dim_type type, const char *name);
1302         #include <isl/set.h>
1303         int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1304                 enum isl_dim_type type, __isl_keep isl_id *id);
1305         int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1306                 enum isl_dim_type type, const char *name);
1308         #include <isl/map.h>
1309         int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1310                 enum isl_dim_type type, __isl_keep isl_id *id);
1311         int isl_basic_map_find_dim_by_name(
1312                 __isl_keep isl_basic_map *bmap,
1313                 enum isl_dim_type type, const char *name);
1314         int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1315                 enum isl_dim_type type, const char *name);
1316         int isl_union_map_find_dim_by_name(
1317                 __isl_keep isl_union_map *umap,
1318                 enum isl_dim_type type, const char *name);
1320         #include <isl/aff.h>
1321         int isl_multi_aff_find_dim_by_id(
1322                 __isl_keep isl_multi_aff *ma,
1323                 enum isl_dim_type type, __isl_keep isl_id *id);
1324         int isl_multi_pw_aff_find_dim_by_id(
1325                 __isl_keep isl_multi_pw_aff *mpa,
1326                 enum isl_dim_type type, __isl_keep isl_id *id);
1327         int isl_multi_union_pw_aff_find_dim_by_id(
1328                 __isl_keep isl_union_multi_pw_aff *mupa,
1329                 enum isl_dim_type type, __isl_keep isl_id *id);
1330         int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1331                 enum isl_dim_type type, const char *name);
1332         int isl_multi_aff_find_dim_by_name(
1333                 __isl_keep isl_multi_aff *ma,
1334                 enum isl_dim_type type, const char *name);
1335         int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1336                 enum isl_dim_type type, const char *name);
1337         int isl_multi_pw_aff_find_dim_by_name(
1338                 __isl_keep isl_multi_pw_aff *mpa,
1339                 enum isl_dim_type type, const char *name);
1340         int isl_pw_multi_aff_find_dim_by_name(
1341                 __isl_keep isl_pw_multi_aff *pma,
1342                 enum isl_dim_type type, const char *name);
1343         int isl_union_pw_aff_find_dim_by_name(
1344                 __isl_keep isl_union_pw_aff *upa,
1345                 enum isl_dim_type type, const char *name);
1346         int isl_union_pw_multi_aff_find_dim_by_name(
1347                 __isl_keep isl_union_pw_multi_aff *upma,
1348                 enum isl_dim_type type, const char *name);
1349         int isl_multi_union_pw_aff_find_dim_by_name(
1350                 __isl_keep isl_multi_union_pw_aff *mupa,
1351                 enum isl_dim_type type, const char *name);
1353         #include <isl/polynomial.h>
1354         int isl_pw_qpolynomial_find_dim_by_name(
1355                 __isl_keep isl_pw_qpolynomial *pwqp,
1356                 enum isl_dim_type type, const char *name);
1357         int isl_pw_qpolynomial_fold_find_dim_by_name(
1358                 __isl_keep isl_pw_qpolynomial_fold *pwf,
1359                 enum isl_dim_type type, const char *name);
1360         int isl_union_pw_qpolynomial_find_dim_by_name(
1361                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1362                 enum isl_dim_type type, const char *name);
1363         int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1364                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1365                 enum isl_dim_type type, const char *name);
1367 The identifiers or names of entire spaces may be set or read off
1368 using the following functions.
1370         #include <isl/space.h>
1371         __isl_give isl_space *isl_space_set_tuple_id(
1372                 __isl_take isl_space *space,
1373                 enum isl_dim_type type, __isl_take isl_id *id);
1374         __isl_give isl_space *isl_space_reset_tuple_id(
1375                 __isl_take isl_space *space, enum isl_dim_type type);
1376         int isl_space_has_tuple_id(__isl_keep isl_space *space,
1377                 enum isl_dim_type type);
1378         __isl_give isl_id *isl_space_get_tuple_id(
1379                 __isl_keep isl_space *space, enum isl_dim_type type);
1380         __isl_give isl_space *isl_space_set_tuple_name(
1381                 __isl_take isl_space *space,
1382                 enum isl_dim_type type, const char *s);
1383         int isl_space_has_tuple_name(__isl_keep isl_space *space,
1384                 enum isl_dim_type type);
1385         const char *isl_space_get_tuple_name(__isl_keep isl_space *space,
1386                 enum isl_dim_type type);
1388         #include <isl/local_space.h>
1389         __isl_give isl_local_space *isl_local_space_set_tuple_id(
1390                 __isl_take isl_local_space *ls,
1391                 enum isl_dim_type type, __isl_take isl_id *id);
1393         #include <isl/set.h>
1394         __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1395                 __isl_take isl_basic_set *bset,
1396                 __isl_take isl_id *id);
1397         __isl_give isl_set *isl_set_set_tuple_id(
1398                 __isl_take isl_set *set, __isl_take isl_id *id);
1399         __isl_give isl_set *isl_set_reset_tuple_id(
1400                 __isl_take isl_set *set);
1401         int isl_set_has_tuple_id(__isl_keep isl_set *set);
1402         __isl_give isl_id *isl_set_get_tuple_id(
1403                 __isl_keep isl_set *set);
1404         __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1405                 __isl_take isl_basic_set *set, const char *s);
1406         __isl_give isl_set *isl_set_set_tuple_name(
1407                 __isl_take isl_set *set, const char *s);
1408         const char *isl_basic_set_get_tuple_name(
1409                 __isl_keep isl_basic_set *bset);
1410         int isl_set_has_tuple_name(__isl_keep isl_set *set);
1411         const char *isl_set_get_tuple_name(
1412                 __isl_keep isl_set *set);
1414         #include <isl/map.h>
1415         __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1416                 __isl_take isl_basic_map *bmap,
1417                 enum isl_dim_type type, __isl_take isl_id *id);
1418         __isl_give isl_map *isl_map_set_tuple_id(
1419                 __isl_take isl_map *map, enum isl_dim_type type,
1420                 __isl_take isl_id *id);
1421         __isl_give isl_map *isl_map_reset_tuple_id(
1422                 __isl_take isl_map *map, enum isl_dim_type type);
1423         int isl_map_has_tuple_id(__isl_keep isl_map *map,
1424                 enum isl_dim_type type);
1425         __isl_give isl_id *isl_map_get_tuple_id(
1426                 __isl_keep isl_map *map, enum isl_dim_type type);
1427         __isl_give isl_map *isl_map_set_tuple_name(
1428                 __isl_take isl_map *map,
1429                 enum isl_dim_type type, const char *s);
1430         const char *isl_basic_map_get_tuple_name(
1431                 __isl_keep isl_basic_map *bmap,
1432                 enum isl_dim_type type);
1433         __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1434                 __isl_take isl_basic_map *bmap,
1435                 enum isl_dim_type type, const char *s);
1436         int isl_map_has_tuple_name(__isl_keep isl_map *map,
1437                 enum isl_dim_type type);
1438         const char *isl_map_get_tuple_name(
1439                 __isl_keep isl_map *map,
1440                 enum isl_dim_type type);
1442         #include <isl/val.h>
1443         __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1444                 __isl_take isl_multi_val *mv,
1445                 enum isl_dim_type type, __isl_take isl_id *id);
1446         __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1447                 __isl_take isl_multi_val *mv,
1448                 enum isl_dim_type type);
1449         int isl_multi_val_has_tuple_id(__isl_keep isl_multi_val *mv,
1450                 enum isl_dim_type type);
1451         __isl_give isl_id *isl_multi_val_get_tuple_id(
1452                 __isl_keep isl_multi_val *mv,
1453                 enum isl_dim_type type);
1454         __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1455                 __isl_take isl_multi_val *mv,
1456                 enum isl_dim_type type, const char *s);
1457         const char *isl_multi_val_get_tuple_name(
1458                 __isl_keep isl_multi_val *mv,
1459                 enum isl_dim_type type);
1461         #include <isl/aff.h>
1462         __isl_give isl_aff *isl_aff_set_tuple_id(
1463                 __isl_take isl_aff *aff,
1464                 enum isl_dim_type type, __isl_take isl_id *id);
1465         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1466                 __isl_take isl_multi_aff *maff,
1467                 enum isl_dim_type type, __isl_take isl_id *id);
1468         __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1469                 __isl_take isl_pw_aff *pwaff,
1470                 enum isl_dim_type type, __isl_take isl_id *id);
1471         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1472                 __isl_take isl_pw_multi_aff *pma,
1473                 enum isl_dim_type type, __isl_take isl_id *id);
1474         __isl_give isl_multi_union_pw_aff *
1475         isl_multi_union_pw_aff_set_tuple_id(
1476                 __isl_take isl_multi_union_pw_aff *mupa,
1477                 enum isl_dim_type type, __isl_take isl_id *id);
1478         __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1479                 __isl_take isl_multi_aff *ma,
1480                 enum isl_dim_type type);
1481         __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1482                 __isl_take isl_pw_aff *pa,
1483                 enum isl_dim_type type);
1484         __isl_give isl_multi_pw_aff *
1485         isl_multi_pw_aff_reset_tuple_id(
1486                 __isl_take isl_multi_pw_aff *mpa,
1487                 enum isl_dim_type type);
1488         __isl_give isl_pw_multi_aff *
1489         isl_pw_multi_aff_reset_tuple_id(
1490                 __isl_take isl_pw_multi_aff *pma,
1491                 enum isl_dim_type type);
1492         __isl_give isl_multi_union_pw_aff *
1493         isl_multi_union_pw_aff_reset_tuple_id(
1494                 __isl_take isl_multi_union_pw_aff *mupa,
1495                 enum isl_dim_type type);
1496         int isl_multi_aff_has_tuple_id(__isl_keep isl_multi_aff *ma,
1497                 enum isl_dim_type type);
1498         __isl_give isl_id *isl_multi_aff_get_tuple_id(
1499                 __isl_keep isl_multi_aff *ma,
1500                 enum isl_dim_type type);
1501         int isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1502                 enum isl_dim_type type);
1503         __isl_give isl_id *isl_pw_aff_get_tuple_id(
1504                 __isl_keep isl_pw_aff *pa,
1505                 enum isl_dim_type type);
1506         int isl_pw_multi_aff_has_tuple_id(
1507                 __isl_keep isl_pw_multi_aff *pma,
1508                 enum isl_dim_type type);
1509         __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1510                 __isl_keep isl_pw_multi_aff *pma,
1511                 enum isl_dim_type type);
1512         int isl_multi_pw_aff_has_tuple_id(
1513                 __isl_keep isl_multi_pw_aff *mpa,
1514                 enum isl_dim_type type);
1515         __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1516                 __isl_keep isl_multi_pw_aff *mpa,
1517                 enum isl_dim_type type);
1518         int isl_multi_union_pw_aff_has_tuple_id(
1519                 __isl_keep isl_multi_union_pw_aff *mupa,
1520                 enum isl_dim_type type);
1521         __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1522                 __isl_keep isl_multi_union_pw_aff *mupa,
1523                 enum isl_dim_type type);
1524         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1525                 __isl_take isl_multi_aff *maff,
1526                 enum isl_dim_type type, const char *s);
1527         __isl_give isl_multi_pw_aff *
1528         isl_multi_pw_aff_set_tuple_name(
1529                 __isl_take isl_multi_pw_aff *mpa,
1530                 enum isl_dim_type type, const char *s);
1531         __isl_give isl_multi_union_pw_aff *
1532         isl_multi_union_pw_aff_set_tuple_name(
1533                 __isl_take isl_multi_union_pw_aff *mupa,
1534                 enum isl_dim_type type, const char *s);
1535         const char *isl_multi_aff_get_tuple_name(
1536                 __isl_keep isl_multi_aff *multi,
1537                 enum isl_dim_type type);
1538         int isl_pw_multi_aff_has_tuple_name(
1539                 __isl_keep isl_pw_multi_aff *pma,
1540                 enum isl_dim_type type);
1541         const char *isl_pw_multi_aff_get_tuple_name(
1542                 __isl_keep isl_pw_multi_aff *pma,
1543                 enum isl_dim_type type);
1544         const char *isl_multi_union_pw_aff_get_tuple_name(
1545                 __isl_keep isl_multi_union_pw_aff *mupa,
1546                 enum isl_dim_type type);
1548 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1549 or C<isl_dim_set>.  As with C<isl_space_get_name>,
1550 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1551 data structure.
1552 Binary operations require the corresponding spaces of their arguments
1553 to have the same name.
1555 To keep the names of all parameters and tuples, but reset the user pointers
1556 of all the corresponding identifiers, use the following function.
1558         #include <isl/space.h>
1559         __isl_give isl_space *isl_space_reset_user(
1560                 __isl_take isl_space *space);
1562         #include <isl/set.h>
1563         __isl_give isl_set *isl_set_reset_user(
1564                 __isl_take isl_set *set);
1566         #include <isl/map.h>
1567         __isl_give isl_map *isl_map_reset_user(
1568                 __isl_take isl_map *map);
1570         #include <isl/union_set.h>
1571         __isl_give isl_union_set *isl_union_set_reset_user(
1572                 __isl_take isl_union_set *uset);
1574         #include <isl/union_map.h>
1575         __isl_give isl_union_map *isl_union_map_reset_user(
1576                 __isl_take isl_union_map *umap);
1578         #include <isl/val.h>
1579         __isl_give isl_multi_val *isl_multi_val_reset_user(
1580                 __isl_take isl_multi_val *mv);
1582         #include <isl/aff.h>
1583         __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1584                 __isl_take isl_multi_aff *ma);
1585         __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1586                 __isl_take isl_pw_aff *pa);
1587         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1588                 __isl_take isl_multi_pw_aff *mpa);
1589         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1590                 __isl_take isl_pw_multi_aff *pma);
1591         __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1592                 __isl_take isl_union_pw_aff *upa);
1593         __isl_give isl_multi_union_pw_aff *
1594         isl_multi_union_pw_aff_reset_user(
1595                 __isl_take isl_multi_union_pw_aff *mupa);
1596         __isl_give isl_union_pw_multi_aff *
1597         isl_union_pw_multi_aff_reset_user(
1598                 __isl_take isl_union_pw_multi_aff *upma);
1600         #include <isl/polynomial.h>
1601         __isl_give isl_pw_qpolynomial *
1602         isl_pw_qpolynomial_reset_user(
1603                 __isl_take isl_pw_qpolynomial *pwqp);
1604         __isl_give isl_union_pw_qpolynomial *
1605         isl_union_pw_qpolynomial_reset_user(
1606                 __isl_take isl_union_pw_qpolynomial *upwqp);
1607         __isl_give isl_pw_qpolynomial_fold *
1608         isl_pw_qpolynomial_fold_reset_user(
1609                 __isl_take isl_pw_qpolynomial_fold *pwf);
1610         __isl_give isl_union_pw_qpolynomial_fold *
1611         isl_union_pw_qpolynomial_fold_reset_user(
1612                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1614 Spaces can be nested.  In particular, the domain of a set or
1615 the domain or range of a relation can be a nested relation.
1616 This process is also called I<wrapping>.
1617 The functions for detecting, constructing and deconstructing
1618 such nested spaces can be found in the wrapping properties
1619 of L</"Unary Properties">, the wrapping operations
1620 of L</"Unary Operations"> and the Cartesian product operations
1621 of L</"Basic Operations">.
1623 Spaces can be created from other spaces
1624 using the functions described in L</"Unary Operations">
1625 and L</"Binary Operations">.
1627 =head2 Local Spaces
1629 A local space is essentially a space with
1630 zero or more existentially quantified variables.
1631 The local space of various objects can be obtained
1632 using the following functions.
1634         #include <isl/constraint.h>
1635         __isl_give isl_local_space *isl_constraint_get_local_space(
1636                 __isl_keep isl_constraint *constraint);
1638         #include <isl/set.h>
1639         __isl_give isl_local_space *isl_basic_set_get_local_space(
1640                 __isl_keep isl_basic_set *bset);
1642         #include <isl/map.h>
1643         __isl_give isl_local_space *isl_basic_map_get_local_space(
1644                 __isl_keep isl_basic_map *bmap);
1646         #include <isl/aff.h>
1647         __isl_give isl_local_space *isl_aff_get_domain_local_space(
1648                 __isl_keep isl_aff *aff);
1649         __isl_give isl_local_space *isl_aff_get_local_space(
1650                 __isl_keep isl_aff *aff);
1652 A new local space can be created from a space using
1654         #include <isl/local_space.h>
1655         __isl_give isl_local_space *isl_local_space_from_space(
1656                 __isl_take isl_space *space);
1658 They can be inspected, modified, copied and freed using the following functions.
1660         #include <isl/local_space.h>
1661         int isl_local_space_is_params(
1662                 __isl_keep isl_local_space *ls);
1663         int isl_local_space_is_set(__isl_keep isl_local_space *ls);
1664         __isl_give isl_space *isl_local_space_get_space(
1665                 __isl_keep isl_local_space *ls);
1666         __isl_give isl_aff *isl_local_space_get_div(
1667                 __isl_keep isl_local_space *ls, int pos);
1668         __isl_give isl_local_space *isl_local_space_copy(
1669                 __isl_keep isl_local_space *ls);
1670         __isl_null isl_local_space *isl_local_space_free(
1671                 __isl_take isl_local_space *ls);
1673 Note that C<isl_local_space_get_div> can only be used on local spaces
1674 of sets.
1676 Two local spaces can be compared using
1678         int isl_local_space_is_equal(__isl_keep isl_local_space *ls1,
1679                 __isl_keep isl_local_space *ls2);
1681 Local spaces can be created from other local spaces
1682 using the functions described in L</"Unary Operations">
1683 and L</"Binary Operations">.
1685 =head2 Creating New Sets and Relations
1687 C<isl> has functions for creating some standard sets and relations.
1689 =over
1691 =item * Empty sets and relations
1693         __isl_give isl_basic_set *isl_basic_set_empty(
1694                 __isl_take isl_space *space);
1695         __isl_give isl_basic_map *isl_basic_map_empty(
1696                 __isl_take isl_space *space);
1697         __isl_give isl_set *isl_set_empty(
1698                 __isl_take isl_space *space);
1699         __isl_give isl_map *isl_map_empty(
1700                 __isl_take isl_space *space);
1701         __isl_give isl_union_set *isl_union_set_empty(
1702                 __isl_take isl_space *space);
1703         __isl_give isl_union_map *isl_union_map_empty(
1704                 __isl_take isl_space *space);
1706 For C<isl_union_set>s and C<isl_union_map>s, the space
1707 is only used to specify the parameters.
1709 =item * Universe sets and relations
1711         __isl_give isl_basic_set *isl_basic_set_universe(
1712                 __isl_take isl_space *space);
1713         __isl_give isl_basic_map *isl_basic_map_universe(
1714                 __isl_take isl_space *space);
1715         __isl_give isl_set *isl_set_universe(
1716                 __isl_take isl_space *space);
1717         __isl_give isl_map *isl_map_universe(
1718                 __isl_take isl_space *space);
1719         __isl_give isl_union_set *isl_union_set_universe(
1720                 __isl_take isl_union_set *uset);
1721         __isl_give isl_union_map *isl_union_map_universe(
1722                 __isl_take isl_union_map *umap);
1724 The sets and relations constructed by the functions above
1725 contain all integer values, while those constructed by the
1726 functions below only contain non-negative values.
1728         __isl_give isl_basic_set *isl_basic_set_nat_universe(
1729                 __isl_take isl_space *space);
1730         __isl_give isl_basic_map *isl_basic_map_nat_universe(
1731                 __isl_take isl_space *space);
1732         __isl_give isl_set *isl_set_nat_universe(
1733                 __isl_take isl_space *space);
1734         __isl_give isl_map *isl_map_nat_universe(
1735                 __isl_take isl_space *space);
1737 =item * Identity relations
1739         __isl_give isl_basic_map *isl_basic_map_identity(
1740                 __isl_take isl_space *space);
1741         __isl_give isl_map *isl_map_identity(
1742                 __isl_take isl_space *space);
1744 The number of input and output dimensions in C<space> needs
1745 to be the same.
1747 =item * Lexicographic order
1749         __isl_give isl_map *isl_map_lex_lt(
1750                 __isl_take isl_space *set_space);
1751         __isl_give isl_map *isl_map_lex_le(
1752                 __isl_take isl_space *set_space);
1753         __isl_give isl_map *isl_map_lex_gt(
1754                 __isl_take isl_space *set_space);
1755         __isl_give isl_map *isl_map_lex_ge(
1756                 __isl_take isl_space *set_space);
1757         __isl_give isl_map *isl_map_lex_lt_first(
1758                 __isl_take isl_space *space, unsigned n);
1759         __isl_give isl_map *isl_map_lex_le_first(
1760                 __isl_take isl_space *space, unsigned n);
1761         __isl_give isl_map *isl_map_lex_gt_first(
1762                 __isl_take isl_space *space, unsigned n);
1763         __isl_give isl_map *isl_map_lex_ge_first(
1764                 __isl_take isl_space *space, unsigned n);
1766 The first four functions take a space for a B<set>
1767 and return relations that express that the elements in the domain
1768 are lexicographically less
1769 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1770 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1771 than the elements in the range.
1772 The last four functions take a space for a map
1773 and return relations that express that the first C<n> dimensions
1774 in the domain are lexicographically less
1775 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1776 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1777 than the first C<n> dimensions in the range.
1779 =back
1781 A basic set or relation can be converted to a set or relation
1782 using the following functions.
1784         __isl_give isl_set *isl_set_from_basic_set(
1785                 __isl_take isl_basic_set *bset);
1786         __isl_give isl_map *isl_map_from_basic_map(
1787                 __isl_take isl_basic_map *bmap);
1789 Sets and relations can be converted to union sets and relations
1790 using the following functions.
1792         __isl_give isl_union_set *isl_union_set_from_basic_set(
1793                 __isl_take isl_basic_set *bset);
1794         __isl_give isl_union_map *isl_union_map_from_basic_map(
1795                 __isl_take isl_basic_map *bmap);
1796         __isl_give isl_union_set *isl_union_set_from_set(
1797                 __isl_take isl_set *set);
1798         __isl_give isl_union_map *isl_union_map_from_map(
1799                 __isl_take isl_map *map);
1801 The inverse conversions below can only be used if the input
1802 union set or relation is known to contain elements in exactly one
1803 space.
1805         __isl_give isl_set *isl_set_from_union_set(
1806                 __isl_take isl_union_set *uset);
1807         __isl_give isl_map *isl_map_from_union_map(
1808                 __isl_take isl_union_map *umap);
1810 Sets and relations can be copied and freed again using the following
1811 functions.
1813         __isl_give isl_basic_set *isl_basic_set_copy(
1814                 __isl_keep isl_basic_set *bset);
1815         __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1816         __isl_give isl_union_set *isl_union_set_copy(
1817                 __isl_keep isl_union_set *uset);
1818         __isl_give isl_basic_map *isl_basic_map_copy(
1819                 __isl_keep isl_basic_map *bmap);
1820         __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1821         __isl_give isl_union_map *isl_union_map_copy(
1822                 __isl_keep isl_union_map *umap);
1823         __isl_null isl_basic_set *isl_basic_set_free(
1824                 __isl_take isl_basic_set *bset);
1825         __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1826         __isl_null isl_union_set *isl_union_set_free(
1827                 __isl_take isl_union_set *uset);
1828         __isl_null isl_basic_map *isl_basic_map_free(
1829                 __isl_take isl_basic_map *bmap);
1830         __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1831         __isl_null isl_union_map *isl_union_map_free(
1832                 __isl_take isl_union_map *umap);
1834 Other sets and relations can be constructed by starting
1835 from a universe set or relation, adding equality and/or
1836 inequality constraints and then projecting out the
1837 existentially quantified variables, if any.
1838 Constraints can be constructed, manipulated and
1839 added to (or removed from) (basic) sets and relations
1840 using the following functions.
1842         #include <isl/constraint.h>
1843         __isl_give isl_constraint *isl_equality_alloc(
1844                 __isl_take isl_local_space *ls);
1845         __isl_give isl_constraint *isl_inequality_alloc(
1846                 __isl_take isl_local_space *ls);
1847         __isl_give isl_constraint *isl_constraint_set_constant_si(
1848                 __isl_take isl_constraint *constraint, int v);
1849         __isl_give isl_constraint *isl_constraint_set_constant_val(
1850                 __isl_take isl_constraint *constraint,
1851                 __isl_take isl_val *v);
1852         __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1853                 __isl_take isl_constraint *constraint,
1854                 enum isl_dim_type type, int pos, int v);
1855         __isl_give isl_constraint *
1856         isl_constraint_set_coefficient_val(
1857                 __isl_take isl_constraint *constraint,
1858                 enum isl_dim_type type, int pos,
1859                 __isl_take isl_val *v);
1860         __isl_give isl_basic_map *isl_basic_map_add_constraint(
1861                 __isl_take isl_basic_map *bmap,
1862                 __isl_take isl_constraint *constraint);
1863         __isl_give isl_basic_set *isl_basic_set_add_constraint(
1864                 __isl_take isl_basic_set *bset,
1865                 __isl_take isl_constraint *constraint);
1866         __isl_give isl_map *isl_map_add_constraint(
1867                 __isl_take isl_map *map,
1868                 __isl_take isl_constraint *constraint);
1869         __isl_give isl_set *isl_set_add_constraint(
1870                 __isl_take isl_set *set,
1871                 __isl_take isl_constraint *constraint);
1872         __isl_give isl_basic_set *isl_basic_set_drop_constraint(
1873                 __isl_take isl_basic_set *bset,
1874                 __isl_take isl_constraint *constraint);
1876 For example, to create a set containing the even integers
1877 between 10 and 42, you would use the following code.
1879         isl_space *space;
1880         isl_local_space *ls;
1881         isl_constraint *c;
1882         isl_basic_set *bset;
1884         space = isl_space_set_alloc(ctx, 0, 2);
1885         bset = isl_basic_set_universe(isl_space_copy(space));
1886         ls = isl_local_space_from_space(space);
1888         c = isl_equality_alloc(isl_local_space_copy(ls));
1889         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1890         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
1891         bset = isl_basic_set_add_constraint(bset, c);
1893         c = isl_inequality_alloc(isl_local_space_copy(ls));
1894         c = isl_constraint_set_constant_si(c, -10);
1895         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
1896         bset = isl_basic_set_add_constraint(bset, c);
1898         c = isl_inequality_alloc(ls);
1899         c = isl_constraint_set_constant_si(c, 42);
1900         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1901         bset = isl_basic_set_add_constraint(bset, c);
1903         bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
1905 Or, alternatively,
1907         isl_basic_set *bset;
1908         bset = isl_basic_set_read_from_str(ctx,
1909                 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
1911 A basic set or relation can also be constructed from two matrices
1912 describing the equalities and the inequalities.
1914         __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
1915                 __isl_take isl_space *space,
1916                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1917                 enum isl_dim_type c1,
1918                 enum isl_dim_type c2, enum isl_dim_type c3,
1919                 enum isl_dim_type c4);
1920         __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
1921                 __isl_take isl_space *space,
1922                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1923                 enum isl_dim_type c1,
1924                 enum isl_dim_type c2, enum isl_dim_type c3,
1925                 enum isl_dim_type c4, enum isl_dim_type c5);
1927 The C<isl_dim_type> arguments indicate the order in which
1928 different kinds of variables appear in the input matrices
1929 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
1930 C<isl_dim_set> and C<isl_dim_div> for sets and
1931 of C<isl_dim_cst>, C<isl_dim_param>,
1932 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
1934 A (basic or union) set or relation can also be constructed from a
1935 (union) (piecewise) (multiple) affine expression
1936 or a list of affine expressions
1937 (See L</"Functions">).
1939         __isl_give isl_basic_map *isl_basic_map_from_aff(
1940                 __isl_take isl_aff *aff);
1941         __isl_give isl_map *isl_map_from_aff(
1942                 __isl_take isl_aff *aff);
1943         __isl_give isl_set *isl_set_from_pw_aff(
1944                 __isl_take isl_pw_aff *pwaff);
1945         __isl_give isl_map *isl_map_from_pw_aff(
1946                 __isl_take isl_pw_aff *pwaff);
1947         __isl_give isl_basic_map *isl_basic_map_from_aff_list(
1948                 __isl_take isl_space *domain_space,
1949                 __isl_take isl_aff_list *list);
1950         __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
1951                 __isl_take isl_multi_aff *maff)
1952         __isl_give isl_map *isl_map_from_multi_aff(
1953                 __isl_take isl_multi_aff *maff)
1954         __isl_give isl_set *isl_set_from_pw_multi_aff(
1955                 __isl_take isl_pw_multi_aff *pma);
1956         __isl_give isl_map *isl_map_from_pw_multi_aff(
1957                 __isl_take isl_pw_multi_aff *pma);
1958         __isl_give isl_set *isl_set_from_multi_pw_aff(
1959                 __isl_take isl_multi_pw_aff *mpa);
1960         __isl_give isl_map *isl_map_from_multi_pw_aff(
1961                 __isl_take isl_multi_pw_aff *mpa);
1962         __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
1963                 __isl_take isl_union_pw_aff *upa);
1964         __isl_give isl_union_map *
1965         isl_union_map_from_union_pw_multi_aff(
1966                 __isl_take isl_union_pw_multi_aff *upma);
1967         __isl_give isl_union_map *
1968         isl_union_map_from_multi_union_pw_aff(
1969                 __isl_take isl_multi_union_pw_aff *mupa);
1971 The C<domain_space> argument describes the domain of the resulting
1972 basic relation.  It is required because the C<list> may consist
1973 of zero affine expressions.
1974 The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
1975 is not allowed to be zero-dimensional.  The domain of the result
1976 is the shared domain of the union piecewise affine elements.
1978 =head2 Inspecting Sets and Relations
1980 Usually, the user should not have to care about the actual constraints
1981 of the sets and maps, but should instead apply the abstract operations
1982 explained in the following sections.
1983 Occasionally, however, it may be required to inspect the individual
1984 coefficients of the constraints.  This section explains how to do so.
1985 In these cases, it may also be useful to have C<isl> compute
1986 an explicit representation of the existentially quantified variables.
1988         __isl_give isl_set *isl_set_compute_divs(
1989                 __isl_take isl_set *set);
1990         __isl_give isl_map *isl_map_compute_divs(
1991                 __isl_take isl_map *map);
1992         __isl_give isl_union_set *isl_union_set_compute_divs(
1993                 __isl_take isl_union_set *uset);
1994         __isl_give isl_union_map *isl_union_map_compute_divs(
1995                 __isl_take isl_union_map *umap);
1997 This explicit representation defines the existentially quantified
1998 variables as integer divisions of the other variables, possibly
1999 including earlier existentially quantified variables.
2000 An explicitly represented existentially quantified variable therefore
2001 has a unique value when the values of the other variables are known.
2002 If, furthermore, the same existentials, i.e., existentials
2003 with the same explicit representations, should appear in the
2004 same order in each of the disjuncts of a set or map, then the user should call
2005 either of the following functions.
2007         __isl_give isl_set *isl_set_align_divs(
2008                 __isl_take isl_set *set);
2009         __isl_give isl_map *isl_map_align_divs(
2010                 __isl_take isl_map *map);
2012 Alternatively, the existentially quantified variables can be removed
2013 using the following functions, which compute an overapproximation.
2015         __isl_give isl_basic_set *isl_basic_set_remove_divs(
2016                 __isl_take isl_basic_set *bset);
2017         __isl_give isl_basic_map *isl_basic_map_remove_divs(
2018                 __isl_take isl_basic_map *bmap);
2019         __isl_give isl_set *isl_set_remove_divs(
2020                 __isl_take isl_set *set);
2021         __isl_give isl_map *isl_map_remove_divs(
2022                 __isl_take isl_map *map);
2024 It is also possible to only remove those divs that are defined
2025 in terms of a given range of dimensions or only those for which
2026 no explicit representation is known.
2028         __isl_give isl_basic_set *
2029         isl_basic_set_remove_divs_involving_dims(
2030                 __isl_take isl_basic_set *bset,
2031                 enum isl_dim_type type,
2032                 unsigned first, unsigned n);
2033         __isl_give isl_basic_map *
2034         isl_basic_map_remove_divs_involving_dims(
2035                 __isl_take isl_basic_map *bmap,
2036                 enum isl_dim_type type,
2037                 unsigned first, unsigned n);
2038         __isl_give isl_set *isl_set_remove_divs_involving_dims(
2039                 __isl_take isl_set *set, enum isl_dim_type type,
2040                 unsigned first, unsigned n);
2041         __isl_give isl_map *isl_map_remove_divs_involving_dims(
2042                 __isl_take isl_map *map, enum isl_dim_type type,
2043                 unsigned first, unsigned n);
2045         __isl_give isl_basic_set *
2046         isl_basic_set_remove_unknown_divs(
2047                 __isl_take isl_basic_set *bset);
2048         __isl_give isl_set *isl_set_remove_unknown_divs(
2049                 __isl_take isl_set *set);
2050         __isl_give isl_map *isl_map_remove_unknown_divs(
2051                 __isl_take isl_map *map);
2053 To iterate over all the sets or maps in a union set or map, use
2055         int isl_union_set_foreach_set(__isl_keep isl_union_set *uset,
2056                 int (*fn)(__isl_take isl_set *set, void *user),
2057                 void *user);
2058         int isl_union_map_foreach_map(__isl_keep isl_union_map *umap,
2059                 int (*fn)(__isl_take isl_map *map, void *user),
2060                 void *user);
2062 The number of sets or maps in a union set or map can be obtained
2063 from
2065         int isl_union_set_n_set(__isl_keep isl_union_set *uset);
2066         int isl_union_map_n_map(__isl_keep isl_union_map *umap);
2068 To extract the set or map in a given space from a union, use
2070         __isl_give isl_set *isl_union_set_extract_set(
2071                 __isl_keep isl_union_set *uset,
2072                 __isl_take isl_space *space);
2073         __isl_give isl_map *isl_union_map_extract_map(
2074                 __isl_keep isl_union_map *umap,
2075                 __isl_take isl_space *space);
2077 To iterate over all the basic sets or maps in a set or map, use
2079         int isl_set_foreach_basic_set(__isl_keep isl_set *set,
2080                 int (*fn)(__isl_take isl_basic_set *bset, void *user),
2081                 void *user);
2082         int isl_map_foreach_basic_map(__isl_keep isl_map *map,
2083                 int (*fn)(__isl_take isl_basic_map *bmap, void *user),
2084                 void *user);
2086 The callback function C<fn> should return 0 if successful and
2087 -1 if an error occurs.  In the latter case, or if any other error
2088 occurs, the above functions will return -1.
2090 It should be noted that C<isl> does not guarantee that
2091 the basic sets or maps passed to C<fn> are disjoint.
2092 If this is required, then the user should call one of
2093 the following functions first.
2095         __isl_give isl_set *isl_set_make_disjoint(
2096                 __isl_take isl_set *set);
2097         __isl_give isl_map *isl_map_make_disjoint(
2098                 __isl_take isl_map *map);
2100 The number of basic sets in a set can be obtained
2101 or the number of basic maps in a map can be obtained
2102 from
2104         #include <isl/set.h>
2105         int isl_set_n_basic_set(__isl_keep isl_set *set);
2107         #include <isl/map.h>
2108         int isl_map_n_basic_map(__isl_keep isl_map *map);
2110 To iterate over the constraints of a basic set or map, use
2112         #include <isl/constraint.h>
2114         int isl_basic_set_n_constraint(
2115                 __isl_keep isl_basic_set *bset);
2116         int isl_basic_set_foreach_constraint(
2117                 __isl_keep isl_basic_set *bset,
2118                 int (*fn)(__isl_take isl_constraint *c, void *user),
2119                 void *user);
2120         int isl_basic_map_n_constraint(
2121                 __isl_keep isl_basic_map *bmap);
2122         int isl_basic_map_foreach_constraint(
2123                 __isl_keep isl_basic_map *bmap,
2124                 int (*fn)(__isl_take isl_constraint *c, void *user),
2125                 void *user);
2126         __isl_null isl_constraint *isl_constraint_free(
2127                 __isl_take isl_constraint *c);
2129 Again, the callback function C<fn> should return 0 if successful and
2130 -1 if an error occurs.  In the latter case, or if any other error
2131 occurs, the above functions will return -1.
2132 The constraint C<c> represents either an equality or an inequality.
2133 Use the following function to find out whether a constraint
2134 represents an equality.  If not, it represents an inequality.
2136         int isl_constraint_is_equality(
2137                 __isl_keep isl_constraint *constraint);
2139 It is also possible to obtain a list of constraints from a basic
2140 map or set
2142         #include <isl/constraint.h>
2143         __isl_give isl_constraint_list *
2144         isl_basic_map_get_constraint_list(
2145                 __isl_keep isl_basic_map *bmap);
2146         __isl_give isl_constraint_list *
2147         isl_basic_set_get_constraint_list(
2148                 __isl_keep isl_basic_set *bset);
2150 These functions require that all existentially quantified variables
2151 have an explicit representation.
2152 The returned list can be manipulated using the functions in L<"Lists">.
2154 The coefficients of the constraints can be inspected using
2155 the following functions.
2157         int isl_constraint_is_lower_bound(
2158                 __isl_keep isl_constraint *constraint,
2159                 enum isl_dim_type type, unsigned pos);
2160         int isl_constraint_is_upper_bound(
2161                 __isl_keep isl_constraint *constraint,
2162                 enum isl_dim_type type, unsigned pos);
2163         __isl_give isl_val *isl_constraint_get_constant_val(
2164                 __isl_keep isl_constraint *constraint);
2165         __isl_give isl_val *isl_constraint_get_coefficient_val(
2166                 __isl_keep isl_constraint *constraint,
2167                 enum isl_dim_type type, int pos);
2169 The explicit representations of the existentially quantified
2170 variables can be inspected using the following function.
2171 Note that the user is only allowed to use this function
2172 if the inspected set or map is the result of a call
2173 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2174 The existentially quantified variable is equal to the floor
2175 of the returned affine expression.  The affine expression
2176 itself can be inspected using the functions in
2177 L</"Functions">.
2179         __isl_give isl_aff *isl_constraint_get_div(
2180                 __isl_keep isl_constraint *constraint, int pos);
2182 To obtain the constraints of a basic set or map in matrix
2183 form, use the following functions.
2185         __isl_give isl_mat *isl_basic_set_equalities_matrix(
2186                 __isl_keep isl_basic_set *bset,
2187                 enum isl_dim_type c1, enum isl_dim_type c2,
2188                 enum isl_dim_type c3, enum isl_dim_type c4);
2189         __isl_give isl_mat *isl_basic_set_inequalities_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_map_equalities_matrix(
2194                 __isl_keep isl_basic_map *bmap,
2195                 enum isl_dim_type c1,
2196                 enum isl_dim_type c2, enum isl_dim_type c3,
2197                 enum isl_dim_type c4, enum isl_dim_type c5);
2198         __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2199                 __isl_keep isl_basic_map *bmap,
2200                 enum isl_dim_type c1,
2201                 enum isl_dim_type c2, enum isl_dim_type c3,
2202                 enum isl_dim_type c4, enum isl_dim_type c5);
2204 The C<isl_dim_type> arguments dictate the order in which
2205 different kinds of variables appear in the resulting matrix.
2206 For set inputs, they should be a permutation of
2207 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2208 For map inputs, they should be a permutation of
2209 C<isl_dim_cst>, C<isl_dim_param>,
2210 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2212 =head2 Points
2214 Points are elements of a set.  They can be used to construct
2215 simple sets (boxes) or they can be used to represent the
2216 individual elements of a set.
2217 The zero point (the origin) can be created using
2219         __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2221 The coordinates of a point can be inspected, set and changed
2222 using
2224         __isl_give isl_val *isl_point_get_coordinate_val(
2225                 __isl_keep isl_point *pnt,
2226                 enum isl_dim_type type, int pos);
2227         __isl_give isl_point *isl_point_set_coordinate_val(
2228                 __isl_take isl_point *pnt,
2229                 enum isl_dim_type type, int pos,
2230                 __isl_take isl_val *v);
2232         __isl_give isl_point *isl_point_add_ui(
2233                 __isl_take isl_point *pnt,
2234                 enum isl_dim_type type, int pos, unsigned val);
2235         __isl_give isl_point *isl_point_sub_ui(
2236                 __isl_take isl_point *pnt,
2237                 enum isl_dim_type type, int pos, unsigned val);
2239 Points can be copied or freed using
2241         __isl_give isl_point *isl_point_copy(
2242                 __isl_keep isl_point *pnt);
2243         void isl_point_free(__isl_take isl_point *pnt);
2245 A singleton set can be created from a point using
2247         __isl_give isl_basic_set *isl_basic_set_from_point(
2248                 __isl_take isl_point *pnt);
2249         __isl_give isl_set *isl_set_from_point(
2250                 __isl_take isl_point *pnt);
2252 and a box can be created from two opposite extremal points using
2254         __isl_give isl_basic_set *isl_basic_set_box_from_points(
2255                 __isl_take isl_point *pnt1,
2256                 __isl_take isl_point *pnt2);
2257         __isl_give isl_set *isl_set_box_from_points(
2258                 __isl_take isl_point *pnt1,
2259                 __isl_take isl_point *pnt2);
2261 All elements of a B<bounded> (union) set can be enumerated using
2262 the following functions.
2264         int isl_set_foreach_point(__isl_keep isl_set *set,
2265                 int (*fn)(__isl_take isl_point *pnt, void *user),
2266                 void *user);
2267         int isl_union_set_foreach_point(__isl_keep isl_union_set *uset,
2268                 int (*fn)(__isl_take isl_point *pnt, void *user),
2269                 void *user);
2271 The function C<fn> is called for each integer point in
2272 C<set> with as second argument the last argument of
2273 the C<isl_set_foreach_point> call.  The function C<fn>
2274 should return C<0> on success and C<-1> on failure.
2275 In the latter case, C<isl_set_foreach_point> will stop
2276 enumerating and return C<-1> as well.
2277 If the enumeration is performed successfully and to completion,
2278 then C<isl_set_foreach_point> returns C<0>.
2280 To obtain a single point of a (basic) set, use
2282         __isl_give isl_point *isl_basic_set_sample_point(
2283                 __isl_take isl_basic_set *bset);
2284         __isl_give isl_point *isl_set_sample_point(
2285                 __isl_take isl_set *set);
2287 If C<set> does not contain any (integer) points, then the
2288 resulting point will be ``void'', a property that can be
2289 tested using
2291         int isl_point_is_void(__isl_keep isl_point *pnt);
2293 =head2 Functions
2295 Besides sets and relation, C<isl> also supports various types of functions.
2296 Each of these types is derived from the value type (see L</"Values">)
2297 or from one of two primitive function types
2298 through the application of zero or more type constructors.
2299 We first describe the primitive type and then we describe
2300 the types derived from these primitive types.
2302 =head3 Primitive Functions
2304 C<isl> support two primitive function types, quasi-affine
2305 expressions and quasipolynomials.
2306 A quasi-affine expression is defined either over a parameter
2307 space or over a set and is composed of integer constants,
2308 parameters and set variables, addition, subtraction and
2309 integer division by an integer constant.
2310 For example, the quasi-affine expression
2312         [n] -> { [x] -> [2*floor((4 n + x)/9] }
2314 maps C<x> to C<2*floor((4 n + x)/9>.
2315 A quasipolynomial is a polynomial expression in quasi-affine
2316 expression.  That is, it additionally allows for multiplication.
2317 Note, though, that it is not allowed to construct an integer
2318 division of an expression involving multiplications.
2319 Here is an example of a quasipolynomial that is not
2320 quasi-affine expression
2322         [n] -> { [x] -> (n*floor((4 n + x)/9) }
2324 Note that the external representations of quasi-affine expressions
2325 and quasipolynomials are different.  Quasi-affine expressions
2326 use a notation with square brackets just like binary relations,
2327 while quasipolynomials do not.  This might change at some point.
2329 If a primitive function is defined over a parameter space,
2330 then the space of the function itself is that of a set.
2331 If it is defined over a set, then the space of the function
2332 is that of a relation.  In both cases, the set space (or
2333 the output space) is single-dimensional, anonymous and unstructured.
2334 To create functions with multiple dimensions or with other kinds
2335 of set or output spaces, use multiple expressions
2336 (see L</"Multiple Expressions">).
2338 =over
2340 =item * Quasi-affine Expressions
2342 Besides the expressions described above, a quasi-affine
2343 expression can also be set to NaN.  Such expressions
2344 typically represent a failure to represent a result
2345 as a quasi-affine expression.
2347 The zero quasi affine expression or the quasi affine expression
2348 that is equal to a given value or
2349 a specified dimension on a given domain can be created using
2351         #include <isl/aff.h>
2352         __isl_give isl_aff *isl_aff_zero_on_domain(
2353                 __isl_take isl_local_space *ls);
2354         __isl_give isl_aff *isl_aff_val_on_domain(
2355                 __isl_take isl_local_space *ls,
2356                 __isl_take isl_val *val);
2357         __isl_give isl_aff *isl_aff_var_on_domain(
2358                 __isl_take isl_local_space *ls,
2359                 enum isl_dim_type type, unsigned pos);
2360         __isl_give isl_aff *isl_aff_nan_on_domain(
2361                 __isl_take isl_local_space *ls);
2363 Quasi affine expressions can be copied and freed using
2365         #include <isl/aff.h>
2366         __isl_give isl_aff *isl_aff_copy(
2367                 __isl_keep isl_aff *aff);
2368         __isl_null isl_aff *isl_aff_free(
2369                 __isl_take isl_aff *aff);
2371 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2372 using the following function.  The constraint is required to have
2373 a non-zero coefficient for the specified dimension.
2375         #include <isl/constraint.h>
2376         __isl_give isl_aff *isl_constraint_get_bound(
2377                 __isl_keep isl_constraint *constraint,
2378                 enum isl_dim_type type, int pos);
2380 The entire affine expression of the constraint can also be extracted
2381 using the following function.
2383         #include <isl/constraint.h>
2384         __isl_give isl_aff *isl_constraint_get_aff(
2385                 __isl_keep isl_constraint *constraint);
2387 Conversely, an equality constraint equating
2388 the affine expression to zero or an inequality constraint enforcing
2389 the affine expression to be non-negative, can be constructed using
2391         __isl_give isl_constraint *isl_equality_from_aff(
2392                 __isl_take isl_aff *aff);
2393         __isl_give isl_constraint *isl_inequality_from_aff(
2394                 __isl_take isl_aff *aff);
2396 The coefficients and the integer divisions of an affine expression
2397 can be inspected using the following functions.
2399         #include <isl/aff.h>
2400         __isl_give isl_val *isl_aff_get_constant_val(
2401                 __isl_keep isl_aff *aff);
2402         __isl_give isl_val *isl_aff_get_coefficient_val(
2403                 __isl_keep isl_aff *aff,
2404                 enum isl_dim_type type, int pos);
2405         int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2406                 enum isl_dim_type type, int pos);
2407         __isl_give isl_val *isl_aff_get_denominator_val(
2408                 __isl_keep isl_aff *aff);
2409         __isl_give isl_aff *isl_aff_get_div(
2410                 __isl_keep isl_aff *aff, int pos);
2412 They can be modified using the following functions.
2414         #include <isl/aff.h>
2415         __isl_give isl_aff *isl_aff_set_constant_si(
2416                 __isl_take isl_aff *aff, int v);
2417         __isl_give isl_aff *isl_aff_set_constant_val(
2418                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2419         __isl_give isl_aff *isl_aff_set_coefficient_si(
2420                 __isl_take isl_aff *aff,
2421                 enum isl_dim_type type, int pos, int v);
2422         __isl_give isl_aff *isl_aff_set_coefficient_val(
2423                 __isl_take isl_aff *aff,
2424                 enum isl_dim_type type, int pos,
2425                 __isl_take isl_val *v);
2427         __isl_give isl_aff *isl_aff_add_constant_si(
2428                 __isl_take isl_aff *aff, int v);
2429         __isl_give isl_aff *isl_aff_add_constant_val(
2430                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2431         __isl_give isl_aff *isl_aff_add_constant_num_si(
2432                 __isl_take isl_aff *aff, int v);
2433         __isl_give isl_aff *isl_aff_add_coefficient_si(
2434                 __isl_take isl_aff *aff,
2435                 enum isl_dim_type type, int pos, int v);
2436         __isl_give isl_aff *isl_aff_add_coefficient_val(
2437                 __isl_take isl_aff *aff,
2438                 enum isl_dim_type type, int pos,
2439                 __isl_take isl_val *v);
2441 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2442 set the I<numerator> of the constant or coefficient, while
2443 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2444 the constant or coefficient as a whole.
2445 The C<add_constant> and C<add_coefficient> functions add an integer
2446 or rational value to
2447 the possibly rational constant or coefficient.
2448 The C<add_constant_num> functions add an integer value to
2449 the numerator.
2451 =item * Quasipolynomials
2453 Some simple quasipolynomials can be created using the following functions.
2455         #include <isl/polynomial.h>
2456         __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2457                 __isl_take isl_space *domain);
2458         __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2459                 __isl_take isl_space *domain);
2460         __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2461                 __isl_take isl_space *domain);
2462         __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2463                 __isl_take isl_space *domain);
2464         __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2465                 __isl_take isl_space *domain);
2466         __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2467                 __isl_take isl_space *domain,
2468                 __isl_take isl_val *val);
2469         __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2470                 __isl_take isl_space *domain,
2471                 enum isl_dim_type type, unsigned pos);
2472         __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2473                 __isl_take isl_aff *aff);
2475 Recall that the space in which a quasipolynomial lives is a map space
2476 with a one-dimensional range.  The C<domain> argument in some of
2477 the functions above corresponds to the domain of this map space.
2479 Quasipolynomials can be copied and freed again using the following
2480 functions.
2482         #include <isl/polynomial.h>
2483         __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2484                 __isl_keep isl_qpolynomial *qp);
2485         __isl_null isl_qpolynomial *isl_qpolynomial_free(
2486                 __isl_take isl_qpolynomial *qp);
2488 The constant term of a quasipolynomial can be extracted using
2490         __isl_give isl_val *isl_qpolynomial_get_constant_val(
2491                 __isl_keep isl_qpolynomial *qp);
2493 To iterate over all terms in a quasipolynomial,
2496         int isl_qpolynomial_foreach_term(
2497                 __isl_keep isl_qpolynomial *qp,
2498                 int (*fn)(__isl_take isl_term *term,
2499                           void *user), void *user);
2501 The terms themselves can be inspected and freed using
2502 these functions
2504         unsigned isl_term_dim(__isl_keep isl_term *term,
2505                 enum isl_dim_type type);
2506         __isl_give isl_val *isl_term_get_coefficient_val(
2507                 __isl_keep isl_term *term);
2508         int isl_term_get_exp(__isl_keep isl_term *term,
2509                 enum isl_dim_type type, unsigned pos);
2510         __isl_give isl_aff *isl_term_get_div(
2511                 __isl_keep isl_term *term, unsigned pos);
2512         void isl_term_free(__isl_take isl_term *term);
2514 Each term is a product of parameters, set variables and
2515 integer divisions.  The function C<isl_term_get_exp>
2516 returns the exponent of a given dimensions in the given term.
2518 =back
2520 =head3 Reductions
2522 A reduction represents a maximum or a minimum of its
2523 base expressions.
2524 The only reduction type defined by C<isl> is
2525 C<isl_qpolynomial_fold>.
2527 There are currently no functions to directly create such
2528 objects, but they do appear in the piecewise quasipolynomial
2529 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2531 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2533 Reductions can be copied and freed using
2534 the following functions.
2536         #include <isl/polynomial.h>
2537         __isl_give isl_qpolynomial_fold *
2538         isl_qpolynomial_fold_copy(
2539                 __isl_keep isl_qpolynomial_fold *fold);
2540         void isl_qpolynomial_fold_free(
2541                 __isl_take isl_qpolynomial_fold *fold);
2543 To iterate over all quasipolynomials in a reduction, use
2545         int isl_qpolynomial_fold_foreach_qpolynomial(
2546                 __isl_keep isl_qpolynomial_fold *fold,
2547                 int (*fn)(__isl_take isl_qpolynomial *qp,
2548                           void *user), void *user);
2550 =head3 Multiple Expressions
2552 A multiple expression represents a sequence of zero or
2553 more base expressions, all defined on the same domain space.
2554 The domain space of the multiple expression is the same
2555 as that of the base expressions, but the range space
2556 can be any space.  In case the base expressions have
2557 a set space, the corresponding multiple expression
2558 also has a set space.
2559 Objects of the value type do not have an associated space.
2560 The space of a multiple value is therefore always a set space.
2561 Similarly, the space of a multiple union piecewise
2562 affine expression is always a set space.
2564 The multiple expression types defined by C<isl>
2565 are C<isl_multi_val>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
2566 C<isl_multi_union_pw_aff>.
2568 A multiple expression with the value zero for
2569 each output (or set) dimension can be created
2570 using the following functions.
2572         #include <isl/val.h>
2573         __isl_give isl_multi_val *isl_multi_val_zero(
2574                 __isl_take isl_space *space);
2576         #include <isl/aff.h>
2577         __isl_give isl_multi_aff *isl_multi_aff_zero(
2578                 __isl_take isl_space *space);
2579         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2580                 __isl_take isl_space *space);
2581         __isl_give isl_multi_union_pw_aff *
2582         isl_multi_union_pw_aff_zero(
2583                 __isl_take isl_space *space);
2585 Since there is no canonical way of representing a zero
2586 value of type C<isl_union_pw_aff>, the space passed
2587 to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
2589 An identity function can be created using the following
2590 functions.  The space needs to be that of a relation
2591 with the same number of input and output dimensions.
2593         #include <isl/aff.h>
2594         __isl_give isl_multi_aff *isl_multi_aff_identity(
2595                 __isl_take isl_space *space);
2596         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2597                 __isl_take isl_space *space);
2599 A function that performs a projection on a universe
2600 relation or set can be created using the following functions.
2601 See also the corresponding
2602 projection operations in L</"Unary Operations">.
2604         #include <isl/aff.h>
2605         __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2606                 __isl_take isl_space *space);
2607         __isl_give isl_multi_aff *isl_multi_aff_range_map(
2608                 __isl_take isl_space *space);
2609         __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2610                 __isl_take isl_space *space,
2611                 enum isl_dim_type type,
2612                 unsigned first, unsigned n);
2614 A multiple expression can be created from a single
2615 base expression using the following functions.
2616 The space of the created multiple expression is the same
2617 as that of the base expression, except for
2618 C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
2619 lives in a parameter space and the output lives
2620 in a single-dimensional set space.
2622         #include <isl/aff.h>
2623         __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2624                 __isl_take isl_aff *aff);
2625         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2626                 __isl_take isl_pw_aff *pa);
2627         __isl_give isl_multi_union_pw_aff *
2628         isl_multi_union_pw_aff_from_union_pw_aff(
2629                 __isl_take isl_union_pw_aff *upa);
2631 A multiple expression can be created from a list
2632 of base expression in a specified space.
2633 The domain of this space needs to be the same
2634 as the domains of the base expressions in the list.
2635 If the base expressions have a set space (or no associated space),
2636 then this space also needs to be a set space.
2638         #include <isl/val.h>
2639         __isl_give isl_multi_val *isl_multi_val_from_val_list(
2640                 __isl_take isl_space *space,
2641                 __isl_take isl_val_list *list);
2643         #include <isl/aff.h>
2644         __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2645                 __isl_take isl_space *space,
2646                 __isl_take isl_aff_list *list);
2647         __isl_give isl_multi_union_pw_aff *
2648         isl_multi_union_pw_aff_from_union_pw_aff_list(
2649                 __isl_take isl_space *space,
2650                 __isl_take isl_union_pw_aff_list *list);
2652 As a convenience, a multiple piecewise expression can
2653 also be created from a multiple expression.
2654 Each piecewise expression in the result has a single
2655 universe cell.
2657         #include <isl/aff.h>
2658         __isl_give isl_multi_pw_aff *
2659         isl_multi_pw_aff_from_multi_aff(
2660                 __isl_take isl_multi_aff *ma);
2662 Similarly, a multiple union expression can be
2663 created from a multiple expression.
2665         #include <isl/aff.h>
2666         __isl_give isl_multi_union_pw_aff *
2667         isl_multi_union_pw_aff_from_multi_aff(
2668                 __isl_take isl_multi_aff *ma);
2669         __isl_give isl_multi_union_pw_aff *
2670         isl_multi_union_pw_aff_from_multi_pw_aff(
2671                 __isl_take isl_multi_pw_aff *mpa);
2673 A multiple quasi-affine expression can be created from
2674 a multiple value with a given domain space using the following
2675 function.
2677         #include <isl/aff.h>
2678         __isl_give isl_multi_aff *
2679         isl_multi_aff_multi_val_on_space(
2680                 __isl_take isl_space *space,
2681                 __isl_take isl_multi_val *mv);
2683 Similarly,
2684 a multiple union piecewise affine expression can be created from
2685 a multiple value with a given domain or
2686 a multiple affine expression with a given domain
2687 using the following functions.
2689         #include <isl/aff.h>
2690         __isl_give isl_multi_union_pw_aff *
2691         isl_multi_union_pw_aff_multi_val_on_domain(
2692                 __isl_take isl_union_set *domain,
2693                 __isl_take isl_multi_val *mv);
2694         __isl_give isl_multi_union_pw_aff *
2695         isl_multi_union_pw_aff_multi_aff_on_domain(
2696                 __isl_take isl_union_set *domain,
2697                 __isl_take isl_multi_aff *ma);
2699 Multiple expressions can be copied and freed using
2700 the following functions.
2702         #include <isl/val.h>
2703         __isl_give isl_multi_val *isl_multi_val_copy(
2704                 __isl_keep isl_multi_val *mv);
2705         __isl_null isl_multi_val *isl_multi_val_free(
2706                 __isl_take isl_multi_val *mv);
2708         #include <isl/aff.h>
2709         __isl_give isl_multi_aff *isl_multi_aff_copy(
2710                 __isl_keep isl_multi_aff *maff);
2711         __isl_null isl_multi_aff *isl_multi_aff_free(
2712                 __isl_take isl_multi_aff *maff);
2713         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2714                 __isl_keep isl_multi_pw_aff *mpa);
2715         __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2716                 __isl_take isl_multi_pw_aff *mpa);
2717         __isl_give isl_multi_union_pw_aff *
2718         isl_multi_union_pw_aff_copy(
2719                 __isl_keep isl_multi_union_pw_aff *mupa);
2720         __isl_null isl_multi_union_pw_aff *
2721         isl_multi_union_pw_aff_free(
2722                 __isl_take isl_multi_union_pw_aff *mupa);
2724 The base expression at a given position of a multiple
2725 expression can be extracted using the following functions.
2727         #include <isl/val.h>
2728         __isl_give isl_val *isl_multi_val_get_val(
2729                 __isl_keep isl_multi_val *mv, int pos);
2731         #include <isl/aff.h>
2732         __isl_give isl_aff *isl_multi_aff_get_aff(
2733                 __isl_keep isl_multi_aff *multi, int pos);
2734         __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2735                 __isl_keep isl_multi_pw_aff *mpa, int pos);
2736         __isl_give isl_union_pw_aff *
2737         isl_multi_union_pw_aff_get_union_pw_aff(
2738                 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
2740 It can be replaced using the following functions.
2742         #include <isl/val.h>
2743         __isl_give isl_multi_val *isl_multi_val_set_val(
2744                 __isl_take isl_multi_val *mv, int pos,
2745                 __isl_take isl_val *val);
2747         #include <isl/aff.h>
2748         __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2749                 __isl_take isl_multi_aff *multi, int pos,
2750                 __isl_take isl_aff *aff);
2751         __isl_give isl_multi_union_pw_aff *
2752         isl_multi_union_pw_aff_set_union_pw_aff(
2753                 __isl_take isl_multi_union_pw_aff *mupa, int pos,
2754                 __isl_take isl_union_pw_aff *upa);
2756 As a convenience, a sequence of base expressions that have
2757 their domains in a given space can be extracted from a sequence
2758 of union expressions using the following function.
2760         #include <isl/aff.h>
2761         __isl_give isl_multi_pw_aff *
2762         isl_multi_union_pw_aff_extract_multi_pw_aff(
2763                 __isl_keep isl_multi_union_pw_aff *mupa,
2764                 __isl_take isl_space *space);
2766 Note that there is a difference between C<isl_multi_union_pw_aff>
2767 and C<isl_union_pw_multi_aff> objects.  The first is a sequence
2768 of unions of piecewise expressions, while the second is a union
2769 of piecewise sequences.  In particular, multiple affine expressions
2770 in an C<isl_union_pw_multi_aff> may live in different spaces,
2771 while there is only a single multiple expression in
2772 an C<isl_multi_union_pw_aff>, which can therefore only live
2773 in a single space.  This means that not every
2774 C<isl_union_pw_multi_aff> can be converted to
2775 an C<isl_multi_union_pw_aff>.  Conversely, a zero-dimensional
2776 C<isl_multi_union_pw_aff> carries no information
2777 about any possible domain and therefore cannot be converted
2778 to an C<isl_union_pw_multi_aff>.  Moreover, the elements
2779 of an C<isl_multi_union_pw_aff> may be defined over different domains,
2780 while each multiple expression inside an C<isl_union_pw_multi_aff>
2781 has a single domain.  The conversion of an C<isl_union_pw_multi_aff>
2782 of dimension greater than one may therefore not be exact.
2783 The following functions can
2784 be used to perform these conversions when they are possible.
2786         #include <isl/aff.h>
2787         __isl_give isl_multi_union_pw_aff *
2788         isl_multi_union_pw_aff_from_union_pw_multi_aff(
2789                 __isl_take isl_union_pw_multi_aff *upma);
2790         __isl_give isl_union_pw_multi_aff *
2791         isl_union_pw_multi_aff_from_multi_union_pw_aff(
2792                 __isl_take isl_multi_union_pw_aff *mupa);
2794 =head3 Piecewise Expressions
2796 A piecewise expression is an expression that is described
2797 using zero or more base expression defined over the same
2798 number of cells in the domain space of the base expressions.
2799 All base expressions are defined over the same
2800 domain space and the cells are disjoint.
2801 The space of a piecewise expression is the same as
2802 that of the base expressions.
2803 If the union of the cells is a strict subset of the domain
2804 space, then the value of the piecewise expression outside
2805 this union is different for types derived from quasi-affine
2806 expressions and those derived from quasipolynomials.
2807 Piecewise expressions derived from quasi-affine expressions
2808 are considered to be undefined outside the union of their cells.
2809 Piecewise expressions derived from quasipolynomials
2810 are considered to be zero outside the union of their cells.
2812 Piecewise quasipolynomials are mainly used by the C<barvinok>
2813 library for representing the number of elements in a parametric set or map.
2814 For example, the piecewise quasipolynomial
2816         [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
2818 represents the number of points in the map
2820         [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
2822 The piecewise expression types defined by C<isl>
2823 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
2824 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
2826 A piecewise expression with no cells can be created using
2827 the following functions.
2829         #include <isl/aff.h>
2830         __isl_give isl_pw_aff *isl_pw_aff_empty(
2831                 __isl_take isl_space *space);
2832         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
2833                 __isl_take isl_space *space);
2835 A piecewise expression with a single universe cell can be
2836 created using the following functions.
2838         #include <isl/aff.h>
2839         __isl_give isl_pw_aff *isl_pw_aff_from_aff(
2840                 __isl_take isl_aff *aff);
2841         __isl_give isl_pw_multi_aff *
2842         isl_pw_multi_aff_from_multi_aff(
2843                 __isl_take isl_multi_aff *ma);
2845         #include <isl/polynomial.h>
2846         __isl_give isl_pw_qpolynomial *
2847         isl_pw_qpolynomial_from_qpolynomial(
2848                 __isl_take isl_qpolynomial *qp);
2850 A piecewise expression with a single specified cell can be
2851 created using the following functions.
2853         #include <isl/aff.h>
2854         __isl_give isl_pw_aff *isl_pw_aff_alloc(
2855                 __isl_take isl_set *set, __isl_take isl_aff *aff);
2856         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
2857                 __isl_take isl_set *set,
2858                 __isl_take isl_multi_aff *maff);
2860         #include <isl/polynomial.h>
2861         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
2862                 __isl_take isl_set *set,
2863                 __isl_take isl_qpolynomial *qp);
2865 The following convenience functions first create a base expression and
2866 then create a piecewise expression over a universe domain.
2868         #include <isl/aff.h>
2869         __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
2870                 __isl_take isl_local_space *ls);
2871         __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
2872                 __isl_take isl_local_space *ls,
2873                 enum isl_dim_type type, unsigned pos);
2874         __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
2875                 __isl_take isl_local_space *ls);
2876         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
2877                 __isl_take isl_space *space);
2878         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
2879                 __isl_take isl_space *space);
2880         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
2881                 __isl_take isl_space *space);
2882         __isl_give isl_pw_multi_aff *
2883         isl_pw_multi_aff_project_out_map(
2884                 __isl_take isl_space *space,
2885                 enum isl_dim_type type,
2886                 unsigned first, unsigned n);
2888         #include <isl/polynomial.h>
2889         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
2890                 __isl_take isl_space *space);
2892 The following convenience functions first create a base expression and
2893 then create a piecewise expression over a given domain.
2895         #include <isl/aff.h>
2896         __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
2897                 __isl_take isl_set *domain,
2898                 __isl_take isl_val *v);
2899         __isl_give isl_pw_multi_aff *
2900         isl_pw_multi_aff_multi_val_on_domain(
2901                 __isl_take isl_set *domain,
2902                 __isl_take isl_multi_val *mv);
2904 As a convenience, a piecewise multiple expression can
2905 also be created from a piecewise expression.
2906 Each multiple expression in the result is derived
2907 from the corresponding base expression.
2909         #include <isl/aff.h>
2910         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
2911                 __isl_take isl_pw_aff *pa);
2913 Similarly, a piecewise quasipolynomial can be
2914 created from a piecewise quasi-affine expression using
2915 the following function.
2917         #include <isl/polynomial.h>
2918         __isl_give isl_pw_qpolynomial *
2919         isl_pw_qpolynomial_from_pw_aff(
2920                 __isl_take isl_pw_aff *pwaff);
2922 Piecewise expressions can be copied and freed using the following functions.
2924         #include <isl/aff.h>
2925         __isl_give isl_pw_aff *isl_pw_aff_copy(
2926                 __isl_keep isl_pw_aff *pwaff);
2927         __isl_null isl_pw_aff *isl_pw_aff_free(
2928                 __isl_take isl_pw_aff *pwaff);
2929         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
2930                 __isl_keep isl_pw_multi_aff *pma);
2931         __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
2932                 __isl_take isl_pw_multi_aff *pma);
2934         #include <isl/polynomial.h>
2935         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
2936                 __isl_keep isl_pw_qpolynomial *pwqp);
2937         __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
2938                 __isl_take isl_pw_qpolynomial *pwqp);
2939         __isl_give isl_pw_qpolynomial_fold *
2940         isl_pw_qpolynomial_fold_copy(
2941                 __isl_keep isl_pw_qpolynomial_fold *pwf);
2942         __isl_null isl_pw_qpolynomial_fold *
2943         isl_pw_qpolynomial_fold_free(
2944                 __isl_take isl_pw_qpolynomial_fold *pwf);
2946 To iterate over the different cells of a piecewise expression,
2947 use the following functions.
2949         #include <isl/aff.h>
2950         int isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
2951         int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
2952         int isl_pw_aff_foreach_piece(__isl_keep isl_pw_aff *pwaff,
2953                 int (*fn)(__isl_take isl_set *set,
2954                           __isl_take isl_aff *aff,
2955                           void *user), void *user);
2956         int isl_pw_multi_aff_foreach_piece(
2957                 __isl_keep isl_pw_multi_aff *pma,
2958                 int (*fn)(__isl_take isl_set *set,
2959                             __isl_take isl_multi_aff *maff,
2960                             void *user), void *user);
2962         #include <isl/polynomial.h>
2963         int isl_pw_qpolynomial_foreach_piece(
2964                 __isl_keep isl_pw_qpolynomial *pwqp,
2965                 int (*fn)(__isl_take isl_set *set,
2966                           __isl_take isl_qpolynomial *qp,
2967                           void *user), void *user);
2968         int isl_pw_qpolynomial_foreach_lifted_piece(
2969                 __isl_keep isl_pw_qpolynomial *pwqp,
2970                 int (*fn)(__isl_take isl_set *set,
2971                           __isl_take isl_qpolynomial *qp,
2972                           void *user), void *user);
2973         int isl_pw_qpolynomial_fold_foreach_piece(
2974                 __isl_keep isl_pw_qpolynomial_fold *pwf,
2975                 int (*fn)(__isl_take isl_set *set,
2976                           __isl_take isl_qpolynomial_fold *fold,
2977                           void *user), void *user);
2978         int isl_pw_qpolynomial_fold_foreach_lifted_piece(
2979                 __isl_keep isl_pw_qpolynomial_fold *pwf,
2980                 int (*fn)(__isl_take isl_set *set,
2981                           __isl_take isl_qpolynomial_fold *fold,
2982                           void *user), void *user);
2984 As usual, the function C<fn> should return C<0> on success
2985 and C<-1> on failure.  The difference between
2986 C<isl_pw_qpolynomial_foreach_piece> and
2987 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
2988 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
2989 compute unique representations for all existentially quantified
2990 variables and then turn these existentially quantified variables
2991 into extra set variables, adapting the associated quasipolynomial
2992 accordingly.  This means that the C<set> passed to C<fn>
2993 will not have any existentially quantified variables, but that
2994 the dimensions of the sets may be different for different
2995 invocations of C<fn>.
2996 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
2997 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
2999 A piecewise expression consisting of the expressions at a given
3000 position of a piecewise multiple expression can be extracted
3001 using the following function.
3003         #include <isl/aff.h>
3004         __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3005                 __isl_keep isl_pw_multi_aff *pma, int pos);
3007 These expressions can be replaced using the following function.
3009         #include <isl/aff.h>
3010         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3011                 __isl_take isl_pw_multi_aff *pma, unsigned pos,
3012                 __isl_take isl_pw_aff *pa);
3014 Note that there is a difference between C<isl_multi_pw_aff> and
3015 C<isl_pw_multi_aff> objects.  The first is a sequence of piecewise
3016 affine expressions, while the second is a piecewise sequence
3017 of affine expressions.  In particular, each of the piecewise
3018 affine expressions in an C<isl_multi_pw_aff> may have a different
3019 domain, while all multiple expressions associated to a cell
3020 in an C<isl_pw_multi_aff> have the same domain.
3021 It is possible to convert between the two, but when converting
3022 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3023 of the result is the intersection of the domains of the input.
3024 The reverse conversion is exact.
3026         #include <isl/aff.h>
3027         __isl_give isl_pw_multi_aff *
3028         isl_pw_multi_aff_from_multi_pw_aff(
3029                 __isl_take isl_multi_pw_aff *mpa);
3030         __isl_give isl_multi_pw_aff *
3031         isl_multi_pw_aff_from_pw_multi_aff(
3032                 __isl_take isl_pw_multi_aff *pma);
3034 =head3 Union Expressions
3036 A union expression collects base expressions defined
3037 over different domains.  The space of a union expression
3038 is that of the shared parameter space.
3040 The union expression types defined by C<isl>
3041 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3042 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3044 An empty union expression can be created using the following functions.
3046         #include <isl/aff.h>
3047         __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
3048                 __isl_take isl_space *space);
3049         __isl_give isl_union_pw_multi_aff *
3050         isl_union_pw_multi_aff_empty(
3051                 __isl_take isl_space *space);
3053         #include <isl/polynomial.h>
3054         __isl_give isl_union_pw_qpolynomial *
3055         isl_union_pw_qpolynomial_zero(
3056                 __isl_take isl_space *space);
3058 A union expression containing a single base expression
3059 can be created using the following functions.
3061         #include <isl/aff.h>
3062         __isl_give isl_union_pw_aff *
3063         isl_union_pw_aff_from_pw_aff(
3064                 __isl_take isl_pw_aff *pa);
3065         __isl_give isl_union_pw_multi_aff *
3066         isl_union_pw_multi_aff_from_aff(
3067                 __isl_take isl_aff *aff);
3068         __isl_give isl_union_pw_multi_aff *
3069         isl_union_pw_multi_aff_from_pw_multi_aff(
3070                 __isl_take isl_pw_multi_aff *pma);
3072         #include <isl/polynomial.h>
3073         __isl_give isl_union_pw_qpolynomial *
3074         isl_union_pw_qpolynomial_from_pw_qpolynomial(
3075                 __isl_take isl_pw_qpolynomial *pwqp);
3077 The following functions create a base expression on each
3078 of the sets in the union set and collect the results.
3080         #include <isl/aff.h>
3081         __isl_give isl_union_pw_multi_aff *
3082         isl_union_pw_multi_aff_from_union_pw_aff(
3083                 __isl_take isl_union_pw_aff *upa);
3084         __isl_give isl_union_pw_aff *
3085         isl_union_pw_multi_aff_get_union_pw_aff(
3086                 __isl_keep isl_union_pw_multi_aff *upma, int pos);
3087         __isl_give isl_union_pw_aff *
3088         isl_union_pw_aff_val_on_domain(
3089                 __isl_take isl_union_set *domain,
3090                 __isl_take isl_val *v);
3091         __isl_give isl_union_pw_multi_aff *
3092         isl_union_pw_multi_aff_multi_val_on_domain(
3093                 __isl_take isl_union_set *domain,
3094                 __isl_take isl_multi_val *mv);
3096 An C<isl_union_pw_aff> that is equal to a (parametric) affine
3097 expression on a given domain can be created using the following
3098 function.
3100         #include <isl/aff.h>
3101         __isl_give isl_union_pw_aff *
3102         isl_union_pw_aff_aff_on_domain(
3103                 __isl_take isl_union_set *domain,
3104                 __isl_take isl_aff *aff);
3106 A base expression can be added to a union expression using
3107 the following functions.
3109         #include <isl/aff.h>
3110         __isl_give isl_union_pw_aff *
3111         isl_union_pw_aff_add_pw_aff(
3112                 __isl_take isl_union_pw_aff *upa,
3113                 __isl_take isl_pw_aff *pa);
3114         __isl_give isl_union_pw_multi_aff *
3115         isl_union_pw_multi_aff_add_pw_multi_aff(
3116                 __isl_take isl_union_pw_multi_aff *upma,
3117                 __isl_take isl_pw_multi_aff *pma);
3119         #include <isl/polynomial.h>
3120         __isl_give isl_union_pw_qpolynomial *
3121         isl_union_pw_qpolynomial_add_pw_qpolynomial(
3122                 __isl_take isl_union_pw_qpolynomial *upwqp,
3123                 __isl_take isl_pw_qpolynomial *pwqp);
3125 Union expressions can be copied and freed using
3126 the following functions.
3128         #include <isl/aff.h>
3129         __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
3130                 __isl_keep isl_union_pw_aff *upa);
3131         __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
3132                 __isl_take isl_union_pw_aff *upa);
3133         __isl_give isl_union_pw_multi_aff *
3134         isl_union_pw_multi_aff_copy(
3135                 __isl_keep isl_union_pw_multi_aff *upma);
3136         __isl_null isl_union_pw_multi_aff *
3137         isl_union_pw_multi_aff_free(
3138                 __isl_take isl_union_pw_multi_aff *upma);
3140         #include <isl/polynomial.h>
3141         __isl_give isl_union_pw_qpolynomial *
3142         isl_union_pw_qpolynomial_copy(
3143                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3144         __isl_null isl_union_pw_qpolynomial *
3145         isl_union_pw_qpolynomial_free(
3146                 __isl_take isl_union_pw_qpolynomial *upwqp);
3147         __isl_give isl_union_pw_qpolynomial_fold *
3148         isl_union_pw_qpolynomial_fold_copy(
3149                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3150         __isl_null isl_union_pw_qpolynomial_fold *
3151         isl_union_pw_qpolynomial_fold_free(
3152                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3154 To iterate over the base expressions in a union expression,
3155 use the following functions.
3157         #include <isl/aff.h>
3158         int isl_union_pw_aff_n_pw_aff(
3159                 __isl_keep isl_union_pw_aff *upa);
3160         int isl_union_pw_aff_foreach_pw_aff(
3161                 __isl_keep isl_union_pw_aff *upa,
3162                 int (*fn)(__isl_take isl_pw_aff *ma, void *user),
3163                         void *user);
3164         int isl_union_pw_multi_aff_n_pw_multi_aff(
3165                 __isl_keep isl_union_pw_multi_aff *upma);
3166         int isl_union_pw_multi_aff_foreach_pw_multi_aff(
3167                 __isl_keep isl_union_pw_multi_aff *upma,
3168                 int (*fn)(__isl_take isl_pw_multi_aff *pma,
3169                             void *user), void *user);
3171         #include <isl/polynomial.h>
3172         int isl_union_pw_qpolynomial_n_pw_qpolynomial(
3173                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3174         int isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3175                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3176                 int (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3177                             void *user), void *user);
3178         int isl_union_pw_qpolynomial_fold_n_pw_qpolynomial_fold(
3179                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3180         int isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3181                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3182                 int (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3183                             void *user), void *user);
3185 To extract the base expression in a given space from a union, use
3186 the following functions.
3188         #include <isl/aff.h>
3189         __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3190                 __isl_keep isl_union_pw_aff *upa,
3191                 __isl_take isl_space *space);
3192         __isl_give isl_pw_multi_aff *
3193         isl_union_pw_multi_aff_extract_pw_multi_aff(
3194                 __isl_keep isl_union_pw_multi_aff *upma,
3195                 __isl_take isl_space *space);
3197         #include <isl/polynomial.h>
3198         __isl_give isl_pw_qpolynomial *
3199         isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3200                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3201                 __isl_take isl_space *space);
3203 =head2 Input and Output
3205 For set and relation,
3206 C<isl> supports its own input/output format, which is similar
3207 to the C<Omega> format, but also supports the C<PolyLib> format
3208 in some cases.
3209 For other object types, typically only an C<isl> format is supported.
3211 =head3 C<isl> format
3213 The C<isl> format is similar to that of C<Omega>, but has a different
3214 syntax for describing the parameters and allows for the definition
3215 of an existentially quantified variable as the integer division
3216 of an affine expression.
3217 For example, the set of integers C<i> between C<0> and C<n>
3218 such that C<i % 10 <= 6> can be described as
3220         [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3221                                 i - 10 a <= 6) }
3223 A set or relation can have several disjuncts, separated
3224 by the keyword C<or>.  Each disjunct is either a conjunction
3225 of constraints or a projection (C<exists>) of a conjunction
3226 of constraints.  The constraints are separated by the keyword
3227 C<and>.
3229 =head3 C<PolyLib> format
3231 If the represented set is a union, then the first line
3232 contains a single number representing the number of disjuncts.
3233 Otherwise, a line containing the number C<1> is optional.
3235 Each disjunct is represented by a matrix of constraints.
3236 The first line contains two numbers representing
3237 the number of rows and columns,
3238 where the number of rows is equal to the number of constraints
3239 and the number of columns is equal to two plus the number of variables.
3240 The following lines contain the actual rows of the constraint matrix.
3241 In each row, the first column indicates whether the constraint
3242 is an equality (C<0>) or inequality (C<1>).  The final column
3243 corresponds to the constant term.
3245 If the set is parametric, then the coefficients of the parameters
3246 appear in the last columns before the constant column.
3247 The coefficients of any existentially quantified variables appear
3248 between those of the set variables and those of the parameters.
3250 =head3 Extended C<PolyLib> format
3252 The extended C<PolyLib> format is nearly identical to the
3253 C<PolyLib> format.  The only difference is that the line
3254 containing the number of rows and columns of a constraint matrix
3255 also contains four additional numbers:
3256 the number of output dimensions, the number of input dimensions,
3257 the number of local dimensions (i.e., the number of existentially
3258 quantified variables) and the number of parameters.
3259 For sets, the number of ``output'' dimensions is equal
3260 to the number of set dimensions, while the number of ``input''
3261 dimensions is zero.
3263 =head3 Input
3265 Objects can be read from input using the following functions.
3267         #include <isl/val.h>
3268         __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3269                 const char *str);
3270         __isl_give isl_multi_val *isl_multi_val_read_from_str(
3271                 isl_ctx *ctx, const char *str);
3273         #include <isl/set.h>
3274         __isl_give isl_basic_set *isl_basic_set_read_from_file(
3275                 isl_ctx *ctx, FILE *input);
3276         __isl_give isl_basic_set *isl_basic_set_read_from_str(
3277                 isl_ctx *ctx, const char *str);
3278         __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3279                 FILE *input);
3280         __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3281                 const char *str);
3283         #include <isl/map.h>
3284         __isl_give isl_basic_map *isl_basic_map_read_from_file(
3285                 isl_ctx *ctx, FILE *input);
3286         __isl_give isl_basic_map *isl_basic_map_read_from_str(
3287                 isl_ctx *ctx, const char *str);
3288         __isl_give isl_map *isl_map_read_from_file(
3289                 isl_ctx *ctx, FILE *input);
3290         __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3291                 const char *str);
3293         #include <isl/union_set.h>
3294         __isl_give isl_union_set *isl_union_set_read_from_file(
3295                 isl_ctx *ctx, FILE *input);
3296         __isl_give isl_union_set *isl_union_set_read_from_str(
3297                 isl_ctx *ctx, const char *str);
3299         #include <isl/union_map.h>
3300         __isl_give isl_union_map *isl_union_map_read_from_file(
3301                 isl_ctx *ctx, FILE *input);
3302         __isl_give isl_union_map *isl_union_map_read_from_str(
3303                 isl_ctx *ctx, const char *str);
3305         #include <isl/aff.h>
3306         __isl_give isl_aff *isl_aff_read_from_str(
3307                 isl_ctx *ctx, const char *str);
3308         __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3309                 isl_ctx *ctx, const char *str);
3310         __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3311                 isl_ctx *ctx, const char *str);
3312         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3313                 isl_ctx *ctx, const char *str);
3314         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3315                 isl_ctx *ctx, const char *str);
3316         __isl_give isl_union_pw_multi_aff *
3317         isl_union_pw_multi_aff_read_from_str(
3318                 isl_ctx *ctx, const char *str);
3319         __isl_give isl_multi_union_pw_aff *
3320         isl_multi_union_pw_aff_read_from_str(
3321                 isl_ctx *ctx, const char *str);
3323         #include <isl/polynomial.h>
3324         __isl_give isl_union_pw_qpolynomial *
3325         isl_union_pw_qpolynomial_read_from_str(
3326                 isl_ctx *ctx, const char *str);
3328 For sets and relations,
3329 the input format is autodetected and may be either the C<PolyLib> format
3330 or the C<isl> format.
3332 =head3 Output
3334 Before anything can be printed, an C<isl_printer> needs to
3335 be created.
3337         __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3338                 FILE *file);
3339         __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3340         __isl_null isl_printer *isl_printer_free(
3341                 __isl_take isl_printer *printer);
3342         __isl_give char *isl_printer_get_str(
3343                 __isl_keep isl_printer *printer);
3345 The printer can be inspected using the following functions.
3347         FILE *isl_printer_get_file(
3348                 __isl_keep isl_printer *printer);
3349         int isl_printer_get_output_format(
3350                 __isl_keep isl_printer *p);
3351         int isl_printer_get_yaml_style(__isl_keep isl_printer *p);
3353 The behavior of the printer can be modified in various ways
3355         __isl_give isl_printer *isl_printer_set_output_format(
3356                 __isl_take isl_printer *p, int output_format);
3357         __isl_give isl_printer *isl_printer_set_indent(
3358                 __isl_take isl_printer *p, int indent);
3359         __isl_give isl_printer *isl_printer_set_indent_prefix(
3360                 __isl_take isl_printer *p, const char *prefix);
3361         __isl_give isl_printer *isl_printer_indent(
3362                 __isl_take isl_printer *p, int indent);
3363         __isl_give isl_printer *isl_printer_set_prefix(
3364                 __isl_take isl_printer *p, const char *prefix);
3365         __isl_give isl_printer *isl_printer_set_suffix(
3366                 __isl_take isl_printer *p, const char *suffix);
3367         __isl_give isl_printer *isl_printer_set_yaml_style(
3368                 __isl_take isl_printer *p, int yaml_style);
3370 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3371 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3372 and defaults to C<ISL_FORMAT_ISL>.
3373 Each line in the output is prefixed by C<indent_prefix>,
3374 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3375 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3376 In the C<PolyLib> format output,
3377 the coefficients of the existentially quantified variables
3378 appear between those of the set variables and those
3379 of the parameters.
3380 The function C<isl_printer_indent> increases the indentation
3381 by the specified amount (which may be negative).
3382 The YAML style may be either C<ISL_YAML_STYLE_BLOCK> or
3383 C<ISL_YAML_STYLE_FLOW> and when we are printing something
3384 in YAML format.
3386 To actually print something, use
3388         #include <isl/printer.h>
3389         __isl_give isl_printer *isl_printer_print_double(
3390                 __isl_take isl_printer *p, double d);
3392         #include <isl/val.h>
3393         __isl_give isl_printer *isl_printer_print_val(
3394                 __isl_take isl_printer *p, __isl_keep isl_val *v);
3396         #include <isl/set.h>
3397         __isl_give isl_printer *isl_printer_print_basic_set(
3398                 __isl_take isl_printer *printer,
3399                 __isl_keep isl_basic_set *bset);
3400         __isl_give isl_printer *isl_printer_print_set(
3401                 __isl_take isl_printer *printer,
3402                 __isl_keep isl_set *set);
3404         #include <isl/map.h>
3405         __isl_give isl_printer *isl_printer_print_basic_map(
3406                 __isl_take isl_printer *printer,
3407                 __isl_keep isl_basic_map *bmap);
3408         __isl_give isl_printer *isl_printer_print_map(
3409                 __isl_take isl_printer *printer,
3410                 __isl_keep isl_map *map);
3412         #include <isl/union_set.h>
3413         __isl_give isl_printer *isl_printer_print_union_set(
3414                 __isl_take isl_printer *p,
3415                 __isl_keep isl_union_set *uset);
3417         #include <isl/union_map.h>
3418         __isl_give isl_printer *isl_printer_print_union_map(
3419                 __isl_take isl_printer *p,
3420                 __isl_keep isl_union_map *umap);
3422         #include <isl/val.h>
3423         __isl_give isl_printer *isl_printer_print_multi_val(
3424                 __isl_take isl_printer *p,
3425                 __isl_keep isl_multi_val *mv);
3427         #include <isl/aff.h>
3428         __isl_give isl_printer *isl_printer_print_aff(
3429                 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3430         __isl_give isl_printer *isl_printer_print_multi_aff(
3431                 __isl_take isl_printer *p,
3432                 __isl_keep isl_multi_aff *maff);
3433         __isl_give isl_printer *isl_printer_print_pw_aff(
3434                 __isl_take isl_printer *p,
3435                 __isl_keep isl_pw_aff *pwaff);
3436         __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3437                 __isl_take isl_printer *p,
3438                 __isl_keep isl_pw_multi_aff *pma);
3439         __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3440                 __isl_take isl_printer *p,
3441                 __isl_keep isl_multi_pw_aff *mpa);
3442         __isl_give isl_printer *isl_printer_print_union_pw_aff(
3443                 __isl_take isl_printer *p,
3444                 __isl_keep isl_union_pw_aff *upa);
3445         __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3446                 __isl_take isl_printer *p,
3447                 __isl_keep isl_union_pw_multi_aff *upma);
3448         __isl_give isl_printer *
3449         isl_printer_print_multi_union_pw_aff(
3450                 __isl_take isl_printer *p,
3451                 __isl_keep isl_multi_union_pw_aff *mupa);
3453         #include <isl/polynomial.h>
3454         __isl_give isl_printer *isl_printer_print_qpolynomial(
3455                 __isl_take isl_printer *p,
3456                 __isl_keep isl_qpolynomial *qp);
3457         __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3458                 __isl_take isl_printer *p,
3459                 __isl_keep isl_pw_qpolynomial *pwqp);
3460         __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3461                 __isl_take isl_printer *p,
3462                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3464         __isl_give isl_printer *
3465         isl_printer_print_pw_qpolynomial_fold(
3466                 __isl_take isl_printer *p,
3467                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3468         __isl_give isl_printer *
3469         isl_printer_print_union_pw_qpolynomial_fold(
3470                 __isl_take isl_printer *p,
3471                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3473 For C<isl_printer_print_qpolynomial>,
3474 C<isl_printer_print_pw_qpolynomial> and
3475 C<isl_printer_print_pw_qpolynomial_fold>,
3476 the output format of the printer
3477 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3478 For C<isl_printer_print_union_pw_qpolynomial> and
3479 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3480 is supported.
3481 In case of printing in C<ISL_FORMAT_C>, the user may want
3482 to set the names of all dimensions first.
3484 C<isl> also provides limited support for printing YAML documents,
3485 just enough for the internal use for printing such documents.
3487         #include <isl/printer.h>
3488         __isl_give isl_printer *isl_printer_yaml_start_mapping(
3489                 __isl_take isl_printer *p);
3490         __isl_give isl_printer *isl_printer_yaml_end_mapping(
3491                 __isl_take isl_printer *p);
3492         __isl_give isl_printer *isl_printer_yaml_start_sequence(
3493                 __isl_take isl_printer *p);
3494         __isl_give isl_printer *isl_printer_yaml_end_sequence(
3495                 __isl_take isl_printer *p);
3496         __isl_give isl_printer *isl_printer_yaml_next(
3497                 __isl_take isl_printer *p);
3499 A document is started by a call to either
3500 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3501 Anything printed to the printer after such a call belong to the
3502 first key of the mapping or the first element in the sequence.
3503 The function C<isl_printer_yaml_next> moves to the value if
3504 we are currently printing a mapping key, the next key if we
3505 are printing a value or the next element if we are printing
3506 an element in a sequence.
3507 Nested mappings and sequences are initiated by the same
3508 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3509 Each call to these functions needs to have a corresponding call to
3510 C<isl_printer_yaml_end_mapping> or C<isl_printer_yaml_end_sequence>.
3512 When called on a file printer, the following function flushes
3513 the file.  When called on a string printer, the buffer is cleared.
3515         __isl_give isl_printer *isl_printer_flush(
3516                 __isl_take isl_printer *p);
3518 Alternatively, a string representation can be obtained
3519 directly using the following functions, which always print
3520 in isl format.
3522         #include <isl/space.h>
3523         __isl_give char *isl_space_to_str(
3524                 __isl_keep isl_space *space);
3526         #include <isl/val.h>
3527         __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3528         __isl_give char *isl_multi_val_to_str(
3529                 __isl_keep isl_multi_val *mv);
3531         #include <isl/set.h>
3532         __isl_give char *isl_set_to_str(
3533                 __isl_keep isl_set *set);
3535         #include <isl/union_set.h>
3536         __isl_give char *isl_union_set_to_str(
3537                 __isl_keep isl_union_set *uset);
3539         #include <isl/map.h>
3540         __isl_give char *isl_map_to_str(
3541                 __isl_keep isl_map *map);
3543         #include <isl/union_map.h>
3544         __isl_give char *isl_union_map_to_str(
3545                 __isl_keep isl_union_map *umap);
3547         #include <isl/aff.h>
3548         __isl_give char *isl_multi_aff_to_str(
3549                 __isl_keep isl_multi_aff *aff);
3550         __isl_give char *isl_union_pw_aff_to_str(
3551                 __isl_keep isl_union_pw_aff *upa);
3552         __isl_give char *isl_union_pw_multi_aff_to_str(
3553                 __isl_keep isl_union_pw_multi_aff *upma);
3554         __isl_give char *isl_multi_union_pw_aff_to_str(
3555                 __isl_keep isl_multi_union_pw_aff *mupa);
3557 =head2 Properties
3559 =head3 Unary Properties
3561 =over
3563 =item * Emptiness
3565 The following functions test whether the given set or relation
3566 contains any integer points.  The ``plain'' variants do not perform
3567 any computations, but simply check if the given set or relation
3568 is already known to be empty.
3570         int isl_basic_set_plain_is_empty(__isl_keep isl_basic_set *bset);
3571         int isl_basic_set_is_empty(__isl_keep isl_basic_set *bset);
3572         int isl_set_plain_is_empty(__isl_keep isl_set *set);
3573         int isl_set_is_empty(__isl_keep isl_set *set);
3574         int isl_union_set_is_empty(__isl_keep isl_union_set *uset);
3575         int isl_basic_map_plain_is_empty(__isl_keep isl_basic_map *bmap);
3576         int isl_basic_map_is_empty(__isl_keep isl_basic_map *bmap);
3577         int isl_map_plain_is_empty(__isl_keep isl_map *map);
3578         int isl_map_is_empty(__isl_keep isl_map *map);
3579         int isl_union_map_is_empty(__isl_keep isl_union_map *umap);
3581 =item * Universality
3583         int isl_basic_set_is_universe(__isl_keep isl_basic_set *bset);
3584         int isl_basic_map_is_universe(__isl_keep isl_basic_map *bmap);
3585         int isl_set_plain_is_universe(__isl_keep isl_set *set);
3587 =item * Single-valuedness
3589         #include <isl/set.h>
3590         int isl_set_is_singleton(__isl_keep isl_set *set);
3592         #include <isl/map.h>
3593         int isl_basic_map_is_single_valued(
3594                 __isl_keep isl_basic_map *bmap);
3595         int isl_map_plain_is_single_valued(
3596                 __isl_keep isl_map *map);
3597         int isl_map_is_single_valued(__isl_keep isl_map *map);
3599         #include <isl/union_map.h>
3600         int isl_union_map_is_single_valued(__isl_keep isl_union_map *umap);
3602 =item * Injectivity
3604         int isl_map_plain_is_injective(__isl_keep isl_map *map);
3605         int isl_map_is_injective(__isl_keep isl_map *map);
3606         int isl_union_map_plain_is_injective(
3607                 __isl_keep isl_union_map *umap);
3608         int isl_union_map_is_injective(
3609                 __isl_keep isl_union_map *umap);
3611 =item * Bijectivity
3613         int isl_map_is_bijective(__isl_keep isl_map *map);
3614         int isl_union_map_is_bijective(__isl_keep isl_union_map *umap);
3616 =item * Position
3618         __isl_give isl_val *
3619         isl_basic_map_plain_get_val_if_fixed(
3620                 __isl_keep isl_basic_map *bmap,
3621                 enum isl_dim_type type, unsigned pos);
3622         __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3623                 __isl_keep isl_set *set,
3624                 enum isl_dim_type type, unsigned pos);
3625         __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3626                 __isl_keep isl_map *map,
3627                 enum isl_dim_type type, unsigned pos);
3629 If the set or relation obviously lies on a hyperplane where the given dimension
3630 has a fixed value, then return that value.
3631 Otherwise return NaN.
3633 =item * Stride
3635         int isl_set_dim_residue_class_val(
3636                 __isl_keep isl_set *set,
3637                 int pos, __isl_give isl_val **modulo,
3638                 __isl_give isl_val **residue);
3640 Check if the values of the given set dimension are equal to a fixed
3641 value modulo some integer value.  If so, assign the modulo to C<*modulo>
3642 and the fixed value to C<*residue>.  If the given dimension attains only
3643 a single value, then assign C<0> to C<*modulo> and the fixed value to
3644 C<*residue>.
3645 If the dimension does not attain only a single value and if no modulo
3646 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3648 =item * Dependence
3650 To check whether the description of a set, relation or function depends
3651 on one or more given dimensions,
3652 the following functions can be used.
3654         #include <isl/constraint.h>
3655         int isl_constraint_involves_dims(
3656                 __isl_keep isl_constraint *constraint,
3657                 enum isl_dim_type type, unsigned first, unsigned n);
3659         #include <isl/set.h>
3660         int isl_basic_set_involves_dims(
3661                 __isl_keep isl_basic_set *bset,
3662                 enum isl_dim_type type, unsigned first, unsigned n);
3663         int isl_set_involves_dims(__isl_keep isl_set *set,
3664                 enum isl_dim_type type, unsigned first, unsigned n);
3666         #include <isl/map.h>
3667         int isl_basic_map_involves_dims(
3668                 __isl_keep isl_basic_map *bmap,
3669                 enum isl_dim_type type, unsigned first, unsigned n);
3670         int isl_map_involves_dims(__isl_keep isl_map *map,
3671                 enum isl_dim_type type, unsigned first, unsigned n);
3673         #include <isl/union_map.h>
3674         int isl_union_map_involves_dims(
3675                 __isl_keep isl_union_map *umap,
3676                 enum isl_dim_type type, unsigned first, unsigned n);
3678         #include <isl/aff.h>
3679         int isl_aff_involves_dims(__isl_keep isl_aff *aff,
3680                 enum isl_dim_type type, unsigned first, unsigned n);
3681         int isl_pw_aff_involves_dims(__isl_keep isl_pw_aff *pwaff,
3682                 enum isl_dim_type type, unsigned first, unsigned n);
3683         int isl_multi_aff_involves_dims(
3684                 __isl_keep isl_multi_aff *ma,
3685                 enum isl_dim_type type, unsigned first, unsigned n);
3686         int isl_multi_pw_aff_involves_dims(
3687                 __isl_keep isl_multi_pw_aff *mpa,
3688                 enum isl_dim_type type, unsigned first, unsigned n);
3690 Similarly, the following functions can be used to check whether
3691 a given dimension is involved in any lower or upper bound.
3693         #include <isl/set.h>
3694         int isl_set_dim_has_any_lower_bound(__isl_keep isl_set *set,
3695                 enum isl_dim_type type, unsigned pos);
3696         int isl_set_dim_has_any_upper_bound(__isl_keep isl_set *set,
3697                 enum isl_dim_type type, unsigned pos);
3699 Note that these functions return true even if there is a bound on
3700 the dimension on only some of the basic sets of C<set>.
3701 To check if they have a bound for all of the basic sets in C<set>,
3702 use the following functions instead.
3704         #include <isl/set.h>
3705         int isl_set_dim_has_lower_bound(__isl_keep isl_set *set,
3706                 enum isl_dim_type type, unsigned pos);
3707         int isl_set_dim_has_upper_bound(__isl_keep isl_set *set,
3708                 enum isl_dim_type type, unsigned pos);
3710 =item * Space
3712 To check whether a set is a parameter domain, use this function:
3714         int isl_set_is_params(__isl_keep isl_set *set);
3715         int isl_union_set_is_params(
3716                 __isl_keep isl_union_set *uset);
3718 =item * Wrapping
3720 The following functions check whether the space of the given
3721 (basic) set or relation range is a wrapped relation.
3723         #include <isl/space.h>
3724         int isl_space_is_wrapping(
3725                 __isl_keep isl_space *space);
3726         int isl_space_domain_is_wrapping(
3727                 __isl_keep isl_space *space);
3728         int isl_space_range_is_wrapping(
3729                 __isl_keep isl_space *space);
3731         #include <isl/set.h>
3732         int isl_basic_set_is_wrapping(
3733                 __isl_keep isl_basic_set *bset);
3734         int isl_set_is_wrapping(__isl_keep isl_set *set);
3736         #include <isl/map.h>
3737         int isl_map_domain_is_wrapping(
3738                 __isl_keep isl_map *map);
3739         int isl_map_range_is_wrapping(
3740                 __isl_keep isl_map *map);
3742         #include <isl/val.h>
3743         int isl_multi_val_range_is_wrapping(
3744                 __isl_keep isl_multi_val *mv);
3746         #include <isl/aff.h>
3747         int isl_multi_aff_range_is_wrapping(
3748                 __isl_keep isl_multi_aff *ma);
3749         int isl_multi_pw_aff_range_is_wrapping(
3750                 __isl_keep isl_multi_pw_aff *mpa);
3751         int isl_multi_union_pw_aff_range_is_wrapping(
3752                 __isl_keep isl_multi_union_pw_aff *mupa);
3754 The input to C<isl_space_is_wrapping> should
3755 be the space of a set, while that of
3756 C<isl_space_domain_is_wrapping> and
3757 C<isl_space_range_is_wrapping> should be the space of a relation.
3759 =item * Internal Product
3761         int isl_basic_map_can_zip(
3762                 __isl_keep isl_basic_map *bmap);
3763         int isl_map_can_zip(__isl_keep isl_map *map);
3765 Check whether the product of domain and range of the given relation
3766 can be computed,
3767 i.e., whether both domain and range are nested relations.
3769 =item * Currying
3771         int isl_basic_map_can_curry(
3772                 __isl_keep isl_basic_map *bmap);
3773         int isl_map_can_curry(__isl_keep isl_map *map);
3775 Check whether the domain of the (basic) relation is a wrapped relation.
3777         int isl_basic_map_can_uncurry(
3778                 __isl_keep isl_basic_map *bmap);
3779         int isl_map_can_uncurry(__isl_keep isl_map *map);
3781 Check whether the range of the (basic) relation is a wrapped relation.
3783 =item * Special Values
3785         #include <isl/aff.h>
3786         int isl_aff_is_cst(__isl_keep isl_aff *aff);
3787         int isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
3789 Check whether the given expression is a constant.
3791         #include <isl/aff.h>
3792         int isl_aff_is_nan(__isl_keep isl_aff *aff);
3793         int isl_pw_aff_involves_nan(__isl_keep isl_pw_aff *pa);
3795 Check whether the given expression is equal to or involves NaN.
3797         #include <isl/aff.h>
3798         int isl_aff_plain_is_zero(__isl_keep isl_aff *aff);
3800 Check whether the affine expression is obviously zero.
3802 =back
3804 =head3 Binary Properties
3806 =over
3808 =item * Equality
3810 The following functions check whether two objects
3811 represent the same set, relation or function.
3812 The C<plain> variants only return true if the objects
3813 are obviously the same.  That is, they may return false
3814 even if the objects are the same, but they will never
3815 return true if the objects are not the same.
3817         #include <isl/set.h>
3818         int isl_basic_set_plain_is_equal(
3819                 __isl_keep isl_basic_set *bset1,
3820                 __isl_keep isl_basic_set *bset2);
3821         int isl_set_plain_is_equal(__isl_keep isl_set *set1,
3822                 __isl_keep isl_set *set2);
3823         int isl_set_is_equal(__isl_keep isl_set *set1,
3824                 __isl_keep isl_set *set2);
3826         #include <isl/map.h>
3827         int isl_basic_map_is_equal(
3828                 __isl_keep isl_basic_map *bmap1,
3829                 __isl_keep isl_basic_map *bmap2);
3830         int isl_map_is_equal(__isl_keep isl_map *map1,
3831                 __isl_keep isl_map *map2);
3832         int isl_map_plain_is_equal(__isl_keep isl_map *map1,
3833                 __isl_keep isl_map *map2);
3835         #include <isl/union_set.h>
3836         int isl_union_set_is_equal(
3837                 __isl_keep isl_union_set *uset1,
3838                 __isl_keep isl_union_set *uset2);
3840         #include <isl/union_map.h>
3841         int isl_union_map_is_equal(
3842                 __isl_keep isl_union_map *umap1,
3843                 __isl_keep isl_union_map *umap2);
3845         #include <isl/aff.h>
3846         int isl_aff_plain_is_equal(__isl_keep isl_aff *aff1,
3847                 __isl_keep isl_aff *aff2);
3848         int isl_multi_aff_plain_is_equal(
3849                 __isl_keep isl_multi_aff *maff1,
3850                 __isl_keep isl_multi_aff *maff2);
3851         int isl_pw_aff_plain_is_equal(
3852                 __isl_keep isl_pw_aff *pwaff1,
3853                 __isl_keep isl_pw_aff *pwaff2);
3854         int isl_pw_multi_aff_plain_is_equal(
3855                 __isl_keep isl_pw_multi_aff *pma1,
3856                 __isl_keep isl_pw_multi_aff *pma2);
3857         int isl_multi_pw_aff_plain_is_equal(
3858                 __isl_keep isl_multi_pw_aff *mpa1,
3859                 __isl_keep isl_multi_pw_aff *mpa2);
3860         int isl_multi_pw_aff_is_equal(
3861                 __isl_keep isl_multi_pw_aff *mpa1,
3862                 __isl_keep isl_multi_pw_aff *mpa2);
3863         int isl_union_pw_aff_plain_is_equal(
3864                 __isl_keep isl_union_pw_aff *upa1,
3865                 __isl_keep isl_union_pw_aff *upa2);
3866         int isl_union_pw_multi_aff_plain_is_equal(
3867                 __isl_keep isl_union_pw_multi_aff *upma1,
3868                 __isl_keep isl_union_pw_multi_aff *upma2);
3869         int isl_multi_union_pw_aff_plain_is_equal(
3870                 __isl_keep isl_multi_union_pw_aff *mupa1,
3871                 __isl_keep isl_multi_union_pw_aff *mupa2);
3873         #include <isl/polynomial.h>
3874         int isl_union_pw_qpolynomial_plain_is_equal(
3875                 __isl_keep isl_union_pw_qpolynomial *upwqp1,
3876                 __isl_keep isl_union_pw_qpolynomial *upwqp2);
3877         int isl_union_pw_qpolynomial_fold_plain_is_equal(
3878                 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
3879                 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
3881 =item * Disjointness
3883         #include <isl/set.h>
3884         int isl_basic_set_is_disjoint(
3885                 __isl_keep isl_basic_set *bset1,
3886                 __isl_keep isl_basic_set *bset2);
3887         int isl_set_plain_is_disjoint(__isl_keep isl_set *set1,
3888                 __isl_keep isl_set *set2);
3889         int isl_set_is_disjoint(__isl_keep isl_set *set1,
3890                 __isl_keep isl_set *set2);
3892         #include <isl/map.h>
3893         int isl_basic_map_is_disjoint(
3894                 __isl_keep isl_basic_map *bmap1,
3895                 __isl_keep isl_basic_map *bmap2);
3896         int isl_map_is_disjoint(__isl_keep isl_map *map1,
3897                 __isl_keep isl_map *map2);
3899         #include <isl/union_set.h>
3900         int isl_union_set_is_disjoint(
3901                 __isl_keep isl_union_set *uset1,
3902                 __isl_keep isl_union_set *uset2);
3904         #include <isl/union_map.h>
3905         int isl_union_map_is_disjoint(
3906                 __isl_keep isl_union_map *umap1,
3907                 __isl_keep isl_union_map *umap2);
3909 =item * Subset
3911         int isl_basic_set_is_subset(
3912                 __isl_keep isl_basic_set *bset1,
3913                 __isl_keep isl_basic_set *bset2);
3914         int isl_set_is_subset(__isl_keep isl_set *set1,
3915                 __isl_keep isl_set *set2);
3916         int isl_set_is_strict_subset(
3917                 __isl_keep isl_set *set1,
3918                 __isl_keep isl_set *set2);
3919         int isl_union_set_is_subset(
3920                 __isl_keep isl_union_set *uset1,
3921                 __isl_keep isl_union_set *uset2);
3922         int isl_union_set_is_strict_subset(
3923                 __isl_keep isl_union_set *uset1,
3924                 __isl_keep isl_union_set *uset2);
3925         int isl_basic_map_is_subset(
3926                 __isl_keep isl_basic_map *bmap1,
3927                 __isl_keep isl_basic_map *bmap2);
3928         int isl_basic_map_is_strict_subset(
3929                 __isl_keep isl_basic_map *bmap1,
3930                 __isl_keep isl_basic_map *bmap2);
3931         int isl_map_is_subset(
3932                 __isl_keep isl_map *map1,
3933                 __isl_keep isl_map *map2);
3934         int isl_map_is_strict_subset(
3935                 __isl_keep isl_map *map1,
3936                 __isl_keep isl_map *map2);
3937         int isl_union_map_is_subset(
3938                 __isl_keep isl_union_map *umap1,
3939                 __isl_keep isl_union_map *umap2);
3940         int isl_union_map_is_strict_subset(
3941                 __isl_keep isl_union_map *umap1,
3942                 __isl_keep isl_union_map *umap2);
3944 Check whether the first argument is a (strict) subset of the
3945 second argument.
3947 =item * Order
3949 Every comparison function returns a negative value if the first
3950 argument is considered smaller than the second, a positive value
3951 if the first argument is considered greater and zero if the two
3952 constraints are considered the same by the comparison criterion.
3954         #include <isl/constraint.h>
3955         int isl_constraint_plain_cmp(
3956                 __isl_keep isl_constraint *c1,
3957                 __isl_keep isl_constraint *c2);
3959 This function is useful for sorting C<isl_constraint>s.
3960 The order depends on the internal representation of the inputs.
3961 The order is fixed over different calls to the function (assuming
3962 the internal representation of the inputs has not changed), but may
3963 change over different versions of C<isl>.
3965         #include <isl/constraint.h>
3966         int isl_constraint_cmp_last_non_zero(
3967                 __isl_keep isl_constraint *c1,
3968                 __isl_keep isl_constraint *c2);
3970 This function can be used to sort constraints that live in the same
3971 local space.  Constraints that involve ``earlier'' dimensions or
3972 that have a smaller coefficient for the shared latest dimension
3973 are considered smaller than other constraints.
3974 This function only defines a B<partial> order.
3976         #include <isl/set.h>
3977         int isl_set_plain_cmp(__isl_keep isl_set *set1,
3978                 __isl_keep isl_set *set2);
3980 This function is useful for sorting C<isl_set>s.
3981 The order depends on the internal representation of the inputs.
3982 The order is fixed over different calls to the function (assuming
3983 the internal representation of the inputs has not changed), but may
3984 change over different versions of C<isl>.
3986         #include <isl/aff.h>
3987         int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
3988                 __isl_keep isl_pw_aff *pa2);
3990 The function C<isl_pw_aff_plain_cmp> can be used to sort
3991 C<isl_pw_aff>s.  The order is not strictly defined.
3992 The current order sorts expressions that only involve
3993 earlier dimensions before those that involve later dimensions.
3995 =back
3997 =head2 Unary Operations
3999 =over
4001 =item * Complement
4003         __isl_give isl_set *isl_set_complement(
4004                 __isl_take isl_set *set);
4005         __isl_give isl_map *isl_map_complement(
4006                 __isl_take isl_map *map);
4008 =item * Inverse map
4010         #include <isl/space.h>
4011         __isl_give isl_space *isl_space_reverse(
4012                 __isl_take isl_space *space);
4014         #include <isl/map.h>
4015         __isl_give isl_basic_map *isl_basic_map_reverse(
4016                 __isl_take isl_basic_map *bmap);
4017         __isl_give isl_map *isl_map_reverse(
4018                 __isl_take isl_map *map);
4020         #include <isl/union_map.h>
4021         __isl_give isl_union_map *isl_union_map_reverse(
4022                 __isl_take isl_union_map *umap);
4024 =item * Projection
4026         #include <isl/space.h>
4027         __isl_give isl_space *isl_space_domain(
4028                 __isl_take isl_space *space);
4029         __isl_give isl_space *isl_space_range(
4030                 __isl_take isl_space *space);
4031         __isl_give isl_space *isl_space_params(
4032                 __isl_take isl_space *space);
4034         #include <isl/local_space.h>
4035         __isl_give isl_local_space *isl_local_space_domain(
4036                 __isl_take isl_local_space *ls);
4037         __isl_give isl_local_space *isl_local_space_range(
4038                 __isl_take isl_local_space *ls);
4040         #include <isl/set.h>
4041         __isl_give isl_basic_set *isl_basic_set_project_out(
4042                 __isl_take isl_basic_set *bset,
4043                 enum isl_dim_type type, unsigned first, unsigned n);
4044         __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
4045                 enum isl_dim_type type, unsigned first, unsigned n);
4046         __isl_give isl_basic_set *isl_basic_set_params(
4047                 __isl_take isl_basic_set *bset);
4048         __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
4050         #include <isl/map.h>
4051         __isl_give isl_basic_map *isl_basic_map_project_out(
4052                 __isl_take isl_basic_map *bmap,
4053                 enum isl_dim_type type, unsigned first, unsigned n);
4054         __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
4055                 enum isl_dim_type type, unsigned first, unsigned n);
4056         __isl_give isl_basic_set *isl_basic_map_domain(
4057                 __isl_take isl_basic_map *bmap);
4058         __isl_give isl_basic_set *isl_basic_map_range(
4059                 __isl_take isl_basic_map *bmap);
4060         __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
4061         __isl_give isl_set *isl_map_domain(
4062                 __isl_take isl_map *bmap);
4063         __isl_give isl_set *isl_map_range(
4064                 __isl_take isl_map *map);
4066         #include <isl/union_set.h>
4067         __isl_give isl_union_set *isl_union_set_project_out(
4068                 __isl_take isl_union_set *uset,
4069                 enum isl_dim_type type,
4070                 unsigned first, unsigned n);
4071         __isl_give isl_set *isl_union_set_params(
4072                 __isl_take isl_union_set *uset);
4074 The function C<isl_union_set_project_out> can only project out
4075 parameters.
4077         #include <isl/union_map.h>
4078         __isl_give isl_union_map *isl_union_map_project_out(
4079                 __isl_take isl_union_map *umap,
4080                 enum isl_dim_type type, unsigned first, unsigned n);
4081         __isl_give isl_set *isl_union_map_params(
4082                 __isl_take isl_union_map *umap);
4083         __isl_give isl_union_set *isl_union_map_domain(
4084                 __isl_take isl_union_map *umap);
4085         __isl_give isl_union_set *isl_union_map_range(
4086                 __isl_take isl_union_map *umap);
4088 The function C<isl_union_map_project_out> can only project out
4089 parameters.
4091         #include <isl/aff.h>
4092         __isl_give isl_aff *isl_aff_project_domain_on_params(
4093                 __isl_take isl_aff *aff);
4094         __isl_give isl_pw_multi_aff *
4095         isl_pw_multi_aff_project_domain_on_params(
4096                 __isl_take isl_pw_multi_aff *pma);
4097         __isl_give isl_set *isl_pw_aff_domain(
4098                 __isl_take isl_pw_aff *pwaff);
4099         __isl_give isl_set *isl_pw_multi_aff_domain(
4100                 __isl_take isl_pw_multi_aff *pma);
4101         __isl_give isl_set *isl_multi_pw_aff_domain(
4102                 __isl_take isl_multi_pw_aff *mpa);
4103         __isl_give isl_union_set *isl_union_pw_aff_domain(
4104                 __isl_take isl_union_pw_aff *upa);
4105         __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
4106                 __isl_take isl_union_pw_multi_aff *upma);
4107         __isl_give isl_union_set *
4108         isl_multi_union_pw_aff_domain(
4109                 __isl_take isl_multi_union_pw_aff *mupa);
4110         __isl_give isl_set *isl_pw_aff_params(
4111                 __isl_take isl_pw_aff *pwa);
4113 The function C<isl_multi_union_pw_aff_domain> requires its
4114 input to have at least one set dimension.
4116         #include <isl/polynomial.h>
4117         __isl_give isl_qpolynomial *
4118         isl_qpolynomial_project_domain_on_params(
4119                 __isl_take isl_qpolynomial *qp);
4120         __isl_give isl_pw_qpolynomial *
4121         isl_pw_qpolynomial_project_domain_on_params(
4122                 __isl_take isl_pw_qpolynomial *pwqp);
4123         __isl_give isl_pw_qpolynomial_fold *
4124         isl_pw_qpolynomial_fold_project_domain_on_params(
4125                 __isl_take isl_pw_qpolynomial_fold *pwf);
4126         __isl_give isl_set *isl_pw_qpolynomial_domain(
4127                 __isl_take isl_pw_qpolynomial *pwqp);
4128         __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
4129                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4130         __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
4131                 __isl_take isl_union_pw_qpolynomial *upwqp);
4133         #include <isl/space.h>
4134         __isl_give isl_space *isl_space_domain_map(
4135                 __isl_take isl_space *space);
4136         __isl_give isl_space *isl_space_range_map(
4137                 __isl_take isl_space *space);
4139         #include <isl/map.h>
4140         __isl_give isl_map *isl_set_wrapped_domain_map(
4141                 __isl_take isl_set *set);
4142         __isl_give isl_basic_map *isl_basic_map_domain_map(
4143                 __isl_take isl_basic_map *bmap);
4144         __isl_give isl_basic_map *isl_basic_map_range_map(
4145                 __isl_take isl_basic_map *bmap);
4146         __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
4147         __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
4149         #include <isl/union_map.h>
4150         __isl_give isl_union_map *isl_union_map_domain_map(
4151                 __isl_take isl_union_map *umap);
4152         __isl_give isl_union_pw_multi_aff *
4153         isl_union_map_domain_map_union_pw_multi_aff(
4154                 __isl_take isl_union_map *umap);
4155         __isl_give isl_union_map *isl_union_map_range_map(
4156                 __isl_take isl_union_map *umap);
4157         __isl_give isl_union_map *
4158         isl_union_set_wrapped_domain_map(
4159                 __isl_take isl_union_set *uset);
4161 The functions above construct a (basic, regular or union) relation
4162 that maps (a wrapped version of) the input relation to its domain or range.
4163 C<isl_set_wrapped_domain_map> maps the input set to the domain
4164 of its wrapped relation.
4166 =item * Elimination
4168         __isl_give isl_basic_set *isl_basic_set_eliminate(
4169                 __isl_take isl_basic_set *bset,
4170                 enum isl_dim_type type,
4171                 unsigned first, unsigned n);
4172         __isl_give isl_set *isl_set_eliminate(
4173                 __isl_take isl_set *set, enum isl_dim_type type,
4174                 unsigned first, unsigned n);
4175         __isl_give isl_basic_map *isl_basic_map_eliminate(
4176                 __isl_take isl_basic_map *bmap,
4177                 enum isl_dim_type type,
4178                 unsigned first, unsigned n);
4179         __isl_give isl_map *isl_map_eliminate(
4180                 __isl_take isl_map *map, enum isl_dim_type type,
4181                 unsigned first, unsigned n);
4183 Eliminate the coefficients for the given dimensions from the constraints,
4184 without removing the dimensions.
4186 =item * Constructing a set from a parameter domain
4188 A zero-dimensional space or (basic) set can be constructed
4189 on a given parameter domain using the following functions.
4191         #include <isl/space.h>
4192         __isl_give isl_space *isl_space_set_from_params(
4193                 __isl_take isl_space *space);
4195         #include <isl/set.h>
4196         __isl_give isl_basic_set *isl_basic_set_from_params(
4197                 __isl_take isl_basic_set *bset);
4198         __isl_give isl_set *isl_set_from_params(
4199                 __isl_take isl_set *set);
4201 =item * Constructing a relation from a set
4203 Create a relation with the given set as domain or range.
4204 The range or domain of the created relation is a zero-dimensional
4205 flat anonymous space.
4207         #include <isl/space.h>
4208         __isl_give isl_space *isl_space_from_domain(
4209                 __isl_take isl_space *space);
4210         __isl_give isl_space *isl_space_from_range(
4211                 __isl_take isl_space *space);
4212         __isl_give isl_space *isl_space_map_from_set(
4213                 __isl_take isl_space *space);
4214         __isl_give isl_space *isl_space_map_from_domain_and_range(
4215                 __isl_take isl_space *domain,
4216                 __isl_take isl_space *range);
4218         #include <isl/local_space.h>
4219         __isl_give isl_local_space *isl_local_space_from_domain(
4220                 __isl_take isl_local_space *ls);
4222         #include <isl/map.h>
4223         __isl_give isl_map *isl_map_from_domain(
4224                 __isl_take isl_set *set);
4225         __isl_give isl_map *isl_map_from_range(
4226                 __isl_take isl_set *set);
4228         #include <isl/val.h>
4229         __isl_give isl_multi_val *isl_multi_val_from_range(
4230                 __isl_take isl_multi_val *mv);
4232         #include <isl/aff.h>
4233         __isl_give isl_multi_aff *isl_multi_aff_from_range(
4234                 __isl_take isl_multi_aff *ma);
4235         __isl_give isl_pw_aff *isl_pw_aff_from_range(
4236                 __isl_take isl_pw_aff *pwa);
4237         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
4238                 __isl_take isl_multi_pw_aff *mpa);
4239         __isl_give isl_multi_union_pw_aff *
4240         isl_multi_union_pw_aff_from_range(
4241                 __isl_take isl_multi_union_pw_aff *mupa);
4242         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
4243                 __isl_take isl_set *set);
4244         __isl_give isl_union_pw_multi_aff *
4245         isl_union_pw_multi_aff_from_domain(
4246                 __isl_take isl_union_set *uset);
4248 =item * Slicing
4250         #include <isl/set.h>
4251         __isl_give isl_basic_set *isl_basic_set_fix_si(
4252                 __isl_take isl_basic_set *bset,
4253                 enum isl_dim_type type, unsigned pos, int value);
4254         __isl_give isl_basic_set *isl_basic_set_fix_val(
4255                 __isl_take isl_basic_set *bset,
4256                 enum isl_dim_type type, unsigned pos,
4257                 __isl_take isl_val *v);
4258         __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
4259                 enum isl_dim_type type, unsigned pos, int value);
4260         __isl_give isl_set *isl_set_fix_val(
4261                 __isl_take isl_set *set,
4262                 enum isl_dim_type type, unsigned pos,
4263                 __isl_take isl_val *v);
4265         #include <isl/map.h>
4266         __isl_give isl_basic_map *isl_basic_map_fix_si(
4267                 __isl_take isl_basic_map *bmap,
4268                 enum isl_dim_type type, unsigned pos, int value);
4269         __isl_give isl_basic_map *isl_basic_map_fix_val(
4270                 __isl_take isl_basic_map *bmap,
4271                 enum isl_dim_type type, unsigned pos,
4272                 __isl_take isl_val *v);
4273         __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
4274                 enum isl_dim_type type, unsigned pos, int value);
4275         __isl_give isl_map *isl_map_fix_val(
4276                 __isl_take isl_map *map,
4277                 enum isl_dim_type type, unsigned pos,
4278                 __isl_take isl_val *v);
4280         #include <isl/aff.h>
4281         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
4282                 __isl_take isl_pw_multi_aff *pma,
4283                 enum isl_dim_type type, unsigned pos, int value);
4285         #include <isl/polynomial.h>
4286         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
4287                 __isl_take isl_pw_qpolynomial *pwqp,
4288                 enum isl_dim_type type, unsigned n,
4289                 __isl_take isl_val *v);
4291 Intersect the set, relation or function domain
4292 with the hyperplane where the given
4293 dimension has the fixed given value.
4295         __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
4296                 __isl_take isl_basic_map *bmap,
4297                 enum isl_dim_type type, unsigned pos, int value);
4298         __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
4299                 __isl_take isl_basic_map *bmap,
4300                 enum isl_dim_type type, unsigned pos, int value);
4301         __isl_give isl_set *isl_set_lower_bound_si(
4302                 __isl_take isl_set *set,
4303                 enum isl_dim_type type, unsigned pos, int value);
4304         __isl_give isl_set *isl_set_lower_bound_val(
4305                 __isl_take isl_set *set,
4306                 enum isl_dim_type type, unsigned pos,
4307                 __isl_take isl_val *value);
4308         __isl_give isl_map *isl_map_lower_bound_si(
4309                 __isl_take isl_map *map,
4310                 enum isl_dim_type type, unsigned pos, int value);
4311         __isl_give isl_set *isl_set_upper_bound_si(
4312                 __isl_take isl_set *set,
4313                 enum isl_dim_type type, unsigned pos, int value);
4314         __isl_give isl_set *isl_set_upper_bound_val(
4315                 __isl_take isl_set *set,
4316                 enum isl_dim_type type, unsigned pos,
4317                 __isl_take isl_val *value);
4318         __isl_give isl_map *isl_map_upper_bound_si(
4319                 __isl_take isl_map *map,
4320                 enum isl_dim_type type, unsigned pos, int value);
4322 Intersect the set or relation with the half-space where the given
4323 dimension has a value bounded by the fixed given integer value.
4325         __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
4326                 enum isl_dim_type type1, int pos1,
4327                 enum isl_dim_type type2, int pos2);
4328         __isl_give isl_basic_map *isl_basic_map_equate(
4329                 __isl_take isl_basic_map *bmap,
4330                 enum isl_dim_type type1, int pos1,
4331                 enum isl_dim_type type2, int pos2);
4332         __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
4333                 enum isl_dim_type type1, int pos1,
4334                 enum isl_dim_type type2, int pos2);
4336 Intersect the set or relation with the hyperplane where the given
4337 dimensions are equal to each other.
4339         __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4340                 enum isl_dim_type type1, int pos1,
4341                 enum isl_dim_type type2, int pos2);
4343 Intersect the relation with the hyperplane where the given
4344 dimensions have opposite values.
4346         __isl_give isl_map *isl_map_order_le(
4347                 __isl_take isl_map *map,
4348                 enum isl_dim_type type1, int pos1,
4349                 enum isl_dim_type type2, int pos2);
4350         __isl_give isl_basic_map *isl_basic_map_order_ge(
4351                 __isl_take isl_basic_map *bmap,
4352                 enum isl_dim_type type1, int pos1,
4353                 enum isl_dim_type type2, int pos2);
4354         __isl_give isl_map *isl_map_order_ge(
4355                 __isl_take isl_map *map,
4356                 enum isl_dim_type type1, int pos1,
4357                 enum isl_dim_type type2, int pos2);
4358         __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4359                 enum isl_dim_type type1, int pos1,
4360                 enum isl_dim_type type2, int pos2);
4361         __isl_give isl_basic_map *isl_basic_map_order_gt(
4362                 __isl_take isl_basic_map *bmap,
4363                 enum isl_dim_type type1, int pos1,
4364                 enum isl_dim_type type2, int pos2);
4365         __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4366                 enum isl_dim_type type1, int pos1,
4367                 enum isl_dim_type type2, int pos2);
4369 Intersect the relation with the half-space where the given
4370 dimensions satisfy the given ordering.
4372 =item * Locus
4374         #include <isl/aff.h>
4375         __isl_give isl_basic_set *isl_aff_zero_basic_set(
4376                 __isl_take isl_aff *aff);
4377         __isl_give isl_basic_set *isl_aff_neg_basic_set(
4378                 __isl_take isl_aff *aff);
4379         __isl_give isl_set *isl_pw_aff_pos_set(
4380                 __isl_take isl_pw_aff *pa);
4381         __isl_give isl_set *isl_pw_aff_nonneg_set(
4382                 __isl_take isl_pw_aff *pwaff);
4383         __isl_give isl_set *isl_pw_aff_zero_set(
4384                 __isl_take isl_pw_aff *pwaff);
4385         __isl_give isl_set *isl_pw_aff_non_zero_set(
4386                 __isl_take isl_pw_aff *pwaff);
4387         __isl_give isl_union_set *
4388         isl_union_pw_aff_zero_union_set(
4389                 __isl_take isl_union_pw_aff *upa);
4390         __isl_give isl_union_set *
4391         isl_multi_union_pw_aff_zero_union_set(
4392                 __isl_take isl_multi_union_pw_aff *mupa);
4394 The function C<isl_aff_neg_basic_set> returns a basic set
4395 containing those elements in the domain space
4396 of C<aff> where C<aff> is negative.
4397 The function C<isl_pw_aff_nonneg_set> returns a set
4398 containing those elements in the domain
4399 of C<pwaff> where C<pwaff> is non-negative.
4400 The function C<isl_multi_union_pw_aff_zero_union_set>
4401 returns a union set containing those elements
4402 in the domains of its elements where they are all zero.
4404 =item * Identity
4406         __isl_give isl_map *isl_set_identity(
4407                 __isl_take isl_set *set);
4408         __isl_give isl_union_map *isl_union_set_identity(
4409                 __isl_take isl_union_set *uset);
4410         __isl_give isl_union_pw_multi_aff *
4411         isl_union_set_identity_union_pw_multi_aff(
4412                 __isl_take isl_union_set *uset);
4414 Construct an identity relation on the given (union) set.
4416 =item * Function Extraction
4418 A piecewise quasi affine expression that is equal to 1 on a set
4419 and 0 outside the set can be created using the following function.
4421         #include <isl/aff.h>
4422         __isl_give isl_pw_aff *isl_set_indicator_function(
4423                 __isl_take isl_set *set);
4425 A piecewise multiple quasi affine expression can be extracted
4426 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4427 and the C<isl_map> is single-valued.
4428 In case of a conversion from an C<isl_union_map>
4429 to an C<isl_union_pw_multi_aff>, these properties need to hold
4430 in each domain space.
4431 A conversion to a C<isl_multi_union_pw_aff> additionally
4432 requires that the input is non-empty and involves only a single
4433 range space.
4435         #include <isl/aff.h>
4436         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4437                 __isl_take isl_set *set);
4438         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4439                 __isl_take isl_map *map);
4441         __isl_give isl_union_pw_multi_aff *
4442         isl_union_pw_multi_aff_from_union_set(
4443                 __isl_take isl_union_set *uset);
4444         __isl_give isl_union_pw_multi_aff *
4445         isl_union_pw_multi_aff_from_union_map(
4446                 __isl_take isl_union_map *umap);
4448         __isl_give isl_multi_union_pw_aff *
4449         isl_multi_union_pw_aff_from_union_map(
4450                 __isl_take isl_union_map *umap);
4452 =item * Deltas
4454         __isl_give isl_basic_set *isl_basic_map_deltas(
4455                 __isl_take isl_basic_map *bmap);
4456         __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
4457         __isl_give isl_union_set *isl_union_map_deltas(
4458                 __isl_take isl_union_map *umap);
4460 These functions return a (basic) set containing the differences
4461 between image elements and corresponding domain elements in the input.
4463         __isl_give isl_basic_map *isl_basic_map_deltas_map(
4464                 __isl_take isl_basic_map *bmap);
4465         __isl_give isl_map *isl_map_deltas_map(
4466                 __isl_take isl_map *map);
4467         __isl_give isl_union_map *isl_union_map_deltas_map(
4468                 __isl_take isl_union_map *umap);
4470 The functions above construct a (basic, regular or union) relation
4471 that maps (a wrapped version of) the input relation to its delta set.
4473 =item * Coalescing
4475 Simplify the representation of a set, relation or functions by trying
4476 to combine pairs of basic sets or relations into a single
4477 basic set or relation.
4479         #include <isl/set.h>
4480         __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
4482         #include <isl/map.h>
4483         __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
4485         #include <isl/union_set.h>
4486         __isl_give isl_union_set *isl_union_set_coalesce(
4487                 __isl_take isl_union_set *uset);
4489         #include <isl/union_map.h>
4490         __isl_give isl_union_map *isl_union_map_coalesce(
4491                 __isl_take isl_union_map *umap);
4493         #include <isl/aff.h>
4494         __isl_give isl_pw_aff *isl_pw_aff_coalesce(
4495                 __isl_take isl_pw_aff *pwqp);
4496         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
4497                 __isl_take isl_pw_multi_aff *pma);
4498         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
4499                 __isl_take isl_multi_pw_aff *mpa);
4500         __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
4501                 __isl_take isl_union_pw_aff *upa);
4502         __isl_give isl_union_pw_multi_aff *
4503         isl_union_pw_multi_aff_coalesce(
4504                 __isl_take isl_union_pw_multi_aff *upma);
4506         #include <isl/polynomial.h>
4507         __isl_give isl_pw_qpolynomial_fold *
4508         isl_pw_qpolynomial_fold_coalesce(
4509                 __isl_take isl_pw_qpolynomial_fold *pwf);
4510         __isl_give isl_union_pw_qpolynomial *
4511         isl_union_pw_qpolynomial_coalesce(
4512                 __isl_take isl_union_pw_qpolynomial *upwqp);
4513         __isl_give isl_union_pw_qpolynomial_fold *
4514         isl_union_pw_qpolynomial_fold_coalesce(
4515                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4517 One of the methods for combining pairs of basic sets or relations
4518 can result in coefficients that are much larger than those that appear
4519 in the constraints of the input.  By default, the coefficients are
4520 not allowed to grow larger, but this can be changed by unsetting
4521 the following option.
4523         int isl_options_set_coalesce_bounded_wrapping(
4524                 isl_ctx *ctx, int val);
4525         int isl_options_get_coalesce_bounded_wrapping(
4526                 isl_ctx *ctx);
4528 =item * Detecting equalities
4530         __isl_give isl_basic_set *isl_basic_set_detect_equalities(
4531                 __isl_take isl_basic_set *bset);
4532         __isl_give isl_basic_map *isl_basic_map_detect_equalities(
4533                 __isl_take isl_basic_map *bmap);
4534         __isl_give isl_set *isl_set_detect_equalities(
4535                 __isl_take isl_set *set);
4536         __isl_give isl_map *isl_map_detect_equalities(
4537                 __isl_take isl_map *map);
4538         __isl_give isl_union_set *isl_union_set_detect_equalities(
4539                 __isl_take isl_union_set *uset);
4540         __isl_give isl_union_map *isl_union_map_detect_equalities(
4541                 __isl_take isl_union_map *umap);
4543 Simplify the representation of a set or relation by detecting implicit
4544 equalities.
4546 =item * Removing redundant constraints
4548         #include <isl/set.h>
4549         __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
4550                 __isl_take isl_basic_set *bset);
4551         __isl_give isl_set *isl_set_remove_redundancies(
4552                 __isl_take isl_set *set);
4554         #include <isl/union_set.h>
4555         __isl_give isl_union_set *
4556         isl_union_set_remove_redundancies(
4557                 __isl_take isl_union_set *uset);
4559         #include <isl/map.h>
4560         __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
4561                 __isl_take isl_basic_map *bmap);
4562         __isl_give isl_map *isl_map_remove_redundancies(
4563                 __isl_take isl_map *map);
4565         #include <isl/union_map.h>
4566         __isl_give isl_union_map *
4567         isl_union_map_remove_redundancies(
4568                 __isl_take isl_union_map *umap);
4570 =item * Convex hull
4572         __isl_give isl_basic_set *isl_set_convex_hull(
4573                 __isl_take isl_set *set);
4574         __isl_give isl_basic_map *isl_map_convex_hull(
4575                 __isl_take isl_map *map);
4577 If the input set or relation has any existentially quantified
4578 variables, then the result of these operations is currently undefined.
4580 =item * Simple hull
4582         #include <isl/set.h>
4583         __isl_give isl_basic_set *
4584         isl_set_unshifted_simple_hull(
4585                 __isl_take isl_set *set);
4586         __isl_give isl_basic_set *isl_set_simple_hull(
4587                 __isl_take isl_set *set);
4588         __isl_give isl_basic_set *
4589         isl_set_unshifted_simple_hull_from_set_list(
4590                 __isl_take isl_set *set,
4591                 __isl_take isl_set_list *list);
4593         #include <isl/map.h>
4594         __isl_give isl_basic_map *
4595         isl_map_unshifted_simple_hull(
4596                 __isl_take isl_map *map);
4597         __isl_give isl_basic_map *isl_map_simple_hull(
4598                 __isl_take isl_map *map);
4599         __isl_give isl_basic_map *
4600         isl_map_unshifted_simple_hull_from_map_list(
4601                 __isl_take isl_map *map,
4602                 __isl_take isl_map_list *list);
4604         #include <isl/union_map.h>
4605         __isl_give isl_union_map *isl_union_map_simple_hull(
4606                 __isl_take isl_union_map *umap);
4608 These functions compute a single basic set or relation
4609 that contains the whole input set or relation.
4610 In particular, the output is described by translates
4611 of the constraints describing the basic sets or relations in the input.
4612 In case of C<isl_set_unshifted_simple_hull>, only the original
4613 constraints are used, without any translation.
4614 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
4615 C<isl_map_unshifted_simple_hull_from_map_list>, the
4616 constraints are taken from the elements of the second argument.
4618 =begin latex
4620 (See \autoref{s:simple hull}.)
4622 =end latex
4624 =item * Affine hull
4626         __isl_give isl_basic_set *isl_basic_set_affine_hull(
4627                 __isl_take isl_basic_set *bset);
4628         __isl_give isl_basic_set *isl_set_affine_hull(
4629                 __isl_take isl_set *set);
4630         __isl_give isl_union_set *isl_union_set_affine_hull(
4631                 __isl_take isl_union_set *uset);
4632         __isl_give isl_basic_map *isl_basic_map_affine_hull(
4633                 __isl_take isl_basic_map *bmap);
4634         __isl_give isl_basic_map *isl_map_affine_hull(
4635                 __isl_take isl_map *map);
4636         __isl_give isl_union_map *isl_union_map_affine_hull(
4637                 __isl_take isl_union_map *umap);
4639 In case of union sets and relations, the affine hull is computed
4640 per space.
4642 =item * Polyhedral hull
4644         __isl_give isl_basic_set *isl_set_polyhedral_hull(
4645                 __isl_take isl_set *set);
4646         __isl_give isl_basic_map *isl_map_polyhedral_hull(
4647                 __isl_take isl_map *map);
4648         __isl_give isl_union_set *isl_union_set_polyhedral_hull(
4649                 __isl_take isl_union_set *uset);
4650         __isl_give isl_union_map *isl_union_map_polyhedral_hull(
4651                 __isl_take isl_union_map *umap);
4653 These functions compute a single basic set or relation
4654 not involving any existentially quantified variables
4655 that contains the whole input set or relation.
4656 In case of union sets and relations, the polyhedral hull is computed
4657 per space.
4659 =item * Other approximations
4661         #include <isl/set.h>
4662         __isl_give isl_basic_set *
4663         isl_basic_set_drop_constraints_involving_dims(
4664                 __isl_take isl_basic_set *bset,
4665                 enum isl_dim_type type,
4666                 unsigned first, unsigned n);
4667         __isl_give isl_basic_set *
4668         isl_basic_set_drop_constraints_not_involving_dims(
4669                 __isl_take isl_basic_set *bset,
4670                 enum isl_dim_type type,
4671                 unsigned first, unsigned n);
4672         __isl_give isl_set *
4673         isl_set_drop_constraints_involving_dims(
4674                 __isl_take isl_set *set,
4675                 enum isl_dim_type type,
4676                 unsigned first, unsigned n);
4678         #include <isl/map.h>
4679         __isl_give isl_basic_map *
4680         isl_basic_map_drop_constraints_involving_dims(
4681                 __isl_take isl_basic_map *bmap,
4682                 enum isl_dim_type type,
4683                 unsigned first, unsigned n);
4684         __isl_give isl_map *
4685         isl_map_drop_constraints_involving_dims(
4686                 __isl_take isl_map *map,
4687                 enum isl_dim_type type,
4688                 unsigned first, unsigned n);
4690 These functions drop any constraints (not) involving the specified dimensions.
4691 Note that the result depends on the representation of the input.
4693         #include <isl/polynomial.h>
4694         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
4695                 __isl_take isl_pw_qpolynomial *pwqp, int sign);
4696         __isl_give isl_union_pw_qpolynomial *
4697         isl_union_pw_qpolynomial_to_polynomial(
4698                 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
4700 Approximate each quasipolynomial by a polynomial.  If C<sign> is positive,
4701 the polynomial will be an overapproximation.  If C<sign> is negative,
4702 it will be an underapproximation.  If C<sign> is zero, the approximation
4703 will lie somewhere in between.
4705 =item * Feasibility
4707         __isl_give isl_basic_set *isl_basic_set_sample(
4708                 __isl_take isl_basic_set *bset);
4709         __isl_give isl_basic_set *isl_set_sample(
4710                 __isl_take isl_set *set);
4711         __isl_give isl_basic_map *isl_basic_map_sample(
4712                 __isl_take isl_basic_map *bmap);
4713         __isl_give isl_basic_map *isl_map_sample(
4714                 __isl_take isl_map *map);
4716 If the input (basic) set or relation is non-empty, then return
4717 a singleton subset of the input.  Otherwise, return an empty set.
4719 =item * Optimization
4721         #include <isl/ilp.h>
4722         __isl_give isl_val *isl_basic_set_max_val(
4723                 __isl_keep isl_basic_set *bset,
4724                 __isl_keep isl_aff *obj);
4725         __isl_give isl_val *isl_set_min_val(
4726                 __isl_keep isl_set *set,
4727                 __isl_keep isl_aff *obj);
4728         __isl_give isl_val *isl_set_max_val(
4729                 __isl_keep isl_set *set,
4730                 __isl_keep isl_aff *obj);
4732 Compute the minimum or maximum of the integer affine expression C<obj>
4733 over the points in C<set>, returning the result in C<opt>.
4734 The result is C<NULL> in case of an error, the optimal value in case
4735 there is one, negative infinity or infinity if the problem is unbounded and
4736 NaN if the problem is empty.
4738 =item * Parametric optimization
4740         __isl_give isl_pw_aff *isl_set_dim_min(
4741                 __isl_take isl_set *set, int pos);
4742         __isl_give isl_pw_aff *isl_set_dim_max(
4743                 __isl_take isl_set *set, int pos);
4744         __isl_give isl_pw_aff *isl_map_dim_max(
4745                 __isl_take isl_map *map, int pos);
4747 Compute the minimum or maximum of the given set or output dimension
4748 as a function of the parameters (and input dimensions), but independently
4749 of the other set or output dimensions.
4750 For lexicographic optimization, see L<"Lexicographic Optimization">.
4752 =item * Dual
4754 The following functions compute either the set of (rational) coefficient
4755 values of valid constraints for the given set or the set of (rational)
4756 values satisfying the constraints with coefficients from the given set.
4757 Internally, these two sets of functions perform essentially the
4758 same operations, except that the set of coefficients is assumed to
4759 be a cone, while the set of values may be any polyhedron.
4760 The current implementation is based on the Farkas lemma and
4761 Fourier-Motzkin elimination, but this may change or be made optional
4762 in future.  In particular, future implementations may use different
4763 dualization algorithms or skip the elimination step.
4765         __isl_give isl_basic_set *isl_basic_set_coefficients(
4766                 __isl_take isl_basic_set *bset);
4767         __isl_give isl_basic_set *isl_set_coefficients(
4768                 __isl_take isl_set *set);
4769         __isl_give isl_union_set *isl_union_set_coefficients(
4770                 __isl_take isl_union_set *bset);
4771         __isl_give isl_basic_set *isl_basic_set_solutions(
4772                 __isl_take isl_basic_set *bset);
4773         __isl_give isl_basic_set *isl_set_solutions(
4774                 __isl_take isl_set *set);
4775         __isl_give isl_union_set *isl_union_set_solutions(
4776                 __isl_take isl_union_set *bset);
4778 =item * Power
4780         __isl_give isl_map *isl_map_fixed_power_val(
4781                 __isl_take isl_map *map,
4782                 __isl_take isl_val *exp);
4783         __isl_give isl_union_map *
4784         isl_union_map_fixed_power_val(
4785                 __isl_take isl_union_map *umap,
4786                 __isl_take isl_val *exp);
4788 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
4789 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
4790 of C<map> is computed.
4792         __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
4793                 int *exact);
4794         __isl_give isl_union_map *isl_union_map_power(
4795                 __isl_take isl_union_map *umap, int *exact);
4797 Compute a parametric representation for all positive powers I<k> of C<map>.
4798 The result maps I<k> to a nested relation corresponding to the
4799 I<k>th power of C<map>.
4800 The result may be an overapproximation.  If the result is known to be exact,
4801 then C<*exact> is set to C<1>.
4803 =item * Transitive closure
4805         __isl_give isl_map *isl_map_transitive_closure(
4806                 __isl_take isl_map *map, int *exact);
4807         __isl_give isl_union_map *isl_union_map_transitive_closure(
4808                 __isl_take isl_union_map *umap, int *exact);
4810 Compute the transitive closure of C<map>.
4811 The result may be an overapproximation.  If the result is known to be exact,
4812 then C<*exact> is set to C<1>.
4814 =item * Reaching path lengths
4816         __isl_give isl_map *isl_map_reaching_path_lengths(
4817                 __isl_take isl_map *map, int *exact);
4819 Compute a relation that maps each element in the range of C<map>
4820 to the lengths of all paths composed of edges in C<map> that
4821 end up in the given element.
4822 The result may be an overapproximation.  If the result is known to be exact,
4823 then C<*exact> is set to C<1>.
4824 To compute the I<maximal> path length, the resulting relation
4825 should be postprocessed by C<isl_map_lexmax>.
4826 In particular, if the input relation is a dependence relation
4827 (mapping sources to sinks), then the maximal path length corresponds
4828 to the free schedule.
4829 Note, however, that C<isl_map_lexmax> expects the maximum to be
4830 finite, so if the path lengths are unbounded (possibly due to
4831 the overapproximation), then you will get an error message.
4833 =item * Wrapping
4835         #include <isl/space.h>
4836         __isl_give isl_space *isl_space_wrap(
4837                 __isl_take isl_space *space);
4838         __isl_give isl_space *isl_space_unwrap(
4839                 __isl_take isl_space *space);
4841         #include <isl/local_space.h>
4842         __isl_give isl_local_space *isl_local_space_wrap(
4843                 __isl_take isl_local_space *ls);
4845         #include <isl/set.h>
4846         __isl_give isl_basic_map *isl_basic_set_unwrap(
4847                 __isl_take isl_basic_set *bset);
4848         __isl_give isl_map *isl_set_unwrap(
4849                 __isl_take isl_set *set);
4851         #include <isl/map.h>
4852         __isl_give isl_basic_set *isl_basic_map_wrap(
4853                 __isl_take isl_basic_map *bmap);
4854         __isl_give isl_set *isl_map_wrap(
4855                 __isl_take isl_map *map);
4857         #include <isl/union_set.h>
4858         __isl_give isl_union_map *isl_union_set_unwrap(
4859                 __isl_take isl_union_set *uset);
4861         #include <isl/union_map.h>
4862         __isl_give isl_union_set *isl_union_map_wrap(
4863                 __isl_take isl_union_map *umap);
4865 The input to C<isl_space_unwrap> should
4866 be the space of a set, while that of
4867 C<isl_space_wrap> should be the space of a relation.
4868 Conversely, the output of C<isl_space_unwrap> is the space
4869 of a relation, while that of C<isl_space_wrap> is the space of a set.
4871 =item * Flattening
4873 Remove any internal structure of domain (and range) of the given
4874 set or relation.  If there is any such internal structure in the input,
4875 then the name of the space is also removed.
4877         #include <isl/local_space.h>
4878         __isl_give isl_local_space *
4879         isl_local_space_flatten_domain(
4880                 __isl_take isl_local_space *ls);
4881         __isl_give isl_local_space *
4882         isl_local_space_flatten_range(
4883                 __isl_take isl_local_space *ls);
4885         #include <isl/set.h>
4886         __isl_give isl_basic_set *isl_basic_set_flatten(
4887                 __isl_take isl_basic_set *bset);
4888         __isl_give isl_set *isl_set_flatten(
4889                 __isl_take isl_set *set);
4891         #include <isl/map.h>
4892         __isl_give isl_basic_map *isl_basic_map_flatten_domain(
4893                 __isl_take isl_basic_map *bmap);
4894         __isl_give isl_basic_map *isl_basic_map_flatten_range(
4895                 __isl_take isl_basic_map *bmap);
4896         __isl_give isl_map *isl_map_flatten_range(
4897                 __isl_take isl_map *map);
4898         __isl_give isl_map *isl_map_flatten_domain(
4899                 __isl_take isl_map *map);
4900         __isl_give isl_basic_map *isl_basic_map_flatten(
4901                 __isl_take isl_basic_map *bmap);
4902         __isl_give isl_map *isl_map_flatten(
4903                 __isl_take isl_map *map);
4905         #include <isl/val.h>
4906         __isl_give isl_multi_val *isl_multi_val_flatten_range(
4907                 __isl_take isl_multi_val *mv);
4909         #include <isl/aff.h>
4910         __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
4911                 __isl_take isl_multi_aff *ma);
4912         __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
4913                 __isl_take isl_multi_aff *ma);
4914         __isl_give isl_multi_pw_aff *
4915         isl_multi_pw_aff_flatten_range(
4916                 __isl_take isl_multi_pw_aff *mpa);
4917         __isl_give isl_multi_union_pw_aff *
4918         isl_multi_union_pw_aff_flatten_range(
4919                 __isl_take isl_multi_union_pw_aff *mupa);
4921         #include <isl/map.h>
4922         __isl_give isl_map *isl_set_flatten_map(
4923                 __isl_take isl_set *set);
4925 The function above constructs a relation
4926 that maps the input set to a flattened version of the set.
4928 =item * Lifting
4930 Lift the input set to a space with extra dimensions corresponding
4931 to the existentially quantified variables in the input.
4932 In particular, the result lives in a wrapped map where the domain
4933 is the original space and the range corresponds to the original
4934 existentially quantified variables.
4936         #include <isl/set.h>
4937         __isl_give isl_basic_set *isl_basic_set_lift(
4938                 __isl_take isl_basic_set *bset);
4939         __isl_give isl_set *isl_set_lift(
4940                 __isl_take isl_set *set);
4941         __isl_give isl_union_set *isl_union_set_lift(
4942                 __isl_take isl_union_set *uset);
4944 Given a local space that contains the existentially quantified
4945 variables of a set, a basic relation that, when applied to
4946 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
4947 can be constructed using the following function.
4949         #include <isl/local_space.h>
4950         __isl_give isl_basic_map *isl_local_space_lifting(
4951                 __isl_take isl_local_space *ls);
4953         #include <isl/aff.h>
4954         __isl_give isl_multi_aff *isl_multi_aff_lift(
4955                 __isl_take isl_multi_aff *maff,
4956                 __isl_give isl_local_space **ls);
4958 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
4959 then it is assigned the local space that lies at the basis of
4960 the lifting applied.
4962 =item * Internal Product
4964         #include <isl/space.h>
4965         __isl_give isl_space *isl_space_zip(
4966                 __isl_take isl_space *space);
4968         #include <isl/map.h>
4969         __isl_give isl_basic_map *isl_basic_map_zip(
4970                 __isl_take isl_basic_map *bmap);
4971         __isl_give isl_map *isl_map_zip(
4972                 __isl_take isl_map *map);
4974         #include <isl/union_map.h>
4975         __isl_give isl_union_map *isl_union_map_zip(
4976                 __isl_take isl_union_map *umap);
4978 Given a relation with nested relations for domain and range,
4979 interchange the range of the domain with the domain of the range.
4981 =item * Currying
4983         #include <isl/space.h>
4984         __isl_give isl_space *isl_space_curry(
4985                 __isl_take isl_space *space);
4986         __isl_give isl_space *isl_space_uncurry(
4987                 __isl_take isl_space *space);
4989         #include <isl/map.h>
4990         __isl_give isl_basic_map *isl_basic_map_curry(
4991                 __isl_take isl_basic_map *bmap);
4992         __isl_give isl_basic_map *isl_basic_map_uncurry(
4993                 __isl_take isl_basic_map *bmap);
4994         __isl_give isl_map *isl_map_curry(
4995                 __isl_take isl_map *map);
4996         __isl_give isl_map *isl_map_uncurry(
4997                 __isl_take isl_map *map);
4999         #include <isl/union_map.h>
5000         __isl_give isl_union_map *isl_union_map_curry(
5001                 __isl_take isl_union_map *umap);
5002         __isl_give isl_union_map *isl_union_map_uncurry(
5003                 __isl_take isl_union_map *umap);
5005 Given a relation with a nested relation for domain,
5006 the C<curry> functions
5007 move the range of the nested relation out of the domain
5008 and use it as the domain of a nested relation in the range,
5009 with the original range as range of this nested relation.
5010 The C<uncurry> functions perform the inverse operation.
5012 =item * Aligning parameters
5014 Change the order of the parameters of the given set, relation
5015 or function
5016 such that the first parameters match those of C<model>.
5017 This may involve the introduction of extra parameters.
5018 All parameters need to be named.
5020         #include <isl/space.h>
5021         __isl_give isl_space *isl_space_align_params(
5022                 __isl_take isl_space *space1,
5023                 __isl_take isl_space *space2)
5025         #include <isl/set.h>
5026         __isl_give isl_basic_set *isl_basic_set_align_params(
5027                 __isl_take isl_basic_set *bset,
5028                 __isl_take isl_space *model);
5029         __isl_give isl_set *isl_set_align_params(
5030                 __isl_take isl_set *set,
5031                 __isl_take isl_space *model);
5033         #include <isl/map.h>
5034         __isl_give isl_basic_map *isl_basic_map_align_params(
5035                 __isl_take isl_basic_map *bmap,
5036                 __isl_take isl_space *model);
5037         __isl_give isl_map *isl_map_align_params(
5038                 __isl_take isl_map *map,
5039                 __isl_take isl_space *model);
5041         #include <isl/val.h>
5042         __isl_give isl_multi_val *isl_multi_val_align_params(
5043                 __isl_take isl_multi_val *mv,
5044                 __isl_take isl_space *model);
5046         #include <isl/aff.h>
5047         __isl_give isl_aff *isl_aff_align_params(
5048                 __isl_take isl_aff *aff,
5049                 __isl_take isl_space *model);
5050         __isl_give isl_multi_aff *isl_multi_aff_align_params(
5051                 __isl_take isl_multi_aff *multi,
5052                 __isl_take isl_space *model);
5053         __isl_give isl_pw_aff *isl_pw_aff_align_params(
5054                 __isl_take isl_pw_aff *pwaff,
5055                 __isl_take isl_space *model);
5056         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
5057                 __isl_take isl_pw_multi_aff *pma,
5058                 __isl_take isl_space *model);
5059         __isl_give isl_union_pw_aff *
5060         isl_union_pw_aff_align_params(
5061                 __isl_take isl_union_pw_aff *upa,
5062                 __isl_take isl_space *model);
5063         __isl_give isl_union_pw_multi_aff *
5064         isl_union_pw_multi_aff_align_params(
5065                 __isl_take isl_union_pw_multi_aff *upma,
5066                 __isl_take isl_space *model);
5067         __isl_give isl_multi_union_pw_aff *
5068         isl_multi_union_pw_aff_align_params(
5069                 __isl_take isl_multi_union_pw_aff *mupa,
5070                 __isl_take isl_space *model);
5072         #include <isl/polynomial.h>
5073         __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
5074                 __isl_take isl_qpolynomial *qp,
5075                 __isl_take isl_space *model);
5077 =item * Unary Arithmethic Operations
5079         #include <isl/val.h>
5080         __isl_give isl_multi_val *isl_multi_val_neg(
5081                 __isl_take isl_multi_val *mv);
5083         #include <isl/aff.h>
5084         __isl_give isl_aff *isl_aff_neg(
5085                 __isl_take isl_aff *aff);
5086         __isl_give isl_multi_aff *isl_multi_aff_neg(
5087                 __isl_take isl_multi_aff *ma);
5088         __isl_give isl_pw_aff *isl_pw_aff_neg(
5089                 __isl_take isl_pw_aff *pwaff);
5090         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
5091                 __isl_take isl_pw_multi_aff *pma);
5092         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
5093                 __isl_take isl_multi_pw_aff *mpa);
5094         __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
5095                 __isl_take isl_union_pw_aff *upa);
5096         __isl_give isl_union_pw_multi_aff *
5097         isl_union_pw_multi_aff_neg(
5098                 __isl_take isl_union_pw_multi_aff *upma);
5099         __isl_give isl_multi_union_pw_aff *
5100         isl_multi_union_pw_aff_neg(
5101                 __isl_take isl_multi_union_pw_aff *mupa);
5102         __isl_give isl_aff *isl_aff_ceil(
5103                 __isl_take isl_aff *aff);
5104         __isl_give isl_pw_aff *isl_pw_aff_ceil(
5105                 __isl_take isl_pw_aff *pwaff);
5106         __isl_give isl_aff *isl_aff_floor(
5107                 __isl_take isl_aff *aff);
5108         __isl_give isl_multi_aff *isl_multi_aff_floor(
5109                 __isl_take isl_multi_aff *ma);
5110         __isl_give isl_pw_aff *isl_pw_aff_floor(
5111                 __isl_take isl_pw_aff *pwaff);
5112         __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
5113                 __isl_take isl_union_pw_aff *upa);
5114         __isl_give isl_multi_union_pw_aff *
5115         isl_multi_union_pw_aff_floor(
5116                 __isl_take isl_multi_union_pw_aff *mupa);
5118         #include <isl/aff.h>
5119         __isl_give isl_pw_aff *isl_pw_aff_list_min(
5120                 __isl_take isl_pw_aff_list *list);
5121         __isl_give isl_pw_aff *isl_pw_aff_list_max(
5122                 __isl_take isl_pw_aff_list *list);
5124         #include <isl/polynomial.h>
5125         __isl_give isl_qpolynomial *isl_qpolynomial_neg(
5126                 __isl_take isl_qpolynomial *qp);
5127         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
5128                 __isl_take isl_pw_qpolynomial *pwqp);
5129         __isl_give isl_union_pw_qpolynomial *
5130         isl_union_pw_qpolynomial_neg(
5131                 __isl_take isl_union_pw_qpolynomial *upwqp);
5132         __isl_give isl_qpolynomial *isl_qpolynomial_pow(
5133                 __isl_take isl_qpolynomial *qp,
5134                 unsigned exponent);
5135         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
5136                 __isl_take isl_pw_qpolynomial *pwqp,
5137                 unsigned exponent);
5139 =item * Evaluation
5141 The following functions evaluate a function in a point.
5143         #include <isl/polynomial.h>
5144         __isl_give isl_val *isl_pw_qpolynomial_eval(
5145                 __isl_take isl_pw_qpolynomial *pwqp,
5146                 __isl_take isl_point *pnt);
5147         __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
5148                 __isl_take isl_pw_qpolynomial_fold *pwf,
5149                 __isl_take isl_point *pnt);
5150         __isl_give isl_val *isl_union_pw_qpolynomial_eval(
5151                 __isl_take isl_union_pw_qpolynomial *upwqp,
5152                 __isl_take isl_point *pnt);
5153         __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
5154                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5155                 __isl_take isl_point *pnt);
5157 =item * Dimension manipulation
5159 It is usually not advisable to directly change the (input or output)
5160 space of a set or a relation as this removes the name and the internal
5161 structure of the space.  However, the functions below can be useful
5162 to add new parameters, assuming
5163 C<isl_set_align_params> and C<isl_map_align_params>
5164 are not sufficient.
5166         #include <isl/space.h>
5167         __isl_give isl_space *isl_space_add_dims(
5168                 __isl_take isl_space *space,
5169                 enum isl_dim_type type, unsigned n);
5170         __isl_give isl_space *isl_space_insert_dims(
5171                 __isl_take isl_space *space,
5172                 enum isl_dim_type type, unsigned pos, unsigned n);
5173         __isl_give isl_space *isl_space_drop_dims(
5174                 __isl_take isl_space *space,
5175                 enum isl_dim_type type, unsigned first, unsigned n);
5176         __isl_give isl_space *isl_space_move_dims(
5177                 __isl_take isl_space *space,
5178                 enum isl_dim_type dst_type, unsigned dst_pos,
5179                 enum isl_dim_type src_type, unsigned src_pos,
5180                 unsigned n);
5182         #include <isl/local_space.h>
5183         __isl_give isl_local_space *isl_local_space_add_dims(
5184                 __isl_take isl_local_space *ls,
5185                 enum isl_dim_type type, unsigned n);
5186         __isl_give isl_local_space *isl_local_space_insert_dims(
5187                 __isl_take isl_local_space *ls,
5188                 enum isl_dim_type type, unsigned first, unsigned n);
5189         __isl_give isl_local_space *isl_local_space_drop_dims(
5190                 __isl_take isl_local_space *ls,
5191                 enum isl_dim_type type, unsigned first, unsigned n);
5193         #include <isl/set.h>
5194         __isl_give isl_basic_set *isl_basic_set_add_dims(
5195                 __isl_take isl_basic_set *bset,
5196                 enum isl_dim_type type, unsigned n);
5197         __isl_give isl_set *isl_set_add_dims(
5198                 __isl_take isl_set *set,
5199                 enum isl_dim_type type, unsigned n);
5200         __isl_give isl_basic_set *isl_basic_set_insert_dims(
5201                 __isl_take isl_basic_set *bset,
5202                 enum isl_dim_type type, unsigned pos,
5203                 unsigned n);
5204         __isl_give isl_set *isl_set_insert_dims(
5205                 __isl_take isl_set *set,
5206                 enum isl_dim_type type, unsigned pos, unsigned n);
5207         __isl_give isl_basic_set *isl_basic_set_move_dims(
5208                 __isl_take isl_basic_set *bset,
5209                 enum isl_dim_type dst_type, unsigned dst_pos,
5210                 enum isl_dim_type src_type, unsigned src_pos,
5211                 unsigned n);
5212         __isl_give isl_set *isl_set_move_dims(
5213                 __isl_take isl_set *set,
5214                 enum isl_dim_type dst_type, unsigned dst_pos,
5215                 enum isl_dim_type src_type, unsigned src_pos,
5216                 unsigned n);
5218         #include <isl/map.h>
5219         __isl_give isl_map *isl_map_add_dims(
5220                 __isl_take isl_map *map,
5221                 enum isl_dim_type type, unsigned n);
5222         __isl_give isl_basic_map *isl_basic_map_insert_dims(
5223                 __isl_take isl_basic_map *bmap,
5224                 enum isl_dim_type type, unsigned pos,
5225                 unsigned n);
5226         __isl_give isl_map *isl_map_insert_dims(
5227                 __isl_take isl_map *map,
5228                 enum isl_dim_type type, unsigned pos, unsigned n);
5229         __isl_give isl_basic_map *isl_basic_map_move_dims(
5230                 __isl_take isl_basic_map *bmap,
5231                 enum isl_dim_type dst_type, unsigned dst_pos,
5232                 enum isl_dim_type src_type, unsigned src_pos,
5233                 unsigned n);
5234         __isl_give isl_map *isl_map_move_dims(
5235                 __isl_take isl_map *map,
5236                 enum isl_dim_type dst_type, unsigned dst_pos,
5237                 enum isl_dim_type src_type, unsigned src_pos,
5238                 unsigned n);
5240         #include <isl/val.h>
5241         __isl_give isl_multi_val *isl_multi_val_insert_dims(
5242                 __isl_take isl_multi_val *mv,
5243                 enum isl_dim_type type, unsigned first, unsigned n);
5244         __isl_give isl_multi_val *isl_multi_val_add_dims(
5245                 __isl_take isl_multi_val *mv,
5246                 enum isl_dim_type type, unsigned n);
5247         __isl_give isl_multi_val *isl_multi_val_drop_dims(
5248                 __isl_take isl_multi_val *mv,
5249                 enum isl_dim_type type, unsigned first, unsigned n);
5251         #include <isl/aff.h>
5252         __isl_give isl_aff *isl_aff_insert_dims(
5253                 __isl_take isl_aff *aff,
5254                 enum isl_dim_type type, unsigned first, unsigned n);
5255         __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
5256                 __isl_take isl_multi_aff *ma,
5257                 enum isl_dim_type type, unsigned first, unsigned n);
5258         __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
5259                 __isl_take isl_pw_aff *pwaff,
5260                 enum isl_dim_type type, unsigned first, unsigned n);
5261         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
5262                 __isl_take isl_multi_pw_aff *mpa,
5263                 enum isl_dim_type type, unsigned first, unsigned n);
5264         __isl_give isl_aff *isl_aff_add_dims(
5265                 __isl_take isl_aff *aff,
5266                 enum isl_dim_type type, unsigned n);
5267         __isl_give isl_multi_aff *isl_multi_aff_add_dims(
5268                 __isl_take isl_multi_aff *ma,
5269                 enum isl_dim_type type, unsigned n);
5270         __isl_give isl_pw_aff *isl_pw_aff_add_dims(
5271                 __isl_take isl_pw_aff *pwaff,
5272                 enum isl_dim_type type, unsigned n);
5273         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
5274                 __isl_take isl_multi_pw_aff *mpa,
5275                 enum isl_dim_type type, unsigned n);
5276         __isl_give isl_aff *isl_aff_drop_dims(
5277                 __isl_take isl_aff *aff,
5278                 enum isl_dim_type type, unsigned first, unsigned n);
5279         __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
5280                 __isl_take isl_multi_aff *maff,
5281                 enum isl_dim_type type, unsigned first, unsigned n);
5282         __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
5283                 __isl_take isl_pw_aff *pwaff,
5284                 enum isl_dim_type type, unsigned first, unsigned n);
5285         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
5286                 __isl_take isl_pw_multi_aff *pma,
5287                 enum isl_dim_type type, unsigned first, unsigned n);
5288         __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
5289                 __isl_take isl_union_pw_aff *upa,
5290                 enum isl_dim_type type, unsigned first, unsigned n);
5291         __isl_give isl_union_pw_multi_aff *
5292                 isl_union_pw_multi_aff_drop_dims(
5293                 __isl_take isl_union_pw_multi_aff *upma,
5294                 enum isl_dim_type type,
5295                 unsigned first, unsigned n);
5296         __isl_give isl_multi_union_pw_aff *
5297         isl_multi_union_pw_aff_drop_dims(
5298                 __isl_take isl_multi_union_pw_aff *mupa,
5299                 enum isl_dim_type type, unsigned first,
5300                 unsigned n);
5301         __isl_give isl_aff *isl_aff_move_dims(
5302                 __isl_take isl_aff *aff,
5303                 enum isl_dim_type dst_type, unsigned dst_pos,
5304                 enum isl_dim_type src_type, unsigned src_pos,
5305                 unsigned n);
5306         __isl_give isl_multi_aff *isl_multi_aff_move_dims(
5307                 __isl_take isl_multi_aff *ma,
5308                 enum isl_dim_type dst_type, unsigned dst_pos,
5309                 enum isl_dim_type src_type, unsigned src_pos,
5310                 unsigned n);
5311         __isl_give isl_pw_aff *isl_pw_aff_move_dims(
5312                 __isl_take isl_pw_aff *pa,
5313                 enum isl_dim_type dst_type, unsigned dst_pos,
5314                 enum isl_dim_type src_type, unsigned src_pos,
5315                 unsigned n);
5316         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
5317                 __isl_take isl_multi_pw_aff *pma,
5318                 enum isl_dim_type dst_type, unsigned dst_pos,
5319                 enum isl_dim_type src_type, unsigned src_pos,
5320                 unsigned n);
5322         #include <isl/polynomial.h>
5323         __isl_give isl_union_pw_qpolynomial *
5324         isl_union_pw_qpolynomial_drop_dims(
5325                 __isl_take isl_union_pw_qpolynomial *upwqp,
5326                 enum isl_dim_type type,
5327                 unsigned first, unsigned n);
5328         __isl_give isl_union_pw_qpolynomial_fold *
5329                 isl_union_pw_qpolynomial_fold_drop_dims(
5330                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5331                 enum isl_dim_type type,
5332                 unsigned first, unsigned n);
5334 The operations on union expressions can only manipulate parameters.
5336 =back
5338 =head2 Binary Operations
5340 The two arguments of a binary operation not only need to live
5341 in the same C<isl_ctx>, they currently also need to have
5342 the same (number of) parameters.
5344 =head3 Basic Operations
5346 =over
5348 =item * Intersection
5350         #include <isl/local_space.h>
5351         __isl_give isl_local_space *isl_local_space_intersect(
5352                 __isl_take isl_local_space *ls1,
5353                 __isl_take isl_local_space *ls2);
5355         #include <isl/set.h>
5356         __isl_give isl_basic_set *isl_basic_set_intersect_params(
5357                 __isl_take isl_basic_set *bset1,
5358                 __isl_take isl_basic_set *bset2);
5359         __isl_give isl_basic_set *isl_basic_set_intersect(
5360                 __isl_take isl_basic_set *bset1,
5361                 __isl_take isl_basic_set *bset2);
5362         __isl_give isl_basic_set *isl_basic_set_list_intersect(
5363                 __isl_take struct isl_basic_set_list *list);
5364         __isl_give isl_set *isl_set_intersect_params(
5365                 __isl_take isl_set *set,
5366                 __isl_take isl_set *params);
5367         __isl_give isl_set *isl_set_intersect(
5368                 __isl_take isl_set *set1,
5369                 __isl_take isl_set *set2);
5371         #include <isl/map.h>
5372         __isl_give isl_basic_map *isl_basic_map_intersect_domain(
5373                 __isl_take isl_basic_map *bmap,
5374                 __isl_take isl_basic_set *bset);
5375         __isl_give isl_basic_map *isl_basic_map_intersect_range(
5376                 __isl_take isl_basic_map *bmap,
5377                 __isl_take isl_basic_set *bset);
5378         __isl_give isl_basic_map *isl_basic_map_intersect(
5379                 __isl_take isl_basic_map *bmap1,
5380                 __isl_take isl_basic_map *bmap2);
5381         __isl_give isl_basic_map *isl_basic_map_list_intersect(
5382                 __isl_take isl_basic_map_list *list);
5383         __isl_give isl_map *isl_map_intersect_params(
5384                 __isl_take isl_map *map,
5385                 __isl_take isl_set *params);
5386         __isl_give isl_map *isl_map_intersect_domain(
5387                 __isl_take isl_map *map,
5388                 __isl_take isl_set *set);
5389         __isl_give isl_map *isl_map_intersect_range(
5390                 __isl_take isl_map *map,
5391                 __isl_take isl_set *set);
5392         __isl_give isl_map *isl_map_intersect(
5393                 __isl_take isl_map *map1,
5394                 __isl_take isl_map *map2);
5396         #include <isl/union_set.h>
5397         __isl_give isl_union_set *isl_union_set_intersect_params(
5398                 __isl_take isl_union_set *uset,
5399                 __isl_take isl_set *set);
5400         __isl_give isl_union_set *isl_union_set_intersect(
5401                 __isl_take isl_union_set *uset1,
5402                 __isl_take isl_union_set *uset2);
5404         #include <isl/union_map.h>
5405         __isl_give isl_union_map *isl_union_map_intersect_params(
5406                 __isl_take isl_union_map *umap,
5407                 __isl_take isl_set *set);
5408         __isl_give isl_union_map *isl_union_map_intersect_domain(
5409                 __isl_take isl_union_map *umap,
5410                 __isl_take isl_union_set *uset);
5411         __isl_give isl_union_map *isl_union_map_intersect_range(
5412                 __isl_take isl_union_map *umap,
5413                 __isl_take isl_union_set *uset);
5414         __isl_give isl_union_map *isl_union_map_intersect(
5415                 __isl_take isl_union_map *umap1,
5416                 __isl_take isl_union_map *umap2);
5418         #include <isl/aff.h>
5419         __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
5420                 __isl_take isl_pw_aff *pa,
5421                 __isl_take isl_set *set);
5422         __isl_give isl_multi_pw_aff *
5423         isl_multi_pw_aff_intersect_domain(
5424                 __isl_take isl_multi_pw_aff *mpa,
5425                 __isl_take isl_set *domain);
5426         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
5427                 __isl_take isl_pw_multi_aff *pma,
5428                 __isl_take isl_set *set);
5429         __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
5430                 __isl_take isl_union_pw_aff *upa,
5431                 __isl_take isl_union_set *uset);
5432         __isl_give isl_union_pw_multi_aff *
5433         isl_union_pw_multi_aff_intersect_domain(
5434                 __isl_take isl_union_pw_multi_aff *upma,
5435                 __isl_take isl_union_set *uset);
5436         __isl_give isl_multi_union_pw_aff *
5437         isl_multi_union_pw_aff_intersect_domain(
5438                 __isl_take isl_multi_union_pw_aff *mupa,
5439                 __isl_take isl_union_set *uset);
5440         __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
5441                 __isl_take isl_pw_aff *pa,
5442                 __isl_take isl_set *set);
5443         __isl_give isl_multi_pw_aff *
5444         isl_multi_pw_aff_intersect_params(
5445                 __isl_take isl_multi_pw_aff *mpa,
5446                 __isl_take isl_set *set);
5447         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
5448                 __isl_take isl_pw_multi_aff *pma,
5449                 __isl_take isl_set *set);
5450         __isl_give isl_union_pw_aff *
5451         isl_union_pw_aff_intersect_params(
5452                 __isl_take isl_union_pw_aff *upa,
5453         __isl_give isl_union_pw_multi_aff *
5454         isl_union_pw_multi_aff_intersect_params(
5455                 __isl_take isl_union_pw_multi_aff *upma,
5456                 __isl_take isl_set *set);
5457         __isl_give isl_multi_union_pw_aff *
5458         isl_multi_union_pw_aff_intersect_params(
5459                 __isl_take isl_multi_union_pw_aff *mupa,
5460                 __isl_take isl_set *params);
5461         isl_multi_union_pw_aff_intersect_range(
5462                 __isl_take isl_multi_union_pw_aff *mupa,
5463                 __isl_take isl_set *set);
5465         #include <isl/polynomial.h>
5466         __isl_give isl_pw_qpolynomial *
5467         isl_pw_qpolynomial_intersect_domain(
5468                 __isl_take isl_pw_qpolynomial *pwpq,
5469                 __isl_take isl_set *set);
5470         __isl_give isl_union_pw_qpolynomial *
5471         isl_union_pw_qpolynomial_intersect_domain(
5472                 __isl_take isl_union_pw_qpolynomial *upwpq,
5473                 __isl_take isl_union_set *uset);
5474         __isl_give isl_union_pw_qpolynomial_fold *
5475         isl_union_pw_qpolynomial_fold_intersect_domain(
5476                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5477                 __isl_take isl_union_set *uset);
5478         __isl_give isl_pw_qpolynomial *
5479         isl_pw_qpolynomial_intersect_params(
5480                 __isl_take isl_pw_qpolynomial *pwpq,
5481                 __isl_take isl_set *set);
5482         __isl_give isl_pw_qpolynomial_fold *
5483         isl_pw_qpolynomial_fold_intersect_params(
5484                 __isl_take isl_pw_qpolynomial_fold *pwf,
5485                 __isl_take isl_set *set);
5486         __isl_give isl_union_pw_qpolynomial *
5487         isl_union_pw_qpolynomial_intersect_params(
5488                 __isl_take isl_union_pw_qpolynomial *upwpq,
5489                 __isl_take isl_set *set);
5490         __isl_give isl_union_pw_qpolynomial_fold *
5491         isl_union_pw_qpolynomial_fold_intersect_params(
5492                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5493                 __isl_take isl_set *set);
5495 The second argument to the C<_params> functions needs to be
5496 a parametric (basic) set.  For the other functions, a parametric set
5497 for either argument is only allowed if the other argument is
5498 a parametric set as well.
5499 The list passed to C<isl_basic_set_list_intersect> needs to have
5500 at least one element and all elements need to live in the same space.
5501 The function C<isl_multi_union_pw_aff_intersect_range>
5502 restricts the input function to those shared domain elements
5503 that map to the specified range.
5505 =item * Union
5507         #include <isl/set.h>
5508         __isl_give isl_set *isl_basic_set_union(
5509                 __isl_take isl_basic_set *bset1,
5510                 __isl_take isl_basic_set *bset2);
5511         __isl_give isl_set *isl_set_union(
5512                 __isl_take isl_set *set1,
5513                 __isl_take isl_set *set2);
5515         #include <isl/map.h>
5516         __isl_give isl_map *isl_basic_map_union(
5517                 __isl_take isl_basic_map *bmap1,
5518                 __isl_take isl_basic_map *bmap2);
5519         __isl_give isl_map *isl_map_union(
5520                 __isl_take isl_map *map1,
5521                 __isl_take isl_map *map2);
5523         #include <isl/union_set.h>
5524         __isl_give isl_union_set *isl_union_set_union(
5525                 __isl_take isl_union_set *uset1,
5526                 __isl_take isl_union_set *uset2);
5527         __isl_give isl_union_set *isl_union_set_list_union(
5528                 __isl_take isl_union_set_list *list);
5530         #include <isl/union_map.h>
5531         __isl_give isl_union_map *isl_union_map_union(
5532                 __isl_take isl_union_map *umap1,
5533                 __isl_take isl_union_map *umap2);
5535 =item * Set difference
5537         #include <isl/set.h>
5538         __isl_give isl_set *isl_set_subtract(
5539                 __isl_take isl_set *set1,
5540                 __isl_take isl_set *set2);
5542         #include <isl/map.h>
5543         __isl_give isl_map *isl_map_subtract(
5544                 __isl_take isl_map *map1,
5545                 __isl_take isl_map *map2);
5546         __isl_give isl_map *isl_map_subtract_domain(
5547                 __isl_take isl_map *map,
5548                 __isl_take isl_set *dom);
5549         __isl_give isl_map *isl_map_subtract_range(
5550                 __isl_take isl_map *map,
5551                 __isl_take isl_set *dom);
5553         #include <isl/union_set.h>
5554         __isl_give isl_union_set *isl_union_set_subtract(
5555                 __isl_take isl_union_set *uset1,
5556                 __isl_take isl_union_set *uset2);
5558         #include <isl/union_map.h>
5559         __isl_give isl_union_map *isl_union_map_subtract(
5560                 __isl_take isl_union_map *umap1,
5561                 __isl_take isl_union_map *umap2);
5562         __isl_give isl_union_map *isl_union_map_subtract_domain(
5563                 __isl_take isl_union_map *umap,
5564                 __isl_take isl_union_set *dom);
5565         __isl_give isl_union_map *isl_union_map_subtract_range(
5566                 __isl_take isl_union_map *umap,
5567                 __isl_take isl_union_set *dom);
5569         #include <isl/aff.h>
5570         __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
5571                 __isl_take isl_pw_aff *pa,
5572                 __isl_take isl_set *set);
5573         __isl_give isl_pw_multi_aff *
5574         isl_pw_multi_aff_subtract_domain(
5575                 __isl_take isl_pw_multi_aff *pma,
5576                 __isl_take isl_set *set);
5577         __isl_give isl_union_pw_aff *
5578         isl_union_pw_aff_subtract_domain(
5579                 __isl_take isl_union_pw_aff *upa,
5580                 __isl_take isl_union_set *uset);
5581         __isl_give isl_union_pw_multi_aff *
5582         isl_union_pw_multi_aff_subtract_domain(
5583                 __isl_take isl_union_pw_multi_aff *upma,
5584                 __isl_take isl_set *set);
5586         #include <isl/polynomial.h>
5587         __isl_give isl_pw_qpolynomial *
5588         isl_pw_qpolynomial_subtract_domain(
5589                 __isl_take isl_pw_qpolynomial *pwpq,
5590                 __isl_take isl_set *set);
5591         __isl_give isl_pw_qpolynomial_fold *
5592         isl_pw_qpolynomial_fold_subtract_domain(
5593                 __isl_take isl_pw_qpolynomial_fold *pwf,
5594                 __isl_take isl_set *set);
5595         __isl_give isl_union_pw_qpolynomial *
5596         isl_union_pw_qpolynomial_subtract_domain(
5597                 __isl_take isl_union_pw_qpolynomial *upwpq,
5598                 __isl_take isl_union_set *uset);
5599         __isl_give isl_union_pw_qpolynomial_fold *
5600         isl_union_pw_qpolynomial_fold_subtract_domain(
5601                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5602                 __isl_take isl_union_set *uset);
5604 =item * Application
5606         #include <isl/space.h>
5607         __isl_give isl_space *isl_space_join(
5608                 __isl_take isl_space *left,
5609                 __isl_take isl_space *right);
5611         #include <isl/map.h>
5612         __isl_give isl_basic_set *isl_basic_set_apply(
5613                 __isl_take isl_basic_set *bset,
5614                 __isl_take isl_basic_map *bmap);
5615         __isl_give isl_set *isl_set_apply(
5616                 __isl_take isl_set *set,
5617                 __isl_take isl_map *map);
5618         __isl_give isl_union_set *isl_union_set_apply(
5619                 __isl_take isl_union_set *uset,
5620                 __isl_take isl_union_map *umap);
5621         __isl_give isl_basic_map *isl_basic_map_apply_domain(
5622                 __isl_take isl_basic_map *bmap1,
5623                 __isl_take isl_basic_map *bmap2);
5624         __isl_give isl_basic_map *isl_basic_map_apply_range(
5625                 __isl_take isl_basic_map *bmap1,
5626                 __isl_take isl_basic_map *bmap2);
5627         __isl_give isl_map *isl_map_apply_domain(
5628                 __isl_take isl_map *map1,
5629                 __isl_take isl_map *map2);
5630         __isl_give isl_map *isl_map_apply_range(
5631                 __isl_take isl_map *map1,
5632                 __isl_take isl_map *map2);
5634         #include <isl/union_map.h>
5635         __isl_give isl_union_map *isl_union_map_apply_domain(
5636                 __isl_take isl_union_map *umap1,
5637                 __isl_take isl_union_map *umap2);
5638         __isl_give isl_union_map *isl_union_map_apply_range(
5639                 __isl_take isl_union_map *umap1,
5640                 __isl_take isl_union_map *umap2);
5642         #include <isl/aff.h>
5643         __isl_give isl_union_pw_aff *
5644         isl_multi_union_pw_aff_apply_aff(
5645                 __isl_take isl_multi_union_pw_aff *mupa,
5646                 __isl_take isl_aff *aff);
5647         __isl_give isl_union_pw_aff *
5648         isl_multi_union_pw_aff_apply_pw_aff(
5649                 __isl_take isl_multi_union_pw_aff *mupa,
5650                 __isl_take isl_pw_aff *pa);
5651         __isl_give isl_multi_union_pw_aff *
5652         isl_multi_union_pw_aff_apply_multi_aff(
5653                 __isl_take isl_multi_union_pw_aff *mupa,
5654                 __isl_take isl_multi_aff *ma);
5655         __isl_give isl_multi_union_pw_aff *
5656         isl_multi_union_pw_aff_apply_pw_multi_aff(
5657                 __isl_take isl_multi_union_pw_aff *mupa,
5658                 __isl_take isl_pw_multi_aff *pma);
5660 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
5661 over the shared domain of the elements of the input.  The dimension is
5662 required to be greater than zero.
5663 The C<isl_multi_union_pw_aff> argument of
5664 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
5665 but only if the range of the C<isl_multi_aff> argument
5666 is also zero-dimensional.
5667 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
5669         #include <isl/polynomial.h>
5670         __isl_give isl_pw_qpolynomial_fold *
5671         isl_set_apply_pw_qpolynomial_fold(
5672                 __isl_take isl_set *set,
5673                 __isl_take isl_pw_qpolynomial_fold *pwf,
5674                 int *tight);
5675         __isl_give isl_pw_qpolynomial_fold *
5676         isl_map_apply_pw_qpolynomial_fold(
5677                 __isl_take isl_map *map,
5678                 __isl_take isl_pw_qpolynomial_fold *pwf,
5679                 int *tight);
5680         __isl_give isl_union_pw_qpolynomial_fold *
5681         isl_union_set_apply_union_pw_qpolynomial_fold(
5682                 __isl_take isl_union_set *uset,
5683                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5684                 int *tight);
5685         __isl_give isl_union_pw_qpolynomial_fold *
5686         isl_union_map_apply_union_pw_qpolynomial_fold(
5687                 __isl_take isl_union_map *umap,
5688                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5689                 int *tight);
5691 The functions taking a map
5692 compose the given map with the given piecewise quasipolynomial reduction.
5693 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
5694 over all elements in the intersection of the range of the map
5695 and the domain of the piecewise quasipolynomial reduction
5696 as a function of an element in the domain of the map.
5697 The functions taking a set compute a bound over all elements in the
5698 intersection of the set and the domain of the
5699 piecewise quasipolynomial reduction.
5701 =item * Preimage
5703         #include <isl/set.h>
5704         __isl_give isl_basic_set *
5705         isl_basic_set_preimage_multi_aff(
5706                 __isl_take isl_basic_set *bset,
5707                 __isl_take isl_multi_aff *ma);
5708         __isl_give isl_set *isl_set_preimage_multi_aff(
5709                 __isl_take isl_set *set,
5710                 __isl_take isl_multi_aff *ma);
5711         __isl_give isl_set *isl_set_preimage_pw_multi_aff(
5712                 __isl_take isl_set *set,
5713                 __isl_take isl_pw_multi_aff *pma);
5714         __isl_give isl_set *isl_set_preimage_multi_pw_aff(
5715                 __isl_take isl_set *set,
5716                 __isl_take isl_multi_pw_aff *mpa);
5718         #include <isl/union_set.h>
5719         __isl_give isl_union_set *
5720         isl_union_set_preimage_multi_aff(
5721                 __isl_take isl_union_set *uset,
5722                 __isl_take isl_multi_aff *ma);
5723         __isl_give isl_union_set *
5724         isl_union_set_preimage_pw_multi_aff(
5725                 __isl_take isl_union_set *uset,
5726                 __isl_take isl_pw_multi_aff *pma);
5727         __isl_give isl_union_set *
5728         isl_union_set_preimage_union_pw_multi_aff(
5729                 __isl_take isl_union_set *uset,
5730                 __isl_take isl_union_pw_multi_aff *upma);
5732         #include <isl/map.h>
5733         __isl_give isl_basic_map *
5734         isl_basic_map_preimage_domain_multi_aff(
5735                 __isl_take isl_basic_map *bmap,
5736                 __isl_take isl_multi_aff *ma);
5737         __isl_give isl_map *isl_map_preimage_domain_multi_aff(
5738                 __isl_take isl_map *map,
5739                 __isl_take isl_multi_aff *ma);
5740         __isl_give isl_map *isl_map_preimage_range_multi_aff(
5741                 __isl_take isl_map *map,
5742                 __isl_take isl_multi_aff *ma);
5743         __isl_give isl_map *
5744         isl_map_preimage_domain_pw_multi_aff(
5745                 __isl_take isl_map *map,
5746                 __isl_take isl_pw_multi_aff *pma);
5747         __isl_give isl_map *
5748         isl_map_preimage_range_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_domain_multi_pw_aff(
5753                 __isl_take isl_map *map,
5754                 __isl_take isl_multi_pw_aff *mpa);
5755         __isl_give isl_basic_map *
5756         isl_basic_map_preimage_range_multi_aff(
5757                 __isl_take isl_basic_map *bmap,
5758                 __isl_take isl_multi_aff *ma);
5760         #include <isl/union_map.h>
5761         __isl_give isl_union_map *
5762         isl_union_map_preimage_domain_multi_aff(
5763                 __isl_take isl_union_map *umap,
5764                 __isl_take isl_multi_aff *ma);
5765         __isl_give isl_union_map *
5766         isl_union_map_preimage_range_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_domain_pw_multi_aff(
5771                 __isl_take isl_union_map *umap,
5772                 __isl_take isl_pw_multi_aff *pma);
5773         __isl_give isl_union_map *
5774         isl_union_map_preimage_range_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_domain_union_pw_multi_aff(
5779                 __isl_take isl_union_map *umap,
5780                 __isl_take isl_union_pw_multi_aff *upma);
5781         __isl_give isl_union_map *
5782         isl_union_map_preimage_range_union_pw_multi_aff(
5783                 __isl_take isl_union_map *umap,
5784                 __isl_take isl_union_pw_multi_aff *upma);
5786 These functions compute the preimage of the given set or map domain/range under
5787 the given function.  In other words, the expression is plugged
5788 into the set description or into the domain/range of the map.
5790 =item * Pullback
5792         #include <isl/aff.h>
5793         __isl_give isl_aff *isl_aff_pullback_aff(
5794                 __isl_take isl_aff *aff1,
5795                 __isl_take isl_aff *aff2);
5796         __isl_give isl_aff *isl_aff_pullback_multi_aff(
5797                 __isl_take isl_aff *aff,
5798                 __isl_take isl_multi_aff *ma);
5799         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
5800                 __isl_take isl_pw_aff *pa,
5801                 __isl_take isl_multi_aff *ma);
5802         __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
5803                 __isl_take isl_pw_aff *pa,
5804                 __isl_take isl_pw_multi_aff *pma);
5805         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
5806                 __isl_take isl_pw_aff *pa,
5807                 __isl_take isl_multi_pw_aff *mpa);
5808         __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
5809                 __isl_take isl_multi_aff *ma1,
5810                 __isl_take isl_multi_aff *ma2);
5811         __isl_give isl_pw_multi_aff *
5812         isl_pw_multi_aff_pullback_multi_aff(
5813                 __isl_take isl_pw_multi_aff *pma,
5814                 __isl_take isl_multi_aff *ma);
5815         __isl_give isl_multi_pw_aff *
5816         isl_multi_pw_aff_pullback_multi_aff(
5817                 __isl_take isl_multi_pw_aff *mpa,
5818                 __isl_take isl_multi_aff *ma);
5819         __isl_give isl_pw_multi_aff *
5820         isl_pw_multi_aff_pullback_pw_multi_aff(
5821                 __isl_take isl_pw_multi_aff *pma1,
5822                 __isl_take isl_pw_multi_aff *pma2);
5823         __isl_give isl_multi_pw_aff *
5824         isl_multi_pw_aff_pullback_pw_multi_aff(
5825                 __isl_take isl_multi_pw_aff *mpa,
5826                 __isl_take isl_pw_multi_aff *pma);
5827         __isl_give isl_multi_pw_aff *
5828         isl_multi_pw_aff_pullback_multi_pw_aff(
5829                 __isl_take isl_multi_pw_aff *mpa1,
5830                 __isl_take isl_multi_pw_aff *mpa2);
5831         __isl_give isl_union_pw_aff *
5832         isl_union_pw_aff_pullback_union_pw_multi_aff(
5833                 __isl_take isl_union_pw_aff *upa,
5834                 __isl_take isl_union_pw_multi_aff *upma);
5835         __isl_give isl_union_pw_multi_aff *
5836         isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
5837                 __isl_take isl_union_pw_multi_aff *upma1,
5838                 __isl_take isl_union_pw_multi_aff *upma2);
5839         __isl_give isl_multi_union_pw_aff *
5840         isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
5841                 __isl_take isl_multi_union_pw_aff *mupa,
5842                 __isl_take isl_union_pw_multi_aff *upma);
5844 These functions precompose the first expression by the second function.
5845 In other words, the second function is plugged
5846 into the first expression.
5848 =item * Locus
5850         #include <isl/aff.h>
5851         __isl_give isl_basic_set *isl_aff_le_basic_set(
5852                 __isl_take isl_aff *aff1,
5853                 __isl_take isl_aff *aff2);
5854         __isl_give isl_basic_set *isl_aff_ge_basic_set(
5855                 __isl_take isl_aff *aff1,
5856                 __isl_take isl_aff *aff2);
5857         __isl_give isl_set *isl_pw_aff_eq_set(
5858                 __isl_take isl_pw_aff *pwaff1,
5859                 __isl_take isl_pw_aff *pwaff2);
5860         __isl_give isl_set *isl_pw_aff_ne_set(
5861                 __isl_take isl_pw_aff *pwaff1,
5862                 __isl_take isl_pw_aff *pwaff2);
5863         __isl_give isl_set *isl_pw_aff_le_set(
5864                 __isl_take isl_pw_aff *pwaff1,
5865                 __isl_take isl_pw_aff *pwaff2);
5866         __isl_give isl_set *isl_pw_aff_lt_set(
5867                 __isl_take isl_pw_aff *pwaff1,
5868                 __isl_take isl_pw_aff *pwaff2);
5869         __isl_give isl_set *isl_pw_aff_ge_set(
5870                 __isl_take isl_pw_aff *pwaff1,
5871                 __isl_take isl_pw_aff *pwaff2);
5872         __isl_give isl_set *isl_pw_aff_gt_set(
5873                 __isl_take isl_pw_aff *pwaff1,
5874                 __isl_take isl_pw_aff *pwaff2);
5876         __isl_give isl_set *isl_multi_aff_lex_le_set(
5877                 __isl_take isl_multi_aff *ma1,
5878                 __isl_take isl_multi_aff *ma2);
5879         __isl_give isl_set *isl_multi_aff_lex_ge_set(
5880                 __isl_take isl_multi_aff *ma1,
5881                 __isl_take isl_multi_aff *ma2);
5883         __isl_give isl_set *isl_pw_aff_list_eq_set(
5884                 __isl_take isl_pw_aff_list *list1,
5885                 __isl_take isl_pw_aff_list *list2);
5886         __isl_give isl_set *isl_pw_aff_list_ne_set(
5887                 __isl_take isl_pw_aff_list *list1,
5888                 __isl_take isl_pw_aff_list *list2);
5889         __isl_give isl_set *isl_pw_aff_list_le_set(
5890                 __isl_take isl_pw_aff_list *list1,
5891                 __isl_take isl_pw_aff_list *list2);
5892         __isl_give isl_set *isl_pw_aff_list_lt_set(
5893                 __isl_take isl_pw_aff_list *list1,
5894                 __isl_take isl_pw_aff_list *list2);
5895         __isl_give isl_set *isl_pw_aff_list_ge_set(
5896                 __isl_take isl_pw_aff_list *list1,
5897                 __isl_take isl_pw_aff_list *list2);
5898         __isl_give isl_set *isl_pw_aff_list_gt_set(
5899                 __isl_take isl_pw_aff_list *list1,
5900                 __isl_take isl_pw_aff_list *list2);
5902 The function C<isl_aff_ge_basic_set> returns a basic set
5903 containing those elements in the shared space
5904 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
5905 The function C<isl_pw_aff_ge_set> returns a set
5906 containing those elements in the shared domain
5907 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
5908 greater than or equal to C<pwaff2>.
5909 The function C<isl_multi_aff_lex_le_set> returns a set
5910 containing those elements in the shared domain space
5911 where C<ma1> is lexicographically smaller than or
5912 equal to C<ma2>.
5913 The functions operating on C<isl_pw_aff_list> apply the corresponding
5914 C<isl_pw_aff> function to each pair of elements in the two lists.
5916         #include <isl/aff.h>
5917         __isl_give isl_map *isl_pw_aff_eq_map(
5918                 __isl_take isl_pw_aff *pa1,
5919                 __isl_take isl_pw_aff *pa2);
5920         __isl_give isl_map *isl_pw_aff_lt_map(
5921                 __isl_take isl_pw_aff *pa1,
5922                 __isl_take isl_pw_aff *pa2);
5923         __isl_give isl_map *isl_pw_aff_gt_map(
5924                 __isl_take isl_pw_aff *pa1,
5925                 __isl_take isl_pw_aff *pa2);
5927         __isl_give isl_map *isl_multi_pw_aff_eq_map(
5928                 __isl_take isl_multi_pw_aff *mpa1,
5929                 __isl_take isl_multi_pw_aff *mpa2);
5930         __isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
5931                 __isl_take isl_multi_pw_aff *mpa1,
5932                 __isl_take isl_multi_pw_aff *mpa2);
5933         __isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
5934                 __isl_take isl_multi_pw_aff *mpa1,
5935                 __isl_take isl_multi_pw_aff *mpa2);
5937 These functions return a map between domain elements of the arguments
5938 where the function values satisfy the given relation.
5940         #include <isl/union_map.h>
5941         __isl_give isl_union_map *
5942         isl_union_map_eq_at_multi_union_pw_aff(
5943                 __isl_take isl_union_map *umap,
5944                 __isl_take isl_multi_union_pw_aff *mupa);
5945         __isl_give isl_union_map *
5946         isl_union_map_lex_lt_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_gt_at_multi_union_pw_aff(
5951                 __isl_take isl_union_map *umap,
5952                 __isl_take isl_multi_union_pw_aff *mupa);
5954 These functions select the subset of elements in the union map
5955 that have an equal or lexicographically smaller function value.
5957 =item * Cartesian Product
5959         #include <isl/space.h>
5960         __isl_give isl_space *isl_space_product(
5961                 __isl_take isl_space *space1,
5962                 __isl_take isl_space *space2);
5963         __isl_give isl_space *isl_space_domain_product(
5964                 __isl_take isl_space *space1,
5965                 __isl_take isl_space *space2);
5966         __isl_give isl_space *isl_space_range_product(
5967                 __isl_take isl_space *space1,
5968                 __isl_take isl_space *space2);
5970 The functions
5971 C<isl_space_product>, C<isl_space_domain_product>
5972 and C<isl_space_range_product> take pairs or relation spaces and
5973 produce a single relations space, where either the domain, the range
5974 or both domain and range are wrapped spaces of relations between
5975 the domains and/or ranges of the input spaces.
5976 If the product is only constructed over the domain or the range
5977 then the ranges or the domains of the inputs should be the same.
5978 The function C<isl_space_product> also accepts a pair of set spaces,
5979 in which case it returns a wrapped space of a relation between the
5980 two input spaces.
5982         #include <isl/set.h>
5983         __isl_give isl_set *isl_set_product(
5984                 __isl_take isl_set *set1,
5985                 __isl_take isl_set *set2);
5987         #include <isl/map.h>
5988         __isl_give isl_basic_map *isl_basic_map_domain_product(
5989                 __isl_take isl_basic_map *bmap1,
5990                 __isl_take isl_basic_map *bmap2);
5991         __isl_give isl_basic_map *isl_basic_map_range_product(
5992                 __isl_take isl_basic_map *bmap1,
5993                 __isl_take isl_basic_map *bmap2);
5994         __isl_give isl_basic_map *isl_basic_map_product(
5995                 __isl_take isl_basic_map *bmap1,
5996                 __isl_take isl_basic_map *bmap2);
5997         __isl_give isl_map *isl_map_domain_product(
5998                 __isl_take isl_map *map1,
5999                 __isl_take isl_map *map2);
6000         __isl_give isl_map *isl_map_range_product(
6001                 __isl_take isl_map *map1,
6002                 __isl_take isl_map *map2);
6003         __isl_give isl_map *isl_map_product(
6004                 __isl_take isl_map *map1,
6005                 __isl_take isl_map *map2);
6007         #include <isl/union_set.h>
6008         __isl_give isl_union_set *isl_union_set_product(
6009                 __isl_take isl_union_set *uset1,
6010                 __isl_take isl_union_set *uset2);
6012         #include <isl/union_map.h>
6013         __isl_give isl_union_map *isl_union_map_domain_product(
6014                 __isl_take isl_union_map *umap1,
6015                 __isl_take isl_union_map *umap2);
6016         __isl_give isl_union_map *isl_union_map_range_product(
6017                 __isl_take isl_union_map *umap1,
6018                 __isl_take isl_union_map *umap2);
6019         __isl_give isl_union_map *isl_union_map_product(
6020                 __isl_take isl_union_map *umap1,
6021                 __isl_take isl_union_map *umap2);
6023         #include <isl/val.h>
6024         __isl_give isl_multi_val *isl_multi_val_range_product(
6025                 __isl_take isl_multi_val *mv1,
6026                 __isl_take isl_multi_val *mv2);
6027         __isl_give isl_multi_val *isl_multi_val_product(
6028                 __isl_take isl_multi_val *mv1,
6029                 __isl_take isl_multi_val *mv2);
6031         #include <isl/aff.h>
6032         __isl_give isl_multi_aff *isl_multi_aff_range_product(
6033                 __isl_take isl_multi_aff *ma1,
6034                 __isl_take isl_multi_aff *ma2);
6035         __isl_give isl_multi_aff *isl_multi_aff_product(
6036                 __isl_take isl_multi_aff *ma1,
6037                 __isl_take isl_multi_aff *ma2);
6038         __isl_give isl_multi_pw_aff *
6039         isl_multi_pw_aff_range_product(
6040                 __isl_take isl_multi_pw_aff *mpa1,
6041                 __isl_take isl_multi_pw_aff *mpa2);
6042         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
6043                 __isl_take isl_multi_pw_aff *mpa1,
6044                 __isl_take isl_multi_pw_aff *mpa2);
6045         __isl_give isl_pw_multi_aff *
6046         isl_pw_multi_aff_range_product(
6047                 __isl_take isl_pw_multi_aff *pma1,
6048                 __isl_take isl_pw_multi_aff *pma2);
6049         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
6050                 __isl_take isl_pw_multi_aff *pma1,
6051                 __isl_take isl_pw_multi_aff *pma2);
6052         __isl_give isl_multi_union_pw_aff *
6053         isl_multi_union_pw_aff_range_product(
6054                 __isl_take isl_multi_union_pw_aff *mupa1,
6055                 __isl_take isl_multi_union_pw_aff *mupa2);
6057 The above functions compute the cross product of the given
6058 sets, relations or functions.  The domains and ranges of the results
6059 are wrapped maps between domains and ranges of the inputs.
6060 To obtain a ``flat'' product, use the following functions
6061 instead.
6063         #include <isl/set.h>
6064         __isl_give isl_basic_set *isl_basic_set_flat_product(
6065                 __isl_take isl_basic_set *bset1,
6066                 __isl_take isl_basic_set *bset2);
6067         __isl_give isl_set *isl_set_flat_product(
6068                 __isl_take isl_set *set1,
6069                 __isl_take isl_set *set2);
6071         #include <isl/map.h>
6072         __isl_give isl_basic_map *isl_basic_map_flat_range_product(
6073                 __isl_take isl_basic_map *bmap1,
6074                 __isl_take isl_basic_map *bmap2);
6075         __isl_give isl_map *isl_map_flat_domain_product(
6076                 __isl_take isl_map *map1,
6077                 __isl_take isl_map *map2);
6078         __isl_give isl_map *isl_map_flat_range_product(
6079                 __isl_take isl_map *map1,
6080                 __isl_take isl_map *map2);
6081         __isl_give isl_basic_map *isl_basic_map_flat_product(
6082                 __isl_take isl_basic_map *bmap1,
6083                 __isl_take isl_basic_map *bmap2);
6084         __isl_give isl_map *isl_map_flat_product(
6085                 __isl_take isl_map *map1,
6086                 __isl_take isl_map *map2);
6088         #include <isl/union_map.h>
6089         __isl_give isl_union_map *
6090         isl_union_map_flat_domain_product(
6091                 __isl_take isl_union_map *umap1,
6092                 __isl_take isl_union_map *umap2);
6093         __isl_give isl_union_map *
6094         isl_union_map_flat_range_product(
6095                 __isl_take isl_union_map *umap1,
6096                 __isl_take isl_union_map *umap2);
6098         #include <isl/val.h>
6099         __isl_give isl_multi_val *isl_multi_val_flat_range_product(
6100                 __isl_take isl_multi_val *mv1,
6101                 __isl_take isl_multi_aff *mv2);
6103         #include <isl/aff.h>
6104         __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
6105                 __isl_take isl_multi_aff *ma1,
6106                 __isl_take isl_multi_aff *ma2);
6107         __isl_give isl_pw_multi_aff *
6108         isl_pw_multi_aff_flat_range_product(
6109                 __isl_take isl_pw_multi_aff *pma1,
6110                 __isl_take isl_pw_multi_aff *pma2);
6111         __isl_give isl_multi_pw_aff *
6112         isl_multi_pw_aff_flat_range_product(
6113                 __isl_take isl_multi_pw_aff *mpa1,
6114                 __isl_take isl_multi_pw_aff *mpa2);
6115         __isl_give isl_union_pw_multi_aff *
6116         isl_union_pw_multi_aff_flat_range_product(
6117                 __isl_take isl_union_pw_multi_aff *upma1,
6118                 __isl_take isl_union_pw_multi_aff *upma2);
6119         __isl_give isl_multi_union_pw_aff *
6120         isl_multi_union_pw_aff_flat_range_product(
6121                 __isl_take isl_multi_union_pw_aff *mupa1,
6122                 __isl_take isl_multi_union_pw_aff *mupa2);
6124         #include <isl/space.h>
6125         __isl_give isl_space *isl_space_factor_domain(
6126                 __isl_take isl_space *space);
6127         __isl_give isl_space *isl_space_factor_range(
6128                 __isl_take isl_space *space);
6129         __isl_give isl_space *isl_space_domain_factor_domain(
6130                 __isl_take isl_space *space);
6131         __isl_give isl_space *isl_space_domain_factor_range(
6132                 __isl_take isl_space *space);
6133         __isl_give isl_space *isl_space_range_factor_domain(
6134                 __isl_take isl_space *space);
6135         __isl_give isl_space *isl_space_range_factor_range(
6136                 __isl_take isl_space *space);
6138 The functions C<isl_space_range_factor_domain> and
6139 C<isl_space_range_factor_range> extract the two arguments from
6140 the result of a call to C<isl_space_range_product>.
6142 The arguments of a call to C<isl_map_range_product> can be extracted
6143 from the result using the following functions.
6145         #include <isl/map.h>
6146         __isl_give isl_map *isl_map_factor_domain(
6147                 __isl_take isl_map *map);
6148         __isl_give isl_map *isl_map_factor_range(
6149                 __isl_take isl_map *map);
6150         __isl_give isl_map *isl_map_domain_factor_domain(
6151                 __isl_take isl_map *map);
6152         __isl_give isl_map *isl_map_domain_factor_range(
6153                 __isl_take isl_map *map);
6154         __isl_give isl_map *isl_map_range_factor_domain(
6155                 __isl_take isl_map *map);
6156         __isl_give isl_map *isl_map_range_factor_range(
6157                 __isl_take isl_map *map);
6159         #include <isl/union_map.h>
6160         __isl_give isl_union_map *isl_union_map_factor_domain(
6161                 __isl_take isl_union_map *umap);
6162         __isl_give isl_union_map *isl_union_map_factor_range(
6163                 __isl_take isl_union_map *umap);
6164         __isl_give isl_union_map *
6165         isl_union_map_domain_factor_domain(
6166                 __isl_take isl_union_map *umap);
6167         __isl_give isl_union_map *
6168         isl_union_map_domain_factor_range(
6169                 __isl_take isl_union_map *umap);
6170         __isl_give isl_union_map *
6171         isl_union_map_range_factor_range(
6172                 __isl_take isl_union_map *umap);
6174         #include <isl/val.h>
6175         __isl_give isl_multi_val *
6176         isl_multi_val_range_factor_domain(
6177                 __isl_take isl_multi_val *mv);
6178         __isl_give isl_multi_val *
6179         isl_multi_val_range_factor_range(
6180                 __isl_take isl_multi_val *mv);
6182         #include <isl/aff.h>
6183         __isl_give isl_multi_aff *
6184         isl_multi_aff_range_factor_domain(
6185                 __isl_take isl_multi_aff *ma);
6186         __isl_give isl_multi_aff *
6187         isl_multi_aff_range_factor_range(
6188                 __isl_take isl_multi_aff *ma);
6189         __isl_give isl_multi_pw_aff *
6190         isl_multi_pw_aff_range_factor_domain(
6191                 __isl_take isl_multi_pw_aff *mpa);
6192         __isl_give isl_multi_pw_aff *
6193         isl_multi_pw_aff_range_factor_range(
6194                 __isl_take isl_multi_pw_aff *mpa);
6195         __isl_give isl_multi_union_pw_aff *
6196         isl_multi_union_pw_aff_range_factor_domain(
6197                 __isl_take isl_multi_union_pw_aff *mupa);
6198         __isl_give isl_multi_union_pw_aff *
6199         isl_multi_union_pw_aff_range_factor_range(
6200                 __isl_take isl_multi_union_pw_aff *mupa);
6202 The splice functions are a generalization of the flat product functions,
6203 where the second argument may be inserted at any position inside
6204 the first argument rather than being placed at the end.
6206         #include <isl/val.h>
6207         __isl_give isl_multi_val *isl_multi_val_range_splice(
6208                 __isl_take isl_multi_val *mv1, unsigned pos,
6209                 __isl_take isl_multi_val *mv2);
6211         #include <isl/aff.h>
6212         __isl_give isl_multi_aff *isl_multi_aff_range_splice(
6213                 __isl_take isl_multi_aff *ma1, unsigned pos,
6214                 __isl_take isl_multi_aff *ma2);
6215         __isl_give isl_multi_aff *isl_multi_aff_splice(
6216                 __isl_take isl_multi_aff *ma1,
6217                 unsigned in_pos, unsigned out_pos,
6218                 __isl_take isl_multi_aff *ma2);
6219         __isl_give isl_multi_pw_aff *
6220         isl_multi_pw_aff_range_splice(
6221                 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
6222                 __isl_take isl_multi_pw_aff *mpa2);
6223         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
6224                 __isl_take isl_multi_pw_aff *mpa1,
6225                 unsigned in_pos, unsigned out_pos,
6226                 __isl_take isl_multi_pw_aff *mpa2);
6227         __isl_give isl_multi_union_pw_aff *
6228         isl_multi_union_pw_aff_range_splice(
6229                 __isl_take isl_multi_union_pw_aff *mupa1,
6230                 unsigned pos,
6231                 __isl_take isl_multi_union_pw_aff *mupa2);
6233 =item * Simplification
6235 When applied to a set or relation,
6236 the gist operation returns a set or relation that has the
6237 same intersection with the context as the input set or relation.
6238 Any implicit equality in the intersection is made explicit in the result,
6239 while all inequalities that are redundant with respect to the intersection
6240 are removed.
6241 In case of union sets and relations, the gist operation is performed
6242 per space.
6244 When applied to a function,
6245 the gist operation applies the set gist operation to each of
6246 the cells in the domain of the input piecewise expression.
6247 The context is also exploited
6248 to simplify the expression associated to each cell.
6250         #include <isl/set.h>
6251         __isl_give isl_basic_set *isl_basic_set_gist(
6252                 __isl_take isl_basic_set *bset,
6253                 __isl_take isl_basic_set *context);
6254         __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
6255                 __isl_take isl_set *context);
6256         __isl_give isl_set *isl_set_gist_params(
6257                 __isl_take isl_set *set,
6258                 __isl_take isl_set *context);
6260         #include <isl/map.h>
6261         __isl_give isl_basic_map *isl_basic_map_gist(
6262                 __isl_take isl_basic_map *bmap,
6263                 __isl_take isl_basic_map *context);
6264         __isl_give isl_basic_map *isl_basic_map_gist_domain(
6265                 __isl_take isl_basic_map *bmap,
6266                 __isl_take isl_basic_set *context);
6267         __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
6268                 __isl_take isl_map *context);
6269         __isl_give isl_map *isl_map_gist_params(
6270                 __isl_take isl_map *map,
6271                 __isl_take isl_set *context);
6272         __isl_give isl_map *isl_map_gist_domain(
6273                 __isl_take isl_map *map,
6274                 __isl_take isl_set *context);
6275         __isl_give isl_map *isl_map_gist_range(
6276                 __isl_take isl_map *map,
6277                 __isl_take isl_set *context);
6279         #include <isl/union_set.h>
6280         __isl_give isl_union_set *isl_union_set_gist(
6281                 __isl_take isl_union_set *uset,
6282                 __isl_take isl_union_set *context);
6283         __isl_give isl_union_set *isl_union_set_gist_params(
6284                 __isl_take isl_union_set *uset,
6285                 __isl_take isl_set *set);
6287         #include <isl/union_map.h>
6288         __isl_give isl_union_map *isl_union_map_gist(
6289                 __isl_take isl_union_map *umap,
6290                 __isl_take isl_union_map *context);
6291         __isl_give isl_union_map *isl_union_map_gist_params(
6292                 __isl_take isl_union_map *umap,
6293                 __isl_take isl_set *set);
6294         __isl_give isl_union_map *isl_union_map_gist_domain(
6295                 __isl_take isl_union_map *umap,
6296                 __isl_take isl_union_set *uset);
6297         __isl_give isl_union_map *isl_union_map_gist_range(
6298                 __isl_take isl_union_map *umap,
6299                 __isl_take isl_union_set *uset);
6301         #include <isl/aff.h>
6302         __isl_give isl_aff *isl_aff_gist_params(
6303                 __isl_take isl_aff *aff,
6304                 __isl_take isl_set *context);
6305         __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
6306                 __isl_take isl_set *context);
6307         __isl_give isl_multi_aff *isl_multi_aff_gist_params(
6308                 __isl_take isl_multi_aff *maff,
6309                 __isl_take isl_set *context);
6310         __isl_give isl_multi_aff *isl_multi_aff_gist(
6311                 __isl_take isl_multi_aff *maff,
6312                 __isl_take isl_set *context);
6313         __isl_give isl_pw_aff *isl_pw_aff_gist_params(
6314                 __isl_take isl_pw_aff *pwaff,
6315                 __isl_take isl_set *context);
6316         __isl_give isl_pw_aff *isl_pw_aff_gist(
6317                 __isl_take isl_pw_aff *pwaff,
6318                 __isl_take isl_set *context);
6319         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
6320                 __isl_take isl_pw_multi_aff *pma,
6321                 __isl_take isl_set *set);
6322         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
6323                 __isl_take isl_pw_multi_aff *pma,
6324                 __isl_take isl_set *set);
6325         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
6326                 __isl_take isl_multi_pw_aff *mpa,
6327                 __isl_take isl_set *set);
6328         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
6329                 __isl_take isl_multi_pw_aff *mpa,
6330                 __isl_take isl_set *set);
6331         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
6332                 __isl_take isl_union_pw_aff *upa,
6333                 __isl_take isl_union_set *context);
6334         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
6335                 __isl_take isl_union_pw_aff *upa,
6336                 __isl_take isl_set *context);
6337         __isl_give isl_union_pw_multi_aff *
6338         isl_union_pw_multi_aff_gist_params(
6339                 __isl_take isl_union_pw_multi_aff *upma,
6340                 __isl_take isl_set *context);
6341         __isl_give isl_union_pw_multi_aff *
6342         isl_union_pw_multi_aff_gist(
6343                 __isl_take isl_union_pw_multi_aff *upma,
6344                 __isl_take isl_union_set *context);
6345         __isl_give isl_multi_union_pw_aff *
6346         isl_multi_union_pw_aff_gist_params(
6347                 __isl_take isl_multi_union_pw_aff *aff,
6348                 __isl_take isl_set *context);
6349         __isl_give isl_multi_union_pw_aff *
6350         isl_multi_union_pw_aff_gist(
6351                 __isl_take isl_multi_union_pw_aff *aff,
6352                 __isl_take isl_union_set *context);
6354         #include <isl/polynomial.h>
6355         __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
6356                 __isl_take isl_qpolynomial *qp,
6357                 __isl_take isl_set *context);
6358         __isl_give isl_qpolynomial *isl_qpolynomial_gist(
6359                 __isl_take isl_qpolynomial *qp,
6360                 __isl_take isl_set *context);
6361         __isl_give isl_qpolynomial_fold *
6362         isl_qpolynomial_fold_gist_params(
6363                 __isl_take isl_qpolynomial_fold *fold,
6364                 __isl_take isl_set *context);
6365         __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
6366                 __isl_take isl_qpolynomial_fold *fold,
6367                 __isl_take isl_set *context);
6368         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
6369                 __isl_take isl_pw_qpolynomial *pwqp,
6370                 __isl_take isl_set *context);
6371         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
6372                 __isl_take isl_pw_qpolynomial *pwqp,
6373                 __isl_take isl_set *context);
6374         __isl_give isl_pw_qpolynomial_fold *
6375         isl_pw_qpolynomial_fold_gist(
6376                 __isl_take isl_pw_qpolynomial_fold *pwf,
6377                 __isl_take isl_set *context);
6378         __isl_give isl_pw_qpolynomial_fold *
6379         isl_pw_qpolynomial_fold_gist_params(
6380                 __isl_take isl_pw_qpolynomial_fold *pwf,
6381                 __isl_take isl_set *context);
6382         __isl_give isl_union_pw_qpolynomial *
6383         isl_union_pw_qpolynomial_gist_params(
6384                 __isl_take isl_union_pw_qpolynomial *upwqp,
6385                 __isl_take isl_set *context);
6386         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
6387                 __isl_take isl_union_pw_qpolynomial *upwqp,
6388                 __isl_take isl_union_set *context);
6389         __isl_give isl_union_pw_qpolynomial_fold *
6390         isl_union_pw_qpolynomial_fold_gist(
6391                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6392                 __isl_take isl_union_set *context);
6393         __isl_give isl_union_pw_qpolynomial_fold *
6394         isl_union_pw_qpolynomial_fold_gist_params(
6395                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6396                 __isl_take isl_set *context);
6398 =item * Binary Arithmethic Operations
6400         #include <isl/val.h>
6401         __isl_give isl_multi_val *isl_multi_val_sub(
6402                 __isl_take isl_multi_val *mv1,
6403                 __isl_take isl_multi_val *mv2);
6405         #include <isl/aff.h>
6406         __isl_give isl_aff *isl_aff_add(
6407                 __isl_take isl_aff *aff1,
6408                 __isl_take isl_aff *aff2);
6409         __isl_give isl_multi_aff *isl_multi_aff_add(
6410                 __isl_take isl_multi_aff *maff1,
6411                 __isl_take isl_multi_aff *maff2);
6412         __isl_give isl_pw_aff *isl_pw_aff_add(
6413                 __isl_take isl_pw_aff *pwaff1,
6414                 __isl_take isl_pw_aff *pwaff2);
6415         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
6416                 __isl_take isl_pw_multi_aff *pma1,
6417                 __isl_take isl_pw_multi_aff *pma2);
6418         __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
6419                 __isl_take isl_union_pw_aff *upa1,
6420                 __isl_take isl_union_pw_aff *upa2);
6421         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
6422                 __isl_take isl_union_pw_multi_aff *upma1,
6423                 __isl_take isl_union_pw_multi_aff *upma2);
6424         __isl_give isl_pw_aff *isl_pw_aff_min(
6425                 __isl_take isl_pw_aff *pwaff1,
6426                 __isl_take isl_pw_aff *pwaff2);
6427         __isl_give isl_pw_aff *isl_pw_aff_max(
6428                 __isl_take isl_pw_aff *pwaff1,
6429                 __isl_take isl_pw_aff *pwaff2);
6430         __isl_give isl_aff *isl_aff_sub(
6431                 __isl_take isl_aff *aff1,
6432                 __isl_take isl_aff *aff2);
6433         __isl_give isl_multi_aff *isl_multi_aff_sub(
6434                 __isl_take isl_multi_aff *ma1,
6435                 __isl_take isl_multi_aff *ma2);
6436         __isl_give isl_pw_aff *isl_pw_aff_sub(
6437                 __isl_take isl_pw_aff *pwaff1,
6438                 __isl_take isl_pw_aff *pwaff2);
6439         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
6440                 __isl_take isl_multi_pw_aff *mpa1,
6441                 __isl_take isl_multi_pw_aff *mpa2);
6442         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
6443                 __isl_take isl_pw_multi_aff *pma1,
6444                 __isl_take isl_pw_multi_aff *pma2);
6445         __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
6446                 __isl_take isl_union_pw_aff *upa1,
6447                 __isl_take isl_union_pw_aff *upa2);
6448         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
6449                 __isl_take isl_union_pw_multi_aff *upma1,
6450                 __isl_take isl_union_pw_multi_aff *upma2);
6451         __isl_give isl_multi_union_pw_aff *
6452         isl_multi_union_pw_aff_sub(
6453                 __isl_take isl_multi_union_pw_aff *mupa1,
6454                 __isl_take isl_multi_union_pw_aff *mupa2);
6456 C<isl_aff_sub> subtracts the second argument from the first.
6458         #include <isl/polynomial.h>
6459         __isl_give isl_qpolynomial *isl_qpolynomial_add(
6460                 __isl_take isl_qpolynomial *qp1,
6461                 __isl_take isl_qpolynomial *qp2);
6462         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
6463                 __isl_take isl_pw_qpolynomial *pwqp1,
6464                 __isl_take isl_pw_qpolynomial *pwqp2);
6465         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
6466                 __isl_take isl_pw_qpolynomial *pwqp1,
6467                 __isl_take isl_pw_qpolynomial *pwqp2);
6468         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
6469                 __isl_take isl_pw_qpolynomial_fold *pwf1,
6470                 __isl_take isl_pw_qpolynomial_fold *pwf2);
6471         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
6472                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6473                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6474         __isl_give isl_qpolynomial *isl_qpolynomial_sub(
6475                 __isl_take isl_qpolynomial *qp1,
6476                 __isl_take isl_qpolynomial *qp2);
6477         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
6478                 __isl_take isl_pw_qpolynomial *pwqp1,
6479                 __isl_take isl_pw_qpolynomial *pwqp2);
6480         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
6481                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6482                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6483         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
6484                 __isl_take isl_pw_qpolynomial_fold *pwf1,
6485                 __isl_take isl_pw_qpolynomial_fold *pwf2);
6486         __isl_give isl_union_pw_qpolynomial_fold *
6487         isl_union_pw_qpolynomial_fold_fold(
6488                 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
6489                 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
6491         #include <isl/aff.h>
6492         __isl_give isl_pw_aff *isl_pw_aff_union_add(
6493                 __isl_take isl_pw_aff *pwaff1,
6494                 __isl_take isl_pw_aff *pwaff2);
6495         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
6496                 __isl_take isl_pw_multi_aff *pma1,
6497                 __isl_take isl_pw_multi_aff *pma2);
6498         __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
6499                 __isl_take isl_union_pw_aff *upa1,
6500                 __isl_take isl_union_pw_aff *upa2);
6501         __isl_give isl_union_pw_multi_aff *
6502         isl_union_pw_multi_aff_union_add(
6503                 __isl_take isl_union_pw_multi_aff *upma1,
6504                 __isl_take isl_union_pw_multi_aff *upma2);
6505         __isl_give isl_multi_union_pw_aff *
6506         isl_multi_union_pw_aff_union_add(
6507                 __isl_take isl_multi_union_pw_aff *mupa1,
6508                 __isl_take isl_multi_union_pw_aff *mupa2);
6509         __isl_give isl_pw_aff *isl_pw_aff_union_min(
6510                 __isl_take isl_pw_aff *pwaff1,
6511                 __isl_take isl_pw_aff *pwaff2);
6512         __isl_give isl_pw_aff *isl_pw_aff_union_max(
6513                 __isl_take isl_pw_aff *pwaff1,
6514                 __isl_take isl_pw_aff *pwaff2);
6516 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
6517 expression with a domain that is the union of those of C<pwaff1> and
6518 C<pwaff2> and such that on each cell, the quasi-affine expression is
6519 the maximum of those of C<pwaff1> and C<pwaff2>.  If only one of
6520 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
6521 associated expression is the defined one.
6522 This in contrast to the C<isl_pw_aff_max> function, which is
6523 only defined on the shared definition domain of the arguments.
6525         #include <isl/val.h>
6526         __isl_give isl_multi_val *isl_multi_val_add_val(
6527                 __isl_take isl_multi_val *mv,
6528                 __isl_take isl_val *v);
6529         __isl_give isl_multi_val *isl_multi_val_mod_val(
6530                 __isl_take isl_multi_val *mv,
6531                 __isl_take isl_val *v);
6532         __isl_give isl_multi_val *isl_multi_val_scale_val(
6533                 __isl_take isl_multi_val *mv,
6534                 __isl_take isl_val *v);
6535         __isl_give isl_multi_val *isl_multi_val_scale_down_val(
6536                 __isl_take isl_multi_val *mv,
6537                 __isl_take isl_val *v);
6539         #include <isl/aff.h>
6540         __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
6541                 __isl_take isl_val *mod);
6542         __isl_give isl_pw_aff *isl_pw_aff_mod_val(
6543                 __isl_take isl_pw_aff *pa,
6544                 __isl_take isl_val *mod);
6545         __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
6546                 __isl_take isl_union_pw_aff *upa,
6547                 __isl_take isl_val *f);
6548         __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
6549                 __isl_take isl_val *v);
6550         __isl_give isl_multi_aff *isl_multi_aff_scale_val(
6551                 __isl_take isl_multi_aff *ma,
6552                 __isl_take isl_val *v);
6553         __isl_give isl_pw_aff *isl_pw_aff_scale_val(
6554                 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
6555         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
6556                 __isl_take isl_multi_pw_aff *mpa,
6557                 __isl_take isl_val *v);
6558         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
6559                 __isl_take isl_pw_multi_aff *pma,
6560                 __isl_take isl_val *v);
6561         __isl_give isl_union_pw_multi_aff *
6562         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
6563                 __isl_take isl_union_pw_aff *upa,
6564                 __isl_take isl_val *f);
6565         isl_union_pw_multi_aff_scale_val(
6566                 __isl_take isl_union_pw_multi_aff *upma,
6567                 __isl_take isl_val *val);
6568         __isl_give isl_multi_union_pw_aff *
6569         isl_multi_union_pw_aff_scale_val(
6570                 __isl_take isl_multi_union_pw_aff *mupa,
6571                 __isl_take isl_val *v);
6572         __isl_give isl_aff *isl_aff_scale_down_ui(
6573                 __isl_take isl_aff *aff, unsigned f);
6574         __isl_give isl_aff *isl_aff_scale_down_val(
6575                 __isl_take isl_aff *aff, __isl_take isl_val *v);
6576         __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
6577                 __isl_take isl_multi_aff *ma,
6578                 __isl_take isl_val *v);
6579         __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
6580                 __isl_take isl_pw_aff *pa,
6581                 __isl_take isl_val *f);
6582         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
6583                 __isl_take isl_multi_pw_aff *mpa,
6584                 __isl_take isl_val *v);
6585         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
6586                 __isl_take isl_pw_multi_aff *pma,
6587                 __isl_take isl_val *v);
6588         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
6589                 __isl_take isl_union_pw_aff *upa,
6590                 __isl_take isl_val *v);
6591         __isl_give isl_union_pw_multi_aff *
6592         isl_union_pw_multi_aff_scale_down_val(
6593                 __isl_take isl_union_pw_multi_aff *upma,
6594                 __isl_take isl_val *val);
6595         __isl_give isl_multi_union_pw_aff *
6596         isl_multi_union_pw_aff_scale_down_val(
6597                 __isl_take isl_multi_union_pw_aff *mupa,
6598                 __isl_take isl_val *v);
6600         #include <isl/polynomial.h>
6601         __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
6602                 __isl_take isl_qpolynomial *qp,
6603                 __isl_take isl_val *v);
6604         __isl_give isl_qpolynomial_fold *
6605         isl_qpolynomial_fold_scale_val(
6606                 __isl_take isl_qpolynomial_fold *fold,
6607                 __isl_take isl_val *v);
6608         __isl_give isl_pw_qpolynomial *
6609         isl_pw_qpolynomial_scale_val(
6610                 __isl_take isl_pw_qpolynomial *pwqp,
6611                 __isl_take isl_val *v);
6612         __isl_give isl_pw_qpolynomial_fold *
6613         isl_pw_qpolynomial_fold_scale_val(
6614                 __isl_take isl_pw_qpolynomial_fold *pwf,
6615                 __isl_take isl_val *v);
6616         __isl_give isl_union_pw_qpolynomial *
6617         isl_union_pw_qpolynomial_scale_val(
6618                 __isl_take isl_union_pw_qpolynomial *upwqp,
6619                 __isl_take isl_val *v);
6620         __isl_give isl_union_pw_qpolynomial_fold *
6621         isl_union_pw_qpolynomial_fold_scale_val(
6622                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6623                 __isl_take isl_val *v);
6624         __isl_give isl_qpolynomial *
6625         isl_qpolynomial_scale_down_val(
6626                 __isl_take isl_qpolynomial *qp,
6627                 __isl_take isl_val *v);
6628         __isl_give isl_qpolynomial_fold *
6629         isl_qpolynomial_fold_scale_down_val(
6630                 __isl_take isl_qpolynomial_fold *fold,
6631                 __isl_take isl_val *v);
6632         __isl_give isl_pw_qpolynomial *
6633         isl_pw_qpolynomial_scale_down_val(
6634                 __isl_take isl_pw_qpolynomial *pwqp,
6635                 __isl_take isl_val *v);
6636         __isl_give isl_pw_qpolynomial_fold *
6637         isl_pw_qpolynomial_fold_scale_down_val(
6638                 __isl_take isl_pw_qpolynomial_fold *pwf,
6639                 __isl_take isl_val *v);
6640         __isl_give isl_union_pw_qpolynomial *
6641         isl_union_pw_qpolynomial_scale_down_val(
6642                 __isl_take isl_union_pw_qpolynomial *upwqp,
6643                 __isl_take isl_val *v);
6644         __isl_give isl_union_pw_qpolynomial_fold *
6645         isl_union_pw_qpolynomial_fold_scale_down_val(
6646                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6647                 __isl_take isl_val *v);
6649         #include <isl/val.h>
6650         __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
6651                 __isl_take isl_multi_val *mv1,
6652                 __isl_take isl_multi_val *mv2);
6653         __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
6654                 __isl_take isl_multi_val *mv1,
6655                 __isl_take isl_multi_val *mv2);
6656         __isl_give isl_multi_val *
6657         isl_multi_val_scale_down_multi_val(
6658                 __isl_take isl_multi_val *mv1,
6659                 __isl_take isl_multi_val *mv2);
6661         #include <isl/aff.h>
6662         __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
6663                 __isl_take isl_multi_aff *ma,
6664                 __isl_take isl_multi_val *mv);
6665         __isl_give isl_multi_union_pw_aff *
6666         isl_multi_union_pw_aff_mod_multi_val(
6667                 __isl_take isl_multi_union_pw_aff *upma,
6668                 __isl_take isl_multi_val *mv);
6669         __isl_give isl_multi_pw_aff *
6670         isl_multi_pw_aff_mod_multi_val(
6671                 __isl_take isl_multi_pw_aff *mpa,
6672                 __isl_take isl_multi_val *mv);
6673         __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
6674                 __isl_take isl_multi_aff *ma,
6675                 __isl_take isl_multi_val *mv);
6676         __isl_give isl_pw_multi_aff *
6677         isl_pw_multi_aff_scale_multi_val(
6678                 __isl_take isl_pw_multi_aff *pma,
6679                 __isl_take isl_multi_val *mv);
6680         __isl_give isl_multi_pw_aff *
6681         isl_multi_pw_aff_scale_multi_val(
6682                 __isl_take isl_multi_pw_aff *mpa,
6683                 __isl_take isl_multi_val *mv);
6684         __isl_give isl_multi_union_pw_aff *
6685         isl_multi_union_pw_aff_scale_multi_val(
6686                 __isl_take isl_multi_union_pw_aff *mupa,
6687                 __isl_take isl_multi_val *mv);
6688         __isl_give isl_union_pw_multi_aff *
6689         isl_union_pw_multi_aff_scale_multi_val(
6690                 __isl_take isl_union_pw_multi_aff *upma,
6691                 __isl_take isl_multi_val *mv);
6692         __isl_give isl_multi_aff *
6693         isl_multi_aff_scale_down_multi_val(
6694                 __isl_take isl_multi_aff *ma,
6695                 __isl_take isl_multi_val *mv);
6696         __isl_give isl_multi_pw_aff *
6697         isl_multi_pw_aff_scale_down_multi_val(
6698                 __isl_take isl_multi_pw_aff *mpa,
6699                 __isl_take isl_multi_val *mv);
6700         __isl_give isl_multi_union_pw_aff *
6701         isl_multi_union_pw_aff_scale_down_multi_val(
6702                 __isl_take isl_multi_union_pw_aff *mupa,
6703                 __isl_take isl_multi_val *mv);
6705 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
6706 by the corresponding elements of C<mv>.
6708         #include <isl/aff.h>
6709         __isl_give isl_aff *isl_aff_mul(
6710                 __isl_take isl_aff *aff1,
6711                 __isl_take isl_aff *aff2);
6712         __isl_give isl_aff *isl_aff_div(
6713                 __isl_take isl_aff *aff1,
6714                 __isl_take isl_aff *aff2);
6715         __isl_give isl_pw_aff *isl_pw_aff_mul(
6716                 __isl_take isl_pw_aff *pwaff1,
6717                 __isl_take isl_pw_aff *pwaff2);
6718         __isl_give isl_pw_aff *isl_pw_aff_div(
6719                 __isl_take isl_pw_aff *pa1,
6720                 __isl_take isl_pw_aff *pa2);
6721         __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
6722                 __isl_take isl_pw_aff *pa1,
6723                 __isl_take isl_pw_aff *pa2);
6724         __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
6725                 __isl_take isl_pw_aff *pa1,
6726                 __isl_take isl_pw_aff *pa2);
6728 When multiplying two affine expressions, at least one of the two needs
6729 to be a constant.  Similarly, when dividing an affine expression by another,
6730 the second expression needs to be a constant.
6731 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
6732 rounding towards zero.  C<isl_pw_aff_tdiv_r> computes the corresponding
6733 remainder.
6735         #include <isl/polynomial.h>
6736         __isl_give isl_qpolynomial *isl_qpolynomial_mul(
6737                 __isl_take isl_qpolynomial *qp1,
6738                 __isl_take isl_qpolynomial *qp2);
6739         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
6740                 __isl_take isl_pw_qpolynomial *pwqp1,
6741                 __isl_take isl_pw_qpolynomial *pwqp2);
6742         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
6743                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6744                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6746 =back
6748 =head3 Lexicographic Optimization
6750 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
6751 the following functions
6752 compute a set that contains the lexicographic minimum or maximum
6753 of the elements in C<set> (or C<bset>) for those values of the parameters
6754 that satisfy C<dom>.
6755 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6756 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
6757 has no elements.
6758 In other words, the union of the parameter values
6759 for which the result is non-empty and of C<*empty>
6760 is equal to C<dom>.
6762         #include <isl/set.h>
6763         __isl_give isl_set *isl_basic_set_partial_lexmin(
6764                 __isl_take isl_basic_set *bset,
6765                 __isl_take isl_basic_set *dom,
6766                 __isl_give isl_set **empty);
6767         __isl_give isl_set *isl_basic_set_partial_lexmax(
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_set_partial_lexmin(
6772                 __isl_take isl_set *set, __isl_take isl_set *dom,
6773                 __isl_give isl_set **empty);
6774         __isl_give isl_set *isl_set_partial_lexmax(
6775                 __isl_take isl_set *set, __isl_take isl_set *dom,
6776                 __isl_give isl_set **empty);
6778 Given a (basic) set C<set> (or C<bset>), the following functions simply
6779 return a set containing the lexicographic minimum or maximum
6780 of the elements in C<set> (or C<bset>).
6781 In case of union sets, the optimum is computed per space.
6783         #include <isl/set.h>
6784         __isl_give isl_set *isl_basic_set_lexmin(
6785                 __isl_take isl_basic_set *bset);
6786         __isl_give isl_set *isl_basic_set_lexmax(
6787                 __isl_take isl_basic_set *bset);
6788         __isl_give isl_set *isl_set_lexmin(
6789                 __isl_take isl_set *set);
6790         __isl_give isl_set *isl_set_lexmax(
6791                 __isl_take isl_set *set);
6792         __isl_give isl_union_set *isl_union_set_lexmin(
6793                 __isl_take isl_union_set *uset);
6794         __isl_give isl_union_set *isl_union_set_lexmax(
6795                 __isl_take isl_union_set *uset);
6797 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
6798 the following functions
6799 compute a relation that maps each element of C<dom>
6800 to the single lexicographic minimum or maximum
6801 of the elements that are associated to that same
6802 element in C<map> (or C<bmap>).
6803 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6804 that contains the elements in C<dom> that do not map
6805 to any elements in C<map> (or C<bmap>).
6806 In other words, the union of the domain of the result and of C<*empty>
6807 is equal to C<dom>.
6809         #include <isl/map.h>
6810         __isl_give isl_map *isl_basic_map_partial_lexmax(
6811                 __isl_take isl_basic_map *bmap,
6812                 __isl_take isl_basic_set *dom,
6813                 __isl_give isl_set **empty);
6814         __isl_give isl_map *isl_basic_map_partial_lexmin(
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_map_partial_lexmax(
6819                 __isl_take isl_map *map, __isl_take isl_set *dom,
6820                 __isl_give isl_set **empty);
6821         __isl_give isl_map *isl_map_partial_lexmin(
6822                 __isl_take isl_map *map, __isl_take isl_set *dom,
6823                 __isl_give isl_set **empty);
6825 Given a (basic) map C<map> (or C<bmap>), the following functions simply
6826 return a map mapping each element in the domain of
6827 C<map> (or C<bmap>) to the lexicographic minimum or maximum
6828 of all elements associated to that element.
6829 In case of union relations, the optimum is computed per space.
6831         #include <isl/map.h>
6832         __isl_give isl_map *isl_basic_map_lexmin(
6833                 __isl_take isl_basic_map *bmap);
6834         __isl_give isl_map *isl_basic_map_lexmax(
6835                 __isl_take isl_basic_map *bmap);
6836         __isl_give isl_map *isl_map_lexmin(
6837                 __isl_take isl_map *map);
6838         __isl_give isl_map *isl_map_lexmax(
6839                 __isl_take isl_map *map);
6840         __isl_give isl_union_map *isl_union_map_lexmin(
6841                 __isl_take isl_union_map *umap);
6842         __isl_give isl_union_map *isl_union_map_lexmax(
6843                 __isl_take isl_union_map *umap);
6845 The following functions return their result in the form of
6846 a piecewise multi-affine expression,
6847 but are otherwise equivalent to the corresponding functions
6848 returning a basic set or relation.
6850         #include <isl/set.h>
6851         __isl_give isl_pw_multi_aff *
6852         isl_basic_set_partial_lexmin_pw_multi_aff(
6853                 __isl_take isl_basic_set *bset,
6854                 __isl_take isl_basic_set *dom,
6855                 __isl_give isl_set **empty);
6856         __isl_give isl_pw_multi_aff *
6857         isl_basic_set_partial_lexmax_pw_multi_aff(
6858                 __isl_take isl_basic_set *bset,
6859                 __isl_take isl_basic_set *dom,
6860                 __isl_give isl_set **empty);
6861         __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
6862                 __isl_take isl_set *set);
6863         __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
6864                 __isl_take isl_set *set);
6866         #include <isl/map.h>
6867         __isl_give isl_pw_multi_aff *
6868         isl_basic_map_lexmin_pw_multi_aff(
6869                 __isl_take isl_basic_map *bmap);
6870         __isl_give isl_pw_multi_aff *
6871         isl_basic_map_partial_lexmin_pw_multi_aff(
6872                 __isl_take isl_basic_map *bmap,
6873                 __isl_take isl_basic_set *dom,
6874                 __isl_give isl_set **empty);
6875         __isl_give isl_pw_multi_aff *
6876         isl_basic_map_partial_lexmax_pw_multi_aff(
6877                 __isl_take isl_basic_map *bmap,
6878                 __isl_take isl_basic_set *dom,
6879                 __isl_give isl_set **empty);
6880         __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
6881                 __isl_take isl_map *map);
6882         __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
6883                 __isl_take isl_map *map);
6885 The following functions return the lexicographic minimum or maximum
6886 on the shared domain of the inputs and the single defined function
6887 on those parts of the domain where only a single function is defined.
6889         #include <isl/aff.h>
6890         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
6891                 __isl_take isl_pw_multi_aff *pma1,
6892                 __isl_take isl_pw_multi_aff *pma2);
6893         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
6894                 __isl_take isl_pw_multi_aff *pma1,
6895                 __isl_take isl_pw_multi_aff *pma2);
6897 =head2 Ternary Operations
6899         #include <isl/aff.h>
6900         __isl_give isl_pw_aff *isl_pw_aff_cond(
6901                 __isl_take isl_pw_aff *cond,
6902                 __isl_take isl_pw_aff *pwaff_true,
6903                 __isl_take isl_pw_aff *pwaff_false);
6905 The function C<isl_pw_aff_cond> performs a conditional operator
6906 and returns an expression that is equal to C<pwaff_true>
6907 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
6908 where C<cond> is zero.
6910 =head2 Lists
6912 Lists are defined over several element types, including
6913 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_union_pw_aff>,
6914 C<isl_union_pw_multi_aff>, C<isl_constraint>,
6915 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
6916 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
6917 Here we take lists of C<isl_set>s as an example.
6918 Lists can be created, copied, modified and freed using the following functions.
6920         #include <isl/set.h>
6921         __isl_give isl_set_list *isl_set_list_from_set(
6922                 __isl_take isl_set *el);
6923         __isl_give isl_set_list *isl_set_list_alloc(
6924                 isl_ctx *ctx, int n);
6925         __isl_give isl_set_list *isl_set_list_copy(
6926                 __isl_keep isl_set_list *list);
6927         __isl_give isl_set_list *isl_set_list_insert(
6928                 __isl_take isl_set_list *list, unsigned pos,
6929                 __isl_take isl_set *el);
6930         __isl_give isl_set_list *isl_set_list_add(
6931                 __isl_take isl_set_list *list,
6932                 __isl_take isl_set *el);
6933         __isl_give isl_set_list *isl_set_list_drop(
6934                 __isl_take isl_set_list *list,
6935                 unsigned first, unsigned n);
6936         __isl_give isl_set_list *isl_set_list_set_set(
6937                 __isl_take isl_set_list *list, int index,
6938                 __isl_take isl_set *set);
6939         __isl_give isl_set_list *isl_set_list_concat(
6940                 __isl_take isl_set_list *list1,
6941                 __isl_take isl_set_list *list2);
6942         __isl_give isl_set_list *isl_set_list_sort(
6943                 __isl_take isl_set_list *list,
6944                 int (*cmp)(__isl_keep isl_set *a,
6945                         __isl_keep isl_set *b, void *user),
6946                 void *user);
6947         __isl_null isl_set_list *isl_set_list_free(
6948                 __isl_take isl_set_list *list);
6950 C<isl_set_list_alloc> creates an empty list with an initial capacity
6951 for C<n> elements.  C<isl_set_list_insert> and C<isl_set_list_add>
6952 add elements to a list, increasing its capacity as needed.
6953 C<isl_set_list_from_set> creates a list with a single element.
6955 Lists can be inspected using the following functions.
6957         #include <isl/set.h>
6958         int isl_set_list_n_set(__isl_keep isl_set_list *list);
6959         __isl_give isl_set *isl_set_list_get_set(
6960                 __isl_keep isl_set_list *list, int index);
6961         int isl_set_list_foreach(__isl_keep isl_set_list *list,
6962                 int (*fn)(__isl_take isl_set *el, void *user),
6963                 void *user);
6964         int isl_set_list_foreach_scc(__isl_keep isl_set_list *list,
6965                 int (*follows)(__isl_keep isl_set *a,
6966                         __isl_keep isl_set *b, void *user),
6967                 void *follows_user
6968                 int (*fn)(__isl_take isl_set *el, void *user),
6969                 void *fn_user);
6971 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
6972 strongly connected components of the graph with as vertices the elements
6973 of C<list> and a directed edge from vertex C<b> to vertex C<a>
6974 iff C<follows(a, b)> returns C<1>.  The callbacks C<follows> and C<fn>
6975 should return C<-1> on error.
6977 Lists can be printed using
6979         #include <isl/set.h>
6980         __isl_give isl_printer *isl_printer_print_set_list(
6981                 __isl_take isl_printer *p,
6982                 __isl_keep isl_set_list *list);
6984 =head2 Associative arrays
6986 Associative arrays map isl objects of a specific type to isl objects
6987 of some (other) specific type.  They are defined for several pairs
6988 of types, including (C<isl_map>, C<isl_basic_set>),
6989 (C<isl_id>, C<isl_ast_expr>) and.
6990 (C<isl_id>, C<isl_pw_aff>).
6991 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
6992 as an example.
6994 Associative arrays can be created, copied and freed using
6995 the following functions.
6997         #include <isl/id_to_ast_expr.h>
6998         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
6999                 isl_ctx *ctx, int min_size);
7000         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
7001                 __isl_keep isl_id_to_ast_expr *id2expr);
7002         __isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
7003                 __isl_take isl_id_to_ast_expr *id2expr);
7005 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
7006 to specify the expected size of the associative array.
7007 The associative array will be grown automatically as needed.
7009 Associative arrays can be inspected using the following functions.
7011         #include <isl/id_to_ast_expr.h>
7012         int isl_id_to_ast_expr_has(
7013                 __isl_keep isl_id_to_ast_expr *id2expr,
7014                 __isl_keep isl_id *key);
7015         __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
7016                 __isl_keep isl_id_to_ast_expr *id2expr,
7017                 __isl_take isl_id *key);
7018         int isl_id_to_ast_expr_foreach(
7019                 __isl_keep isl_id_to_ast_expr *id2expr,
7020                 int (*fn)(__isl_take isl_id *key,
7021                         __isl_take isl_ast_expr *val, void *user),
7022                 void *user);
7024 They can be modified using the following function.
7026         #include <isl/id_to_ast_expr.h>
7027         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
7028                 __isl_take isl_id_to_ast_expr *id2expr,
7029                 __isl_take isl_id *key,
7030                 __isl_take isl_ast_expr *val);
7031         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
7032                 __isl_take isl_id_to_ast_expr *id2expr,
7033                 __isl_take isl_id *key);
7035 Associative arrays can be printed using the following function.
7037         #include <isl/id_to_ast_expr.h>
7038         __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
7039                 __isl_take isl_printer *p,
7040                 __isl_keep isl_id_to_ast_expr *id2expr);
7042 =head2 Vectors
7044 Vectors can be created, copied and freed using the following functions.
7046         #include <isl/vec.h>
7047         __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
7048                 unsigned size);
7049         __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
7050         __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
7052 Note that the elements of a newly created vector may have arbitrary values.
7053 The elements can be changed and inspected using the following functions.
7055         int isl_vec_size(__isl_keep isl_vec *vec);
7056         __isl_give isl_val *isl_vec_get_element_val(
7057                 __isl_keep isl_vec *vec, int pos);
7058         __isl_give isl_vec *isl_vec_set_element_si(
7059                 __isl_take isl_vec *vec, int pos, int v);
7060         __isl_give isl_vec *isl_vec_set_element_val(
7061                 __isl_take isl_vec *vec, int pos,
7062                 __isl_take isl_val *v);
7063         __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
7064                 int v);
7065         __isl_give isl_vec *isl_vec_set_val(
7066                 __isl_take isl_vec *vec, __isl_take isl_val *v);
7067         int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
7068                 __isl_keep isl_vec *vec2, int pos);
7070 C<isl_vec_get_element> will return a negative value if anything went wrong.
7071 In that case, the value of C<*v> is undefined.
7073 The following function can be used to concatenate two vectors.
7075         __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
7076                 __isl_take isl_vec *vec2);
7078 =head2 Matrices
7080 Matrices can be created, copied and freed using the following functions.
7082         #include <isl/mat.h>
7083         __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
7084                 unsigned n_row, unsigned n_col);
7085         __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
7086         __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
7088 Note that the elements of a newly created matrix may have arbitrary values.
7089 The elements can be changed and inspected using the following functions.
7091         int isl_mat_rows(__isl_keep isl_mat *mat);
7092         int isl_mat_cols(__isl_keep isl_mat *mat);
7093         __isl_give isl_val *isl_mat_get_element_val(
7094                 __isl_keep isl_mat *mat, int row, int col);
7095         __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
7096                 int row, int col, int v);
7097         __isl_give isl_mat *isl_mat_set_element_val(
7098                 __isl_take isl_mat *mat, int row, int col,
7099                 __isl_take isl_val *v);
7101 C<isl_mat_get_element> will return a negative value if anything went wrong.
7102 In that case, the value of C<*v> is undefined.
7104 The following function can be used to compute the (right) inverse
7105 of a matrix, i.e., a matrix such that the product of the original
7106 and the inverse (in that order) is a multiple of the identity matrix.
7107 The input matrix is assumed to be of full row-rank.
7109         __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
7111 The following function can be used to compute the (right) kernel
7112 (or null space) of a matrix, i.e., a matrix such that the product of
7113 the original and the kernel (in that order) is the zero matrix.
7115         __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
7117 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
7119 The following functions determine
7120 an upper or lower bound on a quasipolynomial over its domain.
7122         __isl_give isl_pw_qpolynomial_fold *
7123         isl_pw_qpolynomial_bound(
7124                 __isl_take isl_pw_qpolynomial *pwqp,
7125                 enum isl_fold type, int *tight);
7127         __isl_give isl_union_pw_qpolynomial_fold *
7128         isl_union_pw_qpolynomial_bound(
7129                 __isl_take isl_union_pw_qpolynomial *upwqp,
7130                 enum isl_fold type, int *tight);
7132 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
7133 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
7134 is the returned bound is known be tight, i.e., for each value
7135 of the parameters there is at least
7136 one element in the domain that reaches the bound.
7137 If the domain of C<pwqp> is not wrapping, then the bound is computed
7138 over all elements in that domain and the result has a purely parametric
7139 domain.  If the domain of C<pwqp> is wrapping, then the bound is
7140 computed over the range of the wrapped relation.  The domain of the
7141 wrapped relation becomes the domain of the result.
7143 =head2 Parametric Vertex Enumeration
7145 The parametric vertex enumeration described in this section
7146 is mainly intended to be used internally and by the C<barvinok>
7147 library.
7149         #include <isl/vertices.h>
7150         __isl_give isl_vertices *isl_basic_set_compute_vertices(
7151                 __isl_keep isl_basic_set *bset);
7153 The function C<isl_basic_set_compute_vertices> performs the
7154 actual computation of the parametric vertices and the chamber
7155 decomposition and store the result in an C<isl_vertices> object.
7156 This information can be queried by either iterating over all
7157 the vertices or iterating over all the chambers or cells
7158 and then iterating over all vertices that are active on the chamber.
7160         int isl_vertices_foreach_vertex(
7161                 __isl_keep isl_vertices *vertices,
7162                 int (*fn)(__isl_take isl_vertex *vertex, void *user),
7163                 void *user);
7165         int isl_vertices_foreach_cell(
7166                 __isl_keep isl_vertices *vertices,
7167                 int (*fn)(__isl_take isl_cell *cell, void *user),
7168                 void *user);
7169         int isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
7170                 int (*fn)(__isl_take isl_vertex *vertex, void *user),
7171                 void *user);
7173 Other operations that can be performed on an C<isl_vertices> object are
7174 the following.
7176         int isl_vertices_get_n_vertices(
7177                 __isl_keep isl_vertices *vertices);
7178         void isl_vertices_free(__isl_take isl_vertices *vertices);
7180 Vertices can be inspected and destroyed using the following functions.
7182         int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
7183         __isl_give isl_basic_set *isl_vertex_get_domain(
7184                 __isl_keep isl_vertex *vertex);
7185         __isl_give isl_multi_aff *isl_vertex_get_expr(
7186                 __isl_keep isl_vertex *vertex);
7187         void isl_vertex_free(__isl_take isl_vertex *vertex);
7189 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
7190 describing the vertex in terms of the parameters,
7191 while C<isl_vertex_get_domain> returns the activity domain
7192 of the vertex.
7194 Chambers can be inspected and destroyed using the following functions.
7196         __isl_give isl_basic_set *isl_cell_get_domain(
7197                 __isl_keep isl_cell *cell);
7198         void isl_cell_free(__isl_take isl_cell *cell);
7200 =head1 Polyhedral Compilation Library
7202 This section collects functionality in C<isl> that has been specifically
7203 designed for use during polyhedral compilation.
7205 =head2 Dependence Analysis
7207 C<isl> contains specialized functionality for performing
7208 array dataflow analysis.  That is, given a I<sink> access relation
7209 and a collection of possible I<source> access relations,
7210 C<isl> can compute relations that describe
7211 for each iteration of the sink access, which iteration
7212 of which of the source access relations was the last
7213 to access the same data element before the given iteration
7214 of the sink access.
7215 The resulting dependence relations map source iterations
7216 to the corresponding sink iterations.
7217 To compute standard flow dependences, the sink should be
7218 a read, while the sources should be writes.
7219 If any of the source accesses are marked as being I<may>
7220 accesses, then there will be a dependence from the last
7221 I<must> access B<and> from any I<may> access that follows
7222 this last I<must> access.
7223 In particular, if I<all> sources are I<may> accesses,
7224 then memory based dependence analysis is performed.
7225 If, on the other hand, all sources are I<must> accesses,
7226 then value based dependence analysis is performed.
7228         #include <isl/flow.h>
7230         typedef int (*isl_access_level_before)(void *first, void *second);
7232         __isl_give isl_access_info *isl_access_info_alloc(
7233                 __isl_take isl_map *sink,
7234                 void *sink_user, isl_access_level_before fn,
7235                 int max_source);
7236         __isl_give isl_access_info *isl_access_info_add_source(
7237                 __isl_take isl_access_info *acc,
7238                 __isl_take isl_map *source, int must,
7239                 void *source_user);
7240         __isl_null isl_access_info *isl_access_info_free(
7241                 __isl_take isl_access_info *acc);
7243         __isl_give isl_flow *isl_access_info_compute_flow(
7244                 __isl_take isl_access_info *acc);
7246         int isl_flow_foreach(__isl_keep isl_flow *deps,
7247                 int (*fn)(__isl_take isl_map *dep, int must,
7248                           void *dep_user, void *user),
7249                 void *user);
7250         __isl_give isl_map *isl_flow_get_no_source(
7251                 __isl_keep isl_flow *deps, int must);
7252         void isl_flow_free(__isl_take isl_flow *deps);
7254 The function C<isl_access_info_compute_flow> performs the actual
7255 dependence analysis.  The other functions are used to construct
7256 the input for this function or to read off the output.
7258 The input is collected in an C<isl_access_info>, which can
7259 be created through a call to C<isl_access_info_alloc>.
7260 The arguments to this functions are the sink access relation
7261 C<sink>, a token C<sink_user> used to identify the sink
7262 access to the user, a callback function for specifying the
7263 relative order of source and sink accesses, and the number
7264 of source access relations that will be added.
7265 The callback function has type C<int (*)(void *first, void *second)>.
7266 The function is called with two user supplied tokens identifying
7267 either a source or the sink and it should return the shared nesting
7268 level and the relative order of the two accesses.
7269 In particular, let I<n> be the number of loops shared by
7270 the two accesses.  If C<first> precedes C<second> textually,
7271 then the function should return I<2 * n + 1>; otherwise,
7272 it should return I<2 * n>.
7273 The sources can be added to the C<isl_access_info> by performing
7274 (at most) C<max_source> calls to C<isl_access_info_add_source>.
7275 C<must> indicates whether the source is a I<must> access
7276 or a I<may> access.  Note that a multi-valued access relation
7277 should only be marked I<must> if every iteration in the domain
7278 of the relation accesses I<all> elements in its image.
7279 The C<source_user> token is again used to identify
7280 the source access.  The range of the source access relation
7281 C<source> should have the same dimension as the range
7282 of the sink access relation.
7283 The C<isl_access_info_free> function should usually not be
7284 called explicitly, because it is called implicitly by
7285 C<isl_access_info_compute_flow>.
7287 The result of the dependence analysis is collected in an
7288 C<isl_flow>.  There may be elements of
7289 the sink access for which no preceding source access could be
7290 found or for which all preceding sources are I<may> accesses.
7291 The relations containing these elements can be obtained through
7292 calls to C<isl_flow_get_no_source>, the first with C<must> set
7293 and the second with C<must> unset.
7294 In the case of standard flow dependence analysis,
7295 with the sink a read and the sources I<must> writes,
7296 the first relation corresponds to the reads from uninitialized
7297 array elements and the second relation is empty.
7298 The actual flow dependences can be extracted using
7299 C<isl_flow_foreach>.  This function will call the user-specified
7300 callback function C<fn> for each B<non-empty> dependence between
7301 a source and the sink.  The callback function is called
7302 with four arguments, the actual flow dependence relation
7303 mapping source iterations to sink iterations, a boolean that
7304 indicates whether it is a I<must> or I<may> dependence, a token
7305 identifying the source and an additional C<void *> with value
7306 equal to the third argument of the C<isl_flow_foreach> call.
7307 A dependence is marked I<must> if it originates from a I<must>
7308 source and if it is not followed by any I<may> sources.
7310 After finishing with an C<isl_flow>, the user should call
7311 C<isl_flow_free> to free all associated memory.
7313 A higher-level interface to dependence analysis is provided
7314 by the following function.
7316         #include <isl/flow.h>
7318         int isl_union_map_compute_flow(__isl_take isl_union_map *sink,
7319                 __isl_take isl_union_map *must_source,
7320                 __isl_take isl_union_map *may_source,
7321                 __isl_take isl_union_map *schedule,
7322                 __isl_give isl_union_map **must_dep,
7323                 __isl_give isl_union_map **may_dep,
7324                 __isl_give isl_union_map **must_no_source,
7325                 __isl_give isl_union_map **may_no_source);
7327 The arrays are identified by the tuple names of the ranges
7328 of the accesses.  The iteration domains by the tuple names
7329 of the domains of the accesses and of the schedule.
7330 The relative order of the iteration domains is given by the
7331 schedule.  The relations returned through C<must_no_source>
7332 and C<may_no_source> are subsets of C<sink>.
7333 Any of C<must_dep>, C<may_dep>, C<must_no_source>
7334 or C<may_no_source> may be C<NULL>, but a C<NULL> value for
7335 any of the other arguments is treated as an error.
7337 =head3 Interaction with Dependence Analysis
7339 During the dependence analysis, we frequently need to perform
7340 the following operation.  Given a relation between sink iterations
7341 and potential source iterations from a particular source domain,
7342 what is the last potential source iteration corresponding to each
7343 sink iteration.  It can sometimes be convenient to adjust
7344 the set of potential source iterations before or after each such operation.
7345 The prototypical example is fuzzy array dataflow analysis,
7346 where we need to analyze if, based on data-dependent constraints,
7347 the sink iteration can ever be executed without one or more of
7348 the corresponding potential source iterations being executed.
7349 If so, we can introduce extra parameters and select an unknown
7350 but fixed source iteration from the potential source iterations.
7351 To be able to perform such manipulations, C<isl> provides the following
7352 function.
7354         #include <isl/flow.h>
7356         typedef __isl_give isl_restriction *(*isl_access_restrict)(
7357                 __isl_keep isl_map *source_map,
7358                 __isl_keep isl_set *sink, void *source_user,
7359                 void *user);
7360         __isl_give isl_access_info *isl_access_info_set_restrict(
7361                 __isl_take isl_access_info *acc,
7362                 isl_access_restrict fn, void *user);
7364 The function C<isl_access_info_set_restrict> should be called
7365 before calling C<isl_access_info_compute_flow> and registers a callback function
7366 that will be called any time C<isl> is about to compute the last
7367 potential source.  The first argument is the (reverse) proto-dependence,
7368 mapping sink iterations to potential source iterations.
7369 The second argument represents the sink iterations for which
7370 we want to compute the last source iteration.
7371 The third argument is the token corresponding to the source
7372 and the final argument is the token passed to C<isl_access_info_set_restrict>.
7373 The callback is expected to return a restriction on either the input or
7374 the output of the operation computing the last potential source.
7375 If the input needs to be restricted then restrictions are needed
7376 for both the source and the sink iterations.  The sink iterations
7377 and the potential source iterations will be intersected with these sets.
7378 If the output needs to be restricted then only a restriction on the source
7379 iterations is required.
7380 If any error occurs, the callback should return C<NULL>.
7381 An C<isl_restriction> object can be created, freed and inspected
7382 using the following functions.
7384         #include <isl/flow.h>
7386         __isl_give isl_restriction *isl_restriction_input(
7387                 __isl_take isl_set *source_restr,
7388                 __isl_take isl_set *sink_restr);
7389         __isl_give isl_restriction *isl_restriction_output(
7390                 __isl_take isl_set *source_restr);
7391         __isl_give isl_restriction *isl_restriction_none(
7392                 __isl_take isl_map *source_map);
7393         __isl_give isl_restriction *isl_restriction_empty(
7394                 __isl_take isl_map *source_map);
7395         __isl_null isl_restriction *isl_restriction_free(
7396                 __isl_take isl_restriction *restr);
7398 C<isl_restriction_none> and C<isl_restriction_empty> are special
7399 cases of C<isl_restriction_input>.  C<isl_restriction_none>
7400 is essentially equivalent to
7402         isl_restriction_input(isl_set_universe(
7403             isl_space_range(isl_map_get_space(source_map))),
7404                             isl_set_universe(
7405             isl_space_domain(isl_map_get_space(source_map))));
7407 whereas C<isl_restriction_empty> is essentially equivalent to
7409         isl_restriction_input(isl_set_empty(
7410             isl_space_range(isl_map_get_space(source_map))),
7411                             isl_set_universe(
7412             isl_space_domain(isl_map_get_space(source_map))));
7414 =head2 Scheduling
7416 B<The functionality described in this section is fairly new
7417 and may be subject to change.>
7419         #include <isl/schedule.h>
7420         __isl_give isl_schedule *
7421         isl_schedule_constraints_compute_schedule(
7422                 __isl_take isl_schedule_constraints *sc);
7423         __isl_null isl_schedule *isl_schedule_free(
7424                 __isl_take isl_schedule *sched);
7426 The function C<isl_schedule_constraints_compute_schedule> can be
7427 used to compute a schedule that satisfies the given schedule constraints.
7428 These schedule constraints include the iteration domain for which
7429 a schedule should be computed and dependences between pairs of
7430 iterations.  In particular, these dependences include
7431 I<validity> dependences and I<proximity> dependences.
7432 By default, the algorithm used to construct the schedule is similar
7433 to that of C<Pluto>.
7434 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
7435 be selected.
7436 The generated schedule respects all validity dependences.
7437 That is, all dependence distances over these dependences in the
7438 scheduled space are lexicographically positive.
7439 The default algorithm tries to ensure that the dependence distances
7440 over coincidence constraints are zero and to minimize the
7441 dependence distances over proximity dependences.
7442 Moreover, it tries to obtain sequences (bands) of schedule dimensions
7443 for groups of domains where the dependence distances over validity
7444 dependences have only non-negative values.
7445 When using Feautrier's algorithm, the coincidence and proximity constraints
7446 are only taken into account during the extension to a
7447 full-dimensional schedule.
7449 An C<isl_schedule_constraints> object can be constructed
7450 and manipulated using the following functions.
7452         #include <isl/schedule.h>
7453         __isl_give isl_schedule_constraints *
7454         isl_schedule_constraints_copy(
7455                 __isl_keep isl_schedule_constraints *sc);
7456         __isl_give isl_schedule_constraints *
7457         isl_schedule_constraints_on_domain(
7458                 __isl_take isl_union_set *domain);
7459         __isl_give isl_schedule_constraints *
7460         isl_schedule_constraints_set_validity(
7461                 __isl_take isl_schedule_constraints *sc,
7462                 __isl_take isl_union_map *validity);
7463         __isl_give isl_schedule_constraints *
7464         isl_schedule_constraints_set_coincidence(
7465                 __isl_take isl_schedule_constraints *sc,
7466                 __isl_take isl_union_map *coincidence);
7467         __isl_give isl_schedule_constraints *
7468         isl_schedule_constraints_set_proximity(
7469                 __isl_take isl_schedule_constraints *sc,
7470                 __isl_take isl_union_map *proximity);
7471         __isl_give isl_schedule_constraints *
7472         isl_schedule_constraints_set_conditional_validity(
7473                 __isl_take isl_schedule_constraints *sc,
7474                 __isl_take isl_union_map *condition,
7475                 __isl_take isl_union_map *validity);
7476         __isl_null isl_schedule_constraints *
7477         isl_schedule_constraints_free(
7478                 __isl_take isl_schedule_constraints *sc);
7480 The initial C<isl_schedule_constraints> object created by
7481 C<isl_schedule_constraints_on_domain> does not impose any constraints.
7482 That is, it has an empty set of dependences.
7483 The function C<isl_schedule_constraints_set_validity> replaces the
7484 validity dependences, mapping domain elements I<i> to domain
7485 elements that should be scheduled after I<i>.
7486 The function C<isl_schedule_constraints_set_coincidence> replaces the
7487 coincidence dependences, mapping domain elements I<i> to domain
7488 elements that should be scheduled together with I<I>, if possible.
7489 The function C<isl_schedule_constraints_set_proximity> replaces the
7490 proximity dependences, mapping domain elements I<i> to domain
7491 elements that should be scheduled either before I<I>
7492 or as early as possible after I<i>.
7494 The function C<isl_schedule_constraints_set_conditional_validity>
7495 replaces the conditional validity constraints.
7496 A conditional validity constraint is only imposed when any of the corresponding
7497 conditions is satisfied, i.e., when any of them is non-zero.
7498 That is, the scheduler ensures that within each band if the dependence
7499 distances over the condition constraints are not all zero
7500 then all corresponding conditional validity constraints are respected.
7501 A conditional validity constraint corresponds to a condition
7502 if the two are adjacent, i.e., if the domain of one relation intersect
7503 the range of the other relation.
7504 The typical use case of conditional validity constraints is
7505 to allow order constraints between live ranges to be violated
7506 as long as the live ranges themselves are local to the band.
7507 To allow more fine-grained control over which conditions correspond
7508 to which conditional validity constraints, the domains and ranges
7509 of these relations may include I<tags>.  That is, the domains and
7510 ranges of those relation may themselves be wrapped relations
7511 where the iteration domain appears in the domain of those wrapped relations
7512 and the range of the wrapped relations can be arbitrarily chosen
7513 by the user.  Conditions and conditional validity constraints are only
7514 considered adjacent to each other if the entire wrapped relation matches.
7515 In particular, a relation with a tag will never be considered adjacent
7516 to a relation without a tag.
7518 The following function computes a schedule directly from
7519 an iteration domain and validity and proximity dependences
7520 and is implemented in terms of the functions described above.
7521 The use of C<isl_union_set_compute_schedule> is discouraged.
7523         #include <isl/schedule.h>
7524         __isl_give isl_schedule *isl_union_set_compute_schedule(
7525                 __isl_take isl_union_set *domain,
7526                 __isl_take isl_union_map *validity,
7527                 __isl_take isl_union_map *proximity);
7529 A mapping from the domains to the scheduled space can be obtained
7530 from an C<isl_schedule> using the following function.
7532         __isl_give isl_union_map *isl_schedule_get_map(
7533                 __isl_keep isl_schedule *sched);
7535 A representation of the schedule can be printed using
7536          
7537         __isl_give isl_printer *isl_printer_print_schedule(
7538                 __isl_take isl_printer *p,
7539                 __isl_keep isl_schedule *schedule);
7541 A representation of the schedule as a forest of bands can be obtained
7542 using the following function.
7544         __isl_give isl_band_list *isl_schedule_get_band_forest(
7545                 __isl_keep isl_schedule *schedule);
7547 The individual bands can be visited in depth-first post-order
7548 using the following function.
7550         #include <isl/schedule.h>
7551         int isl_schedule_foreach_band(
7552                 __isl_keep isl_schedule *sched,
7553                 int (*fn)(__isl_keep isl_band *band, void *user),
7554                 void *user);
7556 The list can be manipulated as explained in L<"Lists">.
7557 The bands inside the list can be copied and freed using the following
7558 functions.
7560         #include <isl/band.h>
7561         __isl_give isl_band *isl_band_copy(
7562                 __isl_keep isl_band *band);
7563         __isl_null isl_band *isl_band_free(
7564                 __isl_take isl_band *band);
7566 Each band contains zero or more scheduling dimensions.
7567 These are referred to as the members of the band.
7568 The section of the schedule that corresponds to the band is
7569 referred to as the partial schedule of the band.
7570 For those nodes that participate in a band, the outer scheduling
7571 dimensions form the prefix schedule, while the inner scheduling
7572 dimensions form the suffix schedule.
7573 That is, if we take a cut of the band forest, then the union of
7574 the concatenations of the prefix, partial and suffix schedules of
7575 each band in the cut is equal to the entire schedule (modulo
7576 some possible padding at the end with zero scheduling dimensions).
7577 The properties of a band can be inspected using the following functions.
7579         #include <isl/band.h>
7580         int isl_band_has_children(__isl_keep isl_band *band);
7581         __isl_give isl_band_list *isl_band_get_children(
7582                 __isl_keep isl_band *band);
7584         __isl_give isl_union_map *isl_band_get_prefix_schedule(
7585                 __isl_keep isl_band *band);
7586         __isl_give isl_union_map *isl_band_get_partial_schedule(
7587                 __isl_keep isl_band *band);
7588         __isl_give isl_union_map *isl_band_get_suffix_schedule(
7589                 __isl_keep isl_band *band);
7591         int isl_band_n_member(__isl_keep isl_band *band);
7592         int isl_band_member_is_coincident(
7593                 __isl_keep isl_band *band, int pos);
7595         int isl_band_list_foreach_band(
7596                 __isl_keep isl_band_list *list,
7597                 int (*fn)(__isl_keep isl_band *band, void *user),
7598                 void *user);
7600 Note that a scheduling dimension is considered to be ``coincident''
7601 if it satisfies the coincidence constraints within its band.
7602 That is, if the dependence distances of the coincidence
7603 constraints are all zero in that direction (for fixed
7604 iterations of outer bands).
7605 Like C<isl_schedule_foreach_band>,
7606 the function C<isl_band_list_foreach_band> calls C<fn> on the bands
7607 in depth-first post-order.
7609 A band can be tiled using the following function.
7611         #include <isl/band.h>
7612         int isl_band_tile(__isl_keep isl_band *band,
7613                 __isl_take isl_vec *sizes);
7615         int isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
7616                 int val);
7617         int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
7618         int isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
7619                 int val);
7620         int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
7622 The C<isl_band_tile> function tiles the band using the given tile sizes
7623 inside its schedule.
7624 A new child band is created to represent the point loops and it is
7625 inserted between the modified band and its children.
7626 The C<tile_scale_tile_loops> option specifies whether the tile
7627 loops iterators should be scaled by the tile sizes.
7628 If the C<tile_shift_point_loops> option is set, then the point loops
7629 are shifted to start at zero.
7631 A band can be split into two nested bands using the following function.
7633         int isl_band_split(__isl_keep isl_band *band, int pos);
7635 The resulting outer band contains the first C<pos> dimensions of C<band>
7636 while the inner band contains the remaining dimensions.
7638 A representation of the band can be printed using
7640         #include <isl/band.h>
7641         __isl_give isl_printer *isl_printer_print_band(
7642                 __isl_take isl_printer *p,
7643                 __isl_keep isl_band *band);
7645 =head3 Options
7647         #include <isl/schedule.h>
7648         int isl_options_set_schedule_max_coefficient(
7649                 isl_ctx *ctx, int val);
7650         int isl_options_get_schedule_max_coefficient(
7651                 isl_ctx *ctx);
7652         int isl_options_set_schedule_max_constant_term(
7653                 isl_ctx *ctx, int val);
7654         int isl_options_get_schedule_max_constant_term(
7655                 isl_ctx *ctx);
7656         int isl_options_set_schedule_fuse(isl_ctx *ctx, int val);
7657         int isl_options_get_schedule_fuse(isl_ctx *ctx);
7658         int isl_options_set_schedule_maximize_band_depth(
7659                 isl_ctx *ctx, int val);
7660         int isl_options_get_schedule_maximize_band_depth(
7661                 isl_ctx *ctx);
7662         int isl_options_set_schedule_outer_coincidence(
7663                 isl_ctx *ctx, int val);
7664         int isl_options_get_schedule_outer_coincidence(
7665                 isl_ctx *ctx);
7666         int isl_options_set_schedule_split_scaled(
7667                 isl_ctx *ctx, int val);
7668         int isl_options_get_schedule_split_scaled(
7669                 isl_ctx *ctx);
7670         int isl_options_set_schedule_algorithm(
7671                 isl_ctx *ctx, int val);
7672         int isl_options_get_schedule_algorithm(
7673                 isl_ctx *ctx);
7674         int isl_options_set_schedule_separate_components(
7675                 isl_ctx *ctx, int val);
7676         int isl_options_get_schedule_separate_components(
7677                 isl_ctx *ctx);
7679 =over
7681 =item * schedule_max_coefficient
7683 This option enforces that the coefficients for variable and parameter
7684 dimensions in the calculated schedule are not larger than the specified value.
7685 This option can significantly increase the speed of the scheduling calculation
7686 and may also prevent fusing of unrelated dimensions. A value of -1 means that
7687 this option does not introduce bounds on the variable or parameter
7688 coefficients.
7690 =item * schedule_max_constant_term
7692 This option enforces that the constant coefficients in the calculated schedule
7693 are not larger than the maximal constant term. This option can significantly
7694 increase the speed of the scheduling calculation and may also prevent fusing of
7695 unrelated dimensions. A value of -1 means that this option does not introduce
7696 bounds on the constant coefficients.
7698 =item * schedule_fuse
7700 This option controls the level of fusion.
7701 If this option is set to C<ISL_SCHEDULE_FUSE_MIN>, then loops in the
7702 resulting schedule will be distributed as much as possible.
7703 If this option is set to C<ISL_SCHEDULE_FUSE_MAX>, then C<isl> will
7704 try to fuse loops in the resulting schedule.
7706 =item * schedule_maximize_band_depth
7708 If this option is set, we do not split bands at the point
7709 where we detect splitting is necessary. Instead, we
7710 backtrack and split bands as early as possible. This
7711 reduces the number of splits and maximizes the width of
7712 the bands. Wider bands give more possibilities for tiling.
7713 Note that if the C<schedule_fuse> option is set to C<ISL_SCHEDULE_FUSE_MIN>,
7714 then bands will be split as early as possible, even if there is no need.
7715 The C<schedule_maximize_band_depth> option therefore has no effect in this case.
7717 =item * schedule_outer_coincidence
7719 If this option is set, then we try to construct schedules
7720 where the outermost scheduling dimension in each band
7721 satisfies the coincidence constraints.
7723 =item * schedule_split_scaled
7725 If this option is set, then we try to construct schedules in which the
7726 constant term is split off from the linear part if the linear parts of
7727 the scheduling rows for all nodes in the graphs have a common non-trivial
7728 divisor.
7729 The constant term is then placed in a separate band and the linear
7730 part is reduced.
7732 =item * schedule_algorithm
7734 Selects the scheduling algorithm to be used.
7735 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
7736 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
7738 =item * schedule_separate_components
7740 If at any point the dependence graph contains any (weakly connected) components,
7741 then these components are scheduled separately.
7742 If this option is not set, then some iterations of the domains
7743 in these components may be scheduled together.
7744 If this option is set, then the components are given consecutive
7745 schedules.
7747 =back
7749 =head2 AST Generation
7751 This section describes the C<isl> functionality for generating
7752 ASTs that visit all the elements
7753 in a domain in an order specified by a schedule.
7754 In particular, given a C<isl_union_map>, an AST is generated
7755 that visits all the elements in the domain of the C<isl_union_map>
7756 according to the lexicographic order of the corresponding image
7757 element(s).  If the range of the C<isl_union_map> consists of
7758 elements in more than one space, then each of these spaces is handled
7759 separately in an arbitrary order.
7760 It should be noted that the image elements only specify the I<order>
7761 in which the corresponding domain elements should be visited.
7762 No direct relation between the image elements and the loop iterators
7763 in the generated AST should be assumed.
7765 Each AST is generated within a build.  The initial build
7766 simply specifies the constraints on the parameters (if any)
7767 and can be created, inspected, copied and freed using the following functions.
7769         #include <isl/ast_build.h>
7770         __isl_give isl_ast_build *isl_ast_build_from_context(
7771                 __isl_take isl_set *set);
7772         __isl_give isl_ast_build *isl_ast_build_copy(
7773                 __isl_keep isl_ast_build *build);
7774         __isl_null isl_ast_build *isl_ast_build_free(
7775                 __isl_take isl_ast_build *build);
7777 The C<set> argument is usually a parameter set with zero or more parameters.
7778 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
7779 and L</"Fine-grained Control over AST Generation">.
7780 Finally, the AST itself can be constructed using the following
7781 function.
7783         #include <isl/ast_build.h>
7784         __isl_give isl_ast_node *isl_ast_build_ast_from_schedule(
7785                 __isl_keep isl_ast_build *build,
7786                 __isl_take isl_union_map *schedule);
7788 =head3 Inspecting the AST
7790 The basic properties of an AST node can be obtained as follows.
7792         #include <isl/ast.h>
7793         enum isl_ast_node_type isl_ast_node_get_type(
7794                 __isl_keep isl_ast_node *node);
7796 The type of an AST node is one of
7797 C<isl_ast_node_for>,
7798 C<isl_ast_node_if>,
7799 C<isl_ast_node_block> or
7800 C<isl_ast_node_user>.
7801 An C<isl_ast_node_for> represents a for node.
7802 An C<isl_ast_node_if> represents an if node.
7803 An C<isl_ast_node_block> represents a compound node.
7804 An C<isl_ast_node_user> represents an expression statement.
7805 An expression statement typically corresponds to a domain element, i.e.,
7806 one of the elements that is visited by the AST.
7808 Each type of node has its own additional properties.
7810         #include <isl/ast.h>
7811         __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
7812                 __isl_keep isl_ast_node *node);
7813         __isl_give isl_ast_expr *isl_ast_node_for_get_init(
7814                 __isl_keep isl_ast_node *node);
7815         __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
7816                 __isl_keep isl_ast_node *node);
7817         __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
7818                 __isl_keep isl_ast_node *node);
7819         __isl_give isl_ast_node *isl_ast_node_for_get_body(
7820                 __isl_keep isl_ast_node *node);
7821         int isl_ast_node_for_is_degenerate(
7822                 __isl_keep isl_ast_node *node);
7824 An C<isl_ast_for> is considered degenerate if it is known to execute
7825 exactly once.
7827         #include <isl/ast.h>
7828         __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
7829                 __isl_keep isl_ast_node *node);
7830         __isl_give isl_ast_node *isl_ast_node_if_get_then(
7831                 __isl_keep isl_ast_node *node);
7832         int isl_ast_node_if_has_else(
7833                 __isl_keep isl_ast_node *node);
7834         __isl_give isl_ast_node *isl_ast_node_if_get_else(
7835                 __isl_keep isl_ast_node *node);
7837         __isl_give isl_ast_node_list *
7838         isl_ast_node_block_get_children(
7839                 __isl_keep isl_ast_node *node);
7841         __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
7842                 __isl_keep isl_ast_node *node);
7844 Each of the returned C<isl_ast_expr>s can in turn be inspected using
7845 the following functions.
7847         #include <isl/ast.h>
7848         enum isl_ast_expr_type isl_ast_expr_get_type(
7849                 __isl_keep isl_ast_expr *expr);
7851 The type of an AST expression is one of
7852 C<isl_ast_expr_op>,
7853 C<isl_ast_expr_id> or
7854 C<isl_ast_expr_int>.
7855 An C<isl_ast_expr_op> represents the result of an operation.
7856 An C<isl_ast_expr_id> represents an identifier.
7857 An C<isl_ast_expr_int> represents an integer value.
7859 Each type of expression has its own additional properties.
7861         #include <isl/ast.h>
7862         enum isl_ast_op_type isl_ast_expr_get_op_type(
7863                 __isl_keep isl_ast_expr *expr);
7864         int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
7865         __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
7866                 __isl_keep isl_ast_expr *expr, int pos);
7867         int isl_ast_node_foreach_ast_op_type(
7868                 __isl_keep isl_ast_node *node,
7869                 int (*fn)(enum isl_ast_op_type type, void *user),
7870                 void *user);
7872 C<isl_ast_expr_get_op_type> returns the type of the operation
7873 performed.  C<isl_ast_expr_get_op_n_arg> returns the number of
7874 arguments.  C<isl_ast_expr_get_op_arg> returns the specified
7875 argument.
7876 C<isl_ast_node_foreach_ast_op_type> calls C<fn> for each distinct
7877 C<isl_ast_op_type> that appears in C<node>.
7878 The operation type is one of the following.
7880 =over
7882 =item C<isl_ast_op_and>
7884 Logical I<and> of two arguments.
7885 Both arguments can be evaluated.
7887 =item C<isl_ast_op_and_then>
7889 Logical I<and> of two arguments.
7890 The second argument can only be evaluated if the first evaluates to true.
7892 =item C<isl_ast_op_or>
7894 Logical I<or> of two arguments.
7895 Both arguments can be evaluated.
7897 =item C<isl_ast_op_or_else>
7899 Logical I<or> of two arguments.
7900 The second argument can only be evaluated if the first evaluates to false.
7902 =item C<isl_ast_op_max>
7904 Maximum of two or more arguments.
7906 =item C<isl_ast_op_min>
7908 Minimum of two or more arguments.
7910 =item C<isl_ast_op_minus>
7912 Change sign.
7914 =item C<isl_ast_op_add>
7916 Sum of two arguments.
7918 =item C<isl_ast_op_sub>
7920 Difference of two arguments.
7922 =item C<isl_ast_op_mul>
7924 Product of two arguments.
7926 =item C<isl_ast_op_div>
7928 Exact division.  That is, the result is known to be an integer.
7930 =item C<isl_ast_op_fdiv_q>
7932 Result of integer division, rounded towards negative
7933 infinity.
7935 =item C<isl_ast_op_pdiv_q>
7937 Result of integer division, where dividend is known to be non-negative.
7939 =item C<isl_ast_op_pdiv_r>
7941 Remainder of integer division, where dividend is known to be non-negative.
7943 =item C<isl_ast_op_zdiv_r>
7945 Equal to zero iff the remainder on integer division is zero.
7947 =item C<isl_ast_op_cond>
7949 Conditional operator defined on three arguments.
7950 If the first argument evaluates to true, then the result
7951 is equal to the second argument.  Otherwise, the result
7952 is equal to the third argument.
7953 The second and third argument may only be evaluated if
7954 the first argument evaluates to true and false, respectively.
7955 Corresponds to C<a ? b : c> in C.
7957 =item C<isl_ast_op_select>
7959 Conditional operator defined on three arguments.
7960 If the first argument evaluates to true, then the result
7961 is equal to the second argument.  Otherwise, the result
7962 is equal to the third argument.
7963 The second and third argument may be evaluated independently
7964 of the value of the first argument.
7965 Corresponds to C<a * b + (1 - a) * c> in C.
7967 =item C<isl_ast_op_eq>
7969 Equality relation.
7971 =item C<isl_ast_op_le>
7973 Less than or equal relation.
7975 =item C<isl_ast_op_lt>
7977 Less than relation.
7979 =item C<isl_ast_op_ge>
7981 Greater than or equal relation.
7983 =item C<isl_ast_op_gt>
7985 Greater than relation.
7987 =item C<isl_ast_op_call>
7989 A function call.
7990 The number of arguments of the C<isl_ast_expr> is one more than
7991 the number of arguments in the function call, the first argument
7992 representing the function being called.
7994 =item C<isl_ast_op_access>
7996 An array access.
7997 The number of arguments of the C<isl_ast_expr> is one more than
7998 the number of index expressions in the array access, the first argument
7999 representing the array being accessed.
8001 =item C<isl_ast_op_member>
8003 A member access.
8004 This operation has two arguments, a structure and the name of
8005 the member of the structure being accessed.
8007 =back
8009         #include <isl/ast.h>
8010         __isl_give isl_id *isl_ast_expr_get_id(
8011                 __isl_keep isl_ast_expr *expr);
8013 Return the identifier represented by the AST expression.
8015         #include <isl/ast.h>
8016         __isl_give isl_val *isl_ast_expr_get_val(
8017                 __isl_keep isl_ast_expr *expr);
8019 Return the integer represented by the AST expression.
8021 =head3 Properties of ASTs
8023         #include <isl/ast.h>
8024         int isl_ast_expr_is_equal(__isl_keep isl_ast_expr *expr1,
8025                 __isl_keep isl_ast_expr *expr2);
8027 Check if two C<isl_ast_expr>s are equal to each other.
8029 =head3 Manipulating and printing the AST
8031 AST nodes can be copied and freed using the following functions.
8033         #include <isl/ast.h>
8034         __isl_give isl_ast_node *isl_ast_node_copy(
8035                 __isl_keep isl_ast_node *node);
8036         __isl_null isl_ast_node *isl_ast_node_free(
8037                 __isl_take isl_ast_node *node);
8039 AST expressions can be copied and freed using the following functions.
8041         #include <isl/ast.h>
8042         __isl_give isl_ast_expr *isl_ast_expr_copy(
8043                 __isl_keep isl_ast_expr *expr);
8044         __isl_null isl_ast_expr *isl_ast_expr_free(
8045                 __isl_take isl_ast_expr *expr);
8047 New AST expressions can be created either directly or within
8048 the context of an C<isl_ast_build>.
8050         #include <isl/ast.h>
8051         __isl_give isl_ast_expr *isl_ast_expr_from_val(
8052                 __isl_take isl_val *v);
8053         __isl_give isl_ast_expr *isl_ast_expr_from_id(
8054                 __isl_take isl_id *id);
8055         __isl_give isl_ast_expr *isl_ast_expr_neg(
8056                 __isl_take isl_ast_expr *expr);
8057         __isl_give isl_ast_expr *isl_ast_expr_address_of(
8058                 __isl_take isl_ast_expr *expr);
8059         __isl_give isl_ast_expr *isl_ast_expr_add(
8060                 __isl_take isl_ast_expr *expr1,
8061                 __isl_take isl_ast_expr *expr2);
8062         __isl_give isl_ast_expr *isl_ast_expr_sub(
8063                 __isl_take isl_ast_expr *expr1,
8064                 __isl_take isl_ast_expr *expr2);
8065         __isl_give isl_ast_expr *isl_ast_expr_mul(
8066                 __isl_take isl_ast_expr *expr1,
8067                 __isl_take isl_ast_expr *expr2);
8068         __isl_give isl_ast_expr *isl_ast_expr_div(
8069                 __isl_take isl_ast_expr *expr1,
8070                 __isl_take isl_ast_expr *expr2);
8071         __isl_give isl_ast_expr *isl_ast_expr_and(
8072                 __isl_take isl_ast_expr *expr1,
8073                 __isl_take isl_ast_expr *expr2)
8074         __isl_give isl_ast_expr *isl_ast_expr_or(
8075                 __isl_take isl_ast_expr *expr1,
8076                 __isl_take isl_ast_expr *expr2)
8077         __isl_give isl_ast_expr *isl_ast_expr_eq(
8078                 __isl_take isl_ast_expr *expr1,
8079                 __isl_take isl_ast_expr *expr2);
8080         __isl_give isl_ast_expr *isl_ast_expr_le(
8081                 __isl_take isl_ast_expr *expr1,
8082                 __isl_take isl_ast_expr *expr2);
8083         __isl_give isl_ast_expr *isl_ast_expr_lt(
8084                 __isl_take isl_ast_expr *expr1,
8085                 __isl_take isl_ast_expr *expr2);
8086         __isl_give isl_ast_expr *isl_ast_expr_ge(
8087                 __isl_take isl_ast_expr *expr1,
8088                 __isl_take isl_ast_expr *expr2);
8089         __isl_give isl_ast_expr *isl_ast_expr_gt(
8090                 __isl_take isl_ast_expr *expr1,
8091                 __isl_take isl_ast_expr *expr2);
8092         __isl_give isl_ast_expr *isl_ast_expr_access(
8093                 __isl_take isl_ast_expr *array,
8094                 __isl_take isl_ast_expr_list *indices);
8096 The function C<isl_ast_expr_address_of> can be applied to an
8097 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
8098 to represent the address of the C<isl_ast_expr_access>.
8100         #include <isl/ast_build.h>
8101         __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
8102                 __isl_keep isl_ast_build *build,
8103                 __isl_take isl_pw_aff *pa);
8104         __isl_give isl_ast_expr *
8105         isl_ast_build_access_from_pw_multi_aff(
8106                 __isl_keep isl_ast_build *build,
8107                 __isl_take isl_pw_multi_aff *pma);
8108         __isl_give isl_ast_expr *
8109         isl_ast_build_access_from_multi_pw_aff(
8110                 __isl_keep isl_ast_build *build,
8111                 __isl_take isl_multi_pw_aff *mpa);
8112         __isl_give isl_ast_expr *
8113         isl_ast_build_call_from_pw_multi_aff(
8114                 __isl_keep isl_ast_build *build,
8115                 __isl_take isl_pw_multi_aff *pma);
8116         __isl_give isl_ast_expr *
8117         isl_ast_build_call_from_multi_pw_aff(
8118                 __isl_keep isl_ast_build *build,
8119                 __isl_take isl_multi_pw_aff *mpa);
8121 The domains of C<pa>, C<mpa> and C<pma> should correspond
8122 to the schedule space of C<build>.
8123 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
8124 the function being called.
8125 If the accessed space is a nested relation, then it is taken
8126 to represent an access of the member specified by the range
8127 of this nested relation of the structure specified by the domain
8128 of the nested relation.
8130 The following functions can be used to modify an C<isl_ast_expr>.
8132         #include <isl/ast.h>
8133         __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
8134                 __isl_take isl_ast_expr *expr, int pos,
8135                 __isl_take isl_ast_expr *arg);
8137 Replace the argument of C<expr> at position C<pos> by C<arg>.
8139         #include <isl/ast.h>
8140         __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
8141                 __isl_take isl_ast_expr *expr,
8142                 __isl_take isl_id_to_ast_expr *id2expr);
8144 The function C<isl_ast_expr_substitute_ids> replaces the
8145 subexpressions of C<expr> of type C<isl_ast_expr_id>
8146 by the corresponding expression in C<id2expr>, if there is any.
8149 User specified data can be attached to an C<isl_ast_node> and obtained
8150 from the same C<isl_ast_node> using the following functions.
8152         #include <isl/ast.h>
8153         __isl_give isl_ast_node *isl_ast_node_set_annotation(
8154                 __isl_take isl_ast_node *node,
8155                 __isl_take isl_id *annotation);
8156         __isl_give isl_id *isl_ast_node_get_annotation(
8157                 __isl_keep isl_ast_node *node);
8159 Basic printing can be performed using the following functions.
8161         #include <isl/ast.h>
8162         __isl_give isl_printer *isl_printer_print_ast_expr(
8163                 __isl_take isl_printer *p,
8164                 __isl_keep isl_ast_expr *expr);
8165         __isl_give isl_printer *isl_printer_print_ast_node(
8166                 __isl_take isl_printer *p,
8167                 __isl_keep isl_ast_node *node);
8168         __isl_give char *isl_ast_expr_to_str(
8169                 __isl_keep isl_ast_expr *expr);
8171 More advanced printing can be performed using the following functions.
8173         #include <isl/ast.h>
8174         __isl_give isl_printer *isl_ast_op_type_print_macro(
8175                 enum isl_ast_op_type type,
8176                 __isl_take isl_printer *p);
8177         __isl_give isl_printer *isl_ast_node_print_macros(
8178                 __isl_keep isl_ast_node *node,
8179                 __isl_take isl_printer *p);
8180         __isl_give isl_printer *isl_ast_node_print(
8181                 __isl_keep isl_ast_node *node,
8182                 __isl_take isl_printer *p,
8183                 __isl_take isl_ast_print_options *options);
8184         __isl_give isl_printer *isl_ast_node_for_print(
8185                 __isl_keep isl_ast_node *node,
8186                 __isl_take isl_printer *p,
8187                 __isl_take isl_ast_print_options *options);
8188         __isl_give isl_printer *isl_ast_node_if_print(
8189                 __isl_keep isl_ast_node *node,
8190                 __isl_take isl_printer *p,
8191                 __isl_take isl_ast_print_options *options);
8193 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
8194 C<isl> may print out an AST that makes use of macros such
8195 as C<floord>, C<min> and C<max>.
8196 C<isl_ast_op_type_print_macro> prints out the macro
8197 corresponding to a specific C<isl_ast_op_type>.
8198 C<isl_ast_node_print_macros> scans the C<isl_ast_node>
8199 for expressions where these macros would be used and prints
8200 out the required macro definitions.
8201 Essentially, C<isl_ast_node_print_macros> calls
8202 C<isl_ast_node_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
8203 as function argument.
8204 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
8205 C<isl_ast_node_if_print> print an C<isl_ast_node>
8206 in C<ISL_FORMAT_C>, but allow for some extra control
8207 through an C<isl_ast_print_options> object.
8208 This object can be created using the following functions.
8210         #include <isl/ast.h>
8211         __isl_give isl_ast_print_options *
8212         isl_ast_print_options_alloc(isl_ctx *ctx);
8213         __isl_give isl_ast_print_options *
8214         isl_ast_print_options_copy(
8215                 __isl_keep isl_ast_print_options *options);
8216         __isl_null isl_ast_print_options *
8217         isl_ast_print_options_free(
8218                 __isl_take isl_ast_print_options *options);
8220         __isl_give isl_ast_print_options *
8221         isl_ast_print_options_set_print_user(
8222                 __isl_take isl_ast_print_options *options,
8223                 __isl_give isl_printer *(*print_user)(
8224                         __isl_take isl_printer *p,
8225                         __isl_take isl_ast_print_options *options,
8226                         __isl_keep isl_ast_node *node, void *user),
8227                 void *user);
8228         __isl_give isl_ast_print_options *
8229         isl_ast_print_options_set_print_for(
8230                 __isl_take isl_ast_print_options *options,
8231                 __isl_give isl_printer *(*print_for)(
8232                         __isl_take isl_printer *p,
8233                         __isl_take isl_ast_print_options *options,
8234                         __isl_keep isl_ast_node *node, void *user),
8235                 void *user);
8237 The callback set by C<isl_ast_print_options_set_print_user>
8238 is called whenever a node of type C<isl_ast_node_user> needs to
8239 be printed.
8240 The callback set by C<isl_ast_print_options_set_print_for>
8241 is called whenever a node of type C<isl_ast_node_for> needs to
8242 be printed.
8243 Note that C<isl_ast_node_for_print> will I<not> call the
8244 callback set by C<isl_ast_print_options_set_print_for> on the node
8245 on which C<isl_ast_node_for_print> is called, but only on nested
8246 nodes of type C<isl_ast_node_for>.  It is therefore safe to
8247 call C<isl_ast_node_for_print> from within the callback set by
8248 C<isl_ast_print_options_set_print_for>.
8250 The following option determines the type to be used for iterators
8251 while printing the AST.
8253         int isl_options_set_ast_iterator_type(
8254                 isl_ctx *ctx, const char *val);
8255         const char *isl_options_get_ast_iterator_type(
8256                 isl_ctx *ctx);
8258 The AST printer only prints body nodes as blocks if these
8259 blocks cannot be safely omitted.
8260 For example, a C<for> node with one body node will not be
8261 surrounded with braces in C<ISL_FORMAT_C>.
8262 A block will always be printed by setting the following option.
8264         int isl_options_set_ast_always_print_block(isl_ctx *ctx,
8265                 int val);
8266         int isl_options_get_ast_always_print_block(isl_ctx *ctx);
8268 =head3 Options
8270         #include <isl/ast_build.h>
8271         int isl_options_set_ast_build_atomic_upper_bound(
8272                 isl_ctx *ctx, int val);
8273         int isl_options_get_ast_build_atomic_upper_bound(
8274                 isl_ctx *ctx);
8275         int isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
8276                 int val);
8277         int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
8278         int isl_options_set_ast_build_exploit_nested_bounds(
8279                 isl_ctx *ctx, int val);
8280         int isl_options_get_ast_build_exploit_nested_bounds(
8281                 isl_ctx *ctx);
8282         int isl_options_set_ast_build_group_coscheduled(
8283                 isl_ctx *ctx, int val);
8284         int isl_options_get_ast_build_group_coscheduled(
8285                 isl_ctx *ctx);
8286         int isl_options_set_ast_build_scale_strides(
8287                 isl_ctx *ctx, int val);
8288         int isl_options_get_ast_build_scale_strides(
8289                 isl_ctx *ctx);
8290         int isl_options_set_ast_build_allow_else(isl_ctx *ctx,
8291                 int val);
8292         int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
8293         int isl_options_set_ast_build_allow_or(isl_ctx *ctx,
8294                 int val);
8295         int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
8297 =over
8299 =item * ast_build_atomic_upper_bound
8301 Generate loop upper bounds that consist of the current loop iterator,
8302 an operator and an expression not involving the iterator.
8303 If this option is not set, then the current loop iterator may appear
8304 several times in the upper bound.
8305 For example, when this option is turned off, AST generation
8306 for the schedule
8308         [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
8310 produces
8312         for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
8313           A(c0);
8315 When the option is turned on, the following AST is generated
8317         for (int c0 = 0; c0 <= min(100, n); c0 += 1)
8318           A(c0);
8320 =item * ast_build_prefer_pdiv
8322 If this option is turned off, then the AST generation will
8323 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
8324 operators, but no C<isl_ast_op_pdiv_q> or
8325 C<isl_ast_op_pdiv_r> operators.
8326 If this options is turned on, then C<isl> will try to convert
8327 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
8328 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
8330 =item * ast_build_exploit_nested_bounds
8332 Simplify conditions based on bounds of nested for loops.
8333 In particular, remove conditions that are implied by the fact
8334 that one or more nested loops have at least one iteration,
8335 meaning that the upper bound is at least as large as the lower bound.
8336 For example, when this option is turned off, AST generation
8337 for the schedule
8339         [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
8340                                         0 <= j <= M }
8342 produces
8344         if (M >= 0)
8345           for (int c0 = 0; c0 <= N; c0 += 1)
8346             for (int c1 = 0; c1 <= M; c1 += 1)
8347               A(c0, c1);
8349 When the option is turned on, the following AST is generated
8351         for (int c0 = 0; c0 <= N; c0 += 1)
8352           for (int c1 = 0; c1 <= M; c1 += 1)
8353             A(c0, c1);
8355 =item * ast_build_group_coscheduled
8357 If two domain elements are assigned the same schedule point, then
8358 they may be executed in any order and they may even appear in different
8359 loops.  If this options is set, then the AST generator will make
8360 sure that coscheduled domain elements do not appear in separate parts
8361 of the AST.  This is useful in case of nested AST generation
8362 if the outer AST generation is given only part of a schedule
8363 and the inner AST generation should handle the domains that are
8364 coscheduled by this initial part of the schedule together.
8365 For example if an AST is generated for a schedule
8367         { A[i] -> [0]; B[i] -> [0] }
8369 then the C<isl_ast_build_set_create_leaf> callback described
8370 below may get called twice, once for each domain.
8371 Setting this option ensures that the callback is only called once
8372 on both domains together.
8374 =item * ast_build_separation_bounds
8376 This option specifies which bounds to use during separation.
8377 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
8378 then all (possibly implicit) bounds on the current dimension will
8379 be used during separation.
8380 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
8381 then only those bounds that are explicitly available will
8382 be used during separation.
8384 =item * ast_build_scale_strides
8386 This option specifies whether the AST generator is allowed
8387 to scale down iterators of strided loops.
8389 =item * ast_build_allow_else
8391 This option specifies whether the AST generator is allowed
8392 to construct if statements with else branches.
8394 =item * ast_build_allow_or
8396 This option specifies whether the AST generator is allowed
8397 to construct if conditions with disjunctions.
8399 =back
8401 =head3 Fine-grained Control over AST Generation
8403 Besides specifying the constraints on the parameters,
8404 an C<isl_ast_build> object can be used to control
8405 various aspects of the AST generation process.
8406 The most prominent way of control is through ``options'',
8407 which can be set using the following function.
8409         #include <isl/ast_build.h>
8410         __isl_give isl_ast_build *
8411         isl_ast_build_set_options(
8412                 __isl_take isl_ast_build *control,
8413                 __isl_take isl_union_map *options);
8415 The options are encoded in an C<isl_union_map>.
8416 The domain of this union relation refers to the schedule domain,
8417 i.e., the range of the schedule passed to C<isl_ast_build_ast_from_schedule>.
8418 In the case of nested AST generation (see L</"Nested AST Generation">),
8419 the domain of C<options> should refer to the extra piece of the schedule.
8420 That is, it should be equal to the range of the wrapped relation in the
8421 range of the schedule.
8422 The range of the options can consist of elements in one or more spaces,
8423 the names of which determine the effect of the option.
8424 The values of the range typically also refer to the schedule dimension
8425 to which the option applies.  In case of nested AST generation
8426 (see L</"Nested AST Generation">), these values refer to the position
8427 of the schedule dimension within the innermost AST generation.
8428 The constraints on the domain elements of
8429 the option should only refer to this dimension and earlier dimensions.
8430 We consider the following spaces.
8432 =over
8434 =item C<separation_class>
8436 This space is a wrapped relation between two one dimensional spaces.
8437 The input space represents the schedule dimension to which the option
8438 applies and the output space represents the separation class.
8439 While constructing a loop corresponding to the specified schedule
8440 dimension(s), the AST generator will try to generate separate loops
8441 for domain elements that are assigned different classes.
8442 If only some of the elements are assigned a class, then those elements
8443 that are not assigned any class will be treated as belonging to a class
8444 that is separate from the explicitly assigned classes.
8445 The typical use case for this option is to separate full tiles from
8446 partial tiles.
8447 The other options, described below, are applied after the separation
8448 into classes.
8450 As an example, consider the separation into full and partial tiles
8451 of a tiling of a triangular domain.
8452 Take, for example, the domain
8454         { A[i,j] : 0 <= i,j and i + j <= 100 }
8456 and a tiling into tiles of 10 by 10.  The input to the AST generator
8457 is then the schedule
8459         { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
8460                                                 i + j <= 100 }
8462 Without any options, the following AST is generated
8464         for (int c0 = 0; c0 <= 10; c0 += 1)
8465           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
8466             for (int c2 = 10 * c0;
8467                  c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
8468                  c2 += 1)
8469               for (int c3 = 10 * c1;
8470                    c3 <= min(10 * c1 + 9, -c2 + 100);
8471                    c3 += 1)
8472                 A(c2, c3);
8474 Separation into full and partial tiles can be obtained by assigning
8475 a class, say C<0>, to the full tiles.  The full tiles are represented by those
8476 values of the first and second schedule dimensions for which there are
8477 values of the third and fourth dimensions to cover an entire tile.
8478 That is, we need to specify the following option
8480         { [a,b,c,d] -> separation_class[[0]->[0]] :
8481                 exists b': 0 <= 10a,10b' and
8482                            10a+9+10b'+9 <= 100;
8483           [a,b,c,d] -> separation_class[[1]->[0]] :
8484                 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
8486 which simplifies to
8488         { [a, b, c, d] -> separation_class[[1] -> [0]] :
8489                 a >= 0 and b >= 0 and b <= 8 - a;
8490           [a, b, c, d] -> separation_class[[0] -> [0]] :
8491                 a >= 0 and a <= 8 }
8493 With this option, the generated AST is as follows
8495         {
8496           for (int c0 = 0; c0 <= 8; c0 += 1) {
8497             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
8498               for (int c2 = 10 * c0;
8499                    c2 <= 10 * c0 + 9; c2 += 1)
8500                 for (int c3 = 10 * c1;
8501                      c3 <= 10 * c1 + 9; c3 += 1)
8502                   A(c2, c3);
8503             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
8504               for (int c2 = 10 * c0;
8505                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
8506                    c2 += 1)
8507                 for (int c3 = 10 * c1;
8508                      c3 <= min(-c2 + 100, 10 * c1 + 9);
8509                      c3 += 1)
8510                   A(c2, c3);
8511           }
8512           for (int c0 = 9; c0 <= 10; c0 += 1)
8513             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
8514               for (int c2 = 10 * c0;
8515                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
8516                    c2 += 1)
8517                 for (int c3 = 10 * c1;
8518                      c3 <= min(10 * c1 + 9, -c2 + 100);
8519                      c3 += 1)
8520                   A(c2, c3);
8521         }
8523 =item C<separate>
8525 This is a single-dimensional space representing the schedule dimension(s)
8526 to which ``separation'' should be applied.  Separation tries to split
8527 a loop into several pieces if this can avoid the generation of guards
8528 inside the loop.
8529 See also the C<atomic> option.
8531 =item C<atomic>
8533 This is a single-dimensional space representing the schedule dimension(s)
8534 for which the domains should be considered ``atomic''.  That is, the
8535 AST generator will make sure that any given domain space will only appear
8536 in a single loop at the specified level.
8538 Consider the following schedule
8540         { a[i] -> [i] : 0 <= i < 10;
8541           b[i] -> [i+1] : 0 <= i < 10 }
8543 If the following option is specified
8545         { [i] -> separate[x] }
8547 then the following AST will be generated
8549         {
8550           a(0);
8551           for (int c0 = 1; c0 <= 9; c0 += 1) {
8552             a(c0);
8553             b(c0 - 1);
8554           }
8555           b(9);
8556         }
8558 If, on the other hand, the following option is specified
8560         { [i] -> atomic[x] }
8562 then the following AST will be generated
8564         for (int c0 = 0; c0 <= 10; c0 += 1) {
8565           if (c0 <= 9)
8566             a(c0);
8567           if (c0 >= 1)
8568             b(c0 - 1);
8569         }
8571 If neither C<atomic> nor C<separate> is specified, then the AST generator
8572 may produce either of these two results or some intermediate form.
8574 =item C<unroll>
8576 This is a single-dimensional space representing the schedule dimension(s)
8577 that should be I<completely> unrolled.
8578 To obtain a partial unrolling, the user should apply an additional
8579 strip-mining to the schedule and fully unroll the inner loop.
8581 =back
8583 Additional control is available through the following functions.
8585         #include <isl/ast_build.h>
8586         __isl_give isl_ast_build *
8587         isl_ast_build_set_iterators(
8588                 __isl_take isl_ast_build *control,
8589                 __isl_take isl_id_list *iterators);
8591 The function C<isl_ast_build_set_iterators> allows the user to
8592 specify a list of iterator C<isl_id>s to be used as iterators.
8593 If the input schedule is injective, then
8594 the number of elements in this list should be as large as the dimension
8595 of the schedule space, but no direct correspondence should be assumed
8596 between dimensions and elements.
8597 If the input schedule is not injective, then an additional number
8598 of C<isl_id>s equal to the largest dimension of the input domains
8599 may be required.
8600 If the number of provided C<isl_id>s is insufficient, then additional
8601 names are automatically generated.
8603         #include <isl/ast_build.h>
8604         __isl_give isl_ast_build *
8605         isl_ast_build_set_create_leaf(
8606                 __isl_take isl_ast_build *control,
8607                 __isl_give isl_ast_node *(*fn)(
8608                         __isl_take isl_ast_build *build,
8609                         void *user), void *user);
8612 C<isl_ast_build_set_create_leaf> function allows for the
8613 specification of a callback that should be called whenever the AST
8614 generator arrives at an element of the schedule domain.
8615 The callback should return an AST node that should be inserted
8616 at the corresponding position of the AST.  The default action (when
8617 the callback is not set) is to continue generating parts of the AST to scan
8618 all the domain elements associated to the schedule domain element
8619 and to insert user nodes, ``calling'' the domain element, for each of them.
8620 The C<build> argument contains the current state of the C<isl_ast_build>.
8621 To ease nested AST generation (see L</"Nested AST Generation">),
8622 all control information that is
8623 specific to the current AST generation such as the options and
8624 the callbacks has been removed from this C<isl_ast_build>.
8625 The callback would typically return the result of a nested
8626 AST generation or a
8627 user defined node created using the following function.
8629         #include <isl/ast.h>
8630         __isl_give isl_ast_node *isl_ast_node_alloc_user(
8631                 __isl_take isl_ast_expr *expr);
8633         #include <isl/ast_build.h>
8634         __isl_give isl_ast_build *
8635         isl_ast_build_set_at_each_domain(
8636                 __isl_take isl_ast_build *build,
8637                 __isl_give isl_ast_node *(*fn)(
8638                         __isl_take isl_ast_node *node,
8639                         __isl_keep isl_ast_build *build,
8640                         void *user), void *user);
8641         __isl_give isl_ast_build *
8642         isl_ast_build_set_before_each_for(
8643                 __isl_take isl_ast_build *build,
8644                 __isl_give isl_id *(*fn)(
8645                         __isl_keep isl_ast_build *build,
8646                         void *user), void *user);
8647         __isl_give isl_ast_build *
8648         isl_ast_build_set_after_each_for(
8649                 __isl_take isl_ast_build *build,
8650                 __isl_give isl_ast_node *(*fn)(
8651                         __isl_take isl_ast_node *node,
8652                         __isl_keep isl_ast_build *build,
8653                         void *user), void *user);
8655 The callback set by C<isl_ast_build_set_at_each_domain> will
8656 be called for each domain AST node.
8657 The callbacks set by C<isl_ast_build_set_before_each_for>
8658 and C<isl_ast_build_set_after_each_for> will be called
8659 for each for AST node.  The first will be called in depth-first
8660 pre-order, while the second will be called in depth-first post-order.
8661 Since C<isl_ast_build_set_before_each_for> is called before the for
8662 node is actually constructed, it is only passed an C<isl_ast_build>.
8663 The returned C<isl_id> will be added as an annotation (using
8664 C<isl_ast_node_set_annotation>) to the constructed for node.
8665 In particular, if the user has also specified an C<after_each_for>
8666 callback, then the annotation can be retrieved from the node passed to
8667 that callback using C<isl_ast_node_get_annotation>.
8668 All callbacks should C<NULL> on failure.
8669 The given C<isl_ast_build> can be used to create new
8670 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
8671 or C<isl_ast_build_call_from_pw_multi_aff>.
8673 =head3 Nested AST Generation
8675 C<isl> allows the user to create an AST within the context
8676 of another AST.  These nested ASTs are created using the
8677 same C<isl_ast_build_ast_from_schedule> function that is used to create the
8678 outer AST.  The C<build> argument should be an C<isl_ast_build>
8679 passed to a callback set by
8680 C<isl_ast_build_set_create_leaf>.
8681 The space of the range of the C<schedule> argument should refer
8682 to this build.  In particular, the space should be a wrapped
8683 relation and the domain of this wrapped relation should be the
8684 same as that of the range of the schedule returned by
8685 C<isl_ast_build_get_schedule> below.
8686 In practice, the new schedule is typically
8687 created by calling C<isl_union_map_range_product> on the old schedule
8688 and some extra piece of the schedule.
8689 The space of the schedule domain is also available from
8690 the C<isl_ast_build>.
8692         #include <isl/ast_build.h>
8693         __isl_give isl_union_map *isl_ast_build_get_schedule(
8694                 __isl_keep isl_ast_build *build);
8695         __isl_give isl_space *isl_ast_build_get_schedule_space(
8696                 __isl_keep isl_ast_build *build);
8697         __isl_give isl_ast_build *isl_ast_build_restrict(
8698                 __isl_take isl_ast_build *build,
8699                 __isl_take isl_set *set);
8701 The C<isl_ast_build_get_schedule> function returns a (partial)
8702 schedule for the domains elements for which part of the AST still needs to
8703 be generated in the current build.
8704 In particular, the domain elements are mapped to those iterations of the loops
8705 enclosing the current point of the AST generation inside which
8706 the domain elements are executed.
8707 No direct correspondence between
8708 the input schedule and this schedule should be assumed.
8709 The space obtained from C<isl_ast_build_get_schedule_space> can be used
8710 to create a set for C<isl_ast_build_restrict> to intersect
8711 with the current build.  In particular, the set passed to
8712 C<isl_ast_build_restrict> can have additional parameters.
8713 The ids of the set dimensions in the space returned by
8714 C<isl_ast_build_get_schedule_space> correspond to the
8715 iterators of the already generated loops.
8716 The user should not rely on the ids of the output dimensions
8717 of the relations in the union relation returned by
8718 C<isl_ast_build_get_schedule> having any particular value.
8720 =head1 Applications
8722 Although C<isl> is mainly meant to be used as a library,
8723 it also contains some basic applications that use some
8724 of the functionality of C<isl>.
8725 The input may be specified in either the L<isl format>
8726 or the L<PolyLib format>.
8728 =head2 C<isl_polyhedron_sample>
8730 C<isl_polyhedron_sample> takes a polyhedron as input and prints
8731 an integer element of the polyhedron, if there is any.
8732 The first column in the output is the denominator and is always
8733 equal to 1.  If the polyhedron contains no integer points,
8734 then a vector of length zero is printed.
8736 =head2 C<isl_pip>
8738 C<isl_pip> takes the same input as the C<example> program
8739 from the C<piplib> distribution, i.e., a set of constraints
8740 on the parameters, a line containing only -1 and finally a set
8741 of constraints on a parametric polyhedron.
8742 The coefficients of the parameters appear in the last columns
8743 (but before the final constant column).
8744 The output is the lexicographic minimum of the parametric polyhedron.
8745 As C<isl> currently does not have its own output format, the output
8746 is just a dump of the internal state.
8748 =head2 C<isl_polyhedron_minimize>
8750 C<isl_polyhedron_minimize> computes the minimum of some linear
8751 or affine objective function over the integer points in a polyhedron.
8752 If an affine objective function
8753 is given, then the constant should appear in the last column.
8755 =head2 C<isl_polytope_scan>
8757 Given a polytope, C<isl_polytope_scan> prints
8758 all integer points in the polytope.
8760 =head2 C<isl_codegen>
8762 Given a schedule, a context set and an options relation,
8763 C<isl_codegen> prints out an AST that scans the domain elements
8764 of the schedule in the order of their image(s) taking into account
8765 the constraints in the context set.