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.
218 =item * The function C<isl_union_pw_multi_aff_add> now consistently
219 computes the sum on the shared definition domain.
220 The function C<isl_union_pw_multi_aff_union_add> has been added
221 to compute the sum on the union of definition domains.
222 The original behavior of C<isl_union_pw_multi_aff_add> was
223 confused and is no longer available.
225 =item * Band forests have been replaced by schedule trees.
227 =item * The function C<isl_union_map_compute_flow> has been
228 replaced by the function C<isl_union_access_info_compute_flow>.
229 Note that the may dependence relation returned by
230 C<isl_union_flow_get_may_dependence> is the union of
231 the two dependence relations returned by
232 C<isl_union_map_compute_flow>. Similarly for the no source relations.
233 The function C<isl_union_map_compute_flow> is still available
234 for backward compatibility, but it will be removed in the future.
236 =item * The function C<isl_basic_set_drop_constraint> has been
239 =item * The function C<isl_ast_build_ast_from_schedule> has been
240 renamed to C<isl_ast_build_node_from_schedule_map>.
241 The original name is still available
242 for backward compatibility, but it will be removed in the future.
244 =item * The C<separation_class> AST generation option has been
247 =item * The functions C<isl_equality_alloc> and C<isl_inequality_alloc>
248 have been renamed to C<isl_constraint_alloc_equality> and
249 C<isl_constraint_alloc_inequality>. The original names have been
250 kept for backward compatibility, but they will be removed in the future.
252 =item * The C<schedule_fuse> option has been replaced
253 by the C<schedule_serialize_sccs> option. The effect
254 of setting the C<schedule_fuse> option to C<ISL_SCHEDULE_FUSE_MIN>
255 is now obtained by turning on the C<schedule_serialize_sccs> option.
261 C<isl> is released under the MIT license.
265 Permission is hereby granted, free of charge, to any person obtaining a copy of
266 this software and associated documentation files (the "Software"), to deal in
267 the Software without restriction, including without limitation the rights to
268 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
269 of the Software, and to permit persons to whom the Software is furnished to do
270 so, subject to the following conditions:
272 The above copyright notice and this permission notice shall be included in all
273 copies or substantial portions of the Software.
275 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
276 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
277 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
278 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
279 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
280 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
285 Note that by default C<isl> requires C<GMP>, which is released
286 under the GNU Lesser General Public License (LGPL). This means
287 that code linked against C<isl> is also linked against LGPL code.
289 When configuring with C<--with-int=imath> or C<--with-int=imath-32>, C<isl>
290 will link against C<imath>, a library for exact integer arithmetic released
291 under the MIT license.
295 The source of C<isl> can be obtained either as a tarball
296 or from the git repository. Both are available from
297 L<http://freshmeat.net/projects/isl/>.
298 The installation process depends on how you obtained
301 =head2 Installation from the git repository
305 =item 1 Clone or update the repository
307 The first time the source is obtained, you need to clone
310 git clone git://repo.or.cz/isl.git
312 To obtain updates, you need to pull in the latest changes
316 =item 2 Optionally get C<imath> submodule
318 To build C<isl> with C<imath>, you need to obtain the C<imath>
319 submodule by running in the git source tree of C<isl>
324 This will fetch the required version of C<imath> in a subdirectory of C<isl>.
326 =item 2 Generate C<configure>
332 After performing the above steps, continue
333 with the L<Common installation instructions>.
335 =head2 Common installation instructions
339 =item 1 Obtain C<GMP>
341 By default, building C<isl> requires C<GMP>, including its headers files.
342 Your distribution may not provide these header files by default
343 and you may need to install a package called C<gmp-devel> or something
344 similar. Alternatively, C<GMP> can be built from
345 source, available from L<http://gmplib.org/>.
346 C<GMP> is not needed if you build C<isl> with C<imath>.
350 C<isl> uses the standard C<autoconf> C<configure> script.
355 optionally followed by some configure options.
356 A complete list of options can be obtained by running
360 Below we discuss some of the more common options.
366 Installation prefix for C<isl>
368 =item C<--with-int=[gmp|imath|imath-32]>
370 Select the integer library to be used by C<isl>, the default is C<gmp>.
371 With C<imath-32>, C<isl> will use 32 bit integers, but fall back to C<imath>
372 for values out of the 32 bit range. In most applications, C<isl> will run
373 fastest with the C<imath-32> option, followed by C<gmp> and C<imath>, the
376 =item C<--with-gmp-prefix>
378 Installation prefix for C<GMP> (architecture-independent files).
380 =item C<--with-gmp-exec-prefix>
382 Installation prefix for C<GMP> (architecture-dependent files).
390 =item 4 Install (optional)
396 =head1 Integer Set Library
398 =head2 Memory Management
400 Since a high-level operation on isl objects usually involves
401 several substeps and since the user is usually not interested in
402 the intermediate results, most functions that return a new object
403 will also release all the objects passed as arguments.
404 If the user still wants to use one or more of these arguments
405 after the function call, she should pass along a copy of the
406 object rather than the object itself.
407 The user is then responsible for making sure that the original
408 object gets used somewhere else or is explicitly freed.
410 The arguments and return values of all documented functions are
411 annotated to make clear which arguments are released and which
412 arguments are preserved. In particular, the following annotations
419 C<__isl_give> means that a new object is returned.
420 The user should make sure that the returned pointer is
421 used exactly once as a value for an C<__isl_take> argument.
422 In between, it can be used as a value for as many
423 C<__isl_keep> arguments as the user likes.
424 There is one exception, and that is the case where the
425 pointer returned is C<NULL>. Is this case, the user
426 is free to use it as an C<__isl_take> argument or not.
427 When applied to a C<char *>, the returned pointer needs to be
432 C<__isl_null> means that a C<NULL> value is returned.
436 C<__isl_take> means that the object the argument points to
437 is taken over by the function and may no longer be used
438 by the user as an argument to any other function.
439 The pointer value must be one returned by a function
440 returning an C<__isl_give> pointer.
441 If the user passes in a C<NULL> value, then this will
442 be treated as an error in the sense that the function will
443 not perform its usual operation. However, it will still
444 make sure that all the other C<__isl_take> arguments
449 C<__isl_keep> means that the function will only use the object
450 temporarily. After the function has finished, the user
451 can still use it as an argument to other functions.
452 A C<NULL> value will be treated in the same way as
453 a C<NULL> value for an C<__isl_take> argument.
454 This annotation may also be used on return values of
455 type C<const char *>, in which case the returned pointer should
456 not be freed by the user and is only valid until the object
457 from which it was derived is updated or freed.
461 =head2 Initialization
463 All manipulations of integer sets and relations occur within
464 the context of an C<isl_ctx>.
465 A given C<isl_ctx> can only be used within a single thread.
466 All arguments of a function are required to have been allocated
467 within the same context.
468 There are currently no functions available for moving an object
469 from one C<isl_ctx> to another C<isl_ctx>. This means that
470 there is currently no way of safely moving an object from one
471 thread to another, unless the whole C<isl_ctx> is moved.
473 An C<isl_ctx> can be allocated using C<isl_ctx_alloc> and
474 freed using C<isl_ctx_free>.
475 All objects allocated within an C<isl_ctx> should be freed
476 before the C<isl_ctx> itself is freed.
478 isl_ctx *isl_ctx_alloc();
479 void isl_ctx_free(isl_ctx *ctx);
481 The user can impose a bound on the number of low-level I<operations>
482 that can be performed by an C<isl_ctx>. This bound can be set and
483 retrieved using the following functions. A bound of zero means that
484 no bound is imposed. The number of operations performed can be
485 reset using C<isl_ctx_reset_operations>. Note that the number
486 of low-level operations needed to perform a high-level computation
487 may differ significantly across different versions
488 of C<isl>, but it should be the same across different platforms
489 for the same version of C<isl>.
491 Warning: This feature is experimental. C<isl> has good support to abort and
492 bail out during the computation, but this feature may exercise error code paths
493 that are normally not used that much. Consequently, it is not unlikely that
494 hidden bugs will be exposed.
496 void isl_ctx_set_max_operations(isl_ctx *ctx,
497 unsigned long max_operations);
498 unsigned long isl_ctx_get_max_operations(isl_ctx *ctx);
499 void isl_ctx_reset_operations(isl_ctx *ctx);
501 In order to be able to create an object in the same context
502 as another object, most object types (described later in
503 this document) provide a function to obtain the context
504 in which the object was created.
507 isl_ctx *isl_val_get_ctx(__isl_keep isl_val *val);
508 isl_ctx *isl_multi_val_get_ctx(
509 __isl_keep isl_multi_val *mv);
512 isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
514 #include <isl/local_space.h>
515 isl_ctx *isl_local_space_get_ctx(
516 __isl_keep isl_local_space *ls);
519 isl_ctx *isl_set_list_get_ctx(
520 __isl_keep isl_set_list *list);
523 isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
524 isl_ctx *isl_multi_aff_get_ctx(
525 __isl_keep isl_multi_aff *maff);
526 isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pa);
527 isl_ctx *isl_pw_multi_aff_get_ctx(
528 __isl_keep isl_pw_multi_aff *pma);
529 isl_ctx *isl_multi_pw_aff_get_ctx(
530 __isl_keep isl_multi_pw_aff *mpa);
531 isl_ctx *isl_union_pw_aff_get_ctx(
532 __isl_keep isl_union_pw_aff *upa);
533 isl_ctx *isl_union_pw_multi_aff_get_ctx(
534 __isl_keep isl_union_pw_multi_aff *upma);
535 isl_ctx *isl_multi_union_pw_aff_get_ctx(
536 __isl_keep isl_multi_union_pw_aff *mupa);
538 #include <isl/id_to_ast_expr.h>
539 isl_ctx *isl_id_to_ast_expr_get_ctx(
540 __isl_keep isl_id_to_ast_expr *id2expr);
542 #include <isl/point.h>
543 isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
546 isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
549 isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
551 #include <isl/vertices.h>
552 isl_ctx *isl_vertices_get_ctx(
553 __isl_keep isl_vertices *vertices);
554 isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
555 isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
557 #include <isl/flow.h>
558 isl_ctx *isl_restriction_get_ctx(
559 __isl_keep isl_restriction *restr);
560 isl_ctx *isl_union_access_info_get_ctx(
561 __isl_keep isl_union_access_info *access);
562 isl_ctx *isl_union_flow_get_ctx(
563 __isl_keep isl_union_flow *flow);
565 #include <isl/schedule.h>
566 isl_ctx *isl_schedule_get_ctx(
567 __isl_keep isl_schedule *sched);
568 isl_ctx *isl_schedule_constraints_get_ctx(
569 __isl_keep isl_schedule_constraints *sc);
571 #include <isl/schedule_node.h>
572 isl_ctx *isl_schedule_node_get_ctx(
573 __isl_keep isl_schedule_node *node);
575 #include <isl/band.h>
576 isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band);
578 #include <isl/ast_build.h>
579 isl_ctx *isl_ast_build_get_ctx(
580 __isl_keep isl_ast_build *build);
583 isl_ctx *isl_ast_expr_get_ctx(
584 __isl_keep isl_ast_expr *expr);
585 isl_ctx *isl_ast_node_get_ctx(
586 __isl_keep isl_ast_node *node);
590 C<isl> uses two special return types for functions that either return
591 a boolean or that in principle do not return anything.
592 In particular, the C<isl_bool> type has three possible values:
593 C<isl_bool_true> (a positive integer value), indicating I<true> or I<yes>;
594 C<isl_bool_false> (the integer value zero), indicating I<false> or I<no>; and
595 C<isl_bool_error> (a negative integer value), indicating that something
597 The C<isl_stat> type has two possible values:
598 C<isl_stat_ok> (the integer value zero), indicating a successful
600 C<isl_stat_error> (a negative integer value), indicating that something
602 See L</"Error Handling"> for more information on
603 C<isl_bool_error> and C<isl_stat_error>.
607 An C<isl_val> represents an integer value, a rational value
608 or one of three special values, infinity, negative infinity and NaN.
609 Some predefined values can be created using the following functions.
612 __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
613 __isl_give isl_val *isl_val_one(isl_ctx *ctx);
614 __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
615 __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
616 __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
617 __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
619 Specific integer values can be created using the following functions.
622 __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
624 __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
626 __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
627 size_t n, size_t size, const void *chunks);
629 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
630 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
631 The least significant digit is assumed to be stored first.
633 Value objects can be copied and freed using the following functions.
636 __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
637 __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
639 They can be inspected using the following functions.
642 long isl_val_get_num_si(__isl_keep isl_val *v);
643 long isl_val_get_den_si(__isl_keep isl_val *v);
644 __isl_give isl_val *isl_val_get_den_val(
645 __isl_keep isl_val *v);
646 double isl_val_get_d(__isl_keep isl_val *v);
647 size_t isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
649 int isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
650 size_t size, void *chunks);
652 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
653 of C<size> bytes needed to store the absolute value of the
655 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
656 which is assumed to have been preallocated by the caller.
657 The least significant digit is stored first.
658 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
659 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
660 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
662 An C<isl_val> can be modified using the following function.
665 __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
668 The following unary properties are defined on C<isl_val>s.
671 int isl_val_sgn(__isl_keep isl_val *v);
672 isl_bool isl_val_is_zero(__isl_keep isl_val *v);
673 isl_bool isl_val_is_one(__isl_keep isl_val *v);
674 isl_bool isl_val_is_negone(__isl_keep isl_val *v);
675 isl_bool isl_val_is_nonneg(__isl_keep isl_val *v);
676 isl_bool isl_val_is_nonpos(__isl_keep isl_val *v);
677 isl_bool isl_val_is_pos(__isl_keep isl_val *v);
678 isl_bool isl_val_is_neg(__isl_keep isl_val *v);
679 isl_bool isl_val_is_int(__isl_keep isl_val *v);
680 isl_bool isl_val_is_rat(__isl_keep isl_val *v);
681 isl_bool isl_val_is_nan(__isl_keep isl_val *v);
682 isl_bool isl_val_is_infty(__isl_keep isl_val *v);
683 isl_bool isl_val_is_neginfty(__isl_keep isl_val *v);
685 Note that the sign of NaN is undefined.
687 The following binary properties are defined on pairs of C<isl_val>s.
690 isl_bool isl_val_lt(__isl_keep isl_val *v1,
691 __isl_keep isl_val *v2);
692 isl_bool isl_val_le(__isl_keep isl_val *v1,
693 __isl_keep isl_val *v2);
694 isl_bool isl_val_gt(__isl_keep isl_val *v1,
695 __isl_keep isl_val *v2);
696 isl_bool isl_val_ge(__isl_keep isl_val *v1,
697 __isl_keep isl_val *v2);
698 isl_bool isl_val_eq(__isl_keep isl_val *v1,
699 __isl_keep isl_val *v2);
700 isl_bool isl_val_ne(__isl_keep isl_val *v1,
701 __isl_keep isl_val *v2);
702 isl_bool isl_val_abs_eq(__isl_keep isl_val *v1,
703 __isl_keep isl_val *v2);
705 The function C<isl_val_abs_eq> checks whether its two arguments
706 are equal in absolute value.
708 For integer C<isl_val>s we additionally have the following binary property.
711 isl_bool isl_val_is_divisible_by(__isl_keep isl_val *v1,
712 __isl_keep isl_val *v2);
714 An C<isl_val> can also be compared to an integer using the following
715 function. The result is undefined for NaN.
718 int isl_val_cmp_si(__isl_keep isl_val *v, long i);
720 The following unary operations are available on C<isl_val>s.
723 __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
724 __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
725 __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
726 __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
727 __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
728 __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
729 __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
731 The following binary operations are available on C<isl_val>s.
734 __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
735 __isl_take isl_val *v2);
736 __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
737 __isl_take isl_val *v2);
738 __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
739 __isl_take isl_val *v2);
740 __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
742 __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
743 __isl_take isl_val *v2);
744 __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
746 __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
747 __isl_take isl_val *v2);
748 __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
750 __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
751 __isl_take isl_val *v2);
753 On integer values, we additionally have the following operations.
756 __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
757 __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
758 __isl_take isl_val *v2);
759 __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
760 __isl_take isl_val *v2);
761 __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
762 __isl_take isl_val *v2, __isl_give isl_val **x,
763 __isl_give isl_val **y);
765 The function C<isl_val_gcdext> returns the greatest common divisor g
766 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
767 that C<*x> * C<v1> + C<*y> * C<v2> = g.
769 =head3 GMP specific functions
771 These functions are only available if C<isl> has been compiled with C<GMP>
774 Specific integer and rational values can be created from C<GMP> values using
775 the following functions.
777 #include <isl/val_gmp.h>
778 __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
780 __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
781 const mpz_t n, const mpz_t d);
783 The numerator and denominator of a rational value can be extracted as
784 C<GMP> values using the following functions.
786 #include <isl/val_gmp.h>
787 int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
788 int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
790 =head2 Sets and Relations
792 C<isl> uses six types of objects for representing sets and relations,
793 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
794 C<isl_union_set> and C<isl_union_map>.
795 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
796 can be described as a conjunction of affine constraints, while
797 C<isl_set> and C<isl_map> represent unions of
798 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
799 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
800 to live in the same space. C<isl_union_set>s and C<isl_union_map>s
801 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
802 where spaces are considered different if they have a different number
803 of dimensions and/or different names (see L<"Spaces">).
804 The difference between sets and relations (maps) is that sets have
805 one set of variables, while relations have two sets of variables,
806 input variables and output variables.
808 =head2 Error Handling
810 C<isl> supports different ways to react in case a runtime error is triggered.
811 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
812 with two maps that have incompatible spaces. There are three possible ways
813 to react on error: to warn, to continue or to abort.
815 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
816 the last error in the corresponding C<isl_ctx> and the function in which the
817 error was triggered returns a value indicating that some error has
818 occurred. In case of functions returning a pointer, this value is
819 C<NULL>. In case of functions returning an C<isl_bool> or an
820 C<isl_stat>, this valus is C<isl_bool_error> or C<isl_stat_error>.
821 An error does not corrupt internal state,
822 such that isl can continue to be used. C<isl> also provides functions to
823 read the last error and to reset the memory that stores the last error. The
824 last error is only stored for information purposes. Its presence does not
825 change the behavior of C<isl>. Hence, resetting an error is not required to
826 continue to use isl, but only to observe new errors.
829 enum isl_error isl_ctx_last_error(isl_ctx *ctx);
830 void isl_ctx_reset_error(isl_ctx *ctx);
832 Another option is to continue on error. This is similar to warn on error mode,
833 except that C<isl> does not print any warning. This allows a program to
834 implement its own error reporting.
836 The last option is to directly abort the execution of the program from within
837 the isl library. This makes it obviously impossible to recover from an error,
838 but it allows to directly spot the error location. By aborting on error,
839 debuggers break at the location the error occurred and can provide a stack
840 trace. Other tools that automatically provide stack traces on abort or that do
841 not want to continue execution after an error was triggered may also prefer to
844 The on error behavior of isl can be specified by calling
845 C<isl_options_set_on_error> or by setting the command line option
846 C<--isl-on-error>. Valid arguments for the function call are
847 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
848 choices for the command line option are C<warn>, C<continue> and C<abort>.
849 It is also possible to query the current error mode.
851 #include <isl/options.h>
852 isl_stat isl_options_set_on_error(isl_ctx *ctx, int val);
853 int isl_options_get_on_error(isl_ctx *ctx);
857 Identifiers are used to identify both individual dimensions
858 and tuples of dimensions. They consist of an optional name and an optional
859 user pointer. The name and the user pointer cannot both be C<NULL>, however.
860 Identifiers with the same name but different pointer values
861 are considered to be distinct.
862 Similarly, identifiers with different names but the same pointer value
863 are also considered to be distinct.
864 Equal identifiers are represented using the same object.
865 Pairs of identifiers can therefore be tested for equality using the
867 Identifiers can be constructed, copied, freed, inspected and printed
868 using the following functions.
871 __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
872 __isl_keep const char *name, void *user);
873 __isl_give isl_id *isl_id_set_free_user(
874 __isl_take isl_id *id,
875 __isl_give void (*free_user)(void *user));
876 __isl_give isl_id *isl_id_copy(isl_id *id);
877 __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
879 void *isl_id_get_user(__isl_keep isl_id *id);
880 __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
882 __isl_give isl_printer *isl_printer_print_id(
883 __isl_take isl_printer *p, __isl_keep isl_id *id);
885 The callback set by C<isl_id_set_free_user> is called on the user
886 pointer when the last reference to the C<isl_id> is freed.
887 Note that C<isl_id_get_name> returns a pointer to some internal
888 data structure, so the result can only be used while the
889 corresponding C<isl_id> is alive.
893 Whenever a new set, relation or similar object is created from scratch,
894 the space in which it lives needs to be specified using an C<isl_space>.
895 Each space involves zero or more parameters and zero, one or two
896 tuples of set or input/output dimensions. The parameters and dimensions
897 are identified by an C<isl_dim_type> and a position.
898 The type C<isl_dim_param> refers to parameters,
899 the type C<isl_dim_set> refers to set dimensions (for spaces
900 with a single tuple of dimensions) and the types C<isl_dim_in>
901 and C<isl_dim_out> refer to input and output dimensions
902 (for spaces with two tuples of dimensions).
903 Local spaces (see L</"Local Spaces">) also contain dimensions
904 of type C<isl_dim_div>.
905 Note that parameters are only identified by their position within
906 a given object. Across different objects, parameters are (usually)
907 identified by their names or identifiers. Only unnamed parameters
908 are identified by their positions across objects. The use of unnamed
909 parameters is discouraged.
911 #include <isl/space.h>
912 __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
913 unsigned nparam, unsigned n_in, unsigned n_out);
914 __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
916 __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
917 unsigned nparam, unsigned dim);
918 __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
919 __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
921 The space used for creating a parameter domain
922 needs to be created using C<isl_space_params_alloc>.
923 For other sets, the space
924 needs to be created using C<isl_space_set_alloc>, while
925 for a relation, the space
926 needs to be created using C<isl_space_alloc>.
928 To check whether a given space is that of a set or a map
929 or whether it is a parameter space, use these functions:
931 #include <isl/space.h>
932 isl_bool isl_space_is_params(__isl_keep isl_space *space);
933 isl_bool isl_space_is_set(__isl_keep isl_space *space);
934 isl_bool isl_space_is_map(__isl_keep isl_space *space);
936 Spaces can be compared using the following functions:
938 #include <isl/space.h>
939 isl_bool isl_space_is_equal(__isl_keep isl_space *space1,
940 __isl_keep isl_space *space2);
941 isl_bool isl_space_is_domain(__isl_keep isl_space *space1,
942 __isl_keep isl_space *space2);
943 isl_bool isl_space_is_range(__isl_keep isl_space *space1,
944 __isl_keep isl_space *space2);
945 isl_bool isl_space_tuple_is_equal(
946 __isl_keep isl_space *space1,
947 enum isl_dim_type type1,
948 __isl_keep isl_space *space2,
949 enum isl_dim_type type2);
951 C<isl_space_is_domain> checks whether the first argument is equal
952 to the domain of the second argument. This requires in particular that
953 the first argument is a set space and that the second argument
954 is a map space. C<isl_space_tuple_is_equal> checks whether the given
955 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
956 spaces are the same. That is, it checks if they have the same
957 identifier (if any), the same dimension and the same internal structure
960 It is often useful to create objects that live in the
961 same space as some other object. This can be accomplished
962 by creating the new objects
963 (see L</"Creating New Sets and Relations"> or
964 L</"Functions">) based on the space
965 of the original object.
968 __isl_give isl_space *isl_basic_set_get_space(
969 __isl_keep isl_basic_set *bset);
970 __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
972 #include <isl/union_set.h>
973 __isl_give isl_space *isl_union_set_get_space(
974 __isl_keep isl_union_set *uset);
977 __isl_give isl_space *isl_basic_map_get_space(
978 __isl_keep isl_basic_map *bmap);
979 __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
981 #include <isl/union_map.h>
982 __isl_give isl_space *isl_union_map_get_space(
983 __isl_keep isl_union_map *umap);
985 #include <isl/constraint.h>
986 __isl_give isl_space *isl_constraint_get_space(
987 __isl_keep isl_constraint *constraint);
989 #include <isl/polynomial.h>
990 __isl_give isl_space *isl_qpolynomial_get_domain_space(
991 __isl_keep isl_qpolynomial *qp);
992 __isl_give isl_space *isl_qpolynomial_get_space(
993 __isl_keep isl_qpolynomial *qp);
994 __isl_give isl_space *isl_qpolynomial_fold_get_space(
995 __isl_keep isl_qpolynomial_fold *fold);
996 __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
997 __isl_keep isl_pw_qpolynomial *pwqp);
998 __isl_give isl_space *isl_pw_qpolynomial_get_space(
999 __isl_keep isl_pw_qpolynomial *pwqp);
1000 __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
1001 __isl_keep isl_pw_qpolynomial_fold *pwf);
1002 __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
1003 __isl_keep isl_pw_qpolynomial_fold *pwf);
1004 __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
1005 __isl_keep isl_union_pw_qpolynomial *upwqp);
1006 __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
1007 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
1009 #include <isl/val.h>
1010 __isl_give isl_space *isl_multi_val_get_space(
1011 __isl_keep isl_multi_val *mv);
1013 #include <isl/aff.h>
1014 __isl_give isl_space *isl_aff_get_domain_space(
1015 __isl_keep isl_aff *aff);
1016 __isl_give isl_space *isl_aff_get_space(
1017 __isl_keep isl_aff *aff);
1018 __isl_give isl_space *isl_pw_aff_get_domain_space(
1019 __isl_keep isl_pw_aff *pwaff);
1020 __isl_give isl_space *isl_pw_aff_get_space(
1021 __isl_keep isl_pw_aff *pwaff);
1022 __isl_give isl_space *isl_multi_aff_get_domain_space(
1023 __isl_keep isl_multi_aff *maff);
1024 __isl_give isl_space *isl_multi_aff_get_space(
1025 __isl_keep isl_multi_aff *maff);
1026 __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
1027 __isl_keep isl_pw_multi_aff *pma);
1028 __isl_give isl_space *isl_pw_multi_aff_get_space(
1029 __isl_keep isl_pw_multi_aff *pma);
1030 __isl_give isl_space *isl_union_pw_aff_get_space(
1031 __isl_keep isl_union_pw_aff *upa);
1032 __isl_give isl_space *isl_union_pw_multi_aff_get_space(
1033 __isl_keep isl_union_pw_multi_aff *upma);
1034 __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
1035 __isl_keep isl_multi_pw_aff *mpa);
1036 __isl_give isl_space *isl_multi_pw_aff_get_space(
1037 __isl_keep isl_multi_pw_aff *mpa);
1038 __isl_give isl_space *
1039 isl_multi_union_pw_aff_get_domain_space(
1040 __isl_keep isl_multi_union_pw_aff *mupa);
1041 __isl_give isl_space *
1042 isl_multi_union_pw_aff_get_space(
1043 __isl_keep isl_multi_union_pw_aff *mupa);
1045 #include <isl/point.h>
1046 __isl_give isl_space *isl_point_get_space(
1047 __isl_keep isl_point *pnt);
1049 The number of dimensions of a given type of space
1050 may be read off from a space or an object that lives
1051 in a space using the following functions.
1052 In case of C<isl_space_dim>, type may be
1053 C<isl_dim_param>, C<isl_dim_in> (only for relations),
1054 C<isl_dim_out> (only for relations), C<isl_dim_set>
1055 (only for sets) or C<isl_dim_all>.
1057 #include <isl/space.h>
1058 unsigned isl_space_dim(__isl_keep isl_space *space,
1059 enum isl_dim_type type);
1061 #include <isl/local_space.h>
1062 int isl_local_space_dim(__isl_keep isl_local_space *ls,
1063 enum isl_dim_type type);
1065 #include <isl/set.h>
1066 unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1067 enum isl_dim_type type);
1068 unsigned isl_set_dim(__isl_keep isl_set *set,
1069 enum isl_dim_type type);
1071 #include <isl/union_set.h>
1072 unsigned isl_union_set_dim(__isl_keep isl_union_set *uset,
1073 enum isl_dim_type type);
1075 #include <isl/map.h>
1076 unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1077 enum isl_dim_type type);
1078 unsigned isl_map_dim(__isl_keep isl_map *map,
1079 enum isl_dim_type type);
1081 #include <isl/union_map.h>
1082 unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
1083 enum isl_dim_type type);
1085 #include <isl/val.h>
1086 unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1087 enum isl_dim_type type);
1089 #include <isl/aff.h>
1090 int isl_aff_dim(__isl_keep isl_aff *aff,
1091 enum isl_dim_type type);
1092 unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1093 enum isl_dim_type type);
1094 unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1095 enum isl_dim_type type);
1096 unsigned isl_pw_multi_aff_dim(
1097 __isl_keep isl_pw_multi_aff *pma,
1098 enum isl_dim_type type);
1099 unsigned isl_multi_pw_aff_dim(
1100 __isl_keep isl_multi_pw_aff *mpa,
1101 enum isl_dim_type type);
1102 unsigned isl_union_pw_aff_dim(
1103 __isl_keep isl_union_pw_aff *upa,
1104 enum isl_dim_type type);
1105 unsigned isl_union_pw_multi_aff_dim(
1106 __isl_keep isl_union_pw_multi_aff *upma,
1107 enum isl_dim_type type);
1108 unsigned isl_multi_union_pw_aff_dim(
1109 __isl_keep isl_multi_union_pw_aff *mupa,
1110 enum isl_dim_type type);
1112 #include <isl/polynomial.h>
1113 unsigned isl_union_pw_qpolynomial_dim(
1114 __isl_keep isl_union_pw_qpolynomial *upwqp,
1115 enum isl_dim_type type);
1116 unsigned isl_union_pw_qpolynomial_fold_dim(
1117 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1118 enum isl_dim_type type);
1120 Note that an C<isl_union_set>, an C<isl_union_map>,
1121 an C<isl_union_pw_multi_aff>,
1122 an C<isl_union_pw_qpolynomial> and
1123 an C<isl_union_pw_qpolynomial_fold>
1124 only have parameters.
1126 The identifiers or names of the individual dimensions of spaces
1127 may be set or read off using the following functions on spaces
1128 or objects that live in spaces.
1129 These functions are mostly useful to obtain the identifiers, positions
1130 or names of the parameters. Identifiers of individual dimensions are
1131 essentially only useful for printing. They are ignored by all other
1132 operations and may not be preserved across those operations.
1134 #include <isl/space.h>
1135 __isl_give isl_space *isl_space_set_dim_id(
1136 __isl_take isl_space *space,
1137 enum isl_dim_type type, unsigned pos,
1138 __isl_take isl_id *id);
1139 isl_bool isl_space_has_dim_id(__isl_keep isl_space *space,
1140 enum isl_dim_type type, unsigned pos);
1141 __isl_give isl_id *isl_space_get_dim_id(
1142 __isl_keep isl_space *space,
1143 enum isl_dim_type type, unsigned pos);
1144 __isl_give isl_space *isl_space_set_dim_name(
1145 __isl_take isl_space *space,
1146 enum isl_dim_type type, unsigned pos,
1147 __isl_keep const char *name);
1148 isl_bool isl_space_has_dim_name(__isl_keep isl_space *space,
1149 enum isl_dim_type type, unsigned pos);
1150 __isl_keep const char *isl_space_get_dim_name(
1151 __isl_keep isl_space *space,
1152 enum isl_dim_type type, unsigned pos);
1154 #include <isl/local_space.h>
1155 __isl_give isl_local_space *isl_local_space_set_dim_id(
1156 __isl_take isl_local_space *ls,
1157 enum isl_dim_type type, unsigned pos,
1158 __isl_take isl_id *id);
1159 isl_bool isl_local_space_has_dim_id(
1160 __isl_keep isl_local_space *ls,
1161 enum isl_dim_type type, unsigned pos);
1162 __isl_give isl_id *isl_local_space_get_dim_id(
1163 __isl_keep isl_local_space *ls,
1164 enum isl_dim_type type, unsigned pos);
1165 __isl_give isl_local_space *isl_local_space_set_dim_name(
1166 __isl_take isl_local_space *ls,
1167 enum isl_dim_type type, unsigned pos, const char *s);
1168 isl_bool isl_local_space_has_dim_name(
1169 __isl_keep isl_local_space *ls,
1170 enum isl_dim_type type, unsigned pos)
1171 const char *isl_local_space_get_dim_name(
1172 __isl_keep isl_local_space *ls,
1173 enum isl_dim_type type, unsigned pos);
1175 #include <isl/constraint.h>
1176 const char *isl_constraint_get_dim_name(
1177 __isl_keep isl_constraint *constraint,
1178 enum isl_dim_type type, unsigned pos);
1180 #include <isl/set.h>
1181 __isl_give isl_id *isl_basic_set_get_dim_id(
1182 __isl_keep isl_basic_set *bset,
1183 enum isl_dim_type type, unsigned pos);
1184 __isl_give isl_set *isl_set_set_dim_id(
1185 __isl_take isl_set *set, enum isl_dim_type type,
1186 unsigned pos, __isl_take isl_id *id);
1187 isl_bool isl_set_has_dim_id(__isl_keep isl_set *set,
1188 enum isl_dim_type type, unsigned pos);
1189 __isl_give isl_id *isl_set_get_dim_id(
1190 __isl_keep isl_set *set, enum isl_dim_type type,
1192 const char *isl_basic_set_get_dim_name(
1193 __isl_keep isl_basic_set *bset,
1194 enum isl_dim_type type, unsigned pos);
1195 isl_bool isl_set_has_dim_name(__isl_keep isl_set *set,
1196 enum isl_dim_type type, unsigned pos);
1197 const char *isl_set_get_dim_name(
1198 __isl_keep isl_set *set,
1199 enum isl_dim_type type, unsigned pos);
1201 #include <isl/map.h>
1202 __isl_give isl_map *isl_map_set_dim_id(
1203 __isl_take isl_map *map, enum isl_dim_type type,
1204 unsigned pos, __isl_take isl_id *id);
1205 isl_bool isl_basic_map_has_dim_id(
1206 __isl_keep isl_basic_map *bmap,
1207 enum isl_dim_type type, unsigned pos);
1208 isl_bool isl_map_has_dim_id(__isl_keep isl_map *map,
1209 enum isl_dim_type type, unsigned pos);
1210 __isl_give isl_id *isl_map_get_dim_id(
1211 __isl_keep isl_map *map, enum isl_dim_type type,
1213 __isl_give isl_id *isl_union_map_get_dim_id(
1214 __isl_keep isl_union_map *umap,
1215 enum isl_dim_type type, unsigned pos);
1216 const char *isl_basic_map_get_dim_name(
1217 __isl_keep isl_basic_map *bmap,
1218 enum isl_dim_type type, unsigned pos);
1219 isl_bool isl_map_has_dim_name(__isl_keep isl_map *map,
1220 enum isl_dim_type type, unsigned pos);
1221 const char *isl_map_get_dim_name(
1222 __isl_keep isl_map *map,
1223 enum isl_dim_type type, unsigned pos);
1225 #include <isl/val.h>
1226 __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1227 __isl_take isl_multi_val *mv,
1228 enum isl_dim_type type, unsigned pos,
1229 __isl_take isl_id *id);
1230 __isl_give isl_id *isl_multi_val_get_dim_id(
1231 __isl_keep isl_multi_val *mv,
1232 enum isl_dim_type type, unsigned pos);
1233 __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1234 __isl_take isl_multi_val *mv,
1235 enum isl_dim_type type, unsigned pos, const char *s);
1237 #include <isl/aff.h>
1238 __isl_give isl_aff *isl_aff_set_dim_id(
1239 __isl_take isl_aff *aff, enum isl_dim_type type,
1240 unsigned pos, __isl_take isl_id *id);
1241 __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1242 __isl_take isl_multi_aff *maff,
1243 enum isl_dim_type type, unsigned pos,
1244 __isl_take isl_id *id);
1245 __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1246 __isl_take isl_pw_aff *pma,
1247 enum isl_dim_type type, unsigned pos,
1248 __isl_take isl_id *id);
1249 __isl_give isl_multi_pw_aff *
1250 isl_multi_pw_aff_set_dim_id(
1251 __isl_take isl_multi_pw_aff *mpa,
1252 enum isl_dim_type type, unsigned pos,
1253 __isl_take isl_id *id);
1254 __isl_give isl_multi_union_pw_aff *
1255 isl_multi_union_pw_aff_set_dim_id(
1256 __isl_take isl_multi_union_pw_aff *mupa,
1257 enum isl_dim_type type, unsigned pos,
1258 __isl_take isl_id *id);
1259 __isl_give isl_id *isl_multi_aff_get_dim_id(
1260 __isl_keep isl_multi_aff *ma,
1261 enum isl_dim_type type, unsigned pos);
1262 isl_bool isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1263 enum isl_dim_type type, unsigned pos);
1264 __isl_give isl_id *isl_pw_aff_get_dim_id(
1265 __isl_keep isl_pw_aff *pa,
1266 enum isl_dim_type type, unsigned pos);
1267 __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1268 __isl_keep isl_pw_multi_aff *pma,
1269 enum isl_dim_type type, unsigned pos);
1270 __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1271 __isl_keep isl_multi_pw_aff *mpa,
1272 enum isl_dim_type type, unsigned pos);
1273 __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1274 __isl_keep isl_multi_union_pw_aff *mupa,
1275 enum isl_dim_type type, unsigned pos);
1276 __isl_give isl_aff *isl_aff_set_dim_name(
1277 __isl_take isl_aff *aff, enum isl_dim_type type,
1278 unsigned pos, const char *s);
1279 __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1280 __isl_take isl_multi_aff *maff,
1281 enum isl_dim_type type, unsigned pos, const char *s);
1282 __isl_give isl_multi_pw_aff *
1283 isl_multi_pw_aff_set_dim_name(
1284 __isl_take isl_multi_pw_aff *mpa,
1285 enum isl_dim_type type, unsigned pos, const char *s);
1286 __isl_give isl_union_pw_aff *
1287 isl_union_pw_aff_set_dim_name(
1288 __isl_take isl_union_pw_aff *upa,
1289 enum isl_dim_type type, unsigned pos,
1291 __isl_give isl_union_pw_multi_aff *
1292 isl_union_pw_multi_aff_set_dim_name(
1293 __isl_take isl_union_pw_multi_aff *upma,
1294 enum isl_dim_type type, unsigned pos,
1296 __isl_give isl_multi_union_pw_aff *
1297 isl_multi_union_pw_aff_set_dim_name(
1298 __isl_take isl_multi_union_pw_aff *mupa,
1299 enum isl_dim_type type, unsigned pos,
1300 const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1301 enum isl_dim_type type, unsigned pos);
1302 const char *isl_pw_aff_get_dim_name(
1303 __isl_keep isl_pw_aff *pa,
1304 enum isl_dim_type type, unsigned pos);
1305 const char *isl_pw_multi_aff_get_dim_name(
1306 __isl_keep isl_pw_multi_aff *pma,
1307 enum isl_dim_type type, unsigned pos);
1309 #include <isl/polynomial.h>
1310 __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1311 __isl_take isl_qpolynomial *qp,
1312 enum isl_dim_type type, unsigned pos,
1314 __isl_give isl_pw_qpolynomial *
1315 isl_pw_qpolynomial_set_dim_name(
1316 __isl_take isl_pw_qpolynomial *pwqp,
1317 enum isl_dim_type type, unsigned pos,
1319 __isl_give isl_pw_qpolynomial_fold *
1320 isl_pw_qpolynomial_fold_set_dim_name(
1321 __isl_take isl_pw_qpolynomial_fold *pwf,
1322 enum isl_dim_type type, unsigned pos,
1324 __isl_give isl_union_pw_qpolynomial *
1325 isl_union_pw_qpolynomial_set_dim_name(
1326 __isl_take isl_union_pw_qpolynomial *upwqp,
1327 enum isl_dim_type type, unsigned pos,
1329 __isl_give isl_union_pw_qpolynomial_fold *
1330 isl_union_pw_qpolynomial_fold_set_dim_name(
1331 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1332 enum isl_dim_type type, unsigned pos,
1335 Note that C<isl_space_get_name> returns a pointer to some internal
1336 data structure, so the result can only be used while the
1337 corresponding C<isl_space> is alive.
1338 Also note that every function that operates on two sets or relations
1339 requires that both arguments have the same parameters. This also
1340 means that if one of the arguments has named parameters, then the
1341 other needs to have named parameters too and the names need to match.
1342 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1343 arguments may have different parameters (as long as they are named),
1344 in which case the result will have as parameters the union of the parameters of
1347 Given the identifier or name of a dimension (typically a parameter),
1348 its position can be obtained from the following functions.
1350 #include <isl/space.h>
1351 int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1352 enum isl_dim_type type, __isl_keep isl_id *id);
1353 int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1354 enum isl_dim_type type, const char *name);
1356 #include <isl/local_space.h>
1357 int isl_local_space_find_dim_by_name(
1358 __isl_keep isl_local_space *ls,
1359 enum isl_dim_type type, const char *name);
1361 #include <isl/val.h>
1362 int isl_multi_val_find_dim_by_id(
1363 __isl_keep isl_multi_val *mv,
1364 enum isl_dim_type type, __isl_keep isl_id *id);
1365 int isl_multi_val_find_dim_by_name(
1366 __isl_keep isl_multi_val *mv,
1367 enum isl_dim_type type, const char *name);
1369 #include <isl/set.h>
1370 int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1371 enum isl_dim_type type, __isl_keep isl_id *id);
1372 int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1373 enum isl_dim_type type, const char *name);
1375 #include <isl/map.h>
1376 int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1377 enum isl_dim_type type, __isl_keep isl_id *id);
1378 int isl_basic_map_find_dim_by_name(
1379 __isl_keep isl_basic_map *bmap,
1380 enum isl_dim_type type, const char *name);
1381 int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1382 enum isl_dim_type type, const char *name);
1383 int isl_union_map_find_dim_by_name(
1384 __isl_keep isl_union_map *umap,
1385 enum isl_dim_type type, const char *name);
1387 #include <isl/aff.h>
1388 int isl_multi_aff_find_dim_by_id(
1389 __isl_keep isl_multi_aff *ma,
1390 enum isl_dim_type type, __isl_keep isl_id *id);
1391 int isl_multi_pw_aff_find_dim_by_id(
1392 __isl_keep isl_multi_pw_aff *mpa,
1393 enum isl_dim_type type, __isl_keep isl_id *id);
1394 int isl_multi_union_pw_aff_find_dim_by_id(
1395 __isl_keep isl_union_multi_pw_aff *mupa,
1396 enum isl_dim_type type, __isl_keep isl_id *id);
1397 int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1398 enum isl_dim_type type, const char *name);
1399 int isl_multi_aff_find_dim_by_name(
1400 __isl_keep isl_multi_aff *ma,
1401 enum isl_dim_type type, const char *name);
1402 int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1403 enum isl_dim_type type, const char *name);
1404 int isl_multi_pw_aff_find_dim_by_name(
1405 __isl_keep isl_multi_pw_aff *mpa,
1406 enum isl_dim_type type, const char *name);
1407 int isl_pw_multi_aff_find_dim_by_name(
1408 __isl_keep isl_pw_multi_aff *pma,
1409 enum isl_dim_type type, const char *name);
1410 int isl_union_pw_aff_find_dim_by_name(
1411 __isl_keep isl_union_pw_aff *upa,
1412 enum isl_dim_type type, const char *name);
1413 int isl_union_pw_multi_aff_find_dim_by_name(
1414 __isl_keep isl_union_pw_multi_aff *upma,
1415 enum isl_dim_type type, const char *name);
1416 int isl_multi_union_pw_aff_find_dim_by_name(
1417 __isl_keep isl_multi_union_pw_aff *mupa,
1418 enum isl_dim_type type, const char *name);
1420 #include <isl/polynomial.h>
1421 int isl_pw_qpolynomial_find_dim_by_name(
1422 __isl_keep isl_pw_qpolynomial *pwqp,
1423 enum isl_dim_type type, const char *name);
1424 int isl_pw_qpolynomial_fold_find_dim_by_name(
1425 __isl_keep isl_pw_qpolynomial_fold *pwf,
1426 enum isl_dim_type type, const char *name);
1427 int isl_union_pw_qpolynomial_find_dim_by_name(
1428 __isl_keep isl_union_pw_qpolynomial *upwqp,
1429 enum isl_dim_type type, const char *name);
1430 int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1431 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1432 enum isl_dim_type type, const char *name);
1434 The identifiers or names of entire spaces may be set or read off
1435 using the following functions.
1437 #include <isl/space.h>
1438 __isl_give isl_space *isl_space_set_tuple_id(
1439 __isl_take isl_space *space,
1440 enum isl_dim_type type, __isl_take isl_id *id);
1441 __isl_give isl_space *isl_space_reset_tuple_id(
1442 __isl_take isl_space *space, enum isl_dim_type type);
1443 isl_bool isl_space_has_tuple_id(
1444 __isl_keep isl_space *space,
1445 enum isl_dim_type type);
1446 __isl_give isl_id *isl_space_get_tuple_id(
1447 __isl_keep isl_space *space, enum isl_dim_type type);
1448 __isl_give isl_space *isl_space_set_tuple_name(
1449 __isl_take isl_space *space,
1450 enum isl_dim_type type, const char *s);
1451 isl_bool isl_space_has_tuple_name(
1452 __isl_keep isl_space *space,
1453 enum isl_dim_type type);
1454 const char *isl_space_get_tuple_name(__isl_keep isl_space *space,
1455 enum isl_dim_type type);
1457 #include <isl/local_space.h>
1458 __isl_give isl_local_space *isl_local_space_set_tuple_id(
1459 __isl_take isl_local_space *ls,
1460 enum isl_dim_type type, __isl_take isl_id *id);
1462 #include <isl/set.h>
1463 __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1464 __isl_take isl_basic_set *bset,
1465 __isl_take isl_id *id);
1466 __isl_give isl_set *isl_set_set_tuple_id(
1467 __isl_take isl_set *set, __isl_take isl_id *id);
1468 __isl_give isl_set *isl_set_reset_tuple_id(
1469 __isl_take isl_set *set);
1470 isl_bool isl_set_has_tuple_id(__isl_keep isl_set *set);
1471 __isl_give isl_id *isl_set_get_tuple_id(
1472 __isl_keep isl_set *set);
1473 __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1474 __isl_take isl_basic_set *set, const char *s);
1475 __isl_give isl_set *isl_set_set_tuple_name(
1476 __isl_take isl_set *set, const char *s);
1477 const char *isl_basic_set_get_tuple_name(
1478 __isl_keep isl_basic_set *bset);
1479 isl_bool isl_set_has_tuple_name(__isl_keep isl_set *set);
1480 const char *isl_set_get_tuple_name(
1481 __isl_keep isl_set *set);
1483 #include <isl/map.h>
1484 __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1485 __isl_take isl_basic_map *bmap,
1486 enum isl_dim_type type, __isl_take isl_id *id);
1487 __isl_give isl_map *isl_map_set_tuple_id(
1488 __isl_take isl_map *map, enum isl_dim_type type,
1489 __isl_take isl_id *id);
1490 __isl_give isl_map *isl_map_reset_tuple_id(
1491 __isl_take isl_map *map, enum isl_dim_type type);
1492 isl_bool isl_map_has_tuple_id(__isl_keep isl_map *map,
1493 enum isl_dim_type type);
1494 __isl_give isl_id *isl_map_get_tuple_id(
1495 __isl_keep isl_map *map, enum isl_dim_type type);
1496 __isl_give isl_map *isl_map_set_tuple_name(
1497 __isl_take isl_map *map,
1498 enum isl_dim_type type, const char *s);
1499 const char *isl_basic_map_get_tuple_name(
1500 __isl_keep isl_basic_map *bmap,
1501 enum isl_dim_type type);
1502 __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1503 __isl_take isl_basic_map *bmap,
1504 enum isl_dim_type type, const char *s);
1505 isl_bool isl_map_has_tuple_name(__isl_keep isl_map *map,
1506 enum isl_dim_type type);
1507 const char *isl_map_get_tuple_name(
1508 __isl_keep isl_map *map,
1509 enum isl_dim_type type);
1511 #include <isl/val.h>
1512 __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1513 __isl_take isl_multi_val *mv,
1514 enum isl_dim_type type, __isl_take isl_id *id);
1515 __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1516 __isl_take isl_multi_val *mv,
1517 enum isl_dim_type type);
1518 isl_bool isl_multi_val_has_tuple_id(
1519 __isl_keep isl_multi_val *mv,
1520 enum isl_dim_type type);
1521 __isl_give isl_id *isl_multi_val_get_tuple_id(
1522 __isl_keep isl_multi_val *mv,
1523 enum isl_dim_type type);
1524 __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1525 __isl_take isl_multi_val *mv,
1526 enum isl_dim_type type, const char *s);
1527 const char *isl_multi_val_get_tuple_name(
1528 __isl_keep isl_multi_val *mv,
1529 enum isl_dim_type type);
1531 #include <isl/aff.h>
1532 __isl_give isl_aff *isl_aff_set_tuple_id(
1533 __isl_take isl_aff *aff,
1534 enum isl_dim_type type, __isl_take isl_id *id);
1535 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1536 __isl_take isl_multi_aff *maff,
1537 enum isl_dim_type type, __isl_take isl_id *id);
1538 __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1539 __isl_take isl_pw_aff *pwaff,
1540 enum isl_dim_type type, __isl_take isl_id *id);
1541 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1542 __isl_take isl_pw_multi_aff *pma,
1543 enum isl_dim_type type, __isl_take isl_id *id);
1544 __isl_give isl_multi_union_pw_aff *
1545 isl_multi_union_pw_aff_set_tuple_id(
1546 __isl_take isl_multi_union_pw_aff *mupa,
1547 enum isl_dim_type type, __isl_take isl_id *id);
1548 __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1549 __isl_take isl_multi_aff *ma,
1550 enum isl_dim_type type);
1551 __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1552 __isl_take isl_pw_aff *pa,
1553 enum isl_dim_type type);
1554 __isl_give isl_multi_pw_aff *
1555 isl_multi_pw_aff_reset_tuple_id(
1556 __isl_take isl_multi_pw_aff *mpa,
1557 enum isl_dim_type type);
1558 __isl_give isl_pw_multi_aff *
1559 isl_pw_multi_aff_reset_tuple_id(
1560 __isl_take isl_pw_multi_aff *pma,
1561 enum isl_dim_type type);
1562 __isl_give isl_multi_union_pw_aff *
1563 isl_multi_union_pw_aff_reset_tuple_id(
1564 __isl_take isl_multi_union_pw_aff *mupa,
1565 enum isl_dim_type type);
1566 isl_bool isl_multi_aff_has_tuple_id(
1567 __isl_keep isl_multi_aff *ma,
1568 enum isl_dim_type type);
1569 __isl_give isl_id *isl_multi_aff_get_tuple_id(
1570 __isl_keep isl_multi_aff *ma,
1571 enum isl_dim_type type);
1572 isl_bool isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1573 enum isl_dim_type type);
1574 __isl_give isl_id *isl_pw_aff_get_tuple_id(
1575 __isl_keep isl_pw_aff *pa,
1576 enum isl_dim_type type);
1577 isl_bool isl_pw_multi_aff_has_tuple_id(
1578 __isl_keep isl_pw_multi_aff *pma,
1579 enum isl_dim_type type);
1580 __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1581 __isl_keep isl_pw_multi_aff *pma,
1582 enum isl_dim_type type);
1583 isl_bool isl_multi_pw_aff_has_tuple_id(
1584 __isl_keep isl_multi_pw_aff *mpa,
1585 enum isl_dim_type type);
1586 __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1587 __isl_keep isl_multi_pw_aff *mpa,
1588 enum isl_dim_type type);
1589 isl_bool isl_multi_union_pw_aff_has_tuple_id(
1590 __isl_keep isl_multi_union_pw_aff *mupa,
1591 enum isl_dim_type type);
1592 __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1593 __isl_keep isl_multi_union_pw_aff *mupa,
1594 enum isl_dim_type type);
1595 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1596 __isl_take isl_multi_aff *maff,
1597 enum isl_dim_type type, const char *s);
1598 __isl_give isl_multi_pw_aff *
1599 isl_multi_pw_aff_set_tuple_name(
1600 __isl_take isl_multi_pw_aff *mpa,
1601 enum isl_dim_type type, const char *s);
1602 __isl_give isl_multi_union_pw_aff *
1603 isl_multi_union_pw_aff_set_tuple_name(
1604 __isl_take isl_multi_union_pw_aff *mupa,
1605 enum isl_dim_type type, const char *s);
1606 const char *isl_multi_aff_get_tuple_name(
1607 __isl_keep isl_multi_aff *multi,
1608 enum isl_dim_type type);
1609 isl_bool isl_pw_multi_aff_has_tuple_name(
1610 __isl_keep isl_pw_multi_aff *pma,
1611 enum isl_dim_type type);
1612 const char *isl_pw_multi_aff_get_tuple_name(
1613 __isl_keep isl_pw_multi_aff *pma,
1614 enum isl_dim_type type);
1615 const char *isl_multi_union_pw_aff_get_tuple_name(
1616 __isl_keep isl_multi_union_pw_aff *mupa,
1617 enum isl_dim_type type);
1619 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1620 or C<isl_dim_set>. As with C<isl_space_get_name>,
1621 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1623 Binary operations require the corresponding spaces of their arguments
1624 to have the same name.
1626 To keep the names of all parameters and tuples, but reset the user pointers
1627 of all the corresponding identifiers, use the following function.
1629 #include <isl/space.h>
1630 __isl_give isl_space *isl_space_reset_user(
1631 __isl_take isl_space *space);
1633 #include <isl/set.h>
1634 __isl_give isl_set *isl_set_reset_user(
1635 __isl_take isl_set *set);
1637 #include <isl/map.h>
1638 __isl_give isl_map *isl_map_reset_user(
1639 __isl_take isl_map *map);
1641 #include <isl/union_set.h>
1642 __isl_give isl_union_set *isl_union_set_reset_user(
1643 __isl_take isl_union_set *uset);
1645 #include <isl/union_map.h>
1646 __isl_give isl_union_map *isl_union_map_reset_user(
1647 __isl_take isl_union_map *umap);
1649 #include <isl/val.h>
1650 __isl_give isl_multi_val *isl_multi_val_reset_user(
1651 __isl_take isl_multi_val *mv);
1653 #include <isl/aff.h>
1654 __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1655 __isl_take isl_multi_aff *ma);
1656 __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1657 __isl_take isl_pw_aff *pa);
1658 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1659 __isl_take isl_multi_pw_aff *mpa);
1660 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1661 __isl_take isl_pw_multi_aff *pma);
1662 __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1663 __isl_take isl_union_pw_aff *upa);
1664 __isl_give isl_multi_union_pw_aff *
1665 isl_multi_union_pw_aff_reset_user(
1666 __isl_take isl_multi_union_pw_aff *mupa);
1667 __isl_give isl_union_pw_multi_aff *
1668 isl_union_pw_multi_aff_reset_user(
1669 __isl_take isl_union_pw_multi_aff *upma);
1671 #include <isl/polynomial.h>
1672 __isl_give isl_pw_qpolynomial *
1673 isl_pw_qpolynomial_reset_user(
1674 __isl_take isl_pw_qpolynomial *pwqp);
1675 __isl_give isl_union_pw_qpolynomial *
1676 isl_union_pw_qpolynomial_reset_user(
1677 __isl_take isl_union_pw_qpolynomial *upwqp);
1678 __isl_give isl_pw_qpolynomial_fold *
1679 isl_pw_qpolynomial_fold_reset_user(
1680 __isl_take isl_pw_qpolynomial_fold *pwf);
1681 __isl_give isl_union_pw_qpolynomial_fold *
1682 isl_union_pw_qpolynomial_fold_reset_user(
1683 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1685 Spaces can be nested. In particular, the domain of a set or
1686 the domain or range of a relation can be a nested relation.
1687 This process is also called I<wrapping>.
1688 The functions for detecting, constructing and deconstructing
1689 such nested spaces can be found in the wrapping properties
1690 of L</"Unary Properties">, the wrapping operations
1691 of L</"Unary Operations"> and the Cartesian product operations
1692 of L</"Basic Operations">.
1694 Spaces can be created from other spaces
1695 using the functions described in L</"Unary Operations">
1696 and L</"Binary Operations">.
1700 A local space is essentially a space with
1701 zero or more existentially quantified variables.
1702 The local space of various objects can be obtained
1703 using the following functions.
1705 #include <isl/constraint.h>
1706 __isl_give isl_local_space *isl_constraint_get_local_space(
1707 __isl_keep isl_constraint *constraint);
1709 #include <isl/set.h>
1710 __isl_give isl_local_space *isl_basic_set_get_local_space(
1711 __isl_keep isl_basic_set *bset);
1713 #include <isl/map.h>
1714 __isl_give isl_local_space *isl_basic_map_get_local_space(
1715 __isl_keep isl_basic_map *bmap);
1717 #include <isl/aff.h>
1718 __isl_give isl_local_space *isl_aff_get_domain_local_space(
1719 __isl_keep isl_aff *aff);
1720 __isl_give isl_local_space *isl_aff_get_local_space(
1721 __isl_keep isl_aff *aff);
1723 A new local space can be created from a space using
1725 #include <isl/local_space.h>
1726 __isl_give isl_local_space *isl_local_space_from_space(
1727 __isl_take isl_space *space);
1729 They can be inspected, modified, copied and freed using the following functions.
1731 #include <isl/local_space.h>
1732 isl_bool isl_local_space_is_params(
1733 __isl_keep isl_local_space *ls);
1734 isl_bool isl_local_space_is_set(
1735 __isl_keep isl_local_space *ls);
1736 __isl_give isl_space *isl_local_space_get_space(
1737 __isl_keep isl_local_space *ls);
1738 __isl_give isl_aff *isl_local_space_get_div(
1739 __isl_keep isl_local_space *ls, int pos);
1740 __isl_give isl_local_space *isl_local_space_copy(
1741 __isl_keep isl_local_space *ls);
1742 __isl_null isl_local_space *isl_local_space_free(
1743 __isl_take isl_local_space *ls);
1745 Note that C<isl_local_space_get_div> can only be used on local spaces
1748 Two local spaces can be compared using
1750 isl_bool isl_local_space_is_equal(
1751 __isl_keep isl_local_space *ls1,
1752 __isl_keep isl_local_space *ls2);
1754 Local spaces can be created from other local spaces
1755 using the functions described in L</"Unary Operations">
1756 and L</"Binary Operations">.
1758 =head2 Creating New Sets and Relations
1760 C<isl> has functions for creating some standard sets and relations.
1764 =item * Empty sets and relations
1766 __isl_give isl_basic_set *isl_basic_set_empty(
1767 __isl_take isl_space *space);
1768 __isl_give isl_basic_map *isl_basic_map_empty(
1769 __isl_take isl_space *space);
1770 __isl_give isl_set *isl_set_empty(
1771 __isl_take isl_space *space);
1772 __isl_give isl_map *isl_map_empty(
1773 __isl_take isl_space *space);
1774 __isl_give isl_union_set *isl_union_set_empty(
1775 __isl_take isl_space *space);
1776 __isl_give isl_union_map *isl_union_map_empty(
1777 __isl_take isl_space *space);
1779 For C<isl_union_set>s and C<isl_union_map>s, the space
1780 is only used to specify the parameters.
1782 =item * Universe sets and relations
1784 __isl_give isl_basic_set *isl_basic_set_universe(
1785 __isl_take isl_space *space);
1786 __isl_give isl_basic_map *isl_basic_map_universe(
1787 __isl_take isl_space *space);
1788 __isl_give isl_set *isl_set_universe(
1789 __isl_take isl_space *space);
1790 __isl_give isl_map *isl_map_universe(
1791 __isl_take isl_space *space);
1792 __isl_give isl_union_set *isl_union_set_universe(
1793 __isl_take isl_union_set *uset);
1794 __isl_give isl_union_map *isl_union_map_universe(
1795 __isl_take isl_union_map *umap);
1797 The sets and relations constructed by the functions above
1798 contain all integer values, while those constructed by the
1799 functions below only contain non-negative values.
1801 __isl_give isl_basic_set *isl_basic_set_nat_universe(
1802 __isl_take isl_space *space);
1803 __isl_give isl_basic_map *isl_basic_map_nat_universe(
1804 __isl_take isl_space *space);
1805 __isl_give isl_set *isl_set_nat_universe(
1806 __isl_take isl_space *space);
1807 __isl_give isl_map *isl_map_nat_universe(
1808 __isl_take isl_space *space);
1810 =item * Identity relations
1812 __isl_give isl_basic_map *isl_basic_map_identity(
1813 __isl_take isl_space *space);
1814 __isl_give isl_map *isl_map_identity(
1815 __isl_take isl_space *space);
1817 The number of input and output dimensions in C<space> needs
1820 =item * Lexicographic order
1822 __isl_give isl_map *isl_map_lex_lt(
1823 __isl_take isl_space *set_space);
1824 __isl_give isl_map *isl_map_lex_le(
1825 __isl_take isl_space *set_space);
1826 __isl_give isl_map *isl_map_lex_gt(
1827 __isl_take isl_space *set_space);
1828 __isl_give isl_map *isl_map_lex_ge(
1829 __isl_take isl_space *set_space);
1830 __isl_give isl_map *isl_map_lex_lt_first(
1831 __isl_take isl_space *space, unsigned n);
1832 __isl_give isl_map *isl_map_lex_le_first(
1833 __isl_take isl_space *space, unsigned n);
1834 __isl_give isl_map *isl_map_lex_gt_first(
1835 __isl_take isl_space *space, unsigned n);
1836 __isl_give isl_map *isl_map_lex_ge_first(
1837 __isl_take isl_space *space, unsigned n);
1839 The first four functions take a space for a B<set>
1840 and return relations that express that the elements in the domain
1841 are lexicographically less
1842 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1843 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1844 than the elements in the range.
1845 The last four functions take a space for a map
1846 and return relations that express that the first C<n> dimensions
1847 in the domain are lexicographically less
1848 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1849 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1850 than the first C<n> dimensions in the range.
1854 A basic set or relation can be converted to a set or relation
1855 using the following functions.
1857 __isl_give isl_set *isl_set_from_basic_set(
1858 __isl_take isl_basic_set *bset);
1859 __isl_give isl_map *isl_map_from_basic_map(
1860 __isl_take isl_basic_map *bmap);
1862 Sets and relations can be converted to union sets and relations
1863 using the following functions.
1865 __isl_give isl_union_set *isl_union_set_from_basic_set(
1866 __isl_take isl_basic_set *bset);
1867 __isl_give isl_union_map *isl_union_map_from_basic_map(
1868 __isl_take isl_basic_map *bmap);
1869 __isl_give isl_union_set *isl_union_set_from_set(
1870 __isl_take isl_set *set);
1871 __isl_give isl_union_map *isl_union_map_from_map(
1872 __isl_take isl_map *map);
1874 The inverse conversions below can only be used if the input
1875 union set or relation is known to contain elements in exactly one
1878 __isl_give isl_set *isl_set_from_union_set(
1879 __isl_take isl_union_set *uset);
1880 __isl_give isl_map *isl_map_from_union_map(
1881 __isl_take isl_union_map *umap);
1883 Sets and relations can be copied and freed again using the following
1886 __isl_give isl_basic_set *isl_basic_set_copy(
1887 __isl_keep isl_basic_set *bset);
1888 __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1889 __isl_give isl_union_set *isl_union_set_copy(
1890 __isl_keep isl_union_set *uset);
1891 __isl_give isl_basic_map *isl_basic_map_copy(
1892 __isl_keep isl_basic_map *bmap);
1893 __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1894 __isl_give isl_union_map *isl_union_map_copy(
1895 __isl_keep isl_union_map *umap);
1896 __isl_null isl_basic_set *isl_basic_set_free(
1897 __isl_take isl_basic_set *bset);
1898 __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1899 __isl_null isl_union_set *isl_union_set_free(
1900 __isl_take isl_union_set *uset);
1901 __isl_null isl_basic_map *isl_basic_map_free(
1902 __isl_take isl_basic_map *bmap);
1903 __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1904 __isl_null isl_union_map *isl_union_map_free(
1905 __isl_take isl_union_map *umap);
1907 Other sets and relations can be constructed by starting
1908 from a universe set or relation, adding equality and/or
1909 inequality constraints and then projecting out the
1910 existentially quantified variables, if any.
1911 Constraints can be constructed, manipulated and
1912 added to (or removed from) (basic) sets and relations
1913 using the following functions.
1915 #include <isl/constraint.h>
1916 __isl_give isl_constraint *isl_constraint_alloc_equality(
1917 __isl_take isl_local_space *ls);
1918 __isl_give isl_constraint *isl_constraint_alloc_inequality(
1919 __isl_take isl_local_space *ls);
1920 __isl_give isl_constraint *isl_constraint_set_constant_si(
1921 __isl_take isl_constraint *constraint, int v);
1922 __isl_give isl_constraint *isl_constraint_set_constant_val(
1923 __isl_take isl_constraint *constraint,
1924 __isl_take isl_val *v);
1925 __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1926 __isl_take isl_constraint *constraint,
1927 enum isl_dim_type type, int pos, int v);
1928 __isl_give isl_constraint *
1929 isl_constraint_set_coefficient_val(
1930 __isl_take isl_constraint *constraint,
1931 enum isl_dim_type type, int pos,
1932 __isl_take isl_val *v);
1933 __isl_give isl_basic_map *isl_basic_map_add_constraint(
1934 __isl_take isl_basic_map *bmap,
1935 __isl_take isl_constraint *constraint);
1936 __isl_give isl_basic_set *isl_basic_set_add_constraint(
1937 __isl_take isl_basic_set *bset,
1938 __isl_take isl_constraint *constraint);
1939 __isl_give isl_map *isl_map_add_constraint(
1940 __isl_take isl_map *map,
1941 __isl_take isl_constraint *constraint);
1942 __isl_give isl_set *isl_set_add_constraint(
1943 __isl_take isl_set *set,
1944 __isl_take isl_constraint *constraint);
1946 For example, to create a set containing the even integers
1947 between 10 and 42, you would use the following code.
1950 isl_local_space *ls;
1952 isl_basic_set *bset;
1954 space = isl_space_set_alloc(ctx, 0, 2);
1955 bset = isl_basic_set_universe(isl_space_copy(space));
1956 ls = isl_local_space_from_space(space);
1958 c = isl_constraint_alloc_equality(isl_local_space_copy(ls));
1959 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1960 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
1961 bset = isl_basic_set_add_constraint(bset, c);
1963 c = isl_constraint_alloc_inequality(isl_local_space_copy(ls));
1964 c = isl_constraint_set_constant_si(c, -10);
1965 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
1966 bset = isl_basic_set_add_constraint(bset, c);
1968 c = isl_constraint_alloc_inequality(ls);
1969 c = isl_constraint_set_constant_si(c, 42);
1970 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1971 bset = isl_basic_set_add_constraint(bset, c);
1973 bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
1977 isl_basic_set *bset;
1978 bset = isl_basic_set_read_from_str(ctx,
1979 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
1981 A basic set or relation can also be constructed from two matrices
1982 describing the equalities and the inequalities.
1984 __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
1985 __isl_take isl_space *space,
1986 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1987 enum isl_dim_type c1,
1988 enum isl_dim_type c2, enum isl_dim_type c3,
1989 enum isl_dim_type c4);
1990 __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
1991 __isl_take isl_space *space,
1992 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1993 enum isl_dim_type c1,
1994 enum isl_dim_type c2, enum isl_dim_type c3,
1995 enum isl_dim_type c4, enum isl_dim_type c5);
1997 The C<isl_dim_type> arguments indicate the order in which
1998 different kinds of variables appear in the input matrices
1999 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
2000 C<isl_dim_set> and C<isl_dim_div> for sets and
2001 of C<isl_dim_cst>, C<isl_dim_param>,
2002 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
2004 A (basic or union) set or relation can also be constructed from a
2005 (union) (piecewise) (multiple) affine expression
2006 or a list of affine expressions
2007 (See L</"Functions">).
2009 __isl_give isl_basic_map *isl_basic_map_from_aff(
2010 __isl_take isl_aff *aff);
2011 __isl_give isl_map *isl_map_from_aff(
2012 __isl_take isl_aff *aff);
2013 __isl_give isl_set *isl_set_from_pw_aff(
2014 __isl_take isl_pw_aff *pwaff);
2015 __isl_give isl_map *isl_map_from_pw_aff(
2016 __isl_take isl_pw_aff *pwaff);
2017 __isl_give isl_basic_map *isl_basic_map_from_aff_list(
2018 __isl_take isl_space *domain_space,
2019 __isl_take isl_aff_list *list);
2020 __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
2021 __isl_take isl_multi_aff *maff)
2022 __isl_give isl_map *isl_map_from_multi_aff(
2023 __isl_take isl_multi_aff *maff)
2024 __isl_give isl_set *isl_set_from_pw_multi_aff(
2025 __isl_take isl_pw_multi_aff *pma);
2026 __isl_give isl_map *isl_map_from_pw_multi_aff(
2027 __isl_take isl_pw_multi_aff *pma);
2028 __isl_give isl_set *isl_set_from_multi_pw_aff(
2029 __isl_take isl_multi_pw_aff *mpa);
2030 __isl_give isl_map *isl_map_from_multi_pw_aff(
2031 __isl_take isl_multi_pw_aff *mpa);
2032 __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
2033 __isl_take isl_union_pw_aff *upa);
2034 __isl_give isl_union_map *
2035 isl_union_map_from_union_pw_multi_aff(
2036 __isl_take isl_union_pw_multi_aff *upma);
2037 __isl_give isl_union_map *
2038 isl_union_map_from_multi_union_pw_aff(
2039 __isl_take isl_multi_union_pw_aff *mupa);
2041 The C<domain_space> argument describes the domain of the resulting
2042 basic relation. It is required because the C<list> may consist
2043 of zero affine expressions.
2044 The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
2045 is not allowed to be zero-dimensional. The domain of the result
2046 is the shared domain of the union piecewise affine elements.
2048 =head2 Inspecting Sets and Relations
2050 Usually, the user should not have to care about the actual constraints
2051 of the sets and maps, but should instead apply the abstract operations
2052 explained in the following sections.
2053 Occasionally, however, it may be required to inspect the individual
2054 coefficients of the constraints. This section explains how to do so.
2055 In these cases, it may also be useful to have C<isl> compute
2056 an explicit representation of the existentially quantified variables.
2058 __isl_give isl_set *isl_set_compute_divs(
2059 __isl_take isl_set *set);
2060 __isl_give isl_map *isl_map_compute_divs(
2061 __isl_take isl_map *map);
2062 __isl_give isl_union_set *isl_union_set_compute_divs(
2063 __isl_take isl_union_set *uset);
2064 __isl_give isl_union_map *isl_union_map_compute_divs(
2065 __isl_take isl_union_map *umap);
2067 This explicit representation defines the existentially quantified
2068 variables as integer divisions of the other variables, possibly
2069 including earlier existentially quantified variables.
2070 An explicitly represented existentially quantified variable therefore
2071 has a unique value when the values of the other variables are known.
2072 If, furthermore, the same existentials, i.e., existentials
2073 with the same explicit representations, should appear in the
2074 same order in each of the disjuncts of a set or map, then the user should call
2075 either of the following functions.
2077 __isl_give isl_set *isl_set_align_divs(
2078 __isl_take isl_set *set);
2079 __isl_give isl_map *isl_map_align_divs(
2080 __isl_take isl_map *map);
2082 Alternatively, the existentially quantified variables can be removed
2083 using the following functions, which compute an overapproximation.
2085 __isl_give isl_basic_set *isl_basic_set_remove_divs(
2086 __isl_take isl_basic_set *bset);
2087 __isl_give isl_basic_map *isl_basic_map_remove_divs(
2088 __isl_take isl_basic_map *bmap);
2089 __isl_give isl_set *isl_set_remove_divs(
2090 __isl_take isl_set *set);
2091 __isl_give isl_map *isl_map_remove_divs(
2092 __isl_take isl_map *map);
2094 It is also possible to only remove those divs that are defined
2095 in terms of a given range of dimensions or only those for which
2096 no explicit representation is known.
2098 __isl_give isl_basic_set *
2099 isl_basic_set_remove_divs_involving_dims(
2100 __isl_take isl_basic_set *bset,
2101 enum isl_dim_type type,
2102 unsigned first, unsigned n);
2103 __isl_give isl_basic_map *
2104 isl_basic_map_remove_divs_involving_dims(
2105 __isl_take isl_basic_map *bmap,
2106 enum isl_dim_type type,
2107 unsigned first, unsigned n);
2108 __isl_give isl_set *isl_set_remove_divs_involving_dims(
2109 __isl_take isl_set *set, enum isl_dim_type type,
2110 unsigned first, unsigned n);
2111 __isl_give isl_map *isl_map_remove_divs_involving_dims(
2112 __isl_take isl_map *map, enum isl_dim_type type,
2113 unsigned first, unsigned n);
2115 __isl_give isl_basic_set *
2116 isl_basic_set_remove_unknown_divs(
2117 __isl_take isl_basic_set *bset);
2118 __isl_give isl_set *isl_set_remove_unknown_divs(
2119 __isl_take isl_set *set);
2120 __isl_give isl_map *isl_map_remove_unknown_divs(
2121 __isl_take isl_map *map);
2123 To iterate over all the sets or maps in a union set or map, use
2125 isl_stat isl_union_set_foreach_set(
2126 __isl_keep isl_union_set *uset,
2127 isl_stat (*fn)(__isl_take isl_set *set, void *user),
2129 isl_stat isl_union_map_foreach_map(
2130 __isl_keep isl_union_map *umap,
2131 isl_stat (*fn)(__isl_take isl_map *map, void *user),
2134 The number of sets or maps in a union set or map can be obtained
2137 int isl_union_set_n_set(__isl_keep isl_union_set *uset);
2138 int isl_union_map_n_map(__isl_keep isl_union_map *umap);
2140 To extract the set or map in a given space from a union, use
2142 __isl_give isl_set *isl_union_set_extract_set(
2143 __isl_keep isl_union_set *uset,
2144 __isl_take isl_space *space);
2145 __isl_give isl_map *isl_union_map_extract_map(
2146 __isl_keep isl_union_map *umap,
2147 __isl_take isl_space *space);
2149 To iterate over all the basic sets or maps in a set or map, use
2151 isl_stat isl_set_foreach_basic_set(__isl_keep isl_set *set,
2152 isl_stat (*fn)(__isl_take isl_basic_set *bset,
2155 isl_stat isl_map_foreach_basic_map(__isl_keep isl_map *map,
2156 isl_stat (*fn)(__isl_take isl_basic_map *bmap,
2160 The callback function C<fn> should return 0 if successful and
2161 -1 if an error occurs. In the latter case, or if any other error
2162 occurs, the above functions will return -1.
2164 It should be noted that C<isl> does not guarantee that
2165 the basic sets or maps passed to C<fn> are disjoint.
2166 If this is required, then the user should call one of
2167 the following functions first.
2169 __isl_give isl_set *isl_set_make_disjoint(
2170 __isl_take isl_set *set);
2171 __isl_give isl_map *isl_map_make_disjoint(
2172 __isl_take isl_map *map);
2174 The number of basic sets in a set can be obtained
2175 or the number of basic maps in a map can be obtained
2178 #include <isl/set.h>
2179 int isl_set_n_basic_set(__isl_keep isl_set *set);
2181 #include <isl/map.h>
2182 int isl_map_n_basic_map(__isl_keep isl_map *map);
2184 To iterate over the constraints of a basic set or map, use
2186 #include <isl/constraint.h>
2188 int isl_basic_set_n_constraint(
2189 __isl_keep isl_basic_set *bset);
2190 isl_stat isl_basic_set_foreach_constraint(
2191 __isl_keep isl_basic_set *bset,
2192 isl_stat (*fn)(__isl_take isl_constraint *c,
2195 int isl_basic_map_n_constraint(
2196 __isl_keep isl_basic_map *bmap);
2197 isl_stat isl_basic_map_foreach_constraint(
2198 __isl_keep isl_basic_map *bmap,
2199 isl_stat (*fn)(__isl_take isl_constraint *c,
2202 __isl_null isl_constraint *isl_constraint_free(
2203 __isl_take isl_constraint *c);
2205 Again, the callback function C<fn> should return 0 if successful and
2206 -1 if an error occurs. In the latter case, or if any other error
2207 occurs, the above functions will return -1.
2208 The constraint C<c> represents either an equality or an inequality.
2209 Use the following function to find out whether a constraint
2210 represents an equality. If not, it represents an inequality.
2212 isl_bool isl_constraint_is_equality(
2213 __isl_keep isl_constraint *constraint);
2215 It is also possible to obtain a list of constraints from a basic
2218 #include <isl/constraint.h>
2219 __isl_give isl_constraint_list *
2220 isl_basic_map_get_constraint_list(
2221 __isl_keep isl_basic_map *bmap);
2222 __isl_give isl_constraint_list *
2223 isl_basic_set_get_constraint_list(
2224 __isl_keep isl_basic_set *bset);
2226 These functions require that all existentially quantified variables
2227 have an explicit representation.
2228 The returned list can be manipulated using the functions in L<"Lists">.
2230 The coefficients of the constraints can be inspected using
2231 the following functions.
2233 isl_bool isl_constraint_is_lower_bound(
2234 __isl_keep isl_constraint *constraint,
2235 enum isl_dim_type type, unsigned pos);
2236 isl_bool isl_constraint_is_upper_bound(
2237 __isl_keep isl_constraint *constraint,
2238 enum isl_dim_type type, unsigned pos);
2239 __isl_give isl_val *isl_constraint_get_constant_val(
2240 __isl_keep isl_constraint *constraint);
2241 __isl_give isl_val *isl_constraint_get_coefficient_val(
2242 __isl_keep isl_constraint *constraint,
2243 enum isl_dim_type type, int pos);
2245 The explicit representations of the existentially quantified
2246 variables can be inspected using the following function.
2247 Note that the user is only allowed to use this function
2248 if the inspected set or map is the result of a call
2249 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2250 The existentially quantified variable is equal to the floor
2251 of the returned affine expression. The affine expression
2252 itself can be inspected using the functions in
2255 __isl_give isl_aff *isl_constraint_get_div(
2256 __isl_keep isl_constraint *constraint, int pos);
2258 To obtain the constraints of a basic set or map in matrix
2259 form, use the following functions.
2261 __isl_give isl_mat *isl_basic_set_equalities_matrix(
2262 __isl_keep isl_basic_set *bset,
2263 enum isl_dim_type c1, enum isl_dim_type c2,
2264 enum isl_dim_type c3, enum isl_dim_type c4);
2265 __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2266 __isl_keep isl_basic_set *bset,
2267 enum isl_dim_type c1, enum isl_dim_type c2,
2268 enum isl_dim_type c3, enum isl_dim_type c4);
2269 __isl_give isl_mat *isl_basic_map_equalities_matrix(
2270 __isl_keep isl_basic_map *bmap,
2271 enum isl_dim_type c1,
2272 enum isl_dim_type c2, enum isl_dim_type c3,
2273 enum isl_dim_type c4, enum isl_dim_type c5);
2274 __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2275 __isl_keep isl_basic_map *bmap,
2276 enum isl_dim_type c1,
2277 enum isl_dim_type c2, enum isl_dim_type c3,
2278 enum isl_dim_type c4, enum isl_dim_type c5);
2280 The C<isl_dim_type> arguments dictate the order in which
2281 different kinds of variables appear in the resulting matrix.
2282 For set inputs, they should be a permutation of
2283 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2284 For map inputs, they should be a permutation of
2285 C<isl_dim_cst>, C<isl_dim_param>,
2286 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2290 Points are elements of a set. They can be used to construct
2291 simple sets (boxes) or they can be used to represent the
2292 individual elements of a set.
2293 The zero point (the origin) can be created using
2295 __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2297 The coordinates of a point can be inspected, set and changed
2300 __isl_give isl_val *isl_point_get_coordinate_val(
2301 __isl_keep isl_point *pnt,
2302 enum isl_dim_type type, int pos);
2303 __isl_give isl_point *isl_point_set_coordinate_val(
2304 __isl_take isl_point *pnt,
2305 enum isl_dim_type type, int pos,
2306 __isl_take isl_val *v);
2308 __isl_give isl_point *isl_point_add_ui(
2309 __isl_take isl_point *pnt,
2310 enum isl_dim_type type, int pos, unsigned val);
2311 __isl_give isl_point *isl_point_sub_ui(
2312 __isl_take isl_point *pnt,
2313 enum isl_dim_type type, int pos, unsigned val);
2315 Points can be copied or freed using
2317 __isl_give isl_point *isl_point_copy(
2318 __isl_keep isl_point *pnt);
2319 void isl_point_free(__isl_take isl_point *pnt);
2321 A singleton set can be created from a point using
2323 __isl_give isl_basic_set *isl_basic_set_from_point(
2324 __isl_take isl_point *pnt);
2325 __isl_give isl_set *isl_set_from_point(
2326 __isl_take isl_point *pnt);
2328 and a box can be created from two opposite extremal points using
2330 __isl_give isl_basic_set *isl_basic_set_box_from_points(
2331 __isl_take isl_point *pnt1,
2332 __isl_take isl_point *pnt2);
2333 __isl_give isl_set *isl_set_box_from_points(
2334 __isl_take isl_point *pnt1,
2335 __isl_take isl_point *pnt2);
2337 All elements of a B<bounded> (union) set can be enumerated using
2338 the following functions.
2340 isl_stat isl_set_foreach_point(__isl_keep isl_set *set,
2341 isl_stat (*fn)(__isl_take isl_point *pnt,
2344 isl_stat isl_union_set_foreach_point(
2345 __isl_keep isl_union_set *uset,
2346 isl_stat (*fn)(__isl_take isl_point *pnt,
2350 The function C<fn> is called for each integer point in
2351 C<set> with as second argument the last argument of
2352 the C<isl_set_foreach_point> call. The function C<fn>
2353 should return C<0> on success and C<-1> on failure.
2354 In the latter case, C<isl_set_foreach_point> will stop
2355 enumerating and return C<-1> as well.
2356 If the enumeration is performed successfully and to completion,
2357 then C<isl_set_foreach_point> returns C<0>.
2359 To obtain a single point of a (basic) set, use
2361 __isl_give isl_point *isl_basic_set_sample_point(
2362 __isl_take isl_basic_set *bset);
2363 __isl_give isl_point *isl_set_sample_point(
2364 __isl_take isl_set *set);
2366 If C<set> does not contain any (integer) points, then the
2367 resulting point will be ``void'', a property that can be
2370 isl_bool isl_point_is_void(__isl_keep isl_point *pnt);
2374 Besides sets and relation, C<isl> also supports various types of functions.
2375 Each of these types is derived from the value type (see L</"Values">)
2376 or from one of two primitive function types
2377 through the application of zero or more type constructors.
2378 We first describe the primitive type and then we describe
2379 the types derived from these primitive types.
2381 =head3 Primitive Functions
2383 C<isl> support two primitive function types, quasi-affine
2384 expressions and quasipolynomials.
2385 A quasi-affine expression is defined either over a parameter
2386 space or over a set and is composed of integer constants,
2387 parameters and set variables, addition, subtraction and
2388 integer division by an integer constant.
2389 For example, the quasi-affine expression
2391 [n] -> { [x] -> [2*floor((4 n + x)/9] }
2393 maps C<x> to C<2*floor((4 n + x)/9>.
2394 A quasipolynomial is a polynomial expression in quasi-affine
2395 expression. That is, it additionally allows for multiplication.
2396 Note, though, that it is not allowed to construct an integer
2397 division of an expression involving multiplications.
2398 Here is an example of a quasipolynomial that is not
2399 quasi-affine expression
2401 [n] -> { [x] -> (n*floor((4 n + x)/9) }
2403 Note that the external representations of quasi-affine expressions
2404 and quasipolynomials are different. Quasi-affine expressions
2405 use a notation with square brackets just like binary relations,
2406 while quasipolynomials do not. This might change at some point.
2408 If a primitive function is defined over a parameter space,
2409 then the space of the function itself is that of a set.
2410 If it is defined over a set, then the space of the function
2411 is that of a relation. In both cases, the set space (or
2412 the output space) is single-dimensional, anonymous and unstructured.
2413 To create functions with multiple dimensions or with other kinds
2414 of set or output spaces, use multiple expressions
2415 (see L</"Multiple Expressions">).
2419 =item * Quasi-affine Expressions
2421 Besides the expressions described above, a quasi-affine
2422 expression can also be set to NaN. Such expressions
2423 typically represent a failure to represent a result
2424 as a quasi-affine expression.
2426 The zero quasi affine expression or the quasi affine expression
2427 that is equal to a given value or
2428 a specified dimension on a given domain can be created using
2430 #include <isl/aff.h>
2431 __isl_give isl_aff *isl_aff_zero_on_domain(
2432 __isl_take isl_local_space *ls);
2433 __isl_give isl_aff *isl_aff_val_on_domain(
2434 __isl_take isl_local_space *ls,
2435 __isl_take isl_val *val);
2436 __isl_give isl_aff *isl_aff_var_on_domain(
2437 __isl_take isl_local_space *ls,
2438 enum isl_dim_type type, unsigned pos);
2439 __isl_give isl_aff *isl_aff_nan_on_domain(
2440 __isl_take isl_local_space *ls);
2442 Quasi affine expressions can be copied and freed using
2444 #include <isl/aff.h>
2445 __isl_give isl_aff *isl_aff_copy(
2446 __isl_keep isl_aff *aff);
2447 __isl_null isl_aff *isl_aff_free(
2448 __isl_take isl_aff *aff);
2450 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2451 using the following function. The constraint is required to have
2452 a non-zero coefficient for the specified dimension.
2454 #include <isl/constraint.h>
2455 __isl_give isl_aff *isl_constraint_get_bound(
2456 __isl_keep isl_constraint *constraint,
2457 enum isl_dim_type type, int pos);
2459 The entire affine expression of the constraint can also be extracted
2460 using the following function.
2462 #include <isl/constraint.h>
2463 __isl_give isl_aff *isl_constraint_get_aff(
2464 __isl_keep isl_constraint *constraint);
2466 Conversely, an equality constraint equating
2467 the affine expression to zero or an inequality constraint enforcing
2468 the affine expression to be non-negative, can be constructed using
2470 __isl_give isl_constraint *isl_equality_from_aff(
2471 __isl_take isl_aff *aff);
2472 __isl_give isl_constraint *isl_inequality_from_aff(
2473 __isl_take isl_aff *aff);
2475 The coefficients and the integer divisions of an affine expression
2476 can be inspected using the following functions.
2478 #include <isl/aff.h>
2479 __isl_give isl_val *isl_aff_get_constant_val(
2480 __isl_keep isl_aff *aff);
2481 __isl_give isl_val *isl_aff_get_coefficient_val(
2482 __isl_keep isl_aff *aff,
2483 enum isl_dim_type type, int pos);
2484 int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2485 enum isl_dim_type type, int pos);
2486 __isl_give isl_val *isl_aff_get_denominator_val(
2487 __isl_keep isl_aff *aff);
2488 __isl_give isl_aff *isl_aff_get_div(
2489 __isl_keep isl_aff *aff, int pos);
2491 They can be modified using the following functions.
2493 #include <isl/aff.h>
2494 __isl_give isl_aff *isl_aff_set_constant_si(
2495 __isl_take isl_aff *aff, int v);
2496 __isl_give isl_aff *isl_aff_set_constant_val(
2497 __isl_take isl_aff *aff, __isl_take isl_val *v);
2498 __isl_give isl_aff *isl_aff_set_coefficient_si(
2499 __isl_take isl_aff *aff,
2500 enum isl_dim_type type, int pos, int v);
2501 __isl_give isl_aff *isl_aff_set_coefficient_val(
2502 __isl_take isl_aff *aff,
2503 enum isl_dim_type type, int pos,
2504 __isl_take isl_val *v);
2506 __isl_give isl_aff *isl_aff_add_constant_si(
2507 __isl_take isl_aff *aff, int v);
2508 __isl_give isl_aff *isl_aff_add_constant_val(
2509 __isl_take isl_aff *aff, __isl_take isl_val *v);
2510 __isl_give isl_aff *isl_aff_add_constant_num_si(
2511 __isl_take isl_aff *aff, int v);
2512 __isl_give isl_aff *isl_aff_add_coefficient_si(
2513 __isl_take isl_aff *aff,
2514 enum isl_dim_type type, int pos, int v);
2515 __isl_give isl_aff *isl_aff_add_coefficient_val(
2516 __isl_take isl_aff *aff,
2517 enum isl_dim_type type, int pos,
2518 __isl_take isl_val *v);
2520 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2521 set the I<numerator> of the constant or coefficient, while
2522 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2523 the constant or coefficient as a whole.
2524 The C<add_constant> and C<add_coefficient> functions add an integer
2525 or rational value to
2526 the possibly rational constant or coefficient.
2527 The C<add_constant_num> functions add an integer value to
2530 =item * Quasipolynomials
2532 Some simple quasipolynomials can be created using the following functions.
2534 #include <isl/polynomial.h>
2535 __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2536 __isl_take isl_space *domain);
2537 __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2538 __isl_take isl_space *domain);
2539 __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2540 __isl_take isl_space *domain);
2541 __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2542 __isl_take isl_space *domain);
2543 __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2544 __isl_take isl_space *domain);
2545 __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2546 __isl_take isl_space *domain,
2547 __isl_take isl_val *val);
2548 __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2549 __isl_take isl_space *domain,
2550 enum isl_dim_type type, unsigned pos);
2551 __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2552 __isl_take isl_aff *aff);
2554 Recall that the space in which a quasipolynomial lives is a map space
2555 with a one-dimensional range. The C<domain> argument in some of
2556 the functions above corresponds to the domain of this map space.
2558 Quasipolynomials can be copied and freed again using the following
2561 #include <isl/polynomial.h>
2562 __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2563 __isl_keep isl_qpolynomial *qp);
2564 __isl_null isl_qpolynomial *isl_qpolynomial_free(
2565 __isl_take isl_qpolynomial *qp);
2567 The constant term of a quasipolynomial can be extracted using
2569 __isl_give isl_val *isl_qpolynomial_get_constant_val(
2570 __isl_keep isl_qpolynomial *qp);
2572 To iterate over all terms in a quasipolynomial,
2575 isl_stat isl_qpolynomial_foreach_term(
2576 __isl_keep isl_qpolynomial *qp,
2577 isl_stat (*fn)(__isl_take isl_term *term,
2578 void *user), void *user);
2580 The terms themselves can be inspected and freed using
2583 unsigned isl_term_dim(__isl_keep isl_term *term,
2584 enum isl_dim_type type);
2585 __isl_give isl_val *isl_term_get_coefficient_val(
2586 __isl_keep isl_term *term);
2587 int isl_term_get_exp(__isl_keep isl_term *term,
2588 enum isl_dim_type type, unsigned pos);
2589 __isl_give isl_aff *isl_term_get_div(
2590 __isl_keep isl_term *term, unsigned pos);
2591 void isl_term_free(__isl_take isl_term *term);
2593 Each term is a product of parameters, set variables and
2594 integer divisions. The function C<isl_term_get_exp>
2595 returns the exponent of a given dimensions in the given term.
2601 A reduction represents a maximum or a minimum of its
2603 The only reduction type defined by C<isl> is
2604 C<isl_qpolynomial_fold>.
2606 There are currently no functions to directly create such
2607 objects, but they do appear in the piecewise quasipolynomial
2608 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2610 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2612 Reductions can be copied and freed using
2613 the following functions.
2615 #include <isl/polynomial.h>
2616 __isl_give isl_qpolynomial_fold *
2617 isl_qpolynomial_fold_copy(
2618 __isl_keep isl_qpolynomial_fold *fold);
2619 void isl_qpolynomial_fold_free(
2620 __isl_take isl_qpolynomial_fold *fold);
2622 To iterate over all quasipolynomials in a reduction, use
2624 isl_stat isl_qpolynomial_fold_foreach_qpolynomial(
2625 __isl_keep isl_qpolynomial_fold *fold,
2626 isl_stat (*fn)(__isl_take isl_qpolynomial *qp,
2627 void *user), void *user);
2629 =head3 Multiple Expressions
2631 A multiple expression represents a sequence of zero or
2632 more base expressions, all defined on the same domain space.
2633 The domain space of the multiple expression is the same
2634 as that of the base expressions, but the range space
2635 can be any space. In case the base expressions have
2636 a set space, the corresponding multiple expression
2637 also has a set space.
2638 Objects of the value type do not have an associated space.
2639 The space of a multiple value is therefore always a set space.
2640 Similarly, the space of a multiple union piecewise
2641 affine expression is always a set space.
2643 The multiple expression types defined by C<isl>
2644 are C<isl_multi_val>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
2645 C<isl_multi_union_pw_aff>.
2647 A multiple expression with the value zero for
2648 each output (or set) dimension can be created
2649 using the following functions.
2651 #include <isl/val.h>
2652 __isl_give isl_multi_val *isl_multi_val_zero(
2653 __isl_take isl_space *space);
2655 #include <isl/aff.h>
2656 __isl_give isl_multi_aff *isl_multi_aff_zero(
2657 __isl_take isl_space *space);
2658 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2659 __isl_take isl_space *space);
2660 __isl_give isl_multi_union_pw_aff *
2661 isl_multi_union_pw_aff_zero(
2662 __isl_take isl_space *space);
2664 Since there is no canonical way of representing a zero
2665 value of type C<isl_union_pw_aff>, the space passed
2666 to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
2668 An identity function can be created using the following
2669 functions. The space needs to be that of a relation
2670 with the same number of input and output dimensions.
2672 #include <isl/aff.h>
2673 __isl_give isl_multi_aff *isl_multi_aff_identity(
2674 __isl_take isl_space *space);
2675 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2676 __isl_take isl_space *space);
2678 A function that performs a projection on a universe
2679 relation or set can be created using the following functions.
2680 See also the corresponding
2681 projection operations in L</"Unary Operations">.
2683 #include <isl/aff.h>
2684 __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2685 __isl_take isl_space *space);
2686 __isl_give isl_multi_aff *isl_multi_aff_range_map(
2687 __isl_take isl_space *space);
2688 __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2689 __isl_take isl_space *space,
2690 enum isl_dim_type type,
2691 unsigned first, unsigned n);
2693 A multiple expression can be created from a single
2694 base expression using the following functions.
2695 The space of the created multiple expression is the same
2696 as that of the base expression, except for
2697 C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
2698 lives in a parameter space and the output lives
2699 in a single-dimensional set space.
2701 #include <isl/aff.h>
2702 __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2703 __isl_take isl_aff *aff);
2704 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2705 __isl_take isl_pw_aff *pa);
2706 __isl_give isl_multi_union_pw_aff *
2707 isl_multi_union_pw_aff_from_union_pw_aff(
2708 __isl_take isl_union_pw_aff *upa);
2710 A multiple expression can be created from a list
2711 of base expression in a specified space.
2712 The domain of this space needs to be the same
2713 as the domains of the base expressions in the list.
2714 If the base expressions have a set space (or no associated space),
2715 then this space also needs to be a set space.
2717 #include <isl/val.h>
2718 __isl_give isl_multi_val *isl_multi_val_from_val_list(
2719 __isl_take isl_space *space,
2720 __isl_take isl_val_list *list);
2722 #include <isl/aff.h>
2723 __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2724 __isl_take isl_space *space,
2725 __isl_take isl_aff_list *list);
2726 __isl_give isl_multi_union_pw_aff *
2727 isl_multi_union_pw_aff_from_union_pw_aff_list(
2728 __isl_take isl_space *space,
2729 __isl_take isl_union_pw_aff_list *list);
2731 As a convenience, a multiple piecewise expression can
2732 also be created from a multiple expression.
2733 Each piecewise expression in the result has a single
2736 #include <isl/aff.h>
2737 __isl_give isl_multi_pw_aff *
2738 isl_multi_pw_aff_from_multi_aff(
2739 __isl_take isl_multi_aff *ma);
2741 Similarly, a multiple union expression can be
2742 created from a multiple expression.
2744 #include <isl/aff.h>
2745 __isl_give isl_multi_union_pw_aff *
2746 isl_multi_union_pw_aff_from_multi_aff(
2747 __isl_take isl_multi_aff *ma);
2748 __isl_give isl_multi_union_pw_aff *
2749 isl_multi_union_pw_aff_from_multi_pw_aff(
2750 __isl_take isl_multi_pw_aff *mpa);
2752 A multiple quasi-affine expression can be created from
2753 a multiple value with a given domain space using the following
2756 #include <isl/aff.h>
2757 __isl_give isl_multi_aff *
2758 isl_multi_aff_multi_val_on_space(
2759 __isl_take isl_space *space,
2760 __isl_take isl_multi_val *mv);
2763 a multiple union piecewise affine expression can be created from
2764 a multiple value with a given domain or
2765 a multiple affine expression with a given domain
2766 using the following functions.
2768 #include <isl/aff.h>
2769 __isl_give isl_multi_union_pw_aff *
2770 isl_multi_union_pw_aff_multi_val_on_domain(
2771 __isl_take isl_union_set *domain,
2772 __isl_take isl_multi_val *mv);
2773 __isl_give isl_multi_union_pw_aff *
2774 isl_multi_union_pw_aff_multi_aff_on_domain(
2775 __isl_take isl_union_set *domain,
2776 __isl_take isl_multi_aff *ma);
2778 Multiple expressions can be copied and freed using
2779 the following functions.
2781 #include <isl/val.h>
2782 __isl_give isl_multi_val *isl_multi_val_copy(
2783 __isl_keep isl_multi_val *mv);
2784 __isl_null isl_multi_val *isl_multi_val_free(
2785 __isl_take isl_multi_val *mv);
2787 #include <isl/aff.h>
2788 __isl_give isl_multi_aff *isl_multi_aff_copy(
2789 __isl_keep isl_multi_aff *maff);
2790 __isl_null isl_multi_aff *isl_multi_aff_free(
2791 __isl_take isl_multi_aff *maff);
2792 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2793 __isl_keep isl_multi_pw_aff *mpa);
2794 __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2795 __isl_take isl_multi_pw_aff *mpa);
2796 __isl_give isl_multi_union_pw_aff *
2797 isl_multi_union_pw_aff_copy(
2798 __isl_keep isl_multi_union_pw_aff *mupa);
2799 __isl_null isl_multi_union_pw_aff *
2800 isl_multi_union_pw_aff_free(
2801 __isl_take isl_multi_union_pw_aff *mupa);
2803 The base expression at a given position of a multiple
2804 expression can be extracted using the following functions.
2806 #include <isl/val.h>
2807 __isl_give isl_val *isl_multi_val_get_val(
2808 __isl_keep isl_multi_val *mv, int pos);
2810 #include <isl/aff.h>
2811 __isl_give isl_aff *isl_multi_aff_get_aff(
2812 __isl_keep isl_multi_aff *multi, int pos);
2813 __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2814 __isl_keep isl_multi_pw_aff *mpa, int pos);
2815 __isl_give isl_union_pw_aff *
2816 isl_multi_union_pw_aff_get_union_pw_aff(
2817 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
2819 It can be replaced using the following functions.
2821 #include <isl/val.h>
2822 __isl_give isl_multi_val *isl_multi_val_set_val(
2823 __isl_take isl_multi_val *mv, int pos,
2824 __isl_take isl_val *val);
2826 #include <isl/aff.h>
2827 __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2828 __isl_take isl_multi_aff *multi, int pos,
2829 __isl_take isl_aff *aff);
2830 __isl_give isl_multi_union_pw_aff *
2831 isl_multi_union_pw_aff_set_union_pw_aff(
2832 __isl_take isl_multi_union_pw_aff *mupa, int pos,
2833 __isl_take isl_union_pw_aff *upa);
2835 As a convenience, a sequence of base expressions that have
2836 their domains in a given space can be extracted from a sequence
2837 of union expressions using the following function.
2839 #include <isl/aff.h>
2840 __isl_give isl_multi_pw_aff *
2841 isl_multi_union_pw_aff_extract_multi_pw_aff(
2842 __isl_keep isl_multi_union_pw_aff *mupa,
2843 __isl_take isl_space *space);
2845 Note that there is a difference between C<isl_multi_union_pw_aff>
2846 and C<isl_union_pw_multi_aff> objects. The first is a sequence
2847 of unions of piecewise expressions, while the second is a union
2848 of piecewise sequences. In particular, multiple affine expressions
2849 in an C<isl_union_pw_multi_aff> may live in different spaces,
2850 while there is only a single multiple expression in
2851 an C<isl_multi_union_pw_aff>, which can therefore only live
2852 in a single space. This means that not every
2853 C<isl_union_pw_multi_aff> can be converted to
2854 an C<isl_multi_union_pw_aff>. Conversely, a zero-dimensional
2855 C<isl_multi_union_pw_aff> carries no information
2856 about any possible domain and therefore cannot be converted
2857 to an C<isl_union_pw_multi_aff>. Moreover, the elements
2858 of an C<isl_multi_union_pw_aff> may be defined over different domains,
2859 while each multiple expression inside an C<isl_union_pw_multi_aff>
2860 has a single domain. The conversion of an C<isl_union_pw_multi_aff>
2861 of dimension greater than one may therefore not be exact.
2862 The following functions can
2863 be used to perform these conversions when they are possible.
2865 #include <isl/aff.h>
2866 __isl_give isl_multi_union_pw_aff *
2867 isl_multi_union_pw_aff_from_union_pw_multi_aff(
2868 __isl_take isl_union_pw_multi_aff *upma);
2869 __isl_give isl_union_pw_multi_aff *
2870 isl_union_pw_multi_aff_from_multi_union_pw_aff(
2871 __isl_take isl_multi_union_pw_aff *mupa);
2873 =head3 Piecewise Expressions
2875 A piecewise expression is an expression that is described
2876 using zero or more base expression defined over the same
2877 number of cells in the domain space of the base expressions.
2878 All base expressions are defined over the same
2879 domain space and the cells are disjoint.
2880 The space of a piecewise expression is the same as
2881 that of the base expressions.
2882 If the union of the cells is a strict subset of the domain
2883 space, then the value of the piecewise expression outside
2884 this union is different for types derived from quasi-affine
2885 expressions and those derived from quasipolynomials.
2886 Piecewise expressions derived from quasi-affine expressions
2887 are considered to be undefined outside the union of their cells.
2888 Piecewise expressions derived from quasipolynomials
2889 are considered to be zero outside the union of their cells.
2891 Piecewise quasipolynomials are mainly used by the C<barvinok>
2892 library for representing the number of elements in a parametric set or map.
2893 For example, the piecewise quasipolynomial
2895 [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
2897 represents the number of points in the map
2899 [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
2901 The piecewise expression types defined by C<isl>
2902 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
2903 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
2905 A piecewise expression with no cells can be created using
2906 the following functions.
2908 #include <isl/aff.h>
2909 __isl_give isl_pw_aff *isl_pw_aff_empty(
2910 __isl_take isl_space *space);
2911 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
2912 __isl_take isl_space *space);
2914 A piecewise expression with a single universe cell can be
2915 created using the following functions.
2917 #include <isl/aff.h>
2918 __isl_give isl_pw_aff *isl_pw_aff_from_aff(
2919 __isl_take isl_aff *aff);
2920 __isl_give isl_pw_multi_aff *
2921 isl_pw_multi_aff_from_multi_aff(
2922 __isl_take isl_multi_aff *ma);
2924 #include <isl/polynomial.h>
2925 __isl_give isl_pw_qpolynomial *
2926 isl_pw_qpolynomial_from_qpolynomial(
2927 __isl_take isl_qpolynomial *qp);
2929 A piecewise expression with a single specified cell can be
2930 created using the following functions.
2932 #include <isl/aff.h>
2933 __isl_give isl_pw_aff *isl_pw_aff_alloc(
2934 __isl_take isl_set *set, __isl_take isl_aff *aff);
2935 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
2936 __isl_take isl_set *set,
2937 __isl_take isl_multi_aff *maff);
2939 #include <isl/polynomial.h>
2940 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
2941 __isl_take isl_set *set,
2942 __isl_take isl_qpolynomial *qp);
2944 The following convenience functions first create a base expression and
2945 then create a piecewise expression over a universe domain.
2947 #include <isl/aff.h>
2948 __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
2949 __isl_take isl_local_space *ls);
2950 __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
2951 __isl_take isl_local_space *ls,
2952 enum isl_dim_type type, unsigned pos);
2953 __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
2954 __isl_take isl_local_space *ls);
2955 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
2956 __isl_take isl_space *space);
2957 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
2958 __isl_take isl_space *space);
2959 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
2960 __isl_take isl_space *space);
2961 __isl_give isl_pw_multi_aff *
2962 isl_pw_multi_aff_project_out_map(
2963 __isl_take isl_space *space,
2964 enum isl_dim_type type,
2965 unsigned first, unsigned n);
2967 #include <isl/polynomial.h>
2968 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
2969 __isl_take isl_space *space);
2971 The following convenience functions first create a base expression and
2972 then create a piecewise expression over a given domain.
2974 #include <isl/aff.h>
2975 __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
2976 __isl_take isl_set *domain,
2977 __isl_take isl_val *v);
2978 __isl_give isl_pw_multi_aff *
2979 isl_pw_multi_aff_multi_val_on_domain(
2980 __isl_take isl_set *domain,
2981 __isl_take isl_multi_val *mv);
2983 As a convenience, a piecewise multiple expression can
2984 also be created from a piecewise expression.
2985 Each multiple expression in the result is derived
2986 from the corresponding base expression.
2988 #include <isl/aff.h>
2989 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
2990 __isl_take isl_pw_aff *pa);
2992 Similarly, a piecewise quasipolynomial can be
2993 created from a piecewise quasi-affine expression using
2994 the following function.
2996 #include <isl/polynomial.h>
2997 __isl_give isl_pw_qpolynomial *
2998 isl_pw_qpolynomial_from_pw_aff(
2999 __isl_take isl_pw_aff *pwaff);
3001 Piecewise expressions can be copied and freed using the following functions.
3003 #include <isl/aff.h>
3004 __isl_give isl_pw_aff *isl_pw_aff_copy(
3005 __isl_keep isl_pw_aff *pwaff);
3006 __isl_null isl_pw_aff *isl_pw_aff_free(
3007 __isl_take isl_pw_aff *pwaff);
3008 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
3009 __isl_keep isl_pw_multi_aff *pma);
3010 __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
3011 __isl_take isl_pw_multi_aff *pma);
3013 #include <isl/polynomial.h>
3014 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
3015 __isl_keep isl_pw_qpolynomial *pwqp);
3016 __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
3017 __isl_take isl_pw_qpolynomial *pwqp);
3018 __isl_give isl_pw_qpolynomial_fold *
3019 isl_pw_qpolynomial_fold_copy(
3020 __isl_keep isl_pw_qpolynomial_fold *pwf);
3021 __isl_null isl_pw_qpolynomial_fold *
3022 isl_pw_qpolynomial_fold_free(
3023 __isl_take isl_pw_qpolynomial_fold *pwf);
3025 To iterate over the different cells of a piecewise expression,
3026 use the following functions.
3028 #include <isl/aff.h>
3029 isl_bool isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
3030 int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
3031 isl_stat isl_pw_aff_foreach_piece(
3032 __isl_keep isl_pw_aff *pwaff,
3033 isl_stat (*fn)(__isl_take isl_set *set,
3034 __isl_take isl_aff *aff,
3035 void *user), void *user);
3036 isl_stat isl_pw_multi_aff_foreach_piece(
3037 __isl_keep isl_pw_multi_aff *pma,
3038 isl_stat (*fn)(__isl_take isl_set *set,
3039 __isl_take isl_multi_aff *maff,
3040 void *user), void *user);
3042 #include <isl/polynomial.h>
3043 isl_stat isl_pw_qpolynomial_foreach_piece(
3044 __isl_keep isl_pw_qpolynomial *pwqp,
3045 isl_stat (*fn)(__isl_take isl_set *set,
3046 __isl_take isl_qpolynomial *qp,
3047 void *user), void *user);
3048 isl_stat isl_pw_qpolynomial_foreach_lifted_piece(
3049 __isl_keep isl_pw_qpolynomial *pwqp,
3050 isl_stat (*fn)(__isl_take isl_set *set,
3051 __isl_take isl_qpolynomial *qp,
3052 void *user), void *user);
3053 isl_stat isl_pw_qpolynomial_fold_foreach_piece(
3054 __isl_keep isl_pw_qpolynomial_fold *pwf,
3055 isl_stat (*fn)(__isl_take isl_set *set,
3056 __isl_take isl_qpolynomial_fold *fold,
3057 void *user), void *user);
3058 isl_stat isl_pw_qpolynomial_fold_foreach_lifted_piece(
3059 __isl_keep isl_pw_qpolynomial_fold *pwf,
3060 isl_stat (*fn)(__isl_take isl_set *set,
3061 __isl_take isl_qpolynomial_fold *fold,
3062 void *user), void *user);
3064 As usual, the function C<fn> should return C<0> on success
3065 and C<-1> on failure. The difference between
3066 C<isl_pw_qpolynomial_foreach_piece> and
3067 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
3068 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
3069 compute unique representations for all existentially quantified
3070 variables and then turn these existentially quantified variables
3071 into extra set variables, adapting the associated quasipolynomial
3072 accordingly. This means that the C<set> passed to C<fn>
3073 will not have any existentially quantified variables, but that
3074 the dimensions of the sets may be different for different
3075 invocations of C<fn>.
3076 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
3077 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
3079 A piecewise expression consisting of the expressions at a given
3080 position of a piecewise multiple expression can be extracted
3081 using the following function.
3083 #include <isl/aff.h>
3084 __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3085 __isl_keep isl_pw_multi_aff *pma, int pos);
3087 These expressions can be replaced using the following function.
3089 #include <isl/aff.h>
3090 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3091 __isl_take isl_pw_multi_aff *pma, unsigned pos,
3092 __isl_take isl_pw_aff *pa);
3094 Note that there is a difference between C<isl_multi_pw_aff> and
3095 C<isl_pw_multi_aff> objects. The first is a sequence of piecewise
3096 affine expressions, while the second is a piecewise sequence
3097 of affine expressions. In particular, each of the piecewise
3098 affine expressions in an C<isl_multi_pw_aff> may have a different
3099 domain, while all multiple expressions associated to a cell
3100 in an C<isl_pw_multi_aff> have the same domain.
3101 It is possible to convert between the two, but when converting
3102 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3103 of the result is the intersection of the domains of the input.
3104 The reverse conversion is exact.
3106 #include <isl/aff.h>
3107 __isl_give isl_pw_multi_aff *
3108 isl_pw_multi_aff_from_multi_pw_aff(
3109 __isl_take isl_multi_pw_aff *mpa);
3110 __isl_give isl_multi_pw_aff *
3111 isl_multi_pw_aff_from_pw_multi_aff(
3112 __isl_take isl_pw_multi_aff *pma);
3114 =head3 Union Expressions
3116 A union expression collects base expressions defined
3117 over different domains. The space of a union expression
3118 is that of the shared parameter space.
3120 The union expression types defined by C<isl>
3121 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3122 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3124 An empty union expression can be created using the following functions.
3126 #include <isl/aff.h>
3127 __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
3128 __isl_take isl_space *space);
3129 __isl_give isl_union_pw_multi_aff *
3130 isl_union_pw_multi_aff_empty(
3131 __isl_take isl_space *space);
3133 #include <isl/polynomial.h>
3134 __isl_give isl_union_pw_qpolynomial *
3135 isl_union_pw_qpolynomial_zero(
3136 __isl_take isl_space *space);
3138 A union expression containing a single base expression
3139 can be created using the following functions.
3141 #include <isl/aff.h>
3142 __isl_give isl_union_pw_aff *
3143 isl_union_pw_aff_from_pw_aff(
3144 __isl_take isl_pw_aff *pa);
3145 __isl_give isl_union_pw_multi_aff *
3146 isl_union_pw_multi_aff_from_aff(
3147 __isl_take isl_aff *aff);
3148 __isl_give isl_union_pw_multi_aff *
3149 isl_union_pw_multi_aff_from_pw_multi_aff(
3150 __isl_take isl_pw_multi_aff *pma);
3152 #include <isl/polynomial.h>
3153 __isl_give isl_union_pw_qpolynomial *
3154 isl_union_pw_qpolynomial_from_pw_qpolynomial(
3155 __isl_take isl_pw_qpolynomial *pwqp);
3157 The following functions create a base expression on each
3158 of the sets in the union set and collect the results.
3160 #include <isl/aff.h>
3161 __isl_give isl_union_pw_multi_aff *
3162 isl_union_pw_multi_aff_from_union_pw_aff(
3163 __isl_take isl_union_pw_aff *upa);
3164 __isl_give isl_union_pw_aff *
3165 isl_union_pw_multi_aff_get_union_pw_aff(
3166 __isl_keep isl_union_pw_multi_aff *upma, int pos);
3167 __isl_give isl_union_pw_aff *
3168 isl_union_pw_aff_val_on_domain(
3169 __isl_take isl_union_set *domain,
3170 __isl_take isl_val *v);
3171 __isl_give isl_union_pw_multi_aff *
3172 isl_union_pw_multi_aff_multi_val_on_domain(
3173 __isl_take isl_union_set *domain,
3174 __isl_take isl_multi_val *mv);
3176 An C<isl_union_pw_aff> that is equal to a (parametric) affine
3177 expression on a given domain can be created using the following
3180 #include <isl/aff.h>
3181 __isl_give isl_union_pw_aff *
3182 isl_union_pw_aff_aff_on_domain(
3183 __isl_take isl_union_set *domain,
3184 __isl_take isl_aff *aff);
3186 A base expression can be added to a union expression using
3187 the following functions.
3189 #include <isl/aff.h>
3190 __isl_give isl_union_pw_aff *
3191 isl_union_pw_aff_add_pw_aff(
3192 __isl_take isl_union_pw_aff *upa,
3193 __isl_take isl_pw_aff *pa);
3194 __isl_give isl_union_pw_multi_aff *
3195 isl_union_pw_multi_aff_add_pw_multi_aff(
3196 __isl_take isl_union_pw_multi_aff *upma,
3197 __isl_take isl_pw_multi_aff *pma);
3199 #include <isl/polynomial.h>
3200 __isl_give isl_union_pw_qpolynomial *
3201 isl_union_pw_qpolynomial_add_pw_qpolynomial(
3202 __isl_take isl_union_pw_qpolynomial *upwqp,
3203 __isl_take isl_pw_qpolynomial *pwqp);
3205 Union expressions can be copied and freed using
3206 the following functions.
3208 #include <isl/aff.h>
3209 __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
3210 __isl_keep isl_union_pw_aff *upa);
3211 __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
3212 __isl_take isl_union_pw_aff *upa);
3213 __isl_give isl_union_pw_multi_aff *
3214 isl_union_pw_multi_aff_copy(
3215 __isl_keep isl_union_pw_multi_aff *upma);
3216 __isl_null isl_union_pw_multi_aff *
3217 isl_union_pw_multi_aff_free(
3218 __isl_take isl_union_pw_multi_aff *upma);
3220 #include <isl/polynomial.h>
3221 __isl_give isl_union_pw_qpolynomial *
3222 isl_union_pw_qpolynomial_copy(
3223 __isl_keep isl_union_pw_qpolynomial *upwqp);
3224 __isl_null isl_union_pw_qpolynomial *
3225 isl_union_pw_qpolynomial_free(
3226 __isl_take isl_union_pw_qpolynomial *upwqp);
3227 __isl_give isl_union_pw_qpolynomial_fold *
3228 isl_union_pw_qpolynomial_fold_copy(
3229 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3230 __isl_null isl_union_pw_qpolynomial_fold *
3231 isl_union_pw_qpolynomial_fold_free(
3232 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3234 To iterate over the base expressions in a union expression,
3235 use the following functions.
3237 #include <isl/aff.h>
3238 int isl_union_pw_aff_n_pw_aff(
3239 __isl_keep isl_union_pw_aff *upa);
3240 isl_stat isl_union_pw_aff_foreach_pw_aff(
3241 __isl_keep isl_union_pw_aff *upa,
3242 isl_stat (*fn)(__isl_take isl_pw_aff *ma,
3243 void *user), void *user);
3244 int isl_union_pw_multi_aff_n_pw_multi_aff(
3245 __isl_keep isl_union_pw_multi_aff *upma);
3246 isl_stat isl_union_pw_multi_aff_foreach_pw_multi_aff(
3247 __isl_keep isl_union_pw_multi_aff *upma,
3248 isl_stat (*fn)(__isl_take isl_pw_multi_aff *pma,
3249 void *user), void *user);
3251 #include <isl/polynomial.h>
3252 int isl_union_pw_qpolynomial_n_pw_qpolynomial(
3253 __isl_keep isl_union_pw_qpolynomial *upwqp);
3254 isl_stat isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3255 __isl_keep isl_union_pw_qpolynomial *upwqp,
3256 isl_stat (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3257 void *user), void *user);
3258 int isl_union_pw_qpolynomial_fold_n_pw_qpolynomial_fold(
3259 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3260 isl_stat isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3261 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3262 isl_stat (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3263 void *user), void *user);
3265 To extract the base expression in a given space from a union, use
3266 the following functions.
3268 #include <isl/aff.h>
3269 __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3270 __isl_keep isl_union_pw_aff *upa,
3271 __isl_take isl_space *space);
3272 __isl_give isl_pw_multi_aff *
3273 isl_union_pw_multi_aff_extract_pw_multi_aff(
3274 __isl_keep isl_union_pw_multi_aff *upma,
3275 __isl_take isl_space *space);
3277 #include <isl/polynomial.h>
3278 __isl_give isl_pw_qpolynomial *
3279 isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3280 __isl_keep isl_union_pw_qpolynomial *upwqp,
3281 __isl_take isl_space *space);
3283 =head2 Input and Output
3285 For set and relation,
3286 C<isl> supports its own input/output format, which is similar
3287 to the C<Omega> format, but also supports the C<PolyLib> format
3289 For other object types, typically only an C<isl> format is supported.
3291 =head3 C<isl> format
3293 The C<isl> format is similar to that of C<Omega>, but has a different
3294 syntax for describing the parameters and allows for the definition
3295 of an existentially quantified variable as the integer division
3296 of an affine expression.
3297 For example, the set of integers C<i> between C<0> and C<n>
3298 such that C<i % 10 <= 6> can be described as
3300 [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3303 A set or relation can have several disjuncts, separated
3304 by the keyword C<or>. Each disjunct is either a conjunction
3305 of constraints or a projection (C<exists>) of a conjunction
3306 of constraints. The constraints are separated by the keyword
3309 =head3 C<PolyLib> format
3311 If the represented set is a union, then the first line
3312 contains a single number representing the number of disjuncts.
3313 Otherwise, a line containing the number C<1> is optional.
3315 Each disjunct is represented by a matrix of constraints.
3316 The first line contains two numbers representing
3317 the number of rows and columns,
3318 where the number of rows is equal to the number of constraints
3319 and the number of columns is equal to two plus the number of variables.
3320 The following lines contain the actual rows of the constraint matrix.
3321 In each row, the first column indicates whether the constraint
3322 is an equality (C<0>) or inequality (C<1>). The final column
3323 corresponds to the constant term.
3325 If the set is parametric, then the coefficients of the parameters
3326 appear in the last columns before the constant column.
3327 The coefficients of any existentially quantified variables appear
3328 between those of the set variables and those of the parameters.
3330 =head3 Extended C<PolyLib> format
3332 The extended C<PolyLib> format is nearly identical to the
3333 C<PolyLib> format. The only difference is that the line
3334 containing the number of rows and columns of a constraint matrix
3335 also contains four additional numbers:
3336 the number of output dimensions, the number of input dimensions,
3337 the number of local dimensions (i.e., the number of existentially
3338 quantified variables) and the number of parameters.
3339 For sets, the number of ``output'' dimensions is equal
3340 to the number of set dimensions, while the number of ``input''
3345 Objects can be read from input using the following functions.
3347 #include <isl/val.h>
3348 __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3350 __isl_give isl_multi_val *isl_multi_val_read_from_str(
3351 isl_ctx *ctx, const char *str);
3353 #include <isl/set.h>
3354 __isl_give isl_basic_set *isl_basic_set_read_from_file(
3355 isl_ctx *ctx, FILE *input);
3356 __isl_give isl_basic_set *isl_basic_set_read_from_str(
3357 isl_ctx *ctx, const char *str);
3358 __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3360 __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3363 #include <isl/map.h>
3364 __isl_give isl_basic_map *isl_basic_map_read_from_file(
3365 isl_ctx *ctx, FILE *input);
3366 __isl_give isl_basic_map *isl_basic_map_read_from_str(
3367 isl_ctx *ctx, const char *str);
3368 __isl_give isl_map *isl_map_read_from_file(
3369 isl_ctx *ctx, FILE *input);
3370 __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3373 #include <isl/union_set.h>
3374 __isl_give isl_union_set *isl_union_set_read_from_file(
3375 isl_ctx *ctx, FILE *input);
3376 __isl_give isl_union_set *isl_union_set_read_from_str(
3377 isl_ctx *ctx, const char *str);
3379 #include <isl/union_map.h>
3380 __isl_give isl_union_map *isl_union_map_read_from_file(
3381 isl_ctx *ctx, FILE *input);
3382 __isl_give isl_union_map *isl_union_map_read_from_str(
3383 isl_ctx *ctx, const char *str);
3385 #include <isl/aff.h>
3386 __isl_give isl_aff *isl_aff_read_from_str(
3387 isl_ctx *ctx, const char *str);
3388 __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3389 isl_ctx *ctx, const char *str);
3390 __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3391 isl_ctx *ctx, const char *str);
3392 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3393 isl_ctx *ctx, const char *str);
3394 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3395 isl_ctx *ctx, const char *str);
3396 __isl_give isl_union_pw_multi_aff *
3397 isl_union_pw_multi_aff_read_from_str(
3398 isl_ctx *ctx, const char *str);
3399 __isl_give isl_multi_union_pw_aff *
3400 isl_multi_union_pw_aff_read_from_str(
3401 isl_ctx *ctx, const char *str);
3403 #include <isl/polynomial.h>
3404 __isl_give isl_union_pw_qpolynomial *
3405 isl_union_pw_qpolynomial_read_from_str(
3406 isl_ctx *ctx, const char *str);
3408 For sets and relations,
3409 the input format is autodetected and may be either the C<PolyLib> format
3410 or the C<isl> format.
3414 Before anything can be printed, an C<isl_printer> needs to
3417 __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3419 __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3420 __isl_null isl_printer *isl_printer_free(
3421 __isl_take isl_printer *printer);
3422 __isl_give char *isl_printer_get_str(
3423 __isl_keep isl_printer *printer);
3425 The printer can be inspected using the following functions.
3427 FILE *isl_printer_get_file(
3428 __isl_keep isl_printer *printer);
3429 int isl_printer_get_output_format(
3430 __isl_keep isl_printer *p);
3431 int isl_printer_get_yaml_style(__isl_keep isl_printer *p);
3433 The behavior of the printer can be modified in various ways
3435 __isl_give isl_printer *isl_printer_set_output_format(
3436 __isl_take isl_printer *p, int output_format);
3437 __isl_give isl_printer *isl_printer_set_indent(
3438 __isl_take isl_printer *p, int indent);
3439 __isl_give isl_printer *isl_printer_set_indent_prefix(
3440 __isl_take isl_printer *p, const char *prefix);
3441 __isl_give isl_printer *isl_printer_indent(
3442 __isl_take isl_printer *p, int indent);
3443 __isl_give isl_printer *isl_printer_set_prefix(
3444 __isl_take isl_printer *p, const char *prefix);
3445 __isl_give isl_printer *isl_printer_set_suffix(
3446 __isl_take isl_printer *p, const char *suffix);
3447 __isl_give isl_printer *isl_printer_set_yaml_style(
3448 __isl_take isl_printer *p, int yaml_style);
3450 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3451 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3452 and defaults to C<ISL_FORMAT_ISL>.
3453 Each line in the output is prefixed by C<indent_prefix>,
3454 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3455 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3456 In the C<PolyLib> format output,
3457 the coefficients of the existentially quantified variables
3458 appear between those of the set variables and those
3460 The function C<isl_printer_indent> increases the indentation
3461 by the specified amount (which may be negative).
3462 The YAML style may be either C<ISL_YAML_STYLE_BLOCK> or
3463 C<ISL_YAML_STYLE_FLOW> and when we are printing something
3466 To actually print something, use
3468 #include <isl/printer.h>
3469 __isl_give isl_printer *isl_printer_print_double(
3470 __isl_take isl_printer *p, double d);
3472 #include <isl/val.h>
3473 __isl_give isl_printer *isl_printer_print_val(
3474 __isl_take isl_printer *p, __isl_keep isl_val *v);
3476 #include <isl/set.h>
3477 __isl_give isl_printer *isl_printer_print_basic_set(
3478 __isl_take isl_printer *printer,
3479 __isl_keep isl_basic_set *bset);
3480 __isl_give isl_printer *isl_printer_print_set(
3481 __isl_take isl_printer *printer,
3482 __isl_keep isl_set *set);
3484 #include <isl/map.h>
3485 __isl_give isl_printer *isl_printer_print_basic_map(
3486 __isl_take isl_printer *printer,
3487 __isl_keep isl_basic_map *bmap);
3488 __isl_give isl_printer *isl_printer_print_map(
3489 __isl_take isl_printer *printer,
3490 __isl_keep isl_map *map);
3492 #include <isl/union_set.h>
3493 __isl_give isl_printer *isl_printer_print_union_set(
3494 __isl_take isl_printer *p,
3495 __isl_keep isl_union_set *uset);
3497 #include <isl/union_map.h>
3498 __isl_give isl_printer *isl_printer_print_union_map(
3499 __isl_take isl_printer *p,
3500 __isl_keep isl_union_map *umap);
3502 #include <isl/val.h>
3503 __isl_give isl_printer *isl_printer_print_multi_val(
3504 __isl_take isl_printer *p,
3505 __isl_keep isl_multi_val *mv);
3507 #include <isl/aff.h>
3508 __isl_give isl_printer *isl_printer_print_aff(
3509 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3510 __isl_give isl_printer *isl_printer_print_multi_aff(
3511 __isl_take isl_printer *p,
3512 __isl_keep isl_multi_aff *maff);
3513 __isl_give isl_printer *isl_printer_print_pw_aff(
3514 __isl_take isl_printer *p,
3515 __isl_keep isl_pw_aff *pwaff);
3516 __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3517 __isl_take isl_printer *p,
3518 __isl_keep isl_pw_multi_aff *pma);
3519 __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3520 __isl_take isl_printer *p,
3521 __isl_keep isl_multi_pw_aff *mpa);
3522 __isl_give isl_printer *isl_printer_print_union_pw_aff(
3523 __isl_take isl_printer *p,
3524 __isl_keep isl_union_pw_aff *upa);
3525 __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3526 __isl_take isl_printer *p,
3527 __isl_keep isl_union_pw_multi_aff *upma);
3528 __isl_give isl_printer *
3529 isl_printer_print_multi_union_pw_aff(
3530 __isl_take isl_printer *p,
3531 __isl_keep isl_multi_union_pw_aff *mupa);
3533 #include <isl/polynomial.h>
3534 __isl_give isl_printer *isl_printer_print_qpolynomial(
3535 __isl_take isl_printer *p,
3536 __isl_keep isl_qpolynomial *qp);
3537 __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3538 __isl_take isl_printer *p,
3539 __isl_keep isl_pw_qpolynomial *pwqp);
3540 __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3541 __isl_take isl_printer *p,
3542 __isl_keep isl_union_pw_qpolynomial *upwqp);
3544 __isl_give isl_printer *
3545 isl_printer_print_pw_qpolynomial_fold(
3546 __isl_take isl_printer *p,
3547 __isl_keep isl_pw_qpolynomial_fold *pwf);
3548 __isl_give isl_printer *
3549 isl_printer_print_union_pw_qpolynomial_fold(
3550 __isl_take isl_printer *p,
3551 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3553 For C<isl_printer_print_qpolynomial>,
3554 C<isl_printer_print_pw_qpolynomial> and
3555 C<isl_printer_print_pw_qpolynomial_fold>,
3556 the output format of the printer
3557 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3558 For C<isl_printer_print_union_pw_qpolynomial> and
3559 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3561 In case of printing in C<ISL_FORMAT_C>, the user may want
3562 to set the names of all dimensions first.
3564 C<isl> also provides limited support for printing YAML documents,
3565 just enough for the internal use for printing such documents.
3567 #include <isl/printer.h>
3568 __isl_give isl_printer *isl_printer_yaml_start_mapping(
3569 __isl_take isl_printer *p);
3570 __isl_give isl_printer *isl_printer_yaml_end_mapping(
3571 __isl_take isl_printer *p);
3572 __isl_give isl_printer *isl_printer_yaml_start_sequence(
3573 __isl_take isl_printer *p);
3574 __isl_give isl_printer *isl_printer_yaml_end_sequence(
3575 __isl_take isl_printer *p);
3576 __isl_give isl_printer *isl_printer_yaml_next(
3577 __isl_take isl_printer *p);
3579 A document is started by a call to either
3580 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3581 Anything printed to the printer after such a call belong to the
3582 first key of the mapping or the first element in the sequence.
3583 The function C<isl_printer_yaml_next> moves to the value if
3584 we are currently printing a mapping key, the next key if we
3585 are printing a value or the next element if we are printing
3586 an element in a sequence.
3587 Nested mappings and sequences are initiated by the same
3588 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3589 Each call to these functions needs to have a corresponding call to
3590 C<isl_printer_yaml_end_mapping> or C<isl_printer_yaml_end_sequence>.
3592 When called on a file printer, the following function flushes
3593 the file. When called on a string printer, the buffer is cleared.
3595 __isl_give isl_printer *isl_printer_flush(
3596 __isl_take isl_printer *p);
3598 Alternatively, a string representation can be obtained
3599 directly using the following functions, which always print
3602 #include <isl/space.h>
3603 __isl_give char *isl_space_to_str(
3604 __isl_keep isl_space *space);
3606 #include <isl/val.h>
3607 __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3608 __isl_give char *isl_multi_val_to_str(
3609 __isl_keep isl_multi_val *mv);
3611 #include <isl/set.h>
3612 __isl_give char *isl_set_to_str(
3613 __isl_keep isl_set *set);
3615 #include <isl/union_set.h>
3616 __isl_give char *isl_union_set_to_str(
3617 __isl_keep isl_union_set *uset);
3619 #include <isl/map.h>
3620 __isl_give char *isl_map_to_str(
3621 __isl_keep isl_map *map);
3623 #include <isl/union_map.h>
3624 __isl_give char *isl_union_map_to_str(
3625 __isl_keep isl_union_map *umap);
3627 #include <isl/aff.h>
3628 __isl_give char *isl_multi_aff_to_str(
3629 __isl_keep isl_multi_aff *aff);
3630 __isl_give char *isl_union_pw_aff_to_str(
3631 __isl_keep isl_union_pw_aff *upa);
3632 __isl_give char *isl_union_pw_multi_aff_to_str(
3633 __isl_keep isl_union_pw_multi_aff *upma);
3634 __isl_give char *isl_multi_union_pw_aff_to_str(
3635 __isl_keep isl_multi_union_pw_aff *mupa);
3639 =head3 Unary Properties
3645 The following functions test whether the given set or relation
3646 contains any integer points. The ``plain'' variants do not perform
3647 any computations, but simply check if the given set or relation
3648 is already known to be empty.
3650 isl_bool isl_basic_set_plain_is_empty(
3651 __isl_keep isl_basic_set *bset);
3652 isl_bool isl_basic_set_is_empty(
3653 __isl_keep isl_basic_set *bset);
3654 isl_bool isl_set_plain_is_empty(
3655 __isl_keep isl_set *set);
3656 isl_bool isl_set_is_empty(__isl_keep isl_set *set);
3657 isl_bool isl_union_set_is_empty(
3658 __isl_keep isl_union_set *uset);
3659 isl_bool isl_basic_map_plain_is_empty(
3660 __isl_keep isl_basic_map *bmap);
3661 isl_bool isl_basic_map_is_empty(
3662 __isl_keep isl_basic_map *bmap);
3663 isl_bool isl_map_plain_is_empty(
3664 __isl_keep isl_map *map);
3665 isl_bool isl_map_is_empty(__isl_keep isl_map *map);
3666 isl_bool isl_union_map_is_empty(
3667 __isl_keep isl_union_map *umap);
3669 =item * Universality
3671 isl_bool isl_basic_set_is_universe(
3672 __isl_keep isl_basic_set *bset);
3673 isl_bool isl_basic_map_is_universe(
3674 __isl_keep isl_basic_map *bmap);
3675 isl_bool isl_set_plain_is_universe(
3676 __isl_keep isl_set *set);
3677 isl_bool isl_map_plain_is_universe(
3678 __isl_keep isl_map *map);
3680 =item * Single-valuedness
3682 #include <isl/set.h>
3683 isl_bool isl_set_is_singleton(__isl_keep isl_set *set);
3685 #include <isl/map.h>
3686 isl_bool isl_basic_map_is_single_valued(
3687 __isl_keep isl_basic_map *bmap);
3688 isl_bool isl_map_plain_is_single_valued(
3689 __isl_keep isl_map *map);
3690 isl_bool isl_map_is_single_valued(__isl_keep isl_map *map);
3692 #include <isl/union_map.h>
3693 isl_bool isl_union_map_is_single_valued(
3694 __isl_keep isl_union_map *umap);
3698 isl_bool isl_map_plain_is_injective(
3699 __isl_keep isl_map *map);
3700 isl_bool isl_map_is_injective(
3701 __isl_keep isl_map *map);
3702 isl_bool isl_union_map_plain_is_injective(
3703 __isl_keep isl_union_map *umap);
3704 isl_bool isl_union_map_is_injective(
3705 __isl_keep isl_union_map *umap);
3709 isl_bool isl_map_is_bijective(
3710 __isl_keep isl_map *map);
3711 isl_bool isl_union_map_is_bijective(
3712 __isl_keep isl_union_map *umap);
3716 __isl_give isl_val *
3717 isl_basic_map_plain_get_val_if_fixed(
3718 __isl_keep isl_basic_map *bmap,
3719 enum isl_dim_type type, unsigned pos);
3720 __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3721 __isl_keep isl_set *set,
3722 enum isl_dim_type type, unsigned pos);
3723 __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3724 __isl_keep isl_map *map,
3725 enum isl_dim_type type, unsigned pos);
3727 If the set or relation obviously lies on a hyperplane where the given dimension
3728 has a fixed value, then return that value.
3729 Otherwise return NaN.
3733 isl_stat isl_set_dim_residue_class_val(
3734 __isl_keep isl_set *set,
3735 int pos, __isl_give isl_val **modulo,
3736 __isl_give isl_val **residue);
3738 Check if the values of the given set dimension are equal to a fixed
3739 value modulo some integer value. If so, assign the modulo to C<*modulo>
3740 and the fixed value to C<*residue>. If the given dimension attains only
3741 a single value, then assign C<0> to C<*modulo> and the fixed value to
3743 If the dimension does not attain only a single value and if no modulo
3744 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3748 To check whether the description of a set, relation or function depends
3749 on one or more given dimensions,
3750 the following functions can be used.
3752 #include <isl/constraint.h>
3753 isl_bool isl_constraint_involves_dims(
3754 __isl_keep isl_constraint *constraint,
3755 enum isl_dim_type type, unsigned first, unsigned n);
3757 #include <isl/set.h>
3758 isl_bool isl_basic_set_involves_dims(
3759 __isl_keep isl_basic_set *bset,
3760 enum isl_dim_type type, unsigned first, unsigned n);
3761 isl_bool isl_set_involves_dims(__isl_keep isl_set *set,
3762 enum isl_dim_type type, unsigned first, unsigned n);
3764 #include <isl/map.h>
3765 isl_bool isl_basic_map_involves_dims(
3766 __isl_keep isl_basic_map *bmap,
3767 enum isl_dim_type type, unsigned first, unsigned n);
3768 isl_bool isl_map_involves_dims(__isl_keep isl_map *map,
3769 enum isl_dim_type type, unsigned first, unsigned n);
3771 #include <isl/union_map.h>
3772 isl_bool isl_union_map_involves_dims(
3773 __isl_keep isl_union_map *umap,
3774 enum isl_dim_type type, unsigned first, unsigned n);
3776 #include <isl/aff.h>
3777 isl_bool isl_aff_involves_dims(__isl_keep isl_aff *aff,
3778 enum isl_dim_type type, unsigned first, unsigned n);
3779 isl_bool isl_pw_aff_involves_dims(
3780 __isl_keep isl_pw_aff *pwaff,
3781 enum isl_dim_type type, unsigned first, unsigned n);
3782 isl_bool isl_multi_aff_involves_dims(
3783 __isl_keep isl_multi_aff *ma,
3784 enum isl_dim_type type, unsigned first, unsigned n);
3785 isl_bool isl_multi_pw_aff_involves_dims(
3786 __isl_keep isl_multi_pw_aff *mpa,
3787 enum isl_dim_type type, unsigned first, unsigned n);
3789 #include <isl/polynomial.h>
3790 isl_bool isl_qpolynomial_involves_dims(
3791 __isl_keep isl_qpolynomial *qp,
3792 enum isl_dim_type type, unsigned first, unsigned n);
3794 Similarly, the following functions can be used to check whether
3795 a given dimension is involved in any lower or upper bound.
3797 #include <isl/set.h>
3798 isl_bool isl_set_dim_has_any_lower_bound(
3799 __isl_keep isl_set *set,
3800 enum isl_dim_type type, unsigned pos);
3801 isl_bool isl_set_dim_has_any_upper_bound(
3802 __isl_keep isl_set *set,
3803 enum isl_dim_type type, unsigned pos);
3805 Note that these functions return true even if there is a bound on
3806 the dimension on only some of the basic sets of C<set>.
3807 To check if they have a bound for all of the basic sets in C<set>,
3808 use the following functions instead.
3810 #include <isl/set.h>
3811 isl_bool isl_set_dim_has_lower_bound(
3812 __isl_keep isl_set *set,
3813 enum isl_dim_type type, unsigned pos);
3814 isl_bool isl_set_dim_has_upper_bound(
3815 __isl_keep isl_set *set,
3816 enum isl_dim_type type, unsigned pos);
3820 To check whether a set is a parameter domain, use this function:
3822 isl_bool isl_set_is_params(__isl_keep isl_set *set);
3823 isl_bool isl_union_set_is_params(
3824 __isl_keep isl_union_set *uset);
3828 The following functions check whether the space of the given
3829 (basic) set or relation range is a wrapped relation.
3831 #include <isl/space.h>
3832 isl_bool isl_space_is_wrapping(
3833 __isl_keep isl_space *space);
3834 isl_bool isl_space_domain_is_wrapping(
3835 __isl_keep isl_space *space);
3836 isl_bool isl_space_range_is_wrapping(
3837 __isl_keep isl_space *space);
3839 #include <isl/set.h>
3840 isl_bool isl_basic_set_is_wrapping(
3841 __isl_keep isl_basic_set *bset);
3842 isl_bool isl_set_is_wrapping(__isl_keep isl_set *set);
3844 #include <isl/map.h>
3845 isl_bool isl_map_domain_is_wrapping(
3846 __isl_keep isl_map *map);
3847 isl_bool isl_map_range_is_wrapping(
3848 __isl_keep isl_map *map);
3850 #include <isl/val.h>
3851 isl_bool isl_multi_val_range_is_wrapping(
3852 __isl_keep isl_multi_val *mv);
3854 #include <isl/aff.h>
3855 isl_bool isl_multi_aff_range_is_wrapping(
3856 __isl_keep isl_multi_aff *ma);
3857 isl_bool isl_multi_pw_aff_range_is_wrapping(
3858 __isl_keep isl_multi_pw_aff *mpa);
3859 isl_bool isl_multi_union_pw_aff_range_is_wrapping(
3860 __isl_keep isl_multi_union_pw_aff *mupa);
3862 The input to C<isl_space_is_wrapping> should
3863 be the space of a set, while that of
3864 C<isl_space_domain_is_wrapping> and
3865 C<isl_space_range_is_wrapping> should be the space of a relation.
3867 =item * Internal Product
3869 isl_bool isl_basic_map_can_zip(
3870 __isl_keep isl_basic_map *bmap);
3871 isl_bool isl_map_can_zip(__isl_keep isl_map *map);
3873 Check whether the product of domain and range of the given relation
3875 i.e., whether both domain and range are nested relations.
3879 isl_bool isl_basic_map_can_curry(
3880 __isl_keep isl_basic_map *bmap);
3881 isl_bool isl_map_can_curry(__isl_keep isl_map *map);
3883 Check whether the domain of the (basic) relation is a wrapped relation.
3885 isl_bool isl_basic_map_can_uncurry(
3886 __isl_keep isl_basic_map *bmap);
3887 isl_bool isl_map_can_uncurry(__isl_keep isl_map *map);
3889 Check whether the range of the (basic) relation is a wrapped relation.
3891 =item * Special Values
3893 #include <isl/aff.h>
3894 isl_bool isl_aff_is_cst(__isl_keep isl_aff *aff);
3895 isl_bool isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
3897 Check whether the given expression is a constant.
3899 #include <isl/aff.h>
3900 isl_bool isl_aff_is_nan(__isl_keep isl_aff *aff);
3901 isl_bool isl_pw_aff_involves_nan(
3902 __isl_keep isl_pw_aff *pa);
3904 #include <isl/polynomial.h>
3905 isl_bool isl_qpolynomial_fold_is_nan(
3906 __isl_keep isl_qpolynomial_fold *fold);
3908 Check whether the given expression is equal to or involves NaN.
3910 #include <isl/aff.h>
3911 isl_bool isl_aff_plain_is_zero(
3912 __isl_keep isl_aff *aff);
3914 Check whether the affine expression is obviously zero.
3918 =head3 Binary Properties
3924 The following functions check whether two objects
3925 represent the same set, relation or function.
3926 The C<plain> variants only return true if the objects
3927 are obviously the same. That is, they may return false
3928 even if the objects are the same, but they will never
3929 return true if the objects are not the same.
3931 #include <isl/set.h>
3932 isl_bool isl_basic_set_plain_is_equal(
3933 __isl_keep isl_basic_set *bset1,
3934 __isl_keep isl_basic_set *bset2);
3935 isl_bool isl_basic_set_is_equal(
3936 __isl_keep isl_basic_set *bset1,
3937 __isl_keep isl_basic_set *bset2);
3938 isl_bool isl_set_plain_is_equal(
3939 __isl_keep isl_set *set1,
3940 __isl_keep isl_set *set2);
3941 isl_bool isl_set_is_equal(__isl_keep isl_set *set1,
3942 __isl_keep isl_set *set2);
3944 #include <isl/map.h>
3945 isl_bool isl_basic_map_is_equal(
3946 __isl_keep isl_basic_map *bmap1,
3947 __isl_keep isl_basic_map *bmap2);
3948 isl_bool isl_map_is_equal(__isl_keep isl_map *map1,
3949 __isl_keep isl_map *map2);
3950 isl_bool isl_map_plain_is_equal(
3951 __isl_keep isl_map *map1,
3952 __isl_keep isl_map *map2);
3954 #include <isl/union_set.h>
3955 isl_bool isl_union_set_is_equal(
3956 __isl_keep isl_union_set *uset1,
3957 __isl_keep isl_union_set *uset2);
3959 #include <isl/union_map.h>
3960 isl_bool isl_union_map_is_equal(
3961 __isl_keep isl_union_map *umap1,
3962 __isl_keep isl_union_map *umap2);
3964 #include <isl/aff.h>
3965 isl_bool isl_aff_plain_is_equal(
3966 __isl_keep isl_aff *aff1,
3967 __isl_keep isl_aff *aff2);
3968 isl_bool isl_multi_aff_plain_is_equal(
3969 __isl_keep isl_multi_aff *maff1,
3970 __isl_keep isl_multi_aff *maff2);
3971 isl_bool isl_pw_aff_plain_is_equal(
3972 __isl_keep isl_pw_aff *pwaff1,
3973 __isl_keep isl_pw_aff *pwaff2);
3974 isl_bool isl_pw_multi_aff_plain_is_equal(
3975 __isl_keep isl_pw_multi_aff *pma1,
3976 __isl_keep isl_pw_multi_aff *pma2);
3977 isl_bool isl_multi_pw_aff_plain_is_equal(
3978 __isl_keep isl_multi_pw_aff *mpa1,
3979 __isl_keep isl_multi_pw_aff *mpa2);
3980 isl_bool isl_multi_pw_aff_is_equal(
3981 __isl_keep isl_multi_pw_aff *mpa1,
3982 __isl_keep isl_multi_pw_aff *mpa2);
3983 isl_bool isl_union_pw_aff_plain_is_equal(
3984 __isl_keep isl_union_pw_aff *upa1,
3985 __isl_keep isl_union_pw_aff *upa2);
3986 isl_bool isl_union_pw_multi_aff_plain_is_equal(
3987 __isl_keep isl_union_pw_multi_aff *upma1,
3988 __isl_keep isl_union_pw_multi_aff *upma2);
3989 isl_bool isl_multi_union_pw_aff_plain_is_equal(
3990 __isl_keep isl_multi_union_pw_aff *mupa1,
3991 __isl_keep isl_multi_union_pw_aff *mupa2);
3993 #include <isl/polynomial.h>
3994 isl_bool isl_union_pw_qpolynomial_plain_is_equal(
3995 __isl_keep isl_union_pw_qpolynomial *upwqp1,
3996 __isl_keep isl_union_pw_qpolynomial *upwqp2);
3997 isl_bool isl_union_pw_qpolynomial_fold_plain_is_equal(
3998 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
3999 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
4001 =item * Disjointness
4003 #include <isl/set.h>
4004 isl_bool isl_basic_set_is_disjoint(
4005 __isl_keep isl_basic_set *bset1,
4006 __isl_keep isl_basic_set *bset2);
4007 isl_bool isl_set_plain_is_disjoint(
4008 __isl_keep isl_set *set1,
4009 __isl_keep isl_set *set2);
4010 isl_bool isl_set_is_disjoint(__isl_keep isl_set *set1,
4011 __isl_keep isl_set *set2);
4013 #include <isl/map.h>
4014 isl_bool isl_basic_map_is_disjoint(
4015 __isl_keep isl_basic_map *bmap1,
4016 __isl_keep isl_basic_map *bmap2);
4017 isl_bool isl_map_is_disjoint(__isl_keep isl_map *map1,
4018 __isl_keep isl_map *map2);
4020 #include <isl/union_set.h>
4021 isl_bool isl_union_set_is_disjoint(
4022 __isl_keep isl_union_set *uset1,
4023 __isl_keep isl_union_set *uset2);
4025 #include <isl/union_map.h>
4026 isl_bool isl_union_map_is_disjoint(
4027 __isl_keep isl_union_map *umap1,
4028 __isl_keep isl_union_map *umap2);
4032 isl_bool isl_basic_set_is_subset(
4033 __isl_keep isl_basic_set *bset1,
4034 __isl_keep isl_basic_set *bset2);
4035 isl_bool isl_set_is_subset(__isl_keep isl_set *set1,
4036 __isl_keep isl_set *set2);
4037 isl_bool isl_set_is_strict_subset(
4038 __isl_keep isl_set *set1,
4039 __isl_keep isl_set *set2);
4040 isl_bool isl_union_set_is_subset(
4041 __isl_keep isl_union_set *uset1,
4042 __isl_keep isl_union_set *uset2);
4043 isl_bool isl_union_set_is_strict_subset(
4044 __isl_keep isl_union_set *uset1,
4045 __isl_keep isl_union_set *uset2);
4046 isl_bool isl_basic_map_is_subset(
4047 __isl_keep isl_basic_map *bmap1,
4048 __isl_keep isl_basic_map *bmap2);
4049 isl_bool isl_basic_map_is_strict_subset(
4050 __isl_keep isl_basic_map *bmap1,
4051 __isl_keep isl_basic_map *bmap2);
4052 isl_bool isl_map_is_subset(
4053 __isl_keep isl_map *map1,
4054 __isl_keep isl_map *map2);
4055 isl_bool isl_map_is_strict_subset(
4056 __isl_keep isl_map *map1,
4057 __isl_keep isl_map *map2);
4058 isl_bool isl_union_map_is_subset(
4059 __isl_keep isl_union_map *umap1,
4060 __isl_keep isl_union_map *umap2);
4061 isl_bool isl_union_map_is_strict_subset(
4062 __isl_keep isl_union_map *umap1,
4063 __isl_keep isl_union_map *umap2);
4065 Check whether the first argument is a (strict) subset of the
4070 Every comparison function returns a negative value if the first
4071 argument is considered smaller than the second, a positive value
4072 if the first argument is considered greater and zero if the two
4073 constraints are considered the same by the comparison criterion.
4075 #include <isl/constraint.h>
4076 int isl_constraint_plain_cmp(
4077 __isl_keep isl_constraint *c1,
4078 __isl_keep isl_constraint *c2);
4080 This function is useful for sorting C<isl_constraint>s.
4081 The order depends on the internal representation of the inputs.
4082 The order is fixed over different calls to the function (assuming
4083 the internal representation of the inputs has not changed), but may
4084 change over different versions of C<isl>.
4086 #include <isl/constraint.h>
4087 int isl_constraint_cmp_last_non_zero(
4088 __isl_keep isl_constraint *c1,
4089 __isl_keep isl_constraint *c2);
4091 This function can be used to sort constraints that live in the same
4092 local space. Constraints that involve ``earlier'' dimensions or
4093 that have a smaller coefficient for the shared latest dimension
4094 are considered smaller than other constraints.
4095 This function only defines a B<partial> order.
4097 #include <isl/set.h>
4098 int isl_set_plain_cmp(__isl_keep isl_set *set1,
4099 __isl_keep isl_set *set2);
4101 This function is useful for sorting C<isl_set>s.
4102 The order depends on the internal representation of the inputs.
4103 The order is fixed over different calls to the function (assuming
4104 the internal representation of the inputs has not changed), but may
4105 change over different versions of C<isl>.
4107 #include <isl/aff.h>
4108 int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
4109 __isl_keep isl_pw_aff *pa2);
4111 The function C<isl_pw_aff_plain_cmp> can be used to sort
4112 C<isl_pw_aff>s. The order is not strictly defined.
4113 The current order sorts expressions that only involve
4114 earlier dimensions before those that involve later dimensions.
4118 =head2 Unary Operations
4124 __isl_give isl_set *isl_set_complement(
4125 __isl_take isl_set *set);
4126 __isl_give isl_map *isl_map_complement(
4127 __isl_take isl_map *map);
4131 #include <isl/space.h>
4132 __isl_give isl_space *isl_space_reverse(
4133 __isl_take isl_space *space);
4135 #include <isl/map.h>
4136 __isl_give isl_basic_map *isl_basic_map_reverse(
4137 __isl_take isl_basic_map *bmap);
4138 __isl_give isl_map *isl_map_reverse(
4139 __isl_take isl_map *map);
4141 #include <isl/union_map.h>
4142 __isl_give isl_union_map *isl_union_map_reverse(
4143 __isl_take isl_union_map *umap);
4147 #include <isl/space.h>
4148 __isl_give isl_space *isl_space_domain(
4149 __isl_take isl_space *space);
4150 __isl_give isl_space *isl_space_range(
4151 __isl_take isl_space *space);
4152 __isl_give isl_space *isl_space_params(
4153 __isl_take isl_space *space);
4155 #include <isl/local_space.h>
4156 __isl_give isl_local_space *isl_local_space_domain(
4157 __isl_take isl_local_space *ls);
4158 __isl_give isl_local_space *isl_local_space_range(
4159 __isl_take isl_local_space *ls);
4161 #include <isl/set.h>
4162 __isl_give isl_basic_set *isl_basic_set_project_out(
4163 __isl_take isl_basic_set *bset,
4164 enum isl_dim_type type, unsigned first, unsigned n);
4165 __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
4166 enum isl_dim_type type, unsigned first, unsigned n);
4167 __isl_give isl_basic_set *isl_basic_set_params(
4168 __isl_take isl_basic_set *bset);
4169 __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
4171 #include <isl/map.h>
4172 __isl_give isl_basic_map *isl_basic_map_project_out(
4173 __isl_take isl_basic_map *bmap,
4174 enum isl_dim_type type, unsigned first, unsigned n);
4175 __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
4176 enum isl_dim_type type, unsigned first, unsigned n);
4177 __isl_give isl_basic_set *isl_basic_map_domain(
4178 __isl_take isl_basic_map *bmap);
4179 __isl_give isl_basic_set *isl_basic_map_range(
4180 __isl_take isl_basic_map *bmap);
4181 __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
4182 __isl_give isl_set *isl_map_domain(
4183 __isl_take isl_map *bmap);
4184 __isl_give isl_set *isl_map_range(
4185 __isl_take isl_map *map);
4187 #include <isl/union_set.h>
4188 __isl_give isl_union_set *isl_union_set_project_out(
4189 __isl_take isl_union_set *uset,
4190 enum isl_dim_type type,
4191 unsigned first, unsigned n);
4192 __isl_give isl_set *isl_union_set_params(
4193 __isl_take isl_union_set *uset);
4195 The function C<isl_union_set_project_out> can only project out
4198 #include <isl/union_map.h>
4199 __isl_give isl_union_map *isl_union_map_project_out(
4200 __isl_take isl_union_map *umap,
4201 enum isl_dim_type type, unsigned first, unsigned n);
4202 __isl_give isl_set *isl_union_map_params(
4203 __isl_take isl_union_map *umap);
4204 __isl_give isl_union_set *isl_union_map_domain(
4205 __isl_take isl_union_map *umap);
4206 __isl_give isl_union_set *isl_union_map_range(
4207 __isl_take isl_union_map *umap);
4209 The function C<isl_union_map_project_out> can only project out
4212 #include <isl/aff.h>
4213 __isl_give isl_aff *isl_aff_project_domain_on_params(
4214 __isl_take isl_aff *aff);
4215 __isl_give isl_pw_multi_aff *
4216 isl_pw_multi_aff_project_domain_on_params(
4217 __isl_take isl_pw_multi_aff *pma);
4218 __isl_give isl_set *isl_pw_aff_domain(
4219 __isl_take isl_pw_aff *pwaff);
4220 __isl_give isl_set *isl_pw_multi_aff_domain(
4221 __isl_take isl_pw_multi_aff *pma);
4222 __isl_give isl_set *isl_multi_pw_aff_domain(
4223 __isl_take isl_multi_pw_aff *mpa);
4224 __isl_give isl_union_set *isl_union_pw_aff_domain(
4225 __isl_take isl_union_pw_aff *upa);
4226 __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
4227 __isl_take isl_union_pw_multi_aff *upma);
4228 __isl_give isl_union_set *
4229 isl_multi_union_pw_aff_domain(
4230 __isl_take isl_multi_union_pw_aff *mupa);
4231 __isl_give isl_set *isl_pw_aff_params(
4232 __isl_take isl_pw_aff *pwa);
4234 The function C<isl_multi_union_pw_aff_domain> requires its
4235 input to have at least one set dimension.
4237 #include <isl/polynomial.h>
4238 __isl_give isl_qpolynomial *
4239 isl_qpolynomial_project_domain_on_params(
4240 __isl_take isl_qpolynomial *qp);
4241 __isl_give isl_pw_qpolynomial *
4242 isl_pw_qpolynomial_project_domain_on_params(
4243 __isl_take isl_pw_qpolynomial *pwqp);
4244 __isl_give isl_pw_qpolynomial_fold *
4245 isl_pw_qpolynomial_fold_project_domain_on_params(
4246 __isl_take isl_pw_qpolynomial_fold *pwf);
4247 __isl_give isl_set *isl_pw_qpolynomial_domain(
4248 __isl_take isl_pw_qpolynomial *pwqp);
4249 __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
4250 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4251 __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
4252 __isl_take isl_union_pw_qpolynomial *upwqp);
4254 #include <isl/space.h>
4255 __isl_give isl_space *isl_space_domain_map(
4256 __isl_take isl_space *space);
4257 __isl_give isl_space *isl_space_range_map(
4258 __isl_take isl_space *space);
4260 #include <isl/map.h>
4261 __isl_give isl_map *isl_set_wrapped_domain_map(
4262 __isl_take isl_set *set);
4263 __isl_give isl_basic_map *isl_basic_map_domain_map(
4264 __isl_take isl_basic_map *bmap);
4265 __isl_give isl_basic_map *isl_basic_map_range_map(
4266 __isl_take isl_basic_map *bmap);
4267 __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
4268 __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
4270 #include <isl/union_map.h>
4271 __isl_give isl_union_map *isl_union_map_domain_map(
4272 __isl_take isl_union_map *umap);
4273 __isl_give isl_union_pw_multi_aff *
4274 isl_union_map_domain_map_union_pw_multi_aff(
4275 __isl_take isl_union_map *umap);
4276 __isl_give isl_union_map *isl_union_map_range_map(
4277 __isl_take isl_union_map *umap);
4278 __isl_give isl_union_map *
4279 isl_union_set_wrapped_domain_map(
4280 __isl_take isl_union_set *uset);
4282 The functions above construct a (basic, regular or union) relation
4283 that maps (a wrapped version of) the input relation to its domain or range.
4284 C<isl_set_wrapped_domain_map> maps the input set to the domain
4285 of its wrapped relation.
4289 __isl_give isl_basic_set *isl_basic_set_eliminate(
4290 __isl_take isl_basic_set *bset,
4291 enum isl_dim_type type,
4292 unsigned first, unsigned n);
4293 __isl_give isl_set *isl_set_eliminate(
4294 __isl_take isl_set *set, enum isl_dim_type type,
4295 unsigned first, unsigned n);
4296 __isl_give isl_basic_map *isl_basic_map_eliminate(
4297 __isl_take isl_basic_map *bmap,
4298 enum isl_dim_type type,
4299 unsigned first, unsigned n);
4300 __isl_give isl_map *isl_map_eliminate(
4301 __isl_take isl_map *map, enum isl_dim_type type,
4302 unsigned first, unsigned n);
4304 Eliminate the coefficients for the given dimensions from the constraints,
4305 without removing the dimensions.
4307 =item * Constructing a set from a parameter domain
4309 A zero-dimensional space or (basic) set can be constructed
4310 on a given parameter domain using the following functions.
4312 #include <isl/space.h>
4313 __isl_give isl_space *isl_space_set_from_params(
4314 __isl_take isl_space *space);
4316 #include <isl/set.h>
4317 __isl_give isl_basic_set *isl_basic_set_from_params(
4318 __isl_take isl_basic_set *bset);
4319 __isl_give isl_set *isl_set_from_params(
4320 __isl_take isl_set *set);
4322 =item * Constructing a relation from a set
4324 Create a relation with the given set as domain or range.
4325 The range or domain of the created relation is a zero-dimensional
4326 flat anonymous space.
4328 #include <isl/space.h>
4329 __isl_give isl_space *isl_space_from_domain(
4330 __isl_take isl_space *space);
4331 __isl_give isl_space *isl_space_from_range(
4332 __isl_take isl_space *space);
4333 __isl_give isl_space *isl_space_map_from_set(
4334 __isl_take isl_space *space);
4335 __isl_give isl_space *isl_space_map_from_domain_and_range(
4336 __isl_take isl_space *domain,
4337 __isl_take isl_space *range);
4339 #include <isl/local_space.h>
4340 __isl_give isl_local_space *isl_local_space_from_domain(
4341 __isl_take isl_local_space *ls);
4343 #include <isl/map.h>
4344 __isl_give isl_map *isl_map_from_domain(
4345 __isl_take isl_set *set);
4346 __isl_give isl_map *isl_map_from_range(
4347 __isl_take isl_set *set);
4349 #include <isl/val.h>
4350 __isl_give isl_multi_val *isl_multi_val_from_range(
4351 __isl_take isl_multi_val *mv);
4353 #include <isl/aff.h>
4354 __isl_give isl_multi_aff *isl_multi_aff_from_range(
4355 __isl_take isl_multi_aff *ma);
4356 __isl_give isl_pw_aff *isl_pw_aff_from_range(
4357 __isl_take isl_pw_aff *pwa);
4358 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
4359 __isl_take isl_multi_pw_aff *mpa);
4360 __isl_give isl_multi_union_pw_aff *
4361 isl_multi_union_pw_aff_from_range(
4362 __isl_take isl_multi_union_pw_aff *mupa);
4363 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
4364 __isl_take isl_set *set);
4365 __isl_give isl_union_pw_multi_aff *
4366 isl_union_pw_multi_aff_from_domain(
4367 __isl_take isl_union_set *uset);
4371 #include <isl/set.h>
4372 __isl_give isl_basic_set *isl_basic_set_fix_si(
4373 __isl_take isl_basic_set *bset,
4374 enum isl_dim_type type, unsigned pos, int value);
4375 __isl_give isl_basic_set *isl_basic_set_fix_val(
4376 __isl_take isl_basic_set *bset,
4377 enum isl_dim_type type, unsigned pos,
4378 __isl_take isl_val *v);
4379 __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
4380 enum isl_dim_type type, unsigned pos, int value);
4381 __isl_give isl_set *isl_set_fix_val(
4382 __isl_take isl_set *set,
4383 enum isl_dim_type type, unsigned pos,
4384 __isl_take isl_val *v);
4386 #include <isl/map.h>
4387 __isl_give isl_basic_map *isl_basic_map_fix_si(
4388 __isl_take isl_basic_map *bmap,
4389 enum isl_dim_type type, unsigned pos, int value);
4390 __isl_give isl_basic_map *isl_basic_map_fix_val(
4391 __isl_take isl_basic_map *bmap,
4392 enum isl_dim_type type, unsigned pos,
4393 __isl_take isl_val *v);
4394 __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
4395 enum isl_dim_type type, unsigned pos, int value);
4396 __isl_give isl_map *isl_map_fix_val(
4397 __isl_take isl_map *map,
4398 enum isl_dim_type type, unsigned pos,
4399 __isl_take isl_val *v);
4401 #include <isl/aff.h>
4402 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
4403 __isl_take isl_pw_multi_aff *pma,
4404 enum isl_dim_type type, unsigned pos, int value);
4406 #include <isl/polynomial.h>
4407 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
4408 __isl_take isl_pw_qpolynomial *pwqp,
4409 enum isl_dim_type type, unsigned n,
4410 __isl_take isl_val *v);
4412 Intersect the set, relation or function domain
4413 with the hyperplane where the given
4414 dimension has the fixed given value.
4416 __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
4417 __isl_take isl_basic_map *bmap,
4418 enum isl_dim_type type, unsigned pos, int value);
4419 __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
4420 __isl_take isl_basic_map *bmap,
4421 enum isl_dim_type type, unsigned pos, int value);
4422 __isl_give isl_set *isl_set_lower_bound_si(
4423 __isl_take isl_set *set,
4424 enum isl_dim_type type, unsigned pos, int value);
4425 __isl_give isl_set *isl_set_lower_bound_val(
4426 __isl_take isl_set *set,
4427 enum isl_dim_type type, unsigned pos,
4428 __isl_take isl_val *value);
4429 __isl_give isl_map *isl_map_lower_bound_si(
4430 __isl_take isl_map *map,
4431 enum isl_dim_type type, unsigned pos, int value);
4432 __isl_give isl_set *isl_set_upper_bound_si(
4433 __isl_take isl_set *set,
4434 enum isl_dim_type type, unsigned pos, int value);
4435 __isl_give isl_set *isl_set_upper_bound_val(
4436 __isl_take isl_set *set,
4437 enum isl_dim_type type, unsigned pos,
4438 __isl_take isl_val *value);
4439 __isl_give isl_map *isl_map_upper_bound_si(
4440 __isl_take isl_map *map,
4441 enum isl_dim_type type, unsigned pos, int value);
4443 Intersect the set or relation with the half-space where the given
4444 dimension has a value bounded by the fixed given integer value.
4446 __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
4447 enum isl_dim_type type1, int pos1,
4448 enum isl_dim_type type2, int pos2);
4449 __isl_give isl_basic_map *isl_basic_map_equate(
4450 __isl_take isl_basic_map *bmap,
4451 enum isl_dim_type type1, int pos1,
4452 enum isl_dim_type type2, int pos2);
4453 __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
4454 enum isl_dim_type type1, int pos1,
4455 enum isl_dim_type type2, int pos2);
4457 Intersect the set or relation with the hyperplane where the given
4458 dimensions are equal to each other.
4460 __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4461 enum isl_dim_type type1, int pos1,
4462 enum isl_dim_type type2, int pos2);
4464 Intersect the relation with the hyperplane where the given
4465 dimensions have opposite values.
4467 __isl_give isl_map *isl_map_order_le(
4468 __isl_take isl_map *map,
4469 enum isl_dim_type type1, int pos1,
4470 enum isl_dim_type type2, int pos2);
4471 __isl_give isl_basic_map *isl_basic_map_order_ge(
4472 __isl_take isl_basic_map *bmap,
4473 enum isl_dim_type type1, int pos1,
4474 enum isl_dim_type type2, int pos2);
4475 __isl_give isl_map *isl_map_order_ge(
4476 __isl_take isl_map *map,
4477 enum isl_dim_type type1, int pos1,
4478 enum isl_dim_type type2, int pos2);
4479 __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4480 enum isl_dim_type type1, int pos1,
4481 enum isl_dim_type type2, int pos2);
4482 __isl_give isl_basic_map *isl_basic_map_order_gt(
4483 __isl_take isl_basic_map *bmap,
4484 enum isl_dim_type type1, int pos1,
4485 enum isl_dim_type type2, int pos2);
4486 __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4487 enum isl_dim_type type1, int pos1,
4488 enum isl_dim_type type2, int pos2);
4490 Intersect the relation with the half-space where the given
4491 dimensions satisfy the given ordering.
4495 #include <isl/aff.h>
4496 __isl_give isl_basic_set *isl_aff_zero_basic_set(
4497 __isl_take isl_aff *aff);
4498 __isl_give isl_basic_set *isl_aff_neg_basic_set(
4499 __isl_take isl_aff *aff);
4500 __isl_give isl_set *isl_pw_aff_pos_set(
4501 __isl_take isl_pw_aff *pa);
4502 __isl_give isl_set *isl_pw_aff_nonneg_set(
4503 __isl_take isl_pw_aff *pwaff);
4504 __isl_give isl_set *isl_pw_aff_zero_set(
4505 __isl_take isl_pw_aff *pwaff);
4506 __isl_give isl_set *isl_pw_aff_non_zero_set(
4507 __isl_take isl_pw_aff *pwaff);
4508 __isl_give isl_union_set *
4509 isl_union_pw_aff_zero_union_set(
4510 __isl_take isl_union_pw_aff *upa);
4511 __isl_give isl_union_set *
4512 isl_multi_union_pw_aff_zero_union_set(
4513 __isl_take isl_multi_union_pw_aff *mupa);
4515 The function C<isl_aff_neg_basic_set> returns a basic set
4516 containing those elements in the domain space
4517 of C<aff> where C<aff> is negative.
4518 The function C<isl_pw_aff_nonneg_set> returns a set
4519 containing those elements in the domain
4520 of C<pwaff> where C<pwaff> is non-negative.
4521 The function C<isl_multi_union_pw_aff_zero_union_set>
4522 returns a union set containing those elements
4523 in the domains of its elements where they are all zero.
4527 __isl_give isl_map *isl_set_identity(
4528 __isl_take isl_set *set);
4529 __isl_give isl_union_map *isl_union_set_identity(
4530 __isl_take isl_union_set *uset);
4531 __isl_give isl_union_pw_multi_aff *
4532 isl_union_set_identity_union_pw_multi_aff(
4533 __isl_take isl_union_set *uset);
4535 Construct an identity relation on the given (union) set.
4537 =item * Function Extraction
4539 A piecewise quasi affine expression that is equal to 1 on a set
4540 and 0 outside the set can be created using the following function.
4542 #include <isl/aff.h>
4543 __isl_give isl_pw_aff *isl_set_indicator_function(
4544 __isl_take isl_set *set);
4546 A piecewise multiple quasi affine expression can be extracted
4547 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4548 and the C<isl_map> is single-valued.
4549 In case of a conversion from an C<isl_union_map>
4550 to an C<isl_union_pw_multi_aff>, these properties need to hold
4551 in each domain space.
4552 A conversion to a C<isl_multi_union_pw_aff> additionally
4553 requires that the input is non-empty and involves only a single
4556 #include <isl/aff.h>
4557 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4558 __isl_take isl_set *set);
4559 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4560 __isl_take isl_map *map);
4562 __isl_give isl_union_pw_multi_aff *
4563 isl_union_pw_multi_aff_from_union_set(
4564 __isl_take isl_union_set *uset);
4565 __isl_give isl_union_pw_multi_aff *
4566 isl_union_pw_multi_aff_from_union_map(
4567 __isl_take isl_union_map *umap);
4569 __isl_give isl_multi_union_pw_aff *
4570 isl_multi_union_pw_aff_from_union_map(
4571 __isl_take isl_union_map *umap);
4575 __isl_give isl_basic_set *isl_basic_map_deltas(
4576 __isl_take isl_basic_map *bmap);
4577 __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
4578 __isl_give isl_union_set *isl_union_map_deltas(
4579 __isl_take isl_union_map *umap);
4581 These functions return a (basic) set containing the differences
4582 between image elements and corresponding domain elements in the input.
4584 __isl_give isl_basic_map *isl_basic_map_deltas_map(
4585 __isl_take isl_basic_map *bmap);
4586 __isl_give isl_map *isl_map_deltas_map(
4587 __isl_take isl_map *map);
4588 __isl_give isl_union_map *isl_union_map_deltas_map(
4589 __isl_take isl_union_map *umap);
4591 The functions above construct a (basic, regular or union) relation
4592 that maps (a wrapped version of) the input relation to its delta set.
4596 Simplify the representation of a set, relation or functions by trying
4597 to combine pairs of basic sets or relations into a single
4598 basic set or relation.
4600 #include <isl/set.h>
4601 __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
4603 #include <isl/map.h>
4604 __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
4606 #include <isl/union_set.h>
4607 __isl_give isl_union_set *isl_union_set_coalesce(
4608 __isl_take isl_union_set *uset);
4610 #include <isl/union_map.h>
4611 __isl_give isl_union_map *isl_union_map_coalesce(
4612 __isl_take isl_union_map *umap);
4614 #include <isl/aff.h>
4615 __isl_give isl_pw_aff *isl_pw_aff_coalesce(
4616 __isl_take isl_pw_aff *pwqp);
4617 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
4618 __isl_take isl_pw_multi_aff *pma);
4619 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
4620 __isl_take isl_multi_pw_aff *mpa);
4621 __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
4622 __isl_take isl_union_pw_aff *upa);
4623 __isl_give isl_union_pw_multi_aff *
4624 isl_union_pw_multi_aff_coalesce(
4625 __isl_take isl_union_pw_multi_aff *upma);
4627 #include <isl/polynomial.h>
4628 __isl_give isl_pw_qpolynomial_fold *
4629 isl_pw_qpolynomial_fold_coalesce(
4630 __isl_take isl_pw_qpolynomial_fold *pwf);
4631 __isl_give isl_union_pw_qpolynomial *
4632 isl_union_pw_qpolynomial_coalesce(
4633 __isl_take isl_union_pw_qpolynomial *upwqp);
4634 __isl_give isl_union_pw_qpolynomial_fold *
4635 isl_union_pw_qpolynomial_fold_coalesce(
4636 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4638 One of the methods for combining pairs of basic sets or relations
4639 can result in coefficients that are much larger than those that appear
4640 in the constraints of the input. By default, the coefficients are
4641 not allowed to grow larger, but this can be changed by unsetting
4642 the following option.
4644 isl_stat isl_options_set_coalesce_bounded_wrapping(
4645 isl_ctx *ctx, int val);
4646 int isl_options_get_coalesce_bounded_wrapping(
4649 =item * Detecting equalities
4651 __isl_give isl_basic_set *isl_basic_set_detect_equalities(
4652 __isl_take isl_basic_set *bset);
4653 __isl_give isl_basic_map *isl_basic_map_detect_equalities(
4654 __isl_take isl_basic_map *bmap);
4655 __isl_give isl_set *isl_set_detect_equalities(
4656 __isl_take isl_set *set);
4657 __isl_give isl_map *isl_map_detect_equalities(
4658 __isl_take isl_map *map);
4659 __isl_give isl_union_set *isl_union_set_detect_equalities(
4660 __isl_take isl_union_set *uset);
4661 __isl_give isl_union_map *isl_union_map_detect_equalities(
4662 __isl_take isl_union_map *umap);
4664 Simplify the representation of a set or relation by detecting implicit
4667 =item * Removing redundant constraints
4669 #include <isl/set.h>
4670 __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
4671 __isl_take isl_basic_set *bset);
4672 __isl_give isl_set *isl_set_remove_redundancies(
4673 __isl_take isl_set *set);
4675 #include <isl/union_set.h>
4676 __isl_give isl_union_set *
4677 isl_union_set_remove_redundancies(
4678 __isl_take isl_union_set *uset);
4680 #include <isl/map.h>
4681 __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
4682 __isl_take isl_basic_map *bmap);
4683 __isl_give isl_map *isl_map_remove_redundancies(
4684 __isl_take isl_map *map);
4686 #include <isl/union_map.h>
4687 __isl_give isl_union_map *
4688 isl_union_map_remove_redundancies(
4689 __isl_take isl_union_map *umap);
4693 __isl_give isl_basic_set *isl_set_convex_hull(
4694 __isl_take isl_set *set);
4695 __isl_give isl_basic_map *isl_map_convex_hull(
4696 __isl_take isl_map *map);
4698 If the input set or relation has any existentially quantified
4699 variables, then the result of these operations is currently undefined.
4703 #include <isl/set.h>
4704 __isl_give isl_basic_set *
4705 isl_set_unshifted_simple_hull(
4706 __isl_take isl_set *set);
4707 __isl_give isl_basic_set *isl_set_simple_hull(
4708 __isl_take isl_set *set);
4709 __isl_give isl_basic_set *
4710 isl_set_unshifted_simple_hull_from_set_list(
4711 __isl_take isl_set *set,
4712 __isl_take isl_set_list *list);
4714 #include <isl/map.h>
4715 __isl_give isl_basic_map *
4716 isl_map_unshifted_simple_hull(
4717 __isl_take isl_map *map);
4718 __isl_give isl_basic_map *isl_map_simple_hull(
4719 __isl_take isl_map *map);
4720 __isl_give isl_basic_map *
4721 isl_map_unshifted_simple_hull_from_map_list(
4722 __isl_take isl_map *map,
4723 __isl_take isl_map_list *list);
4725 #include <isl/union_map.h>
4726 __isl_give isl_union_map *isl_union_map_simple_hull(
4727 __isl_take isl_union_map *umap);
4729 These functions compute a single basic set or relation
4730 that contains the whole input set or relation.
4731 In particular, the output is described by translates
4732 of the constraints describing the basic sets or relations in the input.
4733 In case of C<isl_set_unshifted_simple_hull>, only the original
4734 constraints are used, without any translation.
4735 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
4736 C<isl_map_unshifted_simple_hull_from_map_list>, the
4737 constraints are taken from the elements of the second argument.
4741 (See \autoref{s:simple hull}.)
4747 __isl_give isl_basic_set *isl_basic_set_affine_hull(
4748 __isl_take isl_basic_set *bset);
4749 __isl_give isl_basic_set *isl_set_affine_hull(
4750 __isl_take isl_set *set);
4751 __isl_give isl_union_set *isl_union_set_affine_hull(
4752 __isl_take isl_union_set *uset);
4753 __isl_give isl_basic_map *isl_basic_map_affine_hull(
4754 __isl_take isl_basic_map *bmap);
4755 __isl_give isl_basic_map *isl_map_affine_hull(
4756 __isl_take isl_map *map);
4757 __isl_give isl_union_map *isl_union_map_affine_hull(
4758 __isl_take isl_union_map *umap);
4760 In case of union sets and relations, the affine hull is computed
4763 =item * Polyhedral hull
4765 __isl_give isl_basic_set *isl_set_polyhedral_hull(
4766 __isl_take isl_set *set);
4767 __isl_give isl_basic_map *isl_map_polyhedral_hull(
4768 __isl_take isl_map *map);
4769 __isl_give isl_union_set *isl_union_set_polyhedral_hull(
4770 __isl_take isl_union_set *uset);
4771 __isl_give isl_union_map *isl_union_map_polyhedral_hull(
4772 __isl_take isl_union_map *umap);
4774 These functions compute a single basic set or relation
4775 not involving any existentially quantified variables
4776 that contains the whole input set or relation.
4777 In case of union sets and relations, the polyhedral hull is computed
4780 =item * Other approximations
4782 #include <isl/set.h>
4783 __isl_give isl_basic_set *
4784 isl_basic_set_drop_constraints_involving_dims(
4785 __isl_take isl_basic_set *bset,
4786 enum isl_dim_type type,
4787 unsigned first, unsigned n);
4788 __isl_give isl_basic_set *
4789 isl_basic_set_drop_constraints_not_involving_dims(
4790 __isl_take isl_basic_set *bset,
4791 enum isl_dim_type type,
4792 unsigned first, unsigned n);
4793 __isl_give isl_set *
4794 isl_set_drop_constraints_involving_dims(
4795 __isl_take isl_set *set,
4796 enum isl_dim_type type,
4797 unsigned first, unsigned n);
4799 #include <isl/map.h>
4800 __isl_give isl_basic_map *
4801 isl_basic_map_drop_constraints_involving_dims(
4802 __isl_take isl_basic_map *bmap,
4803 enum isl_dim_type type,
4804 unsigned first, unsigned n);
4805 __isl_give isl_map *
4806 isl_map_drop_constraints_involving_dims(
4807 __isl_take isl_map *map,
4808 enum isl_dim_type type,
4809 unsigned first, unsigned n);
4811 These functions drop any constraints (not) involving the specified dimensions.
4812 Note that the result depends on the representation of the input.
4814 #include <isl/polynomial.h>
4815 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
4816 __isl_take isl_pw_qpolynomial *pwqp, int sign);
4817 __isl_give isl_union_pw_qpolynomial *
4818 isl_union_pw_qpolynomial_to_polynomial(
4819 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
4821 Approximate each quasipolynomial by a polynomial. If C<sign> is positive,
4822 the polynomial will be an overapproximation. If C<sign> is negative,
4823 it will be an underapproximation. If C<sign> is zero, the approximation
4824 will lie somewhere in between.
4828 __isl_give isl_basic_set *isl_basic_set_sample(
4829 __isl_take isl_basic_set *bset);
4830 __isl_give isl_basic_set *isl_set_sample(
4831 __isl_take isl_set *set);
4832 __isl_give isl_basic_map *isl_basic_map_sample(
4833 __isl_take isl_basic_map *bmap);
4834 __isl_give isl_basic_map *isl_map_sample(
4835 __isl_take isl_map *map);
4837 If the input (basic) set or relation is non-empty, then return
4838 a singleton subset of the input. Otherwise, return an empty set.
4840 =item * Optimization
4842 #include <isl/ilp.h>
4843 __isl_give isl_val *isl_basic_set_max_val(
4844 __isl_keep isl_basic_set *bset,
4845 __isl_keep isl_aff *obj);
4846 __isl_give isl_val *isl_set_min_val(
4847 __isl_keep isl_set *set,
4848 __isl_keep isl_aff *obj);
4849 __isl_give isl_val *isl_set_max_val(
4850 __isl_keep isl_set *set,
4851 __isl_keep isl_aff *obj);
4853 Compute the minimum or maximum of the integer affine expression C<obj>
4854 over the points in C<set>, returning the result in C<opt>.
4855 The result is C<NULL> in case of an error, the optimal value in case
4856 there is one, negative infinity or infinity if the problem is unbounded and
4857 NaN if the problem is empty.
4859 =item * Parametric optimization
4861 __isl_give isl_pw_aff *isl_set_dim_min(
4862 __isl_take isl_set *set, int pos);
4863 __isl_give isl_pw_aff *isl_set_dim_max(
4864 __isl_take isl_set *set, int pos);
4865 __isl_give isl_pw_aff *isl_map_dim_max(
4866 __isl_take isl_map *map, int pos);
4868 Compute the minimum or maximum of the given set or output dimension
4869 as a function of the parameters (and input dimensions), but independently
4870 of the other set or output dimensions.
4871 For lexicographic optimization, see L<"Lexicographic Optimization">.
4875 The following functions compute either the set of (rational) coefficient
4876 values of valid constraints for the given set or the set of (rational)
4877 values satisfying the constraints with coefficients from the given set.
4878 Internally, these two sets of functions perform essentially the
4879 same operations, except that the set of coefficients is assumed to
4880 be a cone, while the set of values may be any polyhedron.
4881 The current implementation is based on the Farkas lemma and
4882 Fourier-Motzkin elimination, but this may change or be made optional
4883 in future. In particular, future implementations may use different
4884 dualization algorithms or skip the elimination step.
4886 __isl_give isl_basic_set *isl_basic_set_coefficients(
4887 __isl_take isl_basic_set *bset);
4888 __isl_give isl_basic_set *isl_set_coefficients(
4889 __isl_take isl_set *set);
4890 __isl_give isl_union_set *isl_union_set_coefficients(
4891 __isl_take isl_union_set *bset);
4892 __isl_give isl_basic_set *isl_basic_set_solutions(
4893 __isl_take isl_basic_set *bset);
4894 __isl_give isl_basic_set *isl_set_solutions(
4895 __isl_take isl_set *set);
4896 __isl_give isl_union_set *isl_union_set_solutions(
4897 __isl_take isl_union_set *bset);
4901 __isl_give isl_map *isl_map_fixed_power_val(
4902 __isl_take isl_map *map,
4903 __isl_take isl_val *exp);
4904 __isl_give isl_union_map *
4905 isl_union_map_fixed_power_val(
4906 __isl_take isl_union_map *umap,
4907 __isl_take isl_val *exp);
4909 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
4910 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
4911 of C<map> is computed.
4913 __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
4915 __isl_give isl_union_map *isl_union_map_power(
4916 __isl_take isl_union_map *umap, int *exact);
4918 Compute a parametric representation for all positive powers I<k> of C<map>.
4919 The result maps I<k> to a nested relation corresponding to the
4920 I<k>th power of C<map>.
4921 The result may be an overapproximation. If the result is known to be exact,
4922 then C<*exact> is set to C<1>.
4924 =item * Transitive closure
4926 __isl_give isl_map *isl_map_transitive_closure(
4927 __isl_take isl_map *map, int *exact);
4928 __isl_give isl_union_map *isl_union_map_transitive_closure(
4929 __isl_take isl_union_map *umap, int *exact);
4931 Compute the transitive closure of C<map>.
4932 The result may be an overapproximation. If the result is known to be exact,
4933 then C<*exact> is set to C<1>.
4935 =item * Reaching path lengths
4937 __isl_give isl_map *isl_map_reaching_path_lengths(
4938 __isl_take isl_map *map, int *exact);
4940 Compute a relation that maps each element in the range of C<map>
4941 to the lengths of all paths composed of edges in C<map> that
4942 end up in the given element.
4943 The result may be an overapproximation. If the result is known to be exact,
4944 then C<*exact> is set to C<1>.
4945 To compute the I<maximal> path length, the resulting relation
4946 should be postprocessed by C<isl_map_lexmax>.
4947 In particular, if the input relation is a dependence relation
4948 (mapping sources to sinks), then the maximal path length corresponds
4949 to the free schedule.
4950 Note, however, that C<isl_map_lexmax> expects the maximum to be
4951 finite, so if the path lengths are unbounded (possibly due to
4952 the overapproximation), then you will get an error message.
4956 #include <isl/space.h>
4957 __isl_give isl_space *isl_space_wrap(
4958 __isl_take isl_space *space);
4959 __isl_give isl_space *isl_space_unwrap(
4960 __isl_take isl_space *space);
4962 #include <isl/local_space.h>
4963 __isl_give isl_local_space *isl_local_space_wrap(
4964 __isl_take isl_local_space *ls);
4966 #include <isl/set.h>
4967 __isl_give isl_basic_map *isl_basic_set_unwrap(
4968 __isl_take isl_basic_set *bset);
4969 __isl_give isl_map *isl_set_unwrap(
4970 __isl_take isl_set *set);
4972 #include <isl/map.h>
4973 __isl_give isl_basic_set *isl_basic_map_wrap(
4974 __isl_take isl_basic_map *bmap);
4975 __isl_give isl_set *isl_map_wrap(
4976 __isl_take isl_map *map);
4978 #include <isl/union_set.h>
4979 __isl_give isl_union_map *isl_union_set_unwrap(
4980 __isl_take isl_union_set *uset);
4982 #include <isl/union_map.h>
4983 __isl_give isl_union_set *isl_union_map_wrap(
4984 __isl_take isl_union_map *umap);
4986 The input to C<isl_space_unwrap> should
4987 be the space of a set, while that of
4988 C<isl_space_wrap> should be the space of a relation.
4989 Conversely, the output of C<isl_space_unwrap> is the space
4990 of a relation, while that of C<isl_space_wrap> is the space of a set.
4994 Remove any internal structure of domain (and range) of the given
4995 set or relation. If there is any such internal structure in the input,
4996 then the name of the space is also removed.
4998 #include <isl/local_space.h>
4999 __isl_give isl_local_space *
5000 isl_local_space_flatten_domain(
5001 __isl_take isl_local_space *ls);
5002 __isl_give isl_local_space *
5003 isl_local_space_flatten_range(
5004 __isl_take isl_local_space *ls);
5006 #include <isl/set.h>
5007 __isl_give isl_basic_set *isl_basic_set_flatten(
5008 __isl_take isl_basic_set *bset);
5009 __isl_give isl_set *isl_set_flatten(
5010 __isl_take isl_set *set);
5012 #include <isl/map.h>
5013 __isl_give isl_basic_map *isl_basic_map_flatten_domain(
5014 __isl_take isl_basic_map *bmap);
5015 __isl_give isl_basic_map *isl_basic_map_flatten_range(
5016 __isl_take isl_basic_map *bmap);
5017 __isl_give isl_map *isl_map_flatten_range(
5018 __isl_take isl_map *map);
5019 __isl_give isl_map *isl_map_flatten_domain(
5020 __isl_take isl_map *map);
5021 __isl_give isl_basic_map *isl_basic_map_flatten(
5022 __isl_take isl_basic_map *bmap);
5023 __isl_give isl_map *isl_map_flatten(
5024 __isl_take isl_map *map);
5026 #include <isl/val.h>
5027 __isl_give isl_multi_val *isl_multi_val_flatten_range(
5028 __isl_take isl_multi_val *mv);
5030 #include <isl/aff.h>
5031 __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
5032 __isl_take isl_multi_aff *ma);
5033 __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
5034 __isl_take isl_multi_aff *ma);
5035 __isl_give isl_multi_pw_aff *
5036 isl_multi_pw_aff_flatten_range(
5037 __isl_take isl_multi_pw_aff *mpa);
5038 __isl_give isl_multi_union_pw_aff *
5039 isl_multi_union_pw_aff_flatten_range(
5040 __isl_take isl_multi_union_pw_aff *mupa);
5042 #include <isl/map.h>
5043 __isl_give isl_map *isl_set_flatten_map(
5044 __isl_take isl_set *set);
5046 The function above constructs a relation
5047 that maps the input set to a flattened version of the set.
5051 Lift the input set to a space with extra dimensions corresponding
5052 to the existentially quantified variables in the input.
5053 In particular, the result lives in a wrapped map where the domain
5054 is the original space and the range corresponds to the original
5055 existentially quantified variables.
5057 #include <isl/set.h>
5058 __isl_give isl_basic_set *isl_basic_set_lift(
5059 __isl_take isl_basic_set *bset);
5060 __isl_give isl_set *isl_set_lift(
5061 __isl_take isl_set *set);
5062 __isl_give isl_union_set *isl_union_set_lift(
5063 __isl_take isl_union_set *uset);
5065 Given a local space that contains the existentially quantified
5066 variables of a set, a basic relation that, when applied to
5067 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
5068 can be constructed using the following function.
5070 #include <isl/local_space.h>
5071 __isl_give isl_basic_map *isl_local_space_lifting(
5072 __isl_take isl_local_space *ls);
5074 #include <isl/aff.h>
5075 __isl_give isl_multi_aff *isl_multi_aff_lift(
5076 __isl_take isl_multi_aff *maff,
5077 __isl_give isl_local_space **ls);
5079 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
5080 then it is assigned the local space that lies at the basis of
5081 the lifting applied.
5083 =item * Internal Product
5085 #include <isl/space.h>
5086 __isl_give isl_space *isl_space_zip(
5087 __isl_take isl_space *space);
5089 #include <isl/map.h>
5090 __isl_give isl_basic_map *isl_basic_map_zip(
5091 __isl_take isl_basic_map *bmap);
5092 __isl_give isl_map *isl_map_zip(
5093 __isl_take isl_map *map);
5095 #include <isl/union_map.h>
5096 __isl_give isl_union_map *isl_union_map_zip(
5097 __isl_take isl_union_map *umap);
5099 Given a relation with nested relations for domain and range,
5100 interchange the range of the domain with the domain of the range.
5104 #include <isl/space.h>
5105 __isl_give isl_space *isl_space_curry(
5106 __isl_take isl_space *space);
5107 __isl_give isl_space *isl_space_uncurry(
5108 __isl_take isl_space *space);
5110 #include <isl/map.h>
5111 __isl_give isl_basic_map *isl_basic_map_curry(
5112 __isl_take isl_basic_map *bmap);
5113 __isl_give isl_basic_map *isl_basic_map_uncurry(
5114 __isl_take isl_basic_map *bmap);
5115 __isl_give isl_map *isl_map_curry(
5116 __isl_take isl_map *map);
5117 __isl_give isl_map *isl_map_uncurry(
5118 __isl_take isl_map *map);
5120 #include <isl/union_map.h>
5121 __isl_give isl_union_map *isl_union_map_curry(
5122 __isl_take isl_union_map *umap);
5123 __isl_give isl_union_map *isl_union_map_uncurry(
5124 __isl_take isl_union_map *umap);
5126 Given a relation with a nested relation for domain,
5127 the C<curry> functions
5128 move the range of the nested relation out of the domain
5129 and use it as the domain of a nested relation in the range,
5130 with the original range as range of this nested relation.
5131 The C<uncurry> functions perform the inverse operation.
5133 =item * Aligning parameters
5135 Change the order of the parameters of the given set, relation
5137 such that the first parameters match those of C<model>.
5138 This may involve the introduction of extra parameters.
5139 All parameters need to be named.
5141 #include <isl/space.h>
5142 __isl_give isl_space *isl_space_align_params(
5143 __isl_take isl_space *space1,
5144 __isl_take isl_space *space2)
5146 #include <isl/set.h>
5147 __isl_give isl_basic_set *isl_basic_set_align_params(
5148 __isl_take isl_basic_set *bset,
5149 __isl_take isl_space *model);
5150 __isl_give isl_set *isl_set_align_params(
5151 __isl_take isl_set *set,
5152 __isl_take isl_space *model);
5154 #include <isl/map.h>
5155 __isl_give isl_basic_map *isl_basic_map_align_params(
5156 __isl_take isl_basic_map *bmap,
5157 __isl_take isl_space *model);
5158 __isl_give isl_map *isl_map_align_params(
5159 __isl_take isl_map *map,
5160 __isl_take isl_space *model);
5162 #include <isl/val.h>
5163 __isl_give isl_multi_val *isl_multi_val_align_params(
5164 __isl_take isl_multi_val *mv,
5165 __isl_take isl_space *model);
5167 #include <isl/aff.h>
5168 __isl_give isl_aff *isl_aff_align_params(
5169 __isl_take isl_aff *aff,
5170 __isl_take isl_space *model);
5171 __isl_give isl_multi_aff *isl_multi_aff_align_params(
5172 __isl_take isl_multi_aff *multi,
5173 __isl_take isl_space *model);
5174 __isl_give isl_pw_aff *isl_pw_aff_align_params(
5175 __isl_take isl_pw_aff *pwaff,
5176 __isl_take isl_space *model);
5177 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
5178 __isl_take isl_pw_multi_aff *pma,
5179 __isl_take isl_space *model);
5180 __isl_give isl_union_pw_aff *
5181 isl_union_pw_aff_align_params(
5182 __isl_take isl_union_pw_aff *upa,
5183 __isl_take isl_space *model);
5184 __isl_give isl_union_pw_multi_aff *
5185 isl_union_pw_multi_aff_align_params(
5186 __isl_take isl_union_pw_multi_aff *upma,
5187 __isl_take isl_space *model);
5188 __isl_give isl_multi_union_pw_aff *
5189 isl_multi_union_pw_aff_align_params(
5190 __isl_take isl_multi_union_pw_aff *mupa,
5191 __isl_take isl_space *model);
5193 #include <isl/polynomial.h>
5194 __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
5195 __isl_take isl_qpolynomial *qp,
5196 __isl_take isl_space *model);
5198 =item * Unary Arithmethic Operations
5200 #include <isl/val.h>
5201 __isl_give isl_multi_val *isl_multi_val_neg(
5202 __isl_take isl_multi_val *mv);
5204 #include <isl/aff.h>
5205 __isl_give isl_aff *isl_aff_neg(
5206 __isl_take isl_aff *aff);
5207 __isl_give isl_multi_aff *isl_multi_aff_neg(
5208 __isl_take isl_multi_aff *ma);
5209 __isl_give isl_pw_aff *isl_pw_aff_neg(
5210 __isl_take isl_pw_aff *pwaff);
5211 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
5212 __isl_take isl_pw_multi_aff *pma);
5213 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
5214 __isl_take isl_multi_pw_aff *mpa);
5215 __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
5216 __isl_take isl_union_pw_aff *upa);
5217 __isl_give isl_union_pw_multi_aff *
5218 isl_union_pw_multi_aff_neg(
5219 __isl_take isl_union_pw_multi_aff *upma);
5220 __isl_give isl_multi_union_pw_aff *
5221 isl_multi_union_pw_aff_neg(
5222 __isl_take isl_multi_union_pw_aff *mupa);
5223 __isl_give isl_aff *isl_aff_ceil(
5224 __isl_take isl_aff *aff);
5225 __isl_give isl_pw_aff *isl_pw_aff_ceil(
5226 __isl_take isl_pw_aff *pwaff);
5227 __isl_give isl_aff *isl_aff_floor(
5228 __isl_take isl_aff *aff);
5229 __isl_give isl_multi_aff *isl_multi_aff_floor(
5230 __isl_take isl_multi_aff *ma);
5231 __isl_give isl_pw_aff *isl_pw_aff_floor(
5232 __isl_take isl_pw_aff *pwaff);
5233 __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
5234 __isl_take isl_union_pw_aff *upa);
5235 __isl_give isl_multi_union_pw_aff *
5236 isl_multi_union_pw_aff_floor(
5237 __isl_take isl_multi_union_pw_aff *mupa);
5239 #include <isl/aff.h>
5240 __isl_give isl_pw_aff *isl_pw_aff_list_min(
5241 __isl_take isl_pw_aff_list *list);
5242 __isl_give isl_pw_aff *isl_pw_aff_list_max(
5243 __isl_take isl_pw_aff_list *list);
5245 #include <isl/polynomial.h>
5246 __isl_give isl_qpolynomial *isl_qpolynomial_neg(
5247 __isl_take isl_qpolynomial *qp);
5248 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
5249 __isl_take isl_pw_qpolynomial *pwqp);
5250 __isl_give isl_union_pw_qpolynomial *
5251 isl_union_pw_qpolynomial_neg(
5252 __isl_take isl_union_pw_qpolynomial *upwqp);
5253 __isl_give isl_qpolynomial *isl_qpolynomial_pow(
5254 __isl_take isl_qpolynomial *qp,
5256 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
5257 __isl_take isl_pw_qpolynomial *pwqp,
5262 The following functions evaluate a function in a point.
5264 #include <isl/polynomial.h>
5265 __isl_give isl_val *isl_pw_qpolynomial_eval(
5266 __isl_take isl_pw_qpolynomial *pwqp,
5267 __isl_take isl_point *pnt);
5268 __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
5269 __isl_take isl_pw_qpolynomial_fold *pwf,
5270 __isl_take isl_point *pnt);
5271 __isl_give isl_val *isl_union_pw_qpolynomial_eval(
5272 __isl_take isl_union_pw_qpolynomial *upwqp,
5273 __isl_take isl_point *pnt);
5274 __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
5275 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5276 __isl_take isl_point *pnt);
5278 =item * Dimension manipulation
5280 It is usually not advisable to directly change the (input or output)
5281 space of a set or a relation as this removes the name and the internal
5282 structure of the space. However, the functions below can be useful
5283 to add new parameters, assuming
5284 C<isl_set_align_params> and C<isl_map_align_params>
5287 #include <isl/space.h>
5288 __isl_give isl_space *isl_space_add_dims(
5289 __isl_take isl_space *space,
5290 enum isl_dim_type type, unsigned n);
5291 __isl_give isl_space *isl_space_insert_dims(
5292 __isl_take isl_space *space,
5293 enum isl_dim_type type, unsigned pos, unsigned n);
5294 __isl_give isl_space *isl_space_drop_dims(
5295 __isl_take isl_space *space,
5296 enum isl_dim_type type, unsigned first, unsigned n);
5297 __isl_give isl_space *isl_space_move_dims(
5298 __isl_take isl_space *space,
5299 enum isl_dim_type dst_type, unsigned dst_pos,
5300 enum isl_dim_type src_type, unsigned src_pos,
5303 #include <isl/local_space.h>
5304 __isl_give isl_local_space *isl_local_space_add_dims(
5305 __isl_take isl_local_space *ls,
5306 enum isl_dim_type type, unsigned n);
5307 __isl_give isl_local_space *isl_local_space_insert_dims(
5308 __isl_take isl_local_space *ls,
5309 enum isl_dim_type type, unsigned first, unsigned n);
5310 __isl_give isl_local_space *isl_local_space_drop_dims(
5311 __isl_take isl_local_space *ls,
5312 enum isl_dim_type type, unsigned first, unsigned n);
5314 #include <isl/set.h>
5315 __isl_give isl_basic_set *isl_basic_set_add_dims(
5316 __isl_take isl_basic_set *bset,
5317 enum isl_dim_type type, unsigned n);
5318 __isl_give isl_set *isl_set_add_dims(
5319 __isl_take isl_set *set,
5320 enum isl_dim_type type, unsigned n);
5321 __isl_give isl_basic_set *isl_basic_set_insert_dims(
5322 __isl_take isl_basic_set *bset,
5323 enum isl_dim_type type, unsigned pos,
5325 __isl_give isl_set *isl_set_insert_dims(
5326 __isl_take isl_set *set,
5327 enum isl_dim_type type, unsigned pos, unsigned n);
5328 __isl_give isl_basic_set *isl_basic_set_move_dims(
5329 __isl_take isl_basic_set *bset,
5330 enum isl_dim_type dst_type, unsigned dst_pos,
5331 enum isl_dim_type src_type, unsigned src_pos,
5333 __isl_give isl_set *isl_set_move_dims(
5334 __isl_take isl_set *set,
5335 enum isl_dim_type dst_type, unsigned dst_pos,
5336 enum isl_dim_type src_type, unsigned src_pos,
5339 #include <isl/map.h>
5340 __isl_give isl_basic_map *isl_basic_map_add_dims(
5341 __isl_take isl_basic_map *bmap,
5342 enum isl_dim_type type, unsigned n);
5343 __isl_give isl_map *isl_map_add_dims(
5344 __isl_take isl_map *map,
5345 enum isl_dim_type type, unsigned n);
5346 __isl_give isl_basic_map *isl_basic_map_insert_dims(
5347 __isl_take isl_basic_map *bmap,
5348 enum isl_dim_type type, unsigned pos,
5350 __isl_give isl_map *isl_map_insert_dims(
5351 __isl_take isl_map *map,
5352 enum isl_dim_type type, unsigned pos, unsigned n);
5353 __isl_give isl_basic_map *isl_basic_map_move_dims(
5354 __isl_take isl_basic_map *bmap,
5355 enum isl_dim_type dst_type, unsigned dst_pos,
5356 enum isl_dim_type src_type, unsigned src_pos,
5358 __isl_give isl_map *isl_map_move_dims(
5359 __isl_take isl_map *map,
5360 enum isl_dim_type dst_type, unsigned dst_pos,
5361 enum isl_dim_type src_type, unsigned src_pos,
5364 #include <isl/val.h>
5365 __isl_give isl_multi_val *isl_multi_val_insert_dims(
5366 __isl_take isl_multi_val *mv,
5367 enum isl_dim_type type, unsigned first, unsigned n);
5368 __isl_give isl_multi_val *isl_multi_val_add_dims(
5369 __isl_take isl_multi_val *mv,
5370 enum isl_dim_type type, unsigned n);
5371 __isl_give isl_multi_val *isl_multi_val_drop_dims(
5372 __isl_take isl_multi_val *mv,
5373 enum isl_dim_type type, unsigned first, unsigned n);
5375 #include <isl/aff.h>
5376 __isl_give isl_aff *isl_aff_insert_dims(
5377 __isl_take isl_aff *aff,
5378 enum isl_dim_type type, unsigned first, unsigned n);
5379 __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
5380 __isl_take isl_multi_aff *ma,
5381 enum isl_dim_type type, unsigned first, unsigned n);
5382 __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
5383 __isl_take isl_pw_aff *pwaff,
5384 enum isl_dim_type type, unsigned first, unsigned n);
5385 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
5386 __isl_take isl_multi_pw_aff *mpa,
5387 enum isl_dim_type type, unsigned first, unsigned n);
5388 __isl_give isl_aff *isl_aff_add_dims(
5389 __isl_take isl_aff *aff,
5390 enum isl_dim_type type, unsigned n);
5391 __isl_give isl_multi_aff *isl_multi_aff_add_dims(
5392 __isl_take isl_multi_aff *ma,
5393 enum isl_dim_type type, unsigned n);
5394 __isl_give isl_pw_aff *isl_pw_aff_add_dims(
5395 __isl_take isl_pw_aff *pwaff,
5396 enum isl_dim_type type, unsigned n);
5397 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
5398 __isl_take isl_multi_pw_aff *mpa,
5399 enum isl_dim_type type, unsigned n);
5400 __isl_give isl_aff *isl_aff_drop_dims(
5401 __isl_take isl_aff *aff,
5402 enum isl_dim_type type, unsigned first, unsigned n);
5403 __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
5404 __isl_take isl_multi_aff *maff,
5405 enum isl_dim_type type, unsigned first, unsigned n);
5406 __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
5407 __isl_take isl_pw_aff *pwaff,
5408 enum isl_dim_type type, unsigned first, unsigned n);
5409 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
5410 __isl_take isl_pw_multi_aff *pma,
5411 enum isl_dim_type type, unsigned first, unsigned n);
5412 __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
5413 __isl_take isl_union_pw_aff *upa,
5414 enum isl_dim_type type, unsigned first, unsigned n);
5415 __isl_give isl_union_pw_multi_aff *
5416 isl_union_pw_multi_aff_drop_dims(
5417 __isl_take isl_union_pw_multi_aff *upma,
5418 enum isl_dim_type type,
5419 unsigned first, unsigned n);
5420 __isl_give isl_multi_union_pw_aff *
5421 isl_multi_union_pw_aff_drop_dims(
5422 __isl_take isl_multi_union_pw_aff *mupa,
5423 enum isl_dim_type type, unsigned first,
5425 __isl_give isl_aff *isl_aff_move_dims(
5426 __isl_take isl_aff *aff,
5427 enum isl_dim_type dst_type, unsigned dst_pos,
5428 enum isl_dim_type src_type, unsigned src_pos,
5430 __isl_give isl_multi_aff *isl_multi_aff_move_dims(
5431 __isl_take isl_multi_aff *ma,
5432 enum isl_dim_type dst_type, unsigned dst_pos,
5433 enum isl_dim_type src_type, unsigned src_pos,
5435 __isl_give isl_pw_aff *isl_pw_aff_move_dims(
5436 __isl_take isl_pw_aff *pa,
5437 enum isl_dim_type dst_type, unsigned dst_pos,
5438 enum isl_dim_type src_type, unsigned src_pos,
5440 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
5441 __isl_take isl_multi_pw_aff *pma,
5442 enum isl_dim_type dst_type, unsigned dst_pos,
5443 enum isl_dim_type src_type, unsigned src_pos,
5446 #include <isl/polynomial.h>
5447 __isl_give isl_union_pw_qpolynomial *
5448 isl_union_pw_qpolynomial_drop_dims(
5449 __isl_take isl_union_pw_qpolynomial *upwqp,
5450 enum isl_dim_type type,
5451 unsigned first, unsigned n);
5452 __isl_give isl_union_pw_qpolynomial_fold *
5453 isl_union_pw_qpolynomial_fold_drop_dims(
5454 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5455 enum isl_dim_type type,
5456 unsigned first, unsigned n);
5458 The operations on union expressions can only manipulate parameters.
5462 =head2 Binary Operations
5464 The two arguments of a binary operation not only need to live
5465 in the same C<isl_ctx>, they currently also need to have
5466 the same (number of) parameters.
5468 =head3 Basic Operations
5472 =item * Intersection
5474 #include <isl/local_space.h>
5475 __isl_give isl_local_space *isl_local_space_intersect(
5476 __isl_take isl_local_space *ls1,
5477 __isl_take isl_local_space *ls2);
5479 #include <isl/set.h>
5480 __isl_give isl_basic_set *isl_basic_set_intersect_params(
5481 __isl_take isl_basic_set *bset1,
5482 __isl_take isl_basic_set *bset2);
5483 __isl_give isl_basic_set *isl_basic_set_intersect(
5484 __isl_take isl_basic_set *bset1,
5485 __isl_take isl_basic_set *bset2);
5486 __isl_give isl_basic_set *isl_basic_set_list_intersect(
5487 __isl_take struct isl_basic_set_list *list);
5488 __isl_give isl_set *isl_set_intersect_params(
5489 __isl_take isl_set *set,
5490 __isl_take isl_set *params);
5491 __isl_give isl_set *isl_set_intersect(
5492 __isl_take isl_set *set1,
5493 __isl_take isl_set *set2);
5495 #include <isl/map.h>
5496 __isl_give isl_basic_map *isl_basic_map_intersect_domain(
5497 __isl_take isl_basic_map *bmap,
5498 __isl_take isl_basic_set *bset);
5499 __isl_give isl_basic_map *isl_basic_map_intersect_range(
5500 __isl_take isl_basic_map *bmap,
5501 __isl_take isl_basic_set *bset);
5502 __isl_give isl_basic_map *isl_basic_map_intersect(
5503 __isl_take isl_basic_map *bmap1,
5504 __isl_take isl_basic_map *bmap2);
5505 __isl_give isl_basic_map *isl_basic_map_list_intersect(
5506 __isl_take isl_basic_map_list *list);
5507 __isl_give isl_map *isl_map_intersect_params(
5508 __isl_take isl_map *map,
5509 __isl_take isl_set *params);
5510 __isl_give isl_map *isl_map_intersect_domain(
5511 __isl_take isl_map *map,
5512 __isl_take isl_set *set);
5513 __isl_give isl_map *isl_map_intersect_range(
5514 __isl_take isl_map *map,
5515 __isl_take isl_set *set);
5516 __isl_give isl_map *isl_map_intersect(
5517 __isl_take isl_map *map1,
5518 __isl_take isl_map *map2);
5520 #include <isl/union_set.h>
5521 __isl_give isl_union_set *isl_union_set_intersect_params(
5522 __isl_take isl_union_set *uset,
5523 __isl_take isl_set *set);
5524 __isl_give isl_union_set *isl_union_set_intersect(
5525 __isl_take isl_union_set *uset1,
5526 __isl_take isl_union_set *uset2);
5528 #include <isl/union_map.h>
5529 __isl_give isl_union_map *isl_union_map_intersect_params(
5530 __isl_take isl_union_map *umap,
5531 __isl_take isl_set *set);
5532 __isl_give isl_union_map *isl_union_map_intersect_domain(
5533 __isl_take isl_union_map *umap,
5534 __isl_take isl_union_set *uset);
5535 __isl_give isl_union_map *isl_union_map_intersect_range(
5536 __isl_take isl_union_map *umap,
5537 __isl_take isl_union_set *uset);
5538 __isl_give isl_union_map *isl_union_map_intersect(
5539 __isl_take isl_union_map *umap1,
5540 __isl_take isl_union_map *umap2);
5542 #include <isl/aff.h>
5543 __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
5544 __isl_take isl_pw_aff *pa,
5545 __isl_take isl_set *set);
5546 __isl_give isl_multi_pw_aff *
5547 isl_multi_pw_aff_intersect_domain(
5548 __isl_take isl_multi_pw_aff *mpa,
5549 __isl_take isl_set *domain);
5550 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
5551 __isl_take isl_pw_multi_aff *pma,
5552 __isl_take isl_set *set);
5553 __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
5554 __isl_take isl_union_pw_aff *upa,
5555 __isl_take isl_union_set *uset);
5556 __isl_give isl_union_pw_multi_aff *
5557 isl_union_pw_multi_aff_intersect_domain(
5558 __isl_take isl_union_pw_multi_aff *upma,
5559 __isl_take isl_union_set *uset);
5560 __isl_give isl_multi_union_pw_aff *
5561 isl_multi_union_pw_aff_intersect_domain(
5562 __isl_take isl_multi_union_pw_aff *mupa,
5563 __isl_take isl_union_set *uset);
5564 __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
5565 __isl_take isl_pw_aff *pa,
5566 __isl_take isl_set *set);
5567 __isl_give isl_multi_pw_aff *
5568 isl_multi_pw_aff_intersect_params(
5569 __isl_take isl_multi_pw_aff *mpa,
5570 __isl_take isl_set *set);
5571 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
5572 __isl_take isl_pw_multi_aff *pma,
5573 __isl_take isl_set *set);
5574 __isl_give isl_union_pw_aff *
5575 isl_union_pw_aff_intersect_params(
5576 __isl_take isl_union_pw_aff *upa,
5577 __isl_give isl_union_pw_multi_aff *
5578 isl_union_pw_multi_aff_intersect_params(
5579 __isl_take isl_union_pw_multi_aff *upma,
5580 __isl_take isl_set *set);
5581 __isl_give isl_multi_union_pw_aff *
5582 isl_multi_union_pw_aff_intersect_params(
5583 __isl_take isl_multi_union_pw_aff *mupa,
5584 __isl_take isl_set *params);
5585 isl_multi_union_pw_aff_intersect_range(
5586 __isl_take isl_multi_union_pw_aff *mupa,
5587 __isl_take isl_set *set);
5589 #include <isl/polynomial.h>
5590 __isl_give isl_pw_qpolynomial *
5591 isl_pw_qpolynomial_intersect_domain(
5592 __isl_take isl_pw_qpolynomial *pwpq,
5593 __isl_take isl_set *set);
5594 __isl_give isl_union_pw_qpolynomial *
5595 isl_union_pw_qpolynomial_intersect_domain(
5596 __isl_take isl_union_pw_qpolynomial *upwpq,
5597 __isl_take isl_union_set *uset);
5598 __isl_give isl_union_pw_qpolynomial_fold *
5599 isl_union_pw_qpolynomial_fold_intersect_domain(
5600 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5601 __isl_take isl_union_set *uset);
5602 __isl_give isl_pw_qpolynomial *
5603 isl_pw_qpolynomial_intersect_params(
5604 __isl_take isl_pw_qpolynomial *pwpq,
5605 __isl_take isl_set *set);
5606 __isl_give isl_pw_qpolynomial_fold *
5607 isl_pw_qpolynomial_fold_intersect_params(
5608 __isl_take isl_pw_qpolynomial_fold *pwf,
5609 __isl_take isl_set *set);
5610 __isl_give isl_union_pw_qpolynomial *
5611 isl_union_pw_qpolynomial_intersect_params(
5612 __isl_take isl_union_pw_qpolynomial *upwpq,
5613 __isl_take isl_set *set);
5614 __isl_give isl_union_pw_qpolynomial_fold *
5615 isl_union_pw_qpolynomial_fold_intersect_params(
5616 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5617 __isl_take isl_set *set);
5619 The second argument to the C<_params> functions needs to be
5620 a parametric (basic) set. For the other functions, a parametric set
5621 for either argument is only allowed if the other argument is
5622 a parametric set as well.
5623 The list passed to C<isl_basic_set_list_intersect> needs to have
5624 at least one element and all elements need to live in the same space.
5625 The function C<isl_multi_union_pw_aff_intersect_range>
5626 restricts the input function to those shared domain elements
5627 that map to the specified range.
5631 #include <isl/set.h>
5632 __isl_give isl_set *isl_basic_set_union(
5633 __isl_take isl_basic_set *bset1,
5634 __isl_take isl_basic_set *bset2);
5635 __isl_give isl_set *isl_set_union(
5636 __isl_take isl_set *set1,
5637 __isl_take isl_set *set2);
5639 #include <isl/map.h>
5640 __isl_give isl_map *isl_basic_map_union(
5641 __isl_take isl_basic_map *bmap1,
5642 __isl_take isl_basic_map *bmap2);
5643 __isl_give isl_map *isl_map_union(
5644 __isl_take isl_map *map1,
5645 __isl_take isl_map *map2);
5647 #include <isl/union_set.h>
5648 __isl_give isl_union_set *isl_union_set_union(
5649 __isl_take isl_union_set *uset1,
5650 __isl_take isl_union_set *uset2);
5651 __isl_give isl_union_set *isl_union_set_list_union(
5652 __isl_take isl_union_set_list *list);
5654 #include <isl/union_map.h>
5655 __isl_give isl_union_map *isl_union_map_union(
5656 __isl_take isl_union_map *umap1,
5657 __isl_take isl_union_map *umap2);
5659 =item * Set difference
5661 #include <isl/set.h>
5662 __isl_give isl_set *isl_set_subtract(
5663 __isl_take isl_set *set1,
5664 __isl_take isl_set *set2);
5666 #include <isl/map.h>
5667 __isl_give isl_map *isl_map_subtract(
5668 __isl_take isl_map *map1,
5669 __isl_take isl_map *map2);
5670 __isl_give isl_map *isl_map_subtract_domain(
5671 __isl_take isl_map *map,
5672 __isl_take isl_set *dom);
5673 __isl_give isl_map *isl_map_subtract_range(
5674 __isl_take isl_map *map,
5675 __isl_take isl_set *dom);
5677 #include <isl/union_set.h>
5678 __isl_give isl_union_set *isl_union_set_subtract(
5679 __isl_take isl_union_set *uset1,
5680 __isl_take isl_union_set *uset2);
5682 #include <isl/union_map.h>
5683 __isl_give isl_union_map *isl_union_map_subtract(
5684 __isl_take isl_union_map *umap1,
5685 __isl_take isl_union_map *umap2);
5686 __isl_give isl_union_map *isl_union_map_subtract_domain(
5687 __isl_take isl_union_map *umap,
5688 __isl_take isl_union_set *dom);
5689 __isl_give isl_union_map *isl_union_map_subtract_range(
5690 __isl_take isl_union_map *umap,
5691 __isl_take isl_union_set *dom);
5693 #include <isl/aff.h>
5694 __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
5695 __isl_take isl_pw_aff *pa,
5696 __isl_take isl_set *set);
5697 __isl_give isl_pw_multi_aff *
5698 isl_pw_multi_aff_subtract_domain(
5699 __isl_take isl_pw_multi_aff *pma,
5700 __isl_take isl_set *set);
5701 __isl_give isl_union_pw_aff *
5702 isl_union_pw_aff_subtract_domain(
5703 __isl_take isl_union_pw_aff *upa,
5704 __isl_take isl_union_set *uset);
5705 __isl_give isl_union_pw_multi_aff *
5706 isl_union_pw_multi_aff_subtract_domain(
5707 __isl_take isl_union_pw_multi_aff *upma,
5708 __isl_take isl_set *set);
5710 #include <isl/polynomial.h>
5711 __isl_give isl_pw_qpolynomial *
5712 isl_pw_qpolynomial_subtract_domain(
5713 __isl_take isl_pw_qpolynomial *pwpq,
5714 __isl_take isl_set *set);
5715 __isl_give isl_pw_qpolynomial_fold *
5716 isl_pw_qpolynomial_fold_subtract_domain(
5717 __isl_take isl_pw_qpolynomial_fold *pwf,
5718 __isl_take isl_set *set);
5719 __isl_give isl_union_pw_qpolynomial *
5720 isl_union_pw_qpolynomial_subtract_domain(
5721 __isl_take isl_union_pw_qpolynomial *upwpq,
5722 __isl_take isl_union_set *uset);
5723 __isl_give isl_union_pw_qpolynomial_fold *
5724 isl_union_pw_qpolynomial_fold_subtract_domain(
5725 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5726 __isl_take isl_union_set *uset);
5730 #include <isl/space.h>
5731 __isl_give isl_space *isl_space_join(
5732 __isl_take isl_space *left,
5733 __isl_take isl_space *right);
5735 #include <isl/map.h>
5736 __isl_give isl_basic_set *isl_basic_set_apply(
5737 __isl_take isl_basic_set *bset,
5738 __isl_take isl_basic_map *bmap);
5739 __isl_give isl_set *isl_set_apply(
5740 __isl_take isl_set *set,
5741 __isl_take isl_map *map);
5742 __isl_give isl_union_set *isl_union_set_apply(
5743 __isl_take isl_union_set *uset,
5744 __isl_take isl_union_map *umap);
5745 __isl_give isl_basic_map *isl_basic_map_apply_domain(
5746 __isl_take isl_basic_map *bmap1,
5747 __isl_take isl_basic_map *bmap2);
5748 __isl_give isl_basic_map *isl_basic_map_apply_range(
5749 __isl_take isl_basic_map *bmap1,
5750 __isl_take isl_basic_map *bmap2);
5751 __isl_give isl_map *isl_map_apply_domain(
5752 __isl_take isl_map *map1,
5753 __isl_take isl_map *map2);
5754 __isl_give isl_map *isl_map_apply_range(
5755 __isl_take isl_map *map1,
5756 __isl_take isl_map *map2);
5758 #include <isl/union_map.h>
5759 __isl_give isl_union_map *isl_union_map_apply_domain(
5760 __isl_take isl_union_map *umap1,
5761 __isl_take isl_union_map *umap2);
5762 __isl_give isl_union_map *isl_union_map_apply_range(
5763 __isl_take isl_union_map *umap1,
5764 __isl_take isl_union_map *umap2);
5766 #include <isl/aff.h>
5767 __isl_give isl_union_pw_aff *
5768 isl_multi_union_pw_aff_apply_aff(
5769 __isl_take isl_multi_union_pw_aff *mupa,
5770 __isl_take isl_aff *aff);
5771 __isl_give isl_union_pw_aff *
5772 isl_multi_union_pw_aff_apply_pw_aff(
5773 __isl_take isl_multi_union_pw_aff *mupa,
5774 __isl_take isl_pw_aff *pa);
5775 __isl_give isl_multi_union_pw_aff *
5776 isl_multi_union_pw_aff_apply_multi_aff(
5777 __isl_take isl_multi_union_pw_aff *mupa,
5778 __isl_take isl_multi_aff *ma);
5779 __isl_give isl_multi_union_pw_aff *
5780 isl_multi_union_pw_aff_apply_pw_multi_aff(
5781 __isl_take isl_multi_union_pw_aff *mupa,
5782 __isl_take isl_pw_multi_aff *pma);
5784 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
5785 over the shared domain of the elements of the input. The dimension is
5786 required to be greater than zero.
5787 The C<isl_multi_union_pw_aff> argument of
5788 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
5789 but only if the range of the C<isl_multi_aff> argument
5790 is also zero-dimensional.
5791 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
5793 #include <isl/polynomial.h>
5794 __isl_give isl_pw_qpolynomial_fold *
5795 isl_set_apply_pw_qpolynomial_fold(
5796 __isl_take isl_set *set,
5797 __isl_take isl_pw_qpolynomial_fold *pwf,
5799 __isl_give isl_pw_qpolynomial_fold *
5800 isl_map_apply_pw_qpolynomial_fold(
5801 __isl_take isl_map *map,
5802 __isl_take isl_pw_qpolynomial_fold *pwf,
5804 __isl_give isl_union_pw_qpolynomial_fold *
5805 isl_union_set_apply_union_pw_qpolynomial_fold(
5806 __isl_take isl_union_set *uset,
5807 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5809 __isl_give isl_union_pw_qpolynomial_fold *
5810 isl_union_map_apply_union_pw_qpolynomial_fold(
5811 __isl_take isl_union_map *umap,
5812 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5815 The functions taking a map
5816 compose the given map with the given piecewise quasipolynomial reduction.
5817 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
5818 over all elements in the intersection of the range of the map
5819 and the domain of the piecewise quasipolynomial reduction
5820 as a function of an element in the domain of the map.
5821 The functions taking a set compute a bound over all elements in the
5822 intersection of the set and the domain of the
5823 piecewise quasipolynomial reduction.
5827 #include <isl/set.h>
5828 __isl_give isl_basic_set *
5829 isl_basic_set_preimage_multi_aff(
5830 __isl_take isl_basic_set *bset,
5831 __isl_take isl_multi_aff *ma);
5832 __isl_give isl_set *isl_set_preimage_multi_aff(
5833 __isl_take isl_set *set,
5834 __isl_take isl_multi_aff *ma);
5835 __isl_give isl_set *isl_set_preimage_pw_multi_aff(
5836 __isl_take isl_set *set,
5837 __isl_take isl_pw_multi_aff *pma);
5838 __isl_give isl_set *isl_set_preimage_multi_pw_aff(
5839 __isl_take isl_set *set,
5840 __isl_take isl_multi_pw_aff *mpa);
5842 #include <isl/union_set.h>
5843 __isl_give isl_union_set *
5844 isl_union_set_preimage_multi_aff(
5845 __isl_take isl_union_set *uset,
5846 __isl_take isl_multi_aff *ma);
5847 __isl_give isl_union_set *
5848 isl_union_set_preimage_pw_multi_aff(
5849 __isl_take isl_union_set *uset,
5850 __isl_take isl_pw_multi_aff *pma);
5851 __isl_give isl_union_set *
5852 isl_union_set_preimage_union_pw_multi_aff(
5853 __isl_take isl_union_set *uset,
5854 __isl_take isl_union_pw_multi_aff *upma);
5856 #include <isl/map.h>
5857 __isl_give isl_basic_map *
5858 isl_basic_map_preimage_domain_multi_aff(
5859 __isl_take isl_basic_map *bmap,
5860 __isl_take isl_multi_aff *ma);
5861 __isl_give isl_map *isl_map_preimage_domain_multi_aff(
5862 __isl_take isl_map *map,
5863 __isl_take isl_multi_aff *ma);
5864 __isl_give isl_map *isl_map_preimage_range_multi_aff(
5865 __isl_take isl_map *map,
5866 __isl_take isl_multi_aff *ma);
5867 __isl_give isl_map *
5868 isl_map_preimage_domain_pw_multi_aff(
5869 __isl_take isl_map *map,
5870 __isl_take isl_pw_multi_aff *pma);
5871 __isl_give isl_map *
5872 isl_map_preimage_range_pw_multi_aff(
5873 __isl_take isl_map *map,
5874 __isl_take isl_pw_multi_aff *pma);
5875 __isl_give isl_map *
5876 isl_map_preimage_domain_multi_pw_aff(
5877 __isl_take isl_map *map,
5878 __isl_take isl_multi_pw_aff *mpa);
5879 __isl_give isl_basic_map *
5880 isl_basic_map_preimage_range_multi_aff(
5881 __isl_take isl_basic_map *bmap,
5882 __isl_take isl_multi_aff *ma);
5884 #include <isl/union_map.h>
5885 __isl_give isl_union_map *
5886 isl_union_map_preimage_domain_multi_aff(
5887 __isl_take isl_union_map *umap,
5888 __isl_take isl_multi_aff *ma);
5889 __isl_give isl_union_map *
5890 isl_union_map_preimage_range_multi_aff(
5891 __isl_take isl_union_map *umap,
5892 __isl_take isl_multi_aff *ma);
5893 __isl_give isl_union_map *
5894 isl_union_map_preimage_domain_pw_multi_aff(
5895 __isl_take isl_union_map *umap,
5896 __isl_take isl_pw_multi_aff *pma);
5897 __isl_give isl_union_map *
5898 isl_union_map_preimage_range_pw_multi_aff(
5899 __isl_take isl_union_map *umap,
5900 __isl_take isl_pw_multi_aff *pma);
5901 __isl_give isl_union_map *
5902 isl_union_map_preimage_domain_union_pw_multi_aff(
5903 __isl_take isl_union_map *umap,
5904 __isl_take isl_union_pw_multi_aff *upma);
5905 __isl_give isl_union_map *
5906 isl_union_map_preimage_range_union_pw_multi_aff(
5907 __isl_take isl_union_map *umap,
5908 __isl_take isl_union_pw_multi_aff *upma);
5910 These functions compute the preimage of the given set or map domain/range under
5911 the given function. In other words, the expression is plugged
5912 into the set description or into the domain/range of the map.
5916 #include <isl/aff.h>
5917 __isl_give isl_aff *isl_aff_pullback_aff(
5918 __isl_take isl_aff *aff1,
5919 __isl_take isl_aff *aff2);
5920 __isl_give isl_aff *isl_aff_pullback_multi_aff(
5921 __isl_take isl_aff *aff,
5922 __isl_take isl_multi_aff *ma);
5923 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
5924 __isl_take isl_pw_aff *pa,
5925 __isl_take isl_multi_aff *ma);
5926 __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
5927 __isl_take isl_pw_aff *pa,
5928 __isl_take isl_pw_multi_aff *pma);
5929 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
5930 __isl_take isl_pw_aff *pa,
5931 __isl_take isl_multi_pw_aff *mpa);
5932 __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
5933 __isl_take isl_multi_aff *ma1,
5934 __isl_take isl_multi_aff *ma2);
5935 __isl_give isl_pw_multi_aff *
5936 isl_pw_multi_aff_pullback_multi_aff(
5937 __isl_take isl_pw_multi_aff *pma,
5938 __isl_take isl_multi_aff *ma);
5939 __isl_give isl_multi_pw_aff *
5940 isl_multi_pw_aff_pullback_multi_aff(
5941 __isl_take isl_multi_pw_aff *mpa,
5942 __isl_take isl_multi_aff *ma);
5943 __isl_give isl_pw_multi_aff *
5944 isl_pw_multi_aff_pullback_pw_multi_aff(
5945 __isl_take isl_pw_multi_aff *pma1,
5946 __isl_take isl_pw_multi_aff *pma2);
5947 __isl_give isl_multi_pw_aff *
5948 isl_multi_pw_aff_pullback_pw_multi_aff(
5949 __isl_take isl_multi_pw_aff *mpa,
5950 __isl_take isl_pw_multi_aff *pma);
5951 __isl_give isl_multi_pw_aff *
5952 isl_multi_pw_aff_pullback_multi_pw_aff(
5953 __isl_take isl_multi_pw_aff *mpa1,
5954 __isl_take isl_multi_pw_aff *mpa2);
5955 __isl_give isl_union_pw_aff *
5956 isl_union_pw_aff_pullback_union_pw_multi_aff(
5957 __isl_take isl_union_pw_aff *upa,
5958 __isl_take isl_union_pw_multi_aff *upma);
5959 __isl_give isl_union_pw_multi_aff *
5960 isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
5961 __isl_take isl_union_pw_multi_aff *upma1,
5962 __isl_take isl_union_pw_multi_aff *upma2);
5963 __isl_give isl_multi_union_pw_aff *
5964 isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
5965 __isl_take isl_multi_union_pw_aff *mupa,
5966 __isl_take isl_union_pw_multi_aff *upma);
5968 These functions precompose the first expression by the second function.
5969 In other words, the second function is plugged
5970 into the first expression.
5974 #include <isl/aff.h>
5975 __isl_give isl_basic_set *isl_aff_le_basic_set(
5976 __isl_take isl_aff *aff1,
5977 __isl_take isl_aff *aff2);
5978 __isl_give isl_basic_set *isl_aff_ge_basic_set(
5979 __isl_take isl_aff *aff1,
5980 __isl_take isl_aff *aff2);
5981 __isl_give isl_set *isl_pw_aff_eq_set(
5982 __isl_take isl_pw_aff *pwaff1,
5983 __isl_take isl_pw_aff *pwaff2);
5984 __isl_give isl_set *isl_pw_aff_ne_set(
5985 __isl_take isl_pw_aff *pwaff1,
5986 __isl_take isl_pw_aff *pwaff2);
5987 __isl_give isl_set *isl_pw_aff_le_set(
5988 __isl_take isl_pw_aff *pwaff1,
5989 __isl_take isl_pw_aff *pwaff2);
5990 __isl_give isl_set *isl_pw_aff_lt_set(
5991 __isl_take isl_pw_aff *pwaff1,
5992 __isl_take isl_pw_aff *pwaff2);
5993 __isl_give isl_set *isl_pw_aff_ge_set(
5994 __isl_take isl_pw_aff *pwaff1,
5995 __isl_take isl_pw_aff *pwaff2);
5996 __isl_give isl_set *isl_pw_aff_gt_set(
5997 __isl_take isl_pw_aff *pwaff1,
5998 __isl_take isl_pw_aff *pwaff2);
6000 __isl_give isl_set *isl_multi_aff_lex_le_set(
6001 __isl_take isl_multi_aff *ma1,
6002 __isl_take isl_multi_aff *ma2);
6003 __isl_give isl_set *isl_multi_aff_lex_ge_set(
6004 __isl_take isl_multi_aff *ma1,
6005 __isl_take isl_multi_aff *ma2);
6007 __isl_give isl_set *isl_pw_aff_list_eq_set(
6008 __isl_take isl_pw_aff_list *list1,
6009 __isl_take isl_pw_aff_list *list2);
6010 __isl_give isl_set *isl_pw_aff_list_ne_set(
6011 __isl_take isl_pw_aff_list *list1,
6012 __isl_take isl_pw_aff_list *list2);
6013 __isl_give isl_set *isl_pw_aff_list_le_set(
6014 __isl_take isl_pw_aff_list *list1,
6015 __isl_take isl_pw_aff_list *list2);
6016 __isl_give isl_set *isl_pw_aff_list_lt_set(
6017 __isl_take isl_pw_aff_list *list1,
6018 __isl_take isl_pw_aff_list *list2);
6019 __isl_give isl_set *isl_pw_aff_list_ge_set(
6020 __isl_take isl_pw_aff_list *list1,
6021 __isl_take isl_pw_aff_list *list2);
6022 __isl_give isl_set *isl_pw_aff_list_gt_set(
6023 __isl_take isl_pw_aff_list *list1,
6024 __isl_take isl_pw_aff_list *list2);
6026 The function C<isl_aff_ge_basic_set> returns a basic set
6027 containing those elements in the shared space
6028 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
6029 The function C<isl_pw_aff_ge_set> returns a set
6030 containing those elements in the shared domain
6031 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
6032 greater than or equal to C<pwaff2>.
6033 The function C<isl_multi_aff_lex_le_set> returns a set
6034 containing those elements in the shared domain space
6035 where C<ma1> is lexicographically smaller than or
6037 The functions operating on C<isl_pw_aff_list> apply the corresponding
6038 C<isl_pw_aff> function to each pair of elements in the two lists.
6040 #include <isl/aff.h>
6041 __isl_give isl_map *isl_pw_aff_eq_map(
6042 __isl_take isl_pw_aff *pa1,
6043 __isl_take isl_pw_aff *pa2);
6044 __isl_give isl_map *isl_pw_aff_lt_map(
6045 __isl_take isl_pw_aff *pa1,
6046 __isl_take isl_pw_aff *pa2);
6047 __isl_give isl_map *isl_pw_aff_gt_map(
6048 __isl_take isl_pw_aff *pa1,
6049 __isl_take isl_pw_aff *pa2);
6051 __isl_give isl_map *isl_multi_pw_aff_eq_map(
6052 __isl_take isl_multi_pw_aff *mpa1,
6053 __isl_take isl_multi_pw_aff *mpa2);
6054 __isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
6055 __isl_take isl_multi_pw_aff *mpa1,
6056 __isl_take isl_multi_pw_aff *mpa2);
6057 __isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
6058 __isl_take isl_multi_pw_aff *mpa1,
6059 __isl_take isl_multi_pw_aff *mpa2);
6061 These functions return a map between domain elements of the arguments
6062 where the function values satisfy the given relation.
6064 #include <isl/union_map.h>
6065 __isl_give isl_union_map *
6066 isl_union_map_eq_at_multi_union_pw_aff(
6067 __isl_take isl_union_map *umap,
6068 __isl_take isl_multi_union_pw_aff *mupa);
6069 __isl_give isl_union_map *
6070 isl_union_map_lex_lt_at_multi_union_pw_aff(
6071 __isl_take isl_union_map *umap,
6072 __isl_take isl_multi_union_pw_aff *mupa);
6073 __isl_give isl_union_map *
6074 isl_union_map_lex_gt_at_multi_union_pw_aff(
6075 __isl_take isl_union_map *umap,
6076 __isl_take isl_multi_union_pw_aff *mupa);
6078 These functions select the subset of elements in the union map
6079 that have an equal or lexicographically smaller function value.
6081 =item * Cartesian Product
6083 #include <isl/space.h>
6084 __isl_give isl_space *isl_space_product(
6085 __isl_take isl_space *space1,
6086 __isl_take isl_space *space2);
6087 __isl_give isl_space *isl_space_domain_product(
6088 __isl_take isl_space *space1,
6089 __isl_take isl_space *space2);
6090 __isl_give isl_space *isl_space_range_product(
6091 __isl_take isl_space *space1,
6092 __isl_take isl_space *space2);
6095 C<isl_space_product>, C<isl_space_domain_product>
6096 and C<isl_space_range_product> take pairs or relation spaces and
6097 produce a single relations space, where either the domain, the range
6098 or both domain and range are wrapped spaces of relations between
6099 the domains and/or ranges of the input spaces.
6100 If the product is only constructed over the domain or the range
6101 then the ranges or the domains of the inputs should be the same.
6102 The function C<isl_space_product> also accepts a pair of set spaces,
6103 in which case it returns a wrapped space of a relation between the
6106 #include <isl/set.h>
6107 __isl_give isl_set *isl_set_product(
6108 __isl_take isl_set *set1,
6109 __isl_take isl_set *set2);
6111 #include <isl/map.h>
6112 __isl_give isl_basic_map *isl_basic_map_domain_product(
6113 __isl_take isl_basic_map *bmap1,
6114 __isl_take isl_basic_map *bmap2);
6115 __isl_give isl_basic_map *isl_basic_map_range_product(
6116 __isl_take isl_basic_map *bmap1,
6117 __isl_take isl_basic_map *bmap2);
6118 __isl_give isl_basic_map *isl_basic_map_product(
6119 __isl_take isl_basic_map *bmap1,
6120 __isl_take isl_basic_map *bmap2);
6121 __isl_give isl_map *isl_map_domain_product(
6122 __isl_take isl_map *map1,
6123 __isl_take isl_map *map2);
6124 __isl_give isl_map *isl_map_range_product(
6125 __isl_take isl_map *map1,
6126 __isl_take isl_map *map2);
6127 __isl_give isl_map *isl_map_product(
6128 __isl_take isl_map *map1,
6129 __isl_take isl_map *map2);
6131 #include <isl/union_set.h>
6132 __isl_give isl_union_set *isl_union_set_product(
6133 __isl_take isl_union_set *uset1,
6134 __isl_take isl_union_set *uset2);
6136 #include <isl/union_map.h>
6137 __isl_give isl_union_map *isl_union_map_domain_product(
6138 __isl_take isl_union_map *umap1,
6139 __isl_take isl_union_map *umap2);
6140 __isl_give isl_union_map *isl_union_map_range_product(
6141 __isl_take isl_union_map *umap1,
6142 __isl_take isl_union_map *umap2);
6143 __isl_give isl_union_map *isl_union_map_product(
6144 __isl_take isl_union_map *umap1,
6145 __isl_take isl_union_map *umap2);
6147 #include <isl/val.h>
6148 __isl_give isl_multi_val *isl_multi_val_range_product(
6149 __isl_take isl_multi_val *mv1,
6150 __isl_take isl_multi_val *mv2);
6151 __isl_give isl_multi_val *isl_multi_val_product(
6152 __isl_take isl_multi_val *mv1,
6153 __isl_take isl_multi_val *mv2);
6155 #include <isl/aff.h>
6156 __isl_give isl_multi_aff *isl_multi_aff_range_product(
6157 __isl_take isl_multi_aff *ma1,
6158 __isl_take isl_multi_aff *ma2);
6159 __isl_give isl_multi_aff *isl_multi_aff_product(
6160 __isl_take isl_multi_aff *ma1,
6161 __isl_take isl_multi_aff *ma2);
6162 __isl_give isl_multi_pw_aff *
6163 isl_multi_pw_aff_range_product(
6164 __isl_take isl_multi_pw_aff *mpa1,
6165 __isl_take isl_multi_pw_aff *mpa2);
6166 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
6167 __isl_take isl_multi_pw_aff *mpa1,
6168 __isl_take isl_multi_pw_aff *mpa2);
6169 __isl_give isl_pw_multi_aff *
6170 isl_pw_multi_aff_range_product(
6171 __isl_take isl_pw_multi_aff *pma1,
6172 __isl_take isl_pw_multi_aff *pma2);
6173 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
6174 __isl_take isl_pw_multi_aff *pma1,
6175 __isl_take isl_pw_multi_aff *pma2);
6176 __isl_give isl_multi_union_pw_aff *
6177 isl_multi_union_pw_aff_range_product(
6178 __isl_take isl_multi_union_pw_aff *mupa1,
6179 __isl_take isl_multi_union_pw_aff *mupa2);
6181 The above functions compute the cross product of the given
6182 sets, relations or functions. The domains and ranges of the results
6183 are wrapped maps between domains and ranges of the inputs.
6184 To obtain a ``flat'' product, use the following functions
6187 #include <isl/set.h>
6188 __isl_give isl_basic_set *isl_basic_set_flat_product(
6189 __isl_take isl_basic_set *bset1,
6190 __isl_take isl_basic_set *bset2);
6191 __isl_give isl_set *isl_set_flat_product(
6192 __isl_take isl_set *set1,
6193 __isl_take isl_set *set2);
6195 #include <isl/map.h>
6196 __isl_give isl_basic_map *isl_basic_map_flat_range_product(
6197 __isl_take isl_basic_map *bmap1,
6198 __isl_take isl_basic_map *bmap2);
6199 __isl_give isl_map *isl_map_flat_domain_product(
6200 __isl_take isl_map *map1,
6201 __isl_take isl_map *map2);
6202 __isl_give isl_map *isl_map_flat_range_product(
6203 __isl_take isl_map *map1,
6204 __isl_take isl_map *map2);
6205 __isl_give isl_basic_map *isl_basic_map_flat_product(
6206 __isl_take isl_basic_map *bmap1,
6207 __isl_take isl_basic_map *bmap2);
6208 __isl_give isl_map *isl_map_flat_product(
6209 __isl_take isl_map *map1,
6210 __isl_take isl_map *map2);
6212 #include <isl/union_map.h>
6213 __isl_give isl_union_map *
6214 isl_union_map_flat_domain_product(
6215 __isl_take isl_union_map *umap1,
6216 __isl_take isl_union_map *umap2);
6217 __isl_give isl_union_map *
6218 isl_union_map_flat_range_product(
6219 __isl_take isl_union_map *umap1,
6220 __isl_take isl_union_map *umap2);
6222 #include <isl/val.h>
6223 __isl_give isl_multi_val *isl_multi_val_flat_range_product(
6224 __isl_take isl_multi_val *mv1,
6225 __isl_take isl_multi_aff *mv2);
6227 #include <isl/aff.h>
6228 __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
6229 __isl_take isl_multi_aff *ma1,
6230 __isl_take isl_multi_aff *ma2);
6231 __isl_give isl_pw_multi_aff *
6232 isl_pw_multi_aff_flat_range_product(
6233 __isl_take isl_pw_multi_aff *pma1,
6234 __isl_take isl_pw_multi_aff *pma2);
6235 __isl_give isl_multi_pw_aff *
6236 isl_multi_pw_aff_flat_range_product(
6237 __isl_take isl_multi_pw_aff *mpa1,
6238 __isl_take isl_multi_pw_aff *mpa2);
6239 __isl_give isl_union_pw_multi_aff *
6240 isl_union_pw_multi_aff_flat_range_product(
6241 __isl_take isl_union_pw_multi_aff *upma1,
6242 __isl_take isl_union_pw_multi_aff *upma2);
6243 __isl_give isl_multi_union_pw_aff *
6244 isl_multi_union_pw_aff_flat_range_product(
6245 __isl_take isl_multi_union_pw_aff *mupa1,
6246 __isl_take isl_multi_union_pw_aff *mupa2);
6248 #include <isl/space.h>
6249 __isl_give isl_space *isl_space_factor_domain(
6250 __isl_take isl_space *space);
6251 __isl_give isl_space *isl_space_factor_range(
6252 __isl_take isl_space *space);
6253 __isl_give isl_space *isl_space_domain_factor_domain(
6254 __isl_take isl_space *space);
6255 __isl_give isl_space *isl_space_domain_factor_range(
6256 __isl_take isl_space *space);
6257 __isl_give isl_space *isl_space_range_factor_domain(
6258 __isl_take isl_space *space);
6259 __isl_give isl_space *isl_space_range_factor_range(
6260 __isl_take isl_space *space);
6262 The functions C<isl_space_range_factor_domain> and
6263 C<isl_space_range_factor_range> extract the two arguments from
6264 the result of a call to C<isl_space_range_product>.
6266 The arguments of a call to a product can be extracted
6267 from the result using the following functions.
6269 #include <isl/map.h>
6270 __isl_give isl_map *isl_map_factor_domain(
6271 __isl_take isl_map *map);
6272 __isl_give isl_map *isl_map_factor_range(
6273 __isl_take isl_map *map);
6274 __isl_give isl_map *isl_map_domain_factor_domain(
6275 __isl_take isl_map *map);
6276 __isl_give isl_map *isl_map_domain_factor_range(
6277 __isl_take isl_map *map);
6278 __isl_give isl_map *isl_map_range_factor_domain(
6279 __isl_take isl_map *map);
6280 __isl_give isl_map *isl_map_range_factor_range(
6281 __isl_take isl_map *map);
6283 #include <isl/union_map.h>
6284 __isl_give isl_union_map *isl_union_map_factor_domain(
6285 __isl_take isl_union_map *umap);
6286 __isl_give isl_union_map *isl_union_map_factor_range(
6287 __isl_take isl_union_map *umap);
6288 __isl_give isl_union_map *
6289 isl_union_map_domain_factor_domain(
6290 __isl_take isl_union_map *umap);
6291 __isl_give isl_union_map *
6292 isl_union_map_domain_factor_range(
6293 __isl_take isl_union_map *umap);
6294 __isl_give isl_union_map *
6295 isl_union_map_range_factor_range(
6296 __isl_take isl_union_map *umap);
6298 #include <isl/val.h>
6299 __isl_give isl_multi_val *isl_multi_val_factor_range(
6300 __isl_take isl_multi_val *mv);
6301 __isl_give isl_multi_val *
6302 isl_multi_val_range_factor_domain(
6303 __isl_take isl_multi_val *mv);
6304 __isl_give isl_multi_val *
6305 isl_multi_val_range_factor_range(
6306 __isl_take isl_multi_val *mv);
6308 #include <isl/aff.h>
6309 __isl_give isl_multi_aff *isl_multi_aff_factor_range(
6310 __isl_take isl_multi_aff *ma);
6311 __isl_give isl_multi_aff *
6312 isl_multi_aff_range_factor_domain(
6313 __isl_take isl_multi_aff *ma);
6314 __isl_give isl_multi_aff *
6315 isl_multi_aff_range_factor_range(
6316 __isl_take isl_multi_aff *ma);
6317 __isl_give isl_multi_pw_aff *
6318 isl_multi_pw_aff_factor_range(
6319 __isl_take isl_multi_pw_aff *mpa);
6320 __isl_give isl_multi_pw_aff *
6321 isl_multi_pw_aff_range_factor_domain(
6322 __isl_take isl_multi_pw_aff *mpa);
6323 __isl_give isl_multi_pw_aff *
6324 isl_multi_pw_aff_range_factor_range(
6325 __isl_take isl_multi_pw_aff *mpa);
6326 __isl_give isl_multi_union_pw_aff *
6327 isl_multi_union_pw_aff_factor_range(
6328 __isl_take isl_multi_union_pw_aff *mupa);
6329 __isl_give isl_multi_union_pw_aff *
6330 isl_multi_union_pw_aff_range_factor_domain(
6331 __isl_take isl_multi_union_pw_aff *mupa);
6332 __isl_give isl_multi_union_pw_aff *
6333 isl_multi_union_pw_aff_range_factor_range(
6334 __isl_take isl_multi_union_pw_aff *mupa);
6336 The splice functions are a generalization of the flat product functions,
6337 where the second argument may be inserted at any position inside
6338 the first argument rather than being placed at the end.
6339 The functions C<isl_multi_val_factor_range>,
6340 C<isl_multi_aff_factor_range>,
6341 C<isl_multi_pw_aff_factor_range> and
6342 C<isl_multi_union_pw_aff_factor_range>
6343 take functions that live in a set space.
6345 #include <isl/val.h>
6346 __isl_give isl_multi_val *isl_multi_val_range_splice(
6347 __isl_take isl_multi_val *mv1, unsigned pos,
6348 __isl_take isl_multi_val *mv2);
6350 #include <isl/aff.h>
6351 __isl_give isl_multi_aff *isl_multi_aff_range_splice(
6352 __isl_take isl_multi_aff *ma1, unsigned pos,
6353 __isl_take isl_multi_aff *ma2);
6354 __isl_give isl_multi_aff *isl_multi_aff_splice(
6355 __isl_take isl_multi_aff *ma1,
6356 unsigned in_pos, unsigned out_pos,
6357 __isl_take isl_multi_aff *ma2);
6358 __isl_give isl_multi_pw_aff *
6359 isl_multi_pw_aff_range_splice(
6360 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
6361 __isl_take isl_multi_pw_aff *mpa2);
6362 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
6363 __isl_take isl_multi_pw_aff *mpa1,
6364 unsigned in_pos, unsigned out_pos,
6365 __isl_take isl_multi_pw_aff *mpa2);
6366 __isl_give isl_multi_union_pw_aff *
6367 isl_multi_union_pw_aff_range_splice(
6368 __isl_take isl_multi_union_pw_aff *mupa1,
6370 __isl_take isl_multi_union_pw_aff *mupa2);
6372 =item * Simplification
6374 When applied to a set or relation,
6375 the gist operation returns a set or relation that has the
6376 same intersection with the context as the input set or relation.
6377 Any implicit equality in the intersection is made explicit in the result,
6378 while all inequalities that are redundant with respect to the intersection
6380 In case of union sets and relations, the gist operation is performed
6383 When applied to a function,
6384 the gist operation applies the set gist operation to each of
6385 the cells in the domain of the input piecewise expression.
6386 The context is also exploited
6387 to simplify the expression associated to each cell.
6389 #include <isl/set.h>
6390 __isl_give isl_basic_set *isl_basic_set_gist(
6391 __isl_take isl_basic_set *bset,
6392 __isl_take isl_basic_set *context);
6393 __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
6394 __isl_take isl_set *context);
6395 __isl_give isl_set *isl_set_gist_params(
6396 __isl_take isl_set *set,
6397 __isl_take isl_set *context);
6399 #include <isl/map.h>
6400 __isl_give isl_basic_map *isl_basic_map_gist(
6401 __isl_take isl_basic_map *bmap,
6402 __isl_take isl_basic_map *context);
6403 __isl_give isl_basic_map *isl_basic_map_gist_domain(
6404 __isl_take isl_basic_map *bmap,
6405 __isl_take isl_basic_set *context);
6406 __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
6407 __isl_take isl_map *context);
6408 __isl_give isl_map *isl_map_gist_params(
6409 __isl_take isl_map *map,
6410 __isl_take isl_set *context);
6411 __isl_give isl_map *isl_map_gist_domain(
6412 __isl_take isl_map *map,
6413 __isl_take isl_set *context);
6414 __isl_give isl_map *isl_map_gist_range(
6415 __isl_take isl_map *map,
6416 __isl_take isl_set *context);
6418 #include <isl/union_set.h>
6419 __isl_give isl_union_set *isl_union_set_gist(
6420 __isl_take isl_union_set *uset,
6421 __isl_take isl_union_set *context);
6422 __isl_give isl_union_set *isl_union_set_gist_params(
6423 __isl_take isl_union_set *uset,
6424 __isl_take isl_set *set);
6426 #include <isl/union_map.h>
6427 __isl_give isl_union_map *isl_union_map_gist(
6428 __isl_take isl_union_map *umap,
6429 __isl_take isl_union_map *context);
6430 __isl_give isl_union_map *isl_union_map_gist_params(
6431 __isl_take isl_union_map *umap,
6432 __isl_take isl_set *set);
6433 __isl_give isl_union_map *isl_union_map_gist_domain(
6434 __isl_take isl_union_map *umap,
6435 __isl_take isl_union_set *uset);
6436 __isl_give isl_union_map *isl_union_map_gist_range(
6437 __isl_take isl_union_map *umap,
6438 __isl_take isl_union_set *uset);
6440 #include <isl/aff.h>
6441 __isl_give isl_aff *isl_aff_gist_params(
6442 __isl_take isl_aff *aff,
6443 __isl_take isl_set *context);
6444 __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
6445 __isl_take isl_set *context);
6446 __isl_give isl_multi_aff *isl_multi_aff_gist_params(
6447 __isl_take isl_multi_aff *maff,
6448 __isl_take isl_set *context);
6449 __isl_give isl_multi_aff *isl_multi_aff_gist(
6450 __isl_take isl_multi_aff *maff,
6451 __isl_take isl_set *context);
6452 __isl_give isl_pw_aff *isl_pw_aff_gist_params(
6453 __isl_take isl_pw_aff *pwaff,
6454 __isl_take isl_set *context);
6455 __isl_give isl_pw_aff *isl_pw_aff_gist(
6456 __isl_take isl_pw_aff *pwaff,
6457 __isl_take isl_set *context);
6458 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
6459 __isl_take isl_pw_multi_aff *pma,
6460 __isl_take isl_set *set);
6461 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
6462 __isl_take isl_pw_multi_aff *pma,
6463 __isl_take isl_set *set);
6464 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
6465 __isl_take isl_multi_pw_aff *mpa,
6466 __isl_take isl_set *set);
6467 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
6468 __isl_take isl_multi_pw_aff *mpa,
6469 __isl_take isl_set *set);
6470 __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
6471 __isl_take isl_union_pw_aff *upa,
6472 __isl_take isl_union_set *context);
6473 __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
6474 __isl_take isl_union_pw_aff *upa,
6475 __isl_take isl_set *context);
6476 __isl_give isl_union_pw_multi_aff *
6477 isl_union_pw_multi_aff_gist_params(
6478 __isl_take isl_union_pw_multi_aff *upma,
6479 __isl_take isl_set *context);
6480 __isl_give isl_union_pw_multi_aff *
6481 isl_union_pw_multi_aff_gist(
6482 __isl_take isl_union_pw_multi_aff *upma,
6483 __isl_take isl_union_set *context);
6484 __isl_give isl_multi_union_pw_aff *
6485 isl_multi_union_pw_aff_gist_params(
6486 __isl_take isl_multi_union_pw_aff *aff,
6487 __isl_take isl_set *context);
6488 __isl_give isl_multi_union_pw_aff *
6489 isl_multi_union_pw_aff_gist(
6490 __isl_take isl_multi_union_pw_aff *aff,
6491 __isl_take isl_union_set *context);
6493 #include <isl/polynomial.h>
6494 __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
6495 __isl_take isl_qpolynomial *qp,
6496 __isl_take isl_set *context);
6497 __isl_give isl_qpolynomial *isl_qpolynomial_gist(
6498 __isl_take isl_qpolynomial *qp,
6499 __isl_take isl_set *context);
6500 __isl_give isl_qpolynomial_fold *
6501 isl_qpolynomial_fold_gist_params(
6502 __isl_take isl_qpolynomial_fold *fold,
6503 __isl_take isl_set *context);
6504 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
6505 __isl_take isl_qpolynomial_fold *fold,
6506 __isl_take isl_set *context);
6507 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
6508 __isl_take isl_pw_qpolynomial *pwqp,
6509 __isl_take isl_set *context);
6510 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
6511 __isl_take isl_pw_qpolynomial *pwqp,
6512 __isl_take isl_set *context);
6513 __isl_give isl_pw_qpolynomial_fold *
6514 isl_pw_qpolynomial_fold_gist(
6515 __isl_take isl_pw_qpolynomial_fold *pwf,
6516 __isl_take isl_set *context);
6517 __isl_give isl_pw_qpolynomial_fold *
6518 isl_pw_qpolynomial_fold_gist_params(
6519 __isl_take isl_pw_qpolynomial_fold *pwf,
6520 __isl_take isl_set *context);
6521 __isl_give isl_union_pw_qpolynomial *
6522 isl_union_pw_qpolynomial_gist_params(
6523 __isl_take isl_union_pw_qpolynomial *upwqp,
6524 __isl_take isl_set *context);
6525 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
6526 __isl_take isl_union_pw_qpolynomial *upwqp,
6527 __isl_take isl_union_set *context);
6528 __isl_give isl_union_pw_qpolynomial_fold *
6529 isl_union_pw_qpolynomial_fold_gist(
6530 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6531 __isl_take isl_union_set *context);
6532 __isl_give isl_union_pw_qpolynomial_fold *
6533 isl_union_pw_qpolynomial_fold_gist_params(
6534 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6535 __isl_take isl_set *context);
6537 =item * Binary Arithmethic Operations
6539 #include <isl/val.h>
6540 __isl_give isl_multi_val *isl_multi_val_add(
6541 __isl_take isl_multi_val *mv1,
6542 __isl_take isl_multi_val *mv2);
6543 __isl_give isl_multi_val *isl_multi_val_sub(
6544 __isl_take isl_multi_val *mv1,
6545 __isl_take isl_multi_val *mv2);
6547 #include <isl/aff.h>
6548 __isl_give isl_aff *isl_aff_add(
6549 __isl_take isl_aff *aff1,
6550 __isl_take isl_aff *aff2);
6551 __isl_give isl_multi_aff *isl_multi_aff_add(
6552 __isl_take isl_multi_aff *maff1,
6553 __isl_take isl_multi_aff *maff2);
6554 __isl_give isl_pw_aff *isl_pw_aff_add(
6555 __isl_take isl_pw_aff *pwaff1,
6556 __isl_take isl_pw_aff *pwaff2);
6557 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add(
6558 __isl_take isl_multi_pw_aff *mpa1,
6559 __isl_take isl_multi_pw_aff *mpa2);
6560 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
6561 __isl_take isl_pw_multi_aff *pma1,
6562 __isl_take isl_pw_multi_aff *pma2);
6563 __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
6564 __isl_take isl_union_pw_aff *upa1,
6565 __isl_take isl_union_pw_aff *upa2);
6566 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
6567 __isl_take isl_union_pw_multi_aff *upma1,
6568 __isl_take isl_union_pw_multi_aff *upma2);
6569 __isl_give isl_multi_union_pw_aff *
6570 isl_multi_union_pw_aff_add(
6571 __isl_take isl_multi_union_pw_aff *mupa1,
6572 __isl_take isl_multi_union_pw_aff *mupa2);
6573 __isl_give isl_pw_aff *isl_pw_aff_min(
6574 __isl_take isl_pw_aff *pwaff1,
6575 __isl_take isl_pw_aff *pwaff2);
6576 __isl_give isl_pw_aff *isl_pw_aff_max(
6577 __isl_take isl_pw_aff *pwaff1,
6578 __isl_take isl_pw_aff *pwaff2);
6579 __isl_give isl_aff *isl_aff_sub(
6580 __isl_take isl_aff *aff1,
6581 __isl_take isl_aff *aff2);
6582 __isl_give isl_multi_aff *isl_multi_aff_sub(
6583 __isl_take isl_multi_aff *ma1,
6584 __isl_take isl_multi_aff *ma2);
6585 __isl_give isl_pw_aff *isl_pw_aff_sub(
6586 __isl_take isl_pw_aff *pwaff1,
6587 __isl_take isl_pw_aff *pwaff2);
6588 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
6589 __isl_take isl_multi_pw_aff *mpa1,
6590 __isl_take isl_multi_pw_aff *mpa2);
6591 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
6592 __isl_take isl_pw_multi_aff *pma1,
6593 __isl_take isl_pw_multi_aff *pma2);
6594 __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
6595 __isl_take isl_union_pw_aff *upa1,
6596 __isl_take isl_union_pw_aff *upa2);
6597 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
6598 __isl_take isl_union_pw_multi_aff *upma1,
6599 __isl_take isl_union_pw_multi_aff *upma2);
6600 __isl_give isl_multi_union_pw_aff *
6601 isl_multi_union_pw_aff_sub(
6602 __isl_take isl_multi_union_pw_aff *mupa1,
6603 __isl_take isl_multi_union_pw_aff *mupa2);
6605 C<isl_aff_sub> subtracts the second argument from the first.
6607 #include <isl/polynomial.h>
6608 __isl_give isl_qpolynomial *isl_qpolynomial_add(
6609 __isl_take isl_qpolynomial *qp1,
6610 __isl_take isl_qpolynomial *qp2);
6611 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
6612 __isl_take isl_pw_qpolynomial *pwqp1,
6613 __isl_take isl_pw_qpolynomial *pwqp2);
6614 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
6615 __isl_take isl_pw_qpolynomial *pwqp1,
6616 __isl_take isl_pw_qpolynomial *pwqp2);
6617 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
6618 __isl_take isl_pw_qpolynomial_fold *pwf1,
6619 __isl_take isl_pw_qpolynomial_fold *pwf2);
6620 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
6621 __isl_take isl_union_pw_qpolynomial *upwqp1,
6622 __isl_take isl_union_pw_qpolynomial *upwqp2);
6623 __isl_give isl_qpolynomial *isl_qpolynomial_sub(
6624 __isl_take isl_qpolynomial *qp1,
6625 __isl_take isl_qpolynomial *qp2);
6626 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
6627 __isl_take isl_pw_qpolynomial *pwqp1,
6628 __isl_take isl_pw_qpolynomial *pwqp2);
6629 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
6630 __isl_take isl_union_pw_qpolynomial *upwqp1,
6631 __isl_take isl_union_pw_qpolynomial *upwqp2);
6632 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
6633 __isl_take isl_pw_qpolynomial_fold *pwf1,
6634 __isl_take isl_pw_qpolynomial_fold *pwf2);
6635 __isl_give isl_union_pw_qpolynomial_fold *
6636 isl_union_pw_qpolynomial_fold_fold(
6637 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
6638 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
6640 #include <isl/aff.h>
6641 __isl_give isl_pw_aff *isl_pw_aff_union_add(
6642 __isl_take isl_pw_aff *pwaff1,
6643 __isl_take isl_pw_aff *pwaff2);
6644 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
6645 __isl_take isl_pw_multi_aff *pma1,
6646 __isl_take isl_pw_multi_aff *pma2);
6647 __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
6648 __isl_take isl_union_pw_aff *upa1,
6649 __isl_take isl_union_pw_aff *upa2);
6650 __isl_give isl_union_pw_multi_aff *
6651 isl_union_pw_multi_aff_union_add(
6652 __isl_take isl_union_pw_multi_aff *upma1,
6653 __isl_take isl_union_pw_multi_aff *upma2);
6654 __isl_give isl_multi_union_pw_aff *
6655 isl_multi_union_pw_aff_union_add(
6656 __isl_take isl_multi_union_pw_aff *mupa1,
6657 __isl_take isl_multi_union_pw_aff *mupa2);
6658 __isl_give isl_pw_aff *isl_pw_aff_union_min(
6659 __isl_take isl_pw_aff *pwaff1,
6660 __isl_take isl_pw_aff *pwaff2);
6661 __isl_give isl_pw_aff *isl_pw_aff_union_max(
6662 __isl_take isl_pw_aff *pwaff1,
6663 __isl_take isl_pw_aff *pwaff2);
6665 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
6666 expression with a domain that is the union of those of C<pwaff1> and
6667 C<pwaff2> and such that on each cell, the quasi-affine expression is
6668 the maximum of those of C<pwaff1> and C<pwaff2>. If only one of
6669 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
6670 associated expression is the defined one.
6671 This in contrast to the C<isl_pw_aff_max> function, which is
6672 only defined on the shared definition domain of the arguments.
6674 #include <isl/val.h>
6675 __isl_give isl_multi_val *isl_multi_val_add_val(
6676 __isl_take isl_multi_val *mv,
6677 __isl_take isl_val *v);
6678 __isl_give isl_multi_val *isl_multi_val_mod_val(
6679 __isl_take isl_multi_val *mv,
6680 __isl_take isl_val *v);
6681 __isl_give isl_multi_val *isl_multi_val_scale_val(
6682 __isl_take isl_multi_val *mv,
6683 __isl_take isl_val *v);
6684 __isl_give isl_multi_val *isl_multi_val_scale_down_val(
6685 __isl_take isl_multi_val *mv,
6686 __isl_take isl_val *v);
6688 #include <isl/aff.h>
6689 __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
6690 __isl_take isl_val *mod);
6691 __isl_give isl_pw_aff *isl_pw_aff_mod_val(
6692 __isl_take isl_pw_aff *pa,
6693 __isl_take isl_val *mod);
6694 __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
6695 __isl_take isl_union_pw_aff *upa,
6696 __isl_take isl_val *f);
6697 __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
6698 __isl_take isl_val *v);
6699 __isl_give isl_multi_aff *isl_multi_aff_scale_val(
6700 __isl_take isl_multi_aff *ma,
6701 __isl_take isl_val *v);
6702 __isl_give isl_pw_aff *isl_pw_aff_scale_val(
6703 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
6704 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
6705 __isl_take isl_multi_pw_aff *mpa,
6706 __isl_take isl_val *v);
6707 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
6708 __isl_take isl_pw_multi_aff *pma,
6709 __isl_take isl_val *v);
6710 __isl_give isl_union_pw_multi_aff *
6711 __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
6712 __isl_take isl_union_pw_aff *upa,
6713 __isl_take isl_val *f);
6714 isl_union_pw_multi_aff_scale_val(
6715 __isl_take isl_union_pw_multi_aff *upma,
6716 __isl_take isl_val *val);
6717 __isl_give isl_multi_union_pw_aff *
6718 isl_multi_union_pw_aff_scale_val(
6719 __isl_take isl_multi_union_pw_aff *mupa,
6720 __isl_take isl_val *v);
6721 __isl_give isl_aff *isl_aff_scale_down_ui(
6722 __isl_take isl_aff *aff, unsigned f);
6723 __isl_give isl_aff *isl_aff_scale_down_val(
6724 __isl_take isl_aff *aff, __isl_take isl_val *v);
6725 __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
6726 __isl_take isl_multi_aff *ma,
6727 __isl_take isl_val *v);
6728 __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
6729 __isl_take isl_pw_aff *pa,
6730 __isl_take isl_val *f);
6731 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
6732 __isl_take isl_multi_pw_aff *mpa,
6733 __isl_take isl_val *v);
6734 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
6735 __isl_take isl_pw_multi_aff *pma,
6736 __isl_take isl_val *v);
6737 __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
6738 __isl_take isl_union_pw_aff *upa,
6739 __isl_take isl_val *v);
6740 __isl_give isl_union_pw_multi_aff *
6741 isl_union_pw_multi_aff_scale_down_val(
6742 __isl_take isl_union_pw_multi_aff *upma,
6743 __isl_take isl_val *val);
6744 __isl_give isl_multi_union_pw_aff *
6745 isl_multi_union_pw_aff_scale_down_val(
6746 __isl_take isl_multi_union_pw_aff *mupa,
6747 __isl_take isl_val *v);
6749 #include <isl/polynomial.h>
6750 __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
6751 __isl_take isl_qpolynomial *qp,
6752 __isl_take isl_val *v);
6753 __isl_give isl_qpolynomial_fold *
6754 isl_qpolynomial_fold_scale_val(
6755 __isl_take isl_qpolynomial_fold *fold,
6756 __isl_take isl_val *v);
6757 __isl_give isl_pw_qpolynomial *
6758 isl_pw_qpolynomial_scale_val(
6759 __isl_take isl_pw_qpolynomial *pwqp,
6760 __isl_take isl_val *v);
6761 __isl_give isl_pw_qpolynomial_fold *
6762 isl_pw_qpolynomial_fold_scale_val(
6763 __isl_take isl_pw_qpolynomial_fold *pwf,
6764 __isl_take isl_val *v);
6765 __isl_give isl_union_pw_qpolynomial *
6766 isl_union_pw_qpolynomial_scale_val(
6767 __isl_take isl_union_pw_qpolynomial *upwqp,
6768 __isl_take isl_val *v);
6769 __isl_give isl_union_pw_qpolynomial_fold *
6770 isl_union_pw_qpolynomial_fold_scale_val(
6771 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6772 __isl_take isl_val *v);
6773 __isl_give isl_qpolynomial *
6774 isl_qpolynomial_scale_down_val(
6775 __isl_take isl_qpolynomial *qp,
6776 __isl_take isl_val *v);
6777 __isl_give isl_qpolynomial_fold *
6778 isl_qpolynomial_fold_scale_down_val(
6779 __isl_take isl_qpolynomial_fold *fold,
6780 __isl_take isl_val *v);
6781 __isl_give isl_pw_qpolynomial *
6782 isl_pw_qpolynomial_scale_down_val(
6783 __isl_take isl_pw_qpolynomial *pwqp,
6784 __isl_take isl_val *v);
6785 __isl_give isl_pw_qpolynomial_fold *
6786 isl_pw_qpolynomial_fold_scale_down_val(
6787 __isl_take isl_pw_qpolynomial_fold *pwf,
6788 __isl_take isl_val *v);
6789 __isl_give isl_union_pw_qpolynomial *
6790 isl_union_pw_qpolynomial_scale_down_val(
6791 __isl_take isl_union_pw_qpolynomial *upwqp,
6792 __isl_take isl_val *v);
6793 __isl_give isl_union_pw_qpolynomial_fold *
6794 isl_union_pw_qpolynomial_fold_scale_down_val(
6795 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6796 __isl_take isl_val *v);
6798 #include <isl/val.h>
6799 __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
6800 __isl_take isl_multi_val *mv1,
6801 __isl_take isl_multi_val *mv2);
6802 __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
6803 __isl_take isl_multi_val *mv1,
6804 __isl_take isl_multi_val *mv2);
6805 __isl_give isl_multi_val *
6806 isl_multi_val_scale_down_multi_val(
6807 __isl_take isl_multi_val *mv1,
6808 __isl_take isl_multi_val *mv2);
6810 #include <isl/aff.h>
6811 __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
6812 __isl_take isl_multi_aff *ma,
6813 __isl_take isl_multi_val *mv);
6814 __isl_give isl_multi_union_pw_aff *
6815 isl_multi_union_pw_aff_mod_multi_val(
6816 __isl_take isl_multi_union_pw_aff *upma,
6817 __isl_take isl_multi_val *mv);
6818 __isl_give isl_multi_pw_aff *
6819 isl_multi_pw_aff_mod_multi_val(
6820 __isl_take isl_multi_pw_aff *mpa,
6821 __isl_take isl_multi_val *mv);
6822 __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
6823 __isl_take isl_multi_aff *ma,
6824 __isl_take isl_multi_val *mv);
6825 __isl_give isl_pw_multi_aff *
6826 isl_pw_multi_aff_scale_multi_val(
6827 __isl_take isl_pw_multi_aff *pma,
6828 __isl_take isl_multi_val *mv);
6829 __isl_give isl_multi_pw_aff *
6830 isl_multi_pw_aff_scale_multi_val(
6831 __isl_take isl_multi_pw_aff *mpa,
6832 __isl_take isl_multi_val *mv);
6833 __isl_give isl_multi_union_pw_aff *
6834 isl_multi_union_pw_aff_scale_multi_val(
6835 __isl_take isl_multi_union_pw_aff *mupa,
6836 __isl_take isl_multi_val *mv);
6837 __isl_give isl_union_pw_multi_aff *
6838 isl_union_pw_multi_aff_scale_multi_val(
6839 __isl_take isl_union_pw_multi_aff *upma,
6840 __isl_take isl_multi_val *mv);
6841 __isl_give isl_multi_aff *
6842 isl_multi_aff_scale_down_multi_val(
6843 __isl_take isl_multi_aff *ma,
6844 __isl_take isl_multi_val *mv);
6845 __isl_give isl_multi_pw_aff *
6846 isl_multi_pw_aff_scale_down_multi_val(
6847 __isl_take isl_multi_pw_aff *mpa,
6848 __isl_take isl_multi_val *mv);
6849 __isl_give isl_multi_union_pw_aff *
6850 isl_multi_union_pw_aff_scale_down_multi_val(
6851 __isl_take isl_multi_union_pw_aff *mupa,
6852 __isl_take isl_multi_val *mv);
6854 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
6855 by the corresponding elements of C<mv>.
6857 #include <isl/aff.h>
6858 __isl_give isl_aff *isl_aff_mul(
6859 __isl_take isl_aff *aff1,
6860 __isl_take isl_aff *aff2);
6861 __isl_give isl_aff *isl_aff_div(
6862 __isl_take isl_aff *aff1,
6863 __isl_take isl_aff *aff2);
6864 __isl_give isl_pw_aff *isl_pw_aff_mul(
6865 __isl_take isl_pw_aff *pwaff1,
6866 __isl_take isl_pw_aff *pwaff2);
6867 __isl_give isl_pw_aff *isl_pw_aff_div(
6868 __isl_take isl_pw_aff *pa1,
6869 __isl_take isl_pw_aff *pa2);
6870 __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
6871 __isl_take isl_pw_aff *pa1,
6872 __isl_take isl_pw_aff *pa2);
6873 __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
6874 __isl_take isl_pw_aff *pa1,
6875 __isl_take isl_pw_aff *pa2);
6877 When multiplying two affine expressions, at least one of the two needs
6878 to be a constant. Similarly, when dividing an affine expression by another,
6879 the second expression needs to be a constant.
6880 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
6881 rounding towards zero. C<isl_pw_aff_tdiv_r> computes the corresponding
6884 #include <isl/polynomial.h>
6885 __isl_give isl_qpolynomial *isl_qpolynomial_mul(
6886 __isl_take isl_qpolynomial *qp1,
6887 __isl_take isl_qpolynomial *qp2);
6888 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
6889 __isl_take isl_pw_qpolynomial *pwqp1,
6890 __isl_take isl_pw_qpolynomial *pwqp2);
6891 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
6892 __isl_take isl_union_pw_qpolynomial *upwqp1,
6893 __isl_take isl_union_pw_qpolynomial *upwqp2);
6897 =head3 Lexicographic Optimization
6899 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
6900 the following functions
6901 compute a set that contains the lexicographic minimum or maximum
6902 of the elements in C<set> (or C<bset>) for those values of the parameters
6903 that satisfy C<dom>.
6904 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6905 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
6907 In other words, the union of the parameter values
6908 for which the result is non-empty and of C<*empty>
6911 #include <isl/set.h>
6912 __isl_give isl_set *isl_basic_set_partial_lexmin(
6913 __isl_take isl_basic_set *bset,
6914 __isl_take isl_basic_set *dom,
6915 __isl_give isl_set **empty);
6916 __isl_give isl_set *isl_basic_set_partial_lexmax(
6917 __isl_take isl_basic_set *bset,
6918 __isl_take isl_basic_set *dom,
6919 __isl_give isl_set **empty);
6920 __isl_give isl_set *isl_set_partial_lexmin(
6921 __isl_take isl_set *set, __isl_take isl_set *dom,
6922 __isl_give isl_set **empty);
6923 __isl_give isl_set *isl_set_partial_lexmax(
6924 __isl_take isl_set *set, __isl_take isl_set *dom,
6925 __isl_give isl_set **empty);
6927 Given a (basic) set C<set> (or C<bset>), the following functions simply
6928 return a set containing the lexicographic minimum or maximum
6929 of the elements in C<set> (or C<bset>).
6930 In case of union sets, the optimum is computed per space.
6932 #include <isl/set.h>
6933 __isl_give isl_set *isl_basic_set_lexmin(
6934 __isl_take isl_basic_set *bset);
6935 __isl_give isl_set *isl_basic_set_lexmax(
6936 __isl_take isl_basic_set *bset);
6937 __isl_give isl_set *isl_set_lexmin(
6938 __isl_take isl_set *set);
6939 __isl_give isl_set *isl_set_lexmax(
6940 __isl_take isl_set *set);
6941 __isl_give isl_union_set *isl_union_set_lexmin(
6942 __isl_take isl_union_set *uset);
6943 __isl_give isl_union_set *isl_union_set_lexmax(
6944 __isl_take isl_union_set *uset);
6946 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
6947 the following functions
6948 compute a relation that maps each element of C<dom>
6949 to the single lexicographic minimum or maximum
6950 of the elements that are associated to that same
6951 element in C<map> (or C<bmap>).
6952 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6953 that contains the elements in C<dom> that do not map
6954 to any elements in C<map> (or C<bmap>).
6955 In other words, the union of the domain of the result and of C<*empty>
6958 #include <isl/map.h>
6959 __isl_give isl_map *isl_basic_map_partial_lexmax(
6960 __isl_take isl_basic_map *bmap,
6961 __isl_take isl_basic_set *dom,
6962 __isl_give isl_set **empty);
6963 __isl_give isl_map *isl_basic_map_partial_lexmin(
6964 __isl_take isl_basic_map *bmap,
6965 __isl_take isl_basic_set *dom,
6966 __isl_give isl_set **empty);
6967 __isl_give isl_map *isl_map_partial_lexmax(
6968 __isl_take isl_map *map, __isl_take isl_set *dom,
6969 __isl_give isl_set **empty);
6970 __isl_give isl_map *isl_map_partial_lexmin(
6971 __isl_take isl_map *map, __isl_take isl_set *dom,
6972 __isl_give isl_set **empty);
6974 Given a (basic) map C<map> (or C<bmap>), the following functions simply
6975 return a map mapping each element in the domain of
6976 C<map> (or C<bmap>) to the lexicographic minimum or maximum
6977 of all elements associated to that element.
6978 In case of union relations, the optimum is computed per space.
6980 #include <isl/map.h>
6981 __isl_give isl_map *isl_basic_map_lexmin(
6982 __isl_take isl_basic_map *bmap);
6983 __isl_give isl_map *isl_basic_map_lexmax(
6984 __isl_take isl_basic_map *bmap);
6985 __isl_give isl_map *isl_map_lexmin(
6986 __isl_take isl_map *map);
6987 __isl_give isl_map *isl_map_lexmax(
6988 __isl_take isl_map *map);
6989 __isl_give isl_union_map *isl_union_map_lexmin(
6990 __isl_take isl_union_map *umap);
6991 __isl_give isl_union_map *isl_union_map_lexmax(
6992 __isl_take isl_union_map *umap);
6994 The following functions return their result in the form of
6995 a piecewise multi-affine expression,
6996 but are otherwise equivalent to the corresponding functions
6997 returning a basic set or relation.
6999 #include <isl/set.h>
7000 __isl_give isl_pw_multi_aff *
7001 isl_basic_set_partial_lexmin_pw_multi_aff(
7002 __isl_take isl_basic_set *bset,
7003 __isl_take isl_basic_set *dom,
7004 __isl_give isl_set **empty);
7005 __isl_give isl_pw_multi_aff *
7006 isl_basic_set_partial_lexmax_pw_multi_aff(
7007 __isl_take isl_basic_set *bset,
7008 __isl_take isl_basic_set *dom,
7009 __isl_give isl_set **empty);
7010 __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
7011 __isl_take isl_set *set);
7012 __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
7013 __isl_take isl_set *set);
7015 #include <isl/map.h>
7016 __isl_give isl_pw_multi_aff *
7017 isl_basic_map_lexmin_pw_multi_aff(
7018 __isl_take isl_basic_map *bmap);
7019 __isl_give isl_pw_multi_aff *
7020 isl_basic_map_partial_lexmin_pw_multi_aff(
7021 __isl_take isl_basic_map *bmap,
7022 __isl_take isl_basic_set *dom,
7023 __isl_give isl_set **empty);
7024 __isl_give isl_pw_multi_aff *
7025 isl_basic_map_partial_lexmax_pw_multi_aff(
7026 __isl_take isl_basic_map *bmap,
7027 __isl_take isl_basic_set *dom,
7028 __isl_give isl_set **empty);
7029 __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
7030 __isl_take isl_map *map);
7031 __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
7032 __isl_take isl_map *map);
7034 The following functions return the lexicographic minimum or maximum
7035 on the shared domain of the inputs and the single defined function
7036 on those parts of the domain where only a single function is defined.
7038 #include <isl/aff.h>
7039 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
7040 __isl_take isl_pw_multi_aff *pma1,
7041 __isl_take isl_pw_multi_aff *pma2);
7042 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
7043 __isl_take isl_pw_multi_aff *pma1,
7044 __isl_take isl_pw_multi_aff *pma2);
7046 =head2 Ternary Operations
7048 #include <isl/aff.h>
7049 __isl_give isl_pw_aff *isl_pw_aff_cond(
7050 __isl_take isl_pw_aff *cond,
7051 __isl_take isl_pw_aff *pwaff_true,
7052 __isl_take isl_pw_aff *pwaff_false);
7054 The function C<isl_pw_aff_cond> performs a conditional operator
7055 and returns an expression that is equal to C<pwaff_true>
7056 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
7057 where C<cond> is zero.
7061 Lists are defined over several element types, including
7062 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_union_pw_aff>,
7063 C<isl_union_pw_multi_aff>, C<isl_constraint>,
7064 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
7065 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
7066 Here we take lists of C<isl_set>s as an example.
7067 Lists can be created, copied, modified and freed using the following functions.
7069 #include <isl/set.h>
7070 __isl_give isl_set_list *isl_set_list_from_set(
7071 __isl_take isl_set *el);
7072 __isl_give isl_set_list *isl_set_list_alloc(
7073 isl_ctx *ctx, int n);
7074 __isl_give isl_set_list *isl_set_list_copy(
7075 __isl_keep isl_set_list *list);
7076 __isl_give isl_set_list *isl_set_list_insert(
7077 __isl_take isl_set_list *list, unsigned pos,
7078 __isl_take isl_set *el);
7079 __isl_give isl_set_list *isl_set_list_add(
7080 __isl_take isl_set_list *list,
7081 __isl_take isl_set *el);
7082 __isl_give isl_set_list *isl_set_list_drop(
7083 __isl_take isl_set_list *list,
7084 unsigned first, unsigned n);
7085 __isl_give isl_set_list *isl_set_list_set_set(
7086 __isl_take isl_set_list *list, int index,
7087 __isl_take isl_set *set);
7088 __isl_give isl_set_list *isl_set_list_concat(
7089 __isl_take isl_set_list *list1,
7090 __isl_take isl_set_list *list2);
7091 __isl_give isl_set_list *isl_set_list_sort(
7092 __isl_take isl_set_list *list,
7093 int (*cmp)(__isl_keep isl_set *a,
7094 __isl_keep isl_set *b, void *user),
7096 __isl_null isl_set_list *isl_set_list_free(
7097 __isl_take isl_set_list *list);
7099 C<isl_set_list_alloc> creates an empty list with an initial capacity
7100 for C<n> elements. C<isl_set_list_insert> and C<isl_set_list_add>
7101 add elements to a list, increasing its capacity as needed.
7102 C<isl_set_list_from_set> creates a list with a single element.
7104 Lists can be inspected using the following functions.
7106 #include <isl/set.h>
7107 int isl_set_list_n_set(__isl_keep isl_set_list *list);
7108 __isl_give isl_set *isl_set_list_get_set(
7109 __isl_keep isl_set_list *list, int index);
7110 isl_stat isl_set_list_foreach(__isl_keep isl_set_list *list,
7111 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7113 isl_stat isl_set_list_foreach_scc(
7114 __isl_keep isl_set_list *list,
7115 isl_bool (*follows)(__isl_keep isl_set *a,
7116 __isl_keep isl_set *b, void *user),
7118 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7121 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
7122 strongly connected components of the graph with as vertices the elements
7123 of C<list> and a directed edge from vertex C<b> to vertex C<a>
7124 iff C<follows(a, b)> returns C<1>. The callbacks C<follows> and C<fn>
7125 should return C<-1> on error.
7127 Lists can be printed using
7129 #include <isl/set.h>
7130 __isl_give isl_printer *isl_printer_print_set_list(
7131 __isl_take isl_printer *p,
7132 __isl_keep isl_set_list *list);
7134 =head2 Associative arrays
7136 Associative arrays map isl objects of a specific type to isl objects
7137 of some (other) specific type. They are defined for several pairs
7138 of types, including (C<isl_map>, C<isl_basic_set>),
7139 (C<isl_id>, C<isl_ast_expr>) and.
7140 (C<isl_id>, C<isl_pw_aff>).
7141 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
7144 Associative arrays can be created, copied and freed using
7145 the following functions.
7147 #include <isl/id_to_ast_expr.h>
7148 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
7149 isl_ctx *ctx, int min_size);
7150 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
7151 __isl_keep isl_id_to_ast_expr *id2expr);
7152 __isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
7153 __isl_take isl_id_to_ast_expr *id2expr);
7155 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
7156 to specify the expected size of the associative array.
7157 The associative array will be grown automatically as needed.
7159 Associative arrays can be inspected using the following functions.
7161 #include <isl/id_to_ast_expr.h>
7162 isl_bool isl_id_to_ast_expr_has(
7163 __isl_keep isl_id_to_ast_expr *id2expr,
7164 __isl_keep isl_id *key);
7165 __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
7166 __isl_keep isl_id_to_ast_expr *id2expr,
7167 __isl_take isl_id *key);
7168 isl_stat isl_id_to_ast_expr_foreach(
7169 __isl_keep isl_id_to_ast_expr *id2expr,
7170 isl_stat (*fn)(__isl_take isl_id *key,
7171 __isl_take isl_ast_expr *val, void *user),
7174 They can be modified using the following function.
7176 #include <isl/id_to_ast_expr.h>
7177 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
7178 __isl_take isl_id_to_ast_expr *id2expr,
7179 __isl_take isl_id *key,
7180 __isl_take isl_ast_expr *val);
7181 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
7182 __isl_take isl_id_to_ast_expr *id2expr,
7183 __isl_take isl_id *key);
7185 Associative arrays can be printed using the following function.
7187 #include <isl/id_to_ast_expr.h>
7188 __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
7189 __isl_take isl_printer *p,
7190 __isl_keep isl_id_to_ast_expr *id2expr);
7194 Vectors can be created, copied and freed using the following functions.
7196 #include <isl/vec.h>
7197 __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
7199 __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
7200 __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
7202 Note that the elements of a newly created vector may have arbitrary values.
7203 The elements can be changed and inspected using the following functions.
7205 int isl_vec_size(__isl_keep isl_vec *vec);
7206 __isl_give isl_val *isl_vec_get_element_val(
7207 __isl_keep isl_vec *vec, int pos);
7208 __isl_give isl_vec *isl_vec_set_element_si(
7209 __isl_take isl_vec *vec, int pos, int v);
7210 __isl_give isl_vec *isl_vec_set_element_val(
7211 __isl_take isl_vec *vec, int pos,
7212 __isl_take isl_val *v);
7213 __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
7215 __isl_give isl_vec *isl_vec_set_val(
7216 __isl_take isl_vec *vec, __isl_take isl_val *v);
7217 int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
7218 __isl_keep isl_vec *vec2, int pos);
7220 C<isl_vec_get_element> will return a negative value if anything went wrong.
7221 In that case, the value of C<*v> is undefined.
7223 The following function can be used to concatenate two vectors.
7225 __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
7226 __isl_take isl_vec *vec2);
7230 Matrices can be created, copied and freed using the following functions.
7232 #include <isl/mat.h>
7233 __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
7234 unsigned n_row, unsigned n_col);
7235 __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
7236 __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
7238 Note that the elements of a newly created matrix may have arbitrary values.
7239 The elements can be changed and inspected using the following functions.
7241 int isl_mat_rows(__isl_keep isl_mat *mat);
7242 int isl_mat_cols(__isl_keep isl_mat *mat);
7243 __isl_give isl_val *isl_mat_get_element_val(
7244 __isl_keep isl_mat *mat, int row, int col);
7245 __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
7246 int row, int col, int v);
7247 __isl_give isl_mat *isl_mat_set_element_val(
7248 __isl_take isl_mat *mat, int row, int col,
7249 __isl_take isl_val *v);
7251 C<isl_mat_get_element> will return a negative value if anything went wrong.
7252 In that case, the value of C<*v> is undefined.
7254 The following function can be used to compute the (right) inverse
7255 of a matrix, i.e., a matrix such that the product of the original
7256 and the inverse (in that order) is a multiple of the identity matrix.
7257 The input matrix is assumed to be of full row-rank.
7259 __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
7261 The following function can be used to compute the (right) kernel
7262 (or null space) of a matrix, i.e., a matrix such that the product of
7263 the original and the kernel (in that order) is the zero matrix.
7265 __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
7267 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
7269 The following functions determine
7270 an upper or lower bound on a quasipolynomial over its domain.
7272 __isl_give isl_pw_qpolynomial_fold *
7273 isl_pw_qpolynomial_bound(
7274 __isl_take isl_pw_qpolynomial *pwqp,
7275 enum isl_fold type, int *tight);
7277 __isl_give isl_union_pw_qpolynomial_fold *
7278 isl_union_pw_qpolynomial_bound(
7279 __isl_take isl_union_pw_qpolynomial *upwqp,
7280 enum isl_fold type, int *tight);
7282 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
7283 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
7284 is the returned bound is known be tight, i.e., for each value
7285 of the parameters there is at least
7286 one element in the domain that reaches the bound.
7287 If the domain of C<pwqp> is not wrapping, then the bound is computed
7288 over all elements in that domain and the result has a purely parametric
7289 domain. If the domain of C<pwqp> is wrapping, then the bound is
7290 computed over the range of the wrapped relation. The domain of the
7291 wrapped relation becomes the domain of the result.
7293 =head2 Parametric Vertex Enumeration
7295 The parametric vertex enumeration described in this section
7296 is mainly intended to be used internally and by the C<barvinok>
7299 #include <isl/vertices.h>
7300 __isl_give isl_vertices *isl_basic_set_compute_vertices(
7301 __isl_keep isl_basic_set *bset);
7303 The function C<isl_basic_set_compute_vertices> performs the
7304 actual computation of the parametric vertices and the chamber
7305 decomposition and store the result in an C<isl_vertices> object.
7306 This information can be queried by either iterating over all
7307 the vertices or iterating over all the chambers or cells
7308 and then iterating over all vertices that are active on the chamber.
7310 isl_stat isl_vertices_foreach_vertex(
7311 __isl_keep isl_vertices *vertices,
7312 isl_stat (*fn)(__isl_take isl_vertex *vertex,
7313 void *user), void *user);
7315 isl_stat isl_vertices_foreach_cell(
7316 __isl_keep isl_vertices *vertices,
7317 isl_stat (*fn)(__isl_take isl_cell *cell,
7318 void *user), void *user);
7319 isl_stat isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
7320 isl_stat (*fn)(__isl_take isl_vertex *vertex,
7321 void *user), void *user);
7323 Other operations that can be performed on an C<isl_vertices> object are
7326 int isl_vertices_get_n_vertices(
7327 __isl_keep isl_vertices *vertices);
7328 void isl_vertices_free(__isl_take isl_vertices *vertices);
7330 Vertices can be inspected and destroyed using the following functions.
7332 int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
7333 __isl_give isl_basic_set *isl_vertex_get_domain(
7334 __isl_keep isl_vertex *vertex);
7335 __isl_give isl_multi_aff *isl_vertex_get_expr(
7336 __isl_keep isl_vertex *vertex);
7337 void isl_vertex_free(__isl_take isl_vertex *vertex);
7339 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
7340 describing the vertex in terms of the parameters,
7341 while C<isl_vertex_get_domain> returns the activity domain
7344 Chambers can be inspected and destroyed using the following functions.
7346 __isl_give isl_basic_set *isl_cell_get_domain(
7347 __isl_keep isl_cell *cell);
7348 void isl_cell_free(__isl_take isl_cell *cell);
7350 =head1 Polyhedral Compilation Library
7352 This section collects functionality in C<isl> that has been specifically
7353 designed for use during polyhedral compilation.
7355 =head2 Schedule Trees
7357 A schedule tree is a structured representation of a schedule,
7358 assigning a relative order to a set of domain elements.
7359 The relative order expressed by the schedule tree is
7360 defined recursively. In particular, the order between
7361 two domain elements is determined by the node that is closest
7362 to the root that refers to both elements and that orders them apart.
7363 Each node in the tree is of one of several types.
7364 The root node is always of type C<isl_schedule_node_domain>
7365 (or C<isl_schedule_node_extension>)
7366 and it describes the (extra) domain elements to which the schedule applies.
7367 The other types of nodes are as follows.
7371 =item C<isl_schedule_node_band>
7373 A band of schedule dimensions. Each schedule dimension is represented
7374 by a union piecewise quasi-affine expression. If this expression
7375 assigns a different value to two domain elements, while all previous
7376 schedule dimensions in the same band assign them the same value,
7377 then the two domain elements are ordered according to these two
7380 =item C<isl_schedule_node_expansion>
7382 An expansion node maps each of the domain elements that reach the node
7383 to one or more domain elements. The image of this mapping forms
7384 the set of domain elements that reach the child of the expansion node.
7385 The function that maps each of the expanded domain elements
7386 to the original domain element from which it was expanded
7387 is called the contraction.
7389 =item C<isl_schedule_node_filter>
7391 A filter node does not impose any ordering, but rather intersects
7392 the set of domain elements that the current subtree refers to
7393 with a given union set. The subtree of the filter node only
7394 refers to domain elements in the intersection.
7395 A filter node is typically only used a child of a sequence or
7398 =item C<isl_schedule_node_leaf>
7400 A leaf of the schedule tree. Leaf nodes do not impose any ordering.
7402 =item C<isl_schedule_node_mark>
7404 A mark node can be used to attach any kind of information to a subtree
7405 of the schedule tree.
7407 =item C<isl_schedule_node_sequence>
7409 A sequence node has one or more children, each of which is a filter node.
7410 The filters on these filter nodes form a partition of
7411 the domain elements that the current subtree refers to.
7412 If two domain elements appear in distinct filters then the sequence
7413 node orders them according to the child positions of the corresponding
7416 =item C<isl_schedule_node_set>
7418 A set node is similar to a sequence node, except that
7419 it expresses that domain elements appearing in distinct filters
7420 may have any order. The order of the children of a set node
7421 is therefore also immaterial.
7425 The following node types are only supported by the AST generator.
7429 =item C<isl_schedule_node_context>
7431 The context describes constraints on the parameters and
7432 the schedule dimensions of outer
7433 bands that the AST generator may assume to hold. It is also the only
7434 kind of node that may introduce additional parameters.
7435 The space of the context is that of the flat product of the outer
7436 band nodes. In particular, if there are no outer band nodes, then
7437 this space is the unnamed zero-dimensional space.
7438 Since a context node references the outer band nodes, any tree
7439 containing a context node is considered to be anchored.
7441 =item C<isl_schedule_node_extension>
7443 An extension node instructs the AST generator to add additional
7444 domain elements that need to be scheduled.
7445 The additional domain elements are described by the range of
7446 the extension map in terms of the outer schedule dimensions,
7447 i.e., the flat product of the outer band nodes.
7448 Note that domain elements are added whenever the AST generator
7449 reaches the extension node, meaning that there are still some
7450 active domain elements for which an AST needs to be generated.
7451 The conditions under which some domain elements are still active
7452 may however not be completely described by the outer AST nodes
7453 generated at that point.
7455 An extension node may also appear as the root of a schedule tree,
7456 when it is intended to be inserted into another tree
7457 using C<isl_schedule_node_graft_before> or C<isl_schedule_node_graft_after>.
7458 In this case, the domain of the extension node should
7459 correspond to the flat product of the outer band nodes
7460 in this other schedule tree at the point where the extension tree
7463 =item C<isl_schedule_node_guard>
7465 The guard describes constraints on the parameters and
7466 the schedule dimensions of outer
7467 bands that need to be enforced by the outer nodes
7468 in the generated AST.
7469 The space of the guard is that of the flat product of the outer
7470 band nodes. In particular, if there are no outer band nodes, then
7471 this space is the unnamed zero-dimensional space.
7472 Since a guard node references the outer band nodes, any tree
7473 containing a guard node is considered to be anchored.
7477 Except for the C<isl_schedule_node_context> nodes,
7478 none of the nodes may introduce any parameters that were not
7479 already present in the root domain node.
7481 A schedule tree is encapsulated in an C<isl_schedule> object.
7482 The simplest such objects, those with a tree consisting of single domain node,
7483 can be created using the following functions with either an empty
7484 domain or a given domain.
7486 #include <isl/schedule.h>
7487 __isl_give isl_schedule *isl_schedule_empty(
7488 __isl_take isl_space *space);
7489 __isl_give isl_schedule *isl_schedule_from_domain(
7490 __isl_take isl_union_set *domain);
7492 The function C<isl_schedule_constraints_compute_schedule> described
7493 in L</"Scheduling"> can also be used to construct schedules.
7495 C<isl_schedule> objects may be copied and freed using the following functions.
7497 #include <isl/schedule.h>
7498 __isl_give isl_schedule *isl_schedule_copy(
7499 __isl_keep isl_schedule *sched);
7500 __isl_null isl_schedule *isl_schedule_free(
7501 __isl_take isl_schedule *sched);
7503 The following functions checks whether two C<isl_schedule> objects
7504 are obviously the same.
7506 #include <isl/schedule.h>
7507 isl_bool isl_schedule_plain_is_equal(
7508 __isl_keep isl_schedule *schedule1,
7509 __isl_keep isl_schedule *schedule2);
7511 The domain of the schedule, i.e., the domain described by the root node,
7512 can be obtained using the following function.
7514 #include <isl/schedule.h>
7515 __isl_give isl_union_set *isl_schedule_get_domain(
7516 __isl_keep isl_schedule *schedule);
7518 An extra top-level band node (right underneath the domain node) can
7519 be introduced into the schedule using the following function.
7520 The schedule tree is assumed not to have any anchored nodes.
7522 #include <isl/schedule.h>
7523 __isl_give isl_schedule *
7524 isl_schedule_insert_partial_schedule(
7525 __isl_take isl_schedule *schedule,
7526 __isl_take isl_multi_union_pw_aff *partial);
7528 A top-level context node (right underneath the domain node) can
7529 be introduced into the schedule using the following function.
7531 #include <isl/schedule.h>
7532 __isl_give isl_schedule *isl_schedule_insert_context(
7533 __isl_take isl_schedule *schedule,
7534 __isl_take isl_set *context)
7536 A top-level guard node (right underneath the domain node) can
7537 be introduced into the schedule using the following function.
7539 #include <isl/schedule.h>
7540 __isl_give isl_schedule *isl_schedule_insert_guard(
7541 __isl_take isl_schedule *schedule,
7542 __isl_take isl_set *guard)
7544 A schedule that combines two schedules either in the given
7545 order or in an arbitrary order, i.e., with an C<isl_schedule_node_sequence>
7546 or an C<isl_schedule_node_set> node,
7547 can be created using the following functions.
7549 #include <isl/schedule.h>
7550 __isl_give isl_schedule *isl_schedule_sequence(
7551 __isl_take isl_schedule *schedule1,
7552 __isl_take isl_schedule *schedule2);
7553 __isl_give isl_schedule *isl_schedule_set(
7554 __isl_take isl_schedule *schedule1,
7555 __isl_take isl_schedule *schedule2);
7557 The domains of the two input schedules need to be disjoint.
7559 The following function can be used to restrict the domain
7560 of a schedule with a domain node as root to be a subset of the given union set.
7561 This operation may remove nodes in the tree that have become
7564 #include <isl/schedule.h>
7565 __isl_give isl_schedule *isl_schedule_intersect_domain(
7566 __isl_take isl_schedule *schedule,
7567 __isl_take isl_union_set *domain);
7569 The following function resets the user pointers on all parameter
7570 and tuple identifiers referenced by the nodes of the given schedule.
7572 #include <isl/schedule.h>
7573 __isl_give isl_schedule *isl_schedule_reset_user(
7574 __isl_take isl_schedule *schedule);
7576 The following function aligns the parameters of all nodes
7577 in the given schedule to the given space.
7579 #include <isl/schedule.h>
7580 __isl_give isl_schedule *isl_schedule_align_params(
7581 __isl_take isl_schedule *schedule,
7582 __isl_take isl_space *space);
7584 The following function allows the user to plug in a given function
7585 in the iteration domains. The input schedule is not allowed to contain
7586 any expansion nodes.
7588 #include <isl/schedule.h>
7589 __isl_give isl_schedule *
7590 isl_schedule_pullback_union_pw_multi_aff(
7591 __isl_take isl_schedule *schedule,
7592 __isl_take isl_union_pw_multi_aff *upma);
7594 An C<isl_union_map> representation of the schedule can be obtained
7595 from an C<isl_schedule> using the following function.
7597 #include <isl/schedule.h>
7598 __isl_give isl_union_map *isl_schedule_get_map(
7599 __isl_keep isl_schedule *sched);
7601 The resulting relation encodes the same relative ordering as
7602 the schedule by mapping the domain elements to a common schedule space.
7603 If the schedule_separate_components option is set, then the order
7604 of the children of a set node is explicitly encoded in the result.
7605 If the tree contains any expansion nodes, then the relation
7606 is formulated in terms of the expanded domain elements.
7608 Schedules can be read from input using the following functions.
7610 #include <isl/schedule.h>
7611 __isl_give isl_schedule *isl_schedule_read_from_file(
7612 isl_ctx *ctx, FILE *input);
7613 __isl_give isl_schedule *isl_schedule_read_from_str(
7614 isl_ctx *ctx, const char *str);
7616 A representation of the schedule can be printed using
7618 #include <isl/schedule.h>
7619 __isl_give isl_printer *isl_printer_print_schedule(
7620 __isl_take isl_printer *p,
7621 __isl_keep isl_schedule *schedule);
7623 The schedule tree can be traversed through the use of
7624 C<isl_schedule_node> objects that point to a particular
7625 position in the schedule tree. Whenever a C<isl_schedule_node>
7626 is use to modify a node in the schedule tree, the original schedule
7627 tree is left untouched and the modifications are performed to a copy
7628 of the tree. The returned C<isl_schedule_node> then points to
7629 this modified copy of the tree.
7631 The root of the schedule tree can be obtained using the following function.
7633 #include <isl/schedule.h>
7634 __isl_give isl_schedule_node *isl_schedule_get_root(
7635 __isl_keep isl_schedule *schedule);
7637 A pointer to a newly created schedule tree with a single domain
7638 node can be created using the following functions.
7640 #include <isl/schedule_node.h>
7641 __isl_give isl_schedule_node *
7642 isl_schedule_node_from_domain(
7643 __isl_take isl_union_set *domain);
7644 __isl_give isl_schedule_node *
7645 isl_schedule_node_from_extension(
7646 __isl_take isl_union_map *extension);
7648 C<isl_schedule_node_from_extension> creates a tree with an extension
7651 Schedule nodes can be copied and freed using the following functions.
7653 #include <isl/schedule_node.h>
7654 __isl_give isl_schedule_node *isl_schedule_node_copy(
7655 __isl_keep isl_schedule_node *node);
7656 __isl_null isl_schedule_node *isl_schedule_node_free(
7657 __isl_take isl_schedule_node *node);
7659 The following functions can be used to check if two schedule
7660 nodes point to the same position in the same schedule.
7662 #include <isl/schedule_node.h>
7663 isl_bool isl_schedule_node_is_equal(
7664 __isl_keep isl_schedule_node *node1,
7665 __isl_keep isl_schedule_node *node2);
7667 The following properties can be obtained from a schedule node.
7669 #include <isl/schedule_node.h>
7670 enum isl_schedule_node_type isl_schedule_node_get_type(
7671 __isl_keep isl_schedule_node *node);
7672 enum isl_schedule_node_type
7673 isl_schedule_node_get_parent_type(
7674 __isl_keep isl_schedule_node *node);
7675 __isl_give isl_schedule *isl_schedule_node_get_schedule(
7676 __isl_keep isl_schedule_node *node);
7678 The function C<isl_schedule_node_get_type> returns the type of
7679 the node, while C<isl_schedule_node_get_parent_type> returns
7680 type of the parent of the node, which is required to exist.
7681 The function C<isl_schedule_node_get_schedule> returns a copy
7682 to the schedule to which the node belongs.
7684 The following functions can be used to move the schedule node
7685 to a different position in the tree or to check if such a position
7688 #include <isl/schedule_node.h>
7689 isl_bool isl_schedule_node_has_parent(
7690 __isl_keep isl_schedule_node *node);
7691 __isl_give isl_schedule_node *isl_schedule_node_parent(
7692 __isl_take isl_schedule_node *node);
7693 __isl_give isl_schedule_node *isl_schedule_node_root(
7694 __isl_take isl_schedule_node *node);
7695 __isl_give isl_schedule_node *isl_schedule_node_ancestor(
7696 __isl_take isl_schedule_node *node,
7698 int isl_schedule_node_n_children(
7699 __isl_keep isl_schedule_node *node);
7700 __isl_give isl_schedule_node *isl_schedule_node_child(
7701 __isl_take isl_schedule_node *node, int pos);
7702 isl_bool isl_schedule_node_has_children(
7703 __isl_keep isl_schedule_node *node);
7704 __isl_give isl_schedule_node *isl_schedule_node_first_child(
7705 __isl_take isl_schedule_node *node);
7706 isl_bool isl_schedule_node_has_previous_sibling(
7707 __isl_keep isl_schedule_node *node);
7708 __isl_give isl_schedule_node *
7709 isl_schedule_node_previous_sibling(
7710 __isl_take isl_schedule_node *node);
7711 isl_bool isl_schedule_node_has_next_sibling(
7712 __isl_keep isl_schedule_node *node);
7713 __isl_give isl_schedule_node *
7714 isl_schedule_node_next_sibling(
7715 __isl_take isl_schedule_node *node);
7717 For C<isl_schedule_node_ancestor>, the ancestor of generation 0
7718 is the node itself, the ancestor of generation 1 is its parent and so on.
7720 It is also possible to query the number of ancestors of a node,
7721 the position of the current node
7722 within the children of its parent, the position of the subtree
7723 containing a node within the children of an ancestor
7724 or to obtain a copy of a given
7725 child without destroying the current node.
7726 Given two nodes that point to the same schedule, their closest
7727 shared ancestor can be obtained using
7728 C<isl_schedule_node_get_shared_ancestor>.
7730 #include <isl/schedule_node.h>
7731 int isl_schedule_node_get_tree_depth(
7732 __isl_keep isl_schedule_node *node);
7733 int isl_schedule_node_get_child_position(
7734 __isl_keep isl_schedule_node *node);
7735 int isl_schedule_node_get_ancestor_child_position(
7736 __isl_keep isl_schedule_node *node,
7737 __isl_keep isl_schedule_node *ancestor);
7738 __isl_give isl_schedule_node *isl_schedule_node_get_child(
7739 __isl_keep isl_schedule_node *node, int pos);
7740 __isl_give isl_schedule_node *
7741 isl_schedule_node_get_shared_ancestor(
7742 __isl_keep isl_schedule_node *node1,
7743 __isl_keep isl_schedule_node *node2);
7745 All nodes in a schedule tree or
7746 all descendants of a specific node (including the node) can be visited
7747 in depth-first pre-order using the following functions.
7749 #include <isl/schedule.h>
7750 isl_stat isl_schedule_foreach_schedule_node_top_down(
7751 __isl_keep isl_schedule *sched,
7752 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
7753 void *user), void *user);
7755 #include <isl/schedule_node.h>
7756 isl_stat isl_schedule_node_foreach_descendant_top_down(
7757 __isl_keep isl_schedule_node *node,
7758 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
7759 void *user), void *user);
7761 The callback function is slightly different from the usual
7762 callbacks in that it not only indicates success (non-negative result)
7763 or failure (negative result), but also indicates whether the children
7764 of the given node should be visited. In particular, if the callback
7765 returns a positive value, then the children are visited, but if
7766 the callback returns zero, then the children are not visited.
7768 The ancestors of a node in a schedule tree can be visited from
7769 the root down to and including the parent of the node using
7770 the following function.
7772 #include <isl/schedule_node.h>
7773 isl_stat isl_schedule_node_foreach_ancestor_top_down(
7774 __isl_keep isl_schedule_node *node,
7775 isl_stat (*fn)(__isl_keep isl_schedule_node *node,
7776 void *user), void *user);
7778 The following functions allows for a depth-first post-order
7779 traversal of the nodes in a schedule tree or
7780 of the descendants of a specific node (including the node
7781 itself), where the user callback is allowed to modify the
7784 #include <isl/schedule.h>
7785 __isl_give isl_schedule *
7786 isl_schedule_map_schedule_node_bottom_up(
7787 __isl_take isl_schedule *schedule,
7788 __isl_give isl_schedule_node *(*fn)(
7789 __isl_take isl_schedule_node *node,
7790 void *user), void *user);
7792 #include <isl/schedule_node.h>
7793 __isl_give isl_schedule_node *
7794 isl_schedule_node_map_descendant_bottom_up(
7795 __isl_take isl_schedule_node *node,
7796 __isl_give isl_schedule_node *(*fn)(
7797 __isl_take isl_schedule_node *node,
7798 void *user), void *user);
7800 The traversal continues from the node returned by the callback function.
7801 It is the responsibility of the user to ensure that this does not
7802 lead to an infinite loop. It is safest to always return a pointer
7803 to the same position (same ancestors and child positions) as the input node.
7805 The following function removes a node (along with its descendants)
7806 from a schedule tree and returns a pointer to the leaf at the
7807 same position in the updated tree.
7808 It is not allowed to remove the root of a schedule tree or
7809 a child of a set or sequence node.
7811 #include <isl/schedule_node.h>
7812 __isl_give isl_schedule_node *isl_schedule_node_cut(
7813 __isl_take isl_schedule_node *node);
7815 The following function removes a single node
7816 from a schedule tree and returns a pointer to the child
7817 of the node, now located at the position of the original node
7818 or to a leaf node at that position if there was no child.
7819 It is not allowed to remove the root of a schedule tree,
7820 a set or sequence node, a child of a set or sequence node or
7821 a band node with an anchored subtree.
7823 #include <isl/schedule_node.h>
7824 __isl_give isl_schedule_node *isl_schedule_node_delete(
7825 __isl_take isl_schedule_node *node);
7827 Most nodes in a schedule tree only contain local information.
7828 In some cases, however, a node may also refer to outer band nodes.
7829 This means that the position of the node within the tree should
7830 not be changed, or at least that no changes are performed to the
7831 outer band nodes. The following function can be used to test
7832 whether the subtree rooted at a given node contains any such nodes.
7834 #include <isl/schedule_node.h>
7835 isl_bool isl_schedule_node_is_subtree_anchored(
7836 __isl_keep isl_schedule_node *node);
7838 The following function resets the user pointers on all parameter
7839 and tuple identifiers referenced by the given schedule node.
7841 #include <isl/schedule_node.h>
7842 __isl_give isl_schedule_node *isl_schedule_node_reset_user(
7843 __isl_take isl_schedule_node *node);
7845 The following function aligns the parameters of the given schedule
7846 node to the given space.
7848 #include <isl/schedule_node.h>
7849 __isl_give isl_schedule_node *
7850 isl_schedule_node_align_params(
7851 __isl_take isl_schedule_node *node,
7852 __isl_take isl_space *space);
7854 Several node types have their own functions for querying
7855 (and in some cases setting) some node type specific properties.
7857 #include <isl/schedule_node.h>
7858 __isl_give isl_space *isl_schedule_node_band_get_space(
7859 __isl_keep isl_schedule_node *node);
7860 __isl_give isl_multi_union_pw_aff *
7861 isl_schedule_node_band_get_partial_schedule(
7862 __isl_keep isl_schedule_node *node);
7863 __isl_give isl_union_map *
7864 isl_schedule_node_band_get_partial_schedule_union_map(
7865 __isl_keep isl_schedule_node *node);
7866 unsigned isl_schedule_node_band_n_member(
7867 __isl_keep isl_schedule_node *node);
7868 isl_bool isl_schedule_node_band_member_get_coincident(
7869 __isl_keep isl_schedule_node *node, int pos);
7870 __isl_give isl_schedule_node *
7871 isl_schedule_node_band_member_set_coincident(
7872 __isl_take isl_schedule_node *node, int pos,
7874 isl_bool isl_schedule_node_band_get_permutable(
7875 __isl_keep isl_schedule_node *node);
7876 __isl_give isl_schedule_node *
7877 isl_schedule_node_band_set_permutable(
7878 __isl_take isl_schedule_node *node, int permutable);
7879 enum isl_ast_loop_type
7880 isl_schedule_node_band_member_get_ast_loop_type(
7881 __isl_keep isl_schedule_node *node, int pos);
7882 __isl_give isl_schedule_node *
7883 isl_schedule_node_band_member_set_ast_loop_type(
7884 __isl_take isl_schedule_node *node, int pos,
7885 enum isl_ast_loop_type type);
7886 __isl_give isl_union_set *
7887 enum isl_ast_loop_type
7888 isl_schedule_node_band_member_get_isolate_ast_loop_type(
7889 __isl_keep isl_schedule_node *node, int pos);
7890 __isl_give isl_schedule_node *
7891 isl_schedule_node_band_member_set_isolate_ast_loop_type(
7892 __isl_take isl_schedule_node *node, int pos,
7893 enum isl_ast_loop_type type);
7894 isl_schedule_node_band_get_ast_build_options(
7895 __isl_keep isl_schedule_node *node);
7896 __isl_give isl_schedule_node *
7897 isl_schedule_node_band_set_ast_build_options(
7898 __isl_take isl_schedule_node *node,
7899 __isl_take isl_union_set *options);
7901 The function C<isl_schedule_node_band_get_space> returns the space
7902 of the partial schedule of the band.
7903 The function C<isl_schedule_node_band_get_partial_schedule_union_map>
7904 returns a representation of the partial schedule of the band node
7905 in the form of an C<isl_union_map>.
7906 The coincident and permutable properties are set by
7907 C<isl_schedule_constraints_compute_schedule> on the schedule tree
7909 A scheduling dimension is considered to be ``coincident''
7910 if it satisfies the coincidence constraints within its band.
7911 That is, if the dependence distances of the coincidence
7912 constraints are all zero in that direction (for fixed
7913 iterations of outer bands).
7914 A band is marked permutable if it was produced using the Pluto-like scheduler.
7915 Note that the scheduler may have to resort to a Feautrier style scheduling
7916 step even if the default scheduler is used.
7917 An C<isl_ast_loop_type> is one of C<isl_ast_loop_default>,
7918 C<isl_ast_loop_atomic>, C<isl_ast_loop_unroll> or C<isl_ast_loop_separate>.
7919 For the meaning of these loop AST generation types and the difference
7920 between the regular loop AST generation type and the isolate
7921 loop AST generation type, see L</"AST Generation Options (Schedule Tree)">.
7922 The functions C<isl_schedule_node_band_member_get_ast_loop_type>
7923 and C<isl_schedule_node_band_member_get_isolate_ast_loop_type>
7924 may return C<isl_ast_loop_error> if an error occurs.
7925 The AST build options govern how an AST is generated for
7926 the individual schedule dimensions during AST generation.
7927 See L</"AST Generation Options (Schedule Tree)">.
7929 #include <isl/schedule_node.h>
7930 __isl_give isl_set *
7931 isl_schedule_node_context_get_context(
7932 __isl_keep isl_schedule_node *node);
7934 #include <isl/schedule_node.h>
7935 __isl_give isl_union_set *
7936 isl_schedule_node_domain_get_domain(
7937 __isl_keep isl_schedule_node *node);
7939 #include <isl/schedule_node.h>
7940 __isl_give isl_union_map *
7941 isl_schedule_node_expansion_get_expansion(
7942 __isl_keep isl_schedule_node *node);
7943 __isl_give isl_union_pw_multi_aff *
7944 isl_schedule_node_expansion_get_contraction(
7945 __isl_keep isl_schedule_node *node);
7947 #include <isl/schedule_node.h>
7948 __isl_give isl_union_map *
7949 isl_schedule_node_extension_get_extension(
7950 __isl_keep isl_schedule_node *node);
7952 #include <isl/schedule_node.h>
7953 __isl_give isl_union_set *
7954 isl_schedule_node_filter_get_filter(
7955 __isl_keep isl_schedule_node *node);
7957 #include <isl/schedule_node.h>
7958 __isl_give isl_set *isl_schedule_node_guard_get_guard(
7959 __isl_keep isl_schedule_node *node);
7961 #include <isl/schedule_node.h>
7962 __isl_give isl_id *isl_schedule_node_mark_get_id(
7963 __isl_keep isl_schedule_node *node);
7965 The following functions can be used to obtain an C<isl_multi_union_pw_aff>,
7966 an C<isl_union_pw_multi_aff> or C<isl_union_map> representation of
7967 partial schedules related to the node.
7969 #include <isl/schedule_node.h>
7970 __isl_give isl_multi_union_pw_aff *
7971 isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(
7972 __isl_keep isl_schedule_node *node);
7973 __isl_give isl_union_pw_multi_aff *
7974 isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(
7975 __isl_keep isl_schedule_node *node);
7976 __isl_give isl_union_map *
7977 isl_schedule_node_get_prefix_schedule_union_map(
7978 __isl_keep isl_schedule_node *node);
7979 __isl_give isl_union_map *
7980 isl_schedule_node_get_prefix_schedule_relation(
7981 __isl_keep isl_schedule_node *node);
7982 __isl_give isl_union_map *
7983 isl_schedule_node_get_subtree_schedule_union_map(
7984 __isl_keep isl_schedule_node *node);
7986 In particular, the functions
7987 C<isl_schedule_node_get_prefix_schedule_multi_union_pw_aff>,
7988 C<isl_schedule_node_get_prefix_schedule_union_pw_multi_aff>
7989 and C<isl_schedule_node_get_prefix_schedule_union_map>
7990 return a relative ordering on the domain elements that reach the given
7991 node determined by its ancestors.
7992 The function C<isl_schedule_node_get_prefix_schedule_relation>
7993 additionally includes the domain constraints in the result.
7994 The function C<isl_schedule_node_get_subtree_schedule_union_map>
7995 returns a representation of the partial schedule defined by the
7996 subtree rooted at the given node.
7997 If the tree contains any expansion nodes, then the subtree schedule
7998 is formulated in terms of the expanded domain elements.
7999 The tree passed to functions returning a prefix schedule
8000 may only contain extension nodes if these would not affect
8001 the result of these functions. That is, if one of the ancestors
8002 is an extension node, then all of the domain elements that were
8003 added by the extension node need to have been filtered out
8004 by filter nodes between the extension node and the input node.
8005 The tree passed to C<isl_schedule_node_get_subtree_schedule_union_map>
8006 may not contain in extension nodes in the selected subtree.
8008 The expansion/contraction defined by an entire subtree, combining
8009 the expansions/contractions
8010 on the expansion nodes in the subtree, can be obtained using
8011 the following functions.
8013 #include <isl/schedule_node.h>
8014 __isl_give isl_union_map *
8015 isl_schedule_node_get_subtree_expansion(
8016 __isl_keep isl_schedule_node *node);
8017 __isl_give isl_union_pw_multi_aff *
8018 isl_schedule_node_get_subtree_contraction(
8019 __isl_keep isl_schedule_node *node);
8021 The total number of outer band members of given node, i.e.,
8022 the shared output dimension of the maps in the result
8023 of C<isl_schedule_node_get_prefix_schedule_union_map> can be obtained
8024 using the following function.
8026 #include <isl/schedule_node.h>
8027 int isl_schedule_node_get_schedule_depth(
8028 __isl_keep isl_schedule_node *node);
8030 The following functions return the elements that reach the given node
8031 or the union of universes in the spaces that contain these elements.
8033 #include <isl/schedule_node.h>
8034 __isl_give isl_union_set *
8035 isl_schedule_node_get_domain(
8036 __isl_keep isl_schedule_node *node);
8037 __isl_give isl_union_set *
8038 isl_schedule_node_get_universe_domain(
8039 __isl_keep isl_schedule_node *node);
8041 The input tree of C<isl_schedule_node_get_domain>
8042 may only contain extension nodes if these would not affect
8043 the result of this function. That is, if one of the ancestors
8044 is an extension node, then all of the domain elements that were
8045 added by the extension node need to have been filtered out
8046 by filter nodes between the extension node and the input node.
8048 The following functions can be used to introduce additional nodes
8049 in the schedule tree. The new node is introduced at the point
8050 in the tree where the C<isl_schedule_node> points to and
8051 the results points to the new node.
8053 #include <isl/schedule_node.h>
8054 __isl_give isl_schedule_node *
8055 isl_schedule_node_insert_partial_schedule(
8056 __isl_take isl_schedule_node *node,
8057 __isl_take isl_multi_union_pw_aff *schedule);
8059 This function inserts a new band node with (the greatest integer
8060 part of) the given partial schedule.
8061 The subtree rooted at the given node is assumed not to have
8064 #include <isl/schedule_node.h>
8065 __isl_give isl_schedule_node *
8066 isl_schedule_node_insert_context(
8067 __isl_take isl_schedule_node *node,
8068 __isl_take isl_set *context);
8070 This function inserts a new context node with the given context constraints.
8072 #include <isl/schedule_node.h>
8073 __isl_give isl_schedule_node *
8074 isl_schedule_node_insert_filter(
8075 __isl_take isl_schedule_node *node,
8076 __isl_take isl_union_set *filter);
8078 This function inserts a new filter node with the given filter.
8079 If the original node already pointed to a filter node, then the
8080 two filter nodes are merged into one.
8082 #include <isl/schedule_node.h>
8083 __isl_give isl_schedule_node *
8084 isl_schedule_node_insert_guard(
8085 __isl_take isl_schedule_node *node,
8086 __isl_take isl_set *guard);
8088 This function inserts a new guard node with the given guard constraints.
8090 #include <isl/schedule_node.h>
8091 __isl_give isl_schedule_node *
8092 isl_schedule_node_insert_mark(
8093 __isl_take isl_schedule_node *node,
8094 __isl_take isl_id *mark);
8096 This function inserts a new mark node with the give mark identifier.
8098 #include <isl/schedule_node.h>
8099 __isl_give isl_schedule_node *
8100 isl_schedule_node_insert_sequence(
8101 __isl_take isl_schedule_node *node,
8102 __isl_take isl_union_set_list *filters);
8103 __isl_give isl_schedule_node *
8104 isl_schedule_node_insert_set(
8105 __isl_take isl_schedule_node *node,
8106 __isl_take isl_union_set_list *filters);
8108 These functions insert a new sequence or set node with the given
8109 filters as children.
8111 #include <isl/schedule_node.h>
8112 __isl_give isl_schedule_node *isl_schedule_node_group(
8113 __isl_take isl_schedule_node *node,
8114 __isl_take isl_id *group_id);
8116 This function introduces an expansion node in between the current
8117 node and its parent that expands instances of a space with tuple
8118 identifier C<group_id> to the original domain elements that reach
8119 the node. The group instances are identified by the prefix schedule
8120 of those domain elements. The ancestors of the node are adjusted
8121 to refer to the group instances instead of the original domain
8122 elements. The return value points to the same node in the updated
8123 schedule tree as the input node, i.e., to the child of the newly
8124 introduced expansion node. Grouping instances of different statements
8125 ensures that they will be treated as a single statement by the
8126 AST generator up to the point of the expansion node.
8128 The partial schedule of a band node can be scaled (down) or reduced using
8129 the following functions.
8131 #include <isl/schedule_node.h>
8132 __isl_give isl_schedule_node *
8133 isl_schedule_node_band_scale(
8134 __isl_take isl_schedule_node *node,
8135 __isl_take isl_multi_val *mv);
8136 __isl_give isl_schedule_node *
8137 isl_schedule_node_band_scale_down(
8138 __isl_take isl_schedule_node *node,
8139 __isl_take isl_multi_val *mv);
8140 __isl_give isl_schedule_node *
8141 isl_schedule_node_band_mod(
8142 __isl_take isl_schedule_node *node,
8143 __isl_take isl_multi_val *mv);
8145 The spaces of the two arguments need to match.
8146 After scaling, the partial schedule is replaced by its greatest
8147 integer part to ensure that the schedule remains integral.
8149 The partial schedule of a band node can be shifted by an
8150 C<isl_multi_union_pw_aff> with a domain that is a superset
8151 of the domain of the partial schedule using
8152 the following function.
8154 #include <isl/schedule_node.h>
8155 __isl_give isl_schedule_node *
8156 isl_schedule_node_band_shift(
8157 __isl_take isl_schedule_node *node,
8158 __isl_take isl_multi_union_pw_aff *shift);
8160 A band node can be tiled using the following function.
8162 #include <isl/schedule_node.h>
8163 __isl_give isl_schedule_node *isl_schedule_node_band_tile(
8164 __isl_take isl_schedule_node *node,
8165 __isl_take isl_multi_val *sizes);
8167 isl_stat isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
8169 int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
8170 isl_stat isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
8172 int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
8174 The C<isl_schedule_node_band_tile> function tiles
8175 the band using the given tile sizes inside its schedule.
8176 A new child band node is created to represent the point loops and it is
8177 inserted between the modified band and its children.
8178 The subtree rooted at the given node is assumed not to have
8180 The C<tile_scale_tile_loops> option specifies whether the tile
8181 loops iterators should be scaled by the tile sizes.
8182 If the C<tile_shift_point_loops> option is set, then the point loops
8183 are shifted to start at zero.
8185 A band node can be split into two nested band nodes
8186 using the following function.
8188 #include <isl/schedule_node.h>
8189 __isl_give isl_schedule_node *isl_schedule_node_band_split(
8190 __isl_take isl_schedule_node *node, int pos);
8192 The resulting outer band node contains the first C<pos> dimensions of
8193 the schedule of C<node> while the inner band contains the remaining dimensions.
8194 The schedules of the two band nodes live in anonymous spaces.
8196 A band node can be moved down to the leaves of the subtree rooted
8197 at the band node using the following function.
8199 #include <isl/schedule_node.h>
8200 __isl_give isl_schedule_node *isl_schedule_node_band_sink(
8201 __isl_take isl_schedule_node *node);
8203 The subtree rooted at the given node is assumed not to have
8205 The result points to the node in the resulting tree that is in the same
8206 position as the node pointed to by C<node> in the original tree.
8208 #include <isl/schedule_node.h>
8209 __isl_give isl_schedule_node *
8210 isl_schedule_node_order_after(
8211 __isl_take isl_schedule_node *node,
8212 __isl_take isl_union_set *filter);
8214 This function splits the domain elements that reach C<node>
8215 into those that satisfy C<filter> and those that do not and
8216 arranges for the elements that do satisfy the filter to be
8217 executed after those that do not. The order is imposed by
8218 a sequence node, possibly reusing the grandparent of C<node>
8219 on two copies of the subtree attached to the original C<node>.
8220 Both copies are simplified with respect to their filter.
8222 Return a pointer to the copy of the subtree that does not
8223 satisfy C<filter>. If there is no such copy (because all
8224 reaching domain elements satisfy the filter), then return
8225 the original pointer.
8227 #include <isl/schedule_node.h>
8228 __isl_give isl_schedule_node *
8229 isl_schedule_node_graft_before(
8230 __isl_take isl_schedule_node *node,
8231 __isl_take isl_schedule_node *graft);
8232 __isl_give isl_schedule_node *
8233 isl_schedule_node_graft_after(
8234 __isl_take isl_schedule_node *node,
8235 __isl_take isl_schedule_node *graft);
8237 This function inserts the C<graft> tree into the tree containing C<node>
8238 such that it is executed before (in case of C<isl_schedule_node_graft_before>)
8239 or after (in case of C<isl_schedule_node_graft_after>) C<node>.
8240 The root node of C<graft>
8241 should be an extension node where the domain of the extension
8242 is the flat product of all outer band nodes of C<node>.
8243 The root node may also be a domain node.
8244 The elements of the domain or the range of the extension may not
8245 intersect with the domain elements that reach "node".
8246 The schedule tree of C<graft> may not be anchored.
8248 The schedule tree of C<node> is modified to include an extension node
8249 corresponding to the root node of C<graft> as a child of the original
8250 parent of C<node>. The original node that C<node> points to and the
8251 child of the root node of C<graft> are attached to this extension node
8252 through a sequence, with appropriate filters and with the child
8253 of C<graft> appearing before or after the original C<node>.
8255 If C<node> already appears inside a sequence that is the child of
8256 an extension node and if the spaces of the new domain elements
8257 do not overlap with those of the original domain elements,
8258 then that extension node is extended with the new extension
8259 rather than introducing a new segment of extension and sequence nodes.
8261 Return a pointer to the same node in the modified tree that
8262 C<node> pointed to in the original tree.
8264 A representation of the schedule node can be printed using
8266 #include <isl/schedule_node.h>
8267 __isl_give isl_printer *isl_printer_print_schedule_node(
8268 __isl_take isl_printer *p,
8269 __isl_keep isl_schedule_node *node);
8271 =head2 Dependence Analysis
8273 C<isl> contains specialized functionality for performing
8274 array dataflow analysis. That is, given a I<sink> access relation
8275 and a collection of possible I<source> access relations,
8276 C<isl> can compute relations that describe
8277 for each iteration of the sink access, which iteration
8278 of which of the source access relations was the last
8279 to access the same data element before the given iteration
8281 The resulting dependence relations map source iterations
8282 to the corresponding sink iterations.
8283 To compute standard flow dependences, the sink should be
8284 a read, while the sources should be writes.
8285 If any of the source accesses are marked as being I<may>
8286 accesses, then there will be a dependence from the last
8287 I<must> access B<and> from any I<may> access that follows
8288 this last I<must> access.
8289 In particular, if I<all> sources are I<may> accesses,
8290 then memory based dependence analysis is performed.
8291 If, on the other hand, all sources are I<must> accesses,
8292 then value based dependence analysis is performed.
8294 =head3 High-level Interface
8296 A high-level interface to dependence analysis is provided
8297 by the following function.
8299 #include <isl/flow.h>
8300 __isl_give isl_union_flow *
8301 isl_union_access_info_compute_flow(
8302 __isl_take isl_union_access_info *access);
8304 The input C<isl_union_access_info> object describes the sink
8305 access relations, the source access relations and a schedule,
8306 while the output C<isl_union_flow> object describes
8307 the resulting dependence relations and the subsets of the
8308 sink relations for which no source was found.
8310 An C<isl_union_access_info> is created, modified, copied and freed using
8311 the following functions.
8313 #include <isl/flow.h>
8314 __isl_give isl_union_access_info *
8315 isl_union_access_info_from_sink(
8316 __isl_take isl_union_map *sink);
8317 __isl_give isl_union_access_info *
8318 isl_union_access_info_set_must_source(
8319 __isl_take isl_union_access_info *access,
8320 __isl_take isl_union_map *must_source);
8321 __isl_give isl_union_access_info *
8322 isl_union_access_info_set_may_source(
8323 __isl_take isl_union_access_info *access,
8324 __isl_take isl_union_map *may_source);
8325 __isl_give isl_union_access_info *
8326 isl_union_access_info_set_schedule(
8327 __isl_take isl_union_access_info *access,
8328 __isl_take isl_schedule *schedule);
8329 __isl_give isl_union_access_info *
8330 isl_union_access_info_set_schedule_map(
8331 __isl_take isl_union_access_info *access,
8332 __isl_take isl_union_map *schedule_map);
8333 __isl_give isl_union_access_info *
8334 isl_union_access_info_copy(
8335 __isl_keep isl_union_access_info *access);
8336 __isl_null isl_union_access_info *
8337 isl_union_access_info_free(
8338 __isl_take isl_union_access_info *access);
8340 The may sources set by C<isl_union_access_info_set_may_source>
8341 do not need to include the must sources set by
8342 C<isl_union_access_info_set_must_source> as a subset.
8343 The user is free not to call one (or both) of these functions,
8344 in which case the corresponding set is kept to its empty default.
8345 Similarly, the default schedule initialized by
8346 C<isl_union_access_info_from_sink> is empty.
8347 The current schedule is determined by the last call to either
8348 C<isl_union_access_info_set_schedule> or
8349 C<isl_union_access_info_set_schedule_map>.
8350 The domain of the schedule corresponds to the domains of
8351 the access relations. In particular, the domains of the access
8352 relations are effectively intersected with the domain of the schedule
8353 and only the resulting accesses are considered by the dependence analysis.
8355 The output of C<isl_union_access_info_compute_flow> can be examined
8356 and freed using the following functions.
8358 #include <isl/flow.h>
8359 __isl_give isl_union_map *isl_union_flow_get_must_dependence(
8360 __isl_keep isl_union_flow *flow);
8361 __isl_give isl_union_map *isl_union_flow_get_may_dependence(
8362 __isl_keep isl_union_flow *flow);
8363 __isl_give isl_union_map *isl_union_flow_get_must_no_source(
8364 __isl_keep isl_union_flow *flow);
8365 __isl_give isl_union_map *isl_union_flow_get_may_no_source(
8366 __isl_keep isl_union_flow *flow);
8367 __isl_null isl_union_flow *isl_union_flow_free(
8368 __isl_take isl_union_flow *flow);
8370 The relation returned by C<isl_union_flow_get_must_dependence>
8371 relates domain elements of must sources to domain elements of the sink.
8372 The relation returned by C<isl_union_flow_get_may_dependence>
8373 relates domain elements of must or may sources to domain elements of the sink
8374 and includes the previous relation as a subset.
8375 The relation returned by C<isl_union_flow_get_must_no_source> is the subset
8376 of the sink relation for which no dependences have been found.
8377 The relation returned by C<isl_union_flow_get_may_no_source> is the subset
8378 of the sink relation for which no definite dependences have been found.
8379 That is, it contains those sink access that do not contribute to any
8380 of the elements in the relation returned
8381 by C<isl_union_flow_get_must_dependence>.
8383 =head3 Low-level Interface
8385 A lower-level interface is provided by the following functions.
8387 #include <isl/flow.h>
8389 typedef int (*isl_access_level_before)(void *first, void *second);
8391 __isl_give isl_access_info *isl_access_info_alloc(
8392 __isl_take isl_map *sink,
8393 void *sink_user, isl_access_level_before fn,
8395 __isl_give isl_access_info *isl_access_info_add_source(
8396 __isl_take isl_access_info *acc,
8397 __isl_take isl_map *source, int must,
8399 __isl_null isl_access_info *isl_access_info_free(
8400 __isl_take isl_access_info *acc);
8402 __isl_give isl_flow *isl_access_info_compute_flow(
8403 __isl_take isl_access_info *acc);
8405 isl_stat isl_flow_foreach(__isl_keep isl_flow *deps,
8406 isl_stat (*fn)(__isl_take isl_map *dep, int must,
8407 void *dep_user, void *user),
8409 __isl_give isl_map *isl_flow_get_no_source(
8410 __isl_keep isl_flow *deps, int must);
8411 void isl_flow_free(__isl_take isl_flow *deps);
8413 The function C<isl_access_info_compute_flow> performs the actual
8414 dependence analysis. The other functions are used to construct
8415 the input for this function or to read off the output.
8417 The input is collected in an C<isl_access_info>, which can
8418 be created through a call to C<isl_access_info_alloc>.
8419 The arguments to this functions are the sink access relation
8420 C<sink>, a token C<sink_user> used to identify the sink
8421 access to the user, a callback function for specifying the
8422 relative order of source and sink accesses, and the number
8423 of source access relations that will be added.
8424 The callback function has type C<int (*)(void *first, void *second)>.
8425 The function is called with two user supplied tokens identifying
8426 either a source or the sink and it should return the shared nesting
8427 level and the relative order of the two accesses.
8428 In particular, let I<n> be the number of loops shared by
8429 the two accesses. If C<first> precedes C<second> textually,
8430 then the function should return I<2 * n + 1>; otherwise,
8431 it should return I<2 * n>.
8432 The sources can be added to the C<isl_access_info> by performing
8433 (at most) C<max_source> calls to C<isl_access_info_add_source>.
8434 C<must> indicates whether the source is a I<must> access
8435 or a I<may> access. Note that a multi-valued access relation
8436 should only be marked I<must> if every iteration in the domain
8437 of the relation accesses I<all> elements in its image.
8438 The C<source_user> token is again used to identify
8439 the source access. The range of the source access relation
8440 C<source> should have the same dimension as the range
8441 of the sink access relation.
8442 The C<isl_access_info_free> function should usually not be
8443 called explicitly, because it is called implicitly by
8444 C<isl_access_info_compute_flow>.
8446 The result of the dependence analysis is collected in an
8447 C<isl_flow>. There may be elements of
8448 the sink access for which no preceding source access could be
8449 found or for which all preceding sources are I<may> accesses.
8450 The relations containing these elements can be obtained through
8451 calls to C<isl_flow_get_no_source>, the first with C<must> set
8452 and the second with C<must> unset.
8453 In the case of standard flow dependence analysis,
8454 with the sink a read and the sources I<must> writes,
8455 the first relation corresponds to the reads from uninitialized
8456 array elements and the second relation is empty.
8457 The actual flow dependences can be extracted using
8458 C<isl_flow_foreach>. This function will call the user-specified
8459 callback function C<fn> for each B<non-empty> dependence between
8460 a source and the sink. The callback function is called
8461 with four arguments, the actual flow dependence relation
8462 mapping source iterations to sink iterations, a boolean that
8463 indicates whether it is a I<must> or I<may> dependence, a token
8464 identifying the source and an additional C<void *> with value
8465 equal to the third argument of the C<isl_flow_foreach> call.
8466 A dependence is marked I<must> if it originates from a I<must>
8467 source and if it is not followed by any I<may> sources.
8469 After finishing with an C<isl_flow>, the user should call
8470 C<isl_flow_free> to free all associated memory.
8472 =head3 Interaction with the Low-level Interface
8474 During the dependence analysis, we frequently need to perform
8475 the following operation. Given a relation between sink iterations
8476 and potential source iterations from a particular source domain,
8477 what is the last potential source iteration corresponding to each
8478 sink iteration. It can sometimes be convenient to adjust
8479 the set of potential source iterations before or after each such operation.
8480 The prototypical example is fuzzy array dataflow analysis,
8481 where we need to analyze if, based on data-dependent constraints,
8482 the sink iteration can ever be executed without one or more of
8483 the corresponding potential source iterations being executed.
8484 If so, we can introduce extra parameters and select an unknown
8485 but fixed source iteration from the potential source iterations.
8486 To be able to perform such manipulations, C<isl> provides the following
8489 #include <isl/flow.h>
8491 typedef __isl_give isl_restriction *(*isl_access_restrict)(
8492 __isl_keep isl_map *source_map,
8493 __isl_keep isl_set *sink, void *source_user,
8495 __isl_give isl_access_info *isl_access_info_set_restrict(
8496 __isl_take isl_access_info *acc,
8497 isl_access_restrict fn, void *user);
8499 The function C<isl_access_info_set_restrict> should be called
8500 before calling C<isl_access_info_compute_flow> and registers a callback function
8501 that will be called any time C<isl> is about to compute the last
8502 potential source. The first argument is the (reverse) proto-dependence,
8503 mapping sink iterations to potential source iterations.
8504 The second argument represents the sink iterations for which
8505 we want to compute the last source iteration.
8506 The third argument is the token corresponding to the source
8507 and the final argument is the token passed to C<isl_access_info_set_restrict>.
8508 The callback is expected to return a restriction on either the input or
8509 the output of the operation computing the last potential source.
8510 If the input needs to be restricted then restrictions are needed
8511 for both the source and the sink iterations. The sink iterations
8512 and the potential source iterations will be intersected with these sets.
8513 If the output needs to be restricted then only a restriction on the source
8514 iterations is required.
8515 If any error occurs, the callback should return C<NULL>.
8516 An C<isl_restriction> object can be created, freed and inspected
8517 using the following functions.
8519 #include <isl/flow.h>
8521 __isl_give isl_restriction *isl_restriction_input(
8522 __isl_take isl_set *source_restr,
8523 __isl_take isl_set *sink_restr);
8524 __isl_give isl_restriction *isl_restriction_output(
8525 __isl_take isl_set *source_restr);
8526 __isl_give isl_restriction *isl_restriction_none(
8527 __isl_take isl_map *source_map);
8528 __isl_give isl_restriction *isl_restriction_empty(
8529 __isl_take isl_map *source_map);
8530 __isl_null isl_restriction *isl_restriction_free(
8531 __isl_take isl_restriction *restr);
8533 C<isl_restriction_none> and C<isl_restriction_empty> are special
8534 cases of C<isl_restriction_input>. C<isl_restriction_none>
8535 is essentially equivalent to
8537 isl_restriction_input(isl_set_universe(
8538 isl_space_range(isl_map_get_space(source_map))),
8540 isl_space_domain(isl_map_get_space(source_map))));
8542 whereas C<isl_restriction_empty> is essentially equivalent to
8544 isl_restriction_input(isl_set_empty(
8545 isl_space_range(isl_map_get_space(source_map))),
8547 isl_space_domain(isl_map_get_space(source_map))));
8551 B<The functionality described in this section is fairly new
8552 and may be subject to change.>
8554 #include <isl/schedule.h>
8555 __isl_give isl_schedule *
8556 isl_schedule_constraints_compute_schedule(
8557 __isl_take isl_schedule_constraints *sc);
8559 The function C<isl_schedule_constraints_compute_schedule> can be
8560 used to compute a schedule that satisfies the given schedule constraints.
8561 These schedule constraints include the iteration domain for which
8562 a schedule should be computed and dependences between pairs of
8563 iterations. In particular, these dependences include
8564 I<validity> dependences and I<proximity> dependences.
8565 By default, the algorithm used to construct the schedule is similar
8566 to that of C<Pluto>.
8567 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
8569 The generated schedule respects all validity dependences.
8570 That is, all dependence distances over these dependences in the
8571 scheduled space are lexicographically positive.
8573 The default algorithm tries to ensure that the dependence distances
8574 over coincidence constraints are zero and to minimize the
8575 dependence distances over proximity dependences.
8576 Moreover, it tries to obtain sequences (bands) of schedule dimensions
8577 for groups of domains where the dependence distances over validity
8578 dependences have only non-negative values.
8579 Note that when minimizing the maximal dependence distance
8580 over proximity dependences, a single affine expression in the parameters
8581 is constructed that bounds all dependence distances. If no such expression
8582 exists, then the algorithm will fail and resort to an alternative
8583 scheduling algorithm. In particular, this means that adding proximity
8584 dependences may eliminate valid solutions. A typical example where this
8585 phenomenon may occur is when some subset of the proximity dependences
8586 has no restriction on some parameter, forcing the coefficient of that
8587 parameter to be zero, while some other subset forces the dependence
8588 distance to depend on that parameter, requiring the same coefficient
8590 When using Feautrier's algorithm, the coincidence and proximity constraints
8591 are only taken into account during the extension to a
8592 full-dimensional schedule.
8594 An C<isl_schedule_constraints> object can be constructed
8595 and manipulated using the following functions.
8597 #include <isl/schedule.h>
8598 __isl_give isl_schedule_constraints *
8599 isl_schedule_constraints_copy(
8600 __isl_keep isl_schedule_constraints *sc);
8601 __isl_give isl_schedule_constraints *
8602 isl_schedule_constraints_on_domain(
8603 __isl_take isl_union_set *domain);
8604 __isl_give isl_schedule_constraints *
8605 isl_schedule_constraints_set_context(
8606 __isl_take isl_schedule_constraints *sc,
8607 __isl_take isl_set *context);
8608 __isl_give isl_schedule_constraints *
8609 isl_schedule_constraints_set_validity(
8610 __isl_take isl_schedule_constraints *sc,
8611 __isl_take isl_union_map *validity);
8612 __isl_give isl_schedule_constraints *
8613 isl_schedule_constraints_set_coincidence(
8614 __isl_take isl_schedule_constraints *sc,
8615 __isl_take isl_union_map *coincidence);
8616 __isl_give isl_schedule_constraints *
8617 isl_schedule_constraints_set_proximity(
8618 __isl_take isl_schedule_constraints *sc,
8619 __isl_take isl_union_map *proximity);
8620 __isl_give isl_schedule_constraints *
8621 isl_schedule_constraints_set_conditional_validity(
8622 __isl_take isl_schedule_constraints *sc,
8623 __isl_take isl_union_map *condition,
8624 __isl_take isl_union_map *validity);
8625 __isl_null isl_schedule_constraints *
8626 isl_schedule_constraints_free(
8627 __isl_take isl_schedule_constraints *sc);
8629 The initial C<isl_schedule_constraints> object created by
8630 C<isl_schedule_constraints_on_domain> does not impose any constraints.
8631 That is, it has an empty set of dependences.
8632 The function C<isl_schedule_constraints_set_context> allows the user
8633 to specify additional constraints on the parameters that may
8634 be assumed to hold during the construction of the schedule.
8635 The function C<isl_schedule_constraints_set_validity> replaces the
8636 validity dependences, mapping domain elements I<i> to domain
8637 elements that should be scheduled after I<i>.
8638 The function C<isl_schedule_constraints_set_coincidence> replaces the
8639 coincidence dependences, mapping domain elements I<i> to domain
8640 elements that should be scheduled together with I<I>, if possible.
8641 The function C<isl_schedule_constraints_set_proximity> replaces the
8642 proximity dependences, mapping domain elements I<i> to domain
8643 elements that should be scheduled either before I<I>
8644 or as early as possible after I<i>.
8646 The function C<isl_schedule_constraints_set_conditional_validity>
8647 replaces the conditional validity constraints.
8648 A conditional validity constraint is only imposed when any of the corresponding
8649 conditions is satisfied, i.e., when any of them is non-zero.
8650 That is, the scheduler ensures that within each band if the dependence
8651 distances over the condition constraints are not all zero
8652 then all corresponding conditional validity constraints are respected.
8653 A conditional validity constraint corresponds to a condition
8654 if the two are adjacent, i.e., if the domain of one relation intersect
8655 the range of the other relation.
8656 The typical use case of conditional validity constraints is
8657 to allow order constraints between live ranges to be violated
8658 as long as the live ranges themselves are local to the band.
8659 To allow more fine-grained control over which conditions correspond
8660 to which conditional validity constraints, the domains and ranges
8661 of these relations may include I<tags>. That is, the domains and
8662 ranges of those relation may themselves be wrapped relations
8663 where the iteration domain appears in the domain of those wrapped relations
8664 and the range of the wrapped relations can be arbitrarily chosen
8665 by the user. Conditions and conditional validity constraints are only
8666 considered adjacent to each other if the entire wrapped relation matches.
8667 In particular, a relation with a tag will never be considered adjacent
8668 to a relation without a tag.
8670 An C<isl_schedule_constraints> object can be inspected
8671 using the following functions.
8673 #include <isl/schedule.h>
8674 __isl_give isl_union_map *
8675 isl_schedule_constraints_get_validity(
8676 __isl_keep isl_schedule_constraints *sc);
8677 __isl_give isl_union_map *
8678 isl_schedule_constraints_get_coincidence(
8679 __isl_keep isl_schedule_constraints *sc);
8680 __isl_give isl_union_map *
8681 isl_schedule_constraints_get_conditional_validity(
8682 __isl_keep isl_schedule_constraints *sc);
8683 __isl_give isl_union_map *
8684 isl_schedule_constraints_get_conditional_validity_condition(
8685 __isl_keep isl_schedule_constraints *sc);
8687 The following function computes a schedule directly from
8688 an iteration domain and validity and proximity dependences
8689 and is implemented in terms of the functions described above.
8690 The use of C<isl_union_set_compute_schedule> is discouraged.
8692 #include <isl/schedule.h>
8693 __isl_give isl_schedule *isl_union_set_compute_schedule(
8694 __isl_take isl_union_set *domain,
8695 __isl_take isl_union_map *validity,
8696 __isl_take isl_union_map *proximity);
8698 The generated schedule represents a schedule tree.
8699 For more information on schedule trees, see
8700 L</"Schedule Trees">.
8704 #include <isl/schedule.h>
8705 isl_stat isl_options_set_schedule_max_coefficient(
8706 isl_ctx *ctx, int val);
8707 int isl_options_get_schedule_max_coefficient(
8709 isl_stat isl_options_set_schedule_max_constant_term(
8710 isl_ctx *ctx, int val);
8711 int isl_options_get_schedule_max_constant_term(
8713 isl_stat isl_options_set_schedule_serialize_sccs(
8714 isl_ctx *ctx, int val);
8715 int isl_options_get_schedule_serialize_sccs(isl_ctx *ctx);
8716 isl_stat isl_options_set_schedule_maximize_band_depth(
8717 isl_ctx *ctx, int val);
8718 int isl_options_get_schedule_maximize_band_depth(
8720 isl_stat isl_options_set_schedule_outer_coincidence(
8721 isl_ctx *ctx, int val);
8722 int isl_options_get_schedule_outer_coincidence(
8724 isl_stat isl_options_set_schedule_split_scaled(
8725 isl_ctx *ctx, int val);
8726 int isl_options_get_schedule_split_scaled(
8728 isl_stat isl_options_set_schedule_algorithm(
8729 isl_ctx *ctx, int val);
8730 int isl_options_get_schedule_algorithm(
8732 isl_stat isl_options_set_schedule_separate_components(
8733 isl_ctx *ctx, int val);
8734 int isl_options_get_schedule_separate_components(
8739 =item * schedule_max_coefficient
8741 This option enforces that the coefficients for variable and parameter
8742 dimensions in the calculated schedule are not larger than the specified value.
8743 This option can significantly increase the speed of the scheduling calculation
8744 and may also prevent fusing of unrelated dimensions. A value of -1 means that
8745 this option does not introduce bounds on the variable or parameter
8748 =item * schedule_max_constant_term
8750 This option enforces that the constant coefficients in the calculated schedule
8751 are not larger than the maximal constant term. This option can significantly
8752 increase the speed of the scheduling calculation and may also prevent fusing of
8753 unrelated dimensions. A value of -1 means that this option does not introduce
8754 bounds on the constant coefficients.
8756 =item * schedule_serialize_sccs
8758 If this option is set, then all strongly connected components
8759 in the dependence graph are serialized as soon as they are detected.
8760 This means in particular that instances of statements will only
8761 appear in the same band node if these statements belong
8762 to the same strongly connected component at the point where
8763 the band node is constructed.
8765 =item * schedule_maximize_band_depth
8767 If this option is set, we do not split bands at the point
8768 where we detect splitting is necessary. Instead, we
8769 backtrack and split bands as early as possible. This
8770 reduces the number of splits and maximizes the width of
8771 the bands. Wider bands give more possibilities for tiling.
8772 Note that if the C<schedule_serialize_sccs> options is set,
8773 then bands will be split as early as possible, even if there is no need.
8774 The C<schedule_maximize_band_depth> option therefore has no effect in this case.
8776 =item * schedule_outer_coincidence
8778 If this option is set, then we try to construct schedules
8779 where the outermost scheduling dimension in each band
8780 satisfies the coincidence constraints.
8782 =item * schedule_split_scaled
8784 If this option is set, then we try to construct schedules in which the
8785 constant term is split off from the linear part if the linear parts of
8786 the scheduling rows for all nodes in the graphs have a common non-trivial
8788 The constant term is then placed in a separate band and the linear
8791 =item * schedule_algorithm
8793 Selects the scheduling algorithm to be used.
8794 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
8795 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
8797 =item * schedule_separate_components
8799 If this option is set then the function C<isl_schedule_get_map>
8800 will treat set nodes in the same way as sequence nodes.
8804 =head2 AST Generation
8806 This section describes the C<isl> functionality for generating
8807 ASTs that visit all the elements
8808 in a domain in an order specified by a schedule tree or
8810 In case the schedule given as a C<isl_union_map>, an AST is generated
8811 that visits all the elements in the domain of the C<isl_union_map>
8812 according to the lexicographic order of the corresponding image
8813 element(s). If the range of the C<isl_union_map> consists of
8814 elements in more than one space, then each of these spaces is handled
8815 separately in an arbitrary order.
8816 It should be noted that the schedule tree or the image elements
8817 in a schedule map only specify the I<order>
8818 in which the corresponding domain elements should be visited.
8819 No direct relation between the partial schedule values
8820 or the image elements on the one hand and the loop iterators
8821 in the generated AST on the other hand should be assumed.
8823 Each AST is generated within a build. The initial build
8824 simply specifies the constraints on the parameters (if any)
8825 and can be created, inspected, copied and freed using the following functions.
8827 #include <isl/ast_build.h>
8828 __isl_give isl_ast_build *isl_ast_build_alloc(
8830 __isl_give isl_ast_build *isl_ast_build_from_context(
8831 __isl_take isl_set *set);
8832 __isl_give isl_ast_build *isl_ast_build_copy(
8833 __isl_keep isl_ast_build *build);
8834 __isl_null isl_ast_build *isl_ast_build_free(
8835 __isl_take isl_ast_build *build);
8837 The C<set> argument is usually a parameter set with zero or more parameters.
8838 In fact, when creating an AST using C<isl_ast_build_node_from_schedule>,
8839 this set is required to be a parameter set.
8840 An C<isl_ast_build> created using C<isl_ast_build_alloc> does not
8841 specify any parameter constraints.
8842 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
8843 and L</"Fine-grained Control over AST Generation">.
8844 Finally, the AST itself can be constructed using one of the following
8847 #include <isl/ast_build.h>
8848 __isl_give isl_ast_node *isl_ast_build_node_from_schedule(
8849 __isl_keep isl_ast_build *build,
8850 __isl_take isl_schedule *schedule);
8851 __isl_give isl_ast_node *
8852 isl_ast_build_node_from_schedule_map(
8853 __isl_keep isl_ast_build *build,
8854 __isl_take isl_union_map *schedule);
8856 =head3 Inspecting the AST
8858 The basic properties of an AST node can be obtained as follows.
8860 #include <isl/ast.h>
8861 enum isl_ast_node_type isl_ast_node_get_type(
8862 __isl_keep isl_ast_node *node);
8864 The type of an AST node is one of
8865 C<isl_ast_node_for>,
8867 C<isl_ast_node_block>,
8868 C<isl_ast_node_mark> or
8869 C<isl_ast_node_user>.
8870 An C<isl_ast_node_for> represents a for node.
8871 An C<isl_ast_node_if> represents an if node.
8872 An C<isl_ast_node_block> represents a compound node.
8873 An C<isl_ast_node_mark> introduces a mark in the AST.
8874 An C<isl_ast_node_user> represents an expression statement.
8875 An expression statement typically corresponds to a domain element, i.e.,
8876 one of the elements that is visited by the AST.
8878 Each type of node has its own additional properties.
8880 #include <isl/ast.h>
8881 __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
8882 __isl_keep isl_ast_node *node);
8883 __isl_give isl_ast_expr *isl_ast_node_for_get_init(
8884 __isl_keep isl_ast_node *node);
8885 __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
8886 __isl_keep isl_ast_node *node);
8887 __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
8888 __isl_keep isl_ast_node *node);
8889 __isl_give isl_ast_node *isl_ast_node_for_get_body(
8890 __isl_keep isl_ast_node *node);
8891 isl_bool isl_ast_node_for_is_degenerate(
8892 __isl_keep isl_ast_node *node);
8894 An C<isl_ast_for> is considered degenerate if it is known to execute
8897 #include <isl/ast.h>
8898 __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
8899 __isl_keep isl_ast_node *node);
8900 __isl_give isl_ast_node *isl_ast_node_if_get_then(
8901 __isl_keep isl_ast_node *node);
8902 isl_bool isl_ast_node_if_has_else(
8903 __isl_keep isl_ast_node *node);
8904 __isl_give isl_ast_node *isl_ast_node_if_get_else(
8905 __isl_keep isl_ast_node *node);
8907 __isl_give isl_ast_node_list *
8908 isl_ast_node_block_get_children(
8909 __isl_keep isl_ast_node *node);
8911 __isl_give isl_id *isl_ast_node_mark_get_id(
8912 __isl_keep isl_ast_node *node);
8913 __isl_give isl_ast_node *isl_ast_node_mark_get_node(
8914 __isl_keep isl_ast_node *node);
8916 C<isl_ast_node_mark_get_id> returns the identifier of the mark.
8917 C<isl_ast_node_mark_get_node> returns the child node that is being marked.
8919 #include <isl/ast.h>
8920 __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
8921 __isl_keep isl_ast_node *node);
8923 Each of the returned C<isl_ast_expr>s can in turn be inspected using
8924 the following functions.
8926 #include <isl/ast.h>
8927 enum isl_ast_expr_type isl_ast_expr_get_type(
8928 __isl_keep isl_ast_expr *expr);
8930 The type of an AST expression is one of
8932 C<isl_ast_expr_id> or
8933 C<isl_ast_expr_int>.
8934 An C<isl_ast_expr_op> represents the result of an operation.
8935 An C<isl_ast_expr_id> represents an identifier.
8936 An C<isl_ast_expr_int> represents an integer value.
8938 Each type of expression has its own additional properties.
8940 #include <isl/ast.h>
8941 enum isl_ast_op_type isl_ast_expr_get_op_type(
8942 __isl_keep isl_ast_expr *expr);
8943 int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
8944 __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
8945 __isl_keep isl_ast_expr *expr, int pos);
8946 isl_stat isl_ast_node_foreach_ast_op_type(
8947 __isl_keep isl_ast_node *node,
8948 isl_stat (*fn)(enum isl_ast_op_type type,
8949 void *user), void *user);
8951 C<isl_ast_expr_get_op_type> returns the type of the operation
8952 performed. C<isl_ast_expr_get_op_n_arg> returns the number of
8953 arguments. C<isl_ast_expr_get_op_arg> returns the specified
8955 C<isl_ast_node_foreach_ast_op_type> calls C<fn> for each distinct
8956 C<isl_ast_op_type> that appears in C<node>.
8957 The operation type is one of the following.
8961 =item C<isl_ast_op_and>
8963 Logical I<and> of two arguments.
8964 Both arguments can be evaluated.
8966 =item C<isl_ast_op_and_then>
8968 Logical I<and> of two arguments.
8969 The second argument can only be evaluated if the first evaluates to true.
8971 =item C<isl_ast_op_or>
8973 Logical I<or> of two arguments.
8974 Both arguments can be evaluated.
8976 =item C<isl_ast_op_or_else>
8978 Logical I<or> of two arguments.
8979 The second argument can only be evaluated if the first evaluates to false.
8981 =item C<isl_ast_op_max>
8983 Maximum of two or more arguments.
8985 =item C<isl_ast_op_min>
8987 Minimum of two or more arguments.
8989 =item C<isl_ast_op_minus>
8993 =item C<isl_ast_op_add>
8995 Sum of two arguments.
8997 =item C<isl_ast_op_sub>
8999 Difference of two arguments.
9001 =item C<isl_ast_op_mul>
9003 Product of two arguments.
9005 =item C<isl_ast_op_div>
9007 Exact division. That is, the result is known to be an integer.
9009 =item C<isl_ast_op_fdiv_q>
9011 Result of integer division, rounded towards negative
9014 =item C<isl_ast_op_pdiv_q>
9016 Result of integer division, where dividend is known to be non-negative.
9018 =item C<isl_ast_op_pdiv_r>
9020 Remainder of integer division, where dividend is known to be non-negative.
9022 =item C<isl_ast_op_zdiv_r>
9024 Equal to zero iff the remainder on integer division is zero.
9026 =item C<isl_ast_op_cond>
9028 Conditional operator defined on three arguments.
9029 If the first argument evaluates to true, then the result
9030 is equal to the second argument. Otherwise, the result
9031 is equal to the third argument.
9032 The second and third argument may only be evaluated if
9033 the first argument evaluates to true and false, respectively.
9034 Corresponds to C<a ? b : c> in C.
9036 =item C<isl_ast_op_select>
9038 Conditional operator defined on three arguments.
9039 If the first argument evaluates to true, then the result
9040 is equal to the second argument. Otherwise, the result
9041 is equal to the third argument.
9042 The second and third argument may be evaluated independently
9043 of the value of the first argument.
9044 Corresponds to C<a * b + (1 - a) * c> in C.
9046 =item C<isl_ast_op_eq>
9050 =item C<isl_ast_op_le>
9052 Less than or equal relation.
9054 =item C<isl_ast_op_lt>
9058 =item C<isl_ast_op_ge>
9060 Greater than or equal relation.
9062 =item C<isl_ast_op_gt>
9064 Greater than relation.
9066 =item C<isl_ast_op_call>
9069 The number of arguments of the C<isl_ast_expr> is one more than
9070 the number of arguments in the function call, the first argument
9071 representing the function being called.
9073 =item C<isl_ast_op_access>
9076 The number of arguments of the C<isl_ast_expr> is one more than
9077 the number of index expressions in the array access, the first argument
9078 representing the array being accessed.
9080 =item C<isl_ast_op_member>
9083 This operation has two arguments, a structure and the name of
9084 the member of the structure being accessed.
9088 #include <isl/ast.h>
9089 __isl_give isl_id *isl_ast_expr_get_id(
9090 __isl_keep isl_ast_expr *expr);
9092 Return the identifier represented by the AST expression.
9094 #include <isl/ast.h>
9095 __isl_give isl_val *isl_ast_expr_get_val(
9096 __isl_keep isl_ast_expr *expr);
9098 Return the integer represented by the AST expression.
9100 =head3 Properties of ASTs
9102 #include <isl/ast.h>
9103 isl_bool isl_ast_expr_is_equal(
9104 __isl_keep isl_ast_expr *expr1,
9105 __isl_keep isl_ast_expr *expr2);
9107 Check if two C<isl_ast_expr>s are equal to each other.
9109 =head3 Manipulating and printing the AST
9111 AST nodes can be copied and freed using the following functions.
9113 #include <isl/ast.h>
9114 __isl_give isl_ast_node *isl_ast_node_copy(
9115 __isl_keep isl_ast_node *node);
9116 __isl_null isl_ast_node *isl_ast_node_free(
9117 __isl_take isl_ast_node *node);
9119 AST expressions can be copied and freed using the following functions.
9121 #include <isl/ast.h>
9122 __isl_give isl_ast_expr *isl_ast_expr_copy(
9123 __isl_keep isl_ast_expr *expr);
9124 __isl_null isl_ast_expr *isl_ast_expr_free(
9125 __isl_take isl_ast_expr *expr);
9127 New AST expressions can be created either directly or within
9128 the context of an C<isl_ast_build>.
9130 #include <isl/ast.h>
9131 __isl_give isl_ast_expr *isl_ast_expr_from_val(
9132 __isl_take isl_val *v);
9133 __isl_give isl_ast_expr *isl_ast_expr_from_id(
9134 __isl_take isl_id *id);
9135 __isl_give isl_ast_expr *isl_ast_expr_neg(
9136 __isl_take isl_ast_expr *expr);
9137 __isl_give isl_ast_expr *isl_ast_expr_address_of(
9138 __isl_take isl_ast_expr *expr);
9139 __isl_give isl_ast_expr *isl_ast_expr_add(
9140 __isl_take isl_ast_expr *expr1,
9141 __isl_take isl_ast_expr *expr2);
9142 __isl_give isl_ast_expr *isl_ast_expr_sub(
9143 __isl_take isl_ast_expr *expr1,
9144 __isl_take isl_ast_expr *expr2);
9145 __isl_give isl_ast_expr *isl_ast_expr_mul(
9146 __isl_take isl_ast_expr *expr1,
9147 __isl_take isl_ast_expr *expr2);
9148 __isl_give isl_ast_expr *isl_ast_expr_div(
9149 __isl_take isl_ast_expr *expr1,
9150 __isl_take isl_ast_expr *expr2);
9151 __isl_give isl_ast_expr *isl_ast_expr_pdiv_q(
9152 __isl_take isl_ast_expr *expr1,
9153 __isl_take isl_ast_expr *expr2);
9154 __isl_give isl_ast_expr *isl_ast_expr_pdiv_r(
9155 __isl_take isl_ast_expr *expr1,
9156 __isl_take isl_ast_expr *expr2);
9157 __isl_give isl_ast_expr *isl_ast_expr_and(
9158 __isl_take isl_ast_expr *expr1,
9159 __isl_take isl_ast_expr *expr2)
9160 __isl_give isl_ast_expr *isl_ast_expr_and_then(
9161 __isl_take isl_ast_expr *expr1,
9162 __isl_take isl_ast_expr *expr2)
9163 __isl_give isl_ast_expr *isl_ast_expr_or(
9164 __isl_take isl_ast_expr *expr1,
9165 __isl_take isl_ast_expr *expr2)
9166 __isl_give isl_ast_expr *isl_ast_expr_or_else(
9167 __isl_take isl_ast_expr *expr1,
9168 __isl_take isl_ast_expr *expr2)
9169 __isl_give isl_ast_expr *isl_ast_expr_eq(
9170 __isl_take isl_ast_expr *expr1,
9171 __isl_take isl_ast_expr *expr2);
9172 __isl_give isl_ast_expr *isl_ast_expr_le(
9173 __isl_take isl_ast_expr *expr1,
9174 __isl_take isl_ast_expr *expr2);
9175 __isl_give isl_ast_expr *isl_ast_expr_lt(
9176 __isl_take isl_ast_expr *expr1,
9177 __isl_take isl_ast_expr *expr2);
9178 __isl_give isl_ast_expr *isl_ast_expr_ge(
9179 __isl_take isl_ast_expr *expr1,
9180 __isl_take isl_ast_expr *expr2);
9181 __isl_give isl_ast_expr *isl_ast_expr_gt(
9182 __isl_take isl_ast_expr *expr1,
9183 __isl_take isl_ast_expr *expr2);
9184 __isl_give isl_ast_expr *isl_ast_expr_access(
9185 __isl_take isl_ast_expr *array,
9186 __isl_take isl_ast_expr_list *indices);
9187 __isl_give isl_ast_expr *isl_ast_expr_call(
9188 __isl_take isl_ast_expr *function,
9189 __isl_take isl_ast_expr_list *arguments);
9191 The function C<isl_ast_expr_address_of> can be applied to an
9192 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
9193 to represent the address of the C<isl_ast_expr_access>. The function
9194 C<isl_ast_expr_and_then> as well as C<isl_ast_expr_or_else> are short-circuit
9195 versions of C<isl_ast_expr_and> and C<isl_ast_expr_or>, respectively.
9197 #include <isl/ast_build.h>
9198 __isl_give isl_ast_expr *isl_ast_build_expr_from_set(
9199 __isl_keep isl_ast_build *build,
9200 __isl_take isl_set *set);
9201 __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
9202 __isl_keep isl_ast_build *build,
9203 __isl_take isl_pw_aff *pa);
9204 __isl_give isl_ast_expr *
9205 isl_ast_build_access_from_pw_multi_aff(
9206 __isl_keep isl_ast_build *build,
9207 __isl_take isl_pw_multi_aff *pma);
9208 __isl_give isl_ast_expr *
9209 isl_ast_build_access_from_multi_pw_aff(
9210 __isl_keep isl_ast_build *build,
9211 __isl_take isl_multi_pw_aff *mpa);
9212 __isl_give isl_ast_expr *
9213 isl_ast_build_call_from_pw_multi_aff(
9214 __isl_keep isl_ast_build *build,
9215 __isl_take isl_pw_multi_aff *pma);
9216 __isl_give isl_ast_expr *
9217 isl_ast_build_call_from_multi_pw_aff(
9218 __isl_keep isl_ast_build *build,
9219 __isl_take isl_multi_pw_aff *mpa);
9222 the domains of C<pa>, C<mpa> and C<pma> should correspond
9223 to the schedule space of C<build>.
9224 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
9225 the function being called.
9226 If the accessed space is a nested relation, then it is taken
9227 to represent an access of the member specified by the range
9228 of this nested relation of the structure specified by the domain
9229 of the nested relation.
9231 The following functions can be used to modify an C<isl_ast_expr>.
9233 #include <isl/ast.h>
9234 __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
9235 __isl_take isl_ast_expr *expr, int pos,
9236 __isl_take isl_ast_expr *arg);
9238 Replace the argument of C<expr> at position C<pos> by C<arg>.
9240 #include <isl/ast.h>
9241 __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
9242 __isl_take isl_ast_expr *expr,
9243 __isl_take isl_id_to_ast_expr *id2expr);
9245 The function C<isl_ast_expr_substitute_ids> replaces the
9246 subexpressions of C<expr> of type C<isl_ast_expr_id>
9247 by the corresponding expression in C<id2expr>, if there is any.
9250 User specified data can be attached to an C<isl_ast_node> and obtained
9251 from the same C<isl_ast_node> using the following functions.
9253 #include <isl/ast.h>
9254 __isl_give isl_ast_node *isl_ast_node_set_annotation(
9255 __isl_take isl_ast_node *node,
9256 __isl_take isl_id *annotation);
9257 __isl_give isl_id *isl_ast_node_get_annotation(
9258 __isl_keep isl_ast_node *node);
9260 Basic printing can be performed using the following functions.
9262 #include <isl/ast.h>
9263 __isl_give isl_printer *isl_printer_print_ast_expr(
9264 __isl_take isl_printer *p,
9265 __isl_keep isl_ast_expr *expr);
9266 __isl_give isl_printer *isl_printer_print_ast_node(
9267 __isl_take isl_printer *p,
9268 __isl_keep isl_ast_node *node);
9269 __isl_give char *isl_ast_expr_to_str(
9270 __isl_keep isl_ast_expr *expr);
9272 More advanced printing can be performed using the following functions.
9274 #include <isl/ast.h>
9275 __isl_give isl_printer *isl_ast_op_type_print_macro(
9276 enum isl_ast_op_type type,
9277 __isl_take isl_printer *p);
9278 __isl_give isl_printer *isl_ast_node_print_macros(
9279 __isl_keep isl_ast_node *node,
9280 __isl_take isl_printer *p);
9281 __isl_give isl_printer *isl_ast_node_print(
9282 __isl_keep isl_ast_node *node,
9283 __isl_take isl_printer *p,
9284 __isl_take isl_ast_print_options *options);
9285 __isl_give isl_printer *isl_ast_node_for_print(
9286 __isl_keep isl_ast_node *node,
9287 __isl_take isl_printer *p,
9288 __isl_take isl_ast_print_options *options);
9289 __isl_give isl_printer *isl_ast_node_if_print(
9290 __isl_keep isl_ast_node *node,
9291 __isl_take isl_printer *p,
9292 __isl_take isl_ast_print_options *options);
9294 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
9295 C<isl> may print out an AST that makes use of macros such
9296 as C<floord>, C<min> and C<max>.
9297 C<isl_ast_op_type_print_macro> prints out the macro
9298 corresponding to a specific C<isl_ast_op_type>.
9299 C<isl_ast_node_print_macros> scans the C<isl_ast_node>
9300 for expressions where these macros would be used and prints
9301 out the required macro definitions.
9302 Essentially, C<isl_ast_node_print_macros> calls
9303 C<isl_ast_node_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
9304 as function argument.
9305 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
9306 C<isl_ast_node_if_print> print an C<isl_ast_node>
9307 in C<ISL_FORMAT_C>, but allow for some extra control
9308 through an C<isl_ast_print_options> object.
9309 This object can be created using the following functions.
9311 #include <isl/ast.h>
9312 __isl_give isl_ast_print_options *
9313 isl_ast_print_options_alloc(isl_ctx *ctx);
9314 __isl_give isl_ast_print_options *
9315 isl_ast_print_options_copy(
9316 __isl_keep isl_ast_print_options *options);
9317 __isl_null isl_ast_print_options *
9318 isl_ast_print_options_free(
9319 __isl_take isl_ast_print_options *options);
9321 __isl_give isl_ast_print_options *
9322 isl_ast_print_options_set_print_user(
9323 __isl_take isl_ast_print_options *options,
9324 __isl_give isl_printer *(*print_user)(
9325 __isl_take isl_printer *p,
9326 __isl_take isl_ast_print_options *options,
9327 __isl_keep isl_ast_node *node, void *user),
9329 __isl_give isl_ast_print_options *
9330 isl_ast_print_options_set_print_for(
9331 __isl_take isl_ast_print_options *options,
9332 __isl_give isl_printer *(*print_for)(
9333 __isl_take isl_printer *p,
9334 __isl_take isl_ast_print_options *options,
9335 __isl_keep isl_ast_node *node, void *user),
9338 The callback set by C<isl_ast_print_options_set_print_user>
9339 is called whenever a node of type C<isl_ast_node_user> needs to
9341 The callback set by C<isl_ast_print_options_set_print_for>
9342 is called whenever a node of type C<isl_ast_node_for> needs to
9344 Note that C<isl_ast_node_for_print> will I<not> call the
9345 callback set by C<isl_ast_print_options_set_print_for> on the node
9346 on which C<isl_ast_node_for_print> is called, but only on nested
9347 nodes of type C<isl_ast_node_for>. It is therefore safe to
9348 call C<isl_ast_node_for_print> from within the callback set by
9349 C<isl_ast_print_options_set_print_for>.
9351 The following option determines the type to be used for iterators
9352 while printing the AST.
9354 isl_stat isl_options_set_ast_iterator_type(
9355 isl_ctx *ctx, const char *val);
9356 const char *isl_options_get_ast_iterator_type(
9359 The AST printer only prints body nodes as blocks if these
9360 blocks cannot be safely omitted.
9361 For example, a C<for> node with one body node will not be
9362 surrounded with braces in C<ISL_FORMAT_C>.
9363 A block will always be printed by setting the following option.
9365 isl_stat isl_options_set_ast_always_print_block(isl_ctx *ctx,
9367 int isl_options_get_ast_always_print_block(isl_ctx *ctx);
9371 #include <isl/ast_build.h>
9372 isl_stat isl_options_set_ast_build_atomic_upper_bound(
9373 isl_ctx *ctx, int val);
9374 int isl_options_get_ast_build_atomic_upper_bound(
9376 isl_stat isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
9378 int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
9379 isl_stat isl_options_set_ast_build_exploit_nested_bounds(
9380 isl_ctx *ctx, int val);
9381 int isl_options_get_ast_build_exploit_nested_bounds(
9383 isl_stat isl_options_set_ast_build_group_coscheduled(
9384 isl_ctx *ctx, int val);
9385 int isl_options_get_ast_build_group_coscheduled(
9387 isl_stat isl_options_set_ast_build_scale_strides(
9388 isl_ctx *ctx, int val);
9389 int isl_options_get_ast_build_scale_strides(
9391 isl_stat isl_options_set_ast_build_allow_else(isl_ctx *ctx,
9393 int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
9394 isl_stat isl_options_set_ast_build_allow_or(isl_ctx *ctx,
9396 int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
9400 =item * ast_build_atomic_upper_bound
9402 Generate loop upper bounds that consist of the current loop iterator,
9403 an operator and an expression not involving the iterator.
9404 If this option is not set, then the current loop iterator may appear
9405 several times in the upper bound.
9406 For example, when this option is turned off, AST generation
9409 [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
9413 for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
9416 When the option is turned on, the following AST is generated
9418 for (int c0 = 0; c0 <= min(100, n); c0 += 1)
9421 =item * ast_build_prefer_pdiv
9423 If this option is turned off, then the AST generation will
9424 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
9425 operators, but no C<isl_ast_op_pdiv_q> or
9426 C<isl_ast_op_pdiv_r> operators.
9427 If this options is turned on, then C<isl> will try to convert
9428 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
9429 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
9431 =item * ast_build_exploit_nested_bounds
9433 Simplify conditions based on bounds of nested for loops.
9434 In particular, remove conditions that are implied by the fact
9435 that one or more nested loops have at least one iteration,
9436 meaning that the upper bound is at least as large as the lower bound.
9437 For example, when this option is turned off, AST generation
9440 [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
9446 for (int c0 = 0; c0 <= N; c0 += 1)
9447 for (int c1 = 0; c1 <= M; c1 += 1)
9450 When the option is turned on, the following AST is generated
9452 for (int c0 = 0; c0 <= N; c0 += 1)
9453 for (int c1 = 0; c1 <= M; c1 += 1)
9456 =item * ast_build_group_coscheduled
9458 If two domain elements are assigned the same schedule point, then
9459 they may be executed in any order and they may even appear in different
9460 loops. If this options is set, then the AST generator will make
9461 sure that coscheduled domain elements do not appear in separate parts
9462 of the AST. This is useful in case of nested AST generation
9463 if the outer AST generation is given only part of a schedule
9464 and the inner AST generation should handle the domains that are
9465 coscheduled by this initial part of the schedule together.
9466 For example if an AST is generated for a schedule
9468 { A[i] -> [0]; B[i] -> [0] }
9470 then the C<isl_ast_build_set_create_leaf> callback described
9471 below may get called twice, once for each domain.
9472 Setting this option ensures that the callback is only called once
9473 on both domains together.
9475 =item * ast_build_separation_bounds
9477 This option specifies which bounds to use during separation.
9478 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
9479 then all (possibly implicit) bounds on the current dimension will
9480 be used during separation.
9481 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
9482 then only those bounds that are explicitly available will
9483 be used during separation.
9485 =item * ast_build_scale_strides
9487 This option specifies whether the AST generator is allowed
9488 to scale down iterators of strided loops.
9490 =item * ast_build_allow_else
9492 This option specifies whether the AST generator is allowed
9493 to construct if statements with else branches.
9495 =item * ast_build_allow_or
9497 This option specifies whether the AST generator is allowed
9498 to construct if conditions with disjunctions.
9502 =head3 AST Generation Options (Schedule Tree)
9504 In case of AST construction from a schedule tree, the options
9505 that control how an AST is created from the individual schedule
9506 dimensions are stored in the band nodes of the tree
9507 (see L</"Schedule Trees">).
9509 In particular, a schedule dimension can be handled in four
9510 different ways, atomic, separate, unroll or the default.
9511 This loop AST generation type can be set using
9512 C<isl_schedule_node_band_member_set_ast_loop_type>.
9514 the first three can be selected by including a one-dimensional
9515 element with as value the position of the schedule dimension
9516 within the band and as name one of C<atomic>, C<separate>
9517 or C<unroll> in the options
9518 set by C<isl_schedule_node_band_set_ast_build_options>.
9519 Only one of these three may be specified for
9520 any given schedule dimension within a band node.
9521 If none of these is specified, then the default
9522 is used. The meaning of the options is as follows.
9528 When this option is specified, the AST generator will make
9529 sure that a given domains space only appears in a single
9530 loop at the specified level.
9532 For example, for the schedule tree
9534 domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
9536 schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
9537 options: "{ atomic[x] }"
9539 the following AST will be generated
9541 for (int c0 = 0; c0 <= 10; c0 += 1) {
9548 On the other hand, for the schedule tree
9550 domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
9552 schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
9553 options: "{ separate[x] }"
9555 the following AST will be generated
9559 for (int c0 = 1; c0 <= 9; c0 += 1) {
9566 If neither C<atomic> nor C<separate> is specified, then the AST generator
9567 may produce either of these two results or some intermediate form.
9571 When this option is specified, the AST generator will
9572 split the domain of the specified schedule dimension
9573 into pieces with a fixed set of statements for which
9574 instances need to be executed by the iterations in
9575 the schedule domain part. This option tends to avoid
9576 the generation of guards inside the corresponding loops.
9577 See also the C<atomic> option.
9581 When this option is specified, the AST generator will
9582 I<completely> unroll the corresponding schedule dimension.
9583 It is the responsibility of the user to ensure that such
9584 unrolling is possible.
9585 To obtain a partial unrolling, the user should apply an additional
9586 strip-mining to the schedule and fully unroll the inner schedule
9591 The C<isolate> option is a bit more involved. It allows the user
9592 to isolate a range of schedule dimension values from smaller and
9593 greater values. Additionally, the user may specify a different
9594 atomic/separate/unroll choice for the isolated part and the remaining
9595 parts. The typical use case of the C<isolate> option is to isolate
9596 full tiles from partial tiles.
9597 The part that needs to be isolated may depend on outer schedule dimensions.
9598 The option therefore needs to be able to reference those outer schedule
9599 dimensions. In particular, the space of the C<isolate> option is that
9600 of a wrapped map with as domain the flat product of all outer band nodes
9601 and as range the space of the current band node.
9602 The atomic/separate/unroll choice for the isolated part is determined
9603 by an option that lives in an unnamed wrapped space with as domain
9604 a zero-dimensional C<isolate> space and as range the regular
9605 C<atomic>, C<separate> or C<unroll> space.
9606 This option may also be set directly using
9607 C<isl_schedule_node_band_member_set_isolate_ast_loop_type>.
9608 The atomic/separate/unroll choice for the remaining part is determined
9609 by the regular C<atomic>, C<separate> or C<unroll> option.
9610 The use of the C<isolate> option causes any tree containing the node
9611 to be considered anchored.
9613 As an example, consider the isolation of full tiles from partial tiles
9614 in a tiling of a triangular domain. The original schedule is as follows.
9616 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
9618 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
9619 { A[i,j] -> [floor(j/10)] }, \
9620 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
9624 for (int c0 = 0; c0 <= 10; c0 += 1)
9625 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9626 for (int c2 = 10 * c0;
9627 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9628 for (int c3 = 10 * c1;
9629 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9632 Isolating the full tiles, we have the following input
9634 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
9636 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
9637 { A[i,j] -> [floor(j/10)] }, \
9638 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
9639 options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
9640 10a+9+10b+9 <= 100 }"
9645 for (int c0 = 0; c0 <= 8; c0 += 1) {
9646 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
9647 for (int c2 = 10 * c0;
9648 c2 <= 10 * c0 + 9; c2 += 1)
9649 for (int c3 = 10 * c1;
9650 c3 <= 10 * c1 + 9; c3 += 1)
9652 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
9653 for (int c2 = 10 * c0;
9654 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9655 for (int c3 = 10 * c1;
9656 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9659 for (int c0 = 9; c0 <= 10; c0 += 1)
9660 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9661 for (int c2 = 10 * c0;
9662 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9663 for (int c3 = 10 * c1;
9664 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9668 We may then additionally unroll the innermost loop of the isolated part
9670 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
9672 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
9673 { A[i,j] -> [floor(j/10)] }, \
9674 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
9675 options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
9676 10a+9+10b+9 <= 100; [isolate[] -> unroll[3]] }"
9681 for (int c0 = 0; c0 <= 8; c0 += 1) {
9682 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
9683 for (int c2 = 10 * c0; c2 <= 10 * c0 + 9; c2 += 1) {
9695 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
9696 for (int c2 = 10 * c0;
9697 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9698 for (int c3 = 10 * c1;
9699 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9702 for (int c0 = 9; c0 <= 10; c0 += 1)
9703 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9704 for (int c2 = 10 * c0;
9705 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9706 for (int c3 = 10 * c1;
9707 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9712 =head3 AST Generation Options (Schedule Map)
9714 In case of AST construction using
9715 C<isl_ast_build_node_from_schedule_map>, the options
9716 that control how an AST is created from the individual schedule
9717 dimensions are stored in the C<isl_ast_build>.
9718 They can be set using the following function.
9720 #include <isl/ast_build.h>
9721 __isl_give isl_ast_build *
9722 isl_ast_build_set_options(
9723 __isl_take isl_ast_build *control,
9724 __isl_take isl_union_map *options);
9726 The options are encoded in an C<isl_union_map>.
9727 The domain of this union relation refers to the schedule domain,
9728 i.e., the range of the schedule passed
9729 to C<isl_ast_build_node_from_schedule_map>.
9730 In the case of nested AST generation (see L</"Nested AST Generation">),
9731 the domain of C<options> should refer to the extra piece of the schedule.
9732 That is, it should be equal to the range of the wrapped relation in the
9733 range of the schedule.
9734 The range of the options can consist of elements in one or more spaces,
9735 the names of which determine the effect of the option.
9736 The values of the range typically also refer to the schedule dimension
9737 to which the option applies. In case of nested AST generation
9738 (see L</"Nested AST Generation">), these values refer to the position
9739 of the schedule dimension within the innermost AST generation.
9740 The constraints on the domain elements of
9741 the option should only refer to this dimension and earlier dimensions.
9742 We consider the following spaces.
9746 =item C<separation_class>
9748 B<This option has been deprecated. Use the isolate option on
9749 schedule trees instead.>
9751 This space is a wrapped relation between two one dimensional spaces.
9752 The input space represents the schedule dimension to which the option
9753 applies and the output space represents the separation class.
9754 While constructing a loop corresponding to the specified schedule
9755 dimension(s), the AST generator will try to generate separate loops
9756 for domain elements that are assigned different classes.
9757 If only some of the elements are assigned a class, then those elements
9758 that are not assigned any class will be treated as belonging to a class
9759 that is separate from the explicitly assigned classes.
9760 The typical use case for this option is to separate full tiles from
9762 The other options, described below, are applied after the separation
9765 As an example, consider the separation into full and partial tiles
9766 of a tiling of a triangular domain.
9767 Take, for example, the domain
9769 { A[i,j] : 0 <= i,j and i + j <= 100 }
9771 and a tiling into tiles of 10 by 10. The input to the AST generator
9772 is then the schedule
9774 { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
9777 Without any options, the following AST is generated
9779 for (int c0 = 0; c0 <= 10; c0 += 1)
9780 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9781 for (int c2 = 10 * c0;
9782 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
9784 for (int c3 = 10 * c1;
9785 c3 <= min(10 * c1 + 9, -c2 + 100);
9789 Separation into full and partial tiles can be obtained by assigning
9790 a class, say C<0>, to the full tiles. The full tiles are represented by those
9791 values of the first and second schedule dimensions for which there are
9792 values of the third and fourth dimensions to cover an entire tile.
9793 That is, we need to specify the following option
9795 { [a,b,c,d] -> separation_class[[0]->[0]] :
9796 exists b': 0 <= 10a,10b' and
9797 10a+9+10b'+9 <= 100;
9798 [a,b,c,d] -> separation_class[[1]->[0]] :
9799 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
9803 { [a, b, c, d] -> separation_class[[1] -> [0]] :
9804 a >= 0 and b >= 0 and b <= 8 - a;
9805 [a, b, c, d] -> separation_class[[0] -> [0]] :
9808 With this option, the generated AST is as follows
9811 for (int c0 = 0; c0 <= 8; c0 += 1) {
9812 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
9813 for (int c2 = 10 * c0;
9814 c2 <= 10 * c0 + 9; c2 += 1)
9815 for (int c3 = 10 * c1;
9816 c3 <= 10 * c1 + 9; c3 += 1)
9818 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
9819 for (int c2 = 10 * c0;
9820 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
9822 for (int c3 = 10 * c1;
9823 c3 <= min(-c2 + 100, 10 * c1 + 9);
9827 for (int c0 = 9; c0 <= 10; c0 += 1)
9828 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9829 for (int c2 = 10 * c0;
9830 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
9832 for (int c3 = 10 * c1;
9833 c3 <= min(10 * c1 + 9, -c2 + 100);
9840 This is a single-dimensional space representing the schedule dimension(s)
9841 to which ``separation'' should be applied. Separation tries to split
9842 a loop into several pieces if this can avoid the generation of guards
9844 See also the C<atomic> option.
9848 This is a single-dimensional space representing the schedule dimension(s)
9849 for which the domains should be considered ``atomic''. That is, the
9850 AST generator will make sure that any given domain space will only appear
9851 in a single loop at the specified level.
9853 Consider the following schedule
9855 { a[i] -> [i] : 0 <= i < 10;
9856 b[i] -> [i+1] : 0 <= i < 10 }
9858 If the following option is specified
9860 { [i] -> separate[x] }
9862 then the following AST will be generated
9866 for (int c0 = 1; c0 <= 9; c0 += 1) {
9873 If, on the other hand, the following option is specified
9875 { [i] -> atomic[x] }
9877 then the following AST will be generated
9879 for (int c0 = 0; c0 <= 10; c0 += 1) {
9886 If neither C<atomic> nor C<separate> is specified, then the AST generator
9887 may produce either of these two results or some intermediate form.
9891 This is a single-dimensional space representing the schedule dimension(s)
9892 that should be I<completely> unrolled.
9893 To obtain a partial unrolling, the user should apply an additional
9894 strip-mining to the schedule and fully unroll the inner loop.
9898 =head3 Fine-grained Control over AST Generation
9900 Besides specifying the constraints on the parameters,
9901 an C<isl_ast_build> object can be used to control
9902 various aspects of the AST generation process.
9903 In case of AST construction using
9904 C<isl_ast_build_node_from_schedule_map>,
9905 the most prominent way of control is through ``options'',
9908 Additional control is available through the following functions.
9910 #include <isl/ast_build.h>
9911 __isl_give isl_ast_build *
9912 isl_ast_build_set_iterators(
9913 __isl_take isl_ast_build *control,
9914 __isl_take isl_id_list *iterators);
9916 The function C<isl_ast_build_set_iterators> allows the user to
9917 specify a list of iterator C<isl_id>s to be used as iterators.
9918 If the input schedule is injective, then
9919 the number of elements in this list should be as large as the dimension
9920 of the schedule space, but no direct correspondence should be assumed
9921 between dimensions and elements.
9922 If the input schedule is not injective, then an additional number
9923 of C<isl_id>s equal to the largest dimension of the input domains
9925 If the number of provided C<isl_id>s is insufficient, then additional
9926 names are automatically generated.
9928 #include <isl/ast_build.h>
9929 __isl_give isl_ast_build *
9930 isl_ast_build_set_create_leaf(
9931 __isl_take isl_ast_build *control,
9932 __isl_give isl_ast_node *(*fn)(
9933 __isl_take isl_ast_build *build,
9934 void *user), void *user);
9937 C<isl_ast_build_set_create_leaf> function allows for the
9938 specification of a callback that should be called whenever the AST
9939 generator arrives at an element of the schedule domain.
9940 The callback should return an AST node that should be inserted
9941 at the corresponding position of the AST. The default action (when
9942 the callback is not set) is to continue generating parts of the AST to scan
9943 all the domain elements associated to the schedule domain element
9944 and to insert user nodes, ``calling'' the domain element, for each of them.
9945 The C<build> argument contains the current state of the C<isl_ast_build>.
9946 To ease nested AST generation (see L</"Nested AST Generation">),
9947 all control information that is
9948 specific to the current AST generation such as the options and
9949 the callbacks has been removed from this C<isl_ast_build>.
9950 The callback would typically return the result of a nested
9952 user defined node created using the following function.
9954 #include <isl/ast.h>
9955 __isl_give isl_ast_node *isl_ast_node_alloc_user(
9956 __isl_take isl_ast_expr *expr);
9958 #include <isl/ast_build.h>
9959 __isl_give isl_ast_build *
9960 isl_ast_build_set_at_each_domain(
9961 __isl_take isl_ast_build *build,
9962 __isl_give isl_ast_node *(*fn)(
9963 __isl_take isl_ast_node *node,
9964 __isl_keep isl_ast_build *build,
9965 void *user), void *user);
9966 __isl_give isl_ast_build *
9967 isl_ast_build_set_before_each_for(
9968 __isl_take isl_ast_build *build,
9969 __isl_give isl_id *(*fn)(
9970 __isl_keep isl_ast_build *build,
9971 void *user), void *user);
9972 __isl_give isl_ast_build *
9973 isl_ast_build_set_after_each_for(
9974 __isl_take isl_ast_build *build,
9975 __isl_give isl_ast_node *(*fn)(
9976 __isl_take isl_ast_node *node,
9977 __isl_keep isl_ast_build *build,
9978 void *user), void *user);
9979 __isl_give isl_ast_build *
9980 isl_ast_build_set_before_each_mark(
9981 __isl_take isl_ast_build *build,
9982 isl_stat (*fn)(__isl_keep isl_id *mark,
9983 __isl_keep isl_ast_build *build,
9984 void *user), void *user);
9985 __isl_give isl_ast_build *
9986 isl_ast_build_set_after_each_mark(
9987 __isl_take isl_ast_build *build,
9988 __isl_give isl_ast_node *(*fn)(
9989 __isl_take isl_ast_node *node,
9990 __isl_keep isl_ast_build *build,
9991 void *user), void *user);
9993 The callback set by C<isl_ast_build_set_at_each_domain> will
9994 be called for each domain AST node.
9995 The callbacks set by C<isl_ast_build_set_before_each_for>
9996 and C<isl_ast_build_set_after_each_for> will be called
9997 for each for AST node. The first will be called in depth-first
9998 pre-order, while the second will be called in depth-first post-order.
9999 Since C<isl_ast_build_set_before_each_for> is called before the for
10000 node is actually constructed, it is only passed an C<isl_ast_build>.
10001 The returned C<isl_id> will be added as an annotation (using
10002 C<isl_ast_node_set_annotation>) to the constructed for node.
10003 In particular, if the user has also specified an C<after_each_for>
10004 callback, then the annotation can be retrieved from the node passed to
10005 that callback using C<isl_ast_node_get_annotation>.
10006 The callbacks set by C<isl_ast_build_set_before_each_mark>
10007 and C<isl_ast_build_set_after_each_mark> will be called for each
10008 mark AST node that is created, i.e., for each mark schedule node
10009 in the input schedule tree. The first will be called in depth-first
10010 pre-order, while the second will be called in depth-first post-order.
10011 Since the callback set by C<isl_ast_build_set_before_each_mark>
10012 is called before the mark AST node is actually constructed, it is passed
10013 the identifier of the mark node.
10014 All callbacks should C<NULL> (or -1) on failure.
10015 The given C<isl_ast_build> can be used to create new
10016 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
10017 or C<isl_ast_build_call_from_pw_multi_aff>.
10019 =head3 Nested AST Generation
10021 C<isl> allows the user to create an AST within the context
10022 of another AST. These nested ASTs are created using the
10023 same C<isl_ast_build_node_from_schedule_map> function that is used to create
10024 the outer AST. The C<build> argument should be an C<isl_ast_build>
10025 passed to a callback set by
10026 C<isl_ast_build_set_create_leaf>.
10027 The space of the range of the C<schedule> argument should refer
10028 to this build. In particular, the space should be a wrapped
10029 relation and the domain of this wrapped relation should be the
10030 same as that of the range of the schedule returned by
10031 C<isl_ast_build_get_schedule> below.
10032 In practice, the new schedule is typically
10033 created by calling C<isl_union_map_range_product> on the old schedule
10034 and some extra piece of the schedule.
10035 The space of the schedule domain is also available from
10036 the C<isl_ast_build>.
10038 #include <isl/ast_build.h>
10039 __isl_give isl_union_map *isl_ast_build_get_schedule(
10040 __isl_keep isl_ast_build *build);
10041 __isl_give isl_space *isl_ast_build_get_schedule_space(
10042 __isl_keep isl_ast_build *build);
10043 __isl_give isl_ast_build *isl_ast_build_restrict(
10044 __isl_take isl_ast_build *build,
10045 __isl_take isl_set *set);
10047 The C<isl_ast_build_get_schedule> function returns a (partial)
10048 schedule for the domains elements for which part of the AST still needs to
10049 be generated in the current build.
10050 In particular, the domain elements are mapped to those iterations of the loops
10051 enclosing the current point of the AST generation inside which
10052 the domain elements are executed.
10053 No direct correspondence between
10054 the input schedule and this schedule should be assumed.
10055 The space obtained from C<isl_ast_build_get_schedule_space> can be used
10056 to create a set for C<isl_ast_build_restrict> to intersect
10057 with the current build. In particular, the set passed to
10058 C<isl_ast_build_restrict> can have additional parameters.
10059 The ids of the set dimensions in the space returned by
10060 C<isl_ast_build_get_schedule_space> correspond to the
10061 iterators of the already generated loops.
10062 The user should not rely on the ids of the output dimensions
10063 of the relations in the union relation returned by
10064 C<isl_ast_build_get_schedule> having any particular value.
10066 =head1 Applications
10068 Although C<isl> is mainly meant to be used as a library,
10069 it also contains some basic applications that use some
10070 of the functionality of C<isl>.
10071 The input may be specified in either the L<isl format>
10072 or the L<PolyLib format>.
10074 =head2 C<isl_polyhedron_sample>
10076 C<isl_polyhedron_sample> takes a polyhedron as input and prints
10077 an integer element of the polyhedron, if there is any.
10078 The first column in the output is the denominator and is always
10079 equal to 1. If the polyhedron contains no integer points,
10080 then a vector of length zero is printed.
10084 C<isl_pip> takes the same input as the C<example> program
10085 from the C<piplib> distribution, i.e., a set of constraints
10086 on the parameters, a line containing only -1 and finally a set
10087 of constraints on a parametric polyhedron.
10088 The coefficients of the parameters appear in the last columns
10089 (but before the final constant column).
10090 The output is the lexicographic minimum of the parametric polyhedron.
10091 As C<isl> currently does not have its own output format, the output
10092 is just a dump of the internal state.
10094 =head2 C<isl_polyhedron_minimize>
10096 C<isl_polyhedron_minimize> computes the minimum of some linear
10097 or affine objective function over the integer points in a polyhedron.
10098 If an affine objective function
10099 is given, then the constant should appear in the last column.
10101 =head2 C<isl_polytope_scan>
10103 Given a polytope, C<isl_polytope_scan> prints
10104 all integer points in the polytope.
10106 =head2 C<isl_codegen>
10108 Given a schedule, a context set and an options relation,
10109 C<isl_codegen> prints out an AST that scans the domain elements
10110 of the schedule in the order of their image(s) taking into account
10111 the constraints in the context set.