relicense isl under the MIT license
[platform/upstream/isl.git] / doc / user.pod
1 =head1 Introduction
2
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>.
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.
12
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 the discussion group at
21 L<http://groups.google.com/group/isl-development>.
22
23 =head2 Backward Incompatible Changes
24
25 =head3 Changes since isl-0.02
26
27 =over
28
29 =item * The old printing functions have been deprecated
30 and replaced by C<isl_printer> functions, see L<Input and Output>.
31
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>.
35
36 =back
37
38 =head3 Changes since isl-0.03
39
40 =over
41
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>.
46
47 =back
48
49 =head3 Changes since isl-0.04
50
51 =over
52
53 =item * All header files have been renamed from C<isl_header.h>
54 to C<isl/header.h>.
55
56 =back
57
58 =head3 Changes since isl-0.05
59
60 =over
61
62 =item * The functions C<isl_printer_print_basic_set> and
63 C<isl_printer_print_basic_map> no longer print a newline.
64
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.
69
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))>.
74
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.
78
79 =back
80
81 =head3 Changes since isl-0.06
82
83 =over
84
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.
88
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.
92
93 =back
94
95 =head3 Changes since isl-0.07
96
97 =over
98
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>.
103
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.
108
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>.
116
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.
125
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>.
130
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
141
142         isl_qpolynomial_from_aff(isl_aff_floor(div))
143
144 The function C<isl_constraint_div> has also been renamed
145 to C<isl_constraint_get_div>.
146
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.
153
154 =back
155
156 =head3 Changes since isl-0.09
157
158 =over
159
160 =item * The C<schedule_split_parallel> option has been replaced
161 by the C<schedule_split_scaled> option.
162
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
166
167         isl_pw_aff_cond(isl_set_indicator_function(a), b, c)
168
169 =back
170
171 =head1 License
172
173 C<isl> is released under the MIT license.
174
175 =over
176
177 Permission is hereby granted, free of charge, to any person obtaining a copy of
178 this software and associated documentation files (the "Software"), to deal in
179 the Software without restriction, including without limitation the rights to
180 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
181 of the Software, and to permit persons to whom the Software is furnished to do
182 so, subject to the following conditions:
183
184 The above copyright notice and this permission notice shall be included in all
185 copies or substantial portions of the Software.
186
187 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
188 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
189 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
190 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
191 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
192 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
193 SOFTWARE.
194
195 =back
196
197 Note that C<isl> currently requires C<GMP>, which is released
198 under the GNU Lesser General Public License (LGPL).  This means
199 that code linked against C<isl> is also linked against LGPL code.
200
201 =head1 Installation
202
203 The source of C<isl> can be obtained either as a tarball
204 or from the git repository.  Both are available from
205 L<http://freshmeat.net/projects/isl/>.
206 The installation process depends on how you obtained
207 the source.
208
209 =head2 Installation from the git repository
210
211 =over
212
213 =item 1 Clone or update the repository
214
215 The first time the source is obtained, you need to clone
216 the repository.
217
218         git clone git://repo.or.cz/isl.git
219
220 To obtain updates, you need to pull in the latest changes
221
222         git pull
223
224 =item 2 Generate C<configure>
225
226         ./autogen.sh
227
228 =back
229
230 After performing the above steps, continue
231 with the L<Common installation instructions>.
232
233 =head2 Common installation instructions
234
235 =over
236
237 =item 1 Obtain C<GMP>
238
239 Building C<isl> requires C<GMP>, including its headers files.
240 Your distribution may not provide these header files by default
241 and you may need to install a package called C<gmp-devel> or something
242 similar.  Alternatively, C<GMP> can be built from
243 source, available from L<http://gmplib.org/>.
244
245 =item 2 Configure
246
247 C<isl> uses the standard C<autoconf> C<configure> script.
248 To run it, just type
249
250         ./configure
251
252 optionally followed by some configure options.
253 A complete list of options can be obtained by running
254
255         ./configure --help
256
257 Below we discuss some of the more common options.
258
259 C<isl> can optionally use C<piplib>, but no
260 C<piplib> functionality is currently used by default.
261 The C<--with-piplib> option can
262 be used to specify which C<piplib>
263 library to use, either an installed version (C<system>),
264 an externally built version (C<build>)
265 or no version (C<no>).  The option C<build> is mostly useful
266 in C<configure> scripts of larger projects that bundle both C<isl>
267 and C<piplib>.
268
269 =over
270
271 =item C<--prefix>
272
273 Installation prefix for C<isl>
274
275 =item C<--with-gmp-prefix>
276
277 Installation prefix for C<GMP> (architecture-independent files).
278
279 =item C<--with-gmp-exec-prefix>
280
281 Installation prefix for C<GMP> (architecture-dependent files).
282
283 =item C<--with-piplib>
284
285 Which copy of C<piplib> to use, either C<no> (default), C<system> or C<build>.
286
287 =item C<--with-piplib-prefix>
288
289 Installation prefix for C<system> C<piplib> (architecture-independent files).
290
291 =item C<--with-piplib-exec-prefix>
292
293 Installation prefix for C<system> C<piplib> (architecture-dependent files).
294
295 =item C<--with-piplib-builddir>
296
297 Location where C<build> C<piplib> was built.
298
299 =back
300
301 =item 3 Compile
302
303         make
304
305 =item 4 Install (optional)
306
307         make install
308
309 =back
310
311 =head1 Library
312
313 =head2 Initialization
314
315 All manipulations of integer sets and relations occur within
316 the context of an C<isl_ctx>.
317 A given C<isl_ctx> can only be used within a single thread.
318 All arguments of a function are required to have been allocated
319 within the same context.
320 There are currently no functions available for moving an object
321 from one C<isl_ctx> to another C<isl_ctx>.  This means that
322 there is currently no way of safely moving an object from one
323 thread to another, unless the whole C<isl_ctx> is moved.
324
325 An C<isl_ctx> can be allocated using C<isl_ctx_alloc> and
326 freed using C<isl_ctx_free>.
327 All objects allocated within an C<isl_ctx> should be freed
328 before the C<isl_ctx> itself is freed.
329
330         isl_ctx *isl_ctx_alloc();
331         void isl_ctx_free(isl_ctx *ctx);
332
333 =head2 Integers
334
335 All operations on integers, mainly the coefficients
336 of the constraints describing the sets and relations,
337 are performed in exact integer arithmetic using C<GMP>.
338 However, to allow future versions of C<isl> to optionally
339 support fixed integer arithmetic, all calls to C<GMP>
340 are wrapped inside C<isl> specific macros.
341 The basic type is C<isl_int> and the operations below
342 are available on this type.
343 The meanings of these operations are essentially the same
344 as their C<GMP> C<mpz_> counterparts.
345 As always with C<GMP> types, C<isl_int>s need to be
346 initialized with C<isl_int_init> before they can be used
347 and they need to be released with C<isl_int_clear>
348 after the last use.
349 The user should not assume that an C<isl_int> is represented
350 as a C<mpz_t>, but should instead explicitly convert between
351 C<mpz_t>s and C<isl_int>s using C<isl_int_set_gmp> and
352 C<isl_int_get_gmp> whenever a C<mpz_t> is required.
353
354 =over
355
356 =item isl_int_init(i)
357
358 =item isl_int_clear(i)
359
360 =item isl_int_set(r,i)
361
362 =item isl_int_set_si(r,i)
363
364 =item isl_int_set_gmp(r,g)
365
366 =item isl_int_get_gmp(i,g)
367
368 =item isl_int_abs(r,i)
369
370 =item isl_int_neg(r,i)
371
372 =item isl_int_swap(i,j)
373
374 =item isl_int_swap_or_set(i,j)
375
376 =item isl_int_add_ui(r,i,j)
377
378 =item isl_int_sub_ui(r,i,j)
379
380 =item isl_int_add(r,i,j)
381
382 =item isl_int_sub(r,i,j)
383
384 =item isl_int_mul(r,i,j)
385
386 =item isl_int_mul_ui(r,i,j)
387
388 =item isl_int_addmul(r,i,j)
389
390 =item isl_int_submul(r,i,j)
391
392 =item isl_int_gcd(r,i,j)
393
394 =item isl_int_lcm(r,i,j)
395
396 =item isl_int_divexact(r,i,j)
397
398 =item isl_int_cdiv_q(r,i,j)
399
400 =item isl_int_fdiv_q(r,i,j)
401
402 =item isl_int_fdiv_r(r,i,j)
403
404 =item isl_int_fdiv_q_ui(r,i,j)
405
406 =item isl_int_read(r,s)
407
408 =item isl_int_print(out,i,width)
409
410 =item isl_int_sgn(i)
411
412 =item isl_int_cmp(i,j)
413
414 =item isl_int_cmp_si(i,si)
415
416 =item isl_int_eq(i,j)
417
418 =item isl_int_ne(i,j)
419
420 =item isl_int_lt(i,j)
421
422 =item isl_int_le(i,j)
423
424 =item isl_int_gt(i,j)
425
426 =item isl_int_ge(i,j)
427
428 =item isl_int_abs_eq(i,j)
429
430 =item isl_int_abs_ne(i,j)
431
432 =item isl_int_abs_lt(i,j)
433
434 =item isl_int_abs_gt(i,j)
435
436 =item isl_int_abs_ge(i,j)
437
438 =item isl_int_is_zero(i)
439
440 =item isl_int_is_one(i)
441
442 =item isl_int_is_negone(i)
443
444 =item isl_int_is_pos(i)
445
446 =item isl_int_is_neg(i)
447
448 =item isl_int_is_nonpos(i)
449
450 =item isl_int_is_nonneg(i)
451
452 =item isl_int_is_divisible_by(i,j)
453
454 =back
455
456 =head2 Sets and Relations
457
458 C<isl> uses six types of objects for representing sets and relations,
459 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
460 C<isl_union_set> and C<isl_union_map>.
461 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
462 can be described as a conjunction of affine constraints, while
463 C<isl_set> and C<isl_map> represent unions of
464 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
465 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
466 to live in the same space.  C<isl_union_set>s and C<isl_union_map>s
467 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
468 where spaces are considered different if they have a different number
469 of dimensions and/or different names (see L<"Spaces">).
470 The difference between sets and relations (maps) is that sets have
471 one set of variables, while relations have two sets of variables,
472 input variables and output variables.
473
474 =head2 Memory Management
475
476 Since a high-level operation on sets and/or relations usually involves
477 several substeps and since the user is usually not interested in
478 the intermediate results, most functions that return a new object
479 will also release all the objects passed as arguments.
480 If the user still wants to use one or more of these arguments
481 after the function call, she should pass along a copy of the
482 object rather than the object itself.
483 The user is then responsible for making sure that the original
484 object gets used somewhere else or is explicitly freed.
485
486 The arguments and return values of all documented functions are
487 annotated to make clear which arguments are released and which
488 arguments are preserved.  In particular, the following annotations
489 are used
490
491 =over
492
493 =item C<__isl_give>
494
495 C<__isl_give> means that a new object is returned.
496 The user should make sure that the returned pointer is
497 used exactly once as a value for an C<__isl_take> argument.
498 In between, it can be used as a value for as many
499 C<__isl_keep> arguments as the user likes.
500 There is one exception, and that is the case where the
501 pointer returned is C<NULL>.  Is this case, the user
502 is free to use it as an C<__isl_take> argument or not.
503
504 =item C<__isl_take>
505
506 C<__isl_take> means that the object the argument points to
507 is taken over by the function and may no longer be used
508 by the user as an argument to any other function.
509 The pointer value must be one returned by a function
510 returning an C<__isl_give> pointer.
511 If the user passes in a C<NULL> value, then this will
512 be treated as an error in the sense that the function will
513 not perform its usual operation.  However, it will still
514 make sure that all the other C<__isl_take> arguments
515 are released.
516
517 =item C<__isl_keep>
518
519 C<__isl_keep> means that the function will only use the object
520 temporarily.  After the function has finished, the user
521 can still use it as an argument to other functions.
522 A C<NULL> value will be treated in the same way as
523 a C<NULL> value for an C<__isl_take> argument.
524
525 =back
526
527 =head2 Error Handling
528
529 C<isl> supports different ways to react in case a runtime error is triggered.
530 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
531 with two maps that have incompatible spaces. There are three possible ways
532 to react on error: to warn, to continue or to abort.
533
534 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
535 the last error in the corresponding C<isl_ctx> and the function in which the
536 error was triggered returns C<NULL>. An error does not corrupt internal state,
537 such that isl can continue to be used. C<isl> also provides functions to
538 read the last error and to reset the memory that stores the last error. The
539 last error is only stored for information purposes. Its presence does not
540 change the behavior of C<isl>. Hence, resetting an error is not required to
541 continue to use isl, but only to observe new errors.
542
543         #include <isl/ctx.h>
544         enum isl_error isl_ctx_last_error(isl_ctx *ctx);
545         void isl_ctx_reset_error(isl_ctx *ctx);
546
547 Another option is to continue on error. This is similar to warn on error mode,
548 except that C<isl> does not print any warning. This allows a program to
549 implement its own error reporting.
550
551 The last option is to directly abort the execution of the program from within
552 the isl library. This makes it obviously impossible to recover from an error,
553 but it allows to directly spot the error location. By aborting on error,
554 debuggers break at the location the error occurred and can provide a stack
555 trace. Other tools that automatically provide stack traces on abort or that do
556 not want to continue execution after an error was triggered may also prefer to
557 abort on error.
558
559 The on error behavior of isl can be specified by calling
560 C<isl_options_set_on_error> or by setting the command line option
561 C<--isl-on-error>. Valid arguments for the function call are
562 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
563 choices for the command line option are C<warn>, C<continue> and C<abort>.
564 It is also possible to query the current error mode.
565
566         #include <isl/options.h>
567         int isl_options_set_on_error(isl_ctx *ctx, int val);
568         int isl_options_get_on_error(isl_ctx *ctx);
569
570 =head2 Identifiers
571
572 Identifiers are used to identify both individual dimensions
573 and tuples of dimensions.  They consist of a name and an optional
574 pointer.  Identifiers with the same name but different pointer values
575 are considered to be distinct.
576 Identifiers can be constructed, copied, freed, inspected and printed
577 using the following functions.
578
579         #include <isl/id.h>
580         __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
581                 __isl_keep const char *name, void *user);
582         __isl_give isl_id *isl_id_copy(isl_id *id);
583         void *isl_id_free(__isl_take isl_id *id);
584
585         isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
586         void *isl_id_get_user(__isl_keep isl_id *id);
587         __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
588
589         __isl_give isl_printer *isl_printer_print_id(
590                 __isl_take isl_printer *p, __isl_keep isl_id *id);
591
592 Note that C<isl_id_get_name> returns a pointer to some internal
593 data structure, so the result can only be used while the
594 corresponding C<isl_id> is alive.
595
596 =head2 Spaces
597
598 Whenever a new set, relation or similiar object is created from scratch,
599 the space in which it lives needs to be specified using an C<isl_space>.
600 Each space involves zero or more parameters and zero, one or two
601 tuples of set or input/output dimensions.  The parameters and dimensions
602 are identified by an C<isl_dim_type> and a position.
603 The type C<isl_dim_param> refers to parameters,
604 the type C<isl_dim_set> refers to set dimensions (for spaces
605 with a single tuple of dimensions) and the types C<isl_dim_in>
606 and C<isl_dim_out> refer to input and output dimensions
607 (for spaces with two tuples of dimensions).
608 Local spaces (see L</"Local Spaces">) also contain dimensions
609 of type C<isl_dim_div>.
610 Note that parameters are only identified by their position within
611 a given object.  Across different objects, parameters are (usually)
612 identified by their names or identifiers.  Only unnamed parameters
613 are identified by their positions across objects.  The use of unnamed
614 parameters is discouraged.
615
616         #include <isl/space.h>
617         __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
618                 unsigned nparam, unsigned n_in, unsigned n_out);
619         __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
620                 unsigned nparam);
621         __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
622                 unsigned nparam, unsigned dim);
623         __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
624         void isl_space_free(__isl_take isl_space *space);
625         unsigned isl_space_dim(__isl_keep isl_space *space,
626                 enum isl_dim_type type);
627
628 The space used for creating a parameter domain
629 needs to be created using C<isl_space_params_alloc>.
630 For other sets, the space
631 needs to be created using C<isl_space_set_alloc>, while
632 for a relation, the space
633 needs to be created using C<isl_space_alloc>.
634 C<isl_space_dim> can be used
635 to find out the number of dimensions of each type in
636 a space, where type may be
637 C<isl_dim_param>, C<isl_dim_in> (only for relations),
638 C<isl_dim_out> (only for relations), C<isl_dim_set>
639 (only for sets) or C<isl_dim_all>.
640
641 To check whether a given space is that of a set or a map
642 or whether it is a parameter space, use these functions:
643
644         #include <isl/space.h>
645         int isl_space_is_params(__isl_keep isl_space *space);
646         int isl_space_is_set(__isl_keep isl_space *space);
647         int isl_space_is_map(__isl_keep isl_space *space);
648
649 Spaces can be compared using the following functions:
650
651         #include <isl/space.h>
652         int isl_space_is_equal(__isl_keep isl_space *space1,
653                 __isl_keep isl_space *space2);
654         int isl_space_is_domain(__isl_keep isl_space *space1,
655                 __isl_keep isl_space *space2);
656         int isl_space_is_range(__isl_keep isl_space *space1,
657                 __isl_keep isl_space *space2);
658
659 C<isl_space_is_domain> checks whether the first argument is equal
660 to the domain of the second argument.  This requires in particular that
661 the first argument is a set space and that the second argument
662 is a map space.
663
664 It is often useful to create objects that live in the
665 same space as some other object.  This can be accomplished
666 by creating the new objects
667 (see L<Creating New Sets and Relations> or
668 L<Creating New (Piecewise) Quasipolynomials>) based on the space
669 of the original object.
670
671         #include <isl/set.h>
672         __isl_give isl_space *isl_basic_set_get_space(
673                 __isl_keep isl_basic_set *bset);
674         __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
675
676         #include <isl/union_set.h>
677         __isl_give isl_space *isl_union_set_get_space(
678                 __isl_keep isl_union_set *uset);
679
680         #include <isl/map.h>
681         __isl_give isl_space *isl_basic_map_get_space(
682                 __isl_keep isl_basic_map *bmap);
683         __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
684
685         #include <isl/union_map.h>
686         __isl_give isl_space *isl_union_map_get_space(
687                 __isl_keep isl_union_map *umap);
688
689         #include <isl/constraint.h>
690         __isl_give isl_space *isl_constraint_get_space(
691                 __isl_keep isl_constraint *constraint);
692
693         #include <isl/polynomial.h>
694         __isl_give isl_space *isl_qpolynomial_get_domain_space(
695                 __isl_keep isl_qpolynomial *qp);
696         __isl_give isl_space *isl_qpolynomial_get_space(
697                 __isl_keep isl_qpolynomial *qp);
698         __isl_give isl_space *isl_qpolynomial_fold_get_space(
699                 __isl_keep isl_qpolynomial_fold *fold);
700         __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
701                 __isl_keep isl_pw_qpolynomial *pwqp);
702         __isl_give isl_space *isl_pw_qpolynomial_get_space(
703                 __isl_keep isl_pw_qpolynomial *pwqp);
704         __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
705                 __isl_keep isl_pw_qpolynomial_fold *pwf);
706         __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
707                 __isl_keep isl_pw_qpolynomial_fold *pwf);
708         __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
709                 __isl_keep isl_union_pw_qpolynomial *upwqp);
710         __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
711                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
712
713         #include <isl/aff.h>
714         __isl_give isl_space *isl_aff_get_domain_space(
715                 __isl_keep isl_aff *aff);
716         __isl_give isl_space *isl_aff_get_space(
717                 __isl_keep isl_aff *aff);
718         __isl_give isl_space *isl_pw_aff_get_domain_space(
719                 __isl_keep isl_pw_aff *pwaff);
720         __isl_give isl_space *isl_pw_aff_get_space(
721                 __isl_keep isl_pw_aff *pwaff);
722         __isl_give isl_space *isl_multi_aff_get_domain_space(
723                 __isl_keep isl_multi_aff *maff);
724         __isl_give isl_space *isl_multi_aff_get_space(
725                 __isl_keep isl_multi_aff *maff);
726         __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
727                 __isl_keep isl_pw_multi_aff *pma);
728         __isl_give isl_space *isl_pw_multi_aff_get_space(
729                 __isl_keep isl_pw_multi_aff *pma);
730         __isl_give isl_space *isl_union_pw_multi_aff_get_space(
731                 __isl_keep isl_union_pw_multi_aff *upma);
732
733         #include <isl/point.h>
734         __isl_give isl_space *isl_point_get_space(
735                 __isl_keep isl_point *pnt);
736
737 The identifiers or names of the individual dimensions may be set or read off
738 using the following functions.
739
740         #include <isl/space.h>
741         __isl_give isl_space *isl_space_set_dim_id(
742                 __isl_take isl_space *space,
743                 enum isl_dim_type type, unsigned pos,
744                 __isl_take isl_id *id);
745         int isl_space_has_dim_id(__isl_keep isl_space *space,
746                 enum isl_dim_type type, unsigned pos);
747         __isl_give isl_id *isl_space_get_dim_id(
748                 __isl_keep isl_space *space,
749                 enum isl_dim_type type, unsigned pos);
750         __isl_give isl_space *isl_space_set_dim_name(
751                 __isl_take isl_space *space,
752                  enum isl_dim_type type, unsigned pos,
753                  __isl_keep const char *name);
754         int isl_space_has_dim_name(__isl_keep isl_space *space,
755                 enum isl_dim_type type, unsigned pos);
756         __isl_keep const char *isl_space_get_dim_name(
757                 __isl_keep isl_space *space,
758                 enum isl_dim_type type, unsigned pos);
759
760 Note that C<isl_space_get_name> returns a pointer to some internal
761 data structure, so the result can only be used while the
762 corresponding C<isl_space> is alive.
763 Also note that every function that operates on two sets or relations
764 requires that both arguments have the same parameters.  This also
765 means that if one of the arguments has named parameters, then the
766 other needs to have named parameters too and the names need to match.
767 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
768 arguments may have different parameters (as long as they are named),
769 in which case the result will have as parameters the union of the parameters of
770 the arguments.
771
772 Given the identifier or name of a dimension (typically a parameter),
773 its position can be obtained from the following function.
774
775         #include <isl/space.h>
776         int isl_space_find_dim_by_id(__isl_keep isl_space *space,
777                 enum isl_dim_type type, __isl_keep isl_id *id);
778         int isl_space_find_dim_by_name(__isl_keep isl_space *space,
779                 enum isl_dim_type type, const char *name);
780
781 The identifiers or names of entire spaces may be set or read off
782 using the following functions.
783
784         #include <isl/space.h>
785         __isl_give isl_space *isl_space_set_tuple_id(
786                 __isl_take isl_space *space,
787                 enum isl_dim_type type, __isl_take isl_id *id);
788         __isl_give isl_space *isl_space_reset_tuple_id(
789                 __isl_take isl_space *space, enum isl_dim_type type);
790         int isl_space_has_tuple_id(__isl_keep isl_space *space,
791                 enum isl_dim_type type);
792         __isl_give isl_id *isl_space_get_tuple_id(
793                 __isl_keep isl_space *space, enum isl_dim_type type);
794         __isl_give isl_space *isl_space_set_tuple_name(
795                 __isl_take isl_space *space,
796                 enum isl_dim_type type, const char *s);
797         int isl_space_has_tuple_name(__isl_keep isl_space *space,
798                 enum isl_dim_type type);
799         const char *isl_space_get_tuple_name(__isl_keep isl_space *space,
800                 enum isl_dim_type type);
801
802 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
803 or C<isl_dim_set>.  As with C<isl_space_get_name>,
804 the C<isl_space_get_tuple_name> function returns a pointer to some internal
805 data structure.
806 Binary operations require the corresponding spaces of their arguments
807 to have the same name.
808
809 Spaces can be nested.  In particular, the domain of a set or
810 the domain or range of a relation can be a nested relation.
811 The following functions can be used to construct and deconstruct
812 such nested spaces.
813
814         #include <isl/space.h>
815         int isl_space_is_wrapping(__isl_keep isl_space *space);
816         __isl_give isl_space *isl_space_wrap(__isl_take isl_space *space);
817         __isl_give isl_space *isl_space_unwrap(__isl_take isl_space *space);
818
819 The input to C<isl_space_is_wrapping> and C<isl_space_unwrap> should
820 be the space of a set, while that of
821 C<isl_space_wrap> should be the space of a relation.
822 Conversely, the output of C<isl_space_unwrap> is the space
823 of a relation, while that of C<isl_space_wrap> is the space of a set.
824
825 Spaces can be created from other spaces
826 using the following functions.
827
828         __isl_give isl_space *isl_space_domain(__isl_take isl_space *space);
829         __isl_give isl_space *isl_space_from_domain(__isl_take isl_space *space);
830         __isl_give isl_space *isl_space_range(__isl_take isl_space *space);
831         __isl_give isl_space *isl_space_from_range(__isl_take isl_space *space);
832         __isl_give isl_space *isl_space_params(
833                 __isl_take isl_space *space);
834         __isl_give isl_space *isl_space_set_from_params(
835                 __isl_take isl_space *space);
836         __isl_give isl_space *isl_space_reverse(__isl_take isl_space *space);
837         __isl_give isl_space *isl_space_join(__isl_take isl_space *left,
838                 __isl_take isl_space *right);
839         __isl_give isl_space *isl_space_align_params(
840                 __isl_take isl_space *space1, __isl_take isl_space *space2)
841         __isl_give isl_space *isl_space_insert_dims(__isl_take isl_space *space,
842                 enum isl_dim_type type, unsigned pos, unsigned n);
843         __isl_give isl_space *isl_space_add_dims(__isl_take isl_space *space,
844                 enum isl_dim_type type, unsigned n);
845         __isl_give isl_space *isl_space_drop_dims(__isl_take isl_space *space,
846                 enum isl_dim_type type, unsigned first, unsigned n);
847         __isl_give isl_space *isl_space_move_dims(__isl_take isl_space *space,
848                 enum isl_dim_type dst_type, unsigned dst_pos,
849                 enum isl_dim_type src_type, unsigned src_pos,
850                 unsigned n);
851         __isl_give isl_space *isl_space_map_from_set(
852                 __isl_take isl_space *space);
853         __isl_give isl_space *isl_space_map_from_domain_and_range(
854                 __isl_take isl_space *domain,
855                 __isl_take isl_space *range);
856         __isl_give isl_space *isl_space_zip(__isl_take isl_space *space);
857         __isl_give isl_space *isl_space_curry(
858                 __isl_take isl_space *space);
859
860 Note that if dimensions are added or removed from a space, then
861 the name and the internal structure are lost.
862
863 =head2 Local Spaces
864
865 A local space is essentially a space with
866 zero or more existentially quantified variables.
867 The local space of a (constraint of a) basic set or relation can be obtained
868 using the following functions.
869
870         #include <isl/constraint.h>
871         __isl_give isl_local_space *isl_constraint_get_local_space(
872                 __isl_keep isl_constraint *constraint);
873
874         #include <isl/set.h>
875         __isl_give isl_local_space *isl_basic_set_get_local_space(
876                 __isl_keep isl_basic_set *bset);
877
878         #include <isl/map.h>
879         __isl_give isl_local_space *isl_basic_map_get_local_space(
880                 __isl_keep isl_basic_map *bmap);
881
882 A new local space can be created from a space using
883
884         #include <isl/local_space.h>
885         __isl_give isl_local_space *isl_local_space_from_space(
886                 __isl_take isl_space *space);
887
888 They can be inspected, modified, copied and freed using the following functions.
889
890         #include <isl/local_space.h>
891         isl_ctx *isl_local_space_get_ctx(
892                 __isl_keep isl_local_space *ls);
893         int isl_local_space_is_set(__isl_keep isl_local_space *ls);
894         int isl_local_space_dim(__isl_keep isl_local_space *ls,
895                 enum isl_dim_type type);
896         int isl_local_space_has_dim_id(
897                 __isl_keep isl_local_space *ls,
898                 enum isl_dim_type type, unsigned pos);
899         __isl_give isl_id *isl_local_space_get_dim_id(
900                 __isl_keep isl_local_space *ls,
901                 enum isl_dim_type type, unsigned pos);
902         int isl_local_space_has_dim_name(
903                 __isl_keep isl_local_space *ls,
904                 enum isl_dim_type type, unsigned pos)
905         const char *isl_local_space_get_dim_name(
906                 __isl_keep isl_local_space *ls,
907                 enum isl_dim_type type, unsigned pos);
908         __isl_give isl_local_space *isl_local_space_set_dim_name(
909                 __isl_take isl_local_space *ls,
910                 enum isl_dim_type type, unsigned pos, const char *s);
911         __isl_give isl_local_space *isl_local_space_set_dim_id(
912                 __isl_take isl_local_space *ls,
913                 enum isl_dim_type type, unsigned pos,
914                 __isl_take isl_id *id);
915         __isl_give isl_space *isl_local_space_get_space(
916                 __isl_keep isl_local_space *ls);
917         __isl_give isl_aff *isl_local_space_get_div(
918                 __isl_keep isl_local_space *ls, int pos);
919         __isl_give isl_local_space *isl_local_space_copy(
920                 __isl_keep isl_local_space *ls);
921         void *isl_local_space_free(__isl_take isl_local_space *ls);
922
923 Two local spaces can be compared using
924
925         int isl_local_space_is_equal(__isl_keep isl_local_space *ls1,
926                 __isl_keep isl_local_space *ls2);
927
928 Local spaces can be created from other local spaces
929 using the following functions.
930
931         __isl_give isl_local_space *isl_local_space_domain(
932                 __isl_take isl_local_space *ls);
933         __isl_give isl_local_space *isl_local_space_range(
934                 __isl_take isl_local_space *ls);
935         __isl_give isl_local_space *isl_local_space_from_domain(
936                 __isl_take isl_local_space *ls);
937         __isl_give isl_local_space *isl_local_space_intersect(
938                 __isl_take isl_local_space *ls1,
939                 __isl_take isl_local_space *ls2);
940         __isl_give isl_local_space *isl_local_space_add_dims(
941                 __isl_take isl_local_space *ls,
942                 enum isl_dim_type type, unsigned n);
943         __isl_give isl_local_space *isl_local_space_insert_dims(
944                 __isl_take isl_local_space *ls,
945                 enum isl_dim_type type, unsigned first, unsigned n);
946         __isl_give isl_local_space *isl_local_space_drop_dims(
947                 __isl_take isl_local_space *ls,
948                 enum isl_dim_type type, unsigned first, unsigned n);
949
950 =head2 Input and Output
951
952 C<isl> supports its own input/output format, which is similar
953 to the C<Omega> format, but also supports the C<PolyLib> format
954 in some cases.
955
956 =head3 C<isl> format
957
958 The C<isl> format is similar to that of C<Omega>, but has a different
959 syntax for describing the parameters and allows for the definition
960 of an existentially quantified variable as the integer division
961 of an affine expression.
962 For example, the set of integers C<i> between C<0> and C<n>
963 such that C<i % 10 <= 6> can be described as
964
965         [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
966                                 i - 10 a <= 6) }
967
968 A set or relation can have several disjuncts, separated
969 by the keyword C<or>.  Each disjunct is either a conjunction
970 of constraints or a projection (C<exists>) of a conjunction
971 of constraints.  The constraints are separated by the keyword
972 C<and>.
973
974 =head3 C<PolyLib> format
975
976 If the represented set is a union, then the first line
977 contains a single number representing the number of disjuncts.
978 Otherwise, a line containing the number C<1> is optional.
979
980 Each disjunct is represented by a matrix of constraints.
981 The first line contains two numbers representing
982 the number of rows and columns,
983 where the number of rows is equal to the number of constraints
984 and the number of columns is equal to two plus the number of variables.
985 The following lines contain the actual rows of the constraint matrix.
986 In each row, the first column indicates whether the constraint
987 is an equality (C<0>) or inequality (C<1>).  The final column
988 corresponds to the constant term.
989
990 If the set is parametric, then the coefficients of the parameters
991 appear in the last columns before the constant column.
992 The coefficients of any existentially quantified variables appear
993 between those of the set variables and those of the parameters.
994
995 =head3 Extended C<PolyLib> format
996
997 The extended C<PolyLib> format is nearly identical to the
998 C<PolyLib> format.  The only difference is that the line
999 containing the number of rows and columns of a constraint matrix
1000 also contains four additional numbers:
1001 the number of output dimensions, the number of input dimensions,
1002 the number of local dimensions (i.e., the number of existentially
1003 quantified variables) and the number of parameters.
1004 For sets, the number of ``output'' dimensions is equal
1005 to the number of set dimensions, while the number of ``input''
1006 dimensions is zero.
1007
1008 =head3 Input
1009
1010         #include <isl/set.h>
1011         __isl_give isl_basic_set *isl_basic_set_read_from_file(
1012                 isl_ctx *ctx, FILE *input);
1013         __isl_give isl_basic_set *isl_basic_set_read_from_str(
1014                 isl_ctx *ctx, const char *str);
1015         __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
1016                 FILE *input);
1017         __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
1018                 const char *str);
1019
1020         #include <isl/map.h>
1021         __isl_give isl_basic_map *isl_basic_map_read_from_file(
1022                 isl_ctx *ctx, FILE *input);
1023         __isl_give isl_basic_map *isl_basic_map_read_from_str(
1024                 isl_ctx *ctx, const char *str);
1025         __isl_give isl_map *isl_map_read_from_file(
1026                 isl_ctx *ctx, FILE *input);
1027         __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
1028                 const char *str);
1029
1030         #include <isl/union_set.h>
1031         __isl_give isl_union_set *isl_union_set_read_from_file(
1032                 isl_ctx *ctx, FILE *input);
1033         __isl_give isl_union_set *isl_union_set_read_from_str(
1034                 isl_ctx *ctx, const char *str);
1035
1036         #include <isl/union_map.h>
1037         __isl_give isl_union_map *isl_union_map_read_from_file(
1038                 isl_ctx *ctx, FILE *input);
1039         __isl_give isl_union_map *isl_union_map_read_from_str(
1040                 isl_ctx *ctx, const char *str);
1041
1042 The input format is autodetected and may be either the C<PolyLib> format
1043 or the C<isl> format.
1044
1045 =head3 Output
1046
1047 Before anything can be printed, an C<isl_printer> needs to
1048 be created.
1049
1050         __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
1051                 FILE *file);
1052         __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
1053         void *isl_printer_free(__isl_take isl_printer *printer);
1054         __isl_give char *isl_printer_get_str(
1055                 __isl_keep isl_printer *printer);
1056
1057 The printer can be inspected using the following functions.
1058
1059         FILE *isl_printer_get_file(
1060                 __isl_keep isl_printer *printer);
1061         int isl_printer_get_output_format(
1062                 __isl_keep isl_printer *p);
1063
1064 The behavior of the printer can be modified in various ways
1065
1066         __isl_give isl_printer *isl_printer_set_output_format(
1067                 __isl_take isl_printer *p, int output_format);
1068         __isl_give isl_printer *isl_printer_set_indent(
1069                 __isl_take isl_printer *p, int indent);
1070         __isl_give isl_printer *isl_printer_indent(
1071                 __isl_take isl_printer *p, int indent);
1072         __isl_give isl_printer *isl_printer_set_prefix(
1073                 __isl_take isl_printer *p, const char *prefix);
1074         __isl_give isl_printer *isl_printer_set_suffix(
1075                 __isl_take isl_printer *p, const char *suffix);
1076
1077 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
1078 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
1079 and defaults to C<ISL_FORMAT_ISL>.
1080 Each line in the output is indented by C<indent> (set by
1081 C<isl_printer_set_indent>) spaces
1082 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
1083 In the C<PolyLib> format output,
1084 the coefficients of the existentially quantified variables
1085 appear between those of the set variables and those
1086 of the parameters.
1087 The function C<isl_printer_indent> increases the indentation
1088 by the specified amount (which may be negative).
1089
1090 To actually print something, use
1091
1092         #include <isl/printer.h>
1093         __isl_give isl_printer *isl_printer_print_double(
1094                 __isl_take isl_printer *p, double d);
1095
1096         #include <isl/set.h>
1097         __isl_give isl_printer *isl_printer_print_basic_set(
1098                 __isl_take isl_printer *printer,
1099                 __isl_keep isl_basic_set *bset);
1100         __isl_give isl_printer *isl_printer_print_set(
1101                 __isl_take isl_printer *printer,
1102                 __isl_keep isl_set *set);
1103
1104         #include <isl/map.h>
1105         __isl_give isl_printer *isl_printer_print_basic_map(
1106                 __isl_take isl_printer *printer,
1107                 __isl_keep isl_basic_map *bmap);
1108         __isl_give isl_printer *isl_printer_print_map(
1109                 __isl_take isl_printer *printer,
1110                 __isl_keep isl_map *map);
1111
1112         #include <isl/union_set.h>
1113         __isl_give isl_printer *isl_printer_print_union_set(
1114                 __isl_take isl_printer *p,
1115                 __isl_keep isl_union_set *uset);
1116
1117         #include <isl/union_map.h>
1118         __isl_give isl_printer *isl_printer_print_union_map(
1119                 __isl_take isl_printer *p,
1120                 __isl_keep isl_union_map *umap);
1121
1122 When called on a file printer, the following function flushes
1123 the file.  When called on a string printer, the buffer is cleared.
1124
1125         __isl_give isl_printer *isl_printer_flush(
1126                 __isl_take isl_printer *p);
1127
1128 =head2 Creating New Sets and Relations
1129
1130 C<isl> has functions for creating some standard sets and relations.
1131
1132 =over
1133
1134 =item * Empty sets and relations
1135
1136         __isl_give isl_basic_set *isl_basic_set_empty(
1137                 __isl_take isl_space *space);
1138         __isl_give isl_basic_map *isl_basic_map_empty(
1139                 __isl_take isl_space *space);
1140         __isl_give isl_set *isl_set_empty(
1141                 __isl_take isl_space *space);
1142         __isl_give isl_map *isl_map_empty(
1143                 __isl_take isl_space *space);
1144         __isl_give isl_union_set *isl_union_set_empty(
1145                 __isl_take isl_space *space);
1146         __isl_give isl_union_map *isl_union_map_empty(
1147                 __isl_take isl_space *space);
1148
1149 For C<isl_union_set>s and C<isl_union_map>s, the space
1150 is only used to specify the parameters.
1151
1152 =item * Universe sets and relations
1153
1154         __isl_give isl_basic_set *isl_basic_set_universe(
1155                 __isl_take isl_space *space);
1156         __isl_give isl_basic_map *isl_basic_map_universe(
1157                 __isl_take isl_space *space);
1158         __isl_give isl_set *isl_set_universe(
1159                 __isl_take isl_space *space);
1160         __isl_give isl_map *isl_map_universe(
1161                 __isl_take isl_space *space);
1162         __isl_give isl_union_set *isl_union_set_universe(
1163                 __isl_take isl_union_set *uset);
1164         __isl_give isl_union_map *isl_union_map_universe(
1165                 __isl_take isl_union_map *umap);
1166
1167 The sets and relations constructed by the functions above
1168 contain all integer values, while those constructed by the
1169 functions below only contain non-negative values.
1170
1171         __isl_give isl_basic_set *isl_basic_set_nat_universe(
1172                 __isl_take isl_space *space);
1173         __isl_give isl_basic_map *isl_basic_map_nat_universe(
1174                 __isl_take isl_space *space);
1175         __isl_give isl_set *isl_set_nat_universe(
1176                 __isl_take isl_space *space);
1177         __isl_give isl_map *isl_map_nat_universe(
1178                 __isl_take isl_space *space);
1179
1180 =item * Identity relations
1181
1182         __isl_give isl_basic_map *isl_basic_map_identity(
1183                 __isl_take isl_space *space);
1184         __isl_give isl_map *isl_map_identity(
1185                 __isl_take isl_space *space);
1186
1187 The number of input and output dimensions in C<space> needs
1188 to be the same.
1189
1190 =item * Lexicographic order
1191
1192         __isl_give isl_map *isl_map_lex_lt(
1193                 __isl_take isl_space *set_space);
1194         __isl_give isl_map *isl_map_lex_le(
1195                 __isl_take isl_space *set_space);
1196         __isl_give isl_map *isl_map_lex_gt(
1197                 __isl_take isl_space *set_space);
1198         __isl_give isl_map *isl_map_lex_ge(
1199                 __isl_take isl_space *set_space);
1200         __isl_give isl_map *isl_map_lex_lt_first(
1201                 __isl_take isl_space *space, unsigned n);
1202         __isl_give isl_map *isl_map_lex_le_first(
1203                 __isl_take isl_space *space, unsigned n);
1204         __isl_give isl_map *isl_map_lex_gt_first(
1205                 __isl_take isl_space *space, unsigned n);
1206         __isl_give isl_map *isl_map_lex_ge_first(
1207                 __isl_take isl_space *space, unsigned n);
1208
1209 The first four functions take a space for a B<set>
1210 and return relations that express that the elements in the domain
1211 are lexicographically less
1212 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1213 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1214 than the elements in the range.
1215 The last four functions take a space for a map
1216 and return relations that express that the first C<n> dimensions
1217 in the domain are lexicographically less
1218 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1219 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1220 than the first C<n> dimensions in the range.
1221
1222 =back
1223
1224 A basic set or relation can be converted to a set or relation
1225 using the following functions.
1226
1227         __isl_give isl_set *isl_set_from_basic_set(
1228                 __isl_take isl_basic_set *bset);
1229         __isl_give isl_map *isl_map_from_basic_map(
1230                 __isl_take isl_basic_map *bmap);
1231
1232 Sets and relations can be converted to union sets and relations
1233 using the following functions.
1234
1235         __isl_give isl_union_set *isl_union_set_from_basic_set(
1236                 __isl_take isl_basic_set *bset);
1237         __isl_give isl_union_map *isl_union_map_from_basic_map(
1238                 __isl_take isl_basic_map *bmap);
1239         __isl_give isl_union_set *isl_union_set_from_set(
1240                 __isl_take isl_set *set);
1241         __isl_give isl_union_map *isl_union_map_from_map(
1242                 __isl_take isl_map *map);
1243
1244 The inverse conversions below can only be used if the input
1245 union set or relation is known to contain elements in exactly one
1246 space.
1247
1248         __isl_give isl_set *isl_set_from_union_set(
1249                 __isl_take isl_union_set *uset);
1250         __isl_give isl_map *isl_map_from_union_map(
1251                 __isl_take isl_union_map *umap);
1252
1253 A zero-dimensional set can be constructed on a given parameter domain
1254 using the following function.
1255
1256         __isl_give isl_set *isl_set_from_params(
1257                 __isl_take isl_set *set);
1258
1259 Sets and relations can be copied and freed again using the following
1260 functions.
1261
1262         __isl_give isl_basic_set *isl_basic_set_copy(
1263                 __isl_keep isl_basic_set *bset);
1264         __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1265         __isl_give isl_union_set *isl_union_set_copy(
1266                 __isl_keep isl_union_set *uset);
1267         __isl_give isl_basic_map *isl_basic_map_copy(
1268                 __isl_keep isl_basic_map *bmap);
1269         __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1270         __isl_give isl_union_map *isl_union_map_copy(
1271                 __isl_keep isl_union_map *umap);
1272         void isl_basic_set_free(__isl_take isl_basic_set *bset);
1273         void *isl_set_free(__isl_take isl_set *set);
1274         void *isl_union_set_free(__isl_take isl_union_set *uset);
1275         void isl_basic_map_free(__isl_take isl_basic_map *bmap);
1276         void isl_map_free(__isl_take isl_map *map);
1277         void *isl_union_map_free(__isl_take isl_union_map *umap);
1278
1279 Other sets and relations can be constructed by starting
1280 from a universe set or relation, adding equality and/or
1281 inequality constraints and then projecting out the
1282 existentially quantified variables, if any.
1283 Constraints can be constructed, manipulated and
1284 added to (or removed from) (basic) sets and relations
1285 using the following functions.
1286
1287         #include <isl/constraint.h>
1288         __isl_give isl_constraint *isl_equality_alloc(
1289                 __isl_take isl_local_space *ls);
1290         __isl_give isl_constraint *isl_inequality_alloc(
1291                 __isl_take isl_local_space *ls);
1292         __isl_give isl_constraint *isl_constraint_set_constant(
1293                 __isl_take isl_constraint *constraint, isl_int v);
1294         __isl_give isl_constraint *isl_constraint_set_constant_si(
1295                 __isl_take isl_constraint *constraint, int v);
1296         __isl_give isl_constraint *isl_constraint_set_coefficient(
1297                 __isl_take isl_constraint *constraint,
1298                 enum isl_dim_type type, int pos, isl_int v);
1299         __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1300                 __isl_take isl_constraint *constraint,
1301                 enum isl_dim_type type, int pos, int v);
1302         __isl_give isl_basic_map *isl_basic_map_add_constraint(
1303                 __isl_take isl_basic_map *bmap,
1304                 __isl_take isl_constraint *constraint);
1305         __isl_give isl_basic_set *isl_basic_set_add_constraint(
1306                 __isl_take isl_basic_set *bset,
1307                 __isl_take isl_constraint *constraint);
1308         __isl_give isl_map *isl_map_add_constraint(
1309                 __isl_take isl_map *map,
1310                 __isl_take isl_constraint *constraint);
1311         __isl_give isl_set *isl_set_add_constraint(
1312                 __isl_take isl_set *set,
1313                 __isl_take isl_constraint *constraint);
1314         __isl_give isl_basic_set *isl_basic_set_drop_constraint(
1315                 __isl_take isl_basic_set *bset,
1316                 __isl_take isl_constraint *constraint);
1317
1318 For example, to create a set containing the even integers
1319 between 10 and 42, you would use the following code.
1320
1321         isl_space *space;
1322         isl_local_space *ls;
1323         isl_constraint *c;
1324         isl_basic_set *bset;
1325
1326         space = isl_space_set_alloc(ctx, 0, 2);
1327         bset = isl_basic_set_universe(isl_space_copy(space));
1328         ls = isl_local_space_from_space(space);
1329
1330         c = isl_equality_alloc(isl_local_space_copy(ls));
1331         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1332         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
1333         bset = isl_basic_set_add_constraint(bset, c);
1334
1335         c = isl_inequality_alloc(isl_local_space_copy(ls));
1336         c = isl_constraint_set_constant_si(c, -10);
1337         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
1338         bset = isl_basic_set_add_constraint(bset, c);
1339
1340         c = isl_inequality_alloc(ls);
1341         c = isl_constraint_set_constant_si(c, 42);
1342         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1343         bset = isl_basic_set_add_constraint(bset, c);
1344
1345         bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
1346
1347 Or, alternatively,
1348
1349         isl_basic_set *bset;
1350         bset = isl_basic_set_read_from_str(ctx,
1351                 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
1352
1353 A basic set or relation can also be constructed from two matrices
1354 describing the equalities and the inequalities.
1355
1356         __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
1357                 __isl_take isl_space *space,
1358                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1359                 enum isl_dim_type c1,
1360                 enum isl_dim_type c2, enum isl_dim_type c3,
1361                 enum isl_dim_type c4);
1362         __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
1363                 __isl_take isl_space *space,
1364                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1365                 enum isl_dim_type c1,
1366                 enum isl_dim_type c2, enum isl_dim_type c3,
1367                 enum isl_dim_type c4, enum isl_dim_type c5);
1368
1369 The C<isl_dim_type> arguments indicate the order in which
1370 different kinds of variables appear in the input matrices
1371 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
1372 C<isl_dim_set> and C<isl_dim_div> for sets and
1373 of C<isl_dim_cst>, C<isl_dim_param>,
1374 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
1375
1376 A (basic or union) set or relation can also be constructed from a
1377 (union) (piecewise) (multiple) affine expression
1378 or a list of affine expressions
1379 (See L<"Piecewise Quasi Affine Expressions"> and
1380 L<"Piecewise Multiple Quasi Affine Expressions">).
1381
1382         __isl_give isl_basic_map *isl_basic_map_from_aff(
1383                 __isl_take isl_aff *aff);
1384         __isl_give isl_map *isl_map_from_aff(
1385                 __isl_take isl_aff *aff);
1386         __isl_give isl_set *isl_set_from_pw_aff(
1387                 __isl_take isl_pw_aff *pwaff);
1388         __isl_give isl_map *isl_map_from_pw_aff(
1389                 __isl_take isl_pw_aff *pwaff);
1390         __isl_give isl_basic_map *isl_basic_map_from_aff_list(
1391                 __isl_take isl_space *domain_space,
1392                 __isl_take isl_aff_list *list);
1393         __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
1394                 __isl_take isl_multi_aff *maff)
1395         __isl_give isl_map *isl_map_from_multi_aff(
1396                 __isl_take isl_multi_aff *maff)
1397         __isl_give isl_set *isl_set_from_pw_multi_aff(
1398                 __isl_take isl_pw_multi_aff *pma);
1399         __isl_give isl_map *isl_map_from_pw_multi_aff(
1400                 __isl_take isl_pw_multi_aff *pma);
1401         __isl_give isl_union_map *
1402         isl_union_map_from_union_pw_multi_aff(
1403                 __isl_take isl_union_pw_multi_aff *upma);
1404
1405 The C<domain_dim> argument describes the domain of the resulting
1406 basic relation.  It is required because the C<list> may consist
1407 of zero affine expressions.
1408
1409 =head2 Inspecting Sets and Relations
1410
1411 Usually, the user should not have to care about the actual constraints
1412 of the sets and maps, but should instead apply the abstract operations
1413 explained in the following sections.
1414 Occasionally, however, it may be required to inspect the individual
1415 coefficients of the constraints.  This section explains how to do so.
1416 In these cases, it may also be useful to have C<isl> compute
1417 an explicit representation of the existentially quantified variables.
1418
1419         __isl_give isl_set *isl_set_compute_divs(
1420                 __isl_take isl_set *set);
1421         __isl_give isl_map *isl_map_compute_divs(
1422                 __isl_take isl_map *map);
1423         __isl_give isl_union_set *isl_union_set_compute_divs(
1424                 __isl_take isl_union_set *uset);
1425         __isl_give isl_union_map *isl_union_map_compute_divs(
1426                 __isl_take isl_union_map *umap);
1427
1428 This explicit representation defines the existentially quantified
1429 variables as integer divisions of the other variables, possibly
1430 including earlier existentially quantified variables.
1431 An explicitly represented existentially quantified variable therefore
1432 has a unique value when the values of the other variables are known.
1433 If, furthermore, the same existentials, i.e., existentials
1434 with the same explicit representations, should appear in the
1435 same order in each of the disjuncts of a set or map, then the user should call
1436 either of the following functions.
1437
1438         __isl_give isl_set *isl_set_align_divs(
1439                 __isl_take isl_set *set);
1440         __isl_give isl_map *isl_map_align_divs(
1441                 __isl_take isl_map *map);
1442
1443 Alternatively, the existentially quantified variables can be removed
1444 using the following functions, which compute an overapproximation.
1445
1446         __isl_give isl_basic_set *isl_basic_set_remove_divs(
1447                 __isl_take isl_basic_set *bset);
1448         __isl_give isl_basic_map *isl_basic_map_remove_divs(
1449                 __isl_take isl_basic_map *bmap);
1450         __isl_give isl_set *isl_set_remove_divs(
1451                 __isl_take isl_set *set);
1452         __isl_give isl_map *isl_map_remove_divs(
1453                 __isl_take isl_map *map);
1454
1455 It is also possible to only remove those divs that are defined
1456 in terms of a given range of dimensions or only those for which
1457 no explicit representation is known.
1458
1459         __isl_give isl_basic_set *
1460         isl_basic_set_remove_divs_involving_dims(
1461                 __isl_take isl_basic_set *bset,
1462                 enum isl_dim_type type,
1463                 unsigned first, unsigned n);
1464         __isl_give isl_set *isl_set_remove_divs_involving_dims(
1465                 __isl_take isl_set *set, enum isl_dim_type type,
1466                 unsigned first, unsigned n);
1467         __isl_give isl_map *isl_map_remove_divs_involving_dims(
1468                 __isl_take isl_map *map, enum isl_dim_type type,
1469                 unsigned first, unsigned n);
1470
1471         __isl_give isl_set *isl_set_remove_unknown_divs(
1472                 __isl_take isl_set *set);
1473         __isl_give isl_map *isl_map_remove_unknown_divs(
1474                 __isl_take isl_map *map);
1475
1476 To iterate over all the sets or maps in a union set or map, use
1477
1478         int isl_union_set_foreach_set(__isl_keep isl_union_set *uset,
1479                 int (*fn)(__isl_take isl_set *set, void *user),
1480                 void *user);
1481         int isl_union_map_foreach_map(__isl_keep isl_union_map *umap,
1482                 int (*fn)(__isl_take isl_map *map, void *user),
1483                 void *user);
1484
1485 The number of sets or maps in a union set or map can be obtained
1486 from
1487
1488         int isl_union_set_n_set(__isl_keep isl_union_set *uset);
1489         int isl_union_map_n_map(__isl_keep isl_union_map *umap);
1490
1491 To extract the set or map in a given space from a union, use
1492
1493         __isl_give isl_set *isl_union_set_extract_set(
1494                 __isl_keep isl_union_set *uset,
1495                 __isl_take isl_space *space);
1496         __isl_give isl_map *isl_union_map_extract_map(
1497                 __isl_keep isl_union_map *umap,
1498                 __isl_take isl_space *space);
1499
1500 To iterate over all the basic sets or maps in a set or map, use
1501
1502         int isl_set_foreach_basic_set(__isl_keep isl_set *set,
1503                 int (*fn)(__isl_take isl_basic_set *bset, void *user),
1504                 void *user);
1505         int isl_map_foreach_basic_map(__isl_keep isl_map *map,
1506                 int (*fn)(__isl_take isl_basic_map *bmap, void *user),
1507                 void *user);
1508
1509 The callback function C<fn> should return 0 if successful and
1510 -1 if an error occurs.  In the latter case, or if any other error
1511 occurs, the above functions will return -1.
1512
1513 It should be noted that C<isl> does not guarantee that
1514 the basic sets or maps passed to C<fn> are disjoint.
1515 If this is required, then the user should call one of
1516 the following functions first.
1517
1518         __isl_give isl_set *isl_set_make_disjoint(
1519                 __isl_take isl_set *set);
1520         __isl_give isl_map *isl_map_make_disjoint(
1521                 __isl_take isl_map *map);
1522
1523 The number of basic sets in a set can be obtained
1524 from
1525
1526         int isl_set_n_basic_set(__isl_keep isl_set *set);
1527
1528 To iterate over the constraints of a basic set or map, use
1529
1530         #include <isl/constraint.h>
1531
1532         int isl_basic_set_n_constraint(
1533                 __isl_keep isl_basic_set *bset);
1534         int isl_basic_set_foreach_constraint(
1535                 __isl_keep isl_basic_set *bset,
1536                 int (*fn)(__isl_take isl_constraint *c, void *user),
1537                 void *user);
1538         int isl_basic_map_foreach_constraint(
1539                 __isl_keep isl_basic_map *bmap,
1540                 int (*fn)(__isl_take isl_constraint *c, void *user),
1541                 void *user);
1542         void *isl_constraint_free(__isl_take isl_constraint *c);
1543
1544 Again, the callback function C<fn> should return 0 if successful and
1545 -1 if an error occurs.  In the latter case, or if any other error
1546 occurs, the above functions will return -1.
1547 The constraint C<c> represents either an equality or an inequality.
1548 Use the following function to find out whether a constraint
1549 represents an equality.  If not, it represents an inequality.
1550
1551         int isl_constraint_is_equality(
1552                 __isl_keep isl_constraint *constraint);
1553
1554 The coefficients of the constraints can be inspected using
1555 the following functions.
1556
1557         int isl_constraint_is_lower_bound(
1558                 __isl_keep isl_constraint *constraint,
1559                 enum isl_dim_type type, unsigned pos);
1560         int isl_constraint_is_upper_bound(
1561                 __isl_keep isl_constraint *constraint,
1562                 enum isl_dim_type type, unsigned pos);
1563         void isl_constraint_get_constant(
1564                 __isl_keep isl_constraint *constraint, isl_int *v);
1565         void isl_constraint_get_coefficient(
1566                 __isl_keep isl_constraint *constraint,
1567                 enum isl_dim_type type, int pos, isl_int *v);
1568         int isl_constraint_involves_dims(
1569                 __isl_keep isl_constraint *constraint,
1570                 enum isl_dim_type type, unsigned first, unsigned n);
1571
1572 The explicit representations of the existentially quantified
1573 variables can be inspected using the following function.
1574 Note that the user is only allowed to use this function
1575 if the inspected set or map is the result of a call
1576 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
1577 The existentially quantified variable is equal to the floor
1578 of the returned affine expression.  The affine expression
1579 itself can be inspected using the functions in
1580 L<"Piecewise Quasi Affine Expressions">.
1581
1582         __isl_give isl_aff *isl_constraint_get_div(
1583                 __isl_keep isl_constraint *constraint, int pos);
1584
1585 To obtain the constraints of a basic set or map in matrix
1586 form, use the following functions.
1587
1588         __isl_give isl_mat *isl_basic_set_equalities_matrix(
1589                 __isl_keep isl_basic_set *bset,
1590                 enum isl_dim_type c1, enum isl_dim_type c2,
1591                 enum isl_dim_type c3, enum isl_dim_type c4);
1592         __isl_give isl_mat *isl_basic_set_inequalities_matrix(
1593                 __isl_keep isl_basic_set *bset,
1594                 enum isl_dim_type c1, enum isl_dim_type c2,
1595                 enum isl_dim_type c3, enum isl_dim_type c4);
1596         __isl_give isl_mat *isl_basic_map_equalities_matrix(
1597                 __isl_keep isl_basic_map *bmap,
1598                 enum isl_dim_type c1,
1599                 enum isl_dim_type c2, enum isl_dim_type c3,
1600                 enum isl_dim_type c4, enum isl_dim_type c5);
1601         __isl_give isl_mat *isl_basic_map_inequalities_matrix(
1602                 __isl_keep isl_basic_map *bmap,
1603                 enum isl_dim_type c1,
1604                 enum isl_dim_type c2, enum isl_dim_type c3,
1605                 enum isl_dim_type c4, enum isl_dim_type c5);
1606
1607 The C<isl_dim_type> arguments dictate the order in which
1608 different kinds of variables appear in the resulting matrix
1609 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
1610 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
1611
1612 The number of parameters, input, output or set dimensions can
1613 be obtained using the following functions.
1614
1615         unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1616                 enum isl_dim_type type);
1617         unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1618                 enum isl_dim_type type);
1619         unsigned isl_set_dim(__isl_keep isl_set *set,
1620                 enum isl_dim_type type);
1621         unsigned isl_map_dim(__isl_keep isl_map *map,
1622                 enum isl_dim_type type);
1623
1624 To check whether the description of a set or relation depends
1625 on one or more given dimensions, it is not necessary to iterate over all
1626 constraints.  Instead the following functions can be used.
1627
1628         int isl_basic_set_involves_dims(
1629                 __isl_keep isl_basic_set *bset,
1630                 enum isl_dim_type type, unsigned first, unsigned n);
1631         int isl_set_involves_dims(__isl_keep isl_set *set,
1632                 enum isl_dim_type type, unsigned first, unsigned n);
1633         int isl_basic_map_involves_dims(
1634                 __isl_keep isl_basic_map *bmap,
1635                 enum isl_dim_type type, unsigned first, unsigned n);
1636         int isl_map_involves_dims(__isl_keep isl_map *map,
1637                 enum isl_dim_type type, unsigned first, unsigned n);
1638
1639 Similarly, the following functions can be used to check whether
1640 a given dimension is involved in any lower or upper bound.
1641
1642         int isl_set_dim_has_lower_bound(__isl_keep isl_set *set,
1643                 enum isl_dim_type type, unsigned pos);
1644         int isl_set_dim_has_upper_bound(__isl_keep isl_set *set,
1645                 enum isl_dim_type type, unsigned pos);
1646
1647 The identifiers or names of the domain and range spaces of a set
1648 or relation can be read off or set using the following functions.
1649
1650         __isl_give isl_set *isl_set_set_tuple_id(
1651                 __isl_take isl_set *set, __isl_take isl_id *id);
1652         __isl_give isl_set *isl_set_reset_tuple_id(
1653                 __isl_take isl_set *set);
1654         int isl_set_has_tuple_id(__isl_keep isl_set *set);
1655         __isl_give isl_id *isl_set_get_tuple_id(
1656                 __isl_keep isl_set *set);
1657         __isl_give isl_map *isl_map_set_tuple_id(
1658                 __isl_take isl_map *map, enum isl_dim_type type,
1659                 __isl_take isl_id *id);
1660         __isl_give isl_map *isl_map_reset_tuple_id(
1661                 __isl_take isl_map *map, enum isl_dim_type type);
1662         int isl_map_has_tuple_id(__isl_keep isl_map *map,
1663                 enum isl_dim_type type);
1664         __isl_give isl_id *isl_map_get_tuple_id(
1665                 __isl_keep isl_map *map, enum isl_dim_type type);
1666
1667         const char *isl_basic_set_get_tuple_name(
1668                 __isl_keep isl_basic_set *bset);
1669         __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1670                 __isl_take isl_basic_set *set, const char *s);
1671         int isl_set_has_tuple_name(__isl_keep isl_set *set);
1672         const char *isl_set_get_tuple_name(
1673                 __isl_keep isl_set *set);
1674         const char *isl_basic_map_get_tuple_name(
1675                 __isl_keep isl_basic_map *bmap,
1676                 enum isl_dim_type type);
1677         __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1678                 __isl_take isl_basic_map *bmap,
1679                 enum isl_dim_type type, const char *s);
1680         int isl_map_has_tuple_name(__isl_keep isl_map *map,
1681                 enum isl_dim_type type);
1682         const char *isl_map_get_tuple_name(
1683                 __isl_keep isl_map *map,
1684                 enum isl_dim_type type);
1685
1686 As with C<isl_space_get_tuple_name>, the value returned points to
1687 an internal data structure.
1688 The identifiers, positions or names of individual dimensions can be
1689 read off using the following functions.
1690
1691         __isl_give isl_id *isl_basic_set_get_dim_id(
1692                 __isl_keep isl_basic_set *bset,
1693                 enum isl_dim_type type, unsigned pos);
1694         __isl_give isl_set *isl_set_set_dim_id(
1695                 __isl_take isl_set *set, enum isl_dim_type type,
1696                 unsigned pos, __isl_take isl_id *id);
1697         int isl_set_has_dim_id(__isl_keep isl_set *set,
1698                 enum isl_dim_type type, unsigned pos);
1699         __isl_give isl_id *isl_set_get_dim_id(
1700                 __isl_keep isl_set *set, enum isl_dim_type type,
1701                 unsigned pos);
1702         int isl_basic_map_has_dim_id(
1703                 __isl_keep isl_basic_map *bmap,
1704                 enum isl_dim_type type, unsigned pos);
1705         __isl_give isl_map *isl_map_set_dim_id(
1706                 __isl_take isl_map *map, enum isl_dim_type type,
1707                 unsigned pos, __isl_take isl_id *id);
1708         int isl_map_has_dim_id(__isl_keep isl_map *map,
1709                 enum isl_dim_type type, unsigned pos);
1710         __isl_give isl_id *isl_map_get_dim_id(
1711                 __isl_keep isl_map *map, enum isl_dim_type type,
1712                 unsigned pos);
1713
1714         int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1715                 enum isl_dim_type type, __isl_keep isl_id *id);
1716         int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1717                 enum isl_dim_type type, __isl_keep isl_id *id);
1718         int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1719                 enum isl_dim_type type, const char *name);
1720         int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1721                 enum isl_dim_type type, const char *name);
1722
1723         const char *isl_constraint_get_dim_name(
1724                 __isl_keep isl_constraint *constraint,
1725                 enum isl_dim_type type, unsigned pos);
1726         const char *isl_basic_set_get_dim_name(
1727                 __isl_keep isl_basic_set *bset,
1728                 enum isl_dim_type type, unsigned pos);
1729         int isl_set_has_dim_name(__isl_keep isl_set *set,
1730                 enum isl_dim_type type, unsigned pos);
1731         const char *isl_set_get_dim_name(
1732                 __isl_keep isl_set *set,
1733                 enum isl_dim_type type, unsigned pos);
1734         const char *isl_basic_map_get_dim_name(
1735                 __isl_keep isl_basic_map *bmap,
1736                 enum isl_dim_type type, unsigned pos);
1737         int isl_map_has_dim_name(__isl_keep isl_map *map,
1738                 enum isl_dim_type type, unsigned pos);
1739         const char *isl_map_get_dim_name(
1740                 __isl_keep isl_map *map,
1741                 enum isl_dim_type type, unsigned pos);
1742
1743 These functions are mostly useful to obtain the identifiers, positions
1744 or names of the parameters.  Identifiers of individual dimensions are
1745 essentially only useful for printing.  They are ignored by all other
1746 operations and may not be preserved across those operations.
1747
1748 =head2 Properties
1749
1750 =head3 Unary Properties
1751
1752 =over
1753
1754 =item * Emptiness
1755
1756 The following functions test whether the given set or relation
1757 contains any integer points.  The ``plain'' variants do not perform
1758 any computations, but simply check if the given set or relation
1759 is already known to be empty.
1760
1761         int isl_basic_set_plain_is_empty(__isl_keep isl_basic_set *bset);
1762         int isl_basic_set_is_empty(__isl_keep isl_basic_set *bset);
1763         int isl_set_plain_is_empty(__isl_keep isl_set *set);
1764         int isl_set_is_empty(__isl_keep isl_set *set);
1765         int isl_union_set_is_empty(__isl_keep isl_union_set *uset);
1766         int isl_basic_map_plain_is_empty(__isl_keep isl_basic_map *bmap);
1767         int isl_basic_map_is_empty(__isl_keep isl_basic_map *bmap);
1768         int isl_map_plain_is_empty(__isl_keep isl_map *map);
1769         int isl_map_is_empty(__isl_keep isl_map *map);
1770         int isl_union_map_is_empty(__isl_keep isl_union_map *umap);
1771
1772 =item * Universality
1773
1774         int isl_basic_set_is_universe(__isl_keep isl_basic_set *bset);
1775         int isl_basic_map_is_universe(__isl_keep isl_basic_map *bmap);
1776         int isl_set_plain_is_universe(__isl_keep isl_set *set);
1777
1778 =item * Single-valuedness
1779
1780         int isl_basic_map_is_single_valued(
1781                 __isl_keep isl_basic_map *bmap);
1782         int isl_map_plain_is_single_valued(
1783                 __isl_keep isl_map *map);
1784         int isl_map_is_single_valued(__isl_keep isl_map *map);
1785         int isl_union_map_is_single_valued(__isl_keep isl_union_map *umap);
1786
1787 =item * Injectivity
1788
1789         int isl_map_plain_is_injective(__isl_keep isl_map *map);
1790         int isl_map_is_injective(__isl_keep isl_map *map);
1791         int isl_union_map_plain_is_injective(
1792                 __isl_keep isl_union_map *umap);
1793         int isl_union_map_is_injective(
1794                 __isl_keep isl_union_map *umap);
1795
1796 =item * Bijectivity
1797
1798         int isl_map_is_bijective(__isl_keep isl_map *map);
1799         int isl_union_map_is_bijective(__isl_keep isl_union_map *umap);
1800
1801 =item * Position
1802
1803         int isl_basic_map_plain_is_fixed(
1804                 __isl_keep isl_basic_map *bmap,
1805                 enum isl_dim_type type, unsigned pos,
1806                 isl_int *val);
1807         int isl_set_plain_is_fixed(__isl_keep isl_set *set,
1808                 enum isl_dim_type type, unsigned pos,
1809                 isl_int *val);
1810         int isl_map_plain_is_fixed(__isl_keep isl_map *map,
1811                 enum isl_dim_type type, unsigned pos,
1812                 isl_int *val);
1813
1814 Check if the relation obviously lies on a hyperplane where the given dimension
1815 has a fixed value and if so, return that value in C<*val>.
1816
1817 =item * Space
1818
1819 To check whether a set is a parameter domain, use this function:
1820
1821         int isl_set_is_params(__isl_keep isl_set *set);
1822         int isl_union_set_is_params(
1823                 __isl_keep isl_union_set *uset);
1824
1825 =item * Wrapping
1826
1827 The following functions check whether the domain of the given
1828 (basic) set is a wrapped relation.
1829
1830         int isl_basic_set_is_wrapping(
1831                 __isl_keep isl_basic_set *bset);
1832         int isl_set_is_wrapping(__isl_keep isl_set *set);
1833
1834 =item * Internal Product
1835
1836         int isl_basic_map_can_zip(
1837                 __isl_keep isl_basic_map *bmap);
1838         int isl_map_can_zip(__isl_keep isl_map *map);
1839
1840 Check whether the product of domain and range of the given relation
1841 can be computed,
1842 i.e., whether both domain and range are nested relations.
1843
1844 =item * Currying
1845
1846         int isl_basic_map_can_curry(
1847                 __isl_keep isl_basic_map *bmap);
1848         int isl_map_can_curry(__isl_keep isl_map *map);
1849
1850 Check whether the domain of the (basic) relation is a wrapped relation.
1851
1852 =back
1853
1854 =head3 Binary Properties
1855
1856 =over
1857
1858 =item * Equality
1859
1860         int isl_set_plain_is_equal(__isl_keep isl_set *set1,
1861                 __isl_keep isl_set *set2);
1862         int isl_set_is_equal(__isl_keep isl_set *set1,
1863                 __isl_keep isl_set *set2);
1864         int isl_union_set_is_equal(
1865                 __isl_keep isl_union_set *uset1,
1866                 __isl_keep isl_union_set *uset2);
1867         int isl_basic_map_is_equal(
1868                 __isl_keep isl_basic_map *bmap1,
1869                 __isl_keep isl_basic_map *bmap2);
1870         int isl_map_is_equal(__isl_keep isl_map *map1,
1871                 __isl_keep isl_map *map2);
1872         int isl_map_plain_is_equal(__isl_keep isl_map *map1,
1873                 __isl_keep isl_map *map2);
1874         int isl_union_map_is_equal(
1875                 __isl_keep isl_union_map *umap1,
1876                 __isl_keep isl_union_map *umap2);
1877
1878 =item * Disjointness
1879
1880         int isl_set_plain_is_disjoint(__isl_keep isl_set *set1,
1881                 __isl_keep isl_set *set2);
1882
1883 =item * Subset
1884
1885         int isl_basic_set_is_subset(
1886                 __isl_keep isl_basic_set *bset1,
1887                 __isl_keep isl_basic_set *bset2);
1888         int isl_set_is_subset(__isl_keep isl_set *set1,
1889                 __isl_keep isl_set *set2);
1890         int isl_set_is_strict_subset(
1891                 __isl_keep isl_set *set1,
1892                 __isl_keep isl_set *set2);
1893         int isl_union_set_is_subset(
1894                 __isl_keep isl_union_set *uset1,
1895                 __isl_keep isl_union_set *uset2);
1896         int isl_union_set_is_strict_subset(
1897                 __isl_keep isl_union_set *uset1,
1898                 __isl_keep isl_union_set *uset2);
1899         int isl_basic_map_is_subset(
1900                 __isl_keep isl_basic_map *bmap1,
1901                 __isl_keep isl_basic_map *bmap2);
1902         int isl_basic_map_is_strict_subset(
1903                 __isl_keep isl_basic_map *bmap1,
1904                 __isl_keep isl_basic_map *bmap2);
1905         int isl_map_is_subset(
1906                 __isl_keep isl_map *map1,
1907                 __isl_keep isl_map *map2);
1908         int isl_map_is_strict_subset(
1909                 __isl_keep isl_map *map1,
1910                 __isl_keep isl_map *map2);
1911         int isl_union_map_is_subset(
1912                 __isl_keep isl_union_map *umap1,
1913                 __isl_keep isl_union_map *umap2);
1914         int isl_union_map_is_strict_subset(
1915                 __isl_keep isl_union_map *umap1,
1916                 __isl_keep isl_union_map *umap2);
1917
1918 Check whether the first argument is a (strict) subset of the
1919 second argument.
1920
1921 =back
1922
1923 =head2 Unary Operations
1924
1925 =over
1926
1927 =item * Complement
1928
1929         __isl_give isl_set *isl_set_complement(
1930                 __isl_take isl_set *set);
1931         __isl_give isl_map *isl_map_complement(
1932                 __isl_take isl_map *map);
1933
1934 =item * Inverse map
1935
1936         __isl_give isl_basic_map *isl_basic_map_reverse(
1937                 __isl_take isl_basic_map *bmap);
1938         __isl_give isl_map *isl_map_reverse(
1939                 __isl_take isl_map *map);
1940         __isl_give isl_union_map *isl_union_map_reverse(
1941                 __isl_take isl_union_map *umap);
1942
1943 =item * Projection
1944
1945         __isl_give isl_basic_set *isl_basic_set_project_out(
1946                 __isl_take isl_basic_set *bset,
1947                 enum isl_dim_type type, unsigned first, unsigned n);
1948         __isl_give isl_basic_map *isl_basic_map_project_out(
1949                 __isl_take isl_basic_map *bmap,
1950                 enum isl_dim_type type, unsigned first, unsigned n);
1951         __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
1952                 enum isl_dim_type type, unsigned first, unsigned n);
1953         __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
1954                 enum isl_dim_type type, unsigned first, unsigned n);
1955         __isl_give isl_basic_set *isl_basic_set_params(
1956                 __isl_take isl_basic_set *bset);
1957         __isl_give isl_basic_set *isl_basic_map_domain(
1958                 __isl_take isl_basic_map *bmap);
1959         __isl_give isl_basic_set *isl_basic_map_range(
1960                 __isl_take isl_basic_map *bmap);
1961         __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
1962         __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
1963         __isl_give isl_set *isl_map_domain(
1964                 __isl_take isl_map *bmap);
1965         __isl_give isl_set *isl_map_range(
1966                 __isl_take isl_map *map);
1967         __isl_give isl_set *isl_union_set_params(
1968                 __isl_take isl_union_set *uset);
1969         __isl_give isl_set *isl_union_map_params(
1970                 __isl_take isl_union_map *umap);
1971         __isl_give isl_union_set *isl_union_map_domain(
1972                 __isl_take isl_union_map *umap);
1973         __isl_give isl_union_set *isl_union_map_range(
1974                 __isl_take isl_union_map *umap);
1975
1976         __isl_give isl_basic_map *isl_basic_map_domain_map(
1977                 __isl_take isl_basic_map *bmap);
1978         __isl_give isl_basic_map *isl_basic_map_range_map(
1979                 __isl_take isl_basic_map *bmap);
1980         __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
1981         __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
1982         __isl_give isl_union_map *isl_union_map_domain_map(
1983                 __isl_take isl_union_map *umap);
1984         __isl_give isl_union_map *isl_union_map_range_map(
1985                 __isl_take isl_union_map *umap);
1986
1987 The functions above construct a (basic, regular or union) relation
1988 that maps (a wrapped version of) the input relation to its domain or range.
1989
1990 =item * Elimination
1991
1992         __isl_give isl_basic_set *isl_basic_set_eliminate(
1993                 __isl_take isl_basic_set *bset,
1994                 enum isl_dim_type type,
1995                 unsigned first, unsigned n);
1996         __isl_give isl_set *isl_set_eliminate(
1997                 __isl_take isl_set *set, enum isl_dim_type type,
1998                 unsigned first, unsigned n);
1999         __isl_give isl_basic_map *isl_basic_map_eliminate(
2000                 __isl_take isl_basic_map *bmap,
2001                 enum isl_dim_type type,
2002                 unsigned first, unsigned n);
2003         __isl_give isl_map *isl_map_eliminate(
2004                 __isl_take isl_map *map, enum isl_dim_type type,
2005                 unsigned first, unsigned n);
2006
2007 Eliminate the coefficients for the given dimensions from the constraints,
2008 without removing the dimensions.
2009
2010 =item * Slicing
2011
2012         __isl_give isl_basic_set *isl_basic_set_fix(
2013                 __isl_take isl_basic_set *bset,
2014                 enum isl_dim_type type, unsigned pos,
2015                 isl_int value);
2016         __isl_give isl_basic_set *isl_basic_set_fix_si(
2017                 __isl_take isl_basic_set *bset,
2018                 enum isl_dim_type type, unsigned pos, int value);
2019         __isl_give isl_set *isl_set_fix(__isl_take isl_set *set,
2020                 enum isl_dim_type type, unsigned pos,
2021                 isl_int value);
2022         __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
2023                 enum isl_dim_type type, unsigned pos, int value);
2024         __isl_give isl_basic_map *isl_basic_map_fix_si(
2025                 __isl_take isl_basic_map *bmap,
2026                 enum isl_dim_type type, unsigned pos, int value);
2027         __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
2028                 enum isl_dim_type type, unsigned pos, int value);
2029
2030 Intersect the set or relation with the hyperplane where the given
2031 dimension has the fixed given value.
2032
2033         __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
2034                 __isl_take isl_basic_map *bmap,
2035                 enum isl_dim_type type, unsigned pos, int value);
2036         __isl_give isl_set *isl_set_lower_bound(
2037                 __isl_take isl_set *set,
2038                 enum isl_dim_type type, unsigned pos,
2039                 isl_int value);
2040         __isl_give isl_set *isl_set_lower_bound_si(
2041                 __isl_take isl_set *set,
2042                 enum isl_dim_type type, unsigned pos, int value);
2043         __isl_give isl_map *isl_map_lower_bound_si(
2044                 __isl_take isl_map *map,
2045                 enum isl_dim_type type, unsigned pos, int value);
2046         __isl_give isl_set *isl_set_upper_bound(
2047                 __isl_take isl_set *set,
2048                 enum isl_dim_type type, unsigned pos,
2049                 isl_int value);
2050         __isl_give isl_set *isl_set_upper_bound_si(
2051                 __isl_take isl_set *set,
2052                 enum isl_dim_type type, unsigned pos, int value);
2053         __isl_give isl_map *isl_map_upper_bound_si(
2054                 __isl_take isl_map *map,
2055                 enum isl_dim_type type, unsigned pos, int value);
2056
2057 Intersect the set or relation with the half-space where the given
2058 dimension has a value bounded by the fixed given value.
2059
2060         __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
2061                 enum isl_dim_type type1, int pos1,
2062                 enum isl_dim_type type2, int pos2);
2063         __isl_give isl_basic_map *isl_basic_map_equate(
2064                 __isl_take isl_basic_map *bmap,
2065                 enum isl_dim_type type1, int pos1,
2066                 enum isl_dim_type type2, int pos2);
2067         __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
2068                 enum isl_dim_type type1, int pos1,
2069                 enum isl_dim_type type2, int pos2);
2070
2071 Intersect the set or relation with the hyperplane where the given
2072 dimensions are equal to each other.
2073
2074         __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
2075                 enum isl_dim_type type1, int pos1,
2076                 enum isl_dim_type type2, int pos2);
2077
2078 Intersect the relation with the hyperplane where the given
2079 dimensions have opposite values.
2080
2081         __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
2082                 enum isl_dim_type type1, int pos1,
2083                 enum isl_dim_type type2, int pos2);
2084         __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
2085                 enum isl_dim_type type1, int pos1,
2086                 enum isl_dim_type type2, int pos2);
2087
2088 Intersect the relation with the half-space where the given
2089 dimensions satisfy the given ordering.
2090
2091 =item * Identity
2092
2093         __isl_give isl_map *isl_set_identity(
2094                 __isl_take isl_set *set);
2095         __isl_give isl_union_map *isl_union_set_identity(
2096                 __isl_take isl_union_set *uset);
2097
2098 Construct an identity relation on the given (union) set.
2099
2100 =item * Deltas
2101
2102         __isl_give isl_basic_set *isl_basic_map_deltas(
2103                 __isl_take isl_basic_map *bmap);
2104         __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
2105         __isl_give isl_union_set *isl_union_map_deltas(
2106                 __isl_take isl_union_map *umap);
2107
2108 These functions return a (basic) set containing the differences
2109 between image elements and corresponding domain elements in the input.
2110
2111         __isl_give isl_basic_map *isl_basic_map_deltas_map(
2112                 __isl_take isl_basic_map *bmap);
2113         __isl_give isl_map *isl_map_deltas_map(
2114                 __isl_take isl_map *map);
2115         __isl_give isl_union_map *isl_union_map_deltas_map(
2116                 __isl_take isl_union_map *umap);
2117
2118 The functions above construct a (basic, regular or union) relation
2119 that maps (a wrapped version of) the input relation to its delta set.
2120
2121 =item * Coalescing
2122
2123 Simplify the representation of a set or relation by trying
2124 to combine pairs of basic sets or relations into a single
2125 basic set or relation.
2126
2127         __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
2128         __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
2129         __isl_give isl_union_set *isl_union_set_coalesce(
2130                 __isl_take isl_union_set *uset);
2131         __isl_give isl_union_map *isl_union_map_coalesce(
2132                 __isl_take isl_union_map *umap);
2133
2134 One of the methods for combining pairs of basic sets or relations
2135 can result in coefficients that are much larger than those that appear
2136 in the constraints of the input.  By default, the coefficients are
2137 not allowed to grow larger, but this can be changed by unsetting
2138 the following option.
2139
2140         int isl_options_set_coalesce_bounded_wrapping(
2141                 isl_ctx *ctx, int val);
2142         int isl_options_get_coalesce_bounded_wrapping(
2143                 isl_ctx *ctx);
2144
2145 =item * Detecting equalities
2146
2147         __isl_give isl_basic_set *isl_basic_set_detect_equalities(
2148                 __isl_take isl_basic_set *bset);
2149         __isl_give isl_basic_map *isl_basic_map_detect_equalities(
2150                 __isl_take isl_basic_map *bmap);
2151         __isl_give isl_set *isl_set_detect_equalities(
2152                 __isl_take isl_set *set);
2153         __isl_give isl_map *isl_map_detect_equalities(
2154                 __isl_take isl_map *map);
2155         __isl_give isl_union_set *isl_union_set_detect_equalities(
2156                 __isl_take isl_union_set *uset);
2157         __isl_give isl_union_map *isl_union_map_detect_equalities(
2158                 __isl_take isl_union_map *umap);
2159
2160 Simplify the representation of a set or relation by detecting implicit
2161 equalities.
2162
2163 =item * Removing redundant constraints
2164
2165         __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
2166                 __isl_take isl_basic_set *bset);
2167         __isl_give isl_set *isl_set_remove_redundancies(
2168                 __isl_take isl_set *set);
2169         __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
2170                 __isl_take isl_basic_map *bmap);
2171         __isl_give isl_map *isl_map_remove_redundancies(
2172                 __isl_take isl_map *map);
2173
2174 =item * Convex hull
2175
2176         __isl_give isl_basic_set *isl_set_convex_hull(
2177                 __isl_take isl_set *set);
2178         __isl_give isl_basic_map *isl_map_convex_hull(
2179                 __isl_take isl_map *map);
2180
2181 If the input set or relation has any existentially quantified
2182 variables, then the result of these operations is currently undefined.
2183
2184 =item * Simple hull
2185
2186         __isl_give isl_basic_set *isl_set_simple_hull(
2187                 __isl_take isl_set *set);
2188         __isl_give isl_basic_map *isl_map_simple_hull(
2189                 __isl_take isl_map *map);
2190         __isl_give isl_union_map *isl_union_map_simple_hull(
2191                 __isl_take isl_union_map *umap);
2192
2193 These functions compute a single basic set or relation
2194 that contains the whole input set or relation.
2195 In particular, the output is described by translates
2196 of the constraints describing the basic sets or relations in the input.
2197
2198 =begin latex
2199
2200 (See \autoref{s:simple hull}.)
2201
2202 =end latex
2203
2204 =item * Affine hull
2205
2206         __isl_give isl_basic_set *isl_basic_set_affine_hull(
2207                 __isl_take isl_basic_set *bset);
2208         __isl_give isl_basic_set *isl_set_affine_hull(
2209                 __isl_take isl_set *set);
2210         __isl_give isl_union_set *isl_union_set_affine_hull(
2211                 __isl_take isl_union_set *uset);
2212         __isl_give isl_basic_map *isl_basic_map_affine_hull(
2213                 __isl_take isl_basic_map *bmap);
2214         __isl_give isl_basic_map *isl_map_affine_hull(
2215                 __isl_take isl_map *map);
2216         __isl_give isl_union_map *isl_union_map_affine_hull(
2217                 __isl_take isl_union_map *umap);
2218
2219 In case of union sets and relations, the affine hull is computed
2220 per space.
2221
2222 =item * Polyhedral hull
2223
2224         __isl_give isl_basic_set *isl_set_polyhedral_hull(
2225                 __isl_take isl_set *set);
2226         __isl_give isl_basic_map *isl_map_polyhedral_hull(
2227                 __isl_take isl_map *map);
2228         __isl_give isl_union_set *isl_union_set_polyhedral_hull(
2229                 __isl_take isl_union_set *uset);
2230         __isl_give isl_union_map *isl_union_map_polyhedral_hull(
2231                 __isl_take isl_union_map *umap);
2232
2233 These functions compute a single basic set or relation
2234 not involving any existentially quantified variables
2235 that contains the whole input set or relation.
2236 In case of union sets and relations, the polyhedral hull is computed
2237 per space.
2238
2239 =item * Feasibility
2240
2241         __isl_give isl_basic_set *isl_basic_set_sample(
2242                 __isl_take isl_basic_set *bset);
2243         __isl_give isl_basic_set *isl_set_sample(
2244                 __isl_take isl_set *set);
2245         __isl_give isl_basic_map *isl_basic_map_sample(
2246                 __isl_take isl_basic_map *bmap);
2247         __isl_give isl_basic_map *isl_map_sample(
2248                 __isl_take isl_map *map);
2249
2250 If the input (basic) set or relation is non-empty, then return
2251 a singleton subset of the input.  Otherwise, return an empty set.
2252
2253 =item * Optimization
2254
2255         #include <isl/ilp.h>
2256         enum isl_lp_result isl_basic_set_max(
2257                 __isl_keep isl_basic_set *bset,
2258                 __isl_keep isl_aff *obj, isl_int *opt)
2259         enum isl_lp_result isl_set_min(__isl_keep isl_set *set,
2260                 __isl_keep isl_aff *obj, isl_int *opt);
2261         enum isl_lp_result isl_set_max(__isl_keep isl_set *set,
2262                 __isl_keep isl_aff *obj, isl_int *opt);
2263
2264 Compute the minimum or maximum of the integer affine expression C<obj>
2265 over the points in C<set>, returning the result in C<opt>.
2266 The return value may be one of C<isl_lp_error>,
2267 C<isl_lp_ok>, C<isl_lp_unbounded> or C<isl_lp_empty>.
2268
2269 =item * Parametric optimization
2270
2271         __isl_give isl_pw_aff *isl_set_dim_min(
2272                 __isl_take isl_set *set, int pos);
2273         __isl_give isl_pw_aff *isl_set_dim_max(
2274                 __isl_take isl_set *set, int pos);
2275         __isl_give isl_pw_aff *isl_map_dim_max(
2276                 __isl_take isl_map *map, int pos);
2277
2278 Compute the minimum or maximum of the given set or output dimension
2279 as a function of the parameters (and input dimensions), but independently
2280 of the other set or output dimensions.
2281 For lexicographic optimization, see L<"Lexicographic Optimization">.
2282
2283 =item * Dual
2284
2285 The following functions compute either the set of (rational) coefficient
2286 values of valid constraints for the given set or the set of (rational)
2287 values satisfying the constraints with coefficients from the given set.
2288 Internally, these two sets of functions perform essentially the
2289 same operations, except that the set of coefficients is assumed to
2290 be a cone, while the set of values may be any polyhedron.
2291 The current implementation is based on the Farkas lemma and
2292 Fourier-Motzkin elimination, but this may change or be made optional
2293 in future.  In particular, future implementations may use different
2294 dualization algorithms or skip the elimination step.
2295
2296         __isl_give isl_basic_set *isl_basic_set_coefficients(
2297                 __isl_take isl_basic_set *bset);
2298         __isl_give isl_basic_set *isl_set_coefficients(
2299                 __isl_take isl_set *set);
2300         __isl_give isl_union_set *isl_union_set_coefficients(
2301                 __isl_take isl_union_set *bset);
2302         __isl_give isl_basic_set *isl_basic_set_solutions(
2303                 __isl_take isl_basic_set *bset);
2304         __isl_give isl_basic_set *isl_set_solutions(
2305                 __isl_take isl_set *set);
2306         __isl_give isl_union_set *isl_union_set_solutions(
2307                 __isl_take isl_union_set *bset);
2308
2309 =item * Power
2310
2311         __isl_give isl_map *isl_map_fixed_power(
2312                 __isl_take isl_map *map, isl_int exp);
2313         __isl_give isl_union_map *isl_union_map_fixed_power(
2314                 __isl_take isl_union_map *umap, isl_int exp);
2315
2316 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
2317 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
2318 of C<map> is computed.
2319
2320         __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
2321                 int *exact);
2322         __isl_give isl_union_map *isl_union_map_power(
2323                 __isl_take isl_union_map *umap, int *exact);
2324
2325 Compute a parametric representation for all positive powers I<k> of C<map>.
2326 The result maps I<k> to a nested relation corresponding to the
2327 I<k>th power of C<map>.
2328 The result may be an overapproximation.  If the result is known to be exact,
2329 then C<*exact> is set to C<1>.
2330
2331 =item * Transitive closure
2332
2333         __isl_give isl_map *isl_map_transitive_closure(
2334                 __isl_take isl_map *map, int *exact);
2335         __isl_give isl_union_map *isl_union_map_transitive_closure(
2336                 __isl_take isl_union_map *umap, int *exact);
2337
2338 Compute the transitive closure of C<map>.
2339 The result may be an overapproximation.  If the result is known to be exact,
2340 then C<*exact> is set to C<1>.
2341
2342 =item * Reaching path lengths
2343
2344         __isl_give isl_map *isl_map_reaching_path_lengths(
2345                 __isl_take isl_map *map, int *exact);
2346
2347 Compute a relation that maps each element in the range of C<map>
2348 to the lengths of all paths composed of edges in C<map> that
2349 end up in the given element.
2350 The result may be an overapproximation.  If the result is known to be exact,
2351 then C<*exact> is set to C<1>.
2352 To compute the I<maximal> path length, the resulting relation
2353 should be postprocessed by C<isl_map_lexmax>.
2354 In particular, if the input relation is a dependence relation
2355 (mapping sources to sinks), then the maximal path length corresponds
2356 to the free schedule.
2357 Note, however, that C<isl_map_lexmax> expects the maximum to be
2358 finite, so if the path lengths are unbounded (possibly due to
2359 the overapproximation), then you will get an error message.
2360
2361 =item * Wrapping
2362
2363         __isl_give isl_basic_set *isl_basic_map_wrap(
2364                 __isl_take isl_basic_map *bmap);
2365         __isl_give isl_set *isl_map_wrap(
2366                 __isl_take isl_map *map);
2367         __isl_give isl_union_set *isl_union_map_wrap(
2368                 __isl_take isl_union_map *umap);
2369         __isl_give isl_basic_map *isl_basic_set_unwrap(
2370                 __isl_take isl_basic_set *bset);
2371         __isl_give isl_map *isl_set_unwrap(
2372                 __isl_take isl_set *set);
2373         __isl_give isl_union_map *isl_union_set_unwrap(
2374                 __isl_take isl_union_set *uset);
2375
2376 =item * Flattening
2377
2378 Remove any internal structure of domain (and range) of the given
2379 set or relation.  If there is any such internal structure in the input,
2380 then the name of the space is also removed.
2381
2382         __isl_give isl_basic_set *isl_basic_set_flatten(
2383                 __isl_take isl_basic_set *bset);
2384         __isl_give isl_set *isl_set_flatten(
2385                 __isl_take isl_set *set);
2386         __isl_give isl_basic_map *isl_basic_map_flatten_domain(
2387                 __isl_take isl_basic_map *bmap);
2388         __isl_give isl_basic_map *isl_basic_map_flatten_range(
2389                 __isl_take isl_basic_map *bmap);
2390         __isl_give isl_map *isl_map_flatten_range(
2391                 __isl_take isl_map *map);
2392         __isl_give isl_map *isl_map_flatten_domain(
2393                 __isl_take isl_map *map);
2394         __isl_give isl_basic_map *isl_basic_map_flatten(
2395                 __isl_take isl_basic_map *bmap);
2396         __isl_give isl_map *isl_map_flatten(
2397                 __isl_take isl_map *map);
2398
2399         __isl_give isl_map *isl_set_flatten_map(
2400                 __isl_take isl_set *set);
2401
2402 The function above constructs a relation
2403 that maps the input set to a flattened version of the set.
2404
2405 =item * Lifting
2406
2407 Lift the input set to a space with extra dimensions corresponding
2408 to the existentially quantified variables in the input.
2409 In particular, the result lives in a wrapped map where the domain
2410 is the original space and the range corresponds to the original
2411 existentially quantified variables.
2412
2413         __isl_give isl_basic_set *isl_basic_set_lift(
2414                 __isl_take isl_basic_set *bset);
2415         __isl_give isl_set *isl_set_lift(
2416                 __isl_take isl_set *set);
2417         __isl_give isl_union_set *isl_union_set_lift(
2418                 __isl_take isl_union_set *uset);
2419
2420 Given a local space that contains the existentially quantified
2421 variables of a set, a basic relation that, when applied to
2422 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
2423 can be constructed using the following function.
2424
2425         #include <isl/local_space.h>
2426         __isl_give isl_basic_map *isl_local_space_lifting(
2427                 __isl_take isl_local_space *ls);
2428
2429 =item * Internal Product
2430
2431         __isl_give isl_basic_map *isl_basic_map_zip(
2432                 __isl_take isl_basic_map *bmap);
2433         __isl_give isl_map *isl_map_zip(
2434                 __isl_take isl_map *map);
2435         __isl_give isl_union_map *isl_union_map_zip(
2436                 __isl_take isl_union_map *umap);
2437
2438 Given a relation with nested relations for domain and range,
2439 interchange the range of the domain with the domain of the range.
2440
2441 =item * Currying
2442
2443         __isl_give isl_basic_map *isl_basic_map_curry(
2444                 __isl_take isl_basic_map *bmap);
2445         __isl_give isl_map *isl_map_curry(
2446                 __isl_take isl_map *map);
2447         __isl_give isl_union_map *isl_union_map_curry(
2448                 __isl_take isl_union_map *umap);
2449
2450 Given a relation with a nested relation for domain,
2451 move the range of the nested relation out of the domain
2452 and use it as the domain of a nested relation in the range,
2453 with the original range as range of this nested relation.
2454
2455 =item * Aligning parameters
2456
2457         __isl_give isl_basic_set *isl_basic_set_align_params(
2458                 __isl_take isl_basic_set *bset,
2459                 __isl_take isl_space *model);
2460         __isl_give isl_set *isl_set_align_params(
2461                 __isl_take isl_set *set,
2462                 __isl_take isl_space *model);
2463         __isl_give isl_basic_map *isl_basic_map_align_params(
2464                 __isl_take isl_basic_map *bmap,
2465                 __isl_take isl_space *model);
2466         __isl_give isl_map *isl_map_align_params(
2467                 __isl_take isl_map *map,
2468                 __isl_take isl_space *model);
2469
2470 Change the order of the parameters of the given set or relation
2471 such that the first parameters match those of C<model>.
2472 This may involve the introduction of extra parameters.
2473 All parameters need to be named.
2474
2475 =item * Dimension manipulation
2476
2477         __isl_give isl_set *isl_set_add_dims(
2478                 __isl_take isl_set *set,
2479                 enum isl_dim_type type, unsigned n);
2480         __isl_give isl_map *isl_map_add_dims(
2481                 __isl_take isl_map *map,
2482                 enum isl_dim_type type, unsigned n);
2483         __isl_give isl_basic_set *isl_basic_set_insert_dims(
2484                 __isl_take isl_basic_set *bset,
2485                 enum isl_dim_type type, unsigned pos,
2486                 unsigned n);
2487         __isl_give isl_basic_map *isl_basic_map_insert_dims(
2488                 __isl_take isl_basic_map *bmap,
2489                 enum isl_dim_type type, unsigned pos,
2490                 unsigned n);
2491         __isl_give isl_set *isl_set_insert_dims(
2492                 __isl_take isl_set *set,
2493                 enum isl_dim_type type, unsigned pos, unsigned n);
2494         __isl_give isl_map *isl_map_insert_dims(
2495                 __isl_take isl_map *map,
2496                 enum isl_dim_type type, unsigned pos, unsigned n);
2497         __isl_give isl_basic_set *isl_basic_set_move_dims(
2498                 __isl_take isl_basic_set *bset,
2499                 enum isl_dim_type dst_type, unsigned dst_pos,
2500                 enum isl_dim_type src_type, unsigned src_pos,
2501                 unsigned n);
2502         __isl_give isl_basic_map *isl_basic_map_move_dims(
2503                 __isl_take isl_basic_map *bmap,
2504                 enum isl_dim_type dst_type, unsigned dst_pos,
2505                 enum isl_dim_type src_type, unsigned src_pos,
2506                 unsigned n);
2507         __isl_give isl_set *isl_set_move_dims(
2508                 __isl_take isl_set *set,
2509                 enum isl_dim_type dst_type, unsigned dst_pos,
2510                 enum isl_dim_type src_type, unsigned src_pos,
2511                 unsigned n);
2512         __isl_give isl_map *isl_map_move_dims(
2513                 __isl_take isl_map *map,
2514                 enum isl_dim_type dst_type, unsigned dst_pos,
2515                 enum isl_dim_type src_type, unsigned src_pos,
2516                 unsigned n);
2517
2518 It is usually not advisable to directly change the (input or output)
2519 space of a set or a relation as this removes the name and the internal
2520 structure of the space.  However, the above functions can be useful
2521 to add new parameters, assuming
2522 C<isl_set_align_params> and C<isl_map_align_params>
2523 are not sufficient.
2524
2525 =back
2526
2527 =head2 Binary Operations
2528
2529 The two arguments of a binary operation not only need to live
2530 in the same C<isl_ctx>, they currently also need to have
2531 the same (number of) parameters.
2532
2533 =head3 Basic Operations
2534
2535 =over
2536
2537 =item * Intersection
2538
2539         __isl_give isl_basic_set *isl_basic_set_intersect_params(
2540                 __isl_take isl_basic_set *bset1,
2541                 __isl_take isl_basic_set *bset2);
2542         __isl_give isl_basic_set *isl_basic_set_intersect(
2543                 __isl_take isl_basic_set *bset1,
2544                 __isl_take isl_basic_set *bset2);
2545         __isl_give isl_set *isl_set_intersect_params(
2546                 __isl_take isl_set *set,
2547                 __isl_take isl_set *params);
2548         __isl_give isl_set *isl_set_intersect(
2549                 __isl_take isl_set *set1,
2550                 __isl_take isl_set *set2);
2551         __isl_give isl_union_set *isl_union_set_intersect_params(
2552                 __isl_take isl_union_set *uset,
2553                 __isl_take isl_set *set);
2554         __isl_give isl_union_map *isl_union_map_intersect_params(
2555                 __isl_take isl_union_map *umap,
2556                 __isl_take isl_set *set);
2557         __isl_give isl_union_set *isl_union_set_intersect(
2558                 __isl_take isl_union_set *uset1,
2559                 __isl_take isl_union_set *uset2);
2560         __isl_give isl_basic_map *isl_basic_map_intersect_domain(
2561                 __isl_take isl_basic_map *bmap,
2562                 __isl_take isl_basic_set *bset);
2563         __isl_give isl_basic_map *isl_basic_map_intersect_range(
2564                 __isl_take isl_basic_map *bmap,
2565                 __isl_take isl_basic_set *bset);
2566         __isl_give isl_basic_map *isl_basic_map_intersect(
2567                 __isl_take isl_basic_map *bmap1,
2568                 __isl_take isl_basic_map *bmap2);
2569         __isl_give isl_map *isl_map_intersect_params(
2570                 __isl_take isl_map *map,
2571                 __isl_take isl_set *params);
2572         __isl_give isl_map *isl_map_intersect_domain(
2573                 __isl_take isl_map *map,
2574                 __isl_take isl_set *set);
2575         __isl_give isl_map *isl_map_intersect_range(
2576                 __isl_take isl_map *map,
2577                 __isl_take isl_set *set);
2578         __isl_give isl_map *isl_map_intersect(
2579                 __isl_take isl_map *map1,
2580                 __isl_take isl_map *map2);
2581         __isl_give isl_union_map *isl_union_map_intersect_domain(
2582                 __isl_take isl_union_map *umap,
2583                 __isl_take isl_union_set *uset);
2584         __isl_give isl_union_map *isl_union_map_intersect_range(
2585                 __isl_take isl_union_map *umap,
2586                 __isl_take isl_union_set *uset);
2587         __isl_give isl_union_map *isl_union_map_intersect(
2588                 __isl_take isl_union_map *umap1,
2589                 __isl_take isl_union_map *umap2);
2590
2591 The second argument to the C<_params> functions needs to be
2592 a parametric (basic) set.  For the other functions, a parametric set
2593 for either argument is only allowed if the other argument is
2594 a parametric set as well.
2595
2596 =item * Union
2597
2598         __isl_give isl_set *isl_basic_set_union(
2599                 __isl_take isl_basic_set *bset1,
2600                 __isl_take isl_basic_set *bset2);
2601         __isl_give isl_map *isl_basic_map_union(
2602                 __isl_take isl_basic_map *bmap1,
2603                 __isl_take isl_basic_map *bmap2);
2604         __isl_give isl_set *isl_set_union(
2605                 __isl_take isl_set *set1,
2606                 __isl_take isl_set *set2);
2607         __isl_give isl_map *isl_map_union(
2608                 __isl_take isl_map *map1,
2609                 __isl_take isl_map *map2);
2610         __isl_give isl_union_set *isl_union_set_union(
2611                 __isl_take isl_union_set *uset1,
2612                 __isl_take isl_union_set *uset2);
2613         __isl_give isl_union_map *isl_union_map_union(
2614                 __isl_take isl_union_map *umap1,
2615                 __isl_take isl_union_map *umap2);
2616
2617 =item * Set difference
2618
2619         __isl_give isl_set *isl_set_subtract(
2620                 __isl_take isl_set *set1,
2621                 __isl_take isl_set *set2);
2622         __isl_give isl_map *isl_map_subtract(
2623                 __isl_take isl_map *map1,
2624                 __isl_take isl_map *map2);
2625         __isl_give isl_map *isl_map_subtract_domain(
2626                 __isl_take isl_map *map,
2627                 __isl_take isl_set *dom);
2628         __isl_give isl_map *isl_map_subtract_range(
2629                 __isl_take isl_map *map,
2630                 __isl_take isl_set *dom);
2631         __isl_give isl_union_set *isl_union_set_subtract(
2632                 __isl_take isl_union_set *uset1,
2633                 __isl_take isl_union_set *uset2);
2634         __isl_give isl_union_map *isl_union_map_subtract(
2635                 __isl_take isl_union_map *umap1,
2636                 __isl_take isl_union_map *umap2);
2637
2638 =item * Application
2639
2640         __isl_give isl_basic_set *isl_basic_set_apply(
2641                 __isl_take isl_basic_set *bset,
2642                 __isl_take isl_basic_map *bmap);
2643         __isl_give isl_set *isl_set_apply(
2644                 __isl_take isl_set *set,
2645                 __isl_take isl_map *map);
2646         __isl_give isl_union_set *isl_union_set_apply(
2647                 __isl_take isl_union_set *uset,
2648                 __isl_take isl_union_map *umap);
2649         __isl_give isl_basic_map *isl_basic_map_apply_domain(
2650                 __isl_take isl_basic_map *bmap1,
2651                 __isl_take isl_basic_map *bmap2);
2652         __isl_give isl_basic_map *isl_basic_map_apply_range(
2653                 __isl_take isl_basic_map *bmap1,
2654                 __isl_take isl_basic_map *bmap2);
2655         __isl_give isl_map *isl_map_apply_domain(
2656                 __isl_take isl_map *map1,
2657                 __isl_take isl_map *map2);
2658         __isl_give isl_union_map *isl_union_map_apply_domain(
2659                 __isl_take isl_union_map *umap1,
2660                 __isl_take isl_union_map *umap2);
2661         __isl_give isl_map *isl_map_apply_range(
2662                 __isl_take isl_map *map1,
2663                 __isl_take isl_map *map2);
2664         __isl_give isl_union_map *isl_union_map_apply_range(
2665                 __isl_take isl_union_map *umap1,
2666                 __isl_take isl_union_map *umap2);
2667
2668 =item * Cartesian Product
2669
2670         __isl_give isl_set *isl_set_product(
2671                 __isl_take isl_set *set1,
2672                 __isl_take isl_set *set2);
2673         __isl_give isl_union_set *isl_union_set_product(
2674                 __isl_take isl_union_set *uset1,
2675                 __isl_take isl_union_set *uset2);
2676         __isl_give isl_basic_map *isl_basic_map_domain_product(
2677                 __isl_take isl_basic_map *bmap1,
2678                 __isl_take isl_basic_map *bmap2);
2679         __isl_give isl_basic_map *isl_basic_map_range_product(
2680                 __isl_take isl_basic_map *bmap1,
2681                 __isl_take isl_basic_map *bmap2);
2682         __isl_give isl_basic_map *isl_basic_map_product(
2683                 __isl_take isl_basic_map *bmap1,
2684                 __isl_take isl_basic_map *bmap2);
2685         __isl_give isl_map *isl_map_domain_product(
2686                 __isl_take isl_map *map1,
2687                 __isl_take isl_map *map2);
2688         __isl_give isl_map *isl_map_range_product(
2689                 __isl_take isl_map *map1,
2690                 __isl_take isl_map *map2);
2691         __isl_give isl_union_map *isl_union_map_domain_product(
2692                 __isl_take isl_union_map *umap1,
2693                 __isl_take isl_union_map *umap2);
2694         __isl_give isl_union_map *isl_union_map_range_product(
2695                 __isl_take isl_union_map *umap1,
2696                 __isl_take isl_union_map *umap2);
2697         __isl_give isl_map *isl_map_product(
2698                 __isl_take isl_map *map1,
2699                 __isl_take isl_map *map2);
2700         __isl_give isl_union_map *isl_union_map_product(
2701                 __isl_take isl_union_map *umap1,
2702                 __isl_take isl_union_map *umap2);
2703
2704 The above functions compute the cross product of the given
2705 sets or relations.  The domains and ranges of the results
2706 are wrapped maps between domains and ranges of the inputs.
2707 To obtain a ``flat'' product, use the following functions
2708 instead.
2709
2710         __isl_give isl_basic_set *isl_basic_set_flat_product(
2711                 __isl_take isl_basic_set *bset1,
2712                 __isl_take isl_basic_set *bset2);
2713         __isl_give isl_set *isl_set_flat_product(
2714                 __isl_take isl_set *set1,
2715                 __isl_take isl_set *set2);
2716         __isl_give isl_basic_map *isl_basic_map_flat_range_product(
2717                 __isl_take isl_basic_map *bmap1,
2718                 __isl_take isl_basic_map *bmap2);
2719         __isl_give isl_map *isl_map_flat_domain_product(
2720                 __isl_take isl_map *map1,
2721                 __isl_take isl_map *map2);
2722         __isl_give isl_map *isl_map_flat_range_product(
2723                 __isl_take isl_map *map1,
2724                 __isl_take isl_map *map2);
2725         __isl_give isl_union_map *isl_union_map_flat_range_product(
2726                 __isl_take isl_union_map *umap1,
2727                 __isl_take isl_union_map *umap2);
2728         __isl_give isl_basic_map *isl_basic_map_flat_product(
2729                 __isl_take isl_basic_map *bmap1,
2730                 __isl_take isl_basic_map *bmap2);
2731         __isl_give isl_map *isl_map_flat_product(
2732                 __isl_take isl_map *map1,
2733                 __isl_take isl_map *map2);
2734
2735 =item * Simplification
2736
2737         __isl_give isl_basic_set *isl_basic_set_gist(
2738                 __isl_take isl_basic_set *bset,
2739                 __isl_take isl_basic_set *context);
2740         __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
2741                 __isl_take isl_set *context);
2742         __isl_give isl_set *isl_set_gist_params(
2743                 __isl_take isl_set *set,
2744                 __isl_take isl_set *context);
2745         __isl_give isl_union_set *isl_union_set_gist(
2746                 __isl_take isl_union_set *uset,
2747                 __isl_take isl_union_set *context);
2748         __isl_give isl_union_set *isl_union_set_gist_params(
2749                 __isl_take isl_union_set *uset,
2750                 __isl_take isl_set *set);
2751         __isl_give isl_basic_map *isl_basic_map_gist(
2752                 __isl_take isl_basic_map *bmap,
2753                 __isl_take isl_basic_map *context);
2754         __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
2755                 __isl_take isl_map *context);
2756         __isl_give isl_map *isl_map_gist_params(
2757                 __isl_take isl_map *map,
2758                 __isl_take isl_set *context);
2759         __isl_give isl_map *isl_map_gist_domain(
2760                 __isl_take isl_map *map,
2761                 __isl_take isl_set *context);
2762         __isl_give isl_map *isl_map_gist_range(
2763                 __isl_take isl_map *map,
2764                 __isl_take isl_set *context);
2765         __isl_give isl_union_map *isl_union_map_gist(
2766                 __isl_take isl_union_map *umap,
2767                 __isl_take isl_union_map *context);
2768         __isl_give isl_union_map *isl_union_map_gist_params(
2769                 __isl_take isl_union_map *umap,
2770                 __isl_take isl_set *set);
2771         __isl_give isl_union_map *isl_union_map_gist_domain(
2772                 __isl_take isl_union_map *umap,
2773                 __isl_take isl_union_set *uset);
2774         __isl_give isl_union_map *isl_union_map_gist_range(
2775                 __isl_take isl_union_map *umap,
2776                 __isl_take isl_union_set *uset);
2777
2778 The gist operation returns a set or relation that has the
2779 same intersection with the context as the input set or relation.
2780 Any implicit equality in the intersection is made explicit in the result,
2781 while all inequalities that are redundant with respect to the intersection
2782 are removed.
2783 In case of union sets and relations, the gist operation is performed
2784 per space.
2785
2786 =back
2787
2788 =head3 Lexicographic Optimization
2789
2790 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
2791 the following functions
2792 compute a set that contains the lexicographic minimum or maximum
2793 of the elements in C<set> (or C<bset>) for those values of the parameters
2794 that satisfy C<dom>.
2795 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
2796 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
2797 has no elements.
2798 In other words, the union of the parameter values
2799 for which the result is non-empty and of C<*empty>
2800 is equal to C<dom>.
2801
2802         __isl_give isl_set *isl_basic_set_partial_lexmin(
2803                 __isl_take isl_basic_set *bset,
2804                 __isl_take isl_basic_set *dom,
2805                 __isl_give isl_set **empty);
2806         __isl_give isl_set *isl_basic_set_partial_lexmax(
2807                 __isl_take isl_basic_set *bset,
2808                 __isl_take isl_basic_set *dom,
2809                 __isl_give isl_set **empty);
2810         __isl_give isl_set *isl_set_partial_lexmin(
2811                 __isl_take isl_set *set, __isl_take isl_set *dom,
2812                 __isl_give isl_set **empty);
2813         __isl_give isl_set *isl_set_partial_lexmax(
2814                 __isl_take isl_set *set, __isl_take isl_set *dom,
2815                 __isl_give isl_set **empty);
2816
2817 Given a (basic) set C<set> (or C<bset>), the following functions simply
2818 return a set containing the lexicographic minimum or maximum
2819 of the elements in C<set> (or C<bset>).
2820 In case of union sets, the optimum is computed per space.
2821
2822         __isl_give isl_set *isl_basic_set_lexmin(
2823                 __isl_take isl_basic_set *bset);
2824         __isl_give isl_set *isl_basic_set_lexmax(
2825                 __isl_take isl_basic_set *bset);
2826         __isl_give isl_set *isl_set_lexmin(
2827                 __isl_take isl_set *set);
2828         __isl_give isl_set *isl_set_lexmax(
2829                 __isl_take isl_set *set);
2830         __isl_give isl_union_set *isl_union_set_lexmin(
2831                 __isl_take isl_union_set *uset);
2832         __isl_give isl_union_set *isl_union_set_lexmax(
2833                 __isl_take isl_union_set *uset);
2834
2835 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
2836 the following functions
2837 compute a relation that maps each element of C<dom>
2838 to the single lexicographic minimum or maximum
2839 of the elements that are associated to that same
2840 element in C<map> (or C<bmap>).
2841 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
2842 that contains the elements in C<dom> that do not map
2843 to any elements in C<map> (or C<bmap>).
2844 In other words, the union of the domain of the result and of C<*empty>
2845 is equal to C<dom>.
2846
2847         __isl_give isl_map *isl_basic_map_partial_lexmax(
2848                 __isl_take isl_basic_map *bmap,
2849                 __isl_take isl_basic_set *dom,
2850                 __isl_give isl_set **empty);
2851         __isl_give isl_map *isl_basic_map_partial_lexmin(
2852                 __isl_take isl_basic_map *bmap,
2853                 __isl_take isl_basic_set *dom,
2854                 __isl_give isl_set **empty);
2855         __isl_give isl_map *isl_map_partial_lexmax(
2856                 __isl_take isl_map *map, __isl_take isl_set *dom,
2857                 __isl_give isl_set **empty);
2858         __isl_give isl_map *isl_map_partial_lexmin(
2859                 __isl_take isl_map *map, __isl_take isl_set *dom,
2860                 __isl_give isl_set **empty);
2861
2862 Given a (basic) map C<map> (or C<bmap>), the following functions simply
2863 return a map mapping each element in the domain of
2864 C<map> (or C<bmap>) to the lexicographic minimum or maximum
2865 of all elements associated to that element.
2866 In case of union relations, the optimum is computed per space.
2867
2868         __isl_give isl_map *isl_basic_map_lexmin(
2869                 __isl_take isl_basic_map *bmap);
2870         __isl_give isl_map *isl_basic_map_lexmax(
2871                 __isl_take isl_basic_map *bmap);
2872         __isl_give isl_map *isl_map_lexmin(
2873                 __isl_take isl_map *map);
2874         __isl_give isl_map *isl_map_lexmax(
2875                 __isl_take isl_map *map);
2876         __isl_give isl_union_map *isl_union_map_lexmin(
2877                 __isl_take isl_union_map *umap);
2878         __isl_give isl_union_map *isl_union_map_lexmax(
2879                 __isl_take isl_union_map *umap);
2880
2881 The following functions return their result in the form of
2882 a piecewise multi-affine expression
2883 (See L<"Piecewise Multiple Quasi Affine Expressions">),
2884 but are otherwise equivalent to the corresponding functions
2885 returning a basic set or relation.
2886
2887         __isl_give isl_pw_multi_aff *
2888         isl_basic_map_lexmin_pw_multi_aff(
2889                 __isl_take isl_basic_map *bmap);
2890         __isl_give isl_pw_multi_aff *
2891         isl_basic_set_partial_lexmin_pw_multi_aff(
2892                 __isl_take isl_basic_set *bset,
2893                 __isl_take isl_basic_set *dom,
2894                 __isl_give isl_set **empty);
2895         __isl_give isl_pw_multi_aff *
2896         isl_basic_set_partial_lexmax_pw_multi_aff(
2897                 __isl_take isl_basic_set *bset,
2898                 __isl_take isl_basic_set *dom,
2899                 __isl_give isl_set **empty);
2900         __isl_give isl_pw_multi_aff *
2901         isl_basic_map_partial_lexmin_pw_multi_aff(
2902                 __isl_take isl_basic_map *bmap,
2903                 __isl_take isl_basic_set *dom,
2904                 __isl_give isl_set **empty);
2905         __isl_give isl_pw_multi_aff *
2906         isl_basic_map_partial_lexmax_pw_multi_aff(
2907                 __isl_take isl_basic_map *bmap,
2908                 __isl_take isl_basic_set *dom,
2909                 __isl_give isl_set **empty);
2910         __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
2911                 __isl_take isl_map *map);
2912         __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
2913                 __isl_take isl_map *map);
2914
2915 =head2 Lists
2916
2917 Lists are defined over several element types, including
2918 C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_basic_set> and C<isl_set>.
2919 Here we take lists of C<isl_set>s as an example.
2920 Lists can be created, copied, modified and freed using the following functions.
2921
2922         #include <isl/list.h>
2923         __isl_give isl_set_list *isl_set_list_from_set(
2924                 __isl_take isl_set *el);
2925         __isl_give isl_set_list *isl_set_list_alloc(
2926                 isl_ctx *ctx, int n);
2927         __isl_give isl_set_list *isl_set_list_copy(
2928                 __isl_keep isl_set_list *list);
2929         __isl_give isl_set_list *isl_set_list_add(
2930                 __isl_take isl_set_list *list,
2931                 __isl_take isl_set *el);
2932         __isl_give isl_set_list *isl_set_list_drop(
2933                 __isl_take isl_set_list *list,
2934                 unsigned first, unsigned n);
2935         __isl_give isl_set_list *isl_set_list_set_set(
2936                 __isl_take isl_set_list *list, int index,
2937                 __isl_take isl_set *set);
2938         __isl_give isl_set_list *isl_set_list_concat(
2939                 __isl_take isl_set_list *list1,
2940                 __isl_take isl_set_list *list2);
2941         void *isl_set_list_free(__isl_take isl_set_list *list);
2942
2943 C<isl_set_list_alloc> creates an empty list with a capacity for
2944 C<n> elements.  C<isl_set_list_from_set> creates a list with a single
2945 element.
2946
2947 Lists can be inspected using the following functions.
2948
2949         #include <isl/list.h>
2950         isl_ctx *isl_set_list_get_ctx(__isl_keep isl_set_list *list);
2951         int isl_set_list_n_set(__isl_keep isl_set_list *list);
2952         __isl_give isl_set *isl_set_list_get_set(
2953                 __isl_keep isl_set_list *list, int index);
2954         int isl_set_list_foreach(__isl_keep isl_set_list *list,
2955                 int (*fn)(__isl_take isl_set *el, void *user),
2956                 void *user);
2957
2958 Lists can be printed using
2959
2960         #include <isl/list.h>
2961         __isl_give isl_printer *isl_printer_print_set_list(
2962                 __isl_take isl_printer *p,
2963                 __isl_keep isl_set_list *list);
2964
2965 =head2 Vectors
2966
2967 Vectors can be created, copied and freed using the following functions.
2968
2969         #include <isl/vec.h>
2970         __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
2971                 unsigned size);
2972         __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
2973         void isl_vec_free(__isl_take isl_vec *vec);
2974
2975 Note that the elements of a newly created vector may have arbitrary values.
2976 The elements can be changed and inspected using the following functions.
2977
2978         isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
2979         int isl_vec_size(__isl_keep isl_vec *vec);
2980         int isl_vec_get_element(__isl_keep isl_vec *vec,
2981                 int pos, isl_int *v);
2982         __isl_give isl_vec *isl_vec_set_element(
2983                 __isl_take isl_vec *vec, int pos, isl_int v);
2984         __isl_give isl_vec *isl_vec_set_element_si(
2985                 __isl_take isl_vec *vec, int pos, int v);
2986         __isl_give isl_vec *isl_vec_set(__isl_take isl_vec *vec,
2987                 isl_int v);
2988         __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
2989                 int v);
2990
2991 C<isl_vec_get_element> will return a negative value if anything went wrong.
2992 In that case, the value of C<*v> is undefined.
2993
2994 =head2 Matrices
2995
2996 Matrices can be created, copied and freed using the following functions.
2997
2998         #include <isl/mat.h>
2999         __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
3000                 unsigned n_row, unsigned n_col);
3001         __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
3002         void isl_mat_free(__isl_take isl_mat *mat);
3003
3004 Note that the elements of a newly created matrix may have arbitrary values.
3005 The elements can be changed and inspected using the following functions.
3006
3007         isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
3008         int isl_mat_rows(__isl_keep isl_mat *mat);
3009         int isl_mat_cols(__isl_keep isl_mat *mat);
3010         int isl_mat_get_element(__isl_keep isl_mat *mat,
3011                 int row, int col, isl_int *v);
3012         __isl_give isl_mat *isl_mat_set_element(__isl_take isl_mat *mat,
3013                 int row, int col, isl_int v);
3014         __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
3015                 int row, int col, int v);
3016
3017 C<isl_mat_get_element> will return a negative value if anything went wrong.
3018 In that case, the value of C<*v> is undefined.
3019
3020 The following function can be used to compute the (right) inverse
3021 of a matrix, i.e., a matrix such that the product of the original
3022 and the inverse (in that order) is a multiple of the identity matrix.
3023 The input matrix is assumed to be of full row-rank.
3024
3025         __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
3026
3027 The following function can be used to compute the (right) kernel
3028 (or null space) of a matrix, i.e., a matrix such that the product of
3029 the original and the kernel (in that order) is the zero matrix.
3030
3031         __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
3032
3033 =head2 Piecewise Quasi Affine Expressions
3034
3035 The zero quasi affine expression on a given domain can be created using
3036
3037         __isl_give isl_aff *isl_aff_zero_on_domain(
3038                 __isl_take isl_local_space *ls);
3039
3040 Note that the space in which the resulting object lives is a map space
3041 with the given space as domain and a one-dimensional range.
3042
3043 An empty piecewise quasi affine expression (one with no cells)
3044 or a piecewise quasi affine expression with a single cell can
3045 be created using the following functions.
3046
3047         #include <isl/aff.h>
3048         __isl_give isl_pw_aff *isl_pw_aff_empty(
3049                 __isl_take isl_space *space);
3050         __isl_give isl_pw_aff *isl_pw_aff_alloc(
3051                 __isl_take isl_set *set, __isl_take isl_aff *aff);
3052         __isl_give isl_pw_aff *isl_pw_aff_from_aff(
3053                 __isl_take isl_aff *aff);
3054
3055 A piecewise quasi affine expression that is equal to 1 on a set
3056 and 0 outside the set can be created using the following function.
3057
3058         #include <isl/aff.h>
3059         __isl_give isl_pw_aff *isl_set_indicator_function(
3060                 __isl_take isl_set *set);
3061
3062 Quasi affine expressions can be copied and freed using
3063
3064         #include <isl/aff.h>
3065         __isl_give isl_aff *isl_aff_copy(__isl_keep isl_aff *aff);
3066         void *isl_aff_free(__isl_take isl_aff *aff);
3067
3068         __isl_give isl_pw_aff *isl_pw_aff_copy(
3069                 __isl_keep isl_pw_aff *pwaff);
3070         void *isl_pw_aff_free(__isl_take isl_pw_aff *pwaff);
3071
3072 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
3073 using the following function.  The constraint is required to have
3074 a non-zero coefficient for the specified dimension.
3075
3076         #include <isl/constraint.h>
3077         __isl_give isl_aff *isl_constraint_get_bound(
3078                 __isl_keep isl_constraint *constraint,
3079                 enum isl_dim_type type, int pos);
3080
3081 The entire affine expression of the constraint can also be extracted
3082 using the following function.
3083
3084         #include <isl/constraint.h>
3085         __isl_give isl_aff *isl_constraint_get_aff(
3086                 __isl_keep isl_constraint *constraint);
3087
3088 Conversely, an equality constraint equating
3089 the affine expression to zero or an inequality constraint enforcing
3090 the affine expression to be non-negative, can be constructed using
3091
3092         __isl_give isl_constraint *isl_equality_from_aff(
3093                 __isl_take isl_aff *aff);
3094         __isl_give isl_constraint *isl_inequality_from_aff(
3095                 __isl_take isl_aff *aff);
3096
3097 The expression can be inspected using
3098
3099         #include <isl/aff.h>
3100         isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
3101         int isl_aff_dim(__isl_keep isl_aff *aff,
3102                 enum isl_dim_type type);
3103         __isl_give isl_local_space *isl_aff_get_domain_local_space(
3104                 __isl_keep isl_aff *aff);
3105         __isl_give isl_local_space *isl_aff_get_local_space(
3106                 __isl_keep isl_aff *aff);
3107         const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
3108                 enum isl_dim_type type, unsigned pos);
3109         const char *isl_pw_aff_get_dim_name(
3110                 __isl_keep isl_pw_aff *pa,
3111                 enum isl_dim_type type, unsigned pos);
3112         int isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
3113                 enum isl_dim_type type, unsigned pos);
3114         __isl_give isl_id *isl_pw_aff_get_dim_id(
3115                 __isl_keep isl_pw_aff *pa,
3116                 enum isl_dim_type type, unsigned pos);
3117         __isl_give isl_id *isl_pw_aff_get_tuple_id(
3118                 __isl_keep isl_pw_aff *pa,
3119                 enum isl_dim_type type);
3120         int isl_aff_get_constant(__isl_keep isl_aff *aff,
3121                 isl_int *v);
3122         int isl_aff_get_coefficient(__isl_keep isl_aff *aff,
3123                 enum isl_dim_type type, int pos, isl_int *v);
3124         int isl_aff_get_denominator(__isl_keep isl_aff *aff,
3125                 isl_int *v);
3126         __isl_give isl_aff *isl_aff_get_div(
3127                 __isl_keep isl_aff *aff, int pos);
3128
3129         int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
3130         int isl_pw_aff_foreach_piece(__isl_keep isl_pw_aff *pwaff,
3131                 int (*fn)(__isl_take isl_set *set,
3132                           __isl_take isl_aff *aff,
3133                           void *user), void *user);
3134
3135         int isl_aff_is_cst(__isl_keep isl_aff *aff);
3136         int isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
3137
3138         int isl_aff_involves_dims(__isl_keep isl_aff *aff,
3139                 enum isl_dim_type type, unsigned first, unsigned n);
3140         int isl_pw_aff_involves_dims(__isl_keep isl_pw_aff *pwaff,
3141                 enum isl_dim_type type, unsigned first, unsigned n);
3142
3143         isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pwaff);
3144         unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
3145                 enum isl_dim_type type);
3146         int isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
3147
3148 It can be modified using
3149
3150         #include <isl/aff.h>
3151         __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
3152                 __isl_take isl_pw_aff *pwaff,
3153                 enum isl_dim_type type, __isl_take isl_id *id);
3154         __isl_give isl_aff *isl_aff_set_dim_name(
3155                 __isl_take isl_aff *aff, enum isl_dim_type type,
3156                 unsigned pos, const char *s);
3157         __isl_give isl_aff *isl_aff_set_dim_id(
3158                 __isl_take isl_aff *aff, enum isl_dim_type type,
3159                 unsigned pos, __isl_take isl_id *id);
3160         __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
3161                 __isl_take isl_pw_aff *pma,
3162                 enum isl_dim_type type, unsigned pos,
3163                 __isl_take isl_id *id);
3164         __isl_give isl_aff *isl_aff_set_constant(
3165                 __isl_take isl_aff *aff, isl_int v);
3166         __isl_give isl_aff *isl_aff_set_constant_si(
3167                 __isl_take isl_aff *aff, int v);
3168         __isl_give isl_aff *isl_aff_set_coefficient(
3169                 __isl_take isl_aff *aff,
3170                 enum isl_dim_type type, int pos, isl_int v);
3171         __isl_give isl_aff *isl_aff_set_coefficient_si(
3172                 __isl_take isl_aff *aff,
3173                 enum isl_dim_type type, int pos, int v);
3174         __isl_give isl_aff *isl_aff_set_denominator(
3175                 __isl_take isl_aff *aff, isl_int v);
3176
3177         __isl_give isl_aff *isl_aff_add_constant(
3178                 __isl_take isl_aff *aff, isl_int v);
3179         __isl_give isl_aff *isl_aff_add_constant_si(
3180                 __isl_take isl_aff *aff, int v);
3181         __isl_give isl_aff *isl_aff_add_constant_num(
3182                 __isl_take isl_aff *aff, isl_int v);
3183         __isl_give isl_aff *isl_aff_add_constant_num_si(
3184                 __isl_take isl_aff *aff, int v);
3185         __isl_give isl_aff *isl_aff_add_coefficient(
3186                 __isl_take isl_aff *aff,
3187                 enum isl_dim_type type, int pos, isl_int v);
3188         __isl_give isl_aff *isl_aff_add_coefficient_si(
3189                 __isl_take isl_aff *aff,
3190                 enum isl_dim_type type, int pos, int v);
3191
3192         __isl_give isl_aff *isl_aff_insert_dims(
3193                 __isl_take isl_aff *aff,
3194                 enum isl_dim_type type, unsigned first, unsigned n);
3195         __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
3196                 __isl_take isl_pw_aff *pwaff,
3197                 enum isl_dim_type type, unsigned first, unsigned n);
3198         __isl_give isl_aff *isl_aff_add_dims(
3199                 __isl_take isl_aff *aff,
3200                 enum isl_dim_type type, unsigned n);
3201         __isl_give isl_pw_aff *isl_pw_aff_add_dims(
3202                 __isl_take isl_pw_aff *pwaff,
3203                 enum isl_dim_type type, unsigned n);
3204         __isl_give isl_aff *isl_aff_drop_dims(
3205                 __isl_take isl_aff *aff,
3206                 enum isl_dim_type type, unsigned first, unsigned n);
3207         __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
3208                 __isl_take isl_pw_aff *pwaff,
3209                 enum isl_dim_type type, unsigned first, unsigned n);
3210
3211 Note that the C<set_constant> and C<set_coefficient> functions
3212 set the I<numerator> of the constant or coefficient, while
3213 C<add_constant> and C<add_coefficient> add an integer value to
3214 the possibly rational constant or coefficient.
3215 The C<add_constant_num> functions add an integer value to
3216 the numerator.
3217
3218 To check whether an affine expressions is obviously zero
3219 or obviously equal to some other affine expression, use
3220
3221         #include <isl/aff.h>
3222         int isl_aff_plain_is_zero(__isl_keep isl_aff *aff);
3223         int isl_aff_plain_is_equal(__isl_keep isl_aff *aff1,
3224                 __isl_keep isl_aff *aff2);
3225         int isl_pw_aff_plain_is_equal(
3226                 __isl_keep isl_pw_aff *pwaff1,
3227                 __isl_keep isl_pw_aff *pwaff2);
3228
3229 Operations include
3230
3231         #include <isl/aff.h>
3232         __isl_give isl_aff *isl_aff_add(__isl_take isl_aff *aff1,
3233                 __isl_take isl_aff *aff2);
3234         __isl_give isl_pw_aff *isl_pw_aff_add(
3235                 __isl_take isl_pw_aff *pwaff1,
3236                 __isl_take isl_pw_aff *pwaff2);
3237         __isl_give isl_pw_aff *isl_pw_aff_min(
3238                 __isl_take isl_pw_aff *pwaff1,
3239                 __isl_take isl_pw_aff *pwaff2);
3240         __isl_give isl_pw_aff *isl_pw_aff_max(
3241                 __isl_take isl_pw_aff *pwaff1,
3242                 __isl_take isl_pw_aff *pwaff2);
3243         __isl_give isl_aff *isl_aff_sub(__isl_take isl_aff *aff1,
3244                 __isl_take isl_aff *aff2);
3245         __isl_give isl_pw_aff *isl_pw_aff_sub(
3246                 __isl_take isl_pw_aff *pwaff1,
3247                 __isl_take isl_pw_aff *pwaff2);
3248         __isl_give isl_aff *isl_aff_neg(__isl_take isl_aff *aff);
3249         __isl_give isl_pw_aff *isl_pw_aff_neg(
3250                 __isl_take isl_pw_aff *pwaff);
3251         __isl_give isl_aff *isl_aff_ceil(__isl_take isl_aff *aff);
3252         __isl_give isl_pw_aff *isl_pw_aff_ceil(
3253                 __isl_take isl_pw_aff *pwaff);
3254         __isl_give isl_aff *isl_aff_floor(__isl_take isl_aff *aff);
3255         __isl_give isl_pw_aff *isl_pw_aff_floor(
3256                 __isl_take isl_pw_aff *pwaff);
3257         __isl_give isl_aff *isl_aff_mod(__isl_take isl_aff *aff,
3258                 isl_int mod);
3259         __isl_give isl_pw_aff *isl_pw_aff_mod(
3260                 __isl_take isl_pw_aff *pwaff, isl_int mod);
3261         __isl_give isl_aff *isl_aff_scale(__isl_take isl_aff *aff,
3262                 isl_int f);
3263         __isl_give isl_pw_aff *isl_pw_aff_scale(
3264                 __isl_take isl_pw_aff *pwaff, isl_int f);
3265         __isl_give isl_aff *isl_aff_scale_down(__isl_take isl_aff *aff,
3266                 isl_int f);
3267         __isl_give isl_aff *isl_aff_scale_down_ui(
3268                 __isl_take isl_aff *aff, unsigned f);
3269         __isl_give isl_pw_aff *isl_pw_aff_scale_down(
3270                 __isl_take isl_pw_aff *pwaff, isl_int f);
3271
3272         __isl_give isl_pw_aff *isl_pw_aff_list_min(
3273                 __isl_take isl_pw_aff_list *list);
3274         __isl_give isl_pw_aff *isl_pw_aff_list_max(
3275                 __isl_take isl_pw_aff_list *list);
3276
3277         __isl_give isl_pw_aff *isl_pw_aff_coalesce(
3278                 __isl_take isl_pw_aff *pwqp);
3279
3280         __isl_give isl_aff *isl_aff_align_params(
3281                 __isl_take isl_aff *aff,
3282                 __isl_take isl_space *model);
3283         __isl_give isl_pw_aff *isl_pw_aff_align_params(
3284                 __isl_take isl_pw_aff *pwaff,
3285                 __isl_take isl_space *model);
3286
3287         __isl_give isl_aff *isl_aff_project_domain_on_params(
3288                 __isl_take isl_aff *aff);
3289
3290         __isl_give isl_aff *isl_aff_gist_params(
3291                 __isl_take isl_aff *aff,
3292                 __isl_take isl_set *context);
3293         __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
3294                 __isl_take isl_set *context);
3295         __isl_give isl_pw_aff *isl_pw_aff_gist_params(
3296                 __isl_take isl_pw_aff *pwaff,
3297                 __isl_take isl_set *context);
3298         __isl_give isl_pw_aff *isl_pw_aff_gist(
3299                 __isl_take isl_pw_aff *pwaff,
3300                 __isl_take isl_set *context);
3301
3302         __isl_give isl_set *isl_pw_aff_domain(
3303                 __isl_take isl_pw_aff *pwaff);
3304         __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
3305                 __isl_take isl_pw_aff *pa,
3306                 __isl_take isl_set *set);
3307         __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
3308                 __isl_take isl_pw_aff *pa,
3309                 __isl_take isl_set *set);
3310
3311         __isl_give isl_aff *isl_aff_mul(__isl_take isl_aff *aff1,
3312                 __isl_take isl_aff *aff2);
3313         __isl_give isl_pw_aff *isl_pw_aff_mul(
3314                 __isl_take isl_pw_aff *pwaff1,
3315                 __isl_take isl_pw_aff *pwaff2);
3316
3317 When multiplying two affine expressions, at least one of the two needs
3318 to be a constant.
3319
3320         #include <isl/aff.h>
3321         __isl_give isl_basic_set *isl_aff_neg_basic_set(
3322                 __isl_take isl_aff *aff);
3323         __isl_give isl_basic_set *isl_aff_le_basic_set(
3324                 __isl_take isl_aff *aff1, __isl_take isl_aff *aff2);
3325         __isl_give isl_basic_set *isl_aff_ge_basic_set(
3326                 __isl_take isl_aff *aff1, __isl_take isl_aff *aff2);
3327         __isl_give isl_set *isl_pw_aff_eq_set(
3328                 __isl_take isl_pw_aff *pwaff1,
3329                 __isl_take isl_pw_aff *pwaff2);
3330         __isl_give isl_set *isl_pw_aff_ne_set(
3331                 __isl_take isl_pw_aff *pwaff1,
3332                 __isl_take isl_pw_aff *pwaff2);
3333         __isl_give isl_set *isl_pw_aff_le_set(
3334                 __isl_take isl_pw_aff *pwaff1,
3335                 __isl_take isl_pw_aff *pwaff2);
3336         __isl_give isl_set *isl_pw_aff_lt_set(
3337                 __isl_take isl_pw_aff *pwaff1,
3338                 __isl_take isl_pw_aff *pwaff2);
3339         __isl_give isl_set *isl_pw_aff_ge_set(
3340                 __isl_take isl_pw_aff *pwaff1,
3341                 __isl_take isl_pw_aff *pwaff2);
3342         __isl_give isl_set *isl_pw_aff_gt_set(
3343                 __isl_take isl_pw_aff *pwaff1,
3344                 __isl_take isl_pw_aff *pwaff2);
3345
3346         __isl_give isl_set *isl_pw_aff_list_eq_set(
3347                 __isl_take isl_pw_aff_list *list1,
3348                 __isl_take isl_pw_aff_list *list2);
3349         __isl_give isl_set *isl_pw_aff_list_ne_set(
3350                 __isl_take isl_pw_aff_list *list1,
3351                 __isl_take isl_pw_aff_list *list2);
3352         __isl_give isl_set *isl_pw_aff_list_le_set(
3353                 __isl_take isl_pw_aff_list *list1,
3354                 __isl_take isl_pw_aff_list *list2);
3355         __isl_give isl_set *isl_pw_aff_list_lt_set(
3356                 __isl_take isl_pw_aff_list *list1,
3357                 __isl_take isl_pw_aff_list *list2);
3358         __isl_give isl_set *isl_pw_aff_list_ge_set(
3359                 __isl_take isl_pw_aff_list *list1,
3360                 __isl_take isl_pw_aff_list *list2);
3361         __isl_give isl_set *isl_pw_aff_list_gt_set(
3362                 __isl_take isl_pw_aff_list *list1,
3363                 __isl_take isl_pw_aff_list *list2);
3364
3365 The function C<isl_aff_neg_basic_set> returns a basic set
3366 containing those elements in the domain space
3367 of C<aff> where C<aff> is negative.
3368 The function C<isl_aff_ge_basic_set> returns a basic set
3369 containing those elements in the shared space
3370 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
3371 The function C<isl_pw_aff_ge_set> returns a set
3372 containing those elements in the shared domain
3373 of C<pwaff1> and C<pwaff2> where C<pwaff1> is greater than or equal to C<pwaff2>.
3374 The functions operating on C<isl_pw_aff_list> apply the corresponding
3375 C<isl_pw_aff> function to each pair of elements in the two lists.
3376
3377         #include <isl/aff.h>
3378         __isl_give isl_set *isl_pw_aff_nonneg_set(
3379                 __isl_take isl_pw_aff *pwaff);
3380         __isl_give isl_set *isl_pw_aff_zero_set(
3381                 __isl_take isl_pw_aff *pwaff);
3382         __isl_give isl_set *isl_pw_aff_non_zero_set(
3383                 __isl_take isl_pw_aff *pwaff);
3384
3385 The function C<isl_pw_aff_nonneg_set> returns a set
3386 containing those elements in the domain
3387 of C<pwaff> where C<pwaff> is non-negative.
3388
3389         #include <isl/aff.h>
3390         __isl_give isl_pw_aff *isl_pw_aff_cond(
3391                 __isl_take isl_pw_aff *cond,
3392                 __isl_take isl_pw_aff *pwaff_true,
3393                 __isl_take isl_pw_aff *pwaff_false);
3394
3395 The function C<isl_pw_aff_cond> performs a conditional operator
3396 and returns an expression that is equal to C<pwaff_true>
3397 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
3398 where C<cond> is zero.
3399
3400         #include <isl/aff.h>
3401         __isl_give isl_pw_aff *isl_pw_aff_union_min(
3402                 __isl_take isl_pw_aff *pwaff1,
3403                 __isl_take isl_pw_aff *pwaff2);
3404         __isl_give isl_pw_aff *isl_pw_aff_union_max(
3405                 __isl_take isl_pw_aff *pwaff1,
3406                 __isl_take isl_pw_aff *pwaff2);
3407         __isl_give isl_pw_aff *isl_pw_aff_union_add(
3408                 __isl_take isl_pw_aff *pwaff1,
3409                 __isl_take isl_pw_aff *pwaff2);
3410
3411 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
3412 expression with a domain that is the union of those of C<pwaff1> and
3413 C<pwaff2> and such that on each cell, the quasi-affine expression is
3414 the maximum of those of C<pwaff1> and C<pwaff2>.  If only one of
3415 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
3416 associated expression is the defined one.
3417
3418 An expression can be read from input using
3419
3420         #include <isl/aff.h>
3421         __isl_give isl_aff *isl_aff_read_from_str(
3422                 isl_ctx *ctx, const char *str);
3423         __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3424                 isl_ctx *ctx, const char *str);
3425
3426 An expression can be printed using
3427
3428         #include <isl/aff.h>
3429         __isl_give isl_printer *isl_printer_print_aff(
3430                 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3431
3432         __isl_give isl_printer *isl_printer_print_pw_aff(
3433                 __isl_take isl_printer *p,
3434                 __isl_keep isl_pw_aff *pwaff);
3435
3436 =head2 Piecewise Multiple Quasi Affine Expressions
3437
3438 An C<isl_multi_aff> object represents a sequence of
3439 zero or more affine expressions, all defined on the same domain space.
3440
3441 An C<isl_multi_aff> can be constructed from a C<isl_aff_list> using the
3442 following function.
3443
3444         #include <isl/aff.h>
3445         __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
3446                 __isl_take isl_space *space,
3447                 __isl_take isl_aff_list *list);
3448
3449 An empty piecewise multiple quasi affine expression (one with no cells),
3450 the zero piecewise multiple quasi affine expression (with value zero
3451 for each output dimension),
3452 a piecewise multiple quasi affine expression with a single cell (with
3453 either a universe or a specified domain) or
3454 a zero-dimensional piecewise multiple quasi affine expression
3455 on a given domain
3456 can be created using the following functions.
3457
3458         #include <isl/aff.h>
3459         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
3460                 __isl_take isl_space *space);
3461         __isl_give isl_multi_aff *isl_multi_aff_zero(
3462                 __isl_take isl_space *space);
3463         __isl_give isl_multi_aff *isl_multi_aff_identity(
3464                 __isl_take isl_space *space);
3465         __isl_give isl_pw_multi_aff *
3466         isl_pw_multi_aff_from_multi_aff(
3467                 __isl_take isl_multi_aff *ma);
3468         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
3469                 __isl_take isl_set *set,
3470                 __isl_take isl_multi_aff *maff);
3471         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
3472                 __isl_take isl_set *set);
3473
3474         __isl_give isl_union_pw_multi_aff *
3475         isl_union_pw_multi_aff_empty(
3476                 __isl_take isl_space *space);
3477         __isl_give isl_union_pw_multi_aff *
3478         isl_union_pw_multi_aff_add_pw_multi_aff(
3479                 __isl_take isl_union_pw_multi_aff *upma,
3480                 __isl_take isl_pw_multi_aff *pma);
3481         __isl_give isl_union_pw_multi_aff *
3482         isl_union_pw_multi_aff_from_domain(
3483                 __isl_take isl_union_set *uset);
3484
3485 A piecewise multiple quasi affine expression can also be initialized
3486 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
3487 and the C<isl_map> is single-valued.
3488
3489         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
3490                 __isl_take isl_set *set);
3491         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
3492                 __isl_take isl_map *map);
3493
3494 Multiple quasi affine expressions can be copied and freed using
3495
3496         #include <isl/aff.h>
3497         __isl_give isl_multi_aff *isl_multi_aff_copy(
3498                 __isl_keep isl_multi_aff *maff);
3499         void *isl_multi_aff_free(__isl_take isl_multi_aff *maff);
3500
3501         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
3502                 __isl_keep isl_pw_multi_aff *pma);
3503         void *isl_pw_multi_aff_free(
3504                 __isl_take isl_pw_multi_aff *pma);
3505
3506         __isl_give isl_union_pw_multi_aff *
3507         isl_union_pw_multi_aff_copy(
3508                 __isl_keep isl_union_pw_multi_aff *upma);
3509         void *isl_union_pw_multi_aff_free(
3510                 __isl_take isl_union_pw_multi_aff *upma);
3511
3512 The expression can be inspected using
3513
3514         #include <isl/aff.h>
3515         isl_ctx *isl_multi_aff_get_ctx(
3516                 __isl_keep isl_multi_aff *maff);
3517         isl_ctx *isl_pw_multi_aff_get_ctx(
3518                 __isl_keep isl_pw_multi_aff *pma);
3519         isl_ctx *isl_union_pw_multi_aff_get_ctx(
3520                 __isl_keep isl_union_pw_multi_aff *upma);
3521         unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
3522                 enum isl_dim_type type);
3523         unsigned isl_pw_multi_aff_dim(
3524                 __isl_keep isl_pw_multi_aff *pma,
3525                 enum isl_dim_type type);
3526         __isl_give isl_aff *isl_multi_aff_get_aff(
3527                 __isl_keep isl_multi_aff *multi, int pos);
3528         __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3529                 __isl_keep isl_pw_multi_aff *pma, int pos);
3530         const char *isl_pw_multi_aff_get_dim_name(
3531                 __isl_keep isl_pw_multi_aff *pma,
3532                 enum isl_dim_type type, unsigned pos);
3533         __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
3534                 __isl_keep isl_pw_multi_aff *pma,
3535                 enum isl_dim_type type, unsigned pos);
3536         const char *isl_multi_aff_get_tuple_name(
3537                 __isl_keep isl_multi_aff *multi,
3538                 enum isl_dim_type type);
3539         int isl_pw_multi_aff_has_tuple_name(
3540                 __isl_keep isl_pw_multi_aff *pma,
3541                 enum isl_dim_type type);
3542         const char *isl_pw_multi_aff_get_tuple_name(
3543                 __isl_keep isl_pw_multi_aff *pma,
3544                 enum isl_dim_type type);
3545         int isl_pw_multi_aff_has_tuple_id(
3546                 __isl_keep isl_pw_multi_aff *pma,
3547                 enum isl_dim_type type);
3548         __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
3549                 __isl_keep isl_pw_multi_aff *pma,
3550                 enum isl_dim_type type);
3551
3552         int isl_pw_multi_aff_foreach_piece(
3553                 __isl_keep isl_pw_multi_aff *pma,
3554                 int (*fn)(__isl_take isl_set *set,
3555                             __isl_take isl_multi_aff *maff,
3556                             void *user), void *user);
3557
3558         int isl_union_pw_multi_aff_foreach_pw_multi_aff(
3559                 __isl_keep isl_union_pw_multi_aff *upma,
3560                 int (*fn)(__isl_take isl_pw_multi_aff *pma,
3561                             void *user), void *user);
3562
3563 It can be modified using
3564
3565         #include <isl/aff.h>
3566         __isl_give isl_multi_aff *isl_multi_aff_set_aff(
3567                 __isl_take isl_multi_aff *multi, int pos,
3568                 __isl_take isl_aff *aff);
3569         __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
3570                 __isl_take isl_multi_aff *maff,
3571                 enum isl_dim_type type, unsigned pos, const char *s);
3572         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
3573                 __isl_take isl_multi_aff *maff,
3574                 enum isl_dim_type type, __isl_take isl_id *id);
3575         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
3576                 __isl_take isl_pw_multi_aff *pma,
3577                 enum isl_dim_type type, __isl_take isl_id *id);
3578
3579         __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
3580                 __isl_take isl_multi_aff *maff,
3581                 enum isl_dim_type type, unsigned first, unsigned n);
3582         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
3583                 __isl_take isl_pw_multi_aff *pma,
3584                 enum isl_dim_type type, unsigned first, unsigned n);
3585
3586 To check whether two multiple affine expressions are
3587 obviously equal to each other, use
3588
3589         int isl_multi_aff_plain_is_equal(__isl_keep isl_multi_aff *maff1,
3590                 __isl_keep isl_multi_aff *maff2);
3591         int isl_pw_multi_aff_plain_is_equal(
3592                 __isl_keep isl_pw_multi_aff *pma1,
3593                 __isl_keep isl_pw_multi_aff *pma2);
3594
3595 Operations include
3596
3597         #include <isl/aff.h>
3598         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
3599                 __isl_take isl_pw_multi_aff *pma1,
3600                 __isl_take isl_pw_multi_aff *pma2);
3601         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
3602                 __isl_take isl_pw_multi_aff *pma1,
3603                 __isl_take isl_pw_multi_aff *pma2);
3604         __isl_give isl_multi_aff *isl_multi_aff_add(
3605                 __isl_take isl_multi_aff *maff1,
3606                 __isl_take isl_multi_aff *maff2);
3607         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
3608                 __isl_take isl_pw_multi_aff *pma1,
3609                 __isl_take isl_pw_multi_aff *pma2);
3610         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
3611                 __isl_take isl_union_pw_multi_aff *upma1,
3612                 __isl_take isl_union_pw_multi_aff *upma2);
3613         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
3614                 __isl_take isl_pw_multi_aff *pma1,
3615                 __isl_take isl_pw_multi_aff *pma2);
3616         __isl_give isl_multi_aff *isl_multi_aff_scale(
3617                 __isl_take isl_multi_aff *maff,
3618                 isl_int f);
3619         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
3620                 __isl_take isl_pw_multi_aff *pma,
3621                 __isl_take isl_set *set);
3622         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
3623                 __isl_take isl_pw_multi_aff *pma,
3624                 __isl_take isl_set *set);
3625         __isl_give isl_multi_aff *isl_multi_aff_lift(
3626                 __isl_take isl_multi_aff *maff,
3627                 __isl_give isl_local_space **ls);
3628         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
3629                 __isl_take isl_pw_multi_aff *pma);
3630         __isl_give isl_multi_aff *isl_multi_aff_align_params(
3631                 __isl_take isl_multi_aff *multi,
3632                 __isl_take isl_space *model);
3633         __isl_give isl_pw_multi_aff *
3634         isl_pw_multi_aff_project_domain_on_params(
3635                 __isl_take isl_pw_multi_aff *pma);
3636         __isl_give isl_multi_aff *isl_multi_aff_gist_params(
3637                 __isl_take isl_multi_aff *maff,
3638                 __isl_take isl_set *context);
3639         __isl_give isl_multi_aff *isl_multi_aff_gist(
3640                 __isl_take isl_multi_aff *maff,
3641                 __isl_take isl_set *context);
3642         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
3643                 __isl_take isl_pw_multi_aff *pma,
3644                 __isl_take isl_set *set);
3645         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
3646                 __isl_take isl_pw_multi_aff *pma,
3647                 __isl_take isl_set *set);
3648         __isl_give isl_set *isl_pw_multi_aff_domain(
3649                 __isl_take isl_pw_multi_aff *pma);
3650         __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
3651                 __isl_take isl_union_pw_multi_aff *upma);
3652         __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
3653                 __isl_take isl_multi_aff *ma1,
3654                 __isl_take isl_multi_aff *ma2);
3655         __isl_give isl_multi_aff *isl_multi_aff_product(
3656                 __isl_take isl_multi_aff *ma1,
3657                 __isl_take isl_multi_aff *ma2);
3658         __isl_give isl_pw_multi_aff *
3659         isl_pw_multi_aff_flat_range_product(
3660                 __isl_take isl_pw_multi_aff *pma1,
3661                 __isl_take isl_pw_multi_aff *pma2);
3662         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
3663                 __isl_take isl_pw_multi_aff *pma1,
3664                 __isl_take isl_pw_multi_aff *pma2);
3665         __isl_give isl_union_pw_multi_aff *
3666         isl_union_pw_multi_aff_flat_range_product(
3667                 __isl_take isl_union_pw_multi_aff *upma1,
3668                 __isl_take isl_union_pw_multi_aff *upma2);
3669
3670 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
3671 then it is assigned the local space that lies at the basis of
3672 the lifting applied.
3673
3674         __isl_give isl_set *isl_multi_aff_lex_le_set(
3675                 __isl_take isl_multi_aff *ma1,
3676                 __isl_take isl_multi_aff *ma2);
3677         __isl_give isl_set *isl_multi_aff_lex_ge_set(
3678                 __isl_take isl_multi_aff *ma1,
3679                 __isl_take isl_multi_aff *ma2);
3680
3681 The function C<isl_multi_aff_lex_le_set> returns a set
3682 containing those elements in the shared domain space
3683 where C<ma1> is lexicographically smaller than or
3684 equal to C<ma2>.
3685
3686 An expression can be read from input using
3687
3688         #include <isl/aff.h>
3689         __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3690                 isl_ctx *ctx, const char *str);
3691         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3692                 isl_ctx *ctx, const char *str);
3693
3694 An expression can be printed using
3695
3696         #include <isl/aff.h>
3697         __isl_give isl_printer *isl_printer_print_multi_aff(
3698                 __isl_take isl_printer *p,
3699                 __isl_keep isl_multi_aff *maff);
3700         __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3701                 __isl_take isl_printer *p,
3702                 __isl_keep isl_pw_multi_aff *pma);
3703         __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3704                 __isl_take isl_printer *p,
3705                 __isl_keep isl_union_pw_multi_aff *upma);
3706
3707 =head2 Points
3708
3709 Points are elements of a set.  They can be used to construct
3710 simple sets (boxes) or they can be used to represent the
3711 individual elements of a set.
3712 The zero point (the origin) can be created using
3713
3714         __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
3715
3716 The coordinates of a point can be inspected, set and changed
3717 using
3718
3719         int isl_point_get_coordinate(__isl_keep isl_point *pnt,
3720                 enum isl_dim_type type, int pos, isl_int *v);
3721         __isl_give isl_point *isl_point_set_coordinate(
3722                 __isl_take isl_point *pnt,
3723                 enum isl_dim_type type, int pos, isl_int v);
3724
3725         __isl_give isl_point *isl_point_add_ui(
3726                 __isl_take isl_point *pnt,
3727                 enum isl_dim_type type, int pos, unsigned val);
3728         __isl_give isl_point *isl_point_sub_ui(
3729                 __isl_take isl_point *pnt,
3730                 enum isl_dim_type type, int pos, unsigned val);
3731
3732 Other properties can be obtained using
3733
3734         isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
3735
3736 Points can be copied or freed using
3737
3738         __isl_give isl_point *isl_point_copy(
3739                 __isl_keep isl_point *pnt);
3740         void isl_point_free(__isl_take isl_point *pnt);
3741
3742 A singleton set can be created from a point using
3743
3744         __isl_give isl_basic_set *isl_basic_set_from_point(
3745                 __isl_take isl_point *pnt);
3746         __isl_give isl_set *isl_set_from_point(
3747                 __isl_take isl_point *pnt);
3748
3749 and a box can be created from two opposite extremal points using
3750
3751         __isl_give isl_basic_set *isl_basic_set_box_from_points(
3752                 __isl_take isl_point *pnt1,
3753                 __isl_take isl_point *pnt2);
3754         __isl_give isl_set *isl_set_box_from_points(
3755                 __isl_take isl_point *pnt1,
3756                 __isl_take isl_point *pnt2);
3757
3758 All elements of a B<bounded> (union) set can be enumerated using
3759 the following functions.
3760
3761         int isl_set_foreach_point(__isl_keep isl_set *set,
3762                 int (*fn)(__isl_take isl_point *pnt, void *user),
3763                 void *user);
3764         int isl_union_set_foreach_point(__isl_keep isl_union_set *uset,
3765                 int (*fn)(__isl_take isl_point *pnt, void *user),
3766                 void *user);
3767
3768 The function C<fn> is called for each integer point in
3769 C<set> with as second argument the last argument of
3770 the C<isl_set_foreach_point> call.  The function C<fn>
3771 should return C<0> on success and C<-1> on failure.
3772 In the latter case, C<isl_set_foreach_point> will stop
3773 enumerating and return C<-1> as well.
3774 If the enumeration is performed successfully and to completion,
3775 then C<isl_set_foreach_point> returns C<0>.
3776
3777 To obtain a single point of a (basic) set, use
3778
3779         __isl_give isl_point *isl_basic_set_sample_point(
3780                 __isl_take isl_basic_set *bset);
3781         __isl_give isl_point *isl_set_sample_point(
3782                 __isl_take isl_set *set);
3783
3784 If C<set> does not contain any (integer) points, then the
3785 resulting point will be ``void'', a property that can be
3786 tested using
3787
3788         int isl_point_is_void(__isl_keep isl_point *pnt);
3789
3790 =head2 Piecewise Quasipolynomials
3791
3792 A piecewise quasipolynomial is a particular kind of function that maps
3793 a parametric point to a rational value.
3794 More specifically, a quasipolynomial is a polynomial expression in greatest
3795 integer parts of affine expressions of parameters and variables.
3796 A piecewise quasipolynomial is a subdivision of a given parametric
3797 domain into disjoint cells with a quasipolynomial associated to
3798 each cell.  The value of the piecewise quasipolynomial at a given
3799 point is the value of the quasipolynomial associated to the cell
3800 that contains the point.  Outside of the union of cells,
3801 the value is assumed to be zero.
3802 For example, the piecewise quasipolynomial
3803
3804         [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
3805
3806 maps C<x> to C<1 + n - x> for values of C<x> between C<0> and C<n>.
3807 A given piecewise quasipolynomial has a fixed domain dimension.
3808 Union piecewise quasipolynomials are used to contain piecewise quasipolynomials
3809 defined over different domains.
3810 Piecewise quasipolynomials are mainly used by the C<barvinok>
3811 library for representing the number of elements in a parametric set or map.
3812 For example, the piecewise quasipolynomial above represents
3813 the number of points in the map
3814
3815         [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
3816
3817 =head3 Input and Output
3818
3819 Piecewise quasipolynomials can be read from input using
3820
3821         __isl_give isl_union_pw_qpolynomial *
3822         isl_union_pw_qpolynomial_read_from_str(
3823                 isl_ctx *ctx, const char *str);
3824
3825 Quasipolynomials and piecewise quasipolynomials can be printed
3826 using the following functions.
3827
3828         __isl_give isl_printer *isl_printer_print_qpolynomial(
3829                 __isl_take isl_printer *p,
3830                 __isl_keep isl_qpolynomial *qp);
3831
3832         __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3833                 __isl_take isl_printer *p,
3834                 __isl_keep isl_pw_qpolynomial *pwqp);
3835
3836         __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3837                 __isl_take isl_printer *p,
3838                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3839
3840 The output format of the printer
3841 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3842 For C<isl_printer_print_union_pw_qpolynomial>, only C<ISL_FORMAT_ISL>
3843 is supported.
3844 In case of printing in C<ISL_FORMAT_C>, the user may want
3845 to set the names of all dimensions
3846
3847         __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
3848                 __isl_take isl_qpolynomial *qp,
3849                 enum isl_dim_type type, unsigned pos,
3850                 const char *s);
3851         __isl_give isl_pw_qpolynomial *
3852         isl_pw_qpolynomial_set_dim_name(
3853                 __isl_take isl_pw_qpolynomial *pwqp,
3854                 enum isl_dim_type type, unsigned pos,
3855                 const char *s);
3856
3857 =head3 Creating New (Piecewise) Quasipolynomials
3858
3859 Some simple quasipolynomials can be created using the following functions.
3860 More complicated quasipolynomials can be created by applying
3861 operations such as addition and multiplication
3862 on the resulting quasipolynomials
3863
3864         __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
3865                 __isl_take isl_space *domain);
3866         __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
3867                 __isl_take isl_space *domain);
3868         __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
3869                 __isl_take isl_space *domain);
3870         __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
3871                 __isl_take isl_space *domain);
3872         __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
3873                 __isl_take isl_space *domain);
3874         __isl_give isl_qpolynomial *isl_qpolynomial_rat_cst_on_domain(
3875                 __isl_take isl_space *domain,
3876                 const isl_int n, const isl_int d);
3877         __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
3878                 __isl_take isl_space *domain,
3879                 enum isl_dim_type type, unsigned pos);
3880         __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
3881                 __isl_take isl_aff *aff);
3882
3883 Note that the space in which a quasipolynomial lives is a map space
3884 with a one-dimensional range.  The C<domain> argument in some of
3885 the functions above corresponds to the domain of this map space.
3886
3887 The zero piecewise quasipolynomial or a piecewise quasipolynomial
3888 with a single cell can be created using the following functions.
3889 Multiple of these single cell piecewise quasipolynomials can
3890 be combined to create more complicated piecewise quasipolynomials.
3891
3892         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
3893                 __isl_take isl_space *space);
3894         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
3895                 __isl_take isl_set *set,
3896                 __isl_take isl_qpolynomial *qp);
3897         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_from_qpolynomial(
3898                 __isl_take isl_qpolynomial *qp);
3899         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_from_pw_aff(
3900                 __isl_take isl_pw_aff *pwaff);
3901
3902         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_zero(
3903                 __isl_take isl_space *space);
3904         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_from_pw_qpolynomial(
3905                 __isl_take isl_pw_qpolynomial *pwqp);
3906         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add_pw_qpolynomial(
3907                 __isl_take isl_union_pw_qpolynomial *upwqp,
3908                 __isl_take isl_pw_qpolynomial *pwqp);
3909
3910 Quasipolynomials can be copied and freed again using the following
3911 functions.
3912
3913         __isl_give isl_qpolynomial *isl_qpolynomial_copy(
3914                 __isl_keep isl_qpolynomial *qp);
3915         void *isl_qpolynomial_free(__isl_take isl_qpolynomial *qp);
3916
3917         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
3918                 __isl_keep isl_pw_qpolynomial *pwqp);
3919         void *isl_pw_qpolynomial_free(
3920                 __isl_take isl_pw_qpolynomial *pwqp);
3921
3922         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_copy(
3923                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3924         void *isl_union_pw_qpolynomial_free(
3925                 __isl_take isl_union_pw_qpolynomial *upwqp);
3926
3927 =head3 Inspecting (Piecewise) Quasipolynomials
3928
3929 To iterate over all piecewise quasipolynomials in a union
3930 piecewise quasipolynomial, use the following function
3931
3932         int isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3933                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3934                 int (*fn)(__isl_take isl_pw_qpolynomial *pwqp, void *user),
3935                 void *user);
3936
3937 To extract the piecewise quasipolynomial in a given space from a union, use
3938
3939         __isl_give isl_pw_qpolynomial *
3940         isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3941                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3942                 __isl_take isl_space *space);
3943
3944 To iterate over the cells in a piecewise quasipolynomial,
3945 use either of the following two functions
3946
3947         int isl_pw_qpolynomial_foreach_piece(
3948                 __isl_keep isl_pw_qpolynomial *pwqp,
3949                 int (*fn)(__isl_take isl_set *set,
3950                           __isl_take isl_qpolynomial *qp,
3951                           void *user), void *user);
3952         int isl_pw_qpolynomial_foreach_lifted_piece(
3953                 __isl_keep isl_pw_qpolynomial *pwqp,
3954                 int (*fn)(__isl_take isl_set *set,
3955                           __isl_take isl_qpolynomial *qp,
3956                           void *user), void *user);
3957
3958 As usual, the function C<fn> should return C<0> on success
3959 and C<-1> on failure.  The difference between
3960 C<isl_pw_qpolynomial_foreach_piece> and
3961 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
3962 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
3963 compute unique representations for all existentially quantified
3964 variables and then turn these existentially quantified variables
3965 into extra set variables, adapting the associated quasipolynomial
3966 accordingly.  This means that the C<set> passed to C<fn>
3967 will not have any existentially quantified variables, but that
3968 the dimensions of the sets may be different for different
3969 invocations of C<fn>.
3970
3971 To iterate over all terms in a quasipolynomial,
3972 use
3973
3974         int isl_qpolynomial_foreach_term(
3975                 __isl_keep isl_qpolynomial *qp,
3976                 int (*fn)(__isl_take isl_term *term,
3977                           void *user), void *user);
3978
3979 The terms themselves can be inspected and freed using
3980 these functions
3981
3982         unsigned isl_term_dim(__isl_keep isl_term *term,
3983                 enum isl_dim_type type);
3984         void isl_term_get_num(__isl_keep isl_term *term,
3985                 isl_int *n);
3986         void isl_term_get_den(__isl_keep isl_term *term,
3987                 isl_int *d);
3988         int isl_term_get_exp(__isl_keep isl_term *term,
3989                 enum isl_dim_type type, unsigned pos);
3990         __isl_give isl_aff *isl_term_get_div(
3991                 __isl_keep isl_term *term, unsigned pos);
3992         void isl_term_free(__isl_take isl_term *term);
3993
3994 Each term is a product of parameters, set variables and
3995 integer divisions.  The function C<isl_term_get_exp>
3996 returns the exponent of a given dimensions in the given term.
3997 The C<isl_int>s in the arguments of C<isl_term_get_num>
3998 and C<isl_term_get_den> need to have been initialized
3999 using C<isl_int_init> before calling these functions.
4000
4001 =head3 Properties of (Piecewise) Quasipolynomials
4002
4003 To check whether a quasipolynomial is actually a constant,
4004 use the following function.
4005
4006         int isl_qpolynomial_is_cst(__isl_keep isl_qpolynomial *qp,
4007                 isl_int *n, isl_int *d);
4008
4009 If C<qp> is a constant and if C<n> and C<d> are not C<NULL>
4010 then the numerator and denominator of the constant
4011 are returned in C<*n> and C<*d>, respectively.
4012
4013 To check whether two union piecewise quasipolynomials are
4014 obviously equal, use
4015
4016         int isl_union_pw_qpolynomial_plain_is_equal(
4017                 __isl_keep isl_union_pw_qpolynomial *upwqp1,
4018                 __isl_keep isl_union_pw_qpolynomial *upwqp2);
4019
4020 =head3 Operations on (Piecewise) Quasipolynomials
4021
4022         __isl_give isl_qpolynomial *isl_qpolynomial_scale(
4023                 __isl_take isl_qpolynomial *qp, isl_int v);
4024         __isl_give isl_qpolynomial *isl_qpolynomial_neg(
4025                 __isl_take isl_qpolynomial *qp);
4026         __isl_give isl_qpolynomial *isl_qpolynomial_add(
4027                 __isl_take isl_qpolynomial *qp1,
4028                 __isl_take isl_qpolynomial *qp2);
4029         __isl_give isl_qpolynomial *isl_qpolynomial_sub(
4030                 __isl_take isl_qpolynomial *qp1,
4031                 __isl_take isl_qpolynomial *qp2);
4032         __isl_give isl_qpolynomial *isl_qpolynomial_mul(
4033                 __isl_take isl_qpolynomial *qp1,
4034                 __isl_take isl_qpolynomial *qp2);
4035         __isl_give isl_qpolynomial *isl_qpolynomial_pow(
4036                 __isl_take isl_qpolynomial *qp, unsigned exponent);
4037
4038         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
4039                 __isl_take isl_pw_qpolynomial *pwqp1,
4040                 __isl_take isl_pw_qpolynomial *pwqp2);
4041         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
4042                 __isl_take isl_pw_qpolynomial *pwqp1,
4043                 __isl_take isl_pw_qpolynomial *pwqp2);
4044         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
4045                 __isl_take isl_pw_qpolynomial *pwqp1,
4046                 __isl_take isl_pw_qpolynomial *pwqp2);
4047         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
4048                 __isl_take isl_pw_qpolynomial *pwqp);
4049         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
4050                 __isl_take isl_pw_qpolynomial *pwqp1,
4051                 __isl_take isl_pw_qpolynomial *pwqp2);
4052         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
4053                 __isl_take isl_pw_qpolynomial *pwqp, unsigned exponent);
4054
4055         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
4056                 __isl_take isl_union_pw_qpolynomial *upwqp1,
4057                 __isl_take isl_union_pw_qpolynomial *upwqp2);
4058         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
4059                 __isl_take isl_union_pw_qpolynomial *upwqp1,
4060                 __isl_take isl_union_pw_qpolynomial *upwqp2);
4061         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
4062                 __isl_take isl_union_pw_qpolynomial *upwqp1,
4063                 __isl_take isl_union_pw_qpolynomial *upwqp2);
4064
4065         __isl_give isl_qpolynomial *isl_pw_qpolynomial_eval(
4066                 __isl_take isl_pw_qpolynomial *pwqp,
4067                 __isl_take isl_point *pnt);
4068
4069         __isl_give isl_qpolynomial *isl_union_pw_qpolynomial_eval(
4070                 __isl_take isl_union_pw_qpolynomial *upwqp,
4071                 __isl_take isl_point *pnt);
4072
4073         __isl_give isl_set *isl_pw_qpolynomial_domain(
4074                 __isl_take isl_pw_qpolynomial *pwqp);
4075         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_intersect_domain(
4076                 __isl_take isl_pw_qpolynomial *pwpq,
4077                 __isl_take isl_set *set);
4078         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_intersect_params(
4079                 __isl_take isl_pw_qpolynomial *pwpq,
4080                 __isl_take isl_set *set);
4081
4082         __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
4083                 __isl_take isl_union_pw_qpolynomial *upwqp);
4084         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_intersect_domain(
4085                 __isl_take isl_union_pw_qpolynomial *upwpq,
4086                 __isl_take isl_union_set *uset);
4087         __isl_give isl_union_pw_qpolynomial *
4088         isl_union_pw_qpolynomial_intersect_params(
4089                 __isl_take isl_union_pw_qpolynomial *upwpq,
4090                 __isl_take isl_set *set);
4091
4092         __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
4093                 __isl_take isl_qpolynomial *qp,
4094                 __isl_take isl_space *model);
4095
4096         __isl_give isl_qpolynomial *isl_qpolynomial_project_domain_on_params(
4097                 __isl_take isl_qpolynomial *qp);
4098         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_project_domain_on_params(
4099                 __isl_take isl_pw_qpolynomial *pwqp);
4100
4101         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_coalesce(
4102                 __isl_take isl_union_pw_qpolynomial *upwqp);
4103
4104         __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
4105                 __isl_take isl_qpolynomial *qp,
4106                 __isl_take isl_set *context);
4107         __isl_give isl_qpolynomial *isl_qpolynomial_gist(
4108                 __isl_take isl_qpolynomial *qp,
4109                 __isl_take isl_set *context);
4110
4111         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
4112                 __isl_take isl_pw_qpolynomial *pwqp,
4113                 __isl_take isl_set *context);
4114         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
4115                 __isl_take isl_pw_qpolynomial *pwqp,
4116                 __isl_take isl_set *context);
4117
4118         __isl_give isl_union_pw_qpolynomial *
4119         isl_union_pw_qpolynomial_gist_params(
4120                 __isl_take isl_union_pw_qpolynomial *upwqp,
4121                 __isl_take isl_set *context);
4122         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
4123                 __isl_take isl_union_pw_qpolynomial *upwqp,
4124                 __isl_take isl_union_set *context);
4125
4126 The gist operation applies the gist operation to each of
4127 the cells in the domain of the input piecewise quasipolynomial.
4128 The context is also exploited
4129 to simplify the quasipolynomials associated to each cell.
4130
4131         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
4132                 __isl_take isl_pw_qpolynomial *pwqp, int sign);
4133         __isl_give isl_union_pw_qpolynomial *
4134         isl_union_pw_qpolynomial_to_polynomial(
4135                 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
4136
4137 Approximate each quasipolynomial by a polynomial.  If C<sign> is positive,
4138 the polynomial will be an overapproximation.  If C<sign> is negative,
4139 it will be an underapproximation.  If C<sign> is zero, the approximation
4140 will lie somewhere in between.
4141
4142 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
4143
4144 A piecewise quasipolynomial reduction is a piecewise
4145 reduction (or fold) of quasipolynomials.
4146 In particular, the reduction can be maximum or a minimum.
4147 The objects are mainly used to represent the result of
4148 an upper or lower bound on a quasipolynomial over its domain,
4149 i.e., as the result of the following function.
4150
4151         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_bound(
4152                 __isl_take isl_pw_qpolynomial *pwqp,
4153                 enum isl_fold type, int *tight);
4154
4155         __isl_give isl_union_pw_qpolynomial_fold *isl_union_pw_qpolynomial_bound(
4156                 __isl_take isl_union_pw_qpolynomial *upwqp,
4157                 enum isl_fold type, int *tight);
4158
4159 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
4160 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
4161 is the returned bound is known be tight, i.e., for each value
4162 of the parameters there is at least
4163 one element in the domain that reaches the bound.
4164 If the domain of C<pwqp> is not wrapping, then the bound is computed
4165 over all elements in that domain and the result has a purely parametric
4166 domain.  If the domain of C<pwqp> is wrapping, then the bound is
4167 computed over the range of the wrapped relation.  The domain of the
4168 wrapped relation becomes the domain of the result.
4169
4170 A (piecewise) quasipolynomial reduction can be copied or freed using the
4171 following functions.
4172
4173         __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_copy(
4174                 __isl_keep isl_qpolynomial_fold *fold);
4175         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_copy(
4176                 __isl_keep isl_pw_qpolynomial_fold *pwf);
4177         __isl_give isl_union_pw_qpolynomial_fold *isl_union_pw_qpolynomial_fold_copy(
4178                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
4179         void isl_qpolynomial_fold_free(
4180                 __isl_take isl_qpolynomial_fold *fold);
4181         void *isl_pw_qpolynomial_fold_free(
4182                 __isl_take isl_pw_qpolynomial_fold *pwf);
4183         void *isl_union_pw_qpolynomial_fold_free(
4184                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4185
4186 =head3 Printing Piecewise Quasipolynomial Reductions
4187
4188 Piecewise quasipolynomial reductions can be printed
4189 using the following function.
4190
4191         __isl_give isl_printer *isl_printer_print_pw_qpolynomial_fold(
4192                 __isl_take isl_printer *p,
4193                 __isl_keep isl_pw_qpolynomial_fold *pwf);
4194         __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial_fold(
4195                 __isl_take isl_printer *p,
4196                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
4197
4198 For C<isl_printer_print_pw_qpolynomial_fold>,
4199 output format of the printer
4200 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
4201 For C<isl_printer_print_union_pw_qpolynomial_fold>,
4202 output format of the printer
4203 needs to be set to C<ISL_FORMAT_ISL>.
4204 In case of printing in C<ISL_FORMAT_C>, the user may want
4205 to set the names of all dimensions
4206
4207         __isl_give isl_pw_qpolynomial_fold *
4208         isl_pw_qpolynomial_fold_set_dim_name(
4209                 __isl_take isl_pw_qpolynomial_fold *pwf,
4210                 enum isl_dim_type type, unsigned pos,
4211                 const char *s);
4212
4213 =head3 Inspecting (Piecewise) Quasipolynomial Reductions
4214
4215 To iterate over all piecewise quasipolynomial reductions in a union
4216 piecewise quasipolynomial reduction, use the following function
4217
4218         int isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
4219                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
4220                 int (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
4221                             void *user), void *user);
4222
4223 To iterate over the cells in a piecewise quasipolynomial reduction,
4224 use either of the following two functions
4225
4226         int isl_pw_qpolynomial_fold_foreach_piece(
4227                 __isl_keep isl_pw_qpolynomial_fold *pwf,
4228                 int (*fn)(__isl_take isl_set *set,
4229                           __isl_take isl_qpolynomial_fold *fold,
4230                           void *user), void *user);
4231         int isl_pw_qpolynomial_fold_foreach_lifted_piece(
4232                 __isl_keep isl_pw_qpolynomial_fold *pwf,
4233                 int (*fn)(__isl_take isl_set *set,
4234                           __isl_take isl_qpolynomial_fold *fold,
4235                           void *user), void *user);
4236
4237 See L<Inspecting (Piecewise) Quasipolynomials> for an explanation
4238 of the difference between these two functions.
4239
4240 To iterate over all quasipolynomials in a reduction, use
4241
4242         int isl_qpolynomial_fold_foreach_qpolynomial(
4243                 __isl_keep isl_qpolynomial_fold *fold,
4244                 int (*fn)(__isl_take isl_qpolynomial *qp,
4245                           void *user), void *user);
4246
4247 =head3 Properties of Piecewise Quasipolynomial Reductions
4248
4249 To check whether two union piecewise quasipolynomial reductions are
4250 obviously equal, use
4251
4252         int isl_union_pw_qpolynomial_fold_plain_is_equal(
4253                 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
4254                 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
4255
4256 =head3 Operations on Piecewise Quasipolynomial Reductions
4257
4258         __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_scale(
4259                 __isl_take isl_qpolynomial_fold *fold, isl_int v);
4260
4261         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
4262                 __isl_take isl_pw_qpolynomial_fold *pwf1,
4263                 __isl_take isl_pw_qpolynomial_fold *pwf2);
4264
4265         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
4266                 __isl_take isl_pw_qpolynomial_fold *pwf1,
4267                 __isl_take isl_pw_qpolynomial_fold *pwf2);
4268
4269         __isl_give isl_union_pw_qpolynomial_fold *isl_union_pw_qpolynomial_fold_fold(
4270                 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
4271                 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
4272
4273         __isl_give isl_qpolynomial *isl_pw_qpolynomial_fold_eval(
4274                 __isl_take isl_pw_qpolynomial_fold *pwf,
4275                 __isl_take isl_point *pnt);
4276
4277         __isl_give isl_qpolynomial *isl_union_pw_qpolynomial_fold_eval(
4278                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
4279                 __isl_take isl_point *pnt);
4280
4281         __isl_give isl_pw_qpolynomial_fold *
4282         isl_pw_qpolynomial_fold_intersect_params(
4283                 __isl_take isl_pw_qpolynomial_fold *pwf,
4284                 __isl_take isl_set *set);
4285
4286         __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
4287                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4288         __isl_give isl_union_pw_qpolynomial_fold *isl_union_pw_qpolynomial_fold_intersect_domain(
4289                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
4290                 __isl_take isl_union_set *uset);
4291         __isl_give isl_union_pw_qpolynomial_fold *
4292         isl_union_pw_qpolynomial_fold_intersect_params(
4293                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
4294                 __isl_take isl_set *set);
4295
4296         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_project_domain_on_params(
4297                 __isl_take isl_pw_qpolynomial_fold *pwf);
4298
4299         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_coalesce(
4300                 __isl_take isl_pw_qpolynomial_fold *pwf);
4301
4302         __isl_give isl_union_pw_qpolynomial_fold *isl_union_pw_qpolynomial_fold_coalesce(
4303                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4304
4305         __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist_params(
4306                 __isl_take isl_qpolynomial_fold *fold,
4307                 __isl_take isl_set *context);
4308         __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
4309                 __isl_take isl_qpolynomial_fold *fold,
4310                 __isl_take isl_set *context);
4311
4312         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_gist(
4313                 __isl_take isl_pw_qpolynomial_fold *pwf,
4314                 __isl_take isl_set *context);
4315         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_gist_params(
4316                 __isl_take isl_pw_qpolynomial_fold *pwf,
4317                 __isl_take isl_set *context);
4318
4319         __isl_give isl_union_pw_qpolynomial_fold *isl_union_pw_qpolynomial_fold_gist(
4320                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
4321                 __isl_take isl_union_set *context);
4322         __isl_give isl_union_pw_qpolynomial_fold *
4323         isl_union_pw_qpolynomial_fold_gist_params(
4324                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
4325                 __isl_take isl_set *context);
4326
4327 The gist operation applies the gist operation to each of
4328 the cells in the domain of the input piecewise quasipolynomial reduction.
4329 In future, the operation will also exploit the context
4330 to simplify the quasipolynomial reductions associated to each cell.
4331
4332         __isl_give isl_pw_qpolynomial_fold *
4333         isl_set_apply_pw_qpolynomial_fold(
4334                 __isl_take isl_set *set,
4335                 __isl_take isl_pw_qpolynomial_fold *pwf,
4336                 int *tight);
4337         __isl_give isl_pw_qpolynomial_fold *
4338         isl_map_apply_pw_qpolynomial_fold(
4339                 __isl_take isl_map *map,
4340                 __isl_take isl_pw_qpolynomial_fold *pwf,
4341                 int *tight);
4342         __isl_give isl_union_pw_qpolynomial_fold *
4343         isl_union_set_apply_union_pw_qpolynomial_fold(
4344                 __isl_take isl_union_set *uset,
4345                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
4346                 int *tight);
4347         __isl_give isl_union_pw_qpolynomial_fold *
4348         isl_union_map_apply_union_pw_qpolynomial_fold(
4349                 __isl_take isl_union_map *umap,
4350                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
4351                 int *tight);
4352
4353 The functions taking a map
4354 compose the given map with the given piecewise quasipolynomial reduction.
4355 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
4356 over all elements in the intersection of the range of the map
4357 and the domain of the piecewise quasipolynomial reduction
4358 as a function of an element in the domain of the map.
4359 The functions taking a set compute a bound over all elements in the
4360 intersection of the set and the domain of the
4361 piecewise quasipolynomial reduction.
4362
4363 =head2 Dependence Analysis
4364
4365 C<isl> contains specialized functionality for performing
4366 array dataflow analysis.  That is, given a I<sink> access relation
4367 and a collection of possible I<source> access relations,
4368 C<isl> can compute relations that describe
4369 for each iteration of the sink access, which iteration
4370 of which of the source access relations was the last
4371 to access the same data element before the given iteration
4372 of the sink access.
4373 The resulting dependence relations map source iterations
4374 to the corresponding sink iterations.
4375 To compute standard flow dependences, the sink should be
4376 a read, while the sources should be writes.
4377 If any of the source accesses are marked as being I<may>
4378 accesses, then there will be a dependence from the last
4379 I<must> access B<and> from any I<may> access that follows
4380 this last I<must> access.
4381 In particular, if I<all> sources are I<may> accesses,
4382 then memory based dependence analysis is performed.
4383 If, on the other hand, all sources are I<must> accesses,
4384 then value based dependence analysis is performed.
4385
4386         #include <isl/flow.h>
4387
4388         typedef int (*isl_access_level_before)(void *first, void *second);
4389
4390         __isl_give isl_access_info *isl_access_info_alloc(
4391                 __isl_take isl_map *sink,
4392                 void *sink_user, isl_access_level_before fn,
4393                 int max_source);
4394         __isl_give isl_access_info *isl_access_info_add_source(
4395                 __isl_take isl_access_info *acc,
4396                 __isl_take isl_map *source, int must,
4397                 void *source_user);
4398         void *isl_access_info_free(__isl_take isl_access_info *acc);
4399
4400         __isl_give isl_flow *isl_access_info_compute_flow(
4401                 __isl_take isl_access_info *acc);
4402
4403         int isl_flow_foreach(__isl_keep isl_flow *deps,
4404                 int (*fn)(__isl_take isl_map *dep, int must,
4405                           void *dep_user, void *user),
4406                 void *user);
4407         __isl_give isl_map *isl_flow_get_no_source(
4408                 __isl_keep isl_flow *deps, int must);
4409         void isl_flow_free(__isl_take isl_flow *deps);
4410
4411 The function C<isl_access_info_compute_flow> performs the actual
4412 dependence analysis.  The other functions are used to construct
4413 the input for this function or to read off the output.
4414
4415 The input is collected in an C<isl_access_info>, which can
4416 be created through a call to C<isl_access_info_alloc>.
4417 The arguments to this functions are the sink access relation
4418 C<sink>, a token C<sink_user> used to identify the sink
4419 access to the user, a callback function for specifying the
4420 relative order of source and sink accesses, and the number
4421 of source access relations that will be added.
4422 The callback function has type C<int (*)(void *first, void *second)>.
4423 The function is called with two user supplied tokens identifying
4424 either a source or the sink and it should return the shared nesting
4425 level and the relative order of the two accesses.
4426 In particular, let I<n> be the number of loops shared by
4427 the two accesses.  If C<first> precedes C<second> textually,
4428 then the function should return I<2 * n + 1>; otherwise,
4429 it should return I<2 * n>.
4430 The sources can be added to the C<isl_access_info> by performing
4431 (at most) C<max_source> calls to C<isl_access_info_add_source>.
4432 C<must> indicates whether the source is a I<must> access
4433 or a I<may> access.  Note that a multi-valued access relation
4434 should only be marked I<must> if every iteration in the domain
4435 of the relation accesses I<all> elements in its image.
4436 The C<source_user> token is again used to identify
4437 the source access.  The range of the source access relation
4438 C<source> should have the same dimension as the range
4439 of the sink access relation.
4440 The C<isl_access_info_free> function should usually not be
4441 called explicitly, because it is called implicitly by
4442 C<isl_access_info_compute_flow>.
4443
4444 The result of the dependence analysis is collected in an
4445 C<isl_flow>.  There may be elements of
4446 the sink access for which no preceding source access could be
4447 found or for which all preceding sources are I<may> accesses.
4448 The relations containing these elements can be obtained through
4449 calls to C<isl_flow_get_no_source>, the first with C<must> set
4450 and the second with C<must> unset.
4451 In the case of standard flow dependence analysis,
4452 with the sink a read and the sources I<must> writes,
4453 the first relation corresponds to the reads from uninitialized
4454 array elements and the second relation is empty.
4455 The actual flow dependences can be extracted using
4456 C<isl_flow_foreach>.  This function will call the user-specified
4457 callback function C<fn> for each B<non-empty> dependence between
4458 a source and the sink.  The callback function is called
4459 with four arguments, the actual flow dependence relation
4460 mapping source iterations to sink iterations, a boolean that
4461 indicates whether it is a I<must> or I<may> dependence, a token
4462 identifying the source and an additional C<void *> with value
4463 equal to the third argument of the C<isl_flow_foreach> call.
4464 A dependence is marked I<must> if it originates from a I<must>
4465 source and if it is not followed by any I<may> sources.
4466
4467 After finishing with an C<isl_flow>, the user should call
4468 C<isl_flow_free> to free all associated memory.
4469
4470 A higher-level interface to dependence analysis is provided
4471 by the following function.
4472
4473         #include <isl/flow.h>
4474
4475         int isl_union_map_compute_flow(__isl_take isl_union_map *sink,
4476                 __isl_take isl_union_map *must_source,
4477                 __isl_take isl_union_map *may_source,
4478                 __isl_take isl_union_map *schedule,
4479                 __isl_give isl_union_map **must_dep,
4480                 __isl_give isl_union_map **may_dep,
4481                 __isl_give isl_union_map **must_no_source,
4482                 __isl_give isl_union_map **may_no_source);
4483
4484 The arrays are identified by the tuple names of the ranges
4485 of the accesses.  The iteration domains by the tuple names
4486 of the domains of the accesses and of the schedule.
4487 The relative order of the iteration domains is given by the
4488 schedule.  The relations returned through C<must_no_source>
4489 and C<may_no_source> are subsets of C<sink>.
4490 Any of C<must_dep>, C<may_dep>, C<must_no_source>
4491 or C<may_no_source> may be C<NULL>, but a C<NULL> value for
4492 any of the other arguments is treated as an error.
4493
4494 =head3 Interaction with Dependence Analysis
4495
4496 During the dependence analysis, we frequently need to perform
4497 the following operation.  Given a relation between sink iterations
4498 and potential source iterations from a particular source domain,
4499 what is the last potential source iteration corresponding to each
4500 sink iteration.  It can sometimes be convenient to adjust
4501 the set of potential source iterations before or after each such operation.
4502 The prototypical example is fuzzy array dataflow analysis,
4503 where we need to analyze if, based on data-dependent constraints,
4504 the sink iteration can ever be executed without one or more of
4505 the corresponding potential source iterations being executed.
4506 If so, we can introduce extra parameters and select an unknown
4507 but fixed source iteration from the potential source iterations.
4508 To be able to perform such manipulations, C<isl> provides the following
4509 function.
4510
4511         #include <isl/flow.h>
4512
4513         typedef __isl_give isl_restriction *(*isl_access_restrict)(
4514                 __isl_keep isl_map *source_map,
4515                 __isl_keep isl_set *sink, void *source_user,
4516                 void *user);
4517         __isl_give isl_access_info *isl_access_info_set_restrict(
4518                 __isl_take isl_access_info *acc,
4519                 isl_access_restrict fn, void *user);
4520
4521 The function C<isl_access_info_set_restrict> should be called
4522 before calling C<isl_access_info_compute_flow> and registers a callback function
4523 that will be called any time C<isl> is about to compute the last
4524 potential source.  The first argument is the (reverse) proto-dependence,
4525 mapping sink iterations to potential source iterations.
4526 The second argument represents the sink iterations for which
4527 we want to compute the last source iteration.
4528 The third argument is the token corresponding to the source
4529 and the final argument is the token passed to C<isl_access_info_set_restrict>.
4530 The callback is expected to return a restriction on either the input or
4531 the output of the operation computing the last potential source.
4532 If the input needs to be restricted then restrictions are needed
4533 for both the source and the sink iterations.  The sink iterations
4534 and the potential source iterations will be intersected with these sets.
4535 If the output needs to be restricted then only a restriction on the source
4536 iterations is required.
4537 If any error occurs, the callback should return C<NULL>.
4538 An C<isl_restriction> object can be created, freed and inspected
4539 using the following functions.
4540
4541         #include <isl/flow.h>
4542
4543         __isl_give isl_restriction *isl_restriction_input(
4544                 __isl_take isl_set *source_restr,
4545                 __isl_take isl_set *sink_restr);
4546         __isl_give isl_restriction *isl_restriction_output(
4547                 __isl_take isl_set *source_restr);
4548         __isl_give isl_restriction *isl_restriction_none(
4549                 __isl_take isl_map *source_map);
4550         __isl_give isl_restriction *isl_restriction_empty(
4551                 __isl_take isl_map *source_map);
4552         void *isl_restriction_free(
4553                 __isl_take isl_restriction *restr);
4554         isl_ctx *isl_restriction_get_ctx(
4555                 __isl_keep isl_restriction *restr);
4556
4557 C<isl_restriction_none> and C<isl_restriction_empty> are special
4558 cases of C<isl_restriction_input>.  C<isl_restriction_none>
4559 is essentially equivalent to
4560
4561         isl_restriction_input(isl_set_universe(
4562             isl_space_range(isl_map_get_space(source_map))),
4563                             isl_set_universe(
4564             isl_space_domain(isl_map_get_space(source_map))));
4565
4566 whereas C<isl_restriction_empty> is essentially equivalent to
4567
4568         isl_restriction_input(isl_set_empty(
4569             isl_space_range(isl_map_get_space(source_map))),
4570                             isl_set_universe(
4571             isl_space_domain(isl_map_get_space(source_map))));
4572
4573 =head2 Scheduling
4574
4575 B<The functionality described in this section is fairly new
4576 and may be subject to change.>
4577
4578 The following function can be used to compute a schedule
4579 for a union of domains.
4580 By default, the algorithm used to construct the schedule is similar
4581 to that of C<Pluto>.
4582 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
4583 be selected.
4584 The generated schedule respects all C<validity> dependences.
4585 That is, all dependence distances over these dependences in the
4586 scheduled space are lexicographically positive.
4587 The default algorithm tries to minimize the dependence distances over
4588 C<proximity> dependences.
4589 Moreover, it tries to obtain sequences (bands) of schedule dimensions
4590 for groups of domains where the dependence distances have only
4591 non-negative values.
4592 When using Feautrier's algorithm, the C<proximity> dependence
4593 distances are only minimized during the extension to a
4594 full-dimensional schedule.
4595
4596         #include <isl/schedule.h>
4597         __isl_give isl_schedule *isl_union_set_compute_schedule(
4598                 __isl_take isl_union_set *domain,
4599                 __isl_take isl_union_map *validity,
4600                 __isl_take isl_union_map *proximity);
4601         void *isl_schedule_free(__isl_take isl_schedule *sched);
4602
4603 A mapping from the domains to the scheduled space can be obtained
4604 from an C<isl_schedule> using the following function.
4605
4606         __isl_give isl_union_map *isl_schedule_get_map(
4607                 __isl_keep isl_schedule *sched);
4608
4609 A representation of the schedule can be printed using
4610          
4611         __isl_give isl_printer *isl_printer_print_schedule(
4612                 __isl_take isl_printer *p,
4613                 __isl_keep isl_schedule *schedule);
4614
4615 A representation of the schedule as a forest of bands can be obtained
4616 using the following function.
4617
4618         __isl_give isl_band_list *isl_schedule_get_band_forest(
4619                 __isl_keep isl_schedule *schedule);
4620
4621 The individual bands can be visited in depth-first post-order
4622 using the following function.
4623
4624         #include <isl/schedule.h>
4625         int isl_schedule_foreach_band(
4626                 __isl_keep isl_schedule *sched,
4627                 int (*fn)(__isl_keep isl_band *band, void *user),
4628                 void *user);
4629
4630 The list can be manipulated as explained in L<"Lists">.
4631 The bands inside the list can be copied and freed using the following
4632 functions.
4633
4634         #include <isl/band.h>
4635         __isl_give isl_band *isl_band_copy(
4636                 __isl_keep isl_band *band);
4637         void *isl_band_free(__isl_take isl_band *band);
4638
4639 Each band contains zero or more scheduling dimensions.
4640 These are referred to as the members of the band.
4641 The section of the schedule that corresponds to the band is
4642 referred to as the partial schedule of the band.
4643 For those nodes that participate in a band, the outer scheduling
4644 dimensions form the prefix schedule, while the inner scheduling
4645 dimensions form the suffix schedule.
4646 That is, if we take a cut of the band forest, then the union of
4647 the concatenations of the prefix, partial and suffix schedules of
4648 each band in the cut is equal to the entire schedule (modulo
4649 some possible padding at the end with zero scheduling dimensions).
4650 The properties of a band can be inspected using the following functions.
4651
4652         #include <isl/band.h>
4653         isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band);
4654
4655         int isl_band_has_children(__isl_keep isl_band *band);
4656         __isl_give isl_band_list *isl_band_get_children(
4657                 __isl_keep isl_band *band);
4658
4659         __isl_give isl_union_map *isl_band_get_prefix_schedule(
4660                 __isl_keep isl_band *band);
4661         __isl_give isl_union_map *isl_band_get_partial_schedule(
4662                 __isl_keep isl_band *band);
4663         __isl_give isl_union_map *isl_band_get_suffix_schedule(
4664                 __isl_keep isl_band *band);
4665
4666         int isl_band_n_member(__isl_keep isl_band *band);
4667         int isl_band_member_is_zero_distance(
4668                 __isl_keep isl_band *band, int pos);
4669
4670         int isl_band_list_foreach_band(
4671                 __isl_keep isl_band_list *list,
4672                 int (*fn)(__isl_keep isl_band *band, void *user),
4673                 void *user);
4674
4675 Note that a scheduling dimension is considered to be ``zero
4676 distance'' if it does not carry any proximity dependences
4677 within its band.
4678 That is, if the dependence distances of the proximity
4679 dependences are all zero in that direction (for fixed
4680 iterations of outer bands).
4681 Like C<isl_schedule_foreach_band>,
4682 the function C<isl_band_list_foreach_band> calls C<fn> on the bands
4683 in depth-first post-order.
4684
4685 A band can be tiled using the following function.
4686
4687         #include <isl/band.h>
4688         int isl_band_tile(__isl_keep isl_band *band,
4689                 __isl_take isl_vec *sizes);
4690
4691         int isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
4692                 int val);
4693         int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
4694
4695 The C<isl_band_tile> function tiles the band using the given tile sizes
4696 inside its schedule.
4697 A new child band is created to represent the point loops and it is
4698 inserted between the modified band and its children.
4699 The C<tile_scale_tile_loops> option specifies whether the tile
4700 loops iterators should be scaled by the tile sizes.
4701
4702 A representation of the band can be printed using
4703
4704         #include <isl/band.h>
4705         __isl_give isl_printer *isl_printer_print_band(
4706                 __isl_take isl_printer *p,
4707                 __isl_keep isl_band *band);
4708
4709 =head3 Options
4710
4711         #include <isl/schedule.h>
4712         int isl_options_set_schedule_max_coefficient(
4713                 isl_ctx *ctx, int val);
4714         int isl_options_get_schedule_max_coefficient(
4715                 isl_ctx *ctx);
4716         int isl_options_set_schedule_max_constant_term(
4717                 isl_ctx *ctx, int val);
4718         int isl_options_get_schedule_max_constant_term(
4719                 isl_ctx *ctx);
4720         int isl_options_set_schedule_fuse(isl_ctx *ctx, int val);
4721         int isl_options_get_schedule_fuse(isl_ctx *ctx);
4722         int isl_options_set_schedule_maximize_band_depth(
4723                 isl_ctx *ctx, int val);
4724         int isl_options_get_schedule_maximize_band_depth(
4725                 isl_ctx *ctx);
4726         int isl_options_set_schedule_outer_zero_distance(
4727                 isl_ctx *ctx, int val);
4728         int isl_options_get_schedule_outer_zero_distance(
4729                 isl_ctx *ctx);
4730         int isl_options_set_schedule_split_scaled(
4731                 isl_ctx *ctx, int val);
4732         int isl_options_get_schedule_split_scaled(
4733                 isl_ctx *ctx);
4734         int isl_options_set_schedule_algorithm(
4735                 isl_ctx *ctx, int val);
4736         int isl_options_get_schedule_algorithm(
4737                 isl_ctx *ctx);
4738         int isl_options_set_schedule_separate_components(
4739                 isl_ctx *ctx, int val);
4740         int isl_options_get_schedule_separate_components(
4741                 isl_ctx *ctx);
4742
4743 =over
4744
4745 =item * schedule_max_coefficient
4746
4747 This option enforces that the coefficients for variable and parameter
4748 dimensions in the calculated schedule are not larger than the specified value.
4749 This option can significantly increase the speed of the scheduling calculation
4750 and may also prevent fusing of unrelated dimensions. A value of -1 means that
4751 this option does not introduce bounds on the variable or parameter
4752 coefficients.
4753
4754 =item * schedule_max_constant_term
4755
4756 This option enforces that the constant coefficients in the calculated schedule
4757 are not larger than the maximal constant term. This option can significantly
4758 increase the speed of the scheduling calculation and may also prevent fusing of
4759 unrelated dimensions. A value of -1 means that this option does not introduce
4760 bounds on the constant coefficients.
4761
4762 =item * schedule_fuse
4763
4764 This option controls the level of fusion.
4765 If this option is set to C<ISL_SCHEDULE_FUSE_MIN>, then loops in the
4766 resulting schedule will be distributed as much as possible.
4767 If this option is set to C<ISL_SCHEDULE_FUSE_MAX>, then C<isl> will
4768 try to fuse loops in the resulting schedule.
4769
4770 =item * schedule_maximize_band_depth
4771
4772 If this option is set, we do not split bands at the point
4773 where we detect splitting is necessary. Instead, we
4774 backtrack and split bands as early as possible. This
4775 reduces the number of splits and maximizes the width of
4776 the bands. Wider bands give more possibilities for tiling.
4777 Note that if the C<schedule_fuse> option is set to C<ISL_SCHEDULE_FUSE_MIN>,
4778 then bands will be split as early as possible, even if there is no need.
4779 The C<schedule_maximize_band_depth> option therefore has no effect in this case.
4780
4781 =item * schedule_outer_zero_distance
4782
4783 If this option is set, then we try to construct schedules
4784 where the outermost scheduling dimension in each band
4785 results in a zero dependence distance over the proximity
4786 dependences.
4787
4788 =item * schedule_split_scaled
4789
4790 If this option is set, then we try to construct schedules in which the
4791 constant term is split off from the linear part if the linear parts of
4792 the scheduling rows for all nodes in the graphs have a common non-trivial
4793 divisor.
4794 The constant term is then placed in a separate band and the linear
4795 part is reduced.
4796
4797 =item * schedule_algorithm
4798
4799 Selects the scheduling algorithm to be used.
4800 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
4801 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
4802
4803 =item * schedule_separate_components
4804
4805 If at any point the dependence graph contains any (weakly connected) components,
4806 then these components are scheduled separately.
4807 If this option is not set, then some iterations of the domains
4808 in these components may be scheduled together.
4809 If this option is set, then the components are given consecutive
4810 schedules.
4811
4812 =back
4813
4814 =head2 Parametric Vertex Enumeration
4815
4816 The parametric vertex enumeration described in this section
4817 is mainly intended to be used internally and by the C<barvinok>
4818 library.
4819
4820         #include <isl/vertices.h>
4821         __isl_give isl_vertices *isl_basic_set_compute_vertices(
4822                 __isl_keep isl_basic_set *bset);
4823
4824 The function C<isl_basic_set_compute_vertices> performs the
4825 actual computation of the parametric vertices and the chamber
4826 decomposition and store the result in an C<isl_vertices> object.
4827 This information can be queried by either iterating over all
4828 the vertices or iterating over all the chambers or cells
4829 and then iterating over all vertices that are active on the chamber.
4830
4831         int isl_vertices_foreach_vertex(
4832                 __isl_keep isl_vertices *vertices,
4833                 int (*fn)(__isl_take isl_vertex *vertex, void *user),
4834                 void *user);
4835
4836         int isl_vertices_foreach_cell(
4837                 __isl_keep isl_vertices *vertices,
4838                 int (*fn)(__isl_take isl_cell *cell, void *user),
4839                 void *user);
4840         int isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
4841                 int (*fn)(__isl_take isl_vertex *vertex, void *user),
4842                 void *user);
4843
4844 Other operations that can be performed on an C<isl_vertices> object are
4845 the following.
4846
4847         isl_ctx *isl_vertices_get_ctx(
4848                 __isl_keep isl_vertices *vertices);
4849         int isl_vertices_get_n_vertices(
4850                 __isl_keep isl_vertices *vertices);
4851         void isl_vertices_free(__isl_take isl_vertices *vertices);
4852
4853 Vertices can be inspected and destroyed using the following functions.
4854
4855         isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
4856         int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
4857         __isl_give isl_basic_set *isl_vertex_get_domain(
4858                 __isl_keep isl_vertex *vertex);
4859         __isl_give isl_basic_set *isl_vertex_get_expr(
4860                 __isl_keep isl_vertex *vertex);
4861         void isl_vertex_free(__isl_take isl_vertex *vertex);
4862
4863 C<isl_vertex_get_expr> returns a singleton parametric set describing
4864 the vertex, while C<isl_vertex_get_domain> returns the activity domain
4865 of the vertex.
4866 Note that C<isl_vertex_get_domain> and C<isl_vertex_get_expr> return
4867 B<rational> basic sets, so they should mainly be used for inspection
4868 and should not be mixed with integer sets.
4869
4870 Chambers can be inspected and destroyed using the following functions.
4871
4872         isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
4873         __isl_give isl_basic_set *isl_cell_get_domain(
4874                 __isl_keep isl_cell *cell);
4875         void isl_cell_free(__isl_take isl_cell *cell);
4876
4877 =head1 Applications
4878
4879 Although C<isl> is mainly meant to be used as a library,
4880 it also contains some basic applications that use some
4881 of the functionality of C<isl>.
4882 The input may be specified in either the L<isl format>
4883 or the L<PolyLib format>.
4884
4885 =head2 C<isl_polyhedron_sample>
4886
4887 C<isl_polyhedron_sample> takes a polyhedron as input and prints
4888 an integer element of the polyhedron, if there is any.
4889 The first column in the output is the denominator and is always
4890 equal to 1.  If the polyhedron contains no integer points,
4891 then a vector of length zero is printed.
4892
4893 =head2 C<isl_pip>
4894
4895 C<isl_pip> takes the same input as the C<example> program
4896 from the C<piplib> distribution, i.e., a set of constraints
4897 on the parameters, a line containing only -1 and finally a set
4898 of constraints on a parametric polyhedron.
4899 The coefficients of the parameters appear in the last columns
4900 (but before the final constant column).
4901 The output is the lexicographic minimum of the parametric polyhedron.
4902 As C<isl> currently does not have its own output format, the output
4903 is just a dump of the internal state.
4904
4905 =head2 C<isl_polyhedron_minimize>
4906
4907 C<isl_polyhedron_minimize> computes the minimum of some linear
4908 or affine objective function over the integer points in a polyhedron.
4909 If an affine objective function
4910 is given, then the constant should appear in the last column.
4911
4912 =head2 C<isl_polytope_scan>
4913
4914 Given a polytope, C<isl_polytope_scan> prints
4915 all integer points in the polytope.