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