3 C<isl> is a thread-safe C library for manipulating
4 sets and relations of integer points bounded by affine constraints.
5 The descriptions of the sets and relations may involve
6 both parameters and existentially quantified variables.
7 All computations are performed in exact integer arithmetic
8 using C<GMP> or C<imath>.
9 The C<isl> library offers functionality that is similar
10 to that offered by the C<Omega> and C<Omega+> libraries,
11 but the underlying algorithms are in most cases completely different.
13 The library is by no means complete and some fairly basic
14 functionality is still missing.
15 Still, even in its current form, the library has been successfully
16 used as a backend polyhedral library for the polyhedral
17 scanner C<CLooG> and as part of an equivalence checker of
18 static affine programs.
19 For bug reports, feature requests and questions,
20 visit the discussion group at
21 L<http://groups.google.com/group/isl-development>.
23 =head2 Backward Incompatible Changes
25 =head3 Changes since isl-0.02
29 =item * The old printing functions have been deprecated
30 and replaced by C<isl_printer> functions, see L<Input and Output>.
32 =item * Most functions related to dependence analysis have acquired
33 an extra C<must> argument. To obtain the old behavior, this argument
34 should be given the value 1. See L<Dependence Analysis>.
38 =head3 Changes since isl-0.03
42 =item * The function C<isl_pw_qpolynomial_fold_add> has been
43 renamed to C<isl_pw_qpolynomial_fold_fold>.
44 Similarly, C<isl_union_pw_qpolynomial_fold_add> has been
45 renamed to C<isl_union_pw_qpolynomial_fold_fold>.
49 =head3 Changes since isl-0.04
53 =item * All header files have been renamed from C<isl_header.h>
58 =head3 Changes since isl-0.05
62 =item * The functions C<isl_printer_print_basic_set> and
63 C<isl_printer_print_basic_map> no longer print a newline.
65 =item * The functions C<isl_flow_get_no_source>
66 and C<isl_union_map_compute_flow> now return
67 the accesses for which no source could be found instead of
68 the iterations where those accesses occur.
70 =item * The functions C<isl_basic_map_identity> and
71 C<isl_map_identity> now take a B<map> space as input. An old call
72 C<isl_map_identity(space)> can be rewritten to
73 C<isl_map_identity(isl_space_map_from_set(space))>.
75 =item * The function C<isl_map_power> no longer takes
76 a parameter position as input. Instead, the exponent
77 is now expressed as the domain of the resulting relation.
81 =head3 Changes since isl-0.06
85 =item * The format of C<isl_printer_print_qpolynomial>'s
86 C<ISL_FORMAT_ISL> output has changed.
87 Use C<ISL_FORMAT_C> to obtain the old output.
89 =item * The C<*_fast_*> functions have been renamed to C<*_plain_*>.
90 Some of the old names have been kept for backward compatibility,
91 but they will be removed in the future.
95 =head3 Changes since isl-0.07
99 =item * The function C<isl_pw_aff_max> has been renamed to
100 C<isl_pw_aff_union_max>.
101 Similarly, the function C<isl_pw_aff_add> has been renamed to
102 C<isl_pw_aff_union_add>.
104 =item * The C<isl_dim> type has been renamed to C<isl_space>
105 along with the associated functions.
106 Some of the old names have been kept for backward compatibility,
107 but they will be removed in the future.
109 =item * Spaces of maps, sets and parameter domains are now
110 treated differently. The distinction between map spaces and set spaces
111 has always been made on a conceptual level, but proper use of such spaces
112 was never checked. Furthermore, up until isl-0.07 there was no way
113 of explicitly creating a parameter space. These can now be created
114 directly using C<isl_space_params_alloc> or from other spaces using
117 =item * The space in which C<isl_aff>, C<isl_pw_aff>, C<isl_qpolynomial>,
118 C<isl_pw_qpolynomial>, C<isl_qpolynomial_fold> and C<isl_pw_qpolynomial_fold>
119 objects live is now a map space
120 instead of a set space. This means, for example, that the dimensions
121 of the domain of an C<isl_aff> are now considered to be of type
122 C<isl_dim_in> instead of C<isl_dim_set>. Extra functions have been
123 added to obtain the domain space. Some of the constructors still
124 take a domain space and have therefore been renamed.
126 =item * The functions C<isl_equality_alloc> and C<isl_inequality_alloc>
127 now take an C<isl_local_space> instead of an C<isl_space>.
128 An C<isl_local_space> can be created from an C<isl_space>
129 using C<isl_local_space_from_space>.
131 =item * The C<isl_div> type has been removed. Functions that used
132 to return an C<isl_div> now return an C<isl_aff>.
133 Note that the space of an C<isl_aff> is that of relation.
134 When replacing a call to C<isl_div_get_coefficient> by a call to
135 C<isl_aff_get_coefficient> any C<isl_dim_set> argument needs
136 to be replaced by C<isl_dim_in>.
137 A call to C<isl_aff_from_div> can be replaced by a call
139 A call to C<isl_qpolynomial_div(div)> call be replaced by
142 isl_qpolynomial_from_aff(isl_aff_floor(div))
144 The function C<isl_constraint_div> has also been renamed
145 to C<isl_constraint_get_div>.
147 =item * The C<nparam> argument has been removed from
148 C<isl_map_read_from_str> and similar functions.
149 When reading input in the original PolyLib format,
150 the result will have no parameters.
151 If parameters are expected, the caller may want to perform
152 dimension manipulation on the result.
156 =head3 Changes since isl-0.09
160 =item * The C<schedule_split_parallel> option has been replaced
161 by the C<schedule_split_scaled> option.
163 =item * The first argument of C<isl_pw_aff_cond> is now
164 an C<isl_pw_aff> instead of an C<isl_set>.
165 A call C<isl_pw_aff_cond(a, b, c)> can be replaced by
167 isl_pw_aff_cond(isl_set_indicator_function(a), b, c)
171 =head3 Changes since isl-0.10
175 =item * The functions C<isl_set_dim_has_lower_bound> and
176 C<isl_set_dim_has_upper_bound> have been renamed to
177 C<isl_set_dim_has_any_lower_bound> and
178 C<isl_set_dim_has_any_upper_bound>.
179 The new C<isl_set_dim_has_lower_bound> and
180 C<isl_set_dim_has_upper_bound> have slightly different meanings.
184 =head3 Changes since isl-0.12
188 =item * C<isl_int> has been replaced by C<isl_val>.
189 Some of the old functions are still available in C<isl/deprecated/*.h>
190 but they will be removed in the future.
192 =item * The functions C<isl_pw_qpolynomial_eval>,
193 C<isl_union_pw_qpolynomial_eval>, C<isl_pw_qpolynomial_fold_eval>
194 and C<isl_union_pw_qpolynomial_fold_eval> have been changed to return
195 an C<isl_val> instead of an C<isl_qpolynomial>.
197 =item * The function C<isl_band_member_is_zero_distance>
198 has been removed. Essentially the same functionality is available
199 through C<isl_band_member_is_coincident>, except that is requires
200 setting up coincidence constraints.
201 The option C<schedule_outer_zero_distance> has accordingly been
202 replaced by the option C<schedule_outer_coincidence>.
204 =item * The function C<isl_vertex_get_expr> has been changed
205 to return an C<isl_multi_aff> instead of a rational C<isl_basic_set>.
206 The function C<isl_vertex_get_domain> has been changed to return
207 a regular basic set, rather than a rational basic set.
211 =head3 Changes since isl-0.14
215 =item * Objects of type C<isl_union_pw_multi_aff> can no longer contain
216 two or more C<isl_pw_multi_aff> objects with the same domain space.
222 C<isl> is released under the MIT license.
226 Permission is hereby granted, free of charge, to any person obtaining a copy of
227 this software and associated documentation files (the "Software"), to deal in
228 the Software without restriction, including without limitation the rights to
229 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
230 of the Software, and to permit persons to whom the Software is furnished to do
231 so, subject to the following conditions:
233 The above copyright notice and this permission notice shall be included in all
234 copies or substantial portions of the Software.
236 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
237 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
238 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
239 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
240 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
241 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
246 Note that by default C<isl> requires C<GMP>, which is released
247 under the GNU Lesser General Public License (LGPL). This means
248 that code linked against C<isl> is also linked against LGPL code.
250 When configuring with C<--with-int=imath>, C<isl> will link against C<imath>, a
251 library for exact integer arithmetic released under the MIT license.
255 The source of C<isl> can be obtained either as a tarball
256 or from the git repository. Both are available from
257 L<http://freshmeat.net/projects/isl/>.
258 The installation process depends on how you obtained
261 =head2 Installation from the git repository
265 =item 1 Clone or update the repository
267 The first time the source is obtained, you need to clone
270 git clone git://repo.or.cz/isl.git
272 To obtain updates, you need to pull in the latest changes
276 =item 2 Optionally get C<imath> submodule
278 To build C<isl> with C<imath>, you need to obtain the C<imath>
279 submodule by running in the git source tree of C<isl>
284 This will fetch the required version of C<imath> in a subdirectory of C<isl>.
286 =item 2 Generate C<configure>
292 After performing the above steps, continue
293 with the L<Common installation instructions>.
295 =head2 Common installation instructions
299 =item 1 Obtain C<GMP>
301 By default, building C<isl> requires C<GMP>, including its headers files.
302 Your distribution may not provide these header files by default
303 and you may need to install a package called C<gmp-devel> or something
304 similar. Alternatively, C<GMP> can be built from
305 source, available from L<http://gmplib.org/>.
306 C<GMP> is not needed if you build C<isl> with C<imath>.
310 C<isl> uses the standard C<autoconf> C<configure> script.
315 optionally followed by some configure options.
316 A complete list of options can be obtained by running
320 Below we discuss some of the more common options.
326 Installation prefix for C<isl>
328 =item C<--with-int=[gmp|imath]>
330 Select the integer library to be used by C<isl>, the default is C<gmp>.
331 Note that C<isl> may run significantly slower if you use C<imath>.
333 =item C<--with-gmp-prefix>
335 Installation prefix for C<GMP> (architecture-independent files).
337 =item C<--with-gmp-exec-prefix>
339 Installation prefix for C<GMP> (architecture-dependent files).
347 =item 4 Install (optional)
353 =head1 Integer Set Library
355 =head2 Memory Management
357 Since a high-level operation on isl objects usually involves
358 several substeps and since the user is usually not interested in
359 the intermediate results, most functions that return a new object
360 will also release all the objects passed as arguments.
361 If the user still wants to use one or more of these arguments
362 after the function call, she should pass along a copy of the
363 object rather than the object itself.
364 The user is then responsible for making sure that the original
365 object gets used somewhere else or is explicitly freed.
367 The arguments and return values of all documented functions are
368 annotated to make clear which arguments are released and which
369 arguments are preserved. In particular, the following annotations
376 C<__isl_give> means that a new object is returned.
377 The user should make sure that the returned pointer is
378 used exactly once as a value for an C<__isl_take> argument.
379 In between, it can be used as a value for as many
380 C<__isl_keep> arguments as the user likes.
381 There is one exception, and that is the case where the
382 pointer returned is C<NULL>. Is this case, the user
383 is free to use it as an C<__isl_take> argument or not.
384 When applied to a C<char *>, the returned pointer needs to be
389 C<__isl_null> means that a C<NULL> value is returned.
393 C<__isl_take> means that the object the argument points to
394 is taken over by the function and may no longer be used
395 by the user as an argument to any other function.
396 The pointer value must be one returned by a function
397 returning an C<__isl_give> pointer.
398 If the user passes in a C<NULL> value, then this will
399 be treated as an error in the sense that the function will
400 not perform its usual operation. However, it will still
401 make sure that all the other C<__isl_take> arguments
406 C<__isl_keep> means that the function will only use the object
407 temporarily. After the function has finished, the user
408 can still use it as an argument to other functions.
409 A C<NULL> value will be treated in the same way as
410 a C<NULL> value for an C<__isl_take> argument.
411 This annotation may also be used on return values of
412 type C<const char *>, in which case the returned pointer should
413 not be freed by the user and is only valid until the object
414 from which it was derived is updated or freed.
418 =head2 Initialization
420 All manipulations of integer sets and relations occur within
421 the context of an C<isl_ctx>.
422 A given C<isl_ctx> can only be used within a single thread.
423 All arguments of a function are required to have been allocated
424 within the same context.
425 There are currently no functions available for moving an object
426 from one C<isl_ctx> to another C<isl_ctx>. This means that
427 there is currently no way of safely moving an object from one
428 thread to another, unless the whole C<isl_ctx> is moved.
430 An C<isl_ctx> can be allocated using C<isl_ctx_alloc> and
431 freed using C<isl_ctx_free>.
432 All objects allocated within an C<isl_ctx> should be freed
433 before the C<isl_ctx> itself is freed.
435 isl_ctx *isl_ctx_alloc();
436 void isl_ctx_free(isl_ctx *ctx);
438 The user can impose a bound on the number of low-level I<operations>
439 that can be performed by an C<isl_ctx>. This bound can be set and
440 retrieved using the following functions. A bound of zero means that
441 no bound is imposed. The number of operations performed can be
442 reset using C<isl_ctx_reset_operations>. Note that the number
443 of low-level operations needed to perform a high-level computation
444 may differ significantly across different versions
445 of C<isl>, but it should be the same across different platforms
446 for the same version of C<isl>.
448 Warning: This feature is experimental. C<isl> has good support to abort and
449 bail out during the computation, but this feature may exercise error code paths
450 that are normally not used that much. Consequently, it is not unlikely that
451 hidden bugs will be exposed.
453 void isl_ctx_set_max_operations(isl_ctx *ctx,
454 unsigned long max_operations);
455 unsigned long isl_ctx_get_max_operations(isl_ctx *ctx);
456 void isl_ctx_reset_operations(isl_ctx *ctx);
458 In order to be able to create an object in the same context
459 as another object, most object types (described later in
460 this document) provide a function to obtain the context
461 in which the object was created.
464 isl_ctx *isl_val_get_ctx(__isl_keep isl_val *val);
465 isl_ctx *isl_multi_val_get_ctx(
466 __isl_keep isl_multi_val *mv);
469 isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
471 #include <isl/local_space.h>
472 isl_ctx *isl_local_space_get_ctx(
473 __isl_keep isl_local_space *ls);
476 isl_ctx *isl_set_list_get_ctx(
477 __isl_keep isl_set_list *list);
480 isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
481 isl_ctx *isl_multi_aff_get_ctx(
482 __isl_keep isl_multi_aff *maff);
483 isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pa);
484 isl_ctx *isl_pw_multi_aff_get_ctx(
485 __isl_keep isl_pw_multi_aff *pma);
486 isl_ctx *isl_multi_pw_aff_get_ctx(
487 __isl_keep isl_multi_pw_aff *mpa);
488 isl_ctx *isl_union_pw_multi_aff_get_ctx(
489 __isl_keep isl_union_pw_multi_aff *upma);
491 #include <isl/id_to_ast_expr.h>
492 isl_ctx *isl_id_to_ast_expr_get_ctx(
493 __isl_keep id_to_ast_expr *id2expr);
495 #include <isl/point.h>
496 isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
499 isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
502 isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
504 #include <isl/vertices.h>
505 isl_ctx *isl_vertices_get_ctx(
506 __isl_keep isl_vertices *vertices);
507 isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
508 isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
510 #include <isl/flow.h>
511 isl_ctx *isl_restriction_get_ctx(
512 __isl_keep isl_restriction *restr);
514 #include <isl/schedule.h>
515 isl_ctx *isl_schedule_constraints_get_ctx(
516 __isl_keep isl_schedule_constraints *sc);
518 #include <isl/band.h>
519 isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band);
521 #include <isl/ast_build.h>
522 isl_ctx *isl_ast_build_get_ctx(
523 __isl_keep isl_ast_build *build);
526 isl_ctx *isl_ast_expr_get_ctx(
527 __isl_keep isl_ast_expr *expr);
528 isl_ctx *isl_ast_node_get_ctx(
529 __isl_keep isl_ast_node *node);
533 An C<isl_val> represents an integer value, a rational value
534 or one of three special values, infinity, negative infinity and NaN.
535 Some predefined values can be created using the following functions.
538 __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
539 __isl_give isl_val *isl_val_one(isl_ctx *ctx);
540 __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
541 __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
542 __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
543 __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
545 Specific integer values can be created using the following functions.
548 __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
550 __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
552 __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
553 size_t n, size_t size, const void *chunks);
555 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
556 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
557 The least significant digit is assumed to be stored first.
559 Value objects can be copied and freed using the following functions.
562 __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
563 __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
565 They can be inspected using the following functions.
568 long isl_val_get_num_si(__isl_keep isl_val *v);
569 long isl_val_get_den_si(__isl_keep isl_val *v);
570 double isl_val_get_d(__isl_keep isl_val *v);
571 size_t isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
573 int isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
574 size_t size, void *chunks);
576 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
577 of C<size> bytes needed to store the absolute value of the
579 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
580 which is assumed to have been preallocated by the caller.
581 The least significant digit is stored first.
582 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
583 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
584 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
586 An C<isl_val> can be modified using the following function.
589 __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
592 The following unary properties are defined on C<isl_val>s.
595 int isl_val_sgn(__isl_keep isl_val *v);
596 int isl_val_is_zero(__isl_keep isl_val *v);
597 int isl_val_is_one(__isl_keep isl_val *v);
598 int isl_val_is_negone(__isl_keep isl_val *v);
599 int isl_val_is_nonneg(__isl_keep isl_val *v);
600 int isl_val_is_nonpos(__isl_keep isl_val *v);
601 int isl_val_is_pos(__isl_keep isl_val *v);
602 int isl_val_is_neg(__isl_keep isl_val *v);
603 int isl_val_is_int(__isl_keep isl_val *v);
604 int isl_val_is_rat(__isl_keep isl_val *v);
605 int isl_val_is_nan(__isl_keep isl_val *v);
606 int isl_val_is_infty(__isl_keep isl_val *v);
607 int isl_val_is_neginfty(__isl_keep isl_val *v);
609 Note that the sign of NaN is undefined.
611 The following binary properties are defined on pairs of C<isl_val>s.
614 int isl_val_lt(__isl_keep isl_val *v1,
615 __isl_keep isl_val *v2);
616 int isl_val_le(__isl_keep isl_val *v1,
617 __isl_keep isl_val *v2);
618 int isl_val_gt(__isl_keep isl_val *v1,
619 __isl_keep isl_val *v2);
620 int isl_val_ge(__isl_keep isl_val *v1,
621 __isl_keep isl_val *v2);
622 int isl_val_eq(__isl_keep isl_val *v1,
623 __isl_keep isl_val *v2);
624 int isl_val_ne(__isl_keep isl_val *v1,
625 __isl_keep isl_val *v2);
626 int isl_val_abs_eq(__isl_keep isl_val *v1,
627 __isl_keep isl_val *v2);
629 The function C<isl_val_abs_eq> checks whether its two arguments
630 are equal in absolute value.
632 For integer C<isl_val>s we additionally have the following binary property.
635 int isl_val_is_divisible_by(__isl_keep isl_val *v1,
636 __isl_keep isl_val *v2);
638 An C<isl_val> can also be compared to an integer using the following
639 function. The result is undefined for NaN.
642 int isl_val_cmp_si(__isl_keep isl_val *v, long i);
644 The following unary operations are available on C<isl_val>s.
647 __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
648 __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
649 __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
650 __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
651 __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
652 __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
654 The following binary operations are available on C<isl_val>s.
657 __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
658 __isl_take isl_val *v2);
659 __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
660 __isl_take isl_val *v2);
661 __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
662 __isl_take isl_val *v2);
663 __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
665 __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
666 __isl_take isl_val *v2);
667 __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
669 __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
670 __isl_take isl_val *v2);
671 __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
673 __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
674 __isl_take isl_val *v2);
676 On integer values, we additionally have the following operations.
679 __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
680 __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
681 __isl_take isl_val *v2);
682 __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
683 __isl_take isl_val *v2);
684 __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
685 __isl_take isl_val *v2, __isl_give isl_val **x,
686 __isl_give isl_val **y);
688 The function C<isl_val_gcdext> returns the greatest common divisor g
689 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
690 that C<*x> * C<v1> + C<*y> * C<v2> = g.
692 =head3 GMP specific functions
694 These functions are only available if C<isl> has been compiled with C<GMP>
697 Specific integer and rational values can be created from C<GMP> values using
698 the following functions.
700 #include <isl/val_gmp.h>
701 __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
703 __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
704 const mpz_t n, const mpz_t d);
706 The numerator and denominator of a rational value can be extracted as
707 C<GMP> values using the following functions.
709 #include <isl/val_gmp.h>
710 int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
711 int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
713 =head2 Sets and Relations
715 C<isl> uses six types of objects for representing sets and relations,
716 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
717 C<isl_union_set> and C<isl_union_map>.
718 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
719 can be described as a conjunction of affine constraints, while
720 C<isl_set> and C<isl_map> represent unions of
721 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
722 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
723 to live in the same space. C<isl_union_set>s and C<isl_union_map>s
724 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
725 where spaces are considered different if they have a different number
726 of dimensions and/or different names (see L<"Spaces">).
727 The difference between sets and relations (maps) is that sets have
728 one set of variables, while relations have two sets of variables,
729 input variables and output variables.
731 =head2 Error Handling
733 C<isl> supports different ways to react in case a runtime error is triggered.
734 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
735 with two maps that have incompatible spaces. There are three possible ways
736 to react on error: to warn, to continue or to abort.
738 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
739 the last error in the corresponding C<isl_ctx> and the function in which the
740 error was triggered returns C<NULL>. An error does not corrupt internal state,
741 such that isl can continue to be used. C<isl> also provides functions to
742 read the last error and to reset the memory that stores the last error. The
743 last error is only stored for information purposes. Its presence does not
744 change the behavior of C<isl>. Hence, resetting an error is not required to
745 continue to use isl, but only to observe new errors.
748 enum isl_error isl_ctx_last_error(isl_ctx *ctx);
749 void isl_ctx_reset_error(isl_ctx *ctx);
751 Another option is to continue on error. This is similar to warn on error mode,
752 except that C<isl> does not print any warning. This allows a program to
753 implement its own error reporting.
755 The last option is to directly abort the execution of the program from within
756 the isl library. This makes it obviously impossible to recover from an error,
757 but it allows to directly spot the error location. By aborting on error,
758 debuggers break at the location the error occurred and can provide a stack
759 trace. Other tools that automatically provide stack traces on abort or that do
760 not want to continue execution after an error was triggered may also prefer to
763 The on error behavior of isl can be specified by calling
764 C<isl_options_set_on_error> or by setting the command line option
765 C<--isl-on-error>. Valid arguments for the function call are
766 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
767 choices for the command line option are C<warn>, C<continue> and C<abort>.
768 It is also possible to query the current error mode.
770 #include <isl/options.h>
771 int isl_options_set_on_error(isl_ctx *ctx, int val);
772 int isl_options_get_on_error(isl_ctx *ctx);
776 Identifiers are used to identify both individual dimensions
777 and tuples of dimensions. They consist of an optional name and an optional
778 user pointer. The name and the user pointer cannot both be C<NULL>, however.
779 Identifiers with the same name but different pointer values
780 are considered to be distinct.
781 Similarly, identifiers with different names but the same pointer value
782 are also considered to be distinct.
783 Equal identifiers are represented using the same object.
784 Pairs of identifiers can therefore be tested for equality using the
786 Identifiers can be constructed, copied, freed, inspected and printed
787 using the following functions.
790 __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
791 __isl_keep const char *name, void *user);
792 __isl_give isl_id *isl_id_set_free_user(
793 __isl_take isl_id *id,
794 __isl_give void (*free_user)(void *user));
795 __isl_give isl_id *isl_id_copy(isl_id *id);
796 __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
798 void *isl_id_get_user(__isl_keep isl_id *id);
799 __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
801 __isl_give isl_printer *isl_printer_print_id(
802 __isl_take isl_printer *p, __isl_keep isl_id *id);
804 The callback set by C<isl_id_set_free_user> is called on the user
805 pointer when the last reference to the C<isl_id> is freed.
806 Note that C<isl_id_get_name> returns a pointer to some internal
807 data structure, so the result can only be used while the
808 corresponding C<isl_id> is alive.
812 Whenever a new set, relation or similar object is created from scratch,
813 the space in which it lives needs to be specified using an C<isl_space>.
814 Each space involves zero or more parameters and zero, one or two
815 tuples of set or input/output dimensions. The parameters and dimensions
816 are identified by an C<isl_dim_type> and a position.
817 The type C<isl_dim_param> refers to parameters,
818 the type C<isl_dim_set> refers to set dimensions (for spaces
819 with a single tuple of dimensions) and the types C<isl_dim_in>
820 and C<isl_dim_out> refer to input and output dimensions
821 (for spaces with two tuples of dimensions).
822 Local spaces (see L</"Local Spaces">) also contain dimensions
823 of type C<isl_dim_div>.
824 Note that parameters are only identified by their position within
825 a given object. Across different objects, parameters are (usually)
826 identified by their names or identifiers. Only unnamed parameters
827 are identified by their positions across objects. The use of unnamed
828 parameters is discouraged.
830 #include <isl/space.h>
831 __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
832 unsigned nparam, unsigned n_in, unsigned n_out);
833 __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
835 __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
836 unsigned nparam, unsigned dim);
837 __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
838 __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
840 The space used for creating a parameter domain
841 needs to be created using C<isl_space_params_alloc>.
842 For other sets, the space
843 needs to be created using C<isl_space_set_alloc>, while
844 for a relation, the space
845 needs to be created using C<isl_space_alloc>.
847 To check whether a given space is that of a set or a map
848 or whether it is a parameter space, use these functions:
850 #include <isl/space.h>
851 int isl_space_is_params(__isl_keep isl_space *space);
852 int isl_space_is_set(__isl_keep isl_space *space);
853 int isl_space_is_map(__isl_keep isl_space *space);
855 Spaces can be compared using the following functions:
857 #include <isl/space.h>
858 int isl_space_is_equal(__isl_keep isl_space *space1,
859 __isl_keep isl_space *space2);
860 int isl_space_is_domain(__isl_keep isl_space *space1,
861 __isl_keep isl_space *space2);
862 int isl_space_is_range(__isl_keep isl_space *space1,
863 __isl_keep isl_space *space2);
864 int isl_space_tuple_is_equal(
865 __isl_keep isl_space *space1,
866 enum isl_dim_type type1,
867 __isl_keep isl_space *space2,
868 enum isl_dim_type type2);
870 C<isl_space_is_domain> checks whether the first argument is equal
871 to the domain of the second argument. This requires in particular that
872 the first argument is a set space and that the second argument
873 is a map space. C<isl_space_tuple_is_equal> checks whether the given
874 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
875 spaces are the same. That is, it checks if they have the same
876 identifier (if any), the same dimension and the same internal structure
879 It is often useful to create objects that live in the
880 same space as some other object. This can be accomplished
881 by creating the new objects
882 (see L</"Creating New Sets and Relations"> or
883 L</"Functions">) based on the space
884 of the original object.
887 __isl_give isl_space *isl_basic_set_get_space(
888 __isl_keep isl_basic_set *bset);
889 __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
891 #include <isl/union_set.h>
892 __isl_give isl_space *isl_union_set_get_space(
893 __isl_keep isl_union_set *uset);
896 __isl_give isl_space *isl_basic_map_get_space(
897 __isl_keep isl_basic_map *bmap);
898 __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
900 #include <isl/union_map.h>
901 __isl_give isl_space *isl_union_map_get_space(
902 __isl_keep isl_union_map *umap);
904 #include <isl/constraint.h>
905 __isl_give isl_space *isl_constraint_get_space(
906 __isl_keep isl_constraint *constraint);
908 #include <isl/polynomial.h>
909 __isl_give isl_space *isl_qpolynomial_get_domain_space(
910 __isl_keep isl_qpolynomial *qp);
911 __isl_give isl_space *isl_qpolynomial_get_space(
912 __isl_keep isl_qpolynomial *qp);
913 __isl_give isl_space *isl_qpolynomial_fold_get_space(
914 __isl_keep isl_qpolynomial_fold *fold);
915 __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
916 __isl_keep isl_pw_qpolynomial *pwqp);
917 __isl_give isl_space *isl_pw_qpolynomial_get_space(
918 __isl_keep isl_pw_qpolynomial *pwqp);
919 __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
920 __isl_keep isl_pw_qpolynomial_fold *pwf);
921 __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
922 __isl_keep isl_pw_qpolynomial_fold *pwf);
923 __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
924 __isl_keep isl_union_pw_qpolynomial *upwqp);
925 __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
926 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
929 __isl_give isl_space *isl_multi_val_get_space(
930 __isl_keep isl_multi_val *mv);
933 __isl_give isl_space *isl_aff_get_domain_space(
934 __isl_keep isl_aff *aff);
935 __isl_give isl_space *isl_aff_get_space(
936 __isl_keep isl_aff *aff);
937 __isl_give isl_space *isl_pw_aff_get_domain_space(
938 __isl_keep isl_pw_aff *pwaff);
939 __isl_give isl_space *isl_pw_aff_get_space(
940 __isl_keep isl_pw_aff *pwaff);
941 __isl_give isl_space *isl_multi_aff_get_domain_space(
942 __isl_keep isl_multi_aff *maff);
943 __isl_give isl_space *isl_multi_aff_get_space(
944 __isl_keep isl_multi_aff *maff);
945 __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
946 __isl_keep isl_pw_multi_aff *pma);
947 __isl_give isl_space *isl_pw_multi_aff_get_space(
948 __isl_keep isl_pw_multi_aff *pma);
949 __isl_give isl_space *isl_union_pw_multi_aff_get_space(
950 __isl_keep isl_union_pw_multi_aff *upma);
951 __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
952 __isl_keep isl_multi_pw_aff *mpa);
953 __isl_give isl_space *isl_multi_pw_aff_get_space(
954 __isl_keep isl_multi_pw_aff *mpa);
956 #include <isl/point.h>
957 __isl_give isl_space *isl_point_get_space(
958 __isl_keep isl_point *pnt);
960 The number of dimensions of a given type of space
961 may be read off from a space or an object that lives
962 in a space using the following functions.
963 In case of C<isl_space_dim>, type may be
964 C<isl_dim_param>, C<isl_dim_in> (only for relations),
965 C<isl_dim_out> (only for relations), C<isl_dim_set>
966 (only for sets) or C<isl_dim_all>.
968 #include <isl/space.h>
969 unsigned isl_space_dim(__isl_keep isl_space *space,
970 enum isl_dim_type type);
972 #include <isl/local_space.h>
973 int isl_local_space_dim(__isl_keep isl_local_space *ls,
974 enum isl_dim_type type);
977 unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
978 enum isl_dim_type type);
979 unsigned isl_set_dim(__isl_keep isl_set *set,
980 enum isl_dim_type type);
983 unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
984 enum isl_dim_type type);
985 unsigned isl_map_dim(__isl_keep isl_map *map,
986 enum isl_dim_type type);
988 #include <isl/union_map.h>
989 unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
990 enum isl_dim_type type);
993 unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
994 enum isl_dim_type type);
997 int isl_aff_dim(__isl_keep isl_aff *aff,
998 enum isl_dim_type type);
999 unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1000 enum isl_dim_type type);
1001 unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1002 enum isl_dim_type type);
1003 unsigned isl_pw_multi_aff_dim(
1004 __isl_keep isl_pw_multi_aff *pma,
1005 enum isl_dim_type type);
1006 unsigned isl_multi_pw_aff_dim(
1007 __isl_keep isl_multi_pw_aff *mpa,
1008 enum isl_dim_type type);
1010 Note that an C<isl_union_map> only has parameters.
1012 The identifiers or names of the individual dimensions of spaces
1013 may be set or read off using the following functions on spaces
1014 or objects that live in spaces.
1015 These functions are mostly useful to obtain the identifiers, positions
1016 or names of the parameters. Identifiers of individual dimensions are
1017 essentially only useful for printing. They are ignored by all other
1018 operations and may not be preserved across those operations.
1020 #include <isl/space.h>
1021 __isl_give isl_space *isl_space_set_dim_id(
1022 __isl_take isl_space *space,
1023 enum isl_dim_type type, unsigned pos,
1024 __isl_take isl_id *id);
1025 int isl_space_has_dim_id(__isl_keep isl_space *space,
1026 enum isl_dim_type type, unsigned pos);
1027 __isl_give isl_id *isl_space_get_dim_id(
1028 __isl_keep isl_space *space,
1029 enum isl_dim_type type, unsigned pos);
1030 __isl_give isl_space *isl_space_set_dim_name(
1031 __isl_take isl_space *space,
1032 enum isl_dim_type type, unsigned pos,
1033 __isl_keep const char *name);
1034 int isl_space_has_dim_name(__isl_keep isl_space *space,
1035 enum isl_dim_type type, unsigned pos);
1036 __isl_keep const char *isl_space_get_dim_name(
1037 __isl_keep isl_space *space,
1038 enum isl_dim_type type, unsigned pos);
1040 #include <isl/local_space.h>
1041 __isl_give isl_local_space *isl_local_space_set_dim_id(
1042 __isl_take isl_local_space *ls,
1043 enum isl_dim_type type, unsigned pos,
1044 __isl_take isl_id *id);
1045 int isl_local_space_has_dim_id(
1046 __isl_keep isl_local_space *ls,
1047 enum isl_dim_type type, unsigned pos);
1048 __isl_give isl_id *isl_local_space_get_dim_id(
1049 __isl_keep isl_local_space *ls,
1050 enum isl_dim_type type, unsigned pos);
1051 __isl_give isl_local_space *isl_local_space_set_dim_name(
1052 __isl_take isl_local_space *ls,
1053 enum isl_dim_type type, unsigned pos, const char *s);
1054 int isl_local_space_has_dim_name(
1055 __isl_keep isl_local_space *ls,
1056 enum isl_dim_type type, unsigned pos)
1057 const char *isl_local_space_get_dim_name(
1058 __isl_keep isl_local_space *ls,
1059 enum isl_dim_type type, unsigned pos);
1061 #include <isl/constraint.h>
1062 const char *isl_constraint_get_dim_name(
1063 __isl_keep isl_constraint *constraint,
1064 enum isl_dim_type type, unsigned pos);
1066 #include <isl/set.h>
1067 __isl_give isl_id *isl_basic_set_get_dim_id(
1068 __isl_keep isl_basic_set *bset,
1069 enum isl_dim_type type, unsigned pos);
1070 __isl_give isl_set *isl_set_set_dim_id(
1071 __isl_take isl_set *set, enum isl_dim_type type,
1072 unsigned pos, __isl_take isl_id *id);
1073 int isl_set_has_dim_id(__isl_keep isl_set *set,
1074 enum isl_dim_type type, unsigned pos);
1075 __isl_give isl_id *isl_set_get_dim_id(
1076 __isl_keep isl_set *set, enum isl_dim_type type,
1078 const char *isl_basic_set_get_dim_name(
1079 __isl_keep isl_basic_set *bset,
1080 enum isl_dim_type type, unsigned pos);
1081 int isl_set_has_dim_name(__isl_keep isl_set *set,
1082 enum isl_dim_type type, unsigned pos);
1083 const char *isl_set_get_dim_name(
1084 __isl_keep isl_set *set,
1085 enum isl_dim_type type, unsigned pos);
1087 #include <isl/map.h>
1088 __isl_give isl_map *isl_map_set_dim_id(
1089 __isl_take isl_map *map, enum isl_dim_type type,
1090 unsigned pos, __isl_take isl_id *id);
1091 int isl_basic_map_has_dim_id(
1092 __isl_keep isl_basic_map *bmap,
1093 enum isl_dim_type type, unsigned pos);
1094 int isl_map_has_dim_id(__isl_keep isl_map *map,
1095 enum isl_dim_type type, unsigned pos);
1096 __isl_give isl_id *isl_map_get_dim_id(
1097 __isl_keep isl_map *map, enum isl_dim_type type,
1099 __isl_give isl_id *isl_union_map_get_dim_id(
1100 __isl_keep isl_union_map *umap,
1101 enum isl_dim_type type, unsigned pos);
1102 const char *isl_basic_map_get_dim_name(
1103 __isl_keep isl_basic_map *bmap,
1104 enum isl_dim_type type, unsigned pos);
1105 int isl_map_has_dim_name(__isl_keep isl_map *map,
1106 enum isl_dim_type type, unsigned pos);
1107 const char *isl_map_get_dim_name(
1108 __isl_keep isl_map *map,
1109 enum isl_dim_type type, unsigned pos);
1111 #include <isl/val.h>
1112 __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1113 __isl_take isl_multi_val *mv,
1114 enum isl_dim_type type, unsigned pos,
1115 __isl_take isl_id *id);
1116 __isl_give isl_id *isl_multi_val_get_dim_id(
1117 __isl_keep isl_multi_val *mv,
1118 enum isl_dim_type type, unsigned pos);
1119 __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1120 __isl_take isl_multi_val *mv,
1121 enum isl_dim_type type, unsigned pos, const char *s);
1123 #include <isl/aff.h>
1124 __isl_give isl_aff *isl_aff_set_dim_id(
1125 __isl_take isl_aff *aff, enum isl_dim_type type,
1126 unsigned pos, __isl_take isl_id *id);
1127 __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1128 __isl_take isl_multi_aff *maff,
1129 enum isl_dim_type type, unsigned pos,
1130 __isl_take isl_id *id);
1131 __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1132 __isl_take isl_pw_aff *pma,
1133 enum isl_dim_type type, unsigned pos,
1134 __isl_take isl_id *id);
1135 __isl_give isl_multi_pw_aff *
1136 isl_multi_pw_aff_set_dim_id(
1137 __isl_take isl_multi_pw_aff *mpa,
1138 enum isl_dim_type type, unsigned pos,
1139 __isl_take isl_id *id);
1140 __isl_give isl_id *isl_multi_aff_get_dim_id(
1141 __isl_keep isl_multi_aff *ma,
1142 enum isl_dim_type type, unsigned pos);
1143 int isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1144 enum isl_dim_type type, unsigned pos);
1145 __isl_give isl_id *isl_pw_aff_get_dim_id(
1146 __isl_keep isl_pw_aff *pa,
1147 enum isl_dim_type type, unsigned pos);
1148 __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1149 __isl_keep isl_pw_multi_aff *pma,
1150 enum isl_dim_type type, unsigned pos);
1151 __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1152 __isl_keep isl_multi_pw_aff *mpa,
1153 enum isl_dim_type type, unsigned pos);
1154 __isl_give isl_aff *isl_aff_set_dim_name(
1155 __isl_take isl_aff *aff, enum isl_dim_type type,
1156 unsigned pos, const char *s);
1157 __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1158 __isl_take isl_multi_aff *maff,
1159 enum isl_dim_type type, unsigned pos, const char *s);
1160 __isl_give isl_multi_pw_aff *
1161 isl_multi_pw_aff_set_dim_name(
1162 __isl_take isl_multi_pw_aff *mpa,
1163 enum isl_dim_type type, unsigned pos, const char *s);
1164 const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1165 enum isl_dim_type type, unsigned pos);
1166 const char *isl_pw_aff_get_dim_name(
1167 __isl_keep isl_pw_aff *pa,
1168 enum isl_dim_type type, unsigned pos);
1169 const char *isl_pw_multi_aff_get_dim_name(
1170 __isl_keep isl_pw_multi_aff *pma,
1171 enum isl_dim_type type, unsigned pos);
1173 #include <isl/polynomial.h>
1174 __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1175 __isl_take isl_qpolynomial *qp,
1176 enum isl_dim_type type, unsigned pos,
1178 __isl_give isl_pw_qpolynomial *
1179 isl_pw_qpolynomial_set_dim_name(
1180 __isl_take isl_pw_qpolynomial *pwqp,
1181 enum isl_dim_type type, unsigned pos,
1183 __isl_give isl_pw_qpolynomial_fold *
1184 isl_pw_qpolynomial_fold_set_dim_name(
1185 __isl_take isl_pw_qpolynomial_fold *pwf,
1186 enum isl_dim_type type, unsigned pos,
1189 Note that C<isl_space_get_name> returns a pointer to some internal
1190 data structure, so the result can only be used while the
1191 corresponding C<isl_space> is alive.
1192 Also note that every function that operates on two sets or relations
1193 requires that both arguments have the same parameters. This also
1194 means that if one of the arguments has named parameters, then the
1195 other needs to have named parameters too and the names need to match.
1196 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1197 arguments may have different parameters (as long as they are named),
1198 in which case the result will have as parameters the union of the parameters of
1201 Given the identifier or name of a dimension (typically a parameter),
1202 its position can be obtained from the following functions.
1204 #include <isl/space.h>
1205 int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1206 enum isl_dim_type type, __isl_keep isl_id *id);
1207 int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1208 enum isl_dim_type type, const char *name);
1210 #include <isl/val.h>
1211 int isl_multi_val_find_dim_by_id(
1212 __isl_keep isl_multi_val *mv,
1213 enum isl_dim_type type, __isl_keep isl_id *id);
1215 #include <isl/set.h>
1216 int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1217 enum isl_dim_type type, __isl_keep isl_id *id);
1218 int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1219 enum isl_dim_type type, const char *name);
1221 #include <isl/map.h>
1222 int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1223 enum isl_dim_type type, __isl_keep isl_id *id);
1224 int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1225 enum isl_dim_type type, const char *name);
1227 #include <isl/aff.h>
1228 int isl_multi_aff_find_dim_by_id(
1229 __isl_keep isl_multi_aff *ma,
1230 enum isl_dim_type type, __isl_keep isl_id *id);
1231 int isl_multi_pw_aff_find_dim_by_id(
1232 __isl_keep isl_multi_pw_aff *mpa,
1233 enum isl_dim_type type, __isl_keep isl_id *id);
1235 The identifiers or names of entire spaces may be set or read off
1236 using the following functions.
1238 #include <isl/space.h>
1239 __isl_give isl_space *isl_space_set_tuple_id(
1240 __isl_take isl_space *space,
1241 enum isl_dim_type type, __isl_take isl_id *id);
1242 __isl_give isl_space *isl_space_reset_tuple_id(
1243 __isl_take isl_space *space, enum isl_dim_type type);
1244 int isl_space_has_tuple_id(__isl_keep isl_space *space,
1245 enum isl_dim_type type);
1246 __isl_give isl_id *isl_space_get_tuple_id(
1247 __isl_keep isl_space *space, enum isl_dim_type type);
1248 __isl_give isl_space *isl_space_set_tuple_name(
1249 __isl_take isl_space *space,
1250 enum isl_dim_type type, const char *s);
1251 int isl_space_has_tuple_name(__isl_keep isl_space *space,
1252 enum isl_dim_type type);
1253 const char *isl_space_get_tuple_name(__isl_keep isl_space *space,
1254 enum isl_dim_type type);
1256 #include <isl/local_space.h>
1257 __isl_give isl_local_space *isl_local_space_set_tuple_id(
1258 __isl_take isl_local_space *ls,
1259 enum isl_dim_type type, __isl_take isl_id *id);
1261 #include <isl/set.h>
1262 __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1263 __isl_take isl_basic_set *bset,
1264 __isl_take isl_id *id);
1265 __isl_give isl_set *isl_set_set_tuple_id(
1266 __isl_take isl_set *set, __isl_take isl_id *id);
1267 __isl_give isl_set *isl_set_reset_tuple_id(
1268 __isl_take isl_set *set);
1269 int isl_set_has_tuple_id(__isl_keep isl_set *set);
1270 __isl_give isl_id *isl_set_get_tuple_id(
1271 __isl_keep isl_set *set);
1272 __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1273 __isl_take isl_basic_set *set, const char *s);
1274 __isl_give isl_set *isl_set_set_tuple_name(
1275 __isl_take isl_set *set, const char *s);
1276 const char *isl_basic_set_get_tuple_name(
1277 __isl_keep isl_basic_set *bset);
1278 int isl_set_has_tuple_name(__isl_keep isl_set *set);
1279 const char *isl_set_get_tuple_name(
1280 __isl_keep isl_set *set);
1282 #include <isl/map.h>
1283 __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1284 __isl_take isl_basic_map *bmap,
1285 enum isl_dim_type type, __isl_take isl_id *id);
1286 __isl_give isl_map *isl_map_set_tuple_id(
1287 __isl_take isl_map *map, enum isl_dim_type type,
1288 __isl_take isl_id *id);
1289 __isl_give isl_map *isl_map_reset_tuple_id(
1290 __isl_take isl_map *map, enum isl_dim_type type);
1291 int isl_map_has_tuple_id(__isl_keep isl_map *map,
1292 enum isl_dim_type type);
1293 __isl_give isl_id *isl_map_get_tuple_id(
1294 __isl_keep isl_map *map, enum isl_dim_type type);
1295 __isl_give isl_map *isl_map_set_tuple_name(
1296 __isl_take isl_map *map,
1297 enum isl_dim_type type, const char *s);
1298 const char *isl_basic_map_get_tuple_name(
1299 __isl_keep isl_basic_map *bmap,
1300 enum isl_dim_type type);
1301 __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1302 __isl_take isl_basic_map *bmap,
1303 enum isl_dim_type type, const char *s);
1304 int isl_map_has_tuple_name(__isl_keep isl_map *map,
1305 enum isl_dim_type type);
1306 const char *isl_map_get_tuple_name(
1307 __isl_keep isl_map *map,
1308 enum isl_dim_type type);
1310 #include <isl/val.h>
1311 __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1312 __isl_take isl_multi_val *mv,
1313 enum isl_dim_type type, __isl_take isl_id *id);
1314 __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1315 __isl_take isl_multi_val *mv,
1316 enum isl_dim_type type);
1317 int isl_multi_val_has_tuple_id(__isl_keep isl_multi_val *mv,
1318 enum isl_dim_type type);
1319 __isl_give isl_id *isl_multi_val_get_tuple_id(
1320 __isl_keep isl_multi_val *mv,
1321 enum isl_dim_type type);
1322 __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1323 __isl_take isl_multi_val *mv,
1324 enum isl_dim_type type, const char *s);
1325 const char *isl_multi_val_get_tuple_name(
1326 __isl_keep isl_multi_val *mv,
1327 enum isl_dim_type type);
1329 #include <isl/aff.h>
1330 __isl_give isl_aff *isl_aff_set_tuple_id(
1331 __isl_take isl_aff *aff,
1332 enum isl_dim_type type, __isl_take isl_id *id);
1333 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1334 __isl_take isl_multi_aff *maff,
1335 enum isl_dim_type type, __isl_take isl_id *id);
1336 __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1337 __isl_take isl_pw_aff *pwaff,
1338 enum isl_dim_type type, __isl_take isl_id *id);
1339 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1340 __isl_take isl_pw_multi_aff *pma,
1341 enum isl_dim_type type, __isl_take isl_id *id);
1342 __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1343 __isl_take isl_multi_aff *ma,
1344 enum isl_dim_type type);
1345 __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1346 __isl_take isl_pw_aff *pa,
1347 enum isl_dim_type type);
1348 __isl_give isl_multi_pw_aff *
1349 isl_multi_pw_aff_reset_tuple_id(
1350 __isl_take isl_multi_pw_aff *mpa,
1351 enum isl_dim_type type);
1352 int isl_multi_aff_has_tuple_id(__isl_keep isl_multi_aff *ma,
1353 enum isl_dim_type type);
1354 __isl_give isl_id *isl_multi_aff_get_tuple_id(
1355 __isl_keep isl_multi_aff *ma,
1356 enum isl_dim_type type);
1357 int isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1358 enum isl_dim_type type);
1359 __isl_give isl_id *isl_pw_aff_get_tuple_id(
1360 __isl_keep isl_pw_aff *pa,
1361 enum isl_dim_type type);
1362 int isl_pw_multi_aff_has_tuple_id(
1363 __isl_keep isl_pw_multi_aff *pma,
1364 enum isl_dim_type type);
1365 __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1366 __isl_keep isl_pw_multi_aff *pma,
1367 enum isl_dim_type type);
1368 int isl_multi_pw_aff_has_tuple_id(
1369 __isl_keep isl_multi_pw_aff *mpa,
1370 enum isl_dim_type type);
1371 __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1372 __isl_keep isl_multi_pw_aff *mpa,
1373 enum isl_dim_type type);
1374 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1375 __isl_take isl_multi_aff *maff,
1376 enum isl_dim_type type, const char *s);
1377 __isl_give isl_multi_pw_aff *
1378 isl_multi_pw_aff_set_tuple_name(
1379 __isl_take isl_multi_pw_aff *mpa,
1380 enum isl_dim_type type, const char *s);
1381 const char *isl_multi_aff_get_tuple_name(
1382 __isl_keep isl_multi_aff *multi,
1383 enum isl_dim_type type);
1384 int isl_pw_multi_aff_has_tuple_name(
1385 __isl_keep isl_pw_multi_aff *pma,
1386 enum isl_dim_type type);
1387 const char *isl_pw_multi_aff_get_tuple_name(
1388 __isl_keep isl_pw_multi_aff *pma,
1389 enum isl_dim_type type);
1391 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1392 or C<isl_dim_set>. As with C<isl_space_get_name>,
1393 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1395 Binary operations require the corresponding spaces of their arguments
1396 to have the same name.
1398 To keep the names of all parameters and tuples, but reset the user pointers
1399 of all the corresponding identifiers, use the following function.
1401 #include <isl/space.h>
1402 __isl_give isl_space *isl_space_reset_user(
1403 __isl_take isl_space *space);
1405 #include <isl/set.h>
1406 __isl_give isl_set *isl_set_reset_user(
1407 __isl_take isl_set *set);
1409 #include <isl/map.h>
1410 __isl_give isl_map *isl_map_reset_user(
1411 __isl_take isl_map *map);
1413 #include <isl/union_set.h>
1414 __isl_give isl_union_set *isl_union_set_reset_user(
1415 __isl_take isl_union_set *uset);
1417 #include <isl/union_map.h>
1418 __isl_give isl_union_map *isl_union_map_reset_user(
1419 __isl_take isl_union_map *umap);
1421 #include <isl/val.h>
1422 __isl_give isl_multi_val *isl_multi_val_reset_user(
1423 __isl_take isl_multi_val *mv);
1425 #include <isl/aff.h>
1426 __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1427 __isl_take isl_multi_aff *ma);
1428 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1429 __isl_take isl_multi_pw_aff *mpa);
1431 Spaces can be nested. In particular, the domain of a set or
1432 the domain or range of a relation can be a nested relation.
1433 This process is also called I<wrapping>.
1434 The functions for detecting, constructing and deconstructing
1435 such nested spaces can be found in the wrapping properties
1436 of L</"Unary Properties">, the wrapping operations
1437 of L</"Unary Operations"> and the Cartesian product operations
1438 of L</"Basic Operations">.
1440 Spaces can be created from other spaces
1441 using the functions described in L</"Unary Operations">
1442 and L</"Binary Operations">.
1446 A local space is essentially a space with
1447 zero or more existentially quantified variables.
1448 The local space of various objects can be obtained
1449 using the following functions.
1451 #include <isl/constraint.h>
1452 __isl_give isl_local_space *isl_constraint_get_local_space(
1453 __isl_keep isl_constraint *constraint);
1455 #include <isl/set.h>
1456 __isl_give isl_local_space *isl_basic_set_get_local_space(
1457 __isl_keep isl_basic_set *bset);
1459 #include <isl/map.h>
1460 __isl_give isl_local_space *isl_basic_map_get_local_space(
1461 __isl_keep isl_basic_map *bmap);
1463 #include <isl/aff.h>
1464 __isl_give isl_local_space *isl_aff_get_domain_local_space(
1465 __isl_keep isl_aff *aff);
1466 __isl_give isl_local_space *isl_aff_get_local_space(
1467 __isl_keep isl_aff *aff);
1469 A new local space can be created from a space using
1471 #include <isl/local_space.h>
1472 __isl_give isl_local_space *isl_local_space_from_space(
1473 __isl_take isl_space *space);
1475 They can be inspected, modified, copied and freed using the following functions.
1477 #include <isl/local_space.h>
1478 int isl_local_space_is_set(__isl_keep isl_local_space *ls);
1479 __isl_give isl_space *isl_local_space_get_space(
1480 __isl_keep isl_local_space *ls);
1481 __isl_give isl_aff *isl_local_space_get_div(
1482 __isl_keep isl_local_space *ls, int pos);
1483 __isl_give isl_local_space *isl_local_space_copy(
1484 __isl_keep isl_local_space *ls);
1485 __isl_null isl_local_space *isl_local_space_free(
1486 __isl_take isl_local_space *ls);
1488 Note that C<isl_local_space_get_div> can only be used on local spaces
1491 Two local spaces can be compared using
1493 int isl_local_space_is_equal(__isl_keep isl_local_space *ls1,
1494 __isl_keep isl_local_space *ls2);
1496 Local spaces can be created from other local spaces
1497 using the functions described in L</"Unary Operations">
1498 and L</"Binary Operations">.
1500 =head2 Creating New Sets and Relations
1502 C<isl> has functions for creating some standard sets and relations.
1506 =item * Empty sets and relations
1508 __isl_give isl_basic_set *isl_basic_set_empty(
1509 __isl_take isl_space *space);
1510 __isl_give isl_basic_map *isl_basic_map_empty(
1511 __isl_take isl_space *space);
1512 __isl_give isl_set *isl_set_empty(
1513 __isl_take isl_space *space);
1514 __isl_give isl_map *isl_map_empty(
1515 __isl_take isl_space *space);
1516 __isl_give isl_union_set *isl_union_set_empty(
1517 __isl_take isl_space *space);
1518 __isl_give isl_union_map *isl_union_map_empty(
1519 __isl_take isl_space *space);
1521 For C<isl_union_set>s and C<isl_union_map>s, the space
1522 is only used to specify the parameters.
1524 =item * Universe sets and relations
1526 __isl_give isl_basic_set *isl_basic_set_universe(
1527 __isl_take isl_space *space);
1528 __isl_give isl_basic_map *isl_basic_map_universe(
1529 __isl_take isl_space *space);
1530 __isl_give isl_set *isl_set_universe(
1531 __isl_take isl_space *space);
1532 __isl_give isl_map *isl_map_universe(
1533 __isl_take isl_space *space);
1534 __isl_give isl_union_set *isl_union_set_universe(
1535 __isl_take isl_union_set *uset);
1536 __isl_give isl_union_map *isl_union_map_universe(
1537 __isl_take isl_union_map *umap);
1539 The sets and relations constructed by the functions above
1540 contain all integer values, while those constructed by the
1541 functions below only contain non-negative values.
1543 __isl_give isl_basic_set *isl_basic_set_nat_universe(
1544 __isl_take isl_space *space);
1545 __isl_give isl_basic_map *isl_basic_map_nat_universe(
1546 __isl_take isl_space *space);
1547 __isl_give isl_set *isl_set_nat_universe(
1548 __isl_take isl_space *space);
1549 __isl_give isl_map *isl_map_nat_universe(
1550 __isl_take isl_space *space);
1552 =item * Identity relations
1554 __isl_give isl_basic_map *isl_basic_map_identity(
1555 __isl_take isl_space *space);
1556 __isl_give isl_map *isl_map_identity(
1557 __isl_take isl_space *space);
1559 The number of input and output dimensions in C<space> needs
1562 =item * Lexicographic order
1564 __isl_give isl_map *isl_map_lex_lt(
1565 __isl_take isl_space *set_space);
1566 __isl_give isl_map *isl_map_lex_le(
1567 __isl_take isl_space *set_space);
1568 __isl_give isl_map *isl_map_lex_gt(
1569 __isl_take isl_space *set_space);
1570 __isl_give isl_map *isl_map_lex_ge(
1571 __isl_take isl_space *set_space);
1572 __isl_give isl_map *isl_map_lex_lt_first(
1573 __isl_take isl_space *space, unsigned n);
1574 __isl_give isl_map *isl_map_lex_le_first(
1575 __isl_take isl_space *space, unsigned n);
1576 __isl_give isl_map *isl_map_lex_gt_first(
1577 __isl_take isl_space *space, unsigned n);
1578 __isl_give isl_map *isl_map_lex_ge_first(
1579 __isl_take isl_space *space, unsigned n);
1581 The first four functions take a space for a B<set>
1582 and return relations that express that the elements in the domain
1583 are lexicographically less
1584 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1585 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1586 than the elements in the range.
1587 The last four functions take a space for a map
1588 and return relations that express that the first C<n> dimensions
1589 in the domain are lexicographically less
1590 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1591 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1592 than the first C<n> dimensions in the range.
1596 A basic set or relation can be converted to a set or relation
1597 using the following functions.
1599 __isl_give isl_set *isl_set_from_basic_set(
1600 __isl_take isl_basic_set *bset);
1601 __isl_give isl_map *isl_map_from_basic_map(
1602 __isl_take isl_basic_map *bmap);
1604 Sets and relations can be converted to union sets and relations
1605 using the following functions.
1607 __isl_give isl_union_set *isl_union_set_from_basic_set(
1608 __isl_take isl_basic_set *bset);
1609 __isl_give isl_union_map *isl_union_map_from_basic_map(
1610 __isl_take isl_basic_map *bmap);
1611 __isl_give isl_union_set *isl_union_set_from_set(
1612 __isl_take isl_set *set);
1613 __isl_give isl_union_map *isl_union_map_from_map(
1614 __isl_take isl_map *map);
1616 The inverse conversions below can only be used if the input
1617 union set or relation is known to contain elements in exactly one
1620 __isl_give isl_set *isl_set_from_union_set(
1621 __isl_take isl_union_set *uset);
1622 __isl_give isl_map *isl_map_from_union_map(
1623 __isl_take isl_union_map *umap);
1625 Sets and relations can be copied and freed again using the following
1628 __isl_give isl_basic_set *isl_basic_set_copy(
1629 __isl_keep isl_basic_set *bset);
1630 __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1631 __isl_give isl_union_set *isl_union_set_copy(
1632 __isl_keep isl_union_set *uset);
1633 __isl_give isl_basic_map *isl_basic_map_copy(
1634 __isl_keep isl_basic_map *bmap);
1635 __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1636 __isl_give isl_union_map *isl_union_map_copy(
1637 __isl_keep isl_union_map *umap);
1638 __isl_null isl_basic_set *isl_basic_set_free(
1639 __isl_take isl_basic_set *bset);
1640 __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1641 __isl_null isl_union_set *isl_union_set_free(
1642 __isl_take isl_union_set *uset);
1643 __isl_null isl_basic_map *isl_basic_map_free(
1644 __isl_take isl_basic_map *bmap);
1645 __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1646 __isl_null isl_union_map *isl_union_map_free(
1647 __isl_take isl_union_map *umap);
1649 Other sets and relations can be constructed by starting
1650 from a universe set or relation, adding equality and/or
1651 inequality constraints and then projecting out the
1652 existentially quantified variables, if any.
1653 Constraints can be constructed, manipulated and
1654 added to (or removed from) (basic) sets and relations
1655 using the following functions.
1657 #include <isl/constraint.h>
1658 __isl_give isl_constraint *isl_equality_alloc(
1659 __isl_take isl_local_space *ls);
1660 __isl_give isl_constraint *isl_inequality_alloc(
1661 __isl_take isl_local_space *ls);
1662 __isl_give isl_constraint *isl_constraint_set_constant_si(
1663 __isl_take isl_constraint *constraint, int v);
1664 __isl_give isl_constraint *isl_constraint_set_constant_val(
1665 __isl_take isl_constraint *constraint,
1666 __isl_take isl_val *v);
1667 __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1668 __isl_take isl_constraint *constraint,
1669 enum isl_dim_type type, int pos, int v);
1670 __isl_give isl_constraint *
1671 isl_constraint_set_coefficient_val(
1672 __isl_take isl_constraint *constraint,
1673 enum isl_dim_type type, int pos,
1674 __isl_take isl_val *v);
1675 __isl_give isl_basic_map *isl_basic_map_add_constraint(
1676 __isl_take isl_basic_map *bmap,
1677 __isl_take isl_constraint *constraint);
1678 __isl_give isl_basic_set *isl_basic_set_add_constraint(
1679 __isl_take isl_basic_set *bset,
1680 __isl_take isl_constraint *constraint);
1681 __isl_give isl_map *isl_map_add_constraint(
1682 __isl_take isl_map *map,
1683 __isl_take isl_constraint *constraint);
1684 __isl_give isl_set *isl_set_add_constraint(
1685 __isl_take isl_set *set,
1686 __isl_take isl_constraint *constraint);
1687 __isl_give isl_basic_set *isl_basic_set_drop_constraint(
1688 __isl_take isl_basic_set *bset,
1689 __isl_take isl_constraint *constraint);
1691 For example, to create a set containing the even integers
1692 between 10 and 42, you would use the following code.
1695 isl_local_space *ls;
1697 isl_basic_set *bset;
1699 space = isl_space_set_alloc(ctx, 0, 2);
1700 bset = isl_basic_set_universe(isl_space_copy(space));
1701 ls = isl_local_space_from_space(space);
1703 c = isl_equality_alloc(isl_local_space_copy(ls));
1704 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1705 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
1706 bset = isl_basic_set_add_constraint(bset, c);
1708 c = isl_inequality_alloc(isl_local_space_copy(ls));
1709 c = isl_constraint_set_constant_si(c, -10);
1710 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
1711 bset = isl_basic_set_add_constraint(bset, c);
1713 c = isl_inequality_alloc(ls);
1714 c = isl_constraint_set_constant_si(c, 42);
1715 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1716 bset = isl_basic_set_add_constraint(bset, c);
1718 bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
1722 isl_basic_set *bset;
1723 bset = isl_basic_set_read_from_str(ctx,
1724 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
1726 A basic set or relation can also be constructed from two matrices
1727 describing the equalities and the inequalities.
1729 __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
1730 __isl_take isl_space *space,
1731 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1732 enum isl_dim_type c1,
1733 enum isl_dim_type c2, enum isl_dim_type c3,
1734 enum isl_dim_type c4);
1735 __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
1736 __isl_take isl_space *space,
1737 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1738 enum isl_dim_type c1,
1739 enum isl_dim_type c2, enum isl_dim_type c3,
1740 enum isl_dim_type c4, enum isl_dim_type c5);
1742 The C<isl_dim_type> arguments indicate the order in which
1743 different kinds of variables appear in the input matrices
1744 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
1745 C<isl_dim_set> and C<isl_dim_div> for sets and
1746 of C<isl_dim_cst>, C<isl_dim_param>,
1747 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
1749 A (basic or union) set or relation can also be constructed from a
1750 (union) (piecewise) (multiple) affine expression
1751 or a list of affine expressions
1752 (See L</"Functions">).
1754 __isl_give isl_basic_map *isl_basic_map_from_aff(
1755 __isl_take isl_aff *aff);
1756 __isl_give isl_map *isl_map_from_aff(
1757 __isl_take isl_aff *aff);
1758 __isl_give isl_set *isl_set_from_pw_aff(
1759 __isl_take isl_pw_aff *pwaff);
1760 __isl_give isl_map *isl_map_from_pw_aff(
1761 __isl_take isl_pw_aff *pwaff);
1762 __isl_give isl_basic_map *isl_basic_map_from_aff_list(
1763 __isl_take isl_space *domain_space,
1764 __isl_take isl_aff_list *list);
1765 __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
1766 __isl_take isl_multi_aff *maff)
1767 __isl_give isl_map *isl_map_from_multi_aff(
1768 __isl_take isl_multi_aff *maff)
1769 __isl_give isl_set *isl_set_from_pw_multi_aff(
1770 __isl_take isl_pw_multi_aff *pma);
1771 __isl_give isl_map *isl_map_from_pw_multi_aff(
1772 __isl_take isl_pw_multi_aff *pma);
1773 __isl_give isl_set *isl_set_from_multi_pw_aff(
1774 __isl_take isl_multi_pw_aff *mpa);
1775 __isl_give isl_map *isl_map_from_multi_pw_aff(
1776 __isl_take isl_multi_pw_aff *mpa);
1777 __isl_give isl_union_map *
1778 isl_union_map_from_union_pw_multi_aff(
1779 __isl_take isl_union_pw_multi_aff *upma);
1781 The C<domain_space> argument describes the domain of the resulting
1782 basic relation. It is required because the C<list> may consist
1783 of zero affine expressions.
1785 =head2 Inspecting Sets and Relations
1787 Usually, the user should not have to care about the actual constraints
1788 of the sets and maps, but should instead apply the abstract operations
1789 explained in the following sections.
1790 Occasionally, however, it may be required to inspect the individual
1791 coefficients of the constraints. This section explains how to do so.
1792 In these cases, it may also be useful to have C<isl> compute
1793 an explicit representation of the existentially quantified variables.
1795 __isl_give isl_set *isl_set_compute_divs(
1796 __isl_take isl_set *set);
1797 __isl_give isl_map *isl_map_compute_divs(
1798 __isl_take isl_map *map);
1799 __isl_give isl_union_set *isl_union_set_compute_divs(
1800 __isl_take isl_union_set *uset);
1801 __isl_give isl_union_map *isl_union_map_compute_divs(
1802 __isl_take isl_union_map *umap);
1804 This explicit representation defines the existentially quantified
1805 variables as integer divisions of the other variables, possibly
1806 including earlier existentially quantified variables.
1807 An explicitly represented existentially quantified variable therefore
1808 has a unique value when the values of the other variables are known.
1809 If, furthermore, the same existentials, i.e., existentials
1810 with the same explicit representations, should appear in the
1811 same order in each of the disjuncts of a set or map, then the user should call
1812 either of the following functions.
1814 __isl_give isl_set *isl_set_align_divs(
1815 __isl_take isl_set *set);
1816 __isl_give isl_map *isl_map_align_divs(
1817 __isl_take isl_map *map);
1819 Alternatively, the existentially quantified variables can be removed
1820 using the following functions, which compute an overapproximation.
1822 __isl_give isl_basic_set *isl_basic_set_remove_divs(
1823 __isl_take isl_basic_set *bset);
1824 __isl_give isl_basic_map *isl_basic_map_remove_divs(
1825 __isl_take isl_basic_map *bmap);
1826 __isl_give isl_set *isl_set_remove_divs(
1827 __isl_take isl_set *set);
1828 __isl_give isl_map *isl_map_remove_divs(
1829 __isl_take isl_map *map);
1831 It is also possible to only remove those divs that are defined
1832 in terms of a given range of dimensions or only those for which
1833 no explicit representation is known.
1835 __isl_give isl_basic_set *
1836 isl_basic_set_remove_divs_involving_dims(
1837 __isl_take isl_basic_set *bset,
1838 enum isl_dim_type type,
1839 unsigned first, unsigned n);
1840 __isl_give isl_basic_map *
1841 isl_basic_map_remove_divs_involving_dims(
1842 __isl_take isl_basic_map *bmap,
1843 enum isl_dim_type type,
1844 unsigned first, unsigned n);
1845 __isl_give isl_set *isl_set_remove_divs_involving_dims(
1846 __isl_take isl_set *set, enum isl_dim_type type,
1847 unsigned first, unsigned n);
1848 __isl_give isl_map *isl_map_remove_divs_involving_dims(
1849 __isl_take isl_map *map, enum isl_dim_type type,
1850 unsigned first, unsigned n);
1852 __isl_give isl_basic_set *
1853 isl_basic_set_remove_unknown_divs(
1854 __isl_take isl_basic_set *bset);
1855 __isl_give isl_set *isl_set_remove_unknown_divs(
1856 __isl_take isl_set *set);
1857 __isl_give isl_map *isl_map_remove_unknown_divs(
1858 __isl_take isl_map *map);
1860 To iterate over all the sets or maps in a union set or map, use
1862 int isl_union_set_foreach_set(__isl_keep isl_union_set *uset,
1863 int (*fn)(__isl_take isl_set *set, void *user),
1865 int isl_union_map_foreach_map(__isl_keep isl_union_map *umap,
1866 int (*fn)(__isl_take isl_map *map, void *user),
1869 The number of sets or maps in a union set or map can be obtained
1872 int isl_union_set_n_set(__isl_keep isl_union_set *uset);
1873 int isl_union_map_n_map(__isl_keep isl_union_map *umap);
1875 To extract the set or map in a given space from a union, use
1877 __isl_give isl_set *isl_union_set_extract_set(
1878 __isl_keep isl_union_set *uset,
1879 __isl_take isl_space *space);
1880 __isl_give isl_map *isl_union_map_extract_map(
1881 __isl_keep isl_union_map *umap,
1882 __isl_take isl_space *space);
1884 To iterate over all the basic sets or maps in a set or map, use
1886 int isl_set_foreach_basic_set(__isl_keep isl_set *set,
1887 int (*fn)(__isl_take isl_basic_set *bset, void *user),
1889 int isl_map_foreach_basic_map(__isl_keep isl_map *map,
1890 int (*fn)(__isl_take isl_basic_map *bmap, void *user),
1893 The callback function C<fn> should return 0 if successful and
1894 -1 if an error occurs. In the latter case, or if any other error
1895 occurs, the above functions will return -1.
1897 It should be noted that C<isl> does not guarantee that
1898 the basic sets or maps passed to C<fn> are disjoint.
1899 If this is required, then the user should call one of
1900 the following functions first.
1902 __isl_give isl_set *isl_set_make_disjoint(
1903 __isl_take isl_set *set);
1904 __isl_give isl_map *isl_map_make_disjoint(
1905 __isl_take isl_map *map);
1907 The number of basic sets in a set can be obtained
1908 or the number of basic maps in a map can be obtained
1911 #include <isl/set.h>
1912 int isl_set_n_basic_set(__isl_keep isl_set *set);
1914 #include <isl/map.h>
1915 int isl_map_n_basic_map(__isl_keep isl_map *map);
1917 To iterate over the constraints of a basic set or map, use
1919 #include <isl/constraint.h>
1921 int isl_basic_set_n_constraint(
1922 __isl_keep isl_basic_set *bset);
1923 int isl_basic_set_foreach_constraint(
1924 __isl_keep isl_basic_set *bset,
1925 int (*fn)(__isl_take isl_constraint *c, void *user),
1927 int isl_basic_map_n_constraint(
1928 __isl_keep isl_basic_map *bmap);
1929 int isl_basic_map_foreach_constraint(
1930 __isl_keep isl_basic_map *bmap,
1931 int (*fn)(__isl_take isl_constraint *c, void *user),
1933 __isl_null isl_constraint *isl_constraint_free(
1934 __isl_take isl_constraint *c);
1936 Again, the callback function C<fn> should return 0 if successful and
1937 -1 if an error occurs. In the latter case, or if any other error
1938 occurs, the above functions will return -1.
1939 The constraint C<c> represents either an equality or an inequality.
1940 Use the following function to find out whether a constraint
1941 represents an equality. If not, it represents an inequality.
1943 int isl_constraint_is_equality(
1944 __isl_keep isl_constraint *constraint);
1946 It is also possible to obtain a list of constraints from a basic
1949 #include <isl/constraint.h>
1950 __isl_give isl_constraint_list *
1951 isl_basic_map_get_constraint_list(
1952 __isl_keep isl_basic_map *bmap);
1953 __isl_give isl_constraint_list *
1954 isl_basic_set_get_constraint_list(
1955 __isl_keep isl_basic_set *bset);
1957 These functions require that all existentially quantified variables
1958 have an explicit representation.
1959 The returned list can be manipulated using the functions in L<"Lists">.
1961 The coefficients of the constraints can be inspected using
1962 the following functions.
1964 int isl_constraint_is_lower_bound(
1965 __isl_keep isl_constraint *constraint,
1966 enum isl_dim_type type, unsigned pos);
1967 int isl_constraint_is_upper_bound(
1968 __isl_keep isl_constraint *constraint,
1969 enum isl_dim_type type, unsigned pos);
1970 __isl_give isl_val *isl_constraint_get_constant_val(
1971 __isl_keep isl_constraint *constraint);
1972 __isl_give isl_val *isl_constraint_get_coefficient_val(
1973 __isl_keep isl_constraint *constraint,
1974 enum isl_dim_type type, int pos);
1976 The explicit representations of the existentially quantified
1977 variables can be inspected using the following function.
1978 Note that the user is only allowed to use this function
1979 if the inspected set or map is the result of a call
1980 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
1981 The existentially quantified variable is equal to the floor
1982 of the returned affine expression. The affine expression
1983 itself can be inspected using the functions in
1986 __isl_give isl_aff *isl_constraint_get_div(
1987 __isl_keep isl_constraint *constraint, int pos);
1989 To obtain the constraints of a basic set or map in matrix
1990 form, use the following functions.
1992 __isl_give isl_mat *isl_basic_set_equalities_matrix(
1993 __isl_keep isl_basic_set *bset,
1994 enum isl_dim_type c1, enum isl_dim_type c2,
1995 enum isl_dim_type c3, enum isl_dim_type c4);
1996 __isl_give isl_mat *isl_basic_set_inequalities_matrix(
1997 __isl_keep isl_basic_set *bset,
1998 enum isl_dim_type c1, enum isl_dim_type c2,
1999 enum isl_dim_type c3, enum isl_dim_type c4);
2000 __isl_give isl_mat *isl_basic_map_equalities_matrix(
2001 __isl_keep isl_basic_map *bmap,
2002 enum isl_dim_type c1,
2003 enum isl_dim_type c2, enum isl_dim_type c3,
2004 enum isl_dim_type c4, enum isl_dim_type c5);
2005 __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2006 __isl_keep isl_basic_map *bmap,
2007 enum isl_dim_type c1,
2008 enum isl_dim_type c2, enum isl_dim_type c3,
2009 enum isl_dim_type c4, enum isl_dim_type c5);
2011 The C<isl_dim_type> arguments dictate the order in which
2012 different kinds of variables appear in the resulting matrix.
2013 For set inputs, they should be a permutation of
2014 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2015 For map inputs, they should be a permutation of
2016 C<isl_dim_cst>, C<isl_dim_param>,
2017 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2021 Points are elements of a set. They can be used to construct
2022 simple sets (boxes) or they can be used to represent the
2023 individual elements of a set.
2024 The zero point (the origin) can be created using
2026 __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2028 The coordinates of a point can be inspected, set and changed
2031 __isl_give isl_val *isl_point_get_coordinate_val(
2032 __isl_keep isl_point *pnt,
2033 enum isl_dim_type type, int pos);
2034 __isl_give isl_point *isl_point_set_coordinate_val(
2035 __isl_take isl_point *pnt,
2036 enum isl_dim_type type, int pos,
2037 __isl_take isl_val *v);
2039 __isl_give isl_point *isl_point_add_ui(
2040 __isl_take isl_point *pnt,
2041 enum isl_dim_type type, int pos, unsigned val);
2042 __isl_give isl_point *isl_point_sub_ui(
2043 __isl_take isl_point *pnt,
2044 enum isl_dim_type type, int pos, unsigned val);
2046 Points can be copied or freed using
2048 __isl_give isl_point *isl_point_copy(
2049 __isl_keep isl_point *pnt);
2050 void isl_point_free(__isl_take isl_point *pnt);
2052 A singleton set can be created from a point using
2054 __isl_give isl_basic_set *isl_basic_set_from_point(
2055 __isl_take isl_point *pnt);
2056 __isl_give isl_set *isl_set_from_point(
2057 __isl_take isl_point *pnt);
2059 and a box can be created from two opposite extremal points using
2061 __isl_give isl_basic_set *isl_basic_set_box_from_points(
2062 __isl_take isl_point *pnt1,
2063 __isl_take isl_point *pnt2);
2064 __isl_give isl_set *isl_set_box_from_points(
2065 __isl_take isl_point *pnt1,
2066 __isl_take isl_point *pnt2);
2068 All elements of a B<bounded> (union) set can be enumerated using
2069 the following functions.
2071 int isl_set_foreach_point(__isl_keep isl_set *set,
2072 int (*fn)(__isl_take isl_point *pnt, void *user),
2074 int isl_union_set_foreach_point(__isl_keep isl_union_set *uset,
2075 int (*fn)(__isl_take isl_point *pnt, void *user),
2078 The function C<fn> is called for each integer point in
2079 C<set> with as second argument the last argument of
2080 the C<isl_set_foreach_point> call. The function C<fn>
2081 should return C<0> on success and C<-1> on failure.
2082 In the latter case, C<isl_set_foreach_point> will stop
2083 enumerating and return C<-1> as well.
2084 If the enumeration is performed successfully and to completion,
2085 then C<isl_set_foreach_point> returns C<0>.
2087 To obtain a single point of a (basic) set, use
2089 __isl_give isl_point *isl_basic_set_sample_point(
2090 __isl_take isl_basic_set *bset);
2091 __isl_give isl_point *isl_set_sample_point(
2092 __isl_take isl_set *set);
2094 If C<set> does not contain any (integer) points, then the
2095 resulting point will be ``void'', a property that can be
2098 int isl_point_is_void(__isl_keep isl_point *pnt);
2102 Besides sets and relation, C<isl> also supports various types of functions.
2103 Each of these types is derived from the value type (see L</"Values">)
2104 or from one of two primitive function types
2105 through the application of zero or more type constructors.
2106 We first describe the primitive type and then we describe
2107 the types derived from these primitive types.
2109 =head3 Primitive Functions
2111 C<isl> support two primitive function types, quasi-affine
2112 expressions and quasipolynomials.
2113 A quasi-affine expression is defined either over a parameter
2114 space or over a set and is composed of integer constants,
2115 parameters and set variables, addition, subtraction and
2116 integer division by an integer constant.
2117 For example, the quasi-affine expression
2119 [n] -> { [x] -> [2*floor((4 n + x)/9] }
2121 maps C<x> to C<2*floor((4 n + x)/9>.
2122 A quasipolynomial is a polynomial expression in quasi-affine
2123 expression. That is, it additionally allows for multiplication.
2124 Note, though, that it is not allowed to construct an integer
2125 division of an expression involving multiplications.
2126 Here is an example of a quasipolynomial that is not
2127 quasi-affine expression
2129 [n] -> { [x] -> (n*floor((4 n + x)/9) }
2131 Note that the external representations of quasi-affine expressions
2132 and quasipolynomials are different. Quasi-affine expressions
2133 use a notation with square brackets just like binary relations,
2134 while quasipolynomials do not. This might change at some point.
2136 If a primitive function is defined over a parameter space,
2137 then the space of the function itself is that of a set.
2138 If it is defined over a set, then the space of the function
2139 is that of a relation. In both cases, the set space (or
2140 the output space) is single-dimensional, anonymous and unstructured.
2141 To create functions with multiple dimensions or with other kinds
2142 of set or output spaces, use multiple expressions
2143 (see L</"Multiple Expressions">).
2147 =item * Quasi-affine Expressions
2149 Besides the expressions described above, a quasi-affine
2150 expression can also be set to NaN. Such expressions
2151 typically represent a failure to represent a result
2152 as a quasi-affine expression.
2154 The zero quasi affine expression or the quasi affine expression
2155 that is equal to a given value or
2156 a specified dimension on a given domain can be created using
2158 #include <isl/aff.h>
2159 __isl_give isl_aff *isl_aff_zero_on_domain(
2160 __isl_take isl_local_space *ls);
2161 __isl_give isl_aff *isl_aff_val_on_domain(
2162 __isl_take isl_local_space *ls,
2163 __isl_take isl_val *val);
2164 __isl_give isl_aff *isl_aff_var_on_domain(
2165 __isl_take isl_local_space *ls,
2166 enum isl_dim_type type, unsigned pos);
2167 __isl_give isl_aff *isl_aff_nan_on_domain(
2168 __isl_take isl_local_space *ls);
2170 Quasi affine expressions can be copied and freed using
2172 #include <isl/aff.h>
2173 __isl_give isl_aff *isl_aff_copy(
2174 __isl_keep isl_aff *aff);
2175 __isl_null isl_aff *isl_aff_free(
2176 __isl_take isl_aff *aff);
2178 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2179 using the following function. The constraint is required to have
2180 a non-zero coefficient for the specified dimension.
2182 #include <isl/constraint.h>
2183 __isl_give isl_aff *isl_constraint_get_bound(
2184 __isl_keep isl_constraint *constraint,
2185 enum isl_dim_type type, int pos);
2187 The entire affine expression of the constraint can also be extracted
2188 using the following function.
2190 #include <isl/constraint.h>
2191 __isl_give isl_aff *isl_constraint_get_aff(
2192 __isl_keep isl_constraint *constraint);
2194 Conversely, an equality constraint equating
2195 the affine expression to zero or an inequality constraint enforcing
2196 the affine expression to be non-negative, can be constructed using
2198 __isl_give isl_constraint *isl_equality_from_aff(
2199 __isl_take isl_aff *aff);
2200 __isl_give isl_constraint *isl_inequality_from_aff(
2201 __isl_take isl_aff *aff);
2203 The coefficients and the integer divisions of an affine expression
2204 can be inspected using the following functions.
2206 #include <isl/aff.h>
2207 __isl_give isl_val *isl_aff_get_constant_val(
2208 __isl_keep isl_aff *aff);
2209 __isl_give isl_val *isl_aff_get_coefficient_val(
2210 __isl_keep isl_aff *aff,
2211 enum isl_dim_type type, int pos);
2212 int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2213 enum isl_dim_type type, int pos);
2214 __isl_give isl_val *isl_aff_get_denominator_val(
2215 __isl_keep isl_aff *aff);
2216 __isl_give isl_aff *isl_aff_get_div(
2217 __isl_keep isl_aff *aff, int pos);
2219 They can be modified using the following functions.
2221 #include <isl/aff.h>
2222 __isl_give isl_aff *isl_aff_set_constant_si(
2223 __isl_take isl_aff *aff, int v);
2224 __isl_give isl_aff *isl_aff_set_constant_val(
2225 __isl_take isl_aff *aff, __isl_take isl_val *v);
2226 __isl_give isl_aff *isl_aff_set_coefficient_si(
2227 __isl_take isl_aff *aff,
2228 enum isl_dim_type type, int pos, int v);
2229 __isl_give isl_aff *isl_aff_set_coefficient_val(
2230 __isl_take isl_aff *aff,
2231 enum isl_dim_type type, int pos,
2232 __isl_take isl_val *v);
2234 __isl_give isl_aff *isl_aff_add_constant_si(
2235 __isl_take isl_aff *aff, int v);
2236 __isl_give isl_aff *isl_aff_add_constant_val(
2237 __isl_take isl_aff *aff, __isl_take isl_val *v);
2238 __isl_give isl_aff *isl_aff_add_constant_num_si(
2239 __isl_take isl_aff *aff, int v);
2240 __isl_give isl_aff *isl_aff_add_coefficient_si(
2241 __isl_take isl_aff *aff,
2242 enum isl_dim_type type, int pos, int v);
2243 __isl_give isl_aff *isl_aff_add_coefficient_val(
2244 __isl_take isl_aff *aff,
2245 enum isl_dim_type type, int pos,
2246 __isl_take isl_val *v);
2248 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2249 set the I<numerator> of the constant or coefficient, while
2250 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2251 the constant or coefficient as a whole.
2252 The C<add_constant> and C<add_coefficient> functions add an integer
2253 or rational value to
2254 the possibly rational constant or coefficient.
2255 The C<add_constant_num> functions add an integer value to
2258 =item * Quasipolynomials
2260 Some simple quasipolynomials can be created using the following functions.
2262 #include <isl/polynomial.h>
2263 __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2264 __isl_take isl_space *domain);
2265 __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2266 __isl_take isl_space *domain);
2267 __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2268 __isl_take isl_space *domain);
2269 __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2270 __isl_take isl_space *domain);
2271 __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2272 __isl_take isl_space *domain);
2273 __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2274 __isl_take isl_space *domain,
2275 __isl_take isl_val *val);
2276 __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2277 __isl_take isl_space *domain,
2278 enum isl_dim_type type, unsigned pos);
2279 __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2280 __isl_take isl_aff *aff);
2282 Recall that the space in which a quasipolynomial lives is a map space
2283 with a one-dimensional range. The C<domain> argument in some of
2284 the functions above corresponds to the domain of this map space.
2286 Quasipolynomials can be copied and freed again using the following
2289 #include <isl/polynomial.h>
2290 __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2291 __isl_keep isl_qpolynomial *qp);
2292 __isl_null isl_qpolynomial *isl_qpolynomial_free(
2293 __isl_take isl_qpolynomial *qp);
2295 The constant term of a quasipolynomial can be extracted using
2297 __isl_give isl_val *isl_qpolynomial_get_constant_val(
2298 __isl_keep isl_qpolynomial *qp);
2300 To iterate over all terms in a quasipolynomial,
2303 int isl_qpolynomial_foreach_term(
2304 __isl_keep isl_qpolynomial *qp,
2305 int (*fn)(__isl_take isl_term *term,
2306 void *user), void *user);
2308 The terms themselves can be inspected and freed using
2311 unsigned isl_term_dim(__isl_keep isl_term *term,
2312 enum isl_dim_type type);
2313 __isl_give isl_val *isl_term_get_coefficient_val(
2314 __isl_keep isl_term *term);
2315 int isl_term_get_exp(__isl_keep isl_term *term,
2316 enum isl_dim_type type, unsigned pos);
2317 __isl_give isl_aff *isl_term_get_div(
2318 __isl_keep isl_term *term, unsigned pos);
2319 void isl_term_free(__isl_take isl_term *term);
2321 Each term is a product of parameters, set variables and
2322 integer divisions. The function C<isl_term_get_exp>
2323 returns the exponent of a given dimensions in the given term.
2329 A reduction represents a maximum or a minimum of its
2331 The only reduction type defined by C<isl> is
2332 C<isl_qpolynomial_fold>.
2334 There are currently no functions to directly create such
2335 objects, but they do appear in the piecewise quasipolynomial
2336 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2338 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2340 Reductions can be copied and freed using
2341 the following functions.
2343 #include <isl/polynomial.h>
2344 __isl_give isl_qpolynomial_fold *
2345 isl_qpolynomial_fold_copy(
2346 __isl_keep isl_qpolynomial_fold *fold);
2347 void isl_qpolynomial_fold_free(
2348 __isl_take isl_qpolynomial_fold *fold);
2350 To iterate over all quasipolynomials in a reduction, use
2352 int isl_qpolynomial_fold_foreach_qpolynomial(
2353 __isl_keep isl_qpolynomial_fold *fold,
2354 int (*fn)(__isl_take isl_qpolynomial *qp,
2355 void *user), void *user);
2357 =head3 Multiple Expressions
2359 A multiple expression represents a sequence of zero or
2360 more base expressions, all defined on the same domain space.
2361 The domain space of the multiple expression is the same
2362 as that of the base expressions, but the range space
2363 can be any space. In case the base expressions have
2364 a set space, the corresponding multiple expression
2365 also has a set space.
2366 Objects of the value type do not have an associated space.
2367 The space of a multiple value is therefore always a set space.
2369 The multiple expression types defined by C<isl>
2370 are C<isl_multi_val>, C<isl_multi_aff> and C<isl_multi_pw_aff>.
2372 A multiple expression with the value zero for
2373 each output (or set) dimension can be created
2374 using the following functions.
2376 #include <isl/val.h>
2377 __isl_give isl_multi_val *isl_multi_val_zero(
2378 __isl_take isl_space *space);
2380 #include <isl/aff.h>
2381 __isl_give isl_multi_aff *isl_multi_aff_zero(
2382 __isl_take isl_space *space);
2383 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2384 __isl_take isl_space *space);
2386 An identity function can be created using the following
2387 functions. The space needs to be that of a relation
2388 with the same number of input and output dimensions.
2390 #include <isl/aff.h>
2391 __isl_give isl_multi_aff *isl_multi_aff_identity(
2392 __isl_take isl_space *space);
2393 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2394 __isl_take isl_space *space);
2396 A function that performs a projection on a universe
2397 relation or set can be created using the following functions.
2398 See also the corresponding
2399 projection operations in L</"Unary Operations">.
2401 #include <isl/aff.h>
2402 __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2403 __isl_take isl_space *space);
2404 __isl_give isl_multi_aff *isl_multi_aff_range_map(
2405 __isl_take isl_space *space);
2406 __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2407 __isl_take isl_space *space,
2408 enum isl_dim_type type,
2409 unsigned first, unsigned n);
2411 A multiple expression can be created from a single
2412 base expression using the following functions.
2413 The space of the created multiple expression is the same
2414 as that of the base expression.
2416 #include <isl/aff.h>
2417 __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2418 __isl_take isl_aff *aff);
2419 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2420 __isl_take isl_pw_aff *pa);
2422 A multiple expression can be created from a list
2423 of base expression in a specified space.
2424 The domain of this space needs to be the same
2425 as the domains of the base expressions in the list.
2426 If the base expressions have a set space (or no associated space),
2427 then this space also needs to be a set space.
2429 #include <isl/val.h>
2430 __isl_give isl_multi_val *isl_multi_val_from_val_list(
2431 __isl_take isl_space *space,
2432 __isl_take isl_val_list *list);
2434 #include <isl/aff.h>
2435 __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2436 __isl_take isl_space *space,
2437 __isl_take isl_aff_list *list);
2439 As a convenience, a multiple piecewise expression can
2440 also be created from a multiple expression.
2441 Each piecewise expression in the result has a single
2444 #include <isl/aff.h>
2445 __isl_give isl_multi_pw_aff *
2446 isl_multi_pw_aff_from_multi_aff(
2447 __isl_take isl_multi_aff *ma);
2449 Multiple expressions can be copied and freed using
2450 the following functions.
2452 #include <isl/val.h>
2453 __isl_give isl_multi_val *isl_multi_val_copy(
2454 __isl_keep isl_multi_val *mv);
2455 __isl_null isl_multi_val *isl_multi_val_free(
2456 __isl_take isl_multi_val *mv);
2458 #include <isl/aff.h>
2459 __isl_give isl_multi_aff *isl_multi_aff_copy(
2460 __isl_keep isl_multi_aff *maff);
2461 __isl_null isl_multi_aff *isl_multi_aff_free(
2462 __isl_take isl_multi_aff *maff);
2463 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2464 __isl_keep isl_multi_pw_aff *mpa);
2465 __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2466 __isl_take isl_multi_pw_aff *mpa);
2468 The base expression at a given position of a multiple
2469 expression can be extracted using the following functions.
2471 #include <isl/val.h>
2472 __isl_give isl_val *isl_multi_val_get_val(
2473 __isl_keep isl_multi_val *mv, int pos);
2475 #include <isl/aff.h>
2476 __isl_give isl_aff *isl_multi_aff_get_aff(
2477 __isl_keep isl_multi_aff *multi, int pos);
2478 __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2479 __isl_keep isl_multi_pw_aff *mpa, int pos);
2481 It can be replaced using the following functions.
2483 #include <isl/val.h>
2484 __isl_give isl_multi_val *isl_multi_val_set_val(
2485 __isl_take isl_multi_val *mv, int pos,
2486 __isl_take isl_val *val);
2488 #include <isl/aff.h>
2489 __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2490 __isl_take isl_multi_aff *multi, int pos,
2491 __isl_take isl_aff *aff);
2493 =head3 Piecewise Expressions
2495 A piecewise expression is an expression that is described
2496 using zero or more base expression defined over the same
2497 number of cells in the domain space of the base expressions.
2498 All base expressions are defined over the same
2499 domain space and the cells are disjoint.
2500 The space of a piecewise expression is the same as
2501 that of the base expressions.
2502 If the union of the cells is a strict subset of the domain
2503 space, then the value of the piecewise expression outside
2504 this union is different for types derived from quasi-affine
2505 expressions and those derived from quasipolynomials.
2506 Piecewise expressions derived from quasi-affine expressions
2507 are considered to be undefined outside the union of their cells.
2508 Piecewise expressions derived from quasipolynomials
2509 are considered to be zero outside the union of their cells.
2511 Piecewise quasipolynomials are mainly used by the C<barvinok>
2512 library for representing the number of elements in a parametric set or map.
2513 For example, the piecewise quasipolynomial
2515 [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
2517 represents the number of points in the map
2519 [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
2521 The piecewise expression types defined by C<isl>
2522 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
2523 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
2525 A piecewise expression with no cells can be created using
2526 the following functions.
2528 #include <isl/aff.h>
2529 __isl_give isl_pw_aff *isl_pw_aff_empty(
2530 __isl_take isl_space *space);
2531 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
2532 __isl_take isl_space *space);
2534 A piecewise expression with a single universe cell can be
2535 created using the following functions.
2537 #include <isl/aff.h>
2538 __isl_give isl_pw_aff *isl_pw_aff_from_aff(
2539 __isl_take isl_aff *aff);
2540 __isl_give isl_pw_multi_aff *
2541 isl_pw_multi_aff_from_multi_aff(
2542 __isl_take isl_multi_aff *ma);
2544 #include <isl/polynomial.h>
2545 __isl_give isl_pw_qpolynomial *
2546 isl_pw_qpolynomial_from_qpolynomial(
2547 __isl_take isl_qpolynomial *qp);
2549 A piecewise expression with a single specified cell can be
2550 created using the following functions.
2552 #include <isl/aff.h>
2553 __isl_give isl_pw_aff *isl_pw_aff_alloc(
2554 __isl_take isl_set *set, __isl_take isl_aff *aff);
2555 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
2556 __isl_take isl_set *set,
2557 __isl_take isl_multi_aff *maff);
2559 #include <isl/polynomial.h>
2560 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
2561 __isl_take isl_set *set,
2562 __isl_take isl_qpolynomial *qp);
2564 The following convenience functions first create a base expression and
2565 then create a piecewise expression over a universe domain.
2567 #include <isl/aff.h>
2568 __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
2569 __isl_take isl_local_space *ls);
2570 __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
2571 __isl_take isl_local_space *ls,
2572 enum isl_dim_type type, unsigned pos);
2573 __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
2574 __isl_take isl_local_space *ls);
2575 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
2576 __isl_take isl_space *space);
2577 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
2578 __isl_take isl_space *space);
2579 __isl_give isl_pw_multi_aff *
2580 isl_pw_multi_aff_project_out_map(
2581 __isl_take isl_space *space,
2582 enum isl_dim_type type,
2583 unsigned first, unsigned n);
2585 #include <isl/polynomial.h>
2586 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
2587 __isl_take isl_space *space);
2589 As a convenience, a piecewise multiple expression can
2590 also be created from a piecewise expression.
2591 Each multiple expression in the result is derived
2592 from the corresponding base expression.
2594 #include <isl/aff.h>
2595 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
2596 __isl_take isl_pw_aff *pa);
2598 Similarly, a piecewise quasipolynomial can be
2599 created from a piecewise quasi-affine expression using
2600 the following function.
2602 #include <isl/polynomial.h>
2603 __isl_give isl_pw_qpolynomial *
2604 isl_pw_qpolynomial_from_pw_aff(
2605 __isl_take isl_pw_aff *pwaff);
2607 Piecewise expressions can be copied and freed using the following functions.
2609 #include <isl/aff.h>
2610 __isl_give isl_pw_aff *isl_pw_aff_copy(
2611 __isl_keep isl_pw_aff *pwaff);
2612 __isl_null isl_pw_aff *isl_pw_aff_free(
2613 __isl_take isl_pw_aff *pwaff);
2614 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
2615 __isl_keep isl_pw_multi_aff *pma);
2616 __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
2617 __isl_take isl_pw_multi_aff *pma);
2619 #include <isl/polynomial.h>
2620 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
2621 __isl_keep isl_pw_qpolynomial *pwqp);
2622 __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
2623 __isl_take isl_pw_qpolynomial *pwqp);
2624 __isl_give isl_pw_qpolynomial_fold *
2625 isl_pw_qpolynomial_fold_copy(
2626 __isl_keep isl_pw_qpolynomial_fold *pwf);
2627 __isl_null isl_pw_qpolynomial_fold *
2628 isl_pw_qpolynomial_fold_free(
2629 __isl_take isl_pw_qpolynomial_fold *pwf);
2631 To iterate over the different cells of a piecewise expression,
2632 use the following functions.
2634 #include <isl/aff.h>
2635 int isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
2636 int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
2637 int isl_pw_aff_foreach_piece(__isl_keep isl_pw_aff *pwaff,
2638 int (*fn)(__isl_take isl_set *set,
2639 __isl_take isl_aff *aff,
2640 void *user), void *user);
2641 int isl_pw_multi_aff_foreach_piece(
2642 __isl_keep isl_pw_multi_aff *pma,
2643 int (*fn)(__isl_take isl_set *set,
2644 __isl_take isl_multi_aff *maff,
2645 void *user), void *user);
2647 #include <isl/polynomial.h>
2648 int isl_pw_qpolynomial_foreach_piece(
2649 __isl_keep isl_pw_qpolynomial *pwqp,
2650 int (*fn)(__isl_take isl_set *set,
2651 __isl_take isl_qpolynomial *qp,
2652 void *user), void *user);
2653 int isl_pw_qpolynomial_foreach_lifted_piece(
2654 __isl_keep isl_pw_qpolynomial *pwqp,
2655 int (*fn)(__isl_take isl_set *set,
2656 __isl_take isl_qpolynomial *qp,
2657 void *user), void *user);
2658 int isl_pw_qpolynomial_fold_foreach_piece(
2659 __isl_keep isl_pw_qpolynomial_fold *pwf,
2660 int (*fn)(__isl_take isl_set *set,
2661 __isl_take isl_qpolynomial_fold *fold,
2662 void *user), void *user);
2663 int isl_pw_qpolynomial_fold_foreach_lifted_piece(
2664 __isl_keep isl_pw_qpolynomial_fold *pwf,
2665 int (*fn)(__isl_take isl_set *set,
2666 __isl_take isl_qpolynomial_fold *fold,
2667 void *user), void *user);
2669 As usual, the function C<fn> should return C<0> on success
2670 and C<-1> on failure. The difference between
2671 C<isl_pw_qpolynomial_foreach_piece> and
2672 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
2673 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
2674 compute unique representations for all existentially quantified
2675 variables and then turn these existentially quantified variables
2676 into extra set variables, adapting the associated quasipolynomial
2677 accordingly. This means that the C<set> passed to C<fn>
2678 will not have any existentially quantified variables, but that
2679 the dimensions of the sets may be different for different
2680 invocations of C<fn>.
2681 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
2682 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
2684 A piecewise expression consisting of the expressions at a given
2685 position of a piecewise multiple expression can be extracted
2686 using the following function.
2688 #include <isl/aff.h>
2689 __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
2690 __isl_keep isl_pw_multi_aff *pma, int pos);
2692 These expressions can be replaced using the following function.
2694 #include <isl/aff.h>
2695 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
2696 __isl_take isl_pw_multi_aff *pma, unsigned pos,
2697 __isl_take isl_pw_aff *pa);
2699 Note that there is a difference between C<isl_multi_pw_aff> and
2700 C<isl_pw_multi_aff> objects. The first is a sequence of piecewise
2701 affine expressions, while the second is a piecewise sequence
2702 of affine expressions. In particular, each of the piecewise
2703 affine expressions in an C<isl_multi_pw_aff> may have a different
2704 domain, while all multiple expressions associated to a cell
2705 in an C<isl_pw_multi_aff> have the same domain.
2706 It is possible to convert between the two, but when converting
2707 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
2708 of the result is the intersection of the domains of the input.
2709 The reverse conversion is exact.
2711 #include <isl/aff.h>
2712 __isl_give isl_pw_multi_aff *
2713 isl_pw_multi_aff_from_multi_pw_aff(
2714 __isl_take isl_multi_pw_aff *mpa);
2715 __isl_give isl_multi_pw_aff *
2716 isl_multi_pw_aff_from_pw_multi_aff(
2717 __isl_take isl_pw_multi_aff *pma);
2719 =head3 Union Expressions
2721 A union expression collects base expressions defined
2722 over different domains. The space of a union expression
2723 is that of the shared parameter space.
2725 The union expression types defined by C<isl>
2726 are C<isl_union_pw_multi_aff>, C<isl_union_pw_qpolynomial> and
2727 C<isl_union_pw_qpolynomial_fold>.
2729 An empty union expression can be created using the following functions.
2731 #include <isl/aff.h>
2732 __isl_give isl_union_pw_multi_aff *
2733 isl_union_pw_multi_aff_empty(
2734 __isl_take isl_space *space);
2736 #include <isl/polynomial.h>
2737 __isl_give isl_union_pw_qpolynomial *
2738 isl_union_pw_qpolynomial_zero(
2739 __isl_take isl_space *space);
2741 A union expression containing a single base expression
2742 can be created using the following function.
2744 #include <isl/polynomial.h>
2745 __isl_give isl_union_pw_qpolynomial *
2746 isl_union_pw_qpolynomial_from_pw_qpolynomial(
2747 __isl_take isl_pw_qpolynomial *pwqp);
2749 A base expression can be added to a union expression using
2750 the following functions.
2752 #include <isl/aff.h>
2753 __isl_give isl_union_pw_multi_aff *
2754 isl_union_pw_multi_aff_add_pw_multi_aff(
2755 __isl_take isl_union_pw_multi_aff *upma,
2756 __isl_take isl_pw_multi_aff *pma);
2758 #include <isl/polynomial.h>
2759 __isl_give isl_union_pw_qpolynomial *
2760 isl_union_pw_qpolynomial_add_pw_qpolynomial(
2761 __isl_take isl_union_pw_qpolynomial *upwqp,
2762 __isl_take isl_pw_qpolynomial *pwqp);
2764 Union expressions can be copied and freed using
2765 the following functions.
2767 #include <isl/aff.h>
2768 __isl_give isl_union_pw_multi_aff *
2769 isl_union_pw_multi_aff_copy(
2770 __isl_keep isl_union_pw_multi_aff *upma);
2771 __isl_null isl_union_pw_multi_aff *
2772 isl_union_pw_multi_aff_free(
2773 __isl_take isl_union_pw_multi_aff *upma);
2775 #include <isl/polynomial.h>
2776 __isl_give isl_union_pw_qpolynomial *
2777 isl_union_pw_qpolynomial_copy(
2778 __isl_keep isl_union_pw_qpolynomial *upwqp);
2779 __isl_null isl_union_pw_qpolynomial *
2780 isl_union_pw_qpolynomial_free(
2781 __isl_take isl_union_pw_qpolynomial *upwqp);
2782 __isl_give isl_union_pw_qpolynomial_fold *
2783 isl_union_pw_qpolynomial_fold_copy(
2784 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
2785 __isl_null isl_union_pw_qpolynomial_fold *
2786 isl_union_pw_qpolynomial_fold_free(
2787 __isl_take isl_union_pw_qpolynomial_fold *upwf);
2789 To iterate over the base expressions in a union expression,
2790 use the following functions.
2792 #include <isl/aff.h>
2793 int isl_union_pw_multi_aff_foreach_pw_multi_aff(
2794 __isl_keep isl_union_pw_multi_aff *upma,
2795 int (*fn)(__isl_take isl_pw_multi_aff *pma,
2796 void *user), void *user);
2798 #include <isl/polynomial.h>
2799 int isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
2800 __isl_keep isl_union_pw_qpolynomial *upwqp,
2801 int (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
2802 void *user), void *user);
2803 int isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
2804 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
2805 int (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
2806 void *user), void *user);
2808 To extract the base expression in a given space from a union, use
2809 the following function.
2811 #include <isl/polynomial.h>
2812 __isl_give isl_pw_qpolynomial *
2813 isl_union_pw_qpolynomial_extract_pw_qpolynomial(
2814 __isl_keep isl_union_pw_qpolynomial *upwqp,
2815 __isl_take isl_space *space);
2817 =head2 Input and Output
2819 For set and relation,
2820 C<isl> supports its own input/output format, which is similar
2821 to the C<Omega> format, but also supports the C<PolyLib> format
2823 For other object types, typically only an C<isl> format is supported.
2825 =head3 C<isl> format
2827 The C<isl> format is similar to that of C<Omega>, but has a different
2828 syntax for describing the parameters and allows for the definition
2829 of an existentially quantified variable as the integer division
2830 of an affine expression.
2831 For example, the set of integers C<i> between C<0> and C<n>
2832 such that C<i % 10 <= 6> can be described as
2834 [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
2837 A set or relation can have several disjuncts, separated
2838 by the keyword C<or>. Each disjunct is either a conjunction
2839 of constraints or a projection (C<exists>) of a conjunction
2840 of constraints. The constraints are separated by the keyword
2843 =head3 C<PolyLib> format
2845 If the represented set is a union, then the first line
2846 contains a single number representing the number of disjuncts.
2847 Otherwise, a line containing the number C<1> is optional.
2849 Each disjunct is represented by a matrix of constraints.
2850 The first line contains two numbers representing
2851 the number of rows and columns,
2852 where the number of rows is equal to the number of constraints
2853 and the number of columns is equal to two plus the number of variables.
2854 The following lines contain the actual rows of the constraint matrix.
2855 In each row, the first column indicates whether the constraint
2856 is an equality (C<0>) or inequality (C<1>). The final column
2857 corresponds to the constant term.
2859 If the set is parametric, then the coefficients of the parameters
2860 appear in the last columns before the constant column.
2861 The coefficients of any existentially quantified variables appear
2862 between those of the set variables and those of the parameters.
2864 =head3 Extended C<PolyLib> format
2866 The extended C<PolyLib> format is nearly identical to the
2867 C<PolyLib> format. The only difference is that the line
2868 containing the number of rows and columns of a constraint matrix
2869 also contains four additional numbers:
2870 the number of output dimensions, the number of input dimensions,
2871 the number of local dimensions (i.e., the number of existentially
2872 quantified variables) and the number of parameters.
2873 For sets, the number of ``output'' dimensions is equal
2874 to the number of set dimensions, while the number of ``input''
2879 Objects can be read from input using the following functions.
2881 #include <isl/val.h>
2882 __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
2885 #include <isl/set.h>
2886 __isl_give isl_basic_set *isl_basic_set_read_from_file(
2887 isl_ctx *ctx, FILE *input);
2888 __isl_give isl_basic_set *isl_basic_set_read_from_str(
2889 isl_ctx *ctx, const char *str);
2890 __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
2892 __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
2895 #include <isl/map.h>
2896 __isl_give isl_basic_map *isl_basic_map_read_from_file(
2897 isl_ctx *ctx, FILE *input);
2898 __isl_give isl_basic_map *isl_basic_map_read_from_str(
2899 isl_ctx *ctx, const char *str);
2900 __isl_give isl_map *isl_map_read_from_file(
2901 isl_ctx *ctx, FILE *input);
2902 __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
2905 #include <isl/union_set.h>
2906 __isl_give isl_union_set *isl_union_set_read_from_file(
2907 isl_ctx *ctx, FILE *input);
2908 __isl_give isl_union_set *isl_union_set_read_from_str(
2909 isl_ctx *ctx, const char *str);
2911 #include <isl/union_map.h>
2912 __isl_give isl_union_map *isl_union_map_read_from_file(
2913 isl_ctx *ctx, FILE *input);
2914 __isl_give isl_union_map *isl_union_map_read_from_str(
2915 isl_ctx *ctx, const char *str);
2917 #include <isl/aff.h>
2918 __isl_give isl_aff *isl_aff_read_from_str(
2919 isl_ctx *ctx, const char *str);
2920 __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
2921 isl_ctx *ctx, const char *str);
2922 __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
2923 isl_ctx *ctx, const char *str);
2924 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
2925 isl_ctx *ctx, const char *str);
2926 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
2927 isl_ctx *ctx, const char *str);
2928 __isl_give isl_union_pw_multi_aff *
2929 isl_union_pw_multi_aff_read_from_str(
2930 isl_ctx *ctx, const char *str);
2932 #include <isl/polynomial.h>
2933 __isl_give isl_union_pw_qpolynomial *
2934 isl_union_pw_qpolynomial_read_from_str(
2935 isl_ctx *ctx, const char *str);
2937 For sets and relations,
2938 the input format is autodetected and may be either the C<PolyLib> format
2939 or the C<isl> format.
2943 Before anything can be printed, an C<isl_printer> needs to
2946 __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
2948 __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
2949 __isl_null isl_printer *isl_printer_free(
2950 __isl_take isl_printer *printer);
2951 __isl_give char *isl_printer_get_str(
2952 __isl_keep isl_printer *printer);
2954 The printer can be inspected using the following functions.
2956 FILE *isl_printer_get_file(
2957 __isl_keep isl_printer *printer);
2958 int isl_printer_get_output_format(
2959 __isl_keep isl_printer *p);
2961 The behavior of the printer can be modified in various ways
2963 __isl_give isl_printer *isl_printer_set_output_format(
2964 __isl_take isl_printer *p, int output_format);
2965 __isl_give isl_printer *isl_printer_set_indent(
2966 __isl_take isl_printer *p, int indent);
2967 __isl_give isl_printer *isl_printer_set_indent_prefix(
2968 __isl_take isl_printer *p, const char *prefix);
2969 __isl_give isl_printer *isl_printer_indent(
2970 __isl_take isl_printer *p, int indent);
2971 __isl_give isl_printer *isl_printer_set_prefix(
2972 __isl_take isl_printer *p, const char *prefix);
2973 __isl_give isl_printer *isl_printer_set_suffix(
2974 __isl_take isl_printer *p, const char *suffix);
2976 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
2977 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
2978 and defaults to C<ISL_FORMAT_ISL>.
2979 Each line in the output is prefixed by C<indent_prefix>,
2980 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
2981 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
2982 In the C<PolyLib> format output,
2983 the coefficients of the existentially quantified variables
2984 appear between those of the set variables and those
2986 The function C<isl_printer_indent> increases the indentation
2987 by the specified amount (which may be negative).
2989 To actually print something, use
2991 #include <isl/printer.h>
2992 __isl_give isl_printer *isl_printer_print_double(
2993 __isl_take isl_printer *p, double d);
2995 #include <isl/val.h>
2996 __isl_give isl_printer *isl_printer_print_val(
2997 __isl_take isl_printer *p, __isl_keep isl_val *v);
2999 #include <isl/set.h>
3000 __isl_give isl_printer *isl_printer_print_basic_set(
3001 __isl_take isl_printer *printer,
3002 __isl_keep isl_basic_set *bset);
3003 __isl_give isl_printer *isl_printer_print_set(
3004 __isl_take isl_printer *printer,
3005 __isl_keep isl_set *set);
3007 #include <isl/map.h>
3008 __isl_give isl_printer *isl_printer_print_basic_map(
3009 __isl_take isl_printer *printer,
3010 __isl_keep isl_basic_map *bmap);
3011 __isl_give isl_printer *isl_printer_print_map(
3012 __isl_take isl_printer *printer,
3013 __isl_keep isl_map *map);
3015 #include <isl/union_set.h>
3016 __isl_give isl_printer *isl_printer_print_union_set(
3017 __isl_take isl_printer *p,
3018 __isl_keep isl_union_set *uset);
3020 #include <isl/union_map.h>
3021 __isl_give isl_printer *isl_printer_print_union_map(
3022 __isl_take isl_printer *p,
3023 __isl_keep isl_union_map *umap);
3025 #include <isl/val.h>
3026 __isl_give isl_printer *isl_printer_print_multi_val(
3027 __isl_take isl_printer *p,
3028 __isl_keep isl_multi_val *mv);
3030 #include <isl/aff.h>
3031 __isl_give isl_printer *isl_printer_print_aff(
3032 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3033 __isl_give isl_printer *isl_printer_print_multi_aff(
3034 __isl_take isl_printer *p,
3035 __isl_keep isl_multi_aff *maff);
3036 __isl_give isl_printer *isl_printer_print_pw_aff(
3037 __isl_take isl_printer *p,
3038 __isl_keep isl_pw_aff *pwaff);
3039 __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3040 __isl_take isl_printer *p,
3041 __isl_keep isl_pw_multi_aff *pma);
3042 __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3043 __isl_take isl_printer *p,
3044 __isl_keep isl_multi_pw_aff *mpa);
3045 __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3046 __isl_take isl_printer *p,
3047 __isl_keep isl_union_pw_multi_aff *upma);
3049 #include <isl/polynomial.h>
3050 __isl_give isl_printer *isl_printer_print_qpolynomial(
3051 __isl_take isl_printer *p,
3052 __isl_keep isl_qpolynomial *qp);
3053 __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3054 __isl_take isl_printer *p,
3055 __isl_keep isl_pw_qpolynomial *pwqp);
3056 __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3057 __isl_take isl_printer *p,
3058 __isl_keep isl_union_pw_qpolynomial *upwqp);
3060 __isl_give isl_printer *
3061 isl_printer_print_pw_qpolynomial_fold(
3062 __isl_take isl_printer *p,
3063 __isl_keep isl_pw_qpolynomial_fold *pwf);
3064 __isl_give isl_printer *
3065 isl_printer_print_union_pw_qpolynomial_fold(
3066 __isl_take isl_printer *p,
3067 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3069 For C<isl_printer_print_qpolynomial>,
3070 C<isl_printer_print_pw_qpolynomial> and
3071 C<isl_printer_print_pw_qpolynomial_fold>,
3072 the output format of the printer
3073 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3074 For C<isl_printer_print_union_pw_qpolynomial> and
3075 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3077 In case of printing in C<ISL_FORMAT_C>, the user may want
3078 to set the names of all dimensions first.
3080 When called on a file printer, the following function flushes
3081 the file. When called on a string printer, the buffer is cleared.
3083 __isl_give isl_printer *isl_printer_flush(
3084 __isl_take isl_printer *p);
3086 Alternatively, a string representation can be obtained
3087 directly using the following functions, which always print
3090 #include <isl/space.h>
3091 __isl_give char *isl_space_to_str(
3092 __isl_keep isl_space *space);
3094 #include <isl/val.h>
3095 __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3096 __isl_give char *isl_multi_val_to_str(
3097 __isl_keep isl_multi_val *mv);
3099 #include <isl/set.h>
3100 __isl_give char *isl_set_to_str(
3101 __isl_keep isl_set *set);
3103 #include <isl/map.h>
3104 __isl_give char *isl_map_to_str(
3105 __isl_keep isl_map *map);
3107 #include <isl/aff.h>
3108 __isl_give char *isl_multi_aff_to_str(
3109 __isl_keep isl_multi_aff *aff);
3110 __isl_give char *isl_union_pw_multi_aff_to_str(
3111 __isl_keep isl_union_pw_multi_aff *upma);
3115 =head3 Unary Properties
3121 The following functions test whether the given set or relation
3122 contains any integer points. The ``plain'' variants do not perform
3123 any computations, but simply check if the given set or relation
3124 is already known to be empty.
3126 int isl_basic_set_plain_is_empty(__isl_keep isl_basic_set *bset);
3127 int isl_basic_set_is_empty(__isl_keep isl_basic_set *bset);
3128 int isl_set_plain_is_empty(__isl_keep isl_set *set);
3129 int isl_set_is_empty(__isl_keep isl_set *set);
3130 int isl_union_set_is_empty(__isl_keep isl_union_set *uset);
3131 int isl_basic_map_plain_is_empty(__isl_keep isl_basic_map *bmap);
3132 int isl_basic_map_is_empty(__isl_keep isl_basic_map *bmap);
3133 int isl_map_plain_is_empty(__isl_keep isl_map *map);
3134 int isl_map_is_empty(__isl_keep isl_map *map);
3135 int isl_union_map_is_empty(__isl_keep isl_union_map *umap);
3137 =item * Universality
3139 int isl_basic_set_is_universe(__isl_keep isl_basic_set *bset);
3140 int isl_basic_map_is_universe(__isl_keep isl_basic_map *bmap);
3141 int isl_set_plain_is_universe(__isl_keep isl_set *set);
3143 =item * Single-valuedness
3145 #include <isl/set.h>
3146 int isl_set_is_singleton(__isl_keep isl_set *set);
3148 #include <isl/map.h>
3149 int isl_basic_map_is_single_valued(
3150 __isl_keep isl_basic_map *bmap);
3151 int isl_map_plain_is_single_valued(
3152 __isl_keep isl_map *map);
3153 int isl_map_is_single_valued(__isl_keep isl_map *map);
3155 #include <isl/union_map.h>
3156 int isl_union_map_is_single_valued(__isl_keep isl_union_map *umap);
3160 int isl_map_plain_is_injective(__isl_keep isl_map *map);
3161 int isl_map_is_injective(__isl_keep isl_map *map);
3162 int isl_union_map_plain_is_injective(
3163 __isl_keep isl_union_map *umap);
3164 int isl_union_map_is_injective(
3165 __isl_keep isl_union_map *umap);
3169 int isl_map_is_bijective(__isl_keep isl_map *map);
3170 int isl_union_map_is_bijective(__isl_keep isl_union_map *umap);
3174 __isl_give isl_val *
3175 isl_basic_map_plain_get_val_if_fixed(
3176 __isl_keep isl_basic_map *bmap,
3177 enum isl_dim_type type, unsigned pos);
3178 __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3179 __isl_keep isl_set *set,
3180 enum isl_dim_type type, unsigned pos);
3181 __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3182 __isl_keep isl_map *map,
3183 enum isl_dim_type type, unsigned pos);
3185 If the set or relation obviously lies on a hyperplane where the given dimension
3186 has a fixed value, then return that value.
3187 Otherwise return NaN.
3191 int isl_set_dim_residue_class_val(
3192 __isl_keep isl_set *set,
3193 int pos, __isl_give isl_val **modulo,
3194 __isl_give isl_val **residue);
3196 Check if the values of the given set dimension are equal to a fixed
3197 value modulo some integer value. If so, assign the modulo to C<*modulo>
3198 and the fixed value to C<*residue>. If the given dimension attains only
3199 a single value, then assign C<0> to C<*modulo> and the fixed value to
3201 If the dimension does not attain only a single value and if no modulo
3202 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3206 To check whether the description of a set, relation or function depends
3207 on one or more given dimensions,
3208 the following functions can be used.
3210 #include <isl/constraint.h>
3211 int isl_constraint_involves_dims(
3212 __isl_keep isl_constraint *constraint,
3213 enum isl_dim_type type, unsigned first, unsigned n);
3215 #include <isl/set.h>
3216 int isl_basic_set_involves_dims(
3217 __isl_keep isl_basic_set *bset,
3218 enum isl_dim_type type, unsigned first, unsigned n);
3219 int isl_set_involves_dims(__isl_keep isl_set *set,
3220 enum isl_dim_type type, unsigned first, unsigned n);
3222 #include <isl/map.h>
3223 int isl_basic_map_involves_dims(
3224 __isl_keep isl_basic_map *bmap,
3225 enum isl_dim_type type, unsigned first, unsigned n);
3226 int isl_map_involves_dims(__isl_keep isl_map *map,
3227 enum isl_dim_type type, unsigned first, unsigned n);
3229 #include <isl/aff.h>
3230 int isl_aff_involves_dims(__isl_keep isl_aff *aff,
3231 enum isl_dim_type type, unsigned first, unsigned n);
3232 int isl_pw_aff_involves_dims(__isl_keep isl_pw_aff *pwaff,
3233 enum isl_dim_type type, unsigned first, unsigned n);
3234 int isl_multi_aff_involves_dims(
3235 __isl_keep isl_multi_aff *ma,
3236 enum isl_dim_type type, unsigned first, unsigned n);
3237 int isl_multi_pw_aff_involves_dims(
3238 __isl_keep isl_multi_pw_aff *mpa,
3239 enum isl_dim_type type, unsigned first, unsigned n);
3241 Similarly, the following functions can be used to check whether
3242 a given dimension is involved in any lower or upper bound.
3244 #include <isl/set.h>
3245 int isl_set_dim_has_any_lower_bound(__isl_keep isl_set *set,
3246 enum isl_dim_type type, unsigned pos);
3247 int isl_set_dim_has_any_upper_bound(__isl_keep isl_set *set,
3248 enum isl_dim_type type, unsigned pos);
3250 Note that these functions return true even if there is a bound on
3251 the dimension on only some of the basic sets of C<set>.
3252 To check if they have a bound for all of the basic sets in C<set>,
3253 use the following functions instead.
3255 #include <isl/set.h>
3256 int isl_set_dim_has_lower_bound(__isl_keep isl_set *set,
3257 enum isl_dim_type type, unsigned pos);
3258 int isl_set_dim_has_upper_bound(__isl_keep isl_set *set,
3259 enum isl_dim_type type, unsigned pos);
3263 To check whether a set is a parameter domain, use this function:
3265 int isl_set_is_params(__isl_keep isl_set *set);
3266 int isl_union_set_is_params(
3267 __isl_keep isl_union_set *uset);
3271 The following functions check whether the space of the given
3272 (basic) set or relation range is a wrapped relation.
3274 #include <isl/space.h>
3275 int isl_space_is_wrapping(
3276 __isl_keep isl_space *space);
3277 int isl_space_domain_is_wrapping(
3278 __isl_keep isl_space *space);
3279 int isl_space_range_is_wrapping(
3280 __isl_keep isl_space *space);
3282 #include <isl/set.h>
3283 int isl_basic_set_is_wrapping(
3284 __isl_keep isl_basic_set *bset);
3285 int isl_set_is_wrapping(__isl_keep isl_set *set);
3287 #include <isl/map.h>
3288 int isl_map_domain_is_wrapping(
3289 __isl_keep isl_map *map);
3290 int isl_map_range_is_wrapping(
3291 __isl_keep isl_map *map);
3293 #include <isl/val.h>
3294 int isl_multi_val_range_is_wrapping(
3295 __isl_keep isl_multi_val *mv);
3297 #include <isl/aff.h>
3298 int isl_multi_aff_range_is_wrapping(
3299 __isl_keep isl_multi_aff *ma);
3300 int isl_multi_pw_aff_range_is_wrapping(
3301 __isl_keep isl_multi_pw_aff *mpa);
3303 The input to C<isl_space_is_wrapping> should
3304 be the space of a set, while that of
3305 C<isl_space_domain_is_wrapping> and
3306 C<isl_space_range_is_wrapping> should be the space of a relation.
3308 =item * Internal Product
3310 int isl_basic_map_can_zip(
3311 __isl_keep isl_basic_map *bmap);
3312 int isl_map_can_zip(__isl_keep isl_map *map);
3314 Check whether the product of domain and range of the given relation
3316 i.e., whether both domain and range are nested relations.
3320 int isl_basic_map_can_curry(
3321 __isl_keep isl_basic_map *bmap);
3322 int isl_map_can_curry(__isl_keep isl_map *map);
3324 Check whether the domain of the (basic) relation is a wrapped relation.
3326 int isl_basic_map_can_uncurry(
3327 __isl_keep isl_basic_map *bmap);
3328 int isl_map_can_uncurry(__isl_keep isl_map *map);
3330 Check whether the range of the (basic) relation is a wrapped relation.
3332 =item * Special Values
3334 #include <isl/aff.h>
3335 int isl_aff_is_cst(__isl_keep isl_aff *aff);
3336 int isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
3338 Check whether the given expression is a constant.
3340 #include <isl/aff.h>
3341 int isl_aff_is_nan(__isl_keep isl_aff *aff);
3342 int isl_pw_aff_involves_nan(__isl_keep isl_pw_aff *pa);
3344 Check whether the given expression is equal to or involves NaN.
3346 #include <isl/aff.h>
3347 int isl_aff_plain_is_zero(__isl_keep isl_aff *aff);
3349 Check whether the affine expression is obviously zero.
3353 =head3 Binary Properties
3359 The following functions check whether two objects
3360 represent the same set, relation or function.
3361 The C<plain> variants only return true if the objects
3362 are obviously the same. That is, they may return false
3363 even if the objects are the same, but they will never
3364 return true if the objects are not the same.
3366 #include <isl/set.h>
3367 int isl_basic_set_plain_is_equal(
3368 __isl_keep isl_basic_set *bset1,
3369 __isl_keep isl_basic_set *bset2);
3370 int isl_set_plain_is_equal(__isl_keep isl_set *set1,
3371 __isl_keep isl_set *set2);
3372 int isl_set_is_equal(__isl_keep isl_set *set1,
3373 __isl_keep isl_set *set2);
3375 #include <isl/map.h>
3376 int isl_basic_map_is_equal(
3377 __isl_keep isl_basic_map *bmap1,
3378 __isl_keep isl_basic_map *bmap2);
3379 int isl_map_is_equal(__isl_keep isl_map *map1,
3380 __isl_keep isl_map *map2);
3381 int isl_map_plain_is_equal(__isl_keep isl_map *map1,
3382 __isl_keep isl_map *map2);
3384 #include <isl/union_set.h>
3385 int isl_union_set_is_equal(
3386 __isl_keep isl_union_set *uset1,
3387 __isl_keep isl_union_set *uset2);
3389 #include <isl/union_map.h>
3390 int isl_union_map_is_equal(
3391 __isl_keep isl_union_map *umap1,
3392 __isl_keep isl_union_map *umap2);
3394 #include <isl/aff.h>
3395 int isl_aff_plain_is_equal(__isl_keep isl_aff *aff1,
3396 __isl_keep isl_aff *aff2);
3397 int isl_multi_aff_plain_is_equal(
3398 __isl_keep isl_multi_aff *maff1,
3399 __isl_keep isl_multi_aff *maff2);
3400 int isl_pw_aff_plain_is_equal(
3401 __isl_keep isl_pw_aff *pwaff1,
3402 __isl_keep isl_pw_aff *pwaff2);
3403 int isl_pw_multi_aff_plain_is_equal(
3404 __isl_keep isl_pw_multi_aff *pma1,
3405 __isl_keep isl_pw_multi_aff *pma2);
3406 int isl_multi_pw_aff_plain_is_equal(
3407 __isl_keep isl_multi_pw_aff *mpa1,
3408 __isl_keep isl_multi_pw_aff *mpa2);
3409 int isl_multi_pw_aff_is_equal(
3410 __isl_keep isl_multi_pw_aff *mpa1,
3411 __isl_keep isl_multi_pw_aff *mpa2);
3413 #include <isl/polynomial.h>
3414 int isl_union_pw_qpolynomial_plain_is_equal(
3415 __isl_keep isl_union_pw_qpolynomial *upwqp1,
3416 __isl_keep isl_union_pw_qpolynomial *upwqp2);
3417 int isl_union_pw_qpolynomial_fold_plain_is_equal(
3418 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
3419 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
3421 =item * Disjointness
3423 int isl_basic_set_is_disjoint(
3424 __isl_keep isl_basic_set *bset1,
3425 __isl_keep isl_basic_set *bset2);
3426 int isl_set_plain_is_disjoint(__isl_keep isl_set *set1,
3427 __isl_keep isl_set *set2);
3428 int isl_set_is_disjoint(__isl_keep isl_set *set1,
3429 __isl_keep isl_set *set2);
3430 int isl_basic_map_is_disjoint(
3431 __isl_keep isl_basic_map *bmap1,
3432 __isl_keep isl_basic_map *bmap2);
3433 int isl_map_is_disjoint(__isl_keep isl_map *map1,
3434 __isl_keep isl_map *map2);
3438 int isl_basic_set_is_subset(
3439 __isl_keep isl_basic_set *bset1,
3440 __isl_keep isl_basic_set *bset2);
3441 int isl_set_is_subset(__isl_keep isl_set *set1,
3442 __isl_keep isl_set *set2);
3443 int isl_set_is_strict_subset(
3444 __isl_keep isl_set *set1,
3445 __isl_keep isl_set *set2);
3446 int isl_union_set_is_subset(
3447 __isl_keep isl_union_set *uset1,
3448 __isl_keep isl_union_set *uset2);
3449 int isl_union_set_is_strict_subset(
3450 __isl_keep isl_union_set *uset1,
3451 __isl_keep isl_union_set *uset2);
3452 int isl_basic_map_is_subset(
3453 __isl_keep isl_basic_map *bmap1,
3454 __isl_keep isl_basic_map *bmap2);
3455 int isl_basic_map_is_strict_subset(
3456 __isl_keep isl_basic_map *bmap1,
3457 __isl_keep isl_basic_map *bmap2);
3458 int isl_map_is_subset(
3459 __isl_keep isl_map *map1,
3460 __isl_keep isl_map *map2);
3461 int isl_map_is_strict_subset(
3462 __isl_keep isl_map *map1,
3463 __isl_keep isl_map *map2);
3464 int isl_union_map_is_subset(
3465 __isl_keep isl_union_map *umap1,
3466 __isl_keep isl_union_map *umap2);
3467 int isl_union_map_is_strict_subset(
3468 __isl_keep isl_union_map *umap1,
3469 __isl_keep isl_union_map *umap2);
3471 Check whether the first argument is a (strict) subset of the
3476 Every comparison function returns a negative value if the first
3477 argument is considered smaller than the second, a positive value
3478 if the first argument is considered greater and zero if the two
3479 constraints are considered the same by the comparison criterion.
3481 #include <isl/constraint.h>
3482 int isl_constraint_plain_cmp(
3483 __isl_keep isl_constraint *c1,
3484 __isl_keep isl_constraint *c2);
3486 This function is useful for sorting C<isl_constraint>s.
3487 The order depends on the internal representation of the inputs.
3488 The order is fixed over different calls to the function (assuming
3489 the internal representation of the inputs has not changed), but may
3490 change over different versions of C<isl>.
3492 #include <isl/constraint.h>
3493 int isl_constraint_cmp_last_non_zero(
3494 __isl_keep isl_constraint *c1,
3495 __isl_keep isl_constraint *c2);
3497 This function can be used to sort constraints that live in the same
3498 local space. Constraints that involve ``earlier'' dimensions or
3499 that have a smaller coefficient for the shared latest dimension
3500 are considered smaller than other constraints.
3501 This function only defines a B<partial> order.
3503 #include <isl/set.h>
3504 int isl_set_plain_cmp(__isl_keep isl_set *set1,
3505 __isl_keep isl_set *set2);
3507 This function is useful for sorting C<isl_set>s.
3508 The order depends on the internal representation of the inputs.
3509 The order is fixed over different calls to the function (assuming
3510 the internal representation of the inputs has not changed), but may
3511 change over different versions of C<isl>.
3513 #include <isl/aff.h>
3514 int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
3515 __isl_keep isl_pw_aff *pa2);
3517 The function C<isl_pw_aff_plain_cmp> can be used to sort
3518 C<isl_pw_aff>s. The order is not strictly defined.
3519 The current order sorts expressions that only involve
3520 earlier dimensions before those that involve later dimensions.
3524 =head2 Unary Operations
3530 __isl_give isl_set *isl_set_complement(
3531 __isl_take isl_set *set);
3532 __isl_give isl_map *isl_map_complement(
3533 __isl_take isl_map *map);
3537 #include <isl/space.h>
3538 __isl_give isl_space *isl_space_reverse(
3539 __isl_take isl_space *space);
3541 #include <isl/map.h>
3542 __isl_give isl_basic_map *isl_basic_map_reverse(
3543 __isl_take isl_basic_map *bmap);
3544 __isl_give isl_map *isl_map_reverse(
3545 __isl_take isl_map *map);
3547 #include <isl/union_map.h>
3548 __isl_give isl_union_map *isl_union_map_reverse(
3549 __isl_take isl_union_map *umap);
3553 #include <isl/space.h>
3554 __isl_give isl_space *isl_space_domain(
3555 __isl_take isl_space *space);
3556 __isl_give isl_space *isl_space_range(
3557 __isl_take isl_space *space);
3558 __isl_give isl_space *isl_space_params(
3559 __isl_take isl_space *space);
3561 #include <isl/local_space.h>
3562 __isl_give isl_local_space *isl_local_space_domain(
3563 __isl_take isl_local_space *ls);
3564 __isl_give isl_local_space *isl_local_space_range(
3565 __isl_take isl_local_space *ls);
3567 #include <isl/set.h>
3568 __isl_give isl_basic_set *isl_basic_set_project_out(
3569 __isl_take isl_basic_set *bset,
3570 enum isl_dim_type type, unsigned first, unsigned n);
3571 __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
3572 enum isl_dim_type type, unsigned first, unsigned n);
3573 __isl_give isl_basic_set *isl_basic_set_params(
3574 __isl_take isl_basic_set *bset);
3575 __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
3577 #include <isl/map.h>
3578 __isl_give isl_basic_map *isl_basic_map_project_out(
3579 __isl_take isl_basic_map *bmap,
3580 enum isl_dim_type type, unsigned first, unsigned n);
3581 __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
3582 enum isl_dim_type type, unsigned first, unsigned n);
3583 __isl_give isl_basic_set *isl_basic_map_domain(
3584 __isl_take isl_basic_map *bmap);
3585 __isl_give isl_basic_set *isl_basic_map_range(
3586 __isl_take isl_basic_map *bmap);
3587 __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
3588 __isl_give isl_set *isl_map_domain(
3589 __isl_take isl_map *bmap);
3590 __isl_give isl_set *isl_map_range(
3591 __isl_take isl_map *map);
3593 #include <isl/union_set.h>
3594 __isl_give isl_set *isl_union_set_params(
3595 __isl_take isl_union_set *uset);
3597 #include <isl/union_map.h>
3598 __isl_give isl_union_map *isl_union_map_project_out(
3599 __isl_take isl_union_map *umap,
3600 enum isl_dim_type type, unsigned first, unsigned n);
3601 __isl_give isl_set *isl_union_map_params(
3602 __isl_take isl_union_map *umap);
3603 __isl_give isl_union_set *isl_union_map_domain(
3604 __isl_take isl_union_map *umap);
3605 __isl_give isl_union_set *isl_union_map_range(
3606 __isl_take isl_union_map *umap);
3608 The function C<isl_union_map_project_out> can only project out
3611 #include <isl/aff.h>
3612 __isl_give isl_aff *isl_aff_project_domain_on_params(
3613 __isl_take isl_aff *aff);
3614 __isl_give isl_pw_multi_aff *
3615 isl_pw_multi_aff_project_domain_on_params(
3616 __isl_take isl_pw_multi_aff *pma);
3617 __isl_give isl_set *isl_pw_aff_domain(
3618 __isl_take isl_pw_aff *pwaff);
3619 __isl_give isl_set *isl_pw_multi_aff_domain(
3620 __isl_take isl_pw_multi_aff *pma);
3621 __isl_give isl_set *isl_multi_pw_aff_domain(
3622 __isl_take isl_multi_pw_aff *mpa);
3623 __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
3624 __isl_take isl_union_pw_multi_aff *upma);
3625 __isl_give isl_set *isl_pw_aff_params(
3626 __isl_take isl_pw_aff *pwa);
3628 #include <isl/polynomial.h>
3629 __isl_give isl_qpolynomial *
3630 isl_qpolynomial_project_domain_on_params(
3631 __isl_take isl_qpolynomial *qp);
3632 __isl_give isl_pw_qpolynomial *
3633 isl_pw_qpolynomial_project_domain_on_params(
3634 __isl_take isl_pw_qpolynomial *pwqp);
3635 __isl_give isl_pw_qpolynomial_fold *
3636 isl_pw_qpolynomial_fold_project_domain_on_params(
3637 __isl_take isl_pw_qpolynomial_fold *pwf);
3638 __isl_give isl_set *isl_pw_qpolynomial_domain(
3639 __isl_take isl_pw_qpolynomial *pwqp);
3640 __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
3641 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3642 __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
3643 __isl_take isl_union_pw_qpolynomial *upwqp);
3645 #include <isl/space.h>
3646 __isl_give isl_space *isl_space_domain_map(
3647 __isl_take isl_space *space);
3648 __isl_give isl_space *isl_space_range_map(
3649 __isl_take isl_space *space);
3651 #include <isl/map.h>
3652 __isl_give isl_basic_map *isl_basic_map_domain_map(
3653 __isl_take isl_basic_map *bmap);
3654 __isl_give isl_basic_map *isl_basic_map_range_map(
3655 __isl_take isl_basic_map *bmap);
3656 __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
3657 __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
3659 #include <isl/union_map.h>
3660 __isl_give isl_union_map *isl_union_map_domain_map(
3661 __isl_take isl_union_map *umap);
3662 __isl_give isl_union_map *isl_union_map_range_map(
3663 __isl_take isl_union_map *umap);
3665 The functions above construct a (basic, regular or union) relation
3666 that maps (a wrapped version of) the input relation to its domain or range.
3670 __isl_give isl_basic_set *isl_basic_set_eliminate(
3671 __isl_take isl_basic_set *bset,
3672 enum isl_dim_type type,
3673 unsigned first, unsigned n);
3674 __isl_give isl_set *isl_set_eliminate(
3675 __isl_take isl_set *set, enum isl_dim_type type,
3676 unsigned first, unsigned n);
3677 __isl_give isl_basic_map *isl_basic_map_eliminate(
3678 __isl_take isl_basic_map *bmap,
3679 enum isl_dim_type type,
3680 unsigned first, unsigned n);
3681 __isl_give isl_map *isl_map_eliminate(
3682 __isl_take isl_map *map, enum isl_dim_type type,
3683 unsigned first, unsigned n);
3685 Eliminate the coefficients for the given dimensions from the constraints,
3686 without removing the dimensions.
3688 =item * Constructing a set from a parameter domain
3690 A zero-dimensional space or (basic) set can be constructed
3691 on a given parameter domain using the following functions.
3693 #include <isl/space.h>
3694 __isl_give isl_space *isl_space_set_from_params(
3695 __isl_take isl_space *space);
3697 #include <isl/set.h>
3698 __isl_give isl_basic_set *isl_basic_set_from_params(
3699 __isl_take isl_basic_set *bset);
3700 __isl_give isl_set *isl_set_from_params(
3701 __isl_take isl_set *set);
3703 =item * Constructing a relation from a set
3705 Create a relation with the given set as domain or range.
3706 The range or domain of the created relation is a zero-dimensional
3707 flat anonymous space.
3709 #include <isl/space.h>
3710 __isl_give isl_space *isl_space_from_domain(
3711 __isl_take isl_space *space);
3712 __isl_give isl_space *isl_space_from_range(
3713 __isl_take isl_space *space);
3714 __isl_give isl_space *isl_space_map_from_set(
3715 __isl_take isl_space *space);
3716 __isl_give isl_space *isl_space_map_from_domain_and_range(
3717 __isl_take isl_space *domain,
3718 __isl_take isl_space *range);
3720 #include <isl/local_space.h>
3721 __isl_give isl_local_space *isl_local_space_from_domain(
3722 __isl_take isl_local_space *ls);
3724 #include <isl/map.h>
3725 __isl_give isl_map *isl_map_from_domain(
3726 __isl_take isl_set *set);
3727 __isl_give isl_map *isl_map_from_range(
3728 __isl_take isl_set *set);
3730 #include <isl/val.h>
3731 __isl_give isl_multi_val *isl_multi_val_from_range(
3732 __isl_take isl_multi_val *mv);
3734 #include <isl/aff.h>
3735 __isl_give isl_multi_aff *isl_multi_aff_from_range(
3736 __isl_take isl_multi_aff *ma);
3737 __isl_give isl_pw_aff *isl_pw_aff_from_range(
3738 __isl_take isl_pw_aff *pwa);
3739 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
3740 __isl_take isl_multi_pw_aff *mpa);
3741 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
3742 __isl_take isl_set *set);
3743 __isl_give isl_union_pw_multi_aff *
3744 isl_union_pw_multi_aff_from_domain(
3745 __isl_take isl_union_set *uset);
3749 #include <isl/set.h>
3750 __isl_give isl_basic_set *isl_basic_set_fix_si(
3751 __isl_take isl_basic_set *bset,
3752 enum isl_dim_type type, unsigned pos, int value);
3753 __isl_give isl_basic_set *isl_basic_set_fix_val(
3754 __isl_take isl_basic_set *bset,
3755 enum isl_dim_type type, unsigned pos,
3756 __isl_take isl_val *v);
3757 __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
3758 enum isl_dim_type type, unsigned pos, int value);
3759 __isl_give isl_set *isl_set_fix_val(
3760 __isl_take isl_set *set,
3761 enum isl_dim_type type, unsigned pos,
3762 __isl_take isl_val *v);
3764 #include <isl/map.h>
3765 __isl_give isl_basic_map *isl_basic_map_fix_si(
3766 __isl_take isl_basic_map *bmap,
3767 enum isl_dim_type type, unsigned pos, int value);
3768 __isl_give isl_basic_map *isl_basic_map_fix_val(
3769 __isl_take isl_basic_map *bmap,
3770 enum isl_dim_type type, unsigned pos,
3771 __isl_take isl_val *v);
3772 __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
3773 enum isl_dim_type type, unsigned pos, int value);
3774 __isl_give isl_map *isl_map_fix_val(
3775 __isl_take isl_map *map,
3776 enum isl_dim_type type, unsigned pos,
3777 __isl_take isl_val *v);
3779 #include <isl/aff.h>
3780 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
3781 __isl_take isl_pw_multi_aff *pma,
3782 enum isl_dim_type type, unsigned pos, int value);
3784 #include <isl/polynomial.h>
3785 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
3786 __isl_take isl_pw_qpolynomial *pwqp,
3787 enum isl_dim_type type, unsigned n,
3788 __isl_take isl_val *v);
3790 Intersect the set, relation or function domain
3791 with the hyperplane where the given
3792 dimension has the fixed given value.
3794 __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
3795 __isl_take isl_basic_map *bmap,
3796 enum isl_dim_type type, unsigned pos, int value);
3797 __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
3798 __isl_take isl_basic_map *bmap,
3799 enum isl_dim_type type, unsigned pos, int value);
3800 __isl_give isl_set *isl_set_lower_bound_si(
3801 __isl_take isl_set *set,
3802 enum isl_dim_type type, unsigned pos, int value);
3803 __isl_give isl_set *isl_set_lower_bound_val(
3804 __isl_take isl_set *set,
3805 enum isl_dim_type type, unsigned pos,
3806 __isl_take isl_val *value);
3807 __isl_give isl_map *isl_map_lower_bound_si(
3808 __isl_take isl_map *map,
3809 enum isl_dim_type type, unsigned pos, int value);
3810 __isl_give isl_set *isl_set_upper_bound_si(
3811 __isl_take isl_set *set,
3812 enum isl_dim_type type, unsigned pos, int value);
3813 __isl_give isl_set *isl_set_upper_bound_val(
3814 __isl_take isl_set *set,
3815 enum isl_dim_type type, unsigned pos,
3816 __isl_take isl_val *value);
3817 __isl_give isl_map *isl_map_upper_bound_si(
3818 __isl_take isl_map *map,
3819 enum isl_dim_type type, unsigned pos, int value);
3821 Intersect the set or relation with the half-space where the given
3822 dimension has a value bounded by the fixed given integer value.
3824 __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
3825 enum isl_dim_type type1, int pos1,
3826 enum isl_dim_type type2, int pos2);
3827 __isl_give isl_basic_map *isl_basic_map_equate(
3828 __isl_take isl_basic_map *bmap,
3829 enum isl_dim_type type1, int pos1,
3830 enum isl_dim_type type2, int pos2);
3831 __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
3832 enum isl_dim_type type1, int pos1,
3833 enum isl_dim_type type2, int pos2);
3835 Intersect the set or relation with the hyperplane where the given
3836 dimensions are equal to each other.
3838 __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
3839 enum isl_dim_type type1, int pos1,
3840 enum isl_dim_type type2, int pos2);
3842 Intersect the relation with the hyperplane where the given
3843 dimensions have opposite values.
3845 __isl_give isl_map *isl_map_order_le(
3846 __isl_take isl_map *map,
3847 enum isl_dim_type type1, int pos1,
3848 enum isl_dim_type type2, int pos2);
3849 __isl_give isl_basic_map *isl_basic_map_order_ge(
3850 __isl_take isl_basic_map *bmap,
3851 enum isl_dim_type type1, int pos1,
3852 enum isl_dim_type type2, int pos2);
3853 __isl_give isl_map *isl_map_order_ge(
3854 __isl_take isl_map *map,
3855 enum isl_dim_type type1, int pos1,
3856 enum isl_dim_type type2, int pos2);
3857 __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
3858 enum isl_dim_type type1, int pos1,
3859 enum isl_dim_type type2, int pos2);
3860 __isl_give isl_basic_map *isl_basic_map_order_gt(
3861 __isl_take isl_basic_map *bmap,
3862 enum isl_dim_type type1, int pos1,
3863 enum isl_dim_type type2, int pos2);
3864 __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
3865 enum isl_dim_type type1, int pos1,
3866 enum isl_dim_type type2, int pos2);
3868 Intersect the relation with the half-space where the given
3869 dimensions satisfy the given ordering.
3873 #include <isl/aff.h>
3874 __isl_give isl_basic_set *isl_aff_zero_basic_set(
3875 __isl_take isl_aff *aff);
3876 __isl_give isl_basic_set *isl_aff_neg_basic_set(
3877 __isl_take isl_aff *aff);
3878 __isl_give isl_set *isl_pw_aff_nonneg_set(
3879 __isl_take isl_pw_aff *pwaff);
3880 __isl_give isl_set *isl_pw_aff_zero_set(
3881 __isl_take isl_pw_aff *pwaff);
3882 __isl_give isl_set *isl_pw_aff_non_zero_set(
3883 __isl_take isl_pw_aff *pwaff);
3885 The function C<isl_aff_neg_basic_set> returns a basic set
3886 containing those elements in the domain space
3887 of C<aff> where C<aff> is negative.
3888 The function C<isl_pw_aff_nonneg_set> returns a set
3889 containing those elements in the domain
3890 of C<pwaff> where C<pwaff> is non-negative.
3894 __isl_give isl_map *isl_set_identity(
3895 __isl_take isl_set *set);
3896 __isl_give isl_union_map *isl_union_set_identity(
3897 __isl_take isl_union_set *uset);
3899 Construct an identity relation on the given (union) set.
3901 =item * Function Extraction
3903 A piecewise quasi affine expression that is equal to 1 on a set
3904 and 0 outside the set can be created using the following function.
3906 #include <isl/aff.h>
3907 __isl_give isl_pw_aff *isl_set_indicator_function(
3908 __isl_take isl_set *set);
3910 A piecewise multiple quasi affine expression can be extracted
3911 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
3912 and the C<isl_map> is single-valued.
3913 In case of a conversion from an C<isl_union_map>
3914 to an C<isl_union_pw_multi_aff>, these properties need to hold
3915 in each domain space.
3917 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
3918 __isl_take isl_set *set);
3919 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
3920 __isl_take isl_map *map);
3922 __isl_give isl_union_pw_multi_aff *
3923 isl_union_pw_multi_aff_from_union_set(
3924 __isl_take isl_union_set *uset);
3925 __isl_give isl_union_pw_multi_aff *
3926 isl_union_pw_multi_aff_from_union_map(
3927 __isl_take isl_union_map *umap);
3931 __isl_give isl_basic_set *isl_basic_map_deltas(
3932 __isl_take isl_basic_map *bmap);
3933 __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
3934 __isl_give isl_union_set *isl_union_map_deltas(
3935 __isl_take isl_union_map *umap);
3937 These functions return a (basic) set containing the differences
3938 between image elements and corresponding domain elements in the input.
3940 __isl_give isl_basic_map *isl_basic_map_deltas_map(
3941 __isl_take isl_basic_map *bmap);
3942 __isl_give isl_map *isl_map_deltas_map(
3943 __isl_take isl_map *map);
3944 __isl_give isl_union_map *isl_union_map_deltas_map(
3945 __isl_take isl_union_map *umap);
3947 The functions above construct a (basic, regular or union) relation
3948 that maps (a wrapped version of) the input relation to its delta set.
3952 Simplify the representation of a set, relation or functions by trying
3953 to combine pairs of basic sets or relations into a single
3954 basic set or relation.
3956 #include <isl/set.h>
3957 __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
3959 #include <isl/map.h>
3960 __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
3962 #include <isl/union_set.h>
3963 __isl_give isl_union_set *isl_union_set_coalesce(
3964 __isl_take isl_union_set *uset);
3966 #include <isl/union_map.h>
3967 __isl_give isl_union_map *isl_union_map_coalesce(
3968 __isl_take isl_union_map *umap);
3970 #include <isl/aff.h>
3971 __isl_give isl_pw_aff *isl_pw_aff_coalesce(
3972 __isl_take isl_pw_aff *pwqp);
3973 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
3974 __isl_take isl_pw_multi_aff *pma);
3975 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
3976 __isl_take isl_multi_pw_aff *mpa);
3978 #include <isl/polynomial.h>
3979 __isl_give isl_pw_qpolynomial_fold *
3980 isl_pw_qpolynomial_fold_coalesce(
3981 __isl_take isl_pw_qpolynomial_fold *pwf);
3982 __isl_give isl_union_pw_qpolynomial *
3983 isl_union_pw_qpolynomial_coalesce(
3984 __isl_take isl_union_pw_qpolynomial *upwqp);
3985 __isl_give isl_union_pw_qpolynomial_fold *
3986 isl_union_pw_qpolynomial_fold_coalesce(
3987 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3989 One of the methods for combining pairs of basic sets or relations
3990 can result in coefficients that are much larger than those that appear
3991 in the constraints of the input. By default, the coefficients are
3992 not allowed to grow larger, but this can be changed by unsetting
3993 the following option.
3995 int isl_options_set_coalesce_bounded_wrapping(
3996 isl_ctx *ctx, int val);
3997 int isl_options_get_coalesce_bounded_wrapping(
4000 =item * Detecting equalities
4002 __isl_give isl_basic_set *isl_basic_set_detect_equalities(
4003 __isl_take isl_basic_set *bset);
4004 __isl_give isl_basic_map *isl_basic_map_detect_equalities(
4005 __isl_take isl_basic_map *bmap);
4006 __isl_give isl_set *isl_set_detect_equalities(
4007 __isl_take isl_set *set);
4008 __isl_give isl_map *isl_map_detect_equalities(
4009 __isl_take isl_map *map);
4010 __isl_give isl_union_set *isl_union_set_detect_equalities(
4011 __isl_take isl_union_set *uset);
4012 __isl_give isl_union_map *isl_union_map_detect_equalities(
4013 __isl_take isl_union_map *umap);
4015 Simplify the representation of a set or relation by detecting implicit
4018 =item * Removing redundant constraints
4020 __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
4021 __isl_take isl_basic_set *bset);
4022 __isl_give isl_set *isl_set_remove_redundancies(
4023 __isl_take isl_set *set);
4024 __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
4025 __isl_take isl_basic_map *bmap);
4026 __isl_give isl_map *isl_map_remove_redundancies(
4027 __isl_take isl_map *map);
4031 __isl_give isl_basic_set *isl_set_convex_hull(
4032 __isl_take isl_set *set);
4033 __isl_give isl_basic_map *isl_map_convex_hull(
4034 __isl_take isl_map *map);
4036 If the input set or relation has any existentially quantified
4037 variables, then the result of these operations is currently undefined.
4041 #include <isl/set.h>
4042 __isl_give isl_basic_set *
4043 isl_set_unshifted_simple_hull(
4044 __isl_take isl_set *set);
4045 __isl_give isl_basic_set *isl_set_simple_hull(
4046 __isl_take isl_set *set);
4047 __isl_give isl_basic_set *
4048 isl_set_unshifted_simple_hull_from_set_list(
4049 __isl_take isl_set *set,
4050 __isl_take isl_set_list *list);
4052 #include <isl/map.h>
4053 __isl_give isl_basic_map *
4054 isl_map_unshifted_simple_hull(
4055 __isl_take isl_map *map);
4056 __isl_give isl_basic_map *isl_map_simple_hull(
4057 __isl_take isl_map *map);
4059 #include <isl/union_map.h>
4060 __isl_give isl_union_map *isl_union_map_simple_hull(
4061 __isl_take isl_union_map *umap);
4063 These functions compute a single basic set or relation
4064 that contains the whole input set or relation.
4065 In particular, the output is described by translates
4066 of the constraints describing the basic sets or relations in the input.
4067 In case of C<isl_set_unshifted_simple_hull>, only the original
4068 constraints are used, without any translation.
4069 In case of C<isl_set_unshifted_simple_hull_from_set_list>, the
4070 constraints are taken from the elements of the second argument.
4074 (See \autoref{s:simple hull}.)
4080 __isl_give isl_basic_set *isl_basic_set_affine_hull(
4081 __isl_take isl_basic_set *bset);
4082 __isl_give isl_basic_set *isl_set_affine_hull(
4083 __isl_take isl_set *set);
4084 __isl_give isl_union_set *isl_union_set_affine_hull(
4085 __isl_take isl_union_set *uset);
4086 __isl_give isl_basic_map *isl_basic_map_affine_hull(
4087 __isl_take isl_basic_map *bmap);
4088 __isl_give isl_basic_map *isl_map_affine_hull(
4089 __isl_take isl_map *map);
4090 __isl_give isl_union_map *isl_union_map_affine_hull(
4091 __isl_take isl_union_map *umap);
4093 In case of union sets and relations, the affine hull is computed
4096 =item * Polyhedral hull
4098 __isl_give isl_basic_set *isl_set_polyhedral_hull(
4099 __isl_take isl_set *set);
4100 __isl_give isl_basic_map *isl_map_polyhedral_hull(
4101 __isl_take isl_map *map);
4102 __isl_give isl_union_set *isl_union_set_polyhedral_hull(
4103 __isl_take isl_union_set *uset);
4104 __isl_give isl_union_map *isl_union_map_polyhedral_hull(
4105 __isl_take isl_union_map *umap);
4107 These functions compute a single basic set or relation
4108 not involving any existentially quantified variables
4109 that contains the whole input set or relation.
4110 In case of union sets and relations, the polyhedral hull is computed
4113 =item * Other approximations
4115 #include <isl/set.h>
4116 __isl_give isl_basic_set *
4117 isl_basic_set_drop_constraints_involving_dims(
4118 __isl_take isl_basic_set *bset,
4119 enum isl_dim_type type,
4120 unsigned first, unsigned n);
4121 __isl_give isl_basic_set *
4122 isl_basic_set_drop_constraints_not_involving_dims(
4123 __isl_take isl_basic_set *bset,
4124 enum isl_dim_type type,
4125 unsigned first, unsigned n);
4126 __isl_give isl_set *
4127 isl_set_drop_constraints_involving_dims(
4128 __isl_take isl_set *set,
4129 enum isl_dim_type type,
4130 unsigned first, unsigned n);
4132 #include <isl/map.h>
4133 __isl_give isl_basic_map *
4134 isl_basic_map_drop_constraints_involving_dims(
4135 __isl_take isl_basic_map *bmap,
4136 enum isl_dim_type type,
4137 unsigned first, unsigned n);
4138 __isl_give isl_map *
4139 isl_map_drop_constraints_involving_dims(
4140 __isl_take isl_map *map,
4141 enum isl_dim_type type,
4142 unsigned first, unsigned n);
4144 These functions drop any constraints (not) involving the specified dimensions.
4145 Note that the result depends on the representation of the input.
4147 #include <isl/polynomial.h>
4148 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
4149 __isl_take isl_pw_qpolynomial *pwqp, int sign);
4150 __isl_give isl_union_pw_qpolynomial *
4151 isl_union_pw_qpolynomial_to_polynomial(
4152 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
4154 Approximate each quasipolynomial by a polynomial. If C<sign> is positive,
4155 the polynomial will be an overapproximation. If C<sign> is negative,
4156 it will be an underapproximation. If C<sign> is zero, the approximation
4157 will lie somewhere in between.
4161 __isl_give isl_basic_set *isl_basic_set_sample(
4162 __isl_take isl_basic_set *bset);
4163 __isl_give isl_basic_set *isl_set_sample(
4164 __isl_take isl_set *set);
4165 __isl_give isl_basic_map *isl_basic_map_sample(
4166 __isl_take isl_basic_map *bmap);
4167 __isl_give isl_basic_map *isl_map_sample(
4168 __isl_take isl_map *map);
4170 If the input (basic) set or relation is non-empty, then return
4171 a singleton subset of the input. Otherwise, return an empty set.
4173 =item * Optimization
4175 #include <isl/ilp.h>
4176 __isl_give isl_val *isl_basic_set_max_val(
4177 __isl_keep isl_basic_set *bset,
4178 __isl_keep isl_aff *obj);
4179 __isl_give isl_val *isl_set_min_val(
4180 __isl_keep isl_set *set,
4181 __isl_keep isl_aff *obj);
4182 __isl_give isl_val *isl_set_max_val(
4183 __isl_keep isl_set *set,
4184 __isl_keep isl_aff *obj);
4186 Compute the minimum or maximum of the integer affine expression C<obj>
4187 over the points in C<set>, returning the result in C<opt>.
4188 The result is C<NULL> in case of an error, the optimal value in case
4189 there is one, negative infinity or infinity if the problem is unbounded and
4190 NaN if the problem is empty.
4192 =item * Parametric optimization
4194 __isl_give isl_pw_aff *isl_set_dim_min(
4195 __isl_take isl_set *set, int pos);
4196 __isl_give isl_pw_aff *isl_set_dim_max(
4197 __isl_take isl_set *set, int pos);
4198 __isl_give isl_pw_aff *isl_map_dim_max(
4199 __isl_take isl_map *map, int pos);
4201 Compute the minimum or maximum of the given set or output dimension
4202 as a function of the parameters (and input dimensions), but independently
4203 of the other set or output dimensions.
4204 For lexicographic optimization, see L<"Lexicographic Optimization">.
4208 The following functions compute either the set of (rational) coefficient
4209 values of valid constraints for the given set or the set of (rational)
4210 values satisfying the constraints with coefficients from the given set.
4211 Internally, these two sets of functions perform essentially the
4212 same operations, except that the set of coefficients is assumed to
4213 be a cone, while the set of values may be any polyhedron.
4214 The current implementation is based on the Farkas lemma and
4215 Fourier-Motzkin elimination, but this may change or be made optional
4216 in future. In particular, future implementations may use different
4217 dualization algorithms or skip the elimination step.
4219 __isl_give isl_basic_set *isl_basic_set_coefficients(
4220 __isl_take isl_basic_set *bset);
4221 __isl_give isl_basic_set *isl_set_coefficients(
4222 __isl_take isl_set *set);
4223 __isl_give isl_union_set *isl_union_set_coefficients(
4224 __isl_take isl_union_set *bset);
4225 __isl_give isl_basic_set *isl_basic_set_solutions(
4226 __isl_take isl_basic_set *bset);
4227 __isl_give isl_basic_set *isl_set_solutions(
4228 __isl_take isl_set *set);
4229 __isl_give isl_union_set *isl_union_set_solutions(
4230 __isl_take isl_union_set *bset);
4234 __isl_give isl_map *isl_map_fixed_power_val(
4235 __isl_take isl_map *map,
4236 __isl_take isl_val *exp);
4237 __isl_give isl_union_map *
4238 isl_union_map_fixed_power_val(
4239 __isl_take isl_union_map *umap,
4240 __isl_take isl_val *exp);
4242 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
4243 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
4244 of C<map> is computed.
4246 __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
4248 __isl_give isl_union_map *isl_union_map_power(
4249 __isl_take isl_union_map *umap, int *exact);
4251 Compute a parametric representation for all positive powers I<k> of C<map>.
4252 The result maps I<k> to a nested relation corresponding to the
4253 I<k>th power of C<map>.
4254 The result may be an overapproximation. If the result is known to be exact,
4255 then C<*exact> is set to C<1>.
4257 =item * Transitive closure
4259 __isl_give isl_map *isl_map_transitive_closure(
4260 __isl_take isl_map *map, int *exact);
4261 __isl_give isl_union_map *isl_union_map_transitive_closure(
4262 __isl_take isl_union_map *umap, int *exact);
4264 Compute the transitive closure of C<map>.
4265 The result may be an overapproximation. If the result is known to be exact,
4266 then C<*exact> is set to C<1>.
4268 =item * Reaching path lengths
4270 __isl_give isl_map *isl_map_reaching_path_lengths(
4271 __isl_take isl_map *map, int *exact);
4273 Compute a relation that maps each element in the range of C<map>
4274 to the lengths of all paths composed of edges in C<map> that
4275 end up in the given element.
4276 The result may be an overapproximation. If the result is known to be exact,
4277 then C<*exact> is set to C<1>.
4278 To compute the I<maximal> path length, the resulting relation
4279 should be postprocessed by C<isl_map_lexmax>.
4280 In particular, if the input relation is a dependence relation
4281 (mapping sources to sinks), then the maximal path length corresponds
4282 to the free schedule.
4283 Note, however, that C<isl_map_lexmax> expects the maximum to be
4284 finite, so if the path lengths are unbounded (possibly due to
4285 the overapproximation), then you will get an error message.
4289 #include <isl/space.h>
4290 __isl_give isl_space *isl_space_wrap(
4291 __isl_take isl_space *space);
4292 __isl_give isl_space *isl_space_unwrap(
4293 __isl_take isl_space *space);
4295 #include <isl/set.h>
4296 __isl_give isl_basic_map *isl_basic_set_unwrap(
4297 __isl_take isl_basic_set *bset);
4298 __isl_give isl_map *isl_set_unwrap(
4299 __isl_take isl_set *set);
4301 #include <isl/map.h>
4302 __isl_give isl_basic_set *isl_basic_map_wrap(
4303 __isl_take isl_basic_map *bmap);
4304 __isl_give isl_set *isl_map_wrap(
4305 __isl_take isl_map *map);
4307 #include <isl/union_set.h>
4308 __isl_give isl_union_map *isl_union_set_unwrap(
4309 __isl_take isl_union_set *uset);
4311 #include <isl/union_map.h>
4312 __isl_give isl_union_set *isl_union_map_wrap(
4313 __isl_take isl_union_map *umap);
4315 The input to C<isl_space_unwrap> should
4316 be the space of a set, while that of
4317 C<isl_space_wrap> should be the space of a relation.
4318 Conversely, the output of C<isl_space_unwrap> is the space
4319 of a relation, while that of C<isl_space_wrap> is the space of a set.
4323 Remove any internal structure of domain (and range) of the given
4324 set or relation. If there is any such internal structure in the input,
4325 then the name of the space is also removed.
4327 #include <isl/local_space.h>
4328 __isl_give isl_local_space *
4329 isl_local_space_flatten_domain(
4330 __isl_take isl_local_space *ls);
4331 __isl_give isl_local_space *
4332 isl_local_space_flatten_range(
4333 __isl_take isl_local_space *ls);
4335 #include <isl/set.h>
4336 __isl_give isl_basic_set *isl_basic_set_flatten(
4337 __isl_take isl_basic_set *bset);
4338 __isl_give isl_set *isl_set_flatten(
4339 __isl_take isl_set *set);
4341 #include <isl/map.h>
4342 __isl_give isl_basic_map *isl_basic_map_flatten_domain(
4343 __isl_take isl_basic_map *bmap);
4344 __isl_give isl_basic_map *isl_basic_map_flatten_range(
4345 __isl_take isl_basic_map *bmap);
4346 __isl_give isl_map *isl_map_flatten_range(
4347 __isl_take isl_map *map);
4348 __isl_give isl_map *isl_map_flatten_domain(
4349 __isl_take isl_map *map);
4350 __isl_give isl_basic_map *isl_basic_map_flatten(
4351 __isl_take isl_basic_map *bmap);
4352 __isl_give isl_map *isl_map_flatten(
4353 __isl_take isl_map *map);
4355 #include <isl/aff.h>
4356 __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
4357 __isl_take isl_multi_aff *ma);
4359 #include <isl/map.h>
4360 __isl_give isl_map *isl_set_flatten_map(
4361 __isl_take isl_set *set);
4363 The function above constructs a relation
4364 that maps the input set to a flattened version of the set.
4368 Lift the input set to a space with extra dimensions corresponding
4369 to the existentially quantified variables in the input.
4370 In particular, the result lives in a wrapped map where the domain
4371 is the original space and the range corresponds to the original
4372 existentially quantified variables.
4374 #include <isl/set.h>
4375 __isl_give isl_basic_set *isl_basic_set_lift(
4376 __isl_take isl_basic_set *bset);
4377 __isl_give isl_set *isl_set_lift(
4378 __isl_take isl_set *set);
4379 __isl_give isl_union_set *isl_union_set_lift(
4380 __isl_take isl_union_set *uset);
4382 Given a local space that contains the existentially quantified
4383 variables of a set, a basic relation that, when applied to
4384 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
4385 can be constructed using the following function.
4387 #include <isl/local_space.h>
4388 __isl_give isl_basic_map *isl_local_space_lifting(
4389 __isl_take isl_local_space *ls);
4391 #include <isl/aff.h>
4392 __isl_give isl_multi_aff *isl_multi_aff_lift(
4393 __isl_take isl_multi_aff *maff,
4394 __isl_give isl_local_space **ls);
4396 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
4397 then it is assigned the local space that lies at the basis of
4398 the lifting applied.
4400 =item * Internal Product
4402 #include <isl/space.h>
4403 __isl_give isl_space *isl_space_zip(
4404 __isl_take isl_space *space);
4406 #include <isl/map.h>
4407 __isl_give isl_basic_map *isl_basic_map_zip(
4408 __isl_take isl_basic_map *bmap);
4409 __isl_give isl_map *isl_map_zip(
4410 __isl_take isl_map *map);
4412 #include <isl/union_map.h>
4413 __isl_give isl_union_map *isl_union_map_zip(
4414 __isl_take isl_union_map *umap);
4416 Given a relation with nested relations for domain and range,
4417 interchange the range of the domain with the domain of the range.
4421 #include <isl/space.h>
4422 __isl_give isl_space *isl_space_curry(
4423 __isl_take isl_space *space);
4424 __isl_give isl_space *isl_space_uncurry(
4425 __isl_take isl_space *space);
4427 #include <isl/map.h>
4428 __isl_give isl_basic_map *isl_basic_map_curry(
4429 __isl_take isl_basic_map *bmap);
4430 __isl_give isl_basic_map *isl_basic_map_uncurry(
4431 __isl_take isl_basic_map *bmap);
4432 __isl_give isl_map *isl_map_curry(
4433 __isl_take isl_map *map);
4434 __isl_give isl_map *isl_map_uncurry(
4435 __isl_take isl_map *map);
4437 #include <isl/union_map.h>
4438 __isl_give isl_union_map *isl_union_map_curry(
4439 __isl_take isl_union_map *umap);
4440 __isl_give isl_union_map *isl_union_map_uncurry(
4441 __isl_take isl_union_map *umap);
4443 Given a relation with a nested relation for domain,
4444 the C<curry> functions
4445 move the range of the nested relation out of the domain
4446 and use it as the domain of a nested relation in the range,
4447 with the original range as range of this nested relation.
4448 The C<uncurry> functions perform the inverse operation.
4450 =item * Aligning parameters
4452 Change the order of the parameters of the given set, relation
4454 such that the first parameters match those of C<model>.
4455 This may involve the introduction of extra parameters.
4456 All parameters need to be named.
4458 #include <isl/space.h>
4459 __isl_give isl_space *isl_space_align_params(
4460 __isl_take isl_space *space1,
4461 __isl_take isl_space *space2)
4463 #include <isl/set.h>
4464 __isl_give isl_basic_set *isl_basic_set_align_params(
4465 __isl_take isl_basic_set *bset,
4466 __isl_take isl_space *model);
4467 __isl_give isl_set *isl_set_align_params(
4468 __isl_take isl_set *set,
4469 __isl_take isl_space *model);
4471 #include <isl/map.h>
4472 __isl_give isl_basic_map *isl_basic_map_align_params(
4473 __isl_take isl_basic_map *bmap,
4474 __isl_take isl_space *model);
4475 __isl_give isl_map *isl_map_align_params(
4476 __isl_take isl_map *map,
4477 __isl_take isl_space *model);
4479 #include <isl/val.h>
4480 __isl_give isl_multi_val *isl_multi_val_align_params(
4481 __isl_take isl_multi_val *mv,
4482 __isl_take isl_space *model);
4484 #include <isl/aff.h>
4485 __isl_give isl_aff *isl_aff_align_params(
4486 __isl_take isl_aff *aff,
4487 __isl_take isl_space *model);
4488 __isl_give isl_multi_aff *isl_multi_aff_align_params(
4489 __isl_take isl_multi_aff *multi,
4490 __isl_take isl_space *model);
4491 __isl_give isl_pw_aff *isl_pw_aff_align_params(
4492 __isl_take isl_pw_aff *pwaff,
4493 __isl_take isl_space *model);
4494 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
4495 __isl_take isl_pw_multi_aff *pma,
4496 __isl_take isl_space *model);
4497 __isl_give isl_union_pw_multi_aff *
4498 isl_union_pw_multi_aff_align_params(
4499 __isl_take isl_union_pw_multi_aff *upma,
4500 __isl_take isl_space *model);
4502 #include <isl/polynomial.h>
4503 __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
4504 __isl_take isl_qpolynomial *qp,
4505 __isl_take isl_space *model);
4507 =item * Unary Arithmethic Operations
4509 #include <isl/aff.h>
4510 __isl_give isl_aff *isl_aff_neg(
4511 __isl_take isl_aff *aff);
4512 __isl_give isl_pw_aff *isl_pw_aff_neg(
4513 __isl_take isl_pw_aff *pwaff);
4514 __isl_give isl_aff *isl_aff_ceil(
4515 __isl_take isl_aff *aff);
4516 __isl_give isl_pw_aff *isl_pw_aff_ceil(
4517 __isl_take isl_pw_aff *pwaff);
4518 __isl_give isl_aff *isl_aff_floor(
4519 __isl_take isl_aff *aff);
4520 __isl_give isl_multi_aff *isl_multi_aff_floor(
4521 __isl_take isl_multi_aff *ma);
4522 __isl_give isl_pw_aff *isl_pw_aff_floor(
4523 __isl_take isl_pw_aff *pwaff);
4525 #include <isl/aff.h>
4526 __isl_give isl_pw_aff *isl_pw_aff_list_min(
4527 __isl_take isl_pw_aff_list *list);
4528 __isl_give isl_pw_aff *isl_pw_aff_list_max(
4529 __isl_take isl_pw_aff_list *list);
4531 #include <isl/polynomial.h>
4532 __isl_give isl_qpolynomial *isl_qpolynomial_neg(
4533 __isl_take isl_qpolynomial *qp);
4534 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
4535 __isl_take isl_pw_qpolynomial *pwqp);
4536 __isl_give isl_qpolynomial *isl_qpolynomial_pow(
4537 __isl_take isl_qpolynomial *qp,
4539 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
4540 __isl_take isl_pw_qpolynomial *pwqp,
4545 The following functions evaluate a function in a point.
4547 #include <isl/polynomial.h>
4548 __isl_give isl_val *isl_pw_qpolynomial_eval(
4549 __isl_take isl_pw_qpolynomial *pwqp,
4550 __isl_take isl_point *pnt);
4551 __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
4552 __isl_take isl_pw_qpolynomial_fold *pwf,
4553 __isl_take isl_point *pnt);
4554 __isl_give isl_val *isl_union_pw_qpolynomial_eval(
4555 __isl_take isl_union_pw_qpolynomial *upwqp,
4556 __isl_take isl_point *pnt);
4557 __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
4558 __isl_take isl_union_pw_qpolynomial_fold *upwf,
4559 __isl_take isl_point *pnt);
4561 =item * Dimension manipulation
4563 It is usually not advisable to directly change the (input or output)
4564 space of a set or a relation as this removes the name and the internal
4565 structure of the space. However, the functions below can be useful
4566 to add new parameters, assuming
4567 C<isl_set_align_params> and C<isl_map_align_params>
4570 #include <isl/space.h>
4571 __isl_give isl_space *isl_space_add_dims(
4572 __isl_take isl_space *space,
4573 enum isl_dim_type type, unsigned n);
4574 __isl_give isl_space *isl_space_insert_dims(
4575 __isl_take isl_space *space,
4576 enum isl_dim_type type, unsigned pos, unsigned n);
4577 __isl_give isl_space *isl_space_drop_dims(
4578 __isl_take isl_space *space,
4579 enum isl_dim_type type, unsigned first, unsigned n);
4580 __isl_give isl_space *isl_space_move_dims(
4581 __isl_take isl_space *space,
4582 enum isl_dim_type dst_type, unsigned dst_pos,
4583 enum isl_dim_type src_type, unsigned src_pos,
4586 #include <isl/local_space.h>
4587 __isl_give isl_local_space *isl_local_space_add_dims(
4588 __isl_take isl_local_space *ls,
4589 enum isl_dim_type type, unsigned n);
4590 __isl_give isl_local_space *isl_local_space_insert_dims(
4591 __isl_take isl_local_space *ls,
4592 enum isl_dim_type type, unsigned first, unsigned n);
4593 __isl_give isl_local_space *isl_local_space_drop_dims(
4594 __isl_take isl_local_space *ls,
4595 enum isl_dim_type type, unsigned first, unsigned n);
4597 #include <isl/set.h>
4598 __isl_give isl_basic_set *isl_basic_set_add_dims(
4599 __isl_take isl_basic_set *bset,
4600 enum isl_dim_type type, unsigned n);
4601 __isl_give isl_set *isl_set_add_dims(
4602 __isl_take isl_set *set,
4603 enum isl_dim_type type, unsigned n);
4604 __isl_give isl_basic_set *isl_basic_set_insert_dims(
4605 __isl_take isl_basic_set *bset,
4606 enum isl_dim_type type, unsigned pos,
4608 __isl_give isl_set *isl_set_insert_dims(
4609 __isl_take isl_set *set,
4610 enum isl_dim_type type, unsigned pos, unsigned n);
4611 __isl_give isl_basic_set *isl_basic_set_move_dims(
4612 __isl_take isl_basic_set *bset,
4613 enum isl_dim_type dst_type, unsigned dst_pos,
4614 enum isl_dim_type src_type, unsigned src_pos,
4616 __isl_give isl_set *isl_set_move_dims(
4617 __isl_take isl_set *set,
4618 enum isl_dim_type dst_type, unsigned dst_pos,
4619 enum isl_dim_type src_type, unsigned src_pos,
4622 #include <isl/map.h>
4623 __isl_give isl_map *isl_map_add_dims(
4624 __isl_take isl_map *map,
4625 enum isl_dim_type type, unsigned n);
4626 __isl_give isl_basic_map *isl_basic_map_insert_dims(
4627 __isl_take isl_basic_map *bmap,
4628 enum isl_dim_type type, unsigned pos,
4630 __isl_give isl_map *isl_map_insert_dims(
4631 __isl_take isl_map *map,
4632 enum isl_dim_type type, unsigned pos, unsigned n);
4633 __isl_give isl_basic_map *isl_basic_map_move_dims(
4634 __isl_take isl_basic_map *bmap,
4635 enum isl_dim_type dst_type, unsigned dst_pos,
4636 enum isl_dim_type src_type, unsigned src_pos,
4638 __isl_give isl_map *isl_map_move_dims(
4639 __isl_take isl_map *map,
4640 enum isl_dim_type dst_type, unsigned dst_pos,
4641 enum isl_dim_type src_type, unsigned src_pos,
4644 #include <isl/val.h>
4645 __isl_give isl_multi_val *isl_multi_val_insert_dims(
4646 __isl_take isl_multi_val *mv,
4647 enum isl_dim_type type, unsigned first, unsigned n);
4648 __isl_give isl_multi_val *isl_multi_val_add_dims(
4649 __isl_take isl_multi_val *mv,
4650 enum isl_dim_type type, unsigned n);
4651 __isl_give isl_multi_val *isl_multi_val_drop_dims(
4652 __isl_take isl_multi_val *mv,
4653 enum isl_dim_type type, unsigned first, unsigned n);
4655 #include <isl/aff.h>
4656 __isl_give isl_aff *isl_aff_insert_dims(
4657 __isl_take isl_aff *aff,
4658 enum isl_dim_type type, unsigned first, unsigned n);
4659 __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
4660 __isl_take isl_multi_aff *ma,
4661 enum isl_dim_type type, unsigned first, unsigned n);
4662 __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
4663 __isl_take isl_pw_aff *pwaff,
4664 enum isl_dim_type type, unsigned first, unsigned n);
4665 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
4666 __isl_take isl_multi_pw_aff *mpa,
4667 enum isl_dim_type type, unsigned first, unsigned n);
4668 __isl_give isl_aff *isl_aff_add_dims(
4669 __isl_take isl_aff *aff,
4670 enum isl_dim_type type, unsigned n);
4671 __isl_give isl_multi_aff *isl_multi_aff_add_dims(
4672 __isl_take isl_multi_aff *ma,
4673 enum isl_dim_type type, unsigned n);
4674 __isl_give isl_pw_aff *isl_pw_aff_add_dims(
4675 __isl_take isl_pw_aff *pwaff,
4676 enum isl_dim_type type, unsigned n);
4677 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
4678 __isl_take isl_multi_pw_aff *mpa,
4679 enum isl_dim_type type, unsigned n);
4680 __isl_give isl_aff *isl_aff_drop_dims(
4681 __isl_take isl_aff *aff,
4682 enum isl_dim_type type, unsigned first, unsigned n);
4683 __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
4684 __isl_take isl_multi_aff *maff,
4685 enum isl_dim_type type, unsigned first, unsigned n);
4686 __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
4687 __isl_take isl_pw_aff *pwaff,
4688 enum isl_dim_type type, unsigned first, unsigned n);
4689 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
4690 __isl_take isl_pw_multi_aff *pma,
4691 enum isl_dim_type type, unsigned first, unsigned n);
4692 __isl_give isl_aff *isl_aff_move_dims(
4693 __isl_take isl_aff *aff,
4694 enum isl_dim_type dst_type, unsigned dst_pos,
4695 enum isl_dim_type src_type, unsigned src_pos,
4697 __isl_give isl_pw_aff *isl_pw_aff_move_dims(
4698 __isl_take isl_pw_aff *pa,
4699 enum isl_dim_type dst_type, unsigned dst_pos,
4700 enum isl_dim_type src_type, unsigned src_pos,
4702 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
4703 __isl_take isl_multi_pw_aff *pma,
4704 enum isl_dim_type dst_type, unsigned dst_pos,
4705 enum isl_dim_type src_type, unsigned src_pos,
4710 =head2 Binary Operations
4712 The two arguments of a binary operation not only need to live
4713 in the same C<isl_ctx>, they currently also need to have
4714 the same (number of) parameters.
4716 =head3 Basic Operations
4720 =item * Intersection
4722 #include <isl/local_space.h>
4723 __isl_give isl_local_space *isl_local_space_intersect(
4724 __isl_take isl_local_space *ls1,
4725 __isl_take isl_local_space *ls2);
4727 #include <isl/set.h>
4728 __isl_give isl_basic_set *isl_basic_set_intersect_params(
4729 __isl_take isl_basic_set *bset1,
4730 __isl_take isl_basic_set *bset2);
4731 __isl_give isl_basic_set *isl_basic_set_intersect(
4732 __isl_take isl_basic_set *bset1,
4733 __isl_take isl_basic_set *bset2);
4734 __isl_give isl_basic_set *isl_basic_set_list_intersect(
4735 __isl_take struct isl_basic_set_list *list);
4736 __isl_give isl_set *isl_set_intersect_params(
4737 __isl_take isl_set *set,
4738 __isl_take isl_set *params);
4739 __isl_give isl_set *isl_set_intersect(
4740 __isl_take isl_set *set1,
4741 __isl_take isl_set *set2);
4743 #include <isl/map.h>
4744 __isl_give isl_basic_map *isl_basic_map_intersect_domain(
4745 __isl_take isl_basic_map *bmap,
4746 __isl_take isl_basic_set *bset);
4747 __isl_give isl_basic_map *isl_basic_map_intersect_range(
4748 __isl_take isl_basic_map *bmap,
4749 __isl_take isl_basic_set *bset);
4750 __isl_give isl_basic_map *isl_basic_map_intersect(
4751 __isl_take isl_basic_map *bmap1,
4752 __isl_take isl_basic_map *bmap2);
4753 __isl_give isl_map *isl_map_intersect_params(
4754 __isl_take isl_map *map,
4755 __isl_take isl_set *params);
4756 __isl_give isl_map *isl_map_intersect_domain(
4757 __isl_take isl_map *map,
4758 __isl_take isl_set *set);
4759 __isl_give isl_map *isl_map_intersect_range(
4760 __isl_take isl_map *map,
4761 __isl_take isl_set *set);
4762 __isl_give isl_map *isl_map_intersect(
4763 __isl_take isl_map *map1,
4764 __isl_take isl_map *map2);
4766 #include <isl/union_set.h>
4767 __isl_give isl_union_set *isl_union_set_intersect_params(
4768 __isl_take isl_union_set *uset,
4769 __isl_take isl_set *set);
4770 __isl_give isl_union_set *isl_union_set_intersect(
4771 __isl_take isl_union_set *uset1,
4772 __isl_take isl_union_set *uset2);
4774 #include <isl/union_map.h>
4775 __isl_give isl_union_map *isl_union_map_intersect_params(
4776 __isl_take isl_union_map *umap,
4777 __isl_take isl_set *set);
4778 __isl_give isl_union_map *isl_union_map_intersect_domain(
4779 __isl_take isl_union_map *umap,
4780 __isl_take isl_union_set *uset);
4781 __isl_give isl_union_map *isl_union_map_intersect_range(
4782 __isl_take isl_union_map *umap,
4783 __isl_take isl_union_set *uset);
4784 __isl_give isl_union_map *isl_union_map_intersect(
4785 __isl_take isl_union_map *umap1,
4786 __isl_take isl_union_map *umap2);
4788 #include <isl/aff.h>
4789 __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
4790 __isl_take isl_pw_aff *pa,
4791 __isl_take isl_set *set);
4792 __isl_give isl_multi_pw_aff *
4793 isl_multi_pw_aff_intersect_domain(
4794 __isl_take isl_multi_pw_aff *mpa,
4795 __isl_take isl_set *domain);
4796 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
4797 __isl_take isl_pw_multi_aff *pma,
4798 __isl_take isl_set *set);
4799 __isl_give isl_union_pw_multi_aff *
4800 isl_union_pw_multi_aff_intersect_domain(
4801 __isl_take isl_union_pw_multi_aff *upma,
4802 __isl_take isl_union_set *uset);
4803 __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
4804 __isl_take isl_pw_aff *pa,
4805 __isl_take isl_set *set);
4806 __isl_give isl_multi_pw_aff *
4807 isl_multi_pw_aff_intersect_params(
4808 __isl_take isl_multi_pw_aff *mpa,
4809 __isl_take isl_set *set);
4810 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
4811 __isl_take isl_pw_multi_aff *pma,
4812 __isl_take isl_set *set);
4814 #include <isl/polynomial.h>
4815 __isl_give isl_pw_qpolynomial *
4816 isl_pw_qpolynomial_intersect_domain(
4817 __isl_take isl_pw_qpolynomial *pwpq,
4818 __isl_take isl_set *set);
4819 __isl_give isl_union_pw_qpolynomial *
4820 isl_union_pw_qpolynomial_intersect_domain(
4821 __isl_take isl_union_pw_qpolynomial *upwpq,
4822 __isl_take isl_union_set *uset);
4823 __isl_give isl_union_pw_qpolynomial_fold *
4824 isl_union_pw_qpolynomial_fold_intersect_domain(
4825 __isl_take isl_union_pw_qpolynomial_fold *upwf,
4826 __isl_take isl_union_set *uset);
4827 __isl_give isl_pw_qpolynomial *
4828 isl_pw_qpolynomial_intersect_params(
4829 __isl_take isl_pw_qpolynomial *pwpq,
4830 __isl_take isl_set *set);
4831 __isl_give isl_pw_qpolynomial_fold *
4832 isl_pw_qpolynomial_fold_intersect_params(
4833 __isl_take isl_pw_qpolynomial_fold *pwf,
4834 __isl_take isl_set *set);
4835 __isl_give isl_union_pw_qpolynomial *
4836 isl_union_pw_qpolynomial_intersect_params(
4837 __isl_take isl_union_pw_qpolynomial *upwpq,
4838 __isl_take isl_set *set);
4839 __isl_give isl_union_pw_qpolynomial_fold *
4840 isl_union_pw_qpolynomial_fold_intersect_params(
4841 __isl_take isl_union_pw_qpolynomial_fold *upwf,
4842 __isl_take isl_set *set);
4844 The second argument to the C<_params> functions needs to be
4845 a parametric (basic) set. For the other functions, a parametric set
4846 for either argument is only allowed if the other argument is
4847 a parametric set as well.
4848 The list passed to C<isl_basic_set_list_intersect> needs to have
4849 at least one element and all elements need to live in the same space.
4853 __isl_give isl_set *isl_basic_set_union(
4854 __isl_take isl_basic_set *bset1,
4855 __isl_take isl_basic_set *bset2);
4856 __isl_give isl_map *isl_basic_map_union(
4857 __isl_take isl_basic_map *bmap1,
4858 __isl_take isl_basic_map *bmap2);
4859 __isl_give isl_set *isl_set_union(
4860 __isl_take isl_set *set1,
4861 __isl_take isl_set *set2);
4862 __isl_give isl_map *isl_map_union(
4863 __isl_take isl_map *map1,
4864 __isl_take isl_map *map2);
4865 __isl_give isl_union_set *isl_union_set_union(
4866 __isl_take isl_union_set *uset1,
4867 __isl_take isl_union_set *uset2);
4868 __isl_give isl_union_map *isl_union_map_union(
4869 __isl_take isl_union_map *umap1,
4870 __isl_take isl_union_map *umap2);
4872 =item * Set difference
4874 __isl_give isl_set *isl_set_subtract(
4875 __isl_take isl_set *set1,
4876 __isl_take isl_set *set2);
4877 __isl_give isl_map *isl_map_subtract(
4878 __isl_take isl_map *map1,
4879 __isl_take isl_map *map2);
4880 __isl_give isl_map *isl_map_subtract_domain(
4881 __isl_take isl_map *map,
4882 __isl_take isl_set *dom);
4883 __isl_give isl_map *isl_map_subtract_range(
4884 __isl_take isl_map *map,
4885 __isl_take isl_set *dom);
4886 __isl_give isl_union_set *isl_union_set_subtract(
4887 __isl_take isl_union_set *uset1,
4888 __isl_take isl_union_set *uset2);
4889 __isl_give isl_union_map *isl_union_map_subtract(
4890 __isl_take isl_union_map *umap1,
4891 __isl_take isl_union_map *umap2);
4892 __isl_give isl_union_map *isl_union_map_subtract_domain(
4893 __isl_take isl_union_map *umap,
4894 __isl_take isl_union_set *dom);
4895 __isl_give isl_union_map *isl_union_map_subtract_range(
4896 __isl_take isl_union_map *umap,
4897 __isl_take isl_union_set *dom);
4901 #include <isl/space.h>
4902 __isl_give isl_space *isl_space_join(
4903 __isl_take isl_space *left,
4904 __isl_take isl_space *right);
4906 #include <isl/map.h>
4907 __isl_give isl_basic_set *isl_basic_set_apply(
4908 __isl_take isl_basic_set *bset,
4909 __isl_take isl_basic_map *bmap);
4910 __isl_give isl_set *isl_set_apply(
4911 __isl_take isl_set *set,
4912 __isl_take isl_map *map);
4913 __isl_give isl_union_set *isl_union_set_apply(
4914 __isl_take isl_union_set *uset,
4915 __isl_take isl_union_map *umap);
4916 __isl_give isl_basic_map *isl_basic_map_apply_domain(
4917 __isl_take isl_basic_map *bmap1,
4918 __isl_take isl_basic_map *bmap2);
4919 __isl_give isl_basic_map *isl_basic_map_apply_range(
4920 __isl_take isl_basic_map *bmap1,
4921 __isl_take isl_basic_map *bmap2);
4922 __isl_give isl_map *isl_map_apply_domain(
4923 __isl_take isl_map *map1,
4924 __isl_take isl_map *map2);
4925 __isl_give isl_map *isl_map_apply_range(
4926 __isl_take isl_map *map1,
4927 __isl_take isl_map *map2);
4929 #include <isl/union_map.h>
4930 __isl_give isl_union_map *isl_union_map_apply_domain(
4931 __isl_take isl_union_map *umap1,
4932 __isl_take isl_union_map *umap2);
4933 __isl_give isl_union_map *isl_union_map_apply_range(
4934 __isl_take isl_union_map *umap1,
4935 __isl_take isl_union_map *umap2);
4937 #include <isl/polynomial.h>
4938 __isl_give isl_pw_qpolynomial_fold *
4939 isl_set_apply_pw_qpolynomial_fold(
4940 __isl_take isl_set *set,
4941 __isl_take isl_pw_qpolynomial_fold *pwf,
4943 __isl_give isl_pw_qpolynomial_fold *
4944 isl_map_apply_pw_qpolynomial_fold(
4945 __isl_take isl_map *map,
4946 __isl_take isl_pw_qpolynomial_fold *pwf,
4948 __isl_give isl_union_pw_qpolynomial_fold *
4949 isl_union_set_apply_union_pw_qpolynomial_fold(
4950 __isl_take isl_union_set *uset,
4951 __isl_take isl_union_pw_qpolynomial_fold *upwf,
4953 __isl_give isl_union_pw_qpolynomial_fold *
4954 isl_union_map_apply_union_pw_qpolynomial_fold(
4955 __isl_take isl_union_map *umap,
4956 __isl_take isl_union_pw_qpolynomial_fold *upwf,
4959 The functions taking a map
4960 compose the given map with the given piecewise quasipolynomial reduction.
4961 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
4962 over all elements in the intersection of the range of the map
4963 and the domain of the piecewise quasipolynomial reduction
4964 as a function of an element in the domain of the map.
4965 The functions taking a set compute a bound over all elements in the
4966 intersection of the set and the domain of the
4967 piecewise quasipolynomial reduction.
4971 #include <isl/set.h>
4972 __isl_give isl_basic_set *
4973 isl_basic_set_preimage_multi_aff(
4974 __isl_take isl_basic_set *bset,
4975 __isl_take isl_multi_aff *ma);
4976 __isl_give isl_set *isl_set_preimage_multi_aff(
4977 __isl_take isl_set *set,
4978 __isl_take isl_multi_aff *ma);
4979 __isl_give isl_set *isl_set_preimage_pw_multi_aff(
4980 __isl_take isl_set *set,
4981 __isl_take isl_pw_multi_aff *pma);
4982 __isl_give isl_set *isl_set_preimage_multi_pw_aff(
4983 __isl_take isl_set *set,
4984 __isl_take isl_multi_pw_aff *mpa);
4986 #include <isl/union_set.h>
4987 __isl_give isl_union_set *
4988 isl_union_set_preimage_multi_aff(
4989 __isl_take isl_union_set *uset,
4990 __isl_take isl_multi_aff *ma);
4991 __isl_give isl_union_set *
4992 isl_union_set_preimage_pw_multi_aff(
4993 __isl_take isl_union_set *uset,
4994 __isl_take isl_pw_multi_aff *pma);
4995 __isl_give isl_union_set *
4996 isl_union_set_preimage_union_pw_multi_aff(
4997 __isl_take isl_union_set *uset,
4998 __isl_take isl_union_pw_multi_aff *upma);
5000 #include <isl/map.h>
5001 __isl_give isl_basic_map *
5002 isl_basic_map_preimage_domain_multi_aff(
5003 __isl_take isl_basic_map *bmap,
5004 __isl_take isl_multi_aff *ma);
5005 __isl_give isl_map *isl_map_preimage_domain_multi_aff(
5006 __isl_take isl_map *map,
5007 __isl_take isl_multi_aff *ma);
5008 __isl_give isl_map *isl_map_preimage_range_multi_aff(
5009 __isl_take isl_map *map,
5010 __isl_take isl_multi_aff *ma);
5011 __isl_give isl_map *
5012 isl_map_preimage_domain_pw_multi_aff(
5013 __isl_take isl_map *map,
5014 __isl_take isl_pw_multi_aff *pma);
5015 __isl_give isl_map *
5016 isl_map_preimage_range_pw_multi_aff(
5017 __isl_take isl_map *map,
5018 __isl_take isl_pw_multi_aff *pma);
5019 __isl_give isl_map *
5020 isl_map_preimage_domain_multi_pw_aff(
5021 __isl_take isl_map *map,
5022 __isl_take isl_multi_pw_aff *mpa);
5023 __isl_give isl_basic_map *
5024 isl_basic_map_preimage_range_multi_aff(
5025 __isl_take isl_basic_map *bmap,
5026 __isl_take isl_multi_aff *ma);
5028 #include <isl/union_map.h>
5029 __isl_give isl_union_map *
5030 isl_union_map_preimage_domain_multi_aff(
5031 __isl_take isl_union_map *umap,
5032 __isl_take isl_multi_aff *ma);
5033 __isl_give isl_union_map *
5034 isl_union_map_preimage_range_multi_aff(
5035 __isl_take isl_union_map *umap,
5036 __isl_take isl_multi_aff *ma);
5037 __isl_give isl_union_map *
5038 isl_union_map_preimage_domain_pw_multi_aff(
5039 __isl_take isl_union_map *umap,
5040 __isl_take isl_pw_multi_aff *pma);
5041 __isl_give isl_union_map *
5042 isl_union_map_preimage_range_pw_multi_aff(
5043 __isl_take isl_union_map *umap,
5044 __isl_take isl_pw_multi_aff *pma);
5045 __isl_give isl_union_map *
5046 isl_union_map_preimage_domain_union_pw_multi_aff(
5047 __isl_take isl_union_map *umap,
5048 __isl_take isl_union_pw_multi_aff *upma);
5049 __isl_give isl_union_map *
5050 isl_union_map_preimage_range_union_pw_multi_aff(
5051 __isl_take isl_union_map *umap,
5052 __isl_take isl_union_pw_multi_aff *upma);
5054 These functions compute the preimage of the given set or map domain/range under
5055 the given function. In other words, the expression is plugged
5056 into the set description or into the domain/range of the map.
5060 #include <isl/aff.h>
5061 __isl_give isl_aff *isl_aff_pullback_aff(
5062 __isl_take isl_aff *aff1,
5063 __isl_take isl_aff *aff2);
5064 __isl_give isl_aff *isl_aff_pullback_multi_aff(
5065 __isl_take isl_aff *aff,
5066 __isl_take isl_multi_aff *ma);
5067 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
5068 __isl_take isl_pw_aff *pa,
5069 __isl_take isl_multi_aff *ma);
5070 __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
5071 __isl_take isl_pw_aff *pa,
5072 __isl_take isl_pw_multi_aff *pma);
5073 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
5074 __isl_take isl_pw_aff *pa,
5075 __isl_take isl_multi_pw_aff *mpa);
5076 __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
5077 __isl_take isl_multi_aff *ma1,
5078 __isl_take isl_multi_aff *ma2);
5079 __isl_give isl_pw_multi_aff *
5080 isl_pw_multi_aff_pullback_multi_aff(
5081 __isl_take isl_pw_multi_aff *pma,
5082 __isl_take isl_multi_aff *ma);
5083 __isl_give isl_multi_pw_aff *
5084 isl_multi_pw_aff_pullback_multi_aff(
5085 __isl_take isl_multi_pw_aff *mpa,
5086 __isl_take isl_multi_aff *ma);
5087 __isl_give isl_pw_multi_aff *
5088 isl_pw_multi_aff_pullback_pw_multi_aff(
5089 __isl_take isl_pw_multi_aff *pma1,
5090 __isl_take isl_pw_multi_aff *pma2);
5091 __isl_give isl_multi_pw_aff *
5092 isl_multi_pw_aff_pullback_pw_multi_aff(
5093 __isl_take isl_multi_pw_aff *mpa,
5094 __isl_take isl_pw_multi_aff *pma);
5095 __isl_give isl_multi_pw_aff *
5096 isl_multi_pw_aff_pullback_multi_pw_aff(
5097 __isl_take isl_multi_pw_aff *mpa1,
5098 __isl_take isl_multi_pw_aff *mpa2);
5100 These functions precompose the first expression by the second function.
5101 In other words, the second function is plugged
5102 into the first expression.
5106 #include <isl/aff.h>
5107 __isl_give isl_basic_set *isl_aff_le_basic_set(
5108 __isl_take isl_aff *aff1,
5109 __isl_take isl_aff *aff2);
5110 __isl_give isl_basic_set *isl_aff_ge_basic_set(
5111 __isl_take isl_aff *aff1,
5112 __isl_take isl_aff *aff2);
5113 __isl_give isl_set *isl_pw_aff_eq_set(
5114 __isl_take isl_pw_aff *pwaff1,
5115 __isl_take isl_pw_aff *pwaff2);
5116 __isl_give isl_set *isl_pw_aff_ne_set(
5117 __isl_take isl_pw_aff *pwaff1,
5118 __isl_take isl_pw_aff *pwaff2);
5119 __isl_give isl_set *isl_pw_aff_le_set(
5120 __isl_take isl_pw_aff *pwaff1,
5121 __isl_take isl_pw_aff *pwaff2);
5122 __isl_give isl_set *isl_pw_aff_lt_set(
5123 __isl_take isl_pw_aff *pwaff1,
5124 __isl_take isl_pw_aff *pwaff2);
5125 __isl_give isl_set *isl_pw_aff_ge_set(
5126 __isl_take isl_pw_aff *pwaff1,
5127 __isl_take isl_pw_aff *pwaff2);
5128 __isl_give isl_set *isl_pw_aff_gt_set(
5129 __isl_take isl_pw_aff *pwaff1,
5130 __isl_take isl_pw_aff *pwaff2);
5132 __isl_give isl_set *isl_multi_aff_lex_le_set(
5133 __isl_take isl_multi_aff *ma1,
5134 __isl_take isl_multi_aff *ma2);
5135 __isl_give isl_set *isl_multi_aff_lex_ge_set(
5136 __isl_take isl_multi_aff *ma1,
5137 __isl_take isl_multi_aff *ma2);
5139 __isl_give isl_set *isl_pw_aff_list_eq_set(
5140 __isl_take isl_pw_aff_list *list1,
5141 __isl_take isl_pw_aff_list *list2);
5142 __isl_give isl_set *isl_pw_aff_list_ne_set(
5143 __isl_take isl_pw_aff_list *list1,
5144 __isl_take isl_pw_aff_list *list2);
5145 __isl_give isl_set *isl_pw_aff_list_le_set(
5146 __isl_take isl_pw_aff_list *list1,
5147 __isl_take isl_pw_aff_list *list2);
5148 __isl_give isl_set *isl_pw_aff_list_lt_set(
5149 __isl_take isl_pw_aff_list *list1,
5150 __isl_take isl_pw_aff_list *list2);
5151 __isl_give isl_set *isl_pw_aff_list_ge_set(
5152 __isl_take isl_pw_aff_list *list1,
5153 __isl_take isl_pw_aff_list *list2);
5154 __isl_give isl_set *isl_pw_aff_list_gt_set(
5155 __isl_take isl_pw_aff_list *list1,
5156 __isl_take isl_pw_aff_list *list2);
5158 The function C<isl_aff_ge_basic_set> returns a basic set
5159 containing those elements in the shared space
5160 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
5161 The function C<isl_pw_aff_ge_set> returns a set
5162 containing those elements in the shared domain
5163 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
5164 greater than or equal to C<pwaff2>.
5165 The function C<isl_multi_aff_lex_le_set> returns a set
5166 containing those elements in the shared domain space
5167 where C<ma1> is lexicographically smaller than or
5169 The functions operating on C<isl_pw_aff_list> apply the corresponding
5170 C<isl_pw_aff> function to each pair of elements in the two lists.
5172 =item * Cartesian Product
5174 #include <isl/space.h>
5175 __isl_give isl_space *isl_space_product(
5176 __isl_take isl_space *space1,
5177 __isl_take isl_space *space2);
5178 __isl_give isl_space *isl_space_domain_product(
5179 __isl_take isl_space *space1,
5180 __isl_take isl_space *space2);
5181 __isl_give isl_space *isl_space_range_product(
5182 __isl_take isl_space *space1,
5183 __isl_take isl_space *space2);
5186 C<isl_space_product>, C<isl_space_domain_product>
5187 and C<isl_space_range_product> take pairs or relation spaces and
5188 produce a single relations space, where either the domain, the range
5189 or both domain and range are wrapped spaces of relations between
5190 the domains and/or ranges of the input spaces.
5191 If the product is only constructed over the domain or the range
5192 then the ranges or the domains of the inputs should be the same.
5193 The function C<isl_space_product> also accepts a pair of set spaces,
5194 in which case it returns a wrapped space of a relation between the
5197 #include <isl/set.h>
5198 __isl_give isl_set *isl_set_product(
5199 __isl_take isl_set *set1,
5200 __isl_take isl_set *set2);
5202 #include <isl/map.h>
5203 __isl_give isl_basic_map *isl_basic_map_domain_product(
5204 __isl_take isl_basic_map *bmap1,
5205 __isl_take isl_basic_map *bmap2);
5206 __isl_give isl_basic_map *isl_basic_map_range_product(
5207 __isl_take isl_basic_map *bmap1,
5208 __isl_take isl_basic_map *bmap2);
5209 __isl_give isl_basic_map *isl_basic_map_product(
5210 __isl_take isl_basic_map *bmap1,
5211 __isl_take isl_basic_map *bmap2);
5212 __isl_give isl_map *isl_map_domain_product(
5213 __isl_take isl_map *map1,
5214 __isl_take isl_map *map2);
5215 __isl_give isl_map *isl_map_range_product(
5216 __isl_take isl_map *map1,
5217 __isl_take isl_map *map2);
5218 __isl_give isl_map *isl_map_product(
5219 __isl_take isl_map *map1,
5220 __isl_take isl_map *map2);
5222 #include <isl/union_set.h>
5223 __isl_give isl_union_set *isl_union_set_product(
5224 __isl_take isl_union_set *uset1,
5225 __isl_take isl_union_set *uset2);
5227 #include <isl/union_map.h>
5228 __isl_give isl_union_map *isl_union_map_domain_product(
5229 __isl_take isl_union_map *umap1,
5230 __isl_take isl_union_map *umap2);
5231 __isl_give isl_union_map *isl_union_map_range_product(
5232 __isl_take isl_union_map *umap1,
5233 __isl_take isl_union_map *umap2);
5234 __isl_give isl_union_map *isl_union_map_product(
5235 __isl_take isl_union_map *umap1,
5236 __isl_take isl_union_map *umap2);
5238 #include <isl/val.h>
5239 __isl_give isl_multi_val *isl_multi_val_range_product(
5240 __isl_take isl_multi_val *mv1,
5241 __isl_take isl_multi_val *mv2);
5242 __isl_give isl_multi_val *isl_multi_val_product(
5243 __isl_take isl_multi_val *mv1,
5244 __isl_take isl_multi_val *mv2);
5246 #include <isl/aff.h>
5247 __isl_give isl_multi_aff *isl_multi_aff_range_product(
5248 __isl_take isl_multi_aff *ma1,
5249 __isl_take isl_multi_aff *ma2);
5250 __isl_give isl_multi_aff *isl_multi_aff_product(
5251 __isl_take isl_multi_aff *ma1,
5252 __isl_take isl_multi_aff *ma2);
5253 __isl_give isl_multi_pw_aff *
5254 isl_multi_pw_aff_range_product(
5255 __isl_take isl_multi_pw_aff *mpa1,
5256 __isl_take isl_multi_pw_aff *mpa2);
5257 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
5258 __isl_take isl_multi_pw_aff *mpa1,
5259 __isl_take isl_multi_pw_aff *mpa2);
5260 __isl_give isl_pw_multi_aff *
5261 isl_pw_multi_aff_range_product(
5262 __isl_take isl_pw_multi_aff *pma1,
5263 __isl_take isl_pw_multi_aff *pma2);
5264 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
5265 __isl_take isl_pw_multi_aff *pma1,
5266 __isl_take isl_pw_multi_aff *pma2);
5268 The above functions compute the cross product of the given
5269 sets, relations or functions. The domains and ranges of the results
5270 are wrapped maps between domains and ranges of the inputs.
5271 To obtain a ``flat'' product, use the following functions
5274 #include <isl/set.h>
5275 __isl_give isl_basic_set *isl_basic_set_flat_product(
5276 __isl_take isl_basic_set *bset1,
5277 __isl_take isl_basic_set *bset2);
5278 __isl_give isl_set *isl_set_flat_product(
5279 __isl_take isl_set *set1,
5280 __isl_take isl_set *set2);
5282 #include <isl/map.h>
5283 __isl_give isl_basic_map *isl_basic_map_flat_range_product(
5284 __isl_take isl_basic_map *bmap1,
5285 __isl_take isl_basic_map *bmap2);
5286 __isl_give isl_map *isl_map_flat_domain_product(
5287 __isl_take isl_map *map1,
5288 __isl_take isl_map *map2);
5289 __isl_give isl_map *isl_map_flat_range_product(
5290 __isl_take isl_map *map1,
5291 __isl_take isl_map *map2);
5292 __isl_give isl_basic_map *isl_basic_map_flat_product(
5293 __isl_take isl_basic_map *bmap1,
5294 __isl_take isl_basic_map *bmap2);
5295 __isl_give isl_map *isl_map_flat_product(
5296 __isl_take isl_map *map1,
5297 __isl_take isl_map *map2);
5299 #include <isl/union_map.h>
5300 __isl_give isl_union_map *
5301 isl_union_map_flat_range_product(
5302 __isl_take isl_union_map *umap1,
5303 __isl_take isl_union_map *umap2);
5305 #include <isl/val.h>
5306 __isl_give isl_multi_val *isl_multi_val_flat_range_product(
5307 __isl_take isl_multi_val *mv1,
5308 __isl_take isl_multi_aff *mv2);
5310 #include <isl/aff.h>
5311 __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
5312 __isl_take isl_multi_aff *ma1,
5313 __isl_take isl_multi_aff *ma2);
5314 __isl_give isl_pw_multi_aff *
5315 isl_pw_multi_aff_flat_range_product(
5316 __isl_take isl_pw_multi_aff *pma1,
5317 __isl_take isl_pw_multi_aff *pma2);
5318 __isl_give isl_multi_pw_aff *
5319 isl_multi_pw_aff_flat_range_product(
5320 __isl_take isl_multi_pw_aff *mpa1,
5321 __isl_take isl_multi_pw_aff *mpa2);
5322 __isl_give isl_union_pw_multi_aff *
5323 isl_union_pw_multi_aff_flat_range_product(
5324 __isl_take isl_union_pw_multi_aff *upma1,
5325 __isl_take isl_union_pw_multi_aff *upma2);
5327 #include <isl/space.h>
5328 __isl_give isl_space *isl_space_domain_factor_domain(
5329 __isl_take isl_space *space);
5330 __isl_give isl_space *isl_space_range_factor_domain(
5331 __isl_take isl_space *space);
5332 __isl_give isl_space *isl_space_range_factor_range(
5333 __isl_take isl_space *space);
5335 The functions C<isl_space_range_factor_domain> and
5336 C<isl_space_range_factor_range> extract the two arguments from
5337 the result of a call to C<isl_space_range_product>.
5339 The arguments of a call to C<isl_map_range_product> can be extracted
5340 from the result using the following two functions.
5342 #include <isl/map.h>
5343 __isl_give isl_map *isl_map_range_factor_domain(
5344 __isl_take isl_map *map);
5345 __isl_give isl_map *isl_map_range_factor_range(
5346 __isl_take isl_map *map);
5348 #include <isl/val.h>
5349 __isl_give isl_multi_val *
5350 isl_multi_val_range_factor_domain(
5351 __isl_take isl_multi_val *mv);
5352 __isl_give isl_multi_val *
5353 isl_multi_val_range_factor_range(
5354 __isl_take isl_multi_val *mv);
5356 #include <isl/aff.h>
5357 __isl_give isl_multi_aff *
5358 isl_multi_aff_range_factor_domain(
5359 __isl_take isl_multi_aff *ma);
5360 __isl_give isl_multi_aff *
5361 isl_multi_aff_range_factor_range(
5362 __isl_take isl_multi_aff *ma);
5363 __isl_give isl_multi_pw_aff *
5364 isl_multi_pw_aff_range_factor_domain(
5365 __isl_take isl_multi_pw_aff *mpa);
5366 __isl_give isl_multi_pw_aff *
5367 isl_multi_pw_aff_range_factor_range(
5368 __isl_take isl_multi_pw_aff *mpa);
5370 The splice functions are a generalization of the flat product functions,
5371 where the second argument may be inserted at any position inside
5372 the first argument rather than being placed at the end.
5374 #include <isl/val.h>
5375 __isl_give isl_multi_val *isl_multi_val_range_splice(
5376 __isl_take isl_multi_val *mv1, unsigned pos,
5377 __isl_take isl_multi_val *mv2);
5379 #include <isl/aff.h>
5380 __isl_give isl_multi_aff *isl_multi_aff_range_splice(
5381 __isl_take isl_multi_aff *ma1, unsigned pos,
5382 __isl_take isl_multi_aff *ma2);
5383 __isl_give isl_multi_aff *isl_multi_aff_splice(
5384 __isl_take isl_multi_aff *ma1,
5385 unsigned in_pos, unsigned out_pos,
5386 __isl_take isl_multi_aff *ma2);
5387 __isl_give isl_multi_pw_aff *
5388 isl_multi_pw_aff_range_splice(
5389 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
5390 __isl_take isl_multi_pw_aff *mpa2);
5391 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
5392 __isl_take isl_multi_pw_aff *mpa1,
5393 unsigned in_pos, unsigned out_pos,
5394 __isl_take isl_multi_pw_aff *mpa2);
5396 =item * Simplification
5398 When applied to a set or relation,
5399 the gist operation returns a set or relation that has the
5400 same intersection with the context as the input set or relation.
5401 Any implicit equality in the intersection is made explicit in the result,
5402 while all inequalities that are redundant with respect to the intersection
5404 In case of union sets and relations, the gist operation is performed
5407 When applied to a function,
5408 the gist operation applies the set gist operation to each of
5409 the cells in the domain of the input piecewise expression.
5410 The context is also exploited
5411 to simplify the expression associated to each cell.
5413 #include <isl/set.h>
5414 __isl_give isl_basic_set *isl_basic_set_gist(
5415 __isl_take isl_basic_set *bset,
5416 __isl_take isl_basic_set *context);
5417 __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
5418 __isl_take isl_set *context);
5419 __isl_give isl_set *isl_set_gist_params(
5420 __isl_take isl_set *set,
5421 __isl_take isl_set *context);
5423 #include <isl/map.h>
5424 __isl_give isl_basic_map *isl_basic_map_gist(
5425 __isl_take isl_basic_map *bmap,
5426 __isl_take isl_basic_map *context);
5427 __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
5428 __isl_take isl_map *context);
5429 __isl_give isl_map *isl_map_gist_params(
5430 __isl_take isl_map *map,
5431 __isl_take isl_set *context);
5432 __isl_give isl_map *isl_map_gist_domain(
5433 __isl_take isl_map *map,
5434 __isl_take isl_set *context);
5435 __isl_give isl_map *isl_map_gist_range(
5436 __isl_take isl_map *map,
5437 __isl_take isl_set *context);
5439 #include <isl/union_set.h>
5440 __isl_give isl_union_set *isl_union_set_gist(
5441 __isl_take isl_union_set *uset,
5442 __isl_take isl_union_set *context);
5443 __isl_give isl_union_set *isl_union_set_gist_params(
5444 __isl_take isl_union_set *uset,
5445 __isl_take isl_set *set);
5447 #include <isl/union_map.h>
5448 __isl_give isl_union_map *isl_union_map_gist(
5449 __isl_take isl_union_map *umap,
5450 __isl_take isl_union_map *context);
5451 __isl_give isl_union_map *isl_union_map_gist_params(
5452 __isl_take isl_union_map *umap,
5453 __isl_take isl_set *set);
5454 __isl_give isl_union_map *isl_union_map_gist_domain(
5455 __isl_take isl_union_map *umap,
5456 __isl_take isl_union_set *uset);
5457 __isl_give isl_union_map *isl_union_map_gist_range(
5458 __isl_take isl_union_map *umap,
5459 __isl_take isl_union_set *uset);
5461 #include <isl/aff.h>
5462 __isl_give isl_aff *isl_aff_gist_params(
5463 __isl_take isl_aff *aff,
5464 __isl_take isl_set *context);
5465 __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
5466 __isl_take isl_set *context);
5467 __isl_give isl_multi_aff *isl_multi_aff_gist_params(
5468 __isl_take isl_multi_aff *maff,
5469 __isl_take isl_set *context);
5470 __isl_give isl_multi_aff *isl_multi_aff_gist(
5471 __isl_take isl_multi_aff *maff,
5472 __isl_take isl_set *context);
5473 __isl_give isl_pw_aff *isl_pw_aff_gist_params(
5474 __isl_take isl_pw_aff *pwaff,
5475 __isl_take isl_set *context);
5476 __isl_give isl_pw_aff *isl_pw_aff_gist(
5477 __isl_take isl_pw_aff *pwaff,
5478 __isl_take isl_set *context);
5479 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
5480 __isl_take isl_pw_multi_aff *pma,
5481 __isl_take isl_set *set);
5482 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
5483 __isl_take isl_pw_multi_aff *pma,
5484 __isl_take isl_set *set);
5485 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
5486 __isl_take isl_multi_pw_aff *mpa,
5487 __isl_take isl_set *set);
5488 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
5489 __isl_take isl_multi_pw_aff *mpa,
5490 __isl_take isl_set *set);
5492 #include <isl/polynomial.h>
5493 __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
5494 __isl_take isl_qpolynomial *qp,
5495 __isl_take isl_set *context);
5496 __isl_give isl_qpolynomial *isl_qpolynomial_gist(
5497 __isl_take isl_qpolynomial *qp,
5498 __isl_take isl_set *context);
5499 __isl_give isl_qpolynomial_fold *
5500 isl_qpolynomial_fold_gist_params(
5501 __isl_take isl_qpolynomial_fold *fold,
5502 __isl_take isl_set *context);
5503 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
5504 __isl_take isl_qpolynomial_fold *fold,
5505 __isl_take isl_set *context);
5506 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
5507 __isl_take isl_pw_qpolynomial *pwqp,
5508 __isl_take isl_set *context);
5509 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
5510 __isl_take isl_pw_qpolynomial *pwqp,
5511 __isl_take isl_set *context);
5512 __isl_give isl_pw_qpolynomial_fold *
5513 isl_pw_qpolynomial_fold_gist(
5514 __isl_take isl_pw_qpolynomial_fold *pwf,
5515 __isl_take isl_set *context);
5516 __isl_give isl_pw_qpolynomial_fold *
5517 isl_pw_qpolynomial_fold_gist_params(
5518 __isl_take isl_pw_qpolynomial_fold *pwf,
5519 __isl_take isl_set *context);
5520 __isl_give isl_union_pw_qpolynomial *
5521 isl_union_pw_qpolynomial_gist_params(
5522 __isl_take isl_union_pw_qpolynomial *upwqp,
5523 __isl_take isl_set *context);
5524 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
5525 __isl_take isl_union_pw_qpolynomial *upwqp,
5526 __isl_take isl_union_set *context);
5527 __isl_give isl_union_pw_qpolynomial_fold *
5528 isl_union_pw_qpolynomial_fold_gist(
5529 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5530 __isl_take isl_union_set *context);
5531 __isl_give isl_union_pw_qpolynomial_fold *
5532 isl_union_pw_qpolynomial_fold_gist_params(
5533 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5534 __isl_take isl_set *context);
5536 =item * Binary Arithmethic Operations
5538 #include <isl/aff.h>
5539 __isl_give isl_aff *isl_aff_add(
5540 __isl_take isl_aff *aff1,
5541 __isl_take isl_aff *aff2);
5542 __isl_give isl_multi_aff *isl_multi_aff_add(
5543 __isl_take isl_multi_aff *maff1,
5544 __isl_take isl_multi_aff *maff2);
5545 __isl_give isl_pw_aff *isl_pw_aff_add(
5546 __isl_take isl_pw_aff *pwaff1,
5547 __isl_take isl_pw_aff *pwaff2);
5548 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
5549 __isl_take isl_pw_multi_aff *pma1,
5550 __isl_take isl_pw_multi_aff *pma2);
5551 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
5552 __isl_take isl_union_pw_multi_aff *upma1,
5553 __isl_take isl_union_pw_multi_aff *upma2);
5554 __isl_give isl_pw_aff *isl_pw_aff_min(
5555 __isl_take isl_pw_aff *pwaff1,
5556 __isl_take isl_pw_aff *pwaff2);
5557 __isl_give isl_pw_aff *isl_pw_aff_max(
5558 __isl_take isl_pw_aff *pwaff1,
5559 __isl_take isl_pw_aff *pwaff2);
5560 __isl_give isl_aff *isl_aff_sub(
5561 __isl_take isl_aff *aff1,
5562 __isl_take isl_aff *aff2);
5563 __isl_give isl_multi_aff *isl_multi_aff_sub(
5564 __isl_take isl_multi_aff *ma1,
5565 __isl_take isl_multi_aff *ma2);
5566 __isl_give isl_pw_aff *isl_pw_aff_sub(
5567 __isl_take isl_pw_aff *pwaff1,
5568 __isl_take isl_pw_aff *pwaff2);
5569 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
5570 __isl_take isl_pw_multi_aff *pma1,
5571 __isl_take isl_pw_multi_aff *pma2);
5572 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
5573 __isl_take isl_union_pw_multi_aff *upma1,
5574 __isl_take isl_union_pw_multi_aff *upma2);
5576 C<isl_aff_sub> subtracts the second argument from the first.
5578 #include <isl/polynomial.h>
5579 __isl_give isl_qpolynomial *isl_qpolynomial_add(
5580 __isl_take isl_qpolynomial *qp1,
5581 __isl_take isl_qpolynomial *qp2);
5582 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
5583 __isl_take isl_pw_qpolynomial *pwqp1,
5584 __isl_take isl_pw_qpolynomial *pwqp2);
5585 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
5586 __isl_take isl_pw_qpolynomial *pwqp1,
5587 __isl_take isl_pw_qpolynomial *pwqp2);
5588 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
5589 __isl_take isl_pw_qpolynomial_fold *pwf1,
5590 __isl_take isl_pw_qpolynomial_fold *pwf2);
5591 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
5592 __isl_take isl_union_pw_qpolynomial *upwqp1,
5593 __isl_take isl_union_pw_qpolynomial *upwqp2);
5594 __isl_give isl_qpolynomial *isl_qpolynomial_sub(
5595 __isl_take isl_qpolynomial *qp1,
5596 __isl_take isl_qpolynomial *qp2);
5597 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
5598 __isl_take isl_pw_qpolynomial *pwqp1,
5599 __isl_take isl_pw_qpolynomial *pwqp2);
5600 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
5601 __isl_take isl_union_pw_qpolynomial *upwqp1,
5602 __isl_take isl_union_pw_qpolynomial *upwqp2);
5603 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
5604 __isl_take isl_pw_qpolynomial_fold *pwf1,
5605 __isl_take isl_pw_qpolynomial_fold *pwf2);
5606 __isl_give isl_union_pw_qpolynomial_fold *
5607 isl_union_pw_qpolynomial_fold_fold(
5608 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
5609 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
5611 #include <isl/aff.h>
5612 __isl_give isl_pw_aff *isl_pw_aff_union_add(
5613 __isl_take isl_pw_aff *pwaff1,
5614 __isl_take isl_pw_aff *pwaff2);
5615 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
5616 __isl_take isl_pw_multi_aff *pma1,
5617 __isl_take isl_pw_multi_aff *pma2);
5618 __isl_give isl_pw_aff *isl_pw_aff_union_min(
5619 __isl_take isl_pw_aff *pwaff1,
5620 __isl_take isl_pw_aff *pwaff2);
5621 __isl_give isl_pw_aff *isl_pw_aff_union_max(
5622 __isl_take isl_pw_aff *pwaff1,
5623 __isl_take isl_pw_aff *pwaff2);
5625 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
5626 expression with a domain that is the union of those of C<pwaff1> and
5627 C<pwaff2> and such that on each cell, the quasi-affine expression is
5628 the maximum of those of C<pwaff1> and C<pwaff2>. If only one of
5629 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
5630 associated expression is the defined one.
5631 This in contrast to the C<isl_pw_aff_max> function, which is
5632 only defined on the shared definition domain of the arguments.
5634 #include <isl/val.h>
5635 __isl_give isl_multi_val *isl_multi_val_add_val(
5636 __isl_take isl_multi_val *mv,
5637 __isl_take isl_val *v);
5638 __isl_give isl_multi_val *isl_multi_val_mod_val(
5639 __isl_take isl_multi_val *mv,
5640 __isl_take isl_val *v);
5641 __isl_give isl_multi_val *isl_multi_val_scale_val(
5642 __isl_take isl_multi_val *mv,
5643 __isl_take isl_val *v);
5645 #include <isl/aff.h>
5646 __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
5647 __isl_take isl_val *mod);
5648 __isl_give isl_pw_aff *isl_pw_aff_mod_val(
5649 __isl_take isl_pw_aff *pa,
5650 __isl_take isl_val *mod);
5651 __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
5652 __isl_take isl_val *v);
5653 __isl_give isl_multi_aff *isl_multi_aff_scale_val(
5654 __isl_take isl_multi_aff *ma,
5655 __isl_take isl_val *v);
5656 __isl_give isl_pw_aff *isl_pw_aff_scale_val(
5657 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
5658 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
5659 __isl_take isl_multi_pw_aff *mpa,
5660 __isl_take isl_val *v);
5661 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
5662 __isl_take isl_pw_multi_aff *pma,
5663 __isl_take isl_val *v);
5664 __isl_give isl_aff *isl_aff_scale_down_ui(
5665 __isl_take isl_aff *aff, unsigned f);
5666 __isl_give isl_aff *isl_aff_scale_down_val(
5667 __isl_take isl_aff *aff, __isl_take isl_val *v);
5668 __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
5669 __isl_take isl_pw_aff *pa,
5670 __isl_take isl_val *f);
5672 #include <isl/polynomial.h>
5673 __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
5674 __isl_take isl_qpolynomial *qp,
5675 __isl_take isl_val *v);
5676 __isl_give isl_qpolynomial_fold *
5677 isl_qpolynomial_fold_scale_val(
5678 __isl_take isl_qpolynomial_fold *fold,
5679 __isl_take isl_val *v);
5680 __isl_give isl_pw_qpolynomial *
5681 isl_pw_qpolynomial_scale_val(
5682 __isl_take isl_pw_qpolynomial *pwqp,
5683 __isl_take isl_val *v);
5684 __isl_give isl_pw_qpolynomial_fold *
5685 isl_pw_qpolynomial_fold_scale_val(
5686 __isl_take isl_pw_qpolynomial_fold *pwf,
5687 __isl_take isl_val *v);
5688 __isl_give isl_union_pw_qpolynomial *
5689 isl_union_pw_qpolynomial_scale_val(
5690 __isl_take isl_union_pw_qpolynomial *upwqp,
5691 __isl_take isl_val *v);
5692 __isl_give isl_union_pw_qpolynomial_fold *
5693 isl_union_pw_qpolynomial_fold_scale_val(
5694 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5695 __isl_take isl_val *v);
5697 #include <isl/val.h>
5698 __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
5699 __isl_take isl_multi_val *mv1,
5700 __isl_take isl_multi_val *mv2);
5701 __isl_give isl_multi_val *
5702 isl_multi_val_scale_down_multi_val(
5703 __isl_take isl_multi_val *mv1,
5704 __isl_take isl_multi_val *mv2);
5706 #include <isl/aff.h>
5707 __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
5708 __isl_take isl_multi_aff *ma,
5709 __isl_take isl_multi_val *mv);
5710 __isl_give isl_pw_multi_aff *
5711 isl_pw_multi_aff_scale_multi_val(
5712 __isl_take isl_pw_multi_aff *pma,
5713 __isl_take isl_multi_val *mv);
5714 __isl_give isl_multi_pw_aff *
5715 isl_multi_pw_aff_scale_multi_val(
5716 __isl_take isl_multi_pw_aff *mpa,
5717 __isl_take isl_multi_val *mv);
5718 __isl_give isl_union_pw_multi_aff *
5719 isl_union_pw_multi_aff_scale_multi_val(
5720 __isl_take isl_union_pw_multi_aff *upma,
5721 __isl_take isl_multi_val *mv);
5722 __isl_give isl_multi_aff *
5723 isl_multi_aff_scale_down_multi_val(
5724 __isl_take isl_multi_aff *ma,
5725 __isl_take isl_multi_val *mv);
5726 __isl_give isl_multi_pw_aff *
5727 isl_multi_pw_aff_scale_down_multi_val(
5728 __isl_take isl_multi_pw_aff *mpa,
5729 __isl_take isl_multi_val *mv);
5731 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
5732 by the corresponding elements of C<mv>.
5734 #include <isl/aff.h>
5735 __isl_give isl_aff *isl_aff_mul(
5736 __isl_take isl_aff *aff1,
5737 __isl_take isl_aff *aff2);
5738 __isl_give isl_aff *isl_aff_div(
5739 __isl_take isl_aff *aff1,
5740 __isl_take isl_aff *aff2);
5741 __isl_give isl_pw_aff *isl_pw_aff_mul(
5742 __isl_take isl_pw_aff *pwaff1,
5743 __isl_take isl_pw_aff *pwaff2);
5744 __isl_give isl_pw_aff *isl_pw_aff_div(
5745 __isl_take isl_pw_aff *pa1,
5746 __isl_take isl_pw_aff *pa2);
5747 __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
5748 __isl_take isl_pw_aff *pa1,
5749 __isl_take isl_pw_aff *pa2);
5750 __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
5751 __isl_take isl_pw_aff *pa1,
5752 __isl_take isl_pw_aff *pa2);
5754 When multiplying two affine expressions, at least one of the two needs
5755 to be a constant. Similarly, when dividing an affine expression by another,
5756 the second expression needs to be a constant.
5757 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
5758 rounding towards zero. C<isl_pw_aff_tdiv_r> computes the corresponding
5761 #include <isl/polynomial.h>
5762 __isl_give isl_qpolynomial *isl_qpolynomial_mul(
5763 __isl_take isl_qpolynomial *qp1,
5764 __isl_take isl_qpolynomial *qp2);
5765 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
5766 __isl_take isl_pw_qpolynomial *pwqp1,
5767 __isl_take isl_pw_qpolynomial *pwqp2);
5768 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
5769 __isl_take isl_union_pw_qpolynomial *upwqp1,
5770 __isl_take isl_union_pw_qpolynomial *upwqp2);
5774 =head3 Lexicographic Optimization
5776 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
5777 the following functions
5778 compute a set that contains the lexicographic minimum or maximum
5779 of the elements in C<set> (or C<bset>) for those values of the parameters
5780 that satisfy C<dom>.
5781 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
5782 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
5784 In other words, the union of the parameter values
5785 for which the result is non-empty and of C<*empty>
5788 #include <isl/set.h>
5789 __isl_give isl_set *isl_basic_set_partial_lexmin(
5790 __isl_take isl_basic_set *bset,
5791 __isl_take isl_basic_set *dom,
5792 __isl_give isl_set **empty);
5793 __isl_give isl_set *isl_basic_set_partial_lexmax(
5794 __isl_take isl_basic_set *bset,
5795 __isl_take isl_basic_set *dom,
5796 __isl_give isl_set **empty);
5797 __isl_give isl_set *isl_set_partial_lexmin(
5798 __isl_take isl_set *set, __isl_take isl_set *dom,
5799 __isl_give isl_set **empty);
5800 __isl_give isl_set *isl_set_partial_lexmax(
5801 __isl_take isl_set *set, __isl_take isl_set *dom,
5802 __isl_give isl_set **empty);
5804 Given a (basic) set C<set> (or C<bset>), the following functions simply
5805 return a set containing the lexicographic minimum or maximum
5806 of the elements in C<set> (or C<bset>).
5807 In case of union sets, the optimum is computed per space.
5809 #include <isl/set.h>
5810 __isl_give isl_set *isl_basic_set_lexmin(
5811 __isl_take isl_basic_set *bset);
5812 __isl_give isl_set *isl_basic_set_lexmax(
5813 __isl_take isl_basic_set *bset);
5814 __isl_give isl_set *isl_set_lexmin(
5815 __isl_take isl_set *set);
5816 __isl_give isl_set *isl_set_lexmax(
5817 __isl_take isl_set *set);
5818 __isl_give isl_union_set *isl_union_set_lexmin(
5819 __isl_take isl_union_set *uset);
5820 __isl_give isl_union_set *isl_union_set_lexmax(
5821 __isl_take isl_union_set *uset);
5823 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
5824 the following functions
5825 compute a relation that maps each element of C<dom>
5826 to the single lexicographic minimum or maximum
5827 of the elements that are associated to that same
5828 element in C<map> (or C<bmap>).
5829 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
5830 that contains the elements in C<dom> that do not map
5831 to any elements in C<map> (or C<bmap>).
5832 In other words, the union of the domain of the result and of C<*empty>
5835 #include <isl/map.h>
5836 __isl_give isl_map *isl_basic_map_partial_lexmax(
5837 __isl_take isl_basic_map *bmap,
5838 __isl_take isl_basic_set *dom,
5839 __isl_give isl_set **empty);
5840 __isl_give isl_map *isl_basic_map_partial_lexmin(
5841 __isl_take isl_basic_map *bmap,
5842 __isl_take isl_basic_set *dom,
5843 __isl_give isl_set **empty);
5844 __isl_give isl_map *isl_map_partial_lexmax(
5845 __isl_take isl_map *map, __isl_take isl_set *dom,
5846 __isl_give isl_set **empty);
5847 __isl_give isl_map *isl_map_partial_lexmin(
5848 __isl_take isl_map *map, __isl_take isl_set *dom,
5849 __isl_give isl_set **empty);
5851 Given a (basic) map C<map> (or C<bmap>), the following functions simply
5852 return a map mapping each element in the domain of
5853 C<map> (or C<bmap>) to the lexicographic minimum or maximum
5854 of all elements associated to that element.
5855 In case of union relations, the optimum is computed per space.
5857 #include <isl/map.h>
5858 __isl_give isl_map *isl_basic_map_lexmin(
5859 __isl_take isl_basic_map *bmap);
5860 __isl_give isl_map *isl_basic_map_lexmax(
5861 __isl_take isl_basic_map *bmap);
5862 __isl_give isl_map *isl_map_lexmin(
5863 __isl_take isl_map *map);
5864 __isl_give isl_map *isl_map_lexmax(
5865 __isl_take isl_map *map);
5866 __isl_give isl_union_map *isl_union_map_lexmin(
5867 __isl_take isl_union_map *umap);
5868 __isl_give isl_union_map *isl_union_map_lexmax(
5869 __isl_take isl_union_map *umap);
5871 The following functions return their result in the form of
5872 a piecewise multi-affine expression,
5873 but are otherwise equivalent to the corresponding functions
5874 returning a basic set or relation.
5876 #include <isl/set.h>
5877 __isl_give isl_pw_multi_aff *
5878 isl_basic_set_partial_lexmin_pw_multi_aff(
5879 __isl_take isl_basic_set *bset,
5880 __isl_take isl_basic_set *dom,
5881 __isl_give isl_set **empty);
5882 __isl_give isl_pw_multi_aff *
5883 isl_basic_set_partial_lexmax_pw_multi_aff(
5884 __isl_take isl_basic_set *bset,
5885 __isl_take isl_basic_set *dom,
5886 __isl_give isl_set **empty);
5887 __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
5888 __isl_take isl_set *set);
5889 __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
5890 __isl_take isl_set *set);
5892 #include <isl/map.h>
5893 __isl_give isl_pw_multi_aff *
5894 isl_basic_map_lexmin_pw_multi_aff(
5895 __isl_take isl_basic_map *bmap);
5896 __isl_give isl_pw_multi_aff *
5897 isl_basic_map_partial_lexmin_pw_multi_aff(
5898 __isl_take isl_basic_map *bmap,
5899 __isl_take isl_basic_set *dom,
5900 __isl_give isl_set **empty);
5901 __isl_give isl_pw_multi_aff *
5902 isl_basic_map_partial_lexmax_pw_multi_aff(
5903 __isl_take isl_basic_map *bmap,
5904 __isl_take isl_basic_set *dom,
5905 __isl_give isl_set **empty);
5906 __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
5907 __isl_take isl_map *map);
5908 __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
5909 __isl_take isl_map *map);
5911 The following functions return the lexicographic minimum or maximum
5912 on the shared domain of the inputs and the single defined function
5913 on those parts of the domain where only a single function is defined.
5915 #include <isl/aff.h>
5916 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
5917 __isl_take isl_pw_multi_aff *pma1,
5918 __isl_take isl_pw_multi_aff *pma2);
5919 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
5920 __isl_take isl_pw_multi_aff *pma1,
5921 __isl_take isl_pw_multi_aff *pma2);
5923 =head2 Ternary Operations
5925 #include <isl/aff.h>
5926 __isl_give isl_pw_aff *isl_pw_aff_cond(
5927 __isl_take isl_pw_aff *cond,
5928 __isl_take isl_pw_aff *pwaff_true,
5929 __isl_take isl_pw_aff *pwaff_false);
5931 The function C<isl_pw_aff_cond> performs a conditional operator
5932 and returns an expression that is equal to C<pwaff_true>
5933 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
5934 where C<cond> is zero.
5938 Lists are defined over several element types, including
5939 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_constraint>,
5940 C<isl_basic_set>, C<isl_set>, C<isl_ast_expr> and C<isl_ast_node>.
5941 Here we take lists of C<isl_set>s as an example.
5942 Lists can be created, copied, modified and freed using the following functions.
5944 #include <isl/set.h>
5945 __isl_give isl_set_list *isl_set_list_from_set(
5946 __isl_take isl_set *el);
5947 __isl_give isl_set_list *isl_set_list_alloc(
5948 isl_ctx *ctx, int n);
5949 __isl_give isl_set_list *isl_set_list_copy(
5950 __isl_keep isl_set_list *list);
5951 __isl_give isl_set_list *isl_set_list_insert(
5952 __isl_take isl_set_list *list, unsigned pos,
5953 __isl_take isl_set *el);
5954 __isl_give isl_set_list *isl_set_list_add(
5955 __isl_take isl_set_list *list,
5956 __isl_take isl_set *el);
5957 __isl_give isl_set_list *isl_set_list_drop(
5958 __isl_take isl_set_list *list,
5959 unsigned first, unsigned n);
5960 __isl_give isl_set_list *isl_set_list_set_set(
5961 __isl_take isl_set_list *list, int index,
5962 __isl_take isl_set *set);
5963 __isl_give isl_set_list *isl_set_list_concat(
5964 __isl_take isl_set_list *list1,
5965 __isl_take isl_set_list *list2);
5966 __isl_give isl_set_list *isl_set_list_sort(
5967 __isl_take isl_set_list *list,
5968 int (*cmp)(__isl_keep isl_set *a,
5969 __isl_keep isl_set *b, void *user),
5971 __isl_null isl_set_list *isl_set_list_free(
5972 __isl_take isl_set_list *list);
5974 C<isl_set_list_alloc> creates an empty list with a capacity for
5975 C<n> elements. C<isl_set_list_from_set> creates a list with a single
5978 Lists can be inspected using the following functions.
5980 #include <isl/set.h>
5981 int isl_set_list_n_set(__isl_keep isl_set_list *list);
5982 __isl_give isl_set *isl_set_list_get_set(
5983 __isl_keep isl_set_list *list, int index);
5984 int isl_set_list_foreach(__isl_keep isl_set_list *list,
5985 int (*fn)(__isl_take isl_set *el, void *user),
5987 int isl_set_list_foreach_scc(__isl_keep isl_set_list *list,
5988 int (*follows)(__isl_keep isl_set *a,
5989 __isl_keep isl_set *b, void *user),
5991 int (*fn)(__isl_take isl_set *el, void *user),
5994 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
5995 strongly connected components of the graph with as vertices the elements
5996 of C<list> and a directed edge from vertex C<b> to vertex C<a>
5997 iff C<follows(a, b)> returns C<1>. The callbacks C<follows> and C<fn>
5998 should return C<-1> on error.
6000 Lists can be printed using
6002 #include <isl/set.h>
6003 __isl_give isl_printer *isl_printer_print_set_list(
6004 __isl_take isl_printer *p,
6005 __isl_keep isl_set_list *list);
6007 =head2 Associative arrays
6009 Associative arrays map isl objects of a specific type to isl objects
6010 of some (other) specific type. They are defined for several pairs
6011 of types, including (C<isl_map>, C<isl_basic_set>),
6012 (C<isl_id>, C<isl_ast_expr>) and.
6013 (C<isl_id>, C<isl_pw_aff>).
6014 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
6017 Associative arrays can be created, copied and freed using
6018 the following functions.
6020 #include <isl/id_to_ast_expr.h>
6021 __isl_give id_to_ast_expr *isl_id_to_ast_expr_alloc(
6022 isl_ctx *ctx, int min_size);
6023 __isl_give id_to_ast_expr *isl_id_to_ast_expr_copy(
6024 __isl_keep id_to_ast_expr *id2expr);
6025 __isl_null id_to_ast_expr *isl_id_to_ast_expr_free(
6026 __isl_take id_to_ast_expr *id2expr);
6028 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
6029 to specify the expected size of the associative array.
6030 The associative array will be grown automatically as needed.
6032 Associative arrays can be inspected using the following functions.
6034 #include <isl/id_to_ast_expr.h>
6035 int isl_id_to_ast_expr_has(
6036 __isl_keep id_to_ast_expr *id2expr,
6037 __isl_keep isl_id *key);
6038 __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
6039 __isl_keep id_to_ast_expr *id2expr,
6040 __isl_take isl_id *key);
6041 int isl_id_to_ast_expr_foreach(
6042 __isl_keep id_to_ast_expr *id2expr,
6043 int (*fn)(__isl_take isl_id *key,
6044 __isl_take isl_ast_expr *val, void *user),
6047 They can be modified using the following function.
6049 #include <isl/id_to_ast_expr.h>
6050 __isl_give id_to_ast_expr *isl_id_to_ast_expr_set(
6051 __isl_take id_to_ast_expr *id2expr,
6052 __isl_take isl_id *key,
6053 __isl_take isl_ast_expr *val);
6054 __isl_give id_to_ast_expr *isl_id_to_ast_expr_drop(
6055 __isl_take id_to_ast_expr *id2expr,
6056 __isl_take isl_id *key);
6058 Associative arrays can be printed using the following function.
6060 #include <isl/id_to_ast_expr.h>
6061 __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
6062 __isl_take isl_printer *p,
6063 __isl_keep id_to_ast_expr *id2expr);
6067 Vectors can be created, copied and freed using the following functions.
6069 #include <isl/vec.h>
6070 __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
6072 __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
6073 __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
6075 Note that the elements of a newly created vector may have arbitrary values.
6076 The elements can be changed and inspected using the following functions.
6078 int isl_vec_size(__isl_keep isl_vec *vec);
6079 __isl_give isl_val *isl_vec_get_element_val(
6080 __isl_keep isl_vec *vec, int pos);
6081 __isl_give isl_vec *isl_vec_set_element_si(
6082 __isl_take isl_vec *vec, int pos, int v);
6083 __isl_give isl_vec *isl_vec_set_element_val(
6084 __isl_take isl_vec *vec, int pos,
6085 __isl_take isl_val *v);
6086 __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
6088 __isl_give isl_vec *isl_vec_set_val(
6089 __isl_take isl_vec *vec, __isl_take isl_val *v);
6090 int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
6091 __isl_keep isl_vec *vec2, int pos);
6093 C<isl_vec_get_element> will return a negative value if anything went wrong.
6094 In that case, the value of C<*v> is undefined.
6096 The following function can be used to concatenate two vectors.
6098 __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
6099 __isl_take isl_vec *vec2);
6103 Matrices can be created, copied and freed using the following functions.
6105 #include <isl/mat.h>
6106 __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
6107 unsigned n_row, unsigned n_col);
6108 __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
6109 __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
6111 Note that the elements of a newly created matrix may have arbitrary values.
6112 The elements can be changed and inspected using the following functions.
6114 int isl_mat_rows(__isl_keep isl_mat *mat);
6115 int isl_mat_cols(__isl_keep isl_mat *mat);
6116 __isl_give isl_val *isl_mat_get_element_val(
6117 __isl_keep isl_mat *mat, int row, int col);
6118 __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
6119 int row, int col, int v);
6120 __isl_give isl_mat *isl_mat_set_element_val(
6121 __isl_take isl_mat *mat, int row, int col,
6122 __isl_take isl_val *v);
6124 C<isl_mat_get_element> will return a negative value if anything went wrong.
6125 In that case, the value of C<*v> is undefined.
6127 The following function can be used to compute the (right) inverse
6128 of a matrix, i.e., a matrix such that the product of the original
6129 and the inverse (in that order) is a multiple of the identity matrix.
6130 The input matrix is assumed to be of full row-rank.
6132 __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
6134 The following function can be used to compute the (right) kernel
6135 (or null space) of a matrix, i.e., a matrix such that the product of
6136 the original and the kernel (in that order) is the zero matrix.
6138 __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
6140 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
6142 The following functions determine
6143 an upper or lower bound on a quasipolynomial over its domain.
6145 __isl_give isl_pw_qpolynomial_fold *
6146 isl_pw_qpolynomial_bound(
6147 __isl_take isl_pw_qpolynomial *pwqp,
6148 enum isl_fold type, int *tight);
6150 __isl_give isl_union_pw_qpolynomial_fold *
6151 isl_union_pw_qpolynomial_bound(
6152 __isl_take isl_union_pw_qpolynomial *upwqp,
6153 enum isl_fold type, int *tight);
6155 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
6156 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
6157 is the returned bound is known be tight, i.e., for each value
6158 of the parameters there is at least
6159 one element in the domain that reaches the bound.
6160 If the domain of C<pwqp> is not wrapping, then the bound is computed
6161 over all elements in that domain and the result has a purely parametric
6162 domain. If the domain of C<pwqp> is wrapping, then the bound is
6163 computed over the range of the wrapped relation. The domain of the
6164 wrapped relation becomes the domain of the result.
6166 =head2 Parametric Vertex Enumeration
6168 The parametric vertex enumeration described in this section
6169 is mainly intended to be used internally and by the C<barvinok>
6172 #include <isl/vertices.h>
6173 __isl_give isl_vertices *isl_basic_set_compute_vertices(
6174 __isl_keep isl_basic_set *bset);
6176 The function C<isl_basic_set_compute_vertices> performs the
6177 actual computation of the parametric vertices and the chamber
6178 decomposition and store the result in an C<isl_vertices> object.
6179 This information can be queried by either iterating over all
6180 the vertices or iterating over all the chambers or cells
6181 and then iterating over all vertices that are active on the chamber.
6183 int isl_vertices_foreach_vertex(
6184 __isl_keep isl_vertices *vertices,
6185 int (*fn)(__isl_take isl_vertex *vertex, void *user),
6188 int isl_vertices_foreach_cell(
6189 __isl_keep isl_vertices *vertices,
6190 int (*fn)(__isl_take isl_cell *cell, void *user),
6192 int isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
6193 int (*fn)(__isl_take isl_vertex *vertex, void *user),
6196 Other operations that can be performed on an C<isl_vertices> object are
6199 int isl_vertices_get_n_vertices(
6200 __isl_keep isl_vertices *vertices);
6201 void isl_vertices_free(__isl_take isl_vertices *vertices);
6203 Vertices can be inspected and destroyed using the following functions.
6205 int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
6206 __isl_give isl_basic_set *isl_vertex_get_domain(
6207 __isl_keep isl_vertex *vertex);
6208 __isl_give isl_multi_aff *isl_vertex_get_expr(
6209 __isl_keep isl_vertex *vertex);
6210 void isl_vertex_free(__isl_take isl_vertex *vertex);
6212 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
6213 describing the vertex in terms of the parameters,
6214 while C<isl_vertex_get_domain> returns the activity domain
6217 Chambers can be inspected and destroyed using the following functions.
6219 __isl_give isl_basic_set *isl_cell_get_domain(
6220 __isl_keep isl_cell *cell);
6221 void isl_cell_free(__isl_take isl_cell *cell);
6223 =head1 Polyhedral Compilation Library
6225 This section collects functionality in C<isl> that has been specifically
6226 designed for use during polyhedral compilation.
6228 =head2 Dependence Analysis
6230 C<isl> contains specialized functionality for performing
6231 array dataflow analysis. That is, given a I<sink> access relation
6232 and a collection of possible I<source> access relations,
6233 C<isl> can compute relations that describe
6234 for each iteration of the sink access, which iteration
6235 of which of the source access relations was the last
6236 to access the same data element before the given iteration
6238 The resulting dependence relations map source iterations
6239 to the corresponding sink iterations.
6240 To compute standard flow dependences, the sink should be
6241 a read, while the sources should be writes.
6242 If any of the source accesses are marked as being I<may>
6243 accesses, then there will be a dependence from the last
6244 I<must> access B<and> from any I<may> access that follows
6245 this last I<must> access.
6246 In particular, if I<all> sources are I<may> accesses,
6247 then memory based dependence analysis is performed.
6248 If, on the other hand, all sources are I<must> accesses,
6249 then value based dependence analysis is performed.
6251 #include <isl/flow.h>
6253 typedef int (*isl_access_level_before)(void *first, void *second);
6255 __isl_give isl_access_info *isl_access_info_alloc(
6256 __isl_take isl_map *sink,
6257 void *sink_user, isl_access_level_before fn,
6259 __isl_give isl_access_info *isl_access_info_add_source(
6260 __isl_take isl_access_info *acc,
6261 __isl_take isl_map *source, int must,
6263 __isl_null isl_access_info *isl_access_info_free(
6264 __isl_take isl_access_info *acc);
6266 __isl_give isl_flow *isl_access_info_compute_flow(
6267 __isl_take isl_access_info *acc);
6269 int isl_flow_foreach(__isl_keep isl_flow *deps,
6270 int (*fn)(__isl_take isl_map *dep, int must,
6271 void *dep_user, void *user),
6273 __isl_give isl_map *isl_flow_get_no_source(
6274 __isl_keep isl_flow *deps, int must);
6275 void isl_flow_free(__isl_take isl_flow *deps);
6277 The function C<isl_access_info_compute_flow> performs the actual
6278 dependence analysis. The other functions are used to construct
6279 the input for this function or to read off the output.
6281 The input is collected in an C<isl_access_info>, which can
6282 be created through a call to C<isl_access_info_alloc>.
6283 The arguments to this functions are the sink access relation
6284 C<sink>, a token C<sink_user> used to identify the sink
6285 access to the user, a callback function for specifying the
6286 relative order of source and sink accesses, and the number
6287 of source access relations that will be added.
6288 The callback function has type C<int (*)(void *first, void *second)>.
6289 The function is called with two user supplied tokens identifying
6290 either a source or the sink and it should return the shared nesting
6291 level and the relative order of the two accesses.
6292 In particular, let I<n> be the number of loops shared by
6293 the two accesses. If C<first> precedes C<second> textually,
6294 then the function should return I<2 * n + 1>; otherwise,
6295 it should return I<2 * n>.
6296 The sources can be added to the C<isl_access_info> by performing
6297 (at most) C<max_source> calls to C<isl_access_info_add_source>.
6298 C<must> indicates whether the source is a I<must> access
6299 or a I<may> access. Note that a multi-valued access relation
6300 should only be marked I<must> if every iteration in the domain
6301 of the relation accesses I<all> elements in its image.
6302 The C<source_user> token is again used to identify
6303 the source access. The range of the source access relation
6304 C<source> should have the same dimension as the range
6305 of the sink access relation.
6306 The C<isl_access_info_free> function should usually not be
6307 called explicitly, because it is called implicitly by
6308 C<isl_access_info_compute_flow>.
6310 The result of the dependence analysis is collected in an
6311 C<isl_flow>. There may be elements of
6312 the sink access for which no preceding source access could be
6313 found or for which all preceding sources are I<may> accesses.
6314 The relations containing these elements can be obtained through
6315 calls to C<isl_flow_get_no_source>, the first with C<must> set
6316 and the second with C<must> unset.
6317 In the case of standard flow dependence analysis,
6318 with the sink a read and the sources I<must> writes,
6319 the first relation corresponds to the reads from uninitialized
6320 array elements and the second relation is empty.
6321 The actual flow dependences can be extracted using
6322 C<isl_flow_foreach>. This function will call the user-specified
6323 callback function C<fn> for each B<non-empty> dependence between
6324 a source and the sink. The callback function is called
6325 with four arguments, the actual flow dependence relation
6326 mapping source iterations to sink iterations, a boolean that
6327 indicates whether it is a I<must> or I<may> dependence, a token
6328 identifying the source and an additional C<void *> with value
6329 equal to the third argument of the C<isl_flow_foreach> call.
6330 A dependence is marked I<must> if it originates from a I<must>
6331 source and if it is not followed by any I<may> sources.
6333 After finishing with an C<isl_flow>, the user should call
6334 C<isl_flow_free> to free all associated memory.
6336 A higher-level interface to dependence analysis is provided
6337 by the following function.
6339 #include <isl/flow.h>
6341 int isl_union_map_compute_flow(__isl_take isl_union_map *sink,
6342 __isl_take isl_union_map *must_source,
6343 __isl_take isl_union_map *may_source,
6344 __isl_take isl_union_map *schedule,
6345 __isl_give isl_union_map **must_dep,
6346 __isl_give isl_union_map **may_dep,
6347 __isl_give isl_union_map **must_no_source,
6348 __isl_give isl_union_map **may_no_source);
6350 The arrays are identified by the tuple names of the ranges
6351 of the accesses. The iteration domains by the tuple names
6352 of the domains of the accesses and of the schedule.
6353 The relative order of the iteration domains is given by the
6354 schedule. The relations returned through C<must_no_source>
6355 and C<may_no_source> are subsets of C<sink>.
6356 Any of C<must_dep>, C<may_dep>, C<must_no_source>
6357 or C<may_no_source> may be C<NULL>, but a C<NULL> value for
6358 any of the other arguments is treated as an error.
6360 =head3 Interaction with Dependence Analysis
6362 During the dependence analysis, we frequently need to perform
6363 the following operation. Given a relation between sink iterations
6364 and potential source iterations from a particular source domain,
6365 what is the last potential source iteration corresponding to each
6366 sink iteration. It can sometimes be convenient to adjust
6367 the set of potential source iterations before or after each such operation.
6368 The prototypical example is fuzzy array dataflow analysis,
6369 where we need to analyze if, based on data-dependent constraints,
6370 the sink iteration can ever be executed without one or more of
6371 the corresponding potential source iterations being executed.
6372 If so, we can introduce extra parameters and select an unknown
6373 but fixed source iteration from the potential source iterations.
6374 To be able to perform such manipulations, C<isl> provides the following
6377 #include <isl/flow.h>
6379 typedef __isl_give isl_restriction *(*isl_access_restrict)(
6380 __isl_keep isl_map *source_map,
6381 __isl_keep isl_set *sink, void *source_user,
6383 __isl_give isl_access_info *isl_access_info_set_restrict(
6384 __isl_take isl_access_info *acc,
6385 isl_access_restrict fn, void *user);
6387 The function C<isl_access_info_set_restrict> should be called
6388 before calling C<isl_access_info_compute_flow> and registers a callback function
6389 that will be called any time C<isl> is about to compute the last
6390 potential source. The first argument is the (reverse) proto-dependence,
6391 mapping sink iterations to potential source iterations.
6392 The second argument represents the sink iterations for which
6393 we want to compute the last source iteration.
6394 The third argument is the token corresponding to the source
6395 and the final argument is the token passed to C<isl_access_info_set_restrict>.
6396 The callback is expected to return a restriction on either the input or
6397 the output of the operation computing the last potential source.
6398 If the input needs to be restricted then restrictions are needed
6399 for both the source and the sink iterations. The sink iterations
6400 and the potential source iterations will be intersected with these sets.
6401 If the output needs to be restricted then only a restriction on the source
6402 iterations is required.
6403 If any error occurs, the callback should return C<NULL>.
6404 An C<isl_restriction> object can be created, freed and inspected
6405 using the following functions.
6407 #include <isl/flow.h>
6409 __isl_give isl_restriction *isl_restriction_input(
6410 __isl_take isl_set *source_restr,
6411 __isl_take isl_set *sink_restr);
6412 __isl_give isl_restriction *isl_restriction_output(
6413 __isl_take isl_set *source_restr);
6414 __isl_give isl_restriction *isl_restriction_none(
6415 __isl_take isl_map *source_map);
6416 __isl_give isl_restriction *isl_restriction_empty(
6417 __isl_take isl_map *source_map);
6418 __isl_null isl_restriction *isl_restriction_free(
6419 __isl_take isl_restriction *restr);
6421 C<isl_restriction_none> and C<isl_restriction_empty> are special
6422 cases of C<isl_restriction_input>. C<isl_restriction_none>
6423 is essentially equivalent to
6425 isl_restriction_input(isl_set_universe(
6426 isl_space_range(isl_map_get_space(source_map))),
6428 isl_space_domain(isl_map_get_space(source_map))));
6430 whereas C<isl_restriction_empty> is essentially equivalent to
6432 isl_restriction_input(isl_set_empty(
6433 isl_space_range(isl_map_get_space(source_map))),
6435 isl_space_domain(isl_map_get_space(source_map))));
6439 B<The functionality described in this section is fairly new
6440 and may be subject to change.>
6442 #include <isl/schedule.h>
6443 __isl_give isl_schedule *
6444 isl_schedule_constraints_compute_schedule(
6445 __isl_take isl_schedule_constraints *sc);
6446 __isl_null isl_schedule *isl_schedule_free(
6447 __isl_take isl_schedule *sched);
6449 The function C<isl_schedule_constraints_compute_schedule> can be
6450 used to compute a schedule that satisfies the given schedule constraints.
6451 These schedule constraints include the iteration domain for which
6452 a schedule should be computed and dependences between pairs of
6453 iterations. In particular, these dependences include
6454 I<validity> dependences and I<proximity> dependences.
6455 By default, the algorithm used to construct the schedule is similar
6456 to that of C<Pluto>.
6457 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
6459 The generated schedule respects all validity dependences.
6460 That is, all dependence distances over these dependences in the
6461 scheduled space are lexicographically positive.
6462 The default algorithm tries to ensure that the dependence distances
6463 over coincidence constraints are zero and to minimize the
6464 dependence distances over proximity dependences.
6465 Moreover, it tries to obtain sequences (bands) of schedule dimensions
6466 for groups of domains where the dependence distances over validity
6467 dependences have only non-negative values.
6468 When using Feautrier's algorithm, the coincidence and proximity constraints
6469 are only taken into account during the extension to a
6470 full-dimensional schedule.
6472 An C<isl_schedule_constraints> object can be constructed
6473 and manipulated using the following functions.
6475 #include <isl/schedule.h>
6476 __isl_give isl_schedule_constraints *
6477 isl_schedule_constraints_copy(
6478 __isl_keep isl_schedule_constraints *sc);
6479 __isl_give isl_schedule_constraints *
6480 isl_schedule_constraints_on_domain(
6481 __isl_take isl_union_set *domain);
6482 __isl_give isl_schedule_constraints *
6483 isl_schedule_constraints_set_validity(
6484 __isl_take isl_schedule_constraints *sc,
6485 __isl_take isl_union_map *validity);
6486 __isl_give isl_schedule_constraints *
6487 isl_schedule_constraints_set_coincidence(
6488 __isl_take isl_schedule_constraints *sc,
6489 __isl_take isl_union_map *coincidence);
6490 __isl_give isl_schedule_constraints *
6491 isl_schedule_constraints_set_proximity(
6492 __isl_take isl_schedule_constraints *sc,
6493 __isl_take isl_union_map *proximity);
6494 __isl_give isl_schedule_constraints *
6495 isl_schedule_constraints_set_conditional_validity(
6496 __isl_take isl_schedule_constraints *sc,
6497 __isl_take isl_union_map *condition,
6498 __isl_take isl_union_map *validity);
6499 __isl_null isl_schedule_constraints *
6500 isl_schedule_constraints_free(
6501 __isl_take isl_schedule_constraints *sc);
6503 The initial C<isl_schedule_constraints> object created by
6504 C<isl_schedule_constraints_on_domain> does not impose any constraints.
6505 That is, it has an empty set of dependences.
6506 The function C<isl_schedule_constraints_set_validity> replaces the
6507 validity dependences, mapping domain elements I<i> to domain
6508 elements that should be scheduled after I<i>.
6509 The function C<isl_schedule_constraints_set_coincidence> replaces the
6510 coincidence dependences, mapping domain elements I<i> to domain
6511 elements that should be scheduled together with I<I>, if possible.
6512 The function C<isl_schedule_constraints_set_proximity> replaces the
6513 proximity dependences, mapping domain elements I<i> to domain
6514 elements that should be scheduled either before I<I>
6515 or as early as possible after I<i>.
6517 The function C<isl_schedule_constraints_set_conditional_validity>
6518 replaces the conditional validity constraints.
6519 A conditional validity constraint is only imposed when any of the corresponding
6520 conditions is satisfied, i.e., when any of them is non-zero.
6521 That is, the scheduler ensures that within each band if the dependence
6522 distances over the condition constraints are not all zero
6523 then all corresponding conditional validity constraints are respected.
6524 A conditional validity constraint corresponds to a condition
6525 if the two are adjacent, i.e., if the domain of one relation intersect
6526 the range of the other relation.
6527 The typical use case of conditional validity constraints is
6528 to allow order constraints between live ranges to be violated
6529 as long as the live ranges themselves are local to the band.
6530 To allow more fine-grained control over which conditions correspond
6531 to which conditional validity constraints, the domains and ranges
6532 of these relations may include I<tags>. That is, the domains and
6533 ranges of those relation may themselves be wrapped relations
6534 where the iteration domain appears in the domain of those wrapped relations
6535 and the range of the wrapped relations can be arbitrarily chosen
6536 by the user. Conditions and conditional validity constraints are only
6537 considered adjacent to each other if the entire wrapped relation matches.
6538 In particular, a relation with a tag will never be considered adjacent
6539 to a relation without a tag.
6541 The following function computes a schedule directly from
6542 an iteration domain and validity and proximity dependences
6543 and is implemented in terms of the functions described above.
6544 The use of C<isl_union_set_compute_schedule> is discouraged.
6546 #include <isl/schedule.h>
6547 __isl_give isl_schedule *isl_union_set_compute_schedule(
6548 __isl_take isl_union_set *domain,
6549 __isl_take isl_union_map *validity,
6550 __isl_take isl_union_map *proximity);
6552 A mapping from the domains to the scheduled space can be obtained
6553 from an C<isl_schedule> using the following function.
6555 __isl_give isl_union_map *isl_schedule_get_map(
6556 __isl_keep isl_schedule *sched);
6558 A representation of the schedule can be printed using
6560 __isl_give isl_printer *isl_printer_print_schedule(
6561 __isl_take isl_printer *p,
6562 __isl_keep isl_schedule *schedule);
6564 A representation of the schedule as a forest of bands can be obtained
6565 using the following function.
6567 __isl_give isl_band_list *isl_schedule_get_band_forest(
6568 __isl_keep isl_schedule *schedule);
6570 The individual bands can be visited in depth-first post-order
6571 using the following function.
6573 #include <isl/schedule.h>
6574 int isl_schedule_foreach_band(
6575 __isl_keep isl_schedule *sched,
6576 int (*fn)(__isl_keep isl_band *band, void *user),
6579 The list can be manipulated as explained in L<"Lists">.
6580 The bands inside the list can be copied and freed using the following
6583 #include <isl/band.h>
6584 __isl_give isl_band *isl_band_copy(
6585 __isl_keep isl_band *band);
6586 __isl_null isl_band *isl_band_free(
6587 __isl_take isl_band *band);
6589 Each band contains zero or more scheduling dimensions.
6590 These are referred to as the members of the band.
6591 The section of the schedule that corresponds to the band is
6592 referred to as the partial schedule of the band.
6593 For those nodes that participate in a band, the outer scheduling
6594 dimensions form the prefix schedule, while the inner scheduling
6595 dimensions form the suffix schedule.
6596 That is, if we take a cut of the band forest, then the union of
6597 the concatenations of the prefix, partial and suffix schedules of
6598 each band in the cut is equal to the entire schedule (modulo
6599 some possible padding at the end with zero scheduling dimensions).
6600 The properties of a band can be inspected using the following functions.
6602 #include <isl/band.h>
6603 int isl_band_has_children(__isl_keep isl_band *band);
6604 __isl_give isl_band_list *isl_band_get_children(
6605 __isl_keep isl_band *band);
6607 __isl_give isl_union_map *isl_band_get_prefix_schedule(
6608 __isl_keep isl_band *band);
6609 __isl_give isl_union_map *isl_band_get_partial_schedule(
6610 __isl_keep isl_band *band);
6611 __isl_give isl_union_map *isl_band_get_suffix_schedule(
6612 __isl_keep isl_band *band);
6614 int isl_band_n_member(__isl_keep isl_band *band);
6615 int isl_band_member_is_coincident(
6616 __isl_keep isl_band *band, int pos);
6618 int isl_band_list_foreach_band(
6619 __isl_keep isl_band_list *list,
6620 int (*fn)(__isl_keep isl_band *band, void *user),
6623 Note that a scheduling dimension is considered to be ``coincident''
6624 if it satisfies the coincidence constraints within its band.
6625 That is, if the dependence distances of the coincidence
6626 constraints are all zero in that direction (for fixed
6627 iterations of outer bands).
6628 Like C<isl_schedule_foreach_band>,
6629 the function C<isl_band_list_foreach_band> calls C<fn> on the bands
6630 in depth-first post-order.
6632 A band can be tiled using the following function.
6634 #include <isl/band.h>
6635 int isl_band_tile(__isl_keep isl_band *band,
6636 __isl_take isl_vec *sizes);
6638 int isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
6640 int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
6641 int isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
6643 int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
6645 The C<isl_band_tile> function tiles the band using the given tile sizes
6646 inside its schedule.
6647 A new child band is created to represent the point loops and it is
6648 inserted between the modified band and its children.
6649 The C<tile_scale_tile_loops> option specifies whether the tile
6650 loops iterators should be scaled by the tile sizes.
6651 If the C<tile_shift_point_loops> option is set, then the point loops
6652 are shifted to start at zero.
6654 A band can be split into two nested bands using the following function.
6656 int isl_band_split(__isl_keep isl_band *band, int pos);
6658 The resulting outer band contains the first C<pos> dimensions of C<band>
6659 while the inner band contains the remaining dimensions.
6661 A representation of the band can be printed using
6663 #include <isl/band.h>
6664 __isl_give isl_printer *isl_printer_print_band(
6665 __isl_take isl_printer *p,
6666 __isl_keep isl_band *band);
6670 #include <isl/schedule.h>
6671 int isl_options_set_schedule_max_coefficient(
6672 isl_ctx *ctx, int val);
6673 int isl_options_get_schedule_max_coefficient(
6675 int isl_options_set_schedule_max_constant_term(
6676 isl_ctx *ctx, int val);
6677 int isl_options_get_schedule_max_constant_term(
6679 int isl_options_set_schedule_fuse(isl_ctx *ctx, int val);
6680 int isl_options_get_schedule_fuse(isl_ctx *ctx);
6681 int isl_options_set_schedule_maximize_band_depth(
6682 isl_ctx *ctx, int val);
6683 int isl_options_get_schedule_maximize_band_depth(
6685 int isl_options_set_schedule_outer_coincidence(
6686 isl_ctx *ctx, int val);
6687 int isl_options_get_schedule_outer_coincidence(
6689 int isl_options_set_schedule_split_scaled(
6690 isl_ctx *ctx, int val);
6691 int isl_options_get_schedule_split_scaled(
6693 int isl_options_set_schedule_algorithm(
6694 isl_ctx *ctx, int val);
6695 int isl_options_get_schedule_algorithm(
6697 int isl_options_set_schedule_separate_components(
6698 isl_ctx *ctx, int val);
6699 int isl_options_get_schedule_separate_components(
6704 =item * schedule_max_coefficient
6706 This option enforces that the coefficients for variable and parameter
6707 dimensions in the calculated schedule are not larger than the specified value.
6708 This option can significantly increase the speed of the scheduling calculation
6709 and may also prevent fusing of unrelated dimensions. A value of -1 means that
6710 this option does not introduce bounds on the variable or parameter
6713 =item * schedule_max_constant_term
6715 This option enforces that the constant coefficients in the calculated schedule
6716 are not larger than the maximal constant term. This option can significantly
6717 increase the speed of the scheduling calculation and may also prevent fusing of
6718 unrelated dimensions. A value of -1 means that this option does not introduce
6719 bounds on the constant coefficients.
6721 =item * schedule_fuse
6723 This option controls the level of fusion.
6724 If this option is set to C<ISL_SCHEDULE_FUSE_MIN>, then loops in the
6725 resulting schedule will be distributed as much as possible.
6726 If this option is set to C<ISL_SCHEDULE_FUSE_MAX>, then C<isl> will
6727 try to fuse loops in the resulting schedule.
6729 =item * schedule_maximize_band_depth
6731 If this option is set, we do not split bands at the point
6732 where we detect splitting is necessary. Instead, we
6733 backtrack and split bands as early as possible. This
6734 reduces the number of splits and maximizes the width of
6735 the bands. Wider bands give more possibilities for tiling.
6736 Note that if the C<schedule_fuse> option is set to C<ISL_SCHEDULE_FUSE_MIN>,
6737 then bands will be split as early as possible, even if there is no need.
6738 The C<schedule_maximize_band_depth> option therefore has no effect in this case.
6740 =item * schedule_outer_coincidence
6742 If this option is set, then we try to construct schedules
6743 where the outermost scheduling dimension in each band
6744 satisfies the coincidence constraints.
6746 =item * schedule_split_scaled
6748 If this option is set, then we try to construct schedules in which the
6749 constant term is split off from the linear part if the linear parts of
6750 the scheduling rows for all nodes in the graphs have a common non-trivial
6752 The constant term is then placed in a separate band and the linear
6755 =item * schedule_algorithm
6757 Selects the scheduling algorithm to be used.
6758 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
6759 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
6761 =item * schedule_separate_components
6763 If at any point the dependence graph contains any (weakly connected) components,
6764 then these components are scheduled separately.
6765 If this option is not set, then some iterations of the domains
6766 in these components may be scheduled together.
6767 If this option is set, then the components are given consecutive
6772 =head2 AST Generation
6774 This section describes the C<isl> functionality for generating
6775 ASTs that visit all the elements
6776 in a domain in an order specified by a schedule.
6777 In particular, given a C<isl_union_map>, an AST is generated
6778 that visits all the elements in the domain of the C<isl_union_map>
6779 according to the lexicographic order of the corresponding image
6780 element(s). If the range of the C<isl_union_map> consists of
6781 elements in more than one space, then each of these spaces is handled
6782 separately in an arbitrary order.
6783 It should be noted that the image elements only specify the I<order>
6784 in which the corresponding domain elements should be visited.
6785 No direct relation between the image elements and the loop iterators
6786 in the generated AST should be assumed.
6788 Each AST is generated within a build. The initial build
6789 simply specifies the constraints on the parameters (if any)
6790 and can be created, inspected, copied and freed using the following functions.
6792 #include <isl/ast_build.h>
6793 __isl_give isl_ast_build *isl_ast_build_from_context(
6794 __isl_take isl_set *set);
6795 __isl_give isl_ast_build *isl_ast_build_copy(
6796 __isl_keep isl_ast_build *build);
6797 __isl_null isl_ast_build *isl_ast_build_free(
6798 __isl_take isl_ast_build *build);
6800 The C<set> argument is usually a parameter set with zero or more parameters.
6801 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
6802 and L</"Fine-grained Control over AST Generation">.
6803 Finally, the AST itself can be constructed using the following
6806 #include <isl/ast_build.h>
6807 __isl_give isl_ast_node *isl_ast_build_ast_from_schedule(
6808 __isl_keep isl_ast_build *build,
6809 __isl_take isl_union_map *schedule);
6811 =head3 Inspecting the AST
6813 The basic properties of an AST node can be obtained as follows.
6815 #include <isl/ast.h>
6816 enum isl_ast_node_type isl_ast_node_get_type(
6817 __isl_keep isl_ast_node *node);
6819 The type of an AST node is one of
6820 C<isl_ast_node_for>,
6822 C<isl_ast_node_block> or
6823 C<isl_ast_node_user>.
6824 An C<isl_ast_node_for> represents a for node.
6825 An C<isl_ast_node_if> represents an if node.
6826 An C<isl_ast_node_block> represents a compound node.
6827 An C<isl_ast_node_user> represents an expression statement.
6828 An expression statement typically corresponds to a domain element, i.e.,
6829 one of the elements that is visited by the AST.
6831 Each type of node has its own additional properties.
6833 #include <isl/ast.h>
6834 __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
6835 __isl_keep isl_ast_node *node);
6836 __isl_give isl_ast_expr *isl_ast_node_for_get_init(
6837 __isl_keep isl_ast_node *node);
6838 __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
6839 __isl_keep isl_ast_node *node);
6840 __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
6841 __isl_keep isl_ast_node *node);
6842 __isl_give isl_ast_node *isl_ast_node_for_get_body(
6843 __isl_keep isl_ast_node *node);
6844 int isl_ast_node_for_is_degenerate(
6845 __isl_keep isl_ast_node *node);
6847 An C<isl_ast_for> is considered degenerate if it is known to execute
6850 #include <isl/ast.h>
6851 __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
6852 __isl_keep isl_ast_node *node);
6853 __isl_give isl_ast_node *isl_ast_node_if_get_then(
6854 __isl_keep isl_ast_node *node);
6855 int isl_ast_node_if_has_else(
6856 __isl_keep isl_ast_node *node);
6857 __isl_give isl_ast_node *isl_ast_node_if_get_else(
6858 __isl_keep isl_ast_node *node);
6860 __isl_give isl_ast_node_list *
6861 isl_ast_node_block_get_children(
6862 __isl_keep isl_ast_node *node);
6864 __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
6865 __isl_keep isl_ast_node *node);
6867 Each of the returned C<isl_ast_expr>s can in turn be inspected using
6868 the following functions.
6870 #include <isl/ast.h>
6871 enum isl_ast_expr_type isl_ast_expr_get_type(
6872 __isl_keep isl_ast_expr *expr);
6874 The type of an AST expression is one of
6876 C<isl_ast_expr_id> or
6877 C<isl_ast_expr_int>.
6878 An C<isl_ast_expr_op> represents the result of an operation.
6879 An C<isl_ast_expr_id> represents an identifier.
6880 An C<isl_ast_expr_int> represents an integer value.
6882 Each type of expression has its own additional properties.
6884 #include <isl/ast.h>
6885 enum isl_ast_op_type isl_ast_expr_get_op_type(
6886 __isl_keep isl_ast_expr *expr);
6887 int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
6888 __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
6889 __isl_keep isl_ast_expr *expr, int pos);
6890 int isl_ast_node_foreach_ast_op_type(
6891 __isl_keep isl_ast_node *node,
6892 int (*fn)(enum isl_ast_op_type type, void *user),
6895 C<isl_ast_expr_get_op_type> returns the type of the operation
6896 performed. C<isl_ast_expr_get_op_n_arg> returns the number of
6897 arguments. C<isl_ast_expr_get_op_arg> returns the specified
6899 C<isl_ast_node_foreach_ast_op_type> calls C<fn> for each distinct
6900 C<isl_ast_op_type> that appears in C<node>.
6901 The operation type is one of the following.
6905 =item C<isl_ast_op_and>
6907 Logical I<and> of two arguments.
6908 Both arguments can be evaluated.
6910 =item C<isl_ast_op_and_then>
6912 Logical I<and> of two arguments.
6913 The second argument can only be evaluated if the first evaluates to true.
6915 =item C<isl_ast_op_or>
6917 Logical I<or> of two arguments.
6918 Both arguments can be evaluated.
6920 =item C<isl_ast_op_or_else>
6922 Logical I<or> of two arguments.
6923 The second argument can only be evaluated if the first evaluates to false.
6925 =item C<isl_ast_op_max>
6927 Maximum of two or more arguments.
6929 =item C<isl_ast_op_min>
6931 Minimum of two or more arguments.
6933 =item C<isl_ast_op_minus>
6937 =item C<isl_ast_op_add>
6939 Sum of two arguments.
6941 =item C<isl_ast_op_sub>
6943 Difference of two arguments.
6945 =item C<isl_ast_op_mul>
6947 Product of two arguments.
6949 =item C<isl_ast_op_div>
6951 Exact division. That is, the result is known to be an integer.
6953 =item C<isl_ast_op_fdiv_q>
6955 Result of integer division, rounded towards negative
6958 =item C<isl_ast_op_pdiv_q>
6960 Result of integer division, where dividend is known to be non-negative.
6962 =item C<isl_ast_op_pdiv_r>
6964 Remainder of integer division, where dividend is known to be non-negative.
6966 =item C<isl_ast_op_zdiv_r>
6968 Equal to zero iff the remainder on integer division is zero.
6970 =item C<isl_ast_op_cond>
6972 Conditional operator defined on three arguments.
6973 If the first argument evaluates to true, then the result
6974 is equal to the second argument. Otherwise, the result
6975 is equal to the third argument.
6976 The second and third argument may only be evaluated if
6977 the first argument evaluates to true and false, respectively.
6978 Corresponds to C<a ? b : c> in C.
6980 =item C<isl_ast_op_select>
6982 Conditional operator defined on three arguments.
6983 If the first argument evaluates to true, then the result
6984 is equal to the second argument. Otherwise, the result
6985 is equal to the third argument.
6986 The second and third argument may be evaluated independently
6987 of the value of the first argument.
6988 Corresponds to C<a * b + (1 - a) * c> in C.
6990 =item C<isl_ast_op_eq>
6994 =item C<isl_ast_op_le>
6996 Less than or equal relation.
6998 =item C<isl_ast_op_lt>
7002 =item C<isl_ast_op_ge>
7004 Greater than or equal relation.
7006 =item C<isl_ast_op_gt>
7008 Greater than relation.
7010 =item C<isl_ast_op_call>
7013 The number of arguments of the C<isl_ast_expr> is one more than
7014 the number of arguments in the function call, the first argument
7015 representing the function being called.
7017 =item C<isl_ast_op_access>
7020 The number of arguments of the C<isl_ast_expr> is one more than
7021 the number of index expressions in the array access, the first argument
7022 representing the array being accessed.
7024 =item C<isl_ast_op_member>
7027 This operation has two arguments, a structure and the name of
7028 the member of the structure being accessed.
7032 #include <isl/ast.h>
7033 __isl_give isl_id *isl_ast_expr_get_id(
7034 __isl_keep isl_ast_expr *expr);
7036 Return the identifier represented by the AST expression.
7038 #include <isl/ast.h>
7039 __isl_give isl_val *isl_ast_expr_get_val(
7040 __isl_keep isl_ast_expr *expr);
7042 Return the integer represented by the AST expression.
7044 =head3 Properties of ASTs
7046 #include <isl/ast.h>
7047 int isl_ast_expr_is_equal(__isl_keep isl_ast_expr *expr1,
7048 __isl_keep isl_ast_expr *expr2);
7050 Check if two C<isl_ast_expr>s are equal to each other.
7052 =head3 Manipulating and printing the AST
7054 AST nodes can be copied and freed using the following functions.
7056 #include <isl/ast.h>
7057 __isl_give isl_ast_node *isl_ast_node_copy(
7058 __isl_keep isl_ast_node *node);
7059 __isl_null isl_ast_node *isl_ast_node_free(
7060 __isl_take isl_ast_node *node);
7062 AST expressions can be copied and freed using the following functions.
7064 #include <isl/ast.h>
7065 __isl_give isl_ast_expr *isl_ast_expr_copy(
7066 __isl_keep isl_ast_expr *expr);
7067 __isl_null isl_ast_expr *isl_ast_expr_free(
7068 __isl_take isl_ast_expr *expr);
7070 New AST expressions can be created either directly or within
7071 the context of an C<isl_ast_build>.
7073 #include <isl/ast.h>
7074 __isl_give isl_ast_expr *isl_ast_expr_from_val(
7075 __isl_take isl_val *v);
7076 __isl_give isl_ast_expr *isl_ast_expr_from_id(
7077 __isl_take isl_id *id);
7078 __isl_give isl_ast_expr *isl_ast_expr_neg(
7079 __isl_take isl_ast_expr *expr);
7080 __isl_give isl_ast_expr *isl_ast_expr_address_of(
7081 __isl_take isl_ast_expr *expr);
7082 __isl_give isl_ast_expr *isl_ast_expr_add(
7083 __isl_take isl_ast_expr *expr1,
7084 __isl_take isl_ast_expr *expr2);
7085 __isl_give isl_ast_expr *isl_ast_expr_sub(
7086 __isl_take isl_ast_expr *expr1,
7087 __isl_take isl_ast_expr *expr2);
7088 __isl_give isl_ast_expr *isl_ast_expr_mul(
7089 __isl_take isl_ast_expr *expr1,
7090 __isl_take isl_ast_expr *expr2);
7091 __isl_give isl_ast_expr *isl_ast_expr_div(
7092 __isl_take isl_ast_expr *expr1,
7093 __isl_take isl_ast_expr *expr2);
7094 __isl_give isl_ast_expr *isl_ast_expr_and(
7095 __isl_take isl_ast_expr *expr1,
7096 __isl_take isl_ast_expr *expr2)
7097 __isl_give isl_ast_expr *isl_ast_expr_or(
7098 __isl_take isl_ast_expr *expr1,
7099 __isl_take isl_ast_expr *expr2)
7100 __isl_give isl_ast_expr *isl_ast_expr_eq(
7101 __isl_take isl_ast_expr *expr1,
7102 __isl_take isl_ast_expr *expr2);
7103 __isl_give isl_ast_expr *isl_ast_expr_le(
7104 __isl_take isl_ast_expr *expr1,
7105 __isl_take isl_ast_expr *expr2);
7106 __isl_give isl_ast_expr *isl_ast_expr_lt(
7107 __isl_take isl_ast_expr *expr1,
7108 __isl_take isl_ast_expr *expr2);
7109 __isl_give isl_ast_expr *isl_ast_expr_ge(
7110 __isl_take isl_ast_expr *expr1,
7111 __isl_take isl_ast_expr *expr2);
7112 __isl_give isl_ast_expr *isl_ast_expr_gt(
7113 __isl_take isl_ast_expr *expr1,
7114 __isl_take isl_ast_expr *expr2);
7115 __isl_give isl_ast_expr *isl_ast_expr_access(
7116 __isl_take isl_ast_expr *array,
7117 __isl_take isl_ast_expr_list *indices);
7119 The function C<isl_ast_expr_address_of> can be applied to an
7120 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
7121 to represent the address of the C<isl_ast_expr_access>.
7123 #include <isl/ast_build.h>
7124 __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
7125 __isl_keep isl_ast_build *build,
7126 __isl_take isl_pw_aff *pa);
7127 __isl_give isl_ast_expr *
7128 isl_ast_build_access_from_pw_multi_aff(
7129 __isl_keep isl_ast_build *build,
7130 __isl_take isl_pw_multi_aff *pma);
7131 __isl_give isl_ast_expr *
7132 isl_ast_build_access_from_multi_pw_aff(
7133 __isl_keep isl_ast_build *build,
7134 __isl_take isl_multi_pw_aff *mpa);
7135 __isl_give isl_ast_expr *
7136 isl_ast_build_call_from_pw_multi_aff(
7137 __isl_keep isl_ast_build *build,
7138 __isl_take isl_pw_multi_aff *pma);
7139 __isl_give isl_ast_expr *
7140 isl_ast_build_call_from_multi_pw_aff(
7141 __isl_keep isl_ast_build *build,
7142 __isl_take isl_multi_pw_aff *mpa);
7144 The domains of C<pa>, C<mpa> and C<pma> should correspond
7145 to the schedule space of C<build>.
7146 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
7147 the function being called.
7148 If the accessed space is a nested relation, then it is taken
7149 to represent an access of the member specified by the range
7150 of this nested relation of the structure specified by the domain
7151 of the nested relation.
7153 The following functions can be used to modify an C<isl_ast_expr>.
7155 #include <isl/ast.h>
7156 __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
7157 __isl_take isl_ast_expr *expr, int pos,
7158 __isl_take isl_ast_expr *arg);
7160 Replace the argument of C<expr> at position C<pos> by C<arg>.
7162 #include <isl/ast.h>
7163 __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
7164 __isl_take isl_ast_expr *expr,
7165 __isl_take isl_id_to_ast_expr *id2expr);
7167 The function C<isl_ast_expr_substitute_ids> replaces the
7168 subexpressions of C<expr> of type C<isl_ast_expr_id>
7169 by the corresponding expression in C<id2expr>, if there is any.
7172 User specified data can be attached to an C<isl_ast_node> and obtained
7173 from the same C<isl_ast_node> using the following functions.
7175 #include <isl/ast.h>
7176 __isl_give isl_ast_node *isl_ast_node_set_annotation(
7177 __isl_take isl_ast_node *node,
7178 __isl_take isl_id *annotation);
7179 __isl_give isl_id *isl_ast_node_get_annotation(
7180 __isl_keep isl_ast_node *node);
7182 Basic printing can be performed using the following functions.
7184 #include <isl/ast.h>
7185 __isl_give isl_printer *isl_printer_print_ast_expr(
7186 __isl_take isl_printer *p,
7187 __isl_keep isl_ast_expr *expr);
7188 __isl_give isl_printer *isl_printer_print_ast_node(
7189 __isl_take isl_printer *p,
7190 __isl_keep isl_ast_node *node);
7191 __isl_give char *isl_ast_expr_to_str(
7192 __isl_keep isl_ast_expr *expr);
7194 More advanced printing can be performed using the following functions.
7196 #include <isl/ast.h>
7197 __isl_give isl_printer *isl_ast_op_type_print_macro(
7198 enum isl_ast_op_type type,
7199 __isl_take isl_printer *p);
7200 __isl_give isl_printer *isl_ast_node_print_macros(
7201 __isl_keep isl_ast_node *node,
7202 __isl_take isl_printer *p);
7203 __isl_give isl_printer *isl_ast_node_print(
7204 __isl_keep isl_ast_node *node,
7205 __isl_take isl_printer *p,
7206 __isl_take isl_ast_print_options *options);
7207 __isl_give isl_printer *isl_ast_node_for_print(
7208 __isl_keep isl_ast_node *node,
7209 __isl_take isl_printer *p,
7210 __isl_take isl_ast_print_options *options);
7211 __isl_give isl_printer *isl_ast_node_if_print(
7212 __isl_keep isl_ast_node *node,
7213 __isl_take isl_printer *p,
7214 __isl_take isl_ast_print_options *options);
7216 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
7217 C<isl> may print out an AST that makes use of macros such
7218 as C<floord>, C<min> and C<max>.
7219 C<isl_ast_op_type_print_macro> prints out the macro
7220 corresponding to a specific C<isl_ast_op_type>.
7221 C<isl_ast_node_print_macros> scans the C<isl_ast_node>
7222 for expressions where these macros would be used and prints
7223 out the required macro definitions.
7224 Essentially, C<isl_ast_node_print_macros> calls
7225 C<isl_ast_node_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
7226 as function argument.
7227 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
7228 C<isl_ast_node_if_print> print an C<isl_ast_node>
7229 in C<ISL_FORMAT_C>, but allow for some extra control
7230 through an C<isl_ast_print_options> object.
7231 This object can be created using the following functions.
7233 #include <isl/ast.h>
7234 __isl_give isl_ast_print_options *
7235 isl_ast_print_options_alloc(isl_ctx *ctx);
7236 __isl_give isl_ast_print_options *
7237 isl_ast_print_options_copy(
7238 __isl_keep isl_ast_print_options *options);
7239 __isl_null isl_ast_print_options *
7240 isl_ast_print_options_free(
7241 __isl_take isl_ast_print_options *options);
7243 __isl_give isl_ast_print_options *
7244 isl_ast_print_options_set_print_user(
7245 __isl_take isl_ast_print_options *options,
7246 __isl_give isl_printer *(*print_user)(
7247 __isl_take isl_printer *p,
7248 __isl_take isl_ast_print_options *options,
7249 __isl_keep isl_ast_node *node, void *user),
7251 __isl_give isl_ast_print_options *
7252 isl_ast_print_options_set_print_for(
7253 __isl_take isl_ast_print_options *options,
7254 __isl_give isl_printer *(*print_for)(
7255 __isl_take isl_printer *p,
7256 __isl_take isl_ast_print_options *options,
7257 __isl_keep isl_ast_node *node, void *user),
7260 The callback set by C<isl_ast_print_options_set_print_user>
7261 is called whenever a node of type C<isl_ast_node_user> needs to
7263 The callback set by C<isl_ast_print_options_set_print_for>
7264 is called whenever a node of type C<isl_ast_node_for> needs to
7266 Note that C<isl_ast_node_for_print> will I<not> call the
7267 callback set by C<isl_ast_print_options_set_print_for> on the node
7268 on which C<isl_ast_node_for_print> is called, but only on nested
7269 nodes of type C<isl_ast_node_for>. It is therefore safe to
7270 call C<isl_ast_node_for_print> from within the callback set by
7271 C<isl_ast_print_options_set_print_for>.
7273 The following option determines the type to be used for iterators
7274 while printing the AST.
7276 int isl_options_set_ast_iterator_type(
7277 isl_ctx *ctx, const char *val);
7278 const char *isl_options_get_ast_iterator_type(
7281 The AST printer only prints body nodes as blocks if these
7282 blocks cannot be safely omitted.
7283 For example, a C<for> node with one body node will not be
7284 surrounded with braces in C<ISL_FORMAT_C>.
7285 A block will always be printed by setting the following option.
7287 int isl_options_set_ast_always_print_block(isl_ctx *ctx,
7289 int isl_options_get_ast_always_print_block(isl_ctx *ctx);
7293 #include <isl/ast_build.h>
7294 int isl_options_set_ast_build_atomic_upper_bound(
7295 isl_ctx *ctx, int val);
7296 int isl_options_get_ast_build_atomic_upper_bound(
7298 int isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
7300 int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
7301 int isl_options_set_ast_build_exploit_nested_bounds(
7302 isl_ctx *ctx, int val);
7303 int isl_options_get_ast_build_exploit_nested_bounds(
7305 int isl_options_set_ast_build_group_coscheduled(
7306 isl_ctx *ctx, int val);
7307 int isl_options_get_ast_build_group_coscheduled(
7309 int isl_options_set_ast_build_scale_strides(
7310 isl_ctx *ctx, int val);
7311 int isl_options_get_ast_build_scale_strides(
7313 int isl_options_set_ast_build_allow_else(isl_ctx *ctx,
7315 int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
7316 int isl_options_set_ast_build_allow_or(isl_ctx *ctx,
7318 int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
7322 =item * ast_build_atomic_upper_bound
7324 Generate loop upper bounds that consist of the current loop iterator,
7325 an operator and an expression not involving the iterator.
7326 If this option is not set, then the current loop iterator may appear
7327 several times in the upper bound.
7328 For example, when this option is turned off, AST generation
7331 [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
7335 for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
7338 When the option is turned on, the following AST is generated
7340 for (int c0 = 0; c0 <= min(100, n); c0 += 1)
7343 =item * ast_build_prefer_pdiv
7345 If this option is turned off, then the AST generation will
7346 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
7347 operators, but no C<isl_ast_op_pdiv_q> or
7348 C<isl_ast_op_pdiv_r> operators.
7349 If this options is turned on, then C<isl> will try to convert
7350 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
7351 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
7353 =item * ast_build_exploit_nested_bounds
7355 Simplify conditions based on bounds of nested for loops.
7356 In particular, remove conditions that are implied by the fact
7357 that one or more nested loops have at least one iteration,
7358 meaning that the upper bound is at least as large as the lower bound.
7359 For example, when this option is turned off, AST generation
7362 [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
7368 for (int c0 = 0; c0 <= N; c0 += 1)
7369 for (int c1 = 0; c1 <= M; c1 += 1)
7372 When the option is turned on, the following AST is generated
7374 for (int c0 = 0; c0 <= N; c0 += 1)
7375 for (int c1 = 0; c1 <= M; c1 += 1)
7378 =item * ast_build_group_coscheduled
7380 If two domain elements are assigned the same schedule point, then
7381 they may be executed in any order and they may even appear in different
7382 loops. If this options is set, then the AST generator will make
7383 sure that coscheduled domain elements do not appear in separate parts
7384 of the AST. This is useful in case of nested AST generation
7385 if the outer AST generation is given only part of a schedule
7386 and the inner AST generation should handle the domains that are
7387 coscheduled by this initial part of the schedule together.
7388 For example if an AST is generated for a schedule
7390 { A[i] -> [0]; B[i] -> [0] }
7392 then the C<isl_ast_build_set_create_leaf> callback described
7393 below may get called twice, once for each domain.
7394 Setting this option ensures that the callback is only called once
7395 on both domains together.
7397 =item * ast_build_separation_bounds
7399 This option specifies which bounds to use during separation.
7400 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
7401 then all (possibly implicit) bounds on the current dimension will
7402 be used during separation.
7403 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
7404 then only those bounds that are explicitly available will
7405 be used during separation.
7407 =item * ast_build_scale_strides
7409 This option specifies whether the AST generator is allowed
7410 to scale down iterators of strided loops.
7412 =item * ast_build_allow_else
7414 This option specifies whether the AST generator is allowed
7415 to construct if statements with else branches.
7417 =item * ast_build_allow_or
7419 This option specifies whether the AST generator is allowed
7420 to construct if conditions with disjunctions.
7424 =head3 Fine-grained Control over AST Generation
7426 Besides specifying the constraints on the parameters,
7427 an C<isl_ast_build> object can be used to control
7428 various aspects of the AST generation process.
7429 The most prominent way of control is through ``options'',
7430 which can be set using the following function.
7432 #include <isl/ast_build.h>
7433 __isl_give isl_ast_build *
7434 isl_ast_build_set_options(
7435 __isl_take isl_ast_build *control,
7436 __isl_take isl_union_map *options);
7438 The options are encoded in an C<isl_union_map>.
7439 The domain of this union relation refers to the schedule domain,
7440 i.e., the range of the schedule passed to C<isl_ast_build_ast_from_schedule>.
7441 In the case of nested AST generation (see L</"Nested AST Generation">),
7442 the domain of C<options> should refer to the extra piece of the schedule.
7443 That is, it should be equal to the range of the wrapped relation in the
7444 range of the schedule.
7445 The range of the options can consist of elements in one or more spaces,
7446 the names of which determine the effect of the option.
7447 The values of the range typically also refer to the schedule dimension
7448 to which the option applies. In case of nested AST generation
7449 (see L</"Nested AST Generation">), these values refer to the position
7450 of the schedule dimension within the innermost AST generation.
7451 The constraints on the domain elements of
7452 the option should only refer to this dimension and earlier dimensions.
7453 We consider the following spaces.
7457 =item C<separation_class>
7459 This space is a wrapped relation between two one dimensional spaces.
7460 The input space represents the schedule dimension to which the option
7461 applies and the output space represents the separation class.
7462 While constructing a loop corresponding to the specified schedule
7463 dimension(s), the AST generator will try to generate separate loops
7464 for domain elements that are assigned different classes.
7465 If only some of the elements are assigned a class, then those elements
7466 that are not assigned any class will be treated as belonging to a class
7467 that is separate from the explicitly assigned classes.
7468 The typical use case for this option is to separate full tiles from
7470 The other options, described below, are applied after the separation
7473 As an example, consider the separation into full and partial tiles
7474 of a tiling of a triangular domain.
7475 Take, for example, the domain
7477 { A[i,j] : 0 <= i,j and i + j <= 100 }
7479 and a tiling into tiles of 10 by 10. The input to the AST generator
7480 is then the schedule
7482 { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
7485 Without any options, the following AST is generated
7487 for (int c0 = 0; c0 <= 10; c0 += 1)
7488 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
7489 for (int c2 = 10 * c0;
7490 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
7492 for (int c3 = 10 * c1;
7493 c3 <= min(10 * c1 + 9, -c2 + 100);
7497 Separation into full and partial tiles can be obtained by assigning
7498 a class, say C<0>, to the full tiles. The full tiles are represented by those
7499 values of the first and second schedule dimensions for which there are
7500 values of the third and fourth dimensions to cover an entire tile.
7501 That is, we need to specify the following option
7503 { [a,b,c,d] -> separation_class[[0]->[0]] :
7504 exists b': 0 <= 10a,10b' and
7505 10a+9+10b'+9 <= 100;
7506 [a,b,c,d] -> separation_class[[1]->[0]] :
7507 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
7511 { [a, b, c, d] -> separation_class[[1] -> [0]] :
7512 a >= 0 and b >= 0 and b <= 8 - a;
7513 [a, b, c, d] -> separation_class[[0] -> [0]] :
7516 With this option, the generated AST is as follows
7519 for (int c0 = 0; c0 <= 8; c0 += 1) {
7520 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
7521 for (int c2 = 10 * c0;
7522 c2 <= 10 * c0 + 9; c2 += 1)
7523 for (int c3 = 10 * c1;
7524 c3 <= 10 * c1 + 9; c3 += 1)
7526 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
7527 for (int c2 = 10 * c0;
7528 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
7530 for (int c3 = 10 * c1;
7531 c3 <= min(-c2 + 100, 10 * c1 + 9);
7535 for (int c0 = 9; c0 <= 10; c0 += 1)
7536 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
7537 for (int c2 = 10 * c0;
7538 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
7540 for (int c3 = 10 * c1;
7541 c3 <= min(10 * c1 + 9, -c2 + 100);
7548 This is a single-dimensional space representing the schedule dimension(s)
7549 to which ``separation'' should be applied. Separation tries to split
7550 a loop into several pieces if this can avoid the generation of guards
7552 See also the C<atomic> option.
7556 This is a single-dimensional space representing the schedule dimension(s)
7557 for which the domains should be considered ``atomic''. That is, the
7558 AST generator will make sure that any given domain space will only appear
7559 in a single loop at the specified level.
7561 Consider the following schedule
7563 { a[i] -> [i] : 0 <= i < 10;
7564 b[i] -> [i+1] : 0 <= i < 10 }
7566 If the following option is specified
7568 { [i] -> separate[x] }
7570 then the following AST will be generated
7574 for (int c0 = 1; c0 <= 9; c0 += 1) {
7581 If, on the other hand, the following option is specified
7583 { [i] -> atomic[x] }
7585 then the following AST will be generated
7587 for (int c0 = 0; c0 <= 10; c0 += 1) {
7594 If neither C<atomic> nor C<separate> is specified, then the AST generator
7595 may produce either of these two results or some intermediate form.
7599 This is a single-dimensional space representing the schedule dimension(s)
7600 that should be I<completely> unrolled.
7601 To obtain a partial unrolling, the user should apply an additional
7602 strip-mining to the schedule and fully unroll the inner loop.
7606 Additional control is available through the following functions.
7608 #include <isl/ast_build.h>
7609 __isl_give isl_ast_build *
7610 isl_ast_build_set_iterators(
7611 __isl_take isl_ast_build *control,
7612 __isl_take isl_id_list *iterators);
7614 The function C<isl_ast_build_set_iterators> allows the user to
7615 specify a list of iterator C<isl_id>s to be used as iterators.
7616 If the input schedule is injective, then
7617 the number of elements in this list should be as large as the dimension
7618 of the schedule space, but no direct correspondence should be assumed
7619 between dimensions and elements.
7620 If the input schedule is not injective, then an additional number
7621 of C<isl_id>s equal to the largest dimension of the input domains
7623 If the number of provided C<isl_id>s is insufficient, then additional
7624 names are automatically generated.
7626 #include <isl/ast_build.h>
7627 __isl_give isl_ast_build *
7628 isl_ast_build_set_create_leaf(
7629 __isl_take isl_ast_build *control,
7630 __isl_give isl_ast_node *(*fn)(
7631 __isl_take isl_ast_build *build,
7632 void *user), void *user);
7635 C<isl_ast_build_set_create_leaf> function allows for the
7636 specification of a callback that should be called whenever the AST
7637 generator arrives at an element of the schedule domain.
7638 The callback should return an AST node that should be inserted
7639 at the corresponding position of the AST. The default action (when
7640 the callback is not set) is to continue generating parts of the AST to scan
7641 all the domain elements associated to the schedule domain element
7642 and to insert user nodes, ``calling'' the domain element, for each of them.
7643 The C<build> argument contains the current state of the C<isl_ast_build>.
7644 To ease nested AST generation (see L</"Nested AST Generation">),
7645 all control information that is
7646 specific to the current AST generation such as the options and
7647 the callbacks has been removed from this C<isl_ast_build>.
7648 The callback would typically return the result of a nested
7650 user defined node created using the following function.
7652 #include <isl/ast.h>
7653 __isl_give isl_ast_node *isl_ast_node_alloc_user(
7654 __isl_take isl_ast_expr *expr);
7656 #include <isl/ast_build.h>
7657 __isl_give isl_ast_build *
7658 isl_ast_build_set_at_each_domain(
7659 __isl_take isl_ast_build *build,
7660 __isl_give isl_ast_node *(*fn)(
7661 __isl_take isl_ast_node *node,
7662 __isl_keep isl_ast_build *build,
7663 void *user), void *user);
7664 __isl_give isl_ast_build *
7665 isl_ast_build_set_before_each_for(
7666 __isl_take isl_ast_build *build,
7667 __isl_give isl_id *(*fn)(
7668 __isl_keep isl_ast_build *build,
7669 void *user), void *user);
7670 __isl_give isl_ast_build *
7671 isl_ast_build_set_after_each_for(
7672 __isl_take isl_ast_build *build,
7673 __isl_give isl_ast_node *(*fn)(
7674 __isl_take isl_ast_node *node,
7675 __isl_keep isl_ast_build *build,
7676 void *user), void *user);
7678 The callback set by C<isl_ast_build_set_at_each_domain> will
7679 be called for each domain AST node.
7680 The callbacks set by C<isl_ast_build_set_before_each_for>
7681 and C<isl_ast_build_set_after_each_for> will be called
7682 for each for AST node. The first will be called in depth-first
7683 pre-order, while the second will be called in depth-first post-order.
7684 Since C<isl_ast_build_set_before_each_for> is called before the for
7685 node is actually constructed, it is only passed an C<isl_ast_build>.
7686 The returned C<isl_id> will be added as an annotation (using
7687 C<isl_ast_node_set_annotation>) to the constructed for node.
7688 In particular, if the user has also specified an C<after_each_for>
7689 callback, then the annotation can be retrieved from the node passed to
7690 that callback using C<isl_ast_node_get_annotation>.
7691 All callbacks should C<NULL> on failure.
7692 The given C<isl_ast_build> can be used to create new
7693 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
7694 or C<isl_ast_build_call_from_pw_multi_aff>.
7696 =head3 Nested AST Generation
7698 C<isl> allows the user to create an AST within the context
7699 of another AST. These nested ASTs are created using the
7700 same C<isl_ast_build_ast_from_schedule> function that is used to create the
7701 outer AST. The C<build> argument should be an C<isl_ast_build>
7702 passed to a callback set by
7703 C<isl_ast_build_set_create_leaf>.
7704 The space of the range of the C<schedule> argument should refer
7705 to this build. In particular, the space should be a wrapped
7706 relation and the domain of this wrapped relation should be the
7707 same as that of the range of the schedule returned by
7708 C<isl_ast_build_get_schedule> below.
7709 In practice, the new schedule is typically
7710 created by calling C<isl_union_map_range_product> on the old schedule
7711 and some extra piece of the schedule.
7712 The space of the schedule domain is also available from
7713 the C<isl_ast_build>.
7715 #include <isl/ast_build.h>
7716 __isl_give isl_union_map *isl_ast_build_get_schedule(
7717 __isl_keep isl_ast_build *build);
7718 __isl_give isl_space *isl_ast_build_get_schedule_space(
7719 __isl_keep isl_ast_build *build);
7720 __isl_give isl_ast_build *isl_ast_build_restrict(
7721 __isl_take isl_ast_build *build,
7722 __isl_take isl_set *set);
7724 The C<isl_ast_build_get_schedule> function returns a (partial)
7725 schedule for the domains elements for which part of the AST still needs to
7726 be generated in the current build.
7727 In particular, the domain elements are mapped to those iterations of the loops
7728 enclosing the current point of the AST generation inside which
7729 the domain elements are executed.
7730 No direct correspondence between
7731 the input schedule and this schedule should be assumed.
7732 The space obtained from C<isl_ast_build_get_schedule_space> can be used
7733 to create a set for C<isl_ast_build_restrict> to intersect
7734 with the current build. In particular, the set passed to
7735 C<isl_ast_build_restrict> can have additional parameters.
7736 The ids of the set dimensions in the space returned by
7737 C<isl_ast_build_get_schedule_space> correspond to the
7738 iterators of the already generated loops.
7739 The user should not rely on the ids of the output dimensions
7740 of the relations in the union relation returned by
7741 C<isl_ast_build_get_schedule> having any particular value.
7745 Although C<isl> is mainly meant to be used as a library,
7746 it also contains some basic applications that use some
7747 of the functionality of C<isl>.
7748 The input may be specified in either the L<isl format>
7749 or the L<PolyLib format>.
7751 =head2 C<isl_polyhedron_sample>
7753 C<isl_polyhedron_sample> takes a polyhedron as input and prints
7754 an integer element of the polyhedron, if there is any.
7755 The first column in the output is the denominator and is always
7756 equal to 1. If the polyhedron contains no integer points,
7757 then a vector of length zero is printed.
7761 C<isl_pip> takes the same input as the C<example> program
7762 from the C<piplib> distribution, i.e., a set of constraints
7763 on the parameters, a line containing only -1 and finally a set
7764 of constraints on a parametric polyhedron.
7765 The coefficients of the parameters appear in the last columns
7766 (but before the final constant column).
7767 The output is the lexicographic minimum of the parametric polyhedron.
7768 As C<isl> currently does not have its own output format, the output
7769 is just a dump of the internal state.
7771 =head2 C<isl_polyhedron_minimize>
7773 C<isl_polyhedron_minimize> computes the minimum of some linear
7774 or affine objective function over the integer points in a polyhedron.
7775 If an affine objective function
7776 is given, then the constant should appear in the last column.
7778 =head2 C<isl_polytope_scan>
7780 Given a polytope, C<isl_polytope_scan> prints
7781 all integer points in the polytope.
7783 =head2 C<isl_codegen>
7785 Given a schedule, a context set and an options relation,
7786 C<isl_codegen> prints out an AST that scans the domain elements
7787 of the schedule in the order of their image(s) taking into account
7788 the constraints in the context set.