1=head1 Introduction
2
3C<isl> is a thread-safe C library for manipulating
4sets and relations of integer points bounded by affine constraints.
5The descriptions of the sets and relations may involve
6both parameters and existentially quantified variables.
7All computations are performed in exact integer arithmetic
8using C<GMP> or C<imath>.
9The C<isl> library offers functionality that is similar
10to that offered by the C<Omega> and C<Omega+> libraries,
11but the underlying algorithms are in most cases completely different.
12
13The library is by no means complete and some fairly basic
14functionality is still missing.
15Still, even in its current form, the library has been successfully
16used as a backend polyhedral library for the polyhedral
17scanner C<CLooG> and as part of an equivalence checker of
18static affine programs.
19For bug reports, feature requests and questions,
20visit the discussion group at
21L<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
30and replaced by C<isl_printer> functions, see L<Input and Output>.
31
32=item * Most functions related to dependence analysis have acquired
33an extra C<must> argument.  To obtain the old behavior, this argument
34should 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
43renamed to C<isl_pw_qpolynomial_fold_fold>.
44Similarly, C<isl_union_pw_qpolynomial_fold_add> has been
45renamed 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>
54to 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
63C<isl_printer_print_basic_map> no longer print a newline.
64
65=item * The functions C<isl_flow_get_no_source>
66and C<isl_union_map_compute_flow> now return
67the accesses for which no source could be found instead of
68the iterations where those accesses occur.
69
70=item * The functions C<isl_basic_map_identity> and
71C<isl_map_identity> now take a B<map> space as input.  An old call
72C<isl_map_identity(space)> can be rewritten to
73C<isl_map_identity(isl_space_map_from_set(space))>.
74
75=item * The function C<isl_map_power> no longer takes
76a parameter position as input.  Instead, the exponent
77is 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
86C<ISL_FORMAT_ISL> output has changed.
87Use C<ISL_FORMAT_C> to obtain the old output.
88
89=item * The C<*_fast_*> functions have been renamed to C<*_plain_*>.
90Some of the old names have been kept for backward compatibility,
91but 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
100C<isl_pw_aff_union_max>.
101Similarly, the function C<isl_pw_aff_add> has been renamed to
102C<isl_pw_aff_union_add>.
103
104=item * The C<isl_dim> type has been renamed to C<isl_space>
105along with the associated functions.
106Some of the old names have been kept for backward compatibility,
107but they will be removed in the future.
108
109=item * Spaces of maps, sets and parameter domains are now
110treated differently.  The distinction between map spaces and set spaces
111has always been made on a conceptual level, but proper use of such spaces
112was never checked.  Furthermore, up until isl-0.07 there was no way
113of explicitly creating a parameter space.  These can now be created
114directly using C<isl_space_params_alloc> or from other spaces using
115C<isl_space_params>.
116
117=item * The space in which C<isl_aff>, C<isl_pw_aff>, C<isl_qpolynomial>,
118C<isl_pw_qpolynomial>, C<isl_qpolynomial_fold> and C<isl_pw_qpolynomial_fold>
119objects live is now a map space
120instead of a set space.  This means, for example, that the dimensions
121of the domain of an C<isl_aff> are now considered to be of type
122C<isl_dim_in> instead of C<isl_dim_set>.  Extra functions have been
123added to obtain the domain space.  Some of the constructors still
124take a domain space and have therefore been renamed.
125
126=item * The functions C<isl_equality_alloc> and C<isl_inequality_alloc>
127now take an C<isl_local_space> instead of an C<isl_space>.
128An C<isl_local_space> can be created from an C<isl_space>
129using C<isl_local_space_from_space>.
130
131=item * The C<isl_div> type has been removed.  Functions that used
132to return an C<isl_div> now return an C<isl_aff>.
133Note that the space of an C<isl_aff> is that of relation.
134When replacing a call to C<isl_div_get_coefficient> by a call to
135C<isl_aff_get_coefficient> any C<isl_dim_set> argument needs
136to be replaced by C<isl_dim_in>.
137A call to C<isl_aff_from_div> can be replaced by a call
138to C<isl_aff_floor>.
139A call to C<isl_qpolynomial_div(div)> call be replaced by
140the nested call
141
142	isl_qpolynomial_from_aff(isl_aff_floor(div))
143
144The function C<isl_constraint_div> has also been renamed
145to C<isl_constraint_get_div>.
146
147=item * The C<nparam> argument has been removed from
148C<isl_map_read_from_str> and similar functions.
149When reading input in the original PolyLib format,
150the result will have no parameters.
151If parameters are expected, the caller may want to perform
152dimension 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
161by the C<schedule_split_scaled> option.
162
163=item * The first argument of C<isl_pw_aff_cond> is now
164an C<isl_pw_aff> instead of an C<isl_set>.
165A 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=head3 Changes since isl-0.10
172
173=over
174
175=item * The functions C<isl_set_dim_has_lower_bound> and
176C<isl_set_dim_has_upper_bound> have been renamed to
177C<isl_set_dim_has_any_lower_bound> and
178C<isl_set_dim_has_any_upper_bound>.
179The new C<isl_set_dim_has_lower_bound> and
180C<isl_set_dim_has_upper_bound> have slightly different meanings.
181
182=back
183
184=head3 Changes since isl-0.12
185
186=over
187
188=item * C<isl_int> has been replaced by C<isl_val>.
189Some of the old functions are still available in C<isl/deprecated/*.h>
190but they will be removed in the future.
191
192=item * The functions C<isl_pw_qpolynomial_eval>,
193C<isl_union_pw_qpolynomial_eval>, C<isl_pw_qpolynomial_fold_eval>
194and C<isl_union_pw_qpolynomial_fold_eval> have been changed to return
195an C<isl_val> instead of an C<isl_qpolynomial>.
196
197=item * The function C<isl_band_member_is_zero_distance>
198has been removed.  Essentially the same functionality is available
199through C<isl_band_member_is_coincident>, except that it requires
200setting up coincidence constraints.
201The option C<schedule_outer_zero_distance> has accordingly been
202replaced by the option C<schedule_outer_coincidence>.
203
204=item * The function C<isl_vertex_get_expr> has been changed
205to return an C<isl_multi_aff> instead of a rational C<isl_basic_set>.
206The function C<isl_vertex_get_domain> has been changed to return
207a regular basic set, rather than a rational basic set.
208
209=back
210
211=head3 Changes since isl-0.14
212
213=over
214
215=item * The function C<isl_union_pw_multi_aff_add> now consistently
216computes the sum on the shared definition domain.
217The function C<isl_union_pw_multi_aff_union_add> has been added
218to compute the sum on the union of definition domains.
219The original behavior of C<isl_union_pw_multi_aff_add> was
220confused and is no longer available.
221
222=item * Band forests have been replaced by schedule trees.
223
224=item * The function C<isl_union_map_compute_flow> has been
225replaced by the function C<isl_union_access_info_compute_flow>.
226Note that the may dependence relation returned by
227C<isl_union_flow_get_may_dependence> is the union of
228the two dependence relations returned by
229C<isl_union_map_compute_flow>.  Similarly for the no source relations.
230The function C<isl_union_map_compute_flow> is still available
231for backward compatibility, but it will be removed in the future.
232
233=item * The function C<isl_basic_set_drop_constraint> has been
234deprecated.
235
236=item * The function C<isl_ast_build_ast_from_schedule> has been
237renamed to C<isl_ast_build_node_from_schedule_map>.
238The original name is still available
239for backward compatibility, but it will be removed in the future.
240
241=item * The C<separation_class> AST generation option has been
242deprecated.
243
244=item * The functions C<isl_equality_alloc> and C<isl_inequality_alloc>
245have been renamed to C<isl_constraint_alloc_equality> and
246C<isl_constraint_alloc_inequality>.  The original names have been
247kept for backward compatibility, but they will be removed in the future.
248
249=item * The C<schedule_fuse> option has been replaced
250by the C<schedule_serialize_sccs> option.  The effect
251of setting the C<schedule_fuse> option to C<ISL_SCHEDULE_FUSE_MIN>
252is now obtained by turning on the C<schedule_serialize_sccs> option.
253
254=back
255
256=head3 Changes since isl-0.17
257
258=over
259
260=item * The function C<isl_printer_print_ast_expr> no longer prints
261in C format by default.  To print in C format, the output format
262of the printer needs to have been explicitly set to C<ISL_FORMAT_C>.
263As a result, the function C<isl_ast_expr_to_str> no longer prints
264the expression in C format.  Use C<isl_ast_expr_to_C_str> instead.
265
266=item * The functions C<isl_set_align_divs> and C<isl_map_align_divs>
267have been deprecated.  The function C<isl_set_lift> has an effect
268that is similar to C<isl_set_align_divs> and could in some cases
269be used as an alternative.
270
271=back
272
273=head3 Changes since isl-0.19
274
275=over
276
277=item * Zero-dimensional objects of type C<isl_multi_pw_aff> or
278C<isl_multi_union_pw_aff> can now keep track of an explicit domain.
279This explicit domain, if present, is taken into account
280by various operations that take such objects as input.
281
282=back
283
284=head3 Changes since isl-0.20
285
286=over
287
288=item * Several functions that used to return C<unsigned>
289now return C<isl_size>.  This means that these functions may
290now return a negative value in case an error occurred.
291The same holds for functions that used to return C<int>,
292although some of those were already returning
293a negative value in case of error.
294
295=item * The C<isl_ast_op_type> enumeration type has been
296renamed to C<isl_ast_expr_op_type>.  The corresponding
297enumeration constants have been similarly renamed.
298The old names are defined to the new names for backward
299compatibility.
300
301=item * Several functions returning an extra boolean value
302through an C<int *> argument now do so through an C<isl_bool *>
303argument.  The returned values are the same, only the type
304of the pointer has been changed.
305
306=back
307
308=head1 License
309
310C<isl> is released under the MIT license.
311
312=over
313
314Permission is hereby granted, free of charge, to any person obtaining a copy of
315this software and associated documentation files (the "Software"), to deal in
316the Software without restriction, including without limitation the rights to
317use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
318of the Software, and to permit persons to whom the Software is furnished to do
319so, subject to the following conditions:
320
321The above copyright notice and this permission notice shall be included in all
322copies or substantial portions of the Software.
323
324THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
325IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
326FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
327AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
328LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
329OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
330SOFTWARE.
331
332=back
333
334Note that by default C<isl> requires C<GMP>, which is released
335under the GNU Lesser General Public License (LGPL).  This means
336that code linked against C<isl> is also linked against LGPL code.
337
338When configuring with C<--with-int=imath> or C<--with-int=imath-32>, C<isl>
339will link against C<imath>, a library for exact integer arithmetic released
340under the MIT license.
341
342=head1 Installation
343
344The source of C<isl> can be obtained either as a tarball
345or from the git repository.  Both are available from
346L<http://isl.gforge.inria.fr/>.
347The installation process depends on how you obtained
348the source.
349
350=head2 Installation from the git repository
351
352=over
353
354=item 1 Clone or update the repository
355
356The first time the source is obtained, you need to clone
357the repository.
358
359	git clone git://repo.or.cz/isl.git
360
361To obtain updates, you need to pull in the latest changes
362
363	git pull
364
365=item 2 Optionally get C<imath> submodule
366
367To build C<isl> with C<imath>, you need to obtain the C<imath>
368submodule by running in the git source tree of C<isl>
369
370       git submodule init
371       git submodule update
372
373This will fetch the required version of C<imath> in a subdirectory of C<isl>.
374
375=item 2 Generate C<configure>
376
377	./autogen.sh
378
379=back
380
381After performing the above steps, continue
382with the L<Common installation instructions>.
383
384=head2 Common installation instructions
385
386=over
387
388=item 1 Obtain C<GMP>
389
390By default, building C<isl> requires C<GMP>, including its headers files.
391Your distribution may not provide these header files by default
392and you may need to install a package called C<gmp-devel> or something
393similar.  Alternatively, C<GMP> can be built from
394source, available from L<http://gmplib.org/>.
395C<GMP> is not needed if you build C<isl> with C<imath>.
396
397=item 2 Configure
398
399C<isl> uses the standard C<autoconf> C<configure> script.
400To run it, just type
401
402	./configure
403
404optionally followed by some configure options.
405A complete list of options can be obtained by running
406
407	./configure --help
408
409Below we discuss some of the more common options.
410
411=over
412
413=item C<--prefix>
414
415Installation prefix for C<isl>
416
417=item C<--with-int=[gmp|imath|imath-32]>
418
419Select the integer library to be used by C<isl>, the default is C<gmp>.
420With C<imath-32>, C<isl> will use 32 bit integers, but fall back to C<imath>
421for values out of the 32 bit range. In most applications, C<isl> will run
422fastest with the C<imath-32> option, followed by C<gmp> and C<imath>, the
423slowest.
424
425=item C<--with-gmp-prefix>
426
427Installation prefix for C<GMP> (architecture-independent files).
428
429=item C<--with-gmp-exec-prefix>
430
431Installation prefix for C<GMP> (architecture-dependent files).
432
433=back
434
435=item 3 Compile
436
437	make
438
439=item 4 Install (optional)
440
441	make install
442
443=back
444
445=head1 Integer Set Library
446
447=head2 Memory Management
448
449Since a high-level operation on isl objects usually involves
450several substeps and since the user is usually not interested in
451the intermediate results, most functions that return a new object
452will also release all the objects passed as arguments.
453If the user still wants to use one or more of these arguments
454after the function call, she should pass along a copy of the
455object rather than the object itself.
456The user is then responsible for making sure that the original
457object gets used somewhere else or is explicitly freed.
458
459The arguments and return values of all documented functions are
460annotated to make clear which arguments are released and which
461arguments are preserved.  In particular, the following annotations
462are used
463
464=over
465
466=item C<__isl_give>
467
468C<__isl_give> means that a new object is returned.
469The user should make sure that the returned pointer is
470used exactly once as a value for an C<__isl_take> argument.
471In between, it can be used as a value for as many
472C<__isl_keep> arguments as the user likes.
473There is one exception, and that is the case where the
474pointer returned is C<NULL>.  In this case, the user
475is free to use it as an C<__isl_take> argument or not.
476When applied to a C<char *>, the returned pointer needs to be
477freed using C<free>.
478
479=item C<__isl_null>
480
481C<__isl_null> means that a C<NULL> value is returned.
482
483=item C<__isl_take>
484
485C<__isl_take> means that the object the argument points to
486is taken over by the function and may no longer be used
487by the user as an argument to any other function.
488The pointer value must be one returned by a function
489returning an C<__isl_give> pointer.
490If the user passes in a C<NULL> value, then this will
491be treated as an error in the sense that the function will
492not perform its usual operation.  However, it will still
493make sure that all the other C<__isl_take> arguments
494are released.
495
496=item C<__isl_keep>
497
498C<__isl_keep> means that the function will only use the object
499temporarily.  After the function has finished, the user
500can still use it as an argument to other functions.
501A C<NULL> value will be treated in the same way as
502a C<NULL> value for an C<__isl_take> argument.
503This annotation may also be used on return values of
504type C<const char *>, in which case the returned pointer should
505not be freed by the user and is only valid until the object
506from which it was derived is updated or freed.
507
508=back
509
510=head2 Initialization
511
512All manipulations of integer sets and relations occur within
513the context of an C<isl_ctx>.
514A given C<isl_ctx> can only be used within a single thread.
515All arguments of a function are required to have been allocated
516within the same context.
517There are currently no functions available for moving an object
518from one C<isl_ctx> to another C<isl_ctx>.  This means that
519there is currently no way of safely moving an object from one
520thread to another, unless the whole C<isl_ctx> is moved.
521
522An C<isl_ctx> can be allocated using C<isl_ctx_alloc> and
523freed using C<isl_ctx_free>.
524All objects allocated within an C<isl_ctx> should be freed
525before the C<isl_ctx> itself is freed.
526
527	isl_ctx *isl_ctx_alloc();
528	void isl_ctx_free(isl_ctx *ctx);
529
530The user can impose a bound on the number of low-level I<operations>
531that can be performed by an C<isl_ctx>.  This bound can be set and
532retrieved using the following functions.  A bound of zero means that
533no bound is imposed.  The number of operations performed can be
534reset using C<isl_ctx_reset_operations>.  Note that the number
535of low-level operations needed to perform a high-level computation
536may differ significantly across different versions
537of C<isl>, but it should be the same across different platforms
538for the same version of C<isl>.
539
540Warning: This feature is experimental.  C<isl> has good support to abort and
541bail out during the computation, but this feature may exercise error code paths
542that are normally not used that much. Consequently, it is not unlikely that
543hidden bugs will be exposed.
544
545	void isl_ctx_set_max_operations(isl_ctx *ctx,
546		unsigned long max_operations);
547	unsigned long isl_ctx_get_max_operations(isl_ctx *ctx);
548	void isl_ctx_reset_operations(isl_ctx *ctx);
549
550In order to be able to create an object in the same context
551as another object, most object types (described later in
552this document) provide a function to obtain the context
553in which the object was created.
554
555	#include <isl/val.h>
556	isl_ctx *isl_val_get_ctx(__isl_keep isl_val *val);
557	isl_ctx *isl_multi_val_get_ctx(
558		__isl_keep isl_multi_val *mv);
559
560	#include <isl/id.h>
561	isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
562	isl_ctx *isl_multi_id_get_ctx(
563		__isl_keep isl_multi_id *mi);
564
565	#include <isl/local_space.h>
566	isl_ctx *isl_local_space_get_ctx(
567		__isl_keep isl_local_space *ls);
568
569	#include <isl/set.h>
570	isl_ctx *isl_set_list_get_ctx(
571		__isl_keep isl_set_list *list);
572
573	#include <isl/aff.h>
574	isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
575	isl_ctx *isl_multi_aff_get_ctx(
576		__isl_keep isl_multi_aff *maff);
577	isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pa);
578	isl_ctx *isl_pw_multi_aff_get_ctx(
579		__isl_keep isl_pw_multi_aff *pma);
580	isl_ctx *isl_multi_pw_aff_get_ctx(
581		__isl_keep isl_multi_pw_aff *mpa);
582	isl_ctx *isl_union_pw_aff_get_ctx(
583		__isl_keep isl_union_pw_aff *upa);
584	isl_ctx *isl_union_pw_multi_aff_get_ctx(
585		__isl_keep isl_union_pw_multi_aff *upma);
586	isl_ctx *isl_multi_union_pw_aff_get_ctx(
587		__isl_keep isl_multi_union_pw_aff *mupa);
588
589	#include <isl/id_to_ast_expr.h>
590	isl_ctx *isl_id_to_ast_expr_get_ctx(
591		__isl_keep isl_id_to_ast_expr *id2expr);
592
593	#include <isl/point.h>
594	isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
595
596	#include <isl/vec.h>
597	isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
598
599	#include <isl/mat.h>
600	isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
601
602	#include <isl/vertices.h>
603	isl_ctx *isl_vertices_get_ctx(
604		__isl_keep isl_vertices *vertices);
605	isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
606	isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
607
608	#include <isl/flow.h>
609	isl_ctx *isl_restriction_get_ctx(
610		__isl_keep isl_restriction *restr);
611	isl_ctx *isl_union_access_info_get_ctx(
612		__isl_keep isl_union_access_info *access);
613	isl_ctx *isl_union_flow_get_ctx(
614		__isl_keep isl_union_flow *flow);
615
616	#include <isl/schedule.h>
617	isl_ctx *isl_schedule_get_ctx(
618		__isl_keep isl_schedule *sched);
619	isl_ctx *isl_schedule_constraints_get_ctx(
620		__isl_keep isl_schedule_constraints *sc);
621
622	#include <isl/schedule_node.h>
623	isl_ctx *isl_schedule_node_get_ctx(
624		__isl_keep isl_schedule_node *node);
625
626	#include <isl/ast_build.h>
627	isl_ctx *isl_ast_build_get_ctx(
628		__isl_keep isl_ast_build *build);
629
630	#include <isl/ast.h>
631	isl_ctx *isl_ast_expr_get_ctx(
632		__isl_keep isl_ast_expr *expr);
633	isl_ctx *isl_ast_node_get_ctx(
634		__isl_keep isl_ast_node *node);
635
636	#include <isl/stride_info.h>
637	isl_ctx *isl_stride_info_get_ctx(
638		__isl_keep isl_stride_info *si);
639
640	#include <isl/fixed_box.h>
641	isl_ctx *isl_fixed_box_get_ctx(
642		__isl_keep isl_fixed_box *box);
643
644=head2 Return Types
645
646C<isl> uses the special return type C<isl_size> for functions
647that return a non-negative value, typically a number or a position.
648Besides the regular non-negative return values, a special (negative)
649value C<isl_size_error> may be returned, indicating that something
650went wrong.
651
652C<isl> also uses two special return types for functions that either return
653a boolean or that in principle do not return anything.
654In particular, the C<isl_bool> type has three possible values:
655C<isl_bool_true> (a positive integer value), indicating I<true> or I<yes>;
656C<isl_bool_false> (the integer value zero), indicating I<false> or I<no>; and
657C<isl_bool_error> (a negative integer value), indicating that something
658went wrong.  The following operations are defined on C<isl_bool>. The function
659C<isl_bool_not> can be used to negate an C<isl_bool>, where the negation of
660C<isl_bool_error> is C<isl_bool_error> again. The function C<isl_bool_ok>
661converts an integer to an C<isl_bool>. Any non-zero values yields
662C<isl_bool_true> and zero yields C<isl_bool_false>.
663
664	#include <isl/ctx.h>
665	isl_bool isl_bool_not(isl_bool b);
666	isl_bool isl_bool_ok(int b);
667
668The C<isl_stat> type has two possible values:
669C<isl_stat_ok> (the integer value zero), indicating a successful
670operation; and
671C<isl_stat_error> (a negative integer value), indicating that something
672went wrong.
673The function C<isl_stat_non_null> converts an isl object pointer
674to an C<isl_stat>, returning C<isl_stat_ok> if the object pointer is valid and
675C<isl_stat_error> if it is C<NULL>.
676
677	#include <isl/ctx.h>
678	isl_stat isl_stat_non_null(void *obj);
679
680See L</"Error Handling"> for more information on
681C<isl_size_error>, C<isl_bool_error> and C<isl_stat_error>.
682
683=head2 Values
684
685An C<isl_val> represents an integer value, a rational value
686or one of three special values, infinity, negative infinity and NaN.
687Some predefined values can be created using the following functions.
688
689	#include <isl/val.h>
690	__isl_give isl_val *isl_val_zero(isl_ctx *ctx);
691	__isl_give isl_val *isl_val_one(isl_ctx *ctx);
692	__isl_give isl_val *isl_val_negone(isl_ctx *ctx);
693	__isl_give isl_val *isl_val_nan(isl_ctx *ctx);
694	__isl_give isl_val *isl_val_infty(isl_ctx *ctx);
695	__isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
696
697Specific integer values can be created using the following functions.
698
699	#include <isl/val.h>
700	__isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
701		long i);
702	__isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
703		unsigned long u);
704	__isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
705		size_t n, size_t size, const void *chunks);
706
707The function C<isl_val_int_from_chunks> constructs an C<isl_val>
708from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
709The least significant digit is assumed to be stored first.
710
711Value objects can be copied and freed using the following functions.
712
713	#include <isl/val.h>
714	__isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
715	__isl_null isl_val *isl_val_free(__isl_take isl_val *v);
716
717They can be inspected using the following functions.
718
719	#include <isl/val.h>
720	long isl_val_get_num_si(__isl_keep isl_val *v);
721	long isl_val_get_den_si(__isl_keep isl_val *v);
722	__isl_give isl_val *isl_val_get_den_val(
723		__isl_keep isl_val *v);
724	double isl_val_get_d(__isl_keep isl_val *v);
725	isl_size isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
726		size_t size);
727	isl_stat isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
728		size_t size, void *chunks);
729
730C<isl_val_n_abs_num_chunks> returns the number of I<digits>
731of C<size> bytes needed to store the absolute value of the
732numerator of C<v>.
733C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
734which is assumed to have been preallocated by the caller.
735The least significant digit is stored first.
736Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
737C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
738and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
739
740An C<isl_val> can be modified using the following function.
741
742	#include <isl/val.h>
743	__isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
744		long i);
745
746The following unary properties are defined on C<isl_val>s.
747
748	#include <isl/val.h>
749	int isl_val_sgn(__isl_keep isl_val *v);
750	isl_bool isl_val_is_zero(__isl_keep isl_val *v);
751	isl_bool isl_val_is_one(__isl_keep isl_val *v);
752	isl_bool isl_val_is_negone(__isl_keep isl_val *v);
753	isl_bool isl_val_is_nonneg(__isl_keep isl_val *v);
754	isl_bool isl_val_is_nonpos(__isl_keep isl_val *v);
755	isl_bool isl_val_is_pos(__isl_keep isl_val *v);
756	isl_bool isl_val_is_neg(__isl_keep isl_val *v);
757	isl_bool isl_val_is_int(__isl_keep isl_val *v);
758	isl_bool isl_val_is_rat(__isl_keep isl_val *v);
759	isl_bool isl_val_is_nan(__isl_keep isl_val *v);
760	isl_bool isl_val_is_infty(__isl_keep isl_val *v);
761	isl_bool isl_val_is_neginfty(__isl_keep isl_val *v);
762
763Note that the sign of NaN is undefined.
764
765The following binary properties are defined on pairs of C<isl_val>s.
766
767	#include <isl/val.h>
768	isl_bool isl_val_lt(__isl_keep isl_val *v1,
769		__isl_keep isl_val *v2);
770	isl_bool isl_val_le(__isl_keep isl_val *v1,
771		__isl_keep isl_val *v2);
772	isl_bool isl_val_gt(__isl_keep isl_val *v1,
773		__isl_keep isl_val *v2);
774	isl_bool isl_val_ge(__isl_keep isl_val *v1,
775		__isl_keep isl_val *v2);
776	isl_bool isl_val_eq(__isl_keep isl_val *v1,
777		__isl_keep isl_val *v2);
778	isl_bool isl_val_ne(__isl_keep isl_val *v1,
779		__isl_keep isl_val *v2);
780	isl_bool isl_val_abs_eq(__isl_keep isl_val *v1,
781		__isl_keep isl_val *v2);
782
783Comparisons to NaN always return false.
784That is, a NaN is not considered to hold any relative position
785with respect to any value.  In particular, a NaN
786is neither considered to be equal to nor to be different from
787any value (including another NaN).
788The function C<isl_val_abs_eq> checks whether its two arguments
789are equal in absolute value.
790
791For integer C<isl_val>s we additionally have the following binary property.
792
793	#include <isl/val.h>
794	isl_bool isl_val_is_divisible_by(__isl_keep isl_val *v1,
795		__isl_keep isl_val *v2);
796
797An C<isl_val> can also be compared to an integer using the following
798functions.  The result of C<isl_val_cmp_si> is undefined for NaN.
799
800	#include <isl/val.h>
801	isl_bool isl_val_gt_si(__isl_keep isl_val *v, long i);
802	isl_bool isl_val_eq_si(__isl_keep isl_val *v, long i);
803	int isl_val_cmp_si(__isl_keep isl_val *v, long i);
804
805The following unary operations are available on C<isl_val>s.
806
807	#include <isl/val.h>
808	__isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
809	__isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
810	__isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
811	__isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
812	__isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
813	__isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
814
815The following binary operations are available on C<isl_val>s.
816
817	#include <isl/val.h>
818	__isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
819		__isl_take isl_val *v2);
820	__isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
821		__isl_take isl_val *v2);
822	__isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
823		__isl_take isl_val *v2);
824	__isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
825		unsigned long v2);
826	__isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
827		__isl_take isl_val *v2);
828	__isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
829		unsigned long v2);
830	__isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
831		__isl_take isl_val *v2);
832	__isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
833		unsigned long v2);
834	__isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
835		__isl_take isl_val *v2);
836	__isl_give isl_val *isl_val_div_ui(__isl_take isl_val *v1,
837		unsigned long v2);
838
839On integer values, we additionally have the following operations.
840
841	#include <isl/val.h>
842	__isl_give isl_val *isl_val_pow2(__isl_take isl_val *v);
843	__isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
844	__isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
845		__isl_take isl_val *v2);
846	__isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
847		__isl_take isl_val *v2);
848	__isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
849		__isl_take isl_val *v2, __isl_give isl_val **x,
850		__isl_give isl_val **y);
851
852C<isl_val_2exp> is an alternative name for C<isl_val_pow2>.
853The function C<isl_val_gcdext> returns the greatest common divisor g
854of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
855that C<*x> * C<v1> + C<*y> * C<v2> = g.
856
857=head3 GMP specific functions
858
859These functions are only available if C<isl> has been compiled with C<GMP>
860support.
861
862Specific integer and rational values can be created from C<GMP> values using
863the following functions.
864
865	#include <isl/val_gmp.h>
866	__isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
867		mpz_t z);
868	__isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
869		const mpz_t n, const mpz_t d);
870
871The numerator and denominator of a rational value can be extracted as
872C<GMP> values using the following functions.
873
874	#include <isl/val_gmp.h>
875	int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
876	int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
877
878=head2 Sets and Relations
879
880C<isl> uses six types of objects for representing sets and relations,
881C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
882C<isl_union_set> and C<isl_union_map>.
883C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
884can be described as a conjunction of affine constraints, while
885C<isl_set> and C<isl_map> represent unions of
886C<isl_basic_set>s and C<isl_basic_map>s, respectively.
887However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
888to live in the same space.  C<isl_union_set>s and C<isl_union_map>s
889represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
890where spaces are considered different if they have a different number
891of dimensions and/or different names (see L<"Spaces">).
892The difference between sets and relations (maps) is that sets have
893one set of variables, while relations have two sets of variables,
894input variables and output variables.
895
896=head2 Error Handling
897
898C<isl> supports different ways to react in case a runtime error is triggered.
899Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
900with two maps that have incompatible spaces. There are three possible ways
901to react on error: to warn, to continue or to abort.
902
903The default behavior is to warn. In this mode, C<isl> prints a warning, stores
904the last error in the corresponding C<isl_ctx> and the function in which the
905error was triggered returns a value indicating that some error has
906occurred.  In case of functions returning a pointer, this value is
907C<NULL>.  In case of functions returning an C<isl_size>, C<isl_bool> or an
908C<isl_stat>, this value is C<isl_size_error>,
909C<isl_bool_error> or C<isl_stat_error>.
910An error does not corrupt internal state,
911such that isl can continue to be used. C<isl> also provides functions to
912read the last error, including the specific error message,
913the isl source file where the error occurred and the line number,
914and to reset all information about the last error. The
915last error is only stored for information purposes. Its presence does not
916change the behavior of C<isl>. Hence, resetting an error is not required to
917continue to use isl, but only to observe new errors.
918
919	#include <isl/ctx.h>
920	enum isl_error isl_ctx_last_error(isl_ctx *ctx);
921	const char *isl_ctx_last_error_msg(isl_ctx *ctx);
922	const char *isl_ctx_last_error_file(isl_ctx *ctx);
923	int isl_ctx_last_error_line(isl_ctx *ctx);
924	void isl_ctx_reset_error(isl_ctx *ctx);
925
926If no error has occurred since the last call to C<isl_ctx_reset_error>,
927then the functions C<isl_ctx_last_error_msg> and
928C<isl_ctx_last_error_file> return C<NULL>.
929
930Another option is to continue on error. This is similar to warn on error mode,
931except that C<isl> does not print any warning. This allows a program to
932implement its own error reporting.
933
934The last option is to directly abort the execution of the program from within
935the isl library. This makes it obviously impossible to recover from an error,
936but it allows to directly spot the error location. By aborting on error,
937debuggers break at the location the error occurred and can provide a stack
938trace. Other tools that automatically provide stack traces on abort or that do
939not want to continue execution after an error was triggered may also prefer to
940abort on error.
941
942The on error behavior of isl can be specified by calling
943C<isl_options_set_on_error> or by setting the command line option
944C<--isl-on-error>. Valid arguments for the function call are
945C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
946choices for the command line option are C<warn>, C<continue> and C<abort>.
947It is also possible to query the current error mode.
948
949	#include <isl/options.h>
950	isl_stat isl_options_set_on_error(isl_ctx *ctx, int val);
951	int isl_options_get_on_error(isl_ctx *ctx);
952
953=head2 Identifiers
954
955Identifiers are used to identify both individual dimensions
956and tuples of dimensions.  They consist of an optional name and an optional
957user pointer.  The name and the user pointer cannot both be C<NULL>, however.
958Identifiers with the same name but different pointer values
959are considered to be distinct.
960Similarly, identifiers with different names but the same pointer value
961are also considered to be distinct.
962Equal identifiers are represented using the same object.
963Pairs of identifiers can therefore be tested for equality using the
964C<==> operator.
965Identifiers can be constructed, copied, freed, inspected and printed
966using the following functions.
967
968	#include <isl/id.h>
969	__isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
970		__isl_keep const char *name, void *user);
971	__isl_give isl_id *isl_id_set_free_user(
972		__isl_take isl_id *id,
973		void (*free_user)(void *user));
974	__isl_give isl_id *isl_id_copy(isl_id *id);
975	__isl_null isl_id *isl_id_free(__isl_take isl_id *id);
976
977	void *isl_id_get_user(__isl_keep isl_id *id);
978	__isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
979
980	__isl_give isl_printer *isl_printer_print_id(
981		__isl_take isl_printer *p, __isl_keep isl_id *id);
982
983The callback set by C<isl_id_set_free_user> is called on the user
984pointer when the last reference to the C<isl_id> is freed.
985Note that C<isl_id_get_name> returns a pointer to some internal
986data structure, so the result can only be used while the
987corresponding C<isl_id> is alive.
988
989=head2 Spaces
990
991Whenever a new set, relation or similar object is created from scratch,
992the space in which it lives needs to be specified using an C<isl_space>.
993Each space involves zero or more parameters and zero, one or two
994tuples of set or input/output dimensions.  The parameters and dimensions
995are identified by an C<isl_dim_type> and a position.
996The type C<isl_dim_param> refers to parameters,
997the type C<isl_dim_set> refers to set dimensions (for spaces
998with a single tuple of dimensions) and the types C<isl_dim_in>
999and C<isl_dim_out> refer to input and output dimensions
1000(for spaces with two tuples of dimensions).
1001Local spaces (see L</"Local Spaces">) also contain dimensions
1002of type C<isl_dim_div>.
1003Note that parameters are only identified by their position within
1004a given object.  Across different objects, parameters are (usually)
1005identified by their names or identifiers.  Only unnamed parameters
1006are identified by their positions across objects.  The use of unnamed
1007parameters is discouraged.
1008
1009	#include <isl/space.h>
1010	__isl_give isl_space *isl_space_unit(isl_ctx *ctx);
1011	__isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
1012		unsigned nparam, unsigned n_in, unsigned n_out);
1013	__isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
1014		unsigned nparam);
1015	__isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
1016		unsigned nparam, unsigned dim);
1017	__isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
1018	__isl_null isl_space *isl_space_free(__isl_take isl_space *space);
1019
1020The space used for creating a parameter domain
1021needs to be created using C<isl_space_unit> or C<isl_space_params_alloc>.
1022For other sets, the space
1023needs to be created using C<isl_space_set_alloc>, while
1024for a relation, the space
1025needs to be created using C<isl_space_alloc>.
1026The use of C<isl_space_params_alloc>,
1027C<isl_space_set_alloc> and C<isl_space_alloc> is discouraged as they allow
1028for the introduction of unnamed parameters.
1029
1030To check whether a given space is that of a set or a map
1031or whether it is a parameter space, use these functions:
1032
1033	#include <isl/space.h>
1034	isl_bool isl_space_is_params(__isl_keep isl_space *space);
1035	isl_bool isl_space_is_set(__isl_keep isl_space *space);
1036	isl_bool isl_space_is_map(__isl_keep isl_space *space);
1037
1038Spaces can be compared using the following functions:
1039
1040	#include <isl/space.h>
1041	isl_bool isl_space_is_equal(__isl_keep isl_space *space1,
1042		__isl_keep isl_space *space2);
1043	isl_bool isl_space_has_equal_params(
1044		__isl_keep isl_space *space1,
1045		__isl_keep isl_space *space2);
1046	isl_bool isl_space_has_equal_tuples(
1047		__isl_keep isl_space *space1,
1048		__isl_keep isl_space *space2);
1049	isl_bool isl_space_is_domain(__isl_keep isl_space *space1,
1050		__isl_keep isl_space *space2);
1051	isl_bool isl_space_is_range(__isl_keep isl_space *space1,
1052		__isl_keep isl_space *space2);
1053	isl_bool isl_space_tuple_is_equal(
1054		__isl_keep isl_space *space1,
1055		enum isl_dim_type type1,
1056		__isl_keep isl_space *space2,
1057		enum isl_dim_type type2);
1058
1059C<isl_space_is_domain> checks whether the first argument is equal
1060to the domain of the second argument.  This requires in particular that
1061the first argument is a set space and that the second argument
1062is a map space.  C<isl_space_tuple_is_equal> checks whether the given
1063tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
1064spaces are the same.  That is, it checks if they have the same
1065identifier (if any), the same dimension and the same internal structure
1066(if any).
1067The function
1068C<isl_space_has_equal_params> checks whether two spaces
1069have the same parameters in the same order.
1070C<isl_space_has_equal_tuples> check whether two spaces have
1071the same tuples.  In contrast to C<isl_space_is_equal> below,
1072it does not check the
1073parameters.  This is useful because many C<isl> functions align the
1074parameters before they perform their operations, such that equivalence
1075is not necessary.
1076C<isl_space_is_equal> checks whether two spaces are identical,
1077meaning that they have the same parameters and the same tuples.
1078That is, it checks whether both C<isl_space_has_equal_params> and
1079C<isl_space_has_equal_tuples> hold.
1080
1081It is often useful to create objects that live in the
1082same space as some other object.  This can be accomplished
1083by creating the new objects
1084(see L</"Creating New Sets and Relations"> or
1085L</"Functions">) based on the space
1086of the original object.
1087
1088	#include <isl/set.h>
1089	__isl_give isl_space *isl_basic_set_get_space(
1090		__isl_keep isl_basic_set *bset);
1091	__isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
1092
1093	#include <isl/union_set.h>
1094	__isl_give isl_space *isl_union_set_get_space(
1095		__isl_keep isl_union_set *uset);
1096
1097	#include <isl/map.h>
1098	__isl_give isl_space *isl_basic_map_get_space(
1099		__isl_keep isl_basic_map *bmap);
1100	__isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
1101
1102	#include <isl/union_map.h>
1103	__isl_give isl_space *isl_union_map_get_space(
1104		__isl_keep isl_union_map *umap);
1105
1106	#include <isl/constraint.h>
1107	__isl_give isl_space *isl_constraint_get_space(
1108		__isl_keep isl_constraint *constraint);
1109
1110	#include <isl/polynomial.h>
1111	__isl_give isl_space *isl_qpolynomial_get_domain_space(
1112		__isl_keep isl_qpolynomial *qp);
1113	__isl_give isl_space *isl_qpolynomial_get_space(
1114		__isl_keep isl_qpolynomial *qp);
1115	__isl_give isl_space *
1116	isl_qpolynomial_fold_get_domain_space(
1117		__isl_keep isl_qpolynomial_fold *fold);
1118	__isl_give isl_space *isl_qpolynomial_fold_get_space(
1119		__isl_keep isl_qpolynomial_fold *fold);
1120	__isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
1121		__isl_keep isl_pw_qpolynomial *pwqp);
1122	__isl_give isl_space *isl_pw_qpolynomial_get_space(
1123		__isl_keep isl_pw_qpolynomial *pwqp);
1124	__isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
1125		__isl_keep isl_pw_qpolynomial_fold *pwf);
1126	__isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
1127		__isl_keep isl_pw_qpolynomial_fold *pwf);
1128	__isl_give isl_space *isl_union_pw_qpolynomial_get_space(
1129		__isl_keep isl_union_pw_qpolynomial *upwqp);
1130	__isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
1131		__isl_keep isl_union_pw_qpolynomial_fold *upwf);
1132
1133	#include <isl/id.h>
1134	__isl_give isl_space *isl_multi_id_get_space(
1135		__isl_keep isl_multi_id *mi);
1136
1137	#include <isl/val.h>
1138	__isl_give isl_space *isl_multi_val_get_space(
1139		__isl_keep isl_multi_val *mv);
1140
1141	#include <isl/aff.h>
1142	__isl_give isl_space *isl_aff_get_domain_space(
1143		__isl_keep isl_aff *aff);
1144	__isl_give isl_space *isl_aff_get_space(
1145		__isl_keep isl_aff *aff);
1146	__isl_give isl_space *isl_pw_aff_get_domain_space(
1147		__isl_keep isl_pw_aff *pwaff);
1148	__isl_give isl_space *isl_pw_aff_get_space(
1149		__isl_keep isl_pw_aff *pwaff);
1150	__isl_give isl_space *isl_multi_aff_get_domain_space(
1151		__isl_keep isl_multi_aff *maff);
1152	__isl_give isl_space *isl_multi_aff_get_space(
1153		__isl_keep isl_multi_aff *maff);
1154	__isl_give isl_space *isl_pw_multi_aff_get_domain_space(
1155		__isl_keep isl_pw_multi_aff *pma);
1156	__isl_give isl_space *isl_pw_multi_aff_get_space(
1157		__isl_keep isl_pw_multi_aff *pma);
1158	__isl_give isl_space *isl_union_pw_aff_get_space(
1159		__isl_keep isl_union_pw_aff *upa);
1160	__isl_give isl_space *isl_union_pw_multi_aff_get_space(
1161		__isl_keep isl_union_pw_multi_aff *upma);
1162	__isl_give isl_space *isl_multi_pw_aff_get_domain_space(
1163		__isl_keep isl_multi_pw_aff *mpa);
1164	__isl_give isl_space *isl_multi_pw_aff_get_space(
1165		__isl_keep isl_multi_pw_aff *mpa);
1166	__isl_give isl_space *
1167	isl_multi_union_pw_aff_get_domain_space(
1168		__isl_keep isl_multi_union_pw_aff *mupa);
1169	__isl_give isl_space *
1170	isl_multi_union_pw_aff_get_space(
1171		__isl_keep isl_multi_union_pw_aff *mupa);
1172
1173	#include <isl/point.h>
1174	__isl_give isl_space *isl_point_get_space(
1175		__isl_keep isl_point *pnt);
1176
1177	#include <isl/fixed_box.h>
1178	__isl_give isl_space *isl_fixed_box_get_space(
1179		__isl_keep isl_fixed_box *box);
1180
1181The number of dimensions of a given type of space
1182may be read off from a space or an object that lives
1183in a space using the following functions.
1184In case of C<isl_space_dim>, type may be
1185C<isl_dim_param>, C<isl_dim_in> (only for relations),
1186C<isl_dim_out> (only for relations), C<isl_dim_set>
1187(only for sets) or C<isl_dim_all>.
1188
1189	#include <isl/space.h>
1190	isl_size isl_space_dim(__isl_keep isl_space *space,
1191		enum isl_dim_type type);
1192
1193	#include <isl/local_space.h>
1194	isl_size isl_local_space_dim(__isl_keep isl_local_space *ls,
1195		enum isl_dim_type type);
1196
1197	#include <isl/set.h>
1198	isl_size isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1199		enum isl_dim_type type);
1200	isl_size isl_set_tuple_dim(__isl_keep isl_set *set);
1201	isl_size isl_set_dim(__isl_keep isl_set *set,
1202		enum isl_dim_type type);
1203
1204	#include <isl/union_set.h>
1205	isl_size isl_union_set_dim(__isl_keep isl_union_set *uset,
1206		enum isl_dim_type type);
1207
1208	#include <isl/map.h>
1209	isl_size isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1210		enum isl_dim_type type);
1211	isl_size isl_map_domain_tuple_dim(
1212		__isl_keep isl_map *map);
1213	isl_size isl_map_range_tuple_dim(
1214		__isl_keep isl_map *map);
1215	isl_size isl_map_dim(__isl_keep isl_map *map,
1216		enum isl_dim_type type);
1217
1218	#include <isl/union_map.h>
1219	isl_size isl_union_map_dim(__isl_keep isl_union_map *umap,
1220		enum isl_dim_type type);
1221
1222	#include <isl/val.h>
1223	isl_size isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1224		enum isl_dim_type type);
1225
1226	#include <isl/aff.h>
1227	isl_size isl_aff_dim(__isl_keep isl_aff *aff,
1228		enum isl_dim_type type);
1229	isl_size isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1230		enum isl_dim_type type);
1231	isl_size isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1232		enum isl_dim_type type);
1233	isl_size isl_pw_multi_aff_dim(
1234		__isl_keep isl_pw_multi_aff *pma,
1235		enum isl_dim_type type);
1236	isl_size isl_multi_pw_aff_dim(
1237		__isl_keep isl_multi_pw_aff *mpa,
1238		enum isl_dim_type type);
1239	isl_size isl_union_pw_aff_dim(
1240		__isl_keep isl_union_pw_aff *upa,
1241		enum isl_dim_type type);
1242	isl_size isl_union_pw_multi_aff_dim(
1243		__isl_keep isl_union_pw_multi_aff *upma,
1244		enum isl_dim_type type);
1245	isl_size isl_multi_union_pw_aff_dim(
1246		__isl_keep isl_multi_union_pw_aff *mupa,
1247		enum isl_dim_type type);
1248
1249	#include <isl/polynomial.h>
1250	isl_size isl_union_pw_qpolynomial_dim(
1251		__isl_keep isl_union_pw_qpolynomial *upwqp,
1252		enum isl_dim_type type);
1253	isl_size isl_union_pw_qpolynomial_fold_dim(
1254		__isl_keep isl_union_pw_qpolynomial_fold *upwf,
1255		enum isl_dim_type type);
1256
1257Note that an C<isl_union_set>, an C<isl_union_map>,
1258an C<isl_union_pw_multi_aff>,
1259an C<isl_union_pw_qpolynomial> and
1260an C<isl_union_pw_qpolynomial_fold>
1261only have parameters.
1262
1263Additional parameters can be added to a space using the following function.
1264
1265	#include <isl/space.h>
1266	__isl_give isl_space *isl_space_add_param_id(
1267		__isl_take isl_space *space,
1268		__isl_take isl_id *id);
1269
1270If a parameter with the given identifier already appears in the space,
1271then it is not added again.
1272
1273Conversely, all parameters can be removed from a space
1274using the following function.
1275
1276	#include <isl/space.h>
1277	__isl_give isl_space *isl_space_drop_all_params(
1278		__isl_take isl_space *space);
1279
1280The identifiers or names of the individual dimensions of spaces
1281may be set or read off using the following functions on spaces
1282or objects that live in spaces.
1283These functions are mostly useful to obtain the identifiers, positions
1284or names of the parameters.  Identifiers of individual dimensions are
1285essentially only useful for printing.  They are ignored by all other
1286operations and may not be preserved across those operations.
1287To keep track of a space along with names/identifiers of
1288the set dimensions, use an C<isl_multi_id> as described in
1289L</"Functions">.
1290
1291	#include <isl/space.h>
1292	__isl_give isl_space *isl_space_set_dim_id(
1293		__isl_take isl_space *space,
1294		enum isl_dim_type type, unsigned pos,
1295		__isl_take isl_id *id);
1296	isl_bool isl_space_has_dim_id(__isl_keep isl_space *space,
1297		enum isl_dim_type type, unsigned pos);
1298	__isl_give isl_id *isl_space_get_dim_id(
1299		__isl_keep isl_space *space,
1300		enum isl_dim_type type, unsigned pos);
1301	__isl_give isl_space *isl_space_set_dim_name(
1302		__isl_take isl_space *space,
1303		 enum isl_dim_type type, unsigned pos,
1304		 __isl_keep const char *name);
1305	isl_bool isl_space_has_dim_name(__isl_keep isl_space *space,
1306		enum isl_dim_type type, unsigned pos);
1307	__isl_keep const char *isl_space_get_dim_name(
1308		__isl_keep isl_space *space,
1309		enum isl_dim_type type, unsigned pos);
1310
1311	#include <isl/local_space.h>
1312	__isl_give isl_local_space *isl_local_space_set_dim_id(
1313		__isl_take isl_local_space *ls,
1314		enum isl_dim_type type, unsigned pos,
1315		__isl_take isl_id *id);
1316	isl_bool isl_local_space_has_dim_id(
1317		__isl_keep isl_local_space *ls,
1318		enum isl_dim_type type, unsigned pos);
1319	__isl_give isl_id *isl_local_space_get_dim_id(
1320		__isl_keep isl_local_space *ls,
1321		enum isl_dim_type type, unsigned pos);
1322	__isl_give isl_local_space *isl_local_space_set_dim_name(
1323		__isl_take isl_local_space *ls,
1324		enum isl_dim_type type, unsigned pos, const char *s);
1325	isl_bool isl_local_space_has_dim_name(
1326		__isl_keep isl_local_space *ls,
1327		enum isl_dim_type type, unsigned pos)
1328	const char *isl_local_space_get_dim_name(
1329		__isl_keep isl_local_space *ls,
1330		enum isl_dim_type type, unsigned pos);
1331
1332	#include <isl/constraint.h>
1333	const char *isl_constraint_get_dim_name(
1334		__isl_keep isl_constraint *constraint,
1335		enum isl_dim_type type, unsigned pos);
1336
1337	#include <isl/set.h>
1338	__isl_give isl_id *isl_basic_set_get_dim_id(
1339		__isl_keep isl_basic_set *bset,
1340		enum isl_dim_type type, unsigned pos);
1341	__isl_give isl_set *isl_set_set_dim_id(
1342		__isl_take isl_set *set, enum isl_dim_type type,
1343		unsigned pos, __isl_take isl_id *id);
1344	isl_bool isl_set_has_dim_id(__isl_keep isl_set *set,
1345		enum isl_dim_type type, unsigned pos);
1346	__isl_give isl_id *isl_set_get_dim_id(
1347		__isl_keep isl_set *set, enum isl_dim_type type,
1348		unsigned pos);
1349	const char *isl_basic_set_get_dim_name(
1350		__isl_keep isl_basic_set *bset,
1351		enum isl_dim_type type, unsigned pos);
1352	isl_bool isl_set_has_dim_name(__isl_keep isl_set *set,
1353		enum isl_dim_type type, unsigned pos);
1354	const char *isl_set_get_dim_name(
1355		__isl_keep isl_set *set,
1356		enum isl_dim_type type, unsigned pos);
1357
1358	#include <isl/map.h>
1359	__isl_give isl_map *isl_map_set_dim_id(
1360		__isl_take isl_map *map, enum isl_dim_type type,
1361		unsigned pos, __isl_take isl_id *id);
1362	isl_bool isl_basic_map_has_dim_id(
1363		__isl_keep isl_basic_map *bmap,
1364		enum isl_dim_type type, unsigned pos);
1365	isl_bool isl_map_has_dim_id(__isl_keep isl_map *map,
1366		enum isl_dim_type type, unsigned pos);
1367	__isl_give isl_id *isl_map_get_dim_id(
1368		__isl_keep isl_map *map, enum isl_dim_type type,
1369		unsigned pos);
1370	__isl_give isl_id *isl_union_map_get_dim_id(
1371		__isl_keep isl_union_map *umap,
1372		enum isl_dim_type type, unsigned pos);
1373	const char *isl_basic_map_get_dim_name(
1374		__isl_keep isl_basic_map *bmap,
1375		enum isl_dim_type type, unsigned pos);
1376	isl_bool isl_map_has_dim_name(__isl_keep isl_map *map,
1377		enum isl_dim_type type, unsigned pos);
1378	const char *isl_map_get_dim_name(
1379		__isl_keep isl_map *map,
1380		enum isl_dim_type type, unsigned pos);
1381
1382	#include <isl/val.h>
1383	__isl_give isl_multi_val *isl_multi_val_set_dim_id(
1384		__isl_take isl_multi_val *mv,
1385		enum isl_dim_type type, unsigned pos,
1386		__isl_take isl_id *id);
1387	__isl_give isl_id *isl_multi_val_get_dim_id(
1388		__isl_keep isl_multi_val *mv,
1389		enum isl_dim_type type, unsigned pos);
1390	__isl_give isl_multi_val *isl_multi_val_set_dim_name(
1391		__isl_take isl_multi_val *mv,
1392		enum isl_dim_type type, unsigned pos, const char *s);
1393
1394	#include <isl/aff.h>
1395	__isl_give isl_aff *isl_aff_set_dim_id(
1396		__isl_take isl_aff *aff, enum isl_dim_type type,
1397		unsigned pos, __isl_take isl_id *id);
1398	__isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1399		__isl_take isl_multi_aff *maff,
1400		enum isl_dim_type type, unsigned pos,
1401		__isl_take isl_id *id);
1402	__isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1403		__isl_take isl_pw_aff *pma,
1404		enum isl_dim_type type, unsigned pos,
1405		__isl_take isl_id *id);
1406	__isl_give isl_multi_pw_aff *
1407	isl_multi_pw_aff_set_dim_id(
1408		__isl_take isl_multi_pw_aff *mpa,
1409		enum isl_dim_type type, unsigned pos,
1410		__isl_take isl_id *id);
1411	__isl_give isl_multi_union_pw_aff *
1412	isl_multi_union_pw_aff_set_dim_id(
1413		__isl_take isl_multi_union_pw_aff *mupa,
1414		enum isl_dim_type type, unsigned pos,
1415		__isl_take isl_id *id);
1416	__isl_give isl_id *isl_multi_aff_get_dim_id(
1417		__isl_keep isl_multi_aff *ma,
1418		enum isl_dim_type type, unsigned pos);
1419	isl_bool isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1420		enum isl_dim_type type, unsigned pos);
1421	__isl_give isl_id *isl_pw_aff_get_dim_id(
1422		__isl_keep isl_pw_aff *pa,
1423		enum isl_dim_type type, unsigned pos);
1424	__isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1425		__isl_keep isl_pw_multi_aff *pma,
1426		enum isl_dim_type type, unsigned pos);
1427	__isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1428		__isl_keep isl_multi_pw_aff *mpa,
1429		enum isl_dim_type type, unsigned pos);
1430	__isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1431		__isl_keep isl_multi_union_pw_aff *mupa,
1432		enum isl_dim_type type, unsigned pos);
1433	__isl_give isl_aff *isl_aff_set_dim_name(
1434		__isl_take isl_aff *aff, enum isl_dim_type type,
1435		unsigned pos, const char *s);
1436	__isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1437		__isl_take isl_multi_aff *maff,
1438		enum isl_dim_type type, unsigned pos, const char *s);
1439	__isl_give isl_multi_pw_aff *
1440	isl_multi_pw_aff_set_dim_name(
1441		__isl_take isl_multi_pw_aff *mpa,
1442		enum isl_dim_type type, unsigned pos, const char *s);
1443	__isl_give isl_union_pw_aff *
1444	isl_union_pw_aff_set_dim_name(
1445		__isl_take isl_union_pw_aff *upa,
1446		enum isl_dim_type type, unsigned pos,
1447		const char *s);
1448	__isl_give isl_union_pw_multi_aff *
1449	isl_union_pw_multi_aff_set_dim_name(
1450		__isl_take isl_union_pw_multi_aff *upma,
1451		enum isl_dim_type type, unsigned pos,
1452		const char *s);
1453	__isl_give isl_multi_union_pw_aff *
1454	isl_multi_union_pw_aff_set_dim_name(
1455		__isl_take isl_multi_union_pw_aff *mupa,
1456		enum isl_dim_type type, unsigned pos,
1457		const char *s);
1458	const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1459		enum isl_dim_type type, unsigned pos);
1460	const char *isl_pw_aff_get_dim_name(
1461		__isl_keep isl_pw_aff *pa,
1462		enum isl_dim_type type, unsigned pos);
1463	const char *isl_pw_multi_aff_get_dim_name(
1464		__isl_keep isl_pw_multi_aff *pma,
1465		enum isl_dim_type type, unsigned pos);
1466
1467	#include <isl/polynomial.h>
1468	__isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1469		__isl_take isl_qpolynomial *qp,
1470		enum isl_dim_type type, unsigned pos,
1471		const char *s);
1472	__isl_give isl_pw_qpolynomial *
1473	isl_pw_qpolynomial_set_dim_name(
1474		__isl_take isl_pw_qpolynomial *pwqp,
1475		enum isl_dim_type type, unsigned pos,
1476		const char *s);
1477	__isl_give isl_pw_qpolynomial_fold *
1478	isl_pw_qpolynomial_fold_set_dim_name(
1479		__isl_take isl_pw_qpolynomial_fold *pwf,
1480		enum isl_dim_type type, unsigned pos,
1481		const char *s);
1482	__isl_give isl_union_pw_qpolynomial *
1483	isl_union_pw_qpolynomial_set_dim_name(
1484		__isl_take isl_union_pw_qpolynomial *upwqp,
1485		enum isl_dim_type type, unsigned pos,
1486		const char *s);
1487	__isl_give isl_union_pw_qpolynomial_fold *
1488	isl_union_pw_qpolynomial_fold_set_dim_name(
1489		__isl_take isl_union_pw_qpolynomial_fold *upwf,
1490		enum isl_dim_type type, unsigned pos,
1491		const char *s);
1492
1493Note that C<isl_space_get_name> returns a pointer to some internal
1494data structure, so the result can only be used while the
1495corresponding C<isl_space> is alive.
1496Also note that every function that operates on two sets or relations
1497requires that both arguments have the same parameters.  This also
1498means that if one of the arguments has named parameters, then the
1499other needs to have named parameters too and the names need to match.
1500Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1501arguments may have different parameters (as long as they are named),
1502in which case the result will have as parameters the union of the parameters of
1503the arguments.
1504
1505Given the identifier or name of a dimension (typically a parameter),
1506its position can be obtained from the following functions.
1507
1508	#include <isl/space.h>
1509	int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1510		enum isl_dim_type type, __isl_keep isl_id *id);
1511	int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1512		enum isl_dim_type type, const char *name);
1513
1514	#include <isl/local_space.h>
1515	int isl_local_space_find_dim_by_name(
1516		__isl_keep isl_local_space *ls,
1517		enum isl_dim_type type, const char *name);
1518
1519	#include <isl/val.h>
1520	int isl_multi_val_find_dim_by_id(
1521		__isl_keep isl_multi_val *mv,
1522		enum isl_dim_type type, __isl_keep isl_id *id);
1523	int isl_multi_val_find_dim_by_name(
1524		__isl_keep isl_multi_val *mv,
1525		enum isl_dim_type type, const char *name);
1526
1527	#include <isl/set.h>
1528	int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1529		enum isl_dim_type type, __isl_keep isl_id *id);
1530	int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1531		enum isl_dim_type type, const char *name);
1532
1533	#include <isl/map.h>
1534	int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1535		enum isl_dim_type type, __isl_keep isl_id *id);
1536	int isl_basic_map_find_dim_by_name(
1537		__isl_keep isl_basic_map *bmap,
1538		enum isl_dim_type type, const char *name);
1539	int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1540		enum isl_dim_type type, const char *name);
1541	int isl_union_map_find_dim_by_name(
1542		__isl_keep isl_union_map *umap,
1543		enum isl_dim_type type, const char *name);
1544
1545	#include <isl/aff.h>
1546	int isl_multi_aff_find_dim_by_id(
1547		__isl_keep isl_multi_aff *ma,
1548		enum isl_dim_type type, __isl_keep isl_id *id);
1549	int isl_multi_pw_aff_find_dim_by_id(
1550		__isl_keep isl_multi_pw_aff *mpa,
1551		enum isl_dim_type type, __isl_keep isl_id *id);
1552	int isl_multi_union_pw_aff_find_dim_by_id(
1553		__isl_keep isl_multi_union_pw_aff *mupa,
1554		enum isl_dim_type type, __isl_keep isl_id *id);
1555	int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1556		enum isl_dim_type type, const char *name);
1557	int isl_multi_aff_find_dim_by_name(
1558		__isl_keep isl_multi_aff *ma,
1559		enum isl_dim_type type, const char *name);
1560	int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1561		enum isl_dim_type type, const char *name);
1562	int isl_multi_pw_aff_find_dim_by_name(
1563		__isl_keep isl_multi_pw_aff *mpa,
1564		enum isl_dim_type type, const char *name);
1565	int isl_pw_multi_aff_find_dim_by_name(
1566		__isl_keep isl_pw_multi_aff *pma,
1567		enum isl_dim_type type, const char *name);
1568	int isl_union_pw_aff_find_dim_by_name(
1569		__isl_keep isl_union_pw_aff *upa,
1570		enum isl_dim_type type, const char *name);
1571	int isl_union_pw_multi_aff_find_dim_by_name(
1572		__isl_keep isl_union_pw_multi_aff *upma,
1573		enum isl_dim_type type, const char *name);
1574	int isl_multi_union_pw_aff_find_dim_by_name(
1575		__isl_keep isl_multi_union_pw_aff *mupa,
1576		enum isl_dim_type type, const char *name);
1577
1578	#include <isl/polynomial.h>
1579	int isl_pw_qpolynomial_find_dim_by_name(
1580		__isl_keep isl_pw_qpolynomial *pwqp,
1581		enum isl_dim_type type, const char *name);
1582	int isl_pw_qpolynomial_fold_find_dim_by_name(
1583		__isl_keep isl_pw_qpolynomial_fold *pwf,
1584		enum isl_dim_type type, const char *name);
1585	int isl_union_pw_qpolynomial_find_dim_by_name(
1586		__isl_keep isl_union_pw_qpolynomial *upwqp,
1587		enum isl_dim_type type, const char *name);
1588	int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1589		__isl_keep isl_union_pw_qpolynomial_fold *upwf,
1590		enum isl_dim_type type, const char *name);
1591
1592The identifiers or names of entire spaces may be set or read off
1593using the following functions.
1594
1595	#include <isl/space.h>
1596	__isl_give isl_space *isl_space_set_domain_tuple_id(
1597		__isl_take isl_space *space,
1598		__isl_take isl_id *id);
1599	__isl_give isl_space *isl_space_set_range_tuple_id(
1600		__isl_take isl_space *space,
1601		__isl_take isl_id *id);
1602	__isl_give isl_space *isl_space_set_tuple_id(
1603		__isl_take isl_space *space,
1604		enum isl_dim_type type, __isl_take isl_id *id);
1605	__isl_give isl_space *isl_space_reset_tuple_id(
1606		__isl_take isl_space *space, enum isl_dim_type type);
1607	isl_bool isl_space_has_domain_tuple_id(
1608		__isl_keep isl_space *space);
1609	isl_bool isl_space_has_range_tuple_id(
1610		__isl_keep isl_space *space);
1611	isl_bool isl_space_has_tuple_id(
1612		__isl_keep isl_space *space,
1613		enum isl_dim_type type);
1614	__isl_give isl_id *isl_space_get_domain_tuple_id(
1615		__isl_keep isl_space *space);
1616	__isl_give isl_id *isl_space_get_range_tuple_id(
1617		__isl_keep isl_space *space);
1618	__isl_give isl_id *isl_space_get_tuple_id(
1619		__isl_keep isl_space *space, enum isl_dim_type type);
1620	__isl_give isl_space *isl_space_set_tuple_name(
1621		__isl_take isl_space *space,
1622		enum isl_dim_type type, const char *s);
1623	isl_bool isl_space_has_tuple_name(
1624		__isl_keep isl_space *space,
1625		enum isl_dim_type type);
1626	__isl_keep const char *isl_space_get_tuple_name(
1627		__isl_keep isl_space *space,
1628		enum isl_dim_type type);
1629
1630	#include <isl/local_space.h>
1631	__isl_give isl_local_space *isl_local_space_set_tuple_id(
1632		__isl_take isl_local_space *ls,
1633		enum isl_dim_type type, __isl_take isl_id *id);
1634
1635	#include <isl/set.h>
1636	__isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1637		__isl_take isl_basic_set *bset,
1638		__isl_take isl_id *id);
1639	__isl_give isl_set *isl_set_set_tuple_id(
1640		__isl_take isl_set *set, __isl_take isl_id *id);
1641	__isl_give isl_set *isl_set_reset_tuple_id(
1642		__isl_take isl_set *set);
1643	isl_bool isl_set_has_tuple_id(__isl_keep isl_set *set);
1644	__isl_give isl_id *isl_set_get_tuple_id(
1645		__isl_keep isl_set *set);
1646	__isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1647		__isl_take isl_basic_set *set, const char *s);
1648	__isl_give isl_set *isl_set_set_tuple_name(
1649		__isl_take isl_set *set, const char *s);
1650	const char *isl_basic_set_get_tuple_name(
1651		__isl_keep isl_basic_set *bset);
1652	isl_bool isl_set_has_tuple_name(__isl_keep isl_set *set);
1653	const char *isl_set_get_tuple_name(
1654		__isl_keep isl_set *set);
1655
1656	#include <isl/map.h>
1657	__isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1658		__isl_take isl_basic_map *bmap,
1659		enum isl_dim_type type, __isl_take isl_id *id);
1660	__isl_give isl_map *isl_map_set_domain_tuple_id(
1661		__isl_take isl_map *map, __isl_take isl_id *id);
1662	__isl_give isl_map *isl_map_set_range_tuple_id(
1663		__isl_take isl_map *map, __isl_take isl_id *id);
1664	__isl_give isl_map *isl_map_set_tuple_id(
1665		__isl_take isl_map *map, enum isl_dim_type type,
1666		__isl_take isl_id *id);
1667	__isl_give isl_map *isl_map_reset_tuple_id(
1668		__isl_take isl_map *map, enum isl_dim_type type);
1669	isl_bool isl_map_has_domain_tuple_id(
1670		__isl_keep isl_map *map);
1671	isl_bool isl_map_has_range_tuple_id(
1672		__isl_keep isl_map *map);
1673	isl_bool isl_map_has_tuple_id(__isl_keep isl_map *map,
1674		enum isl_dim_type type);
1675	__isl_give isl_id *isl_map_get_domain_tuple_id(
1676		__isl_keep isl_map *map);
1677	__isl_give isl_id *isl_map_get_range_tuple_id(
1678		__isl_keep isl_map *map);
1679	__isl_give isl_id *isl_map_get_tuple_id(
1680		__isl_keep isl_map *map, enum isl_dim_type type);
1681	__isl_give isl_map *isl_map_set_tuple_name(
1682		__isl_take isl_map *map,
1683		enum isl_dim_type type, const char *s);
1684	const char *isl_basic_map_get_tuple_name(
1685		__isl_keep isl_basic_map *bmap,
1686		enum isl_dim_type type);
1687	__isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1688		__isl_take isl_basic_map *bmap,
1689		enum isl_dim_type type, const char *s);
1690	isl_bool isl_map_has_tuple_name(__isl_keep isl_map *map,
1691		enum isl_dim_type type);
1692	const char *isl_map_get_tuple_name(
1693		__isl_keep isl_map *map,
1694		enum isl_dim_type type);
1695
1696	#include <isl/val.h>
1697	__isl_give isl_multi_val *isl_multi_val_set_range_tuple_id(
1698		__isl_take isl_multi_val *mv,
1699		__isl_take isl_id *id);
1700	__isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1701		__isl_take isl_multi_val *mv,
1702		enum isl_dim_type type, __isl_take isl_id *id);
1703	__isl_give isl_multi_val *
1704	isl_multi_val_reset_range_tuple_id(
1705		__isl_take isl_multi_val *mv);
1706	__isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1707		__isl_take isl_multi_val *mv,
1708		enum isl_dim_type type);
1709	isl_bool isl_multi_val_has_range_tuple_id(
1710		__isl_keep isl_multi_val *mv);
1711	__isl_give isl_id *isl_multi_val_get_range_tuple_id(
1712		__isl_keep isl_multi_val *mv);
1713	isl_bool isl_multi_val_has_tuple_id(
1714		__isl_keep isl_multi_val *mv,
1715		enum isl_dim_type type);
1716	__isl_give isl_id *isl_multi_val_get_tuple_id(
1717		__isl_keep isl_multi_val *mv,
1718		enum isl_dim_type type);
1719	__isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1720		__isl_take isl_multi_val *mv,
1721		enum isl_dim_type type, const char *s);
1722	const char *isl_multi_val_get_tuple_name(
1723		__isl_keep isl_multi_val *mv,
1724		enum isl_dim_type type);
1725
1726	#include <isl/aff.h>
1727	__isl_give isl_aff *isl_aff_set_tuple_id(
1728		__isl_take isl_aff *aff,
1729		enum isl_dim_type type, __isl_take isl_id *id);
1730	__isl_give isl_multi_aff *isl_multi_aff_set_range_tuple_id(
1731		__isl_take isl_multi_aff *ma,
1732		__isl_take isl_id *id);
1733	__isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1734		__isl_take isl_multi_aff *maff,
1735		enum isl_dim_type type, __isl_take isl_id *id);
1736	__isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1737		__isl_take isl_pw_aff *pwaff,
1738		enum isl_dim_type type, __isl_take isl_id *id);
1739	__isl_give isl_pw_multi_aff *
1740	isl_pw_multi_aff_set_range_tuple_id(
1741		__isl_take isl_pw_multi_aff *pma,
1742		__isl_take isl_id *id);
1743	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1744		__isl_take isl_pw_multi_aff *pma,
1745		enum isl_dim_type type, __isl_take isl_id *id);
1746	__isl_give isl_multi_pw_aff *
1747	isl_multi_pw_aff_set_range_tuple_id(
1748		__isl_take isl_multi_pw_aff *mpa,
1749		__isl_take isl_id *id);
1750	__isl_give isl_multi_union_pw_aff *
1751	isl_multi_union_pw_aff_set_range_tuple_id(
1752		__isl_take isl_multi_union_pw_aff *mupa,
1753		__isl_take isl_id *id);
1754	__isl_give isl_multi_union_pw_aff *
1755	isl_multi_union_pw_aff_set_tuple_id(
1756		__isl_take isl_multi_union_pw_aff *mupa,
1757		enum isl_dim_type type, __isl_take isl_id *id);
1758	__isl_give isl_multi_aff *
1759	isl_multi_aff_reset_range_tuple_id(
1760		__isl_take isl_multi_aff *ma);
1761	__isl_give isl_multi_pw_aff *
1762	isl_multi_pw_aff_reset_range_tuple_id(
1763		__isl_take isl_multi_pw_aff *mpa);
1764	__isl_give isl_multi_union_pw_aff *
1765	isl_multi_union_pw_aff_reset_range_tuple_id(
1766		__isl_take isl_multi_union_pw_aff *mupa);
1767	__isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1768		__isl_take isl_multi_aff *ma,
1769		enum isl_dim_type type);
1770	__isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1771		__isl_take isl_pw_aff *pa,
1772		enum isl_dim_type type);
1773	__isl_give isl_multi_pw_aff *
1774	isl_multi_pw_aff_reset_tuple_id(
1775		__isl_take isl_multi_pw_aff *mpa,
1776		enum isl_dim_type type);
1777	__isl_give isl_pw_multi_aff *
1778	isl_pw_multi_aff_reset_tuple_id(
1779		__isl_take isl_pw_multi_aff *pma,
1780		enum isl_dim_type type);
1781	__isl_give isl_multi_union_pw_aff *
1782	isl_multi_union_pw_aff_reset_tuple_id(
1783		__isl_take isl_multi_union_pw_aff *mupa,
1784		enum isl_dim_type type);
1785	isl_bool isl_multi_aff_has_range_tuple_id(
1786		__isl_keep isl_multi_aff *ma);
1787	__isl_give isl_id *isl_multi_aff_get_range_tuple_id(
1788		__isl_keep isl_multi_aff *ma);
1789	isl_bool isl_multi_aff_has_tuple_id(
1790		__isl_keep isl_multi_aff *ma,
1791		enum isl_dim_type type);
1792	__isl_give isl_id *isl_multi_aff_get_tuple_id(
1793		__isl_keep isl_multi_aff *ma,
1794		enum isl_dim_type type);
1795	isl_bool isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1796		enum isl_dim_type type);
1797	__isl_give isl_id *isl_pw_aff_get_tuple_id(
1798		__isl_keep isl_pw_aff *pa,
1799		enum isl_dim_type type);
1800	isl_bool isl_pw_multi_aff_has_range_tuple_id(
1801		__isl_keep isl_pw_multi_aff *pma);
1802	isl_bool isl_pw_multi_aff_has_tuple_id(
1803		__isl_keep isl_pw_multi_aff *pma,
1804		enum isl_dim_type type);
1805	__isl_give isl_id *isl_pw_multi_aff_get_range_tuple_id(
1806		__isl_keep isl_pw_multi_aff *pma);
1807	__isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1808		__isl_keep isl_pw_multi_aff *pma,
1809		enum isl_dim_type type);
1810	isl_bool isl_multi_pw_aff_has_range_tuple_id(
1811		__isl_keep isl_multi_pw_aff *mpa);
1812	__isl_give isl_id *isl_multi_pw_aff_get_range_tuple_id(
1813		__isl_keep isl_multi_pw_aff *mpa);
1814	isl_bool isl_multi_pw_aff_has_tuple_id(
1815		__isl_keep isl_multi_pw_aff *mpa,
1816		enum isl_dim_type type);
1817	__isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1818		__isl_keep isl_multi_pw_aff *mpa,
1819		enum isl_dim_type type);
1820	isl_bool isl_multi_union_pw_aff_has_range_tuple_id(
1821		__isl_keep isl_multi_union_pw_aff *mupa);
1822	__isl_give isl_id *
1823	isl_multi_union_pw_aff_get_range_tuple_id(
1824		__isl_keep isl_multi_union_pw_aff *mupa);
1825	isl_bool isl_multi_union_pw_aff_has_tuple_id(
1826		__isl_keep isl_multi_union_pw_aff *mupa,
1827		enum isl_dim_type type);
1828	__isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1829		__isl_keep isl_multi_union_pw_aff *mupa,
1830		enum isl_dim_type type);
1831	__isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1832		__isl_take isl_multi_aff *maff,
1833		enum isl_dim_type type, const char *s);
1834	__isl_give isl_multi_pw_aff *
1835	isl_multi_pw_aff_set_tuple_name(
1836		__isl_take isl_multi_pw_aff *mpa,
1837		enum isl_dim_type type, const char *s);
1838	__isl_give isl_multi_union_pw_aff *
1839	isl_multi_union_pw_aff_set_tuple_name(
1840		__isl_take isl_multi_union_pw_aff *mupa,
1841		enum isl_dim_type type, const char *s);
1842	const char *isl_multi_aff_get_tuple_name(
1843		__isl_keep isl_multi_aff *multi,
1844		enum isl_dim_type type);
1845	isl_bool isl_pw_multi_aff_has_tuple_name(
1846		__isl_keep isl_pw_multi_aff *pma,
1847		enum isl_dim_type type);
1848	const char *isl_pw_multi_aff_get_tuple_name(
1849		__isl_keep isl_pw_multi_aff *pma,
1850		enum isl_dim_type type);
1851	const char *isl_multi_union_pw_aff_get_tuple_name(
1852		__isl_keep isl_multi_union_pw_aff *mupa,
1853		enum isl_dim_type type);
1854
1855The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1856or C<isl_dim_set>.  As with C<isl_space_get_name>,
1857the C<isl_space_get_tuple_name> function returns a pointer to some internal
1858data structure.
1859Binary operations require the corresponding spaces of their arguments
1860to have the same name.
1861
1862To keep the names of all parameters and tuples, but reset the user pointers
1863of all the corresponding identifiers, use the following function.
1864
1865	#include <isl/space.h>
1866	__isl_give isl_space *isl_space_reset_user(
1867		__isl_take isl_space *space);
1868
1869	#include <isl/set.h>
1870	__isl_give isl_set *isl_set_reset_user(
1871		__isl_take isl_set *set);
1872
1873	#include <isl/map.h>
1874	__isl_give isl_map *isl_map_reset_user(
1875		__isl_take isl_map *map);
1876
1877	#include <isl/union_set.h>
1878	__isl_give isl_union_set *isl_union_set_reset_user(
1879		__isl_take isl_union_set *uset);
1880
1881	#include <isl/union_map.h>
1882	__isl_give isl_union_map *isl_union_map_reset_user(
1883		__isl_take isl_union_map *umap);
1884
1885	#include <isl/id.h>
1886	__isl_give isl_multi_id *isl_multi_id_reset_user(
1887		__isl_take isl_multi_id *mi);
1888
1889	#include <isl/val.h>
1890	__isl_give isl_multi_val *isl_multi_val_reset_user(
1891		__isl_take isl_multi_val *mv);
1892
1893	#include <isl/aff.h>
1894	__isl_give isl_multi_aff *isl_multi_aff_reset_user(
1895		__isl_take isl_multi_aff *ma);
1896	__isl_give isl_pw_aff *isl_pw_aff_reset_user(
1897		__isl_take isl_pw_aff *pa);
1898	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1899		__isl_take isl_multi_pw_aff *mpa);
1900	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1901		__isl_take isl_pw_multi_aff *pma);
1902	__isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1903		__isl_take isl_union_pw_aff *upa);
1904	__isl_give isl_multi_union_pw_aff *
1905	isl_multi_union_pw_aff_reset_user(
1906		__isl_take isl_multi_union_pw_aff *mupa);
1907	__isl_give isl_union_pw_multi_aff *
1908	isl_union_pw_multi_aff_reset_user(
1909		__isl_take isl_union_pw_multi_aff *upma);
1910
1911	#include <isl/polynomial.h>
1912	__isl_give isl_pw_qpolynomial *
1913	isl_pw_qpolynomial_reset_user(
1914		__isl_take isl_pw_qpolynomial *pwqp);
1915	__isl_give isl_union_pw_qpolynomial *
1916	isl_union_pw_qpolynomial_reset_user(
1917		__isl_take isl_union_pw_qpolynomial *upwqp);
1918	__isl_give isl_pw_qpolynomial_fold *
1919	isl_pw_qpolynomial_fold_reset_user(
1920		__isl_take isl_pw_qpolynomial_fold *pwf);
1921	__isl_give isl_union_pw_qpolynomial_fold *
1922	isl_union_pw_qpolynomial_fold_reset_user(
1923		__isl_take isl_union_pw_qpolynomial_fold *upwf);
1924
1925Spaces can be nested.  In particular, the domain of a set or
1926the domain or range of a relation can be a nested relation.
1927This process is also called I<wrapping>.
1928The functions for detecting, constructing and deconstructing
1929such nested spaces can be found in the wrapping properties
1930of L</"Unary Properties">, the wrapping operations
1931of L</"Unary Operations"> and the Cartesian product operations
1932of L</"Basic Operations">.
1933
1934Spaces can be created from other spaces
1935using the functions described in L</"Unary Operations">
1936and L</"Binary Operations">.
1937
1938=head2 Local Spaces
1939
1940A local space is essentially a space with
1941zero or more existentially quantified variables.
1942The local space of various objects can be obtained
1943using the following functions.
1944
1945	#include <isl/constraint.h>
1946	__isl_give isl_local_space *isl_constraint_get_local_space(
1947		__isl_keep isl_constraint *constraint);
1948
1949	#include <isl/set.h>
1950	__isl_give isl_local_space *isl_basic_set_get_local_space(
1951		__isl_keep isl_basic_set *bset);
1952
1953	#include <isl/map.h>
1954	__isl_give isl_local_space *isl_basic_map_get_local_space(
1955		__isl_keep isl_basic_map *bmap);
1956
1957	#include <isl/aff.h>
1958	__isl_give isl_local_space *isl_aff_get_domain_local_space(
1959		__isl_keep isl_aff *aff);
1960	__isl_give isl_local_space *isl_aff_get_local_space(
1961		__isl_keep isl_aff *aff);
1962
1963A new local space can be created from a space using
1964
1965	#include <isl/local_space.h>
1966	__isl_give isl_local_space *isl_local_space_from_space(
1967		__isl_take isl_space *space);
1968
1969They can be inspected, modified, copied and freed using the following functions.
1970
1971	#include <isl/local_space.h>
1972	isl_bool isl_local_space_is_params(
1973		__isl_keep isl_local_space *ls);
1974	isl_bool isl_local_space_is_set(
1975		__isl_keep isl_local_space *ls);
1976	__isl_give isl_space *isl_local_space_get_space(
1977		__isl_keep isl_local_space *ls);
1978	__isl_give isl_aff *isl_local_space_get_div(
1979		__isl_keep isl_local_space *ls, int pos);
1980	__isl_give isl_local_space *isl_local_space_copy(
1981		__isl_keep isl_local_space *ls);
1982	__isl_null isl_local_space *isl_local_space_free(
1983		__isl_take isl_local_space *ls);
1984
1985Note that C<isl_local_space_get_div> can only be used on local spaces
1986of sets.
1987
1988Two local spaces can be compared using
1989
1990	isl_bool isl_local_space_is_equal(
1991		__isl_keep isl_local_space *ls1,
1992		__isl_keep isl_local_space *ls2);
1993
1994Local spaces can be created from other local spaces
1995using the functions described in L</"Unary Operations">
1996and L</"Binary Operations">.
1997
1998=head2 Creating New Sets and Relations
1999
2000C<isl> has functions for creating some standard sets and relations.
2001
2002=over
2003
2004=item * Empty sets and relations
2005
2006	__isl_give isl_basic_set *isl_basic_set_empty(
2007		__isl_take isl_space *space);
2008	__isl_give isl_basic_map *isl_basic_map_empty(
2009		__isl_take isl_space *space);
2010	__isl_give isl_set *isl_set_empty(
2011		__isl_take isl_space *space);
2012	__isl_give isl_map *isl_map_empty(
2013		__isl_take isl_space *space);
2014	__isl_give isl_union_set *isl_union_set_empty_ctx(
2015		isl_ctx *ctx);
2016	__isl_give isl_union_set *isl_union_set_empty_space(
2017		__isl_take isl_space *space);
2018	__isl_give isl_union_set *isl_union_set_empty(
2019		__isl_take isl_space *space);
2020	__isl_give isl_union_map *isl_union_map_empty_ctx(
2021		isl_ctx *ctx);
2022	__isl_give isl_union_map *isl_union_map_empty_space(
2023		__isl_take isl_space *space);
2024	__isl_give isl_union_map *isl_union_map_empty(
2025		__isl_take isl_space *space);
2026
2027For C<isl_union_set>s and C<isl_union_map>s, the space
2028is only used to specify the parameters.
2029C<isl_union_set_empty> is an alternative name for
2030C<isl_union_set_empty_space>.
2031Similarly for the other pair of functions.
2032
2033=item * Universe sets and relations
2034
2035	#include <isl/set.h>
2036	__isl_give isl_basic_set *isl_basic_set_universe(
2037		__isl_take isl_space *space);
2038	__isl_give isl_set *isl_set_universe(
2039		__isl_take isl_space *space);
2040	__isl_give isl_set *isl_space_universe_set(
2041		__isl_take isl_space *space);
2042
2043	#include <isl/map.h>
2044	__isl_give isl_basic_map *isl_basic_map_universe(
2045		__isl_take isl_space *space);
2046	__isl_give isl_map *isl_map_universe(
2047		__isl_take isl_space *space);
2048	__isl_give isl_map *isl_space_universe_map(
2049		__isl_take isl_space *space);
2050
2051	#include <isl/union_set.h>
2052	__isl_give isl_union_set *isl_union_set_universe(
2053		__isl_take isl_union_set *uset);
2054
2055	#include <isl/union_map.h>
2056	__isl_give isl_union_map *isl_union_map_universe(
2057		__isl_take isl_union_map *umap);
2058
2059C<isl_set_universe> and C<isl_space_universe_set>
2060perform the same operation.
2061Similarly
2062for the pair C<isl_map_universe> and C<isl_space_universe_map>.
2063
2064The sets and relations constructed by the functions above
2065contain all integer values, while those constructed by the
2066functions below only contain non-negative values.
2067
2068	__isl_give isl_basic_set *isl_basic_set_nat_universe(
2069		__isl_take isl_space *space);
2070	__isl_give isl_basic_map *isl_basic_map_nat_universe(
2071		__isl_take isl_space *space);
2072	__isl_give isl_set *isl_set_nat_universe(
2073		__isl_take isl_space *space);
2074	__isl_give isl_map *isl_map_nat_universe(
2075		__isl_take isl_space *space);
2076
2077=item * Identity relations
2078
2079	__isl_give isl_basic_map *isl_basic_map_identity(
2080		__isl_take isl_space *space);
2081	__isl_give isl_map *isl_map_identity(
2082		__isl_take isl_space *space);
2083
2084The number of input and output dimensions in C<space> needs
2085to be the same.
2086
2087=item * Lexicographic order
2088
2089	__isl_give isl_map *isl_map_lex_lt(
2090		__isl_take isl_space *set_space);
2091	__isl_give isl_map *isl_map_lex_le(
2092		__isl_take isl_space *set_space);
2093	__isl_give isl_map *isl_map_lex_gt(
2094		__isl_take isl_space *set_space);
2095	__isl_give isl_map *isl_map_lex_ge(
2096		__isl_take isl_space *set_space);
2097	__isl_give isl_map *isl_map_lex_lt_first(
2098		__isl_take isl_space *space, unsigned n);
2099	__isl_give isl_map *isl_map_lex_le_first(
2100		__isl_take isl_space *space, unsigned n);
2101	__isl_give isl_map *isl_map_lex_gt_first(
2102		__isl_take isl_space *space, unsigned n);
2103	__isl_give isl_map *isl_map_lex_ge_first(
2104		__isl_take isl_space *space, unsigned n);
2105
2106The first four functions take a space for a B<set>
2107and return relations that express that the elements in the domain
2108are lexicographically less
2109(C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
2110greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
2111than the elements in the range.
2112The last four functions take a space for a map
2113and return relations that express that the first C<n> dimensions
2114in the domain are lexicographically less
2115(C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
2116greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
2117than the first C<n> dimensions in the range.
2118
2119=back
2120
2121A basic set or relation can be converted to a set or relation
2122using the following functions.
2123
2124	__isl_give isl_set *isl_basic_set_to_set(
2125		__isl_take isl_basic_set *bset);
2126	__isl_give isl_set *isl_set_from_basic_set(
2127		__isl_take isl_basic_set *bset);
2128	__isl_give isl_map *isl_map_from_basic_map(
2129		__isl_take isl_basic_map *bmap);
2130
2131C<isl_basic_set_to_set> and C<isl_set_from_basic_set> perform
2132the same operation.
2133
2134Sets and relations can be converted to union sets and relations
2135using the following functions.
2136
2137	__isl_give isl_union_set *isl_union_set_from_basic_set(
2138		__isl_take isl_basic_set *bset);
2139	__isl_give isl_union_map *isl_union_map_from_basic_map(
2140		__isl_take isl_basic_map *bmap);
2141	__isl_give isl_union_set *isl_set_to_union_set(
2142		__isl_take isl_set *set);
2143	__isl_give isl_union_set *isl_union_set_from_set(
2144		__isl_take isl_set *set);
2145	__isl_give isl_union_map *isl_map_to_union_map(
2146		__isl_take isl_map *map);
2147	__isl_give isl_union_map *isl_union_map_from_map(
2148		__isl_take isl_map *map);
2149
2150C<isl_map_to_union_map> and C<isl_union_map_from_map> perform
2151the same operation.
2152Similarly for C<isl_set_to_union_set> and C<isl_union_set_from_set>.
2153
2154The inverse conversions below can only be used if the input
2155union set or relation is known to contain elements in exactly one
2156space.
2157
2158	#include <isl/union_set.h>
2159	isl_bool isl_union_set_isa_set(
2160		__isl_keep isl_union_set *uset);
2161	__isl_give isl_set *isl_union_set_as_set(
2162		__isl_take isl_union_set *uset);
2163	__isl_give isl_set *isl_set_from_union_set(
2164		__isl_take isl_union_set *uset);
2165
2166	#include <isl/union_map.h>
2167	isl_bool isl_union_map_isa_map(
2168		__isl_keep isl_union_map *umap);
2169	__isl_give isl_map *isl_union_map_as_map(
2170		__isl_take isl_union_map *umap);
2171	__isl_give isl_map *isl_map_from_union_map(
2172		__isl_take isl_union_map *umap);
2173
2174C<isl_union_map_as_map> and C<isl_map_from_union_map> perform
2175the same operation.
2176Similarly for C<isl_union_set_as_set> and C<isl_set_from_union_set>.
2177
2178Sets and relations can be copied and freed again using the following
2179functions.
2180
2181	__isl_give isl_basic_set *isl_basic_set_copy(
2182		__isl_keep isl_basic_set *bset);
2183	__isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
2184	__isl_give isl_union_set *isl_union_set_copy(
2185		__isl_keep isl_union_set *uset);
2186	__isl_give isl_basic_map *isl_basic_map_copy(
2187		__isl_keep isl_basic_map *bmap);
2188	__isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
2189	__isl_give isl_union_map *isl_union_map_copy(
2190		__isl_keep isl_union_map *umap);
2191	__isl_null isl_basic_set *isl_basic_set_free(
2192		__isl_take isl_basic_set *bset);
2193	__isl_null isl_set *isl_set_free(__isl_take isl_set *set);
2194	__isl_null isl_union_set *isl_union_set_free(
2195		__isl_take isl_union_set *uset);
2196	__isl_null isl_basic_map *isl_basic_map_free(
2197		__isl_take isl_basic_map *bmap);
2198	__isl_null isl_map *isl_map_free(__isl_take isl_map *map);
2199	__isl_null isl_union_map *isl_union_map_free(
2200		__isl_take isl_union_map *umap);
2201
2202Other sets and relations can be constructed by starting
2203from a universe set or relation, adding equality and/or
2204inequality constraints and then projecting out the
2205existentially quantified variables, if any.
2206Constraints can be constructed, manipulated and
2207added to (or removed from) (basic) sets and relations
2208using the following functions.
2209
2210	#include <isl/constraint.h>
2211	__isl_give isl_constraint *isl_constraint_alloc_equality(
2212		__isl_take isl_local_space *ls);
2213	__isl_give isl_constraint *isl_constraint_alloc_inequality(
2214		__isl_take isl_local_space *ls);
2215	__isl_give isl_constraint *isl_constraint_set_constant_si(
2216		__isl_take isl_constraint *constraint, int v);
2217	__isl_give isl_constraint *isl_constraint_set_constant_val(
2218		__isl_take isl_constraint *constraint,
2219		__isl_take isl_val *v);
2220	__isl_give isl_constraint *isl_constraint_set_coefficient_si(
2221		__isl_take isl_constraint *constraint,
2222		enum isl_dim_type type, int pos, int v);
2223	__isl_give isl_constraint *
2224	isl_constraint_set_coefficient_val(
2225		__isl_take isl_constraint *constraint,
2226		enum isl_dim_type type, int pos,
2227		__isl_take isl_val *v);
2228	__isl_give isl_basic_map *isl_basic_map_add_constraint(
2229		__isl_take isl_basic_map *bmap,
2230		__isl_take isl_constraint *constraint);
2231	__isl_give isl_basic_set *isl_basic_set_add_constraint(
2232		__isl_take isl_basic_set *bset,
2233		__isl_take isl_constraint *constraint);
2234	__isl_give isl_map *isl_map_add_constraint(
2235		__isl_take isl_map *map,
2236		__isl_take isl_constraint *constraint);
2237	__isl_give isl_set *isl_set_add_constraint(
2238		__isl_take isl_set *set,
2239		__isl_take isl_constraint *constraint);
2240
2241For example, to create a set containing the even integers
2242between 10 and 42, you could use the following code.
2243
2244	isl_space *space;
2245	isl_local_space *ls;
2246	isl_constraint *c;
2247	isl_basic_set *bset;
2248
2249	space = isl_space_set_alloc(ctx, 0, 2);
2250	bset = isl_basic_set_universe(isl_space_copy(space));
2251	ls = isl_local_space_from_space(space);
2252
2253	c = isl_constraint_alloc_equality(isl_local_space_copy(ls));
2254	c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
2255	c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
2256	bset = isl_basic_set_add_constraint(bset, c);
2257
2258	c = isl_constraint_alloc_inequality(isl_local_space_copy(ls));
2259	c = isl_constraint_set_constant_si(c, -10);
2260	c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
2261	bset = isl_basic_set_add_constraint(bset, c);
2262
2263	c = isl_constraint_alloc_inequality(ls);
2264	c = isl_constraint_set_constant_si(c, 42);
2265	c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
2266	bset = isl_basic_set_add_constraint(bset, c);
2267
2268	bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
2269
2270However, this is considered to be a fairly low-level approach.
2271It is more appropriate to construct a (basic) set by means
2272of affine expressions (defined below in L</"Functions">).
2273For example, the same set could be constructed as follows.
2274
2275	isl_val *v, *two;
2276	isl_space *space;
2277	isl_multi_aff *ma;
2278	isl_aff *var, *cst;
2279	isl_basic_set *bset;
2280
2281	space = isl_space_unit(ctx);
2282	space = isl_space_add_unnamed_tuple_ui(space, 1);
2283	ma = isl_multi_aff_identity_on_domain_space(
2284		isl_space_copy(space));
2285	var = isl_multi_aff_get_at(ma, 0);
2286	v = isl_val_int_from_si(ctx, 10);
2287	cst = isl_aff_val_on_domain_space(isl_space_copy(space), v);
2288	bset = isl_aff_ge_basic_set(isl_aff_copy(var), cst);
2289
2290	v = isl_val_int_from_si(ctx, 42);
2291	cst = isl_aff_val_on_domain_space(space, v);
2292	bset = isl_basic_set_intersect(bset,
2293		isl_aff_le_basic_set(var, cst));
2294
2295	two = isl_val_int_from_si(ctx, 2);
2296	ma = isl_multi_aff_scale_val(ma, isl_val_copy(two));
2297	bset = isl_basic_set_preimage_multi_aff(bset,
2298		isl_multi_aff_copy(ma));
2299	ma = isl_multi_aff_scale_down_val(ma, isl_val_copy(two));
2300	ma = isl_multi_aff_scale_down_val(ma, two);
2301	bset = isl_basic_set_preimage_multi_aff(bset, ma);
2302
2303Alternatively, the set can be parsed from a string representation.
2304
2305	isl_basic_set *bset;
2306	bset = isl_basic_set_read_from_str(ctx,
2307		"{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
2308
2309A basic set or relation can also be constructed from two matrices
2310describing the equalities and the inequalities.
2311
2312	__isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
2313		__isl_take isl_space *space,
2314		__isl_take isl_mat *eq, __isl_take isl_mat *ineq,
2315		enum isl_dim_type c1,
2316		enum isl_dim_type c2, enum isl_dim_type c3,
2317		enum isl_dim_type c4);
2318	__isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
2319		__isl_take isl_space *space,
2320		__isl_take isl_mat *eq, __isl_take isl_mat *ineq,
2321		enum isl_dim_type c1,
2322		enum isl_dim_type c2, enum isl_dim_type c3,
2323		enum isl_dim_type c4, enum isl_dim_type c5);
2324
2325The C<isl_dim_type> arguments indicate the order in which
2326different kinds of variables appear in the input matrices
2327and should be a permutation of C<isl_dim_cst> (the constant term),
2328C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div> for sets and
2329of C<isl_dim_cst>, C<isl_dim_param>,
2330C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
2331
2332A (basic or union) set or relation can also be constructed from a
2333(union) (piecewise) (multiple) affine expression
2334or a list of affine expressions
2335(See L</"Functions">), provided these affine expressions do not
2336involve any NaN.
2337
2338	#include <isl/set.h>
2339	__isl_give isl_basic_set *isl_basic_set_from_multi_aff(
2340		__isl_take isl_multi_aff *ma);
2341	__isl_give isl_set *isl_multi_aff_as_set(
2342		__isl_take isl_multi_aff *ma);
2343	__isl_give isl_set *isl_set_from_multi_aff(
2344		__isl_take isl_multi_aff *ma);
2345
2346	#include <isl/map.h>
2347	__isl_give isl_basic_map *isl_basic_map_from_aff(
2348		__isl_take isl_aff *aff);
2349	__isl_give isl_map *isl_map_from_aff(
2350		__isl_take isl_aff *aff);
2351	__isl_give isl_basic_map *isl_basic_map_from_aff_list(
2352		__isl_take isl_space *domain_space,
2353		__isl_take isl_aff_list *list);
2354	__isl_give isl_basic_map *isl_basic_map_from_multi_aff(
2355		__isl_take isl_multi_aff *maff)
2356	__isl_give isl_map *isl_multi_aff_as_map(
2357		__isl_take isl_multi_aff *ma);
2358	__isl_give isl_map *isl_map_from_multi_aff(
2359		__isl_take isl_multi_aff *maff)
2360
2361	#include <isl/aff.h>
2362	__isl_give isl_set *isl_set_from_pw_aff(
2363		__isl_take isl_pw_aff *pwaff);
2364	__isl_give isl_map *isl_pw_aff_as_map(
2365		__isl_take isl_pw_aff *pa);
2366	__isl_give isl_map *isl_map_from_pw_aff(
2367		__isl_take isl_pw_aff *pwaff);
2368	__isl_give isl_set *isl_pw_multi_aff_as_set(
2369		__isl_take isl_pw_multi_aff *pma);
2370	__isl_give isl_set *isl_set_from_pw_multi_aff(
2371		__isl_take isl_pw_multi_aff *pma);
2372	__isl_give isl_map *isl_pw_multi_aff_as_map(
2373		__isl_take isl_pw_multi_aff *pma);
2374	__isl_give isl_map *isl_map_from_pw_multi_aff(
2375		__isl_take isl_pw_multi_aff *pma);
2376	__isl_give isl_set *isl_multi_pw_aff_as_set(
2377		__isl_take isl_multi_pw_aff *mpa);
2378	__isl_give isl_set *isl_set_from_multi_pw_aff(
2379		__isl_take isl_multi_pw_aff *mpa);
2380	__isl_give isl_map *isl_multi_pw_aff_as_map(
2381		__isl_take isl_multi_pw_aff *mpa);
2382	__isl_give isl_map *isl_map_from_multi_pw_aff(
2383		__isl_take isl_multi_pw_aff *mpa);
2384	__isl_give isl_union_map *isl_union_map_from_union_pw_aff(
2385		__isl_take isl_union_pw_aff *upa);
2386	__isl_give isl_union_map *
2387	isl_union_pw_multi_aff_as_union_map(
2388		__isl_take isl_union_pw_multi_aff *upma);
2389	__isl_give isl_union_map *
2390	isl_union_map_from_union_pw_multi_aff(
2391		__isl_take isl_union_pw_multi_aff *upma);
2392	__isl_give isl_union_map *
2393	isl_union_map_from_multi_union_pw_aff(
2394		__isl_take isl_multi_union_pw_aff *mupa);
2395
2396The C<domain_space> argument describes the domain of the resulting
2397basic relation.  It is required because the C<list> may consist
2398of zero affine expressions.
2399The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
2400is not allowed to be zero-dimensional.  The domain of the result
2401is the shared domain of the union piecewise affine elements.
2402C<isl_multi_aff_as_set> and C<isl_set_from_multi_aff> perform
2403the same operation.
2404Similarly for the pair C<isl_multi_aff_as_map> and C<isl_map_from_multi_aff>,
2405for the pair C<isl_pw_aff_as_map> and C<isl_map_from_pw_aff>,
2406for the pair C<isl_pw_multi_aff_as_set> and C<isl_set_from_pw_multi_aff>,
2407for the pair C<isl_pw_multi_aff_as_map> and C<isl_map_from_pw_multi_aff>,
2408the pair C<isl_multi_pw_aff_as_set> and C<isl_set_from_multi_pw_aff>,
2409the pair C<isl_multi_pw_aff_as_map> and C<isl_map_from_multi_pw_aff>,
2410and
2411C<isl_union_pw_multi_aff_as_union_map> and
2412C<isl_union_map_from_union_pw_multi_aff>.
2413
2414=head2 Inspecting Sets and Relations
2415
2416Usually, the user should not have to care about the actual constraints
2417of the sets and maps, but should instead apply the abstract operations
2418explained in the following sections.
2419Occasionally, however, it may be required to inspect the individual
2420coefficients of the constraints.  This section explains how to do so.
2421In these cases, it may also be useful to have C<isl> compute
2422an explicit representation of the existentially quantified variables.
2423
2424	__isl_give isl_set *isl_set_compute_divs(
2425		__isl_take isl_set *set);
2426	__isl_give isl_map *isl_map_compute_divs(
2427		__isl_take isl_map *map);
2428	__isl_give isl_union_set *isl_union_set_compute_divs(
2429		__isl_take isl_union_set *uset);
2430	__isl_give isl_union_map *isl_union_map_compute_divs(
2431		__isl_take isl_union_map *umap);
2432
2433This explicit representation defines the existentially quantified
2434variables as integer divisions of the other variables, possibly
2435including earlier existentially quantified variables.
2436An explicitly represented existentially quantified variable therefore
2437has a unique value when the values of the other variables are known.
2438
2439Alternatively, the existentially quantified variables can be removed
2440using the following functions, which compute an overapproximation.
2441
2442	#include <isl/set.h>
2443	__isl_give isl_basic_set *isl_basic_set_remove_divs(
2444		__isl_take isl_basic_set *bset);
2445	__isl_give isl_set *isl_set_remove_divs(
2446		__isl_take isl_set *set);
2447
2448	#include <isl/map.h>
2449	__isl_give isl_basic_map *isl_basic_map_remove_divs(
2450		__isl_take isl_basic_map *bmap);
2451	__isl_give isl_map *isl_map_remove_divs(
2452		__isl_take isl_map *map);
2453
2454	#include <isl/union_set.h>
2455	__isl_give isl_union_set *isl_union_set_remove_divs(
2456		__isl_take isl_union_set *bset);
2457
2458	#include <isl/union_map.h>
2459	__isl_give isl_union_map *isl_union_map_remove_divs(
2460		__isl_take isl_union_map *bmap);
2461
2462It is also possible to only remove those divs that are defined
2463in terms of a given range of dimensions or only those for which
2464no explicit representation is known.
2465
2466	__isl_give isl_basic_set *
2467	isl_basic_set_remove_divs_involving_dims(
2468		__isl_take isl_basic_set *bset,
2469		enum isl_dim_type type,
2470		unsigned first, unsigned n);
2471	__isl_give isl_basic_map *
2472	isl_basic_map_remove_divs_involving_dims(
2473		__isl_take isl_basic_map *bmap,
2474		enum isl_dim_type type,
2475		unsigned first, unsigned n);
2476	__isl_give isl_set *isl_set_remove_divs_involving_dims(
2477		__isl_take isl_set *set, enum isl_dim_type type,
2478		unsigned first, unsigned n);
2479	__isl_give isl_map *isl_map_remove_divs_involving_dims(
2480		__isl_take isl_map *map, enum isl_dim_type type,
2481		unsigned first, unsigned n);
2482
2483	__isl_give isl_basic_set *
2484	isl_basic_set_remove_unknown_divs(
2485		__isl_take isl_basic_set *bset);
2486	__isl_give isl_set *isl_set_remove_unknown_divs(
2487		__isl_take isl_set *set);
2488	__isl_give isl_map *isl_map_remove_unknown_divs(
2489		__isl_take isl_map *map);
2490
2491To iterate over all the sets or maps in a union set or map, use
2492
2493	#include <isl/union_set.h>
2494	isl_stat isl_union_set_foreach_set(
2495		__isl_keep isl_union_set *uset,
2496		isl_stat (*fn)(__isl_take isl_set *set, void *user),
2497		void *user);
2498	isl_bool isl_union_set_every_set(
2499		__isl_keep isl_union_set *uset,
2500		isl_bool (*test)(__isl_keep isl_set *set,
2501			void *user),
2502		void *user);
2503
2504	#include <isl/union_map.h>
2505	isl_stat isl_union_map_foreach_map(
2506		__isl_keep isl_union_map *umap,
2507		isl_stat (*fn)(__isl_take isl_map *map, void *user),
2508		void *user);
2509	isl_bool isl_union_map_every_map(
2510		__isl_keep isl_union_map *umap,
2511		isl_bool (*test)(__isl_keep isl_map *map,
2512			void *user),
2513		void *user);
2514
2515These functions call the callback function once for each
2516(pair of) space(s) for which there are elements in the input.
2517The argument to the callback contains all elements in the input
2518with that (pair of) space(s).
2519The C<isl_union_set_every_set> and
2520C<isl_union_map_every_map> variants check whether each
2521call to the callback returns true and stops checking as soon as one
2522of these calls returns false.
2523
2524The number of sets or maps in a union set or map can be obtained
2525from
2526
2527	isl_size isl_union_set_n_set(__isl_keep isl_union_set *uset);
2528	isl_size isl_union_map_n_map(__isl_keep isl_union_map *umap);
2529
2530To extract the set or map in a given space from a union, use
2531
2532	__isl_give isl_set *isl_union_set_extract_set(
2533		__isl_keep isl_union_set *uset,
2534		__isl_take isl_space *space);
2535	__isl_give isl_map *isl_union_map_extract_map(
2536		__isl_keep isl_union_map *umap,
2537		__isl_take isl_space *space);
2538
2539To iterate over all the basic sets or maps in a set or map, use
2540
2541	isl_stat isl_set_foreach_basic_set(__isl_keep isl_set *set,
2542		isl_stat (*fn)(__isl_take isl_basic_set *bset,
2543			void *user),
2544		void *user);
2545	isl_stat isl_map_foreach_basic_map(__isl_keep isl_map *map,
2546		isl_stat (*fn)(__isl_take isl_basic_map *bmap,
2547			void *user),
2548		void *user);
2549
2550The callback function C<fn> should return C<isl_stat_ok> if successful and
2551C<isl_stat_error> if an error occurs.  In the latter case, or if any other error
2552occurs, the above functions will return C<isl_stat_error>.
2553
2554It should be noted that C<isl> does not guarantee that
2555the basic sets or maps passed to C<fn> are disjoint.
2556If this is required, then the user should call one of
2557the following functions first.
2558
2559	__isl_give isl_set *isl_set_make_disjoint(
2560		__isl_take isl_set *set);
2561	__isl_give isl_map *isl_map_make_disjoint(
2562		__isl_take isl_map *map);
2563
2564The number of basic sets in a set can be obtained
2565or the number of basic maps in a map can be obtained
2566from
2567
2568	#include <isl/set.h>
2569	isl_size isl_set_n_basic_set(__isl_keep isl_set *set);
2570
2571	#include <isl/map.h>
2572	isl_size isl_map_n_basic_map(__isl_keep isl_map *map);
2573
2574It is also possible to obtain a list of (basic) sets from a set
2575or union set, a list of basic maps from a map and a list of maps from a union
2576map.
2577
2578	#include <isl/set.h>
2579	__isl_give isl_basic_set_list *isl_set_get_basic_set_list(
2580		__isl_keep isl_set *set);
2581
2582	#include <isl/union_set.h>
2583	__isl_give isl_basic_set_list *
2584	isl_union_set_get_basic_set_list(
2585		__isl_keep isl_union_set *uset);
2586	__isl_give isl_set_list *isl_union_set_get_set_list(
2587		__isl_keep isl_union_set *uset);
2588
2589	#include <isl/map.h>
2590	__isl_give isl_basic_map_list *isl_map_get_basic_map_list(
2591		__isl_keep isl_map *map);
2592
2593	#include <isl/union_map.h>
2594	__isl_give isl_map_list *isl_union_map_get_map_list(
2595		__isl_keep isl_union_map *umap);
2596
2597The returned list can be manipulated using the functions in L<"Lists">.
2598
2599To iterate over the constraints of a basic set or map, use
2600
2601	#include <isl/constraint.h>
2602
2603	isl_size isl_basic_set_n_constraint(
2604		__isl_keep isl_basic_set *bset);
2605	isl_stat isl_basic_set_foreach_constraint(
2606		__isl_keep isl_basic_set *bset,
2607		isl_stat (*fn)(__isl_take isl_constraint *c,
2608			void *user),
2609		void *user);
2610	isl_size isl_basic_map_n_constraint(
2611		__isl_keep isl_basic_map *bmap);
2612	isl_stat isl_basic_map_foreach_constraint(
2613		__isl_keep isl_basic_map *bmap,
2614		isl_stat (*fn)(__isl_take isl_constraint *c,
2615			void *user),
2616		void *user);
2617	__isl_null isl_constraint *isl_constraint_free(
2618		__isl_take isl_constraint *c);
2619
2620Again, the callback function C<fn> should return C<isl_stat_ok>
2621if successful and
2622C<isl_stat_error> if an error occurs.  In the latter case, or if any other error
2623occurs, the above functions will return C<isl_stat_error>.
2624The constraint C<c> represents either an equality or an inequality.
2625Use the following function to find out whether a constraint
2626represents an equality.  If not, it represents an inequality.
2627
2628	isl_bool isl_constraint_is_equality(
2629		__isl_keep isl_constraint *constraint);
2630
2631It is also possible to obtain a list of constraints from a basic
2632map or set
2633
2634	#include <isl/constraint.h>
2635	__isl_give isl_constraint_list *
2636	isl_basic_map_get_constraint_list(
2637		__isl_keep isl_basic_map *bmap);
2638	__isl_give isl_constraint_list *
2639	isl_basic_set_get_constraint_list(
2640		__isl_keep isl_basic_set *bset);
2641
2642These functions require that all existentially quantified variables
2643have an explicit representation.
2644The returned list can be manipulated using the functions in L<"Lists">.
2645
2646The coefficients of the constraints can be inspected using
2647the following functions.
2648
2649	isl_bool isl_constraint_is_lower_bound(
2650		__isl_keep isl_constraint *constraint,
2651		enum isl_dim_type type, unsigned pos);
2652	isl_bool isl_constraint_is_upper_bound(
2653		__isl_keep isl_constraint *constraint,
2654		enum isl_dim_type type, unsigned pos);
2655	__isl_give isl_val *isl_constraint_get_constant_val(
2656		__isl_keep isl_constraint *constraint);
2657	__isl_give isl_val *isl_constraint_get_coefficient_val(
2658		__isl_keep isl_constraint *constraint,
2659		enum isl_dim_type type, int pos);
2660
2661The explicit representations of the existentially quantified
2662variables can be inspected using the following function.
2663Note that the user is only allowed to use this function
2664if the inspected set or map is the result of a call
2665to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2666The existentially quantified variable is equal to the floor
2667of the returned affine expression.  The affine expression
2668itself can be inspected using the functions in
2669L</"Functions">.
2670
2671	__isl_give isl_aff *isl_constraint_get_div(
2672		__isl_keep isl_constraint *constraint, int pos);
2673
2674To obtain the constraints of a basic set or map in matrix
2675form, use the following functions.
2676
2677	__isl_give isl_mat *isl_basic_set_equalities_matrix(
2678		__isl_keep isl_basic_set *bset,
2679		enum isl_dim_type c1, enum isl_dim_type c2,
2680		enum isl_dim_type c3, enum isl_dim_type c4);
2681	__isl_give isl_mat *isl_basic_set_inequalities_matrix(
2682		__isl_keep isl_basic_set *bset,
2683		enum isl_dim_type c1, enum isl_dim_type c2,
2684		enum isl_dim_type c3, enum isl_dim_type c4);
2685	__isl_give isl_mat *isl_basic_map_equalities_matrix(
2686		__isl_keep isl_basic_map *bmap,
2687		enum isl_dim_type c1,
2688		enum isl_dim_type c2, enum isl_dim_type c3,
2689		enum isl_dim_type c4, enum isl_dim_type c5);
2690	__isl_give isl_mat *isl_basic_map_inequalities_matrix(
2691		__isl_keep isl_basic_map *bmap,
2692		enum isl_dim_type c1,
2693		enum isl_dim_type c2, enum isl_dim_type c3,
2694		enum isl_dim_type c4, enum isl_dim_type c5);
2695
2696The C<isl_dim_type> arguments dictate the order in which
2697different kinds of variables appear in the resulting matrix.
2698For set inputs, they should be a permutation of
2699C<isl_dim_cst> (the constant term), C<isl_dim_param>, C<isl_dim_set> and
2700C<isl_dim_div>.
2701For map inputs, they should be a permutation of
2702C<isl_dim_cst>, C<isl_dim_param>,
2703C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2704
2705=head2 Points
2706
2707Points are elements of a set.  They can be used to construct
2708simple sets (boxes) or they can be used to represent the
2709individual elements of a set.
2710The zero point (the origin) can be created using
2711
2712	__isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2713
2714The coordinates of a point can be inspected, set and changed
2715using
2716
2717	#include <isl/point.h>
2718	__isl_give isl_multi_val *isl_point_get_multi_val(
2719		__isl_keep isl_point *pnt);
2720	__isl_give isl_val *isl_point_get_coordinate_val(
2721		__isl_keep isl_point *pnt,
2722		enum isl_dim_type type, int pos);
2723	__isl_give isl_point *isl_point_set_coordinate_val(
2724		__isl_take isl_point *pnt,
2725		enum isl_dim_type type, int pos,
2726		__isl_take isl_val *v);
2727
2728	__isl_give isl_point *isl_point_add_ui(
2729		__isl_take isl_point *pnt,
2730		enum isl_dim_type type, int pos, unsigned val);
2731	__isl_give isl_point *isl_point_sub_ui(
2732		__isl_take isl_point *pnt,
2733		enum isl_dim_type type, int pos, unsigned val);
2734
2735Points can be copied or freed using
2736
2737	__isl_give isl_point *isl_point_copy(
2738		__isl_keep isl_point *pnt);
2739	__isl_null isl_point *isl_point_free(
2740		__isl_take isl_point *pnt);
2741
2742A singleton set can be created from a point using the following functions.
2743
2744	__isl_give isl_basic_set *isl_basic_set_from_point(
2745		__isl_take isl_point *pnt);
2746	__isl_give isl_set *isl_point_to_set(
2747		__isl_take isl_point *pnt);
2748	__isl_give isl_set *isl_set_from_point(
2749		__isl_take isl_point *pnt);
2750	__isl_give isl_union_set *isl_union_set_from_point(
2751		__isl_take isl_point *pnt);
2752
2753C<isl_point_to_set> and C<isl_set_from_point> perform
2754the same operation.
2755
2756A box can be created from two opposite extremal points using
2757
2758	__isl_give isl_basic_set *isl_basic_set_box_from_points(
2759		__isl_take isl_point *pnt1,
2760		__isl_take isl_point *pnt2);
2761	__isl_give isl_set *isl_set_box_from_points(
2762		__isl_take isl_point *pnt1,
2763		__isl_take isl_point *pnt2);
2764
2765All elements of a B<bounded> (union) set can be enumerated using
2766the following functions.
2767
2768	isl_stat isl_set_foreach_point(__isl_keep isl_set *set,
2769		isl_stat (*fn)(__isl_take isl_point *pnt,
2770			void *user),
2771		void *user);
2772	isl_stat isl_union_set_foreach_point(
2773		__isl_keep isl_union_set *uset,
2774		isl_stat (*fn)(__isl_take isl_point *pnt,
2775			void *user),
2776		void *user);
2777
2778The function C<fn> is called for each integer point in
2779C<set> with as second argument the last argument of
2780the C<isl_set_foreach_point> call.  The function C<fn>
2781should return C<isl_stat_ok> on success and C<isl_stat_error> on failure.
2782In the latter case, C<isl_set_foreach_point> will stop
2783enumerating and return C<isl_stat_error> as well.
2784If the enumeration is performed successfully and to completion,
2785then C<isl_set_foreach_point> returns C<isl_stat_ok>.
2786
2787To obtain a single point of a (basic or union) set, use
2788
2789	__isl_give isl_point *isl_basic_set_sample_point(
2790		__isl_take isl_basic_set *bset);
2791	__isl_give isl_point *isl_set_sample_point(
2792		__isl_take isl_set *set);
2793	__isl_give isl_point *isl_union_set_sample_point(
2794		__isl_take isl_union_set *uset);
2795
2796If C<set> does not contain any (integer) points, then the
2797resulting point will be ``void'', a property that can be
2798tested using
2799
2800	isl_bool isl_point_is_void(__isl_keep isl_point *pnt);
2801
2802=head2 Functions
2803
2804Besides sets and relation, C<isl> also supports various types of functions.
2805Each of these types is derived from the value type (see L</"Values">)
2806or from one of two primitive function types
2807through the application of zero or more type constructors.
2808As a special case, a multiple expression can also be derived
2809from an identifier (see L</"Identifiers">) although the result
2810is not really a function.
2811We first describe the primitive type and then we describe
2812the types derived from these primitive types.
2813
2814=head3 Primitive Functions
2815
2816C<isl> support two primitive function types, quasi-affine
2817expressions and quasipolynomials.
2818A quasi-affine expression is defined either over a parameter
2819space or over a set and is composed of integer constants,
2820parameters and set variables, addition, subtraction and
2821integer division by an integer constant.
2822For example, the quasi-affine expression
2823
2824	[n] -> { [x] -> [2*floor((4 n + x)/9)] }
2825
2826maps C<x> to C<2*floor((4 n + x)/9>.
2827A quasipolynomial is a polynomial expression in quasi-affine
2828expression.  That is, it additionally allows for multiplication.
2829Note, though, that it is not allowed to construct an integer
2830division of an expression involving multiplications.
2831Here is an example of a quasipolynomial that is not
2832quasi-affine expression
2833
2834	[n] -> { [x] -> (n*floor((4 n + x)/9)) }
2835
2836Note that the external representations of quasi-affine expressions
2837and quasipolynomials are different.  Quasi-affine expressions
2838use a notation with square brackets just like binary relations,
2839while quasipolynomials do not.  This might change at some point.
2840
2841If a primitive function is defined over a parameter space,
2842then the space of the function itself is that of a set.
2843If it is defined over a set, then the space of the function
2844is that of a relation.  In both cases, the set space (or
2845the output space) is single-dimensional, anonymous and unstructured.
2846To create functions with multiple dimensions or with other kinds
2847of set or output spaces, use multiple expressions
2848(see L</"Multiple Expressions">).
2849
2850=over
2851
2852=item * Quasi-affine Expressions
2853
2854Besides the expressions described above, a quasi-affine
2855expression can also be set to NaN.  Such expressions
2856typically represent a failure to represent a result
2857as a quasi-affine expression.
2858
2859The zero quasi affine expression or the quasi affine expression
2860that is equal to a given value, parameter or
2861a specified dimension on a given domain can be created using
2862
2863	#include <isl/aff.h>
2864	__isl_give isl_aff *isl_aff_zero_on_domain_space(
2865		__isl_take isl_space *space);
2866	__isl_give isl_aff *isl_space_zero_aff_on_domain(
2867		__isl_take isl_space *space);
2868	__isl_give isl_aff *isl_aff_zero_on_domain(
2869		__isl_take isl_local_space *ls);
2870	__isl_give isl_aff *isl_aff_val_on_domain_space(
2871		__isl_take isl_space *space,
2872		__isl_take isl_val *val);
2873	__isl_give isl_aff *isl_aff_val_on_domain(
2874		__isl_take isl_local_space *ls,
2875		__isl_take isl_val *val);
2876	__isl_give isl_aff *isl_aff_param_on_domain_space_id(
2877		__isl_take isl_space *space,
2878		__isl_take isl_id *id);
2879	__isl_give isl_aff *isl_space_param_aff_on_domain_id(
2880		__isl_take isl_space *space,
2881		__isl_take isl_id *id);
2882	__isl_give isl_aff *isl_aff_var_on_domain(
2883		__isl_take isl_local_space *ls,
2884		enum isl_dim_type type, unsigned pos);
2885	__isl_give isl_aff *isl_aff_nan_on_domain_space(
2886		__isl_take isl_space *space);
2887	__isl_give isl_aff *isl_aff_nan_on_domain(
2888		__isl_take isl_local_space *ls);
2889
2890The space passed to C<isl_aff_param_on_domain_space_id>
2891is required to have a parameter with the given identifier.
2892C<isl_aff_param_on_domain_space_id> and
2893C<isl_space_param_aff_on_domain_id> perform the same operation.
2894
2895C<isl_aff_zero_on_domain_space> and C<isl_space_zero_aff_on_domain>
2896perform the same operation.
2897
2898Quasi affine expressions can be copied and freed using
2899
2900	#include <isl/aff.h>
2901	__isl_give isl_aff *isl_aff_copy(
2902		__isl_keep isl_aff *aff);
2903	__isl_null isl_aff *isl_aff_free(
2904		__isl_take isl_aff *aff);
2905
2906A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2907using the following function.  The constraint is required to have
2908a non-zero coefficient for the specified dimension.
2909
2910	#include <isl/constraint.h>
2911	__isl_give isl_aff *isl_constraint_get_bound(
2912		__isl_keep isl_constraint *constraint,
2913		enum isl_dim_type type, int pos);
2914
2915The entire affine expression of the constraint can also be extracted
2916using the following function.
2917
2918	#include <isl/constraint.h>
2919	__isl_give isl_aff *isl_constraint_get_aff(
2920		__isl_keep isl_constraint *constraint);
2921
2922Conversely, an equality constraint equating
2923the affine expression to zero or an inequality constraint enforcing
2924the affine expression to be non-negative, can be constructed using
2925
2926	__isl_give isl_constraint *isl_equality_from_aff(
2927		__isl_take isl_aff *aff);
2928	__isl_give isl_constraint *isl_inequality_from_aff(
2929		__isl_take isl_aff *aff);
2930
2931The coefficients and the integer divisions of an affine expression
2932can be inspected using the following functions.
2933
2934	#include <isl/aff.h>
2935	__isl_give isl_val *isl_aff_get_constant_val(
2936		__isl_keep isl_aff *aff);
2937	__isl_give isl_val *isl_aff_get_coefficient_val(
2938		__isl_keep isl_aff *aff,
2939		enum isl_dim_type type, int pos);
2940	int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2941		enum isl_dim_type type, int pos);
2942	__isl_give isl_val *isl_aff_get_denominator_val(
2943		__isl_keep isl_aff *aff);
2944	__isl_give isl_aff *isl_aff_get_div(
2945		__isl_keep isl_aff *aff, int pos);
2946
2947They can be modified using the following functions.
2948
2949	#include <isl/aff.h>
2950	__isl_give isl_aff *isl_aff_set_constant_si(
2951		__isl_take isl_aff *aff, int v);
2952	__isl_give isl_aff *isl_aff_set_constant_val(
2953		__isl_take isl_aff *aff, __isl_take isl_val *v);
2954	__isl_give isl_aff *isl_aff_set_coefficient_si(
2955		__isl_take isl_aff *aff,
2956		enum isl_dim_type type, int pos, int v);
2957	__isl_give isl_aff *isl_aff_set_coefficient_val(
2958		__isl_take isl_aff *aff,
2959		enum isl_dim_type type, int pos,
2960		__isl_take isl_val *v);
2961
2962	__isl_give isl_aff *isl_aff_add_constant_si(
2963		__isl_take isl_aff *aff, int v);
2964	__isl_give isl_aff *isl_aff_add_constant_val(
2965		__isl_take isl_aff *aff, __isl_take isl_val *v);
2966	__isl_give isl_aff *isl_aff_add_constant_num_si(
2967		__isl_take isl_aff *aff, int v);
2968	__isl_give isl_aff *isl_aff_add_coefficient_si(
2969		__isl_take isl_aff *aff,
2970		enum isl_dim_type type, int pos, int v);
2971	__isl_give isl_aff *isl_aff_add_coefficient_val(
2972		__isl_take isl_aff *aff,
2973		enum isl_dim_type type, int pos,
2974		__isl_take isl_val *v);
2975
2976Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2977set the I<numerator> of the constant or coefficient, while
2978C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2979the constant or coefficient as a whole.
2980The C<add_constant> and C<add_coefficient> functions add an integer
2981or rational value to
2982the possibly rational constant or coefficient.
2983The C<add_constant_num> functions add an integer value to
2984the numerator.
2985
2986=item * Quasipolynomials
2987
2988Some simple quasipolynomials can be created using the following functions.
2989
2990	#include <isl/polynomial.h>
2991	__isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2992		__isl_take isl_space *domain);
2993	__isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2994		__isl_take isl_space *domain);
2995	__isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2996		__isl_take isl_space *domain);
2997	__isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2998		__isl_take isl_space *domain);
2999	__isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
3000		__isl_take isl_space *domain);
3001	__isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
3002		__isl_take isl_space *domain,
3003		__isl_take isl_val *val);
3004	__isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
3005		__isl_take isl_space *domain,
3006		enum isl_dim_type type, unsigned pos);
3007	__isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
3008		__isl_take isl_aff *aff);
3009
3010Recall that the space in which a quasipolynomial lives is a map space
3011with a one-dimensional range.  The C<domain> argument in some of
3012the functions above corresponds to the domain of this map space.
3013
3014Quasipolynomials can be copied and freed again using the following
3015functions.
3016
3017	#include <isl/polynomial.h>
3018	__isl_give isl_qpolynomial *isl_qpolynomial_copy(
3019		__isl_keep isl_qpolynomial *qp);
3020	__isl_null isl_qpolynomial *isl_qpolynomial_free(
3021		__isl_take isl_qpolynomial *qp);
3022
3023The constant term of a quasipolynomial can be extracted using
3024
3025	__isl_give isl_val *isl_qpolynomial_get_constant_val(
3026		__isl_keep isl_qpolynomial *qp);
3027
3028To iterate over all terms in a quasipolynomial,
3029use
3030
3031	isl_stat isl_qpolynomial_foreach_term(
3032		__isl_keep isl_qpolynomial *qp,
3033		isl_stat (*fn)(__isl_take isl_term *term,
3034			  void *user), void *user);
3035
3036The terms themselves can be inspected and freed using
3037these functions
3038
3039	isl_size isl_term_dim(__isl_keep isl_term *term,
3040		enum isl_dim_type type);
3041	__isl_give isl_val *isl_term_get_coefficient_val(
3042		__isl_keep isl_term *term);
3043	isl_size isl_term_get_exp(__isl_keep isl_term *term,
3044		enum isl_dim_type type, unsigned pos);
3045	__isl_give isl_aff *isl_term_get_div(
3046		__isl_keep isl_term *term, unsigned pos);
3047	__isl_null isl_term *isl_term_free(
3048		__isl_take isl_term *term);
3049
3050Each term is a product of parameters, set variables and
3051integer divisions.  The function C<isl_term_get_exp>
3052returns the exponent of a given dimensions in the given term.
3053
3054=back
3055
3056=head3 Reductions
3057
3058A reduction represents a maximum or a minimum of its
3059base expressions.
3060The only reduction type defined by C<isl> is
3061C<isl_qpolynomial_fold>.
3062
3063There are currently no functions to directly create such
3064objects, but they do appear in the piecewise quasipolynomial
3065reductions returned by the C<isl_pw_qpolynomial_bound> function.
3066See
3067L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
3068
3069Reductions can be copied and freed using
3070the following functions.
3071
3072	#include <isl/polynomial.h>
3073	__isl_give isl_qpolynomial_fold *
3074	isl_qpolynomial_fold_copy(
3075		__isl_keep isl_qpolynomial_fold *fold);
3076	__isl_null isl_qpolynomial_fold *
3077	isl_qpolynomial_fold_free(
3078		__isl_take isl_qpolynomial_fold *fold);
3079
3080The type of a (union piecewise) reduction
3081can be obtained using the following functions.
3082
3083	#include <isl/polynomial.h>
3084	enum isl_fold isl_qpolynomial_fold_get_type(
3085		__isl_keep isl_qpolynomial_fold *fold);
3086	enum isl_fold isl_pw_qpolynomial_fold_get_type(
3087		__isl_keep isl_pw_qpolynomial_fold *pwf);
3088	enum isl_fold isl_union_pw_qpolynomial_fold_get_type(
3089		__isl_keep isl_union_pw_qpolynomial_fold *upwf);
3090
3091The type may be either C<isl_fold_min> or C<isl_fold_max>
3092(or C<isl_fold_error> in case of error).
3093
3094To iterate over all quasipolynomials in a reduction, use
3095
3096	isl_stat isl_qpolynomial_fold_foreach_qpolynomial(
3097		__isl_keep isl_qpolynomial_fold *fold,
3098		isl_stat (*fn)(__isl_take isl_qpolynomial *qp,
3099			  void *user), void *user);
3100
3101=head3 Multiple Expressions
3102
3103A multiple expression represents a sequence of zero or
3104more base expressions, all defined on the same domain space.
3105The domain space of the multiple expression is the same
3106as that of the base expressions, but the range space
3107can be any space.  In case the base expressions have
3108a set space, the corresponding multiple expression
3109also has a set space.
3110Objects of the value or identifier type do not have an associated space.
3111The space of a multiple value or
3112multiple identifier is therefore always a set space.
3113Similarly, the space of a multiple union piecewise
3114affine expression is always a set space.
3115If the base expressions are not total, then
3116a corresponding zero-dimensional multiple expression may
3117have an explicit domain that keeps track of the domain
3118outside of any base expressions.
3119
3120The multiple expression types defined by C<isl>
3121are C<isl_multi_val>, C<isl_multi_id>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
3122C<isl_multi_union_pw_aff>.
3123
3124A multiple expression with the value zero for
3125each output (or set) dimension can be created
3126using the following functions.
3127
3128	#include <isl/val.h>
3129	__isl_give isl_multi_val *isl_multi_val_zero(
3130		__isl_take isl_space *space);
3131	__isl_give isl_multi_val *isl_space_zero_multi_val(
3132		__isl_take isl_space *space);
3133
3134	#include <isl/aff.h>
3135	__isl_give isl_multi_aff *isl_multi_aff_zero(
3136		__isl_take isl_space *space);
3137	__isl_give isl_multi_aff *isl_space_zero_multi_aff(
3138		__isl_take isl_space *space);
3139	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
3140		__isl_take isl_space *space);
3141	__isl_give isl_multi_pw_aff *isl_space_zero_multi_pw_aff(
3142		__isl_take isl_space *space);
3143	__isl_give isl_multi_union_pw_aff *
3144	isl_multi_union_pw_aff_zero(
3145		__isl_take isl_space *space);
3146	__isl_give isl_multi_union_pw_aff *
3147	isl_space_zero_multi_union_pw_aff(
3148		__isl_take isl_space *space);
3149
3150Since there is no canonical way of representing a zero
3151value of type C<isl_union_pw_aff>, the space passed
3152to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
3153C<isl_multi_val_zero> and C<isl_space_zero_multi_val>
3154perform the same operation.
3155Similarly
3156for the pair C<isl_multi_aff_zero> and C<isl_space_zero_multi_aff>,
3157for the pair C<isl_multi_pw_aff_zero> and C<isl_space_zero_multi_pw_aff> and
3158for the pair C<isl_multi_union_pw_aff_zero> and
3159C<isl_space_zero_multi_union_pw_aff>.
3160
3161
3162An identity function can be created using the following
3163functions.
3164For the first group of functions, the space needs to be that of a set.
3165For the second group,
3166the space needs to be that of a relation
3167with the same number of input and output dimensions.
3168For the third group, the input function needs to live in a space
3169with the same number of input and output dimensions and
3170the identity function is created in that space.
3171
3172	#include <isl/aff.h>
3173	__isl_give isl_multi_aff *
3174	isl_multi_aff_identity_on_domain_space(
3175		__isl_take isl_space *space);
3176	__isl_give isl_multi_aff *
3177	isl_space_identity_multi_aff_on_domain(
3178		__isl_take isl_space *space);
3179	__isl_give isl_multi_pw_aff *
3180	isl_multi_pw_aff_identity_on_domain_space(
3181		__isl_take isl_space *space);
3182	__isl_give isl_multi_pw_aff *
3183	isl_space_identity_multi_pw_aff_on_domain(
3184		__isl_take isl_space *space);
3185	__isl_give isl_multi_aff *isl_multi_aff_identity(
3186		__isl_take isl_space *space);
3187	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
3188		__isl_take isl_space *space);
3189	__isl_give isl_multi_aff *
3190	isl_multi_aff_identity_multi_aff(
3191		__isl_take isl_multi_aff *ma);
3192	__isl_give isl_multi_pw_aff *
3193	isl_multi_pw_aff_identity_multi_pw_aff(
3194		__isl_take isl_multi_pw_aff *mpa);
3195
3196C<isl_multi_aff_identity_on_domain_space> and
3197C<isl_space_identity_multi_aff_on_domain>
3198perform the same operation.
3199Similarly
3200for the pair C<isl_multi_pw_aff_identity_on_domain_space> and
3201C<isl_space_identity_multi_pw_aff_on_domain>.
3202
3203A function that performs a projection on a universe
3204relation or set can be created using the following functions.
3205See also the corresponding
3206projection operations in L</"Unary Operations">.
3207
3208	#include <isl/aff.h>
3209	__isl_give isl_multi_aff *isl_multi_aff_domain_map(
3210		__isl_take isl_space *space);
3211	__isl_give isl_multi_aff *isl_space_domain_map_multi_aff(
3212		__isl_take isl_space *space);
3213	__isl_give isl_multi_aff *isl_multi_aff_range_map(
3214		__isl_take isl_space *space);
3215	__isl_give isl_multi_aff *isl_space_range_map_multi_aff(
3216		__isl_take isl_space *space);
3217	__isl_give isl_multi_aff *isl_multi_aff_project_out_map(
3218		__isl_take isl_space *space,
3219		enum isl_dim_type type,
3220		unsigned first, unsigned n);
3221
3222C<isl_multi_aff_domain_map> and C<isl_space_domain_map_multi_aff> perform
3223the same operation.
3224Similarly
3225for the pair C<isl_multi_aff_range_map> and C<isl_space_range_map_multi_aff>.
3226
3227A multiple expression can be created from a single
3228base expression using the following functions.
3229The space of the created multiple expression is the same
3230as that of the base expression, except for
3231C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
3232lives in a parameter space and the output lives
3233in a single-dimensional set space.
3234
3235	#include <isl/aff.h>
3236	__isl_give isl_multi_aff *isl_multi_aff_from_aff(
3237		__isl_take isl_aff *aff);
3238	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
3239		__isl_take isl_pw_aff *pa);
3240	__isl_give isl_multi_union_pw_aff *
3241	isl_multi_union_pw_aff_from_union_pw_aff(
3242		__isl_take isl_union_pw_aff *upa);
3243
3244A multiple expression can be created from a list
3245of base expression in a specified space.
3246The domain of this space needs to be the same
3247as the domains of the base expressions in the list.
3248If the base expressions have a set space (or no associated space),
3249then this space also needs to be a set space.
3250
3251	#include <isl/id.h>
3252	__isl_give isl_multi_id *isl_multi_id_from_id_list(
3253		__isl_take isl_space *space,
3254		__isl_take isl_id_list *list);
3255	__isl_give isl_multi_id *isl_space_multi_id(
3256		__isl_take isl_space *space,
3257		__isl_take isl_id_list *list);
3258
3259	#include <isl/val.h>
3260	__isl_give isl_multi_val *isl_multi_val_from_val_list(
3261		__isl_take isl_space *space,
3262		__isl_take isl_val_list *list);
3263	__isl_give isl_multi_val *isl_space_multi_val(
3264		__isl_take isl_space *space,
3265		__isl_take isl_val_list *list);
3266
3267	#include <isl/aff.h>
3268	__isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
3269		__isl_take isl_space *space,
3270		__isl_take isl_aff_list *list);
3271	__isl_give isl_multi_aff *isl_space_multi_aff(
3272		__isl_take isl_space *space,
3273		__isl_take isl_aff_list *list);
3274	__isl_give isl_multi_pw_aff *
3275	isl_multi_pw_aff_from_pw_aff_list(
3276		__isl_take isl_space *space,
3277		__isl_take isl_pw_aff_list *list);
3278	__isl_give isl_multi_pw_aff *
3279	isl_space_multi_pw_aff(
3280		__isl_take isl_space *space,
3281		__isl_take isl_pw_aff_list *list);
3282	__isl_give isl_multi_union_pw_aff *
3283	isl_multi_union_pw_aff_from_union_pw_aff_list(
3284		__isl_take isl_space *space,
3285		__isl_take isl_union_pw_aff_list *list);
3286	__isl_give isl_multi_union_pw_aff *
3287	isl_space_multi_union_pw_aff(
3288		__isl_take isl_space *space,
3289		__isl_take isl_union_pw_aff_list *list);
3290
3291C<isl_multi_id_from_id_list> and C<isl_space_multi_id> perform
3292the same operation.
3293Similarly for the pair C<isl_multi_val_from_val_list> and
3294C<isl_space_multi_val>,
3295for the pair C<isl_multi_aff_from_aff_list> and
3296C<isl_space_multi_aff>,
3297for the pair C<isl_multi_pw_aff_from_pw_aff_list> and
3298C<isl_space_multi_pw_aff> and
3299for the pair C<isl_multi_union_pw_aff_from_union_pw_aff_list> and
3300C<isl_space_multi_union_pw_aff>.
3301
3302As a convenience, a multiple piecewise expression can
3303also be created from a multiple expression,
3304or even directly from a single base expression.
3305Each piecewise expression in the result has a single
3306universe cell.
3307
3308	#include <isl/aff.h>
3309	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_aff(
3310		__isl_take isl_aff *aff);
3311	__isl_give isl_multi_pw_aff *
3312	isl_multi_aff_to_multi_pw_aff(
3313		__isl_take isl_multi_aff *ma);
3314	__isl_give isl_multi_pw_aff *
3315	isl_multi_pw_aff_from_multi_aff(
3316		__isl_take isl_multi_aff *ma);
3317
3318C<isl_multi_aff_to_multi_pw_aff> and
3319C<isl_multi_pw_aff_from_multi_aff> perform the same operation.
3320
3321Similarly, a multiple union expression can be
3322created from a multiple expression.
3323
3324	#include <isl/aff.h>
3325	__isl_give isl_multi_union_pw_aff *
3326	isl_multi_union_pw_aff_from_multi_aff(
3327		__isl_take isl_multi_aff *ma);
3328	__isl_give isl_multi_union_pw_aff *
3329	isl_multi_aff_to_multi_union_pw_aff(
3330		__isl_take isl_multi_aff *ma);
3331	__isl_give isl_multi_union_pw_aff *
3332	isl_multi_union_pw_aff_from_multi_pw_aff(
3333		__isl_take isl_multi_pw_aff *mpa);
3334
3335C<isl_multi_aff_to_multi_union_pw_aff> and
3336C<isl_multi_union_pw_aff_from_multi_aff> perform the same operation.
3337
3338A multiple quasi-affine expression can be created from
3339a multiple value with a given domain space using the following
3340function.
3341
3342	#include <isl/aff.h>
3343	__isl_give isl_multi_aff *
3344	isl_multi_aff_multi_val_on_domain_space(
3345		__isl_take isl_space *space,
3346		__isl_take isl_multi_val *mv);
3347	__isl_give isl_multi_aff *
3348	isl_space_multi_aff_on_domain_multi_val(
3349		__isl_take isl_space *space,
3350		__isl_take isl_multi_val *mv);
3351	__isl_give isl_multi_aff *
3352	isl_multi_aff_multi_val_on_space(
3353		__isl_take isl_space *space,
3354		__isl_take isl_multi_val *mv);
3355
3356C<isl_space_multi_aff_on_domain_multi_val> and
3357C<isl_multi_aff_multi_val_on_space> are alternative names
3358for C<isl_multi_aff_multi_val_on_domain_space>.
3359
3360Similarly,
3361a multiple union piecewise affine expression can be created from
3362a multiple value with a given domain or
3363a (piecewise) multiple affine expression with a given domain
3364using the following functions.
3365
3366	#include <isl/aff.h>
3367	__isl_give isl_multi_union_pw_aff *
3368	isl_multi_union_pw_aff_multi_val_on_domain(
3369		__isl_take isl_union_set *domain,
3370		__isl_take isl_multi_val *mv);
3371	__isl_give isl_multi_union_pw_aff *
3372	isl_multi_union_pw_aff_multi_aff_on_domain(
3373		__isl_take isl_union_set *domain,
3374		__isl_take isl_multi_aff *ma);
3375	__isl_give isl_multi_union_pw_aff *
3376	isl_multi_union_pw_aff_pw_multi_aff_on_domain(
3377		__isl_take isl_union_set *domain,
3378		__isl_take isl_pw_multi_aff *pma);
3379
3380Multiple expressions can be copied and freed using
3381the following functions.
3382
3383	#include <isl/id.h>
3384	__isl_give isl_multi_id *isl_multi_id_copy(
3385		__isl_keep isl_multi_id *mi);
3386	__isl_null isl_multi_id *isl_multi_id_free(
3387		__isl_take isl_multi_id *mi);
3388
3389	#include <isl/val.h>
3390	__isl_give isl_multi_val *isl_multi_val_copy(
3391		__isl_keep isl_multi_val *mv);
3392	__isl_null isl_multi_val *isl_multi_val_free(
3393		__isl_take isl_multi_val *mv);
3394
3395	#include <isl/aff.h>
3396	__isl_give isl_multi_aff *isl_multi_aff_copy(
3397		__isl_keep isl_multi_aff *maff);
3398	__isl_null isl_multi_aff *isl_multi_aff_free(
3399		__isl_take isl_multi_aff *maff);
3400	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
3401		__isl_keep isl_multi_pw_aff *mpa);
3402	__isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
3403		__isl_take isl_multi_pw_aff *mpa);
3404	__isl_give isl_multi_union_pw_aff *
3405	isl_multi_union_pw_aff_copy(
3406		__isl_keep isl_multi_union_pw_aff *mupa);
3407	__isl_null isl_multi_union_pw_aff *
3408	isl_multi_union_pw_aff_free(
3409		__isl_take isl_multi_union_pw_aff *mupa);
3410
3411The number of base expressions in a multiple
3412expression can be obtained using the following functions.
3413
3414	#include <isl/id.h>
3415	int isl_multi_id_size(__isl_keep isl_multi_id *mi);
3416
3417	#include <isl/val.h>
3418	isl_size isl_multi_val_size(__isl_keep isl_multi_val *mv);
3419
3420	#include <isl/aff.h>
3421	isl_size isl_multi_aff_size(
3422		__isl_keep isl_multi_aff *multi);
3423	isl_size isl_multi_pw_aff_size(
3424		__isl_keep isl_multi_pw_aff *mpa);
3425	isl_size isl_multi_union_pw_aff_size(
3426		__isl_keep isl_multi_union_pw_aff *mupa);
3427
3428The base expression at a given position of a multiple
3429expression can be extracted using the following functions.
3430
3431	#include <isl/id.h>
3432	__isl_give isl_id *isl_multi_id_get_at(
3433		__isl_keep isl_multi_id *mi, int pos);
3434	__isl_give isl_id *isl_multi_id_get_id(
3435		__isl_keep isl_multi_id *mi, int pos);
3436
3437	#include <isl/val.h>
3438	__isl_give isl_val *isl_multi_val_get_at(
3439		__isl_keep isl_multi_val *mv, int pos);
3440	__isl_give isl_val *isl_multi_val_get_val(
3441		__isl_keep isl_multi_val *mv, int pos);
3442
3443	#include <isl/aff.h>
3444	__isl_give isl_aff *isl_multi_aff_get_at(
3445		__isl_keep isl_multi_aff *ma, int pos);
3446	__isl_give isl_aff *isl_multi_aff_get_aff(
3447		__isl_keep isl_multi_aff *multi, int pos);
3448	__isl_give isl_pw_aff *isl_multi_pw_aff_get_at(
3449		__isl_keep isl_multi_pw_aff *mpa, int pos);
3450	__isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
3451		__isl_keep isl_multi_pw_aff *mpa, int pos);
3452	__isl_give isl_union_pw_aff *
3453	isl_multi_union_pw_aff_get_at(
3454		__isl_keep isl_multi_union_pw_aff *mupa, int pos);
3455	__isl_give isl_union_pw_aff *
3456	isl_multi_union_pw_aff_get_union_pw_aff(
3457		__isl_keep isl_multi_union_pw_aff *mupa, int pos);
3458
3459C<isl_multi_id_get_id> is an alternative name for C<isl_multi_id_get_at>.
3460Similarly for the other pairs of functions.
3461
3462The base expression can be replaced using the following functions.
3463
3464	#include <isl/id.h>
3465	__isl_give isl_multi_id *isl_multi_id_set_at(
3466		__isl_take isl_multi_id *mi, int pos,
3467		__isl_take isl_id *id);
3468	__isl_give isl_multi_id *isl_multi_id_set_id(
3469		__isl_take isl_multi_id *mi, int pos,
3470		__isl_take isl_id *id);
3471
3472	#include <isl/val.h>
3473	__isl_give isl_multi_val *isl_multi_val_set_at(
3474		__isl_take isl_multi_val *mv, int pos,
3475		__isl_take isl_val *val);
3476	__isl_give isl_multi_val *isl_multi_val_set_val(
3477		__isl_take isl_multi_val *mv, int pos,
3478		__isl_take isl_val *val);
3479
3480	#include <isl/aff.h>
3481	__isl_give isl_multi_aff *isl_multi_aff_set_at(
3482		__isl_take isl_multi_aff *ma, int pos,
3483		__isl_take isl_aff *aff);
3484	__isl_give isl_multi_aff *isl_multi_aff_set_aff(
3485		__isl_take isl_multi_aff *multi, int pos,
3486		__isl_take isl_aff *aff);
3487	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_set_at(
3488		__isl_take isl_multi_pw_aff *mpa, int pos,
3489		__isl_take isl_pw_aff *pa);
3490	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_set_pw_aff(
3491		__isl_take isl_multi_pw_aff *mpa, int pos,
3492		__isl_take isl_pw_aff *pa);
3493	__isl_give isl_multi_union_pw_aff *
3494	isl_multi_union_pw_aff_set_at(
3495		__isl_take isl_multi_union_pw_aff *mupa, int pos,
3496		__isl_take isl_union_pw_aff *upa);
3497	__isl_give isl_multi_union_pw_aff *
3498	isl_multi_union_pw_aff_set_union_pw_aff(
3499		__isl_take isl_multi_union_pw_aff *mupa, int pos,
3500		__isl_take isl_union_pw_aff *upa);
3501
3502C<isl_multi_id_set_id> is an alternative name for C<isl_multi_id_set_at>.
3503Similarly for the other pairs of functions.
3504
3505A list of all base expressions of a multiple
3506expression can be extracted using the following functions.
3507
3508	#include <isl/id.h>
3509	__isl_give isl_id_list *isl_multi_id_get_list(
3510		__isl_keep isl_multi_id *mi);
3511
3512	#include <isl/val.h>
3513	__isl_give isl_val_list *isl_multi_val_get_list(
3514		__isl_keep isl_multi_val *mv);
3515
3516	#include <isl/aff.h>
3517	__isl_give isl_aff_list *isl_multi_aff_get_list(
3518		__isl_keep isl_multi_aff *multi);
3519	__isl_give isl_pw_aff_list *isl_multi_pw_aff_get_list(
3520		__isl_keep isl_multi_pw_aff *mpa);
3521	__isl_give isl_union_pw_aff_list *
3522	isl_multi_union_pw_aff_list(
3523		__isl_keep isl_multi_union_pw_aff *mupa);
3524
3525The constant terms of the base expressions can be obtained using
3526the following function.
3527
3528	#include <isl/aff.h>
3529	__isl_give isl_multi_val *
3530	isl_multi_aff_get_constant_multi_val(
3531		__isl_keep isl_multi_aff *ma);
3532
3533As a convenience, a sequence of base expressions that have
3534their domains in a given space can be extracted from a sequence
3535of union expressions using the following function.
3536
3537	#include <isl/aff.h>
3538	__isl_give isl_multi_pw_aff *
3539	isl_multi_union_pw_aff_extract_multi_pw_aff(
3540		__isl_keep isl_multi_union_pw_aff *mupa,
3541		__isl_take isl_space *space);
3542
3543Note that there is a difference between C<isl_multi_union_pw_aff>
3544and C<isl_union_pw_multi_aff> objects.  The first is a sequence
3545of unions of piecewise expressions, while the second is a union
3546of piecewise sequences.  In particular, multiple affine expressions
3547in an C<isl_union_pw_multi_aff> may live in different spaces,
3548while there is only a single multiple expression in
3549an C<isl_multi_union_pw_aff>, which can therefore only live
3550in a single space.  This means that not every
3551C<isl_union_pw_multi_aff> can be converted to
3552an C<isl_multi_union_pw_aff>.  Conversely, the elements
3553of an C<isl_multi_union_pw_aff> may be defined over different domains,
3554while each multiple expression inside an C<isl_union_pw_multi_aff>
3555has a single domain.  The conversion of an C<isl_union_pw_multi_aff>
3556of dimension greater than one may therefore not be exact.
3557The following functions can
3558be used to perform these conversions when they are possible.
3559
3560	#include <isl/aff.h>
3561	__isl_give isl_multi_union_pw_aff *
3562	isl_union_pw_multi_aff_as_multi_union_pw_aff(
3563		__isl_take isl_union_pw_multi_aff *upma);
3564	__isl_give isl_multi_union_pw_aff *
3565	isl_multi_union_pw_aff_from_union_pw_multi_aff(
3566		__isl_take isl_union_pw_multi_aff *upma);
3567	__isl_give isl_union_pw_multi_aff *
3568	isl_union_pw_multi_aff_from_multi_union_pw_aff(
3569		__isl_take isl_multi_union_pw_aff *mupa);
3570
3571C<isl_union_pw_multi_aff_as_multi_union_pw_aff> and
3572C<isl_multi_union_pw_aff_from_union_pw_multi_aff>
3573perform the same operation.
3574
3575=head3 Piecewise Expressions
3576
3577A piecewise expression is an expression that is described
3578using zero or more base expression defined over the same
3579number of cells in the domain space of the base expressions.
3580All base expressions are defined over the same
3581domain space and the cells are disjoint.
3582The space of a piecewise expression is the same as
3583that of the base expressions.
3584If the union of the cells is a strict subset of the domain
3585space, then the value of the piecewise expression outside
3586this union is different for types derived from quasi-affine
3587expressions and those derived from quasipolynomials.
3588Piecewise expressions derived from quasi-affine expressions
3589are considered to be undefined outside the union of their cells.
3590Piecewise expressions derived from quasipolynomials
3591are considered to be zero outside the union of their cells.
3592
3593Piecewise quasipolynomials are mainly used by the C<barvinok>
3594library for representing the number of elements in a parametric set or map.
3595For example, the piecewise quasipolynomial
3596
3597	[n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
3598
3599represents the number of points in the map
3600
3601	[n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
3602
3603The piecewise expression types defined by C<isl>
3604are C<isl_pw_aff>, C<isl_pw_multi_aff>,
3605C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
3606
3607A piecewise expression with no cells can be created using
3608the following functions.
3609
3610	#include <isl/aff.h>
3611	__isl_give isl_pw_aff *isl_pw_aff_empty(
3612		__isl_take isl_space *space);
3613	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
3614		__isl_take isl_space *space);
3615
3616A piecewise expression with a single universe cell can be
3617created using the following functions.
3618
3619	#include <isl/aff.h>
3620	__isl_give isl_pw_aff *isl_pw_aff_from_aff(
3621		__isl_take isl_aff *aff);
3622	__isl_give isl_pw_multi_aff *
3623	isl_multi_aff_to_pw_multi_aff(
3624		__isl_take isl_multi_aff *ma);
3625	__isl_give isl_pw_multi_aff *
3626	isl_pw_multi_aff_from_multi_aff(
3627		__isl_take isl_multi_aff *ma);
3628
3629	#include <isl/polynomial.h>
3630	__isl_give isl_pw_qpolynomial *
3631	isl_pw_qpolynomial_from_qpolynomial(
3632		__isl_take isl_qpolynomial *qp);
3633	__isl_give isl_pw_qpolynomial_fold *
3634	isl_pw_qpolynomial_fold_from_qpolynomial_fold(
3635		__isl_take isl_qpolynomial_fold *fold);
3636
3637C<isl_multi_aff_to_pw_multi_aff> and C<isl_pw_multi_aff_from_multi_aff> perform
3638the same operation.
3639
3640The inverse conversions below can only be used if the input
3641expression is known to be defined over a single universe domain.
3642
3643	#include <isl/aff.h>
3644	isl_bool isl_pw_aff_isa_aff(__isl_keep isl_pw_aff *pa);
3645	__isl_give isl_aff *isl_pw_aff_as_aff(
3646		__isl_take isl_pw_aff *pa);
3647	isl_bool isl_multi_pw_aff_isa_multi_aff(
3648		__isl_keep isl_multi_pw_aff *mpa);
3649	__isl_give isl_multi_aff *isl_multi_pw_aff_as_multi_aff(
3650		__isl_take isl_multi_pw_aff *mpa);
3651	isl_bool isl_pw_multi_aff_isa_multi_aff(
3652		__isl_keep isl_pw_multi_aff *pma);
3653	__isl_give isl_multi_aff *isl_pw_multi_aff_as_multi_aff(
3654		__isl_take isl_pw_multi_aff *pma);
3655
3656	#include <isl/polynomial.h>
3657	isl_bool isl_pw_qpolynomial_isa_qpolynomial(
3658		__isl_keep isl_pw_qpolynomial *pwqp);
3659	__isl_give isl_qpolynomial *
3660	isl_pw_qpolynomial_as_qpolynomial(
3661		__isl_take isl_pw_qpolynomial *pwqp);
3662	isl_bool isl_pw_qpolynomial_fold_isa_qpolynomial_fold(
3663		__isl_keep isl_pw_qpolynomial_fold *pwf);
3664	__isl_give isl_qpolynomial_fold *
3665	isl_pw_qpolynomial_fold_as_qpolynomial_fold(
3666		__isl_take isl_pw_qpolynomial_fold *pwf);
3667
3668A piecewise expression with a single specified cell can be
3669created using the following functions.
3670
3671	#include <isl/aff.h>
3672	__isl_give isl_pw_aff *isl_pw_aff_alloc(
3673		__isl_take isl_set *set, __isl_take isl_aff *aff);
3674	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
3675		__isl_take isl_set *set,
3676		__isl_take isl_multi_aff *maff);
3677
3678	#include <isl/polynomial.h>
3679	__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
3680		__isl_take isl_set *set,
3681		__isl_take isl_qpolynomial *qp);
3682
3683The following convenience functions first create a base expression and
3684then create a piecewise expression over a universe domain.
3685
3686	#include <isl/aff.h>
3687	__isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
3688		__isl_take isl_local_space *ls);
3689	__isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
3690		__isl_take isl_local_space *ls,
3691		enum isl_dim_type type, unsigned pos);
3692	__isl_give isl_pw_aff *isl_pw_aff_nan_on_domain_space(
3693		__isl_take isl_space *space);
3694	__isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
3695		__isl_take isl_local_space *ls);
3696	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
3697		__isl_take isl_space *space);
3698	__isl_give isl_pw_multi_aff *
3699	isl_pw_multi_aff_identity_on_domain_space(
3700		__isl_take isl_space *space)
3701	__isl_give isl_pw_multi_aff *
3702	isl_space_identity_pw_multi_aff_on_domain(
3703		__isl_take isl_space *space)
3704	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
3705		__isl_take isl_space *space);
3706	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_domain_map(
3707		__isl_take isl_space *space);
3708	__isl_give isl_pw_multi_aff *
3709	isl_space_domain_map_pw_multi_aff(
3710		__isl_take isl_space *space);
3711	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
3712		__isl_take isl_space *space);
3713	__isl_give isl_pw_multi_aff *
3714	isl_space_range_map_pw_multi_aff(
3715		__isl_take isl_space *space);
3716	__isl_give isl_pw_multi_aff *
3717	isl_pw_multi_aff_project_out_map(
3718		__isl_take isl_space *space,
3719		enum isl_dim_type type,
3720		unsigned first, unsigned n);
3721
3722	#include <isl/polynomial.h>
3723	__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
3724		__isl_take isl_space *space);
3725
3726C<isl_pw_multi_aff_identity_on_domain_space> and
3727C<isl_space_identity_pw_multi_aff_on_domain>
3728perform the same operation.
3729Similarly
3730for the pair C<isl_pw_multi_aff_domain_map> and
3731C<isl_space_domain_map_pw_multi_aff> and
3732for the pair C<isl_pw_multi_aff_range_map> and
3733C<isl_space_range_map_pw_multi_aff>.
3734
3735The following convenience functions first create a base expression and
3736then create a piecewise expression over a given domain.
3737
3738	#include <isl/aff.h>
3739	__isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
3740		__isl_take isl_set *domain,
3741		__isl_take isl_val *v);
3742	__isl_give isl_pw_multi_aff *
3743	isl_pw_multi_aff_multi_val_on_domain(
3744		__isl_take isl_set *domain,
3745		__isl_take isl_multi_val *mv);
3746	__isl_give isl_pw_multi_aff *
3747	isl_set_pw_multi_aff_on_domain_multi_val(
3748		__isl_take isl_set *domain,
3749		__isl_take isl_multi_val *mv);
3750	__isl_give isl_pw_aff *isl_pw_aff_param_on_domain_id(
3751		__isl_take isl_set *domain,
3752		__isl_take isl_id *id);
3753
3754C<isl_set_pw_multi_aff_on_domain_multi_val> is an alternative name
3755for C<isl_pw_multi_aff_multi_val_on_domain>.
3756
3757As a convenience, a piecewise multiple expression can
3758also be created from a piecewise expression.
3759Each multiple expression in the result is derived
3760from the corresponding base expression.
3761
3762	#include <isl/aff.h>
3763	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
3764		__isl_take isl_pw_aff *pa);
3765
3766Similarly, a piecewise quasipolynomial can be
3767created from a piecewise quasi-affine expression using
3768the following function.
3769
3770	#include <isl/polynomial.h>
3771	__isl_give isl_pw_qpolynomial *
3772	isl_pw_qpolynomial_from_pw_aff(
3773		__isl_take isl_pw_aff *pwaff);
3774
3775Piecewise expressions can be copied and freed using the following functions.
3776
3777	#include <isl/aff.h>
3778	__isl_give isl_pw_aff *isl_pw_aff_copy(
3779		__isl_keep isl_pw_aff *pwaff);
3780	__isl_null isl_pw_aff *isl_pw_aff_free(
3781		__isl_take isl_pw_aff *pwaff);
3782	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
3783		__isl_keep isl_pw_multi_aff *pma);
3784	__isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
3785		__isl_take isl_pw_multi_aff *pma);
3786
3787	#include <isl/polynomial.h>
3788	__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
3789		__isl_keep isl_pw_qpolynomial *pwqp);
3790	__isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
3791		__isl_take isl_pw_qpolynomial *pwqp);
3792	__isl_give isl_pw_qpolynomial_fold *
3793	isl_pw_qpolynomial_fold_copy(
3794		__isl_keep isl_pw_qpolynomial_fold *pwf);
3795	__isl_null isl_pw_qpolynomial_fold *
3796	isl_pw_qpolynomial_fold_free(
3797		__isl_take isl_pw_qpolynomial_fold *pwf);
3798
3799To iterate over the different cells of a piecewise expression,
3800use the following functions.
3801
3802	#include <isl/aff.h>
3803	isl_bool isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
3804	isl_size isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
3805	isl_stat isl_pw_aff_foreach_piece(
3806		__isl_keep isl_pw_aff *pwaff,
3807		isl_stat (*fn)(__isl_take isl_set *set,
3808			  __isl_take isl_aff *aff,
3809			  void *user), void *user);
3810	isl_bool isl_pw_aff_every_piece(__isl_keep isl_pw_aff *pa,
3811		isl_bool (*test)(__isl_keep isl_set *set,
3812			__isl_keep isl_aff *aff, void *user),
3813			void *user);
3814	isl_size isl_pw_multi_aff_n_piece(
3815		__isl_keep isl_pw_multi_aff *pma);
3816	isl_stat isl_pw_multi_aff_foreach_piece(
3817		__isl_keep isl_pw_multi_aff *pma,
3818		isl_stat (*fn)(__isl_take isl_set *set,
3819			    __isl_take isl_multi_aff *maff,
3820			    void *user), void *user);
3821	isl_bool isl_pw_multi_aff_every_piece(
3822		__isl_keep isl_pw_multi_aff *pma,
3823		isl_bool (*test)(__isl_keep isl_set *set,
3824			__isl_keep isl_multi_aff *ma, void *user),
3825			void *user);
3826
3827	#include <isl/polynomial.h>
3828	isl_size isl_pw_qpolynomial_n_piece(
3829		__isl_keep isl_pw_qpolynomial *pwqp);
3830	isl_stat isl_pw_qpolynomial_foreach_piece(
3831		__isl_keep isl_pw_qpolynomial *pwqp,
3832		isl_stat (*fn)(__isl_take isl_set *set,
3833			  __isl_take isl_qpolynomial *qp,
3834			  void *user), void *user);
3835	isl_bool isl_pw_qpolynomial_every_piece(
3836		__isl_keep isl_pw_qpolynomial *pwqp,
3837		isl_bool (*test)(__isl_keep isl_set *set,
3838			__isl_keep isl_qpolynomial *qp,
3839			void *user), void *user);
3840	isl_stat isl_pw_qpolynomial_foreach_lifted_piece(
3841		__isl_keep isl_pw_qpolynomial *pwqp,
3842		isl_stat (*fn)(__isl_take isl_set *set,
3843			  __isl_take isl_qpolynomial *qp,
3844			  void *user), void *user);
3845	isl_size isl_pw_qpolynomial_fold_n_piece(
3846		__isl_keep isl_pw_qpolynomial_fold *pwf);
3847	isl_stat isl_pw_qpolynomial_fold_foreach_piece(
3848		__isl_keep isl_pw_qpolynomial_fold *pwf,
3849		isl_stat (*fn)(__isl_take isl_set *set,
3850			  __isl_take isl_qpolynomial_fold *fold,
3851			  void *user), void *user);
3852	isl_bool isl_pw_qpolynomial_fold_every_piece(
3853		__isl_keep isl_pw_qpolynomial_fold *pwf,
3854		isl_bool (*test)(__isl_keep isl_set *set,
3855			__isl_keep isl_qpolynomial_fold *fold,
3856			void *user), void *user);
3857	isl_stat isl_pw_qpolynomial_fold_foreach_lifted_piece(
3858		__isl_keep isl_pw_qpolynomial_fold *pwf,
3859		isl_stat (*fn)(__isl_take isl_set *set,
3860			  __isl_take isl_qpolynomial_fold *fold,
3861			  void *user), void *user);
3862
3863As usual, the function C<fn> should return C<isl_stat_ok> on success
3864and C<isl_stat_error> on failure.  The difference between
3865C<isl_pw_qpolynomial_foreach_piece> and
3866C<isl_pw_qpolynomial_foreach_lifted_piece> is that
3867C<isl_pw_qpolynomial_foreach_lifted_piece> will first
3868compute unique representations for all existentially quantified
3869variables and then turn these existentially quantified variables
3870into extra set variables, adapting the associated quasipolynomial
3871accordingly.  This means that the C<set> passed to C<fn>
3872will not have any existentially quantified variables, but that
3873the dimensions of the sets may be different for different
3874invocations of C<fn>.
3875Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
3876and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
3877The function C<isl_pw_aff_every_piece> and its variants
3878check whether each call to the callback returns true and
3879stop checking as soon as one of these calls returns false (or error).
3880
3881A piecewise expression consisting of the expressions at a given
3882position of a piecewise multiple expression can be extracted
3883using the following function.
3884
3885	#include <isl/aff.h>
3886	__isl_give isl_pw_aff *isl_pw_multi_aff_get_at(
3887		__isl_keep isl_pw_multi_aff *pma, int pos);
3888	__isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3889		__isl_keep isl_pw_multi_aff *pma, int pos);
3890
3891C<isl_pw_multi_aff_get_pw_aff> is an alternative name for
3892C<isl_pw_multi_aff_get_at>.
3893
3894These expressions can be replaced using the following function.
3895
3896	#include <isl/aff.h>
3897	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3898		__isl_take isl_pw_multi_aff *pma, unsigned pos,
3899		__isl_take isl_pw_aff *pa);
3900
3901Note that there is a difference between C<isl_multi_pw_aff> and
3902C<isl_pw_multi_aff> objects.  The first is a sequence of piecewise
3903affine expressions, while the second is a piecewise sequence
3904of affine expressions.  In particular, each of the piecewise
3905affine expressions in an C<isl_multi_pw_aff> may have a different
3906domain, while all multiple expressions associated to a cell
3907in an C<isl_pw_multi_aff> have the same domain.
3908It is possible to convert between the two, but when converting
3909an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3910of the result is the intersection of the domains of the input.
3911The reverse conversion is exact.
3912
3913	#include <isl/aff.h>
3914	__isl_give isl_pw_multi_aff *
3915	isl_pw_multi_aff_from_multi_pw_aff(
3916		__isl_take isl_multi_pw_aff *mpa);
3917	__isl_give isl_multi_pw_aff *
3918	isl_pw_multi_aff_to_multi_pw_aff(
3919		__isl_take isl_pw_multi_aff *pma);
3920	__isl_give isl_multi_pw_aff *
3921	isl_multi_pw_aff_from_pw_multi_aff(
3922		__isl_take isl_pw_multi_aff *pma);
3923
3924C<isl_pw_multi_aff_to_multi_pw_aff> and
3925C<isl_multi_pw_aff_from_pw_multi_aff> perform the same operation.
3926
3927=head3 Union Expressions
3928
3929A union expression collects base expressions defined
3930over different domains.  The space of a union expression
3931is that of the shared parameter space.
3932
3933The union expression types defined by C<isl>
3934are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3935C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3936In case of
3937C<isl_union_pw_aff>,
3938C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>,
3939there can be at most one base expression for a given domain space.
3940In case of
3941C<isl_union_pw_multi_aff>,
3942there can be multiple such expressions for a given domain space,
3943but the domains of these expressions need to be disjoint.
3944
3945An empty union expression can be created using the following functions.
3946
3947	#include <isl/aff.h>
3948	__isl_give isl_union_pw_aff *
3949	isl_union_pw_aff_empty_ctx(
3950		isl_ctx *ctx);
3951	__isl_give isl_union_pw_aff *
3952	isl_union_pw_aff_empty_space(
3953		__isl_take isl_space *space);
3954	__isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
3955		__isl_take isl_space *space);
3956	__isl_give isl_union_pw_multi_aff *
3957	isl_union_pw_multi_aff_empty_ctx(
3958		isl_ctx *ctx);
3959	__isl_give isl_union_pw_multi_aff *
3960	isl_union_pw_multi_aff_empty_space(
3961		__isl_take isl_space *space);
3962	__isl_give isl_union_pw_multi_aff *
3963	isl_union_pw_multi_aff_empty(
3964		__isl_take isl_space *space);
3965
3966	#include <isl/polynomial.h>
3967	__isl_give isl_union_pw_qpolynomial *
3968	isl_union_pw_qpolynomial_zero_ctx(
3969		isl_ctx *ctx);
3970	__isl_give isl_union_pw_qpolynomial *
3971	isl_union_pw_qpolynomial_zero_space(
3972		__isl_take isl_space *space);
3973	__isl_give isl_union_pw_qpolynomial *
3974	isl_union_pw_qpolynomial_zero(
3975		__isl_take isl_space *space);
3976
3977C<isl_union_pw_aff_empty> is an alternative name for
3978C<isl_union_pw_aff_empty_space>.
3979Similarly for the other pairs of functions.
3980
3981A union expression containing a single base expression
3982can be created using the following functions.
3983
3984	#include <isl/aff.h>
3985	__isl_give isl_union_pw_aff *
3986	isl_pw_aff_to_union_pw_aff(
3987		__isl_take isl_pw_aff *pa);
3988	__isl_give isl_union_pw_aff *
3989	isl_union_pw_aff_from_pw_aff(
3990		__isl_take isl_pw_aff *pa);
3991	__isl_give isl_union_pw_multi_aff *
3992	isl_union_pw_multi_aff_from_aff(
3993		__isl_take isl_aff *aff);
3994	__isl_give isl_union_pw_multi_aff *
3995	isl_pw_multi_aff_to_union_pw_multi_aff(
3996		__isl_take isl_pw_multi_aff *pma);
3997	__isl_give isl_union_pw_multi_aff *
3998	isl_union_pw_multi_aff_from_pw_multi_aff(
3999		__isl_take isl_pw_multi_aff *pma);
4000
4001	#include <isl/polynomial.h>
4002	__isl_give isl_union_pw_qpolynomial *
4003	isl_pw_qpolynomial_to_union_pw_qpolynomial(
4004		__isl_take isl_pw_qpolynomial *pwqp);
4005	__isl_give isl_union_pw_qpolynomial *
4006	isl_union_pw_qpolynomial_from_pw_qpolynomial(
4007		__isl_take isl_pw_qpolynomial *pwqp);
4008	__isl_give isl_union_pw_qpolynomial_fold *
4009	isl_pw_qpolynomial_fold_to_union_pw_qpolynomial_fold(
4010		__isl_take isl_pw_qpolynomial_fold *pwf);
4011	__isl_give isl_union_pw_qpolynomial_fold *
4012	isl_union_pw_qpolynomial_fold_from_pw_qpolynomial_fold(
4013		__isl_take isl_pw_qpolynomial_fold *pwf);
4014
4015C<isl_pw_aff_to_union_pw_aff> and C<isl_union_pw_aff_from_pw_aff> perform
4016the same operation.
4017Similarly for C<isl_pw_multi_aff_to_union_pw_multi_aff> and
4018C<isl_union_pw_multi_aff_from_pw_multi_aff>,
4019for
4020C<isl_pw_qpolynomial_to_union_pw_qpolynomial> and
4021C<isl_union_pw_qpolynomial_from_pw_qpolynomial>, and
4022for
4023C<isl_pw_qpolynomial_fold_to_union_pw_qpolynomial_fold> and
4024C<isl_union_pw_qpolynomial_fold_from_pw_qpolynomial_fold>.
4025
4026The inverse conversions below can only be used if the input
4027expression is known to live in exactly one space.
4028
4029	#include <isl/aff.h>
4030	isl_bool isl_union_pw_multi_aff_isa_pw_multi_aff(
4031		__isl_keep isl_union_pw_multi_aff *upma);
4032	__isl_give isl_pw_multi_aff *
4033	isl_union_pw_multi_aff_as_pw_multi_aff(
4034		__isl_take isl_union_pw_multi_aff *upma);
4035
4036A union piecewise expression containing a single base expression
4037on a universe domain can also be created directly from
4038a base expression using the following functions.
4039
4040	#include <isl/aff.h>
4041	__isl_give isl_union_pw_aff *isl_union_pw_aff_from_aff(
4042		__isl_take isl_aff *aff);
4043	__isl_give isl_union_pw_multi_aff *
4044	isl_union_pw_multi_aff_from_multi_aff(
4045		__isl_take isl_multi_aff *ma);
4046
4047The following functions create a base expression on each
4048of the sets in the union set and collect the results.
4049
4050	#include <isl/aff.h>
4051	__isl_give isl_union_pw_multi_aff *
4052	isl_union_pw_multi_aff_from_union_pw_aff(
4053		__isl_take isl_union_pw_aff *upa);
4054	__isl_give isl_union_pw_aff *
4055	isl_union_pw_multi_aff_get_union_pw_aff(
4056		__isl_keep isl_union_pw_multi_aff *upma, int pos);
4057	__isl_give isl_union_pw_aff *
4058	isl_union_pw_aff_val_on_domain(
4059		__isl_take isl_union_set *domain,
4060		__isl_take isl_val *v);
4061	__isl_give isl_union_pw_multi_aff *
4062	isl_union_pw_multi_aff_multi_val_on_domain(
4063		__isl_take isl_union_set *domain,
4064		__isl_take isl_multi_val *mv);
4065	__isl_give isl_union_pw_aff *
4066	isl_union_pw_aff_param_on_domain_id(
4067		__isl_take isl_union_set *domain,
4068		__isl_take isl_id *id);
4069
4070The C<id> argument of C<isl_union_pw_aff_param_on_domain_id>
4071is the identifier of a parameter that may or may not already
4072be present in C<domain>.
4073
4074An C<isl_union_pw_aff> that is equal to a (parametric) affine
4075or piecewise affine
4076expression on a given domain can be created using the following
4077functions.
4078
4079	#include <isl/aff.h>
4080	__isl_give isl_union_pw_aff *
4081	isl_union_pw_aff_aff_on_domain(
4082		__isl_take isl_union_set *domain,
4083		__isl_take isl_aff *aff);
4084	__isl_give isl_union_pw_aff *
4085	isl_union_pw_aff_pw_aff_on_domain(
4086		__isl_take isl_union_set *domain,
4087		__isl_take isl_pw_aff *pa);
4088
4089A base expression can be added to a union expression using
4090the following functions.
4091
4092	#include <isl/aff.h>
4093	__isl_give isl_union_pw_aff *
4094	isl_union_pw_aff_add_pw_aff(
4095		__isl_take isl_union_pw_aff *upa,
4096		__isl_take isl_pw_aff *pa);
4097	__isl_give isl_union_pw_multi_aff *
4098	isl_union_pw_multi_aff_add_pw_multi_aff(
4099		__isl_take isl_union_pw_multi_aff *upma,
4100		__isl_take isl_pw_multi_aff *pma);
4101
4102	#include <isl/polynomial.h>
4103	__isl_give isl_union_pw_qpolynomial *
4104	isl_union_pw_qpolynomial_add_pw_qpolynomial(
4105		__isl_take isl_union_pw_qpolynomial *upwqp,
4106		__isl_take isl_pw_qpolynomial *pwqp);
4107
4108Union expressions can be copied and freed using
4109the following functions.
4110
4111	#include <isl/aff.h>
4112	__isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
4113		__isl_keep isl_union_pw_aff *upa);
4114	__isl_null isl_union_pw_aff *isl_union_pw_aff_free(
4115		__isl_take isl_union_pw_aff *upa);
4116	__isl_give isl_union_pw_multi_aff *
4117	isl_union_pw_multi_aff_copy(
4118		__isl_keep isl_union_pw_multi_aff *upma);
4119	__isl_null isl_union_pw_multi_aff *
4120	isl_union_pw_multi_aff_free(
4121		__isl_take isl_union_pw_multi_aff *upma);
4122
4123	#include <isl/polynomial.h>
4124	__isl_give isl_union_pw_qpolynomial *
4125	isl_union_pw_qpolynomial_copy(
4126		__isl_keep isl_union_pw_qpolynomial *upwqp);
4127	__isl_null isl_union_pw_qpolynomial *
4128	isl_union_pw_qpolynomial_free(
4129		__isl_take isl_union_pw_qpolynomial *upwqp);
4130	__isl_give isl_union_pw_qpolynomial_fold *
4131	isl_union_pw_qpolynomial_fold_copy(
4132		__isl_keep isl_union_pw_qpolynomial_fold *upwf);
4133	__isl_null isl_union_pw_qpolynomial_fold *
4134	isl_union_pw_qpolynomial_fold_free(
4135		__isl_take isl_union_pw_qpolynomial_fold *upwf);
4136
4137To iterate over the base expressions in a union expression,
4138use the following functions.
4139
4140	#include <isl/aff.h>
4141	isl_size isl_union_pw_aff_n_pw_aff(
4142		__isl_keep isl_union_pw_aff *upa);
4143	isl_stat isl_union_pw_aff_foreach_pw_aff(
4144		__isl_keep isl_union_pw_aff *upa,
4145		isl_stat (*fn)(__isl_take isl_pw_aff *pa,
4146			void *user), void *user);
4147	isl_bool isl_union_pw_aff_every_pw_aff(
4148		__isl_keep isl_union_pw_aff *upa,
4149		isl_bool (*test)(__isl_keep isl_pw_aff *pa,
4150			void *user), void *user);
4151	isl_size isl_union_pw_multi_aff_n_pw_multi_aff(
4152		__isl_keep isl_union_pw_multi_aff *upma);
4153	isl_stat isl_union_pw_multi_aff_foreach_pw_multi_aff(
4154		__isl_keep isl_union_pw_multi_aff *upma,
4155		isl_stat (*fn)(__isl_take isl_pw_multi_aff *pma,
4156			    void *user), void *user);
4157	isl_bool isl_union_pw_multi_aff_every_pw_multi_aff(
4158		__isl_keep isl_union_pw_multi_aff *upma,
4159		isl_bool (*test)(
4160			__isl_keep isl_pw_multi_aff *pma,
4161			void *user), void *user);
4162
4163	#include <isl/polynomial.h>
4164	isl_size isl_union_pw_qpolynomial_n_pw_qpolynomial(
4165		__isl_keep isl_union_pw_qpolynomial *upwqp);
4166	isl_stat isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
4167		__isl_keep isl_union_pw_qpolynomial *upwqp,
4168		isl_stat (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
4169			    void *user), void *user);
4170	isl_bool isl_union_pw_qpolynomial_every_pw_qpolynomial(
4171		__isl_keep isl_union_pw_qpolynomial *upwqp,
4172		isl_bool (*test)(
4173			__isl_keep isl_pw_qpolynomial *pwqp,
4174			void *user), void *user);
4175	isl_size isl_union_pw_qpolynomial_fold_n_pw_qpolynomial_fold(
4176		__isl_keep isl_union_pw_qpolynomial_fold *upwf);
4177	isl_stat isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
4178		__isl_keep isl_union_pw_qpolynomial_fold *upwf,
4179		isl_stat (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
4180			    void *user), void *user);
4181	isl_bool
4182	isl_union_pw_qpolynomial_fold_every_pw_qpolynomial_fold(
4183		__isl_keep isl_union_pw_qpolynomial_fold *upwf,
4184		isl_bool (*test)(
4185			__isl_keep isl_pw_qpolynomial_fold *pwf,
4186			void *user), void *user);
4187
4188To extract the base expression in a given space from a union, use
4189the following functions.
4190
4191	#include <isl/aff.h>
4192	__isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
4193		__isl_keep isl_union_pw_aff *upa,
4194		__isl_take isl_space *space);
4195	__isl_give isl_pw_multi_aff *
4196	isl_union_pw_multi_aff_extract_pw_multi_aff(
4197		__isl_keep isl_union_pw_multi_aff *upma,
4198		__isl_take isl_space *space);
4199
4200	#include <isl/polynomial.h>
4201	__isl_give isl_pw_qpolynomial *
4202	isl_union_pw_qpolynomial_extract_pw_qpolynomial(
4203		__isl_keep isl_union_pw_qpolynomial *upwqp,
4204		__isl_take isl_space *space);
4205
4206It is also possible to obtain a list of the base expressions using
4207the following functions.
4208
4209	#include <isl/aff.h>
4210	__isl_give isl_pw_aff_list *
4211	isl_union_pw_aff_get_pw_aff_list(
4212		__isl_keep isl_union_pw_aff *upa);
4213	__isl_give isl_pw_multi_aff_list *
4214	isl_union_pw_multi_aff_get_pw_multi_aff_list(
4215		__isl_keep isl_union_pw_multi_aff *upma);
4216
4217	#include <isl/polynomial.h>
4218	__isl_give isl_pw_qpolynomial_list *
4219	isl_union_pw_qpolynomial_get_pw_qpolynomial_list(
4220		__isl_keep isl_union_pw_qpolynomial *upwqp);
4221	__isl_give isl_pw_qpolynomial_fold_list *
4222	isl_union_pw_qpolynomial_fold_get_pw_qpolynomial_fold_list(
4223		__isl_keep isl_union_pw_qpolynomial_fold *upwf);
4224
4225The returned list can be manipulated using the functions in L<"Lists">.
4226
4227=head2 Input and Output
4228
4229For set and relation,
4230C<isl> supports its own input/output format, which is similar
4231to the C<Omega> format, but also supports the C<PolyLib> format
4232in some cases.
4233For other object types, typically only an C<isl> format is supported.
4234
4235=head3 C<isl> format
4236
4237The C<isl> format is similar to that of C<Omega>, but has a different
4238syntax for describing the parameters and allows for the definition
4239of an existentially quantified variable as the integer division
4240of an affine expression.
4241For example, the set of integers C<i> between C<0> and C<n>
4242such that C<i % 10 <= 6> can be described as
4243
4244	[n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
4245				i - 10 a <= 6) }
4246
4247A set or relation can have several disjuncts, separated
4248by the keyword C<or>.  Each disjunct is either a conjunction
4249of constraints or a projection (C<exists>) of a conjunction
4250of constraints.  The constraints are separated by the keyword
4251C<and>.
4252
4253=head3 C<PolyLib> format
4254
4255If the represented set is a union, then the first line
4256contains a single number representing the number of disjuncts.
4257Otherwise, a line containing the number C<1> is optional.
4258
4259Each disjunct is represented by a matrix of constraints.
4260The first line contains two numbers representing
4261the number of rows and columns,
4262where the number of rows is equal to the number of constraints
4263and the number of columns is equal to two plus the number of variables.
4264The following lines contain the actual rows of the constraint matrix.
4265In each row, the first column indicates whether the constraint
4266is an equality (C<0>) or inequality (C<1>).  The final column
4267corresponds to the constant term.
4268
4269If the set is parametric, then the coefficients of the parameters
4270appear in the last columns before the constant column.
4271The coefficients of any existentially quantified variables appear
4272between those of the set variables and those of the parameters.
4273
4274=head3 Extended C<PolyLib> format
4275
4276The extended C<PolyLib> format is nearly identical to the
4277C<PolyLib> format.  The only difference is that the line
4278containing the number of rows and columns of a constraint matrix
4279also contains four additional numbers:
4280the number of output dimensions, the number of input dimensions,
4281the number of local dimensions (i.e., the number of existentially
4282quantified variables) and the number of parameters.
4283For sets, the number of ``output'' dimensions is equal
4284to the number of set dimensions, while the number of ``input''
4285dimensions is zero.
4286
4287=head3 Input
4288
4289Objects can be read from input using the following functions.
4290
4291	#include <isl/id.h>
4292	__isl_give isl_id *isl_id_read_from_str(isl_ctx *ctx,
4293		const char *str);
4294	__isl_give isl_multi_id *isl_multi_id_read_from_str(
4295		isl_ctx *ctx, const char *str);
4296
4297	#include <isl/val.h>
4298	__isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
4299		const char *str);
4300	__isl_give isl_multi_val *isl_multi_val_read_from_str(
4301		isl_ctx *ctx, const char *str);
4302
4303	#include <isl/set.h>
4304	__isl_give isl_basic_set *isl_basic_set_read_from_file(
4305		isl_ctx *ctx, FILE *input);
4306	__isl_give isl_basic_set *isl_basic_set_read_from_str(
4307		isl_ctx *ctx, const char *str);
4308	__isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
4309		FILE *input);
4310	__isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
4311		const char *str);
4312
4313	#include <isl/map.h>
4314	__isl_give isl_basic_map *isl_basic_map_read_from_file(
4315		isl_ctx *ctx, FILE *input);
4316	__isl_give isl_basic_map *isl_basic_map_read_from_str(
4317		isl_ctx *ctx, const char *str);
4318	__isl_give isl_map *isl_map_read_from_file(
4319		isl_ctx *ctx, FILE *input);
4320	__isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
4321		const char *str);
4322
4323	#include <isl/union_set.h>
4324	__isl_give isl_union_set *isl_union_set_read_from_file(
4325		isl_ctx *ctx, FILE *input);
4326	__isl_give isl_union_set *isl_union_set_read_from_str(
4327		isl_ctx *ctx, const char *str);
4328
4329	#include <isl/union_map.h>
4330	__isl_give isl_union_map *isl_union_map_read_from_file(
4331		isl_ctx *ctx, FILE *input);
4332	__isl_give isl_union_map *isl_union_map_read_from_str(
4333		isl_ctx *ctx, const char *str);
4334
4335	#include <isl/aff.h>
4336	__isl_give isl_aff *isl_aff_read_from_str(
4337		isl_ctx *ctx, const char *str);
4338	__isl_give isl_multi_aff *isl_multi_aff_read_from_str(
4339		isl_ctx *ctx, const char *str);
4340	__isl_give isl_pw_aff *isl_pw_aff_read_from_str(
4341		isl_ctx *ctx, const char *str);
4342	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
4343		isl_ctx *ctx, const char *str);
4344	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
4345		isl_ctx *ctx, const char *str);
4346	__isl_give isl_union_pw_aff *
4347	isl_union_pw_aff_read_from_str(
4348		isl_ctx *ctx, const char *str);
4349	__isl_give isl_union_pw_multi_aff *
4350	isl_union_pw_multi_aff_read_from_str(
4351		isl_ctx *ctx, const char *str);
4352	__isl_give isl_multi_union_pw_aff *
4353	isl_multi_union_pw_aff_read_from_str(
4354		isl_ctx *ctx, const char *str);
4355
4356	#include <isl/polynomial.h>
4357	__isl_give isl_union_pw_qpolynomial *
4358	isl_union_pw_qpolynomial_read_from_str(
4359		isl_ctx *ctx, const char *str);
4360
4361	__isl_give isl_pw_qpolynomial_fold *
4362	isl_pw_qpolynomial_fold_read_from_str(
4363		isl_ctx *ctx, const char *str);
4364
4365For sets and relations,
4366the input format is autodetected and may be either the C<PolyLib> format
4367or the C<isl> format.
4368
4369=head3 Output
4370
4371Before anything can be printed, an C<isl_printer> needs to
4372be created.
4373
4374	__isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
4375		FILE *file);
4376	__isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
4377	__isl_null isl_printer *isl_printer_free(
4378		__isl_take isl_printer *printer);
4379
4380C<isl_printer_to_file> prints to the given file, while
4381C<isl_printer_to_str> prints to a string that can be extracted
4382using the following function.
4383
4384	#include <isl/printer.h>
4385	__isl_give char *isl_printer_get_str(
4386		__isl_keep isl_printer *printer);
4387
4388The printer can be inspected using the following functions.
4389
4390	FILE *isl_printer_get_file(
4391		__isl_keep isl_printer *printer);
4392	int isl_printer_get_output_format(
4393		__isl_keep isl_printer *p);
4394	int isl_printer_get_yaml_style(__isl_keep isl_printer *p);
4395
4396The behavior of the printer can be modified in various ways
4397
4398	__isl_give isl_printer *isl_printer_set_output_format(
4399		__isl_take isl_printer *p, int output_format);
4400	__isl_give isl_printer *isl_printer_set_indent(
4401		__isl_take isl_printer *p, int indent);
4402	__isl_give isl_printer *isl_printer_set_indent_prefix(
4403		__isl_take isl_printer *p, const char *prefix);
4404	__isl_give isl_printer *isl_printer_indent(
4405		__isl_take isl_printer *p, int indent);
4406	__isl_give isl_printer *isl_printer_set_prefix(
4407		__isl_take isl_printer *p, const char *prefix);
4408	__isl_give isl_printer *isl_printer_set_suffix(
4409		__isl_take isl_printer *p, const char *suffix);
4410	__isl_give isl_printer *isl_printer_set_yaml_style(
4411		__isl_take isl_printer *p, int yaml_style);
4412
4413The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
4414C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
4415and defaults to C<ISL_FORMAT_ISL>.
4416Each line in the output is prefixed by C<indent_prefix>,
4417indented by C<indent> (set by C<isl_printer_set_indent>) spaces
4418(default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
4419In the C<PolyLib> format output,
4420the coefficients of the existentially quantified variables
4421appear between those of the set variables and those
4422of the parameters.
4423The function C<isl_printer_indent> increases the indentation
4424by the specified amount (which may be negative).
4425The YAML style may be either C<ISL_YAML_STYLE_BLOCK> or
4426C<ISL_YAML_STYLE_FLOW> and when we are printing something
4427in YAML format.
4428
4429To actually print something, use
4430
4431	#include <isl/printer.h>
4432	__isl_give isl_printer *isl_printer_print_double(
4433		__isl_take isl_printer *p, double d);
4434
4435	#include <isl/val.h>
4436	__isl_give isl_printer *isl_printer_print_val(
4437		__isl_take isl_printer *p, __isl_keep isl_val *v);
4438
4439	#include <isl/set.h>
4440	__isl_give isl_printer *isl_printer_print_basic_set(
4441		__isl_take isl_printer *printer,
4442		__isl_keep isl_basic_set *bset);
4443	__isl_give isl_printer *isl_printer_print_set(
4444		__isl_take isl_printer *printer,
4445		__isl_keep isl_set *set);
4446
4447	#include <isl/map.h>
4448	__isl_give isl_printer *isl_printer_print_basic_map(
4449		__isl_take isl_printer *printer,
4450		__isl_keep isl_basic_map *bmap);
4451	__isl_give isl_printer *isl_printer_print_map(
4452		__isl_take isl_printer *printer,
4453		__isl_keep isl_map *map);
4454
4455	#include <isl/union_set.h>
4456	__isl_give isl_printer *isl_printer_print_union_set(
4457		__isl_take isl_printer *p,
4458		__isl_keep isl_union_set *uset);
4459
4460	#include <isl/union_map.h>
4461	__isl_give isl_printer *isl_printer_print_union_map(
4462		__isl_take isl_printer *p,
4463		__isl_keep isl_union_map *umap);
4464
4465	#include <isl/val.h>
4466	__isl_give isl_printer *isl_printer_print_multi_val(
4467		__isl_take isl_printer *p,
4468		__isl_keep isl_multi_val *mv);
4469
4470	#include <isl/id.h>
4471	__isl_give isl_printer *isl_printer_print_multi_id(
4472		__isl_take isl_printer *p,
4473		__isl_keep isl_multi_id *mi);
4474
4475	#include <isl/aff.h>
4476	__isl_give isl_printer *isl_printer_print_aff(
4477		__isl_take isl_printer *p, __isl_keep isl_aff *aff);
4478	__isl_give isl_printer *isl_printer_print_multi_aff(
4479		__isl_take isl_printer *p,
4480		__isl_keep isl_multi_aff *maff);
4481	__isl_give isl_printer *isl_printer_print_pw_aff(
4482		__isl_take isl_printer *p,
4483		__isl_keep isl_pw_aff *pwaff);
4484	__isl_give isl_printer *isl_printer_print_pw_multi_aff(
4485		__isl_take isl_printer *p,
4486		__isl_keep isl_pw_multi_aff *pma);
4487	__isl_give isl_printer *isl_printer_print_multi_pw_aff(
4488		__isl_take isl_printer *p,
4489		__isl_keep isl_multi_pw_aff *mpa);
4490	__isl_give isl_printer *isl_printer_print_union_pw_aff(
4491		__isl_take isl_printer *p,
4492		__isl_keep isl_union_pw_aff *upa);
4493	__isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
4494		__isl_take isl_printer *p,
4495		__isl_keep isl_union_pw_multi_aff *upma);
4496	__isl_give isl_printer *
4497	isl_printer_print_multi_union_pw_aff(
4498		__isl_take isl_printer *p,
4499		__isl_keep isl_multi_union_pw_aff *mupa);
4500
4501	#include <isl/polynomial.h>
4502	__isl_give isl_printer *isl_printer_print_qpolynomial(
4503		__isl_take isl_printer *p,
4504		__isl_keep isl_qpolynomial *qp);
4505	__isl_give isl_printer *isl_printer_print_pw_qpolynomial(
4506		__isl_take isl_printer *p,
4507		__isl_keep isl_pw_qpolynomial *pwqp);
4508	__isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
4509		__isl_take isl_printer *p,
4510		__isl_keep isl_union_pw_qpolynomial *upwqp);
4511
4512	__isl_give isl_printer *
4513	isl_printer_print_pw_qpolynomial_fold(
4514		__isl_take isl_printer *p,
4515		__isl_keep isl_pw_qpolynomial_fold *pwf);
4516	__isl_give isl_printer *
4517	isl_printer_print_union_pw_qpolynomial_fold(
4518		__isl_take isl_printer *p,
4519		__isl_keep isl_union_pw_qpolynomial_fold *upwf);
4520
4521For C<isl_printer_print_qpolynomial>,
4522C<isl_printer_print_pw_qpolynomial> and
4523C<isl_printer_print_pw_qpolynomial_fold>,
4524the output format of the printer
4525needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
4526For C<isl_printer_print_union_pw_qpolynomial> and
4527C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
4528is supported.
4529In case of printing in C<ISL_FORMAT_C>, the user may want
4530to set the names of all dimensions first.
4531
4532C<isl> also provides limited support for printing YAML documents,
4533just enough for the internal use for printing such documents.
4534
4535	#include <isl/printer.h>
4536	__isl_give isl_printer *isl_printer_yaml_start_mapping(
4537		__isl_take isl_printer *p);
4538	__isl_give isl_printer *isl_printer_yaml_end_mapping(
4539		__isl_take isl_printer *p);
4540	__isl_give isl_printer *isl_printer_yaml_start_sequence(
4541		__isl_take isl_printer *p);
4542	__isl_give isl_printer *isl_printer_yaml_end_sequence(
4543		__isl_take isl_printer *p);
4544	__isl_give isl_printer *isl_printer_yaml_next(
4545		__isl_take isl_printer *p);
4546
4547A document is started by a call to either
4548C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
4549Anything printed to the printer after such a call belong to the
4550first key of the mapping or the first element in the sequence.
4551The function C<isl_printer_yaml_next> moves to the value if
4552we are currently printing a mapping key, the next key if we
4553are printing a value or the next element if we are printing
4554an element in a sequence.
4555Nested mappings and sequences are initiated by the same
4556C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
4557Each call to these functions needs to have a corresponding call to
4558C<isl_printer_yaml_end_mapping> or C<isl_printer_yaml_end_sequence>.
4559
4560When called on a file printer, the following function flushes
4561the file.  When called on a string printer, the buffer is cleared.
4562
4563	__isl_give isl_printer *isl_printer_flush(
4564		__isl_take isl_printer *p);
4565
4566The following functions allow the user to attach
4567notes to a printer in order to keep track of additional state.
4568
4569	#include <isl/printer.h>
4570	isl_bool isl_printer_has_note(__isl_keep isl_printer *p,
4571		__isl_keep isl_id *id);
4572	__isl_give isl_id *isl_printer_get_note(
4573		__isl_keep isl_printer *p, __isl_take isl_id *id);
4574	__isl_give isl_printer *isl_printer_set_note(
4575		__isl_take isl_printer *p,
4576		__isl_take isl_id *id, __isl_take isl_id *note);
4577
4578C<isl_printer_set_note> associates the given note to the given
4579identifier in the printer.
4580C<isl_printer_get_note> retrieves a note associated to an
4581identifier, while
4582C<isl_printer_has_note> checks if there is such a note.
4583C<isl_printer_get_note> fails if the requested note does not exist.
4584
4585Alternatively, a string representation can be obtained
4586directly using the following functions, which always print
4587in isl format.
4588
4589	#include <isl/id.h>
4590	__isl_give char *isl_id_to_str(
4591		__isl_keep isl_id *id);
4592	__isl_give char *isl_multi_id_to_str(
4593		__isl_keep isl_multi_id *mi);
4594
4595	#include <isl/space.h>
4596	__isl_give char *isl_space_to_str(
4597		__isl_keep isl_space *space);
4598
4599	#include <isl/val.h>
4600	__isl_give char *isl_val_to_str(__isl_keep isl_val *v);
4601	__isl_give char *isl_multi_val_to_str(
4602		__isl_keep isl_multi_val *mv);
4603
4604	#include <isl/set.h>
4605	__isl_give char *isl_basic_set_to_str(
4606		__isl_keep isl_basic_set *bset);
4607	__isl_give char *isl_set_to_str(
4608		__isl_keep isl_set *set);
4609
4610	#include <isl/union_set.h>
4611	__isl_give char *isl_union_set_to_str(
4612		__isl_keep isl_union_set *uset);
4613
4614	#include <isl/map.h>
4615	__isl_give char *isl_basic_map_to_str(
4616		__isl_keep isl_basic_map *bmap);
4617	__isl_give char *isl_map_to_str(
4618		__isl_keep isl_map *map);
4619
4620	#include <isl/union_map.h>
4621	__isl_give char *isl_union_map_to_str(
4622		__isl_keep isl_union_map *umap);
4623
4624	#include <isl/aff.h>
4625	__isl_give char *isl_aff_to_str(__isl_keep isl_aff *aff);
4626	__isl_give char *isl_pw_aff_to_str(
4627		__isl_keep isl_pw_aff *pa);
4628	__isl_give char *isl_multi_aff_to_str(
4629		__isl_keep isl_multi_aff *ma);
4630	__isl_give char *isl_pw_multi_aff_to_str(
4631		__isl_keep isl_pw_multi_aff *pma);
4632	__isl_give char *isl_multi_pw_aff_to_str(
4633		__isl_keep isl_multi_pw_aff *mpa);
4634	__isl_give char *isl_union_pw_aff_to_str(
4635		__isl_keep isl_union_pw_aff *upa);
4636	__isl_give char *isl_union_pw_multi_aff_to_str(
4637		__isl_keep isl_union_pw_multi_aff *upma);
4638	__isl_give char *isl_multi_union_pw_aff_to_str(
4639		__isl_keep isl_multi_union_pw_aff *mupa);
4640
4641	#include <isl/point.h>
4642	__isl_give char *isl_point_to_str(
4643		__isl_keep isl_point *pnt);
4644
4645	#include <isl/polynomial.h>
4646	__isl_give char *isl_pw_qpolynomial_to_str(
4647		__isl_keep isl_pw_qpolynomial *pwqp);
4648	__isl_give char *isl_union_pw_qpolynomial_to_str(
4649		__isl_keep isl_union_pw_qpolynomial *upwqp);
4650
4651=head2 Properties
4652
4653=head3 Unary Properties
4654
4655=over
4656
4657=item * Emptiness
4658
4659The following functions test whether the given set or relation
4660contains any integer points.  The ``plain'' variants do not perform
4661any computations, but simply check if the given set or relation
4662is already known to be empty.
4663
4664	#include <isl/set.h>
4665	isl_bool isl_basic_set_plain_is_empty(
4666		__isl_keep isl_basic_set *bset);
4667	isl_bool isl_basic_set_is_empty(
4668		__isl_keep isl_basic_set *bset);
4669	isl_bool isl_set_plain_is_empty(
4670		__isl_keep isl_set *set);
4671	isl_bool isl_set_is_empty(__isl_keep isl_set *set);
4672
4673	#include <isl/union_set.h>
4674	isl_bool isl_union_set_is_empty(
4675		__isl_keep isl_union_set *uset);
4676
4677	#include <isl/map.h>
4678	isl_bool isl_basic_map_plain_is_empty(
4679		__isl_keep isl_basic_map *bmap);
4680	isl_bool isl_basic_map_is_empty(
4681		__isl_keep isl_basic_map *bmap);
4682	isl_bool isl_map_plain_is_empty(
4683		__isl_keep isl_map *map);
4684	isl_bool isl_map_is_empty(__isl_keep isl_map *map);
4685
4686	#include <isl/union_map.h>
4687	isl_bool isl_union_map_plain_is_empty(
4688		__isl_keep isl_union_map *umap);
4689	isl_bool isl_union_map_is_empty(
4690		__isl_keep isl_union_map *umap);
4691
4692	#include <isl/aff.h>
4693	isl_bool isl_union_pw_multi_aff_plain_is_empty(
4694		__isl_keep isl_union_pw_multi_aff *upma);
4695
4696=item * Universality
4697
4698	isl_bool isl_basic_set_plain_is_universe(
4699		__isl_keep isl_basic_set *bset);
4700	isl_bool isl_basic_set_is_universe(
4701		__isl_keep isl_basic_set *bset);
4702	isl_bool isl_basic_map_plain_is_universe(
4703		__isl_keep isl_basic_map *bmap);
4704	isl_bool isl_basic_map_is_universe(
4705		__isl_keep isl_basic_map *bmap);
4706	isl_bool isl_set_plain_is_universe(
4707		__isl_keep isl_set *set);
4708	isl_bool isl_map_plain_is_universe(
4709		__isl_keep isl_map *map);
4710
4711=item * Single-valuedness
4712
4713	#include <isl/set.h>
4714	isl_bool isl_set_is_singleton(__isl_keep isl_set *set);
4715
4716	#include <isl/map.h>
4717	isl_bool isl_basic_map_is_single_valued(
4718		__isl_keep isl_basic_map *bmap);
4719	isl_bool isl_map_plain_is_single_valued(
4720		__isl_keep isl_map *map);
4721	isl_bool isl_map_is_single_valued(__isl_keep isl_map *map);
4722
4723	#include <isl/union_map.h>
4724	isl_bool isl_union_map_is_single_valued(
4725		__isl_keep isl_union_map *umap);
4726
4727=item * Injectivity
4728
4729	isl_bool isl_map_plain_is_injective(
4730		__isl_keep isl_map *map);
4731	isl_bool isl_map_is_injective(
4732		__isl_keep isl_map *map);
4733	isl_bool isl_union_map_plain_is_injective(
4734		__isl_keep isl_union_map *umap);
4735	isl_bool isl_union_map_is_injective(
4736		__isl_keep isl_union_map *umap);
4737
4738=item * Bijectivity
4739
4740	isl_bool isl_map_is_bijective(
4741		__isl_keep isl_map *map);
4742	isl_bool isl_union_map_is_bijective(
4743		__isl_keep isl_union_map *umap);
4744
4745=item * Identity
4746
4747The following functions test whether the given relation
4748only maps elements to themselves.
4749
4750	#include <isl/map.h>
4751	isl_bool isl_map_is_identity(
4752		__isl_keep isl_map *map);
4753
4754	#include <isl/union_map.h>
4755	isl_bool isl_union_map_is_identity(
4756		__isl_keep isl_union_map *umap);
4757
4758=item * Position
4759
4760	__isl_give isl_val *
4761	isl_basic_map_plain_get_val_if_fixed(
4762		__isl_keep isl_basic_map *bmap,
4763		enum isl_dim_type type, unsigned pos);
4764	__isl_give isl_val *isl_set_plain_get_val_if_fixed(
4765		__isl_keep isl_set *set,
4766		enum isl_dim_type type, unsigned pos);
4767	__isl_give isl_multi_val *
4768	isl_set_get_plain_multi_val_if_fixed(
4769		__isl_keep isl_set *set);
4770	__isl_give isl_val *isl_map_plain_get_val_if_fixed(
4771		__isl_keep isl_map *map,
4772		enum isl_dim_type type, unsigned pos);
4773
4774If the set or relation obviously lies on a hyperplane where the given dimension
4775has a fixed value, then return that value.
4776Otherwise return NaN.
4777C<isl_set_get_plain_multi_val_if_fixed> collects the results over
4778all set dimensions.
4779
4780=item * Stride
4781
4782Stride detection is based on heuristics.
4783The strides returned by the functions below are always valid,
4784but there may be larger valid strides that are not detected.
4785
4786	isl_stat isl_set_dim_residue_class_val(
4787		__isl_keep isl_set *set,
4788		int pos, __isl_give isl_val **modulo,
4789		__isl_give isl_val **residue);
4790
4791Check if the values of the given set dimension are equal to a fixed
4792value modulo some integer value.  If so, assign the modulo to C<*modulo>
4793and the fixed value to C<*residue>.  If the given dimension attains only
4794a single value, then assign C<0> to C<*modulo> and the fixed value to
4795C<*residue>.
4796If the dimension does not attain only a single value and if no modulo
4797can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
4798
4799	#include <isl/set.h>
4800	__isl_give isl_stride_info *isl_set_get_stride_info(
4801		__isl_keep isl_set *set, int pos);
4802	__isl_give isl_val *isl_set_get_stride(
4803		__isl_keep isl_set *set, int pos);
4804
4805	#include <isl/map.h>
4806	__isl_give isl_stride_info *
4807	isl_map_get_range_stride_info(
4808		__isl_keep isl_map *map, int pos);
4809	__isl_give isl_fixed_box *
4810	isl_map_get_range_lattice_tile(
4811		__isl_keep isl_map *map);
4812
4813Check if the values of the given set dimension are equal to
4814some affine expression of the other dimensions (the offset)
4815modulo some integer stride or
4816check if the values of the given output dimensions are equal to
4817some affine expression of the input dimensions (the offset)
4818modulo some integer stride.
4819If no more specific information can be found, then the stride
4820is taken to be one and the offset is taken to be the zero expression.
4821The function C<isl_set_get_stride> performs the same
4822computation as C<isl_set_get_stride_info> but only returns the stride.
4823The function C<isl_map_get_range_lattice_tile> collects the stride
4824information over all output dimensions.
4825In particular, it returns a tile of a rectangular lattice
4826(possibly of size 1 in all directions)
4827containing the output in terms of the parameters and the input dimensions.
4828The size and the offset of this tile correspond to
4829the strides and the offsets of the stride information and
4830can be extracted from the returned
4831C<isl_fixed_box> using the functions described under "Box hull" in
4832L</"Unary Operations">.  Note that the C<isl_fixed_box> object returned by
4833C<isl_map_get_range_lattice_tile> is always valid.
4834For the other functions,
4835the stride and offset can be extracted from the returned object
4836using the following functions.
4837
4838	#include <isl/stride_info.h>
4839	__isl_give isl_val *isl_stride_info_get_stride(
4840		__isl_keep isl_stride_info *si);
4841	__isl_give isl_aff *isl_stride_info_get_offset(
4842		__isl_keep isl_stride_info *si);
4843
4844The stride info object can be copied and released using the following
4845functions.
4846
4847	#include <isl/stride_info.h>
4848	__isl_give isl_stride_info *isl_stride_info_copy(
4849		__isl_keep isl_stride_info *si);
4850	__isl_null isl_stride_info *isl_stride_info_free(
4851		__isl_take isl_stride_info *si);
4852
4853=item * Dependence
4854
4855To check whether a function involves any local variables,
4856i.e., integer divisions,
4857the following functions can be used.
4858
4859	#include <isl/set.h>
4860	isl_bool isl_set_involves_locals(
4861		__isl_keep isl_set *set);
4862
4863	#include <isl/aff.h>
4864	isl_bool isl_aff_involves_locals(
4865		__isl_keep isl_aff *aff);
4866	isl_bool isl_multi_aff_involves_locals(
4867		__isl_keep isl_multi_aff *ma);
4868	isl_bool isl_pw_multi_aff_involves_locals(
4869		__isl_keep isl_pw_multi_aff *pma);
4870	isl_bool isl_union_pw_multi_aff_involves_locals(
4871		__isl_keep isl_union_pw_multi_aff *upma);
4872
4873To check whether the description of a set, relation or function depends
4874on a parameter or one or more given dimensions,
4875the following functions can be used.
4876
4877	#include <isl/constraint.h>
4878	isl_bool isl_constraint_involves_dims(
4879		__isl_keep isl_constraint *constraint,
4880		enum isl_dim_type type, unsigned first, unsigned n);
4881
4882	#include <isl/set.h>
4883	isl_bool isl_basic_set_involves_dims(
4884		__isl_keep isl_basic_set *bset,
4885		enum isl_dim_type type, unsigned first, unsigned n);
4886	isl_bool isl_set_involves_dims(__isl_keep isl_set *set,
4887		enum isl_dim_type type, unsigned first, unsigned n);
4888
4889	#include <isl/map.h>
4890	isl_bool isl_basic_map_involves_dims(
4891		__isl_keep isl_basic_map *bmap,
4892		enum isl_dim_type type, unsigned first, unsigned n);
4893	isl_bool isl_map_involves_dims(__isl_keep isl_map *map,
4894		enum isl_dim_type type, unsigned first, unsigned n);
4895
4896	#include <isl/union_map.h>
4897	isl_bool isl_union_map_involves_dims(
4898		__isl_keep isl_union_map *umap,
4899		enum isl_dim_type type, unsigned first, unsigned n);
4900
4901	#include <isl/aff.h>
4902	isl_bool isl_aff_involves_dims(__isl_keep isl_aff *aff,
4903		enum isl_dim_type type, unsigned first, unsigned n);
4904	isl_bool isl_pw_aff_involves_param_id(
4905		__isl_keep isl_pw_aff *pa,
4906		__isl_keep isl_id *id);
4907	isl_bool isl_pw_aff_involves_dims(
4908		__isl_keep isl_pw_aff *pwaff,
4909		enum isl_dim_type type, unsigned first, unsigned n);
4910	isl_bool isl_multi_aff_involves_dims(
4911		__isl_keep isl_multi_aff *ma,
4912		enum isl_dim_type type, unsigned first, unsigned n);
4913	isl_bool isl_pw_multi_aff_involves_param_id(
4914		__isl_keep isl_pw_multi_aff *pma,
4915		__isl_keep isl_id *id);
4916	isl_bool isl_pw_multi_aff_involves_dims(
4917		__isl_keep isl_pw_multi_aff *pma,
4918		enum isl_dim_type type, unsigned first, unsigned n);
4919	isl_bool isl_multi_pw_aff_involves_dims(
4920		__isl_keep isl_multi_pw_aff *mpa,
4921		enum isl_dim_type type, unsigned first, unsigned n);
4922	isl_bool isl_multi_pw_aff_involves_param_id(
4923		__isl_keep isl_multi_pw_aff *mpa,
4924		__isl_keep isl_id *id);
4925	isl_bool isl_multi_pw_aff_involves_param_id_list(
4926		__isl_keep isl_multi_pw_aff *mpa,
4927		__isl_keep isl_id_list *list);
4928
4929	#include <isl/polynomial.h>
4930	isl_bool isl_qpolynomial_involves_dims(
4931		__isl_keep isl_qpolynomial *qp,
4932		enum isl_dim_type type, unsigned first, unsigned n);
4933	isl_bool isl_pw_qpolynomial_involves_param_id(
4934		__isl_keep isl_pw_qpolynomial *pwqp,
4935		__isl_keep isl_id *id);
4936	isl_bool isl_pw_qpolynomial_fold_involves_param_id(
4937		__isl_keep isl_pw_qpolynomial_fold *pwf,
4938		__isl_keep isl_id *id);
4939
4940Similarly, the following functions can be used to check whether
4941a given dimension is involved in any lower or upper bound.
4942
4943	#include <isl/set.h>
4944	isl_bool isl_set_dim_has_any_lower_bound(
4945		__isl_keep isl_set *set,
4946		enum isl_dim_type type, unsigned pos);
4947	isl_bool isl_set_dim_has_any_upper_bound(
4948		__isl_keep isl_set *set,
4949		enum isl_dim_type type, unsigned pos);
4950
4951Note that these functions return true even if there is a bound on
4952the dimension on only some of the basic sets of C<set>.
4953To check if they have a bound for all of the basic sets in C<set>,
4954use the following functions instead.
4955
4956	#include <isl/set.h>
4957	isl_bool isl_set_dim_has_lower_bound(
4958		__isl_keep isl_set *set,
4959		enum isl_dim_type type, unsigned pos);
4960	isl_bool isl_set_dim_has_upper_bound(
4961		__isl_keep isl_set *set,
4962		enum isl_dim_type type, unsigned pos);
4963
4964=item * Space
4965
4966To check whether a set is a parameter domain, use this function:
4967
4968	isl_bool isl_set_is_params(__isl_keep isl_set *set);
4969	isl_bool isl_union_set_is_params(
4970		__isl_keep isl_union_set *uset);
4971
4972=item * Wrapping
4973
4974The following functions check whether the space of the given
4975(basic) set or relation domain and/or range is a wrapped relation.
4976
4977	#include <isl/space.h>
4978	isl_bool isl_space_is_wrapping(
4979		__isl_keep isl_space *space);
4980	isl_bool isl_space_domain_is_wrapping(
4981		__isl_keep isl_space *space);
4982	isl_bool isl_space_range_is_wrapping(
4983		__isl_keep isl_space *space);
4984	isl_bool isl_space_is_product(
4985		__isl_keep isl_space *space);
4986
4987	#include <isl/set.h>
4988	isl_bool isl_basic_set_is_wrapping(
4989		__isl_keep isl_basic_set *bset);
4990	isl_bool isl_set_is_wrapping(__isl_keep isl_set *set);
4991
4992	#include <isl/map.h>
4993	isl_bool isl_map_domain_is_wrapping(
4994		__isl_keep isl_map *map);
4995	isl_bool isl_map_range_is_wrapping(
4996		__isl_keep isl_map *map);
4997	isl_bool isl_map_is_product(__isl_keep isl_map *map);
4998
4999	#include <isl/id.h>
5000	isl_bool isl_multi_id_range_is_wrapping(
5001		__isl_keep isl_multi_id *mi);
5002
5003	#include <isl/val.h>
5004	isl_bool isl_multi_val_range_is_wrapping(
5005		__isl_keep isl_multi_val *mv);
5006
5007	#include <isl/aff.h>
5008	isl_bool isl_multi_aff_range_is_wrapping(
5009		__isl_keep isl_multi_aff *ma);
5010	isl_bool isl_multi_pw_aff_range_is_wrapping(
5011		__isl_keep isl_multi_pw_aff *mpa);
5012	isl_bool isl_multi_union_pw_aff_range_is_wrapping(
5013		__isl_keep isl_multi_union_pw_aff *mupa);
5014
5015The input to C<isl_space_is_wrapping> should
5016be the space of a set, while that of
5017C<isl_space_domain_is_wrapping> and
5018C<isl_space_range_is_wrapping> should be the space of a relation.
5019The input to C<isl_space_is_product> can be either the space
5020of a set or that of a binary relation.
5021In case the input is the space of a binary relation, it checks
5022whether both domain and range are wrapping.
5023
5024=item * Internal Product
5025
5026	isl_bool isl_basic_map_can_zip(
5027		__isl_keep isl_basic_map *bmap);
5028	isl_bool isl_map_can_zip(__isl_keep isl_map *map);
5029
5030Check whether the product of domain and range of the given relation
5031can be computed,
5032i.e., whether both domain and range are nested relations.
5033
5034=item * Currying
5035
5036	#include <isl/space.h>
5037	isl_bool isl_space_can_curry(
5038		__isl_keep isl_space *space);
5039
5040	#include <isl/map.h>
5041	isl_bool isl_basic_map_can_curry(
5042		__isl_keep isl_basic_map *bmap);
5043	isl_bool isl_map_can_curry(__isl_keep isl_map *map);
5044
5045Check whether the domain of the (basic) relation is a wrapped relation.
5046
5047	#include <isl/space.h>
5048	isl_bool isl_space_can_uncurry(
5049		__isl_keep isl_space *space);
5050
5051	#include <isl/map.h>
5052	isl_bool isl_basic_map_can_uncurry(
5053		__isl_keep isl_basic_map *bmap);
5054	isl_bool isl_map_can_uncurry(__isl_keep isl_map *map);
5055
5056Check whether the range of the (basic) relation is a wrapped relation.
5057
5058	#include <isl/space.h>
5059	isl_bool isl_space_can_range_curry(
5060		__isl_keep isl_space *space);
5061
5062	#include <isl/map.h>
5063	isl_bool isl_map_can_range_curry(
5064		__isl_keep isl_map *map);
5065
5066Check whether the domain of the relation wrapped in the range of
5067the input is itself a wrapped relation.
5068
5069=item * Special Values
5070
5071	#include <isl/aff.h>
5072	isl_bool isl_aff_is_cst(__isl_keep isl_aff *aff);
5073	isl_bool isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
5074	isl_bool isl_multi_pw_aff_is_cst(
5075		__isl_keep isl_multi_pw_aff *mpa);
5076
5077Check whether the given expression is a constant.
5078
5079	#include <isl/val.h>
5080	isl_bool isl_multi_val_involves_nan(
5081		__isl_keep isl_multi_val *mv);
5082
5083	#include <isl/aff.h>
5084	isl_bool isl_aff_is_nan(__isl_keep isl_aff *aff);
5085	isl_bool isl_multi_aff_involves_nan(
5086		__isl_keep isl_multi_aff *ma);
5087	isl_bool isl_pw_aff_involves_nan(
5088		__isl_keep isl_pw_aff *pa);
5089	isl_bool isl_pw_multi_aff_involves_nan(
5090		__isl_keep isl_pw_multi_aff *pma);
5091	isl_bool isl_multi_pw_aff_involves_nan(
5092		__isl_keep isl_multi_pw_aff *mpa);
5093	isl_bool isl_union_pw_aff_involves_nan(
5094		__isl_keep isl_union_pw_aff *upa);
5095	isl_bool isl_union_pw_multi_aff_involves_nan(
5096		__isl_keep isl_union_pw_multi_aff *upma);
5097	isl_bool isl_multi_union_pw_aff_involves_nan(
5098		__isl_keep isl_multi_union_pw_aff *mupa);
5099
5100	#include <isl/polynomial.h>
5101	isl_bool isl_qpolynomial_is_nan(
5102		__isl_keep isl_qpolynomial *qp);
5103	isl_bool isl_qpolynomial_fold_is_nan(
5104		__isl_keep isl_qpolynomial_fold *fold);
5105	isl_bool isl_pw_qpolynomial_involves_nan(
5106		__isl_keep isl_pw_qpolynomial *pwqp);
5107	isl_bool isl_pw_qpolynomial_fold_involves_nan(
5108		__isl_keep isl_pw_qpolynomial_fold *pwf);
5109	isl_bool isl_union_pw_qpolynomial_involves_nan(
5110		__isl_keep isl_union_pw_qpolynomial *upwqp);
5111	isl_bool isl_union_pw_qpolynomial_fold_involves_nan(
5112		__isl_keep isl_union_pw_qpolynomial_fold *upwf);
5113
5114Check whether the given expression is equal to or involves NaN.
5115
5116	#include <isl/val.h>
5117	isl_bool isl_multi_val_is_zero(
5118		__isl_keep isl_multi_val *mv);
5119
5120Check whether the multiple value is zero.
5121
5122	#include <isl/aff.h>
5123	isl_bool isl_aff_plain_is_zero(
5124		__isl_keep isl_aff *aff);
5125
5126Check whether the affine expression is obviously zero.
5127
5128=back
5129
5130=head3 Binary Properties
5131
5132=over
5133
5134=item * Equality
5135
5136The following functions check whether two objects
5137represent the same set, relation or function.
5138The C<plain> variants only return true if the objects
5139are obviously the same.  That is, they may return false
5140even if the objects are the same, but they will never
5141return true if the objects are not the same.
5142
5143	#include <isl/set.h>
5144	isl_bool isl_basic_set_plain_is_equal(
5145		__isl_keep isl_basic_set *bset1,
5146		__isl_keep isl_basic_set *bset2);
5147	isl_bool isl_basic_set_is_equal(
5148		__isl_keep isl_basic_set *bset1,
5149		__isl_keep isl_basic_set *bset2);
5150	isl_bool isl_set_plain_is_equal(
5151		__isl_keep isl_set *set1,
5152		__isl_keep isl_set *set2);
5153	isl_bool isl_set_is_equal(__isl_keep isl_set *set1,
5154		__isl_keep isl_set *set2);
5155
5156	#include <isl/map.h>
5157	isl_bool isl_basic_map_is_equal(
5158		__isl_keep isl_basic_map *bmap1,
5159		__isl_keep isl_basic_map *bmap2);
5160	isl_bool isl_map_is_equal(__isl_keep isl_map *map1,
5161		__isl_keep isl_map *map2);
5162	isl_bool isl_map_plain_is_equal(
5163		__isl_keep isl_map *map1,
5164		__isl_keep isl_map *map2);
5165
5166	#include <isl/union_set.h>
5167	isl_bool isl_union_set_is_equal(
5168		__isl_keep isl_union_set *uset1,
5169		__isl_keep isl_union_set *uset2);
5170
5171	#include <isl/union_map.h>
5172	isl_bool isl_union_map_is_equal(
5173		__isl_keep isl_union_map *umap1,
5174		__isl_keep isl_union_map *umap2);
5175
5176	#include <isl/id.h>
5177	isl_bool isl_multi_id_plain_is_equal(
5178		__isl_keep isl_multi_id *mi1,
5179		__isl_keep isl_multi_id *mi2);
5180
5181	#include <isl/val.h>
5182	isl_bool isl_multi_val_plain_is_equal(
5183		__isl_keep isl_multi_val *mv1,
5184		__isl_keep isl_multi_val *mv2);
5185
5186	#include <isl/aff.h>
5187	isl_bool isl_aff_plain_is_equal(
5188		__isl_keep isl_aff *aff1,
5189		__isl_keep isl_aff *aff2);
5190	isl_bool isl_multi_aff_plain_is_equal(
5191		__isl_keep isl_multi_aff *maff1,
5192		__isl_keep isl_multi_aff *maff2);
5193	isl_bool isl_pw_aff_plain_is_equal(
5194		__isl_keep isl_pw_aff *pwaff1,
5195		__isl_keep isl_pw_aff *pwaff2);
5196	isl_bool isl_pw_aff_is_equal(
5197		__isl_keep isl_pw_aff *pa1,
5198		__isl_keep isl_pw_aff *pa2);
5199	isl_bool isl_pw_multi_aff_plain_is_equal(
5200		__isl_keep isl_pw_multi_aff *pma1,
5201		__isl_keep isl_pw_multi_aff *pma2);
5202	isl_bool isl_pw_multi_aff_is_equal(
5203		__isl_keep isl_pw_multi_aff *pma1,
5204		__isl_keep isl_pw_multi_aff *pma2);
5205	isl_bool isl_multi_pw_aff_plain_is_equal(
5206		__isl_keep isl_multi_pw_aff *mpa1,
5207		__isl_keep isl_multi_pw_aff *mpa2);
5208	isl_bool isl_multi_pw_aff_is_equal(
5209		__isl_keep isl_multi_pw_aff *mpa1,
5210		__isl_keep isl_multi_pw_aff *mpa2);
5211	isl_bool isl_union_pw_aff_plain_is_equal(
5212		__isl_keep isl_union_pw_aff *upa1,
5213		__isl_keep isl_union_pw_aff *upa2);
5214	isl_bool isl_union_pw_multi_aff_plain_is_equal(
5215		__isl_keep isl_union_pw_multi_aff *upma1,
5216		__isl_keep isl_union_pw_multi_aff *upma2);
5217	isl_bool isl_multi_union_pw_aff_plain_is_equal(
5218		__isl_keep isl_multi_union_pw_aff *mupa1,
5219		__isl_keep isl_multi_union_pw_aff *mupa2);
5220
5221	#include <isl/polynomial.h>
5222	isl_bool isl_union_pw_qpolynomial_plain_is_equal(
5223		__isl_keep isl_union_pw_qpolynomial *upwqp1,
5224		__isl_keep isl_union_pw_qpolynomial *upwqp2);
5225	isl_bool isl_union_pw_qpolynomial_fold_plain_is_equal(
5226		__isl_keep isl_union_pw_qpolynomial_fold *upwf1,
5227		__isl_keep isl_union_pw_qpolynomial_fold *upwf2);
5228
5229=item * Disjointness
5230
5231	#include <isl/set.h>
5232	isl_bool isl_basic_set_is_disjoint(
5233		__isl_keep isl_basic_set *bset1,
5234		__isl_keep isl_basic_set *bset2);
5235	isl_bool isl_set_plain_is_disjoint(
5236		__isl_keep isl_set *set1,
5237		__isl_keep isl_set *set2);
5238	isl_bool isl_set_is_disjoint(__isl_keep isl_set *set1,
5239		__isl_keep isl_set *set2);
5240
5241	#include <isl/map.h>
5242	isl_bool isl_basic_map_is_disjoint(
5243		__isl_keep isl_basic_map *bmap1,
5244		__isl_keep isl_basic_map *bmap2);
5245	isl_bool isl_map_is_disjoint(__isl_keep isl_map *map1,
5246		__isl_keep isl_map *map2);
5247
5248	#include <isl/union_set.h>
5249	isl_bool isl_union_set_is_disjoint(
5250		__isl_keep isl_union_set *uset1,
5251		__isl_keep isl_union_set *uset2);
5252
5253	#include <isl/union_map.h>
5254	isl_bool isl_union_map_is_disjoint(
5255		__isl_keep isl_union_map *umap1,
5256		__isl_keep isl_union_map *umap2);
5257
5258=item * Subset
5259
5260	isl_bool isl_basic_set_is_subset(
5261		__isl_keep isl_basic_set *bset1,
5262		__isl_keep isl_basic_set *bset2);
5263	isl_bool isl_set_is_subset(__isl_keep isl_set *set1,
5264		__isl_keep isl_set *set2);
5265	isl_bool isl_set_is_strict_subset(
5266		__isl_keep isl_set *set1,
5267		__isl_keep isl_set *set2);
5268	isl_bool isl_union_set_is_subset(
5269		__isl_keep isl_union_set *uset1,
5270		__isl_keep isl_union_set *uset2);
5271	isl_bool isl_union_set_is_strict_subset(
5272		__isl_keep isl_union_set *uset1,
5273		__isl_keep isl_union_set *uset2);
5274	isl_bool isl_basic_map_is_subset(
5275		__isl_keep isl_basic_map *bmap1,
5276		__isl_keep isl_basic_map *bmap2);
5277	isl_bool isl_basic_map_is_strict_subset(
5278		__isl_keep isl_basic_map *bmap1,
5279		__isl_keep isl_basic_map *bmap2);
5280	isl_bool isl_map_is_subset(
5281		__isl_keep isl_map *map1,
5282		__isl_keep isl_map *map2);
5283	isl_bool isl_map_is_strict_subset(
5284		__isl_keep isl_map *map1,
5285		__isl_keep isl_map *map2);
5286	isl_bool isl_union_map_is_subset(
5287		__isl_keep isl_union_map *umap1,
5288		__isl_keep isl_union_map *umap2);
5289	isl_bool isl_union_map_is_strict_subset(
5290		__isl_keep isl_union_map *umap1,
5291		__isl_keep isl_union_map *umap2);
5292
5293Check whether the first argument is a (strict) subset of the
5294second argument.
5295
5296=item * Order
5297
5298Every comparison function returns a negative value if the first
5299argument is considered smaller than the second, a positive value
5300if the first argument is considered greater and zero if the two
5301constraints are considered the same by the comparison criterion.
5302
5303	#include <isl/constraint.h>
5304	int isl_constraint_plain_cmp(
5305		__isl_keep isl_constraint *c1,
5306		__isl_keep isl_constraint *c2);
5307
5308This function is useful for sorting C<isl_constraint>s.
5309The order depends on the internal representation of the inputs.
5310The order is fixed over different calls to the function (assuming
5311the internal representation of the inputs has not changed), but may
5312change over different versions of C<isl>.
5313
5314	#include <isl/constraint.h>
5315	int isl_constraint_cmp_last_non_zero(
5316		__isl_keep isl_constraint *c1,
5317		__isl_keep isl_constraint *c2);
5318
5319This function can be used to sort constraints that live in the same
5320local space.  Constraints that involve ``earlier'' dimensions or
5321that have a smaller coefficient for the shared latest dimension
5322are considered smaller than other constraints.
5323This function only defines a B<partial> order.
5324
5325	#include <isl/set.h>
5326	int isl_set_plain_cmp(__isl_keep isl_set *set1,
5327		__isl_keep isl_set *set2);
5328
5329This function is useful for sorting C<isl_set>s.
5330The order depends on the internal representation of the inputs.
5331The order is fixed over different calls to the function (assuming
5332the internal representation of the inputs has not changed), but may
5333change over different versions of C<isl>.
5334
5335	#include <isl/aff.h>
5336	int isl_multi_aff_plain_cmp(
5337		__isl_keep isl_multi_aff *ma1,
5338		__isl_keep isl_multi_aff *ma2);
5339	int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
5340		__isl_keep isl_pw_aff *pa2);
5341
5342The functions C<isl_multi_aff_plain_cmp> and
5343C<isl_pw_aff_plain_cmp> can be used to sort C<isl_multi_aff>s and
5344C<isl_pw_aff>s.  The order is not strictly defined.
5345The current order sorts expressions that only involve
5346earlier dimensions before those that involve later dimensions.
5347
5348=back
5349
5350=head2 Unary Operations
5351
5352=over
5353
5354=item * Complement
5355
5356	__isl_give isl_set *isl_set_complement(
5357		__isl_take isl_set *set);
5358	__isl_give isl_map *isl_map_complement(
5359		__isl_take isl_map *map);
5360
5361=item * Inverse map
5362
5363	#include <isl/space.h>
5364	__isl_give isl_space *isl_space_reverse(
5365		__isl_take isl_space *space);
5366	__isl_give isl_space *isl_space_range_reverse(
5367		__isl_take isl_space *space);
5368
5369	#include <isl/map.h>
5370	__isl_give isl_basic_map *isl_basic_map_reverse(
5371		__isl_take isl_basic_map *bmap);
5372	__isl_give isl_map *isl_map_reverse(
5373		__isl_take isl_map *map);
5374	__isl_give isl_map *isl_map_range_reverse(
5375		__isl_take isl_map *map);
5376
5377	#include <isl/union_map.h>
5378	__isl_give isl_union_map *isl_union_map_reverse(
5379		__isl_take isl_union_map *umap);
5380	__isl_give isl_union_map *isl_union_map_range_reverse(
5381		__isl_take isl_union_map *umap);
5382
5383The function C<isl_space_range_reverse> reverses the relation
5384that is embedded in the range of the input map space.
5385The identifier of the range, if any, is only preserved
5386if this embedded relation has identical input and output tuples.
5387
5388=item * Tuple binding
5389
5390The following function binds
5391a tuple to a sequence of parameter identifiers, equating
5392the tuple dimensions to the parameters with those identifiers and
5393subsequently projecting out the tuple.
5394If the original object did not reference any such parameters,
5395then this means that the tuple dimensions are reinterpreted
5396as parameters.
5397The space of C<tuple> needs to match that of the bound tuple.
5398
5399	#include <isl/set.h>
5400	__isl_give isl_set *isl_set_bind(
5401		__isl_take isl_set *set,
5402		__isl_take isl_multi_id *tuple);
5403
5404	#include <isl/map.h>
5405	__isl_give isl_set *isl_map_bind_domain(
5406		__isl_take isl_map *map,
5407		__isl_take isl_multi_id *tuple);
5408	__isl_give isl_set *isl_map_bind_range(
5409		__isl_take isl_map *map,
5410		__isl_take isl_multi_id *tuple);
5411
5412	#include <isl/union_map.h>
5413	__isl_give isl_union_set *isl_union_map_bind_range(
5414		__isl_take isl_union_map *umap,
5415		__isl_take isl_multi_id *tuple);
5416
5417	#include <isl/aff.h>
5418	__isl_give isl_pw_aff *isl_pw_aff_bind_domain(
5419		__isl_take isl_pw_aff *pa,
5420		__isl_take isl_multi_id *tuple);
5421	__isl_give isl_multi_aff *isl_multi_aff_bind_domain(
5422		__isl_take isl_multi_aff *ma,
5423		__isl_take isl_multi_id *tuple);
5424	__isl_give isl_pw_multi_aff *
5425	isl_pw_multi_aff_bind_domain(
5426		__isl_take isl_pw_multi_aff *pma,
5427		__isl_take isl_multi_id *tuple);
5428	__isl_give isl_multi_pw_aff *
5429	isl_multi_pw_aff_bind_domain(
5430		__isl_take isl_multi_pw_aff *mpa,
5431		__isl_take isl_multi_id *tuple);
5432	__isl_give isl_pw_aff *
5433	isl_pw_aff_bind_domain_wrapped_domain(
5434		__isl_take isl_pw_aff *pa,
5435		__isl_take isl_multi_id *tuple);
5436	__isl_give isl_multi_aff *
5437	isl_multi_aff_bind_domain_wrapped_domain(
5438		__isl_take isl_multi_aff *ma,
5439		__isl_take isl_multi_id *tuple);
5440	__isl_give isl_pw_multi_aff *
5441	isl_pw_multi_aff_bind_domain_wrapped_domain(
5442		__isl_take isl_pw_multi_aff *pma,
5443		__isl_take isl_multi_id *tuple);
5444	__isl_give isl_multi_pw_aff *
5445	isl_multi_pw_aff_bind_domain_wrapped_domain(
5446		__isl_take isl_multi_pw_aff *mpa,
5447		__isl_take isl_multi_id *tuple);
5448	__isl_give isl_basic_set *isl_aff_bind_id(
5449		__isl_take isl_aff *aff,
5450		__isl_take isl_id *id);
5451	__isl_give isl_set *isl_pw_aff_bind_id(
5452		__isl_take isl_pw_aff *pa,
5453		__isl_take isl_id *id);
5454	__isl_give isl_basic_set *isl_multi_aff_bind(
5455		__isl_take isl_multi_aff *ma,
5456		__isl_take isl_multi_id *tuple);
5457	__isl_give isl_set *isl_multi_pw_aff_bind(
5458		__isl_take isl_multi_pw_aff *mpa,
5459		__isl_take isl_multi_id *tuple);
5460	__isl_give isl_union_set *isl_union_pw_aff_bind_id(
5461		__isl_take isl_union_pw_aff *upa,
5462		__isl_take isl_id *id);
5463	__isl_give isl_union_set *
5464	isl_multi_union_pw_aff_bind(
5465		__isl_take isl_multi_union_pw_aff *mupa,
5466		__isl_take isl_multi_id *tuple);
5467
5468Projecting out the domain of the wrapped relation in the domain
5469of a function leaves the range of that wrapped relation
5470in the domain of the resulting function.
5471In the case of C<isl_aff_bind_id>, C<isl_pw_aff_bind_id>,
5472C<isl_multi_aff_bind>, C<isl_multi_pw_aff_bind>,
5473C<isl_union_pw_aff_bind_id> and
5474C<isl_multi_union_pw_aff_bind>, the parameters
5475are bound to the function values and the result lives
5476in the domain of the input function.
5477
5478=item * Projection
5479
5480	#include <isl/space.h>
5481	__isl_give isl_space *isl_space_domain(
5482		__isl_take isl_space *space);
5483	__isl_give isl_space *isl_space_range(
5484		__isl_take isl_space *space);
5485	__isl_give isl_space *isl_space_params(
5486		__isl_take isl_space *space);
5487
5488	#include <isl/local_space.h>
5489	__isl_give isl_local_space *isl_local_space_domain(
5490		__isl_take isl_local_space *ls);
5491	__isl_give isl_local_space *isl_local_space_range(
5492		__isl_take isl_local_space *ls);
5493
5494	#include <isl/set.h>
5495	__isl_give isl_basic_set *isl_basic_set_project_out(
5496		__isl_take isl_basic_set *bset,
5497		enum isl_dim_type type, unsigned first, unsigned n);
5498	__isl_give isl_set *isl_set_project_out_param_id(
5499		__isl_take isl_set *set,
5500		__isl_take isl_id *id);
5501	__isl_give isl_set *
5502	isl_set_project_out_param_id_list(
5503		__isl_take isl_set *set,
5504		__isl_take isl_id_list *list);
5505	__isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
5506		enum isl_dim_type type, unsigned first, unsigned n);
5507	__isl_give isl_set *isl_set_project_out_all_params(
5508		__isl_take isl_set *set);
5509	__isl_give isl_map *isl_set_project_onto_map(
5510		__isl_take isl_set *set,
5511		enum isl_dim_type type, unsigned first,
5512		unsigned n);
5513	__isl_give isl_basic_set *isl_basic_set_params(
5514		__isl_take isl_basic_set *bset);
5515	__isl_give isl_set *isl_set_params(__isl_take isl_set *set);
5516
5517The function C<isl_set_project_onto_map> returns a relation
5518that projects the input set onto the given set dimensions.
5519
5520	#include <isl/map.h>
5521	__isl_give isl_basic_map *isl_basic_map_project_out(
5522		__isl_take isl_basic_map *bmap,
5523		enum isl_dim_type type, unsigned first, unsigned n);
5524	__isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
5525		enum isl_dim_type type, unsigned first, unsigned n);
5526	__isl_give isl_map *isl_map_project_out_all_params(
5527		__isl_take isl_map *map);
5528	__isl_give isl_basic_set *isl_basic_map_domain(
5529		__isl_take isl_basic_map *bmap);
5530	__isl_give isl_basic_set *isl_basic_map_range(
5531		__isl_take isl_basic_map *bmap);
5532	__isl_give isl_set *isl_map_params(__isl_take isl_map *map);
5533	__isl_give isl_set *isl_map_domain(
5534		__isl_take isl_map *bmap);
5535	__isl_give isl_set *isl_map_range(
5536		__isl_take isl_map *map);
5537
5538	#include <isl/union_set.h>
5539	__isl_give isl_union_set *isl_union_set_project_out(
5540		__isl_take isl_union_set *uset,
5541		enum isl_dim_type type,
5542		unsigned first, unsigned n);
5543	__isl_give isl_union_set *
5544	isl_union_set_project_out_all_params(
5545		__isl_take isl_union_set *uset);
5546	__isl_give isl_set *isl_union_set_params(
5547		__isl_take isl_union_set *uset);
5548
5549The function C<isl_union_set_project_out> can only project out
5550parameters.
5551
5552	#include <isl/union_map.h>
5553	__isl_give isl_union_map *isl_union_map_project_out(
5554		__isl_take isl_union_map *umap,
5555		enum isl_dim_type type, unsigned first, unsigned n);
5556	__isl_give isl_union_map *
5557	isl_union_map_project_out_all_params(
5558		__isl_take isl_union_map *umap);
5559	__isl_give isl_set *isl_union_map_params(
5560		__isl_take isl_union_map *umap);
5561	__isl_give isl_union_set *isl_union_map_domain(
5562		__isl_take isl_union_map *umap);
5563	__isl_give isl_union_set *isl_union_map_range(
5564		__isl_take isl_union_map *umap);
5565
5566The function C<isl_union_map_project_out> can only project out
5567parameters.
5568
5569	#include <isl/aff.h>
5570	__isl_give isl_aff *isl_aff_project_domain_on_params(
5571		__isl_take isl_aff *aff);
5572	__isl_give isl_multi_aff *
5573	isl_multi_aff_project_domain_on_params(
5574		__isl_take isl_multi_aff *ma);
5575	__isl_give isl_pw_aff *
5576	isl_pw_aff_project_domain_on_params(
5577		__isl_take isl_pw_aff *pa);
5578	__isl_give isl_multi_pw_aff *
5579	isl_multi_pw_aff_project_domain_on_params(
5580		__isl_take isl_multi_pw_aff *mpa);
5581	__isl_give isl_pw_multi_aff *
5582	isl_pw_multi_aff_project_domain_on_params(
5583		__isl_take isl_pw_multi_aff *pma);
5584	__isl_give isl_set *isl_pw_aff_domain(
5585		__isl_take isl_pw_aff *pwaff);
5586	__isl_give isl_set *isl_pw_multi_aff_domain(
5587		__isl_take isl_pw_multi_aff *pma);
5588	__isl_give isl_set *isl_multi_pw_aff_domain(
5589		__isl_take isl_multi_pw_aff *mpa);
5590	__isl_give isl_union_set *isl_union_pw_aff_domain(
5591		__isl_take isl_union_pw_aff *upa);
5592	__isl_give isl_union_set *isl_union_pw_multi_aff_domain(
5593		__isl_take isl_union_pw_multi_aff *upma);
5594	__isl_give isl_union_set *
5595	isl_multi_union_pw_aff_domain(
5596		__isl_take isl_multi_union_pw_aff *mupa);
5597	__isl_give isl_set *isl_pw_aff_params(
5598		__isl_take isl_pw_aff *pwa);
5599
5600If no explicit domain was set on a zero-dimensional input to
5601C<isl_multi_union_pw_aff_domain>, then this function will
5602return a parameter set.
5603
5604	#include <isl/polynomial.h>
5605	__isl_give isl_qpolynomial *
5606	isl_qpolynomial_project_domain_on_params(
5607		__isl_take isl_qpolynomial *qp);
5608	__isl_give isl_pw_qpolynomial *
5609	isl_pw_qpolynomial_project_domain_on_params(
5610		__isl_take isl_pw_qpolynomial *pwqp);
5611	__isl_give isl_pw_qpolynomial_fold *
5612	isl_pw_qpolynomial_fold_project_domain_on_params(
5613		__isl_take isl_pw_qpolynomial_fold *pwf);
5614	__isl_give isl_set *isl_pw_qpolynomial_domain(
5615		__isl_take isl_pw_qpolynomial *pwqp);
5616	__isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
5617		__isl_take isl_union_pw_qpolynomial_fold *upwf);
5618	__isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
5619		__isl_take isl_union_pw_qpolynomial *upwqp);
5620
5621	#include <isl/space.h>
5622	__isl_give isl_space *isl_space_domain_map(
5623		__isl_take isl_space *space);
5624	__isl_give isl_space *isl_space_range_map(
5625		__isl_take isl_space *space);
5626
5627	#include <isl/map.h>
5628	__isl_give isl_map *isl_set_wrapped_domain_map(
5629		__isl_take isl_set *set);
5630	__isl_give isl_basic_map *isl_basic_map_domain_map(
5631		__isl_take isl_basic_map *bmap);
5632	__isl_give isl_basic_map *isl_basic_map_range_map(
5633		__isl_take isl_basic_map *bmap);
5634	__isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
5635	__isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
5636
5637	#include <isl/union_map.h>
5638	__isl_give isl_union_map *isl_union_map_domain_map(
5639		__isl_take isl_union_map *umap);
5640	__isl_give isl_union_pw_multi_aff *
5641	isl_union_map_domain_map_union_pw_multi_aff(
5642		__isl_take isl_union_map *umap);
5643	__isl_give isl_union_map *isl_union_map_range_map(
5644		__isl_take isl_union_map *umap);
5645	__isl_give isl_union_map *
5646	isl_union_set_wrapped_domain_map(
5647		__isl_take isl_union_set *uset);
5648
5649The functions above construct a (basic, regular or union) relation
5650that maps (a wrapped version of) the input relation to its domain or range.
5651C<isl_set_wrapped_domain_map> maps the input set to the domain
5652of its wrapped relation.
5653
5654=item * Elimination
5655
5656	__isl_give isl_basic_set *isl_basic_set_eliminate(
5657		__isl_take isl_basic_set *bset,
5658		enum isl_dim_type type,
5659		unsigned first, unsigned n);
5660	__isl_give isl_set *isl_set_eliminate(
5661		__isl_take isl_set *set, enum isl_dim_type type,
5662		unsigned first, unsigned n);
5663	__isl_give isl_basic_map *isl_basic_map_eliminate(
5664		__isl_take isl_basic_map *bmap,
5665		enum isl_dim_type type,
5666		unsigned first, unsigned n);
5667	__isl_give isl_map *isl_map_eliminate(
5668		__isl_take isl_map *map, enum isl_dim_type type,
5669		unsigned first, unsigned n);
5670
5671Eliminate the coefficients for the given dimensions from the constraints,
5672without removing the dimensions.
5673
5674=item * Constructing a set from a parameter domain
5675
5676A set space of a given dimension and with an optional name
5677can be created from a parameter space using the following functions.
5678
5679	#include <isl/space.h>
5680	__isl_give isl_space *isl_space_add_unnamed_tuple_ui(
5681		__isl_take isl_space *space, unsigned dim);
5682	__isl_give isl_space *
5683	isl_space_add_named_tuple_id_ui(
5684		__isl_take isl_space *space,
5685		__isl_take isl_id *tuple_id, unsigned dim);
5686
5687A set with a given tuple can be created from a parameter domain
5688using the following function.
5689
5690	#include <isl/set.h>
5691	__isl_give isl_set *isl_set_unbind_params(
5692		__isl_take isl_set *set,
5693		__isl_take isl_multi_id *tuple);
5694
5695Any parameters with identifiers in C<tuple> are reinterpreted
5696as the corresponding set dimensions.
5697
5698A zero-dimensional (local) space or (basic) set can be constructed
5699on a given parameter domain using the following functions.
5700
5701	#include <isl/space.h>
5702	__isl_give isl_space *isl_space_set_from_params(
5703		__isl_take isl_space *space);
5704
5705	#include <isl/local_space.h>
5706	__isl_give isl_local_space *
5707	isl_local_space_set_from_params(
5708		__isl_take isl_local_space *ls);
5709
5710	#include <isl/set.h>
5711	__isl_give isl_basic_set *isl_basic_set_from_params(
5712		__isl_take isl_basic_set *bset);
5713	__isl_give isl_set *isl_set_from_params(
5714		__isl_take isl_set *set);
5715
5716=item * Constructing a relation from one or two sets
5717
5718A map space with a range of a given dimension and with an optional name
5719can be created from a domain space using the functions
5720C<isl_space_add_unnamed_tuple_ui> and C<isl_space_add_named_tuple_id_ui>
5721described above.
5722
5723A relation with a given domain tuple can be created from a set
5724that will become the range of the relation
5725using the following function.
5726
5727	#include <isl/set.h>
5728	__isl_give isl_map *
5729	isl_set_unbind_params_insert_domain(
5730		__isl_take isl_set *set,
5731		__isl_take isl_multi_id *domain);
5732
5733Any parameters with identifiers in C<domain> are reinterpreted
5734as the corresponding input dimensions.
5735
5736Similarly, a function defined over a parameter domain can
5737be converted into one defined over a set domain
5738using the following functions.
5739
5740	#include <isl/aff.h>
5741	__isl_give isl_aff *
5742	isl_aff_unbind_params_insert_domain(
5743		__isl_take isl_aff *aff,
5744		__isl_take isl_multi_id *domain);
5745	__isl_give isl_multi_aff *
5746	isl_multi_aff_unbind_params_insert_domain(
5747		__isl_take isl_multi_aff *ma,
5748		__isl_take isl_multi_id *domain);
5749	__isl_give isl_multi_pw_aff *
5750	isl_multi_pw_aff_unbind_params_insert_domain(
5751		__isl_take isl_multi_pw_aff *mpa,
5752		__isl_take isl_multi_id *domain);
5753
5754Again,
5755any parameters with identifiers in C<domain> are reinterpreted
5756as the corresponding input dimensions.
5757
5758Create a relation with the given set(s) as domain and/or range.
5759If only the domain or the range is specified, then
5760the range or domain of the created relation is a zero-dimensional
5761flat anonymous space.
5762If the case of C<isl_space_map_from_set>, the input space
5763specifies both the domain and the range of the result.
5764
5765	#include <isl/space.h>
5766	__isl_give isl_space *isl_space_from_domain(
5767		__isl_take isl_space *space);
5768	__isl_give isl_space *isl_space_from_range(
5769		__isl_take isl_space *space);
5770	__isl_give isl_space *isl_space_map_from_set(
5771		__isl_take isl_space *space);
5772	__isl_give isl_space *isl_space_map_from_domain_and_range(
5773		__isl_take isl_space *domain,
5774		__isl_take isl_space *range);
5775
5776	#include <isl/local_space.h>
5777	__isl_give isl_local_space *isl_local_space_from_domain(
5778		__isl_take isl_local_space *ls);
5779
5780	#include <isl/map.h>
5781	__isl_give isl_map *isl_set_insert_domain(
5782		__isl_take isl_set *set,
5783		__isl_take isl_space *domain);
5784	__isl_give isl_map *isl_map_from_domain(
5785		__isl_take isl_set *set);
5786	__isl_give isl_map *isl_map_from_range(
5787		__isl_take isl_set *set);
5788
5789	#include <isl/union_map.h>
5790	__isl_give isl_union_map *isl_union_map_from_domain(
5791		__isl_take isl_union_set *uset);
5792	__isl_give isl_union_map *isl_union_map_from_range(
5793		__isl_take isl_union_set *uset);
5794	__isl_give isl_union_map *
5795	isl_union_map_from_domain_and_range(
5796		__isl_take isl_union_set *domain,
5797		__isl_take isl_union_set *range);
5798
5799	#include <isl/id.h>
5800	__isl_give isl_multi_id *isl_multi_id_from_range(
5801		__isl_take isl_multi_id *mi);
5802
5803	#include <isl/val.h>
5804	__isl_give isl_multi_val *isl_multi_val_from_range(
5805		__isl_take isl_multi_val *mv);
5806
5807	#include <isl/aff.h>
5808	__isl_give isl_multi_aff *
5809	isl_multi_aff_insert_domain(
5810		__isl_take isl_multi_aff *ma,
5811		__isl_take isl_space *domain);
5812	__isl_give isl_pw_aff *isl_pw_aff_insert_domain(
5813		__isl_take isl_pw_aff *pa,
5814		__isl_take isl_space *domain);
5815	__isl_give isl_pw_multi_aff *
5816	isl_pw_multi_aff_insert_domain(
5817		__isl_take isl_pw_multi_aff *pma,
5818		__isl_take isl_space *domain);
5819	__isl_give isl_multi_pw_aff *
5820	isl_multi_pw_aff_insert_domain(
5821		__isl_take isl_multi_pw_aff *mpa,
5822		__isl_take isl_space *domain);
5823	__isl_give isl_aff *isl_aff_from_range(
5824		__isl_take isl_aff *aff);
5825	__isl_give isl_multi_aff *isl_multi_aff_from_range(
5826		__isl_take isl_multi_aff *ma);
5827	__isl_give isl_pw_aff *isl_pw_aff_from_range(
5828		__isl_take isl_pw_aff *pwa);
5829	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
5830		__isl_take isl_multi_pw_aff *mpa);
5831	__isl_give isl_multi_union_pw_aff *
5832	isl_multi_union_pw_aff_from_range(
5833		__isl_take isl_multi_union_pw_aff *mupa);
5834	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
5835		__isl_take isl_set *set);
5836	__isl_give isl_union_pw_multi_aff *
5837	isl_union_pw_multi_aff_from_domain(
5838		__isl_take isl_union_set *uset);
5839
5840	#include <isl/polynomial.h>
5841	__isl_give isl_pw_qpolynomial *
5842	isl_pw_qpolynomial_from_range(
5843		__isl_take isl_pw_qpolynomial *pwqp);
5844	__isl_give isl_pw_qpolynomial_fold *
5845	isl_pw_qpolynomial_fold_from_range(
5846		__isl_take isl_pw_qpolynomial_fold *pwf);
5847
5848=item * Slicing
5849
5850	#include <isl/set.h>
5851	__isl_give isl_basic_set *isl_basic_set_fix_si(
5852		__isl_take isl_basic_set *bset,
5853		enum isl_dim_type type, unsigned pos, int value);
5854	__isl_give isl_basic_set *isl_basic_set_fix_val(
5855		__isl_take isl_basic_set *bset,
5856		enum isl_dim_type type, unsigned pos,
5857		__isl_take isl_val *v);
5858	__isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
5859		enum isl_dim_type type, unsigned pos, int value);
5860	__isl_give isl_set *isl_set_fix_val(
5861		__isl_take isl_set *set,
5862		enum isl_dim_type type, unsigned pos,
5863		__isl_take isl_val *v);
5864
5865	#include <isl/map.h>
5866	__isl_give isl_basic_map *isl_basic_map_fix_si(
5867		__isl_take isl_basic_map *bmap,
5868		enum isl_dim_type type, unsigned pos, int value);
5869	__isl_give isl_basic_map *isl_basic_map_fix_val(
5870		__isl_take isl_basic_map *bmap,
5871		enum isl_dim_type type, unsigned pos,
5872		__isl_take isl_val *v);
5873	__isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
5874		enum isl_dim_type type, unsigned pos, int value);
5875	__isl_give isl_map *isl_map_fix_val(
5876		__isl_take isl_map *map,
5877		enum isl_dim_type type, unsigned pos,
5878		__isl_take isl_val *v);
5879
5880	#include <isl/aff.h>
5881	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
5882		__isl_take isl_pw_multi_aff *pma,
5883		enum isl_dim_type type, unsigned pos, int value);
5884
5885	#include <isl/polynomial.h>
5886	__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
5887		__isl_take isl_pw_qpolynomial *pwqp,
5888		enum isl_dim_type type, unsigned n,
5889		__isl_take isl_val *v);
5890	__isl_give isl_pw_qpolynomial_fold *
5891	isl_pw_qpolynomial_fold_fix_val(
5892		__isl_take isl_pw_qpolynomial_fold *pwf,
5893		enum isl_dim_type type, unsigned n,
5894		__isl_take isl_val *v);
5895
5896Intersect the set, relation or function domain
5897with the hyperplane where the given
5898dimension has the fixed given value.
5899
5900	#include <isl/set.h>
5901	__isl_give isl_basic_set *
5902	isl_basic_set_lower_bound_val(
5903		__isl_take isl_basic_set *bset,
5904		enum isl_dim_type type, unsigned pos,
5905		__isl_take isl_val *value);
5906	__isl_give isl_basic_set *
5907	isl_basic_set_upper_bound_val(
5908		__isl_take isl_basic_set *bset,
5909		enum isl_dim_type type, unsigned pos,
5910		__isl_take isl_val *value);
5911	__isl_give isl_set *isl_set_lower_bound_si(
5912		__isl_take isl_set *set,
5913		enum isl_dim_type type, unsigned pos, int value);
5914	__isl_give isl_set *isl_set_lower_bound_val(
5915		__isl_take isl_set *set,
5916		enum isl_dim_type type, unsigned pos,
5917		__isl_take isl_val *value);
5918	__isl_give isl_set *isl_set_upper_bound_si(
5919		__isl_take isl_set *set,
5920		enum isl_dim_type type, unsigned pos, int value);
5921	__isl_give isl_set *isl_set_upper_bound_val(
5922		__isl_take isl_set *set,
5923		enum isl_dim_type type, unsigned pos,
5924		__isl_take isl_val *value);
5925	__isl_give isl_set *isl_set_lower_bound_multi_val(
5926		__isl_take isl_set *set,
5927		__isl_take isl_multi_val *lower);
5928	__isl_give isl_set *isl_set_upper_bound_multi_val(
5929		__isl_take isl_set *set,
5930		__isl_take isl_multi_val *upper);
5931	__isl_give isl_set *isl_set_lower_bound_multi_pw_aff(
5932		__isl_take isl_set *set,
5933		__isl_take isl_multi_pw_aff *lower);
5934	__isl_give isl_set *isl_set_upper_bound_multi_pw_aff(
5935		__isl_take isl_set *set,
5936		__isl_take isl_multi_pw_aff *upper);
5937
5938	#include <isl/map.h>
5939	__isl_give isl_basic_map *isl_basic_map_lower_bound_si(
5940		__isl_take isl_basic_map *bmap,
5941		enum isl_dim_type type, unsigned pos, int value);
5942	__isl_give isl_basic_map *isl_basic_map_upper_bound_si(
5943		__isl_take isl_basic_map *bmap,
5944		enum isl_dim_type type, unsigned pos, int value);
5945	__isl_give isl_map *isl_map_lower_bound_si(
5946		__isl_take isl_map *map,
5947		enum isl_dim_type type, unsigned pos, int value);
5948	__isl_give isl_map *isl_map_upper_bound_si(
5949		__isl_take isl_map *map,
5950		enum isl_dim_type type, unsigned pos, int value);
5951	__isl_give isl_map *isl_map_lower_bound_val(
5952		__isl_take isl_map *map,
5953		enum isl_dim_type type, unsigned pos,
5954		__isl_take isl_val *value);
5955	__isl_give isl_map *isl_map_upper_bound_val(
5956		__isl_take isl_map *map,
5957		enum isl_dim_type type, unsigned pos,
5958		__isl_take isl_val *value);
5959	__isl_give isl_map *isl_map_lower_bound_multi_pw_aff(
5960		__isl_take isl_map *map,
5961		__isl_take isl_multi_pw_aff *lower);
5962	__isl_give isl_map *isl_map_upper_bound_multi_pw_aff(
5963		__isl_take isl_map *map,
5964		__isl_take isl_multi_pw_aff *upper);
5965
5966Intersect the set or relation with the half-space where the given
5967dimension has a value bounded by the given fixed integer value or
5968symbolic constant expression.
5969For functions taking a multi expression,
5970this applies to all set dimensions.
5971Those that bound a map, bound the range of that map.
5972If the multi expression is zero-dimensional but has an explicit domain,
5973then the (parameter) domain of the set or map is intersected
5974with this explicit domain.
5975
5976	__isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
5977		enum isl_dim_type type1, int pos1,
5978		enum isl_dim_type type2, int pos2);
5979	__isl_give isl_basic_map *isl_basic_map_equate(
5980		__isl_take isl_basic_map *bmap,
5981		enum isl_dim_type type1, int pos1,
5982		enum isl_dim_type type2, int pos2);
5983	__isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
5984		enum isl_dim_type type1, int pos1,
5985		enum isl_dim_type type2, int pos2);
5986
5987Intersect the set or relation with the hyperplane where the given
5988dimensions are equal to each other.
5989
5990	__isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
5991		enum isl_dim_type type1, int pos1,
5992		enum isl_dim_type type2, int pos2);
5993
5994Intersect the relation with the hyperplane where the given
5995dimensions have opposite values.
5996
5997	__isl_give isl_map *isl_map_order_le(
5998		__isl_take isl_map *map,
5999		enum isl_dim_type type1, int pos1,
6000		enum isl_dim_type type2, int pos2);
6001	__isl_give isl_basic_map *isl_basic_map_order_ge(
6002		__isl_take isl_basic_map *bmap,
6003		enum isl_dim_type type1, int pos1,
6004		enum isl_dim_type type2, int pos2);
6005	__isl_give isl_map *isl_map_order_ge(
6006		__isl_take isl_map *map,
6007		enum isl_dim_type type1, int pos1,
6008		enum isl_dim_type type2, int pos2);
6009	__isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
6010		enum isl_dim_type type1, int pos1,
6011		enum isl_dim_type type2, int pos2);
6012	__isl_give isl_basic_map *isl_basic_map_order_gt(
6013		__isl_take isl_basic_map *bmap,
6014		enum isl_dim_type type1, int pos1,
6015		enum isl_dim_type type2, int pos2);
6016	__isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
6017		enum isl_dim_type type1, int pos1,
6018		enum isl_dim_type type2, int pos2);
6019
6020Intersect the relation with the half-space where the given
6021dimensions satisfy the given ordering.
6022
6023	#include <isl/union_set.h>
6024	__isl_give isl_union_map *isl_union_map_remove_map_if(
6025		__isl_take isl_union_map *umap,
6026		isl_bool (*fn)(__isl_keep isl_map *map,
6027			void *user), void *user);
6028
6029This function calls the callback function once for each
6030pair of spaces for which there are elements in the input.
6031If the callback returns C<isl_bool_true>, then all those elements
6032are removed from the result.  The only remaining elements in the output
6033are then those for which the callback returns C<isl_bool_false>.
6034
6035=item * Locus
6036
6037	#include <isl/aff.h>
6038	__isl_give isl_basic_set *isl_aff_zero_basic_set(
6039		__isl_take isl_aff *aff);
6040	__isl_give isl_basic_set *isl_aff_neg_basic_set(
6041		__isl_take isl_aff *aff);
6042	__isl_give isl_set *isl_pw_aff_pos_set(
6043		__isl_take isl_pw_aff *pa);
6044	__isl_give isl_set *isl_pw_aff_nonneg_set(
6045		__isl_take isl_pw_aff *pwaff);
6046	__isl_give isl_set *isl_pw_aff_zero_set(
6047		__isl_take isl_pw_aff *pwaff);
6048	__isl_give isl_set *isl_pw_aff_non_zero_set(
6049		__isl_take isl_pw_aff *pwaff);
6050	__isl_give isl_union_set *
6051	isl_union_pw_aff_zero_union_set(
6052		__isl_take isl_union_pw_aff *upa);
6053	__isl_give isl_union_set *
6054	isl_multi_union_pw_aff_zero_union_set(
6055		__isl_take isl_multi_union_pw_aff *mupa);
6056
6057The function C<isl_aff_neg_basic_set> returns a basic set
6058containing those elements in the domain space
6059of C<aff> where C<aff> is negative.
6060The function C<isl_pw_aff_nonneg_set> returns a set
6061containing those elements in the domain
6062of C<pwaff> where C<pwaff> is non-negative.
6063The function C<isl_multi_union_pw_aff_zero_union_set>
6064returns a union set containing those elements
6065in the domains of its elements where they are all zero.
6066
6067=item * Identity
6068
6069	__isl_give isl_map *isl_set_identity(
6070		__isl_take isl_set *set);
6071	__isl_give isl_union_map *isl_union_set_identity(
6072		__isl_take isl_union_set *uset);
6073	__isl_give isl_union_pw_multi_aff *
6074	isl_union_set_identity_union_pw_multi_aff(
6075		__isl_take isl_union_set *uset);
6076
6077Construct an identity relation on the given (union) set.
6078
6079=item * Function Extraction
6080
6081A piecewise quasi affine expression that is equal to 1 on a set
6082and 0 outside the set can be created using the following function.
6083
6084	#include <isl/aff.h>
6085	__isl_give isl_pw_aff *isl_set_indicator_function(
6086		__isl_take isl_set *set);
6087
6088A piecewise multiple quasi affine expression can be extracted
6089from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
6090and the C<isl_map> is single-valued.
6091In case of a conversion from an C<isl_union_map>
6092to an C<isl_union_pw_multi_aff>, these properties need to hold
6093in each domain space.
6094A conversion to a C<isl_multi_union_pw_aff> additionally
6095requires that the input is non-empty and involves only a single
6096range space.
6097
6098	#include <isl/aff.h>
6099	__isl_give isl_pw_multi_aff *isl_set_as_pw_multi_aff(
6100		__isl_take isl_set *set);
6101	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
6102		__isl_take isl_set *set);
6103	__isl_give isl_pw_multi_aff *isl_map_as_pw_multi_aff(
6104		__isl_take isl_map *map);
6105	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
6106		__isl_take isl_map *map);
6107
6108	__isl_give isl_union_pw_multi_aff *
6109	isl_union_pw_multi_aff_from_union_set(
6110		__isl_take isl_union_set *uset);
6111	__isl_give isl_union_pw_multi_aff *
6112	isl_union_map_as_union_pw_multi_aff(
6113		__isl_take isl_union_map *umap);
6114	__isl_give isl_union_pw_multi_aff *
6115	isl_union_pw_multi_aff_from_union_map(
6116		__isl_take isl_union_map *umap);
6117
6118	__isl_give isl_multi_union_pw_aff *
6119	isl_union_map_as_multi_union_pw_aff(
6120		__isl_take isl_union_map *umap);
6121	__isl_give isl_multi_union_pw_aff *
6122	isl_multi_union_pw_aff_from_union_map(
6123		__isl_take isl_union_map *umap);
6124
6125C<isl_map_as_pw_multi_aff> and C<isl_pw_multi_aff_from_map> perform
6126the same operation.
6127Similarly for C<isl_set_as_pw_multi_aff> and
6128C<isl_pw_multi_aff_from_set>,
6129for C<isl_union_map_as_union_pw_multi_aff> and
6130C<isl_union_pw_multi_aff_from_union_map> and
6131for C<isl_union_map_as_multi_union_pw_aff> and
6132C<isl_multi_union_pw_aff_from_union_map>.
6133
6134=item * Deltas
6135
6136	__isl_give isl_basic_set *isl_basic_map_deltas(
6137		__isl_take isl_basic_map *bmap);
6138	__isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
6139	__isl_give isl_union_set *isl_union_map_deltas(
6140		__isl_take isl_union_map *umap);
6141
6142These functions return a (basic) set containing the differences
6143between image elements and corresponding domain elements in the input.
6144
6145	__isl_give isl_basic_map *isl_basic_map_deltas_map(
6146		__isl_take isl_basic_map *bmap);
6147	__isl_give isl_map *isl_map_deltas_map(
6148		__isl_take isl_map *map);
6149	__isl_give isl_union_map *isl_union_map_deltas_map(
6150		__isl_take isl_union_map *umap);
6151
6152The functions above construct a (basic, regular or union) relation
6153that maps (a wrapped version of) the input relation to its delta set.
6154
6155=item * Translation
6156
6157	#include <isl/map.h>
6158	__isl_give isl_map *isl_set_translation(
6159		__isl_take isl_set *deltas);
6160
6161This function performs essentially the opposite operation
6162of C<isl_map_deltas>.  In particular, it returns pairs
6163of elements in the same space that have a difference in C<deltas>.
6164
6165=item * Coalescing
6166
6167Simplify the representation of a set, relation or functions by trying
6168to combine pairs of basic sets or relations into a single
6169basic set or relation.
6170
6171	#include <isl/set.h>
6172	__isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
6173
6174	#include <isl/map.h>
6175	__isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
6176
6177	#include <isl/union_set.h>
6178	__isl_give isl_union_set *isl_union_set_coalesce(
6179		__isl_take isl_union_set *uset);
6180
6181	#include <isl/union_map.h>
6182	__isl_give isl_union_map *isl_union_map_coalesce(
6183		__isl_take isl_union_map *umap);
6184
6185	#include <isl/aff.h>
6186	__isl_give isl_pw_aff *isl_pw_aff_coalesce(
6187		__isl_take isl_pw_aff *pa);
6188	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
6189		__isl_take isl_pw_multi_aff *pma);
6190	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
6191		__isl_take isl_multi_pw_aff *mpa);
6192	__isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
6193		__isl_take isl_union_pw_aff *upa);
6194	__isl_give isl_union_pw_multi_aff *
6195	isl_union_pw_multi_aff_coalesce(
6196		__isl_take isl_union_pw_multi_aff *upma);
6197	__isl_give isl_multi_union_pw_aff *
6198	isl_multi_union_pw_aff_coalesce(
6199		__isl_take isl_multi_union_pw_aff *mupa);
6200
6201	#include <isl/polynomial.h>
6202	__isl_give isl_pw_qpolynomial_fold *
6203	isl_pw_qpolynomial_fold_coalesce(
6204		__isl_take isl_pw_qpolynomial_fold *pwf);
6205	__isl_give isl_union_pw_qpolynomial *
6206	isl_union_pw_qpolynomial_coalesce(
6207		__isl_take isl_union_pw_qpolynomial *upwqp);
6208	__isl_give isl_union_pw_qpolynomial_fold *
6209	isl_union_pw_qpolynomial_fold_coalesce(
6210		__isl_take isl_union_pw_qpolynomial_fold *upwf);
6211
6212One of the methods for combining pairs of basic sets or relations
6213can result in coefficients that are much larger than those that appear
6214in the constraints of the input.  By default, the coefficients are
6215not allowed to grow larger, but this can be changed by unsetting
6216the following option.
6217
6218	isl_stat isl_options_set_coalesce_bounded_wrapping(
6219		isl_ctx *ctx, int val);
6220	int isl_options_get_coalesce_bounded_wrapping(
6221		isl_ctx *ctx);
6222
6223One of the other methods tries to combine pairs of basic sets
6224with different local variables, treating them as existentially
6225quantified variables even if they have known (but different)
6226integer division expressions.  The result may then also have
6227existentially quantified variables.  Turning on the following
6228option prevents this from happening.
6229
6230	isl_stat isl_options_set_coalesce_preserve_locals(
6231		isl_ctx *ctx, int val);
6232	int isl_options_get_coalesce_preserve_locals(isl_ctx *ctx);
6233
6234=item * Detecting equalities
6235
6236	__isl_give isl_basic_set *isl_basic_set_detect_equalities(
6237                __isl_take isl_basic_set *bset);
6238	__isl_give isl_basic_map *isl_basic_map_detect_equalities(
6239                __isl_take isl_basic_map *bmap);
6240	__isl_give isl_set *isl_set_detect_equalities(
6241		__isl_take isl_set *set);
6242	__isl_give isl_map *isl_map_detect_equalities(
6243		__isl_take isl_map *map);
6244	__isl_give isl_union_set *isl_union_set_detect_equalities(
6245		__isl_take isl_union_set *uset);
6246	__isl_give isl_union_map *isl_union_map_detect_equalities(
6247		__isl_take isl_union_map *umap);
6248
6249Simplify the representation of a set or relation by detecting implicit
6250equalities.
6251
6252=item * Removing redundant constraints
6253
6254	#include <isl/set.h>
6255	__isl_give isl_basic_set *isl_basic_set_remove_redundancies(
6256		__isl_take isl_basic_set *bset);
6257	__isl_give isl_set *isl_set_remove_redundancies(
6258		__isl_take isl_set *set);
6259
6260	#include <isl/union_set.h>
6261	__isl_give isl_union_set *
6262	isl_union_set_remove_redundancies(
6263		__isl_take isl_union_set *uset);
6264
6265	#include <isl/map.h>
6266	__isl_give isl_basic_map *isl_basic_map_remove_redundancies(
6267		__isl_take isl_basic_map *bmap);
6268	__isl_give isl_map *isl_map_remove_redundancies(
6269		__isl_take isl_map *map);
6270
6271	#include <isl/union_map.h>
6272	__isl_give isl_union_map *
6273	isl_union_map_remove_redundancies(
6274		__isl_take isl_union_map *umap);
6275
6276=item * Convex hull
6277
6278	__isl_give isl_basic_set *isl_set_convex_hull(
6279		__isl_take isl_set *set);
6280	__isl_give isl_basic_map *isl_map_convex_hull(
6281		__isl_take isl_map *map);
6282
6283If the input set or relation has any existentially quantified
6284variables, then the result of these operations is currently undefined.
6285
6286=item * Simple hull
6287
6288	#include <isl/set.h>
6289	__isl_give isl_basic_set *
6290	isl_set_unshifted_simple_hull(
6291		__isl_take isl_set *set);
6292	__isl_give isl_basic_set *isl_set_simple_hull(
6293		__isl_take isl_set *set);
6294	__isl_give isl_basic_set *
6295	isl_set_plain_unshifted_simple_hull(
6296		__isl_take isl_set *set);
6297	__isl_give isl_basic_set *
6298	isl_set_unshifted_simple_hull_from_set_list(
6299		__isl_take isl_set *set,
6300		__isl_take isl_set_list *list);
6301
6302	#include <isl/map.h>
6303	__isl_give isl_basic_map *
6304	isl_map_unshifted_simple_hull(
6305		__isl_take isl_map *map);
6306	__isl_give isl_basic_map *isl_map_simple_hull(
6307		__isl_take isl_map *map);
6308	__isl_give isl_basic_map *
6309	isl_map_plain_unshifted_simple_hull(
6310		__isl_take isl_map *map);
6311		__isl_give isl_basic_map *
6312	isl_map_unshifted_simple_hull_from_map_list(
6313		__isl_take isl_map *map,
6314		__isl_take isl_map_list *list);
6315
6316	#include <isl/union_map.h>
6317	__isl_give isl_union_map *isl_union_map_simple_hull(
6318		__isl_take isl_union_map *umap);
6319
6320These functions compute a single basic set or relation
6321that contains the whole input set or relation.
6322In particular, the output is described by translates
6323of the constraints describing the basic sets or relations in the input.
6324In case of C<isl_set_unshifted_simple_hull>, only the original
6325constraints are used, without any translation.
6326In case of C<isl_set_plain_unshifted_simple_hull> and
6327C<isl_map_plain_unshifted_simple_hull>, the result is described
6328by original constraints that are obviously satisfied
6329by the entire input set or relation.
6330In case of C<isl_set_unshifted_simple_hull_from_set_list> and
6331C<isl_map_unshifted_simple_hull_from_map_list>, the
6332constraints are taken from the elements of the second argument.
6333
6334=begin latex
6335
6336(See \autoref{s:simple hull}.)
6337
6338=end latex
6339
6340=item * Affine hull
6341
6342	__isl_give isl_basic_set *isl_basic_set_affine_hull(
6343		__isl_take isl_basic_set *bset);
6344	__isl_give isl_basic_set *isl_set_affine_hull(
6345		__isl_take isl_set *set);
6346	__isl_give isl_union_set *isl_union_set_affine_hull(
6347		__isl_take isl_union_set *uset);
6348	__isl_give isl_basic_map *isl_basic_map_affine_hull(
6349		__isl_take isl_basic_map *bmap);
6350	__isl_give isl_basic_map *isl_map_affine_hull(
6351		__isl_take isl_map *map);
6352	__isl_give isl_union_map *isl_union_map_affine_hull(
6353		__isl_take isl_union_map *umap);
6354
6355In case of union sets and relations, the affine hull is computed
6356per space.
6357
6358=item * Polyhedral hull
6359
6360	__isl_give isl_basic_set *isl_set_polyhedral_hull(
6361		__isl_take isl_set *set);
6362	__isl_give isl_basic_map *isl_map_polyhedral_hull(
6363		__isl_take isl_map *map);
6364	__isl_give isl_union_set *isl_union_set_polyhedral_hull(
6365		__isl_take isl_union_set *uset);
6366	__isl_give isl_union_map *isl_union_map_polyhedral_hull(
6367		__isl_take isl_union_map *umap);
6368
6369These functions compute a single basic set or relation
6370not involving any existentially quantified variables
6371that contains the whole input set or relation.
6372In case of union sets and relations, the polyhedral hull is computed
6373per space.
6374
6375=item * Box hull
6376
6377	#include <isl/set.h>
6378	__isl_give isl_fixed_box *
6379	isl_set_get_simple_fixed_box_hull(
6380		__isl_keep isl_set *set)
6381
6382	#include <isl/map.h>
6383	__isl_give isl_fixed_box *
6384	isl_map_get_range_simple_fixed_box_hull(
6385		__isl_keep isl_map *map);
6386
6387These functions try to approximate the set or
6388the range of the map by a box of fixed size.
6389The box is described in terms of an offset living in the same space as
6390the input and a size living in the set or range space.  For any element
6391in the input map, the range value is greater than or equal to
6392the offset applied to the domain value and the difference with
6393this offset is strictly smaller than the size.
6394The same holds for the elements of the input set, where
6395the offset is a parametric constant value.
6396If no fixed-size approximation can be found,
6397an I<invalid> box is returned, i.e., one for which
6398C<isl_fixed_box_is_valid> below returns false.
6399
6400The validity, the offset and the size of the box can be obtained using
6401the following functions.
6402
6403	#include <isl/fixed_box.h>
6404	isl_bool isl_fixed_box_is_valid(
6405		__isl_keep isl_fixed_box *box);
6406	__isl_give isl_multi_aff *isl_fixed_box_get_offset(
6407		__isl_keep isl_fixed_box *box);
6408	__isl_give isl_multi_val *isl_fixed_box_get_size(
6409		__isl_keep isl_fixed_box *box);
6410
6411The box can be copied and freed using the following functions.
6412
6413	#include <isl/fixed_box.h>
6414	__isl_give isl_fixed_box *isl_fixed_box_copy(
6415		__isl_keep isl_fixed_box *box);
6416	__isl_null isl_fixed_box *isl_fixed_box_free(
6417		__isl_take isl_fixed_box *box);
6418
6419A representation of the information contained in an object
6420of type C<isl_fixed_box> can be obtained using
6421
6422	#include <isl/fixed_box.h>
6423	__isl_give isl_printer *isl_printer_print_fixed_box(
6424		__isl_take isl_printer *p,
6425		__isl_keep isl_fixed_box *box);
6426	__isl_give char *isl_fixed_box_to_str(
6427		__isl_keep isl_fixed_box *box);
6428
6429C<isl_fixed_box_to_str> prints the information in flow format.
6430
6431=item * Other approximations
6432
6433	#include <isl/set.h>
6434	__isl_give isl_basic_set *
6435	isl_basic_set_drop_constraints_involving_dims(
6436		__isl_take isl_basic_set *bset,
6437		enum isl_dim_type type,
6438		unsigned first, unsigned n);
6439	__isl_give isl_basic_set *
6440	isl_basic_set_drop_constraints_not_involving_dims(
6441		__isl_take isl_basic_set *bset,
6442		enum isl_dim_type type,
6443		unsigned first, unsigned n);
6444	__isl_give isl_set *
6445	isl_set_drop_constraints_involving_dims(
6446		__isl_take isl_set *set,
6447		enum isl_dim_type type,
6448		unsigned first, unsigned n);
6449	__isl_give isl_set *
6450	isl_set_drop_constraints_not_involving_dims(
6451		__isl_take isl_set *set,
6452		enum isl_dim_type type,
6453		unsigned first, unsigned n);
6454
6455	#include <isl/map.h>
6456	__isl_give isl_basic_map *
6457	isl_basic_map_drop_constraints_involving_dims(
6458		__isl_take isl_basic_map *bmap,
6459		enum isl_dim_type type,
6460		unsigned first, unsigned n);
6461	__isl_give isl_basic_map *
6462	isl_basic_map_drop_constraints_not_involving_dims(
6463		__isl_take isl_basic_map *bmap,
6464		enum isl_dim_type type,
6465		unsigned first, unsigned n);
6466	__isl_give isl_map *
6467	isl_map_drop_constraints_involving_dims(
6468		__isl_take isl_map *map,
6469		enum isl_dim_type type,
6470		unsigned first, unsigned n);
6471	__isl_give isl_map *
6472	isl_map_drop_constraints_not_involving_dims(
6473		__isl_take isl_map *map,
6474		enum isl_dim_type type,
6475		unsigned first, unsigned n);
6476
6477These functions drop any constraints (not) involving the specified dimensions.
6478Note that the result depends on the representation of the input.
6479
6480	#include <isl/polynomial.h>
6481	__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
6482		__isl_take isl_pw_qpolynomial *pwqp, int sign);
6483	__isl_give isl_union_pw_qpolynomial *
6484	isl_union_pw_qpolynomial_to_polynomial(
6485		__isl_take isl_union_pw_qpolynomial *upwqp, int sign);
6486
6487Approximate each quasipolynomial by a polynomial.  If C<sign> is positive,
6488the polynomial will be an overapproximation.  If C<sign> is negative,
6489it will be an underapproximation.  If C<sign> is zero, the approximation
6490will lie somewhere in between.
6491
6492=item * Feasibility
6493
6494	__isl_give isl_basic_set *isl_basic_set_sample(
6495		__isl_take isl_basic_set *bset);
6496	__isl_give isl_basic_set *isl_set_sample(
6497		__isl_take isl_set *set);
6498	__isl_give isl_basic_map *isl_basic_map_sample(
6499		__isl_take isl_basic_map *bmap);
6500	__isl_give isl_basic_map *isl_map_sample(
6501		__isl_take isl_map *map);
6502
6503If the input (basic) set or relation is non-empty, then return
6504a singleton subset of the input.  Otherwise, return an empty set.
6505
6506=item * Optimization
6507
6508	#include <isl/ilp.h>
6509	__isl_give isl_val *isl_basic_set_max_val(
6510		__isl_keep isl_basic_set *bset,
6511		__isl_keep isl_aff *obj);
6512	__isl_give isl_val *isl_set_min_val(
6513		__isl_keep isl_set *set,
6514		__isl_keep isl_aff *obj);
6515	__isl_give isl_val *isl_set_max_val(
6516		__isl_keep isl_set *set,
6517		__isl_keep isl_aff *obj);
6518	__isl_give isl_multi_val *
6519	isl_union_set_min_multi_union_pw_aff(
6520		__isl_keep isl_union_set *uset,
6521		__isl_keep isl_multi_union_pw_aff *obj);
6522
6523Compute the minimum or maximum of the integer affine expression C<obj>
6524over the points in C<set>.
6525The result is C<NULL> in case of an error, the optimal value in case
6526there is one, negative infinity or infinity if the problem is unbounded and
6527NaN if the problem is empty.
6528
6529	#include <isl/ilp.h>
6530	__isl_give isl_multi_val *
6531	isl_pw_multi_aff_min_multi_val(
6532		__isl_take isl_pw_multi_aff *pma);
6533	__isl_give isl_multi_val *
6534	isl_pw_multi_aff_max_multi_val(
6535		__isl_take isl_pw_multi_aff *pma);
6536	__isl_give isl_multi_val *
6537	isl_multi_pw_aff_min_multi_val(
6538		__isl_take isl_multi_pw_aff *mpa);
6539	__isl_give isl_multi_val *
6540	isl_multi_pw_aff_max_multi_val(
6541		__isl_take isl_multi_pw_aff *mpa);
6542	__isl_give isl_val *isl_union_pw_aff_min_val(
6543		__isl_take isl_union_pw_aff *upa);
6544	__isl_give isl_val *isl_union_pw_aff_max_val(
6545		__isl_take isl_union_pw_aff *upa);
6546	__isl_give isl_multi_val *
6547	isl_multi_union_pw_aff_min_multi_val(
6548		__isl_take isl_multi_union_pw_aff *mupa);
6549	__isl_give isl_multi_val *
6550	isl_multi_union_pw_aff_max_multi_val(
6551		__isl_take isl_multi_union_pw_aff *mupa);
6552
6553Compute the minimum or maximum of the integer affine expression
6554over its definition domain.
6555The result is C<NULL> in case of an error, the optimal value in case
6556there is one, negative infinity or infinity if the problem is unbounded and
6557NaN if the problem is empty.
6558
6559	#include <isl/ilp.h>
6560	__isl_give isl_val *isl_basic_set_dim_max_val(
6561		__isl_take isl_basic_set *bset, int pos);
6562	__isl_give isl_val *isl_set_dim_min_val(
6563		__isl_take isl_set *set, int pos);
6564	__isl_give isl_val *isl_set_dim_max_val(
6565		__isl_take isl_set *set, int pos);
6566
6567Return the minimal or maximal value attained by the given set dimension,
6568independently of the parameter values and of any other dimensions.
6569The result is C<NULL> in case of an error, the optimal value in case
6570there is one, (negative) infinity if the problem is unbounded and
6571NaN if the input is empty.
6572
6573=item * Parametric optimization
6574
6575	__isl_give isl_pw_aff *isl_set_dim_min(
6576		__isl_take isl_set *set, int pos);
6577	__isl_give isl_pw_aff *isl_set_dim_max(
6578		__isl_take isl_set *set, int pos);
6579	__isl_give isl_pw_aff *isl_map_dim_min(
6580		__isl_take isl_map *map, int pos);
6581	__isl_give isl_pw_aff *isl_map_dim_max(
6582		__isl_take isl_map *map, int pos);
6583	__isl_give isl_multi_pw_aff *
6584	isl_set_min_multi_pw_aff(
6585		__isl_take isl_set *set);
6586	__isl_give isl_multi_pw_aff *
6587	isl_set_max_multi_pw_aff(
6588		__isl_take isl_set *set);
6589	__isl_give isl_multi_pw_aff *
6590	isl_map_min_multi_pw_aff(
6591		__isl_take isl_map *map);
6592	__isl_give isl_multi_pw_aff *
6593	isl_map_max_multi_pw_aff(
6594		__isl_take isl_map *map);
6595
6596Compute the minimum or maximum of the (given) set or output dimension(s)
6597as a function of the parameters (and input dimensions), but independently
6598of the other set or output dimensions.
6599For lexicographic optimization, see L<"Lexicographic Optimization">.
6600
6601=item * Dual
6602
6603The following functions compute either the set of (rational) coefficient
6604values of valid constraints for the given set or the set of (rational)
6605values satisfying the constraints with coefficients from the given set.
6606Internally, these two sets of functions perform essentially the
6607same operations, except that the set of coefficients is assumed to
6608be a cone, while the set of values may be any polyhedron.
6609The current implementation is based on the Farkas lemma and
6610Fourier-Motzkin elimination, but this may change or be made optional
6611in future.  In particular, future implementations may use different
6612dualization algorithms or skip the elimination step.
6613
6614	#include <isl/set.h>
6615	__isl_give isl_basic_set *isl_basic_set_coefficients(
6616		__isl_take isl_basic_set *bset);
6617	__isl_give isl_basic_set_list *
6618	isl_basic_set_list_coefficients(
6619		__isl_take isl_basic_set_list *list);
6620	__isl_give isl_basic_set *isl_set_coefficients(
6621		__isl_take isl_set *set);
6622	__isl_give isl_union_set *isl_union_set_coefficients(
6623		__isl_take isl_union_set *bset);
6624	__isl_give isl_basic_set *isl_basic_set_solutions(
6625		__isl_take isl_basic_set *bset);
6626	__isl_give isl_basic_set *isl_set_solutions(
6627		__isl_take isl_set *set);
6628	__isl_give isl_union_set *isl_union_set_solutions(
6629		__isl_take isl_union_set *bset);
6630
6631=item * Power
6632
6633	__isl_give isl_map *isl_map_fixed_power_val(
6634		__isl_take isl_map *map,
6635		__isl_take isl_val *exp);
6636	__isl_give isl_union_map *
6637	isl_union_map_fixed_power_val(
6638		__isl_take isl_union_map *umap,
6639		__isl_take isl_val *exp);
6640
6641Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
6642If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
6643of C<map> is computed.
6644
6645	__isl_give isl_map *isl_map_power(__isl_take isl_map *map,
6646		isl_bool *exact);
6647	__isl_give isl_union_map *isl_union_map_power(
6648		__isl_take isl_union_map *umap, isl_bool *exact);
6649
6650Compute a parametric representation for all positive powers I<k> of C<map>.
6651The result maps I<k> to a nested relation corresponding to the
6652I<k>th power of C<map>.
6653The result may be an overapproximation.  If the result is known to be exact,
6654then C<*exact> is set to C<1>.
6655
6656=item * Transitive closure
6657
6658	__isl_give isl_map *isl_map_transitive_closure(
6659		__isl_take isl_map *map, isl_bool *exact);
6660	__isl_give isl_union_map *isl_union_map_transitive_closure(
6661		__isl_take isl_union_map *umap, isl_bool *exact);
6662
6663Compute the transitive closure of C<map>.
6664The result may be an overapproximation.  If the result is known to be exact,
6665then C<*exact> is set to C<1>.
6666
6667=item * Reaching path lengths
6668
6669	__isl_give isl_map *isl_map_reaching_path_lengths(
6670		__isl_take isl_map *map, isl_bool *exact);
6671
6672Compute a relation that maps each element in the range of C<map>
6673to the lengths of all paths composed of edges in C<map> that
6674end up in the given element.
6675The result may be an overapproximation.  If the result is known to be exact,
6676then C<*exact> is set to C<1>.
6677To compute the I<maximal> path length, the resulting relation
6678should be postprocessed by C<isl_map_lexmax>.
6679In particular, if the input relation is a dependence relation
6680(mapping sources to sinks), then the maximal path length corresponds
6681to the free schedule.
6682Note, however, that C<isl_map_lexmax> expects the maximum to be
6683finite, so if the path lengths are unbounded (possibly due to
6684the overapproximation), then you will get an error message.
6685
6686=item * Wrapping
6687
6688	#include <isl/space.h>
6689	__isl_give isl_space *isl_space_wrap(
6690		__isl_take isl_space *space);
6691	__isl_give isl_space *isl_space_unwrap(
6692		__isl_take isl_space *space);
6693
6694	#include <isl/local_space.h>
6695	__isl_give isl_local_space *isl_local_space_wrap(
6696		__isl_take isl_local_space *ls);
6697
6698	#include <isl/set.h>
6699	__isl_give isl_basic_map *isl_basic_set_unwrap(
6700		__isl_take isl_basic_set *bset);
6701	__isl_give isl_map *isl_set_unwrap(
6702		__isl_take isl_set *set);
6703
6704	#include <isl/map.h>
6705	__isl_give isl_basic_set *isl_basic_map_wrap(
6706		__isl_take isl_basic_map *bmap);
6707	__isl_give isl_set *isl_map_wrap(
6708		__isl_take isl_map *map);
6709
6710	#include <isl/union_set.h>
6711	__isl_give isl_union_map *isl_union_set_unwrap(
6712		__isl_take isl_union_set *uset);
6713
6714	#include <isl/union_map.h>
6715	__isl_give isl_union_set *isl_union_map_wrap(
6716		__isl_take isl_union_map *umap);
6717
6718The input to C<isl_space_unwrap> should
6719be the space of a set, while that of
6720C<isl_space_wrap> should be the space of a relation.
6721Conversely, the output of C<isl_space_unwrap> is the space
6722of a relation, while that of C<isl_space_wrap> is the space of a set.
6723
6724=item * Flattening
6725
6726Remove any internal structure of domain (and range) of the given
6727set or relation.  If there is any such internal structure in the input,
6728then the name of the space is also removed.
6729
6730	#include <isl/space.h>
6731	__isl_give isl_space *isl_space_flatten_domain(
6732		__isl_take isl_space *space);
6733	__isl_give isl_space *isl_space_flatten_range(
6734		__isl_take isl_space *space);
6735
6736	#include <isl/local_space.h>
6737	__isl_give isl_local_space *
6738	isl_local_space_flatten_domain(
6739		__isl_take isl_local_space *ls);
6740	__isl_give isl_local_space *
6741	isl_local_space_flatten_range(
6742		__isl_take isl_local_space *ls);
6743
6744	#include <isl/set.h>
6745	__isl_give isl_basic_set *isl_basic_set_flatten(
6746		__isl_take isl_basic_set *bset);
6747	__isl_give isl_set *isl_set_flatten(
6748		__isl_take isl_set *set);
6749
6750	#include <isl/map.h>
6751	__isl_give isl_basic_map *isl_basic_map_flatten_domain(
6752		__isl_take isl_basic_map *bmap);
6753	__isl_give isl_basic_map *isl_basic_map_flatten_range(
6754		__isl_take isl_basic_map *bmap);
6755	__isl_give isl_map *isl_map_flatten_range(
6756		__isl_take isl_map *map);
6757	__isl_give isl_map *isl_map_flatten_domain(
6758		__isl_take isl_map *map);
6759	__isl_give isl_basic_map *isl_basic_map_flatten(
6760		__isl_take isl_basic_map *bmap);
6761	__isl_give isl_map *isl_map_flatten(
6762		__isl_take isl_map *map);
6763
6764	#include <isl/id.h>
6765	__isl_give isl_multi_id *isl_multi_id_flatten_range(
6766		__isl_take isl_multi_id *mi);
6767
6768	#include <isl/val.h>
6769	__isl_give isl_multi_val *isl_multi_val_flatten_range(
6770		__isl_take isl_multi_val *mv);
6771
6772	#include <isl/aff.h>
6773	__isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
6774		__isl_take isl_multi_aff *ma);
6775	__isl_give isl_multi_aff *isl_multi_aff_flatten_range(
6776		__isl_take isl_multi_aff *ma);
6777	__isl_give isl_multi_pw_aff *
6778	isl_multi_pw_aff_flatten_range(
6779		__isl_take isl_multi_pw_aff *mpa);
6780	__isl_give isl_multi_union_pw_aff *
6781	isl_multi_union_pw_aff_flatten_range(
6782		__isl_take isl_multi_union_pw_aff *mupa);
6783
6784	#include <isl/map.h>
6785	__isl_give isl_map *isl_set_flatten_map(
6786		__isl_take isl_set *set);
6787
6788The function above constructs a relation
6789that maps the input set to a flattened version of the set.
6790
6791=item * Lifting
6792
6793Lift the input set to a space with extra dimensions corresponding
6794to the existentially quantified variables in the input.
6795In particular, the result lives in a wrapped map where the domain
6796is the original space and the range corresponds to the original
6797existentially quantified variables.
6798
6799	#include <isl/set.h>
6800	__isl_give isl_basic_set *isl_basic_set_lift(
6801		__isl_take isl_basic_set *bset);
6802	__isl_give isl_set *isl_set_lift(
6803		__isl_take isl_set *set);
6804	__isl_give isl_union_set *isl_union_set_lift(
6805		__isl_take isl_union_set *uset);
6806
6807Given a local space that contains the existentially quantified
6808variables of a set, a basic relation that, when applied to
6809a basic set, has essentially the same effect as C<isl_basic_set_lift>,
6810can be constructed using the following function.
6811
6812	#include <isl/local_space.h>
6813	__isl_give isl_basic_map *isl_local_space_lifting(
6814		__isl_take isl_local_space *ls);
6815
6816	#include <isl/aff.h>
6817	__isl_give isl_multi_aff *isl_multi_aff_lift(
6818		__isl_take isl_multi_aff *maff,
6819		__isl_give isl_local_space **ls);
6820
6821If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
6822then it is assigned the local space that lies at the basis of
6823the lifting applied.
6824
6825=item * Internal Product
6826
6827	#include <isl/space.h>
6828	__isl_give isl_space *isl_space_zip(
6829		__isl_take isl_space *space);
6830
6831	#include <isl/map.h>
6832	__isl_give isl_basic_map *isl_basic_map_zip(
6833		__isl_take isl_basic_map *bmap);
6834	__isl_give isl_map *isl_map_zip(
6835		__isl_take isl_map *map);
6836
6837	#include <isl/union_map.h>
6838	__isl_give isl_union_map *isl_union_map_zip(
6839		__isl_take isl_union_map *umap);
6840
6841Given a relation with nested relations for domain and range,
6842interchange the range of the domain with the domain of the range.
6843
6844=item * Currying
6845
6846	#include <isl/space.h>
6847	__isl_give isl_space *isl_space_curry(
6848		__isl_take isl_space *space);
6849	__isl_give isl_space *isl_space_uncurry(
6850		__isl_take isl_space *space);
6851
6852	#include <isl/map.h>
6853	__isl_give isl_basic_map *isl_basic_map_curry(
6854		__isl_take isl_basic_map *bmap);
6855	__isl_give isl_basic_map *isl_basic_map_uncurry(
6856		__isl_take isl_basic_map *bmap);
6857	__isl_give isl_map *isl_map_curry(
6858		__isl_take isl_map *map);
6859	__isl_give isl_map *isl_map_uncurry(
6860		__isl_take isl_map *map);
6861
6862	#include <isl/union_map.h>
6863	__isl_give isl_union_map *isl_union_map_curry(
6864		__isl_take isl_union_map *umap);
6865	__isl_give isl_union_map *isl_union_map_uncurry(
6866		__isl_take isl_union_map *umap);
6867
6868Given a relation with a nested relation for domain,
6869the C<curry> functions
6870move the range of the nested relation out of the domain
6871and use it as the domain of a nested relation in the range,
6872with the original range as range of this nested relation.
6873The C<uncurry> functions perform the inverse operation.
6874
6875	#include <isl/space.h>
6876	__isl_give isl_space *isl_space_range_curry(
6877		__isl_take isl_space *space);
6878
6879	#include <isl/map.h>
6880	__isl_give isl_map *isl_map_range_curry(
6881		__isl_take isl_map *map);
6882
6883	#include <isl/union_map.h>
6884	__isl_give isl_union_map *isl_union_map_range_curry(
6885		__isl_take isl_union_map *umap);
6886
6887These functions apply the currying to the relation that
6888is nested inside the range of the input.
6889
6890=item * Aligning parameters
6891
6892Change the order of the parameters of the given set, relation
6893or function
6894such that the first parameters match those of C<model>.
6895This may involve the introduction of extra parameters.
6896All parameters need to be named.
6897
6898	#include <isl/space.h>
6899	__isl_give isl_space *isl_space_align_params(
6900		__isl_take isl_space *space1,
6901		__isl_take isl_space *space2)
6902
6903	#include <isl/set.h>
6904	__isl_give isl_basic_set *isl_basic_set_align_params(
6905		__isl_take isl_basic_set *bset,
6906		__isl_take isl_space *model);
6907	__isl_give isl_set *isl_set_align_params(
6908		__isl_take isl_set *set,
6909		__isl_take isl_space *model);
6910
6911	#include <isl/map.h>
6912	__isl_give isl_basic_map *isl_basic_map_align_params(
6913		__isl_take isl_basic_map *bmap,
6914		__isl_take isl_space *model);
6915	__isl_give isl_map *isl_map_align_params(
6916		__isl_take isl_map *map,
6917		__isl_take isl_space *model);
6918
6919	#include <isl/id.h>
6920	__isl_give isl_multi_id *isl_multi_id_align_params(
6921		__isl_take isl_multi_id *mi,
6922		__isl_take isl_space *model);
6923
6924	#include <isl/val.h>
6925	__isl_give isl_multi_val *isl_multi_val_align_params(
6926		__isl_take isl_multi_val *mv,
6927		__isl_take isl_space *model);
6928
6929	#include <isl/aff.h>
6930	__isl_give isl_aff *isl_aff_align_params(
6931		__isl_take isl_aff *aff,
6932		__isl_take isl_space *model);
6933	__isl_give isl_multi_aff *isl_multi_aff_align_params(
6934		__isl_take isl_multi_aff *multi,
6935		__isl_take isl_space *model);
6936	__isl_give isl_pw_aff *isl_pw_aff_align_params(
6937		__isl_take isl_pw_aff *pwaff,
6938		__isl_take isl_space *model);
6939	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
6940		__isl_take isl_pw_multi_aff *pma,
6941		__isl_take isl_space *model);
6942	__isl_give isl_union_pw_aff *
6943	isl_union_pw_aff_align_params(
6944		__isl_take isl_union_pw_aff *upa,
6945		__isl_take isl_space *model);
6946	__isl_give isl_union_pw_multi_aff *
6947	isl_union_pw_multi_aff_align_params(
6948		__isl_take isl_union_pw_multi_aff *upma,
6949		__isl_take isl_space *model);
6950	__isl_give isl_multi_union_pw_aff *
6951	isl_multi_union_pw_aff_align_params(
6952		__isl_take isl_multi_union_pw_aff *mupa,
6953		__isl_take isl_space *model);
6954
6955	#include <isl/polynomial.h>
6956	__isl_give isl_qpolynomial *isl_qpolynomial_align_params(
6957		__isl_take isl_qpolynomial *qp,
6958		__isl_take isl_space *model);
6959
6960=item * Drop unused parameters
6961
6962Drop parameters that are not referenced by the isl object.
6963All parameters need to be named.
6964
6965	#include <isl/set.h>
6966	__isl_give isl_basic_set *
6967	isl_basic_set_drop_unused_params(
6968		__isl_take isl_basic_set *bset);
6969	__isl_give isl_set *isl_set_drop_unused_params(
6970		__isl_take isl_set *set);
6971
6972	#include <isl/map.h>
6973	__isl_give isl_basic_map *
6974	isl_basic_map_drop_unused_params(
6975		__isl_take isl_basic_map *bmap);
6976	__isl_give isl_map *isl_map_drop_unused_params(
6977		__isl_take isl_map *map);
6978
6979	#include <isl/aff.h>
6980	__isl_give isl_pw_aff *isl_pw_aff_drop_unused_params(
6981		__isl_take isl_pw_aff *pa);
6982	__isl_give isl_pw_multi_aff *
6983	isl_pw_multi_aff_drop_unused_params(
6984		__isl_take isl_pw_multi_aff *pma);
6985
6986	#include <isl/polynomial.h>
6987	__isl_give isl_pw_qpolynomial *
6988	isl_pw_qpolynomial_drop_unused_params(
6989		__isl_take isl_pw_qpolynomial *pwqp);
6990	__isl_give isl_pw_qpolynomial_fold *
6991	isl_pw_qpolynomial_fold_drop_unused_params(
6992		__isl_take isl_pw_qpolynomial_fold *pwf);
6993
6994=item * Unary Arithmetic Operations
6995
6996	#include <isl/set.h>
6997	__isl_give isl_set *isl_set_neg(
6998		__isl_take isl_set *set);
6999	#include <isl/map.h>
7000	__isl_give isl_map *isl_map_neg(
7001		__isl_take isl_map *map);
7002
7003C<isl_set_neg> constructs a set containing the opposites of
7004the elements in its argument.
7005The domain of the result of C<isl_map_neg> is the same
7006as the domain of its argument.  The corresponding range
7007elements are the opposites of the corresponding range
7008elements in the argument.
7009
7010	#include <isl/val.h>
7011	__isl_give isl_multi_val *isl_multi_val_neg(
7012		__isl_take isl_multi_val *mv);
7013
7014	#include <isl/aff.h>
7015	__isl_give isl_aff *isl_aff_neg(
7016		__isl_take isl_aff *aff);
7017	__isl_give isl_multi_aff *isl_multi_aff_neg(
7018		__isl_take isl_multi_aff *ma);
7019	__isl_give isl_pw_aff *isl_pw_aff_neg(
7020		__isl_take isl_pw_aff *pwaff);
7021	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
7022		__isl_take isl_pw_multi_aff *pma);
7023	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
7024		__isl_take isl_multi_pw_aff *mpa);
7025	__isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
7026		__isl_take isl_union_pw_aff *upa);
7027	__isl_give isl_union_pw_multi_aff *
7028	isl_union_pw_multi_aff_neg(
7029		__isl_take isl_union_pw_multi_aff *upma);
7030	__isl_give isl_multi_union_pw_aff *
7031	isl_multi_union_pw_aff_neg(
7032		__isl_take isl_multi_union_pw_aff *mupa);
7033	__isl_give isl_aff *isl_aff_ceil(
7034		__isl_take isl_aff *aff);
7035	__isl_give isl_pw_aff *isl_pw_aff_ceil(
7036		__isl_take isl_pw_aff *pwaff);
7037	__isl_give isl_aff *isl_aff_floor(
7038		__isl_take isl_aff *aff);
7039	__isl_give isl_multi_aff *isl_multi_aff_floor(
7040		__isl_take isl_multi_aff *ma);
7041	__isl_give isl_pw_aff *isl_pw_aff_floor(
7042		__isl_take isl_pw_aff *pwaff);
7043	__isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
7044		__isl_take isl_union_pw_aff *upa);
7045	__isl_give isl_multi_union_pw_aff *
7046	isl_multi_union_pw_aff_floor(
7047		__isl_take isl_multi_union_pw_aff *mupa);
7048
7049	#include <isl/aff.h>
7050	__isl_give isl_pw_aff *isl_pw_aff_list_min(
7051		__isl_take isl_pw_aff_list *list);
7052	__isl_give isl_pw_aff *isl_pw_aff_list_max(
7053		__isl_take isl_pw_aff_list *list);
7054
7055	#include <isl/polynomial.h>
7056	__isl_give isl_qpolynomial *isl_qpolynomial_neg(
7057		__isl_take isl_qpolynomial *qp);
7058	__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
7059		__isl_take isl_pw_qpolynomial *pwqp);
7060	__isl_give isl_union_pw_qpolynomial *
7061	isl_union_pw_qpolynomial_neg(
7062		__isl_take isl_union_pw_qpolynomial *upwqp);
7063	__isl_give isl_qpolynomial *isl_qpolynomial_pow(
7064		__isl_take isl_qpolynomial *qp,
7065		unsigned exponent);
7066	__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
7067		__isl_take isl_pw_qpolynomial *pwqp,
7068		unsigned exponent);
7069
7070=item * Evaluation
7071
7072The following functions evaluate a function in a point.
7073
7074	#include <isl/aff.h>
7075	__isl_give isl_val *isl_aff_eval(
7076		__isl_take isl_aff *aff,
7077		__isl_take isl_point *pnt);
7078	__isl_give isl_val *isl_pw_aff_eval(
7079		__isl_take isl_pw_aff *pa,
7080		__isl_take isl_point *pnt);
7081
7082	#include <isl/polynomial.h>
7083	__isl_give isl_val *isl_pw_qpolynomial_eval(
7084		__isl_take isl_pw_qpolynomial *pwqp,
7085		__isl_take isl_point *pnt);
7086	__isl_give isl_val *isl_pw_qpolynomial_fold_eval(
7087		__isl_take isl_pw_qpolynomial_fold *pwf,
7088		__isl_take isl_point *pnt);
7089	__isl_give isl_val *isl_union_pw_qpolynomial_eval(
7090		__isl_take isl_union_pw_qpolynomial *upwqp,
7091		__isl_take isl_point *pnt);
7092	__isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
7093		__isl_take isl_union_pw_qpolynomial_fold *upwf,
7094		__isl_take isl_point *pnt);
7095
7096These functions return NaN when evaluated at a void point.
7097Note that C<isl_pw_aff_eval> returns NaN when the function is evaluated outside
7098its definition domain, while C<isl_pw_qpolynomial_eval> returns zero
7099when the function is evaluated outside its explicit domain.
7100
7101=item * Dimension manipulation
7102
7103It is usually not advisable to directly change the (input or output)
7104space of a set or a relation as this removes the name and the internal
7105structure of the space.  However, the functions below can be useful
7106to add new parameters, assuming
7107C<isl_set_align_params> and C<isl_map_align_params>
7108are not sufficient.
7109
7110	#include <isl/space.h>
7111	__isl_give isl_space *isl_space_add_dims(
7112		__isl_take isl_space *space,
7113		enum isl_dim_type type, unsigned n);
7114	__isl_give isl_space *isl_space_insert_dims(
7115		__isl_take isl_space *space,
7116		enum isl_dim_type type, unsigned pos, unsigned n);
7117	__isl_give isl_space *isl_space_drop_dims(
7118		__isl_take isl_space *space,
7119		enum isl_dim_type type, unsigned first, unsigned n);
7120	__isl_give isl_space *isl_space_move_dims(
7121		__isl_take isl_space *space,
7122		enum isl_dim_type dst_type, unsigned dst_pos,
7123		enum isl_dim_type src_type, unsigned src_pos,
7124		unsigned n);
7125
7126	#include <isl/local_space.h>
7127	__isl_give isl_local_space *isl_local_space_add_dims(
7128		__isl_take isl_local_space *ls,
7129		enum isl_dim_type type, unsigned n);
7130	__isl_give isl_local_space *isl_local_space_insert_dims(
7131		__isl_take isl_local_space *ls,
7132		enum isl_dim_type type, unsigned first, unsigned n);
7133	__isl_give isl_local_space *isl_local_space_drop_dims(
7134		__isl_take isl_local_space *ls,
7135		enum isl_dim_type type, unsigned first, unsigned n);
7136
7137	#include <isl/set.h>
7138	__isl_give isl_basic_set *isl_basic_set_add_dims(
7139		__isl_take isl_basic_set *bset,
7140		enum isl_dim_type type, unsigned n);
7141	__isl_give isl_set *isl_set_add_dims(
7142		__isl_take isl_set *set,
7143		enum isl_dim_type type, unsigned n);
7144	__isl_give isl_basic_set *isl_basic_set_insert_dims(
7145		__isl_take isl_basic_set *bset,
7146		enum isl_dim_type type, unsigned pos,
7147		unsigned n);
7148	__isl_give isl_set *isl_set_insert_dims(
7149		__isl_take isl_set *set,
7150		enum isl_dim_type type, unsigned pos, unsigned n);
7151	__isl_give isl_basic_set *isl_basic_set_move_dims(
7152		__isl_take isl_basic_set *bset,
7153		enum isl_dim_type dst_type, unsigned dst_pos,
7154		enum isl_dim_type src_type, unsigned src_pos,
7155		unsigned n);
7156	__isl_give isl_set *isl_set_move_dims(
7157		__isl_take isl_set *set,
7158		enum isl_dim_type dst_type, unsigned dst_pos,
7159		enum isl_dim_type src_type, unsigned src_pos,
7160		unsigned n);
7161
7162	#include <isl/map.h>
7163	__isl_give isl_basic_map *isl_basic_map_add_dims(
7164		__isl_take isl_basic_map *bmap,
7165		enum isl_dim_type type, unsigned n);
7166	__isl_give isl_map *isl_map_add_dims(
7167		__isl_take isl_map *map,
7168		enum isl_dim_type type, unsigned n);
7169	__isl_give isl_basic_map *isl_basic_map_insert_dims(
7170		__isl_take isl_basic_map *bmap,
7171		enum isl_dim_type type, unsigned pos,
7172		unsigned n);
7173	__isl_give isl_map *isl_map_insert_dims(
7174		__isl_take isl_map *map,
7175		enum isl_dim_type type, unsigned pos, unsigned n);
7176	__isl_give isl_basic_map *isl_basic_map_move_dims(
7177		__isl_take isl_basic_map *bmap,
7178		enum isl_dim_type dst_type, unsigned dst_pos,
7179		enum isl_dim_type src_type, unsigned src_pos,
7180		unsigned n);
7181	__isl_give isl_map *isl_map_move_dims(
7182		__isl_take isl_map *map,
7183		enum isl_dim_type dst_type, unsigned dst_pos,
7184		enum isl_dim_type src_type, unsigned src_pos,
7185		unsigned n);
7186
7187	#include <isl/val.h>
7188	__isl_give isl_multi_val *isl_multi_val_insert_dims(
7189		__isl_take isl_multi_val *mv,
7190		enum isl_dim_type type, unsigned first, unsigned n);
7191	__isl_give isl_multi_val *isl_multi_val_add_dims(
7192		__isl_take isl_multi_val *mv,
7193		enum isl_dim_type type, unsigned n);
7194	__isl_give isl_multi_val *isl_multi_val_drop_dims(
7195		__isl_take isl_multi_val *mv,
7196		enum isl_dim_type type, unsigned first, unsigned n);
7197
7198	#include <isl/aff.h>
7199	__isl_give isl_aff *isl_aff_insert_dims(
7200		__isl_take isl_aff *aff,
7201		enum isl_dim_type type, unsigned first, unsigned n);
7202	__isl_give isl_multi_aff *isl_multi_aff_insert_dims(
7203		__isl_take isl_multi_aff *ma,
7204		enum isl_dim_type type, unsigned first, unsigned n);
7205	__isl_give isl_pw_aff *isl_pw_aff_insert_dims(
7206		__isl_take isl_pw_aff *pwaff,
7207		enum isl_dim_type type, unsigned first, unsigned n);
7208	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
7209		__isl_take isl_multi_pw_aff *mpa,
7210		enum isl_dim_type type, unsigned first, unsigned n);
7211	__isl_give isl_aff *isl_aff_add_dims(
7212		__isl_take isl_aff *aff,
7213		enum isl_dim_type type, unsigned n);
7214	__isl_give isl_multi_aff *isl_multi_aff_add_dims(
7215		__isl_take isl_multi_aff *ma,
7216		enum isl_dim_type type, unsigned n);
7217	__isl_give isl_pw_aff *isl_pw_aff_add_dims(
7218		__isl_take isl_pw_aff *pwaff,
7219		enum isl_dim_type type, unsigned n);
7220	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
7221		__isl_take isl_multi_pw_aff *mpa,
7222		enum isl_dim_type type, unsigned n);
7223	__isl_give isl_aff *isl_aff_drop_dims(
7224		__isl_take isl_aff *aff,
7225		enum isl_dim_type type, unsigned first, unsigned n);
7226	__isl_give isl_multi_aff *isl_multi_aff_drop_dims(
7227		__isl_take isl_multi_aff *maff,
7228		enum isl_dim_type type, unsigned first, unsigned n);
7229	__isl_give isl_pw_aff *isl_pw_aff_drop_dims(
7230		__isl_take isl_pw_aff *pwaff,
7231		enum isl_dim_type type, unsigned first, unsigned n);
7232	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
7233		__isl_take isl_pw_multi_aff *pma,
7234		enum isl_dim_type type, unsigned first, unsigned n);
7235	__isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
7236		__isl_take isl_union_pw_aff *upa,
7237		enum isl_dim_type type, unsigned first, unsigned n);
7238	__isl_give isl_union_pw_multi_aff *
7239		isl_union_pw_multi_aff_drop_dims(
7240		__isl_take isl_union_pw_multi_aff *upma,
7241		enum isl_dim_type type,
7242		unsigned first, unsigned n);
7243	__isl_give isl_multi_union_pw_aff *
7244	isl_multi_union_pw_aff_drop_dims(
7245		__isl_take isl_multi_union_pw_aff *mupa,
7246		enum isl_dim_type type, unsigned first,
7247		unsigned n);
7248	__isl_give isl_aff *isl_aff_move_dims(
7249		__isl_take isl_aff *aff,
7250		enum isl_dim_type dst_type, unsigned dst_pos,
7251		enum isl_dim_type src_type, unsigned src_pos,
7252		unsigned n);
7253	__isl_give isl_multi_aff *isl_multi_aff_move_dims(
7254		__isl_take isl_multi_aff *ma,
7255		enum isl_dim_type dst_type, unsigned dst_pos,
7256		enum isl_dim_type src_type, unsigned src_pos,
7257		unsigned n);
7258	__isl_give isl_pw_aff *isl_pw_aff_move_dims(
7259		__isl_take isl_pw_aff *pa,
7260		enum isl_dim_type dst_type, unsigned dst_pos,
7261		enum isl_dim_type src_type, unsigned src_pos,
7262		unsigned n);
7263	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
7264		__isl_take isl_multi_pw_aff *pma,
7265		enum isl_dim_type dst_type, unsigned dst_pos,
7266		enum isl_dim_type src_type, unsigned src_pos,
7267		unsigned n);
7268
7269	#include <isl/polynomial.h>
7270	__isl_give isl_union_pw_qpolynomial *
7271	isl_union_pw_qpolynomial_drop_dims(
7272		__isl_take isl_union_pw_qpolynomial *upwqp,
7273		enum isl_dim_type type,
7274		unsigned first, unsigned n);
7275	__isl_give isl_union_pw_qpolynomial_fold *
7276		isl_union_pw_qpolynomial_fold_drop_dims(
7277		__isl_take isl_union_pw_qpolynomial_fold *upwf,
7278		enum isl_dim_type type,
7279		unsigned first, unsigned n);
7280
7281The operations on union expressions can only manipulate parameters.
7282
7283=back
7284
7285=head2 Binary Operations
7286
7287The two arguments of a binary operation not only need to live
7288in the same C<isl_ctx>, they currently also need to have
7289the same (number of) parameters.
7290
7291=head3 Basic Operations
7292
7293=over
7294
7295=item * Intersection
7296
7297	#include <isl/local_space.h>
7298	__isl_give isl_local_space *isl_local_space_intersect(
7299		__isl_take isl_local_space *ls1,
7300		__isl_take isl_local_space *ls2);
7301
7302	#include <isl/set.h>
7303	__isl_give isl_basic_set *isl_basic_set_intersect_params(
7304		__isl_take isl_basic_set *bset1,
7305		__isl_take isl_basic_set *bset2);
7306	__isl_give isl_basic_set *isl_basic_set_intersect(
7307		__isl_take isl_basic_set *bset1,
7308		__isl_take isl_basic_set *bset2);
7309	__isl_give isl_basic_set *isl_basic_set_list_intersect(
7310		__isl_take struct isl_basic_set_list *list);
7311	__isl_give isl_set *isl_set_intersect_params(
7312		__isl_take isl_set *set,
7313		__isl_take isl_set *params);
7314	__isl_give isl_set *isl_set_intersect(
7315		__isl_take isl_set *set1,
7316		__isl_take isl_set *set2);
7317	__isl_give isl_set *isl_set_intersect_factor_domain(
7318		__isl_take isl_set *set,
7319		__isl_take isl_set *domain);
7320	__isl_give isl_set *isl_set_intersect_factor_range(
7321		__isl_take isl_set *set,
7322		__isl_take isl_set *range);
7323
7324	#include <isl/map.h>
7325	__isl_give isl_basic_map *isl_basic_map_intersect_domain(
7326		__isl_take isl_basic_map *bmap,
7327		__isl_take isl_basic_set *bset);
7328	__isl_give isl_basic_map *isl_basic_map_intersect_range(
7329		__isl_take isl_basic_map *bmap,
7330		__isl_take isl_basic_set *bset);
7331	__isl_give isl_basic_map *isl_basic_map_intersect(
7332		__isl_take isl_basic_map *bmap1,
7333		__isl_take isl_basic_map *bmap2);
7334	__isl_give isl_basic_map *isl_basic_map_list_intersect(
7335		__isl_take isl_basic_map_list *list);
7336	__isl_give isl_map *isl_map_intersect_params(
7337		__isl_take isl_map *map,
7338		__isl_take isl_set *params);
7339	__isl_give isl_map *isl_map_intersect_domain(
7340		__isl_take isl_map *map,
7341		__isl_take isl_set *set);
7342	__isl_give isl_map *isl_map_intersect_range(
7343		__isl_take isl_map *map,
7344		__isl_take isl_set *set);
7345	__isl_give isl_map *isl_map_intersect(
7346		__isl_take isl_map *map1,
7347		__isl_take isl_map *map2);
7348	__isl_give isl_map *
7349	isl_map_intersect_domain_factor_domain(
7350		__isl_take isl_map *map,
7351		__isl_take isl_map *factor);
7352	__isl_give isl_map *
7353	isl_map_intersect_domain_factor_range(
7354		__isl_take isl_map *map,
7355		__isl_take isl_map *factor);
7356	__isl_give isl_map *
7357	isl_map_intersect_range_factor_domain(
7358		__isl_take isl_map *map,
7359		__isl_take isl_map *factor);
7360	__isl_give isl_map *
7361	isl_map_intersect_range_factor_range(
7362		__isl_take isl_map *map,
7363		__isl_take isl_map *factor);
7364
7365	#include <isl/union_set.h>
7366	__isl_give isl_union_set *isl_union_set_intersect_params(
7367		__isl_take isl_union_set *uset,
7368		__isl_take isl_set *set);
7369	__isl_give isl_union_set *isl_union_set_intersect(
7370		__isl_take isl_union_set *uset1,
7371		__isl_take isl_union_set *uset2);
7372
7373	#include <isl/union_map.h>
7374	__isl_give isl_union_map *isl_union_map_intersect_params(
7375		__isl_take isl_union_map *umap,
7376		__isl_take isl_set *set);
7377	__isl_give isl_union_map *
7378	isl_union_map_intersect_domain_union_set(
7379		__isl_take isl_union_map *umap,
7380		__isl_take isl_union_set *uset);
7381	__isl_give isl_union_map *
7382	isl_union_map_intersect_domain_space(
7383		__isl_take isl_union_map *umap,
7384		__isl_take isl_space *space);
7385	__isl_give isl_union_map *isl_union_map_intersect_domain(
7386		__isl_take isl_union_map *umap,
7387		__isl_take isl_union_set *uset);
7388	__isl_give isl_union_map *
7389	isl_union_map_intersect_range_union_set(
7390		__isl_take isl_union_map *umap,
7391		__isl_take isl_union_set *uset);
7392	__isl_give isl_union_map *
7393	isl_union_map_intersect_range_space(
7394		__isl_take isl_union_map *umap,
7395		__isl_take isl_space *space);
7396	__isl_give isl_union_map *isl_union_map_intersect_range(
7397		__isl_take isl_union_map *umap,
7398		__isl_take isl_union_set *uset);
7399	__isl_give isl_union_map *isl_union_map_intersect(
7400		__isl_take isl_union_map *umap1,
7401		__isl_take isl_union_map *umap2);
7402	__isl_give isl_union_map *
7403	isl_union_map_intersect_domain_factor_domain(
7404		__isl_take isl_union_map *umap,
7405		__isl_take isl_union_map *factor);
7406	__isl_give isl_union_map *
7407	isl_union_map_intersect_domain_factor_range(
7408		__isl_take isl_union_map *umap,
7409		__isl_take isl_union_map *factor);
7410	__isl_give isl_union_map *
7411	isl_union_map_intersect_range_factor_domain(
7412		__isl_take isl_union_map *umap,
7413		__isl_take isl_union_map *factor);
7414	__isl_give isl_union_map *
7415	isl_union_map_intersect_range_factor_range(
7416		__isl_take isl_union_map *umap,
7417		__isl_take isl_union_map *factor);
7418
7419	#include <isl/aff.h>
7420	__isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
7421		__isl_take isl_pw_aff *pa,
7422		__isl_take isl_set *set);
7423	__isl_give isl_multi_pw_aff *
7424	isl_multi_pw_aff_intersect_domain(
7425		__isl_take isl_multi_pw_aff *mpa,
7426		__isl_take isl_set *domain);
7427	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
7428		__isl_take isl_pw_multi_aff *pma,
7429		__isl_take isl_set *set);
7430	__isl_give isl_union_pw_aff *
7431	isl_union_pw_aff_intersect_domain_space(
7432		__isl_take isl_union_pw_aff *upa,
7433		__isl_take isl_space *space);
7434	__isl_give isl_union_pw_aff *
7435	isl_union_pw_aff_intersect_domain_union_set(
7436		__isl_take isl_union_pw_aff *upa,
7437		__isl_take isl_union_set *uset);
7438	__isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
7439		__isl_take isl_union_pw_aff *upa,
7440		__isl_take isl_union_set *uset);
7441	__isl_give isl_union_pw_multi_aff *
7442	isl_union_pw_multi_aff_intersect_domain_space(
7443		__isl_take isl_union_pw_multi_aff *upma,
7444		__isl_take isl_space *space);
7445	__isl_give isl_union_pw_multi_aff *
7446	isl_union_pw_multi_aff_intersect_domain_union_set(
7447		__isl_take isl_union_pw_multi_aff *upma,
7448		__isl_take isl_union_set *uset);
7449	__isl_give isl_union_pw_multi_aff *
7450	isl_union_pw_multi_aff_intersect_domain(
7451		__isl_take isl_union_pw_multi_aff *upma,
7452		__isl_take isl_union_set *uset);
7453	__isl_give isl_multi_union_pw_aff *
7454	isl_multi_union_pw_aff_intersect_domain(
7455		__isl_take isl_multi_union_pw_aff *mupa,
7456		__isl_take isl_union_set *uset);
7457	__isl_give isl_pw_aff *
7458	isl_pw_aff_intersect_domain_wrapped_domain(
7459		__isl_take isl_pw_aff *pa,
7460		__isl_take isl_set *set);
7461	__isl_give isl_pw_multi_aff *
7462	isl_pw_multi_aff_intersect_domain_wrapped_domain(
7463		__isl_take isl_pw_multi_aff *pma,
7464		__isl_take isl_set *set);
7465	__isl_give isl_union_pw_aff *
7466	isl_union_pw_aff_intersect_domain_wrapped_domain(
7467		__isl_take isl_union_pw_aff *upa,
7468		__isl_take isl_union_set *uset);
7469	__isl_give isl_union_pw_multi_aff *
7470	isl_union_pw_multi_aff_intersect_domain_wrapped_domain(
7471		__isl_take isl_union_pw_multi_aff *upma,
7472		__isl_take isl_union_set *uset);
7473	__isl_give isl_pw_aff *
7474	isl_pw_aff_intersect_domain_wrapped_range(
7475		__isl_take isl_pw_aff *pa,
7476		__isl_take isl_set *set);
7477	__isl_give isl_pw_multi_aff *
7478	isl_pw_multi_aff_intersect_domain_wrapped_range(
7479		__isl_take isl_pw_multi_aff *pma,
7480		__isl_take isl_set *set);
7481	__isl_give isl_union_pw_multi_aff *
7482	isl_union_pw_multi_aff_intersect_domain_wrapped_range(
7483		__isl_take isl_union_pw_multi_aff *upma,
7484		__isl_take isl_union_set *uset);
7485	__isl_give isl_union_pw_aff *
7486	isl_union_pw_aff_intersect_domain_wrapped_range(
7487		__isl_take isl_union_pw_aff *upa,
7488		__isl_take isl_union_set *uset);
7489	__isl_give isl_pw_aff *isl_pw_aff_intersect_params(
7490		__isl_take isl_pw_aff *pa,
7491		__isl_take isl_set *set);
7492	__isl_give isl_multi_pw_aff *
7493	isl_multi_pw_aff_intersect_params(
7494		__isl_take isl_multi_pw_aff *mpa,
7495		__isl_take isl_set *set);
7496	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
7497		__isl_take isl_pw_multi_aff *pma,
7498		__isl_take isl_set *set);
7499	__isl_give isl_union_pw_aff *
7500	isl_union_pw_aff_intersect_params(
7501		__isl_take isl_union_pw_aff *upa,
7502		__isl_take isl_set *set);
7503	__isl_give isl_union_pw_multi_aff *
7504	isl_union_pw_multi_aff_intersect_params(
7505		__isl_take isl_union_pw_multi_aff *upma,
7506		__isl_take isl_set *set);
7507	__isl_give isl_multi_union_pw_aff *
7508	isl_multi_union_pw_aff_intersect_params(
7509		__isl_take isl_multi_union_pw_aff *mupa,
7510		__isl_take isl_set *params);
7511	__isl_give isl_multi_union_pw_aff *
7512	isl_multi_union_pw_aff_intersect_range(
7513		__isl_take isl_multi_union_pw_aff *mupa,
7514		__isl_take isl_set *set);
7515
7516	#include <isl/polynomial.h>
7517	__isl_give isl_pw_qpolynomial *
7518	isl_pw_qpolynomial_intersect_domain(
7519		__isl_take isl_pw_qpolynomial *pwpq,
7520		__isl_take isl_set *set);
7521	__isl_give isl_union_pw_qpolynomial *
7522	isl_union_pw_qpolynomial_intersect_domain_space(
7523		__isl_take isl_union_pw_qpolynomial *upwpq,
7524		__isl_take isl_space *space);
7525	__isl_give isl_union_pw_qpolynomial *
7526	isl_union_pw_qpolynomial_intersect_domain_union_set(
7527		__isl_take isl_union_pw_qpolynomial *upwpq,
7528		__isl_take isl_union_set *uset);
7529	__isl_give isl_union_pw_qpolynomial *
7530	isl_union_pw_qpolynomial_intersect_domain(
7531		__isl_take isl_union_pw_qpolynomial *upwpq,
7532		__isl_take isl_union_set *uset);
7533	__isl_give isl_union_pw_qpolynomial_fold *
7534	isl_union_pw_qpolynomial_fold_intersect_domain_space(
7535		__isl_take isl_union_pw_qpolynomial_fold *upwf,
7536		__isl_take isl_space *space);
7537	__isl_give isl_union_pw_qpolynomial_fold *
7538	isl_union_pw_qpolynomial_fold_intersect_domain_union_set(
7539		__isl_take isl_union_pw_qpolynomial_fold *upwf,
7540		__isl_take isl_union_set *uset);
7541	__isl_give isl_union_pw_qpolynomial_fold *
7542	isl_union_pw_qpolynomial_fold_intersect_domain(
7543		__isl_take isl_union_pw_qpolynomial_fold *upwf,
7544		__isl_take isl_union_set *uset);
7545	__isl_give isl_pw_qpolynomial *
7546	isl_pw_qpolynomial_intersect_domain_wrapped_domain(
7547		__isl_take isl_pw_qpolynomial *pwpq,
7548		__isl_take isl_set *set);
7549	__isl_give isl_pw_qpolynomial_fold *
7550	isl_pw_qpolynomial_fold_intersect_domain_wrapped_domain(
7551		__isl_take isl_pw_qpolynomial_fold *pwf,
7552		__isl_take isl_set *set);
7553	__isl_give isl_union_pw_qpolynomial *
7554	isl_union_pw_qpolynomial_intersect_domain_wrapped_domain(
7555		__isl_take isl_union_pw_qpolynomial *upwpq,
7556		__isl_take isl_union_set *uset);
7557	__isl_give isl_union_pw_qpolynomial_fold *
7558	isl_union_pw_qpolynomial_fold_intersect_domain_wrapped_domain(
7559		__isl_take isl_union_pw_qpolynomial_fold *upwf,
7560		__isl_take isl_union_set *uset);
7561	__isl_give isl_pw_qpolynomial *
7562	isl_pw_qpolynomial_intersect_domain_wrapped_range(
7563		__isl_take isl_pw_qpolynomial *pwpq,
7564		__isl_take isl_set *set);
7565	__isl_give isl_pw_qpolynomial_fold *
7566	isl_pw_qpolynomial_fold_intersect_domain_wrapped_range(
7567		__isl_take isl_pw_qpolynomial_fold *pwf,
7568		__isl_take isl_set *set);
7569	__isl_give isl_union_pw_qpolynomial *
7570	isl_union_pw_qpolynomial_intersect_domain_wrapped_range(
7571		__isl_take isl_union_pw_qpolynomial *upwpq,
7572		__isl_take isl_union_set *uset);
7573	__isl_give isl_union_pw_qpolynomial_fold *
7574	isl_union_pw_qpolynomial_fold_intersect_domain_wrapped_range(
7575		__isl_take isl_union_pw_qpolynomial_fold *upwf,
7576		__isl_take isl_union_set *uset);
7577	__isl_give isl_pw_qpolynomial *
7578	isl_pw_qpolynomial_intersect_params(
7579		__isl_take isl_pw_qpolynomial *pwpq,
7580		__isl_take isl_set *set);
7581	__isl_give isl_pw_qpolynomial_fold *
7582	isl_pw_qpolynomial_fold_intersect_params(
7583		__isl_take isl_pw_qpolynomial_fold *pwf,
7584		__isl_take isl_set *set);
7585	__isl_give isl_union_pw_qpolynomial *
7586	isl_union_pw_qpolynomial_intersect_params(
7587		__isl_take isl_union_pw_qpolynomial *upwpq,
7588		__isl_take isl_set *set);
7589	__isl_give isl_union_pw_qpolynomial_fold *
7590	isl_union_pw_qpolynomial_fold_intersect_params(
7591		__isl_take isl_union_pw_qpolynomial_fold *upwf,
7592		__isl_take isl_set *set);
7593
7594The second argument to the C<_params> functions needs to be
7595a parametric (basic) set.  For the other functions, a parametric set
7596for either argument is only allowed if the other argument is
7597a parametric set as well.
7598The list passed to C<isl_basic_set_list_intersect> needs to have
7599at least one element and all elements need to live in the same space.
7600The function C<isl_multi_union_pw_aff_intersect_range>
7601restricts the input function to those shared domain elements
7602that map to the specified range.
7603C<isl_union_map_intersect_domain> is an alternative name for
7604C<isl_union_map_intersect_domain_union_set>.
7605Similarly for the other pairs of functions.
7606
7607=item * Union
7608
7609	#include <isl/set.h>
7610	__isl_give isl_set *isl_basic_set_union(
7611		__isl_take isl_basic_set *bset1,
7612		__isl_take isl_basic_set *bset2);
7613	__isl_give isl_set *isl_set_union(
7614		__isl_take isl_set *set1,
7615		__isl_take isl_set *set2);
7616	__isl_give isl_set *isl_set_list_union(
7617		__isl_take isl_set_list *list);
7618
7619	#include <isl/map.h>
7620	__isl_give isl_map *isl_basic_map_union(
7621		__isl_take isl_basic_map *bmap1,
7622		__isl_take isl_basic_map *bmap2);
7623	__isl_give isl_map *isl_map_union(
7624		__isl_take isl_map *map1,
7625		__isl_take isl_map *map2);
7626
7627	#include <isl/union_set.h>
7628	__isl_give isl_union_set *isl_union_set_union(
7629		__isl_take isl_union_set *uset1,
7630		__isl_take isl_union_set *uset2);
7631	__isl_give isl_union_set *isl_union_set_list_union(
7632		__isl_take isl_union_set_list *list);
7633
7634	#include <isl/union_map.h>
7635	__isl_give isl_union_map *isl_union_map_union(
7636		__isl_take isl_union_map *umap1,
7637		__isl_take isl_union_map *umap2);
7638
7639The list passed to C<isl_set_list_union> needs to have
7640at least one element and all elements need to live in the same space.
7641
7642=item * Set difference
7643
7644	#include <isl/set.h>
7645	__isl_give isl_set *isl_set_subtract(
7646		__isl_take isl_set *set1,
7647		__isl_take isl_set *set2);
7648
7649	#include <isl/map.h>
7650	__isl_give isl_map *isl_map_subtract(
7651		__isl_take isl_map *map1,
7652		__isl_take isl_map *map2);
7653	__isl_give isl_map *isl_map_subtract_domain(
7654		__isl_take isl_map *map,
7655		__isl_take isl_set *dom);
7656	__isl_give isl_map *isl_map_subtract_range(
7657		__isl_take isl_map *map,
7658		__isl_take isl_set *dom);
7659
7660	#include <isl/union_set.h>
7661	__isl_give isl_union_set *isl_union_set_subtract(
7662		__isl_take isl_union_set *uset1,
7663		__isl_take isl_union_set *uset2);
7664
7665	#include <isl/union_map.h>
7666	__isl_give isl_union_map *isl_union_map_subtract(
7667		__isl_take isl_union_map *umap1,
7668		__isl_take isl_union_map *umap2);
7669	__isl_give isl_union_map *isl_union_map_subtract_domain(
7670		__isl_take isl_union_map *umap,
7671		__isl_take isl_union_set *dom);
7672	__isl_give isl_union_map *isl_union_map_subtract_range(
7673		__isl_take isl_union_map *umap,
7674		__isl_take isl_union_set *dom);
7675
7676	#include <isl/aff.h>
7677	__isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
7678		__isl_take isl_pw_aff *pa,
7679		__isl_take isl_set *set);
7680	__isl_give isl_pw_multi_aff *
7681	isl_pw_multi_aff_subtract_domain(
7682		__isl_take isl_pw_multi_aff *pma,
7683		__isl_take isl_set *set);
7684	__isl_give isl_union_pw_aff *
7685	isl_union_pw_aff_subtract_domain_union_set(
7686		__isl_take isl_union_pw_aff *upa,
7687		__isl_take isl_union_set *uset);
7688	__isl_give isl_union_pw_aff *
7689	isl_union_pw_aff_subtract_domain_space(
7690		__isl_take isl_union_pw_aff *upa,
7691		__isl_take isl_space *space);
7692	__isl_give isl_union_pw_aff *
7693	isl_union_pw_aff_subtract_domain(
7694		__isl_take isl_union_pw_aff *upa,
7695		__isl_take isl_union_set *uset);
7696	__isl_give isl_union_pw_multi_aff *
7697	isl_union_pw_multi_aff_subtract_domain_union_set(
7698		__isl_take isl_union_pw_multi_aff *upma,
7699		__isl_take isl_set *set);
7700	__isl_give isl_union_pw_multi_aff *
7701	isl_union_pw_multi_aff_subtract_domain_space(
7702		__isl_take isl_union_pw_multi_aff *upma,
7703		__isl_take isl_space *space);
7704	__isl_give isl_union_pw_multi_aff *
7705	isl_union_pw_multi_aff_subtract_domain(
7706		__isl_take isl_union_pw_multi_aff *upma,
7707		__isl_take isl_union_set *uset);
7708
7709	#include <isl/polynomial.h>
7710	__isl_give isl_pw_qpolynomial *
7711	isl_pw_qpolynomial_subtract_domain(
7712		__isl_take isl_pw_qpolynomial *pwpq,
7713		__isl_take isl_set *set);
7714	__isl_give isl_pw_qpolynomial_fold *
7715	isl_pw_qpolynomial_fold_subtract_domain(
7716		__isl_take isl_pw_qpolynomial_fold *pwf,
7717		__isl_take isl_set *set);
7718	__isl_give isl_union_pw_qpolynomial *
7719	isl_union_pw_qpolynomial_subtract_domain_union_set(
7720		__isl_take isl_union_pw_qpolynomial *upwpq,
7721		__isl_take isl_union_set *uset);
7722	__isl_give isl_union_pw_qpolynomial *
7723	isl_union_pw_qpolynomial_subtract_domain_space(
7724		__isl_take isl_union_pw_qpolynomial *upwpq,
7725		__isl_take isl_space *space);
7726	__isl_give isl_union_pw_qpolynomial *
7727	isl_union_pw_qpolynomial_subtract_domain(
7728		__isl_take isl_union_pw_qpolynomial *upwpq,
7729		__isl_take isl_union_set *uset);
7730	__isl_give isl_union_pw_qpolynomial_fold *
7731	isl_union_pw_qpolynomial_fold_subtract_domain_union_set(
7732		__isl_take isl_union_pw_qpolynomial_fold *upwf,
7733		__isl_take isl_union_set *uset);
7734	__isl_give isl_union_pw_qpolynomial_fold *
7735	isl_union_pw_qpolynomial_fold_subtract_domain_space(
7736		__isl_take isl_union_pw_qpolynomial_fold *upwf,
7737		__isl_take isl_space *space);
7738	__isl_give isl_union_pw_qpolynomial_fold *
7739	isl_union_pw_qpolynomial_fold_subtract_domain(
7740		__isl_take isl_union_pw_qpolynomial_fold *upwf,
7741		__isl_take isl_union_set *uset);
7742
7743C<isl_union_pw_aff_subtract_domain> is an alternative name for
7744C<isl_union_pw_aff_subtract_domain_union_set>.
7745Similarly for the other pairs of functions.
7746
7747=item * Application
7748
7749	#include <isl/space.h>
7750	__isl_give isl_space *isl_space_join(
7751		__isl_take isl_space *left,
7752		__isl_take isl_space *right);
7753
7754	#include <isl/set.h>
7755	__isl_give isl_basic_set *isl_basic_set_apply(
7756		__isl_take isl_basic_set *bset,
7757		__isl_take isl_basic_map *bmap);
7758	__isl_give isl_set *isl_set_apply(
7759		__isl_take isl_set *set,
7760		__isl_take isl_map *map);
7761
7762	#include <isl/union_set.h>
7763	__isl_give isl_union_set *isl_union_set_apply(
7764		__isl_take isl_union_set *uset,
7765		__isl_take isl_union_map *umap);
7766
7767	#include <isl/map.h>
7768	__isl_give isl_basic_map *isl_basic_map_apply_domain(
7769		__isl_take isl_basic_map *bmap1,
7770		__isl_take isl_basic_map *bmap2);
7771	__isl_give isl_basic_map *isl_basic_map_apply_range(
7772		__isl_take isl_basic_map *bmap1,
7773		__isl_take isl_basic_map *bmap2);
7774	__isl_give isl_map *isl_map_apply_domain(
7775		__isl_take isl_map *map1,
7776		__isl_take isl_map *map2);
7777	__isl_give isl_map *isl_map_apply_range(
7778		__isl_take isl_map *map1,
7779		__isl_take isl_map *map2);
7780
7781	#include <isl/union_map.h>
7782	__isl_give isl_union_map *isl_union_map_apply_domain(
7783		__isl_take isl_union_map *umap1,
7784		__isl_take isl_union_map *umap2);
7785	__isl_give isl_union_map *isl_union_map_apply_range(
7786		__isl_take isl_union_map *umap1,
7787		__isl_take isl_union_map *umap2);
7788
7789	#include <isl/aff.h>
7790	__isl_give isl_union_pw_multi_aff *
7791	isl_union_pw_multi_aff_apply_union_pw_multi_aff(
7792		__isl_take isl_union_pw_multi_aff *upma1,
7793		__isl_take isl_union_pw_multi_aff *upma2);
7794	__isl_give isl_union_pw_aff *
7795	isl_multi_union_pw_aff_apply_aff(
7796		__isl_take isl_multi_union_pw_aff *mupa,
7797		__isl_take isl_aff *aff);
7798	__isl_give isl_union_pw_aff *
7799	isl_multi_union_pw_aff_apply_pw_aff(
7800		__isl_take isl_multi_union_pw_aff *mupa,
7801		__isl_take isl_pw_aff *pa);
7802	__isl_give isl_multi_union_pw_aff *
7803	isl_multi_union_pw_aff_apply_multi_aff(
7804		__isl_take isl_multi_union_pw_aff *mupa,
7805		__isl_take isl_multi_aff *ma);
7806	__isl_give isl_multi_union_pw_aff *
7807	isl_multi_union_pw_aff_apply_pw_multi_aff(
7808		__isl_take isl_multi_union_pw_aff *mupa,
7809		__isl_take isl_pw_multi_aff *pma);
7810
7811The result of C<isl_multi_union_pw_aff_apply_aff> is defined
7812over the shared domain of the elements of the input.  The dimension is
7813required to be greater than zero.
7814The C<isl_multi_union_pw_aff> argument of
7815C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
7816but only if the range of the C<isl_multi_aff> argument
7817is also zero-dimensional.
7818Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
7819
7820	#include <isl/polynomial.h>
7821	__isl_give isl_pw_qpolynomial_fold *
7822	isl_set_apply_pw_qpolynomial_fold(
7823		__isl_take isl_set *set,
7824		__isl_take isl_pw_qpolynomial_fold *pwf,
7825		isl_bool *tight);
7826	__isl_give isl_pw_qpolynomial_fold *
7827	isl_map_apply_pw_qpolynomial_fold(
7828		__isl_take isl_map *map,
7829		__isl_take isl_pw_qpolynomial_fold *pwf,
7830		isl_bool *tight);
7831	__isl_give isl_union_pw_qpolynomial_fold *
7832	isl_union_set_apply_union_pw_qpolynomial_fold(
7833		__isl_take isl_union_set *uset,
7834		__isl_take isl_union_pw_qpolynomial_fold *upwf,
7835		isl_bool *tight);
7836	__isl_give isl_union_pw_qpolynomial_fold *
7837	isl_union_map_apply_union_pw_qpolynomial_fold(
7838		__isl_take isl_union_map *umap,
7839		__isl_take isl_union_pw_qpolynomial_fold *upwf,
7840		isl_bool *tight);
7841
7842The functions taking a map
7843compose the given map with the given piecewise quasipolynomial reduction.
7844That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
7845over all elements in the intersection of the range of the map
7846and the domain of the piecewise quasipolynomial reduction
7847as a function of an element in the domain of the map.
7848The functions taking a set compute a bound over all elements in the
7849intersection of the set and the domain of the
7850piecewise quasipolynomial reduction.
7851
7852=item * Preimage
7853
7854	#include <isl/set.h>
7855	__isl_give isl_basic_set *
7856	isl_basic_set_preimage_multi_aff(
7857		__isl_take isl_basic_set *bset,
7858		__isl_take isl_multi_aff *ma);
7859	__isl_give isl_set *isl_set_preimage_multi_aff(
7860		__isl_take isl_set *set,
7861		__isl_take isl_multi_aff *ma);
7862	__isl_give isl_set *isl_set_preimage_pw_multi_aff(
7863		__isl_take isl_set *set,
7864		__isl_take isl_pw_multi_aff *pma);
7865	__isl_give isl_set *isl_set_preimage_multi_pw_aff(
7866		__isl_take isl_set *set,
7867		__isl_take isl_multi_pw_aff *mpa);
7868
7869	#include <isl/union_set.h>
7870	__isl_give isl_union_set *
7871	isl_union_set_preimage_multi_aff(
7872		__isl_take isl_union_set *uset,
7873		__isl_take isl_multi_aff *ma);
7874	__isl_give isl_union_set *
7875	isl_union_set_preimage_pw_multi_aff(
7876		__isl_take isl_union_set *uset,
7877		__isl_take isl_pw_multi_aff *pma);
7878	__isl_give isl_union_set *
7879	isl_union_set_preimage_union_pw_multi_aff(
7880		__isl_take isl_union_set *uset,
7881		__isl_take isl_union_pw_multi_aff *upma);
7882
7883	#include <isl/map.h>
7884	__isl_give isl_basic_map *
7885	isl_basic_map_preimage_domain_multi_aff(
7886		__isl_take isl_basic_map *bmap,
7887		__isl_take isl_multi_aff *ma);
7888	__isl_give isl_map *isl_map_preimage_domain_multi_aff(
7889		__isl_take isl_map *map,
7890		__isl_take isl_multi_aff *ma);
7891	__isl_give isl_map *isl_map_preimage_range_multi_aff(
7892		__isl_take isl_map *map,
7893		__isl_take isl_multi_aff *ma);
7894	__isl_give isl_map *
7895	isl_map_preimage_domain_pw_multi_aff(
7896		__isl_take isl_map *map,
7897		__isl_take isl_pw_multi_aff *pma);
7898	__isl_give isl_map *
7899	isl_map_preimage_range_pw_multi_aff(
7900		__isl_take isl_map *map,
7901		__isl_take isl_pw_multi_aff *pma);
7902	__isl_give isl_map *
7903	isl_map_preimage_domain_multi_pw_aff(
7904		__isl_take isl_map *map,
7905		__isl_take isl_multi_pw_aff *mpa);
7906	__isl_give isl_basic_map *
7907	isl_basic_map_preimage_range_multi_aff(
7908		__isl_take isl_basic_map *bmap,
7909		__isl_take isl_multi_aff *ma);
7910
7911	#include <isl/union_map.h>
7912	__isl_give isl_union_map *
7913	isl_union_map_preimage_domain_multi_aff(
7914		__isl_take isl_union_map *umap,
7915		__isl_take isl_multi_aff *ma);
7916	__isl_give isl_union_map *
7917	isl_union_map_preimage_range_multi_aff(
7918		__isl_take isl_union_map *umap,
7919		__isl_take isl_multi_aff *ma);
7920	__isl_give isl_union_map *
7921	isl_union_map_preimage_domain_pw_multi_aff(
7922		__isl_take isl_union_map *umap,
7923		__isl_take isl_pw_multi_aff *pma);
7924	__isl_give isl_union_map *
7925	isl_union_map_preimage_range_pw_multi_aff(
7926		__isl_take isl_union_map *umap,
7927		__isl_take isl_pw_multi_aff *pma);
7928	__isl_give isl_union_map *
7929	isl_union_map_preimage_domain_union_pw_multi_aff(
7930		__isl_take isl_union_map *umap,
7931		__isl_take isl_union_pw_multi_aff *upma);
7932	__isl_give isl_union_map *
7933	isl_union_map_preimage_range_union_pw_multi_aff(
7934		__isl_take isl_union_map *umap,
7935		__isl_take isl_union_pw_multi_aff *upma);
7936
7937	#include <isl/aff.h>
7938	__isl_give isl_pw_multi_aff *
7939	isl_pw_multi_aff_preimage_domain_wrapped_domain_pw_multi_aff(
7940		__isl_take isl_pw_multi_aff *pma1,
7941		__isl_take isl_pw_multi_aff *pma2);
7942	__isl_give isl_union_pw_multi_aff *
7943	isl_union_pw_multi_aff_preimage_domain_wrapped_domain_union_pw_multi_aff(
7944		__isl_take isl_union_pw_multi_aff *upma1,
7945		__isl_take isl_union_pw_multi_aff *upma2);
7946
7947These functions compute the preimage of the given set or map domain/range under
7948the given function.  In other words, the expression is plugged
7949into the set description or into the domain/range of the map or function.
7950
7951=item * Pullback
7952
7953	#include <isl/aff.h>
7954	__isl_give isl_aff *isl_aff_pullback_aff(
7955		__isl_take isl_aff *aff1,
7956		__isl_take isl_aff *aff2);
7957	__isl_give isl_aff *isl_aff_pullback_multi_aff(
7958		__isl_take isl_aff *aff,
7959		__isl_take isl_multi_aff *ma);
7960	__isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
7961		__isl_take isl_pw_aff *pa,
7962		__isl_take isl_multi_aff *ma);
7963	__isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
7964		__isl_take isl_pw_aff *pa,
7965		__isl_take isl_pw_multi_aff *pma);
7966	__isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
7967		__isl_take isl_pw_aff *pa,
7968		__isl_take isl_multi_pw_aff *mpa);
7969	__isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
7970		__isl_take isl_multi_aff *ma1,
7971		__isl_take isl_multi_aff *ma2);
7972	__isl_give isl_pw_multi_aff *
7973	isl_pw_multi_aff_pullback_multi_aff(
7974		__isl_take isl_pw_multi_aff *pma,
7975		__isl_take isl_multi_aff *ma);
7976	__isl_give isl_multi_pw_aff *
7977	isl_multi_pw_aff_pullback_multi_aff(
7978		__isl_take isl_multi_pw_aff *mpa,
7979		__isl_take isl_multi_aff *ma);
7980	__isl_give isl_pw_multi_aff *
7981	isl_pw_multi_aff_pullback_pw_multi_aff(
7982		__isl_take isl_pw_multi_aff *pma1,
7983		__isl_take isl_pw_multi_aff *pma2);
7984	__isl_give isl_multi_pw_aff *
7985	isl_multi_pw_aff_pullback_pw_multi_aff(
7986		__isl_take isl_multi_pw_aff *mpa,
7987		__isl_take isl_pw_multi_aff *pma);
7988	__isl_give isl_multi_pw_aff *
7989	isl_multi_pw_aff_pullback_multi_pw_aff(
7990		__isl_take isl_multi_pw_aff *mpa1,
7991		__isl_take isl_multi_pw_aff *mpa2);
7992	__isl_give isl_union_pw_aff *
7993	isl_union_pw_aff_pullback_union_pw_multi_aff(
7994		__isl_take isl_union_pw_aff *upa,
7995		__isl_take isl_union_pw_multi_aff *upma);
7996	__isl_give isl_union_pw_multi_aff *
7997	isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
7998		__isl_take isl_union_pw_multi_aff *upma1,
7999		__isl_take isl_union_pw_multi_aff *upma2);
8000	__isl_give isl_multi_union_pw_aff *
8001	isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
8002		__isl_take isl_multi_union_pw_aff *mupa,
8003		__isl_take isl_union_pw_multi_aff *upma);
8004
8005These functions precompose the first expression by the second function.
8006In other words, the second function is plugged
8007into the first expression.
8008
8009=item * Locus
8010
8011	#include <isl/aff.h>
8012	__isl_give isl_basic_set *isl_aff_eq_basic_set(
8013		__isl_take isl_aff *aff1,
8014		__isl_take isl_aff *aff2);
8015	__isl_give isl_set *isl_aff_eq_set(
8016		__isl_take isl_aff *aff1,
8017		__isl_take isl_aff *aff2);
8018	__isl_give isl_set *isl_aff_ne_set(
8019		__isl_take isl_aff *aff1,
8020		__isl_take isl_aff *aff2);
8021	__isl_give isl_basic_set *isl_aff_le_basic_set(
8022		__isl_take isl_aff *aff1,
8023		__isl_take isl_aff *aff2);
8024	__isl_give isl_set *isl_aff_le_set(
8025		__isl_take isl_aff *aff1,
8026		__isl_take isl_aff *aff2);
8027	__isl_give isl_basic_set *isl_aff_lt_basic_set(
8028		__isl_take isl_aff *aff1,
8029		__isl_take isl_aff *aff2);
8030	__isl_give isl_set *isl_aff_lt_set(
8031		__isl_take isl_aff *aff1,
8032		__isl_take isl_aff *aff2);
8033	__isl_give isl_basic_set *isl_aff_ge_basic_set(
8034		__isl_take isl_aff *aff1,
8035		__isl_take isl_aff *aff2);
8036	__isl_give isl_set *isl_aff_ge_set(
8037		__isl_take isl_aff *aff1,
8038		__isl_take isl_aff *aff2);
8039	__isl_give isl_basic_set *isl_aff_gt_basic_set(
8040		__isl_take isl_aff *aff1,
8041		__isl_take isl_aff *aff2);
8042	__isl_give isl_set *isl_aff_gt_set(
8043		__isl_take isl_aff *aff1,
8044		__isl_take isl_aff *aff2);
8045	__isl_give isl_set *isl_pw_aff_eq_set(
8046		__isl_take isl_pw_aff *pwaff1,
8047		__isl_take isl_pw_aff *pwaff2);
8048	__isl_give isl_set *isl_pw_aff_ne_set(
8049		__isl_take isl_pw_aff *pwaff1,
8050		__isl_take isl_pw_aff *pwaff2);
8051	__isl_give isl_set *isl_pw_aff_le_set(
8052		__isl_take isl_pw_aff *pwaff1,
8053		__isl_take isl_pw_aff *pwaff2);
8054	__isl_give isl_set *isl_pw_aff_lt_set(
8055		__isl_take isl_pw_aff *pwaff1,
8056		__isl_take isl_pw_aff *pwaff2);
8057	__isl_give isl_set *isl_pw_aff_ge_set(
8058		__isl_take isl_pw_aff *pwaff1,
8059		__isl_take isl_pw_aff *pwaff2);
8060	__isl_give isl_set *isl_pw_aff_gt_set(
8061		__isl_take isl_pw_aff *pwaff1,
8062		__isl_take isl_pw_aff *pwaff2);
8063
8064	__isl_give isl_set *isl_multi_aff_lex_le_set(
8065		__isl_take isl_multi_aff *ma1,
8066		__isl_take isl_multi_aff *ma2);
8067	__isl_give isl_set *isl_multi_aff_lex_lt_set(
8068		__isl_take isl_multi_aff *ma1,
8069		__isl_take isl_multi_aff *ma2);
8070	__isl_give isl_set *isl_multi_aff_lex_ge_set(
8071		__isl_take isl_multi_aff *ma1,
8072		__isl_take isl_multi_aff *ma2);
8073	__isl_give isl_set *isl_multi_aff_lex_gt_set(
8074		__isl_take isl_multi_aff *ma1,
8075		__isl_take isl_multi_aff *ma2);
8076
8077	__isl_give isl_set *isl_pw_aff_list_eq_set(
8078		__isl_take isl_pw_aff_list *list1,
8079		__isl_take isl_pw_aff_list *list2);
8080	__isl_give isl_set *isl_pw_aff_list_ne_set(
8081		__isl_take isl_pw_aff_list *list1,
8082		__isl_take isl_pw_aff_list *list2);
8083	__isl_give isl_set *isl_pw_aff_list_le_set(
8084		__isl_take isl_pw_aff_list *list1,
8085		__isl_take isl_pw_aff_list *list2);
8086	__isl_give isl_set *isl_pw_aff_list_lt_set(
8087		__isl_take isl_pw_aff_list *list1,
8088		__isl_take isl_pw_aff_list *list2);
8089	__isl_give isl_set *isl_pw_aff_list_ge_set(
8090		__isl_take isl_pw_aff_list *list1,
8091		__isl_take isl_pw_aff_list *list2);
8092	__isl_give isl_set *isl_pw_aff_list_gt_set(
8093		__isl_take isl_pw_aff_list *list1,
8094		__isl_take isl_pw_aff_list *list2);
8095
8096The function C<isl_aff_ge_basic_set> returns a basic set
8097containing those elements in the shared space
8098of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
8099The function C<isl_pw_aff_ge_set> returns a set
8100containing those elements in the shared domain
8101of C<pwaff1> and C<pwaff2> where C<pwaff1> is
8102greater than or equal to C<pwaff2>.
8103The function C<isl_multi_aff_lex_le_set> returns a set
8104containing those elements in the shared domain space
8105where C<ma1> is lexicographically smaller than or
8106equal to C<ma2>.
8107The functions operating on C<isl_pw_aff_list> apply the corresponding
8108C<isl_pw_aff> function to each pair of elements in the two lists.
8109
8110	#include <isl/aff.h>
8111	__isl_give isl_map *isl_pw_aff_eq_map(
8112		__isl_take isl_pw_aff *pa1,
8113		__isl_take isl_pw_aff *pa2);
8114	__isl_give isl_map *isl_pw_aff_le_map(
8115		__isl_take isl_pw_aff *pa1,
8116		__isl_take isl_pw_aff *pa2);
8117	__isl_give isl_map *isl_pw_aff_lt_map(
8118		__isl_take isl_pw_aff *pa1,
8119		__isl_take isl_pw_aff *pa2);
8120	__isl_give isl_map *isl_pw_aff_ge_map(
8121		__isl_take isl_pw_aff *pa1,
8122		__isl_take isl_pw_aff *pa2);
8123	__isl_give isl_map *isl_pw_aff_gt_map(
8124		__isl_take isl_pw_aff *pa1,
8125		__isl_take isl_pw_aff *pa2);
8126
8127	__isl_give isl_map *isl_multi_pw_aff_eq_map(
8128		__isl_take isl_multi_pw_aff *mpa1,
8129		__isl_take isl_multi_pw_aff *mpa2);
8130	__isl_give isl_map *isl_multi_pw_aff_lex_le_map(
8131		__isl_take isl_multi_pw_aff *mpa1,
8132		__isl_take isl_multi_pw_aff *mpa2);
8133	__isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
8134		__isl_take isl_multi_pw_aff *mpa1,
8135		__isl_take isl_multi_pw_aff *mpa2);
8136	__isl_give isl_map *isl_multi_pw_aff_lex_ge_map(
8137		__isl_take isl_multi_pw_aff *mpa1,
8138		__isl_take isl_multi_pw_aff *mpa2);
8139	__isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
8140		__isl_take isl_multi_pw_aff *mpa1,
8141		__isl_take isl_multi_pw_aff *mpa2);
8142
8143These functions return a map between domain elements of the arguments
8144where the function values satisfy the given relation.
8145
8146	#include <isl/map.h>
8147	__isl_give isl_map *isl_map_eq_at_multi_pw_aff(
8148		__isl_take isl_map *map,
8149		__isl_take isl_multi_pw_aff *mpa);
8150	__isl_give isl_map *isl_map_lex_lt_at_multi_pw_aff(
8151		__isl_take isl_map *map,
8152		__isl_take isl_multi_pw_aff *mpa);
8153	__isl_give isl_map *isl_map_lex_le_at_multi_pw_aff(
8154		__isl_take isl_map *map,
8155		__isl_take isl_multi_pw_aff *mpa);
8156	__isl_give isl_map *isl_map_lex_gt_at_multi_pw_aff(
8157		__isl_take isl_map *map,
8158		__isl_take isl_multi_pw_aff *mpa);
8159	__isl_give isl_map *isl_map_lex_ge_at_multi_pw_aff(
8160		__isl_take isl_map *map,
8161		__isl_take isl_multi_pw_aff *mpa);
8162
8163	#include <isl/union_map.h>
8164	__isl_give isl_union_map *
8165	isl_union_map_eq_at_multi_union_pw_aff(
8166		__isl_take isl_union_map *umap,
8167		__isl_take isl_multi_union_pw_aff *mupa);
8168	__isl_give isl_union_map *
8169	isl_union_map_lex_lt_at_multi_union_pw_aff(
8170		__isl_take isl_union_map *umap,
8171		__isl_take isl_multi_union_pw_aff *mupa);
8172	__isl_give isl_union_map *
8173	isl_union_map_lex_le_at_multi_union_pw_aff(
8174		__isl_take isl_union_map *umap,
8175		__isl_take isl_multi_union_pw_aff *mupa);
8176	__isl_give isl_union_map *
8177	isl_union_map_lex_gt_at_multi_union_pw_aff(
8178		__isl_take isl_union_map *umap,
8179		__isl_take isl_multi_union_pw_aff *mupa);
8180	__isl_give isl_union_map *
8181	isl_union_map_lex_ge_at_multi_union_pw_aff(
8182		__isl_take isl_union_map *umap,
8183		__isl_take isl_multi_union_pw_aff *mupa);
8184
8185These functions select the subset of elements in the union map
8186that have an equal or lexicographically smaller or greater function value.
8187
8188=item * Cartesian Product
8189
8190	#include <isl/space.h>
8191	__isl_give isl_space *isl_space_product(
8192		__isl_take isl_space *space1,
8193		__isl_take isl_space *space2);
8194	__isl_give isl_space *isl_space_domain_product(
8195		__isl_take isl_space *space1,
8196		__isl_take isl_space *space2);
8197	__isl_give isl_space *isl_space_range_product(
8198		__isl_take isl_space *space1,
8199		__isl_take isl_space *space2);
8200
8201The functions
8202C<isl_space_product>, C<isl_space_domain_product>
8203and C<isl_space_range_product> take pairs or relation spaces and
8204produce a single relations space, where either the domain, the range
8205or both domain and range are wrapped spaces of relations between
8206the domains and/or ranges of the input spaces.
8207If the product is only constructed over the domain or the range
8208then the ranges or the domains of the inputs should be the same.
8209The function C<isl_space_product> also accepts a pair of set spaces,
8210in which case it returns a wrapped space of a relation between the
8211two input spaces.
8212
8213	#include <isl/set.h>
8214	__isl_give isl_set *isl_set_product(
8215		__isl_take isl_set *set1,
8216		__isl_take isl_set *set2);
8217
8218	#include <isl/map.h>
8219	__isl_give isl_basic_map *isl_basic_map_domain_product(
8220		__isl_take isl_basic_map *bmap1,
8221		__isl_take isl_basic_map *bmap2);
8222	__isl_give isl_basic_map *isl_basic_map_range_product(
8223		__isl_take isl_basic_map *bmap1,
8224		__isl_take isl_basic_map *bmap2);
8225	__isl_give isl_basic_map *isl_basic_map_product(
8226		__isl_take isl_basic_map *bmap1,
8227		__isl_take isl_basic_map *bmap2);
8228	__isl_give isl_map *isl_map_domain_product(
8229		__isl_take isl_map *map1,
8230		__isl_take isl_map *map2);
8231	__isl_give isl_map *isl_map_range_product(
8232		__isl_take isl_map *map1,
8233		__isl_take isl_map *map2);
8234	__isl_give isl_map *isl_map_product(
8235		__isl_take isl_map *map1,
8236		__isl_take isl_map *map2);
8237
8238	#include <isl/union_set.h>
8239	__isl_give isl_union_set *isl_union_set_product(
8240		__isl_take isl_union_set *uset1,
8241		__isl_take isl_union_set *uset2);
8242
8243	#include <isl/union_map.h>
8244	__isl_give isl_union_map *isl_union_map_domain_product(
8245		__isl_take isl_union_map *umap1,
8246		__isl_take isl_union_map *umap2);
8247	__isl_give isl_union_map *isl_union_map_range_product(
8248		__isl_take isl_union_map *umap1,
8249		__isl_take isl_union_map *umap2);
8250	__isl_give isl_union_map *isl_union_map_product(
8251		__isl_take isl_union_map *umap1,
8252		__isl_take isl_union_map *umap2);
8253
8254	#include <isl/id.h>
8255	__isl_give isl_multi_id *isl_multi_id_range_product(
8256		__isl_take isl_multi_id *mi1,
8257		__isl_take isl_multi_id *mi2);
8258
8259	#include <isl/val.h>
8260	__isl_give isl_multi_val *isl_multi_val_range_product(
8261		__isl_take isl_multi_val *mv1,
8262		__isl_take isl_multi_val *mv2);
8263	__isl_give isl_multi_val *isl_multi_val_product(
8264		__isl_take isl_multi_val *mv1,
8265		__isl_take isl_multi_val *mv2);
8266
8267	#include <isl/aff.h>
8268	__isl_give isl_multi_aff *isl_multi_aff_range_product(
8269		__isl_take isl_multi_aff *ma1,
8270		__isl_take isl_multi_aff *ma2);
8271	__isl_give isl_multi_aff *isl_multi_aff_product(
8272		__isl_take isl_multi_aff *ma1,
8273		__isl_take isl_multi_aff *ma2);
8274	__isl_give isl_multi_pw_aff *
8275	isl_multi_pw_aff_range_product(
8276		__isl_take isl_multi_pw_aff *mpa1,
8277		__isl_take isl_multi_pw_aff *mpa2);
8278	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
8279		__isl_take isl_multi_pw_aff *mpa1,
8280		__isl_take isl_multi_pw_aff *mpa2);
8281	__isl_give isl_pw_multi_aff *
8282	isl_pw_multi_aff_range_product(
8283		__isl_take isl_pw_multi_aff *pma1,
8284		__isl_take isl_pw_multi_aff *pma2);
8285	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
8286		__isl_take isl_pw_multi_aff *pma1,
8287		__isl_take isl_pw_multi_aff *pma2);
8288	__isl_give isl_union_pw_multi_aff *
8289	isl_union_pw_multi_aff_range_product(
8290		__isl_take isl_union_pw_multi_aff *upma1,
8291		__isl_take isl_union_pw_multi_aff *upma2);
8292	__isl_give isl_multi_union_pw_aff *
8293	isl_multi_union_pw_aff_range_product(
8294		__isl_take isl_multi_union_pw_aff *mupa1,
8295		__isl_take isl_multi_union_pw_aff *mupa2);
8296
8297The above functions compute the cross product of the given
8298sets, relations or functions.  The domains and ranges of the results
8299are wrapped maps between domains and ranges of the inputs.
8300To obtain a ``flat'' product, use the following functions
8301instead.
8302
8303	#include <isl/set.h>
8304	__isl_give isl_basic_set *isl_basic_set_flat_product(
8305		__isl_take isl_basic_set *bset1,
8306		__isl_take isl_basic_set *bset2);
8307	__isl_give isl_set *isl_set_flat_product(
8308		__isl_take isl_set *set1,
8309		__isl_take isl_set *set2);
8310
8311	#include <isl/map.h>
8312	__isl_give isl_basic_map *isl_basic_map_flat_range_product(
8313		__isl_take isl_basic_map *bmap1,
8314		__isl_take isl_basic_map *bmap2);
8315	__isl_give isl_map *isl_map_flat_domain_product(
8316		__isl_take isl_map *map1,
8317		__isl_take isl_map *map2);
8318	__isl_give isl_map *isl_map_flat_range_product(
8319		__isl_take isl_map *map1,
8320		__isl_take isl_map *map2);
8321	__isl_give isl_basic_map *isl_basic_map_flat_product(
8322		__isl_take isl_basic_map *bmap1,
8323		__isl_take isl_basic_map *bmap2);
8324	__isl_give isl_map *isl_map_flat_product(
8325		__isl_take isl_map *map1,
8326		__isl_take isl_map *map2);
8327
8328	#include <isl/union_map.h>
8329	__isl_give isl_union_map *
8330	isl_union_map_flat_domain_product(
8331		__isl_take isl_union_map *umap1,
8332		__isl_take isl_union_map *umap2);
8333	__isl_give isl_union_map *
8334	isl_union_map_flat_range_product(
8335		__isl_take isl_union_map *umap1,
8336		__isl_take isl_union_map *umap2);
8337
8338	#include <isl/id.h>
8339	__isl_give isl_multi_id *
8340	isl_multi_id_flat_range_product(
8341		__isl_take isl_multi_id *mi1,
8342		__isl_take isl_multi_id *mi2);
8343
8344	#include <isl/val.h>
8345	__isl_give isl_multi_val *isl_multi_val_flat_range_product(
8346		__isl_take isl_multi_val *mv1,
8347		__isl_take isl_multi_val *mv2);
8348
8349	#include <isl/aff.h>
8350	__isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
8351		__isl_take isl_multi_aff *ma1,
8352		__isl_take isl_multi_aff *ma2);
8353	__isl_give isl_pw_multi_aff *
8354	isl_pw_multi_aff_flat_range_product(
8355		__isl_take isl_pw_multi_aff *pma1,
8356		__isl_take isl_pw_multi_aff *pma2);
8357	__isl_give isl_multi_pw_aff *
8358	isl_multi_pw_aff_flat_range_product(
8359		__isl_take isl_multi_pw_aff *mpa1,
8360		__isl_take isl_multi_pw_aff *mpa2);
8361	__isl_give isl_union_pw_multi_aff *
8362	isl_union_pw_multi_aff_flat_range_product(
8363		__isl_take isl_union_pw_multi_aff *upma1,
8364		__isl_take isl_union_pw_multi_aff *upma2);
8365	__isl_give isl_multi_union_pw_aff *
8366	isl_multi_union_pw_aff_flat_range_product(
8367		__isl_take isl_multi_union_pw_aff *mupa1,
8368		__isl_take isl_multi_union_pw_aff *mupa2);
8369
8370	#include <isl/space.h>
8371	__isl_give isl_space *isl_space_factor_domain(
8372		__isl_take isl_space *space);
8373	__isl_give isl_space *isl_space_factor_range(
8374		__isl_take isl_space *space);
8375	__isl_give isl_space *isl_space_domain_factor_domain(
8376		__isl_take isl_space *space);
8377	__isl_give isl_space *isl_space_domain_factor_range(
8378		__isl_take isl_space *space);
8379	__isl_give isl_space *isl_space_range_factor_domain(
8380		__isl_take isl_space *space);
8381	__isl_give isl_space *isl_space_range_factor_range(
8382		__isl_take isl_space *space);
8383
8384The functions C<isl_space_range_factor_domain> and
8385C<isl_space_range_factor_range> extract the two arguments from
8386the result of a call to C<isl_space_range_product>.
8387
8388The arguments of a call to a product can be extracted
8389from the result using the following functions.
8390
8391	#include <isl/map.h>
8392	__isl_give isl_map *isl_map_factor_domain(
8393		__isl_take isl_map *map);
8394	__isl_give isl_map *isl_map_factor_range(
8395		__isl_take isl_map *map);
8396	__isl_give isl_map *isl_map_domain_factor_domain(
8397		__isl_take isl_map *map);
8398	__isl_give isl_map *isl_map_domain_factor_range(
8399		__isl_take isl_map *map);
8400	__isl_give isl_map *isl_map_range_factor_domain(
8401		__isl_take isl_map *map);
8402	__isl_give isl_map *isl_map_range_factor_range(
8403		__isl_take isl_map *map);
8404
8405	#include <isl/union_map.h>
8406	__isl_give isl_union_map *isl_union_map_factor_domain(
8407		__isl_take isl_union_map *umap);
8408	__isl_give isl_union_map *isl_union_map_factor_range(
8409		__isl_take isl_union_map *umap);
8410	__isl_give isl_union_map *
8411	isl_union_map_domain_factor_domain(
8412		__isl_take isl_union_map *umap);
8413	__isl_give isl_union_map *
8414	isl_union_map_domain_factor_range(
8415		__isl_take isl_union_map *umap);
8416	__isl_give isl_union_map *
8417	isl_union_map_range_factor_domain(
8418		__isl_take isl_union_map *umap);
8419	__isl_give isl_union_map *
8420	isl_union_map_range_factor_range(
8421		__isl_take isl_union_map *umap);
8422
8423	#include <isl/id.h>
8424	__isl_give isl_multi_id *isl_multi_id_factor_range(
8425		__isl_take isl_multi_id *mi);
8426	__isl_give isl_multi_id *
8427	isl_multi_id_range_factor_domain(
8428		__isl_take isl_multi_id *mi);
8429	__isl_give isl_multi_id *
8430	isl_multi_id_range_factor_range(
8431		__isl_take isl_multi_id *mi);
8432
8433	#include <isl/val.h>
8434	__isl_give isl_multi_val *isl_multi_val_factor_range(
8435		__isl_take isl_multi_val *mv);
8436	__isl_give isl_multi_val *
8437	isl_multi_val_range_factor_domain(
8438		__isl_take isl_multi_val *mv);
8439	__isl_give isl_multi_val *
8440	isl_multi_val_range_factor_range(
8441		__isl_take isl_multi_val *mv);
8442
8443	#include <isl/aff.h>
8444	__isl_give isl_multi_aff *isl_multi_aff_factor_range(
8445		__isl_take isl_multi_aff *ma);
8446	__isl_give isl_multi_aff *
8447	isl_multi_aff_range_factor_domain(
8448		__isl_take isl_multi_aff *ma);
8449	__isl_give isl_multi_aff *
8450	isl_multi_aff_range_factor_range(
8451		__isl_take isl_multi_aff *ma);
8452	__isl_give isl_multi_pw_aff *
8453	isl_multi_pw_aff_factor_range(
8454		__isl_take isl_multi_pw_aff *mpa);
8455	__isl_give isl_multi_pw_aff *
8456	isl_multi_pw_aff_range_factor_domain(
8457		__isl_take isl_multi_pw_aff *mpa);
8458	__isl_give isl_multi_pw_aff *
8459	isl_multi_pw_aff_range_factor_range(
8460		__isl_take isl_multi_pw_aff *mpa);
8461	__isl_give isl_pw_multi_aff *
8462	isl_pw_multi_aff_range_factor_domain(
8463		__isl_take isl_pw_multi_aff *pma);
8464	__isl_give isl_pw_multi_aff *
8465	isl_pw_multi_aff_range_factor_range(
8466		__isl_take isl_pw_multi_aff *pma);
8467	__isl_give isl_union_pw_multi_aff *
8468	isl_union_pw_multi_aff_range_factor_domain(
8469		__isl_take isl_union_pw_multi_aff *upma);
8470	__isl_give isl_union_pw_multi_aff *
8471	isl_union_pw_multi_aff_range_factor_range(
8472		__isl_take isl_union_pw_multi_aff *upma);
8473	__isl_give isl_multi_union_pw_aff *
8474	isl_multi_union_pw_aff_factor_range(
8475		__isl_take isl_multi_union_pw_aff *mupa);
8476	__isl_give isl_multi_union_pw_aff *
8477	isl_multi_union_pw_aff_range_factor_domain(
8478		__isl_take isl_multi_union_pw_aff *mupa);
8479	__isl_give isl_multi_union_pw_aff *
8480	isl_multi_union_pw_aff_range_factor_range(
8481		__isl_take isl_multi_union_pw_aff *mupa);
8482
8483The splice functions are a generalization of the flat product functions,
8484where the second argument may be inserted at any position inside
8485the first argument rather than being placed at the end.
8486The functions C<isl_multi_val_factor_range>,
8487C<isl_multi_aff_factor_range>,
8488C<isl_multi_pw_aff_factor_range> and
8489C<isl_multi_union_pw_aff_factor_range>
8490take functions that live in a set space.
8491
8492	#include <isl/id.h>
8493	__isl_give isl_multi_id *isl_multi_id_range_splice(
8494		__isl_take isl_multi_id *mi1, unsigned pos,
8495		__isl_take isl_multi_id *mi2);
8496
8497	#include <isl/val.h>
8498	__isl_give isl_multi_val *isl_multi_val_range_splice(
8499		__isl_take isl_multi_val *mv1, unsigned pos,
8500		__isl_take isl_multi_val *mv2);
8501
8502	#include <isl/aff.h>
8503	__isl_give isl_multi_aff *isl_multi_aff_range_splice(
8504		__isl_take isl_multi_aff *ma1, unsigned pos,
8505		__isl_take isl_multi_aff *ma2);
8506	__isl_give isl_multi_aff *isl_multi_aff_splice(
8507		__isl_take isl_multi_aff *ma1,
8508		unsigned in_pos, unsigned out_pos,
8509		__isl_take isl_multi_aff *ma2);
8510	__isl_give isl_multi_pw_aff *
8511	isl_multi_pw_aff_range_splice(
8512		__isl_take isl_multi_pw_aff *mpa1, unsigned pos,
8513		__isl_take isl_multi_pw_aff *mpa2);
8514	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
8515		__isl_take isl_multi_pw_aff *mpa1,
8516		unsigned in_pos, unsigned out_pos,
8517		__isl_take isl_multi_pw_aff *mpa2);
8518	__isl_give isl_multi_union_pw_aff *
8519	isl_multi_union_pw_aff_range_splice(
8520		__isl_take isl_multi_union_pw_aff *mupa1,
8521		unsigned pos,
8522		__isl_take isl_multi_union_pw_aff *mupa2);
8523
8524=item * Simplification
8525
8526When applied to a set or relation,
8527the gist operation returns a set or relation that has the
8528same intersection with the context as the input set or relation.
8529Any implicit equality in the intersection is made explicit in the result,
8530while all inequalities that are redundant with respect to the intersection
8531are removed.
8532In case of union sets and relations, the gist operation is performed
8533per space.
8534
8535When applied to a function,
8536the gist operation applies the set gist operation to each of
8537the cells in the domain of the input piecewise expression.
8538The context is also exploited
8539to simplify the expression associated to each cell.
8540
8541	#include <isl/set.h>
8542	__isl_give isl_basic_set *isl_basic_set_gist(
8543		__isl_take isl_basic_set *bset,
8544		__isl_take isl_basic_set *context);
8545	__isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
8546		__isl_take isl_set *context);
8547	__isl_give isl_set *isl_set_gist_params(
8548		__isl_take isl_set *set,
8549		__isl_take isl_set *context);
8550
8551	#include <isl/map.h>
8552	__isl_give isl_basic_map *isl_basic_map_gist(
8553		__isl_take isl_basic_map *bmap,
8554		__isl_take isl_basic_map *context);
8555	__isl_give isl_basic_map *isl_basic_map_gist_domain(
8556		__isl_take isl_basic_map *bmap,
8557		__isl_take isl_basic_set *context);
8558	__isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
8559		__isl_take isl_map *context);
8560	__isl_give isl_map *isl_map_gist_params(
8561		__isl_take isl_map *map,
8562		__isl_take isl_set *context);
8563	__isl_give isl_map *isl_map_gist_domain(
8564		__isl_take isl_map *map,
8565		__isl_take isl_set *context);
8566	__isl_give isl_map *isl_map_gist_range(
8567		__isl_take isl_map *map,
8568		__isl_take isl_set *context);
8569
8570	#include <isl/union_set.h>
8571	__isl_give isl_union_set *isl_union_set_gist(
8572		__isl_take isl_union_set *uset,
8573		__isl_take isl_union_set *context);
8574	__isl_give isl_union_set *isl_union_set_gist_params(
8575		__isl_take isl_union_set *uset,
8576		__isl_take isl_set *set);
8577
8578	#include <isl/union_map.h>
8579	__isl_give isl_union_map *isl_union_map_gist(
8580		__isl_take isl_union_map *umap,
8581		__isl_take isl_union_map *context);
8582	__isl_give isl_union_map *isl_union_map_gist_params(
8583		__isl_take isl_union_map *umap,
8584		__isl_take isl_set *set);
8585	__isl_give isl_union_map *isl_union_map_gist_domain(
8586		__isl_take isl_union_map *umap,
8587		__isl_take isl_union_set *uset);
8588	__isl_give isl_union_map *isl_union_map_gist_range(
8589		__isl_take isl_union_map *umap,
8590		__isl_take isl_union_set *uset);
8591
8592	#include <isl/aff.h>
8593	__isl_give isl_aff *isl_aff_gist_params(
8594		__isl_take isl_aff *aff,
8595		__isl_take isl_set *context);
8596	__isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
8597		__isl_take isl_set *context);
8598	__isl_give isl_multi_aff *isl_multi_aff_gist_params(
8599		__isl_take isl_multi_aff *maff,
8600		__isl_take isl_set *context);
8601	__isl_give isl_multi_aff *isl_multi_aff_gist(
8602		__isl_take isl_multi_aff *maff,
8603		__isl_take isl_set *context);
8604	__isl_give isl_pw_aff *isl_pw_aff_gist_params(
8605		__isl_take isl_pw_aff *pwaff,
8606		__isl_take isl_set *context);
8607	__isl_give isl_pw_aff *isl_pw_aff_gist(
8608		__isl_take isl_pw_aff *pwaff,
8609		__isl_take isl_set *context);
8610	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
8611		__isl_take isl_pw_multi_aff *pma,
8612		__isl_take isl_set *set);
8613	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
8614		__isl_take isl_pw_multi_aff *pma,
8615		__isl_take isl_set *set);
8616	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
8617		__isl_take isl_multi_pw_aff *mpa,
8618		__isl_take isl_set *set);
8619	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
8620		__isl_take isl_multi_pw_aff *mpa,
8621		__isl_take isl_set *set);
8622	__isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
8623		__isl_take isl_union_pw_aff *upa,
8624		__isl_take isl_union_set *context);
8625	__isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
8626		__isl_take isl_union_pw_aff *upa,
8627		__isl_take isl_set *context);
8628	__isl_give isl_union_pw_multi_aff *
8629	isl_union_pw_multi_aff_gist_params(
8630		__isl_take isl_union_pw_multi_aff *upma,
8631		__isl_take isl_set *context);
8632	__isl_give isl_union_pw_multi_aff *
8633	isl_union_pw_multi_aff_gist(
8634		__isl_take isl_union_pw_multi_aff *upma,
8635		__isl_take isl_union_set *context);
8636	__isl_give isl_multi_union_pw_aff *
8637	isl_multi_union_pw_aff_gist_params(
8638		__isl_take isl_multi_union_pw_aff *mupa,
8639		__isl_take isl_set *context);
8640	__isl_give isl_multi_union_pw_aff *
8641	isl_multi_union_pw_aff_gist(
8642		__isl_take isl_multi_union_pw_aff *mupa,
8643		__isl_take isl_union_set *context);
8644
8645	#include <isl/polynomial.h>
8646	__isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
8647		__isl_take isl_qpolynomial *qp,
8648		__isl_take isl_set *context);
8649	__isl_give isl_qpolynomial *isl_qpolynomial_gist(
8650		__isl_take isl_qpolynomial *qp,
8651		__isl_take isl_set *context);
8652	__isl_give isl_qpolynomial_fold *
8653	isl_qpolynomial_fold_gist_params(
8654		__isl_take isl_qpolynomial_fold *fold,
8655		__isl_take isl_set *context);
8656	__isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
8657		__isl_take isl_qpolynomial_fold *fold,
8658		__isl_take isl_set *context);
8659	__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
8660		__isl_take isl_pw_qpolynomial *pwqp,
8661		__isl_take isl_set *context);
8662	__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
8663		__isl_take isl_pw_qpolynomial *pwqp,
8664		__isl_take isl_set *context);
8665	__isl_give isl_pw_qpolynomial_fold *
8666	isl_pw_qpolynomial_fold_gist(
8667		__isl_take isl_pw_qpolynomial_fold *pwf,
8668		__isl_take isl_set *context);
8669	__isl_give isl_pw_qpolynomial_fold *
8670	isl_pw_qpolynomial_fold_gist_params(
8671		__isl_take isl_pw_qpolynomial_fold *pwf,
8672		__isl_take isl_set *context);
8673	__isl_give isl_union_pw_qpolynomial *
8674	isl_union_pw_qpolynomial_gist_params(
8675		__isl_take isl_union_pw_qpolynomial *upwqp,
8676		__isl_take isl_set *context);
8677	__isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
8678		__isl_take isl_union_pw_qpolynomial *upwqp,
8679		__isl_take isl_union_set *context);
8680	__isl_give isl_union_pw_qpolynomial_fold *
8681	isl_union_pw_qpolynomial_fold_gist(
8682		__isl_take isl_union_pw_qpolynomial_fold *upwf,
8683		__isl_take isl_union_set *context);
8684	__isl_give isl_union_pw_qpolynomial_fold *
8685	isl_union_pw_qpolynomial_fold_gist_params(
8686		__isl_take isl_union_pw_qpolynomial_fold *upwf,
8687		__isl_take isl_set *context);
8688
8689=item * Binary Arithmetic Operations
8690
8691	#include <isl/set.h>
8692	__isl_give isl_set *isl_set_sum(
8693		__isl_take isl_set *set1,
8694		__isl_take isl_set *set2);
8695	#include <isl/map.h>
8696	__isl_give isl_map *isl_map_sum(
8697		__isl_take isl_map *map1,
8698		__isl_take isl_map *map2);
8699
8700C<isl_set_sum> computes the Minkowski sum of its two arguments,
8701i.e., the set containing the sums of pairs of elements from
8702C<set1> and C<set2>.
8703The domain of the result of C<isl_map_sum> is the intersection
8704of the domains of its two arguments.  The corresponding range
8705elements are the sums of the corresponding range elements
8706in the two arguments.
8707
8708	#include <isl/val.h>
8709	__isl_give isl_multi_val *isl_multi_val_add(
8710		__isl_take isl_multi_val *mv1,
8711		__isl_take isl_multi_val *mv2);
8712	__isl_give isl_multi_val *isl_multi_val_sub(
8713		__isl_take isl_multi_val *mv1,
8714		__isl_take isl_multi_val *mv2);
8715	__isl_give isl_multi_val *isl_multi_val_min(
8716		__isl_take isl_multi_val *mv1,
8717		__isl_take isl_multi_val *mv2);
8718	__isl_give isl_multi_val *isl_multi_val_max(
8719		__isl_take isl_multi_val *mv1,
8720		__isl_take isl_multi_val *mv2);
8721
8722	#include <isl/aff.h>
8723	__isl_give isl_aff *isl_aff_add(
8724		__isl_take isl_aff *aff1,
8725		__isl_take isl_aff *aff2);
8726	__isl_give isl_multi_aff *isl_multi_aff_add(
8727		__isl_take isl_multi_aff *maff1,
8728		__isl_take isl_multi_aff *maff2);
8729	__isl_give isl_pw_aff *isl_pw_aff_add(
8730		__isl_take isl_pw_aff *pwaff1,
8731		__isl_take isl_pw_aff *pwaff2);
8732	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_add(
8733		__isl_take isl_multi_pw_aff *mpa1,
8734		__isl_take isl_multi_pw_aff *mpa2);
8735	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
8736		__isl_take isl_pw_multi_aff *pma1,
8737		__isl_take isl_pw_multi_aff *pma2);
8738	__isl_give isl_union_pw_aff *isl_union_pw_aff_add(
8739		__isl_take isl_union_pw_aff *upa1,
8740		__isl_take isl_union_pw_aff *upa2);
8741	__isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
8742		__isl_take isl_union_pw_multi_aff *upma1,
8743		__isl_take isl_union_pw_multi_aff *upma2);
8744	__isl_give isl_multi_union_pw_aff *
8745	isl_multi_union_pw_aff_add(
8746		__isl_take isl_multi_union_pw_aff *mupa1,
8747		__isl_take isl_multi_union_pw_aff *mupa2);
8748	__isl_give isl_pw_aff *isl_pw_aff_add_constant_val(
8749		__isl_take isl_pw_aff *pa,
8750		__isl_take isl_val *v);
8751	__isl_give isl_multi_aff *
8752	isl_multi_aff_add_constant_val(
8753		__isl_take isl_multi_aff *pa,
8754		__isl_take isl_val *v);
8755	__isl_give isl_pw_multi_aff *
8756	isl_pw_multi_aff_add_constant_val(
8757		__isl_take isl_pw_multi_aff *pma,
8758		__isl_take isl_val *v);
8759	__isl_give isl_pw_multi_aff *
8760	isl_pw_multi_aff_add_constant_multi_val(
8761		__isl_take isl_pw_multi_aff *pma,
8762		__isl_take isl_multi_val *mv);
8763	__isl_give isl_multi_pw_aff *
8764	isl_multi_pw_aff_add_constant_val(
8765		__isl_take isl_multi_pw_aff *mpa,
8766		__isl_take isl_val *v);
8767	__isl_give isl_multi_aff *
8768	isl_multi_aff_add_constant_multi_val(
8769		__isl_take isl_multi_aff *pa,
8770		__isl_take isl_multi_val *mv);
8771	__isl_give isl_multi_pw_aff *
8772	isl_multi_pw_aff_add_constant_multi_val(
8773		__isl_take isl_multi_pw_aff *mpa,
8774		__isl_take isl_multi_val *mv);
8775	__isl_give isl_pw_aff *isl_pw_aff_min(
8776		__isl_take isl_pw_aff *pwaff1,
8777		__isl_take isl_pw_aff *pwaff2);
8778	__isl_give isl_pw_aff *isl_pw_aff_max(
8779		__isl_take isl_pw_aff *pwaff1,
8780		__isl_take isl_pw_aff *pwaff2);
8781	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_min(
8782		__isl_take isl_multi_pw_aff *mpa1,
8783		__isl_take isl_multi_pw_aff *mpa2);
8784	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_max(
8785		__isl_take isl_multi_pw_aff *mpa1,
8786		__isl_take isl_multi_pw_aff *mpa2);
8787	__isl_give isl_aff *isl_aff_sub(
8788		__isl_take isl_aff *aff1,
8789		__isl_take isl_aff *aff2);
8790	__isl_give isl_multi_aff *isl_multi_aff_sub(
8791		__isl_take isl_multi_aff *ma1,
8792		__isl_take isl_multi_aff *ma2);
8793	__isl_give isl_pw_aff *isl_pw_aff_sub(
8794		__isl_take isl_pw_aff *pwaff1,
8795		__isl_take isl_pw_aff *pwaff2);
8796	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
8797		__isl_take isl_multi_pw_aff *mpa1,
8798		__isl_take isl_multi_pw_aff *mpa2);
8799	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
8800		__isl_take isl_pw_multi_aff *pma1,
8801		__isl_take isl_pw_multi_aff *pma2);
8802	__isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
8803		__isl_take isl_union_pw_aff *upa1,
8804		__isl_take isl_union_pw_aff *upa2);
8805	__isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
8806		__isl_take isl_union_pw_multi_aff *upma1,
8807		__isl_take isl_union_pw_multi_aff *upma2);
8808	__isl_give isl_multi_union_pw_aff *
8809	isl_multi_union_pw_aff_sub(
8810		__isl_take isl_multi_union_pw_aff *mupa1,
8811		__isl_take isl_multi_union_pw_aff *mupa2);
8812
8813C<isl_aff_sub> subtracts the second argument from the first.
8814
8815	#include <isl/polynomial.h>
8816	__isl_give isl_qpolynomial *isl_qpolynomial_add(
8817		__isl_take isl_qpolynomial *qp1,
8818		__isl_take isl_qpolynomial *qp2);
8819	__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
8820		__isl_take isl_pw_qpolynomial *pwqp1,
8821		__isl_take isl_pw_qpolynomial *pwqp2);
8822	__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
8823		__isl_take isl_pw_qpolynomial *pwqp1,
8824		__isl_take isl_pw_qpolynomial *pwqp2);
8825	__isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
8826		__isl_take isl_pw_qpolynomial_fold *pwf1,
8827		__isl_take isl_pw_qpolynomial_fold *pwf2);
8828	__isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
8829		__isl_take isl_union_pw_qpolynomial *upwqp1,
8830		__isl_take isl_union_pw_qpolynomial *upwqp2);
8831	__isl_give isl_qpolynomial *isl_qpolynomial_sub(
8832		__isl_take isl_qpolynomial *qp1,
8833		__isl_take isl_qpolynomial *qp2);
8834	__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
8835		__isl_take isl_pw_qpolynomial *pwqp1,
8836		__isl_take isl_pw_qpolynomial *pwqp2);
8837	__isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
8838		__isl_take isl_union_pw_qpolynomial *upwqp1,
8839		__isl_take isl_union_pw_qpolynomial *upwqp2);
8840	__isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
8841		__isl_take isl_pw_qpolynomial_fold *pwf1,
8842		__isl_take isl_pw_qpolynomial_fold *pwf2);
8843	__isl_give isl_union_pw_qpolynomial_fold *
8844	isl_union_pw_qpolynomial_fold_fold(
8845		__isl_take isl_union_pw_qpolynomial_fold *upwf1,
8846		__isl_take isl_union_pw_qpolynomial_fold *upwf2);
8847
8848	#include <isl/aff.h>
8849	__isl_give isl_pw_aff *isl_pw_aff_union_add(
8850		__isl_take isl_pw_aff *pwaff1,
8851		__isl_take isl_pw_aff *pwaff2);
8852	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_union_add(
8853		__isl_take isl_multi_pw_aff *mpa1,
8854		__isl_take isl_multi_pw_aff *mpa2);
8855	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
8856		__isl_take isl_pw_multi_aff *pma1,
8857		__isl_take isl_pw_multi_aff *pma2);
8858	__isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
8859		__isl_take isl_union_pw_aff *upa1,
8860		__isl_take isl_union_pw_aff *upa2);
8861	__isl_give isl_union_pw_multi_aff *
8862	isl_union_pw_multi_aff_union_add(
8863		__isl_take isl_union_pw_multi_aff *upma1,
8864		__isl_take isl_union_pw_multi_aff *upma2);
8865	__isl_give isl_multi_union_pw_aff *
8866	isl_multi_union_pw_aff_union_add(
8867		__isl_take isl_multi_union_pw_aff *mupa1,
8868		__isl_take isl_multi_union_pw_aff *mupa2);
8869	__isl_give isl_pw_aff *isl_pw_aff_union_min(
8870		__isl_take isl_pw_aff *pwaff1,
8871		__isl_take isl_pw_aff *pwaff2);
8872	__isl_give isl_pw_aff *isl_pw_aff_union_max(
8873		__isl_take isl_pw_aff *pwaff1,
8874		__isl_take isl_pw_aff *pwaff2);
8875
8876The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
8877expression with a domain that is the union of those of C<pwaff1> and
8878C<pwaff2> and such that on each cell, the quasi-affine expression is
8879the maximum of those of C<pwaff1> and C<pwaff2>.  If only one of
8880C<pwaff1> or C<pwaff2> is defined on a given cell, then the
8881associated expression is the defined one.
8882This in contrast to the C<isl_pw_aff_max> function, which is
8883only defined on the shared definition domain of the arguments.
8884
8885	#include <isl/val.h>
8886	__isl_give isl_multi_val *isl_multi_val_add_val(
8887		__isl_take isl_multi_val *mv,
8888		__isl_take isl_val *v);
8889	__isl_give isl_multi_val *isl_multi_val_mod_val(
8890		__isl_take isl_multi_val *mv,
8891		__isl_take isl_val *v);
8892	__isl_give isl_multi_val *isl_multi_val_scale_val(
8893		__isl_take isl_multi_val *mv,
8894		__isl_take isl_val *v);
8895	__isl_give isl_multi_val *isl_multi_val_scale_down_val(
8896		__isl_take isl_multi_val *mv,
8897		__isl_take isl_val *v);
8898
8899	#include <isl/aff.h>
8900	__isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
8901		__isl_take isl_val *mod);
8902	__isl_give isl_pw_aff *isl_pw_aff_mod_val(
8903		__isl_take isl_pw_aff *pa,
8904		__isl_take isl_val *mod);
8905	__isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
8906		__isl_take isl_union_pw_aff *upa,
8907		__isl_take isl_val *f);
8908	__isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
8909		__isl_take isl_val *v);
8910	__isl_give isl_multi_aff *isl_multi_aff_scale_val(
8911		__isl_take isl_multi_aff *ma,
8912		__isl_take isl_val *v);
8913	__isl_give isl_pw_aff *isl_pw_aff_scale_val(
8914		__isl_take isl_pw_aff *pa, __isl_take isl_val *v);
8915	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
8916		__isl_take isl_multi_pw_aff *mpa,
8917		__isl_take isl_val *v);
8918	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
8919		__isl_take isl_pw_multi_aff *pma,
8920		__isl_take isl_val *v);
8921	__isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
8922		__isl_take isl_union_pw_aff *upa,
8923		__isl_take isl_val *f);
8924	__isl_give isl_union_pw_multi_aff *
8925	isl_union_pw_multi_aff_scale_val(
8926		__isl_take isl_union_pw_multi_aff *upma,
8927		__isl_take isl_val *val);
8928	__isl_give isl_multi_union_pw_aff *
8929	isl_multi_union_pw_aff_scale_val(
8930		__isl_take isl_multi_union_pw_aff *mupa,
8931		__isl_take isl_val *v);
8932	__isl_give isl_aff *isl_aff_scale_down_ui(
8933		__isl_take isl_aff *aff, unsigned f);
8934	__isl_give isl_aff *isl_aff_scale_down_val(
8935		__isl_take isl_aff *aff, __isl_take isl_val *v);
8936	__isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
8937		__isl_take isl_multi_aff *ma,
8938		__isl_take isl_val *v);
8939	__isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
8940		__isl_take isl_pw_aff *pa,
8941		__isl_take isl_val *f);
8942	__isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
8943		__isl_take isl_multi_pw_aff *mpa,
8944		__isl_take isl_val *v);
8945	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
8946		__isl_take isl_pw_multi_aff *pma,
8947		__isl_take isl_val *v);
8948	__isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
8949		__isl_take isl_union_pw_aff *upa,
8950		__isl_take isl_val *v);
8951	__isl_give isl_union_pw_multi_aff *
8952	isl_union_pw_multi_aff_scale_down_val(
8953		__isl_take isl_union_pw_multi_aff *upma,
8954		__isl_take isl_val *val);
8955	__isl_give isl_multi_union_pw_aff *
8956	isl_multi_union_pw_aff_scale_down_val(
8957		__isl_take isl_multi_union_pw_aff *mupa,
8958		__isl_take isl_val *v);
8959
8960	#include <isl/polynomial.h>
8961	__isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
8962		__isl_take isl_qpolynomial *qp,
8963		__isl_take isl_val *v);
8964	__isl_give isl_qpolynomial_fold *
8965	isl_qpolynomial_fold_scale_val(
8966		__isl_take isl_qpolynomial_fold *fold,
8967		__isl_take isl_val *v);
8968	__isl_give isl_pw_qpolynomial *
8969	isl_pw_qpolynomial_scale_val(
8970		__isl_take isl_pw_qpolynomial *pwqp,
8971		__isl_take isl_val *v);
8972	__isl_give isl_pw_qpolynomial_fold *
8973	isl_pw_qpolynomial_fold_scale_val(
8974		__isl_take isl_pw_qpolynomial_fold *pwf,
8975		__isl_take isl_val *v);
8976	__isl_give isl_union_pw_qpolynomial *
8977	isl_union_pw_qpolynomial_scale_val(
8978		__isl_take isl_union_pw_qpolynomial *upwqp,
8979		__isl_take isl_val *v);
8980	__isl_give isl_union_pw_qpolynomial_fold *
8981	isl_union_pw_qpolynomial_fold_scale_val(
8982		__isl_take isl_union_pw_qpolynomial_fold *upwf,
8983		__isl_take isl_val *v);
8984	__isl_give isl_qpolynomial *
8985	isl_qpolynomial_scale_down_val(
8986		__isl_take isl_qpolynomial *qp,
8987		__isl_take isl_val *v);
8988	__isl_give isl_qpolynomial_fold *
8989	isl_qpolynomial_fold_scale_down_val(
8990		__isl_take isl_qpolynomial_fold *fold,
8991		__isl_take isl_val *v);
8992	__isl_give isl_pw_qpolynomial *
8993	isl_pw_qpolynomial_scale_down_val(
8994		__isl_take isl_pw_qpolynomial *pwqp,
8995		__isl_take isl_val *v);
8996	__isl_give isl_pw_qpolynomial_fold *
8997	isl_pw_qpolynomial_fold_scale_down_val(
8998		__isl_take isl_pw_qpolynomial_fold *pwf,
8999		__isl_take isl_val *v);
9000	__isl_give isl_union_pw_qpolynomial *
9001	isl_union_pw_qpolynomial_scale_down_val(
9002		__isl_take isl_union_pw_qpolynomial *upwqp,
9003		__isl_take isl_val *v);
9004	__isl_give isl_union_pw_qpolynomial_fold *
9005	isl_union_pw_qpolynomial_fold_scale_down_val(
9006		__isl_take isl_union_pw_qpolynomial_fold *upwf,
9007		__isl_take isl_val *v);
9008
9009	#include <isl/val.h>
9010	__isl_give isl_multi_val *isl_multi_val_mod_multi_val(
9011		__isl_take isl_multi_val *mv1,
9012		__isl_take isl_multi_val *mv2);
9013	__isl_give isl_multi_val *isl_multi_val_scale_multi_val(
9014		__isl_take isl_multi_val *mv1,
9015		__isl_take isl_multi_val *mv2);
9016	__isl_give isl_multi_val *
9017	isl_multi_val_scale_down_multi_val(
9018		__isl_take isl_multi_val *mv1,
9019		__isl_take isl_multi_val *mv2);
9020
9021	#include <isl/aff.h>
9022	__isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
9023		__isl_take isl_multi_aff *ma,
9024		__isl_take isl_multi_val *mv);
9025	__isl_give isl_multi_union_pw_aff *
9026	isl_multi_union_pw_aff_mod_multi_val(
9027		__isl_take isl_multi_union_pw_aff *upma,
9028		__isl_take isl_multi_val *mv);
9029	__isl_give isl_multi_pw_aff *
9030	isl_multi_pw_aff_mod_multi_val(
9031		__isl_take isl_multi_pw_aff *mpa,
9032		__isl_take isl_multi_val *mv);
9033	__isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
9034		__isl_take isl_multi_aff *ma,
9035		__isl_take isl_multi_val *mv);
9036	__isl_give isl_pw_multi_aff *
9037	isl_pw_multi_aff_scale_multi_val(
9038		__isl_take isl_pw_multi_aff *pma,
9039		__isl_take isl_multi_val *mv);
9040	__isl_give isl_multi_pw_aff *
9041	isl_multi_pw_aff_scale_multi_val(
9042		__isl_take isl_multi_pw_aff *mpa,
9043		__isl_take isl_multi_val *mv);
9044	__isl_give isl_multi_union_pw_aff *
9045	isl_multi_union_pw_aff_scale_multi_val(
9046		__isl_take isl_multi_union_pw_aff *mupa,
9047		__isl_take isl_multi_val *mv);
9048	__isl_give isl_union_pw_multi_aff *
9049	isl_union_pw_multi_aff_scale_multi_val(
9050		__isl_take isl_union_pw_multi_aff *upma,
9051		__isl_take isl_multi_val *mv);
9052	__isl_give isl_multi_aff *
9053	isl_multi_aff_scale_down_multi_val(
9054		__isl_take isl_multi_aff *ma,
9055		__isl_take isl_multi_val *mv);
9056	__isl_give isl_multi_pw_aff *
9057	isl_multi_pw_aff_scale_down_multi_val(
9058		__isl_take isl_multi_pw_aff *mpa,
9059		__isl_take isl_multi_val *mv);
9060	__isl_give isl_multi_union_pw_aff *
9061	isl_multi_union_pw_aff_scale_down_multi_val(
9062		__isl_take isl_multi_union_pw_aff *mupa,
9063		__isl_take isl_multi_val *mv);
9064
9065C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
9066by the corresponding elements of C<mv>.
9067
9068	#include <isl/aff.h>
9069	__isl_give isl_aff *isl_aff_mul(
9070		__isl_take isl_aff *aff1,
9071		__isl_take isl_aff *aff2);
9072	__isl_give isl_aff *isl_aff_div(
9073		__isl_take isl_aff *aff1,
9074		__isl_take isl_aff *aff2);
9075	__isl_give isl_pw_aff *isl_pw_aff_mul(
9076		__isl_take isl_pw_aff *pwaff1,
9077		__isl_take isl_pw_aff *pwaff2);
9078	__isl_give isl_pw_aff *isl_pw_aff_div(
9079		__isl_take isl_pw_aff *pa1,
9080		__isl_take isl_pw_aff *pa2);
9081	__isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
9082		__isl_take isl_pw_aff *pa1,
9083		__isl_take isl_pw_aff *pa2);
9084	__isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
9085		__isl_take isl_pw_aff *pa1,
9086		__isl_take isl_pw_aff *pa2);
9087
9088When multiplying two affine expressions, at least one of the two needs
9089to be a constant.  Similarly, when dividing an affine expression by another,
9090the second expression needs to be a constant.
9091C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
9092rounding towards zero.  C<isl_pw_aff_tdiv_r> computes the corresponding
9093remainder.
9094
9095	#include <isl/polynomial.h>
9096	__isl_give isl_qpolynomial *isl_qpolynomial_mul(
9097		__isl_take isl_qpolynomial *qp1,
9098		__isl_take isl_qpolynomial *qp2);
9099	__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
9100		__isl_take isl_pw_qpolynomial *pwqp1,
9101		__isl_take isl_pw_qpolynomial *pwqp2);
9102	__isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
9103		__isl_take isl_union_pw_qpolynomial *upwqp1,
9104		__isl_take isl_union_pw_qpolynomial *upwqp2);
9105
9106=back
9107
9108=head3 Lexicographic Optimization
9109
9110Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
9111the following functions
9112compute a set that contains the lexicographic minimum or maximum
9113of the elements in C<set> (or C<bset>) for those values of the parameters
9114that satisfy C<dom>.
9115If C<empty> is not C<NULL>, then C<*empty> is assigned a set
9116that contains the parameter values in C<dom> for which C<set> (or C<bset>)
9117has no elements.
9118In other words, the union of the parameter values
9119for which the result is non-empty and of C<*empty>
9120is equal to C<dom>.
9121
9122	#include <isl/set.h>
9123	__isl_give isl_set *isl_basic_set_partial_lexmin(
9124		__isl_take isl_basic_set *bset,
9125		__isl_take isl_basic_set *dom,
9126		__isl_give isl_set **empty);
9127	__isl_give isl_set *isl_basic_set_partial_lexmax(
9128		__isl_take isl_basic_set *bset,
9129		__isl_take isl_basic_set *dom,
9130		__isl_give isl_set **empty);
9131	__isl_give isl_set *isl_set_partial_lexmin(
9132		__isl_take isl_set *set, __isl_take isl_set *dom,
9133		__isl_give isl_set **empty);
9134	__isl_give isl_set *isl_set_partial_lexmax(
9135		__isl_take isl_set *set, __isl_take isl_set *dom,
9136		__isl_give isl_set **empty);
9137
9138Given a (basic) set C<set> (or C<bset>), the following functions simply
9139return a set containing the lexicographic minimum or maximum
9140of the elements in C<set> (or C<bset>).
9141In case of union sets, the optimum is computed per space.
9142
9143	#include <isl/set.h>
9144	__isl_give isl_set *isl_basic_set_lexmin(
9145		__isl_take isl_basic_set *bset);
9146	__isl_give isl_set *isl_basic_set_lexmax(
9147		__isl_take isl_basic_set *bset);
9148	__isl_give isl_set *isl_set_lexmin(
9149		__isl_take isl_set *set);
9150	__isl_give isl_set *isl_set_lexmax(
9151		__isl_take isl_set *set);
9152	__isl_give isl_union_set *isl_union_set_lexmin(
9153		__isl_take isl_union_set *uset);
9154	__isl_give isl_union_set *isl_union_set_lexmax(
9155		__isl_take isl_union_set *uset);
9156
9157Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
9158the following functions
9159compute a relation that maps each element of C<dom>
9160to the single lexicographic minimum or maximum
9161of the elements that are associated to that same
9162element in C<map> (or C<bmap>).
9163If C<empty> is not C<NULL>, then C<*empty> is assigned a set
9164that contains the elements in C<dom> that do not map
9165to any elements in C<map> (or C<bmap>).
9166In other words, the union of the domain of the result and of C<*empty>
9167is equal to C<dom>.
9168
9169	#include <isl/map.h>
9170	__isl_give isl_map *isl_basic_map_partial_lexmax(
9171		__isl_take isl_basic_map *bmap,
9172		__isl_take isl_basic_set *dom,
9173		__isl_give isl_set **empty);
9174	__isl_give isl_map *isl_basic_map_partial_lexmin(
9175		__isl_take isl_basic_map *bmap,
9176		__isl_take isl_basic_set *dom,
9177		__isl_give isl_set **empty);
9178	__isl_give isl_map *isl_map_partial_lexmax(
9179		__isl_take isl_map *map, __isl_take isl_set *dom,
9180		__isl_give isl_set **empty);
9181	__isl_give isl_map *isl_map_partial_lexmin(
9182		__isl_take isl_map *map, __isl_take isl_set *dom,
9183		__isl_give isl_set **empty);
9184
9185Given a (basic) map C<map> (or C<bmap>), the following functions simply
9186return a map mapping each element in the domain of
9187C<map> (or C<bmap>) to the lexicographic minimum or maximum
9188of all elements associated to that element.
9189In case of union relations, the optimum is computed per space.
9190
9191	#include <isl/map.h>
9192	__isl_give isl_map *isl_basic_map_lexmin(
9193		__isl_take isl_basic_map *bmap);
9194	__isl_give isl_map *isl_basic_map_lexmax(
9195		__isl_take isl_basic_map *bmap);
9196	__isl_give isl_map *isl_map_lexmin(
9197		__isl_take isl_map *map);
9198	__isl_give isl_map *isl_map_lexmax(
9199		__isl_take isl_map *map);
9200	__isl_give isl_union_map *isl_union_map_lexmin(
9201		__isl_take isl_union_map *umap);
9202	__isl_give isl_union_map *isl_union_map_lexmax(
9203		__isl_take isl_union_map *umap);
9204
9205The following functions return their result in the form of
9206a piecewise multi-affine expression,
9207but are otherwise equivalent to the corresponding functions
9208returning a basic set or relation.
9209
9210	#include <isl/set.h>
9211	__isl_give isl_pw_multi_aff *
9212	isl_basic_set_partial_lexmin_pw_multi_aff(
9213		__isl_take isl_basic_set *bset,
9214		__isl_take isl_basic_set *dom,
9215		__isl_give isl_set **empty);
9216	__isl_give isl_pw_multi_aff *
9217	isl_basic_set_partial_lexmax_pw_multi_aff(
9218		__isl_take isl_basic_set *bset,
9219		__isl_take isl_basic_set *dom,
9220		__isl_give isl_set **empty);
9221	__isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
9222		__isl_take isl_set *set);
9223	__isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
9224		__isl_take isl_set *set);
9225
9226	#include <isl/map.h>
9227	__isl_give isl_pw_multi_aff *
9228	isl_basic_map_lexmin_pw_multi_aff(
9229		__isl_take isl_basic_map *bmap);
9230	__isl_give isl_pw_multi_aff *
9231	isl_basic_map_partial_lexmin_pw_multi_aff(
9232		__isl_take isl_basic_map *bmap,
9233		__isl_take isl_basic_set *dom,
9234		__isl_give isl_set **empty);
9235	__isl_give isl_pw_multi_aff *
9236	isl_basic_map_partial_lexmax_pw_multi_aff(
9237		__isl_take isl_basic_map *bmap,
9238		__isl_take isl_basic_set *dom,
9239		__isl_give isl_set **empty);
9240	__isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
9241		__isl_take isl_map *map);
9242	__isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
9243		__isl_take isl_map *map);
9244
9245The following functions return the lexicographic minimum or maximum
9246on the shared domain of the inputs and the single defined function
9247on those parts of the domain where only a single function is defined.
9248
9249	#include <isl/aff.h>
9250	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
9251		__isl_take isl_pw_multi_aff *pma1,
9252		__isl_take isl_pw_multi_aff *pma2);
9253	__isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
9254		__isl_take isl_pw_multi_aff *pma1,
9255		__isl_take isl_pw_multi_aff *pma2);
9256
9257If the input to a lexicographic optimization problem has
9258multiple constraints with the same coefficients for the optimized
9259variables, then, by default, this symmetry is exploited by
9260replacing those constraints by a single constraint with
9261an abstract bound, which is in turn bounded by the corresponding terms
9262in the original constraints.
9263Without this optimization, the solver would typically consider
9264all possible orderings of those original bounds, resulting in a needless
9265decomposition of the domain.
9266However, the optimization can also result in slowdowns since
9267an extra parameter is introduced that may get used in additional
9268integer divisions.
9269The following option determines whether symmetry detection is applied
9270during lexicographic optimization.
9271
9272	#include <isl/options.h>
9273	isl_stat isl_options_set_pip_symmetry(isl_ctx *ctx,
9274		int val);
9275	int isl_options_get_pip_symmetry(isl_ctx *ctx);
9276
9277=begin latex
9278
9279See also \autoref{s:offline}.
9280
9281=end latex
9282
9283=head2 Ternary Operations
9284
9285	#include <isl/aff.h>
9286	__isl_give isl_pw_aff *isl_pw_aff_cond(
9287		__isl_take isl_pw_aff *cond,
9288		__isl_take isl_pw_aff *pwaff_true,
9289		__isl_take isl_pw_aff *pwaff_false);
9290
9291The function C<isl_pw_aff_cond> performs a conditional operator
9292and returns an expression that is equal to C<pwaff_true>
9293for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
9294where C<cond> is zero.
9295
9296=head2 Lists
9297
9298Lists are defined over several element types, including
9299C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_pw_multi_aff>,
9300C<isl_union_pw_aff>,
9301C<isl_union_pw_multi_aff>,
9302C<isl_qpolynomial>, C<isl_pw_qpolynomial>, C<isl_pw_qpolynomial_fold>,
9303C<isl_constraint>,
9304C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
9305C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
9306Here we take lists of C<isl_set>s as an example.
9307Lists can be created, copied, modified and freed using the following functions.
9308
9309	#include <isl/set.h>
9310	__isl_give isl_set_list *isl_set_to_list(
9311		__isl_take isl_set *el);
9312	__isl_give isl_set_list *isl_set_list_from_set(
9313		__isl_take isl_set *el);
9314	__isl_give isl_set_list *isl_set_list_alloc(
9315		isl_ctx *ctx, int n);
9316	__isl_give isl_set_list *isl_set_list_copy(
9317		__isl_keep isl_set_list *list);
9318	__isl_give isl_set_list *isl_set_list_insert(
9319		__isl_take isl_set_list *list, unsigned pos,
9320		__isl_take isl_set *el);
9321	__isl_give isl_set_list *isl_set_list_add(
9322		__isl_take isl_set_list *list,
9323		__isl_take isl_set *el);
9324	__isl_give isl_set_list *isl_set_list_drop(
9325		__isl_take isl_set_list *list,
9326		unsigned first, unsigned n);
9327	__isl_give isl_set_list *isl_set_list_clear(
9328		__isl_take isl_set_list *list);
9329	__isl_give isl_set_list *isl_set_list_swap(
9330		__isl_take isl_set_list *list,
9331		unsigned pos1, unsigned pos2);
9332	__isl_give isl_set_list *isl_set_list_reverse(
9333		__isl_take isl_set_list *list);
9334	__isl_give isl_set_list *isl_set_list_set_set(
9335		__isl_take isl_set_list *list, int index,
9336		__isl_take isl_set *set);
9337	__isl_give isl_set_list *isl_set_list_concat(
9338		__isl_take isl_set_list *list1,
9339		__isl_take isl_set_list *list2);
9340	__isl_give isl_set_list *isl_set_list_map(
9341		__isl_take isl_set_list *list,
9342		__isl_give isl_set *(*fn)(__isl_take isl_set *el,
9343			void *user),
9344		void *user);
9345	__isl_give isl_set_list *isl_set_list_sort(
9346		__isl_take isl_set_list *list,
9347		int (*cmp)(__isl_keep isl_set *a,
9348			__isl_keep isl_set *b, void *user),
9349		void *user);
9350	__isl_null isl_set_list *isl_set_list_free(
9351		__isl_take isl_set_list *list);
9352
9353C<isl_set_list_alloc> creates an empty list with an initial capacity
9354for C<n> elements.  C<isl_set_list_insert> and C<isl_set_list_add>
9355add elements to a list, increasing its capacity as needed.
9356C<isl_set_to_list> creates a list with a single element.
9357C<isl_set_list_from_set> performs the same operation.
9358C<isl_set_list_clear> removes all elements from a list.
9359C<isl_set_list_swap> swaps the elements at the specified locations.
9360C<isl_set_list_reverse> reverses the elements in the list.
9361
9362Lists can be inspected using the following functions.
9363
9364	#include <isl/set.h>
9365	isl_size isl_set_list_size(__isl_keep isl_set_list *list);
9366	isl_size isl_set_list_n_set(__isl_keep isl_set_list *list);
9367	__isl_give isl_set *isl_set_list_get_at(
9368		__isl_keep isl_set_list *list, int index);
9369	__isl_give isl_set *isl_set_list_get_set(
9370		__isl_keep isl_set_list *list, int index);
9371	isl_stat isl_set_list_foreach(__isl_keep isl_set_list *list,
9372		isl_stat (*fn)(__isl_take isl_set *el, void *user),
9373		void *user);
9374	isl_bool isl_set_list_every(__isl_keep isl_set_list *list,
9375		isl_bool (*test)(__isl_take isl_set *el,
9376			void *user),
9377		void *user);
9378	isl_stat isl_set_list_foreach_scc(
9379		__isl_keep isl_set_list *list,
9380		isl_bool (*follows)(__isl_keep isl_set *a,
9381			__isl_keep isl_set *b, void *user),
9382		void *follows_user,
9383		isl_stat (*fn)(__isl_take isl_set_list *scc,
9384			void *user),
9385		void *fn_user);
9386
9387C<isl_set_list_n_set> is an alternative name for C<isl_set_list_size>.
9388Similarly,
9389C<isl_set_list_get_set> is an alternative name for C<isl_set_list_get_at>.
9390The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
9391strongly connected components of the graph with as vertices the elements
9392of C<list> and a directed edge from vertex C<b> to vertex C<a>
9393iff C<follows(a, b)> returns C<isl_bool_true>.  The callbacks C<follows> and
9394C<fn> should return C<isl_bool_error> or C<isl_stat_error> on error.
9395
9396Lists can be printed using
9397
9398	#include <isl/set.h>
9399	__isl_give isl_printer *isl_printer_print_set_list(
9400		__isl_take isl_printer *p,
9401		__isl_keep isl_set_list *list);
9402
9403Alternatively, a string representation can be obtained
9404directly using the following function, which always prints
9405in isl format.
9406
9407	#include <isl/set.h>
9408	__isl_give char *isl_set_list_to_str(
9409		__isl_keep isl_set_list *list);
9410
9411An C<isl_val_list>, C<isl_id_list>,
9412C<isl_aff_list>, C<isl_pw_aff_list>, C<isl_pw_multi_aff_list>,
9413C<isl_union_pw_aff_list>,
9414C<isl_set_list>, C<isl_map_list> or C<isl_union_set_list> object
9415can also be read from input using the following functions.
9416
9417	#include <isl/val.h>
9418	__isl_give isl_val_list *isl_val_list_read_from_str(
9419		isl_ctx *ctx, const char *str);
9420
9421	#include <isl/id.h>
9422	__isl_give isl_id_list *isl_id_list_read_from_str(
9423		isl_ctx *ctx, const char *str);
9424
9425	#include <isl/aff.h>
9426	__isl_give isl_aff_list *
9427	isl_aff_list_read_from_str(isl_ctx *ctx,
9428		const char *str);
9429	__isl_give isl_pw_aff_list *
9430	isl_pw_aff_list_read_from_str(isl_ctx *ctx,
9431		const char *str);
9432	__isl_give isl_pw_multi_aff_list *
9433	isl_pw_multi_aff_list_read_from_str(isl_ctx *ctx,
9434		const char *str);
9435	__isl_give isl_union_pw_aff_list *
9436	isl_union_pw_aff_list_read_from_str(isl_ctx *ctx,
9437		const char *str);
9438
9439	#include <isl/set.h>
9440	__isl_give isl_set_list *isl_set_list_read_from_str(
9441		isl_ctx *ctx, const char *str);
9442
9443	#include <isl/map.h>
9444	__isl_give isl_map_list *isl_map_list_read_from_str(
9445		isl_ctx *ctx, const char *str);
9446
9447	#include <isl/union_set.h>
9448	__isl_give isl_union_set_list *
9449	isl_union_set_list_read_from_str(isl_ctx *ctx,
9450		const char *str);
9451
9452=head2 Associative arrays
9453
9454Associative arrays map isl objects of a specific type to isl objects
9455of some (other) specific type.  They are defined for several pairs
9456of types, including (C<isl_map>, C<isl_basic_set>),
9457(C<isl_id>, C<isl_ast_expr>),
9458(C<isl_id>, C<isl_id>) and
9459(C<isl_id>, C<isl_pw_aff>).
9460Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
9461as an example.
9462
9463Associative arrays can be created, copied and freed using
9464the following functions.
9465
9466	#include <isl/id_to_ast_expr.h>
9467	__isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
9468		isl_ctx *ctx, int min_size);
9469	__isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
9470		__isl_keep isl_id_to_ast_expr *id2expr);
9471	__isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
9472		__isl_take isl_id_to_ast_expr *id2expr);
9473
9474The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
9475to specify the expected size of the associative array.
9476The associative array will be grown automatically as needed.
9477
9478Associative arrays can be inspected using the following functions.
9479
9480	#include <isl/id_to_ast_expr.h>
9481	__isl_give isl_maybe_isl_ast_expr
9482	isl_id_to_ast_expr_try_get(
9483		__isl_keep isl_id_to_ast_expr *id2expr,
9484		__isl_keep isl_id *key);
9485	isl_bool isl_id_to_ast_expr_has(
9486		__isl_keep isl_id_to_ast_expr *id2expr,
9487		__isl_keep isl_id *key);
9488	__isl_give isl_ast_expr *isl_id_to_ast_expr_get(
9489		__isl_keep isl_id_to_ast_expr *id2expr,
9490		__isl_take isl_id *key);
9491	isl_stat isl_id_to_ast_expr_foreach(
9492		__isl_keep isl_id_to_ast_expr *id2expr,
9493		isl_stat (*fn)(__isl_take isl_id *key,
9494			__isl_take isl_ast_expr *val, void *user),
9495		void *user);
9496
9497The function C<isl_id_to_ast_expr_try_get> returns a structure
9498containing two elements, C<valid> and C<value>.
9499If there is a value associated to the key, then C<valid>
9500is set to C<isl_bool_true> and C<value> contains a copy of
9501the associated value.  Otherwise C<value> is C<NULL> and
9502C<valid> may be C<isl_bool_error> or C<isl_bool_false> depending
9503on whether some error has occurred or there simply is no associated value.
9504The function C<isl_id_to_ast_expr_has> returns the C<valid> field
9505in the structure and
9506the function C<isl_id_to_ast_expr_get> returns the C<value> field.
9507
9508Associative arrays can be modified using the following functions.
9509
9510	#include <isl/id_to_ast_expr.h>
9511	__isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
9512		__isl_take isl_id_to_ast_expr *id2expr,
9513		__isl_take isl_id *key,
9514		__isl_take isl_ast_expr *val);
9515	__isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
9516		__isl_take isl_id_to_ast_expr *id2expr,
9517		__isl_take isl_id *key);
9518
9519Associative arrays can be printed using the following function.
9520
9521	#include <isl/id_to_ast_expr.h>
9522	__isl_give isl_printer *isl_printer_print_id_to_ast_expr(
9523		__isl_take isl_printer *p,
9524		__isl_keep isl_id_to_ast_expr *id2expr);
9525
9526=head2 Vectors
9527
9528Vectors can be created, copied and freed using the following functions.
9529
9530	#include <isl/vec.h>
9531	__isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
9532		unsigned size);
9533	__isl_give isl_vec *isl_vec_zero(isl_ctx *ctx,
9534		unsigned size);
9535	__isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
9536	__isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
9537
9538Note that the elements of a vector created by C<isl_vec_alloc>
9539may have arbitrary values.
9540A vector created by C<isl_vec_zero> has elements with value zero.
9541The elements can be changed and inspected using the following functions.
9542
9543	isl_size isl_vec_size(__isl_keep isl_vec *vec);
9544	__isl_give isl_val *isl_vec_get_element_val(
9545		__isl_keep isl_vec *vec, int pos);
9546	__isl_give isl_vec *isl_vec_set_element_si(
9547		__isl_take isl_vec *vec, int pos, int v);
9548	__isl_give isl_vec *isl_vec_set_element_val(
9549		__isl_take isl_vec *vec, int pos,
9550		__isl_take isl_val *v);
9551	__isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
9552		int v);
9553	__isl_give isl_vec *isl_vec_set_val(
9554		__isl_take isl_vec *vec, __isl_take isl_val *v);
9555	int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
9556		__isl_keep isl_vec *vec2, int pos);
9557
9558C<isl_vec_get_element> will return a negative value if anything went wrong.
9559In that case, the value of C<*v> is undefined.
9560
9561The following function can be used to concatenate two vectors.
9562
9563	__isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
9564		__isl_take isl_vec *vec2);
9565
9566=head2 Matrices
9567
9568Matrices can be created, copied and freed using the following functions.
9569
9570	#include <isl/mat.h>
9571	__isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
9572		unsigned n_row, unsigned n_col);
9573	__isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
9574	__isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
9575
9576Note that the elements of a newly created matrix may have arbitrary values.
9577The elements can be changed and inspected using the following functions.
9578
9579	isl_size isl_mat_rows(__isl_keep isl_mat *mat);
9580	isl_size isl_mat_cols(__isl_keep isl_mat *mat);
9581	__isl_give isl_val *isl_mat_get_element_val(
9582		__isl_keep isl_mat *mat, int row, int col);
9583	__isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
9584		int row, int col, int v);
9585	__isl_give isl_mat *isl_mat_set_element_val(
9586		__isl_take isl_mat *mat, int row, int col,
9587		__isl_take isl_val *v);
9588
9589The following function computes the rank of a matrix.
9590The return value may be -1 if some error occurred.
9591
9592	#include <isl/mat.h>
9593	isl_size isl_mat_rank(__isl_keep isl_mat *mat);
9594
9595The following function can be used to compute the (right) inverse
9596of a matrix, i.e., a matrix such that the product of the original
9597and the inverse (in that order) is a multiple of the identity matrix.
9598The input matrix is assumed to be of full row-rank.
9599
9600	__isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
9601
9602The following function can be used to compute the (right) kernel
9603(or null space) of a matrix, i.e., a matrix such that the product of
9604the original and the kernel (in that order) is the zero matrix.
9605
9606	__isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
9607
9608The following function computes a basis for the space spanned
9609by the rows of a matrix.
9610
9611	__isl_give isl_mat *isl_mat_row_basis(
9612		__isl_take isl_mat *mat);
9613
9614The following function computes rows that extend a basis of C<mat1>
9615to a basis that also covers C<mat2>.
9616
9617	__isl_give isl_mat *isl_mat_row_basis_extension(
9618		__isl_take isl_mat *mat1,
9619		__isl_take isl_mat *mat2);
9620
9621The following function checks whether there is no linear dependence
9622among the combined rows of "mat1" and "mat2" that is not already present
9623in "mat1" or "mat2" individually.
9624If "mat1" and "mat2" have linearly independent rows by themselves,
9625then this means that there is no linear dependence among all rows together.
9626
9627	isl_bool isl_mat_has_linearly_independent_rows(
9628		__isl_keep isl_mat *mat1,
9629		__isl_keep isl_mat *mat2);
9630
9631=head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
9632
9633The following functions determine
9634an upper or lower bound on a quasipolynomial over its domain.
9635
9636	__isl_give isl_pw_qpolynomial_fold *
9637	isl_pw_qpolynomial_bound(
9638		__isl_take isl_pw_qpolynomial *pwqp,
9639		enum isl_fold type, isl_bool *tight);
9640
9641	__isl_give isl_union_pw_qpolynomial_fold *
9642	isl_union_pw_qpolynomial_bound(
9643		__isl_take isl_union_pw_qpolynomial *upwqp,
9644		enum isl_fold type, isl_bool *tight);
9645
9646The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
9647If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
9648is the returned bound is known be tight, i.e., for each value
9649of the parameters there is at least
9650one element in the domain that reaches the bound.
9651If the domain of C<pwqp> is not wrapping, then the bound is computed
9652over all elements in that domain and the result has a purely parametric
9653domain.  If the domain of C<pwqp> is wrapping, then the bound is
9654computed over the range of the wrapped relation.  The domain of the
9655wrapped relation becomes the domain of the result.
9656
9657=head2 Parametric Vertex Enumeration
9658
9659The parametric vertex enumeration described in this section
9660is mainly intended to be used internally and by the C<barvinok>
9661library.
9662
9663	#include <isl/vertices.h>
9664	__isl_give isl_vertices *isl_basic_set_compute_vertices(
9665		__isl_keep isl_basic_set *bset);
9666
9667The function C<isl_basic_set_compute_vertices> performs the
9668actual computation of the parametric vertices and the chamber
9669decomposition and stores the result in an C<isl_vertices> object.
9670This information can be queried by either iterating over all
9671the vertices or iterating over all the chambers or cells
9672and then iterating over all vertices that are active on the chamber.
9673
9674	isl_stat isl_vertices_foreach_vertex(
9675		__isl_keep isl_vertices *vertices,
9676		isl_stat (*fn)(__isl_take isl_vertex *vertex,
9677			void *user), void *user);
9678
9679	isl_stat isl_vertices_foreach_cell(
9680		__isl_keep isl_vertices *vertices,
9681		isl_stat (*fn)(__isl_take isl_cell *cell,
9682			void *user), void *user);
9683	isl_stat isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
9684		isl_stat (*fn)(__isl_take isl_vertex *vertex,
9685			void *user), void *user);
9686
9687Other operations that can be performed on an C<isl_vertices> object are
9688the following.
9689
9690	isl_size isl_vertices_get_n_vertices(
9691		__isl_keep isl_vertices *vertices);
9692	__isl_null isl_vertices *isl_vertices_free(
9693		__isl_take isl_vertices *vertices);
9694
9695Vertices can be inspected and destroyed using the following functions.
9696
9697	isl_size isl_vertex_get_id(__isl_keep isl_vertex *vertex);
9698	__isl_give isl_basic_set *isl_vertex_get_domain(
9699		__isl_keep isl_vertex *vertex);
9700	__isl_give isl_multi_aff *isl_vertex_get_expr(
9701		__isl_keep isl_vertex *vertex);
9702	__isl_null isl_vertex *isl_vertex_free(
9703		__isl_take isl_vertex *vertex);
9704
9705C<isl_vertex_get_expr> returns a multiple quasi-affine expression
9706describing the vertex in terms of the parameters,
9707while C<isl_vertex_get_domain> returns the activity domain
9708of the vertex.
9709
9710Chambers can be inspected and destroyed using the following functions.
9711
9712	__isl_give isl_basic_set *isl_cell_get_domain(
9713		__isl_keep isl_cell *cell);
9714	__isl_null isl_cell *isl_cell_free(
9715		__isl_take isl_cell *cell);
9716
9717=head1 Polyhedral Compilation Library
9718
9719This section collects functionality in C<isl> that has been specifically
9720designed for use during polyhedral compilation.
9721
9722=head2 Schedule Trees
9723
9724A schedule tree is a structured representation of a schedule,
9725assigning a relative order to a set of domain elements.
9726The relative order expressed by the schedule tree is
9727defined recursively.  In particular, the order between
9728two domain elements is determined by the node that is closest
9729to the root that refers to both elements and that orders them apart.
9730Each node in the tree is of one of several types.
9731The root node is always of type C<isl_schedule_node_domain>
9732(or C<isl_schedule_node_extension>)
9733and it describes the (extra) domain elements to which the schedule applies.
9734The other types of nodes are as follows.
9735
9736=over
9737
9738=item C<isl_schedule_node_band>
9739
9740A band of schedule dimensions.  Each schedule dimension is represented
9741by a union piecewise quasi-affine expression.  If this expression
9742assigns a different value to two domain elements, while all previous
9743schedule dimensions in the same band assign them the same value,
9744then the two domain elements are ordered according to these two
9745different values.
9746Each expression is required to be total in the domain elements
9747that reach the band node.
9748
9749=item C<isl_schedule_node_expansion>
9750
9751An expansion node maps each of the domain elements that reach the node
9752to one or more domain elements.  The image of this mapping forms
9753the set of domain elements that reach the child of the expansion node.
9754The function that maps each of the expanded domain elements
9755to the original domain element from which it was expanded
9756is called the contraction.
9757
9758=item C<isl_schedule_node_filter>
9759
9760A filter node does not impose any ordering, but rather intersects
9761the set of domain elements that the current subtree refers to
9762with a given union set.  The subtree of the filter node only
9763refers to domain elements in the intersection.
9764A filter node is typically only used as a child of a sequence or
9765set node.
9766
9767=item C<isl_schedule_node_leaf>
9768
9769A leaf of the schedule tree.  Leaf nodes do not impose any ordering.
9770
9771=item C<isl_schedule_node_mark>
9772
9773A mark node can be used to attach any kind of information to a subtree
9774of the schedule tree.
9775
9776=item C<isl_schedule_node_sequence>
9777
9778A sequence node has one or more children, each of which is a filter node.
9779The filters on these filter nodes form a partition of
9780the domain elements that the current subtree refers to.
9781If two domain elements appear in distinct filters then the sequence
9782node orders them according to the child positions of the corresponding
9783filter nodes.
9784
9785=item C<isl_schedule_node_set>
9786
9787A set node is similar to a sequence node, except that
9788it expresses that domain elements appearing in distinct filters
9789may have any order.  The order of the children of a set node
9790is therefore also immaterial.
9791
9792=back
9793
9794The following node types are only supported by the AST generator.
9795
9796=over
9797
9798=item C<isl_schedule_node_context>
9799
9800The context describes constraints on the parameters and
9801the schedule dimensions of outer
9802bands that the AST generator may assume to hold.  It is also the only
9803kind of node that may introduce additional parameters.
9804The space of the context is that of the flat product of the outer
9805band nodes.  In particular, if there are no outer band nodes, then
9806this space is the unnamed zero-dimensional space.
9807Since a context node references the outer band nodes, any tree
9808containing a context node is considered to be anchored.
9809
9810=item C<isl_schedule_node_extension>
9811
9812An extension node instructs the AST generator to add additional
9813domain elements that need to be scheduled.
9814The additional domain elements are described by the range of
9815the extension map in terms of the outer schedule dimensions,
9816i.e., the flat product of the outer band nodes.
9817Note that domain elements are added whenever the AST generator
9818reaches the extension node, meaning that there are still some
9819active domain elements for which an AST needs to be generated.
9820The conditions under which some domain elements are still active
9821may however not be completely described by the outer AST nodes
9822generated at that point.
9823Since an extension node references the outer band nodes, any tree
9824containing an extension node is considered to be anchored.
9825
9826An extension node may also appear as the root of a schedule tree,
9827when it is intended to be inserted into another tree
9828using C<isl_schedule_node_graft_before> or C<isl_schedule_node_graft_after>.
9829In this case, the domain of the extension node should
9830correspond to the flat product of the outer band nodes
9831in this other schedule tree at the point where the extension tree
9832will be inserted.
9833
9834=item C<isl_schedule_node_guard>
9835
9836The guard describes constraints on the parameters and
9837the schedule dimensions of outer
9838bands that need to be enforced by the outer nodes
9839in the generated AST.
9840That is, the part of the AST that is generated from descendants
9841of the guard node can assume that these constraints are satisfied.
9842The space of the guard is that of the flat product of the outer
9843band nodes.  In particular, if there are no outer band nodes, then
9844this space is the unnamed zero-dimensional space.
9845Since a guard node references the outer band nodes, any tree
9846containing a guard node is considered to be anchored.
9847
9848=back
9849
9850Except for the C<isl_schedule_node_context> nodes,
9851none of the nodes may introduce any parameters that were not
9852already present in the root domain node.
9853
9854A schedule tree is encapsulated in an C<isl_schedule> object.
9855The simplest such objects, those with a tree consisting of single domain node,
9856can be created using the following functions with either an empty
9857domain or a given domain.
9858
9859	#include <isl/schedule.h>
9860	__isl_give isl_schedule *isl_schedule_empty(
9861		__isl_take isl_space *space);
9862	__isl_give isl_schedule *isl_schedule_from_domain(
9863		__isl_take isl_union_set *domain);
9864
9865The function C<isl_schedule_constraints_compute_schedule> described
9866in L</"Scheduling"> can also be used to construct schedules.
9867
9868C<isl_schedule> objects may be copied and freed using the following functions.
9869
9870	#include <isl/schedule.h>
9871	__isl_give isl_schedule *isl_schedule_copy(
9872		__isl_keep isl_schedule *sched);
9873	__isl_null isl_schedule *isl_schedule_free(
9874		__isl_take isl_schedule *sched);
9875
9876The following functions checks whether two C<isl_schedule> objects
9877are obviously the same.
9878
9879	#include <isl/schedule.h>
9880	isl_bool isl_schedule_plain_is_equal(
9881		__isl_keep isl_schedule *schedule1,
9882		__isl_keep isl_schedule *schedule2);
9883
9884The domain of the schedule, i.e., the domain described by the root node,
9885can be obtained using the following function.
9886
9887	#include <isl/schedule.h>
9888	__isl_give isl_union_set *isl_schedule_get_domain(
9889		__isl_keep isl_schedule *schedule);
9890
9891An extra top-level band node (right underneath the domain node) can
9892be introduced into the schedule using the following function.
9893The schedule tree is assumed not to have any anchored nodes.
9894
9895	#include <isl/schedule.h>
9896	__isl_give isl_schedule *
9897	isl_schedule_insert_partial_schedule(
9898		__isl_take isl_schedule *schedule,
9899		__isl_take isl_multi_union_pw_aff *partial);
9900
9901A top-level context node (right underneath the domain node) can
9902be introduced into the schedule using the following function.
9903
9904	#include <isl/schedule.h>
9905	__isl_give isl_schedule *isl_schedule_insert_context(
9906		__isl_take isl_schedule *schedule,
9907		__isl_take isl_set *context)
9908
9909A top-level guard node (right underneath the domain node) can
9910be introduced into the schedule using the following function.
9911
9912	#include <isl/schedule.h>
9913	__isl_give isl_schedule *isl_schedule_insert_guard(
9914		__isl_take isl_schedule *schedule,
9915		__isl_take isl_set *guard)
9916
9917A schedule that combines two schedules either in the given
9918order or in an arbitrary order, i.e., with an C<isl_schedule_node_sequence>
9919or an C<isl_schedule_node_set> node,
9920can be created using the following functions.
9921
9922	#include <isl/schedule.h>
9923	__isl_give isl_schedule *isl_schedule_sequence(
9924		__isl_take isl_schedule *schedule1,
9925		__isl_take isl_schedule *schedule2);
9926	__isl_give isl_schedule *isl_schedule_set(
9927		__isl_take isl_schedule *schedule1,
9928		__isl_take isl_schedule *schedule2);
9929
9930The domains of the two input schedules need to be disjoint.
9931
9932The following function can be used to restrict the domain
9933of a schedule with a domain node as root to be a subset of the given union set.
9934This operation may remove nodes in the tree that have become
9935redundant.
9936
9937	#include <isl/schedule.h>
9938	__isl_give isl_schedule *isl_schedule_intersect_domain(
9939		__isl_take isl_schedule *schedule,
9940		__isl_take isl_union_set *domain);
9941
9942The following function can be used to simplify the domain
9943of a schedule with a domain node as root with respect to the given
9944parameter domain.
9945
9946	#include <isl/schedule.h>
9947	__isl_give isl_schedule *isl_schedule_gist_domain_params(
9948		__isl_take isl_schedule *schedule,
9949		__isl_take isl_set *context);
9950
9951The following function resets the user pointers on all parameter
9952and tuple identifiers referenced by the nodes of the given schedule.
9953
9954	#include <isl/schedule.h>
9955	__isl_give isl_schedule *isl_schedule_reset_user(
9956		__isl_take isl_schedule *schedule);
9957
9958The following function aligns the parameters of all nodes
9959in the given schedule to the given space.
9960
9961	#include <isl/schedule.h>
9962	__isl_give isl_schedule *isl_schedule_align_params(
9963		__isl_take isl_schedule *schedule,
9964		__isl_take isl_space *space);
9965
9966The following function allows the user to plug in a given function
9967in the iteration domains.  The input schedule is not allowed to contain
9968any expansion nodes.
9969
9970	#include <isl/schedule.h>
9971	__isl_give isl_schedule *
9972	isl_schedule_pullback_union_pw_multi_aff(
9973		__isl_take isl_schedule *schedule,
9974		__isl_take isl_union_pw_multi_aff *upma);
9975
9976The following function can be used to plug in the schedule C<expansion>
9977in the leaves of C<schedule>, where C<contraction> describes how
9978the domain elements of C<expansion> map to the domain elements
9979at the original leaves of C<schedule>.
9980The resulting schedule will contain expansion nodes, unless
9981C<contraction> is an identity function.
9982
9983	#include <isl/schedule.h>
9984	__isl_give isl_schedule *isl_schedule_expand(
9985		__isl_take isl_schedule *schedule,
9986		__isl_take isl_union_pw_multi_aff *contraction,
9987		__isl_take isl_schedule *expansion);
9988
9989An C<isl_union_map> representation of the schedule can be obtained
9990from an C<isl_schedule> using the following function.
9991
9992	#include <isl/schedule.h>
9993	__isl_give isl_union_map *isl_schedule_get_map(
9994		__isl_keep isl_schedule *sched);
9995
9996The resulting relation encodes the same relative ordering as
9997the schedule by mapping the domain elements to a common schedule space.
9998If the schedule_separate_components option is set, then the order
9999of the children of a set node is explicitly encoded in the result.
10000If the tree contains any expansion nodes, then the relation
10001is formulated in terms of the expanded domain elements.
10002
10003Schedules can be read from input using the following functions.
10004
10005	#include <isl/schedule.h>
10006	__isl_give isl_schedule *isl_schedule_read_from_file(
10007		isl_ctx *ctx, FILE *input);
10008	__isl_give isl_schedule *isl_schedule_read_from_str(
10009		isl_ctx *ctx, const char *str);
10010
10011A representation of the schedule can be printed using
10012
10013	#include <isl/schedule.h>
10014	__isl_give isl_printer *isl_printer_print_schedule(
10015		__isl_take isl_printer *p,
10016		__isl_keep isl_schedule *schedule);
10017	__isl_give char *isl_schedule_to_str(
10018		__isl_keep isl_schedule *schedule);
10019
10020C<isl_schedule_to_str> prints the schedule in flow format.
10021
10022The schedule tree can be traversed through the use of
10023C<isl_schedule_node> objects that point to a particular
10024position in the schedule tree.  Whenever a C<isl_schedule_node>
10025is used to modify a node in the schedule tree, the original schedule
10026tree is left untouched and the modifications are performed to a copy
10027of the tree.  The returned C<isl_schedule_node> then points to
10028this modified copy of the tree.
10029
10030The root of the schedule tree can be obtained using the following function.
10031
10032	#include <isl/schedule.h>
10033	__isl_give isl_schedule_node *isl_schedule_get_root(
10034		__isl_keep isl_schedule *schedule);
10035
10036A pointer to a newly created schedule tree with a single domain
10037node can be created using the following functions.
10038
10039	#include <isl/schedule_node.h>
10040	__isl_give isl_schedule_node *
10041	isl_schedule_node_from_domain(
10042		__isl_take isl_union_set *domain);
10043	__isl_give isl_schedule_node *
10044	isl_schedule_node_from_extension(
10045		__isl_take isl_union_map *extension);
10046
10047C<isl_schedule_node_from_extension> creates a tree with an extension
10048node as root.
10049
10050Schedule nodes can be copied and freed using the following functions.
10051
10052	#include <isl/schedule_node.h>
10053	__isl_give isl_schedule_node *isl_schedule_node_copy(
10054		__isl_keep isl_schedule_node *node);
10055	__isl_null isl_schedule_node *isl_schedule_node_free(
10056		__isl_take isl_schedule_node *node);
10057
10058The following functions can be used to check if two schedule
10059nodes point to the same position in the same schedule.
10060
10061	#include <isl/schedule_node.h>
10062	isl_bool isl_schedule_node_is_equal(
10063		__isl_keep isl_schedule_node *node1,
10064		__isl_keep isl_schedule_node *node2);
10065
10066The following properties can be obtained from a schedule node.
10067
10068	#include <isl/schedule_node.h>
10069	enum isl_schedule_node_type isl_schedule_node_get_type(
10070		__isl_keep isl_schedule_node *node);
10071	enum isl_schedule_node_type
10072	isl_schedule_node_get_parent_type(
10073		__isl_keep isl_schedule_node *node);
10074	__isl_give isl_schedule *isl_schedule_node_get_schedule(
10075		__isl_keep isl_schedule_node *node);
10076
10077The function C<isl_schedule_node_get_type> returns the type of
10078the node, while C<isl_schedule_node_get_parent_type> returns
10079type of the parent of the node, which is required to exist.
10080The function C<isl_schedule_node_get_schedule> returns a copy
10081to the schedule to which the node belongs.
10082
10083The following functions can be used to move the schedule node
10084to a different position in the tree or to check if such a position
10085exists.
10086
10087	#include <isl/schedule_node.h>
10088	isl_bool isl_schedule_node_has_parent(
10089		__isl_keep isl_schedule_node *node);
10090	__isl_give isl_schedule_node *isl_schedule_node_parent(
10091		__isl_take isl_schedule_node *node);
10092	__isl_give isl_schedule_node *isl_schedule_node_root(
10093		__isl_take isl_schedule_node *node);
10094	__isl_give isl_schedule_node *isl_schedule_node_ancestor(
10095		__isl_take isl_schedule_node *node,
10096		int generation);
10097	isl_size isl_schedule_node_n_children(
10098		__isl_keep isl_schedule_node *node);
10099	__isl_give isl_schedule_node *isl_schedule_node_child(
10100		__isl_take isl_schedule_node *node, int pos);
10101	isl_bool isl_schedule_node_has_children(
10102		__isl_keep isl_schedule_node *node);
10103	__isl_give isl_schedule_node *isl_schedule_node_first_child(
10104		__isl_take isl_schedule_node *node);
10105	isl_bool isl_schedule_node_has_previous_sibling(
10106		__isl_keep isl_schedule_node *node);
10107	__isl_give isl_schedule_node *
10108	isl_schedule_node_previous_sibling(
10109		__isl_take isl_schedule_node *node);
10110	isl_bool isl_schedule_node_has_next_sibling(
10111		__isl_keep isl_schedule_node *node);
10112	__isl_give isl_schedule_node *
10113	isl_schedule_node_next_sibling(
10114		__isl_take isl_schedule_node *node);
10115
10116For C<isl_schedule_node_ancestor>, the ancestor of generation 0
10117is the node itself, the ancestor of generation 1 is its parent and so on.
10118
10119It is also possible to query the number of ancestors of a node,
10120the position of the current node
10121within the children of its parent, the position of the subtree
10122containing a node within the children of an ancestor
10123or to obtain a copy of a given
10124child without destroying the current node.
10125Given two nodes that point to the same schedule, their closest
10126shared ancestor can be obtained using
10127C<isl_schedule_node_get_shared_ancestor>.
10128
10129	#include <isl/schedule_node.h>
10130	isl_size isl_schedule_node_get_tree_depth(
10131		__isl_keep isl_schedule_node *node);
10132	isl_size isl_schedule_node_get_child_position(
10133		__isl_keep isl_schedule_node *node);
10134	isl_size isl_schedule_node_get_ancestor_child_position(
10135		__isl_keep isl_schedule_node *node,
10136		__isl_keep isl_schedule_node *ancestor);
10137	__isl_give isl_schedule_node *isl_schedule_node_get_child(
10138		__isl_keep isl_schedule_node *node, int pos);
10139	__isl_give isl_schedule_node *
10140	isl_schedule_node_get_shared_ancestor(
10141		__isl_keep isl_schedule_node *node1,
10142		__isl_keep isl_schedule_node *node2);
10143
10144All nodes in a schedule tree or
10145all descendants of a specific node (including the node) can be visited
10146in depth-first pre-order using the following functions.
10147
10148	#include <isl/schedule.h>
10149	isl_stat isl_schedule_foreach_schedule_node_top_down(
10150		__isl_keep isl_schedule *sched,
10151		isl_bool (*fn)(__isl_keep isl_schedule_node *node,
10152			void *user), void *user);
10153
10154	#include <isl/schedule_node.h>
10155	isl_stat isl_schedule_node_foreach_descendant_top_down(
10156		__isl_keep isl_schedule_node *node,
10157		isl_bool (*fn)(__isl_keep isl_schedule_node *node,
10158			void *user), void *user);
10159
10160The callback function is slightly different from the usual
10161callbacks in that it not only indicates success (non-negative result)
10162or failure (negative result), but also indicates whether the children
10163of the given node should be visited.  In particular, if the callback
10164returns a positive value, then the children are visited, but if
10165the callback returns zero, then the children are not visited.
10166
10167The following functions checks whether
10168all descendants of a specific node (including the node itself)
10169satisfy a user-specified test.
10170
10171	#include <isl/schedule_node.h>
10172	isl_bool isl_schedule_node_every_descendant(
10173		__isl_keep isl_schedule_node *node,
10174		isl_bool (*test)(__isl_keep isl_schedule_node *node,
10175			void *user), void *user)
10176
10177The ancestors of a node in a schedule tree can be visited from
10178the root down to and including the parent of the node using
10179the following function.
10180
10181	#include <isl/schedule_node.h>
10182	isl_stat isl_schedule_node_foreach_ancestor_top_down(
10183		__isl_keep isl_schedule_node *node,
10184		isl_stat (*fn)(__isl_keep isl_schedule_node *node,
10185			void *user), void *user);
10186
10187The following functions allows for a depth-first post-order
10188traversal of the nodes in a schedule tree or
10189of the descendants of a specific node (including the node
10190itself), where the user callback is allowed to modify the
10191visited node.
10192
10193	#include <isl/schedule.h>
10194	__isl_give isl_schedule *
10195	isl_schedule_map_schedule_node_bottom_up(
10196		__isl_take isl_schedule *schedule,
10197		__isl_give isl_schedule_node *(*fn)(
10198			__isl_take isl_schedule_node *node,
10199			void *user), void *user);
10200
10201	#include <isl/schedule_node.h>
10202	__isl_give isl_schedule_node *
10203	isl_schedule_node_map_descendant_bottom_up(
10204		__isl_take isl_schedule_node *node,
10205		__isl_give isl_schedule_node *(*fn)(
10206			__isl_take isl_schedule_node *node,
10207			void *user), void *user);
10208
10209The traversal continues from the node returned by the callback function.
10210It is the responsibility of the user to ensure that this does not
10211lead to an infinite loop.  It is safest to always return a pointer
10212to the same position (same ancestors and child positions) as the input node.
10213
10214The following function removes a node (along with its descendants)
10215from a schedule tree and returns a pointer to the leaf at the
10216same position in the updated tree.
10217It is not allowed to remove the root of a schedule tree or
10218a child of a set or sequence node.
10219
10220	#include <isl/schedule_node.h>
10221	__isl_give isl_schedule_node *isl_schedule_node_cut(
10222		__isl_take isl_schedule_node *node);
10223
10224The following function removes a single node
10225from a schedule tree and returns a pointer to the child
10226of the node, now located at the position of the original node
10227or to a leaf node at that position if there was no child.
10228It is not allowed to remove the root of a schedule tree,
10229a set or sequence node, a child of a set or sequence node or
10230a band node with an anchored subtree.
10231
10232	#include <isl/schedule_node.h>
10233	__isl_give isl_schedule_node *isl_schedule_node_delete(
10234		__isl_take isl_schedule_node *node);
10235
10236Most nodes in a schedule tree only contain local information.
10237In some cases, however, a node may also refer to the schedule dimensions
10238of its outer band nodes.
10239This means that the position of the node within the tree should
10240not be changed, or at least that no changes are performed to the
10241outer band nodes.  The following function can be used to test
10242whether the subtree rooted at a given node contains any such nodes.
10243
10244	#include <isl/schedule_node.h>
10245	isl_bool isl_schedule_node_is_subtree_anchored(
10246		__isl_keep isl_schedule_node *node);
10247
10248The following function resets the user pointers on all parameter
10249and tuple identifiers referenced by the given schedule node.
10250
10251	#include <isl/schedule_node.h>
10252	__isl_give isl_schedule_node *isl_schedule_node_reset_user(
10253		__isl_take isl_schedule_node *node);
10254
10255The following function aligns the parameters of the given schedule
10256node to the given space.
10257
10258	#include <isl/schedule_node.h>
10259	__isl_give isl_schedule_node *
10260	isl_schedule_node_align_params(
10261		__isl_take isl_schedule_node *node,
10262		__isl_take isl_space *space);
10263
10264Several node types have their own functions for querying
10265(and in some cases setting) some node type specific properties.
10266
10267	#include <isl/schedule_node.h>
10268	__isl_give isl_space *isl_schedule_node_band_get_space(
10269		__isl_keep isl_schedule_node *node);
10270	__isl_give isl_multi_union_pw_aff *
10271	isl_schedule_node_band_get_partial_schedule(
10272		__isl_keep isl_schedule_node *node);
10273	__isl_give isl_union_map *
10274	isl_schedule_node_band_get_partial_schedule_union_map(
10275		__isl_keep isl_schedule_node *node);
10276	isl_size isl_schedule_node_band_n_member(
10277		__isl_keep isl_schedule_node *node);
10278	isl_bool isl_schedule_node_band_member_get_coincident(
10279		__isl_keep isl_schedule_node *node, int pos);
10280	__isl_give isl_schedule_node *
10281	isl_schedule_node_band_member_set_coincident(
10282		__isl_take isl_schedule_node *node, int pos,
10283		int coincident);
10284	isl_bool isl_schedule_node_band_get_permutable(
10285		__isl_keep isl_schedule_node *node);
10286	__isl_give isl_schedule_node *
10287	isl_schedule_node_band_set_permutable(
10288		__isl_take isl_schedule_node *node, int permutable);
10289	enum isl_ast_loop_type
10290	isl_schedule_node_band_member_get_ast_loop_type(
10291		__isl_keep isl_schedule_node *node, int pos);
10292	__isl_give isl_schedule_node *
10293	isl_schedule_node_band_member_set_ast_loop_type(
10294		__isl_take isl_schedule_node *node, int pos,
10295		enum isl_ast_loop_type type);
10296	enum isl_ast_loop_type
10297	isl_schedule_node_band_member_get_isolate_ast_loop_type(
10298		__isl_keep isl_schedule_node *node, int pos);
10299	__isl_give isl_schedule_node *
10300	isl_schedule_node_band_member_set_isolate_ast_loop_type(
10301		__isl_take isl_schedule_node *node, int pos,
10302		enum isl_ast_loop_type type);
10303	__isl_give isl_union_set *
10304	isl_schedule_node_band_get_ast_build_options(
10305		__isl_keep isl_schedule_node *node);
10306	__isl_give isl_schedule_node *
10307	isl_schedule_node_band_set_ast_build_options(
10308		__isl_take isl_schedule_node *node,
10309		__isl_take isl_union_set *options);
10310	__isl_give isl_set *
10311	isl_schedule_node_band_get_ast_isolate_option(
10312		__isl_keep isl_schedule_node *node);
10313
10314The function C<isl_schedule_node_band_get_space> returns the space
10315of the partial schedule of the band.
10316The function C<isl_schedule_node_band_get_partial_schedule_union_map>
10317returns a representation of the partial schedule of the band node
10318in the form of an C<isl_union_map>.
10319The coincident and permutable properties are set by
10320C<isl_schedule_constraints_compute_schedule> on the schedule tree
10321it produces.
10322A scheduling dimension is considered to be ``coincident''
10323if it satisfies the coincidence constraints within its band.
10324That is, if the dependence distances of the coincidence
10325constraints are all zero in that direction (for fixed
10326iterations of outer bands).
10327A band is marked permutable if it was produced using the Pluto-like scheduler.
10328Note that the scheduler may have to resort to a Feautrier style scheduling
10329step even if the default scheduler is used.
10330An C<isl_ast_loop_type> is one of C<isl_ast_loop_default>,
10331C<isl_ast_loop_atomic>, C<isl_ast_loop_unroll> or C<isl_ast_loop_separate>.
10332For the meaning of these loop AST generation types and the difference
10333between the regular loop AST generation type and the isolate
10334loop AST generation type, see L</"AST Generation Options (Schedule Tree)">.
10335The functions C<isl_schedule_node_band_member_get_ast_loop_type>
10336and C<isl_schedule_node_band_member_get_isolate_ast_loop_type>
10337may return C<isl_ast_loop_error> if an error occurs.
10338The AST build options govern how an AST is generated for
10339the individual schedule dimensions during AST generation.
10340See L</"AST Generation Options (Schedule Tree)">.
10341The isolate option for the given node can be extracted from these
10342AST build options using the function
10343C<isl_schedule_node_band_get_ast_isolate_option>.
10344
10345	#include <isl/schedule_node.h>
10346	__isl_give isl_set *
10347	isl_schedule_node_context_get_context(
10348		__isl_keep isl_schedule_node *node);
10349
10350	#include <isl/schedule_node.h>
10351	__isl_give isl_union_set *
10352	isl_schedule_node_domain_get_domain(
10353		__isl_keep isl_schedule_node *node);
10354
10355	#include <isl/schedule_node.h>
10356	__isl_give isl_union_map *
10357	isl_schedule_node_expansion_get_expansion(
10358		__isl_keep isl_schedule_node *node);
10359	__isl_give isl_union_pw_multi_aff *
10360	isl_schedule_node_expansion_get_contraction(
10361		__isl_keep isl_schedule_node *node);
10362
10363	#include <isl/schedule_node.h>
10364	__isl_give isl_union_map *
10365	isl_schedule_node_extension_get_extension(
10366		__isl_keep isl_schedule_node *node);
10367
10368	#include <isl/schedule_node.h>
10369	__isl_give isl_union_set *
10370	isl_schedule_node_filter_get_filter(
10371		__isl_keep isl_schedule_node *node);
10372
10373	#include <isl/schedule_node.h>
10374	__isl_give isl_set *isl_schedule_node_guard_get_guard(
10375		__isl_keep isl_schedule_node *node);
10376
10377	#include <isl/schedule_node.h>
10378	__isl_give isl_id *isl_schedule_node_mark_get_id(
10379		__isl_keep isl_schedule_node *node);
10380
10381The following functions can be used to obtain an C<isl_multi_union_pw_aff>,
10382an C<isl_union_pw_multi_aff> or C<isl_union_map> representation of
10383partial schedules related to the node.
10384
10385	#include <isl/schedule_node.h>
10386	__isl_give isl_multi_union_pw_aff *
10387	isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(
10388		__isl_keep isl_schedule_node *node);
10389	__isl_give isl_union_pw_multi_aff *
10390	isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(
10391		__isl_keep isl_schedule_node *node);
10392	__isl_give isl_union_map *
10393	isl_schedule_node_get_prefix_schedule_union_map(
10394		__isl_keep isl_schedule_node *node);
10395	__isl_give isl_union_map *
10396	isl_schedule_node_get_prefix_schedule_relation(
10397		__isl_keep isl_schedule_node *node);
10398	__isl_give isl_union_map *
10399	isl_schedule_node_get_subtree_schedule_union_map(
10400		__isl_keep isl_schedule_node *node);
10401
10402In particular, the functions
10403C<isl_schedule_node_get_prefix_schedule_multi_union_pw_aff>,
10404C<isl_schedule_node_get_prefix_schedule_union_pw_multi_aff>
10405and C<isl_schedule_node_get_prefix_schedule_union_map>
10406return a relative ordering on the domain elements that reach the given
10407node determined by its ancestors.
10408The function C<isl_schedule_node_get_prefix_schedule_relation>
10409additionally includes the domain constraints in the result.
10410The function C<isl_schedule_node_get_subtree_schedule_union_map>
10411returns a representation of the partial schedule defined by the
10412subtree rooted at the given node.
10413If the tree contains any expansion nodes, then the subtree schedule
10414is formulated in terms of the expanded domain elements.
10415The tree passed to functions returning a prefix schedule
10416may only contain extension nodes if these would not affect
10417the result of these functions.  That is, if one of the ancestors
10418is an extension node, then all of the domain elements that were
10419added by the extension node need to have been filtered out
10420by filter nodes between the extension node and the input node.
10421The tree passed to C<isl_schedule_node_get_subtree_schedule_union_map>
10422may not contain in extension nodes in the selected subtree.
10423
10424The expansion/contraction defined by an entire subtree, combining
10425the expansions/contractions
10426on the expansion nodes in the subtree, can be obtained using
10427the following functions.
10428
10429	#include <isl/schedule_node.h>
10430	__isl_give isl_union_map *
10431	isl_schedule_node_get_subtree_expansion(
10432		__isl_keep isl_schedule_node *node);
10433	__isl_give isl_union_pw_multi_aff *
10434	isl_schedule_node_get_subtree_contraction(
10435		__isl_keep isl_schedule_node *node);
10436
10437The total number of outer band members of given node, i.e.,
10438the shared output dimension of the maps in the result
10439of C<isl_schedule_node_get_prefix_schedule_union_map> can be obtained
10440using the following function.
10441
10442	#include <isl/schedule_node.h>
10443	isl_size isl_schedule_node_get_schedule_depth(
10444		__isl_keep isl_schedule_node *node);
10445
10446The following functions return the elements that reach the given node
10447or the union of universes in the spaces that contain these elements.
10448
10449	#include <isl/schedule_node.h>
10450	__isl_give isl_union_set *
10451	isl_schedule_node_get_domain(
10452		__isl_keep isl_schedule_node *node);
10453	__isl_give isl_union_set *
10454	isl_schedule_node_get_universe_domain(
10455		__isl_keep isl_schedule_node *node);
10456
10457The input tree of C<isl_schedule_node_get_domain>
10458may only contain extension nodes if these would not affect
10459the result of this function.  That is, if one of the ancestors
10460is an extension node, then all of the domain elements that were
10461added by the extension node need to have been filtered out
10462by filter nodes between the extension node and the input node.
10463
10464The following functions can be used to introduce additional nodes
10465in the schedule tree.  The new node is introduced at the point
10466in the tree where the C<isl_schedule_node> points to and
10467the results points to the new node.
10468
10469	#include <isl/schedule_node.h>
10470	__isl_give isl_schedule_node *
10471	isl_schedule_node_insert_partial_schedule(
10472		__isl_take isl_schedule_node *node,
10473		__isl_take isl_multi_union_pw_aff *schedule);
10474
10475This function inserts a new band node with (the greatest integer
10476part of) the given partial schedule.
10477The subtree rooted at the given node is assumed not to have
10478any anchored nodes.
10479
10480	#include <isl/schedule_node.h>
10481	__isl_give isl_schedule_node *
10482	isl_schedule_node_insert_context(
10483		__isl_take isl_schedule_node *node,
10484		__isl_take isl_set *context);
10485
10486This function inserts a new context node with the given context constraints.
10487
10488	#include <isl/schedule_node.h>
10489	__isl_give isl_schedule_node *
10490	isl_schedule_node_insert_filter(
10491		__isl_take isl_schedule_node *node,
10492		__isl_take isl_union_set *filter);
10493
10494This function inserts a new filter node with the given filter.
10495If the original node already pointed to a filter node, then the
10496two filter nodes are merged into one.
10497
10498	#include <isl/schedule_node.h>
10499	__isl_give isl_schedule_node *
10500	isl_schedule_node_insert_guard(
10501		__isl_take isl_schedule_node *node,
10502		__isl_take isl_set *guard);
10503
10504This function inserts a new guard node with the given guard constraints.
10505
10506	#include <isl/schedule_node.h>
10507	__isl_give isl_schedule_node *
10508	isl_schedule_node_insert_mark(
10509		__isl_take isl_schedule_node *node,
10510		__isl_take isl_id *mark);
10511
10512This function inserts a new mark node with the give mark identifier.
10513
10514	#include <isl/schedule_node.h>
10515	__isl_give isl_schedule_node *
10516	isl_schedule_node_insert_sequence(
10517		__isl_take isl_schedule_node *node,
10518		__isl_take isl_union_set_list *filters);
10519	__isl_give isl_schedule_node *
10520	isl_schedule_node_insert_set(
10521		__isl_take isl_schedule_node *node,
10522		__isl_take isl_union_set_list *filters);
10523
10524These functions insert a new sequence or set node with the given
10525filters as children.
10526
10527	#include <isl/schedule_node.h>
10528	__isl_give isl_schedule_node *isl_schedule_node_group(
10529		__isl_take isl_schedule_node *node,
10530		__isl_take isl_id *group_id);
10531
10532This function introduces an expansion node in between the current
10533node and its parent that expands instances of a space with tuple
10534identifier C<group_id> to the original domain elements that reach
10535the node.  The group instances are identified by the prefix schedule
10536of those domain elements.  The ancestors of the node are adjusted
10537to refer to the group instances instead of the original domain
10538elements.  The return value points to the same node in the updated
10539schedule tree as the input node, i.e., to the child of the newly
10540introduced expansion node.  Grouping instances of different statements
10541ensures that they will be treated as a single statement by the
10542AST generator up to the point of the expansion node.
10543
10544The following function can be used to flatten a nested
10545sequence.
10546
10547	#include <isl/schedule_node.h>
10548	__isl_give isl_schedule_node *
10549	isl_schedule_node_sequence_splice_child(
10550		__isl_take isl_schedule_node *node, int pos);
10551
10552That is, given a sequence node C<node> that has another sequence node
10553in its child at position C<pos> (in particular, the child of that filter
10554node is a sequence node), attach the children of that other sequence
10555node as children of C<node>, replacing the original child at position
10556C<pos>.
10557
10558The partial schedule of a band node can be scaled (down) or reduced using
10559the following functions.
10560
10561	#include <isl/schedule_node.h>
10562	__isl_give isl_schedule_node *
10563	isl_schedule_node_band_scale(
10564		__isl_take isl_schedule_node *node,
10565		__isl_take isl_multi_val *mv);
10566	__isl_give isl_schedule_node *
10567	isl_schedule_node_band_scale_down(
10568		__isl_take isl_schedule_node *node,
10569		__isl_take isl_multi_val *mv);
10570	__isl_give isl_schedule_node *
10571	isl_schedule_node_band_mod(
10572		__isl_take isl_schedule_node *node,
10573		__isl_take isl_multi_val *mv);
10574
10575The spaces of the two arguments need to match.
10576After scaling, the partial schedule is replaced by its greatest
10577integer part to ensure that the schedule remains integral.
10578
10579The partial schedule of a band node can be shifted by an
10580C<isl_multi_union_pw_aff> with a domain that is a superset
10581of the domain of the partial schedule using
10582the following function.
10583
10584	#include <isl/schedule_node.h>
10585	__isl_give isl_schedule_node *
10586	isl_schedule_node_band_shift(
10587		__isl_take isl_schedule_node *node,
10588		__isl_take isl_multi_union_pw_aff *shift);
10589
10590A band node can be tiled using the following function.
10591
10592	#include <isl/schedule_node.h>
10593	__isl_give isl_schedule_node *isl_schedule_node_band_tile(
10594		__isl_take isl_schedule_node *node,
10595		__isl_take isl_multi_val *sizes);
10596
10597	isl_stat isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
10598		int val);
10599	int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
10600	isl_stat isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
10601		int val);
10602	int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
10603
10604The C<isl_schedule_node_band_tile> function tiles
10605the band using the given tile sizes inside its schedule.
10606A new child band node is created to represent the point loops and it is
10607inserted between the modified band and its children.
10608The subtree rooted at the given node is assumed not to have
10609any anchored nodes.
10610The C<tile_scale_tile_loops> option specifies whether the tile
10611loops iterators should be scaled by the tile sizes.
10612If the C<tile_shift_point_loops> option is set, then the point loops
10613are shifted to start at zero.
10614
10615A band node can be split into two nested band nodes
10616using the following function.
10617
10618	#include <isl/schedule_node.h>
10619	__isl_give isl_schedule_node *isl_schedule_node_band_split(
10620		__isl_take isl_schedule_node *node, int pos);
10621
10622The resulting outer band node contains the first C<pos> dimensions of
10623the schedule of C<node> while the inner band contains the remaining dimensions.
10624The schedules of the two band nodes live in anonymous spaces.
10625The loop AST generation type options and the isolate option
10626are split over the two band nodes.
10627
10628A band node can be moved down to the leaves of the subtree rooted
10629at the band node using the following function.
10630
10631	#include <isl/schedule_node.h>
10632	__isl_give isl_schedule_node *isl_schedule_node_band_sink(
10633		__isl_take isl_schedule_node *node);
10634
10635The subtree rooted at the given node is assumed not to have
10636any anchored nodes.
10637The result points to the node in the resulting tree that is in the same
10638position as the node pointed to by C<node> in the original tree.
10639
10640	#include <isl/schedule_node.h>
10641	__isl_give isl_schedule_node *
10642	isl_schedule_node_order_before(
10643		__isl_take isl_schedule_node *node,
10644		__isl_take isl_union_set *filter);
10645	__isl_give isl_schedule_node *
10646	isl_schedule_node_order_after(
10647		__isl_take isl_schedule_node *node,
10648		__isl_take isl_union_set *filter);
10649
10650These functions split the domain elements that reach C<node>
10651into those that satisfy C<filter> and those that do not and
10652arranges for the elements that do satisfy the filter to be
10653executed before (in case of C<isl_schedule_node_order_before>)
10654or after (in case of C<isl_schedule_node_order_after>)
10655those that do not.  The order is imposed by
10656a sequence node, possibly reusing the grandparent of C<node>
10657on two copies of the subtree attached to the original C<node>.
10658Both copies are simplified with respect to their filter.
10659
10660Return a pointer to the copy of the subtree that does not
10661satisfy C<filter>.  If there is no such copy (because all
10662reaching domain elements satisfy the filter), then return
10663the original pointer.
10664
10665	#include <isl/schedule_node.h>
10666	__isl_give isl_schedule_node *
10667	isl_schedule_node_graft_before(
10668		__isl_take isl_schedule_node *node,
10669		__isl_take isl_schedule_node *graft);
10670	__isl_give isl_schedule_node *
10671	isl_schedule_node_graft_after(
10672		__isl_take isl_schedule_node *node,
10673		__isl_take isl_schedule_node *graft);
10674
10675This function inserts the C<graft> tree into the tree containing C<node>
10676such that it is executed before (in case of C<isl_schedule_node_graft_before>)
10677or after (in case of C<isl_schedule_node_graft_after>) C<node>.
10678The root node of C<graft>
10679should be an extension node where the domain of the extension
10680is the flat product of all outer band nodes of C<node>.
10681The root node may also be a domain node.
10682The elements of the domain or the range of the extension may not
10683intersect with the domain elements that reach "node".
10684The schedule tree of C<graft> may not be anchored.
10685
10686The schedule tree of C<node> is modified to include an extension node
10687corresponding to the root node of C<graft> as a child of the original
10688parent of C<node>.  The original node that C<node> points to and the
10689child of the root node of C<graft> are attached to this extension node
10690through a sequence, with appropriate filters and with the child
10691of C<graft> appearing before or after the original C<node>.
10692
10693If C<node> already appears inside a sequence that is the child of
10694an extension node and if the spaces of the new domain elements
10695do not overlap with those of the original domain elements,
10696then that extension node is extended with the new extension
10697rather than introducing a new segment of extension and sequence nodes.
10698
10699Return a pointer to the same node in the modified tree that
10700C<node> pointed to in the original tree.
10701
10702A representation of the schedule node can be printed using
10703
10704	#include <isl/schedule_node.h>
10705	__isl_give isl_printer *isl_printer_print_schedule_node(
10706		__isl_take isl_printer *p,
10707		__isl_keep isl_schedule_node *node);
10708	__isl_give char *isl_schedule_node_to_str(
10709		__isl_keep isl_schedule_node *node);
10710
10711C<isl_schedule_node_to_str> prints the schedule node in block format.
10712
10713=head2 Dependence Analysis
10714
10715C<isl> contains specialized functionality for performing
10716array dataflow analysis.  That is, given a I<sink> access relation,
10717a collection of possible I<source> accesses and
10718a collection of I<kill> accesses,
10719C<isl> can compute relations that describe
10720for each iteration of the sink access, which iterations
10721of which of the source access relations may have
10722accessed the same data element before the given iteration
10723of the sink access without any intermediate kill of that data element.
10724The resulting dependence relations map source iterations
10725to either the corresponding sink iterations or
10726pairs of corresponding sink iterations and accessed data elements.
10727To compute standard flow dependences, the sink should be
10728a read, while the sources should be writes.
10729If no kills are specified,
10730then memory based dependence analysis is performed.
10731If, on the other hand, all sources are also kills,
10732then value based dependence analysis is performed.
10733If any of the source accesses are marked as being I<must>
10734accesses, then they are also treated as kills.
10735Furthermore, the specification of must-sources results
10736in the computation of must-dependences.
10737Only dependences originating in a must access not coscheduled
10738with any other access to the same element and without
10739any may accesses between the must access and the sink access
10740are considered to be must dependences.
10741
10742=head3 High-level Interface
10743
10744A high-level interface to dependence analysis is provided
10745by the following function.
10746
10747	#include <isl/flow.h>
10748	__isl_give isl_union_flow *
10749	isl_union_access_info_compute_flow(
10750		__isl_take isl_union_access_info *access);
10751
10752The input C<isl_union_access_info> object describes the sink
10753access relations, the source access relations and a schedule,
10754while the output C<isl_union_flow> object describes
10755the resulting dependence relations and the subsets of the
10756sink relations for which no source was found.
10757
10758An C<isl_union_access_info> is created, modified, copied and freed using
10759the following functions.
10760
10761	#include <isl/flow.h>
10762	__isl_give isl_union_access_info *
10763	isl_union_access_info_from_sink(
10764		__isl_take isl_union_map *sink);
10765	__isl_give isl_union_access_info *
10766	isl_union_access_info_set_kill(
10767		__isl_take isl_union_access_info *access,
10768		__isl_take isl_union_map *kill);
10769	__isl_give isl_union_access_info *
10770	isl_union_access_info_set_may_source(
10771		__isl_take isl_union_access_info *access,
10772		__isl_take isl_union_map *may_source);
10773	__isl_give isl_union_access_info *
10774	isl_union_access_info_set_must_source(
10775		__isl_take isl_union_access_info *access,
10776		__isl_take isl_union_map *must_source);
10777	__isl_give isl_union_access_info *
10778	isl_union_access_info_set_schedule(
10779		__isl_take isl_union_access_info *access,
10780		__isl_take isl_schedule *schedule);
10781	__isl_give isl_union_access_info *
10782	isl_union_access_info_set_schedule_map(
10783		__isl_take isl_union_access_info *access,
10784		__isl_take isl_union_map *schedule_map);
10785	__isl_give isl_union_access_info *
10786	isl_union_access_info_copy(
10787		__isl_keep isl_union_access_info *access);
10788	__isl_null isl_union_access_info *
10789	isl_union_access_info_free(
10790		__isl_take isl_union_access_info *access);
10791
10792The may sources set by C<isl_union_access_info_set_may_source>
10793do not need to include the must sources set by
10794C<isl_union_access_info_set_must_source> as a subset.
10795The kills set by C<isl_union_access_info_set_kill> may overlap
10796with the may-sources and/or must-sources.
10797The user is free not to call one (or more) of these functions,
10798in which case the corresponding set is kept to its empty default.
10799Similarly, the default schedule initialized by
10800C<isl_union_access_info_from_sink> is empty.
10801The current schedule is determined by the last call to either
10802C<isl_union_access_info_set_schedule> or
10803C<isl_union_access_info_set_schedule_map>.
10804The domain of the schedule corresponds to the domains of
10805the access relations.  In particular, the domains of the access
10806relations are effectively intersected with the domain of the schedule
10807and only the resulting accesses are considered by the dependence analysis.
10808
10809An C<isl_union_access_info> object can be read from input
10810using the following function.
10811
10812	#include <isl/flow.h>
10813	__isl_give isl_union_access_info *
10814	isl_union_access_info_read_from_file(isl_ctx *ctx,
10815		FILE *input);
10816
10817A representation of the information contained in an object
10818of type C<isl_union_access_info> can be obtained using
10819
10820	#include <isl/flow.h>
10821	__isl_give isl_printer *
10822	isl_printer_print_union_access_info(
10823		__isl_take isl_printer *p,
10824		__isl_keep isl_union_access_info *access);
10825	__isl_give char *isl_union_access_info_to_str(
10826		__isl_keep isl_union_access_info *access);
10827
10828C<isl_union_access_info_to_str> prints the information in flow format.
10829
10830The output of C<isl_union_access_info_compute_flow> can be examined,
10831copied, and freed using the following functions.
10832
10833	#include <isl/flow.h>
10834	__isl_give isl_union_map *isl_union_flow_get_must_dependence(
10835		__isl_keep isl_union_flow *flow);
10836	__isl_give isl_union_map *isl_union_flow_get_may_dependence(
10837		__isl_keep isl_union_flow *flow);
10838	__isl_give isl_union_map *
10839	isl_union_flow_get_full_must_dependence(
10840		__isl_keep isl_union_flow *flow);
10841	__isl_give isl_union_map *
10842	isl_union_flow_get_full_may_dependence(
10843		__isl_keep isl_union_flow *flow);
10844	__isl_give isl_union_map *isl_union_flow_get_must_no_source(
10845		__isl_keep isl_union_flow *flow);
10846	__isl_give isl_union_map *isl_union_flow_get_may_no_source(
10847		__isl_keep isl_union_flow *flow);
10848	__isl_give isl_union_flow *isl_union_flow_copy(
10849		__isl_keep isl_union_flow *flow);
10850	__isl_null isl_union_flow *isl_union_flow_free(
10851		__isl_take isl_union_flow *flow);
10852
10853The relation returned by C<isl_union_flow_get_must_dependence>
10854relates domain elements of must sources to domain elements of the sink.
10855The relation returned by C<isl_union_flow_get_may_dependence>
10856relates domain elements of must or may sources to domain elements of the sink
10857and includes the previous relation as a subset.
10858The relation returned by C<isl_union_flow_get_full_must_dependence>
10859relates domain elements of must sources to pairs of domain elements of the sink
10860and accessed data elements.
10861The relation returned by C<isl_union_flow_get_full_may_dependence>
10862relates domain elements of must or may sources to pairs of
10863domain elements of the sink and accessed data elements.
10864This relation includes the previous relation as a subset.
10865The relation returned by C<isl_union_flow_get_must_no_source> is the subset
10866of the sink relation for which no dependences have been found.
10867The relation returned by C<isl_union_flow_get_may_no_source> is the subset
10868of the sink relation for which no definite dependences have been found.
10869That is, it contains those sink access that do not contribute to any
10870of the elements in the relation returned
10871by C<isl_union_flow_get_must_dependence>.
10872
10873A representation of the information contained in an object
10874of type C<isl_union_flow> can be obtained using
10875
10876	#include <isl/flow.h>
10877	__isl_give isl_printer *isl_printer_print_union_flow(
10878		__isl_take isl_printer *p,
10879		__isl_keep isl_union_flow *flow);
10880	__isl_give char *isl_union_flow_to_str(
10881		__isl_keep isl_union_flow *flow);
10882
10883C<isl_union_flow_to_str> prints the information in flow format.
10884
10885=head3 Low-level Interface
10886
10887A lower-level interface is provided by the following functions.
10888
10889	#include <isl/flow.h>
10890
10891	typedef int (*isl_access_level_before)(void *first, void *second);
10892
10893	__isl_give isl_access_info *isl_access_info_alloc(
10894		__isl_take isl_map *sink,
10895		void *sink_user, isl_access_level_before fn,
10896		int max_source);
10897	__isl_give isl_access_info *isl_access_info_add_source(
10898		__isl_take isl_access_info *acc,
10899		__isl_take isl_map *source, int must,
10900		void *source_user);
10901	__isl_null isl_access_info *isl_access_info_free(
10902		__isl_take isl_access_info *acc);
10903
10904	__isl_give isl_flow *isl_access_info_compute_flow(
10905		__isl_take isl_access_info *acc);
10906
10907	isl_stat isl_flow_foreach(__isl_keep isl_flow *deps,
10908		isl_stat (*fn)(__isl_take isl_map *dep, int must,
10909			  void *dep_user, void *user),
10910		void *user);
10911	__isl_give isl_map *isl_flow_get_no_source(
10912		__isl_keep isl_flow *deps, int must);
10913	__isl_null isl_flow *isl_flow_free(
10914		__isl_take isl_flow *deps);
10915
10916The function C<isl_access_info_compute_flow> performs the actual
10917dependence analysis.  The other functions are used to construct
10918the input for this function or to read off the output.
10919
10920The input is collected in an C<isl_access_info>, which can
10921be created through a call to C<isl_access_info_alloc>.
10922The arguments to this functions are the sink access relation
10923C<sink>, a token C<sink_user> used to identify the sink
10924access to the user, a callback function for specifying the
10925relative order of source and sink accesses, and the number
10926of source access relations that will be added.
10927
10928The callback function has type C<int (*)(void *first, void *second)>.
10929The function is called with two user supplied tokens identifying
10930either a source or the sink and it should return the shared nesting
10931level and the relative order of the two accesses.
10932In particular, let I<n> be the number of loops shared by
10933the two accesses.  If C<first> precedes C<second> textually,
10934then the function should return I<2 * n + 1>; otherwise,
10935it should return I<2 * n>.
10936The low-level interface assumes that no sources are coscheduled.
10937If the information returned by the callback does not allow
10938the relative order to be determined, then one of the sources
10939is arbitrarily taken to be executed after the other(s).
10940
10941The sources can be added to the C<isl_access_info> object by performing
10942(at most) C<max_source> calls to C<isl_access_info_add_source>.
10943C<must> indicates whether the source is a I<must> access
10944or a I<may> access.  Note that a multi-valued access relation
10945should only be marked I<must> if every iteration in the domain
10946of the relation accesses I<all> elements in its image.
10947The C<source_user> token is again used to identify
10948the source access.  The range of the source access relation
10949C<source> should have the same dimension as the range
10950of the sink access relation.
10951The C<isl_access_info_free> function should usually not be
10952called explicitly, because it is already called implicitly by
10953C<isl_access_info_compute_flow>.
10954
10955The result of the dependence analysis is collected in an
10956C<isl_flow>.  There may be elements of
10957the sink access for which no preceding source access could be
10958found or for which all preceding sources are I<may> accesses.
10959The relations containing these elements can be obtained through
10960calls to C<isl_flow_get_no_source>, the first with C<must> set
10961and the second with C<must> unset.
10962In the case of standard flow dependence analysis,
10963with the sink a read and the sources I<must> writes,
10964the first relation corresponds to the reads from uninitialized
10965array elements and the second relation is empty.
10966The actual flow dependences can be extracted using
10967C<isl_flow_foreach>.  This function will call the user-specified
10968callback function C<fn> for each B<non-empty> dependence between
10969a source and the sink.  The callback function is called
10970with four arguments, the actual flow dependence relation
10971mapping source iterations to sink iterations, a boolean that
10972indicates whether it is a I<must> or I<may> dependence, a token
10973identifying the source and an additional C<void *> with value
10974equal to the third argument of the C<isl_flow_foreach> call.
10975A dependence is marked I<must> if it originates from a I<must>
10976source and if it is not followed by any I<may> sources.
10977
10978After finishing with an C<isl_flow>, the user should call
10979C<isl_flow_free> to free all associated memory.
10980
10981=head3 Interaction with the Low-level Interface
10982
10983During the dependence analysis, we frequently need to perform
10984the following operation.  Given a relation between sink iterations
10985and potential source iterations from a particular source domain,
10986what is the last potential source iteration corresponding to each
10987sink iteration.  It can sometimes be convenient to adjust
10988the set of potential source iterations before or after each such operation.
10989The prototypical example is fuzzy array dataflow analysis,
10990where we need to analyze if, based on data-dependent constraints,
10991the sink iteration can ever be executed without one or more of
10992the corresponding potential source iterations being executed.
10993If so, we can introduce extra parameters and select an unknown
10994but fixed source iteration from the potential source iterations.
10995To be able to perform such manipulations, C<isl> provides the following
10996function.
10997
10998	#include <isl/flow.h>
10999
11000	typedef __isl_give isl_restriction *(*isl_access_restrict)(
11001		__isl_keep isl_map *source_map,
11002		__isl_keep isl_set *sink, void *source_user,
11003		void *user);
11004	__isl_give isl_access_info *isl_access_info_set_restrict(
11005		__isl_take isl_access_info *acc,
11006		isl_access_restrict fn, void *user);
11007
11008The function C<isl_access_info_set_restrict> should be called
11009before calling C<isl_access_info_compute_flow> and registers a callback function
11010that will be called any time C<isl> is about to compute the last
11011potential source.  The first argument is the (reverse) proto-dependence,
11012mapping sink iterations to potential source iterations.
11013The second argument represents the sink iterations for which
11014we want to compute the last source iteration.
11015The third argument is the token corresponding to the source
11016and the final argument is the token passed to C<isl_access_info_set_restrict>.
11017The callback is expected to return a restriction on either the input or
11018the output of the operation computing the last potential source.
11019If the input needs to be restricted then restrictions are needed
11020for both the source and the sink iterations.  The sink iterations
11021and the potential source iterations will be intersected with these sets.
11022If the output needs to be restricted then only a restriction on the source
11023iterations is required.
11024If any error occurs, the callback should return C<NULL>.
11025An C<isl_restriction> object can be created, freed and inspected
11026using the following functions.
11027
11028	#include <isl/flow.h>
11029
11030	__isl_give isl_restriction *isl_restriction_input(
11031		__isl_take isl_set *source_restr,
11032		__isl_take isl_set *sink_restr);
11033	__isl_give isl_restriction *isl_restriction_output(
11034		__isl_take isl_set *source_restr);
11035	__isl_give isl_restriction *isl_restriction_none(
11036		__isl_take isl_map *source_map);
11037	__isl_give isl_restriction *isl_restriction_empty(
11038		__isl_take isl_map *source_map);
11039	__isl_null isl_restriction *isl_restriction_free(
11040		__isl_take isl_restriction *restr);
11041
11042C<isl_restriction_none> and C<isl_restriction_empty> are special
11043cases of C<isl_restriction_input>.  C<isl_restriction_none>
11044is essentially equivalent to
11045
11046	isl_restriction_input(isl_set_universe(
11047	    isl_space_range(isl_map_get_space(source_map))),
11048			    isl_set_universe(
11049	    isl_space_domain(isl_map_get_space(source_map))));
11050
11051whereas C<isl_restriction_empty> is essentially equivalent to
11052
11053	isl_restriction_input(isl_set_empty(
11054	    isl_space_range(isl_map_get_space(source_map))),
11055			    isl_set_universe(
11056	    isl_space_domain(isl_map_get_space(source_map))));
11057
11058=head2 Scheduling
11059
11060	#include <isl/schedule.h>
11061	__isl_give isl_schedule *
11062	isl_schedule_constraints_compute_schedule(
11063		__isl_take isl_schedule_constraints *sc);
11064
11065The function C<isl_schedule_constraints_compute_schedule> can be
11066used to compute a schedule that satisfies the given schedule constraints.
11067These schedule constraints include the iteration domain for which
11068a schedule should be computed and dependences between pairs of
11069iterations.  In particular, these dependences include
11070I<validity> dependences and I<proximity> dependences.
11071By default, the algorithm used to construct the schedule is similar
11072to that of C<Pluto>.
11073Alternatively, Feautrier's multi-dimensional scheduling algorithm can
11074be selected.
11075The generated schedule respects all validity dependences.
11076That is, all dependence distances over these dependences in the
11077scheduled space are lexicographically positive.
11078
11079The default algorithm tries to ensure that the dependence distances
11080over coincidence constraints are zero and to minimize the
11081dependence distances over proximity dependences.
11082Moreover, it tries to obtain sequences (bands) of schedule dimensions
11083for groups of domains where the dependence distances over validity
11084dependences have only non-negative values.
11085Note that when minimizing the maximal dependence distance
11086over proximity dependences, a single affine expression in the parameters
11087is constructed that bounds all dependence distances.  If no such expression
11088exists, then the algorithm will fail and resort to an alternative
11089scheduling algorithm.  In particular, this means that adding proximity
11090dependences may eliminate valid solutions.  A typical example where this
11091phenomenon may occur is when some subset of the proximity dependences
11092has no restriction on some parameter, forcing the coefficient of that
11093parameter to be zero, while some other subset forces the dependence
11094distance to depend on that parameter, requiring the same coefficient
11095to be non-zero.
11096When using Feautrier's algorithm, the coincidence and proximity constraints
11097are only taken into account during the extension to a
11098full-dimensional schedule.
11099
11100An C<isl_schedule_constraints> object can be constructed
11101and manipulated using the following functions.
11102
11103	#include <isl/schedule.h>
11104	__isl_give isl_schedule_constraints *
11105	isl_schedule_constraints_copy(
11106		__isl_keep isl_schedule_constraints *sc);
11107	__isl_give isl_schedule_constraints *
11108	isl_schedule_constraints_on_domain(
11109		__isl_take isl_union_set *domain);
11110	__isl_give isl_schedule_constraints *
11111	isl_schedule_constraints_set_context(
11112		__isl_take isl_schedule_constraints *sc,
11113		__isl_take isl_set *context);
11114	__isl_give isl_schedule_constraints *
11115	isl_schedule_constraints_set_validity(
11116		__isl_take isl_schedule_constraints *sc,
11117		__isl_take isl_union_map *validity);
11118	__isl_give isl_schedule_constraints *
11119	isl_schedule_constraints_set_coincidence(
11120		__isl_take isl_schedule_constraints *sc,
11121		__isl_take isl_union_map *coincidence);
11122	__isl_give isl_schedule_constraints *
11123	isl_schedule_constraints_set_proximity(
11124		__isl_take isl_schedule_constraints *sc,
11125		__isl_take isl_union_map *proximity);
11126	__isl_give isl_schedule_constraints *
11127	isl_schedule_constraints_set_conditional_validity(
11128		__isl_take isl_schedule_constraints *sc,
11129		__isl_take isl_union_map *condition,
11130		__isl_take isl_union_map *validity);
11131	__isl_give isl_schedule_constraints *
11132	isl_schedule_constraints_apply(
11133		__isl_take isl_schedule_constraints *sc,
11134		__isl_take isl_union_map *umap);
11135	__isl_null isl_schedule_constraints *
11136	isl_schedule_constraints_free(
11137		__isl_take isl_schedule_constraints *sc);
11138
11139The initial C<isl_schedule_constraints> object created by
11140C<isl_schedule_constraints_on_domain> does not impose any constraints.
11141That is, it has an empty set of dependences.
11142The function C<isl_schedule_constraints_set_context> allows the user
11143to specify additional constraints on the parameters that may
11144be assumed to hold during the construction of the schedule.
11145The function C<isl_schedule_constraints_set_validity> replaces the
11146validity dependences, mapping domain elements I<i> to domain
11147elements that should be scheduled after I<i>.
11148The function C<isl_schedule_constraints_set_coincidence> replaces the
11149coincidence dependences, mapping domain elements I<i> to domain
11150elements that should be scheduled together with I<I>, if possible.
11151The function C<isl_schedule_constraints_set_proximity> replaces the
11152proximity dependences, mapping domain elements I<i> to domain
11153elements that should be scheduled either before I<I>
11154or as early as possible after I<i>.
11155
11156The function C<isl_schedule_constraints_set_conditional_validity>
11157replaces the conditional validity constraints.
11158A conditional validity constraint is only imposed when any of the corresponding
11159conditions is satisfied, i.e., when any of them is non-zero.
11160That is, the scheduler ensures that within each band if the dependence
11161distances over the condition constraints are not all zero
11162then all corresponding conditional validity constraints are respected.
11163A conditional validity constraint corresponds to a condition
11164if the two are adjacent, i.e., if the domain of one relation intersect
11165the range of the other relation.
11166The typical use case of conditional validity constraints is
11167to allow order constraints between live ranges to be violated
11168as long as the live ranges themselves are local to the band.
11169To allow more fine-grained control over which conditions correspond
11170to which conditional validity constraints, the domains and ranges
11171of these relations may include I<tags>.  That is, the domains and
11172ranges of those relation may themselves be wrapped relations
11173where the iteration domain appears in the domain of those wrapped relations
11174and the range of the wrapped relations can be arbitrarily chosen
11175by the user.  Conditions and conditional validity constraints are only
11176considered adjacent to each other if the entire wrapped relation matches.
11177In particular, a relation with a tag will never be considered adjacent
11178to a relation without a tag.
11179
11180The function C<isl_schedule_constraints_apply> takes
11181schedule constraints that are defined on some set of domain elements
11182and transforms them to schedule constraints on the elements
11183to which these domain elements are mapped by the given transformation.
11184
11185An C<isl_schedule_constraints> object can be inspected
11186using the following functions.
11187
11188	#include <isl/schedule.h>
11189	__isl_give isl_union_set *
11190	isl_schedule_constraints_get_domain(
11191		__isl_keep isl_schedule_constraints *sc);
11192	__isl_give isl_set *isl_schedule_constraints_get_context(
11193		__isl_keep isl_schedule_constraints *sc);
11194	__isl_give isl_union_map *
11195	isl_schedule_constraints_get_validity(
11196		__isl_keep isl_schedule_constraints *sc);
11197	__isl_give isl_union_map *
11198	isl_schedule_constraints_get_coincidence(
11199		__isl_keep isl_schedule_constraints *sc);
11200	__isl_give isl_union_map *
11201	isl_schedule_constraints_get_proximity(
11202		__isl_keep isl_schedule_constraints *sc);
11203	__isl_give isl_union_map *
11204	isl_schedule_constraints_get_conditional_validity(
11205		__isl_keep isl_schedule_constraints *sc);
11206	__isl_give isl_union_map *
11207	isl_schedule_constraints_get_conditional_validity_condition(
11208		__isl_keep isl_schedule_constraints *sc);
11209
11210An C<isl_schedule_constraints> object can be read from input
11211using the following functions.
11212
11213	#include <isl/schedule.h>
11214	__isl_give isl_schedule_constraints *
11215	isl_schedule_constraints_read_from_str(isl_ctx *ctx,
11216		const char *str);
11217	__isl_give isl_schedule_constraints *
11218	isl_schedule_constraints_read_from_file(isl_ctx *ctx,
11219		FILE *input);
11220
11221The contents of an C<isl_schedule_constraints> object can be printed
11222using the following functions.
11223
11224	#include <isl/schedule.h>
11225	__isl_give isl_printer *
11226	isl_printer_print_schedule_constraints(
11227		__isl_take isl_printer *p,
11228		__isl_keep isl_schedule_constraints *sc);
11229	__isl_give char *isl_schedule_constraints_to_str(
11230		__isl_keep isl_schedule_constraints *sc);
11231
11232The following function computes a schedule directly from
11233an iteration domain and validity and proximity dependences
11234and is implemented in terms of the functions described above.
11235The use of C<isl_union_set_compute_schedule> is discouraged.
11236
11237	#include <isl/schedule.h>
11238	__isl_give isl_schedule *isl_union_set_compute_schedule(
11239		__isl_take isl_union_set *domain,
11240		__isl_take isl_union_map *validity,
11241		__isl_take isl_union_map *proximity);
11242
11243The generated schedule represents a schedule tree.
11244For more information on schedule trees, see
11245L</"Schedule Trees">.
11246
11247=head3 Options
11248
11249	#include <isl/schedule.h>
11250	isl_stat isl_options_set_schedule_max_coefficient(
11251		isl_ctx *ctx, int val);
11252	int isl_options_get_schedule_max_coefficient(
11253		isl_ctx *ctx);
11254	isl_stat isl_options_set_schedule_max_constant_term(
11255		isl_ctx *ctx, int val);
11256	int isl_options_get_schedule_max_constant_term(
11257		isl_ctx *ctx);
11258	isl_stat isl_options_set_schedule_serialize_sccs(
11259		isl_ctx *ctx, int val);
11260	int isl_options_get_schedule_serialize_sccs(isl_ctx *ctx);
11261	isl_stat isl_options_set_schedule_whole_component(
11262		isl_ctx *ctx, int val);
11263	int isl_options_get_schedule_whole_component(
11264		isl_ctx *ctx);
11265	isl_stat isl_options_set_schedule_maximize_band_depth(
11266		isl_ctx *ctx, int val);
11267	int isl_options_get_schedule_maximize_band_depth(
11268		isl_ctx *ctx);
11269	isl_stat isl_options_set_schedule_maximize_coincidence(
11270		isl_ctx *ctx, int val);
11271	int isl_options_get_schedule_maximize_coincidence(
11272		isl_ctx *ctx);
11273	isl_stat isl_options_set_schedule_outer_coincidence(
11274		isl_ctx *ctx, int val);
11275	int isl_options_get_schedule_outer_coincidence(
11276		isl_ctx *ctx);
11277	isl_stat isl_options_set_schedule_split_scaled(
11278		isl_ctx *ctx, int val);
11279	int isl_options_get_schedule_split_scaled(
11280		isl_ctx *ctx);
11281	isl_stat isl_options_set_schedule_treat_coalescing(
11282		isl_ctx *ctx, int val);
11283	int isl_options_get_schedule_treat_coalescing(
11284		isl_ctx *ctx);
11285	isl_stat isl_options_set_schedule_algorithm(
11286		isl_ctx *ctx, int val);
11287	int isl_options_get_schedule_algorithm(
11288		isl_ctx *ctx);
11289	isl_stat isl_options_set_schedule_carry_self_first(
11290		isl_ctx *ctx, int val);
11291	int isl_options_get_schedule_carry_self_first(
11292		isl_ctx *ctx);
11293	isl_stat isl_options_set_schedule_separate_components(
11294		isl_ctx *ctx, int val);
11295	int isl_options_get_schedule_separate_components(
11296		isl_ctx *ctx);
11297
11298=over
11299
11300=item * schedule_max_coefficient
11301
11302This option enforces that the coefficients for variable and parameter
11303dimensions in the calculated schedule are not larger than the specified value.
11304This option can significantly increase the speed of the scheduling calculation
11305and may also prevent fusing of unrelated dimensions. A value of -1 means that
11306this option does not introduce bounds on the variable or parameter
11307coefficients.
11308This option has no effect on the Feautrier style scheduler.
11309
11310=item * schedule_max_constant_term
11311
11312This option enforces that the constant coefficients in the calculated schedule
11313are not larger than the maximal constant term. This option can significantly
11314increase the speed of the scheduling calculation and may also prevent fusing of
11315unrelated dimensions. A value of -1 means that this option does not introduce
11316bounds on the constant coefficients.
11317
11318=item * schedule_serialize_sccs
11319
11320If this option is set, then all strongly connected components
11321in the dependence graph are serialized as soon as they are detected.
11322This means in particular that instances of statements will only
11323appear in the same band node if these statements belong
11324to the same strongly connected component at the point where
11325the band node is constructed.
11326
11327=item * schedule_whole_component
11328
11329If this option is set, then entire (weakly) connected
11330components in the dependence graph are scheduled together
11331as a whole.
11332Otherwise, each strongly connected component within
11333such a weakly connected component is first scheduled separately
11334and then combined with other strongly connected components.
11335This option has no effect if C<schedule_serialize_sccs> is set.
11336
11337=item * schedule_maximize_band_depth
11338
11339If this option is set, then the scheduler tries to maximize
11340the width of the bands.  Wider bands give more possibilities for tiling.
11341In particular, if the C<schedule_whole_component> option is set,
11342then bands are split if this might result in wider bands.
11343Otherwise, the effect of this option is to only allow
11344strongly connected components to be combined if this does
11345not reduce the width of the bands.
11346Note that if the C<schedule_serialize_sccs> options is set, then
11347the C<schedule_maximize_band_depth> option therefore has no effect.
11348
11349=item * schedule_maximize_coincidence
11350
11351This option is only effective if the C<schedule_whole_component>
11352option is turned off.
11353If the C<schedule_maximize_coincidence> option is set, then (clusters of)
11354strongly connected components are only combined with each other
11355if this does not reduce the number of coincident band members.
11356
11357=item * schedule_outer_coincidence
11358
11359If this option is set, then we try to construct schedules
11360where the outermost scheduling dimension in each band
11361satisfies the coincidence constraints.
11362
11363=item * schedule_algorithm
11364
11365Selects the scheduling algorithm to be used.
11366Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
11367and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
11368
11369=item * schedule_split_scaled
11370
11371If this option is set, then we try to construct schedules in which the
11372constant term is split off from the linear part if the linear parts of
11373the scheduling rows for all nodes in the graph have a common non-trivial
11374divisor.
11375The constant term is then dropped and the linear
11376part is reduced.
11377This option is only effective when the Feautrier style scheduler is
11378being used, either as the main scheduler or as a fallback for the
11379Pluto-like scheduler.
11380
11381=item * schedule_treat_coalescing
11382
11383If this option is set, then the scheduler will try and avoid
11384producing schedules that perform loop coalescing.
11385In particular, for the Pluto-like scheduler, this option places
11386bounds on the schedule coefficients based on the sizes of the instance sets.
11387For the Feautrier style scheduler, this option detects potentially
11388coalescing schedules and then tries to adjust the schedule to avoid
11389the coalescing.
11390
11391=item * schedule_carry_self_first
11392
11393If this option is set, then the Feautrier style scheduler
11394(when used as a fallback for the Pluto-like scheduler) will
11395first try to only carry self-dependences.
11396
11397=item * schedule_separate_components
11398
11399If this option is set then the function C<isl_schedule_get_map>
11400will treat set nodes in the same way as sequence nodes.
11401
11402=back
11403
11404=head2 AST Generation
11405
11406This section describes the C<isl> functionality for generating
11407ASTs that visit all the elements
11408in a domain in an order specified by a schedule tree or
11409a schedule map.
11410In case the schedule given as a C<isl_union_map>, an AST is generated
11411that visits all the elements in the domain of the C<isl_union_map>
11412according to the lexicographic order of the corresponding image
11413element(s).  If the range of the C<isl_union_map> consists of
11414elements in more than one space, then each of these spaces is handled
11415separately in an arbitrary order.
11416It should be noted that the schedule tree or the image elements
11417in a schedule map only specify the I<order>
11418in which the corresponding domain elements should be visited.
11419No direct relation between the partial schedule values
11420or the image elements on the one hand and the loop iterators
11421in the generated AST on the other hand should be assumed.
11422
11423Each AST is generated within a build.  The initial build
11424simply specifies the constraints on the parameters (if any)
11425and can be created, inspected, copied and freed using the following functions.
11426
11427	#include <isl/ast_build.h>
11428	__isl_give isl_ast_build *isl_ast_build_alloc(
11429		isl_ctx *ctx);
11430	__isl_give isl_ast_build *isl_ast_build_from_context(
11431		__isl_take isl_set *set);
11432	__isl_give isl_ast_build *isl_ast_build_copy(
11433		__isl_keep isl_ast_build *build);
11434	__isl_null isl_ast_build *isl_ast_build_free(
11435		__isl_take isl_ast_build *build);
11436
11437The C<set> argument is usually a parameter set with zero or more parameters.
11438In fact, when creating an AST using C<isl_ast_build_node_from_schedule>,
11439this set is required to be a parameter set.
11440An C<isl_ast_build> created using C<isl_ast_build_alloc> does not
11441specify any parameter constraints.
11442More C<isl_ast_build> functions are described in L</"Nested AST Generation">
11443and L</"Fine-grained Control over AST Generation">.
11444Finally, the AST itself can be constructed using one of the following
11445functions.
11446
11447	#include <isl/ast_build.h>
11448	__isl_give isl_ast_node *isl_ast_build_node_from_schedule(
11449		__isl_keep isl_ast_build *build,
11450		__isl_take isl_schedule *schedule);
11451	__isl_give isl_ast_node *
11452	isl_ast_build_node_from_schedule_map(
11453		__isl_keep isl_ast_build *build,
11454		__isl_take isl_union_map *schedule);
11455
11456=head3 Inspecting the AST
11457
11458The basic properties of an AST node can be obtained as follows.
11459
11460	#include <isl/ast.h>
11461	enum isl_ast_node_type isl_ast_node_get_type(
11462		__isl_keep isl_ast_node *node);
11463
11464The type of an AST node is one of
11465C<isl_ast_node_for>,
11466C<isl_ast_node_if>,
11467C<isl_ast_node_block>,
11468C<isl_ast_node_mark> or
11469C<isl_ast_node_user>.
11470An C<isl_ast_node_for> represents a for node.
11471An C<isl_ast_node_if> represents an if node.
11472An C<isl_ast_node_block> represents a compound node.
11473An C<isl_ast_node_mark> introduces a mark in the AST.
11474An C<isl_ast_node_user> represents an expression statement.
11475An expression statement typically corresponds to a domain element, i.e.,
11476one of the elements that is visited by the AST.
11477
11478Each type of node has its own additional properties.
11479
11480	#include <isl/ast.h>
11481	__isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
11482		__isl_keep isl_ast_node *node);
11483	__isl_give isl_ast_expr *isl_ast_node_for_get_init(
11484		__isl_keep isl_ast_node *node);
11485	__isl_give isl_ast_expr *isl_ast_node_for_get_cond(
11486		__isl_keep isl_ast_node *node);
11487	__isl_give isl_ast_expr *isl_ast_node_for_get_inc(
11488		__isl_keep isl_ast_node *node);
11489	__isl_give isl_ast_node *isl_ast_node_for_get_body(
11490		__isl_keep isl_ast_node *node);
11491	isl_bool isl_ast_node_for_is_degenerate(
11492		__isl_keep isl_ast_node *node);
11493
11494An C<isl_ast_for> is considered degenerate if it is known to execute
11495exactly once.
11496
11497	#include <isl/ast.h>
11498	__isl_give isl_ast_expr *isl_ast_node_if_get_cond(
11499		__isl_keep isl_ast_node *node);
11500	__isl_give isl_ast_node *isl_ast_node_if_get_then_node(
11501		__isl_keep isl_ast_node *node);
11502	__isl_give isl_ast_node *isl_ast_node_if_get_then(
11503		__isl_keep isl_ast_node *node);
11504	isl_bool isl_ast_node_if_has_else_node(
11505		__isl_keep isl_ast_node *node);
11506	isl_bool isl_ast_node_if_has_else(
11507		__isl_keep isl_ast_node *node);
11508	__isl_give isl_ast_node *isl_ast_node_if_get_else_node(
11509		__isl_keep isl_ast_node *node);
11510	__isl_give isl_ast_node *isl_ast_node_if_get_else(
11511		__isl_keep isl_ast_node *node);
11512
11513C<isl_ast_node_if_get_then>,
11514C<isl_ast_node_if_has_else> and
11515C<isl_ast_node_if_get_else>
11516are alternative names for
11517C<isl_ast_node_if_get_then_node>,
11518C<isl_ast_node_if_has_else_node> and
11519C<isl_ast_node_if_get_else_node>, respectively.
11520
11521	__isl_give isl_ast_node_list *
11522	isl_ast_node_block_get_children(
11523		__isl_keep isl_ast_node *node);
11524
11525	__isl_give isl_id *isl_ast_node_mark_get_id(
11526		__isl_keep isl_ast_node *node);
11527	__isl_give isl_ast_node *isl_ast_node_mark_get_node(
11528		__isl_keep isl_ast_node *node);
11529
11530C<isl_ast_node_mark_get_id> returns the identifier of the mark.
11531C<isl_ast_node_mark_get_node> returns the child node that is being marked.
11532
11533	#include <isl/ast.h>
11534	__isl_give isl_ast_expr *isl_ast_node_user_get_expr(
11535		__isl_keep isl_ast_node *node);
11536
11537All descendants of a specific node in the AST (including the node itself)
11538can be visited
11539in depth-first pre-order using the following function.
11540
11541	#include <isl/ast.h>
11542	isl_stat isl_ast_node_foreach_descendant_top_down(
11543		__isl_keep isl_ast_node *node,
11544		isl_bool (*fn)(__isl_keep isl_ast_node *node,
11545			void *user), void *user);
11546
11547The callback function should return C<isl_bool_true> if the children
11548of the given node should be visited and C<isl_bool_false> if they should not.
11549It should return C<isl_bool_error> in case of failure, in which case
11550the entire traversal is aborted.
11551
11552Each of the returned C<isl_ast_expr>s can in turn be inspected using
11553the following functions.
11554
11555	#include <isl/ast.h>
11556	enum isl_ast_expr_type isl_ast_expr_get_type(
11557		__isl_keep isl_ast_expr *expr);
11558
11559The type of an AST expression is one of
11560C<isl_ast_expr_op>,
11561C<isl_ast_expr_id> or
11562C<isl_ast_expr_int>.
11563An C<isl_ast_expr_op> represents the result of an operation.
11564An C<isl_ast_expr_id> represents an identifier.
11565An C<isl_ast_expr_int> represents an integer value.
11566
11567Each type of expression has its own additional properties.
11568
11569	#include <isl/ast.h>
11570	enum isl_ast_expr_op_type isl_ast_expr_op_get_type(
11571		__isl_keep isl_ast_expr *expr);
11572	enum isl_ast_expr_op_type isl_ast_expr_get_op_type(
11573		__isl_keep isl_ast_expr *expr);
11574	isl_size isl_ast_expr_op_get_n_arg(__isl_keep isl_ast_expr *expr);
11575	isl_size isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
11576	__isl_give isl_ast_expr *isl_ast_expr_op_get_arg(
11577		__isl_keep isl_ast_expr *expr, int pos);
11578	__isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
11579		__isl_keep isl_ast_expr *expr, int pos);
11580	isl_stat isl_ast_expr_foreach_ast_expr_op_type(
11581		__isl_keep isl_ast_expr *expr,
11582		isl_stat (*fn)(enum isl_ast_expr_op_type type,
11583			void *user), void *user);
11584	isl_stat isl_ast_expr_foreach_ast_op_type(
11585		__isl_keep isl_ast_expr *expr,
11586		isl_stat (*fn)(enum isl_ast_expr_op_type type,
11587			void *user), void *user);
11588	isl_stat isl_ast_node_foreach_ast_expr_op_type(
11589		__isl_keep isl_ast_node *node,
11590		isl_stat (*fn)(enum isl_ast_expr_op_type type,
11591			void *user), void *user);
11592	isl_stat isl_ast_node_foreach_ast_op_type(
11593		__isl_keep isl_ast_node *node,
11594		isl_stat (*fn)(enum isl_ast_expr_op_type type,
11595			void *user), void *user);
11596
11597C<isl_ast_expr_op_get_type> returns the type of the operation
11598performed.  C<isl_ast_expr_op_get_n_arg> returns the number of
11599arguments.  C<isl_ast_expr_get_op_arg> returns the specified
11600argument.
11601C<isl_ast_expr_get_op_type> is an alternative name for
11602C<isl_ast_expr_op_get_type>.
11603Similarly,
11604C<isl_ast_expr_get_op_n_arg> is an alternative name for
11605C<isl_ast_expr_op_get_n_arg> and
11606C<isl_ast_expr_get_op_arg> is an alternative name for
11607C<isl_ast_expr_op_get_arg>.
11608
11609C<isl_ast_expr_foreach_ast_expr_op_type> calls C<fn> for each distinct
11610C<isl_ast_expr_op_type> that appears in C<expr>.
11611C<isl_ast_expr_foreach_ast_op_type> is an alternative name for
11612C<isl_ast_expr_foreach_ast_expr_op_type>.
11613C<isl_ast_node_foreach_ast_expr_op_type> does the same for each distinct
11614C<isl_ast_expr_op_type> that appears in C<node>.
11615C<isl_ast_node_foreach_ast_op_type> is an alternative name for
11616C<isl_ast_node_foreach_ast_expr_op_type>.
11617The operation type is one of the following.
11618
11619=over
11620
11621=item C<isl_ast_expr_op_and>
11622
11623Logical I<and> of two arguments.
11624Both arguments can be evaluated.
11625
11626=item C<isl_ast_expr_op_and_then>
11627
11628Logical I<and> of two arguments.
11629The second argument can only be evaluated if the first evaluates to true.
11630
11631=item C<isl_ast_expr_op_or>
11632
11633Logical I<or> of two arguments.
11634Both arguments can be evaluated.
11635
11636=item C<isl_ast_expr_op_or_else>
11637
11638Logical I<or> of two arguments.
11639The second argument can only be evaluated if the first evaluates to false.
11640
11641=item C<isl_ast_expr_op_max>
11642
11643Maximum of two or more arguments.
11644
11645=item C<isl_ast_expr_op_min>
11646
11647Minimum of two or more arguments.
11648
11649=item C<isl_ast_expr_op_minus>
11650
11651Change sign.
11652
11653=item C<isl_ast_expr_op_add>
11654
11655Sum of two arguments.
11656
11657=item C<isl_ast_expr_op_sub>
11658
11659Difference of two arguments.
11660
11661=item C<isl_ast_expr_op_mul>
11662
11663Product of two arguments.
11664
11665=item C<isl_ast_expr_op_div>
11666
11667Exact division.  That is, the result is known to be an integer.
11668
11669=item C<isl_ast_expr_op_fdiv_q>
11670
11671Result of integer division, rounded towards negative
11672infinity.
11673The divisor is known to be positive.
11674
11675=item C<isl_ast_expr_op_pdiv_q>
11676
11677Result of integer division, where dividend is known to be non-negative.
11678The divisor is known to be positive.
11679
11680=item C<isl_ast_expr_op_pdiv_r>
11681
11682Remainder of integer division, where dividend is known to be non-negative.
11683The divisor is known to be positive.
11684
11685=item C<isl_ast_expr_op_zdiv_r>
11686
11687Equal to zero iff the remainder on integer division is zero.
11688The divisor is known to be positive.
11689
11690=item C<isl_ast_expr_op_cond>
11691
11692Conditional operator defined on three arguments.
11693If the first argument evaluates to true, then the result
11694is equal to the second argument.  Otherwise, the result
11695is equal to the third argument.
11696The second and third argument may only be evaluated if
11697the first argument evaluates to true and false, respectively.
11698Corresponds to C<a ? b : c> in C.
11699
11700=item C<isl_ast_expr_op_select>
11701
11702Conditional operator defined on three arguments.
11703If the first argument evaluates to true, then the result
11704is equal to the second argument.  Otherwise, the result
11705is equal to the third argument.
11706The second and third argument may be evaluated independently
11707of the value of the first argument.
11708Corresponds to C<a * b + (1 - a) * c> in C.
11709
11710=item C<isl_ast_expr_op_eq>
11711
11712Equality relation.
11713
11714=item C<isl_ast_expr_op_le>
11715
11716Less than or equal relation.
11717
11718=item C<isl_ast_expr_op_lt>
11719
11720Less than relation.
11721
11722=item C<isl_ast_expr_op_ge>
11723
11724Greater than or equal relation.
11725
11726=item C<isl_ast_expr_op_gt>
11727
11728Greater than relation.
11729
11730=item C<isl_ast_expr_op_call>
11731
11732A function call.
11733The number of arguments of the C<isl_ast_expr> is one more than
11734the number of arguments in the function call, the first argument
11735representing the function being called.
11736
11737=item C<isl_ast_expr_op_access>
11738
11739An array access.
11740The number of arguments of the C<isl_ast_expr> is one more than
11741the number of index expressions in the array access, the first argument
11742representing the array being accessed.
11743
11744=item C<isl_ast_expr_op_member>
11745
11746A member access.
11747This operation has two arguments, a structure and the name of
11748the member of the structure being accessed.
11749
11750=back
11751
11752	#include <isl/ast.h>
11753	__isl_give isl_id *isl_ast_expr_id_get_id(
11754		__isl_keep isl_ast_expr *expr);
11755	__isl_give isl_id *isl_ast_expr_get_id(
11756		__isl_keep isl_ast_expr *expr);
11757
11758Return the identifier represented by the AST expression.
11759C<isl_ast_expr_get_id> is an alternative name for
11760C<isl_ast_expr_id_get_id>.
11761
11762	#include <isl/ast.h>
11763	__isl_give isl_val *isl_ast_expr_int_get_val(
11764		__isl_keep isl_ast_expr *expr);
11765	__isl_give isl_val *isl_ast_expr_get_val(
11766		__isl_keep isl_ast_expr *expr);
11767
11768Return the integer represented by the AST expression.
11769C<isl_ast_expr_get_val> is an alternative name for
11770C<isl_ast_expr_int_get_val>.
11771
11772=head3 Properties of ASTs
11773
11774	#include <isl/ast.h>
11775	isl_bool isl_ast_expr_is_equal(
11776		__isl_keep isl_ast_expr *expr1,
11777		__isl_keep isl_ast_expr *expr2);
11778
11779Check if two C<isl_ast_expr>s are equal to each other.
11780
11781=head3 Manipulating and printing the AST
11782
11783AST nodes can be copied and freed using the following functions.
11784
11785	#include <isl/ast.h>
11786	__isl_give isl_ast_node *isl_ast_node_copy(
11787		__isl_keep isl_ast_node *node);
11788	__isl_null isl_ast_node *isl_ast_node_free(
11789		__isl_take isl_ast_node *node);
11790
11791AST expressions can be copied and freed using the following functions.
11792
11793	#include <isl/ast.h>
11794	__isl_give isl_ast_expr *isl_ast_expr_copy(
11795		__isl_keep isl_ast_expr *expr);
11796	__isl_null isl_ast_expr *isl_ast_expr_free(
11797		__isl_take isl_ast_expr *expr);
11798
11799New AST expressions can be created either directly or within
11800the context of an C<isl_ast_build>.
11801
11802	#include <isl/ast.h>
11803	__isl_give isl_ast_expr *isl_ast_expr_from_val(
11804		__isl_take isl_val *v);
11805	__isl_give isl_ast_expr *isl_ast_expr_from_id(
11806		__isl_take isl_id *id);
11807	__isl_give isl_ast_expr *isl_ast_expr_neg(
11808		__isl_take isl_ast_expr *expr);
11809	__isl_give isl_ast_expr *isl_ast_expr_address_of(
11810		__isl_take isl_ast_expr *expr);
11811	__isl_give isl_ast_expr *isl_ast_expr_add(
11812		__isl_take isl_ast_expr *expr1,
11813		__isl_take isl_ast_expr *expr2);
11814	__isl_give isl_ast_expr *isl_ast_expr_sub(
11815		__isl_take isl_ast_expr *expr1,
11816		__isl_take isl_ast_expr *expr2);
11817	__isl_give isl_ast_expr *isl_ast_expr_mul(
11818		__isl_take isl_ast_expr *expr1,
11819		__isl_take isl_ast_expr *expr2);
11820	__isl_give isl_ast_expr *isl_ast_expr_div(
11821		__isl_take isl_ast_expr *expr1,
11822		__isl_take isl_ast_expr *expr2);
11823	__isl_give isl_ast_expr *isl_ast_expr_pdiv_q(
11824		__isl_take isl_ast_expr *expr1,
11825		__isl_take isl_ast_expr *expr2);
11826	__isl_give isl_ast_expr *isl_ast_expr_pdiv_r(
11827		__isl_take isl_ast_expr *expr1,
11828		__isl_take isl_ast_expr *expr2);
11829	__isl_give isl_ast_expr *isl_ast_expr_and(
11830		__isl_take isl_ast_expr *expr1,
11831		__isl_take isl_ast_expr *expr2)
11832	__isl_give isl_ast_expr *isl_ast_expr_and_then(
11833		__isl_take isl_ast_expr *expr1,
11834		__isl_take isl_ast_expr *expr2)
11835	__isl_give isl_ast_expr *isl_ast_expr_or(
11836		__isl_take isl_ast_expr *expr1,
11837		__isl_take isl_ast_expr *expr2)
11838	__isl_give isl_ast_expr *isl_ast_expr_or_else(
11839		__isl_take isl_ast_expr *expr1,
11840		__isl_take isl_ast_expr *expr2)
11841	__isl_give isl_ast_expr *isl_ast_expr_eq(
11842		__isl_take isl_ast_expr *expr1,
11843		__isl_take isl_ast_expr *expr2);
11844	__isl_give isl_ast_expr *isl_ast_expr_le(
11845		__isl_take isl_ast_expr *expr1,
11846		__isl_take isl_ast_expr *expr2);
11847	__isl_give isl_ast_expr *isl_ast_expr_lt(
11848		__isl_take isl_ast_expr *expr1,
11849		__isl_take isl_ast_expr *expr2);
11850	__isl_give isl_ast_expr *isl_ast_expr_ge(
11851		__isl_take isl_ast_expr *expr1,
11852		__isl_take isl_ast_expr *expr2);
11853	__isl_give isl_ast_expr *isl_ast_expr_gt(
11854		__isl_take isl_ast_expr *expr1,
11855		__isl_take isl_ast_expr *expr2);
11856	__isl_give isl_ast_expr *isl_ast_expr_access(
11857		__isl_take isl_ast_expr *array,
11858		__isl_take isl_ast_expr_list *indices);
11859	__isl_give isl_ast_expr *isl_ast_expr_call(
11860		__isl_take isl_ast_expr *function,
11861		__isl_take isl_ast_expr_list *arguments);
11862
11863The function C<isl_ast_expr_address_of> can be applied to an
11864C<isl_ast_expr> of type C<isl_ast_expr_op_access> only. It is meant
11865to represent the address of the C<isl_ast_expr_access>.
11866The second argument of the functions C<isl_ast_expr_pdiv_q> and
11867C<isl_ast_expr_pdiv_r> should always evaluate to a positive number.
11868The function
11869C<isl_ast_expr_and_then> as well as C<isl_ast_expr_or_else> are short-circuit
11870versions of C<isl_ast_expr_and> and C<isl_ast_expr_or>, respectively.
11871
11872	#include <isl/ast_build.h>
11873	__isl_give isl_ast_expr *isl_ast_build_expr_from_set(
11874		__isl_keep isl_ast_build *build,
11875		__isl_take isl_set *set);
11876	__isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
11877		__isl_keep isl_ast_build *build,
11878		__isl_take isl_pw_aff *pa);
11879	__isl_give isl_ast_expr *
11880	isl_ast_build_access_from_pw_multi_aff(
11881		__isl_keep isl_ast_build *build,
11882		__isl_take isl_pw_multi_aff *pma);
11883	__isl_give isl_ast_expr *
11884	isl_ast_build_access_from_multi_pw_aff(
11885		__isl_keep isl_ast_build *build,
11886		__isl_take isl_multi_pw_aff *mpa);
11887	__isl_give isl_ast_expr *
11888	isl_ast_build_call_from_pw_multi_aff(
11889		__isl_keep isl_ast_build *build,
11890		__isl_take isl_pw_multi_aff *pma);
11891	__isl_give isl_ast_expr *
11892	isl_ast_build_call_from_multi_pw_aff(
11893		__isl_keep isl_ast_build *build,
11894		__isl_take isl_multi_pw_aff *mpa);
11895
11896The set C<set> and
11897the domains of C<pa>, C<mpa> and C<pma> should correspond
11898to the schedule space of C<build>.
11899The tuple id of C<mpa> or C<pma> is used as the array being accessed or
11900the function being called.
11901If the accessed space is a nested relation, then it is taken
11902to represent an access of the member specified by the range
11903of this nested relation of the structure specified by the domain
11904of the nested relation.
11905
11906The following functions can be used to modify an C<isl_ast_expr>.
11907
11908	#include <isl/ast.h>
11909	__isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
11910		__isl_take isl_ast_expr *expr, int pos,
11911		__isl_take isl_ast_expr *arg);
11912
11913Replace the argument of C<expr> at position C<pos> by C<arg>.
11914
11915	#include <isl/ast.h>
11916	__isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
11917		__isl_take isl_ast_expr *expr,
11918		__isl_take isl_id_to_ast_expr *id2expr);
11919
11920The function C<isl_ast_expr_substitute_ids> replaces the
11921subexpressions of C<expr> of type C<isl_ast_expr_id>
11922by the corresponding expression in C<id2expr>, if there is any.
11923
11924
11925User specified data can be attached to an C<isl_ast_node> and obtained
11926from the same C<isl_ast_node> using the following functions.
11927
11928	#include <isl/ast.h>
11929	__isl_give isl_ast_node *isl_ast_node_set_annotation(
11930		__isl_take isl_ast_node *node,
11931		__isl_take isl_id *annotation);
11932	__isl_give isl_id *isl_ast_node_get_annotation(
11933		__isl_keep isl_ast_node *node);
11934
11935Basic printing can be performed using the following functions.
11936
11937	#include <isl/ast.h>
11938	__isl_give isl_printer *isl_printer_print_ast_expr(
11939		__isl_take isl_printer *p,
11940		__isl_keep isl_ast_expr *expr);
11941	__isl_give isl_printer *isl_printer_print_ast_node(
11942		__isl_take isl_printer *p,
11943		__isl_keep isl_ast_node *node);
11944	__isl_give char *isl_ast_expr_to_str(
11945		__isl_keep isl_ast_expr *expr);
11946	__isl_give char *isl_ast_node_to_str(
11947		__isl_keep isl_ast_node *node);
11948	__isl_give char *isl_ast_expr_to_C_str(
11949		__isl_keep isl_ast_expr *expr);
11950	__isl_give char *isl_ast_node_to_C_str(
11951		__isl_keep isl_ast_node *node);
11952
11953The functions C<isl_ast_expr_to_C_str> and
11954C<isl_ast_node_to_C_str> are convenience functions
11955that return a string representation of the input in C format.
11956
11957More advanced printing can be performed using the following functions.
11958
11959	#include <isl/ast.h>
11960	__isl_give isl_printer *
11961	isl_ast_expr_op_type_set_print_name(
11962		__isl_take isl_printer *p,
11963		enum isl_ast_expr_op_type type,
11964		__isl_keep const char *name);
11965	__isl_give isl_printer *isl_ast_op_type_set_print_name(
11966		__isl_take isl_printer *p,
11967		enum isl_ast_expr_op_type type,
11968		__isl_keep const char *name);
11969	isl_stat isl_options_set_ast_print_macro_once(
11970		isl_ctx *ctx, int val);
11971	int isl_options_get_ast_print_macro_once(isl_ctx *ctx);
11972	__isl_give isl_printer *isl_ast_expr_op_type_print_macro(
11973		enum isl_ast_expr_op_type type,
11974		__isl_take isl_printer *p);
11975	__isl_give isl_printer *isl_ast_op_type_print_macro(
11976		enum isl_ast_expr_op_type type,
11977		__isl_take isl_printer *p);
11978	__isl_give isl_printer *isl_ast_expr_print_macros(
11979		__isl_keep isl_ast_expr *expr,
11980		__isl_take isl_printer *p);
11981	__isl_give isl_printer *isl_ast_node_print_macros(
11982		__isl_keep isl_ast_node *node,
11983		__isl_take isl_printer *p);
11984	__isl_give isl_printer *isl_ast_node_print(
11985		__isl_keep isl_ast_node *node,
11986		__isl_take isl_printer *p,
11987		__isl_take isl_ast_print_options *options);
11988	__isl_give isl_printer *isl_ast_node_for_print(
11989		__isl_keep isl_ast_node *node,
11990		__isl_take isl_printer *p,
11991		__isl_take isl_ast_print_options *options);
11992	__isl_give isl_printer *isl_ast_node_if_print(
11993		__isl_keep isl_ast_node *node,
11994		__isl_take isl_printer *p,
11995		__isl_take isl_ast_print_options *options);
11996
11997While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
11998C<isl> may print out an AST that makes use of macros such
11999as C<floord>, C<min> and C<max>.
12000The names of these macros may be modified by a call
12001to C<isl_ast_expr_op_type_set_print_name>.  The user-specified
12002names are associated to the printer object.
12003C<isl_ast_op_type_set_print_name> is an alternative name for
12004C<isl_ast_expr_op_type_set_print_name>.
12005C<isl_ast_expr_op_type_print_macro> prints out the macro
12006corresponding to a specific C<isl_ast_expr_op_type>.
12007If the print-macro-once option is set, then a given macro definition
12008is only printed once to any given printer object.
12009C<isl_ast_op_type_print_macro> is an alternative name for
12010C<isl_ast_expr_op_type_print_macro>.
12011C<isl_ast_expr_print_macros> scans the C<isl_ast_expr>
12012for subexpressions where these macros would be used and prints
12013out the required macro definitions.
12014Essentially, C<isl_ast_expr_print_macros> calls
12015C<isl_ast_expr_foreach_ast_expr_op_type> with
12016C<isl_ast_expr_op_type_print_macro>
12017as function argument.
12018C<isl_ast_node_print_macros> does the same
12019for expressions in its C<isl_ast_node> argument.
12020C<isl_ast_node_print>, C<isl_ast_node_for_print> and
12021C<isl_ast_node_if_print> print an C<isl_ast_node>
12022in C<ISL_FORMAT_C>, but allow for some extra control
12023through an C<isl_ast_print_options> object.
12024This object can be created using the following functions.
12025
12026	#include <isl/ast.h>
12027	__isl_give isl_ast_print_options *
12028	isl_ast_print_options_alloc(isl_ctx *ctx);
12029	__isl_give isl_ast_print_options *
12030	isl_ast_print_options_copy(
12031		__isl_keep isl_ast_print_options *options);
12032	__isl_null isl_ast_print_options *
12033	isl_ast_print_options_free(
12034		__isl_take isl_ast_print_options *options);
12035
12036	__isl_give isl_ast_print_options *
12037	isl_ast_print_options_set_print_user(
12038		__isl_take isl_ast_print_options *options,
12039		__isl_give isl_printer *(*print_user)(
12040			__isl_take isl_printer *p,
12041			__isl_take isl_ast_print_options *options,
12042			__isl_keep isl_ast_node *node, void *user),
12043		void *user);
12044	__isl_give isl_ast_print_options *
12045	isl_ast_print_options_set_print_for(
12046		__isl_take isl_ast_print_options *options,
12047		__isl_give isl_printer *(*print_for)(
12048			__isl_take isl_printer *p,
12049			__isl_take isl_ast_print_options *options,
12050			__isl_keep isl_ast_node *node, void *user),
12051		void *user);
12052
12053The callback set by C<isl_ast_print_options_set_print_user>
12054is called whenever a node of type C<isl_ast_node_user> needs to
12055be printed.
12056The callback set by C<isl_ast_print_options_set_print_for>
12057is called whenever a node of type C<isl_ast_node_for> needs to
12058be printed.
12059Note that C<isl_ast_node_for_print> will I<not> call the
12060callback set by C<isl_ast_print_options_set_print_for> on the node
12061on which C<isl_ast_node_for_print> is called, but only on nested
12062nodes of type C<isl_ast_node_for>.  It is therefore safe to
12063call C<isl_ast_node_for_print> from within the callback set by
12064C<isl_ast_print_options_set_print_for>.
12065
12066The following option determines the type to be used for iterators
12067while printing the AST.
12068
12069	isl_stat isl_options_set_ast_iterator_type(
12070		isl_ctx *ctx, const char *val);
12071	const char *isl_options_get_ast_iterator_type(
12072		isl_ctx *ctx);
12073
12074The AST printer only prints body nodes of C<if> and C<for> nodes
12075as blocks if these
12076blocks cannot be safely omitted.
12077For example, a C<for> node with one body node will not be
12078surrounded with braces in C<ISL_FORMAT_C>.
12079A block will always be printed by setting the following option.
12080
12081	isl_stat isl_options_set_ast_always_print_block(isl_ctx *ctx,
12082		int val);
12083	int isl_options_get_ast_always_print_block(isl_ctx *ctx);
12084
12085Explicit block nodes that appear inside the AST are always printed as blocks.
12086If the block node appears as the outermost node,
12087then it is only printed if the following option is set.
12088
12089	isl_stat isl_options_set_ast_print_outermost_block(
12090		isl_ctx *ctx, int val);
12091	int isl_options_get_ast_print_outermost_block(
12092		isl_ctx *ctx);
12093
12094=head3 Options
12095
12096	#include <isl/ast_build.h>
12097	isl_stat isl_options_set_ast_build_atomic_upper_bound(
12098		isl_ctx *ctx, int val);
12099	int isl_options_get_ast_build_atomic_upper_bound(
12100		isl_ctx *ctx);
12101	isl_stat isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
12102		int val);
12103	int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
12104	isl_stat isl_options_set_ast_build_detect_min_max(
12105		isl_ctx *ctx, int val);
12106	int isl_options_get_ast_build_detect_min_max(
12107		isl_ctx *ctx);
12108	isl_stat isl_options_set_ast_build_exploit_nested_bounds(
12109		isl_ctx *ctx, int val);
12110	int isl_options_get_ast_build_exploit_nested_bounds(
12111		isl_ctx *ctx);
12112	isl_stat isl_options_set_ast_build_group_coscheduled(
12113		isl_ctx *ctx, int val);
12114	int isl_options_get_ast_build_group_coscheduled(
12115		isl_ctx *ctx);
12116	isl_stat isl_options_set_ast_build_separation_bounds(
12117		isl_ctx *ctx, int val);
12118	int isl_options_get_ast_build_separation_bounds(
12119		isl_ctx *ctx);
12120	isl_stat isl_options_set_ast_build_scale_strides(
12121		isl_ctx *ctx, int val);
12122	int isl_options_get_ast_build_scale_strides(
12123		isl_ctx *ctx);
12124	isl_stat isl_options_set_ast_build_allow_else(isl_ctx *ctx,
12125		int val);
12126	int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
12127	isl_stat isl_options_set_ast_build_allow_or(isl_ctx *ctx,
12128		int val);
12129	int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
12130
12131=over
12132
12133=item * ast_build_atomic_upper_bound
12134
12135Generate loop upper bounds that consist of the current loop iterator,
12136an operator and an expression not involving the iterator.
12137If this option is not set, then the current loop iterator may appear
12138several times in the upper bound.
12139For example, when this option is turned off, AST generation
12140for the schedule
12141
12142	[n] -> { A[i] -> [i] : 0 <= i <= 100, n }
12143
12144produces
12145
12146	for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
12147	  A(c0);
12148
12149When the option is turned on, the following AST is generated
12150
12151	for (int c0 = 0; c0 <= min(100, n); c0 += 1)
12152	  A(c0);
12153
12154=item * ast_build_prefer_pdiv
12155
12156If this option is turned off, then the AST generation will
12157produce ASTs that may only contain C<isl_ast_expr_op_fdiv_q>
12158operators, but no C<isl_ast_expr_op_pdiv_q> or
12159C<isl_ast_expr_op_pdiv_r> operators.
12160If this option is turned on, then C<isl> will try to convert
12161some of the C<isl_ast_expr_op_fdiv_q> operators to (expressions containing)
12162C<isl_ast_expr_op_pdiv_q> or C<isl_ast_expr_op_pdiv_r> operators.
12163
12164=item * ast_build_detect_min_max
12165
12166If this option is turned on, then C<isl> will try and detect
12167min or max-expressions when building AST expressions from
12168piecewise affine expressions.
12169
12170=item * ast_build_exploit_nested_bounds
12171
12172Simplify conditions based on bounds of nested for loops.
12173In particular, remove conditions that are implied by the fact
12174that one or more nested loops have at least one iteration,
12175meaning that the upper bound is at least as large as the lower bound.
12176For example, when this option is turned off, AST generation
12177for the schedule
12178
12179	[N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
12180					0 <= j <= M }
12181
12182produces
12183
12184	if (M >= 0)
12185	  for (int c0 = 0; c0 <= N; c0 += 1)
12186	    for (int c1 = 0; c1 <= M; c1 += 1)
12187	      A(c0, c1);
12188
12189When the option is turned on, the following AST is generated
12190
12191	for (int c0 = 0; c0 <= N; c0 += 1)
12192	  for (int c1 = 0; c1 <= M; c1 += 1)
12193	    A(c0, c1);
12194
12195=item * ast_build_group_coscheduled
12196
12197If two domain elements are assigned the same schedule point, then
12198they may be executed in any order and they may even appear in different
12199loops.  If this options is set, then the AST generator will make
12200sure that coscheduled domain elements do not appear in separate parts
12201of the AST.  This is useful in case of nested AST generation
12202if the outer AST generation is given only part of a schedule
12203and the inner AST generation should handle the domains that are
12204coscheduled by this initial part of the schedule together.
12205For example if an AST is generated for a schedule
12206
12207	{ A[i] -> [0]; B[i] -> [0] }
12208
12209then the C<isl_ast_build_set_create_leaf> callback described
12210below may get called twice, once for each domain.
12211Setting this option ensures that the callback is only called once
12212on both domains together.
12213
12214=item * ast_build_separation_bounds
12215
12216This option specifies which bounds to use during separation.
12217If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
12218then all (possibly implicit) bounds on the current dimension will
12219be used during separation.
12220If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
12221then only those bounds that are explicitly available will
12222be used during separation.
12223
12224=item * ast_build_scale_strides
12225
12226This option specifies whether the AST generator is allowed
12227to scale down iterators of strided loops.
12228
12229=item * ast_build_allow_else
12230
12231This option specifies whether the AST generator is allowed
12232to construct if statements with else branches.
12233
12234=item * ast_build_allow_or
12235
12236This option specifies whether the AST generator is allowed
12237to construct if conditions with disjunctions.
12238
12239=back
12240
12241=head3 AST Generation Options (Schedule Tree)
12242
12243In case of AST construction from a schedule tree, the options
12244that control how an AST is created from the individual schedule
12245dimensions are stored in the band nodes of the tree
12246(see L</"Schedule Trees">).
12247
12248In particular, a schedule dimension can be handled in four
12249different ways, atomic, separate, unroll or the default.
12250This loop AST generation type can be set using
12251C<isl_schedule_node_band_member_set_ast_loop_type>.
12252Alternatively,
12253the first three can be selected by including a one-dimensional
12254element with as value the position of the schedule dimension
12255within the band and as name one of C<atomic>, C<separate>
12256or C<unroll> in the options
12257set by C<isl_schedule_node_band_set_ast_build_options>.
12258Only one of these three may be specified for
12259any given schedule dimension within a band node.
12260If none of these is specified, then the default
12261is used.  The meaning of the options is as follows.
12262
12263=over
12264
12265=item C<atomic>
12266
12267When this option is specified, the AST generator will make
12268sure that a given domain space only appears in a single
12269loop at the specified level.
12270
12271For example, for the schedule tree
12272
12273	domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
12274	child:
12275	  schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
12276	  options: "{ atomic[x] }"
12277
12278the following AST will be generated
12279
12280	for (int c0 = 0; c0 <= 10; c0 += 1) {
12281	  if (c0 >= 1)
12282	    b(c0 - 1);
12283	  if (c0 <= 9)
12284	    a(c0);
12285	}
12286
12287On the other hand, for the schedule tree
12288
12289	domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
12290	child:
12291	  schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
12292	  options: "{ separate[x] }"
12293
12294the following AST will be generated
12295
12296	{
12297	  a(0);
12298	  for (int c0 = 1; c0 <= 9; c0 += 1) {
12299	    b(c0 - 1);
12300	    a(c0);
12301	  }
12302	  b(9);
12303	}
12304
12305If neither C<atomic> nor C<separate> is specified, then the AST generator
12306may produce either of these two results or some intermediate form.
12307
12308=item C<separate>
12309
12310When this option is specified, the AST generator will
12311split the domain of the specified schedule dimension
12312into pieces with a fixed set of statements for which
12313instances need to be executed by the iterations in
12314the schedule domain part.  This option tends to avoid
12315the generation of guards inside the corresponding loops.
12316See also the C<atomic> option.
12317
12318=item C<unroll>
12319
12320When this option is specified, the AST generator will
12321I<completely> unroll the corresponding schedule dimension.
12322It is the responsibility of the user to ensure that such
12323unrolling is possible.
12324To obtain a partial unrolling, the user should apply an additional
12325strip-mining to the schedule and fully unroll the inner schedule
12326dimension.
12327
12328=back
12329
12330The C<isolate> option is a bit more involved.  It allows the user
12331to isolate a range of schedule dimension values from smaller and
12332greater values.  Additionally, the user may specify a different
12333atomic/separate/unroll choice for the isolated part and the remaining
12334parts.  The typical use case of the C<isolate> option is to isolate
12335full tiles from partial tiles.
12336The part that needs to be isolated may depend on outer schedule dimensions.
12337The option therefore needs to be able to reference those outer schedule
12338dimensions.  In particular, the space of the C<isolate> option is that
12339of a wrapped map with as domain the flat product of all outer band nodes
12340and as range the space of the current band node.
12341The atomic/separate/unroll choice for the isolated part is determined
12342by an option that lives in an unnamed wrapped space with as domain
12343a zero-dimensional C<isolate> space and as range the regular
12344C<atomic>, C<separate> or C<unroll> space.
12345This option may also be set directly using
12346C<isl_schedule_node_band_member_set_isolate_ast_loop_type>.
12347The atomic/separate/unroll choice for the remaining part is determined
12348by the regular C<atomic>, C<separate> or C<unroll> option.
12349Since the C<isolate> option references outer schedule dimensions,
12350its use in a band node causes any tree containing the node
12351to be considered anchored.
12352
12353As an example, consider the isolation of full tiles from partial tiles
12354in a tiling of a triangular domain.  The original schedule is as follows.
12355
12356	domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
12357	child:
12358	  schedule: "[{ A[i,j] -> [floor(i/10)] }, \
12359		{ A[i,j] -> [floor(j/10)] }, \
12360		{ A[i,j] -> [i] }, { A[i,j] -> [j] }]"
12361
12362The output is
12363
12364	for (int c0 = 0; c0 <= 10; c0 += 1)
12365	  for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
12366	    for (int c2 = 10 * c0;
12367                 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
12368	      for (int c3 = 10 * c1;
12369                   c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
12370		A(c2, c3);
12371
12372Isolating the full tiles, we have the following input
12373
12374	domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
12375	child:
12376	  schedule: "[{ A[i,j] -> [floor(i/10)] }, \
12377		{ A[i,j] -> [floor(j/10)] }, \
12378		{ A[i,j] -> [i] }, { A[i,j] -> [j] }]"
12379	  options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
12380		10a+9+10b+9 <= 100 }"
12381
12382and output
12383
12384	{
12385	  for (int c0 = 0; c0 <= 8; c0 += 1) {
12386	    for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
12387	      for (int c2 = 10 * c0;
12388		   c2 <= 10 * c0 + 9; c2 += 1)
12389		for (int c3 = 10 * c1;
12390		     c3 <= 10 * c1 + 9; c3 += 1)
12391		  A(c2, c3);
12392	    for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
12393	      for (int c2 = 10 * c0;
12394                   c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
12395		for (int c3 = 10 * c1;
12396                     c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
12397		  A(c2, c3);
12398	  }
12399	  for (int c0 = 9; c0 <= 10; c0 += 1)
12400	    for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
12401	      for (int c2 = 10 * c0;
12402                   c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
12403		for (int c3 = 10 * c1;
12404                     c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
12405		  A(c2, c3);
12406	}
12407
12408We may then additionally unroll the innermost loop of the isolated part
12409
12410	domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
12411	child:
12412	  schedule: "[{ A[i,j] -> [floor(i/10)] }, \
12413		{ A[i,j] -> [floor(j/10)] }, \
12414		{ A[i,j] -> [i] }, { A[i,j] -> [j] }]"
12415	  options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
12416		10a+9+10b+9 <= 100; [isolate[] -> unroll[3]] }"
12417
12418to obtain
12419
12420	{
12421	  for (int c0 = 0; c0 <= 8; c0 += 1) {
12422	    for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
12423	      for (int c2 = 10 * c0; c2 <= 10 * c0 + 9; c2 += 1) {
12424		A(c2, 10 * c1);
12425		A(c2, 10 * c1 + 1);
12426		A(c2, 10 * c1 + 2);
12427		A(c2, 10 * c1 + 3);
12428		A(c2, 10 * c1 + 4);
12429		A(c2, 10 * c1 + 5);
12430		A(c2, 10 * c1 + 6);
12431		A(c2, 10 * c1 + 7);
12432		A(c2, 10 * c1 + 8);
12433		A(c2, 10 * c1 + 9);
12434	      }
12435	    for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
12436	      for (int c2 = 10 * c0;
12437                   c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
12438		for (int c3 = 10 * c1;
12439		     c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
12440		  A(c2, c3);
12441	  }
12442	  for (int c0 = 9; c0 <= 10; c0 += 1)
12443	    for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
12444	      for (int c2 = 10 * c0;
12445		   c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
12446		for (int c3 = 10 * c1;
12447		     c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
12448		  A(c2, c3);
12449	}
12450
12451
12452=head3 AST Generation Options (Schedule Map)
12453
12454In case of AST construction using
12455C<isl_ast_build_node_from_schedule_map>, the options
12456that control how an AST is created from the individual schedule
12457dimensions are stored in the C<isl_ast_build>.
12458They can be set using the following function.
12459
12460	#include <isl/ast_build.h>
12461	__isl_give isl_ast_build *
12462	isl_ast_build_set_options(
12463		__isl_take isl_ast_build *build,
12464		__isl_take isl_union_map *options);
12465
12466The options are encoded in an C<isl_union_map>.
12467The domain of this union relation refers to the schedule domain,
12468i.e., the range of the schedule passed
12469to C<isl_ast_build_node_from_schedule_map>.
12470In the case of nested AST generation (see L</"Nested AST Generation">),
12471the domain of C<options> should refer to the extra piece of the schedule.
12472That is, it should be equal to the range of the wrapped relation in the
12473range of the schedule.
12474The range of the options can consist of elements in one or more spaces,
12475the names of which determine the effect of the option.
12476The values of the range typically also refer to the schedule dimension
12477to which the option applies, with value C<0> representing
12478the outermost schedule dimension.  In case of nested AST generation
12479(see L</"Nested AST Generation">), these values refer to the position
12480of the schedule dimension within the innermost AST generation.
12481The constraints on the domain elements of
12482the option should only refer to this dimension and earlier dimensions.
12483We consider the following spaces.
12484
12485=over
12486
12487=item C<separation_class>
12488
12489B<This option has been deprecated.  Use the isolate option on
12490schedule trees instead.>
12491
12492This space is a wrapped relation between two one dimensional spaces.
12493The input space represents the schedule dimension to which the option
12494applies and the output space represents the separation class.
12495While constructing a loop corresponding to the specified schedule
12496dimension(s), the AST generator will try to generate separate loops
12497for domain elements that are assigned different classes.
12498If only some of the elements are assigned a class, then those elements
12499that are not assigned any class will be treated as belonging to a class
12500that is separate from the explicitly assigned classes.
12501The typical use case for this option is to separate full tiles from
12502partial tiles.
12503The other options, described below, are applied after the separation
12504into classes.
12505
12506As an example, consider the separation into full and partial tiles
12507of a tiling of a triangular domain.
12508Take, for example, the domain
12509
12510	{ A[i,j] : 0 <= i,j and i + j <= 100 }
12511
12512and a tiling into tiles of 10 by 10.  The input to the AST generator
12513is then the schedule
12514
12515	{ A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
12516						i + j <= 100 }
12517
12518Without any options, the following AST is generated
12519
12520	for (int c0 = 0; c0 <= 10; c0 += 1)
12521	  for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
12522	    for (int c2 = 10 * c0;
12523		 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
12524		 c2 += 1)
12525	      for (int c3 = 10 * c1;
12526		   c3 <= min(10 * c1 + 9, -c2 + 100);
12527		   c3 += 1)
12528		A(c2, c3);
12529
12530Separation into full and partial tiles can be obtained by assigning
12531a class, say C<0>, to the full tiles.  The full tiles are represented by those
12532values of the first and second schedule dimensions for which there are
12533values of the third and fourth dimensions to cover an entire tile.
12534That is, we need to specify the following option
12535
12536	{ [a,b,c,d] -> separation_class[[0]->[0]] :
12537		exists b': 0 <= 10a,10b' and
12538			   10a+9+10b'+9 <= 100;
12539	  [a,b,c,d] -> separation_class[[1]->[0]] :
12540		0 <= 10a,10b and 10a+9+10b+9 <= 100 }
12541
12542which simplifies to
12543
12544	{ [a, b, c, d] -> separation_class[[1] -> [0]] :
12545		a >= 0 and b >= 0 and b <= 8 - a;
12546	  [a, b, c, d] -> separation_class[[0] -> [0]] :
12547		a >= 0 and a <= 8 }
12548
12549With this option, the generated AST is as follows
12550
12551	{
12552	  for (int c0 = 0; c0 <= 8; c0 += 1) {
12553	    for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
12554	      for (int c2 = 10 * c0;
12555		   c2 <= 10 * c0 + 9; c2 += 1)
12556		for (int c3 = 10 * c1;
12557		     c3 <= 10 * c1 + 9; c3 += 1)
12558		  A(c2, c3);
12559	    for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
12560	      for (int c2 = 10 * c0;
12561		   c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
12562		   c2 += 1)
12563		for (int c3 = 10 * c1;
12564		     c3 <= min(-c2 + 100, 10 * c1 + 9);
12565		     c3 += 1)
12566		  A(c2, c3);
12567	  }
12568	  for (int c0 = 9; c0 <= 10; c0 += 1)
12569	    for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
12570	      for (int c2 = 10 * c0;
12571		   c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
12572		   c2 += 1)
12573		for (int c3 = 10 * c1;
12574		     c3 <= min(10 * c1 + 9, -c2 + 100);
12575		     c3 += 1)
12576		  A(c2, c3);
12577	}
12578
12579=item C<separate>
12580
12581This is a single-dimensional space representing the schedule dimension(s)
12582to which ``separation'' should be applied.  Separation tries to split
12583a loop into several pieces if this can avoid the generation of guards
12584inside the loop.
12585See also the C<atomic> option.
12586
12587=item C<atomic>
12588
12589This is a single-dimensional space representing the schedule dimension(s)
12590for which the domains should be considered ``atomic''.  That is, the
12591AST generator will make sure that any given domain space will only appear
12592in a single loop at the specified level.
12593
12594Consider the following schedule
12595
12596	{ a[i] -> [i] : 0 <= i < 10;
12597	  b[i] -> [i+1] : 0 <= i < 10 }
12598
12599If the following option is specified
12600
12601	{ [i] -> separate[x] }
12602
12603then the following AST will be generated
12604
12605	{
12606	  a(0);
12607	  for (int c0 = 1; c0 <= 9; c0 += 1) {
12608	    a(c0);
12609	    b(c0 - 1);
12610	  }
12611	  b(9);
12612	}
12613
12614If, on the other hand, the following option is specified
12615
12616	{ [i] -> atomic[x] }
12617
12618then the following AST will be generated
12619
12620	for (int c0 = 0; c0 <= 10; c0 += 1) {
12621	  if (c0 <= 9)
12622	    a(c0);
12623	  if (c0 >= 1)
12624	    b(c0 - 1);
12625	}
12626
12627If neither C<atomic> nor C<separate> is specified, then the AST generator
12628may produce either of these two results or some intermediate form.
12629
12630=item C<unroll>
12631
12632This is a single-dimensional space representing the schedule dimension(s)
12633that should be I<completely> unrolled.
12634To obtain a partial unrolling, the user should apply an additional
12635strip-mining to the schedule and fully unroll the inner loop.
12636
12637=back
12638
12639=head3 Fine-grained Control over AST Generation
12640
12641Besides specifying the constraints on the parameters,
12642an C<isl_ast_build> object can be used to control
12643various aspects of the AST generation process.
12644In case of AST construction using
12645C<isl_ast_build_node_from_schedule_map>,
12646the most prominent way of control is through ``options'',
12647as explained above.
12648
12649Additional control is available through the following functions.
12650
12651	#include <isl/ast_build.h>
12652	__isl_give isl_ast_build *
12653	isl_ast_build_set_iterators(
12654		__isl_take isl_ast_build *build,
12655		__isl_take isl_id_list *iterators);
12656
12657The function C<isl_ast_build_set_iterators> allows the user to
12658specify a list of iterator C<isl_id>s to be used as iterators.
12659If the input schedule is injective, then
12660the number of elements in this list should be as large as the dimension
12661of the schedule space, but no direct correspondence should be assumed
12662between dimensions and elements.
12663If the input schedule is not injective, then an additional number
12664of C<isl_id>s equal to the largest dimension of the input domains
12665may be required.
12666If the number of provided C<isl_id>s is insufficient, then additional
12667names are automatically generated.
12668
12669	#include <isl/ast_build.h>
12670	__isl_give isl_ast_build *
12671	isl_ast_build_set_create_leaf(
12672		__isl_take isl_ast_build *build,
12673		__isl_give isl_ast_node *(*fn)(
12674			__isl_take isl_ast_build *build,
12675			void *user), void *user);
12676
12677The
12678C<isl_ast_build_set_create_leaf> function allows for the
12679specification of a callback that should be called whenever the AST
12680generator arrives at an element of the schedule domain.
12681The callback should return an AST node that should be inserted
12682at the corresponding position of the AST.  The default action (when
12683the callback is not set) is to continue generating parts of the AST to scan
12684all the domain elements associated to the schedule domain element
12685and to insert user nodes, ``calling'' the domain element, for each of them.
12686The C<build> argument contains the current state of the C<isl_ast_build>.
12687To ease nested AST generation (see L</"Nested AST Generation">),
12688all control information that is
12689specific to the current AST generation such as the options and
12690the callbacks has been removed from this C<isl_ast_build>.
12691The callback would typically return the result of a nested
12692AST generation or a
12693user defined node created using the following function.
12694
12695	#include <isl/ast.h>
12696	__isl_give isl_ast_node *isl_ast_node_alloc_user(
12697		__isl_take isl_ast_expr *expr);
12698
12699	#include <isl/ast_build.h>
12700	__isl_give isl_ast_build *
12701	isl_ast_build_set_at_each_domain(
12702		__isl_take isl_ast_build *build,
12703		__isl_give isl_ast_node *(*fn)(
12704			__isl_take isl_ast_node *node,
12705			__isl_keep isl_ast_build *build,
12706			void *user), void *user);
12707	__isl_give isl_ast_build *
12708	isl_ast_build_set_before_each_for(
12709		__isl_take isl_ast_build *build,
12710		__isl_give isl_id *(*fn)(
12711			__isl_keep isl_ast_build *build,
12712			void *user), void *user);
12713	__isl_give isl_ast_build *
12714	isl_ast_build_set_after_each_for(
12715		__isl_take isl_ast_build *build,
12716		__isl_give isl_ast_node *(*fn)(
12717			__isl_take isl_ast_node *node,
12718			__isl_keep isl_ast_build *build,
12719			void *user), void *user);
12720	__isl_give isl_ast_build *
12721	isl_ast_build_set_before_each_mark(
12722		__isl_take isl_ast_build *build,
12723		isl_stat (*fn)(__isl_keep isl_id *mark,
12724			__isl_keep isl_ast_build *build,
12725			void *user), void *user);
12726	__isl_give isl_ast_build *
12727	isl_ast_build_set_after_each_mark(
12728		__isl_take isl_ast_build *build,
12729		__isl_give isl_ast_node *(*fn)(
12730			__isl_take isl_ast_node *node,
12731			__isl_keep isl_ast_build *build,
12732			void *user), void *user);
12733
12734The callback set by C<isl_ast_build_set_at_each_domain> will
12735be called for each domain AST node.
12736The callbacks set by C<isl_ast_build_set_before_each_for>
12737and C<isl_ast_build_set_after_each_for> will be called
12738for each for AST node.  The first will be called in depth-first
12739pre-order, while the second will be called in depth-first post-order.
12740Since C<isl_ast_build_set_before_each_for> is called before the for
12741node is actually constructed, it is only passed an C<isl_ast_build>.
12742The returned C<isl_id> will be added as an annotation (using
12743C<isl_ast_node_set_annotation>) to the constructed for node.
12744In particular, if the user has also specified an C<after_each_for>
12745callback, then the annotation can be retrieved from the node passed to
12746that callback using C<isl_ast_node_get_annotation>.
12747The callbacks set by C<isl_ast_build_set_before_each_mark>
12748and C<isl_ast_build_set_after_each_mark> will be called for each
12749mark AST node that is created, i.e., for each mark schedule node
12750in the input schedule tree.  The first will be called in depth-first
12751pre-order, while the second will be called in depth-first post-order.
12752Since the callback set by C<isl_ast_build_set_before_each_mark>
12753is called before the mark AST node is actually constructed, it is passed
12754the identifier of the mark node.
12755All callbacks should C<NULL> (or C<isl_stat_error>) on failure.
12756The given C<isl_ast_build> can be used to create new
12757C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
12758or C<isl_ast_build_call_from_pw_multi_aff>.
12759
12760=head3 Nested AST Generation
12761
12762C<isl> allows the user to create an AST within the context
12763of another AST.  These nested ASTs are created using the
12764same C<isl_ast_build_node_from_schedule_map> function that is used to create
12765the outer AST.  The C<build> argument should be an C<isl_ast_build>
12766passed to a callback set by
12767C<isl_ast_build_set_create_leaf>.
12768The space of the range of the C<schedule> argument should refer
12769to this build.  In particular, the space should be a wrapped
12770relation and the domain of this wrapped relation should be the
12771same as that of the range of the schedule returned by
12772C<isl_ast_build_get_schedule> below.
12773In practice, the new schedule is typically
12774created by calling C<isl_union_map_range_product> on the old schedule
12775and some extra piece of the schedule.
12776The space of the schedule domain is also available from
12777the C<isl_ast_build>.
12778
12779	#include <isl/ast_build.h>
12780	__isl_give isl_union_map *isl_ast_build_get_schedule(
12781		__isl_keep isl_ast_build *build);
12782	__isl_give isl_space *isl_ast_build_get_schedule_space(
12783		__isl_keep isl_ast_build *build);
12784	__isl_give isl_ast_build *isl_ast_build_restrict(
12785		__isl_take isl_ast_build *build,
12786		__isl_take isl_set *set);
12787
12788The C<isl_ast_build_get_schedule> function returns a (partial)
12789schedule for the domains elements for which part of the AST still needs to
12790be generated in the current build.
12791In particular, the domain elements are mapped to those iterations of the loops
12792enclosing the current point of the AST generation inside which
12793the domain elements are executed.
12794No direct correspondence between
12795the input schedule and this schedule should be assumed.
12796The space obtained from C<isl_ast_build_get_schedule_space> can be used
12797to create a set for C<isl_ast_build_restrict> to intersect
12798with the current build.  In particular, the set passed to
12799C<isl_ast_build_restrict> can have additional parameters.
12800The ids of the set dimensions in the space returned by
12801C<isl_ast_build_get_schedule_space> correspond to the
12802iterators of the already generated loops.
12803The user should not rely on the ids of the output dimensions
12804of the relations in the union relation returned by
12805C<isl_ast_build_get_schedule> having any particular value.
12806
12807=head1 Applications
12808
12809Although C<isl> is mainly meant to be used as a library,
12810it also contains some basic applications that use some
12811of the functionality of C<isl>.
12812For applications that take one or more polytopes or polyhedra
12813as input, this input may be specified in either the L<isl format>
12814or the L<PolyLib format>.
12815
12816=head2 C<isl_polyhedron_sample>
12817
12818C<isl_polyhedron_sample> takes a polyhedron as input and prints
12819an integer element of the polyhedron, if there is any.
12820The first column in the output is the denominator and is always
12821equal to 1.  If the polyhedron contains no integer points,
12822then a vector of length zero is printed.
12823
12824=head2 C<isl_pip>
12825
12826C<isl_pip> takes the same input as the C<example> program
12827from the C<piplib> distribution, i.e., a set of constraints
12828on the parameters, a line containing only -1 and finally a set
12829of constraints on a parametric polyhedron.
12830The coefficients of the parameters appear in the last columns
12831(but before the final constant column).
12832The output is the lexicographic minimum of the parametric polyhedron.
12833As C<isl> currently does not have its own output format, the output
12834is just a dump of the internal state.
12835
12836=head2 C<isl_polyhedron_minimize>
12837
12838C<isl_polyhedron_minimize> computes the minimum of some linear
12839or affine objective function over the integer points in a polyhedron.
12840If an affine objective function
12841is given, then the constant should appear in the last column.
12842
12843=head2 C<isl_polytope_scan>
12844
12845Given a polytope, C<isl_polytope_scan> prints
12846all integer points in the polytope.
12847
12848=head2 C<isl_flow>
12849
12850Given an C<isl_union_access_info> object as input,
12851C<isl_flow> prints out the corresponding dependences,
12852as computed by C<isl_union_access_info_compute_flow>.
12853
12854=head2 C<isl_codegen>
12855
12856Given either a schedule tree or a sequence consisting of
12857a schedule map, a context set and an options relation,
12858C<isl_codegen> prints out an AST that scans the domain elements
12859of the schedule in the order of their image(s) taking into account
12860the constraints in the context set.
12861
12862=head2 C<isl_schedule>
12863
12864Given an C<isl_schedule_constraints> object as input,
12865C<isl_schedule> prints out a schedule that satisfies the given
12866constraints.
12867