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 it 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 * The function C<isl_union_pw_multi_aff_add> now consistently
216 computes the sum on the shared definition domain.
217 The function C<isl_union_pw_multi_aff_union_add> has been added
218 to compute the sum on the union of definition domains.
219 The original behavior of C<isl_union_pw_multi_aff_add> was
220 confused and is no longer available.
222 =item * Band forests have been replaced by schedule trees.
224 =item * The function C<isl_union_map_compute_flow> has been
225 replaced by the function C<isl_union_access_info_compute_flow>.
226 Note that the may dependence relation returned by
227 C<isl_union_flow_get_may_dependence> is the union of
228 the two dependence relations returned by
229 C<isl_union_map_compute_flow>. Similarly for the no source relations.
230 The function C<isl_union_map_compute_flow> is still available
231 for backward compatibility, but it will be removed in the future.
233 =item * The function C<isl_basic_set_drop_constraint> has been
236 =item * The function C<isl_ast_build_ast_from_schedule> has been
237 renamed to C<isl_ast_build_node_from_schedule_map>.
238 The original name is still available
239 for backward compatibility, but it will be removed in the future.
241 =item * The C<separation_class> AST generation option has been
244 =item * The functions C<isl_equality_alloc> and C<isl_inequality_alloc>
245 have been renamed to C<isl_constraint_alloc_equality> and
246 C<isl_constraint_alloc_inequality>. The original names have been
247 kept for backward compatibility, but they will be removed in the future.
249 =item * The C<schedule_fuse> option has been replaced
250 by the C<schedule_serialize_sccs> option. The effect
251 of setting the C<schedule_fuse> option to C<ISL_SCHEDULE_FUSE_MIN>
252 is now obtained by turning on the C<schedule_serialize_sccs> option.
256 =head3 Changes since isl-0.17
260 =item * The function C<isl_printer_print_ast_expr> no longer prints
261 in C format by default. To print in C format, the output format
262 of the printer needs to have been explicitly set to C<ISL_FORMAT_C>.
263 As a result, the function C<isl_ast_expr_to_str> no longer prints
264 the expression in C format. Use C<isl_ast_expr_to_C_str> instead.
266 =item * The functions C<isl_set_align_divs> and C<isl_map_align_divs>
267 have been deprecated. The function C<isl_set_lift> has an effect
268 that is similar to C<isl_set_align_divs> and could in some cases
269 be used as an alternative.
273 =head3 Changes since isl-0.19
277 =item * Zero-dimensional objects of type C<isl_multi_pw_aff> or
278 C<isl_multi_union_pw_aff> can now keep track of an explicit domain.
279 This explicit domain, if present, is taken into account
280 by various operations that take such objects as input.
284 =head3 Changes since isl-0.20
288 =item * Several functions that used to return C<unsigned>
289 now return C<isl_size>. This means that these functions may
290 now return a negative value in case an error occurred.
291 The same holds for functions that used to return C<int>,
292 although some of those were already returning
293 a negative value in case of error.
295 =item * The C<isl_ast_op_type> enumeration type has been
296 renamed to C<isl_ast_expr_op_type>. The corresponding
297 enumeration constants have been similarly renamed.
298 The old names are defined to the new names for backward
301 =item * Several functions returning an extra boolean value
302 through an C<int *> argument now do so through an C<isl_bool *>
303 argument. The returned values are the same, only the type
304 of the pointer has been changed.
310 C<isl> is released under the MIT license.
314 Permission is hereby granted, free of charge, to any person obtaining a copy of
315 this software and associated documentation files (the "Software"), to deal in
316 the Software without restriction, including without limitation the rights to
317 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
318 of the Software, and to permit persons to whom the Software is furnished to do
319 so, subject to the following conditions:
321 The above copyright notice and this permission notice shall be included in all
322 copies or substantial portions of the Software.
324 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
325 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
326 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
327 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
328 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
329 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
334 Note that by default C<isl> requires C<GMP>, which is released
335 under the GNU Lesser General Public License (LGPL). This means
336 that code linked against C<isl> is also linked against LGPL code.
338 When configuring with C<--with-int=imath> or C<--with-int=imath-32>, C<isl>
339 will link against C<imath>, a library for exact integer arithmetic released
340 under the MIT license.
344 The source of C<isl> can be obtained either as a tarball
345 or from the git repository. Both are available from
346 L<http://isl.gforge.inria.fr/>.
347 The installation process depends on how you obtained
350 =head2 Installation from the git repository
354 =item 1 Clone or update the repository
356 The first time the source is obtained, you need to clone
359 git clone git://repo.or.cz/isl.git
361 To obtain updates, you need to pull in the latest changes
365 =item 2 Optionally get C<imath> submodule
367 To build C<isl> with C<imath>, you need to obtain the C<imath>
368 submodule by running in the git source tree of C<isl>
373 This will fetch the required version of C<imath> in a subdirectory of C<isl>.
375 =item 2 Generate C<configure>
381 After performing the above steps, continue
382 with the L<Common installation instructions>.
384 =head2 Common installation instructions
388 =item 1 Obtain C<GMP>
390 By default, building C<isl> requires C<GMP>, including its headers files.
391 Your distribution may not provide these header files by default
392 and you may need to install a package called C<gmp-devel> or something
393 similar. Alternatively, C<GMP> can be built from
394 source, available from L<http://gmplib.org/>.
395 C<GMP> is not needed if you build C<isl> with C<imath>.
399 C<isl> uses the standard C<autoconf> C<configure> script.
404 optionally followed by some configure options.
405 A complete list of options can be obtained by running
409 Below we discuss some of the more common options.
415 Installation prefix for C<isl>
417 =item C<--with-int=[gmp|imath|imath-32]>
419 Select the integer library to be used by C<isl>, the default is C<gmp>.
420 With C<imath-32>, C<isl> will use 32 bit integers, but fall back to C<imath>
421 for values out of the 32 bit range. In most applications, C<isl> will run
422 fastest with the C<imath-32> option, followed by C<gmp> and C<imath>, the
425 =item C<--with-gmp-prefix>
427 Installation prefix for C<GMP> (architecture-independent files).
429 =item C<--with-gmp-exec-prefix>
431 Installation prefix for C<GMP> (architecture-dependent files).
439 =item 4 Install (optional)
445 =head1 Integer Set Library
447 =head2 Memory Management
449 Since a high-level operation on isl objects usually involves
450 several substeps and since the user is usually not interested in
451 the intermediate results, most functions that return a new object
452 will also release all the objects passed as arguments.
453 If the user still wants to use one or more of these arguments
454 after the function call, she should pass along a copy of the
455 object rather than the object itself.
456 The user is then responsible for making sure that the original
457 object gets used somewhere else or is explicitly freed.
459 The arguments and return values of all documented functions are
460 annotated to make clear which arguments are released and which
461 arguments are preserved. In particular, the following annotations
468 C<__isl_give> means that a new object is returned.
469 The user should make sure that the returned pointer is
470 used exactly once as a value for an C<__isl_take> argument.
471 In between, it can be used as a value for as many
472 C<__isl_keep> arguments as the user likes.
473 There is one exception, and that is the case where the
474 pointer returned is C<NULL>. Is this case, the user
475 is free to use it as an C<__isl_take> argument or not.
476 When applied to a C<char *>, the returned pointer needs to be
481 C<__isl_null> means that a C<NULL> value is returned.
485 C<__isl_take> means that the object the argument points to
486 is taken over by the function and may no longer be used
487 by the user as an argument to any other function.
488 The pointer value must be one returned by a function
489 returning an C<__isl_give> pointer.
490 If the user passes in a C<NULL> value, then this will
491 be treated as an error in the sense that the function will
492 not perform its usual operation. However, it will still
493 make sure that all the other C<__isl_take> arguments
498 C<__isl_keep> means that the function will only use the object
499 temporarily. After the function has finished, the user
500 can still use it as an argument to other functions.
501 A C<NULL> value will be treated in the same way as
502 a C<NULL> value for an C<__isl_take> argument.
503 This annotation may also be used on return values of
504 type C<const char *>, in which case the returned pointer should
505 not be freed by the user and is only valid until the object
506 from which it was derived is updated or freed.
510 =head2 Initialization
512 All manipulations of integer sets and relations occur within
513 the context of an C<isl_ctx>.
514 A given C<isl_ctx> can only be used within a single thread.
515 All arguments of a function are required to have been allocated
516 within the same context.
517 There are currently no functions available for moving an object
518 from one C<isl_ctx> to another C<isl_ctx>. This means that
519 there is currently no way of safely moving an object from one
520 thread to another, unless the whole C<isl_ctx> is moved.
522 An C<isl_ctx> can be allocated using C<isl_ctx_alloc> and
523 freed using C<isl_ctx_free>.
524 All objects allocated within an C<isl_ctx> should be freed
525 before the C<isl_ctx> itself is freed.
527 isl_ctx *isl_ctx_alloc();
528 void isl_ctx_free(isl_ctx *ctx);
530 The user can impose a bound on the number of low-level I<operations>
531 that can be performed by an C<isl_ctx>. This bound can be set and
532 retrieved using the following functions. A bound of zero means that
533 no bound is imposed. The number of operations performed can be
534 reset using C<isl_ctx_reset_operations>. Note that the number
535 of low-level operations needed to perform a high-level computation
536 may differ significantly across different versions
537 of C<isl>, but it should be the same across different platforms
538 for the same version of C<isl>.
540 Warning: This feature is experimental. C<isl> has good support to abort and
541 bail out during the computation, but this feature may exercise error code paths
542 that are normally not used that much. Consequently, it is not unlikely that
543 hidden bugs will be exposed.
545 void isl_ctx_set_max_operations(isl_ctx *ctx,
546 unsigned long max_operations);
547 unsigned long isl_ctx_get_max_operations(isl_ctx *ctx);
548 void isl_ctx_reset_operations(isl_ctx *ctx);
550 In order to be able to create an object in the same context
551 as another object, most object types (described later in
552 this document) provide a function to obtain the context
553 in which the object was created.
556 isl_ctx *isl_val_get_ctx(__isl_keep isl_val *val);
557 isl_ctx *isl_multi_val_get_ctx(
558 __isl_keep isl_multi_val *mv);
561 isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
563 #include <isl/local_space.h>
564 isl_ctx *isl_local_space_get_ctx(
565 __isl_keep isl_local_space *ls);
568 isl_ctx *isl_set_list_get_ctx(
569 __isl_keep isl_set_list *list);
572 isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
573 isl_ctx *isl_multi_aff_get_ctx(
574 __isl_keep isl_multi_aff *maff);
575 isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pa);
576 isl_ctx *isl_pw_multi_aff_get_ctx(
577 __isl_keep isl_pw_multi_aff *pma);
578 isl_ctx *isl_multi_pw_aff_get_ctx(
579 __isl_keep isl_multi_pw_aff *mpa);
580 isl_ctx *isl_union_pw_aff_get_ctx(
581 __isl_keep isl_union_pw_aff *upa);
582 isl_ctx *isl_union_pw_multi_aff_get_ctx(
583 __isl_keep isl_union_pw_multi_aff *upma);
584 isl_ctx *isl_multi_union_pw_aff_get_ctx(
585 __isl_keep isl_multi_union_pw_aff *mupa);
587 #include <isl/id_to_ast_expr.h>
588 isl_ctx *isl_id_to_ast_expr_get_ctx(
589 __isl_keep isl_id_to_ast_expr *id2expr);
591 #include <isl/point.h>
592 isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
595 isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
598 isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
600 #include <isl/vertices.h>
601 isl_ctx *isl_vertices_get_ctx(
602 __isl_keep isl_vertices *vertices);
603 isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
604 isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
606 #include <isl/flow.h>
607 isl_ctx *isl_restriction_get_ctx(
608 __isl_keep isl_restriction *restr);
609 isl_ctx *isl_union_access_info_get_ctx(
610 __isl_keep isl_union_access_info *access);
611 isl_ctx *isl_union_flow_get_ctx(
612 __isl_keep isl_union_flow *flow);
614 #include <isl/schedule.h>
615 isl_ctx *isl_schedule_get_ctx(
616 __isl_keep isl_schedule *sched);
617 isl_ctx *isl_schedule_constraints_get_ctx(
618 __isl_keep isl_schedule_constraints *sc);
620 #include <isl/schedule_node.h>
621 isl_ctx *isl_schedule_node_get_ctx(
622 __isl_keep isl_schedule_node *node);
624 #include <isl/ast_build.h>
625 isl_ctx *isl_ast_build_get_ctx(
626 __isl_keep isl_ast_build *build);
629 isl_ctx *isl_ast_expr_get_ctx(
630 __isl_keep isl_ast_expr *expr);
631 isl_ctx *isl_ast_node_get_ctx(
632 __isl_keep isl_ast_node *node);
634 #include <isl/stride_info.h>
635 isl_ctx *isl_stride_info_get_ctx(
636 __isl_keep isl_stride_info *si);
638 #include <isl/fixed_box.h>
639 isl_ctx *isl_fixed_box_get_ctx(
640 __isl_keep isl_fixed_box *box);
644 C<isl> uses the special return type C<isl_size> for functions
645 that return a non-negative value, typically a number or a position.
646 Besides the regular non-negative return values, a special (negative)
647 value C<isl_size_error> may be returned, indicating that something
650 C<isl> also uses two special return types for functions that either return
651 a boolean or that in principle do not return anything.
652 In particular, the C<isl_bool> type has three possible values:
653 C<isl_bool_true> (a positive integer value), indicating I<true> or I<yes>;
654 C<isl_bool_false> (the integer value zero), indicating I<false> or I<no>; and
655 C<isl_bool_error> (a negative integer value), indicating that something
656 went wrong. The following operations are defined on C<isl_bool>. The function
657 C<isl_bool_not> can be used to negate an C<isl_bool>, where the negation of
658 C<isl_bool_error> is C<isl_bool_error> again. The function C<isl_bool_ok>
659 converts an integer to an C<isl_bool>. Any non-zero values yields
660 C<isl_bool_true> and zero yields C<isl_bool_false>.
663 isl_bool isl_bool_not(isl_bool b);
664 isl_bool isl_bool_ok(int b);
666 The C<isl_stat> type has two possible values:
667 C<isl_stat_ok> (the integer value zero), indicating a successful
669 C<isl_stat_error> (a negative integer value), indicating that something
671 See L</"Error Handling"> for more information on
672 C<isl_size_error>, C<isl_bool_error> and C<isl_stat_error>.
676 An C<isl_val> represents an integer value, a rational value
677 or one of three special values, infinity, negative infinity and NaN.
678 Some predefined values can be created using the following functions.
681 __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
682 __isl_give isl_val *isl_val_one(isl_ctx *ctx);
683 __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
684 __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
685 __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
686 __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
688 Specific integer values can be created using the following functions.
691 __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
693 __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
695 __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
696 size_t n, size_t size, const void *chunks);
698 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
699 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
700 The least significant digit is assumed to be stored first.
702 Value objects can be copied and freed using the following functions.
705 __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
706 __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
708 They can be inspected using the following functions.
711 long isl_val_get_num_si(__isl_keep isl_val *v);
712 long isl_val_get_den_si(__isl_keep isl_val *v);
713 __isl_give isl_val *isl_val_get_den_val(
714 __isl_keep isl_val *v);
715 double isl_val_get_d(__isl_keep isl_val *v);
716 isl_size isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
718 isl_stat isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
719 size_t size, void *chunks);
721 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
722 of C<size> bytes needed to store the absolute value of the
724 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
725 which is assumed to have been preallocated by the caller.
726 The least significant digit is stored first.
727 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
728 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
729 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
731 An C<isl_val> can be modified using the following function.
734 __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
737 The following unary properties are defined on C<isl_val>s.
740 int isl_val_sgn(__isl_keep isl_val *v);
741 isl_bool isl_val_is_zero(__isl_keep isl_val *v);
742 isl_bool isl_val_is_one(__isl_keep isl_val *v);
743 isl_bool isl_val_is_negone(__isl_keep isl_val *v);
744 isl_bool isl_val_is_nonneg(__isl_keep isl_val *v);
745 isl_bool isl_val_is_nonpos(__isl_keep isl_val *v);
746 isl_bool isl_val_is_pos(__isl_keep isl_val *v);
747 isl_bool isl_val_is_neg(__isl_keep isl_val *v);
748 isl_bool isl_val_is_int(__isl_keep isl_val *v);
749 isl_bool isl_val_is_rat(__isl_keep isl_val *v);
750 isl_bool isl_val_is_nan(__isl_keep isl_val *v);
751 isl_bool isl_val_is_infty(__isl_keep isl_val *v);
752 isl_bool isl_val_is_neginfty(__isl_keep isl_val *v);
754 Note that the sign of NaN is undefined.
756 The following binary properties are defined on pairs of C<isl_val>s.
759 isl_bool isl_val_lt(__isl_keep isl_val *v1,
760 __isl_keep isl_val *v2);
761 isl_bool isl_val_le(__isl_keep isl_val *v1,
762 __isl_keep isl_val *v2);
763 isl_bool isl_val_gt(__isl_keep isl_val *v1,
764 __isl_keep isl_val *v2);
765 isl_bool isl_val_ge(__isl_keep isl_val *v1,
766 __isl_keep isl_val *v2);
767 isl_bool isl_val_eq(__isl_keep isl_val *v1,
768 __isl_keep isl_val *v2);
769 isl_bool isl_val_ne(__isl_keep isl_val *v1,
770 __isl_keep isl_val *v2);
771 isl_bool isl_val_abs_eq(__isl_keep isl_val *v1,
772 __isl_keep isl_val *v2);
774 Comparisons to NaN always return false.
775 That is, a NaN is not considered to hold any relative position
776 with respect to any value. In particular, a NaN
777 is neither considered to be equal to nor to be different from
778 any value (including another NaN).
779 The function C<isl_val_abs_eq> checks whether its two arguments
780 are equal in absolute value.
782 For integer C<isl_val>s we additionally have the following binary property.
785 isl_bool isl_val_is_divisible_by(__isl_keep isl_val *v1,
786 __isl_keep isl_val *v2);
788 An C<isl_val> can also be compared to an integer using the following
789 functions. The result of C<isl_val_cmp_si> undefined for NaN.
792 isl_bool isl_val_gt_si(__isl_keep isl_val *v, long i);
793 int isl_val_cmp_si(__isl_keep isl_val *v, long i);
795 The following unary operations are available on C<isl_val>s.
798 __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
799 __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
800 __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
801 __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
802 __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
803 __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
805 The following binary operations are available on C<isl_val>s.
808 __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
809 __isl_take isl_val *v2);
810 __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
811 __isl_take isl_val *v2);
812 __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
813 __isl_take isl_val *v2);
814 __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
816 __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
817 __isl_take isl_val *v2);
818 __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
820 __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
821 __isl_take isl_val *v2);
822 __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
824 __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
825 __isl_take isl_val *v2);
826 __isl_give isl_val *isl_val_div_ui(__isl_take isl_val *v1,
829 On integer values, we additionally have the following operations.
832 __isl_give isl_val *isl_val_pow2(__isl_take isl_val *v);
833 __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
834 __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
835 __isl_take isl_val *v2);
836 __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
837 __isl_take isl_val *v2);
838 __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
839 __isl_take isl_val *v2, __isl_give isl_val **x,
840 __isl_give isl_val **y);
842 C<isl_val_2exp> is an alternative name for C<isl_val_pow2>.
843 The function C<isl_val_gcdext> returns the greatest common divisor g
844 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
845 that C<*x> * C<v1> + C<*y> * C<v2> = g.
847 =head3 GMP specific functions
849 These functions are only available if C<isl> has been compiled with C<GMP>
852 Specific integer and rational values can be created from C<GMP> values using
853 the following functions.
855 #include <isl/val_gmp.h>
856 __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
858 __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
859 const mpz_t n, const mpz_t d);
861 The numerator and denominator of a rational value can be extracted as
862 C<GMP> values using the following functions.
864 #include <isl/val_gmp.h>
865 int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
866 int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
868 =head2 Sets and Relations
870 C<isl> uses six types of objects for representing sets and relations,
871 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
872 C<isl_union_set> and C<isl_union_map>.
873 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
874 can be described as a conjunction of affine constraints, while
875 C<isl_set> and C<isl_map> represent unions of
876 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
877 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
878 to live in the same space. C<isl_union_set>s and C<isl_union_map>s
879 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
880 where spaces are considered different if they have a different number
881 of dimensions and/or different names (see L<"Spaces">).
882 The difference between sets and relations (maps) is that sets have
883 one set of variables, while relations have two sets of variables,
884 input variables and output variables.
886 =head2 Error Handling
888 C<isl> supports different ways to react in case a runtime error is triggered.
889 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
890 with two maps that have incompatible spaces. There are three possible ways
891 to react on error: to warn, to continue or to abort.
893 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
894 the last error in the corresponding C<isl_ctx> and the function in which the
895 error was triggered returns a value indicating that some error has
896 occurred. In case of functions returning a pointer, this value is
897 C<NULL>. In case of functions returning an C<isl_size>, C<isl_bool> or an
898 C<isl_stat>, this value is C<isl_size_error>,
899 C<isl_bool_error> or C<isl_stat_error>.
900 An error does not corrupt internal state,
901 such that isl can continue to be used. C<isl> also provides functions to
902 read the last error, including the specific error message,
903 the isl source file where the error occurred and the line number,
904 and to reset all information about the last error. The
905 last error is only stored for information purposes. Its presence does not
906 change the behavior of C<isl>. Hence, resetting an error is not required to
907 continue to use isl, but only to observe new errors.
910 enum isl_error isl_ctx_last_error(isl_ctx *ctx);
911 const char *isl_ctx_last_error_msg(isl_ctx *ctx);
912 const char *isl_ctx_last_error_file(isl_ctx *ctx);
913 int isl_ctx_last_error_line(isl_ctx *ctx);
914 void isl_ctx_reset_error(isl_ctx *ctx);
916 If no error has occurred since the last call to C<isl_ctx_reset_error>,
917 then the functions C<isl_ctx_last_error_msg> and
918 C<isl_ctx_last_error_file> return C<NULL>.
920 Another option is to continue on error. This is similar to warn on error mode,
921 except that C<isl> does not print any warning. This allows a program to
922 implement its own error reporting.
924 The last option is to directly abort the execution of the program from within
925 the isl library. This makes it obviously impossible to recover from an error,
926 but it allows to directly spot the error location. By aborting on error,
927 debuggers break at the location the error occurred and can provide a stack
928 trace. Other tools that automatically provide stack traces on abort or that do
929 not want to continue execution after an error was triggered may also prefer to
932 The on error behavior of isl can be specified by calling
933 C<isl_options_set_on_error> or by setting the command line option
934 C<--isl-on-error>. Valid arguments for the function call are
935 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
936 choices for the command line option are C<warn>, C<continue> and C<abort>.
937 It is also possible to query the current error mode.
939 #include <isl/options.h>
940 isl_stat isl_options_set_on_error(isl_ctx *ctx, int val);
941 int isl_options_get_on_error(isl_ctx *ctx);
945 Identifiers are used to identify both individual dimensions
946 and tuples of dimensions. They consist of an optional name and an optional
947 user pointer. The name and the user pointer cannot both be C<NULL>, however.
948 Identifiers with the same name but different pointer values
949 are considered to be distinct.
950 Similarly, identifiers with different names but the same pointer value
951 are also considered to be distinct.
952 Equal identifiers are represented using the same object.
953 Pairs of identifiers can therefore be tested for equality using the
955 Identifiers can be constructed, copied, freed, inspected and printed
956 using the following functions.
959 __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
960 __isl_keep const char *name, void *user);
961 __isl_give isl_id *isl_id_set_free_user(
962 __isl_take isl_id *id,
963 void (*free_user)(void *user));
964 __isl_give isl_id *isl_id_copy(isl_id *id);
965 __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
967 void *isl_id_get_user(__isl_keep isl_id *id);
968 __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
970 __isl_give isl_printer *isl_printer_print_id(
971 __isl_take isl_printer *p, __isl_keep isl_id *id);
973 The callback set by C<isl_id_set_free_user> is called on the user
974 pointer when the last reference to the C<isl_id> is freed.
975 Note that C<isl_id_get_name> returns a pointer to some internal
976 data structure, so the result can only be used while the
977 corresponding C<isl_id> is alive.
981 Whenever a new set, relation or similar object is created from scratch,
982 the space in which it lives needs to be specified using an C<isl_space>.
983 Each space involves zero or more parameters and zero, one or two
984 tuples of set or input/output dimensions. The parameters and dimensions
985 are identified by an C<isl_dim_type> and a position.
986 The type C<isl_dim_param> refers to parameters,
987 the type C<isl_dim_set> refers to set dimensions (for spaces
988 with a single tuple of dimensions) and the types C<isl_dim_in>
989 and C<isl_dim_out> refer to input and output dimensions
990 (for spaces with two tuples of dimensions).
991 Local spaces (see L</"Local Spaces">) also contain dimensions
992 of type C<isl_dim_div>.
993 Note that parameters are only identified by their position within
994 a given object. Across different objects, parameters are (usually)
995 identified by their names or identifiers. Only unnamed parameters
996 are identified by their positions across objects. The use of unnamed
997 parameters is discouraged.
999 #include <isl/space.h>
1000 __isl_give isl_space *isl_space_unit(isl_ctx *ctx);
1001 __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
1002 unsigned nparam, unsigned n_in, unsigned n_out);
1003 __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
1005 __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
1006 unsigned nparam, unsigned dim);
1007 __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
1008 __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
1010 The space used for creating a parameter domain
1011 needs to be created using C<isl_space_unit> or C<isl_space_params_alloc>.
1012 For other sets, the space
1013 needs to be created using C<isl_space_set_alloc>, while
1014 for a relation, the space
1015 needs to be created using C<isl_space_alloc>.
1016 The use of C<isl_space_params_alloc>,
1017 C<isl_space_set_alloc> and C<isl_space_alloc> is discouraged as they allow
1018 for the introduction of unnamed parameters.
1020 To check whether a given space is that of a set or a map
1021 or whether it is a parameter space, use these functions:
1023 #include <isl/space.h>
1024 isl_bool isl_space_is_params(__isl_keep isl_space *space);
1025 isl_bool isl_space_is_set(__isl_keep isl_space *space);
1026 isl_bool isl_space_is_map(__isl_keep isl_space *space);
1028 Spaces can be compared using the following functions:
1030 #include <isl/space.h>
1031 isl_bool isl_space_is_equal(__isl_keep isl_space *space1,
1032 __isl_keep isl_space *space2);
1033 isl_bool isl_space_has_equal_params(
1034 __isl_keep isl_space *space1,
1035 __isl_keep isl_space *space2);
1036 isl_bool isl_space_has_equal_tuples(
1037 __isl_keep isl_space *space1,
1038 __isl_keep isl_space *space2);
1039 isl_bool isl_space_is_domain(__isl_keep isl_space *space1,
1040 __isl_keep isl_space *space2);
1041 isl_bool isl_space_is_range(__isl_keep isl_space *space1,
1042 __isl_keep isl_space *space2);
1043 isl_bool isl_space_tuple_is_equal(
1044 __isl_keep isl_space *space1,
1045 enum isl_dim_type type1,
1046 __isl_keep isl_space *space2,
1047 enum isl_dim_type type2);
1049 C<isl_space_is_domain> checks whether the first argument is equal
1050 to the domain of the second argument. This requires in particular that
1051 the first argument is a set space and that the second argument
1052 is a map space. C<isl_space_tuple_is_equal> checks whether the given
1053 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
1054 spaces are the same. That is, it checks if they have the same
1055 identifier (if any), the same dimension and the same internal structure
1058 C<isl_space_has_equal_params> checks whether two spaces
1059 have the same parameters in the same order.
1060 C<isl_space_has_equal_tuples> check whether two spaces have
1061 the same tuples. In contrast to C<isl_space_is_equal> below,
1062 it does not check the
1063 parameters. This is useful because many C<isl> functions align the
1064 parameters before they perform their operations, such that equivalence
1066 C<isl_space_is_equal> checks whether two spaces are identical,
1067 meaning that they have the same parameters and the same tuples.
1068 That is, it checks whether both C<isl_space_has_equal_params> and
1069 C<isl_space_has_equal_tuples> hold.
1071 It is often useful to create objects that live in the
1072 same space as some other object. This can be accomplished
1073 by creating the new objects
1074 (see L</"Creating New Sets and Relations"> or
1075 L</"Functions">) based on the space
1076 of the original object.
1078 #include <isl/set.h>
1079 __isl_give isl_space *isl_basic_set_get_space(
1080 __isl_keep isl_basic_set *bset);
1081 __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
1083 #include <isl/union_set.h>
1084 __isl_give isl_space *isl_union_set_get_space(
1085 __isl_keep isl_union_set *uset);
1087 #include <isl/map.h>
1088 __isl_give isl_space *isl_basic_map_get_space(
1089 __isl_keep isl_basic_map *bmap);
1090 __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
1092 #include <isl/union_map.h>
1093 __isl_give isl_space *isl_union_map_get_space(
1094 __isl_keep isl_union_map *umap);
1096 #include <isl/constraint.h>
1097 __isl_give isl_space *isl_constraint_get_space(
1098 __isl_keep isl_constraint *constraint);
1100 #include <isl/polynomial.h>
1101 __isl_give isl_space *isl_qpolynomial_get_domain_space(
1102 __isl_keep isl_qpolynomial *qp);
1103 __isl_give isl_space *isl_qpolynomial_get_space(
1104 __isl_keep isl_qpolynomial *qp);
1105 __isl_give isl_space *
1106 isl_qpolynomial_fold_get_domain_space(
1107 __isl_keep isl_qpolynomial_fold *fold);
1108 __isl_give isl_space *isl_qpolynomial_fold_get_space(
1109 __isl_keep isl_qpolynomial_fold *fold);
1110 __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
1111 __isl_keep isl_pw_qpolynomial *pwqp);
1112 __isl_give isl_space *isl_pw_qpolynomial_get_space(
1113 __isl_keep isl_pw_qpolynomial *pwqp);
1114 __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
1115 __isl_keep isl_pw_qpolynomial_fold *pwf);
1116 __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
1117 __isl_keep isl_pw_qpolynomial_fold *pwf);
1118 __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
1119 __isl_keep isl_union_pw_qpolynomial *upwqp);
1120 __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
1121 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
1123 #include <isl/val.h>
1124 __isl_give isl_space *isl_multi_val_get_space(
1125 __isl_keep isl_multi_val *mv);
1127 #include <isl/aff.h>
1128 __isl_give isl_space *isl_aff_get_domain_space(
1129 __isl_keep isl_aff *aff);
1130 __isl_give isl_space *isl_aff_get_space(
1131 __isl_keep isl_aff *aff);
1132 __isl_give isl_space *isl_pw_aff_get_domain_space(
1133 __isl_keep isl_pw_aff *pwaff);
1134 __isl_give isl_space *isl_pw_aff_get_space(
1135 __isl_keep isl_pw_aff *pwaff);
1136 __isl_give isl_space *isl_multi_aff_get_domain_space(
1137 __isl_keep isl_multi_aff *maff);
1138 __isl_give isl_space *isl_multi_aff_get_space(
1139 __isl_keep isl_multi_aff *maff);
1140 __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
1141 __isl_keep isl_pw_multi_aff *pma);
1142 __isl_give isl_space *isl_pw_multi_aff_get_space(
1143 __isl_keep isl_pw_multi_aff *pma);
1144 __isl_give isl_space *isl_union_pw_aff_get_space(
1145 __isl_keep isl_union_pw_aff *upa);
1146 __isl_give isl_space *isl_union_pw_multi_aff_get_space(
1147 __isl_keep isl_union_pw_multi_aff *upma);
1148 __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
1149 __isl_keep isl_multi_pw_aff *mpa);
1150 __isl_give isl_space *isl_multi_pw_aff_get_space(
1151 __isl_keep isl_multi_pw_aff *mpa);
1152 __isl_give isl_space *
1153 isl_multi_union_pw_aff_get_domain_space(
1154 __isl_keep isl_multi_union_pw_aff *mupa);
1155 __isl_give isl_space *
1156 isl_multi_union_pw_aff_get_space(
1157 __isl_keep isl_multi_union_pw_aff *mupa);
1159 #include <isl/point.h>
1160 __isl_give isl_space *isl_point_get_space(
1161 __isl_keep isl_point *pnt);
1163 #include <isl/fixed_box.h>
1164 __isl_give isl_space *isl_fixed_box_get_space(
1165 __isl_keep isl_fixed_box *box);
1167 The number of dimensions of a given type of space
1168 may be read off from a space or an object that lives
1169 in a space using the following functions.
1170 In case of C<isl_space_dim>, type may be
1171 C<isl_dim_param>, C<isl_dim_in> (only for relations),
1172 C<isl_dim_out> (only for relations), C<isl_dim_set>
1173 (only for sets) or C<isl_dim_all>.
1175 #include <isl/space.h>
1176 isl_size isl_space_dim(__isl_keep isl_space *space,
1177 enum isl_dim_type type);
1179 #include <isl/local_space.h>
1180 isl_size isl_local_space_dim(__isl_keep isl_local_space *ls,
1181 enum isl_dim_type type);
1183 #include <isl/set.h>
1184 isl_size isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1185 enum isl_dim_type type);
1186 isl_size isl_set_dim(__isl_keep isl_set *set,
1187 enum isl_dim_type type);
1189 #include <isl/union_set.h>
1190 isl_size isl_union_set_dim(__isl_keep isl_union_set *uset,
1191 enum isl_dim_type type);
1193 #include <isl/map.h>
1194 isl_size isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1195 enum isl_dim_type type);
1196 isl_size isl_map_dim(__isl_keep isl_map *map,
1197 enum isl_dim_type type);
1199 #include <isl/union_map.h>
1200 isl_size isl_union_map_dim(__isl_keep isl_union_map *umap,
1201 enum isl_dim_type type);
1203 #include <isl/val.h>
1204 isl_size isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1205 enum isl_dim_type type);
1207 #include <isl/aff.h>
1208 isl_size isl_aff_dim(__isl_keep isl_aff *aff,
1209 enum isl_dim_type type);
1210 isl_size isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1211 enum isl_dim_type type);
1212 isl_size isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1213 enum isl_dim_type type);
1214 isl_size isl_pw_multi_aff_dim(
1215 __isl_keep isl_pw_multi_aff *pma,
1216 enum isl_dim_type type);
1217 isl_size isl_multi_pw_aff_dim(
1218 __isl_keep isl_multi_pw_aff *mpa,
1219 enum isl_dim_type type);
1220 isl_size isl_union_pw_aff_dim(
1221 __isl_keep isl_union_pw_aff *upa,
1222 enum isl_dim_type type);
1223 isl_size isl_union_pw_multi_aff_dim(
1224 __isl_keep isl_union_pw_multi_aff *upma,
1225 enum isl_dim_type type);
1226 isl_size isl_multi_union_pw_aff_dim(
1227 __isl_keep isl_multi_union_pw_aff *mupa,
1228 enum isl_dim_type type);
1230 #include <isl/polynomial.h>
1231 isl_size isl_union_pw_qpolynomial_dim(
1232 __isl_keep isl_union_pw_qpolynomial *upwqp,
1233 enum isl_dim_type type);
1234 isl_size isl_union_pw_qpolynomial_fold_dim(
1235 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1236 enum isl_dim_type type);
1238 Note that an C<isl_union_set>, an C<isl_union_map>,
1239 an C<isl_union_pw_multi_aff>,
1240 an C<isl_union_pw_qpolynomial> and
1241 an C<isl_union_pw_qpolynomial_fold>
1242 only have parameters.
1244 Additional parameters can be added to a space using the following function.
1246 #include <isl/space.h>
1247 __isl_give isl_space *isl_space_add_param_id(
1248 __isl_take isl_space *space,
1249 __isl_take isl_id *id);
1251 If a parameter with the given identifier already appears in the space,
1252 then it is not added again.
1254 Conversely, all parameters can be removed from a space
1255 using the following function.
1257 #include <isl/space.h>
1258 __isl_give isl_space *isl_space_drop_all_params(
1259 __isl_take isl_space *space);
1261 The identifiers or names of the individual dimensions of spaces
1262 may be set or read off using the following functions on spaces
1263 or objects that live in spaces.
1264 These functions are mostly useful to obtain the identifiers, positions
1265 or names of the parameters. Identifiers of individual dimensions are
1266 essentially only useful for printing. They are ignored by all other
1267 operations and may not be preserved across those operations.
1269 #include <isl/space.h>
1270 __isl_give isl_space *isl_space_set_dim_id(
1271 __isl_take isl_space *space,
1272 enum isl_dim_type type, unsigned pos,
1273 __isl_take isl_id *id);
1274 isl_bool isl_space_has_dim_id(__isl_keep isl_space *space,
1275 enum isl_dim_type type, unsigned pos);
1276 __isl_give isl_id *isl_space_get_dim_id(
1277 __isl_keep isl_space *space,
1278 enum isl_dim_type type, unsigned pos);
1279 __isl_give isl_space *isl_space_set_dim_name(
1280 __isl_take isl_space *space,
1281 enum isl_dim_type type, unsigned pos,
1282 __isl_keep const char *name);
1283 isl_bool isl_space_has_dim_name(__isl_keep isl_space *space,
1284 enum isl_dim_type type, unsigned pos);
1285 __isl_keep const char *isl_space_get_dim_name(
1286 __isl_keep isl_space *space,
1287 enum isl_dim_type type, unsigned pos);
1289 #include <isl/local_space.h>
1290 __isl_give isl_local_space *isl_local_space_set_dim_id(
1291 __isl_take isl_local_space *ls,
1292 enum isl_dim_type type, unsigned pos,
1293 __isl_take isl_id *id);
1294 isl_bool isl_local_space_has_dim_id(
1295 __isl_keep isl_local_space *ls,
1296 enum isl_dim_type type, unsigned pos);
1297 __isl_give isl_id *isl_local_space_get_dim_id(
1298 __isl_keep isl_local_space *ls,
1299 enum isl_dim_type type, unsigned pos);
1300 __isl_give isl_local_space *isl_local_space_set_dim_name(
1301 __isl_take isl_local_space *ls,
1302 enum isl_dim_type type, unsigned pos, const char *s);
1303 isl_bool isl_local_space_has_dim_name(
1304 __isl_keep isl_local_space *ls,
1305 enum isl_dim_type type, unsigned pos)
1306 const char *isl_local_space_get_dim_name(
1307 __isl_keep isl_local_space *ls,
1308 enum isl_dim_type type, unsigned pos);
1310 #include <isl/constraint.h>
1311 const char *isl_constraint_get_dim_name(
1312 __isl_keep isl_constraint *constraint,
1313 enum isl_dim_type type, unsigned pos);
1315 #include <isl/set.h>
1316 __isl_give isl_id *isl_basic_set_get_dim_id(
1317 __isl_keep isl_basic_set *bset,
1318 enum isl_dim_type type, unsigned pos);
1319 __isl_give isl_set *isl_set_set_dim_id(
1320 __isl_take isl_set *set, enum isl_dim_type type,
1321 unsigned pos, __isl_take isl_id *id);
1322 isl_bool isl_set_has_dim_id(__isl_keep isl_set *set,
1323 enum isl_dim_type type, unsigned pos);
1324 __isl_give isl_id *isl_set_get_dim_id(
1325 __isl_keep isl_set *set, enum isl_dim_type type,
1327 const char *isl_basic_set_get_dim_name(
1328 __isl_keep isl_basic_set *bset,
1329 enum isl_dim_type type, unsigned pos);
1330 isl_bool isl_set_has_dim_name(__isl_keep isl_set *set,
1331 enum isl_dim_type type, unsigned pos);
1332 const char *isl_set_get_dim_name(
1333 __isl_keep isl_set *set,
1334 enum isl_dim_type type, unsigned pos);
1336 #include <isl/map.h>
1337 __isl_give isl_map *isl_map_set_dim_id(
1338 __isl_take isl_map *map, enum isl_dim_type type,
1339 unsigned pos, __isl_take isl_id *id);
1340 isl_bool isl_basic_map_has_dim_id(
1341 __isl_keep isl_basic_map *bmap,
1342 enum isl_dim_type type, unsigned pos);
1343 isl_bool isl_map_has_dim_id(__isl_keep isl_map *map,
1344 enum isl_dim_type type, unsigned pos);
1345 __isl_give isl_id *isl_map_get_dim_id(
1346 __isl_keep isl_map *map, enum isl_dim_type type,
1348 __isl_give isl_id *isl_union_map_get_dim_id(
1349 __isl_keep isl_union_map *umap,
1350 enum isl_dim_type type, unsigned pos);
1351 const char *isl_basic_map_get_dim_name(
1352 __isl_keep isl_basic_map *bmap,
1353 enum isl_dim_type type, unsigned pos);
1354 isl_bool isl_map_has_dim_name(__isl_keep isl_map *map,
1355 enum isl_dim_type type, unsigned pos);
1356 const char *isl_map_get_dim_name(
1357 __isl_keep isl_map *map,
1358 enum isl_dim_type type, unsigned pos);
1360 #include <isl/val.h>
1361 __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1362 __isl_take isl_multi_val *mv,
1363 enum isl_dim_type type, unsigned pos,
1364 __isl_take isl_id *id);
1365 __isl_give isl_id *isl_multi_val_get_dim_id(
1366 __isl_keep isl_multi_val *mv,
1367 enum isl_dim_type type, unsigned pos);
1368 __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1369 __isl_take isl_multi_val *mv,
1370 enum isl_dim_type type, unsigned pos, const char *s);
1372 #include <isl/aff.h>
1373 __isl_give isl_aff *isl_aff_set_dim_id(
1374 __isl_take isl_aff *aff, enum isl_dim_type type,
1375 unsigned pos, __isl_take isl_id *id);
1376 __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1377 __isl_take isl_multi_aff *maff,
1378 enum isl_dim_type type, unsigned pos,
1379 __isl_take isl_id *id);
1380 __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1381 __isl_take isl_pw_aff *pma,
1382 enum isl_dim_type type, unsigned pos,
1383 __isl_take isl_id *id);
1384 __isl_give isl_multi_pw_aff *
1385 isl_multi_pw_aff_set_dim_id(
1386 __isl_take isl_multi_pw_aff *mpa,
1387 enum isl_dim_type type, unsigned pos,
1388 __isl_take isl_id *id);
1389 __isl_give isl_multi_union_pw_aff *
1390 isl_multi_union_pw_aff_set_dim_id(
1391 __isl_take isl_multi_union_pw_aff *mupa,
1392 enum isl_dim_type type, unsigned pos,
1393 __isl_take isl_id *id);
1394 __isl_give isl_id *isl_multi_aff_get_dim_id(
1395 __isl_keep isl_multi_aff *ma,
1396 enum isl_dim_type type, unsigned pos);
1397 isl_bool isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1398 enum isl_dim_type type, unsigned pos);
1399 __isl_give isl_id *isl_pw_aff_get_dim_id(
1400 __isl_keep isl_pw_aff *pa,
1401 enum isl_dim_type type, unsigned pos);
1402 __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1403 __isl_keep isl_pw_multi_aff *pma,
1404 enum isl_dim_type type, unsigned pos);
1405 __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1406 __isl_keep isl_multi_pw_aff *mpa,
1407 enum isl_dim_type type, unsigned pos);
1408 __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1409 __isl_keep isl_multi_union_pw_aff *mupa,
1410 enum isl_dim_type type, unsigned pos);
1411 __isl_give isl_aff *isl_aff_set_dim_name(
1412 __isl_take isl_aff *aff, enum isl_dim_type type,
1413 unsigned pos, const char *s);
1414 __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1415 __isl_take isl_multi_aff *maff,
1416 enum isl_dim_type type, unsigned pos, const char *s);
1417 __isl_give isl_multi_pw_aff *
1418 isl_multi_pw_aff_set_dim_name(
1419 __isl_take isl_multi_pw_aff *mpa,
1420 enum isl_dim_type type, unsigned pos, const char *s);
1421 __isl_give isl_union_pw_aff *
1422 isl_union_pw_aff_set_dim_name(
1423 __isl_take isl_union_pw_aff *upa,
1424 enum isl_dim_type type, unsigned pos,
1426 __isl_give isl_union_pw_multi_aff *
1427 isl_union_pw_multi_aff_set_dim_name(
1428 __isl_take isl_union_pw_multi_aff *upma,
1429 enum isl_dim_type type, unsigned pos,
1431 __isl_give isl_multi_union_pw_aff *
1432 isl_multi_union_pw_aff_set_dim_name(
1433 __isl_take isl_multi_union_pw_aff *mupa,
1434 enum isl_dim_type type, unsigned pos,
1435 const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1436 enum isl_dim_type type, unsigned pos);
1437 const char *isl_pw_aff_get_dim_name(
1438 __isl_keep isl_pw_aff *pa,
1439 enum isl_dim_type type, unsigned pos);
1440 const char *isl_pw_multi_aff_get_dim_name(
1441 __isl_keep isl_pw_multi_aff *pma,
1442 enum isl_dim_type type, unsigned pos);
1444 #include <isl/polynomial.h>
1445 __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1446 __isl_take isl_qpolynomial *qp,
1447 enum isl_dim_type type, unsigned pos,
1449 __isl_give isl_pw_qpolynomial *
1450 isl_pw_qpolynomial_set_dim_name(
1451 __isl_take isl_pw_qpolynomial *pwqp,
1452 enum isl_dim_type type, unsigned pos,
1454 __isl_give isl_pw_qpolynomial_fold *
1455 isl_pw_qpolynomial_fold_set_dim_name(
1456 __isl_take isl_pw_qpolynomial_fold *pwf,
1457 enum isl_dim_type type, unsigned pos,
1459 __isl_give isl_union_pw_qpolynomial *
1460 isl_union_pw_qpolynomial_set_dim_name(
1461 __isl_take isl_union_pw_qpolynomial *upwqp,
1462 enum isl_dim_type type, unsigned pos,
1464 __isl_give isl_union_pw_qpolynomial_fold *
1465 isl_union_pw_qpolynomial_fold_set_dim_name(
1466 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1467 enum isl_dim_type type, unsigned pos,
1470 Note that C<isl_space_get_name> returns a pointer to some internal
1471 data structure, so the result can only be used while the
1472 corresponding C<isl_space> is alive.
1473 Also note that every function that operates on two sets or relations
1474 requires that both arguments have the same parameters. This also
1475 means that if one of the arguments has named parameters, then the
1476 other needs to have named parameters too and the names need to match.
1477 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1478 arguments may have different parameters (as long as they are named),
1479 in which case the result will have as parameters the union of the parameters of
1482 Given the identifier or name of a dimension (typically a parameter),
1483 its position can be obtained from the following functions.
1485 #include <isl/space.h>
1486 int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1487 enum isl_dim_type type, __isl_keep isl_id *id);
1488 int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1489 enum isl_dim_type type, const char *name);
1491 #include <isl/local_space.h>
1492 int isl_local_space_find_dim_by_name(
1493 __isl_keep isl_local_space *ls,
1494 enum isl_dim_type type, const char *name);
1496 #include <isl/val.h>
1497 int isl_multi_val_find_dim_by_id(
1498 __isl_keep isl_multi_val *mv,
1499 enum isl_dim_type type, __isl_keep isl_id *id);
1500 int isl_multi_val_find_dim_by_name(
1501 __isl_keep isl_multi_val *mv,
1502 enum isl_dim_type type, const char *name);
1504 #include <isl/set.h>
1505 int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1506 enum isl_dim_type type, __isl_keep isl_id *id);
1507 int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1508 enum isl_dim_type type, const char *name);
1510 #include <isl/map.h>
1511 int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1512 enum isl_dim_type type, __isl_keep isl_id *id);
1513 int isl_basic_map_find_dim_by_name(
1514 __isl_keep isl_basic_map *bmap,
1515 enum isl_dim_type type, const char *name);
1516 int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1517 enum isl_dim_type type, const char *name);
1518 int isl_union_map_find_dim_by_name(
1519 __isl_keep isl_union_map *umap,
1520 enum isl_dim_type type, const char *name);
1522 #include <isl/aff.h>
1523 int isl_multi_aff_find_dim_by_id(
1524 __isl_keep isl_multi_aff *ma,
1525 enum isl_dim_type type, __isl_keep isl_id *id);
1526 int isl_multi_pw_aff_find_dim_by_id(
1527 __isl_keep isl_multi_pw_aff *mpa,
1528 enum isl_dim_type type, __isl_keep isl_id *id);
1529 int isl_multi_union_pw_aff_find_dim_by_id(
1530 __isl_keep isl_union_multi_pw_aff *mupa,
1531 enum isl_dim_type type, __isl_keep isl_id *id);
1532 int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1533 enum isl_dim_type type, const char *name);
1534 int isl_multi_aff_find_dim_by_name(
1535 __isl_keep isl_multi_aff *ma,
1536 enum isl_dim_type type, const char *name);
1537 int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1538 enum isl_dim_type type, const char *name);
1539 int isl_multi_pw_aff_find_dim_by_name(
1540 __isl_keep isl_multi_pw_aff *mpa,
1541 enum isl_dim_type type, const char *name);
1542 int isl_pw_multi_aff_find_dim_by_name(
1543 __isl_keep isl_pw_multi_aff *pma,
1544 enum isl_dim_type type, const char *name);
1545 int isl_union_pw_aff_find_dim_by_name(
1546 __isl_keep isl_union_pw_aff *upa,
1547 enum isl_dim_type type, const char *name);
1548 int isl_union_pw_multi_aff_find_dim_by_name(
1549 __isl_keep isl_union_pw_multi_aff *upma,
1550 enum isl_dim_type type, const char *name);
1551 int isl_multi_union_pw_aff_find_dim_by_name(
1552 __isl_keep isl_multi_union_pw_aff *mupa,
1553 enum isl_dim_type type, const char *name);
1555 #include <isl/polynomial.h>
1556 int isl_pw_qpolynomial_find_dim_by_name(
1557 __isl_keep isl_pw_qpolynomial *pwqp,
1558 enum isl_dim_type type, const char *name);
1559 int isl_pw_qpolynomial_fold_find_dim_by_name(
1560 __isl_keep isl_pw_qpolynomial_fold *pwf,
1561 enum isl_dim_type type, const char *name);
1562 int isl_union_pw_qpolynomial_find_dim_by_name(
1563 __isl_keep isl_union_pw_qpolynomial *upwqp,
1564 enum isl_dim_type type, const char *name);
1565 int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1566 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1567 enum isl_dim_type type, const char *name);
1569 The identifiers or names of entire spaces may be set or read off
1570 using the following functions.
1572 #include <isl/space.h>
1573 __isl_give isl_space *isl_space_set_tuple_id(
1574 __isl_take isl_space *space,
1575 enum isl_dim_type type, __isl_take isl_id *id);
1576 __isl_give isl_space *isl_space_reset_tuple_id(
1577 __isl_take isl_space *space, enum isl_dim_type type);
1578 isl_bool isl_space_has_tuple_id(
1579 __isl_keep isl_space *space,
1580 enum isl_dim_type type);
1581 __isl_give isl_id *isl_space_get_tuple_id(
1582 __isl_keep isl_space *space, enum isl_dim_type type);
1583 __isl_give isl_space *isl_space_set_tuple_name(
1584 __isl_take isl_space *space,
1585 enum isl_dim_type type, const char *s);
1586 isl_bool isl_space_has_tuple_name(
1587 __isl_keep isl_space *space,
1588 enum isl_dim_type type);
1589 __isl_keep const char *isl_space_get_tuple_name(
1590 __isl_keep isl_space *space,
1591 enum isl_dim_type type);
1593 #include <isl/local_space.h>
1594 __isl_give isl_local_space *isl_local_space_set_tuple_id(
1595 __isl_take isl_local_space *ls,
1596 enum isl_dim_type type, __isl_take isl_id *id);
1598 #include <isl/set.h>
1599 __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1600 __isl_take isl_basic_set *bset,
1601 __isl_take isl_id *id);
1602 __isl_give isl_set *isl_set_set_tuple_id(
1603 __isl_take isl_set *set, __isl_take isl_id *id);
1604 __isl_give isl_set *isl_set_reset_tuple_id(
1605 __isl_take isl_set *set);
1606 isl_bool isl_set_has_tuple_id(__isl_keep isl_set *set);
1607 __isl_give isl_id *isl_set_get_tuple_id(
1608 __isl_keep isl_set *set);
1609 __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1610 __isl_take isl_basic_set *set, const char *s);
1611 __isl_give isl_set *isl_set_set_tuple_name(
1612 __isl_take isl_set *set, const char *s);
1613 const char *isl_basic_set_get_tuple_name(
1614 __isl_keep isl_basic_set *bset);
1615 isl_bool isl_set_has_tuple_name(__isl_keep isl_set *set);
1616 const char *isl_set_get_tuple_name(
1617 __isl_keep isl_set *set);
1619 #include <isl/map.h>
1620 __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1621 __isl_take isl_basic_map *bmap,
1622 enum isl_dim_type type, __isl_take isl_id *id);
1623 __isl_give isl_map *isl_map_set_tuple_id(
1624 __isl_take isl_map *map, enum isl_dim_type type,
1625 __isl_take isl_id *id);
1626 __isl_give isl_map *isl_map_reset_tuple_id(
1627 __isl_take isl_map *map, enum isl_dim_type type);
1628 isl_bool isl_map_has_tuple_id(__isl_keep isl_map *map,
1629 enum isl_dim_type type);
1630 __isl_give isl_id *isl_map_get_tuple_id(
1631 __isl_keep isl_map *map, enum isl_dim_type type);
1632 __isl_give isl_map *isl_map_set_tuple_name(
1633 __isl_take isl_map *map,
1634 enum isl_dim_type type, const char *s);
1635 const char *isl_basic_map_get_tuple_name(
1636 __isl_keep isl_basic_map *bmap,
1637 enum isl_dim_type type);
1638 __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1639 __isl_take isl_basic_map *bmap,
1640 enum isl_dim_type type, const char *s);
1641 isl_bool isl_map_has_tuple_name(__isl_keep isl_map *map,
1642 enum isl_dim_type type);
1643 const char *isl_map_get_tuple_name(
1644 __isl_keep isl_map *map,
1645 enum isl_dim_type type);
1647 #include <isl/val.h>
1648 __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1649 __isl_take isl_multi_val *mv,
1650 enum isl_dim_type type, __isl_take isl_id *id);
1651 __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1652 __isl_take isl_multi_val *mv,
1653 enum isl_dim_type type);
1654 isl_bool isl_multi_val_has_tuple_id(
1655 __isl_keep isl_multi_val *mv,
1656 enum isl_dim_type type);
1657 __isl_give isl_id *isl_multi_val_get_tuple_id(
1658 __isl_keep isl_multi_val *mv,
1659 enum isl_dim_type type);
1660 __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1661 __isl_take isl_multi_val *mv,
1662 enum isl_dim_type type, const char *s);
1663 const char *isl_multi_val_get_tuple_name(
1664 __isl_keep isl_multi_val *mv,
1665 enum isl_dim_type type);
1667 #include <isl/aff.h>
1668 __isl_give isl_aff *isl_aff_set_tuple_id(
1669 __isl_take isl_aff *aff,
1670 enum isl_dim_type type, __isl_take isl_id *id);
1671 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1672 __isl_take isl_multi_aff *maff,
1673 enum isl_dim_type type, __isl_take isl_id *id);
1674 __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1675 __isl_take isl_pw_aff *pwaff,
1676 enum isl_dim_type type, __isl_take isl_id *id);
1677 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1678 __isl_take isl_pw_multi_aff *pma,
1679 enum isl_dim_type type, __isl_take isl_id *id);
1680 __isl_give isl_multi_union_pw_aff *
1681 isl_multi_union_pw_aff_set_tuple_id(
1682 __isl_take isl_multi_union_pw_aff *mupa,
1683 enum isl_dim_type type, __isl_take isl_id *id);
1684 __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1685 __isl_take isl_multi_aff *ma,
1686 enum isl_dim_type type);
1687 __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1688 __isl_take isl_pw_aff *pa,
1689 enum isl_dim_type type);
1690 __isl_give isl_multi_pw_aff *
1691 isl_multi_pw_aff_reset_tuple_id(
1692 __isl_take isl_multi_pw_aff *mpa,
1693 enum isl_dim_type type);
1694 __isl_give isl_pw_multi_aff *
1695 isl_pw_multi_aff_reset_tuple_id(
1696 __isl_take isl_pw_multi_aff *pma,
1697 enum isl_dim_type type);
1698 __isl_give isl_multi_union_pw_aff *
1699 isl_multi_union_pw_aff_reset_tuple_id(
1700 __isl_take isl_multi_union_pw_aff *mupa,
1701 enum isl_dim_type type);
1702 isl_bool isl_multi_aff_has_tuple_id(
1703 __isl_keep isl_multi_aff *ma,
1704 enum isl_dim_type type);
1705 __isl_give isl_id *isl_multi_aff_get_tuple_id(
1706 __isl_keep isl_multi_aff *ma,
1707 enum isl_dim_type type);
1708 isl_bool isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1709 enum isl_dim_type type);
1710 __isl_give isl_id *isl_pw_aff_get_tuple_id(
1711 __isl_keep isl_pw_aff *pa,
1712 enum isl_dim_type type);
1713 isl_bool isl_pw_multi_aff_has_tuple_id(
1714 __isl_keep isl_pw_multi_aff *pma,
1715 enum isl_dim_type type);
1716 __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1717 __isl_keep isl_pw_multi_aff *pma,
1718 enum isl_dim_type type);
1719 isl_bool isl_multi_pw_aff_has_tuple_id(
1720 __isl_keep isl_multi_pw_aff *mpa,
1721 enum isl_dim_type type);
1722 __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1723 __isl_keep isl_multi_pw_aff *mpa,
1724 enum isl_dim_type type);
1725 isl_bool isl_multi_union_pw_aff_has_tuple_id(
1726 __isl_keep isl_multi_union_pw_aff *mupa,
1727 enum isl_dim_type type);
1728 __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1729 __isl_keep isl_multi_union_pw_aff *mupa,
1730 enum isl_dim_type type);
1731 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1732 __isl_take isl_multi_aff *maff,
1733 enum isl_dim_type type, const char *s);
1734 __isl_give isl_multi_pw_aff *
1735 isl_multi_pw_aff_set_tuple_name(
1736 __isl_take isl_multi_pw_aff *mpa,
1737 enum isl_dim_type type, const char *s);
1738 __isl_give isl_multi_union_pw_aff *
1739 isl_multi_union_pw_aff_set_tuple_name(
1740 __isl_take isl_multi_union_pw_aff *mupa,
1741 enum isl_dim_type type, const char *s);
1742 const char *isl_multi_aff_get_tuple_name(
1743 __isl_keep isl_multi_aff *multi,
1744 enum isl_dim_type type);
1745 isl_bool isl_pw_multi_aff_has_tuple_name(
1746 __isl_keep isl_pw_multi_aff *pma,
1747 enum isl_dim_type type);
1748 const char *isl_pw_multi_aff_get_tuple_name(
1749 __isl_keep isl_pw_multi_aff *pma,
1750 enum isl_dim_type type);
1751 const char *isl_multi_union_pw_aff_get_tuple_name(
1752 __isl_keep isl_multi_union_pw_aff *mupa,
1753 enum isl_dim_type type);
1755 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1756 or C<isl_dim_set>. As with C<isl_space_get_name>,
1757 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1759 Binary operations require the corresponding spaces of their arguments
1760 to have the same name.
1762 To keep the names of all parameters and tuples, but reset the user pointers
1763 of all the corresponding identifiers, use the following function.
1765 #include <isl/space.h>
1766 __isl_give isl_space *isl_space_reset_user(
1767 __isl_take isl_space *space);
1769 #include <isl/set.h>
1770 __isl_give isl_set *isl_set_reset_user(
1771 __isl_take isl_set *set);
1773 #include <isl/map.h>
1774 __isl_give isl_map *isl_map_reset_user(
1775 __isl_take isl_map *map);
1777 #include <isl/union_set.h>
1778 __isl_give isl_union_set *isl_union_set_reset_user(
1779 __isl_take isl_union_set *uset);
1781 #include <isl/union_map.h>
1782 __isl_give isl_union_map *isl_union_map_reset_user(
1783 __isl_take isl_union_map *umap);
1785 #include <isl/val.h>
1786 __isl_give isl_multi_val *isl_multi_val_reset_user(
1787 __isl_take isl_multi_val *mv);
1789 #include <isl/aff.h>
1790 __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1791 __isl_take isl_multi_aff *ma);
1792 __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1793 __isl_take isl_pw_aff *pa);
1794 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1795 __isl_take isl_multi_pw_aff *mpa);
1796 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1797 __isl_take isl_pw_multi_aff *pma);
1798 __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1799 __isl_take isl_union_pw_aff *upa);
1800 __isl_give isl_multi_union_pw_aff *
1801 isl_multi_union_pw_aff_reset_user(
1802 __isl_take isl_multi_union_pw_aff *mupa);
1803 __isl_give isl_union_pw_multi_aff *
1804 isl_union_pw_multi_aff_reset_user(
1805 __isl_take isl_union_pw_multi_aff *upma);
1807 #include <isl/polynomial.h>
1808 __isl_give isl_pw_qpolynomial *
1809 isl_pw_qpolynomial_reset_user(
1810 __isl_take isl_pw_qpolynomial *pwqp);
1811 __isl_give isl_union_pw_qpolynomial *
1812 isl_union_pw_qpolynomial_reset_user(
1813 __isl_take isl_union_pw_qpolynomial *upwqp);
1814 __isl_give isl_pw_qpolynomial_fold *
1815 isl_pw_qpolynomial_fold_reset_user(
1816 __isl_take isl_pw_qpolynomial_fold *pwf);
1817 __isl_give isl_union_pw_qpolynomial_fold *
1818 isl_union_pw_qpolynomial_fold_reset_user(
1819 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1821 Spaces can be nested. In particular, the domain of a set or
1822 the domain or range of a relation can be a nested relation.
1823 This process is also called I<wrapping>.
1824 The functions for detecting, constructing and deconstructing
1825 such nested spaces can be found in the wrapping properties
1826 of L</"Unary Properties">, the wrapping operations
1827 of L</"Unary Operations"> and the Cartesian product operations
1828 of L</"Basic Operations">.
1830 Spaces can be created from other spaces
1831 using the functions described in L</"Unary Operations">
1832 and L</"Binary Operations">.
1836 A local space is essentially a space with
1837 zero or more existentially quantified variables.
1838 The local space of various objects can be obtained
1839 using the following functions.
1841 #include <isl/constraint.h>
1842 __isl_give isl_local_space *isl_constraint_get_local_space(
1843 __isl_keep isl_constraint *constraint);
1845 #include <isl/set.h>
1846 __isl_give isl_local_space *isl_basic_set_get_local_space(
1847 __isl_keep isl_basic_set *bset);
1849 #include <isl/map.h>
1850 __isl_give isl_local_space *isl_basic_map_get_local_space(
1851 __isl_keep isl_basic_map *bmap);
1853 #include <isl/aff.h>
1854 __isl_give isl_local_space *isl_aff_get_domain_local_space(
1855 __isl_keep isl_aff *aff);
1856 __isl_give isl_local_space *isl_aff_get_local_space(
1857 __isl_keep isl_aff *aff);
1859 A new local space can be created from a space using
1861 #include <isl/local_space.h>
1862 __isl_give isl_local_space *isl_local_space_from_space(
1863 __isl_take isl_space *space);
1865 They can be inspected, modified, copied and freed using the following functions.
1867 #include <isl/local_space.h>
1868 isl_bool isl_local_space_is_params(
1869 __isl_keep isl_local_space *ls);
1870 isl_bool isl_local_space_is_set(
1871 __isl_keep isl_local_space *ls);
1872 __isl_give isl_space *isl_local_space_get_space(
1873 __isl_keep isl_local_space *ls);
1874 __isl_give isl_aff *isl_local_space_get_div(
1875 __isl_keep isl_local_space *ls, int pos);
1876 __isl_give isl_local_space *isl_local_space_copy(
1877 __isl_keep isl_local_space *ls);
1878 __isl_null isl_local_space *isl_local_space_free(
1879 __isl_take isl_local_space *ls);
1881 Note that C<isl_local_space_get_div> can only be used on local spaces
1884 Two local spaces can be compared using
1886 isl_bool isl_local_space_is_equal(
1887 __isl_keep isl_local_space *ls1,
1888 __isl_keep isl_local_space *ls2);
1890 Local spaces can be created from other local spaces
1891 using the functions described in L</"Unary Operations">
1892 and L</"Binary Operations">.
1894 =head2 Creating New Sets and Relations
1896 C<isl> has functions for creating some standard sets and relations.
1900 =item * Empty sets and relations
1902 __isl_give isl_basic_set *isl_basic_set_empty(
1903 __isl_take isl_space *space);
1904 __isl_give isl_basic_map *isl_basic_map_empty(
1905 __isl_take isl_space *space);
1906 __isl_give isl_set *isl_set_empty(
1907 __isl_take isl_space *space);
1908 __isl_give isl_map *isl_map_empty(
1909 __isl_take isl_space *space);
1910 __isl_give isl_union_set *isl_union_set_empty(
1911 __isl_take isl_space *space);
1912 __isl_give isl_union_map *isl_union_map_empty(
1913 __isl_take isl_space *space);
1915 For C<isl_union_set>s and C<isl_union_map>s, the space
1916 is only used to specify the parameters.
1918 =item * Universe sets and relations
1920 __isl_give isl_basic_set *isl_basic_set_universe(
1921 __isl_take isl_space *space);
1922 __isl_give isl_basic_map *isl_basic_map_universe(
1923 __isl_take isl_space *space);
1924 __isl_give isl_set *isl_set_universe(
1925 __isl_take isl_space *space);
1926 __isl_give isl_map *isl_map_universe(
1927 __isl_take isl_space *space);
1928 __isl_give isl_union_set *isl_union_set_universe(
1929 __isl_take isl_union_set *uset);
1930 __isl_give isl_union_map *isl_union_map_universe(
1931 __isl_take isl_union_map *umap);
1933 The sets and relations constructed by the functions above
1934 contain all integer values, while those constructed by the
1935 functions below only contain non-negative values.
1937 __isl_give isl_basic_set *isl_basic_set_nat_universe(
1938 __isl_take isl_space *space);
1939 __isl_give isl_basic_map *isl_basic_map_nat_universe(
1940 __isl_take isl_space *space);
1941 __isl_give isl_set *isl_set_nat_universe(
1942 __isl_take isl_space *space);
1943 __isl_give isl_map *isl_map_nat_universe(
1944 __isl_take isl_space *space);
1946 =item * Identity relations
1948 __isl_give isl_basic_map *isl_basic_map_identity(
1949 __isl_take isl_space *space);
1950 __isl_give isl_map *isl_map_identity(
1951 __isl_take isl_space *space);
1953 The number of input and output dimensions in C<space> needs
1956 =item * Lexicographic order
1958 __isl_give isl_map *isl_map_lex_lt(
1959 __isl_take isl_space *set_space);
1960 __isl_give isl_map *isl_map_lex_le(
1961 __isl_take isl_space *set_space);
1962 __isl_give isl_map *isl_map_lex_gt(
1963 __isl_take isl_space *set_space);
1964 __isl_give isl_map *isl_map_lex_ge(
1965 __isl_take isl_space *set_space);
1966 __isl_give isl_map *isl_map_lex_lt_first(
1967 __isl_take isl_space *space, unsigned n);
1968 __isl_give isl_map *isl_map_lex_le_first(
1969 __isl_take isl_space *space, unsigned n);
1970 __isl_give isl_map *isl_map_lex_gt_first(
1971 __isl_take isl_space *space, unsigned n);
1972 __isl_give isl_map *isl_map_lex_ge_first(
1973 __isl_take isl_space *space, unsigned n);
1975 The first four functions take a space for a B<set>
1976 and return relations that express that the elements in the domain
1977 are lexicographically less
1978 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1979 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1980 than the elements in the range.
1981 The last four functions take a space for a map
1982 and return relations that express that the first C<n> dimensions
1983 in the domain are lexicographically less
1984 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1985 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1986 than the first C<n> dimensions in the range.
1990 A basic set or relation can be converted to a set or relation
1991 using the following functions.
1993 __isl_give isl_set *isl_set_from_basic_set(
1994 __isl_take isl_basic_set *bset);
1995 __isl_give isl_map *isl_map_from_basic_map(
1996 __isl_take isl_basic_map *bmap);
1998 Sets and relations can be converted to union sets and relations
1999 using the following functions.
2001 __isl_give isl_union_set *isl_union_set_from_basic_set(
2002 __isl_take isl_basic_set *bset);
2003 __isl_give isl_union_map *isl_union_map_from_basic_map(
2004 __isl_take isl_basic_map *bmap);
2005 __isl_give isl_union_set *isl_union_set_from_set(
2006 __isl_take isl_set *set);
2007 __isl_give isl_union_map *isl_union_map_from_map(
2008 __isl_take isl_map *map);
2010 The inverse conversions below can only be used if the input
2011 union set or relation is known to contain elements in exactly one
2014 #include <isl/union_set.h>
2015 isl_bool isl_union_set_isa_set(
2016 __isl_keep isl_union_set *uset);
2017 __isl_give isl_set *isl_set_from_union_set(
2018 __isl_take isl_union_set *uset);
2020 #include <isl/union_map.h>
2021 isl_bool isl_union_map_isa_map(
2022 __isl_keep isl_union_map *umap);
2023 __isl_give isl_map *isl_map_from_union_map(
2024 __isl_take isl_union_map *umap);
2026 Sets and relations can be copied and freed again using the following
2029 __isl_give isl_basic_set *isl_basic_set_copy(
2030 __isl_keep isl_basic_set *bset);
2031 __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
2032 __isl_give isl_union_set *isl_union_set_copy(
2033 __isl_keep isl_union_set *uset);
2034 __isl_give isl_basic_map *isl_basic_map_copy(
2035 __isl_keep isl_basic_map *bmap);
2036 __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
2037 __isl_give isl_union_map *isl_union_map_copy(
2038 __isl_keep isl_union_map *umap);
2039 __isl_null isl_basic_set *isl_basic_set_free(
2040 __isl_take isl_basic_set *bset);
2041 __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
2042 __isl_null isl_union_set *isl_union_set_free(
2043 __isl_take isl_union_set *uset);
2044 __isl_null isl_basic_map *isl_basic_map_free(
2045 __isl_take isl_basic_map *bmap);
2046 __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
2047 __isl_null isl_union_map *isl_union_map_free(
2048 __isl_take isl_union_map *umap);
2050 Other sets and relations can be constructed by starting
2051 from a universe set or relation, adding equality and/or
2052 inequality constraints and then projecting out the
2053 existentially quantified variables, if any.
2054 Constraints can be constructed, manipulated and
2055 added to (or removed from) (basic) sets and relations
2056 using the following functions.
2058 #include <isl/constraint.h>
2059 __isl_give isl_constraint *isl_constraint_alloc_equality(
2060 __isl_take isl_local_space *ls);
2061 __isl_give isl_constraint *isl_constraint_alloc_inequality(
2062 __isl_take isl_local_space *ls);
2063 __isl_give isl_constraint *isl_constraint_set_constant_si(
2064 __isl_take isl_constraint *constraint, int v);
2065 __isl_give isl_constraint *isl_constraint_set_constant_val(
2066 __isl_take isl_constraint *constraint,
2067 __isl_take isl_val *v);
2068 __isl_give isl_constraint *isl_constraint_set_coefficient_si(
2069 __isl_take isl_constraint *constraint,
2070 enum isl_dim_type type, int pos, int v);
2071 __isl_give isl_constraint *
2072 isl_constraint_set_coefficient_val(
2073 __isl_take isl_constraint *constraint,
2074 enum isl_dim_type type, int pos,
2075 __isl_take isl_val *v);
2076 __isl_give isl_basic_map *isl_basic_map_add_constraint(
2077 __isl_take isl_basic_map *bmap,
2078 __isl_take isl_constraint *constraint);
2079 __isl_give isl_basic_set *isl_basic_set_add_constraint(
2080 __isl_take isl_basic_set *bset,
2081 __isl_take isl_constraint *constraint);
2082 __isl_give isl_map *isl_map_add_constraint(
2083 __isl_take isl_map *map,
2084 __isl_take isl_constraint *constraint);
2085 __isl_give isl_set *isl_set_add_constraint(
2086 __isl_take isl_set *set,
2087 __isl_take isl_constraint *constraint);
2089 For example, to create a set containing the even integers
2090 between 10 and 42, you would use the following code.
2093 isl_local_space *ls;
2095 isl_basic_set *bset;
2097 space = isl_space_set_alloc(ctx, 0, 2);
2098 bset = isl_basic_set_universe(isl_space_copy(space));
2099 ls = isl_local_space_from_space(space);
2101 c = isl_constraint_alloc_equality(isl_local_space_copy(ls));
2102 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
2103 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
2104 bset = isl_basic_set_add_constraint(bset, c);
2106 c = isl_constraint_alloc_inequality(isl_local_space_copy(ls));
2107 c = isl_constraint_set_constant_si(c, -10);
2108 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
2109 bset = isl_basic_set_add_constraint(bset, c);
2111 c = isl_constraint_alloc_inequality(ls);
2112 c = isl_constraint_set_constant_si(c, 42);
2113 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
2114 bset = isl_basic_set_add_constraint(bset, c);
2116 bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
2120 isl_basic_set *bset;
2121 bset = isl_basic_set_read_from_str(ctx,
2122 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
2124 A basic set or relation can also be constructed from two matrices
2125 describing the equalities and the inequalities.
2127 __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
2128 __isl_take isl_space *space,
2129 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
2130 enum isl_dim_type c1,
2131 enum isl_dim_type c2, enum isl_dim_type c3,
2132 enum isl_dim_type c4);
2133 __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
2134 __isl_take isl_space *space,
2135 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
2136 enum isl_dim_type c1,
2137 enum isl_dim_type c2, enum isl_dim_type c3,
2138 enum isl_dim_type c4, enum isl_dim_type c5);
2140 The C<isl_dim_type> arguments indicate the order in which
2141 different kinds of variables appear in the input matrices
2142 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
2143 C<isl_dim_set> and C<isl_dim_div> for sets and
2144 of C<isl_dim_cst>, C<isl_dim_param>,
2145 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
2147 A (basic or union) set or relation can also be constructed from a
2148 (union) (piecewise) (multiple) affine expression
2149 or a list of affine expressions
2150 (See L</"Functions">), provided these affine expressions do not
2153 #include <isl/set.h>
2154 __isl_give isl_basic_set *isl_basic_set_from_multi_aff(
2155 __isl_take isl_multi_aff *ma);
2156 __isl_give isl_set *isl_set_from_multi_aff(
2157 __isl_take isl_multi_aff *ma);
2159 #include <isl/map.h>
2160 __isl_give isl_basic_map *isl_basic_map_from_aff(
2161 __isl_take isl_aff *aff);
2162 __isl_give isl_map *isl_map_from_aff(
2163 __isl_take isl_aff *aff);
2164 __isl_give isl_basic_map *isl_basic_map_from_aff_list(
2165 __isl_take isl_space *domain_space,
2166 __isl_take isl_aff_list *list);
2167 __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
2168 __isl_take isl_multi_aff *maff)
2169 __isl_give isl_map *isl_map_from_multi_aff(
2170 __isl_take isl_multi_aff *maff)
2172 #include <isl/aff.h>
2173 __isl_give isl_set *isl_set_from_pw_aff(
2174 __isl_take isl_pw_aff *pwaff);
2175 __isl_give isl_map *isl_map_from_pw_aff(
2176 __isl_take isl_pw_aff *pwaff);
2177 __isl_give isl_set *isl_set_from_pw_multi_aff(
2178 __isl_take isl_pw_multi_aff *pma);
2179 __isl_give isl_map *isl_map_from_pw_multi_aff(
2180 __isl_take isl_pw_multi_aff *pma);
2181 __isl_give isl_set *isl_set_from_multi_pw_aff(
2182 __isl_take isl_multi_pw_aff *mpa);
2183 __isl_give isl_map *isl_map_from_multi_pw_aff(
2184 __isl_take isl_multi_pw_aff *mpa);
2185 __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
2186 __isl_take isl_union_pw_aff *upa);
2187 __isl_give isl_union_map *
2188 isl_union_map_from_union_pw_multi_aff(
2189 __isl_take isl_union_pw_multi_aff *upma);
2190 __isl_give isl_union_map *
2191 isl_union_map_from_multi_union_pw_aff(
2192 __isl_take isl_multi_union_pw_aff *mupa);
2194 The C<domain_space> argument describes the domain of the resulting
2195 basic relation. It is required because the C<list> may consist
2196 of zero affine expressions.
2197 The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
2198 is not allowed to be zero-dimensional. The domain of the result
2199 is the shared domain of the union piecewise affine elements.
2201 =head2 Inspecting Sets and Relations
2203 Usually, the user should not have to care about the actual constraints
2204 of the sets and maps, but should instead apply the abstract operations
2205 explained in the following sections.
2206 Occasionally, however, it may be required to inspect the individual
2207 coefficients of the constraints. This section explains how to do so.
2208 In these cases, it may also be useful to have C<isl> compute
2209 an explicit representation of the existentially quantified variables.
2211 __isl_give isl_set *isl_set_compute_divs(
2212 __isl_take isl_set *set);
2213 __isl_give isl_map *isl_map_compute_divs(
2214 __isl_take isl_map *map);
2215 __isl_give isl_union_set *isl_union_set_compute_divs(
2216 __isl_take isl_union_set *uset);
2217 __isl_give isl_union_map *isl_union_map_compute_divs(
2218 __isl_take isl_union_map *umap);
2220 This explicit representation defines the existentially quantified
2221 variables as integer divisions of the other variables, possibly
2222 including earlier existentially quantified variables.
2223 An explicitly represented existentially quantified variable therefore
2224 has a unique value when the values of the other variables are known.
2226 Alternatively, the existentially quantified variables can be removed
2227 using the following functions, which compute an overapproximation.
2229 #include <isl/set.h>
2230 __isl_give isl_basic_set *isl_basic_set_remove_divs(
2231 __isl_take isl_basic_set *bset);
2232 __isl_give isl_set *isl_set_remove_divs(
2233 __isl_take isl_set *set);
2235 #include <isl/map.h>
2236 __isl_give isl_basic_map *isl_basic_map_remove_divs(
2237 __isl_take isl_basic_map *bmap);
2238 __isl_give isl_map *isl_map_remove_divs(
2239 __isl_take isl_map *map);
2241 #include <isl/union_set.h>
2242 __isl_give isl_union_set *isl_union_set_remove_divs(
2243 __isl_take isl_union_set *bset);
2245 #include <isl/union_map.h>
2246 __isl_give isl_union_map *isl_union_map_remove_divs(
2247 __isl_take isl_union_map *bmap);
2249 It is also possible to only remove those divs that are defined
2250 in terms of a given range of dimensions or only those for which
2251 no explicit representation is known.
2253 __isl_give isl_basic_set *
2254 isl_basic_set_remove_divs_involving_dims(
2255 __isl_take isl_basic_set *bset,
2256 enum isl_dim_type type,
2257 unsigned first, unsigned n);
2258 __isl_give isl_basic_map *
2259 isl_basic_map_remove_divs_involving_dims(
2260 __isl_take isl_basic_map *bmap,
2261 enum isl_dim_type type,
2262 unsigned first, unsigned n);
2263 __isl_give isl_set *isl_set_remove_divs_involving_dims(
2264 __isl_take isl_set *set, enum isl_dim_type type,
2265 unsigned first, unsigned n);
2266 __isl_give isl_map *isl_map_remove_divs_involving_dims(
2267 __isl_take isl_map *map, enum isl_dim_type type,
2268 unsigned first, unsigned n);
2270 __isl_give isl_basic_set *
2271 isl_basic_set_remove_unknown_divs(
2272 __isl_take isl_basic_set *bset);
2273 __isl_give isl_set *isl_set_remove_unknown_divs(
2274 __isl_take isl_set *set);
2275 __isl_give isl_map *isl_map_remove_unknown_divs(
2276 __isl_take isl_map *map);
2278 To iterate over all the sets or maps in a union set or map, use
2280 #include <isl/union_set.h>
2281 isl_stat isl_union_set_foreach_set(
2282 __isl_keep isl_union_set *uset,
2283 isl_stat (*fn)(__isl_take isl_set *set, void *user),
2285 isl_bool isl_union_set_every_set(
2286 __isl_keep isl_union_set *uset,
2287 isl_bool (*test)(__isl_keep isl_set *set,
2291 #include <isl/union_map.h>
2292 isl_stat isl_union_map_foreach_map(
2293 __isl_keep isl_union_map *umap,
2294 isl_stat (*fn)(__isl_take isl_map *map, void *user),
2296 isl_bool isl_union_map_every_map(
2297 __isl_keep isl_union_map *umap,
2298 isl_bool (*test)(__isl_keep isl_map *map,
2302 These functions call the callback function once for each
2303 (pair of) space(s) for which there are elements in the input.
2304 The argument to the callback contains all elements in the input
2305 with that (pair of) space(s).
2306 The C<isl_union_set_every_set> and
2307 C<isl_union_map_every_map> variants check whether each
2308 call to the callback returns true and stops checking as soon as one
2309 of these calls returns false.
2311 The number of sets or maps in a union set or map can be obtained
2314 isl_size isl_union_set_n_set(__isl_keep isl_union_set *uset);
2315 isl_size isl_union_map_n_map(__isl_keep isl_union_map *umap);
2317 To extract the set or map in a given space from a union, use
2319 __isl_give isl_set *isl_union_set_extract_set(
2320 __isl_keep isl_union_set *uset,
2321 __isl_take isl_space *space);
2322 __isl_give isl_map *isl_union_map_extract_map(
2323 __isl_keep isl_union_map *umap,
2324 __isl_take isl_space *space);
2326 To iterate over all the basic sets or maps in a set or map, use
2328 isl_stat isl_set_foreach_basic_set(__isl_keep isl_set *set,
2329 isl_stat (*fn)(__isl_take isl_basic_set *bset,
2332 isl_stat isl_map_foreach_basic_map(__isl_keep isl_map *map,
2333 isl_stat (*fn)(__isl_take isl_basic_map *bmap,
2337 The callback function C<fn> should return C<isl_stat_ok> if successful and
2338 C<isl_stat_error> if an error occurs. In the latter case, or if any other error
2339 occurs, the above functions will return C<isl_stat_error>.
2341 It should be noted that C<isl> does not guarantee that
2342 the basic sets or maps passed to C<fn> are disjoint.
2343 If this is required, then the user should call one of
2344 the following functions first.
2346 __isl_give isl_set *isl_set_make_disjoint(
2347 __isl_take isl_set *set);
2348 __isl_give isl_map *isl_map_make_disjoint(
2349 __isl_take isl_map *map);
2351 The number of basic sets in a set can be obtained
2352 or the number of basic maps in a map can be obtained
2355 #include <isl/set.h>
2356 isl_size isl_set_n_basic_set(__isl_keep isl_set *set);
2358 #include <isl/map.h>
2359 isl_size isl_map_n_basic_map(__isl_keep isl_map *map);
2361 It is also possible to obtain a list of (basic) sets from a set
2362 or union set, a list of basic maps from a map and a list of maps from a union
2365 #include <isl/set.h>
2366 __isl_give isl_basic_set_list *isl_set_get_basic_set_list(
2367 __isl_keep isl_set *set);
2369 #include <isl/union_set.h>
2370 __isl_give isl_basic_set_list *
2371 isl_union_set_get_basic_set_list(
2372 __isl_keep isl_union_set *uset);
2373 __isl_give isl_set_list *isl_union_set_get_set_list(
2374 __isl_keep isl_union_set *uset);
2376 #include <isl/map.h>
2377 __isl_give isl_basic_map_list *isl_map_get_basic_map_list(
2378 __isl_keep isl_map *map);
2380 #include <isl/union_map.h>
2381 __isl_give isl_map_list *isl_union_map_get_map_list(
2382 __isl_keep isl_union_map *umap);
2384 The returned list can be manipulated using the functions in L<"Lists">.
2386 To iterate over the constraints of a basic set or map, use
2388 #include <isl/constraint.h>
2390 isl_size isl_basic_set_n_constraint(
2391 __isl_keep isl_basic_set *bset);
2392 isl_stat isl_basic_set_foreach_constraint(
2393 __isl_keep isl_basic_set *bset,
2394 isl_stat (*fn)(__isl_take isl_constraint *c,
2397 isl_size isl_basic_map_n_constraint(
2398 __isl_keep isl_basic_map *bmap);
2399 isl_stat isl_basic_map_foreach_constraint(
2400 __isl_keep isl_basic_map *bmap,
2401 isl_stat (*fn)(__isl_take isl_constraint *c,
2404 __isl_null isl_constraint *isl_constraint_free(
2405 __isl_take isl_constraint *c);
2407 Again, the callback function C<fn> should return C<isl_stat_ok>
2409 C<isl_stat_error> if an error occurs. In the latter case, or if any other error
2410 occurs, the above functions will return C<isl_stat_error>.
2411 The constraint C<c> represents either an equality or an inequality.
2412 Use the following function to find out whether a constraint
2413 represents an equality. If not, it represents an inequality.
2415 isl_bool isl_constraint_is_equality(
2416 __isl_keep isl_constraint *constraint);
2418 It is also possible to obtain a list of constraints from a basic
2421 #include <isl/constraint.h>
2422 __isl_give isl_constraint_list *
2423 isl_basic_map_get_constraint_list(
2424 __isl_keep isl_basic_map *bmap);
2425 __isl_give isl_constraint_list *
2426 isl_basic_set_get_constraint_list(
2427 __isl_keep isl_basic_set *bset);
2429 These functions require that all existentially quantified variables
2430 have an explicit representation.
2431 The returned list can be manipulated using the functions in L<"Lists">.
2433 The coefficients of the constraints can be inspected using
2434 the following functions.
2436 isl_bool isl_constraint_is_lower_bound(
2437 __isl_keep isl_constraint *constraint,
2438 enum isl_dim_type type, unsigned pos);
2439 isl_bool isl_constraint_is_upper_bound(
2440 __isl_keep isl_constraint *constraint,
2441 enum isl_dim_type type, unsigned pos);
2442 __isl_give isl_val *isl_constraint_get_constant_val(
2443 __isl_keep isl_constraint *constraint);
2444 __isl_give isl_val *isl_constraint_get_coefficient_val(
2445 __isl_keep isl_constraint *constraint,
2446 enum isl_dim_type type, int pos);
2448 The explicit representations of the existentially quantified
2449 variables can be inspected using the following function.
2450 Note that the user is only allowed to use this function
2451 if the inspected set or map is the result of a call
2452 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2453 The existentially quantified variable is equal to the floor
2454 of the returned affine expression. The affine expression
2455 itself can be inspected using the functions in
2458 __isl_give isl_aff *isl_constraint_get_div(
2459 __isl_keep isl_constraint *constraint, int pos);
2461 To obtain the constraints of a basic set or map in matrix
2462 form, use the following functions.
2464 __isl_give isl_mat *isl_basic_set_equalities_matrix(
2465 __isl_keep isl_basic_set *bset,
2466 enum isl_dim_type c1, enum isl_dim_type c2,
2467 enum isl_dim_type c3, enum isl_dim_type c4);
2468 __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2469 __isl_keep isl_basic_set *bset,
2470 enum isl_dim_type c1, enum isl_dim_type c2,
2471 enum isl_dim_type c3, enum isl_dim_type c4);
2472 __isl_give isl_mat *isl_basic_map_equalities_matrix(
2473 __isl_keep isl_basic_map *bmap,
2474 enum isl_dim_type c1,
2475 enum isl_dim_type c2, enum isl_dim_type c3,
2476 enum isl_dim_type c4, enum isl_dim_type c5);
2477 __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2478 __isl_keep isl_basic_map *bmap,
2479 enum isl_dim_type c1,
2480 enum isl_dim_type c2, enum isl_dim_type c3,
2481 enum isl_dim_type c4, enum isl_dim_type c5);
2483 The C<isl_dim_type> arguments dictate the order in which
2484 different kinds of variables appear in the resulting matrix.
2485 For set inputs, they should be a permutation of
2486 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2487 For map inputs, they should be a permutation of
2488 C<isl_dim_cst>, C<isl_dim_param>,
2489 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2493 Points are elements of a set. They can be used to construct
2494 simple sets (boxes) or they can be used to represent the
2495 individual elements of a set.
2496 The zero point (the origin) can be created using
2498 __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2500 The coordinates of a point can be inspected, set and changed
2503 __isl_give isl_val *isl_point_get_coordinate_val(
2504 __isl_keep isl_point *pnt,
2505 enum isl_dim_type type, int pos);
2506 __isl_give isl_point *isl_point_set_coordinate_val(
2507 __isl_take isl_point *pnt,
2508 enum isl_dim_type type, int pos,
2509 __isl_take isl_val *v);
2511 __isl_give isl_point *isl_point_add_ui(
2512 __isl_take isl_point *pnt,
2513 enum isl_dim_type type, int pos, unsigned val);
2514 __isl_give isl_point *isl_point_sub_ui(
2515 __isl_take isl_point *pnt,
2516 enum isl_dim_type type, int pos, unsigned val);
2518 Points can be copied or freed using
2520 __isl_give isl_point *isl_point_copy(
2521 __isl_keep isl_point *pnt);
2522 __isl_null isl_point *isl_point_free(
2523 __isl_take isl_point *pnt);
2525 A singleton set can be created from a point using
2527 __isl_give isl_basic_set *isl_basic_set_from_point(
2528 __isl_take isl_point *pnt);
2529 __isl_give isl_set *isl_set_from_point(
2530 __isl_take isl_point *pnt);
2531 __isl_give isl_union_set *isl_union_set_from_point(
2532 __isl_take isl_point *pnt);
2534 and a box can be created from two opposite extremal points using
2536 __isl_give isl_basic_set *isl_basic_set_box_from_points(
2537 __isl_take isl_point *pnt1,
2538 __isl_take isl_point *pnt2);
2539 __isl_give isl_set *isl_set_box_from_points(
2540 __isl_take isl_point *pnt1,
2541 __isl_take isl_point *pnt2);
2543 All elements of a B<bounded> (union) set can be enumerated using
2544 the following functions.
2546 isl_stat isl_set_foreach_point(__isl_keep isl_set *set,
2547 isl_stat (*fn)(__isl_take isl_point *pnt,
2550 isl_stat isl_union_set_foreach_point(
2551 __isl_keep isl_union_set *uset,
2552 isl_stat (*fn)(__isl_take isl_point *pnt,
2556 The function C<fn> is called for each integer point in
2557 C<set> with as second argument the last argument of
2558 the C<isl_set_foreach_point> call. The function C<fn>
2559 should return C<isl_stat_ok> on success and C<isl_stat_error> on failure.
2560 In the latter case, C<isl_set_foreach_point> will stop
2561 enumerating and return C<isl_stat_error> as well.
2562 If the enumeration is performed successfully and to completion,
2563 then C<isl_set_foreach_point> returns C<isl_stat_ok>.
2565 To obtain a single point of a (basic or union) set, use
2567 __isl_give isl_point *isl_basic_set_sample_point(
2568 __isl_take isl_basic_set *bset);
2569 __isl_give isl_point *isl_set_sample_point(
2570 __isl_take isl_set *set);
2571 __isl_give isl_point *isl_union_set_sample_point(
2572 __isl_take isl_union_set *uset);
2574 If C<set> does not contain any (integer) points, then the
2575 resulting point will be ``void'', a property that can be
2578 isl_bool isl_point_is_void(__isl_keep isl_point *pnt);
2582 Besides sets and relation, C<isl> also supports various types of functions.
2583 Each of these types is derived from the value type (see L</"Values">)
2584 or from one of two primitive function types
2585 through the application of zero or more type constructors.
2586 We first describe the primitive type and then we describe
2587 the types derived from these primitive types.
2589 =head3 Primitive Functions
2591 C<isl> support two primitive function types, quasi-affine
2592 expressions and quasipolynomials.
2593 A quasi-affine expression is defined either over a parameter
2594 space or over a set and is composed of integer constants,
2595 parameters and set variables, addition, subtraction and
2596 integer division by an integer constant.
2597 For example, the quasi-affine expression
2599 [n] -> { [x] -> [2*floor((4 n + x)/9)] }
2601 maps C<x> to C<2*floor((4 n + x)/9>.
2602 A quasipolynomial is a polynomial expression in quasi-affine
2603 expression. That is, it additionally allows for multiplication.
2604 Note, though, that it is not allowed to construct an integer
2605 division of an expression involving multiplications.
2606 Here is an example of a quasipolynomial that is not
2607 quasi-affine expression
2609 [n] -> { [x] -> (n*floor((4 n + x)/9)) }
2611 Note that the external representations of quasi-affine expressions
2612 and quasipolynomials are different. Quasi-affine expressions
2613 use a notation with square brackets just like binary relations,
2614 while quasipolynomials do not. This might change at some point.
2616 If a primitive function is defined over a parameter space,
2617 then the space of the function itself is that of a set.
2618 If it is defined over a set, then the space of the function
2619 is that of a relation. In both cases, the set space (or
2620 the output space) is single-dimensional, anonymous and unstructured.
2621 To create functions with multiple dimensions or with other kinds
2622 of set or output spaces, use multiple expressions
2623 (see L</"Multiple Expressions">).
2627 =item * Quasi-affine Expressions
2629 Besides the expressions described above, a quasi-affine
2630 expression can also be set to NaN. Such expressions
2631 typically represent a failure to represent a result
2632 as a quasi-affine expression.
2634 The zero quasi affine expression or the quasi affine expression
2635 that is equal to a given value, parameter or
2636 a specified dimension on a given domain can be created using
2638 #include <isl/aff.h>
2639 __isl_give isl_aff *isl_aff_zero_on_domain(
2640 __isl_take isl_local_space *ls);
2641 __isl_give isl_aff *isl_aff_val_on_domain(
2642 __isl_take isl_local_space *ls,
2643 __isl_take isl_val *val);
2644 __isl_give isl_aff *isl_aff_param_on_domain_space_id(
2645 __isl_take isl_space *space,
2646 __isl_take isl_id *id);
2647 __isl_give isl_aff *isl_aff_var_on_domain(
2648 __isl_take isl_local_space *ls,
2649 enum isl_dim_type type, unsigned pos);
2650 __isl_give isl_aff *isl_aff_nan_on_domain(
2651 __isl_take isl_local_space *ls);
2653 The space passed to C<isl_aff_param_on_domain_space_id>
2654 is required to have a parameter with the given identifier.
2656 Quasi affine expressions can be copied and freed using
2658 #include <isl/aff.h>
2659 __isl_give isl_aff *isl_aff_copy(
2660 __isl_keep isl_aff *aff);
2661 __isl_null isl_aff *isl_aff_free(
2662 __isl_take isl_aff *aff);
2664 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2665 using the following function. The constraint is required to have
2666 a non-zero coefficient for the specified dimension.
2668 #include <isl/constraint.h>
2669 __isl_give isl_aff *isl_constraint_get_bound(
2670 __isl_keep isl_constraint *constraint,
2671 enum isl_dim_type type, int pos);
2673 The entire affine expression of the constraint can also be extracted
2674 using the following function.
2676 #include <isl/constraint.h>
2677 __isl_give isl_aff *isl_constraint_get_aff(
2678 __isl_keep isl_constraint *constraint);
2680 Conversely, an equality constraint equating
2681 the affine expression to zero or an inequality constraint enforcing
2682 the affine expression to be non-negative, can be constructed using
2684 __isl_give isl_constraint *isl_equality_from_aff(
2685 __isl_take isl_aff *aff);
2686 __isl_give isl_constraint *isl_inequality_from_aff(
2687 __isl_take isl_aff *aff);
2689 The coefficients and the integer divisions of an affine expression
2690 can be inspected using the following functions.
2692 #include <isl/aff.h>
2693 __isl_give isl_val *isl_aff_get_constant_val(
2694 __isl_keep isl_aff *aff);
2695 __isl_give isl_val *isl_aff_get_coefficient_val(
2696 __isl_keep isl_aff *aff,
2697 enum isl_dim_type type, int pos);
2698 int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2699 enum isl_dim_type type, int pos);
2700 __isl_give isl_val *isl_aff_get_denominator_val(
2701 __isl_keep isl_aff *aff);
2702 __isl_give isl_aff *isl_aff_get_div(
2703 __isl_keep isl_aff *aff, int pos);
2705 They can be modified using the following functions.
2707 #include <isl/aff.h>
2708 __isl_give isl_aff *isl_aff_set_constant_si(
2709 __isl_take isl_aff *aff, int v);
2710 __isl_give isl_aff *isl_aff_set_constant_val(
2711 __isl_take isl_aff *aff, __isl_take isl_val *v);
2712 __isl_give isl_aff *isl_aff_set_coefficient_si(
2713 __isl_take isl_aff *aff,
2714 enum isl_dim_type type, int pos, int v);
2715 __isl_give isl_aff *isl_aff_set_coefficient_val(
2716 __isl_take isl_aff *aff,
2717 enum isl_dim_type type, int pos,
2718 __isl_take isl_val *v);
2720 __isl_give isl_aff *isl_aff_add_constant_si(
2721 __isl_take isl_aff *aff, int v);
2722 __isl_give isl_aff *isl_aff_add_constant_val(
2723 __isl_take isl_aff *aff, __isl_take isl_val *v);
2724 __isl_give isl_aff *isl_aff_add_constant_num_si(
2725 __isl_take isl_aff *aff, int v);
2726 __isl_give isl_aff *isl_aff_add_coefficient_si(
2727 __isl_take isl_aff *aff,
2728 enum isl_dim_type type, int pos, int v);
2729 __isl_give isl_aff *isl_aff_add_coefficient_val(
2730 __isl_take isl_aff *aff,
2731 enum isl_dim_type type, int pos,
2732 __isl_take isl_val *v);
2734 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2735 set the I<numerator> of the constant or coefficient, while
2736 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2737 the constant or coefficient as a whole.
2738 The C<add_constant> and C<add_coefficient> functions add an integer
2739 or rational value to
2740 the possibly rational constant or coefficient.
2741 The C<add_constant_num> functions add an integer value to
2744 =item * Quasipolynomials
2746 Some simple quasipolynomials can be created using the following functions.
2748 #include <isl/polynomial.h>
2749 __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2750 __isl_take isl_space *domain);
2751 __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2752 __isl_take isl_space *domain);
2753 __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2754 __isl_take isl_space *domain);
2755 __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2756 __isl_take isl_space *domain);
2757 __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2758 __isl_take isl_space *domain);
2759 __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2760 __isl_take isl_space *domain,
2761 __isl_take isl_val *val);
2762 __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2763 __isl_take isl_space *domain,
2764 enum isl_dim_type type, unsigned pos);
2765 __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2766 __isl_take isl_aff *aff);
2768 Recall that the space in which a quasipolynomial lives is a map space
2769 with a one-dimensional range. The C<domain> argument in some of
2770 the functions above corresponds to the domain of this map space.
2772 Quasipolynomials can be copied and freed again using the following
2775 #include <isl/polynomial.h>
2776 __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2777 __isl_keep isl_qpolynomial *qp);
2778 __isl_null isl_qpolynomial *isl_qpolynomial_free(
2779 __isl_take isl_qpolynomial *qp);
2781 The constant term of a quasipolynomial can be extracted using
2783 __isl_give isl_val *isl_qpolynomial_get_constant_val(
2784 __isl_keep isl_qpolynomial *qp);
2786 To iterate over all terms in a quasipolynomial,
2789 isl_stat isl_qpolynomial_foreach_term(
2790 __isl_keep isl_qpolynomial *qp,
2791 isl_stat (*fn)(__isl_take isl_term *term,
2792 void *user), void *user);
2794 The terms themselves can be inspected and freed using
2797 isl_size isl_term_dim(__isl_keep isl_term *term,
2798 enum isl_dim_type type);
2799 __isl_give isl_val *isl_term_get_coefficient_val(
2800 __isl_keep isl_term *term);
2801 isl_size isl_term_get_exp(__isl_keep isl_term *term,
2802 enum isl_dim_type type, unsigned pos);
2803 __isl_give isl_aff *isl_term_get_div(
2804 __isl_keep isl_term *term, unsigned pos);
2805 __isl_null isl_term *isl_term_free(
2806 __isl_take isl_term *term);
2808 Each term is a product of parameters, set variables and
2809 integer divisions. The function C<isl_term_get_exp>
2810 returns the exponent of a given dimensions in the given term.
2816 A reduction represents a maximum or a minimum of its
2818 The only reduction type defined by C<isl> is
2819 C<isl_qpolynomial_fold>.
2821 There are currently no functions to directly create such
2822 objects, but they do appear in the piecewise quasipolynomial
2823 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2825 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2827 Reductions can be copied and freed using
2828 the following functions.
2830 #include <isl/polynomial.h>
2831 __isl_give isl_qpolynomial_fold *
2832 isl_qpolynomial_fold_copy(
2833 __isl_keep isl_qpolynomial_fold *fold);
2834 __isl_null isl_qpolynomial_fold *
2835 isl_qpolynomial_fold_free(
2836 __isl_take isl_qpolynomial_fold *fold);
2838 To iterate over all quasipolynomials in a reduction, use
2840 isl_stat isl_qpolynomial_fold_foreach_qpolynomial(
2841 __isl_keep isl_qpolynomial_fold *fold,
2842 isl_stat (*fn)(__isl_take isl_qpolynomial *qp,
2843 void *user), void *user);
2845 =head3 Multiple Expressions
2847 A multiple expression represents a sequence of zero or
2848 more base expressions, all defined on the same domain space.
2849 The domain space of the multiple expression is the same
2850 as that of the base expressions, but the range space
2851 can be any space. In case the base expressions have
2852 a set space, the corresponding multiple expression
2853 also has a set space.
2854 Objects of the value type do not have an associated space.
2855 The space of a multiple value is therefore always a set space.
2856 Similarly, the space of a multiple union piecewise
2857 affine expression is always a set space.
2858 If the base expressions are not total, then
2859 a corresponding zero-dimensional multiple expression may
2860 have an explicit domain that keeps track of the domain
2861 outside of any base expressions.
2863 The multiple expression types defined by C<isl>
2864 are C<isl_multi_val>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
2865 C<isl_multi_union_pw_aff>.
2867 A multiple expression with the value zero for
2868 each output (or set) dimension can be created
2869 using the following functions.
2871 #include <isl/val.h>
2872 __isl_give isl_multi_val *isl_multi_val_zero(
2873 __isl_take isl_space *space);
2875 #include <isl/aff.h>
2876 __isl_give isl_multi_aff *isl_multi_aff_zero(
2877 __isl_take isl_space *space);
2878 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2879 __isl_take isl_space *space);
2880 __isl_give isl_multi_union_pw_aff *
2881 isl_multi_union_pw_aff_zero(
2882 __isl_take isl_space *space);
2884 Since there is no canonical way of representing a zero
2885 value of type C<isl_union_pw_aff>, the space passed
2886 to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
2888 An identity function can be created using the following
2889 functions. The space needs to be that of a relation
2890 with the same number of input and output dimensions.
2892 #include <isl/aff.h>
2893 __isl_give isl_multi_aff *isl_multi_aff_identity(
2894 __isl_take isl_space *space);
2895 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2896 __isl_take isl_space *space);
2898 A function that performs a projection on a universe
2899 relation or set can be created using the following functions.
2900 See also the corresponding
2901 projection operations in L</"Unary Operations">.
2903 #include <isl/aff.h>
2904 __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2905 __isl_take isl_space *space);
2906 __isl_give isl_multi_aff *isl_multi_aff_range_map(
2907 __isl_take isl_space *space);
2908 __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2909 __isl_take isl_space *space,
2910 enum isl_dim_type type,
2911 unsigned first, unsigned n);
2913 A multiple expression can be created from a single
2914 base expression using the following functions.
2915 The space of the created multiple expression is the same
2916 as that of the base expression, except for
2917 C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
2918 lives in a parameter space and the output lives
2919 in a single-dimensional set space.
2921 #include <isl/aff.h>
2922 __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2923 __isl_take isl_aff *aff);
2924 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2925 __isl_take isl_pw_aff *pa);
2926 __isl_give isl_multi_union_pw_aff *
2927 isl_multi_union_pw_aff_from_union_pw_aff(
2928 __isl_take isl_union_pw_aff *upa);
2930 A multiple expression can be created from a list
2931 of base expression in a specified space.
2932 The domain of this space needs to be the same
2933 as the domains of the base expressions in the list.
2934 If the base expressions have a set space (or no associated space),
2935 then this space also needs to be a set space.
2937 #include <isl/val.h>
2938 __isl_give isl_multi_val *isl_multi_val_from_val_list(
2939 __isl_take isl_space *space,
2940 __isl_take isl_val_list *list);
2942 #include <isl/aff.h>
2943 __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2944 __isl_take isl_space *space,
2945 __isl_take isl_aff_list *list);
2946 __isl_give isl_multi_pw_aff *
2947 isl_multi_pw_aff_from_pw_aff_list(
2948 __isl_take isl_space *space,
2949 __isl_take isl_pw_aff_list *list);
2950 __isl_give isl_multi_union_pw_aff *
2951 isl_multi_union_pw_aff_from_union_pw_aff_list(
2952 __isl_take isl_space *space,
2953 __isl_take isl_union_pw_aff_list *list);
2955 As a convenience, a multiple piecewise expression can
2956 also be created from a multiple expression.
2957 Each piecewise expression in the result has a single
2960 #include <isl/aff.h>
2961 __isl_give isl_multi_pw_aff *
2962 isl_multi_pw_aff_from_multi_aff(
2963 __isl_take isl_multi_aff *ma);
2965 Similarly, a multiple union expression can be
2966 created from a multiple expression.
2968 #include <isl/aff.h>
2969 __isl_give isl_multi_union_pw_aff *
2970 isl_multi_union_pw_aff_from_multi_aff(
2971 __isl_take isl_multi_aff *ma);
2972 __isl_give isl_multi_union_pw_aff *
2973 isl_multi_union_pw_aff_from_multi_pw_aff(
2974 __isl_take isl_multi_pw_aff *mpa);
2976 A multiple quasi-affine expression can be created from
2977 a multiple value with a given domain space using the following
2980 #include <isl/aff.h>
2981 __isl_give isl_multi_aff *
2982 isl_multi_aff_multi_val_on_space(
2983 __isl_take isl_space *space,
2984 __isl_take isl_multi_val *mv);
2987 a multiple union piecewise affine expression can be created from
2988 a multiple value with a given domain or
2989 a (piecewise) multiple affine expression with a given domain
2990 using the following functions.
2992 #include <isl/aff.h>
2993 __isl_give isl_multi_union_pw_aff *
2994 isl_multi_union_pw_aff_multi_val_on_domain(
2995 __isl_take isl_union_set *domain,
2996 __isl_take isl_multi_val *mv);
2997 __isl_give isl_multi_union_pw_aff *
2998 isl_multi_union_pw_aff_multi_aff_on_domain(
2999 __isl_take isl_union_set *domain,
3000 __isl_take isl_multi_aff *ma);
3001 __isl_give isl_multi_union_pw_aff *
3002 isl_multi_union_pw_aff_pw_multi_aff_on_domain(
3003 __isl_take isl_union_set *domain,
3004 __isl_take isl_pw_multi_aff *pma);
3006 Multiple expressions can be copied and freed using
3007 the following functions.
3009 #include <isl/val.h>
3010 __isl_give isl_multi_val *isl_multi_val_copy(
3011 __isl_keep isl_multi_val *mv);
3012 __isl_null isl_multi_val *isl_multi_val_free(
3013 __isl_take isl_multi_val *mv);
3015 #include <isl/aff.h>
3016 __isl_give isl_multi_aff *isl_multi_aff_copy(
3017 __isl_keep isl_multi_aff *maff);
3018 __isl_null isl_multi_aff *isl_multi_aff_free(
3019 __isl_take isl_multi_aff *maff);
3020 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
3021 __isl_keep isl_multi_pw_aff *mpa);
3022 __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
3023 __isl_take isl_multi_pw_aff *mpa);
3024 __isl_give isl_multi_union_pw_aff *
3025 isl_multi_union_pw_aff_copy(
3026 __isl_keep isl_multi_union_pw_aff *mupa);
3027 __isl_null isl_multi_union_pw_aff *
3028 isl_multi_union_pw_aff_free(
3029 __isl_take isl_multi_union_pw_aff *mupa);
3031 The number of base expressions in a multiple
3032 expression can be obtained using the following functions.
3034 #include <isl/val.h>
3035 isl_size isl_multi_val_size(__isl_keep isl_multi_val *mv);
3037 #include <isl/aff.h>
3038 isl_size isl_multi_aff_size(
3039 __isl_keep isl_multi_aff *multi);
3040 isl_size isl_multi_pw_aff_size(
3041 __isl_keep isl_multi_pw_aff *mpa);
3042 isl_size isl_multi_union_pw_aff_size(
3043 __isl_keep isl_multi_union_pw_aff *mupa);
3045 The base expression at a given position of a multiple
3046 expression can be extracted using the following functions.
3048 #include <isl/val.h>
3049 __isl_give isl_val *isl_multi_val_get_val(
3050 __isl_keep isl_multi_val *mv, int pos);
3052 #include <isl/aff.h>
3053 __isl_give isl_aff *isl_multi_aff_get_aff(
3054 __isl_keep isl_multi_aff *multi, int pos);
3055 __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
3056 __isl_keep isl_multi_pw_aff *mpa, int pos);
3057 __isl_give isl_union_pw_aff *
3058 isl_multi_union_pw_aff_get_union_pw_aff(
3059 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
3061 It can be replaced using the following functions.
3063 #include <isl/val.h>
3064 __isl_give isl_multi_val *isl_multi_val_set_val(
3065 __isl_take isl_multi_val *mv, int pos,
3066 __isl_take isl_val *val);
3068 #include <isl/aff.h>
3069 __isl_give isl_multi_aff *isl_multi_aff_set_aff(
3070 __isl_take isl_multi_aff *multi, int pos,
3071 __isl_take isl_aff *aff);
3072 __isl_give isl_multi_union_pw_aff *
3073 isl_multi_union_pw_aff_set_union_pw_aff(
3074 __isl_take isl_multi_union_pw_aff *mupa, int pos,
3075 __isl_take isl_union_pw_aff *upa);
3077 As a convenience, a sequence of base expressions that have
3078 their domains in a given space can be extracted from a sequence
3079 of union expressions using the following function.
3081 #include <isl/aff.h>
3082 __isl_give isl_multi_pw_aff *
3083 isl_multi_union_pw_aff_extract_multi_pw_aff(
3084 __isl_keep isl_multi_union_pw_aff *mupa,
3085 __isl_take isl_space *space);
3087 Note that there is a difference between C<isl_multi_union_pw_aff>
3088 and C<isl_union_pw_multi_aff> objects. The first is a sequence
3089 of unions of piecewise expressions, while the second is a union
3090 of piecewise sequences. In particular, multiple affine expressions
3091 in an C<isl_union_pw_multi_aff> may live in different spaces,
3092 while there is only a single multiple expression in
3093 an C<isl_multi_union_pw_aff>, which can therefore only live
3094 in a single space. This means that not every
3095 C<isl_union_pw_multi_aff> can be converted to
3096 an C<isl_multi_union_pw_aff>. Conversely, the elements
3097 of an C<isl_multi_union_pw_aff> may be defined over different domains,
3098 while each multiple expression inside an C<isl_union_pw_multi_aff>
3099 has a single domain. The conversion of an C<isl_union_pw_multi_aff>
3100 of dimension greater than one may therefore not be exact.
3101 The following functions can
3102 be used to perform these conversions when they are possible.
3104 #include <isl/aff.h>
3105 __isl_give isl_multi_union_pw_aff *
3106 isl_multi_union_pw_aff_from_union_pw_multi_aff(
3107 __isl_take isl_union_pw_multi_aff *upma);
3108 __isl_give isl_union_pw_multi_aff *
3109 isl_union_pw_multi_aff_from_multi_union_pw_aff(
3110 __isl_take isl_multi_union_pw_aff *mupa);
3112 =head3 Piecewise Expressions
3114 A piecewise expression is an expression that is described
3115 using zero or more base expression defined over the same
3116 number of cells in the domain space of the base expressions.
3117 All base expressions are defined over the same
3118 domain space and the cells are disjoint.
3119 The space of a piecewise expression is the same as
3120 that of the base expressions.
3121 If the union of the cells is a strict subset of the domain
3122 space, then the value of the piecewise expression outside
3123 this union is different for types derived from quasi-affine
3124 expressions and those derived from quasipolynomials.
3125 Piecewise expressions derived from quasi-affine expressions
3126 are considered to be undefined outside the union of their cells.
3127 Piecewise expressions derived from quasipolynomials
3128 are considered to be zero outside the union of their cells.
3130 Piecewise quasipolynomials are mainly used by the C<barvinok>
3131 library for representing the number of elements in a parametric set or map.
3132 For example, the piecewise quasipolynomial
3134 [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
3136 represents the number of points in the map
3138 [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
3140 The piecewise expression types defined by C<isl>
3141 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
3142 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
3144 A piecewise expression with no cells can be created using
3145 the following functions.
3147 #include <isl/aff.h>
3148 __isl_give isl_pw_aff *isl_pw_aff_empty(
3149 __isl_take isl_space *space);
3150 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
3151 __isl_take isl_space *space);
3153 A piecewise expression with a single universe cell can be
3154 created using the following functions.
3156 #include <isl/aff.h>
3157 __isl_give isl_pw_aff *isl_pw_aff_from_aff(
3158 __isl_take isl_aff *aff);
3159 __isl_give isl_pw_multi_aff *
3160 isl_pw_multi_aff_from_multi_aff(
3161 __isl_take isl_multi_aff *ma);
3163 #include <isl/polynomial.h>
3164 __isl_give isl_pw_qpolynomial *
3165 isl_pw_qpolynomial_from_qpolynomial(
3166 __isl_take isl_qpolynomial *qp);
3168 A piecewise expression with a single specified cell can be
3169 created using the following functions.
3171 #include <isl/aff.h>
3172 __isl_give isl_pw_aff *isl_pw_aff_alloc(
3173 __isl_take isl_set *set, __isl_take isl_aff *aff);
3174 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
3175 __isl_take isl_set *set,
3176 __isl_take isl_multi_aff *maff);
3178 #include <isl/polynomial.h>
3179 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
3180 __isl_take isl_set *set,
3181 __isl_take isl_qpolynomial *qp);
3183 The following convenience functions first create a base expression and
3184 then create a piecewise expression over a universe domain.
3186 #include <isl/aff.h>
3187 __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
3188 __isl_take isl_local_space *ls);
3189 __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
3190 __isl_take isl_local_space *ls,
3191 enum isl_dim_type type, unsigned pos);
3192 __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
3193 __isl_take isl_local_space *ls);
3194 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
3195 __isl_take isl_space *space);
3196 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
3197 __isl_take isl_space *space);
3198 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
3199 __isl_take isl_space *space);
3200 __isl_give isl_pw_multi_aff *
3201 isl_pw_multi_aff_project_out_map(
3202 __isl_take isl_space *space,
3203 enum isl_dim_type type,
3204 unsigned first, unsigned n);
3206 #include <isl/polynomial.h>
3207 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
3208 __isl_take isl_space *space);
3210 The following convenience functions first create a base expression and
3211 then create a piecewise expression over a given domain.
3213 #include <isl/aff.h>
3214 __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
3215 __isl_take isl_set *domain,
3216 __isl_take isl_val *v);
3217 __isl_give isl_pw_multi_aff *
3218 isl_pw_multi_aff_multi_val_on_domain(
3219 __isl_take isl_set *domain,
3220 __isl_take isl_multi_val *mv);
3222 As a convenience, a piecewise multiple expression can
3223 also be created from a piecewise expression.
3224 Each multiple expression in the result is derived
3225 from the corresponding base expression.
3227 #include <isl/aff.h>
3228 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
3229 __isl_take isl_pw_aff *pa);
3231 Similarly, a piecewise quasipolynomial can be
3232 created from a piecewise quasi-affine expression using
3233 the following function.
3235 #include <isl/polynomial.h>
3236 __isl_give isl_pw_qpolynomial *
3237 isl_pw_qpolynomial_from_pw_aff(
3238 __isl_take isl_pw_aff *pwaff);
3240 Piecewise expressions can be copied and freed using the following functions.
3242 #include <isl/aff.h>
3243 __isl_give isl_pw_aff *isl_pw_aff_copy(
3244 __isl_keep isl_pw_aff *pwaff);
3245 __isl_null isl_pw_aff *isl_pw_aff_free(
3246 __isl_take isl_pw_aff *pwaff);
3247 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
3248 __isl_keep isl_pw_multi_aff *pma);
3249 __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
3250 __isl_take isl_pw_multi_aff *pma);
3252 #include <isl/polynomial.h>
3253 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
3254 __isl_keep isl_pw_qpolynomial *pwqp);
3255 __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
3256 __isl_take isl_pw_qpolynomial *pwqp);
3257 __isl_give isl_pw_qpolynomial_fold *
3258 isl_pw_qpolynomial_fold_copy(
3259 __isl_keep isl_pw_qpolynomial_fold *pwf);
3260 __isl_null isl_pw_qpolynomial_fold *
3261 isl_pw_qpolynomial_fold_free(
3262 __isl_take isl_pw_qpolynomial_fold *pwf);
3264 To iterate over the different cells of a piecewise expression,
3265 use the following functions.
3267 #include <isl/aff.h>
3268 isl_bool isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
3269 isl_size isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
3270 isl_stat isl_pw_aff_foreach_piece(
3271 __isl_keep isl_pw_aff *pwaff,
3272 isl_stat (*fn)(__isl_take isl_set *set,
3273 __isl_take isl_aff *aff,
3274 void *user), void *user);
3275 isl_size isl_pw_multi_aff_n_piece(
3276 __isl_keep isl_pw_multi_aff *pma);
3277 isl_stat isl_pw_multi_aff_foreach_piece(
3278 __isl_keep isl_pw_multi_aff *pma,
3279 isl_stat (*fn)(__isl_take isl_set *set,
3280 __isl_take isl_multi_aff *maff,
3281 void *user), void *user);
3283 #include <isl/polynomial.h>
3284 isl_size isl_pw_qpolynomial_n_piece(
3285 __isl_keep isl_pw_qpolynomial *pwqp);
3286 isl_stat isl_pw_qpolynomial_foreach_piece(
3287 __isl_keep isl_pw_qpolynomial *pwqp,
3288 isl_stat (*fn)(__isl_take isl_set *set,
3289 __isl_take isl_qpolynomial *qp,
3290 void *user), void *user);
3291 isl_stat isl_pw_qpolynomial_foreach_lifted_piece(
3292 __isl_keep isl_pw_qpolynomial *pwqp,
3293 isl_stat (*fn)(__isl_take isl_set *set,
3294 __isl_take isl_qpolynomial *qp,
3295 void *user), void *user);
3296 isl_size isl_pw_qpolynomial_fold_n_piece(
3297 __isl_keep isl_pw_qpolynomial_fold *pwf);
3298 isl_stat isl_pw_qpolynomial_fold_foreach_piece(
3299 __isl_keep isl_pw_qpolynomial_fold *pwf,
3300 isl_stat (*fn)(__isl_take isl_set *set,
3301 __isl_take isl_qpolynomial_fold *fold,
3302 void *user), void *user);
3303 isl_stat isl_pw_qpolynomial_fold_foreach_lifted_piece(
3304 __isl_keep isl_pw_qpolynomial_fold *pwf,
3305 isl_stat (*fn)(__isl_take isl_set *set,
3306 __isl_take isl_qpolynomial_fold *fold,
3307 void *user), void *user);
3309 As usual, the function C<fn> should return C<isl_stat_ok> on success
3310 and C<isl_stat_error> on failure. The difference between
3311 C<isl_pw_qpolynomial_foreach_piece> and
3312 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
3313 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
3314 compute unique representations for all existentially quantified
3315 variables and then turn these existentially quantified variables
3316 into extra set variables, adapting the associated quasipolynomial
3317 accordingly. This means that the C<set> passed to C<fn>
3318 will not have any existentially quantified variables, but that
3319 the dimensions of the sets may be different for different
3320 invocations of C<fn>.
3321 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
3322 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
3324 A piecewise expression consisting of the expressions at a given
3325 position of a piecewise multiple expression can be extracted
3326 using the following function.
3328 #include <isl/aff.h>
3329 __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3330 __isl_keep isl_pw_multi_aff *pma, int pos);
3332 These expressions can be replaced using the following function.
3334 #include <isl/aff.h>
3335 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3336 __isl_take isl_pw_multi_aff *pma, unsigned pos,
3337 __isl_take isl_pw_aff *pa);
3339 Note that there is a difference between C<isl_multi_pw_aff> and
3340 C<isl_pw_multi_aff> objects. The first is a sequence of piecewise
3341 affine expressions, while the second is a piecewise sequence
3342 of affine expressions. In particular, each of the piecewise
3343 affine expressions in an C<isl_multi_pw_aff> may have a different
3344 domain, while all multiple expressions associated to a cell
3345 in an C<isl_pw_multi_aff> have the same domain.
3346 It is possible to convert between the two, but when converting
3347 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3348 of the result is the intersection of the domains of the input.
3349 The reverse conversion is exact.
3351 #include <isl/aff.h>
3352 __isl_give isl_pw_multi_aff *
3353 isl_pw_multi_aff_from_multi_pw_aff(
3354 __isl_take isl_multi_pw_aff *mpa);
3355 __isl_give isl_multi_pw_aff *
3356 isl_multi_pw_aff_from_pw_multi_aff(
3357 __isl_take isl_pw_multi_aff *pma);
3359 =head3 Union Expressions
3361 A union expression collects base expressions defined
3362 over different domains. The space of a union expression
3363 is that of the shared parameter space.
3365 The union expression types defined by C<isl>
3366 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3367 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3369 C<isl_union_pw_aff>,
3370 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>,
3371 there can be at most one base expression for a given domain space.
3373 C<isl_union_pw_multi_aff>,
3374 there can be multiple such expressions for a given domain space,
3375 but the domains of these expressions need to be disjoint.
3377 An empty union expression can be created using the following functions.
3379 #include <isl/aff.h>
3380 __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
3381 __isl_take isl_space *space);
3382 __isl_give isl_union_pw_multi_aff *
3383 isl_union_pw_multi_aff_empty(
3384 __isl_take isl_space *space);
3386 #include <isl/polynomial.h>
3387 __isl_give isl_union_pw_qpolynomial *
3388 isl_union_pw_qpolynomial_zero(
3389 __isl_take isl_space *space);
3391 A union expression containing a single base expression
3392 can be created using the following functions.
3394 #include <isl/aff.h>
3395 __isl_give isl_union_pw_aff *
3396 isl_union_pw_aff_from_pw_aff(
3397 __isl_take isl_pw_aff *pa);
3398 __isl_give isl_union_pw_multi_aff *
3399 isl_union_pw_multi_aff_from_aff(
3400 __isl_take isl_aff *aff);
3401 __isl_give isl_union_pw_multi_aff *
3402 isl_union_pw_multi_aff_from_pw_multi_aff(
3403 __isl_take isl_pw_multi_aff *pma);
3405 #include <isl/polynomial.h>
3406 __isl_give isl_union_pw_qpolynomial *
3407 isl_union_pw_qpolynomial_from_pw_qpolynomial(
3408 __isl_take isl_pw_qpolynomial *pwqp);
3410 The following functions create a base expression on each
3411 of the sets in the union set and collect the results.
3413 #include <isl/aff.h>
3414 __isl_give isl_union_pw_multi_aff *
3415 isl_union_pw_multi_aff_from_union_pw_aff(
3416 __isl_take isl_union_pw_aff *upa);
3417 __isl_give isl_union_pw_aff *
3418 isl_union_pw_multi_aff_get_union_pw_aff(
3419 __isl_keep isl_union_pw_multi_aff *upma, int pos);
3420 __isl_give isl_union_pw_aff *
3421 isl_union_pw_aff_val_on_domain(
3422 __isl_take isl_union_set *domain,
3423 __isl_take isl_val *v);
3424 __isl_give isl_union_pw_multi_aff *
3425 isl_union_pw_multi_aff_multi_val_on_domain(
3426 __isl_take isl_union_set *domain,
3427 __isl_take isl_multi_val *mv);
3428 __isl_give isl_union_pw_aff *
3429 isl_union_pw_aff_param_on_domain_id(
3430 __isl_take isl_union_set *domain,
3431 __isl_take isl_id *id);
3433 The C<id> argument of C<isl_union_pw_aff_param_on_domain_id>
3434 is the identifier of a parameter that may or may not already
3435 be present in C<domain>.
3437 An C<isl_union_pw_aff> that is equal to a (parametric) affine
3439 expression on a given domain can be created using the following
3442 #include <isl/aff.h>
3443 __isl_give isl_union_pw_aff *
3444 isl_union_pw_aff_aff_on_domain(
3445 __isl_take isl_union_set *domain,
3446 __isl_take isl_aff *aff);
3447 __isl_give isl_union_pw_aff *
3448 isl_union_pw_aff_pw_aff_on_domain(
3449 __isl_take isl_union_set *domain,
3450 __isl_take isl_pw_aff *pa);
3452 A base expression can be added to a union expression using
3453 the following functions.
3455 #include <isl/aff.h>
3456 __isl_give isl_union_pw_aff *
3457 isl_union_pw_aff_add_pw_aff(
3458 __isl_take isl_union_pw_aff *upa,
3459 __isl_take isl_pw_aff *pa);
3460 __isl_give isl_union_pw_multi_aff *
3461 isl_union_pw_multi_aff_add_pw_multi_aff(
3462 __isl_take isl_union_pw_multi_aff *upma,
3463 __isl_take isl_pw_multi_aff *pma);
3465 #include <isl/polynomial.h>
3466 __isl_give isl_union_pw_qpolynomial *
3467 isl_union_pw_qpolynomial_add_pw_qpolynomial(
3468 __isl_take isl_union_pw_qpolynomial *upwqp,
3469 __isl_take isl_pw_qpolynomial *pwqp);
3471 Union expressions can be copied and freed using
3472 the following functions.
3474 #include <isl/aff.h>
3475 __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
3476 __isl_keep isl_union_pw_aff *upa);
3477 __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
3478 __isl_take isl_union_pw_aff *upa);
3479 __isl_give isl_union_pw_multi_aff *
3480 isl_union_pw_multi_aff_copy(
3481 __isl_keep isl_union_pw_multi_aff *upma);
3482 __isl_null isl_union_pw_multi_aff *
3483 isl_union_pw_multi_aff_free(
3484 __isl_take isl_union_pw_multi_aff *upma);
3486 #include <isl/polynomial.h>
3487 __isl_give isl_union_pw_qpolynomial *
3488 isl_union_pw_qpolynomial_copy(
3489 __isl_keep isl_union_pw_qpolynomial *upwqp);
3490 __isl_null isl_union_pw_qpolynomial *
3491 isl_union_pw_qpolynomial_free(
3492 __isl_take isl_union_pw_qpolynomial *upwqp);
3493 __isl_give isl_union_pw_qpolynomial_fold *
3494 isl_union_pw_qpolynomial_fold_copy(
3495 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3496 __isl_null isl_union_pw_qpolynomial_fold *
3497 isl_union_pw_qpolynomial_fold_free(
3498 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3500 To iterate over the base expressions in a union expression,
3501 use the following functions.
3503 #include <isl/aff.h>
3504 isl_size isl_union_pw_aff_n_pw_aff(
3505 __isl_keep isl_union_pw_aff *upa);
3506 isl_stat isl_union_pw_aff_foreach_pw_aff(
3507 __isl_keep isl_union_pw_aff *upa,
3508 isl_stat (*fn)(__isl_take isl_pw_aff *pa,
3509 void *user), void *user);
3510 isl_size isl_union_pw_multi_aff_n_pw_multi_aff(
3511 __isl_keep isl_union_pw_multi_aff *upma);
3512 isl_stat isl_union_pw_multi_aff_foreach_pw_multi_aff(
3513 __isl_keep isl_union_pw_multi_aff *upma,
3514 isl_stat (*fn)(__isl_take isl_pw_multi_aff *pma,
3515 void *user), void *user);
3517 #include <isl/polynomial.h>
3518 isl_size isl_union_pw_qpolynomial_n_pw_qpolynomial(
3519 __isl_keep isl_union_pw_qpolynomial *upwqp);
3520 isl_stat isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3521 __isl_keep isl_union_pw_qpolynomial *upwqp,
3522 isl_stat (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3523 void *user), void *user);
3524 isl_size isl_union_pw_qpolynomial_fold_n_pw_qpolynomial_fold(
3525 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3526 isl_stat isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3527 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3528 isl_stat (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3529 void *user), void *user);
3531 To extract the base expression in a given space from a union, use
3532 the following functions.
3534 #include <isl/aff.h>
3535 __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3536 __isl_keep isl_union_pw_aff *upa,
3537 __isl_take isl_space *space);
3538 __isl_give isl_pw_multi_aff *
3539 isl_union_pw_multi_aff_extract_pw_multi_aff(
3540 __isl_keep isl_union_pw_multi_aff *upma,
3541 __isl_take isl_space *space);
3543 #include <isl/polynomial.h>
3544 __isl_give isl_pw_qpolynomial *
3545 isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3546 __isl_keep isl_union_pw_qpolynomial *upwqp,
3547 __isl_take isl_space *space);
3549 It is also possible to obtain a list of the base expressions using
3550 the following functions.
3552 #include <isl/aff.h>
3553 __isl_give isl_pw_aff_list *
3554 isl_union_pw_aff_get_pw_aff_list(
3555 __isl_keep isl_union_pw_aff *upa);
3556 __isl_give isl_pw_multi_aff_list *
3557 isl_union_pw_multi_aff_get_pw_multi_aff_list(
3558 __isl_keep isl_union_pw_multi_aff *upma);
3560 #include <isl/polynomial.h>
3561 __isl_give isl_pw_qpolynomial_list *
3562 isl_union_pw_qpolynomial_get_pw_qpolynomial_list(
3563 __isl_keep isl_union_pw_qpolynomial *upwqp);
3564 __isl_give isl_pw_qpolynomial_fold_list *
3565 isl_union_pw_qpolynomial_fold_get_pw_qpolynomial_fold_list(
3566 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3568 The returned list can be manipulated using the functions in L<"Lists">.
3570 =head2 Input and Output
3572 For set and relation,
3573 C<isl> supports its own input/output format, which is similar
3574 to the C<Omega> format, but also supports the C<PolyLib> format
3576 For other object types, typically only an C<isl> format is supported.
3578 =head3 C<isl> format
3580 The C<isl> format is similar to that of C<Omega>, but has a different
3581 syntax for describing the parameters and allows for the definition
3582 of an existentially quantified variable as the integer division
3583 of an affine expression.
3584 For example, the set of integers C<i> between C<0> and C<n>
3585 such that C<i % 10 <= 6> can be described as
3587 [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3590 A set or relation can have several disjuncts, separated
3591 by the keyword C<or>. Each disjunct is either a conjunction
3592 of constraints or a projection (C<exists>) of a conjunction
3593 of constraints. The constraints are separated by the keyword
3596 =head3 C<PolyLib> format
3598 If the represented set is a union, then the first line
3599 contains a single number representing the number of disjuncts.
3600 Otherwise, a line containing the number C<1> is optional.
3602 Each disjunct is represented by a matrix of constraints.
3603 The first line contains two numbers representing
3604 the number of rows and columns,
3605 where the number of rows is equal to the number of constraints
3606 and the number of columns is equal to two plus the number of variables.
3607 The following lines contain the actual rows of the constraint matrix.
3608 In each row, the first column indicates whether the constraint
3609 is an equality (C<0>) or inequality (C<1>). The final column
3610 corresponds to the constant term.
3612 If the set is parametric, then the coefficients of the parameters
3613 appear in the last columns before the constant column.
3614 The coefficients of any existentially quantified variables appear
3615 between those of the set variables and those of the parameters.
3617 =head3 Extended C<PolyLib> format
3619 The extended C<PolyLib> format is nearly identical to the
3620 C<PolyLib> format. The only difference is that the line
3621 containing the number of rows and columns of a constraint matrix
3622 also contains four additional numbers:
3623 the number of output dimensions, the number of input dimensions,
3624 the number of local dimensions (i.e., the number of existentially
3625 quantified variables) and the number of parameters.
3626 For sets, the number of ``output'' dimensions is equal
3627 to the number of set dimensions, while the number of ``input''
3632 Objects can be read from input using the following functions.
3635 __isl_give isl_id *isl_id_read_from_str(isl_ctx *ctx,
3638 #include <isl/val.h>
3639 __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3641 __isl_give isl_multi_val *isl_multi_val_read_from_str(
3642 isl_ctx *ctx, const char *str);
3644 #include <isl/set.h>
3645 __isl_give isl_basic_set *isl_basic_set_read_from_file(
3646 isl_ctx *ctx, FILE *input);
3647 __isl_give isl_basic_set *isl_basic_set_read_from_str(
3648 isl_ctx *ctx, const char *str);
3649 __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3651 __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3654 #include <isl/map.h>
3655 __isl_give isl_basic_map *isl_basic_map_read_from_file(
3656 isl_ctx *ctx, FILE *input);
3657 __isl_give isl_basic_map *isl_basic_map_read_from_str(
3658 isl_ctx *ctx, const char *str);
3659 __isl_give isl_map *isl_map_read_from_file(
3660 isl_ctx *ctx, FILE *input);
3661 __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3664 #include <isl/union_set.h>
3665 __isl_give isl_union_set *isl_union_set_read_from_file(
3666 isl_ctx *ctx, FILE *input);
3667 __isl_give isl_union_set *isl_union_set_read_from_str(
3668 isl_ctx *ctx, const char *str);
3670 #include <isl/union_map.h>
3671 __isl_give isl_union_map *isl_union_map_read_from_file(
3672 isl_ctx *ctx, FILE *input);
3673 __isl_give isl_union_map *isl_union_map_read_from_str(
3674 isl_ctx *ctx, const char *str);
3676 #include <isl/aff.h>
3677 __isl_give isl_aff *isl_aff_read_from_str(
3678 isl_ctx *ctx, const char *str);
3679 __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3680 isl_ctx *ctx, const char *str);
3681 __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3682 isl_ctx *ctx, const char *str);
3683 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3684 isl_ctx *ctx, const char *str);
3685 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3686 isl_ctx *ctx, const char *str);
3687 __isl_give isl_union_pw_aff *
3688 isl_union_pw_aff_read_from_str(
3689 isl_ctx *ctx, const char *str);
3690 __isl_give isl_union_pw_multi_aff *
3691 isl_union_pw_multi_aff_read_from_str(
3692 isl_ctx *ctx, const char *str);
3693 __isl_give isl_multi_union_pw_aff *
3694 isl_multi_union_pw_aff_read_from_str(
3695 isl_ctx *ctx, const char *str);
3697 #include <isl/polynomial.h>
3698 __isl_give isl_union_pw_qpolynomial *
3699 isl_union_pw_qpolynomial_read_from_str(
3700 isl_ctx *ctx, const char *str);
3702 For sets and relations,
3703 the input format is autodetected and may be either the C<PolyLib> format
3704 or the C<isl> format.
3708 Before anything can be printed, an C<isl_printer> needs to
3711 __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3713 __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3714 __isl_null isl_printer *isl_printer_free(
3715 __isl_take isl_printer *printer);
3717 C<isl_printer_to_file> prints to the given file, while
3718 C<isl_printer_to_str> prints to a string that can be extracted
3719 using the following function.
3721 #include <isl/printer.h>
3722 __isl_give char *isl_printer_get_str(
3723 __isl_keep isl_printer *printer);
3725 The printer can be inspected using the following functions.
3727 FILE *isl_printer_get_file(
3728 __isl_keep isl_printer *printer);
3729 int isl_printer_get_output_format(
3730 __isl_keep isl_printer *p);
3731 int isl_printer_get_yaml_style(__isl_keep isl_printer *p);
3733 The behavior of the printer can be modified in various ways
3735 __isl_give isl_printer *isl_printer_set_output_format(
3736 __isl_take isl_printer *p, int output_format);
3737 __isl_give isl_printer *isl_printer_set_indent(
3738 __isl_take isl_printer *p, int indent);
3739 __isl_give isl_printer *isl_printer_set_indent_prefix(
3740 __isl_take isl_printer *p, const char *prefix);
3741 __isl_give isl_printer *isl_printer_indent(
3742 __isl_take isl_printer *p, int indent);
3743 __isl_give isl_printer *isl_printer_set_prefix(
3744 __isl_take isl_printer *p, const char *prefix);
3745 __isl_give isl_printer *isl_printer_set_suffix(
3746 __isl_take isl_printer *p, const char *suffix);
3747 __isl_give isl_printer *isl_printer_set_yaml_style(
3748 __isl_take isl_printer *p, int yaml_style);
3750 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3751 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3752 and defaults to C<ISL_FORMAT_ISL>.
3753 Each line in the output is prefixed by C<indent_prefix>,
3754 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3755 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3756 In the C<PolyLib> format output,
3757 the coefficients of the existentially quantified variables
3758 appear between those of the set variables and those
3760 The function C<isl_printer_indent> increases the indentation
3761 by the specified amount (which may be negative).
3762 The YAML style may be either C<ISL_YAML_STYLE_BLOCK> or
3763 C<ISL_YAML_STYLE_FLOW> and when we are printing something
3766 To actually print something, use
3768 #include <isl/printer.h>
3769 __isl_give isl_printer *isl_printer_print_double(
3770 __isl_take isl_printer *p, double d);
3772 #include <isl/val.h>
3773 __isl_give isl_printer *isl_printer_print_val(
3774 __isl_take isl_printer *p, __isl_keep isl_val *v);
3776 #include <isl/set.h>
3777 __isl_give isl_printer *isl_printer_print_basic_set(
3778 __isl_take isl_printer *printer,
3779 __isl_keep isl_basic_set *bset);
3780 __isl_give isl_printer *isl_printer_print_set(
3781 __isl_take isl_printer *printer,
3782 __isl_keep isl_set *set);
3784 #include <isl/map.h>
3785 __isl_give isl_printer *isl_printer_print_basic_map(
3786 __isl_take isl_printer *printer,
3787 __isl_keep isl_basic_map *bmap);
3788 __isl_give isl_printer *isl_printer_print_map(
3789 __isl_take isl_printer *printer,
3790 __isl_keep isl_map *map);
3792 #include <isl/union_set.h>
3793 __isl_give isl_printer *isl_printer_print_union_set(
3794 __isl_take isl_printer *p,
3795 __isl_keep isl_union_set *uset);
3797 #include <isl/union_map.h>
3798 __isl_give isl_printer *isl_printer_print_union_map(
3799 __isl_take isl_printer *p,
3800 __isl_keep isl_union_map *umap);
3802 #include <isl/val.h>
3803 __isl_give isl_printer *isl_printer_print_multi_val(
3804 __isl_take isl_printer *p,
3805 __isl_keep isl_multi_val *mv);
3807 #include <isl/aff.h>
3808 __isl_give isl_printer *isl_printer_print_aff(
3809 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3810 __isl_give isl_printer *isl_printer_print_multi_aff(
3811 __isl_take isl_printer *p,
3812 __isl_keep isl_multi_aff *maff);
3813 __isl_give isl_printer *isl_printer_print_pw_aff(
3814 __isl_take isl_printer *p,
3815 __isl_keep isl_pw_aff *pwaff);
3816 __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3817 __isl_take isl_printer *p,
3818 __isl_keep isl_pw_multi_aff *pma);
3819 __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3820 __isl_take isl_printer *p,
3821 __isl_keep isl_multi_pw_aff *mpa);
3822 __isl_give isl_printer *isl_printer_print_union_pw_aff(
3823 __isl_take isl_printer *p,
3824 __isl_keep isl_union_pw_aff *upa);
3825 __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3826 __isl_take isl_printer *p,
3827 __isl_keep isl_union_pw_multi_aff *upma);
3828 __isl_give isl_printer *
3829 isl_printer_print_multi_union_pw_aff(
3830 __isl_take isl_printer *p,
3831 __isl_keep isl_multi_union_pw_aff *mupa);
3833 #include <isl/polynomial.h>
3834 __isl_give isl_printer *isl_printer_print_qpolynomial(
3835 __isl_take isl_printer *p,
3836 __isl_keep isl_qpolynomial *qp);
3837 __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3838 __isl_take isl_printer *p,
3839 __isl_keep isl_pw_qpolynomial *pwqp);
3840 __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3841 __isl_take isl_printer *p,
3842 __isl_keep isl_union_pw_qpolynomial *upwqp);
3844 __isl_give isl_printer *
3845 isl_printer_print_pw_qpolynomial_fold(
3846 __isl_take isl_printer *p,
3847 __isl_keep isl_pw_qpolynomial_fold *pwf);
3848 __isl_give isl_printer *
3849 isl_printer_print_union_pw_qpolynomial_fold(
3850 __isl_take isl_printer *p,
3851 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3853 For C<isl_printer_print_qpolynomial>,
3854 C<isl_printer_print_pw_qpolynomial> and
3855 C<isl_printer_print_pw_qpolynomial_fold>,
3856 the output format of the printer
3857 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3858 For C<isl_printer_print_union_pw_qpolynomial> and
3859 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3861 In case of printing in C<ISL_FORMAT_C>, the user may want
3862 to set the names of all dimensions first.
3864 C<isl> also provides limited support for printing YAML documents,
3865 just enough for the internal use for printing such documents.
3867 #include <isl/printer.h>
3868 __isl_give isl_printer *isl_printer_yaml_start_mapping(
3869 __isl_take isl_printer *p);
3870 __isl_give isl_printer *isl_printer_yaml_end_mapping(
3871 __isl_take isl_printer *p);
3872 __isl_give isl_printer *isl_printer_yaml_start_sequence(
3873 __isl_take isl_printer *p);
3874 __isl_give isl_printer *isl_printer_yaml_end_sequence(
3875 __isl_take isl_printer *p);
3876 __isl_give isl_printer *isl_printer_yaml_next(
3877 __isl_take isl_printer *p);
3879 A document is started by a call to either
3880 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3881 Anything printed to the printer after such a call belong to the
3882 first key of the mapping or the first element in the sequence.
3883 The function C<isl_printer_yaml_next> moves to the value if
3884 we are currently printing a mapping key, the next key if we
3885 are printing a value or the next element if we are printing
3886 an element in a sequence.
3887 Nested mappings and sequences are initiated by the same
3888 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3889 Each call to these functions needs to have a corresponding call to
3890 C<isl_printer_yaml_end_mapping> or C<isl_printer_yaml_end_sequence>.
3892 When called on a file printer, the following function flushes
3893 the file. When called on a string printer, the buffer is cleared.
3895 __isl_give isl_printer *isl_printer_flush(
3896 __isl_take isl_printer *p);
3898 The following functions allow the user to attach
3899 notes to a printer in order to keep track of additional state.
3901 #include <isl/printer.h>
3902 isl_bool isl_printer_has_note(__isl_keep isl_printer *p,
3903 __isl_keep isl_id *id);
3904 __isl_give isl_id *isl_printer_get_note(
3905 __isl_keep isl_printer *p, __isl_take isl_id *id);
3906 __isl_give isl_printer *isl_printer_set_note(
3907 __isl_take isl_printer *p,
3908 __isl_take isl_id *id, __isl_take isl_id *note);
3910 C<isl_printer_set_note> associates the given note to the given
3911 identifier in the printer.
3912 C<isl_printer_get_note> retrieves a note associated to an
3914 C<isl_printer_has_note> checks if there is such a note.
3915 C<isl_printer_get_note> fails if the requested note does not exist.
3917 Alternatively, a string representation can be obtained
3918 directly using the following functions, which always print
3922 __isl_give char *isl_id_to_str(
3923 __isl_keep isl_id *id);
3925 #include <isl/space.h>
3926 __isl_give char *isl_space_to_str(
3927 __isl_keep isl_space *space);
3929 #include <isl/val.h>
3930 __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3931 __isl_give char *isl_multi_val_to_str(
3932 __isl_keep isl_multi_val *mv);
3934 #include <isl/set.h>
3935 __isl_give char *isl_basic_set_to_str(
3936 __isl_keep isl_basic_set *bset);
3937 __isl_give char *isl_set_to_str(
3938 __isl_keep isl_set *set);
3940 #include <isl/union_set.h>
3941 __isl_give char *isl_union_set_to_str(
3942 __isl_keep isl_union_set *uset);
3944 #include <isl/map.h>
3945 __isl_give char *isl_basic_map_to_str(
3946 __isl_keep isl_basic_map *bmap);
3947 __isl_give char *isl_map_to_str(
3948 __isl_keep isl_map *map);
3950 #include <isl/union_map.h>
3951 __isl_give char *isl_union_map_to_str(
3952 __isl_keep isl_union_map *umap);
3954 #include <isl/aff.h>
3955 __isl_give char *isl_aff_to_str(__isl_keep isl_aff *aff);
3956 __isl_give char *isl_pw_aff_to_str(
3957 __isl_keep isl_pw_aff *pa);
3958 __isl_give char *isl_multi_aff_to_str(
3959 __isl_keep isl_multi_aff *ma);
3960 __isl_give char *isl_pw_multi_aff_to_str(
3961 __isl_keep isl_pw_multi_aff *pma);
3962 __isl_give char *isl_multi_pw_aff_to_str(
3963 __isl_keep isl_multi_pw_aff *mpa);
3964 __isl_give char *isl_union_pw_aff_to_str(
3965 __isl_keep isl_union_pw_aff *upa);
3966 __isl_give char *isl_union_pw_multi_aff_to_str(
3967 __isl_keep isl_union_pw_multi_aff *upma);
3968 __isl_give char *isl_multi_union_pw_aff_to_str(
3969 __isl_keep isl_multi_union_pw_aff *mupa);
3971 #include <isl/point.h>
3972 __isl_give char *isl_point_to_str(
3973 __isl_keep isl_point *pnt);
3975 #include <isl/polynomial.h>
3976 __isl_give char *isl_pw_qpolynomial_to_str(
3977 __isl_keep isl_pw_qpolynomial *pwqp);
3978 __isl_give char *isl_union_pw_qpolynomial_to_str(
3979 __isl_keep isl_union_pw_qpolynomial *upwqp);
3983 =head3 Unary Properties
3989 The following functions test whether the given set or relation
3990 contains any integer points. The ``plain'' variants do not perform
3991 any computations, but simply check if the given set or relation
3992 is already known to be empty.
3994 #include <isl/set.h>
3995 isl_bool isl_basic_set_plain_is_empty(
3996 __isl_keep isl_basic_set *bset);
3997 isl_bool isl_basic_set_is_empty(
3998 __isl_keep isl_basic_set *bset);
3999 isl_bool isl_set_plain_is_empty(
4000 __isl_keep isl_set *set);
4001 isl_bool isl_set_is_empty(__isl_keep isl_set *set);
4003 #include <isl/union_set.h>
4004 isl_bool isl_union_set_is_empty(
4005 __isl_keep isl_union_set *uset);
4007 #include <isl/map.h>
4008 isl_bool isl_basic_map_plain_is_empty(
4009 __isl_keep isl_basic_map *bmap);
4010 isl_bool isl_basic_map_is_empty(
4011 __isl_keep isl_basic_map *bmap);
4012 isl_bool isl_map_plain_is_empty(
4013 __isl_keep isl_map *map);
4014 isl_bool isl_map_is_empty(__isl_keep isl_map *map);
4016 #include <isl/union_map.h>
4017 isl_bool isl_union_map_plain_is_empty(
4018 __isl_keep isl_union_map *umap);
4019 isl_bool isl_union_map_is_empty(
4020 __isl_keep isl_union_map *umap);
4022 =item * Universality
4024 isl_bool isl_basic_set_plain_is_universe(
4025 __isl_keep isl_basic_set *bset);
4026 isl_bool isl_basic_set_is_universe(
4027 __isl_keep isl_basic_set *bset);
4028 isl_bool isl_basic_map_plain_is_universe(
4029 __isl_keep isl_basic_map *bmap);
4030 isl_bool isl_basic_map_is_universe(
4031 __isl_keep isl_basic_map *bmap);
4032 isl_bool isl_set_plain_is_universe(
4033 __isl_keep isl_set *set);
4034 isl_bool isl_map_plain_is_universe(
4035 __isl_keep isl_map *map);
4037 =item * Single-valuedness
4039 #include <isl/set.h>
4040 isl_bool isl_set_is_singleton(__isl_keep isl_set *set);
4042 #include <isl/map.h>
4043 isl_bool isl_basic_map_is_single_valued(
4044 __isl_keep isl_basic_map *bmap);
4045 isl_bool isl_map_plain_is_single_valued(
4046 __isl_keep isl_map *map);
4047 isl_bool isl_map_is_single_valued(__isl_keep isl_map *map);
4049 #include <isl/union_map.h>
4050 isl_bool isl_union_map_is_single_valued(
4051 __isl_keep isl_union_map *umap);
4055 isl_bool isl_map_plain_is_injective(
4056 __isl_keep isl_map *map);
4057 isl_bool isl_map_is_injective(
4058 __isl_keep isl_map *map);
4059 isl_bool isl_union_map_plain_is_injective(
4060 __isl_keep isl_union_map *umap);
4061 isl_bool isl_union_map_is_injective(
4062 __isl_keep isl_union_map *umap);
4066 isl_bool isl_map_is_bijective(
4067 __isl_keep isl_map *map);
4068 isl_bool isl_union_map_is_bijective(
4069 __isl_keep isl_union_map *umap);
4073 The following functions test whether the given relation
4074 only maps elements to themselves.
4076 #include <isl/map.h>
4077 isl_bool isl_map_is_identity(
4078 __isl_keep isl_map *map);
4080 #include <isl/union_map.h>
4081 isl_bool isl_union_map_is_identity(
4082 __isl_keep isl_union_map *umap);
4086 __isl_give isl_val *
4087 isl_basic_map_plain_get_val_if_fixed(
4088 __isl_keep isl_basic_map *bmap,
4089 enum isl_dim_type type, unsigned pos);
4090 __isl_give isl_val *isl_set_plain_get_val_if_fixed(
4091 __isl_keep isl_set *set,
4092 enum isl_dim_type type, unsigned pos);
4093 __isl_give isl_val *isl_map_plain_get_val_if_fixed(
4094 __isl_keep isl_map *map,
4095 enum isl_dim_type type, unsigned pos);
4097 If the set or relation obviously lies on a hyperplane where the given dimension
4098 has a fixed value, then return that value.
4099 Otherwise return NaN.
4103 isl_stat isl_set_dim_residue_class_val(
4104 __isl_keep isl_set *set,
4105 int pos, __isl_give isl_val **modulo,
4106 __isl_give isl_val **residue);
4108 Check if the values of the given set dimension are equal to a fixed
4109 value modulo some integer value. If so, assign the modulo to C<*modulo>
4110 and the fixed value to C<*residue>. If the given dimension attains only
4111 a single value, then assign C<0> to C<*modulo> and the fixed value to
4113 If the dimension does not attain only a single value and if no modulo
4114 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
4116 #include <isl/set.h>
4117 __isl_give isl_stride_info *isl_set_get_stride_info(
4118 __isl_keep isl_set *set, int pos);
4119 __isl_give isl_val *isl_set_get_stride(
4120 __isl_keep isl_set *set, int pos);
4122 #include <isl/map.h>
4123 __isl_give isl_stride_info *
4124 isl_map_get_range_stride_info(
4125 __isl_keep isl_map *map, int pos);
4127 Check if the values of the given set dimension are equal to
4128 some affine expression of the other dimensions (the offset)
4129 modulo some integer stride or
4130 check if the values of the given output dimensions are equal to
4131 some affine expression of the input dimensions (the offset)
4132 modulo some integer stride.
4133 If no more specific information can be found, then the stride
4134 is taken to be one and the offset is taken to be the zero expression.
4135 The function C<isl_set_get_stride> performs the same
4136 computation as C<isl_set_get_stride_info> but only returns the stride.
4137 For the other functions,
4138 the stride and offset can be extracted from the returned object
4139 using the following functions.
4141 #include <isl/stride_info.h>
4142 __isl_give isl_val *isl_stride_info_get_stride(
4143 __isl_keep isl_stride_info *si);
4144 __isl_give isl_aff *isl_stride_info_get_offset(
4145 __isl_keep isl_stride_info *si);
4147 The stride info object can be copied and released using the following
4150 #include <isl/stride_info.h>
4151 __isl_give isl_stride_info *isl_stride_info_copy(
4152 __isl_keep isl_stride_info *si);
4153 __isl_null isl_stride_info *isl_stride_info_free(
4154 __isl_take isl_stride_info *si);
4158 To check whether the description of a set, relation or function depends
4159 on a parameter or one or more given dimensions,
4160 the following functions can be used.
4162 #include <isl/constraint.h>
4163 isl_bool isl_constraint_involves_dims(
4164 __isl_keep isl_constraint *constraint,
4165 enum isl_dim_type type, unsigned first, unsigned n);
4167 #include <isl/set.h>
4168 isl_bool isl_basic_set_involves_dims(
4169 __isl_keep isl_basic_set *bset,
4170 enum isl_dim_type type, unsigned first, unsigned n);
4171 isl_bool isl_set_involves_dims(__isl_keep isl_set *set,
4172 enum isl_dim_type type, unsigned first, unsigned n);
4174 #include <isl/map.h>
4175 isl_bool isl_basic_map_involves_dims(
4176 __isl_keep isl_basic_map *bmap,
4177 enum isl_dim_type type, unsigned first, unsigned n);
4178 isl_bool isl_map_involves_dims(__isl_keep isl_map *map,
4179 enum isl_dim_type type, unsigned first, unsigned n);
4181 #include <isl/union_map.h>
4182 isl_bool isl_union_map_involves_dims(
4183 __isl_keep isl_union_map *umap,
4184 enum isl_dim_type type, unsigned first, unsigned n);
4186 #include <isl/aff.h>
4187 isl_bool isl_aff_involves_dims(__isl_keep isl_aff *aff,
4188 enum isl_dim_type type, unsigned first, unsigned n);
4189 isl_bool isl_pw_aff_involves_param_id(
4190 __isl_keep isl_pw_aff *pa,
4191 __isl_keep isl_id *id);
4192 isl_bool isl_pw_aff_involves_dims(
4193 __isl_keep isl_pw_aff *pwaff,
4194 enum isl_dim_type type, unsigned first, unsigned n);
4195 isl_bool isl_multi_aff_involves_dims(
4196 __isl_keep isl_multi_aff *ma,
4197 enum isl_dim_type type, unsigned first, unsigned n);
4198 isl_bool isl_pw_multi_aff_involves_param_id(
4199 __isl_keep isl_pw_multi_aff *pma,
4200 __isl_keep isl_id *id);
4201 isl_bool isl_pw_multi_aff_involves_dims(
4202 __isl_keep isl_pw_multi_aff *pma,
4203 enum isl_dim_type type, unsigned first, unsigned n);
4204 isl_bool isl_multi_pw_aff_involves_dims(
4205 __isl_keep isl_multi_pw_aff *mpa,
4206 enum isl_dim_type type, unsigned first, unsigned n);
4208 #include <isl/polynomial.h>
4209 isl_bool isl_qpolynomial_involves_dims(
4210 __isl_keep isl_qpolynomial *qp,
4211 enum isl_dim_type type, unsigned first, unsigned n);
4212 isl_bool isl_pw_qpolynomial_involves_param_id(
4213 __isl_keep isl_pw_qpolynomial *pwqp,
4214 __isl_keep isl_id *id);
4215 isl_bool isl_pw_qpolynomial_fold_involves_param_id(
4216 __isl_keep isl_pw_qpolynomial_fold *pwf,
4217 __isl_keep isl_id *id);
4219 Similarly, the following functions can be used to check whether
4220 a given dimension is involved in any lower or upper bound.
4222 #include <isl/set.h>
4223 isl_bool isl_set_dim_has_any_lower_bound(
4224 __isl_keep isl_set *set,
4225 enum isl_dim_type type, unsigned pos);
4226 isl_bool isl_set_dim_has_any_upper_bound(
4227 __isl_keep isl_set *set,
4228 enum isl_dim_type type, unsigned pos);
4230 Note that these functions return true even if there is a bound on
4231 the dimension on only some of the basic sets of C<set>.
4232 To check if they have a bound for all of the basic sets in C<set>,
4233 use the following functions instead.
4235 #include <isl/set.h>
4236 isl_bool isl_set_dim_has_lower_bound(
4237 __isl_keep isl_set *set,
4238 enum isl_dim_type type, unsigned pos);
4239 isl_bool isl_set_dim_has_upper_bound(
4240 __isl_keep isl_set *set,
4241 enum isl_dim_type type, unsigned pos);
4245 To check whether a set is a parameter domain, use this function:
4247 isl_bool isl_set_is_params(__isl_keep isl_set *set);
4248 isl_bool isl_union_set_is_params(
4249 __isl_keep isl_union_set *uset);
4253 The following functions check whether the space of the given
4254 (basic) set or relation domain and/or range is a wrapped relation.
4256 #include <isl/space.h>
4257 isl_bool isl_space_is_wrapping(
4258 __isl_keep isl_space *space);
4259 isl_bool isl_space_domain_is_wrapping(
4260 __isl_keep isl_space *space);
4261 isl_bool isl_space_range_is_wrapping(
4262 __isl_keep isl_space *space);
4263 isl_bool isl_space_is_product(
4264 __isl_keep isl_space *space);
4266 #include <isl/set.h>
4267 isl_bool isl_basic_set_is_wrapping(
4268 __isl_keep isl_basic_set *bset);
4269 isl_bool isl_set_is_wrapping(__isl_keep isl_set *set);
4271 #include <isl/map.h>
4272 isl_bool isl_map_domain_is_wrapping(
4273 __isl_keep isl_map *map);
4274 isl_bool isl_map_range_is_wrapping(
4275 __isl_keep isl_map *map);
4276 isl_bool isl_map_is_product(__isl_keep isl_map *map);
4278 #include <isl/val.h>
4279 isl_bool isl_multi_val_range_is_wrapping(
4280 __isl_keep isl_multi_val *mv);
4282 #include <isl/aff.h>
4283 isl_bool isl_multi_aff_range_is_wrapping(
4284 __isl_keep isl_multi_aff *ma);
4285 isl_bool isl_multi_pw_aff_range_is_wrapping(
4286 __isl_keep isl_multi_pw_aff *mpa);
4287 isl_bool isl_multi_union_pw_aff_range_is_wrapping(
4288 __isl_keep isl_multi_union_pw_aff *mupa);
4290 The input to C<isl_space_is_wrapping> should
4291 be the space of a set, while that of
4292 C<isl_space_domain_is_wrapping> and
4293 C<isl_space_range_is_wrapping> should be the space of a relation.
4294 The input to C<isl_space_is_product> can be either the space
4295 of a set or that of a binary relation.
4296 In case the input is the space of a binary relation, it checks
4297 whether both domain and range are wrapping.
4299 =item * Internal Product
4301 isl_bool isl_basic_map_can_zip(
4302 __isl_keep isl_basic_map *bmap);
4303 isl_bool isl_map_can_zip(__isl_keep isl_map *map);
4305 Check whether the product of domain and range of the given relation
4307 i.e., whether both domain and range are nested relations.
4311 #include <isl/space.h>
4312 isl_bool isl_space_can_curry(
4313 __isl_keep isl_space *space);
4315 #include <isl/map.h>
4316 isl_bool isl_basic_map_can_curry(
4317 __isl_keep isl_basic_map *bmap);
4318 isl_bool isl_map_can_curry(__isl_keep isl_map *map);
4320 Check whether the domain of the (basic) relation is a wrapped relation.
4322 #include <isl/space.h>
4323 __isl_give isl_space *isl_space_uncurry(
4324 __isl_take isl_space *space);
4326 #include <isl/map.h>
4327 isl_bool isl_basic_map_can_uncurry(
4328 __isl_keep isl_basic_map *bmap);
4329 isl_bool isl_map_can_uncurry(__isl_keep isl_map *map);
4331 Check whether the range of the (basic) relation is a wrapped relation.
4333 #include <isl/space.h>
4334 isl_bool isl_space_can_range_curry(
4335 __isl_keep isl_space *space);
4337 #include <isl/map.h>
4338 isl_bool isl_map_can_range_curry(
4339 __isl_keep isl_map *map);
4341 Check whether the domain of the relation wrapped in the range of
4342 the input is itself a wrapped relation.
4344 =item * Special Values
4346 #include <isl/aff.h>
4347 isl_bool isl_aff_is_cst(__isl_keep isl_aff *aff);
4348 isl_bool isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
4349 isl_bool isl_multi_pw_aff_is_cst(
4350 __isl_keep isl_multi_pw_aff *mpa);
4352 Check whether the given expression is a constant.
4354 #include <isl/val.h>
4355 isl_bool isl_multi_val_involves_nan(
4356 __isl_keep isl_multi_val *mv);
4358 #include <isl/aff.h>
4359 isl_bool isl_aff_is_nan(__isl_keep isl_aff *aff);
4360 isl_bool isl_multi_aff_involves_nan(
4361 __isl_keep isl_multi_aff *ma);
4362 isl_bool isl_pw_aff_involves_nan(
4363 __isl_keep isl_pw_aff *pa);
4364 isl_bool isl_pw_multi_aff_involves_nan(
4365 __isl_keep isl_pw_multi_aff *pma);
4366 isl_bool isl_multi_pw_aff_involves_nan(
4367 __isl_keep isl_multi_pw_aff *mpa);
4368 isl_bool isl_union_pw_aff_involves_nan(
4369 __isl_keep isl_union_pw_aff *upa);
4370 isl_bool isl_union_pw_multi_aff_involves_nan(
4371 __isl_keep isl_union_pw_multi_aff *upma);
4372 isl_bool isl_multi_union_pw_aff_involves_nan(
4373 __isl_keep isl_multi_union_pw_aff *mupa);
4375 #include <isl/polynomial.h>
4376 isl_bool isl_qpolynomial_is_nan(
4377 __isl_keep isl_qpolynomial *qp);
4378 isl_bool isl_qpolynomial_fold_is_nan(
4379 __isl_keep isl_qpolynomial_fold *fold);
4380 isl_bool isl_pw_qpolynomial_involves_nan(
4381 __isl_keep isl_pw_qpolynomial *pwqp);
4382 isl_bool isl_pw_qpolynomial_fold_involves_nan(
4383 __isl_keep isl_pw_qpolynomial_fold *pwf);
4384 isl_bool isl_union_pw_qpolynomial_involves_nan(
4385 __isl_keep isl_union_pw_qpolynomial *upwqp);
4386 isl_bool isl_union_pw_qpolynomial_fold_involves_nan(
4387 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
4389 Check whether the given expression is equal to or involves NaN.
4391 #include <isl/aff.h>
4392 isl_bool isl_aff_plain_is_zero(
4393 __isl_keep isl_aff *aff);
4395 Check whether the affine expression is obviously zero.
4399 =head3 Binary Properties
4405 The following functions check whether two objects
4406 represent the same set, relation or function.
4407 The C<plain> variants only return true if the objects
4408 are obviously the same. That is, they may return false
4409 even if the objects are the same, but they will never
4410 return true if the objects are not the same.
4412 #include <isl/set.h>
4413 isl_bool isl_basic_set_plain_is_equal(
4414 __isl_keep isl_basic_set *bset1,
4415 __isl_keep isl_basic_set *bset2);
4416 isl_bool isl_basic_set_is_equal(
4417 __isl_keep isl_basic_set *bset1,
4418 __isl_keep isl_basic_set *bset2);
4419 isl_bool isl_set_plain_is_equal(
4420 __isl_keep isl_set *set1,
4421 __isl_keep isl_set *set2);
4422 isl_bool isl_set_is_equal(__isl_keep isl_set *set1,
4423 __isl_keep isl_set *set2);
4425 #include <isl/map.h>
4426 isl_bool isl_basic_map_is_equal(
4427 __isl_keep isl_basic_map *bmap1,
4428 __isl_keep isl_basic_map *bmap2);
4429 isl_bool isl_map_is_equal(__isl_keep isl_map *map1,
4430 __isl_keep isl_map *map2);
4431 isl_bool isl_map_plain_is_equal(
4432 __isl_keep isl_map *map1,
4433 __isl_keep isl_map *map2);
4435 #include <isl/union_set.h>
4436 isl_bool isl_union_set_is_equal(
4437 __isl_keep isl_union_set *uset1,
4438 __isl_keep isl_union_set *uset2);
4440 #include <isl/union_map.h>
4441 isl_bool isl_union_map_is_equal(
4442 __isl_keep isl_union_map *umap1,
4443 __isl_keep isl_union_map *umap2);
4445 #include <isl/val.h>
4446 isl_bool isl_multi_val_plain_is_equal(
4447 __isl_keep isl_multi_val *mv1,
4448 __isl_keep isl_multi_val *mv2);
4450 #include <isl/aff.h>
4451 isl_bool isl_aff_plain_is_equal(
4452 __isl_keep isl_aff *aff1,
4453 __isl_keep isl_aff *aff2);
4454 isl_bool isl_multi_aff_plain_is_equal(
4455 __isl_keep isl_multi_aff *maff1,
4456 __isl_keep isl_multi_aff *maff2);
4457 isl_bool isl_pw_aff_plain_is_equal(
4458 __isl_keep isl_pw_aff *pwaff1,
4459 __isl_keep isl_pw_aff *pwaff2);
4460 isl_bool isl_pw_aff_is_equal(
4461 __isl_keep isl_pw_aff *pa1,
4462 __isl_keep isl_pw_aff *pa2);
4463 isl_bool isl_pw_multi_aff_plain_is_equal(
4464 __isl_keep isl_pw_multi_aff *pma1,
4465 __isl_keep isl_pw_multi_aff *pma2);
4466 isl_bool isl_pw_multi_aff_is_equal(
4467 __isl_keep isl_pw_multi_aff *pma1,
4468 __isl_keep isl_pw_multi_aff *pma2);
4469 isl_bool isl_multi_pw_aff_plain_is_equal(
4470 __isl_keep isl_multi_pw_aff *mpa1,
4471 __isl_keep isl_multi_pw_aff *mpa2);
4472 isl_bool isl_multi_pw_aff_is_equal(
4473 __isl_keep isl_multi_pw_aff *mpa1,
4474 __isl_keep isl_multi_pw_aff *mpa2);
4475 isl_bool isl_union_pw_aff_plain_is_equal(
4476 __isl_keep isl_union_pw_aff *upa1,
4477 __isl_keep isl_union_pw_aff *upa2);
4478 isl_bool isl_union_pw_multi_aff_plain_is_equal(
4479 __isl_keep isl_union_pw_multi_aff *upma1,
4480 __isl_keep isl_union_pw_multi_aff *upma2);
4481 isl_bool isl_multi_union_pw_aff_plain_is_equal(
4482 __isl_keep isl_multi_union_pw_aff *mupa1,
4483 __isl_keep isl_multi_union_pw_aff *mupa2);
4485 #include <isl/polynomial.h>
4486 isl_bool isl_union_pw_qpolynomial_plain_is_equal(
4487 __isl_keep isl_union_pw_qpolynomial *upwqp1,
4488 __isl_keep isl_union_pw_qpolynomial *upwqp2);
4489 isl_bool isl_union_pw_qpolynomial_fold_plain_is_equal(
4490 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
4491 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
4493 =item * Disjointness
4495 #include <isl/set.h>
4496 isl_bool isl_basic_set_is_disjoint(
4497 __isl_keep isl_basic_set *bset1,
4498 __isl_keep isl_basic_set *bset2);
4499 isl_bool isl_set_plain_is_disjoint(
4500 __isl_keep isl_set *set1,
4501 __isl_keep isl_set *set2);
4502 isl_bool isl_set_is_disjoint(__isl_keep isl_set *set1,
4503 __isl_keep isl_set *set2);
4505 #include <isl/map.h>
4506 isl_bool isl_basic_map_is_disjoint(
4507 __isl_keep isl_basic_map *bmap1,
4508 __isl_keep isl_basic_map *bmap2);
4509 isl_bool isl_map_is_disjoint(__isl_keep isl_map *map1,
4510 __isl_keep isl_map *map2);
4512 #include <isl/union_set.h>
4513 isl_bool isl_union_set_is_disjoint(
4514 __isl_keep isl_union_set *uset1,
4515 __isl_keep isl_union_set *uset2);
4517 #include <isl/union_map.h>
4518 isl_bool isl_union_map_is_disjoint(
4519 __isl_keep isl_union_map *umap1,
4520 __isl_keep isl_union_map *umap2);
4524 isl_bool isl_basic_set_is_subset(
4525 __isl_keep isl_basic_set *bset1,
4526 __isl_keep isl_basic_set *bset2);
4527 isl_bool isl_set_is_subset(__isl_keep isl_set *set1,
4528 __isl_keep isl_set *set2);
4529 isl_bool isl_set_is_strict_subset(
4530 __isl_keep isl_set *set1,
4531 __isl_keep isl_set *set2);
4532 isl_bool isl_union_set_is_subset(
4533 __isl_keep isl_union_set *uset1,
4534 __isl_keep isl_union_set *uset2);
4535 isl_bool isl_union_set_is_strict_subset(
4536 __isl_keep isl_union_set *uset1,
4537 __isl_keep isl_union_set *uset2);
4538 isl_bool isl_basic_map_is_subset(
4539 __isl_keep isl_basic_map *bmap1,
4540 __isl_keep isl_basic_map *bmap2);
4541 isl_bool isl_basic_map_is_strict_subset(
4542 __isl_keep isl_basic_map *bmap1,
4543 __isl_keep isl_basic_map *bmap2);
4544 isl_bool isl_map_is_subset(
4545 __isl_keep isl_map *map1,
4546 __isl_keep isl_map *map2);
4547 isl_bool isl_map_is_strict_subset(
4548 __isl_keep isl_map *map1,
4549 __isl_keep isl_map *map2);
4550 isl_bool isl_union_map_is_subset(
4551 __isl_keep isl_union_map *umap1,
4552 __isl_keep isl_union_map *umap2);
4553 isl_bool isl_union_map_is_strict_subset(
4554 __isl_keep isl_union_map *umap1,
4555 __isl_keep isl_union_map *umap2);
4557 Check whether the first argument is a (strict) subset of the
4562 Every comparison function returns a negative value if the first
4563 argument is considered smaller than the second, a positive value
4564 if the first argument is considered greater and zero if the two
4565 constraints are considered the same by the comparison criterion.
4567 #include <isl/constraint.h>
4568 int isl_constraint_plain_cmp(
4569 __isl_keep isl_constraint *c1,
4570 __isl_keep isl_constraint *c2);
4572 This function is useful for sorting C<isl_constraint>s.
4573 The order depends on the internal representation of the inputs.
4574 The order is fixed over different calls to the function (assuming
4575 the internal representation of the inputs has not changed), but may
4576 change over different versions of C<isl>.
4578 #include <isl/constraint.h>
4579 int isl_constraint_cmp_last_non_zero(
4580 __isl_keep isl_constraint *c1,
4581 __isl_keep isl_constraint *c2);
4583 This function can be used to sort constraints that live in the same
4584 local space. Constraints that involve ``earlier'' dimensions or
4585 that have a smaller coefficient for the shared latest dimension
4586 are considered smaller than other constraints.
4587 This function only defines a B<partial> order.
4589 #include <isl/set.h>
4590 int isl_set_plain_cmp(__isl_keep isl_set *set1,
4591 __isl_keep isl_set *set2);
4593 This function is useful for sorting C<isl_set>s.
4594 The order depends on the internal representation of the inputs.
4595 The order is fixed over different calls to the function (assuming
4596 the internal representation of the inputs has not changed), but may
4597 change over different versions of C<isl>.
4599 #include <isl/aff.h>
4600 int isl_multi_aff_plain_cmp(
4601 __isl_keep isl_multi_aff *ma1,
4602 __isl_keep isl_multi_aff *ma2);
4603 int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
4604 __isl_keep isl_pw_aff *pa2);
4606 The functions C<isl_multi_aff_plain_cmp> and
4607 C<isl_pw_aff_plain_cmp> can be used to sort C<isl_multi_aff>s and
4608 C<isl_pw_aff>s. The order is not strictly defined.
4609 The current order sorts expressions that only involve
4610 earlier dimensions before those that involve later dimensions.
4614 =head2 Unary Operations
4620 __isl_give isl_set *isl_set_complement(
4621 __isl_take isl_set *set);
4622 __isl_give isl_map *isl_map_complement(
4623 __isl_take isl_map *map);
4627 #include <isl/space.h>
4628 __isl_give isl_space *isl_space_reverse(
4629 __isl_take isl_space *space);
4631 #include <isl/map.h>
4632 __isl_give isl_basic_map *isl_basic_map_reverse(
4633 __isl_take isl_basic_map *bmap);
4634 __isl_give isl_map *isl_map_reverse(
4635 __isl_take isl_map *map);
4637 #include <isl/union_map.h>
4638 __isl_give isl_union_map *isl_union_map_reverse(
4639 __isl_take isl_union_map *umap);
4643 #include <isl/space.h>
4644 __isl_give isl_space *isl_space_domain(
4645 __isl_take isl_space *space);
4646 __isl_give isl_space *isl_space_range(
4647 __isl_take isl_space *space);
4648 __isl_give isl_space *isl_space_params(
4649 __isl_take isl_space *space);
4651 #include <isl/local_space.h>
4652 __isl_give isl_local_space *isl_local_space_domain(
4653 __isl_take isl_local_space *ls);
4654 __isl_give isl_local_space *isl_local_space_range(
4655 __isl_take isl_local_space *ls);
4657 #include <isl/set.h>
4658 __isl_give isl_basic_set *isl_basic_set_project_out(
4659 __isl_take isl_basic_set *bset,
4660 enum isl_dim_type type, unsigned first, unsigned n);
4661 __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
4662 enum isl_dim_type type, unsigned first, unsigned n);
4663 __isl_give isl_map *isl_set_project_onto_map(
4664 __isl_take isl_set *set,
4665 enum isl_dim_type type, unsigned first,
4667 __isl_give isl_basic_set *isl_basic_set_params(
4668 __isl_take isl_basic_set *bset);
4669 __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
4671 The function C<isl_set_project_onto_map> returns a relation
4672 that projects the input set onto the given set dimensions.
4674 #include <isl/map.h>
4675 __isl_give isl_basic_map *isl_basic_map_project_out(
4676 __isl_take isl_basic_map *bmap,
4677 enum isl_dim_type type, unsigned first, unsigned n);
4678 __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
4679 enum isl_dim_type type, unsigned first, unsigned n);
4680 __isl_give isl_basic_set *isl_basic_map_domain(
4681 __isl_take isl_basic_map *bmap);
4682 __isl_give isl_basic_set *isl_basic_map_range(
4683 __isl_take isl_basic_map *bmap);
4684 __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
4685 __isl_give isl_set *isl_map_domain(
4686 __isl_take isl_map *bmap);
4687 __isl_give isl_set *isl_map_range(
4688 __isl_take isl_map *map);
4690 #include <isl/union_set.h>
4691 __isl_give isl_union_set *isl_union_set_project_out(
4692 __isl_take isl_union_set *uset,
4693 enum isl_dim_type type,
4694 unsigned first, unsigned n);
4695 __isl_give isl_union_set *
4696 isl_union_set_project_out_all_params(
4697 __isl_take isl_union_set *uset);
4698 __isl_give isl_set *isl_union_set_params(
4699 __isl_take isl_union_set *uset);
4701 The function C<isl_union_set_project_out> can only project out
4704 #include <isl/union_map.h>
4705 __isl_give isl_union_map *isl_union_map_project_out(
4706 __isl_take isl_union_map *umap,
4707 enum isl_dim_type type, unsigned first, unsigned n);
4708 __isl_give isl_union_map *
4709 isl_union_map_project_out_all_params(
4710 __isl_take isl_union_map *umap);
4711 __isl_give isl_set *isl_union_map_params(
4712 __isl_take isl_union_map *umap);
4713 __isl_give isl_union_set *isl_union_map_domain(
4714 __isl_take isl_union_map *umap);
4715 __isl_give isl_union_set *isl_union_map_range(
4716 __isl_take isl_union_map *umap);
4718 The function C<isl_union_map_project_out> can only project out
4721 #include <isl/aff.h>
4722 __isl_give isl_aff *isl_aff_project_domain_on_params(
4723 __isl_take isl_aff *aff);
4724 __isl_give isl_multi_aff *
4725 isl_multi_aff_project_domain_on_params(
4726 __isl_take isl_multi_aff *ma);
4727 __isl_give isl_pw_aff *
4728 isl_pw_aff_project_domain_on_params(
4729 __isl_take isl_pw_aff *pa);
4730 __isl_give isl_multi_pw_aff *
4731 isl_multi_pw_aff_project_domain_on_params(
4732 __isl_take isl_multi_pw_aff *mpa);
4733 __isl_give isl_pw_multi_aff *
4734 isl_pw_multi_aff_project_domain_on_params(
4735 __isl_take isl_pw_multi_aff *pma);
4736 __isl_give isl_set *isl_pw_aff_domain(
4737 __isl_take isl_pw_aff *pwaff);
4738 __isl_give isl_set *isl_pw_multi_aff_domain(
4739 __isl_take isl_pw_multi_aff *pma);
4740 __isl_give isl_set *isl_multi_pw_aff_domain(
4741 __isl_take isl_multi_pw_aff *mpa);
4742 __isl_give isl_union_set *isl_union_pw_aff_domain(
4743 __isl_take isl_union_pw_aff *upa);
4744 __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
4745 __isl_take isl_union_pw_multi_aff *upma);
4746 __isl_give isl_union_set *
4747 isl_multi_union_pw_aff_domain(
4748 __isl_take isl_multi_union_pw_aff *mupa);
4749 __isl_give isl_set *isl_pw_aff_params(
4750 __isl_take isl_pw_aff *pwa);
4752 If no explicit domain was set on a zero-dimensional input to
4753 C<isl_multi_union_pw_aff_domain>, then this function will
4754 return a parameter set.
4756 #include <isl/polynomial.h>
4757 __isl_give isl_qpolynomial *
4758 isl_qpolynomial_project_domain_on_params(
4759 __isl_take isl_qpolynomial *qp);
4760 __isl_give isl_pw_qpolynomial *
4761 isl_pw_qpolynomial_project_domain_on_params(
4762 __isl_take isl_pw_qpolynomial *pwqp);
4763 __isl_give isl_pw_qpolynomial_fold *
4764 isl_pw_qpolynomial_fold_project_domain_on_params(
4765 __isl_take isl_pw_qpolynomial_fold *pwf);
4766 __isl_give isl_set *isl_pw_qpolynomial_domain(
4767 __isl_take isl_pw_qpolynomial *pwqp);
4768 __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
4769 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4770 __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
4771 __isl_take isl_union_pw_qpolynomial *upwqp);
4773 #include <isl/space.h>
4774 __isl_give isl_space *isl_space_domain_map(
4775 __isl_take isl_space *space);
4776 __isl_give isl_space *isl_space_range_map(
4777 __isl_take isl_space *space);
4779 #include <isl/map.h>
4780 __isl_give isl_map *isl_set_wrapped_domain_map(
4781 __isl_take isl_set *set);
4782 __isl_give isl_basic_map *isl_basic_map_domain_map(
4783 __isl_take isl_basic_map *bmap);
4784 __isl_give isl_basic_map *isl_basic_map_range_map(
4785 __isl_take isl_basic_map *bmap);
4786 __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
4787 __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
4789 #include <isl/union_map.h>
4790 __isl_give isl_union_map *isl_union_map_domain_map(
4791 __isl_take isl_union_map *umap);
4792 __isl_give isl_union_pw_multi_aff *
4793 isl_union_map_domain_map_union_pw_multi_aff(
4794 __isl_take isl_union_map *umap);
4795 __isl_give isl_union_map *isl_union_map_range_map(
4796 __isl_take isl_union_map *umap);
4797 __isl_give isl_union_map *
4798 isl_union_set_wrapped_domain_map(
4799 __isl_take isl_union_set *uset);
4801 The functions above construct a (basic, regular or union) relation
4802 that maps (a wrapped version of) the input relation to its domain or range.
4803 C<isl_set_wrapped_domain_map> maps the input set to the domain
4804 of its wrapped relation.
4808 __isl_give isl_basic_set *isl_basic_set_eliminate(
4809 __isl_take isl_basic_set *bset,
4810 enum isl_dim_type type,
4811 unsigned first, unsigned n);
4812 __isl_give isl_set *isl_set_eliminate(
4813 __isl_take isl_set *set, enum isl_dim_type type,
4814 unsigned first, unsigned n);
4815 __isl_give isl_basic_map *isl_basic_map_eliminate(
4816 __isl_take isl_basic_map *bmap,
4817 enum isl_dim_type type,
4818 unsigned first, unsigned n);
4819 __isl_give isl_map *isl_map_eliminate(
4820 __isl_take isl_map *map, enum isl_dim_type type,
4821 unsigned first, unsigned n);
4823 Eliminate the coefficients for the given dimensions from the constraints,
4824 without removing the dimensions.
4826 =item * Constructing a set from a parameter domain
4828 A set space of a given dimension and with an optional name
4829 can be created from a parameter space using the following functions.
4831 #include <isl/space.h>
4832 __isl_give isl_space *isl_space_add_unnamed_tuple_ui(
4833 __isl_take isl_space *space, unsigned dim);
4834 __isl_give isl_space *
4835 isl_space_add_named_tuple_id_ui(
4836 __isl_take isl_space *space,
4837 __isl_take isl_id *tuple_id, unsigned dim);
4839 A zero-dimensional (local) space or (basic) set can be constructed
4840 on a given parameter domain using the following functions.
4842 #include <isl/space.h>
4843 __isl_give isl_space *isl_space_set_from_params(
4844 __isl_take isl_space *space);
4846 #include <isl/local_space.h>
4847 __isl_give isl_local_space *
4848 isl_local_space_set_from_params(
4849 __isl_take isl_local_space *ls);
4851 #include <isl/set.h>
4852 __isl_give isl_basic_set *isl_basic_set_from_params(
4853 __isl_take isl_basic_set *bset);
4854 __isl_give isl_set *isl_set_from_params(
4855 __isl_take isl_set *set);
4857 =item * Constructing a relation from one or two sets
4859 A map space with a range of a given dimension and with an optional name
4860 can be created from a domain space using the functions
4861 C<isl_space_add_unnamed_tuple_ui> and C<isl_space_add_named_tuple_id_ui>
4864 Create a relation with the given set(s) as domain and/or range.
4865 If only the domain or the range is specified, then
4866 the range or domain of the created relation is a zero-dimensional
4867 flat anonymous space.
4869 #include <isl/space.h>
4870 __isl_give isl_space *isl_space_from_domain(
4871 __isl_take isl_space *space);
4872 __isl_give isl_space *isl_space_from_range(
4873 __isl_take isl_space *space);
4874 __isl_give isl_space *isl_space_map_from_set(
4875 __isl_take isl_space *space);
4876 __isl_give isl_space *isl_space_map_from_domain_and_range(
4877 __isl_take isl_space *domain,
4878 __isl_take isl_space *range);
4880 #include <isl/local_space.h>
4881 __isl_give isl_local_space *isl_local_space_from_domain(
4882 __isl_take isl_local_space *ls);
4884 #include <isl/map.h>
4885 __isl_give isl_map *isl_map_from_domain(
4886 __isl_take isl_set *set);
4887 __isl_give isl_map *isl_map_from_range(
4888 __isl_take isl_set *set);
4890 #include <isl/union_map.h>
4891 __isl_give isl_union_map *isl_union_map_from_domain(
4892 __isl_take isl_union_set *uset);
4893 __isl_give isl_union_map *isl_union_map_from_range(
4894 __isl_take isl_union_set *uset);
4895 __isl_give isl_union_map *
4896 isl_union_map_from_domain_and_range(
4897 __isl_take isl_union_set *domain,
4898 __isl_take isl_union_set *range);
4900 #include <isl/val.h>
4901 __isl_give isl_multi_val *isl_multi_val_from_range(
4902 __isl_take isl_multi_val *mv);
4904 #include <isl/aff.h>
4905 __isl_give isl_aff *isl_aff_from_range(
4906 __isl_take isl_aff *aff);
4907 __isl_give isl_multi_aff *isl_multi_aff_from_range(
4908 __isl_take isl_multi_aff *ma);
4909 __isl_give isl_pw_aff *isl_pw_aff_from_range(
4910 __isl_take isl_pw_aff *pwa);
4911 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
4912 __isl_take isl_multi_pw_aff *mpa);
4913 __isl_give isl_multi_union_pw_aff *
4914 isl_multi_union_pw_aff_from_range(
4915 __isl_take isl_multi_union_pw_aff *mupa);
4916 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
4917 __isl_take isl_set *set);
4918 __isl_give isl_union_pw_multi_aff *
4919 isl_union_pw_multi_aff_from_domain(
4920 __isl_take isl_union_set *uset);
4922 #include <isl/polynomial.h>
4923 __isl_give isl_pw_qpolynomial *
4924 isl_pw_qpolynomial_from_range(
4925 __isl_take isl_pw_qpolynomial *pwqp);
4926 __isl_give isl_pw_qpolynomial_fold *
4927 isl_pw_qpolynomial_fold_from_range(
4928 __isl_take isl_pw_qpolynomial_fold *pwf);
4932 #include <isl/set.h>
4933 __isl_give isl_basic_set *isl_basic_set_fix_si(
4934 __isl_take isl_basic_set *bset,
4935 enum isl_dim_type type, unsigned pos, int value);
4936 __isl_give isl_basic_set *isl_basic_set_fix_val(
4937 __isl_take isl_basic_set *bset,
4938 enum isl_dim_type type, unsigned pos,
4939 __isl_take isl_val *v);
4940 __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
4941 enum isl_dim_type type, unsigned pos, int value);
4942 __isl_give isl_set *isl_set_fix_val(
4943 __isl_take isl_set *set,
4944 enum isl_dim_type type, unsigned pos,
4945 __isl_take isl_val *v);
4947 #include <isl/map.h>
4948 __isl_give isl_basic_map *isl_basic_map_fix_si(
4949 __isl_take isl_basic_map *bmap,
4950 enum isl_dim_type type, unsigned pos, int value);
4951 __isl_give isl_basic_map *isl_basic_map_fix_val(
4952 __isl_take isl_basic_map *bmap,
4953 enum isl_dim_type type, unsigned pos,
4954 __isl_take isl_val *v);
4955 __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
4956 enum isl_dim_type type, unsigned pos, int value);
4957 __isl_give isl_map *isl_map_fix_val(
4958 __isl_take isl_map *map,
4959 enum isl_dim_type type, unsigned pos,
4960 __isl_take isl_val *v);
4962 #include <isl/aff.h>
4963 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
4964 __isl_take isl_pw_multi_aff *pma,
4965 enum isl_dim_type type, unsigned pos, int value);
4967 #include <isl/polynomial.h>
4968 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
4969 __isl_take isl_pw_qpolynomial *pwqp,
4970 enum isl_dim_type type, unsigned n,
4971 __isl_take isl_val *v);
4972 __isl_give isl_pw_qpolynomial_fold *
4973 isl_pw_qpolynomial_fold_fix_val(
4974 __isl_take isl_pw_qpolynomial_fold *pwf,
4975 enum isl_dim_type type, unsigned n,
4976 __isl_take isl_val *v);
4978 Intersect the set, relation or function domain
4979 with the hyperplane where the given
4980 dimension has the fixed given value.
4982 #include <isl/set.h>
4983 __isl_give isl_basic_set *
4984 isl_basic_set_lower_bound_val(
4985 __isl_take isl_basic_set *bset,
4986 enum isl_dim_type type, unsigned pos,
4987 __isl_take isl_val *value);
4988 __isl_give isl_basic_set *
4989 isl_basic_set_upper_bound_val(
4990 __isl_take isl_basic_set *bset,
4991 enum isl_dim_type type, unsigned pos,
4992 __isl_take isl_val *value);
4993 __isl_give isl_set *isl_set_lower_bound_si(
4994 __isl_take isl_set *set,
4995 enum isl_dim_type type, unsigned pos, int value);
4996 __isl_give isl_set *isl_set_lower_bound_val(
4997 __isl_take isl_set *set,
4998 enum isl_dim_type type, unsigned pos,
4999 __isl_take isl_val *value);
5000 __isl_give isl_set *isl_set_upper_bound_si(
5001 __isl_take isl_set *set,
5002 enum isl_dim_type type, unsigned pos, int value);
5003 __isl_give isl_set *isl_set_upper_bound_val(
5004 __isl_take isl_set *set,
5005 enum isl_dim_type type, unsigned pos,
5006 __isl_take isl_val *value);
5008 #include <isl/map.h>
5009 __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
5010 __isl_take isl_basic_map *bmap,
5011 enum isl_dim_type type, unsigned pos, int value);
5012 __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
5013 __isl_take isl_basic_map *bmap,
5014 enum isl_dim_type type, unsigned pos, int value);
5015 __isl_give isl_map *isl_map_lower_bound_si(
5016 __isl_take isl_map *map,
5017 enum isl_dim_type type, unsigned pos, int value);
5018 __isl_give isl_map *isl_map_upper_bound_si(
5019 __isl_take isl_map *map,
5020 enum isl_dim_type type, unsigned pos, int value);
5022 Intersect the set or relation with the half-space where the given
5023 dimension has a value bounded by the fixed given integer value.
5025 __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
5026 enum isl_dim_type type1, int pos1,
5027 enum isl_dim_type type2, int pos2);
5028 __isl_give isl_basic_map *isl_basic_map_equate(
5029 __isl_take isl_basic_map *bmap,
5030 enum isl_dim_type type1, int pos1,
5031 enum isl_dim_type type2, int pos2);
5032 __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
5033 enum isl_dim_type type1, int pos1,
5034 enum isl_dim_type type2, int pos2);
5036 Intersect the set or relation with the hyperplane where the given
5037 dimensions are equal to each other.
5039 __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
5040 enum isl_dim_type type1, int pos1,
5041 enum isl_dim_type type2, int pos2);
5043 Intersect the relation with the hyperplane where the given
5044 dimensions have opposite values.
5046 __isl_give isl_map *isl_map_order_le(
5047 __isl_take isl_map *map,
5048 enum isl_dim_type type1, int pos1,
5049 enum isl_dim_type type2, int pos2);
5050 __isl_give isl_basic_map *isl_basic_map_order_ge(
5051 __isl_take isl_basic_map *bmap,
5052 enum isl_dim_type type1, int pos1,
5053 enum isl_dim_type type2, int pos2);
5054 __isl_give isl_map *isl_map_order_ge(
5055 __isl_take isl_map *map,
5056 enum isl_dim_type type1, int pos1,
5057 enum isl_dim_type type2, int pos2);
5058 __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
5059 enum isl_dim_type type1, int pos1,
5060 enum isl_dim_type type2, int pos2);
5061 __isl_give isl_basic_map *isl_basic_map_order_gt(
5062 __isl_take isl_basic_map *bmap,
5063 enum isl_dim_type type1, int pos1,
5064 enum isl_dim_type type2, int pos2);
5065 __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
5066 enum isl_dim_type type1, int pos1,
5067 enum isl_dim_type type2, int pos2);
5069 Intersect the relation with the half-space where the given
5070 dimensions satisfy the given ordering.
5072 #include <isl/union_set.h>
5073 __isl_give isl_union_map *isl_union_map_remove_map_if(
5074 __isl_take isl_union_map *umap,
5075 isl_bool (*fn)(__isl_keep isl_map *map,
5076 void *user), void *user);
5078 This function calls the callback function once for each
5079 pair of spaces for which there are elements in the input.
5080 If the callback returns C<isl_bool_true>, then all those elements
5081 are removed from the result. The only remaining elements in the output
5082 are then those for which the callback returns C<isl_bool_false>.
5086 #include <isl/aff.h>
5087 __isl_give isl_basic_set *isl_aff_zero_basic_set(
5088 __isl_take isl_aff *aff);
5089 __isl_give isl_basic_set *isl_aff_neg_basic_set(
5090 __isl_take isl_aff *aff);
5091 __isl_give isl_set *isl_pw_aff_pos_set(
5092 __isl_take isl_pw_aff *pa);
5093 __isl_give isl_set *isl_pw_aff_nonneg_set(
5094 __isl_take isl_pw_aff *pwaff);
5095 __isl_give isl_set *isl_pw_aff_zero_set(
5096 __isl_take isl_pw_aff *pwaff);
5097 __isl_give isl_set *isl_pw_aff_non_zero_set(
5098 __isl_take isl_pw_aff *pwaff);
5099 __isl_give isl_union_set *
5100 isl_union_pw_aff_zero_union_set(
5101 __isl_take isl_union_pw_aff *upa);
5102 __isl_give isl_union_set *
5103 isl_multi_union_pw_aff_zero_union_set(
5104 __isl_take isl_multi_union_pw_aff *mupa);
5106 The function C<isl_aff_neg_basic_set> returns a basic set
5107 containing those elements in the domain space
5108 of C<aff> where C<aff> is negative.
5109 The function C<isl_pw_aff_nonneg_set> returns a set
5110 containing those elements in the domain
5111 of C<pwaff> where C<pwaff> is non-negative.
5112 The function C<isl_multi_union_pw_aff_zero_union_set>
5113 returns a union set containing those elements
5114 in the domains of its elements where they are all zero.
5118 __isl_give isl_map *isl_set_identity(
5119 __isl_take isl_set *set);
5120 __isl_give isl_union_map *isl_union_set_identity(
5121 __isl_take isl_union_set *uset);
5122 __isl_give isl_union_pw_multi_aff *
5123 isl_union_set_identity_union_pw_multi_aff(
5124 __isl_take isl_union_set *uset);
5126 Construct an identity relation on the given (union) set.
5128 =item * Function Extraction
5130 A piecewise quasi affine expression that is equal to 1 on a set
5131 and 0 outside the set can be created using the following function.
5133 #include <isl/aff.h>
5134 __isl_give isl_pw_aff *isl_set_indicator_function(
5135 __isl_take isl_set *set);
5137 A piecewise multiple quasi affine expression can be extracted
5138 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
5139 and the C<isl_map> is single-valued.
5140 In case of a conversion from an C<isl_union_map>
5141 to an C<isl_union_pw_multi_aff>, these properties need to hold
5142 in each domain space.
5143 A conversion to a C<isl_multi_union_pw_aff> additionally
5144 requires that the input is non-empty and involves only a single
5147 #include <isl/aff.h>
5148 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
5149 __isl_take isl_set *set);
5150 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
5151 __isl_take isl_map *map);
5153 __isl_give isl_union_pw_multi_aff *
5154 isl_union_pw_multi_aff_from_union_set(
5155 __isl_take isl_union_set *uset);
5156 __isl_give isl_union_pw_multi_aff *
5157 isl_union_pw_multi_aff_from_union_map(
5158 __isl_take isl_union_map *umap);
5160 __isl_give isl_multi_union_pw_aff *
5161 isl_multi_union_pw_aff_from_union_map(
5162 __isl_take isl_union_map *umap);
5166 __isl_give isl_basic_set *isl_basic_map_deltas(
5167 __isl_take isl_basic_map *bmap);
5168 __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
5169 __isl_give isl_union_set *isl_union_map_deltas(
5170 __isl_take isl_union_map *umap);
5172 These functions return a (basic) set containing the differences
5173 between image elements and corresponding domain elements in the input.
5175 __isl_give isl_basic_map *isl_basic_map_deltas_map(
5176 __isl_take isl_basic_map *bmap);
5177 __isl_give isl_map *isl_map_deltas_map(
5178 __isl_take isl_map *map);
5179 __isl_give isl_union_map *isl_union_map_deltas_map(
5180 __isl_take isl_union_map *umap);
5182 The functions above construct a (basic, regular or union) relation
5183 that maps (a wrapped version of) the input relation to its delta set.
5187 Simplify the representation of a set, relation or functions by trying
5188 to combine pairs of basic sets or relations into a single
5189 basic set or relation.
5191 #include <isl/set.h>
5192 __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
5194 #include <isl/map.h>
5195 __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
5197 #include <isl/union_set.h>
5198 __isl_give isl_union_set *isl_union_set_coalesce(
5199 __isl_take isl_union_set *uset);
5201 #include <isl/union_map.h>
5202 __isl_give isl_union_map *isl_union_map_coalesce(
5203 __isl_take isl_union_map *umap);
5205 #include <isl/aff.h>
5206 __isl_give isl_pw_aff *isl_pw_aff_coalesce(
5207 __isl_take isl_pw_aff *pwqp);
5208 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
5209 __isl_take isl_pw_multi_aff *pma);
5210 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
5211 __isl_take isl_multi_pw_aff *mpa);
5212 __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
5213 __isl_take isl_union_pw_aff *upa);
5214 __isl_give isl_union_pw_multi_aff *
5215 isl_union_pw_multi_aff_coalesce(
5216 __isl_take isl_union_pw_multi_aff *upma);
5217 __isl_give isl_multi_union_pw_aff *
5218 isl_multi_union_pw_aff_coalesce(
5219 __isl_take isl_multi_union_pw_aff *aff);
5221 #include <isl/polynomial.h>
5222 __isl_give isl_pw_qpolynomial_fold *
5223 isl_pw_qpolynomial_fold_coalesce(
5224 __isl_take isl_pw_qpolynomial_fold *pwf);
5225 __isl_give isl_union_pw_qpolynomial *
5226 isl_union_pw_qpolynomial_coalesce(
5227 __isl_take isl_union_pw_qpolynomial *upwqp);
5228 __isl_give isl_union_pw_qpolynomial_fold *
5229 isl_union_pw_qpolynomial_fold_coalesce(
5230 __isl_take isl_union_pw_qpolynomial_fold *upwf);
5232 One of the methods for combining pairs of basic sets or relations
5233 can result in coefficients that are much larger than those that appear
5234 in the constraints of the input. By default, the coefficients are
5235 not allowed to grow larger, but this can be changed by unsetting
5236 the following option.
5238 isl_stat isl_options_set_coalesce_bounded_wrapping(
5239 isl_ctx *ctx, int val);
5240 int isl_options_get_coalesce_bounded_wrapping(
5243 One of the other methods tries to combine pairs of basic sets
5244 with different local variables, treating them as existentially
5245 quantified variables even if they have known (but different)
5246 integer division expressions. The result may then also have
5247 existentially quantified variables. Turning on the following
5248 option prevents this from happening.
5250 isl_stat isl_options_set_coalesce_preserve_locals(
5251 isl_ctx *ctx, int val);
5252 int isl_options_get_coalesce_preserve_locals(isl_ctx *ctx);
5254 =item * Detecting equalities
5256 __isl_give isl_basic_set *isl_basic_set_detect_equalities(
5257 __isl_take isl_basic_set *bset);
5258 __isl_give isl_basic_map *isl_basic_map_detect_equalities(
5259 __isl_take isl_basic_map *bmap);
5260 __isl_give isl_set *isl_set_detect_equalities(
5261 __isl_take isl_set *set);
5262 __isl_give isl_map *isl_map_detect_equalities(
5263 __isl_take isl_map *map);
5264 __isl_give isl_union_set *isl_union_set_detect_equalities(
5265 __isl_take isl_union_set *uset);
5266 __isl_give isl_union_map *isl_union_map_detect_equalities(
5267 __isl_take isl_union_map *umap);
5269 Simplify the representation of a set or relation by detecting implicit
5272 =item * Removing redundant constraints
5274 #include <isl/set.h>
5275 __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
5276 __isl_take isl_basic_set *bset);
5277 __isl_give isl_set *isl_set_remove_redundancies(
5278 __isl_take isl_set *set);
5280 #include <isl/union_set.h>
5281 __isl_give isl_union_set *
5282 isl_union_set_remove_redundancies(
5283 __isl_take isl_union_set *uset);
5285 #include <isl/map.h>
5286 __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
5287 __isl_take isl_basic_map *bmap);
5288 __isl_give isl_map *isl_map_remove_redundancies(
5289 __isl_take isl_map *map);
5291 #include <isl/union_map.h>
5292 __isl_give isl_union_map *
5293 isl_union_map_remove_redundancies(
5294 __isl_take isl_union_map *umap);
5298 __isl_give isl_basic_set *isl_set_convex_hull(
5299 __isl_take isl_set *set);
5300 __isl_give isl_basic_map *isl_map_convex_hull(
5301 __isl_take isl_map *map);
5303 If the input set or relation has any existentially quantified
5304 variables, then the result of these operations is currently undefined.
5308 #include <isl/set.h>
5309 __isl_give isl_basic_set *
5310 isl_set_unshifted_simple_hull(
5311 __isl_take isl_set *set);
5312 __isl_give isl_basic_set *isl_set_simple_hull(
5313 __isl_take isl_set *set);
5314 __isl_give isl_basic_set *
5315 isl_set_plain_unshifted_simple_hull(
5316 __isl_take isl_set *set);
5317 __isl_give isl_basic_set *
5318 isl_set_unshifted_simple_hull_from_set_list(
5319 __isl_take isl_set *set,
5320 __isl_take isl_set_list *list);
5322 #include <isl/map.h>
5323 __isl_give isl_basic_map *
5324 isl_map_unshifted_simple_hull(
5325 __isl_take isl_map *map);
5326 __isl_give isl_basic_map *isl_map_simple_hull(
5327 __isl_take isl_map *map);
5328 __isl_give isl_basic_map *
5329 isl_map_plain_unshifted_simple_hull(
5330 __isl_take isl_map *map);
5331 __isl_give isl_basic_map *
5332 isl_map_unshifted_simple_hull_from_map_list(
5333 __isl_take isl_map *map,
5334 __isl_take isl_map_list *list);
5336 #include <isl/union_map.h>
5337 __isl_give isl_union_map *isl_union_map_simple_hull(
5338 __isl_take isl_union_map *umap);
5340 These functions compute a single basic set or relation
5341 that contains the whole input set or relation.
5342 In particular, the output is described by translates
5343 of the constraints describing the basic sets or relations in the input.
5344 In case of C<isl_set_unshifted_simple_hull>, only the original
5345 constraints are used, without any translation.
5346 In case of C<isl_set_plain_unshifted_simple_hull> and
5347 C<isl_map_plain_unshifted_simple_hull>, the result is described
5348 by original constraints that are obviously satisfied
5349 by the entire input set or relation.
5350 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
5351 C<isl_map_unshifted_simple_hull_from_map_list>, the
5352 constraints are taken from the elements of the second argument.
5356 (See \autoref{s:simple hull}.)
5362 __isl_give isl_basic_set *isl_basic_set_affine_hull(
5363 __isl_take isl_basic_set *bset);
5364 __isl_give isl_basic_set *isl_set_affine_hull(
5365 __isl_take isl_set *set);
5366 __isl_give isl_union_set *isl_union_set_affine_hull(
5367 __isl_take isl_union_set *uset);
5368 __isl_give isl_basic_map *isl_basic_map_affine_hull(
5369 __isl_take isl_basic_map *bmap);
5370 __isl_give isl_basic_map *isl_map_affine_hull(
5371 __isl_take isl_map *map);
5372 __isl_give isl_union_map *isl_union_map_affine_hull(
5373 __isl_take isl_union_map *umap);
5375 In case of union sets and relations, the affine hull is computed
5378 =item * Polyhedral hull
5380 __isl_give isl_basic_set *isl_set_polyhedral_hull(
5381 __isl_take isl_set *set);
5382 __isl_give isl_basic_map *isl_map_polyhedral_hull(
5383 __isl_take isl_map *map);
5384 __isl_give isl_union_set *isl_union_set_polyhedral_hull(
5385 __isl_take isl_union_set *uset);
5386 __isl_give isl_union_map *isl_union_map_polyhedral_hull(
5387 __isl_take isl_union_map *umap);
5389 These functions compute a single basic set or relation
5390 not involving any existentially quantified variables
5391 that contains the whole input set or relation.
5392 In case of union sets and relations, the polyhedral hull is computed
5397 #include <isl/map.h>
5398 __isl_give isl_fixed_box *
5399 isl_map_get_range_simple_fixed_box_hull(
5400 __isl_keep isl_map *map);
5402 This function tries to approximate the range of the map by a box of fixed size.
5403 The box is described in terms of an offset living in the same space as
5404 the input map and a size living in the range space. For any element
5405 in the input map, the range value is greater than or equal to
5406 the offset applied to the domain value and the difference with
5407 this offset is strictly smaller than the size.
5408 If no fixed-size approximation of the range can be found,
5409 an I<invalid> box is returned, i.e., one for which
5410 C<isl_fixed_box_is_valid> below returns false.
5412 The validity, the offset and the size of the box can be obtained using
5413 the following functions.
5415 #include <isl/fixed_box.h>
5416 isl_bool isl_fixed_box_is_valid(
5417 __isl_keep isl_fixed_box *box);
5418 __isl_give isl_multi_aff *isl_fixed_box_get_offset(
5419 __isl_keep isl_fixed_box *box);
5420 __isl_give isl_multi_val *isl_fixed_box_get_size(
5421 __isl_keep isl_fixed_box *box);
5423 The box can be copied and freed using the following functions.
5425 #include <isl/fixed_box.h>
5426 __isl_give isl_fixed_box *isl_fixed_box_copy(
5427 __isl_keep isl_fixed_box *box);
5428 __isl_null isl_fixed_box *isl_fixed_box_free(
5429 __isl_take isl_fixed_box *box);
5431 A representation of the information contained in an object
5432 of type C<isl_fixed_box> can be obtained using
5434 #include <isl/fixed_box.h>
5435 __isl_give isl_printer *isl_printer_print_fixed_box(
5436 __isl_take isl_printer *p,
5437 __isl_keep isl_fixed_box *box);
5438 __isl_give char *isl_fixed_box_to_str(
5439 __isl_keep isl_fixed_box *box);
5441 C<isl_fixed_box_to_str> prints the information in flow format.
5443 =item * Other approximations
5445 #include <isl/set.h>
5446 __isl_give isl_basic_set *
5447 isl_basic_set_drop_constraints_involving_dims(
5448 __isl_take isl_basic_set *bset,
5449 enum isl_dim_type type,
5450 unsigned first, unsigned n);
5451 __isl_give isl_basic_set *
5452 isl_basic_set_drop_constraints_not_involving_dims(
5453 __isl_take isl_basic_set *bset,
5454 enum isl_dim_type type,
5455 unsigned first, unsigned n);
5456 __isl_give isl_set *
5457 isl_set_drop_constraints_involving_dims(
5458 __isl_take isl_set *set,
5459 enum isl_dim_type type,
5460 unsigned first, unsigned n);
5461 __isl_give isl_set *
5462 isl_set_drop_constraints_not_involving_dims(
5463 __isl_take isl_set *set,
5464 enum isl_dim_type type,
5465 unsigned first, unsigned n);
5467 #include <isl/map.h>
5468 __isl_give isl_basic_map *
5469 isl_basic_map_drop_constraints_involving_dims(
5470 __isl_take isl_basic_map *bmap,
5471 enum isl_dim_type type,
5472 unsigned first, unsigned n);
5473 __isl_give isl_basic_map *
5474 isl_basic_map_drop_constraints_not_involving_dims(
5475 __isl_take isl_basic_map *bmap,
5476 enum isl_dim_type type,
5477 unsigned first, unsigned n);
5478 __isl_give isl_map *
5479 isl_map_drop_constraints_involving_dims(
5480 __isl_take isl_map *map,
5481 enum isl_dim_type type,
5482 unsigned first, unsigned n);
5483 __isl_give isl_map *
5484 isl_map_drop_constraints_not_involving_dims(
5485 __isl_take isl_map *map,
5486 enum isl_dim_type type,
5487 unsigned first, unsigned n);
5489 These functions drop any constraints (not) involving the specified dimensions.
5490 Note that the result depends on the representation of the input.
5492 #include <isl/polynomial.h>
5493 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
5494 __isl_take isl_pw_qpolynomial *pwqp, int sign);
5495 __isl_give isl_union_pw_qpolynomial *
5496 isl_union_pw_qpolynomial_to_polynomial(
5497 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
5499 Approximate each quasipolynomial by a polynomial. If C<sign> is positive,
5500 the polynomial will be an overapproximation. If C<sign> is negative,
5501 it will be an underapproximation. If C<sign> is zero, the approximation
5502 will lie somewhere in between.
5506 __isl_give isl_basic_set *isl_basic_set_sample(
5507 __isl_take isl_basic_set *bset);
5508 __isl_give isl_basic_set *isl_set_sample(
5509 __isl_take isl_set *set);
5510 __isl_give isl_basic_map *isl_basic_map_sample(
5511 __isl_take isl_basic_map *bmap);
5512 __isl_give isl_basic_map *isl_map_sample(
5513 __isl_take isl_map *map);
5515 If the input (basic) set or relation is non-empty, then return
5516 a singleton subset of the input. Otherwise, return an empty set.
5518 =item * Optimization
5520 #include <isl/ilp.h>
5521 __isl_give isl_val *isl_basic_set_max_val(
5522 __isl_keep isl_basic_set *bset,
5523 __isl_keep isl_aff *obj);
5524 __isl_give isl_val *isl_set_min_val(
5525 __isl_keep isl_set *set,
5526 __isl_keep isl_aff *obj);
5527 __isl_give isl_val *isl_set_max_val(
5528 __isl_keep isl_set *set,
5529 __isl_keep isl_aff *obj);
5530 __isl_give isl_multi_val *
5531 isl_union_set_min_multi_union_pw_aff(
5532 __isl_keep isl_union_set *uset,
5533 __isl_keep isl_multi_union_pw_aff *obj);
5535 Compute the minimum or maximum of the integer affine expression C<obj>
5536 over the points in C<set>.
5537 The result is C<NULL> in case of an error, the optimal value in case
5538 there is one, negative infinity or infinity if the problem is unbounded and
5539 NaN if the problem is empty.
5541 #include <isl/ilp.h>
5542 __isl_give isl_val *isl_union_pw_aff_min_val(
5543 __isl_take isl_union_pw_aff *upa);
5544 __isl_give isl_val *isl_union_pw_aff_max_val(
5545 __isl_take isl_union_pw_aff *upa);
5546 __isl_give isl_multi_val *
5547 isl_multi_union_pw_aff_min_multi_val(
5548 __isl_take isl_multi_union_pw_aff *mupa);
5549 __isl_give isl_multi_val *
5550 isl_multi_union_pw_aff_max_multi_val(
5551 __isl_take isl_multi_union_pw_aff *mupa);
5553 Compute the minimum or maximum of the integer affine expression
5554 over its definition domain.
5555 The result is C<NULL> in case of an error, the optimal value in case
5556 there is one, negative infinity or infinity if the problem is unbounded and
5557 NaN if the problem is empty.
5559 #include <isl/ilp.h>
5560 __isl_give isl_val *isl_basic_set_dim_max_val(
5561 __isl_take isl_basic_set *bset, int pos);
5563 Return the maximal value attained by the given set dimension,
5564 independently of the parameter values and of any other dimensions.
5565 The result is C<NULL> in case of an error, the optimal value in case
5566 there is one, infinity if the problem is unbounded and
5567 NaN if the input is empty.
5569 =item * Parametric optimization
5571 __isl_give isl_pw_aff *isl_set_dim_min(
5572 __isl_take isl_set *set, int pos);
5573 __isl_give isl_pw_aff *isl_set_dim_max(
5574 __isl_take isl_set *set, int pos);
5575 __isl_give isl_pw_aff *isl_map_dim_min(
5576 __isl_take isl_map *map, int pos);
5577 __isl_give isl_pw_aff *isl_map_dim_max(
5578 __isl_take isl_map *map, int pos);
5580 Compute the minimum or maximum of the given set or output dimension
5581 as a function of the parameters (and input dimensions), but independently
5582 of the other set or output dimensions.
5583 For lexicographic optimization, see L<"Lexicographic Optimization">.
5587 The following functions compute either the set of (rational) coefficient
5588 values of valid constraints for the given set or the set of (rational)
5589 values satisfying the constraints with coefficients from the given set.
5590 Internally, these two sets of functions perform essentially the
5591 same operations, except that the set of coefficients is assumed to
5592 be a cone, while the set of values may be any polyhedron.
5593 The current implementation is based on the Farkas lemma and
5594 Fourier-Motzkin elimination, but this may change or be made optional
5595 in future. In particular, future implementations may use different
5596 dualization algorithms or skip the elimination step.
5598 #include <isl/set.h>
5599 __isl_give isl_basic_set *isl_basic_set_coefficients(
5600 __isl_take isl_basic_set *bset);
5601 __isl_give isl_basic_set_list *
5602 isl_basic_set_list_coefficients(
5603 __isl_take isl_basic_set_list *list);
5604 __isl_give isl_basic_set *isl_set_coefficients(
5605 __isl_take isl_set *set);
5606 __isl_give isl_union_set *isl_union_set_coefficients(
5607 __isl_take isl_union_set *bset);
5608 __isl_give isl_basic_set *isl_basic_set_solutions(
5609 __isl_take isl_basic_set *bset);
5610 __isl_give isl_basic_set *isl_set_solutions(
5611 __isl_take isl_set *set);
5612 __isl_give isl_union_set *isl_union_set_solutions(
5613 __isl_take isl_union_set *bset);
5617 __isl_give isl_map *isl_map_fixed_power_val(
5618 __isl_take isl_map *map,
5619 __isl_take isl_val *exp);
5620 __isl_give isl_union_map *
5621 isl_union_map_fixed_power_val(
5622 __isl_take isl_union_map *umap,
5623 __isl_take isl_val *exp);
5625 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
5626 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
5627 of C<map> is computed.
5629 __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
5631 __isl_give isl_union_map *isl_union_map_power(
5632 __isl_take isl_union_map *umap, isl_bool *exact);
5634 Compute a parametric representation for all positive powers I<k> of C<map>.
5635 The result maps I<k> to a nested relation corresponding to the
5636 I<k>th power of C<map>.
5637 The result may be an overapproximation. If the result is known to be exact,
5638 then C<*exact> is set to C<1>.
5640 =item * Transitive closure
5642 __isl_give isl_map *isl_map_transitive_closure(
5643 __isl_take isl_map *map, isl_bool *exact);
5644 __isl_give isl_union_map *isl_union_map_transitive_closure(
5645 __isl_take isl_union_map *umap, isl_bool *exact);
5647 Compute the transitive closure of C<map>.
5648 The result may be an overapproximation. If the result is known to be exact,
5649 then C<*exact> is set to C<1>.
5651 =item * Reaching path lengths
5653 __isl_give isl_map *isl_map_reaching_path_lengths(
5654 __isl_take isl_map *map, isl_bool *exact);
5656 Compute a relation that maps each element in the range of C<map>
5657 to the lengths of all paths composed of edges in C<map> that
5658 end up in the given element.
5659 The result may be an overapproximation. If the result is known to be exact,
5660 then C<*exact> is set to C<1>.
5661 To compute the I<maximal> path length, the resulting relation
5662 should be postprocessed by C<isl_map_lexmax>.
5663 In particular, if the input relation is a dependence relation
5664 (mapping sources to sinks), then the maximal path length corresponds
5665 to the free schedule.
5666 Note, however, that C<isl_map_lexmax> expects the maximum to be
5667 finite, so if the path lengths are unbounded (possibly due to
5668 the overapproximation), then you will get an error message.
5672 #include <isl/space.h>
5673 __isl_give isl_space *isl_space_wrap(
5674 __isl_take isl_space *space);
5675 __isl_give isl_space *isl_space_unwrap(
5676 __isl_take isl_space *space);
5678 #include <isl/local_space.h>
5679 __isl_give isl_local_space *isl_local_space_wrap(
5680 __isl_take isl_local_space *ls);
5682 #include <isl/set.h>
5683 __isl_give isl_basic_map *isl_basic_set_unwrap(
5684 __isl_take isl_basic_set *bset);
5685 __isl_give isl_map *isl_set_unwrap(
5686 __isl_take isl_set *set);
5688 #include <isl/map.h>
5689 __isl_give isl_basic_set *isl_basic_map_wrap(
5690 __isl_take isl_basic_map *bmap);
5691 __isl_give isl_set *isl_map_wrap(
5692 __isl_take isl_map *map);
5694 #include <isl/union_set.h>
5695 __isl_give isl_union_map *isl_union_set_unwrap(
5696 __isl_take isl_union_set *uset);
5698 #include <isl/union_map.h>
5699 __isl_give isl_union_set *isl_union_map_wrap(
5700 __isl_take isl_union_map *umap);
5702 The input to C<isl_space_unwrap> should
5703 be the space of a set, while that of
5704 C<isl_space_wrap> should be the space of a relation.
5705 Conversely, the output of C<isl_space_unwrap> is the space
5706 of a relation, while that of C<isl_space_wrap> is the space of a set.
5710 Remove any internal structure of domain (and range) of the given
5711 set or relation. If there is any such internal structure in the input,
5712 then the name of the space is also removed.
5714 #include <isl/space.h>
5715 __isl_give isl_space *isl_space_flatten_domain(
5716 __isl_take isl_space *space);
5717 __isl_give isl_space *isl_space_flatten_range(
5718 __isl_take isl_space *space);
5720 #include <isl/local_space.h>
5721 __isl_give isl_local_space *
5722 isl_local_space_flatten_domain(
5723 __isl_take isl_local_space *ls);
5724 __isl_give isl_local_space *
5725 isl_local_space_flatten_range(
5726 __isl_take isl_local_space *ls);
5728 #include <isl/set.h>
5729 __isl_give isl_basic_set *isl_basic_set_flatten(
5730 __isl_take isl_basic_set *bset);
5731 __isl_give isl_set *isl_set_flatten(
5732 __isl_take isl_set *set);
5734 #include <isl/map.h>
5735 __isl_give isl_basic_map *isl_basic_map_flatten_domain(
5736 __isl_take isl_basic_map *bmap);
5737 __isl_give isl_basic_map *isl_basic_map_flatten_range(
5738 __isl_take isl_basic_map *bmap);
5739 __isl_give isl_map *isl_map_flatten_range(
5740 __isl_take isl_map *map);
5741 __isl_give isl_map *isl_map_flatten_domain(
5742 __isl_take isl_map *map);
5743 __isl_give isl_basic_map *isl_basic_map_flatten(
5744 __isl_take isl_basic_map *bmap);
5745 __isl_give isl_map *isl_map_flatten(
5746 __isl_take isl_map *map);
5748 #include <isl/val.h>
5749 __isl_give isl_multi_val *isl_multi_val_flatten_range(
5750 __isl_take isl_multi_val *mv);
5752 #include <isl/aff.h>
5753 __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
5754 __isl_take isl_multi_aff *ma);
5755 __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
5756 __isl_take isl_multi_aff *ma);
5757 __isl_give isl_multi_pw_aff *
5758 isl_multi_pw_aff_flatten_range(
5759 __isl_take isl_multi_pw_aff *mpa);
5760 __isl_give isl_multi_union_pw_aff *
5761 isl_multi_union_pw_aff_flatten_range(
5762 __isl_take isl_multi_union_pw_aff *mupa);
5764 #include <isl/map.h>
5765 __isl_give isl_map *isl_set_flatten_map(
5766 __isl_take isl_set *set);
5768 The function above constructs a relation
5769 that maps the input set to a flattened version of the set.
5773 Lift the input set to a space with extra dimensions corresponding
5774 to the existentially quantified variables in the input.
5775 In particular, the result lives in a wrapped map where the domain
5776 is the original space and the range corresponds to the original
5777 existentially quantified variables.
5779 #include <isl/set.h>
5780 __isl_give isl_basic_set *isl_basic_set_lift(
5781 __isl_take isl_basic_set *bset);
5782 __isl_give isl_set *isl_set_lift(
5783 __isl_take isl_set *set);
5784 __isl_give isl_union_set *isl_union_set_lift(
5785 __isl_take isl_union_set *uset);
5787 Given a local space that contains the existentially quantified
5788 variables of a set, a basic relation that, when applied to
5789 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
5790 can be constructed using the following function.
5792 #include <isl/local_space.h>
5793 __isl_give isl_basic_map *isl_local_space_lifting(
5794 __isl_take isl_local_space *ls);
5796 #include <isl/aff.h>
5797 __isl_give isl_multi_aff *isl_multi_aff_lift(
5798 __isl_take isl_multi_aff *maff,
5799 __isl_give isl_local_space **ls);
5801 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
5802 then it is assigned the local space that lies at the basis of
5803 the lifting applied.
5805 =item * Internal Product
5807 #include <isl/space.h>
5808 __isl_give isl_space *isl_space_zip(
5809 __isl_take isl_space *space);
5811 #include <isl/map.h>
5812 __isl_give isl_basic_map *isl_basic_map_zip(
5813 __isl_take isl_basic_map *bmap);
5814 __isl_give isl_map *isl_map_zip(
5815 __isl_take isl_map *map);
5817 #include <isl/union_map.h>
5818 __isl_give isl_union_map *isl_union_map_zip(
5819 __isl_take isl_union_map *umap);
5821 Given a relation with nested relations for domain and range,
5822 interchange the range of the domain with the domain of the range.
5826 #include <isl/space.h>
5827 __isl_give isl_space *isl_space_curry(
5828 __isl_take isl_space *space);
5829 __isl_give isl_space *isl_space_uncurry(
5830 __isl_take isl_space *space);
5832 #include <isl/map.h>
5833 __isl_give isl_basic_map *isl_basic_map_curry(
5834 __isl_take isl_basic_map *bmap);
5835 __isl_give isl_basic_map *isl_basic_map_uncurry(
5836 __isl_take isl_basic_map *bmap);
5837 __isl_give isl_map *isl_map_curry(
5838 __isl_take isl_map *map);
5839 __isl_give isl_map *isl_map_uncurry(
5840 __isl_take isl_map *map);
5842 #include <isl/union_map.h>
5843 __isl_give isl_union_map *isl_union_map_curry(
5844 __isl_take isl_union_map *umap);
5845 __isl_give isl_union_map *isl_union_map_uncurry(
5846 __isl_take isl_union_map *umap);
5848 Given a relation with a nested relation for domain,
5849 the C<curry> functions
5850 move the range of the nested relation out of the domain
5851 and use it as the domain of a nested relation in the range,
5852 with the original range as range of this nested relation.
5853 The C<uncurry> functions perform the inverse operation.
5855 #include <isl/space.h>
5856 __isl_give isl_space *isl_space_range_curry(
5857 __isl_take isl_space *space);
5859 #include <isl/map.h>
5860 __isl_give isl_map *isl_map_range_curry(
5861 __isl_take isl_map *map);
5863 #include <isl/union_map.h>
5864 __isl_give isl_union_map *isl_union_map_range_curry(
5865 __isl_take isl_union_map *umap);
5867 These functions apply the currying to the relation that
5868 is nested inside the range of the input.
5870 =item * Aligning parameters
5872 Change the order of the parameters of the given set, relation
5874 such that the first parameters match those of C<model>.
5875 This may involve the introduction of extra parameters.
5876 All parameters need to be named.
5878 #include <isl/space.h>
5879 __isl_give isl_space *isl_space_align_params(
5880 __isl_take isl_space *space1,
5881 __isl_take isl_space *space2)
5883 #include <isl/set.h>
5884 __isl_give isl_basic_set *isl_basic_set_align_params(
5885 __isl_take isl_basic_set *bset,
5886 __isl_take isl_space *model);
5887 __isl_give isl_set *isl_set_align_params(
5888 __isl_take isl_set *set,
5889 __isl_take isl_space *model);
5891 #include <isl/map.h>
5892 __isl_give isl_basic_map *isl_basic_map_align_params(
5893 __isl_take isl_basic_map *bmap,
5894 __isl_take isl_space *model);
5895 __isl_give isl_map *isl_map_align_params(
5896 __isl_take isl_map *map,
5897 __isl_take isl_space *model);
5899 #include <isl/val.h>
5900 __isl_give isl_multi_val *isl_multi_val_align_params(
5901 __isl_take isl_multi_val *mv,
5902 __isl_take isl_space *model);
5904 #include <isl/aff.h>
5905 __isl_give isl_aff *isl_aff_align_params(
5906 __isl_take isl_aff *aff,
5907 __isl_take isl_space *model);
5908 __isl_give isl_multi_aff *isl_multi_aff_align_params(
5909 __isl_take isl_multi_aff *multi,
5910 __isl_take isl_space *model);
5911 __isl_give isl_pw_aff *isl_pw_aff_align_params(
5912 __isl_take isl_pw_aff *pwaff,
5913 __isl_take isl_space *model);
5914 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
5915 __isl_take isl_pw_multi_aff *pma,
5916 __isl_take isl_space *model);
5917 __isl_give isl_union_pw_aff *
5918 isl_union_pw_aff_align_params(
5919 __isl_take isl_union_pw_aff *upa,
5920 __isl_take isl_space *model);
5921 __isl_give isl_union_pw_multi_aff *
5922 isl_union_pw_multi_aff_align_params(
5923 __isl_take isl_union_pw_multi_aff *upma,
5924 __isl_take isl_space *model);
5925 __isl_give isl_multi_union_pw_aff *
5926 isl_multi_union_pw_aff_align_params(
5927 __isl_take isl_multi_union_pw_aff *mupa,
5928 __isl_take isl_space *model);
5930 #include <isl/polynomial.h>
5931 __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
5932 __isl_take isl_qpolynomial *qp,
5933 __isl_take isl_space *model);
5935 =item * Drop unused parameters
5937 Drop parameters that are not referenced by the isl object.
5938 All parameters need to be named.
5940 #include <isl/set.h>
5941 __isl_give isl_basic_set *
5942 isl_basic_set_drop_unused_params(
5943 __isl_take isl_basic_set *bset);
5944 __isl_give isl_set *isl_set_drop_unused_params(
5945 __isl_take isl_set *set);
5947 #include <isl/map.h>
5948 __isl_give isl_basic_map *
5949 isl_basic_map_drop_unused_params(
5950 __isl_take isl_basic_map *bmap);
5951 __isl_give isl_map *isl_map_drop_unused_params(
5952 __isl_take isl_map *map);
5954 #include <isl/aff.h>
5955 __isl_give isl_pw_aff *isl_pw_aff_drop_unused_params(
5956 __isl_take isl_pw_aff *pa);
5957 __isl_give isl_pw_multi_aff *
5958 isl_pw_multi_aff_drop_unused_params(
5959 __isl_take isl_pw_multi_aff *pma);
5961 #include <isl/polynomial.h>
5962 __isl_give isl_pw_qpolynomial *
5963 isl_pw_qpolynomial_drop_unused_params(
5964 __isl_take isl_pw_qpolynomial *pwqp);
5965 __isl_give isl_pw_qpolynomial_fold *
5966 isl_pw_qpolynomial_fold_drop_unused_params(
5967 __isl_take isl_pw_qpolynomial_fold *pwf);
5969 =item * Unary Arithmetic Operations
5971 #include <isl/set.h>
5972 __isl_give isl_set *isl_set_neg(
5973 __isl_take isl_set *set);
5974 #include <isl/map.h>
5975 __isl_give isl_map *isl_map_neg(
5976 __isl_take isl_map *map);
5978 C<isl_set_neg> constructs a set containing the opposites of
5979 the elements in its argument.
5980 The domain of the result of C<isl_map_neg> is the same
5981 as the domain of its argument. The corresponding range
5982 elements are the opposites of the corresponding range
5983 elements in the argument.
5985 #include <isl/val.h>
5986 __isl_give isl_multi_val *isl_multi_val_neg(
5987 __isl_take isl_multi_val *mv);
5989 #include <isl/aff.h>
5990 __isl_give isl_aff *isl_aff_neg(
5991 __isl_take isl_aff *aff);
5992 __isl_give isl_multi_aff *isl_multi_aff_neg(
5993 __isl_take isl_multi_aff *ma);
5994 __isl_give isl_pw_aff *isl_pw_aff_neg(
5995 __isl_take isl_pw_aff *pwaff);
5996 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
5997 __isl_take isl_pw_multi_aff *pma);
5998 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
5999 __isl_take isl_multi_pw_aff *mpa);
6000 __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
6001 __isl_take isl_union_pw_aff *upa);
6002 __isl_give isl_union_pw_multi_aff *
6003 isl_union_pw_multi_aff_neg(
6004 __isl_take isl_union_pw_multi_aff *upma);
6005 __isl_give isl_multi_union_pw_aff *
6006 isl_multi_union_pw_aff_neg(
6007 __isl_take isl_multi_union_pw_aff *mupa);
6008 __isl_give isl_aff *isl_aff_ceil(
6009 __isl_take isl_aff *aff);
6010 __isl_give isl_pw_aff *isl_pw_aff_ceil(
6011 __isl_take isl_pw_aff *pwaff);
6012 __isl_give isl_aff *isl_aff_floor(
6013 __isl_take isl_aff *aff);
6014 __isl_give isl_multi_aff *isl_multi_aff_floor(
6015 __isl_take isl_multi_aff *ma);
6016 __isl_give isl_pw_aff *isl_pw_aff_floor(
6017 __isl_take isl_pw_aff *pwaff);
6018 __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
6019 __isl_take isl_union_pw_aff *upa);
6020 __isl_give isl_multi_union_pw_aff *
6021 isl_multi_union_pw_aff_floor(
6022 __isl_take isl_multi_union_pw_aff *mupa);
6024 #include <isl/aff.h>
6025 __isl_give isl_pw_aff *isl_pw_aff_list_min(
6026 __isl_take isl_pw_aff_list *list);
6027 __isl_give isl_pw_aff *isl_pw_aff_list_max(
6028 __isl_take isl_pw_aff_list *list);
6030 #include <isl/polynomial.h>
6031 __isl_give isl_qpolynomial *isl_qpolynomial_neg(
6032 __isl_take isl_qpolynomial *qp);
6033 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
6034 __isl_take isl_pw_qpolynomial *pwqp);
6035 __isl_give isl_union_pw_qpolynomial *
6036 isl_union_pw_qpolynomial_neg(
6037 __isl_take isl_union_pw_qpolynomial *upwqp);
6038 __isl_give isl_qpolynomial *isl_qpolynomial_pow(
6039 __isl_take isl_qpolynomial *qp,
6041 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
6042 __isl_take isl_pw_qpolynomial *pwqp,
6047 The following functions evaluate a function in a point.
6049 #include <isl/aff.h>
6050 __isl_give isl_val *isl_aff_eval(
6051 __isl_take isl_aff *aff,
6052 __isl_take isl_point *pnt);
6053 __isl_give isl_val *isl_pw_aff_eval(
6054 __isl_take isl_pw_aff *pa,
6055 __isl_take isl_point *pnt);
6057 #include <isl/polynomial.h>
6058 __isl_give isl_val *isl_pw_qpolynomial_eval(
6059 __isl_take isl_pw_qpolynomial *pwqp,
6060 __isl_take isl_point *pnt);
6061 __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
6062 __isl_take isl_pw_qpolynomial_fold *pwf,
6063 __isl_take isl_point *pnt);
6064 __isl_give isl_val *isl_union_pw_qpolynomial_eval(
6065 __isl_take isl_union_pw_qpolynomial *upwqp,
6066 __isl_take isl_point *pnt);
6067 __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
6068 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6069 __isl_take isl_point *pnt);
6071 These functions return NaN when evaluated at a void point.
6072 Note that C<isl_pw_aff_eval> returns NaN when the function is evaluated outside
6073 its definition domain, while C<isl_pw_qpolynomial_eval> returns zero
6074 when the function is evaluated outside its explicit domain.
6076 =item * Dimension manipulation
6078 It is usually not advisable to directly change the (input or output)
6079 space of a set or a relation as this removes the name and the internal
6080 structure of the space. However, the functions below can be useful
6081 to add new parameters, assuming
6082 C<isl_set_align_params> and C<isl_map_align_params>
6085 #include <isl/space.h>
6086 __isl_give isl_space *isl_space_add_dims(
6087 __isl_take isl_space *space,
6088 enum isl_dim_type type, unsigned n);
6089 __isl_give isl_space *isl_space_insert_dims(
6090 __isl_take isl_space *space,
6091 enum isl_dim_type type, unsigned pos, unsigned n);
6092 __isl_give isl_space *isl_space_drop_dims(
6093 __isl_take isl_space *space,
6094 enum isl_dim_type type, unsigned first, unsigned n);
6095 __isl_give isl_space *isl_space_move_dims(
6096 __isl_take isl_space *space,
6097 enum isl_dim_type dst_type, unsigned dst_pos,
6098 enum isl_dim_type src_type, unsigned src_pos,
6101 #include <isl/local_space.h>
6102 __isl_give isl_local_space *isl_local_space_add_dims(
6103 __isl_take isl_local_space *ls,
6104 enum isl_dim_type type, unsigned n);
6105 __isl_give isl_local_space *isl_local_space_insert_dims(
6106 __isl_take isl_local_space *ls,
6107 enum isl_dim_type type, unsigned first, unsigned n);
6108 __isl_give isl_local_space *isl_local_space_drop_dims(
6109 __isl_take isl_local_space *ls,
6110 enum isl_dim_type type, unsigned first, unsigned n);
6112 #include <isl/set.h>
6113 __isl_give isl_basic_set *isl_basic_set_add_dims(
6114 __isl_take isl_basic_set *bset,
6115 enum isl_dim_type type, unsigned n);
6116 __isl_give isl_set *isl_set_add_dims(
6117 __isl_take isl_set *set,
6118 enum isl_dim_type type, unsigned n);
6119 __isl_give isl_basic_set *isl_basic_set_insert_dims(
6120 __isl_take isl_basic_set *bset,
6121 enum isl_dim_type type, unsigned pos,
6123 __isl_give isl_set *isl_set_insert_dims(
6124 __isl_take isl_set *set,
6125 enum isl_dim_type type, unsigned pos, unsigned n);
6126 __isl_give isl_basic_set *isl_basic_set_move_dims(
6127 __isl_take isl_basic_set *bset,
6128 enum isl_dim_type dst_type, unsigned dst_pos,
6129 enum isl_dim_type src_type, unsigned src_pos,
6131 __isl_give isl_set *isl_set_move_dims(
6132 __isl_take isl_set *set,
6133 enum isl_dim_type dst_type, unsigned dst_pos,
6134 enum isl_dim_type src_type, unsigned src_pos,
6137 #include <isl/map.h>
6138 __isl_give isl_basic_map *isl_basic_map_add_dims(
6139 __isl_take isl_basic_map *bmap,
6140 enum isl_dim_type type, unsigned n);
6141 __isl_give isl_map *isl_map_add_dims(
6142 __isl_take isl_map *map,
6143 enum isl_dim_type type, unsigned n);
6144 __isl_give isl_basic_map *isl_basic_map_insert_dims(
6145 __isl_take isl_basic_map *bmap,
6146 enum isl_dim_type type, unsigned pos,
6148 __isl_give isl_map *isl_map_insert_dims(
6149 __isl_take isl_map *map,
6150 enum isl_dim_type type, unsigned pos, unsigned n);
6151 __isl_give isl_basic_map *isl_basic_map_move_dims(
6152 __isl_take isl_basic_map *bmap,
6153 enum isl_dim_type dst_type, unsigned dst_pos,
6154 enum isl_dim_type src_type, unsigned src_pos,
6156 __isl_give isl_map *isl_map_move_dims(
6157 __isl_take isl_map *map,
6158 enum isl_dim_type dst_type, unsigned dst_pos,
6159 enum isl_dim_type src_type, unsigned src_pos,
6162 #include <isl/val.h>
6163 __isl_give isl_multi_val *isl_multi_val_insert_dims(
6164 __isl_take isl_multi_val *mv,
6165 enum isl_dim_type type, unsigned first, unsigned n);
6166 __isl_give isl_multi_val *isl_multi_val_add_dims(
6167 __isl_take isl_multi_val *mv,
6168 enum isl_dim_type type, unsigned n);
6169 __isl_give isl_multi_val *isl_multi_val_drop_dims(
6170 __isl_take isl_multi_val *mv,
6171 enum isl_dim_type type, unsigned first, unsigned n);
6173 #include <isl/aff.h>
6174 __isl_give isl_aff *isl_aff_insert_dims(
6175 __isl_take isl_aff *aff,
6176 enum isl_dim_type type, unsigned first, unsigned n);
6177 __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
6178 __isl_take isl_multi_aff *ma,
6179 enum isl_dim_type type, unsigned first, unsigned n);
6180 __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
6181 __isl_take isl_pw_aff *pwaff,
6182 enum isl_dim_type type, unsigned first, unsigned n);
6183 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
6184 __isl_take isl_multi_pw_aff *mpa,
6185 enum isl_dim_type type, unsigned first, unsigned n);
6186 __isl_give isl_aff *isl_aff_add_dims(
6187 __isl_take isl_aff *aff,
6188 enum isl_dim_type type, unsigned n);
6189 __isl_give isl_multi_aff *isl_multi_aff_add_dims(
6190 __isl_take isl_multi_aff *ma,
6191 enum isl_dim_type type, unsigned n);
6192 __isl_give isl_pw_aff *isl_pw_aff_add_dims(
6193 __isl_take isl_pw_aff *pwaff,
6194 enum isl_dim_type type, unsigned n);
6195 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
6196 __isl_take isl_multi_pw_aff *mpa,
6197 enum isl_dim_type type, unsigned n);
6198 __isl_give isl_aff *isl_aff_drop_dims(
6199 __isl_take isl_aff *aff,
6200 enum isl_dim_type type, unsigned first, unsigned n);
6201 __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
6202 __isl_take isl_multi_aff *maff,
6203 enum isl_dim_type type, unsigned first, unsigned n);
6204 __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
6205 __isl_take isl_pw_aff *pwaff,
6206 enum isl_dim_type type, unsigned first, unsigned n);
6207 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
6208 __isl_take isl_pw_multi_aff *pma,
6209 enum isl_dim_type type, unsigned first, unsigned n);
6210 __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
6211 __isl_take isl_union_pw_aff *upa,
6212 enum isl_dim_type type, unsigned first, unsigned n);
6213 __isl_give isl_union_pw_multi_aff *
6214 isl_union_pw_multi_aff_drop_dims(
6215 __isl_take isl_union_pw_multi_aff *upma,
6216 enum isl_dim_type type,
6217 unsigned first, unsigned n);
6218 __isl_give isl_multi_union_pw_aff *
6219 isl_multi_union_pw_aff_drop_dims(
6220 __isl_take isl_multi_union_pw_aff *mupa,
6221 enum isl_dim_type type, unsigned first,
6223 __isl_give isl_aff *isl_aff_move_dims(
6224 __isl_take isl_aff *aff,
6225 enum isl_dim_type dst_type, unsigned dst_pos,
6226 enum isl_dim_type src_type, unsigned src_pos,
6228 __isl_give isl_multi_aff *isl_multi_aff_move_dims(
6229 __isl_take isl_multi_aff *ma,
6230 enum isl_dim_type dst_type, unsigned dst_pos,
6231 enum isl_dim_type src_type, unsigned src_pos,
6233 __isl_give isl_pw_aff *isl_pw_aff_move_dims(
6234 __isl_take isl_pw_aff *pa,
6235 enum isl_dim_type dst_type, unsigned dst_pos,
6236 enum isl_dim_type src_type, unsigned src_pos,
6238 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
6239 __isl_take isl_multi_pw_aff *pma,
6240 enum isl_dim_type dst_type, unsigned dst_pos,
6241 enum isl_dim_type src_type, unsigned src_pos,
6244 #include <isl/polynomial.h>
6245 __isl_give isl_union_pw_qpolynomial *
6246 isl_union_pw_qpolynomial_drop_dims(
6247 __isl_take isl_union_pw_qpolynomial *upwqp,
6248 enum isl_dim_type type,
6249 unsigned first, unsigned n);
6250 __isl_give isl_union_pw_qpolynomial_fold *
6251 isl_union_pw_qpolynomial_fold_drop_dims(
6252 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6253 enum isl_dim_type type,
6254 unsigned first, unsigned n);
6256 The operations on union expressions can only manipulate parameters.
6260 =head2 Binary Operations
6262 The two arguments of a binary operation not only need to live
6263 in the same C<isl_ctx>, they currently also need to have
6264 the same (number of) parameters.
6266 =head3 Basic Operations
6270 =item * Intersection
6272 #include <isl/local_space.h>
6273 __isl_give isl_local_space *isl_local_space_intersect(
6274 __isl_take isl_local_space *ls1,
6275 __isl_take isl_local_space *ls2);
6277 #include <isl/set.h>
6278 __isl_give isl_basic_set *isl_basic_set_intersect_params(
6279 __isl_take isl_basic_set *bset1,
6280 __isl_take isl_basic_set *bset2);
6281 __isl_give isl_basic_set *isl_basic_set_intersect(
6282 __isl_take isl_basic_set *bset1,
6283 __isl_take isl_basic_set *bset2);
6284 __isl_give isl_basic_set *isl_basic_set_list_intersect(
6285 __isl_take struct isl_basic_set_list *list);
6286 __isl_give isl_set *isl_set_intersect_params(
6287 __isl_take isl_set *set,
6288 __isl_take isl_set *params);
6289 __isl_give isl_set *isl_set_intersect(
6290 __isl_take isl_set *set1,
6291 __isl_take isl_set *set2);
6293 #include <isl/map.h>
6294 __isl_give isl_basic_map *isl_basic_map_intersect_domain(
6295 __isl_take isl_basic_map *bmap,
6296 __isl_take isl_basic_set *bset);
6297 __isl_give isl_basic_map *isl_basic_map_intersect_range(
6298 __isl_take isl_basic_map *bmap,
6299 __isl_take isl_basic_set *bset);
6300 __isl_give isl_basic_map *isl_basic_map_intersect(
6301 __isl_take isl_basic_map *bmap1,
6302 __isl_take isl_basic_map *bmap2);
6303 __isl_give isl_basic_map *isl_basic_map_list_intersect(
6304 __isl_take isl_basic_map_list *list);
6305 __isl_give isl_map *isl_map_intersect_params(
6306 __isl_take isl_map *map,
6307 __isl_take isl_set *params);
6308 __isl_give isl_map *isl_map_intersect_domain(
6309 __isl_take isl_map *map,
6310 __isl_take isl_set *set);
6311 __isl_give isl_map *isl_map_intersect_range(
6312 __isl_take isl_map *map,
6313 __isl_take isl_set *set);
6314 __isl_give isl_map *isl_map_intersect(
6315 __isl_take isl_map *map1,
6316 __isl_take isl_map *map2);
6317 __isl_give isl_map *
6318 isl_map_intersect_domain_factor_range(
6319 __isl_take isl_map *map,
6320 __isl_take isl_map *factor);
6321 __isl_give isl_map *
6322 isl_map_intersect_range_factor_range(
6323 __isl_take isl_map *map,
6324 __isl_take isl_map *factor);
6326 #include <isl/union_set.h>
6327 __isl_give isl_union_set *isl_union_set_intersect_params(
6328 __isl_take isl_union_set *uset,
6329 __isl_take isl_set *set);
6330 __isl_give isl_union_set *isl_union_set_intersect(
6331 __isl_take isl_union_set *uset1,
6332 __isl_take isl_union_set *uset2);
6334 #include <isl/union_map.h>
6335 __isl_give isl_union_map *isl_union_map_intersect_params(
6336 __isl_take isl_union_map *umap,
6337 __isl_take isl_set *set);
6338 __isl_give isl_union_map *isl_union_map_intersect_domain(
6339 __isl_take isl_union_map *umap,
6340 __isl_take isl_union_set *uset);
6341 __isl_give isl_union_map *isl_union_map_intersect_range(
6342 __isl_take isl_union_map *umap,
6343 __isl_take isl_union_set *uset);
6344 __isl_give isl_union_map *isl_union_map_intersect(
6345 __isl_take isl_union_map *umap1,
6346 __isl_take isl_union_map *umap2);
6347 __isl_give isl_union_map *
6348 isl_union_map_intersect_range_factor_range(
6349 __isl_take isl_union_map *umap,
6350 __isl_take isl_union_map *factor);
6352 #include <isl/aff.h>
6353 __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
6354 __isl_take isl_pw_aff *pa,
6355 __isl_take isl_set *set);
6356 __isl_give isl_multi_pw_aff *
6357 isl_multi_pw_aff_intersect_domain(
6358 __isl_take isl_multi_pw_aff *mpa,
6359 __isl_take isl_set *domain);
6360 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
6361 __isl_take isl_pw_multi_aff *pma,
6362 __isl_take isl_set *set);
6363 __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
6364 __isl_take isl_union_pw_aff *upa,
6365 __isl_take isl_union_set *uset);
6366 __isl_give isl_union_pw_multi_aff *
6367 isl_union_pw_multi_aff_intersect_domain(
6368 __isl_take isl_union_pw_multi_aff *upma,
6369 __isl_take isl_union_set *uset);
6370 __isl_give isl_multi_union_pw_aff *
6371 isl_multi_union_pw_aff_intersect_domain(
6372 __isl_take isl_multi_union_pw_aff *mupa,
6373 __isl_take isl_union_set *uset);
6374 __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
6375 __isl_take isl_pw_aff *pa,
6376 __isl_take isl_set *set);
6377 __isl_give isl_multi_pw_aff *
6378 isl_multi_pw_aff_intersect_params(
6379 __isl_take isl_multi_pw_aff *mpa,
6380 __isl_take isl_set *set);
6381 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
6382 __isl_take isl_pw_multi_aff *pma,
6383 __isl_take isl_set *set);
6384 __isl_give isl_union_pw_aff *
6385 isl_union_pw_aff_intersect_params(
6386 __isl_take isl_union_pw_aff *upa,
6387 __isl_give isl_union_pw_multi_aff *
6388 isl_union_pw_multi_aff_intersect_params(
6389 __isl_take isl_union_pw_multi_aff *upma,
6390 __isl_take isl_set *set);
6391 __isl_give isl_multi_union_pw_aff *
6392 isl_multi_union_pw_aff_intersect_params(
6393 __isl_take isl_multi_union_pw_aff *mupa,
6394 __isl_take isl_set *params);
6395 isl_multi_union_pw_aff_intersect_range(
6396 __isl_take isl_multi_union_pw_aff *mupa,
6397 __isl_take isl_set *set);
6399 #include <isl/polynomial.h>
6400 __isl_give isl_pw_qpolynomial *
6401 isl_pw_qpolynomial_intersect_domain(
6402 __isl_take isl_pw_qpolynomial *pwpq,
6403 __isl_take isl_set *set);
6404 __isl_give isl_union_pw_qpolynomial *
6405 isl_union_pw_qpolynomial_intersect_domain(
6406 __isl_take isl_union_pw_qpolynomial *upwpq,
6407 __isl_take isl_union_set *uset);
6408 __isl_give isl_union_pw_qpolynomial_fold *
6409 isl_union_pw_qpolynomial_fold_intersect_domain(
6410 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6411 __isl_take isl_union_set *uset);
6412 __isl_give isl_pw_qpolynomial *
6413 isl_pw_qpolynomial_intersect_params(
6414 __isl_take isl_pw_qpolynomial *pwpq,
6415 __isl_take isl_set *set);
6416 __isl_give isl_pw_qpolynomial_fold *
6417 isl_pw_qpolynomial_fold_intersect_params(
6418 __isl_take isl_pw_qpolynomial_fold *pwf,
6419 __isl_take isl_set *set);
6420 __isl_give isl_union_pw_qpolynomial *
6421 isl_union_pw_qpolynomial_intersect_params(
6422 __isl_take isl_union_pw_qpolynomial *upwpq,
6423 __isl_take isl_set *set);
6424 __isl_give isl_union_pw_qpolynomial_fold *
6425 isl_union_pw_qpolynomial_fold_intersect_params(
6426 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6427 __isl_take isl_set *set);
6429 The second argument to the C<_params> functions needs to be
6430 a parametric (basic) set. For the other functions, a parametric set
6431 for either argument is only allowed if the other argument is
6432 a parametric set as well.
6433 The list passed to C<isl_basic_set_list_intersect> needs to have
6434 at least one element and all elements need to live in the same space.
6435 The function C<isl_multi_union_pw_aff_intersect_range>
6436 restricts the input function to those shared domain elements
6437 that map to the specified range.
6441 #include <isl/set.h>
6442 __isl_give isl_set *isl_basic_set_union(
6443 __isl_take isl_basic_set *bset1,
6444 __isl_take isl_basic_set *bset2);
6445 __isl_give isl_set *isl_set_union(
6446 __isl_take isl_set *set1,
6447 __isl_take isl_set *set2);
6448 __isl_give isl_set *isl_set_list_union(
6449 __isl_take isl_set_list *list);
6451 #include <isl/map.h>
6452 __isl_give isl_map *isl_basic_map_union(
6453 __isl_take isl_basic_map *bmap1,
6454 __isl_take isl_basic_map *bmap2);
6455 __isl_give isl_map *isl_map_union(
6456 __isl_take isl_map *map1,
6457 __isl_take isl_map *map2);
6459 #include <isl/union_set.h>
6460 __isl_give isl_union_set *isl_union_set_union(
6461 __isl_take isl_union_set *uset1,
6462 __isl_take isl_union_set *uset2);
6463 __isl_give isl_union_set *isl_union_set_list_union(
6464 __isl_take isl_union_set_list *list);
6466 #include <isl/union_map.h>
6467 __isl_give isl_union_map *isl_union_map_union(
6468 __isl_take isl_union_map *umap1,
6469 __isl_take isl_union_map *umap2);
6471 The list passed to C<isl_set_list_union> needs to have
6472 at least one element and all elements need to live in the same space.
6474 =item * Set difference
6476 #include <isl/set.h>
6477 __isl_give isl_set *isl_set_subtract(
6478 __isl_take isl_set *set1,
6479 __isl_take isl_set *set2);
6481 #include <isl/map.h>
6482 __isl_give isl_map *isl_map_subtract(
6483 __isl_take isl_map *map1,
6484 __isl_take isl_map *map2);
6485 __isl_give isl_map *isl_map_subtract_domain(
6486 __isl_take isl_map *map,
6487 __isl_take isl_set *dom);
6488 __isl_give isl_map *isl_map_subtract_range(
6489 __isl_take isl_map *map,
6490 __isl_take isl_set *dom);
6492 #include <isl/union_set.h>
6493 __isl_give isl_union_set *isl_union_set_subtract(
6494 __isl_take isl_union_set *uset1,
6495 __isl_take isl_union_set *uset2);
6497 #include <isl/union_map.h>
6498 __isl_give isl_union_map *isl_union_map_subtract(
6499 __isl_take isl_union_map *umap1,
6500 __isl_take isl_union_map *umap2);
6501 __isl_give isl_union_map *isl_union_map_subtract_domain(
6502 __isl_take isl_union_map *umap,
6503 __isl_take isl_union_set *dom);
6504 __isl_give isl_union_map *isl_union_map_subtract_range(
6505 __isl_take isl_union_map *umap,
6506 __isl_take isl_union_set *dom);
6508 #include <isl/aff.h>
6509 __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
6510 __isl_take isl_pw_aff *pa,
6511 __isl_take isl_set *set);
6512 __isl_give isl_pw_multi_aff *
6513 isl_pw_multi_aff_subtract_domain(
6514 __isl_take isl_pw_multi_aff *pma,
6515 __isl_take isl_set *set);
6516 __isl_give isl_union_pw_aff *
6517 isl_union_pw_aff_subtract_domain(
6518 __isl_take isl_union_pw_aff *upa,
6519 __isl_take isl_union_set *uset);
6520 __isl_give isl_union_pw_multi_aff *
6521 isl_union_pw_multi_aff_subtract_domain(
6522 __isl_take isl_union_pw_multi_aff *upma,
6523 __isl_take isl_set *set);
6525 #include <isl/polynomial.h>
6526 __isl_give isl_pw_qpolynomial *
6527 isl_pw_qpolynomial_subtract_domain(
6528 __isl_take isl_pw_qpolynomial *pwpq,
6529 __isl_take isl_set *set);
6530 __isl_give isl_pw_qpolynomial_fold *
6531 isl_pw_qpolynomial_fold_subtract_domain(
6532 __isl_take isl_pw_qpolynomial_fold *pwf,
6533 __isl_take isl_set *set);
6534 __isl_give isl_union_pw_qpolynomial *
6535 isl_union_pw_qpolynomial_subtract_domain(
6536 __isl_take isl_union_pw_qpolynomial *upwpq,
6537 __isl_take isl_union_set *uset);
6538 __isl_give isl_union_pw_qpolynomial_fold *
6539 isl_union_pw_qpolynomial_fold_subtract_domain(
6540 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6541 __isl_take isl_union_set *uset);
6545 #include <isl/space.h>
6546 __isl_give isl_space *isl_space_join(
6547 __isl_take isl_space *left,
6548 __isl_take isl_space *right);
6550 #include <isl/map.h>
6551 __isl_give isl_basic_set *isl_basic_set_apply(
6552 __isl_take isl_basic_set *bset,
6553 __isl_take isl_basic_map *bmap);
6554 __isl_give isl_set *isl_set_apply(
6555 __isl_take isl_set *set,
6556 __isl_take isl_map *map);
6557 __isl_give isl_union_set *isl_union_set_apply(
6558 __isl_take isl_union_set *uset,
6559 __isl_take isl_union_map *umap);
6560 __isl_give isl_basic_map *isl_basic_map_apply_domain(
6561 __isl_take isl_basic_map *bmap1,
6562 __isl_take isl_basic_map *bmap2);
6563 __isl_give isl_basic_map *isl_basic_map_apply_range(
6564 __isl_take isl_basic_map *bmap1,
6565 __isl_take isl_basic_map *bmap2);
6566 __isl_give isl_map *isl_map_apply_domain(
6567 __isl_take isl_map *map1,
6568 __isl_take isl_map *map2);
6569 __isl_give isl_map *isl_map_apply_range(
6570 __isl_take isl_map *map1,
6571 __isl_take isl_map *map2);
6573 #include <isl/union_map.h>
6574 __isl_give isl_union_map *isl_union_map_apply_domain(
6575 __isl_take isl_union_map *umap1,
6576 __isl_take isl_union_map *umap2);
6577 __isl_give isl_union_map *isl_union_map_apply_range(
6578 __isl_take isl_union_map *umap1,
6579 __isl_take isl_union_map *umap2);
6581 #include <isl/aff.h>
6582 __isl_give isl_union_pw_aff *
6583 isl_multi_union_pw_aff_apply_aff(
6584 __isl_take isl_multi_union_pw_aff *mupa,
6585 __isl_take isl_aff *aff);
6586 __isl_give isl_union_pw_aff *
6587 isl_multi_union_pw_aff_apply_pw_aff(
6588 __isl_take isl_multi_union_pw_aff *mupa,
6589 __isl_take isl_pw_aff *pa);
6590 __isl_give isl_multi_union_pw_aff *
6591 isl_multi_union_pw_aff_apply_multi_aff(
6592 __isl_take isl_multi_union_pw_aff *mupa,
6593 __isl_take isl_multi_aff *ma);
6594 __isl_give isl_multi_union_pw_aff *
6595 isl_multi_union_pw_aff_apply_pw_multi_aff(
6596 __isl_take isl_multi_union_pw_aff *mupa,
6597 __isl_take isl_pw_multi_aff *pma);
6599 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
6600 over the shared domain of the elements of the input. The dimension is
6601 required to be greater than zero.
6602 The C<isl_multi_union_pw_aff> argument of
6603 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
6604 but only if the range of the C<isl_multi_aff> argument
6605 is also zero-dimensional.
6606 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
6608 #include <isl/polynomial.h>
6609 __isl_give isl_pw_qpolynomial_fold *
6610 isl_set_apply_pw_qpolynomial_fold(
6611 __isl_take isl_set *set,
6612 __isl_take isl_pw_qpolynomial_fold *pwf,
6614 __isl_give isl_pw_qpolynomial_fold *
6615 isl_map_apply_pw_qpolynomial_fold(
6616 __isl_take isl_map *map,
6617 __isl_take isl_pw_qpolynomial_fold *pwf,
6619 __isl_give isl_union_pw_qpolynomial_fold *
6620 isl_union_set_apply_union_pw_qpolynomial_fold(
6621 __isl_take isl_union_set *uset,
6622 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6624 __isl_give isl_union_pw_qpolynomial_fold *
6625 isl_union_map_apply_union_pw_qpolynomial_fold(
6626 __isl_take isl_union_map *umap,
6627 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6630 The functions taking a map
6631 compose the given map with the given piecewise quasipolynomial reduction.
6632 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
6633 over all elements in the intersection of the range of the map
6634 and the domain of the piecewise quasipolynomial reduction
6635 as a function of an element in the domain of the map.
6636 The functions taking a set compute a bound over all elements in the
6637 intersection of the set and the domain of the
6638 piecewise quasipolynomial reduction.
6642 #include <isl/set.h>
6643 __isl_give isl_basic_set *
6644 isl_basic_set_preimage_multi_aff(
6645 __isl_take isl_basic_set *bset,
6646 __isl_take isl_multi_aff *ma);
6647 __isl_give isl_set *isl_set_preimage_multi_aff(
6648 __isl_take isl_set *set,
6649 __isl_take isl_multi_aff *ma);
6650 __isl_give isl_set *isl_set_preimage_pw_multi_aff(
6651 __isl_take isl_set *set,
6652 __isl_take isl_pw_multi_aff *pma);
6653 __isl_give isl_set *isl_set_preimage_multi_pw_aff(
6654 __isl_take isl_set *set,
6655 __isl_take isl_multi_pw_aff *mpa);
6657 #include <isl/union_set.h>
6658 __isl_give isl_union_set *
6659 isl_union_set_preimage_multi_aff(
6660 __isl_take isl_union_set *uset,
6661 __isl_take isl_multi_aff *ma);
6662 __isl_give isl_union_set *
6663 isl_union_set_preimage_pw_multi_aff(
6664 __isl_take isl_union_set *uset,
6665 __isl_take isl_pw_multi_aff *pma);
6666 __isl_give isl_union_set *
6667 isl_union_set_preimage_union_pw_multi_aff(
6668 __isl_take isl_union_set *uset,
6669 __isl_take isl_union_pw_multi_aff *upma);
6671 #include <isl/map.h>
6672 __isl_give isl_basic_map *
6673 isl_basic_map_preimage_domain_multi_aff(
6674 __isl_take isl_basic_map *bmap,
6675 __isl_take isl_multi_aff *ma);
6676 __isl_give isl_map *isl_map_preimage_domain_multi_aff(
6677 __isl_take isl_map *map,
6678 __isl_take isl_multi_aff *ma);
6679 __isl_give isl_map *isl_map_preimage_range_multi_aff(
6680 __isl_take isl_map *map,
6681 __isl_take isl_multi_aff *ma);
6682 __isl_give isl_map *
6683 isl_map_preimage_domain_pw_multi_aff(
6684 __isl_take isl_map *map,
6685 __isl_take isl_pw_multi_aff *pma);
6686 __isl_give isl_map *
6687 isl_map_preimage_range_pw_multi_aff(
6688 __isl_take isl_map *map,
6689 __isl_take isl_pw_multi_aff *pma);
6690 __isl_give isl_map *
6691 isl_map_preimage_domain_multi_pw_aff(
6692 __isl_take isl_map *map,
6693 __isl_take isl_multi_pw_aff *mpa);
6694 __isl_give isl_basic_map *
6695 isl_basic_map_preimage_range_multi_aff(
6696 __isl_take isl_basic_map *bmap,
6697 __isl_take isl_multi_aff *ma);
6699 #include <isl/union_map.h>
6700 __isl_give isl_union_map *
6701 isl_union_map_preimage_domain_multi_aff(
6702 __isl_take isl_union_map *umap,
6703 __isl_take isl_multi_aff *ma);
6704 __isl_give isl_union_map *
6705 isl_union_map_preimage_range_multi_aff(
6706 __isl_take isl_union_map *umap,
6707 __isl_take isl_multi_aff *ma);
6708 __isl_give isl_union_map *
6709 isl_union_map_preimage_domain_pw_multi_aff(
6710 __isl_take isl_union_map *umap,
6711 __isl_take isl_pw_multi_aff *pma);
6712 __isl_give isl_union_map *
6713 isl_union_map_preimage_range_pw_multi_aff(
6714 __isl_take isl_union_map *umap,
6715 __isl_take isl_pw_multi_aff *pma);
6716 __isl_give isl_union_map *
6717 isl_union_map_preimage_domain_union_pw_multi_aff(
6718 __isl_take isl_union_map *umap,
6719 __isl_take isl_union_pw_multi_aff *upma);
6720 __isl_give isl_union_map *
6721 isl_union_map_preimage_range_union_pw_multi_aff(
6722 __isl_take isl_union_map *umap,
6723 __isl_take isl_union_pw_multi_aff *upma);
6725 These functions compute the preimage of the given set or map domain/range under
6726 the given function. In other words, the expression is plugged
6727 into the set description or into the domain/range of the map.
6731 #include <isl/aff.h>
6732 __isl_give isl_aff *isl_aff_pullback_aff(
6733 __isl_take isl_aff *aff1,
6734 __isl_take isl_aff *aff2);
6735 __isl_give isl_aff *isl_aff_pullback_multi_aff(
6736 __isl_take isl_aff *aff,
6737 __isl_take isl_multi_aff *ma);
6738 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
6739 __isl_take isl_pw_aff *pa,
6740 __isl_take isl_multi_aff *ma);
6741 __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
6742 __isl_take isl_pw_aff *pa,
6743 __isl_take isl_pw_multi_aff *pma);
6744 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
6745 __isl_take isl_pw_aff *pa,
6746 __isl_take isl_multi_pw_aff *mpa);
6747 __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
6748 __isl_take isl_multi_aff *ma1,
6749 __isl_take isl_multi_aff *ma2);
6750 __isl_give isl_pw_multi_aff *
6751 isl_pw_multi_aff_pullback_multi_aff(
6752 __isl_take isl_pw_multi_aff *pma,
6753 __isl_take isl_multi_aff *ma);
6754 __isl_give isl_multi_pw_aff *
6755 isl_multi_pw_aff_pullback_multi_aff(
6756 __isl_take isl_multi_pw_aff *mpa,
6757 __isl_take isl_multi_aff *ma);
6758 __isl_give isl_pw_multi_aff *
6759 isl_pw_multi_aff_pullback_pw_multi_aff(
6760 __isl_take isl_pw_multi_aff *pma1,
6761 __isl_take isl_pw_multi_aff *pma2);
6762 __isl_give isl_multi_pw_aff *
6763 isl_multi_pw_aff_pullback_pw_multi_aff(
6764 __isl_take isl_multi_pw_aff *mpa,
6765 __isl_take isl_pw_multi_aff *pma);
6766 __isl_give isl_multi_pw_aff *
6767 isl_multi_pw_aff_pullback_multi_pw_aff(
6768 __isl_take isl_multi_pw_aff *mpa1,
6769 __isl_take isl_multi_pw_aff *mpa2);
6770 __isl_give isl_union_pw_aff *
6771 isl_union_pw_aff_pullback_union_pw_multi_aff(
6772 __isl_take isl_union_pw_aff *upa,
6773 __isl_take isl_union_pw_multi_aff *upma);
6774 __isl_give isl_union_pw_multi_aff *
6775 isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
6776 __isl_take isl_union_pw_multi_aff *upma1,
6777 __isl_take isl_union_pw_multi_aff *upma2);
6778 __isl_give isl_multi_union_pw_aff *
6779 isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
6780 __isl_take isl_multi_union_pw_aff *mupa,
6781 __isl_take isl_union_pw_multi_aff *upma);
6783 These functions precompose the first expression by the second function.
6784 In other words, the second function is plugged
6785 into the first expression.
6789 #include <isl/aff.h>
6790 __isl_give isl_basic_set *isl_aff_eq_basic_set(
6791 __isl_take isl_aff *aff1,
6792 __isl_take isl_aff *aff2);
6793 __isl_give isl_set *isl_aff_eq_set(
6794 __isl_take isl_aff *aff1,
6795 __isl_take isl_aff *aff2);
6796 __isl_give isl_set *isl_aff_ne_set(
6797 __isl_take isl_aff *aff1,
6798 __isl_take isl_aff *aff2);
6799 __isl_give isl_basic_set *isl_aff_le_basic_set(
6800 __isl_take isl_aff *aff1,
6801 __isl_take isl_aff *aff2);
6802 __isl_give isl_set *isl_aff_le_set(
6803 __isl_take isl_aff *aff1,
6804 __isl_take isl_aff *aff2);
6805 __isl_give isl_basic_set *isl_aff_lt_basic_set(
6806 __isl_take isl_aff *aff1,
6807 __isl_take isl_aff *aff2);
6808 __isl_give isl_set *isl_aff_lt_set(
6809 __isl_take isl_aff *aff1,
6810 __isl_take isl_aff *aff2);
6811 __isl_give isl_basic_set *isl_aff_ge_basic_set(
6812 __isl_take isl_aff *aff1,
6813 __isl_take isl_aff *aff2);
6814 __isl_give isl_set *isl_aff_ge_set(
6815 __isl_take isl_aff *aff1,
6816 __isl_take isl_aff *aff2);
6817 __isl_give isl_basic_set *isl_aff_gt_basic_set(
6818 __isl_take isl_aff *aff1,
6819 __isl_take isl_aff *aff2);
6820 __isl_give isl_set *isl_aff_gt_set(
6821 __isl_take isl_aff *aff1,
6822 __isl_take isl_aff *aff2);
6823 __isl_give isl_set *isl_pw_aff_eq_set(
6824 __isl_take isl_pw_aff *pwaff1,
6825 __isl_take isl_pw_aff *pwaff2);
6826 __isl_give isl_set *isl_pw_aff_ne_set(
6827 __isl_take isl_pw_aff *pwaff1,
6828 __isl_take isl_pw_aff *pwaff2);
6829 __isl_give isl_set *isl_pw_aff_le_set(
6830 __isl_take isl_pw_aff *pwaff1,
6831 __isl_take isl_pw_aff *pwaff2);
6832 __isl_give isl_set *isl_pw_aff_lt_set(
6833 __isl_take isl_pw_aff *pwaff1,
6834 __isl_take isl_pw_aff *pwaff2);
6835 __isl_give isl_set *isl_pw_aff_ge_set(
6836 __isl_take isl_pw_aff *pwaff1,
6837 __isl_take isl_pw_aff *pwaff2);
6838 __isl_give isl_set *isl_pw_aff_gt_set(
6839 __isl_take isl_pw_aff *pwaff1,
6840 __isl_take isl_pw_aff *pwaff2);
6842 __isl_give isl_set *isl_multi_aff_lex_le_set(
6843 __isl_take isl_multi_aff *ma1,
6844 __isl_take isl_multi_aff *ma2);
6845 __isl_give isl_set *isl_multi_aff_lex_lt_set(
6846 __isl_take isl_multi_aff *ma1,
6847 __isl_take isl_multi_aff *ma2);
6848 __isl_give isl_set *isl_multi_aff_lex_ge_set(
6849 __isl_take isl_multi_aff *ma1,
6850 __isl_take isl_multi_aff *ma2);
6851 __isl_give isl_set *isl_multi_aff_lex_gt_set(
6852 __isl_take isl_multi_aff *ma1,
6853 __isl_take isl_multi_aff *ma2);
6855 __isl_give isl_set *isl_pw_aff_list_eq_set(
6856 __isl_take isl_pw_aff_list *list1,
6857 __isl_take isl_pw_aff_list *list2);
6858 __isl_give isl_set *isl_pw_aff_list_ne_set(
6859 __isl_take isl_pw_aff_list *list1,
6860 __isl_take isl_pw_aff_list *list2);
6861 __isl_give isl_set *isl_pw_aff_list_le_set(
6862 __isl_take isl_pw_aff_list *list1,
6863 __isl_take isl_pw_aff_list *list2);
6864 __isl_give isl_set *isl_pw_aff_list_lt_set(
6865 __isl_take isl_pw_aff_list *list1,
6866 __isl_take isl_pw_aff_list *list2);
6867 __isl_give isl_set *isl_pw_aff_list_ge_set(
6868 __isl_take isl_pw_aff_list *list1,
6869 __isl_take isl_pw_aff_list *list2);
6870 __isl_give isl_set *isl_pw_aff_list_gt_set(
6871 __isl_take isl_pw_aff_list *list1,
6872 __isl_take isl_pw_aff_list *list2);
6874 The function C<isl_aff_ge_basic_set> returns a basic set
6875 containing those elements in the shared space
6876 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
6877 The function C<isl_pw_aff_ge_set> returns a set
6878 containing those elements in the shared domain
6879 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
6880 greater than or equal to C<pwaff2>.
6881 The function C<isl_multi_aff_lex_le_set> returns a set
6882 containing those elements in the shared domain space
6883 where C<ma1> is lexicographically smaller than or
6885 The functions operating on C<isl_pw_aff_list> apply the corresponding
6886 C<isl_pw_aff> function to each pair of elements in the two lists.
6888 #include <isl/aff.h>
6889 __isl_give isl_map *isl_pw_aff_eq_map(
6890 __isl_take isl_pw_aff *pa1,
6891 __isl_take isl_pw_aff *pa2);
6892 __isl_give isl_map *isl_pw_aff_lt_map(
6893 __isl_take isl_pw_aff *pa1,
6894 __isl_take isl_pw_aff *pa2);
6895 __isl_give isl_map *isl_pw_aff_gt_map(
6896 __isl_take isl_pw_aff *pa1,
6897 __isl_take isl_pw_aff *pa2);
6899 __isl_give isl_map *isl_multi_pw_aff_eq_map(
6900 __isl_take isl_multi_pw_aff *mpa1,
6901 __isl_take isl_multi_pw_aff *mpa2);
6902 __isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
6903 __isl_take isl_multi_pw_aff *mpa1,
6904 __isl_take isl_multi_pw_aff *mpa2);
6905 __isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
6906 __isl_take isl_multi_pw_aff *mpa1,
6907 __isl_take isl_multi_pw_aff *mpa2);
6909 These functions return a map between domain elements of the arguments
6910 where the function values satisfy the given relation.
6912 #include <isl/union_map.h>
6913 __isl_give isl_union_map *
6914 isl_union_map_eq_at_multi_union_pw_aff(
6915 __isl_take isl_union_map *umap,
6916 __isl_take isl_multi_union_pw_aff *mupa);
6917 __isl_give isl_union_map *
6918 isl_union_map_lex_lt_at_multi_union_pw_aff(
6919 __isl_take isl_union_map *umap,
6920 __isl_take isl_multi_union_pw_aff *mupa);
6921 __isl_give isl_union_map *
6922 isl_union_map_lex_gt_at_multi_union_pw_aff(
6923 __isl_take isl_union_map *umap,
6924 __isl_take isl_multi_union_pw_aff *mupa);
6926 These functions select the subset of elements in the union map
6927 that have an equal or lexicographically smaller function value.
6929 =item * Cartesian Product
6931 #include <isl/space.h>
6932 __isl_give isl_space *isl_space_product(
6933 __isl_take isl_space *space1,
6934 __isl_take isl_space *space2);
6935 __isl_give isl_space *isl_space_domain_product(
6936 __isl_take isl_space *space1,
6937 __isl_take isl_space *space2);
6938 __isl_give isl_space *isl_space_range_product(
6939 __isl_take isl_space *space1,
6940 __isl_take isl_space *space2);
6943 C<isl_space_product>, C<isl_space_domain_product>
6944 and C<isl_space_range_product> take pairs or relation spaces and
6945 produce a single relations space, where either the domain, the range
6946 or both domain and range are wrapped spaces of relations between
6947 the domains and/or ranges of the input spaces.
6948 If the product is only constructed over the domain or the range
6949 then the ranges or the domains of the inputs should be the same.
6950 The function C<isl_space_product> also accepts a pair of set spaces,
6951 in which case it returns a wrapped space of a relation between the
6954 #include <isl/set.h>
6955 __isl_give isl_set *isl_set_product(
6956 __isl_take isl_set *set1,
6957 __isl_take isl_set *set2);
6959 #include <isl/map.h>
6960 __isl_give isl_basic_map *isl_basic_map_domain_product(
6961 __isl_take isl_basic_map *bmap1,
6962 __isl_take isl_basic_map *bmap2);
6963 __isl_give isl_basic_map *isl_basic_map_range_product(
6964 __isl_take isl_basic_map *bmap1,
6965 __isl_take isl_basic_map *bmap2);
6966 __isl_give isl_basic_map *isl_basic_map_product(
6967 __isl_take isl_basic_map *bmap1,
6968 __isl_take isl_basic_map *bmap2);
6969 __isl_give isl_map *isl_map_domain_product(
6970 __isl_take isl_map *map1,
6971 __isl_take isl_map *map2);
6972 __isl_give isl_map *isl_map_range_product(
6973 __isl_take isl_map *map1,
6974 __isl_take isl_map *map2);
6975 __isl_give isl_map *isl_map_product(
6976 __isl_take isl_map *map1,
6977 __isl_take isl_map *map2);
6979 #include <isl/union_set.h>
6980 __isl_give isl_union_set *isl_union_set_product(
6981 __isl_take isl_union_set *uset1,
6982 __isl_take isl_union_set *uset2);
6984 #include <isl/union_map.h>
6985 __isl_give isl_union_map *isl_union_map_domain_product(
6986 __isl_take isl_union_map *umap1,
6987 __isl_take isl_union_map *umap2);
6988 __isl_give isl_union_map *isl_union_map_range_product(
6989 __isl_take isl_union_map *umap1,
6990 __isl_take isl_union_map *umap2);
6991 __isl_give isl_union_map *isl_union_map_product(
6992 __isl_take isl_union_map *umap1,
6993 __isl_take isl_union_map *umap2);
6995 #include <isl/val.h>
6996 __isl_give isl_multi_val *isl_multi_val_range_product(
6997 __isl_take isl_multi_val *mv1,
6998 __isl_take isl_multi_val *mv2);
6999 __isl_give isl_multi_val *isl_multi_val_product(
7000 __isl_take isl_multi_val *mv1,
7001 __isl_take isl_multi_val *mv2);
7003 #include <isl/aff.h>
7004 __isl_give isl_multi_aff *isl_multi_aff_range_product(
7005 __isl_take isl_multi_aff *ma1,
7006 __isl_take isl_multi_aff *ma2);
7007 __isl_give isl_multi_aff *isl_multi_aff_product(
7008 __isl_take isl_multi_aff *ma1,
7009 __isl_take isl_multi_aff *ma2);
7010 __isl_give isl_multi_pw_aff *
7011 isl_multi_pw_aff_range_product(
7012 __isl_take isl_multi_pw_aff *mpa1,
7013 __isl_take isl_multi_pw_aff *mpa2);
7014 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
7015 __isl_take isl_multi_pw_aff *mpa1,
7016 __isl_take isl_multi_pw_aff *mpa2);
7017 __isl_give isl_pw_multi_aff *
7018 isl_pw_multi_aff_range_product(
7019 __isl_take isl_pw_multi_aff *pma1,
7020 __isl_take isl_pw_multi_aff *pma2);
7021 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
7022 __isl_take isl_pw_multi_aff *pma1,
7023 __isl_take isl_pw_multi_aff *pma2);
7024 __isl_give isl_multi_union_pw_aff *
7025 isl_multi_union_pw_aff_range_product(
7026 __isl_take isl_multi_union_pw_aff *mupa1,
7027 __isl_take isl_multi_union_pw_aff *mupa2);
7029 The above functions compute the cross product of the given
7030 sets, relations or functions. The domains and ranges of the results
7031 are wrapped maps between domains and ranges of the inputs.
7032 To obtain a ``flat'' product, use the following functions
7035 #include <isl/set.h>
7036 __isl_give isl_basic_set *isl_basic_set_flat_product(
7037 __isl_take isl_basic_set *bset1,
7038 __isl_take isl_basic_set *bset2);
7039 __isl_give isl_set *isl_set_flat_product(
7040 __isl_take isl_set *set1,
7041 __isl_take isl_set *set2);
7043 #include <isl/map.h>
7044 __isl_give isl_basic_map *isl_basic_map_flat_range_product(
7045 __isl_take isl_basic_map *bmap1,
7046 __isl_take isl_basic_map *bmap2);
7047 __isl_give isl_map *isl_map_flat_domain_product(
7048 __isl_take isl_map *map1,
7049 __isl_take isl_map *map2);
7050 __isl_give isl_map *isl_map_flat_range_product(
7051 __isl_take isl_map *map1,
7052 __isl_take isl_map *map2);
7053 __isl_give isl_basic_map *isl_basic_map_flat_product(
7054 __isl_take isl_basic_map *bmap1,
7055 __isl_take isl_basic_map *bmap2);
7056 __isl_give isl_map *isl_map_flat_product(
7057 __isl_take isl_map *map1,
7058 __isl_take isl_map *map2);
7060 #include <isl/union_map.h>
7061 __isl_give isl_union_map *
7062 isl_union_map_flat_domain_product(
7063 __isl_take isl_union_map *umap1,
7064 __isl_take isl_union_map *umap2);
7065 __isl_give isl_union_map *
7066 isl_union_map_flat_range_product(
7067 __isl_take isl_union_map *umap1,
7068 __isl_take isl_union_map *umap2);
7070 #include <isl/val.h>
7071 __isl_give isl_multi_val *isl_multi_val_flat_range_product(
7072 __isl_take isl_multi_val *mv1,
7073 __isl_take isl_multi_val *mv2);
7075 #include <isl/aff.h>
7076 __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
7077 __isl_take isl_multi_aff *ma1,
7078 __isl_take isl_multi_aff *ma2);
7079 __isl_give isl_pw_multi_aff *
7080 isl_pw_multi_aff_flat_range_product(
7081 __isl_take isl_pw_multi_aff *pma1,
7082 __isl_take isl_pw_multi_aff *pma2);
7083 __isl_give isl_multi_pw_aff *
7084 isl_multi_pw_aff_flat_range_product(
7085 __isl_take isl_multi_pw_aff *mpa1,
7086 __isl_take isl_multi_pw_aff *mpa2);
7087 __isl_give isl_union_pw_multi_aff *
7088 isl_union_pw_multi_aff_flat_range_product(
7089 __isl_take isl_union_pw_multi_aff *upma1,
7090 __isl_take isl_union_pw_multi_aff *upma2);
7091 __isl_give isl_multi_union_pw_aff *
7092 isl_multi_union_pw_aff_flat_range_product(
7093 __isl_take isl_multi_union_pw_aff *mupa1,
7094 __isl_take isl_multi_union_pw_aff *mupa2);
7096 #include <isl/space.h>
7097 __isl_give isl_space *isl_space_factor_domain(
7098 __isl_take isl_space *space);
7099 __isl_give isl_space *isl_space_factor_range(
7100 __isl_take isl_space *space);
7101 __isl_give isl_space *isl_space_domain_factor_domain(
7102 __isl_take isl_space *space);
7103 __isl_give isl_space *isl_space_domain_factor_range(
7104 __isl_take isl_space *space);
7105 __isl_give isl_space *isl_space_range_factor_domain(
7106 __isl_take isl_space *space);
7107 __isl_give isl_space *isl_space_range_factor_range(
7108 __isl_take isl_space *space);
7110 The functions C<isl_space_range_factor_domain> and
7111 C<isl_space_range_factor_range> extract the two arguments from
7112 the result of a call to C<isl_space_range_product>.
7114 The arguments of a call to a product can be extracted
7115 from the result using the following functions.
7117 #include <isl/map.h>
7118 __isl_give isl_map *isl_map_factor_domain(
7119 __isl_take isl_map *map);
7120 __isl_give isl_map *isl_map_factor_range(
7121 __isl_take isl_map *map);
7122 __isl_give isl_map *isl_map_domain_factor_domain(
7123 __isl_take isl_map *map);
7124 __isl_give isl_map *isl_map_domain_factor_range(
7125 __isl_take isl_map *map);
7126 __isl_give isl_map *isl_map_range_factor_domain(
7127 __isl_take isl_map *map);
7128 __isl_give isl_map *isl_map_range_factor_range(
7129 __isl_take isl_map *map);
7131 #include <isl/union_map.h>
7132 __isl_give isl_union_map *isl_union_map_factor_domain(
7133 __isl_take isl_union_map *umap);
7134 __isl_give isl_union_map *isl_union_map_factor_range(
7135 __isl_take isl_union_map *umap);
7136 __isl_give isl_union_map *
7137 isl_union_map_domain_factor_domain(
7138 __isl_take isl_union_map *umap);
7139 __isl_give isl_union_map *
7140 isl_union_map_domain_factor_range(
7141 __isl_take isl_union_map *umap);
7142 __isl_give isl_union_map *
7143 isl_union_map_range_factor_domain(
7144 __isl_take isl_union_map *umap);
7145 __isl_give isl_union_map *
7146 isl_union_map_range_factor_range(
7147 __isl_take isl_union_map *umap);
7149 #include <isl/val.h>
7150 __isl_give isl_multi_val *isl_multi_val_factor_range(
7151 __isl_take isl_multi_val *mv);
7152 __isl_give isl_multi_val *
7153 isl_multi_val_range_factor_domain(
7154 __isl_take isl_multi_val *mv);
7155 __isl_give isl_multi_val *
7156 isl_multi_val_range_factor_range(
7157 __isl_take isl_multi_val *mv);
7159 #include <isl/aff.h>
7160 __isl_give isl_multi_aff *isl_multi_aff_factor_range(
7161 __isl_take isl_multi_aff *ma);
7162 __isl_give isl_multi_aff *
7163 isl_multi_aff_range_factor_domain(
7164 __isl_take isl_multi_aff *ma);
7165 __isl_give isl_multi_aff *
7166 isl_multi_aff_range_factor_range(
7167 __isl_take isl_multi_aff *ma);
7168 __isl_give isl_multi_pw_aff *
7169 isl_multi_pw_aff_factor_range(
7170 __isl_take isl_multi_pw_aff *mpa);
7171 __isl_give isl_multi_pw_aff *
7172 isl_multi_pw_aff_range_factor_domain(
7173 __isl_take isl_multi_pw_aff *mpa);
7174 __isl_give isl_multi_pw_aff *
7175 isl_multi_pw_aff_range_factor_range(
7176 __isl_take isl_multi_pw_aff *mpa);
7177 __isl_give isl_multi_union_pw_aff *
7178 isl_multi_union_pw_aff_factor_range(
7179 __isl_take isl_multi_union_pw_aff *mupa);
7180 __isl_give isl_multi_union_pw_aff *
7181 isl_multi_union_pw_aff_range_factor_domain(
7182 __isl_take isl_multi_union_pw_aff *mupa);
7183 __isl_give isl_multi_union_pw_aff *
7184 isl_multi_union_pw_aff_range_factor_range(
7185 __isl_take isl_multi_union_pw_aff *mupa);
7187 The splice functions are a generalization of the flat product functions,
7188 where the second argument may be inserted at any position inside
7189 the first argument rather than being placed at the end.
7190 The functions C<isl_multi_val_factor_range>,
7191 C<isl_multi_aff_factor_range>,
7192 C<isl_multi_pw_aff_factor_range> and
7193 C<isl_multi_union_pw_aff_factor_range>
7194 take functions that live in a set space.
7196 #include <isl/val.h>
7197 __isl_give isl_multi_val *isl_multi_val_range_splice(
7198 __isl_take isl_multi_val *mv1, unsigned pos,
7199 __isl_take isl_multi_val *mv2);
7201 #include <isl/aff.h>
7202 __isl_give isl_multi_aff *isl_multi_aff_range_splice(
7203 __isl_take isl_multi_aff *ma1, unsigned pos,
7204 __isl_take isl_multi_aff *ma2);
7205 __isl_give isl_multi_aff *isl_multi_aff_splice(
7206 __isl_take isl_multi_aff *ma1,
7207 unsigned in_pos, unsigned out_pos,
7208 __isl_take isl_multi_aff *ma2);
7209 __isl_give isl_multi_pw_aff *
7210 isl_multi_pw_aff_range_splice(
7211 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
7212 __isl_take isl_multi_pw_aff *mpa2);
7213 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
7214 __isl_take isl_multi_pw_aff *mpa1,
7215 unsigned in_pos, unsigned out_pos,
7216 __isl_take isl_multi_pw_aff *mpa2);
7217 __isl_give isl_multi_union_pw_aff *
7218 isl_multi_union_pw_aff_range_splice(
7219 __isl_take isl_multi_union_pw_aff *mupa1,
7221 __isl_take isl_multi_union_pw_aff *mupa2);
7223 =item * Simplification
7225 When applied to a set or relation,
7226 the gist operation returns a set or relation that has the
7227 same intersection with the context as the input set or relation.
7228 Any implicit equality in the intersection is made explicit in the result,
7229 while all inequalities that are redundant with respect to the intersection
7231 In case of union sets and relations, the gist operation is performed
7234 When applied to a function,
7235 the gist operation applies the set gist operation to each of
7236 the cells in the domain of the input piecewise expression.
7237 The context is also exploited
7238 to simplify the expression associated to each cell.
7240 #include <isl/set.h>
7241 __isl_give isl_basic_set *isl_basic_set_gist(
7242 __isl_take isl_basic_set *bset,
7243 __isl_take isl_basic_set *context);
7244 __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
7245 __isl_take isl_set *context);
7246 __isl_give isl_set *isl_set_gist_params(
7247 __isl_take isl_set *set,
7248 __isl_take isl_set *context);
7250 #include <isl/map.h>
7251 __isl_give isl_basic_map *isl_basic_map_gist(
7252 __isl_take isl_basic_map *bmap,
7253 __isl_take isl_basic_map *context);
7254 __isl_give isl_basic_map *isl_basic_map_gist_domain(
7255 __isl_take isl_basic_map *bmap,
7256 __isl_take isl_basic_set *context);
7257 __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
7258 __isl_take isl_map *context);
7259 __isl_give isl_map *isl_map_gist_params(
7260 __isl_take isl_map *map,
7261 __isl_take isl_set *context);
7262 __isl_give isl_map *isl_map_gist_domain(
7263 __isl_take isl_map *map,
7264 __isl_take isl_set *context);
7265 __isl_give isl_map *isl_map_gist_range(
7266 __isl_take isl_map *map,
7267 __isl_take isl_set *context);
7269 #include <isl/union_set.h>
7270 __isl_give isl_union_set *isl_union_set_gist(
7271 __isl_take isl_union_set *uset,
7272 __isl_take isl_union_set *context);
7273 __isl_give isl_union_set *isl_union_set_gist_params(
7274 __isl_take isl_union_set *uset,
7275 __isl_take isl_set *set);
7277 #include <isl/union_map.h>
7278 __isl_give isl_union_map *isl_union_map_gist(
7279 __isl_take isl_union_map *umap,
7280 __isl_take isl_union_map *context);
7281 __isl_give isl_union_map *isl_union_map_gist_params(
7282 __isl_take isl_union_map *umap,
7283 __isl_take isl_set *set);
7284 __isl_give isl_union_map *isl_union_map_gist_domain(
7285 __isl_take isl_union_map *umap,
7286 __isl_take isl_union_set *uset);
7287 __isl_give isl_union_map *isl_union_map_gist_range(
7288 __isl_take isl_union_map *umap,
7289 __isl_take isl_union_set *uset);
7291 #include <isl/aff.h>
7292 __isl_give isl_aff *isl_aff_gist_params(
7293 __isl_take isl_aff *aff,
7294 __isl_take isl_set *context);
7295 __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
7296 __isl_take isl_set *context);
7297 __isl_give isl_multi_aff *isl_multi_aff_gist_params(
7298 __isl_take isl_multi_aff *maff,
7299 __isl_take isl_set *context);
7300 __isl_give isl_multi_aff *isl_multi_aff_gist(
7301 __isl_take isl_multi_aff *maff,
7302 __isl_take isl_set *context);
7303 __isl_give isl_pw_aff *isl_pw_aff_gist_params(
7304 __isl_take isl_pw_aff *pwaff,
7305 __isl_take isl_set *context);
7306 __isl_give isl_pw_aff *isl_pw_aff_gist(
7307 __isl_take isl_pw_aff *pwaff,
7308 __isl_take isl_set *context);
7309 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
7310 __isl_take isl_pw_multi_aff *pma,
7311 __isl_take isl_set *set);
7312 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
7313 __isl_take isl_pw_multi_aff *pma,
7314 __isl_take isl_set *set);
7315 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
7316 __isl_take isl_multi_pw_aff *mpa,
7317 __isl_take isl_set *set);
7318 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
7319 __isl_take isl_multi_pw_aff *mpa,
7320 __isl_take isl_set *set);
7321 __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
7322 __isl_take isl_union_pw_aff *upa,
7323 __isl_take isl_union_set *context);
7324 __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
7325 __isl_take isl_union_pw_aff *upa,
7326 __isl_take isl_set *context);
7327 __isl_give isl_union_pw_multi_aff *
7328 isl_union_pw_multi_aff_gist_params(
7329 __isl_take isl_union_pw_multi_aff *upma,
7330 __isl_take isl_set *context);
7331 __isl_give isl_union_pw_multi_aff *
7332 isl_union_pw_multi_aff_gist(
7333 __isl_take isl_union_pw_multi_aff *upma,
7334 __isl_take isl_union_set *context);
7335 __isl_give isl_multi_union_pw_aff *
7336 isl_multi_union_pw_aff_gist_params(
7337 __isl_take isl_multi_union_pw_aff *aff,
7338 __isl_take isl_set *context);
7339 __isl_give isl_multi_union_pw_aff *
7340 isl_multi_union_pw_aff_gist(
7341 __isl_take isl_multi_union_pw_aff *aff,
7342 __isl_take isl_union_set *context);
7344 #include <isl/polynomial.h>
7345 __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
7346 __isl_take isl_qpolynomial *qp,
7347 __isl_take isl_set *context);
7348 __isl_give isl_qpolynomial *isl_qpolynomial_gist(
7349 __isl_take isl_qpolynomial *qp,
7350 __isl_take isl_set *context);
7351 __isl_give isl_qpolynomial_fold *
7352 isl_qpolynomial_fold_gist_params(
7353 __isl_take isl_qpolynomial_fold *fold,
7354 __isl_take isl_set *context);
7355 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
7356 __isl_take isl_qpolynomial_fold *fold,
7357 __isl_take isl_set *context);
7358 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
7359 __isl_take isl_pw_qpolynomial *pwqp,
7360 __isl_take isl_set *context);
7361 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
7362 __isl_take isl_pw_qpolynomial *pwqp,
7363 __isl_take isl_set *context);
7364 __isl_give isl_pw_qpolynomial_fold *
7365 isl_pw_qpolynomial_fold_gist(
7366 __isl_take isl_pw_qpolynomial_fold *pwf,
7367 __isl_take isl_set *context);
7368 __isl_give isl_pw_qpolynomial_fold *
7369 isl_pw_qpolynomial_fold_gist_params(
7370 __isl_take isl_pw_qpolynomial_fold *pwf,
7371 __isl_take isl_set *context);
7372 __isl_give isl_union_pw_qpolynomial *
7373 isl_union_pw_qpolynomial_gist_params(
7374 __isl_take isl_union_pw_qpolynomial *upwqp,
7375 __isl_take isl_set *context);
7376 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
7377 __isl_take isl_union_pw_qpolynomial *upwqp,
7378 __isl_take isl_union_set *context);
7379 __isl_give isl_union_pw_qpolynomial_fold *
7380 isl_union_pw_qpolynomial_fold_gist(
7381 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7382 __isl_take isl_union_set *context);
7383 __isl_give isl_union_pw_qpolynomial_fold *
7384 isl_union_pw_qpolynomial_fold_gist_params(
7385 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7386 __isl_take isl_set *context);
7388 =item * Binary Arithmetic Operations
7390 #include <isl/set.h>
7391 __isl_give isl_set *isl_set_sum(
7392 __isl_take isl_set *set1,
7393 __isl_take isl_set *set2);
7394 #include <isl/map.h>
7395 __isl_give isl_map *isl_map_sum(
7396 __isl_take isl_map *map1,
7397 __isl_take isl_map *map2);
7399 C<isl_set_sum> computes the Minkowski sum of its two arguments,
7400 i.e., the set containing the sums of pairs of elements from
7401 C<set1> and C<set2>.
7402 The domain of the result of C<isl_map_sum> is the intersection
7403 of the domains of its two arguments. The corresponding range
7404 elements are the sums of the corresponding range elements
7405 in the two arguments.
7407 #include <isl/val.h>
7408 __isl_give isl_multi_val *isl_multi_val_add(
7409 __isl_take isl_multi_val *mv1,
7410 __isl_take isl_multi_val *mv2);
7411 __isl_give isl_multi_val *isl_multi_val_sub(
7412 __isl_take isl_multi_val *mv1,
7413 __isl_take isl_multi_val *mv2);
7415 #include <isl/aff.h>
7416 __isl_give isl_aff *isl_aff_add(
7417 __isl_take isl_aff *aff1,
7418 __isl_take isl_aff *aff2);
7419 __isl_give isl_multi_aff *isl_multi_aff_add(
7420 __isl_take isl_multi_aff *maff1,
7421 __isl_take isl_multi_aff *maff2);
7422 __isl_give isl_pw_aff *isl_pw_aff_add(
7423 __isl_take isl_pw_aff *pwaff1,
7424 __isl_take isl_pw_aff *pwaff2);
7425 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add(
7426 __isl_take isl_multi_pw_aff *mpa1,
7427 __isl_take isl_multi_pw_aff *mpa2);
7428 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
7429 __isl_take isl_pw_multi_aff *pma1,
7430 __isl_take isl_pw_multi_aff *pma2);
7431 __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
7432 __isl_take isl_union_pw_aff *upa1,
7433 __isl_take isl_union_pw_aff *upa2);
7434 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
7435 __isl_take isl_union_pw_multi_aff *upma1,
7436 __isl_take isl_union_pw_multi_aff *upma2);
7437 __isl_give isl_multi_union_pw_aff *
7438 isl_multi_union_pw_aff_add(
7439 __isl_take isl_multi_union_pw_aff *mupa1,
7440 __isl_take isl_multi_union_pw_aff *mupa2);
7441 __isl_give isl_pw_aff *isl_pw_aff_min(
7442 __isl_take isl_pw_aff *pwaff1,
7443 __isl_take isl_pw_aff *pwaff2);
7444 __isl_give isl_pw_aff *isl_pw_aff_max(
7445 __isl_take isl_pw_aff *pwaff1,
7446 __isl_take isl_pw_aff *pwaff2);
7447 __isl_give isl_aff *isl_aff_sub(
7448 __isl_take isl_aff *aff1,
7449 __isl_take isl_aff *aff2);
7450 __isl_give isl_multi_aff *isl_multi_aff_sub(
7451 __isl_take isl_multi_aff *ma1,
7452 __isl_take isl_multi_aff *ma2);
7453 __isl_give isl_pw_aff *isl_pw_aff_sub(
7454 __isl_take isl_pw_aff *pwaff1,
7455 __isl_take isl_pw_aff *pwaff2);
7456 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
7457 __isl_take isl_multi_pw_aff *mpa1,
7458 __isl_take isl_multi_pw_aff *mpa2);
7459 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
7460 __isl_take isl_pw_multi_aff *pma1,
7461 __isl_take isl_pw_multi_aff *pma2);
7462 __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
7463 __isl_take isl_union_pw_aff *upa1,
7464 __isl_take isl_union_pw_aff *upa2);
7465 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
7466 __isl_take isl_union_pw_multi_aff *upma1,
7467 __isl_take isl_union_pw_multi_aff *upma2);
7468 __isl_give isl_multi_union_pw_aff *
7469 isl_multi_union_pw_aff_sub(
7470 __isl_take isl_multi_union_pw_aff *mupa1,
7471 __isl_take isl_multi_union_pw_aff *mupa2);
7473 C<isl_aff_sub> subtracts the second argument from the first.
7475 #include <isl/polynomial.h>
7476 __isl_give isl_qpolynomial *isl_qpolynomial_add(
7477 __isl_take isl_qpolynomial *qp1,
7478 __isl_take isl_qpolynomial *qp2);
7479 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
7480 __isl_take isl_pw_qpolynomial *pwqp1,
7481 __isl_take isl_pw_qpolynomial *pwqp2);
7482 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
7483 __isl_take isl_pw_qpolynomial *pwqp1,
7484 __isl_take isl_pw_qpolynomial *pwqp2);
7485 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
7486 __isl_take isl_pw_qpolynomial_fold *pwf1,
7487 __isl_take isl_pw_qpolynomial_fold *pwf2);
7488 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
7489 __isl_take isl_union_pw_qpolynomial *upwqp1,
7490 __isl_take isl_union_pw_qpolynomial *upwqp2);
7491 __isl_give isl_qpolynomial *isl_qpolynomial_sub(
7492 __isl_take isl_qpolynomial *qp1,
7493 __isl_take isl_qpolynomial *qp2);
7494 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
7495 __isl_take isl_pw_qpolynomial *pwqp1,
7496 __isl_take isl_pw_qpolynomial *pwqp2);
7497 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
7498 __isl_take isl_union_pw_qpolynomial *upwqp1,
7499 __isl_take isl_union_pw_qpolynomial *upwqp2);
7500 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
7501 __isl_take isl_pw_qpolynomial_fold *pwf1,
7502 __isl_take isl_pw_qpolynomial_fold *pwf2);
7503 __isl_give isl_union_pw_qpolynomial_fold *
7504 isl_union_pw_qpolynomial_fold_fold(
7505 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
7506 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
7508 #include <isl/aff.h>
7509 __isl_give isl_pw_aff *isl_pw_aff_union_add(
7510 __isl_take isl_pw_aff *pwaff1,
7511 __isl_take isl_pw_aff *pwaff2);
7512 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
7513 __isl_take isl_pw_multi_aff *pma1,
7514 __isl_take isl_pw_multi_aff *pma2);
7515 __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
7516 __isl_take isl_union_pw_aff *upa1,
7517 __isl_take isl_union_pw_aff *upa2);
7518 __isl_give isl_union_pw_multi_aff *
7519 isl_union_pw_multi_aff_union_add(
7520 __isl_take isl_union_pw_multi_aff *upma1,
7521 __isl_take isl_union_pw_multi_aff *upma2);
7522 __isl_give isl_multi_union_pw_aff *
7523 isl_multi_union_pw_aff_union_add(
7524 __isl_take isl_multi_union_pw_aff *mupa1,
7525 __isl_take isl_multi_union_pw_aff *mupa2);
7526 __isl_give isl_pw_aff *isl_pw_aff_union_min(
7527 __isl_take isl_pw_aff *pwaff1,
7528 __isl_take isl_pw_aff *pwaff2);
7529 __isl_give isl_pw_aff *isl_pw_aff_union_max(
7530 __isl_take isl_pw_aff *pwaff1,
7531 __isl_take isl_pw_aff *pwaff2);
7533 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
7534 expression with a domain that is the union of those of C<pwaff1> and
7535 C<pwaff2> and such that on each cell, the quasi-affine expression is
7536 the maximum of those of C<pwaff1> and C<pwaff2>. If only one of
7537 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
7538 associated expression is the defined one.
7539 This in contrast to the C<isl_pw_aff_max> function, which is
7540 only defined on the shared definition domain of the arguments.
7542 #include <isl/val.h>
7543 __isl_give isl_multi_val *isl_multi_val_add_val(
7544 __isl_take isl_multi_val *mv,
7545 __isl_take isl_val *v);
7546 __isl_give isl_multi_val *isl_multi_val_mod_val(
7547 __isl_take isl_multi_val *mv,
7548 __isl_take isl_val *v);
7549 __isl_give isl_multi_val *isl_multi_val_scale_val(
7550 __isl_take isl_multi_val *mv,
7551 __isl_take isl_val *v);
7552 __isl_give isl_multi_val *isl_multi_val_scale_down_val(
7553 __isl_take isl_multi_val *mv,
7554 __isl_take isl_val *v);
7556 #include <isl/aff.h>
7557 __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
7558 __isl_take isl_val *mod);
7559 __isl_give isl_pw_aff *isl_pw_aff_mod_val(
7560 __isl_take isl_pw_aff *pa,
7561 __isl_take isl_val *mod);
7562 __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
7563 __isl_take isl_union_pw_aff *upa,
7564 __isl_take isl_val *f);
7565 __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
7566 __isl_take isl_val *v);
7567 __isl_give isl_multi_aff *isl_multi_aff_scale_val(
7568 __isl_take isl_multi_aff *ma,
7569 __isl_take isl_val *v);
7570 __isl_give isl_pw_aff *isl_pw_aff_scale_val(
7571 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
7572 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
7573 __isl_take isl_multi_pw_aff *mpa,
7574 __isl_take isl_val *v);
7575 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
7576 __isl_take isl_pw_multi_aff *pma,
7577 __isl_take isl_val *v);
7578 __isl_give isl_union_pw_multi_aff *
7579 __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
7580 __isl_take isl_union_pw_aff *upa,
7581 __isl_take isl_val *f);
7582 isl_union_pw_multi_aff_scale_val(
7583 __isl_take isl_union_pw_multi_aff *upma,
7584 __isl_take isl_val *val);
7585 __isl_give isl_multi_union_pw_aff *
7586 isl_multi_union_pw_aff_scale_val(
7587 __isl_take isl_multi_union_pw_aff *mupa,
7588 __isl_take isl_val *v);
7589 __isl_give isl_aff *isl_aff_scale_down_ui(
7590 __isl_take isl_aff *aff, unsigned f);
7591 __isl_give isl_aff *isl_aff_scale_down_val(
7592 __isl_take isl_aff *aff, __isl_take isl_val *v);
7593 __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
7594 __isl_take isl_multi_aff *ma,
7595 __isl_take isl_val *v);
7596 __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
7597 __isl_take isl_pw_aff *pa,
7598 __isl_take isl_val *f);
7599 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
7600 __isl_take isl_multi_pw_aff *mpa,
7601 __isl_take isl_val *v);
7602 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
7603 __isl_take isl_pw_multi_aff *pma,
7604 __isl_take isl_val *v);
7605 __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
7606 __isl_take isl_union_pw_aff *upa,
7607 __isl_take isl_val *v);
7608 __isl_give isl_union_pw_multi_aff *
7609 isl_union_pw_multi_aff_scale_down_val(
7610 __isl_take isl_union_pw_multi_aff *upma,
7611 __isl_take isl_val *val);
7612 __isl_give isl_multi_union_pw_aff *
7613 isl_multi_union_pw_aff_scale_down_val(
7614 __isl_take isl_multi_union_pw_aff *mupa,
7615 __isl_take isl_val *v);
7617 #include <isl/polynomial.h>
7618 __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
7619 __isl_take isl_qpolynomial *qp,
7620 __isl_take isl_val *v);
7621 __isl_give isl_qpolynomial_fold *
7622 isl_qpolynomial_fold_scale_val(
7623 __isl_take isl_qpolynomial_fold *fold,
7624 __isl_take isl_val *v);
7625 __isl_give isl_pw_qpolynomial *
7626 isl_pw_qpolynomial_scale_val(
7627 __isl_take isl_pw_qpolynomial *pwqp,
7628 __isl_take isl_val *v);
7629 __isl_give isl_pw_qpolynomial_fold *
7630 isl_pw_qpolynomial_fold_scale_val(
7631 __isl_take isl_pw_qpolynomial_fold *pwf,
7632 __isl_take isl_val *v);
7633 __isl_give isl_union_pw_qpolynomial *
7634 isl_union_pw_qpolynomial_scale_val(
7635 __isl_take isl_union_pw_qpolynomial *upwqp,
7636 __isl_take isl_val *v);
7637 __isl_give isl_union_pw_qpolynomial_fold *
7638 isl_union_pw_qpolynomial_fold_scale_val(
7639 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7640 __isl_take isl_val *v);
7641 __isl_give isl_qpolynomial *
7642 isl_qpolynomial_scale_down_val(
7643 __isl_take isl_qpolynomial *qp,
7644 __isl_take isl_val *v);
7645 __isl_give isl_qpolynomial_fold *
7646 isl_qpolynomial_fold_scale_down_val(
7647 __isl_take isl_qpolynomial_fold *fold,
7648 __isl_take isl_val *v);
7649 __isl_give isl_pw_qpolynomial *
7650 isl_pw_qpolynomial_scale_down_val(
7651 __isl_take isl_pw_qpolynomial *pwqp,
7652 __isl_take isl_val *v);
7653 __isl_give isl_pw_qpolynomial_fold *
7654 isl_pw_qpolynomial_fold_scale_down_val(
7655 __isl_take isl_pw_qpolynomial_fold *pwf,
7656 __isl_take isl_val *v);
7657 __isl_give isl_union_pw_qpolynomial *
7658 isl_union_pw_qpolynomial_scale_down_val(
7659 __isl_take isl_union_pw_qpolynomial *upwqp,
7660 __isl_take isl_val *v);
7661 __isl_give isl_union_pw_qpolynomial_fold *
7662 isl_union_pw_qpolynomial_fold_scale_down_val(
7663 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7664 __isl_take isl_val *v);
7666 #include <isl/val.h>
7667 __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
7668 __isl_take isl_multi_val *mv1,
7669 __isl_take isl_multi_val *mv2);
7670 __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
7671 __isl_take isl_multi_val *mv1,
7672 __isl_take isl_multi_val *mv2);
7673 __isl_give isl_multi_val *
7674 isl_multi_val_scale_down_multi_val(
7675 __isl_take isl_multi_val *mv1,
7676 __isl_take isl_multi_val *mv2);
7678 #include <isl/aff.h>
7679 __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
7680 __isl_take isl_multi_aff *ma,
7681 __isl_take isl_multi_val *mv);
7682 __isl_give isl_multi_union_pw_aff *
7683 isl_multi_union_pw_aff_mod_multi_val(
7684 __isl_take isl_multi_union_pw_aff *upma,
7685 __isl_take isl_multi_val *mv);
7686 __isl_give isl_multi_pw_aff *
7687 isl_multi_pw_aff_mod_multi_val(
7688 __isl_take isl_multi_pw_aff *mpa,
7689 __isl_take isl_multi_val *mv);
7690 __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
7691 __isl_take isl_multi_aff *ma,
7692 __isl_take isl_multi_val *mv);
7693 __isl_give isl_pw_multi_aff *
7694 isl_pw_multi_aff_scale_multi_val(
7695 __isl_take isl_pw_multi_aff *pma,
7696 __isl_take isl_multi_val *mv);
7697 __isl_give isl_multi_pw_aff *
7698 isl_multi_pw_aff_scale_multi_val(
7699 __isl_take isl_multi_pw_aff *mpa,
7700 __isl_take isl_multi_val *mv);
7701 __isl_give isl_multi_union_pw_aff *
7702 isl_multi_union_pw_aff_scale_multi_val(
7703 __isl_take isl_multi_union_pw_aff *mupa,
7704 __isl_take isl_multi_val *mv);
7705 __isl_give isl_union_pw_multi_aff *
7706 isl_union_pw_multi_aff_scale_multi_val(
7707 __isl_take isl_union_pw_multi_aff *upma,
7708 __isl_take isl_multi_val *mv);
7709 __isl_give isl_multi_aff *
7710 isl_multi_aff_scale_down_multi_val(
7711 __isl_take isl_multi_aff *ma,
7712 __isl_take isl_multi_val *mv);
7713 __isl_give isl_multi_pw_aff *
7714 isl_multi_pw_aff_scale_down_multi_val(
7715 __isl_take isl_multi_pw_aff *mpa,
7716 __isl_take isl_multi_val *mv);
7717 __isl_give isl_multi_union_pw_aff *
7718 isl_multi_union_pw_aff_scale_down_multi_val(
7719 __isl_take isl_multi_union_pw_aff *mupa,
7720 __isl_take isl_multi_val *mv);
7722 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
7723 by the corresponding elements of C<mv>.
7725 #include <isl/aff.h>
7726 __isl_give isl_aff *isl_aff_mul(
7727 __isl_take isl_aff *aff1,
7728 __isl_take isl_aff *aff2);
7729 __isl_give isl_aff *isl_aff_div(
7730 __isl_take isl_aff *aff1,
7731 __isl_take isl_aff *aff2);
7732 __isl_give isl_pw_aff *isl_pw_aff_mul(
7733 __isl_take isl_pw_aff *pwaff1,
7734 __isl_take isl_pw_aff *pwaff2);
7735 __isl_give isl_pw_aff *isl_pw_aff_div(
7736 __isl_take isl_pw_aff *pa1,
7737 __isl_take isl_pw_aff *pa2);
7738 __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
7739 __isl_take isl_pw_aff *pa1,
7740 __isl_take isl_pw_aff *pa2);
7741 __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
7742 __isl_take isl_pw_aff *pa1,
7743 __isl_take isl_pw_aff *pa2);
7745 When multiplying two affine expressions, at least one of the two needs
7746 to be a constant. Similarly, when dividing an affine expression by another,
7747 the second expression needs to be a constant.
7748 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
7749 rounding towards zero. C<isl_pw_aff_tdiv_r> computes the corresponding
7752 #include <isl/polynomial.h>
7753 __isl_give isl_qpolynomial *isl_qpolynomial_mul(
7754 __isl_take isl_qpolynomial *qp1,
7755 __isl_take isl_qpolynomial *qp2);
7756 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
7757 __isl_take isl_pw_qpolynomial *pwqp1,
7758 __isl_take isl_pw_qpolynomial *pwqp2);
7759 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
7760 __isl_take isl_union_pw_qpolynomial *upwqp1,
7761 __isl_take isl_union_pw_qpolynomial *upwqp2);
7765 =head3 Lexicographic Optimization
7767 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
7768 the following functions
7769 compute a set that contains the lexicographic minimum or maximum
7770 of the elements in C<set> (or C<bset>) for those values of the parameters
7771 that satisfy C<dom>.
7772 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
7773 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
7775 In other words, the union of the parameter values
7776 for which the result is non-empty and of C<*empty>
7779 #include <isl/set.h>
7780 __isl_give isl_set *isl_basic_set_partial_lexmin(
7781 __isl_take isl_basic_set *bset,
7782 __isl_take isl_basic_set *dom,
7783 __isl_give isl_set **empty);
7784 __isl_give isl_set *isl_basic_set_partial_lexmax(
7785 __isl_take isl_basic_set *bset,
7786 __isl_take isl_basic_set *dom,
7787 __isl_give isl_set **empty);
7788 __isl_give isl_set *isl_set_partial_lexmin(
7789 __isl_take isl_set *set, __isl_take isl_set *dom,
7790 __isl_give isl_set **empty);
7791 __isl_give isl_set *isl_set_partial_lexmax(
7792 __isl_take isl_set *set, __isl_take isl_set *dom,
7793 __isl_give isl_set **empty);
7795 Given a (basic) set C<set> (or C<bset>), the following functions simply
7796 return a set containing the lexicographic minimum or maximum
7797 of the elements in C<set> (or C<bset>).
7798 In case of union sets, the optimum is computed per space.
7800 #include <isl/set.h>
7801 __isl_give isl_set *isl_basic_set_lexmin(
7802 __isl_take isl_basic_set *bset);
7803 __isl_give isl_set *isl_basic_set_lexmax(
7804 __isl_take isl_basic_set *bset);
7805 __isl_give isl_set *isl_set_lexmin(
7806 __isl_take isl_set *set);
7807 __isl_give isl_set *isl_set_lexmax(
7808 __isl_take isl_set *set);
7809 __isl_give isl_union_set *isl_union_set_lexmin(
7810 __isl_take isl_union_set *uset);
7811 __isl_give isl_union_set *isl_union_set_lexmax(
7812 __isl_take isl_union_set *uset);
7814 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
7815 the following functions
7816 compute a relation that maps each element of C<dom>
7817 to the single lexicographic minimum or maximum
7818 of the elements that are associated to that same
7819 element in C<map> (or C<bmap>).
7820 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
7821 that contains the elements in C<dom> that do not map
7822 to any elements in C<map> (or C<bmap>).
7823 In other words, the union of the domain of the result and of C<*empty>
7826 #include <isl/map.h>
7827 __isl_give isl_map *isl_basic_map_partial_lexmax(
7828 __isl_take isl_basic_map *bmap,
7829 __isl_take isl_basic_set *dom,
7830 __isl_give isl_set **empty);
7831 __isl_give isl_map *isl_basic_map_partial_lexmin(
7832 __isl_take isl_basic_map *bmap,
7833 __isl_take isl_basic_set *dom,
7834 __isl_give isl_set **empty);
7835 __isl_give isl_map *isl_map_partial_lexmax(
7836 __isl_take isl_map *map, __isl_take isl_set *dom,
7837 __isl_give isl_set **empty);
7838 __isl_give isl_map *isl_map_partial_lexmin(
7839 __isl_take isl_map *map, __isl_take isl_set *dom,
7840 __isl_give isl_set **empty);
7842 Given a (basic) map C<map> (or C<bmap>), the following functions simply
7843 return a map mapping each element in the domain of
7844 C<map> (or C<bmap>) to the lexicographic minimum or maximum
7845 of all elements associated to that element.
7846 In case of union relations, the optimum is computed per space.
7848 #include <isl/map.h>
7849 __isl_give isl_map *isl_basic_map_lexmin(
7850 __isl_take isl_basic_map *bmap);
7851 __isl_give isl_map *isl_basic_map_lexmax(
7852 __isl_take isl_basic_map *bmap);
7853 __isl_give isl_map *isl_map_lexmin(
7854 __isl_take isl_map *map);
7855 __isl_give isl_map *isl_map_lexmax(
7856 __isl_take isl_map *map);
7857 __isl_give isl_union_map *isl_union_map_lexmin(
7858 __isl_take isl_union_map *umap);
7859 __isl_give isl_union_map *isl_union_map_lexmax(
7860 __isl_take isl_union_map *umap);
7862 The following functions return their result in the form of
7863 a piecewise multi-affine expression,
7864 but are otherwise equivalent to the corresponding functions
7865 returning a basic set or relation.
7867 #include <isl/set.h>
7868 __isl_give isl_pw_multi_aff *
7869 isl_basic_set_partial_lexmin_pw_multi_aff(
7870 __isl_take isl_basic_set *bset,
7871 __isl_take isl_basic_set *dom,
7872 __isl_give isl_set **empty);
7873 __isl_give isl_pw_multi_aff *
7874 isl_basic_set_partial_lexmax_pw_multi_aff(
7875 __isl_take isl_basic_set *bset,
7876 __isl_take isl_basic_set *dom,
7877 __isl_give isl_set **empty);
7878 __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
7879 __isl_take isl_set *set);
7880 __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
7881 __isl_take isl_set *set);
7883 #include <isl/map.h>
7884 __isl_give isl_pw_multi_aff *
7885 isl_basic_map_lexmin_pw_multi_aff(
7886 __isl_take isl_basic_map *bmap);
7887 __isl_give isl_pw_multi_aff *
7888 isl_basic_map_partial_lexmin_pw_multi_aff(
7889 __isl_take isl_basic_map *bmap,
7890 __isl_take isl_basic_set *dom,
7891 __isl_give isl_set **empty);
7892 __isl_give isl_pw_multi_aff *
7893 isl_basic_map_partial_lexmax_pw_multi_aff(
7894 __isl_take isl_basic_map *bmap,
7895 __isl_take isl_basic_set *dom,
7896 __isl_give isl_set **empty);
7897 __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
7898 __isl_take isl_map *map);
7899 __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
7900 __isl_take isl_map *map);
7902 The following functions return the lexicographic minimum or maximum
7903 on the shared domain of the inputs and the single defined function
7904 on those parts of the domain where only a single function is defined.
7906 #include <isl/aff.h>
7907 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
7908 __isl_take isl_pw_multi_aff *pma1,
7909 __isl_take isl_pw_multi_aff *pma2);
7910 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
7911 __isl_take isl_pw_multi_aff *pma1,
7912 __isl_take isl_pw_multi_aff *pma2);
7914 If the input to a lexicographic optimization problem has
7915 multiple constraints with the same coefficients for the optimized
7916 variables, then, by default, this symmetry is exploited by
7917 replacing those constraints by a single constraint with
7918 an abstract bound, which is in turn bounded by the corresponding terms
7919 in the original constraints.
7920 Without this optimization, the solver would typically consider
7921 all possible orderings of those original bounds, resulting in a needless
7922 decomposition of the domain.
7923 However, the optimization can also result in slowdowns since
7924 an extra parameter is introduced that may get used in additional
7926 The following option determines whether symmetry detection is applied
7927 during lexicographic optimization.
7929 #include <isl/options.h>
7930 isl_stat isl_options_set_pip_symmetry(isl_ctx *ctx,
7932 int isl_options_get_pip_symmetry(isl_ctx *ctx);
7936 See also \autoref{s:offline}.
7940 =head2 Ternary Operations
7942 #include <isl/aff.h>
7943 __isl_give isl_pw_aff *isl_pw_aff_cond(
7944 __isl_take isl_pw_aff *cond,
7945 __isl_take isl_pw_aff *pwaff_true,
7946 __isl_take isl_pw_aff *pwaff_false);
7948 The function C<isl_pw_aff_cond> performs a conditional operator
7949 and returns an expression that is equal to C<pwaff_true>
7950 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
7951 where C<cond> is zero.
7955 Lists are defined over several element types, including
7956 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_pw_multi_aff>,
7957 C<isl_union_pw_aff>,
7958 C<isl_union_pw_multi_aff>,
7959 C<isl_pw_qpolynomial>, C<isl_pw_qpolynomial_fold>,
7961 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
7962 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
7963 Here we take lists of C<isl_set>s as an example.
7964 Lists can be created, copied, modified and freed using the following functions.
7966 #include <isl/set.h>
7967 __isl_give isl_set_list *isl_set_list_from_set(
7968 __isl_take isl_set *el);
7969 __isl_give isl_set_list *isl_set_list_alloc(
7970 isl_ctx *ctx, int n);
7971 __isl_give isl_set_list *isl_set_list_copy(
7972 __isl_keep isl_set_list *list);
7973 __isl_give isl_set_list *isl_set_list_insert(
7974 __isl_take isl_set_list *list, unsigned pos,
7975 __isl_take isl_set *el);
7976 __isl_give isl_set_list *isl_set_list_add(
7977 __isl_take isl_set_list *list,
7978 __isl_take isl_set *el);
7979 __isl_give isl_set_list *isl_set_list_drop(
7980 __isl_take isl_set_list *list,
7981 unsigned first, unsigned n);
7982 __isl_give isl_set_list *isl_set_list_swap(
7983 __isl_take isl_set_list *list,
7984 unsigned pos1, unsigned pos2);
7985 __isl_give isl_set_list *isl_set_list_reverse(
7986 __isl_take isl_set_list *list);
7987 __isl_give isl_set_list *isl_set_list_set_set(
7988 __isl_take isl_set_list *list, int index,
7989 __isl_take isl_set *set);
7990 __isl_give isl_set_list *isl_set_list_concat(
7991 __isl_take isl_set_list *list1,
7992 __isl_take isl_set_list *list2);
7993 __isl_give isl_set_list *isl_set_list_map(
7994 __isl_take isl_set_list *list,
7995 __isl_give isl_set *(*fn)(__isl_take isl_set *el,
7998 __isl_give isl_set_list *isl_set_list_sort(
7999 __isl_take isl_set_list *list,
8000 int (*cmp)(__isl_keep isl_set *a,
8001 __isl_keep isl_set *b, void *user),
8003 __isl_null isl_set_list *isl_set_list_free(
8004 __isl_take isl_set_list *list);
8006 C<isl_set_list_alloc> creates an empty list with an initial capacity
8007 for C<n> elements. C<isl_set_list_insert> and C<isl_set_list_add>
8008 add elements to a list, increasing its capacity as needed.
8009 C<isl_set_list_from_set> creates a list with a single element.
8010 C<isl_set_list_swap> swaps the elements at the specified locations.
8011 C<isl_set_list_reverse> reverses the elements in the list.
8013 Lists can be inspected using the following functions.
8015 #include <isl/set.h>
8016 isl_size isl_set_list_size(__isl_keep isl_set_list *list);
8017 isl_size isl_set_list_n_set(__isl_keep isl_set_list *list);
8018 __isl_give isl_set *isl_set_list_get_at(
8019 __isl_keep isl_set_list *list, int index);
8020 __isl_give isl_set *isl_set_list_get_set(
8021 __isl_keep isl_set_list *list, int index);
8022 isl_stat isl_set_list_foreach(__isl_keep isl_set_list *list,
8023 isl_stat (*fn)(__isl_take isl_set *el, void *user),
8025 isl_stat isl_set_list_foreach_scc(
8026 __isl_keep isl_set_list *list,
8027 isl_bool (*follows)(__isl_keep isl_set *a,
8028 __isl_keep isl_set *b, void *user),
8030 isl_stat (*fn)(__isl_take isl_set *el, void *user),
8033 C<isl_set_list_n_set> is an alternative name for C<isl_set_list_size>.
8035 C<isl_set_list_get_set> is an alternative name for C<isl_set_list_get_at>.
8036 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
8037 strongly connected components of the graph with as vertices the elements
8038 of C<list> and a directed edge from vertex C<b> to vertex C<a>
8039 iff C<follows(a, b)> returns C<isl_bool_true>. The callbacks C<follows> and
8040 C<fn> should return C<isl_bool_error> or C<isl_stat_error> on error.
8042 Lists can be printed using
8044 #include <isl/set.h>
8045 __isl_give isl_printer *isl_printer_print_set_list(
8046 __isl_take isl_printer *p,
8047 __isl_keep isl_set_list *list);
8049 Alternatively, a string representation can be obtained
8050 directly using the following function, which always prints
8053 #include <isl/set.h>
8054 __isl_give char *isl_set_list_to_str(
8055 __isl_keep isl_set_list *list);
8057 =head2 Associative arrays
8059 Associative arrays map isl objects of a specific type to isl objects
8060 of some (other) specific type. They are defined for several pairs
8061 of types, including (C<isl_map>, C<isl_basic_set>),
8062 (C<isl_id>, C<isl_ast_expr>),
8063 (C<isl_id>, C<isl_id>) and
8064 (C<isl_id>, C<isl_pw_aff>).
8065 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
8068 Associative arrays can be created, copied and freed using
8069 the following functions.
8071 #include <isl/id_to_ast_expr.h>
8072 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
8073 isl_ctx *ctx, int min_size);
8074 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
8075 __isl_keep isl_id_to_ast_expr *id2expr);
8076 __isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
8077 __isl_take isl_id_to_ast_expr *id2expr);
8079 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
8080 to specify the expected size of the associative array.
8081 The associative array will be grown automatically as needed.
8083 Associative arrays can be inspected using the following functions.
8085 #include <isl/id_to_ast_expr.h>
8086 __isl_give isl_maybe_isl_ast_expr
8087 isl_id_to_ast_expr_try_get(
8088 __isl_keep isl_id_to_ast_expr *id2expr,
8089 __isl_keep isl_id *key);
8090 isl_bool isl_id_to_ast_expr_has(
8091 __isl_keep isl_id_to_ast_expr *id2expr,
8092 __isl_keep isl_id *key);
8093 __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
8094 __isl_keep isl_id_to_ast_expr *id2expr,
8095 __isl_take isl_id *key);
8096 isl_stat isl_id_to_ast_expr_foreach(
8097 __isl_keep isl_id_to_ast_expr *id2expr,
8098 isl_stat (*fn)(__isl_take isl_id *key,
8099 __isl_take isl_ast_expr *val, void *user),
8102 The function C<isl_id_to_ast_expr_try_get> returns a structure
8103 containing two elements, C<valid> and C<value>.
8104 If there is a value associated to the key, then C<valid>
8105 is set to C<isl_bool_true> and C<value> contains a copy of
8106 the associated value. Otherwise C<value> is C<NULL> and
8107 C<valid> may be C<isl_bool_error> or C<isl_bool_false> depending
8108 on whether some error has occurred or there simply is no associated value.
8109 The function C<isl_id_to_ast_expr_has> returns the C<valid> field
8110 in the structure and
8111 the function C<isl_id_to_ast_expr_get> returns the C<value> field.
8113 Associative arrays can be modified using the following functions.
8115 #include <isl/id_to_ast_expr.h>
8116 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
8117 __isl_take isl_id_to_ast_expr *id2expr,
8118 __isl_take isl_id *key,
8119 __isl_take isl_ast_expr *val);
8120 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
8121 __isl_take isl_id_to_ast_expr *id2expr,
8122 __isl_take isl_id *key);
8124 Associative arrays can be printed using the following function.
8126 #include <isl/id_to_ast_expr.h>
8127 __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
8128 __isl_take isl_printer *p,
8129 __isl_keep isl_id_to_ast_expr *id2expr);
8133 Vectors can be created, copied and freed using the following functions.
8135 #include <isl/vec.h>
8136 __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
8138 __isl_give isl_vec *isl_vec_zero(isl_ctx *ctx,
8140 __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
8141 __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
8143 Note that the elements of a vector created by C<isl_vec_alloc>
8144 may have arbitrary values.
8145 A vector created by C<isl_vec_zero> has elements with value zero.
8146 The elements can be changed and inspected using the following functions.
8148 isl_size isl_vec_size(__isl_keep isl_vec *vec);
8149 __isl_give isl_val *isl_vec_get_element_val(
8150 __isl_keep isl_vec *vec, int pos);
8151 __isl_give isl_vec *isl_vec_set_element_si(
8152 __isl_take isl_vec *vec, int pos, int v);
8153 __isl_give isl_vec *isl_vec_set_element_val(
8154 __isl_take isl_vec *vec, int pos,
8155 __isl_take isl_val *v);
8156 __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
8158 __isl_give isl_vec *isl_vec_set_val(
8159 __isl_take isl_vec *vec, __isl_take isl_val *v);
8160 int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
8161 __isl_keep isl_vec *vec2, int pos);
8163 C<isl_vec_get_element> will return a negative value if anything went wrong.
8164 In that case, the value of C<*v> is undefined.
8166 The following function can be used to concatenate two vectors.
8168 __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
8169 __isl_take isl_vec *vec2);
8173 Matrices can be created, copied and freed using the following functions.
8175 #include <isl/mat.h>
8176 __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
8177 unsigned n_row, unsigned n_col);
8178 __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
8179 __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
8181 Note that the elements of a newly created matrix may have arbitrary values.
8182 The elements can be changed and inspected using the following functions.
8184 isl_size isl_mat_rows(__isl_keep isl_mat *mat);
8185 isl_size isl_mat_cols(__isl_keep isl_mat *mat);
8186 __isl_give isl_val *isl_mat_get_element_val(
8187 __isl_keep isl_mat *mat, int row, int col);
8188 __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
8189 int row, int col, int v);
8190 __isl_give isl_mat *isl_mat_set_element_val(
8191 __isl_take isl_mat *mat, int row, int col,
8192 __isl_take isl_val *v);
8194 The following function computes the rank of a matrix.
8195 The return value may be -1 if some error occurred.
8197 #include <isl/mat.h>
8198 isl_size isl_mat_rank(__isl_keep isl_mat *mat);
8200 The following function can be used to compute the (right) inverse
8201 of a matrix, i.e., a matrix such that the product of the original
8202 and the inverse (in that order) is a multiple of the identity matrix.
8203 The input matrix is assumed to be of full row-rank.
8205 __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
8207 The following function can be used to compute the (right) kernel
8208 (or null space) of a matrix, i.e., a matrix such that the product of
8209 the original and the kernel (in that order) is the zero matrix.
8211 __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
8213 The following function computes a basis for the space spanned
8214 by the rows of a matrix.
8216 __isl_give isl_mat *isl_mat_row_basis(
8217 __isl_take isl_mat *mat);
8219 The following function computes rows that extend a basis of C<mat1>
8220 to a basis that also covers C<mat2>.
8222 __isl_give isl_mat *isl_mat_row_basis_extension(
8223 __isl_take isl_mat *mat1,
8224 __isl_take isl_mat *mat2);
8226 The following function checks whether there is no linear dependence
8227 among the combined rows of "mat1" and "mat2" that is not already present
8228 in "mat1" or "mat2" individually.
8229 If "mat1" and "mat2" have linearly independent rows by themselves,
8230 then this means that there is no linear dependence among all rows together.
8232 isl_bool isl_mat_has_linearly_independent_rows(
8233 __isl_keep isl_mat *mat1,
8234 __isl_keep isl_mat *mat2);
8236 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
8238 The following functions determine
8239 an upper or lower bound on a quasipolynomial over its domain.
8241 __isl_give isl_pw_qpolynomial_fold *
8242 isl_pw_qpolynomial_bound(
8243 __isl_take isl_pw_qpolynomial *pwqp,
8244 enum isl_fold type, isl_bool *tight);
8246 __isl_give isl_union_pw_qpolynomial_fold *
8247 isl_union_pw_qpolynomial_bound(
8248 __isl_take isl_union_pw_qpolynomial *upwqp,
8249 enum isl_fold type, isl_bool *tight);
8251 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
8252 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
8253 is the returned bound is known be tight, i.e., for each value
8254 of the parameters there is at least
8255 one element in the domain that reaches the bound.
8256 If the domain of C<pwqp> is not wrapping, then the bound is computed
8257 over all elements in that domain and the result has a purely parametric
8258 domain. If the domain of C<pwqp> is wrapping, then the bound is
8259 computed over the range of the wrapped relation. The domain of the
8260 wrapped relation becomes the domain of the result.
8262 =head2 Parametric Vertex Enumeration
8264 The parametric vertex enumeration described in this section
8265 is mainly intended to be used internally and by the C<barvinok>
8268 #include <isl/vertices.h>
8269 __isl_give isl_vertices *isl_basic_set_compute_vertices(
8270 __isl_keep isl_basic_set *bset);
8272 The function C<isl_basic_set_compute_vertices> performs the
8273 actual computation of the parametric vertices and the chamber
8274 decomposition and stores the result in an C<isl_vertices> object.
8275 This information can be queried by either iterating over all
8276 the vertices or iterating over all the chambers or cells
8277 and then iterating over all vertices that are active on the chamber.
8279 isl_stat isl_vertices_foreach_vertex(
8280 __isl_keep isl_vertices *vertices,
8281 isl_stat (*fn)(__isl_take isl_vertex *vertex,
8282 void *user), void *user);
8284 isl_stat isl_vertices_foreach_cell(
8285 __isl_keep isl_vertices *vertices,
8286 isl_stat (*fn)(__isl_take isl_cell *cell,
8287 void *user), void *user);
8288 isl_stat isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
8289 isl_stat (*fn)(__isl_take isl_vertex *vertex,
8290 void *user), void *user);
8292 Other operations that can be performed on an C<isl_vertices> object are
8295 isl_size isl_vertices_get_n_vertices(
8296 __isl_keep isl_vertices *vertices);
8297 __isl_null isl_vertices *isl_vertices_free(
8298 __isl_take isl_vertices *vertices);
8300 Vertices can be inspected and destroyed using the following functions.
8302 isl_size isl_vertex_get_id(__isl_keep isl_vertex *vertex);
8303 __isl_give isl_basic_set *isl_vertex_get_domain(
8304 __isl_keep isl_vertex *vertex);
8305 __isl_give isl_multi_aff *isl_vertex_get_expr(
8306 __isl_keep isl_vertex *vertex);
8307 __isl_null isl_vertex *isl_vertex_free(
8308 __isl_take isl_vertex *vertex);
8310 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
8311 describing the vertex in terms of the parameters,
8312 while C<isl_vertex_get_domain> returns the activity domain
8315 Chambers can be inspected and destroyed using the following functions.
8317 __isl_give isl_basic_set *isl_cell_get_domain(
8318 __isl_keep isl_cell *cell);
8319 __isl_null isl_cell *isl_cell_free(
8320 __isl_take isl_cell *cell);
8322 =head1 Polyhedral Compilation Library
8324 This section collects functionality in C<isl> that has been specifically
8325 designed for use during polyhedral compilation.
8327 =head2 Schedule Trees
8329 A schedule tree is a structured representation of a schedule,
8330 assigning a relative order to a set of domain elements.
8331 The relative order expressed by the schedule tree is
8332 defined recursively. In particular, the order between
8333 two domain elements is determined by the node that is closest
8334 to the root that refers to both elements and that orders them apart.
8335 Each node in the tree is of one of several types.
8336 The root node is always of type C<isl_schedule_node_domain>
8337 (or C<isl_schedule_node_extension>)
8338 and it describes the (extra) domain elements to which the schedule applies.
8339 The other types of nodes are as follows.
8343 =item C<isl_schedule_node_band>
8345 A band of schedule dimensions. Each schedule dimension is represented
8346 by a union piecewise quasi-affine expression. If this expression
8347 assigns a different value to two domain elements, while all previous
8348 schedule dimensions in the same band assign them the same value,
8349 then the two domain elements are ordered according to these two
8351 Each expression is required to be total in the domain elements
8352 that reach the band node.
8354 =item C<isl_schedule_node_expansion>
8356 An expansion node maps each of the domain elements that reach the node
8357 to one or more domain elements. The image of this mapping forms
8358 the set of domain elements that reach the child of the expansion node.
8359 The function that maps each of the expanded domain elements
8360 to the original domain element from which it was expanded
8361 is called the contraction.
8363 =item C<isl_schedule_node_filter>
8365 A filter node does not impose any ordering, but rather intersects
8366 the set of domain elements that the current subtree refers to
8367 with a given union set. The subtree of the filter node only
8368 refers to domain elements in the intersection.
8369 A filter node is typically only used as a child of a sequence or
8372 =item C<isl_schedule_node_leaf>
8374 A leaf of the schedule tree. Leaf nodes do not impose any ordering.
8376 =item C<isl_schedule_node_mark>
8378 A mark node can be used to attach any kind of information to a subtree
8379 of the schedule tree.
8381 =item C<isl_schedule_node_sequence>
8383 A sequence node has one or more children, each of which is a filter node.
8384 The filters on these filter nodes form a partition of
8385 the domain elements that the current subtree refers to.
8386 If two domain elements appear in distinct filters then the sequence
8387 node orders them according to the child positions of the corresponding
8390 =item C<isl_schedule_node_set>
8392 A set node is similar to a sequence node, except that
8393 it expresses that domain elements appearing in distinct filters
8394 may have any order. The order of the children of a set node
8395 is therefore also immaterial.
8399 The following node types are only supported by the AST generator.
8403 =item C<isl_schedule_node_context>
8405 The context describes constraints on the parameters and
8406 the schedule dimensions of outer
8407 bands that the AST generator may assume to hold. It is also the only
8408 kind of node that may introduce additional parameters.
8409 The space of the context is that of the flat product of the outer
8410 band nodes. In particular, if there are no outer band nodes, then
8411 this space is the unnamed zero-dimensional space.
8412 Since a context node references the outer band nodes, any tree
8413 containing a context node is considered to be anchored.
8415 =item C<isl_schedule_node_extension>
8417 An extension node instructs the AST generator to add additional
8418 domain elements that need to be scheduled.
8419 The additional domain elements are described by the range of
8420 the extension map in terms of the outer schedule dimensions,
8421 i.e., the flat product of the outer band nodes.
8422 Note that domain elements are added whenever the AST generator
8423 reaches the extension node, meaning that there are still some
8424 active domain elements for which an AST needs to be generated.
8425 The conditions under which some domain elements are still active
8426 may however not be completely described by the outer AST nodes
8427 generated at that point.
8428 Since an extension node references the outer band nodes, any tree
8429 containing an extension node is considered to be anchored.
8431 An extension node may also appear as the root of a schedule tree,
8432 when it is intended to be inserted into another tree
8433 using C<isl_schedule_node_graft_before> or C<isl_schedule_node_graft_after>.
8434 In this case, the domain of the extension node should
8435 correspond to the flat product of the outer band nodes
8436 in this other schedule tree at the point where the extension tree
8439 =item C<isl_schedule_node_guard>
8441 The guard describes constraints on the parameters and
8442 the schedule dimensions of outer
8443 bands that need to be enforced by the outer nodes
8444 in the generated AST.
8445 That is, the part of the AST that is generated from descendants
8446 of the guard node can assume that these constraints are satisfied.
8447 The space of the guard is that of the flat product of the outer
8448 band nodes. In particular, if there are no outer band nodes, then
8449 this space is the unnamed zero-dimensional space.
8450 Since a guard node references the outer band nodes, any tree
8451 containing a guard node is considered to be anchored.
8455 Except for the C<isl_schedule_node_context> nodes,
8456 none of the nodes may introduce any parameters that were not
8457 already present in the root domain node.
8459 A schedule tree is encapsulated in an C<isl_schedule> object.
8460 The simplest such objects, those with a tree consisting of single domain node,
8461 can be created using the following functions with either an empty
8462 domain or a given domain.
8464 #include <isl/schedule.h>
8465 __isl_give isl_schedule *isl_schedule_empty(
8466 __isl_take isl_space *space);
8467 __isl_give isl_schedule *isl_schedule_from_domain(
8468 __isl_take isl_union_set *domain);
8470 The function C<isl_schedule_constraints_compute_schedule> described
8471 in L</"Scheduling"> can also be used to construct schedules.
8473 C<isl_schedule> objects may be copied and freed using the following functions.
8475 #include <isl/schedule.h>
8476 __isl_give isl_schedule *isl_schedule_copy(
8477 __isl_keep isl_schedule *sched);
8478 __isl_null isl_schedule *isl_schedule_free(
8479 __isl_take isl_schedule *sched);
8481 The following functions checks whether two C<isl_schedule> objects
8482 are obviously the same.
8484 #include <isl/schedule.h>
8485 isl_bool isl_schedule_plain_is_equal(
8486 __isl_keep isl_schedule *schedule1,
8487 __isl_keep isl_schedule *schedule2);
8489 The domain of the schedule, i.e., the domain described by the root node,
8490 can be obtained using the following function.
8492 #include <isl/schedule.h>
8493 __isl_give isl_union_set *isl_schedule_get_domain(
8494 __isl_keep isl_schedule *schedule);
8496 An extra top-level band node (right underneath the domain node) can
8497 be introduced into the schedule using the following function.
8498 The schedule tree is assumed not to have any anchored nodes.
8500 #include <isl/schedule.h>
8501 __isl_give isl_schedule *
8502 isl_schedule_insert_partial_schedule(
8503 __isl_take isl_schedule *schedule,
8504 __isl_take isl_multi_union_pw_aff *partial);
8506 A top-level context node (right underneath the domain node) can
8507 be introduced into the schedule using the following function.
8509 #include <isl/schedule.h>
8510 __isl_give isl_schedule *isl_schedule_insert_context(
8511 __isl_take isl_schedule *schedule,
8512 __isl_take isl_set *context)
8514 A top-level guard node (right underneath the domain node) can
8515 be introduced into the schedule using the following function.
8517 #include <isl/schedule.h>
8518 __isl_give isl_schedule *isl_schedule_insert_guard(
8519 __isl_take isl_schedule *schedule,
8520 __isl_take isl_set *guard)
8522 A schedule that combines two schedules either in the given
8523 order or in an arbitrary order, i.e., with an C<isl_schedule_node_sequence>
8524 or an C<isl_schedule_node_set> node,
8525 can be created using the following functions.
8527 #include <isl/schedule.h>
8528 __isl_give isl_schedule *isl_schedule_sequence(
8529 __isl_take isl_schedule *schedule1,
8530 __isl_take isl_schedule *schedule2);
8531 __isl_give isl_schedule *isl_schedule_set(
8532 __isl_take isl_schedule *schedule1,
8533 __isl_take isl_schedule *schedule2);
8535 The domains of the two input schedules need to be disjoint.
8537 The following function can be used to restrict the domain
8538 of a schedule with a domain node as root to be a subset of the given union set.
8539 This operation may remove nodes in the tree that have become
8542 #include <isl/schedule.h>
8543 __isl_give isl_schedule *isl_schedule_intersect_domain(
8544 __isl_take isl_schedule *schedule,
8545 __isl_take isl_union_set *domain);
8547 The following function can be used to simplify the domain
8548 of a schedule with a domain node as root with respect to the given
8551 #include <isl/schedule.h>
8552 __isl_give isl_schedule *isl_schedule_gist_domain_params(
8553 __isl_take isl_schedule *schedule,
8554 __isl_take isl_set *context);
8556 The following function resets the user pointers on all parameter
8557 and tuple identifiers referenced by the nodes of the given schedule.
8559 #include <isl/schedule.h>
8560 __isl_give isl_schedule *isl_schedule_reset_user(
8561 __isl_take isl_schedule *schedule);
8563 The following function aligns the parameters of all nodes
8564 in the given schedule to the given space.
8566 #include <isl/schedule.h>
8567 __isl_give isl_schedule *isl_schedule_align_params(
8568 __isl_take isl_schedule *schedule,
8569 __isl_take isl_space *space);
8571 The following function allows the user to plug in a given function
8572 in the iteration domains. The input schedule is not allowed to contain
8573 any expansion nodes.
8575 #include <isl/schedule.h>
8576 __isl_give isl_schedule *
8577 isl_schedule_pullback_union_pw_multi_aff(
8578 __isl_take isl_schedule *schedule,
8579 __isl_take isl_union_pw_multi_aff *upma);
8581 The following function can be used to plug in the schedule C<expansion>
8582 in the leaves of C<schedule>, where C<contraction> describes how
8583 the domain elements of C<expansion> map to the domain elements
8584 at the original leaves of C<schedule>.
8585 The resulting schedule will contain expansion nodes, unless
8586 C<contraction> is an identity function.
8588 #include <isl/schedule.h>
8589 __isl_give isl_schedule *isl_schedule_expand(
8590 __isl_take isl_schedule *schedule,
8591 __isl_take isl_union_pw_multi_aff *contraction,
8592 __isl_take isl_schedule *expansion);
8594 An C<isl_union_map> representation of the schedule can be obtained
8595 from an C<isl_schedule> using the following function.
8597 #include <isl/schedule.h>
8598 __isl_give isl_union_map *isl_schedule_get_map(
8599 __isl_keep isl_schedule *sched);
8601 The resulting relation encodes the same relative ordering as
8602 the schedule by mapping the domain elements to a common schedule space.
8603 If the schedule_separate_components option is set, then the order
8604 of the children of a set node is explicitly encoded in the result.
8605 If the tree contains any expansion nodes, then the relation
8606 is formulated in terms of the expanded domain elements.
8608 Schedules can be read from input using the following functions.
8610 #include <isl/schedule.h>
8611 __isl_give isl_schedule *isl_schedule_read_from_file(
8612 isl_ctx *ctx, FILE *input);
8613 __isl_give isl_schedule *isl_schedule_read_from_str(
8614 isl_ctx *ctx, const char *str);
8616 A representation of the schedule can be printed using
8618 #include <isl/schedule.h>
8619 __isl_give isl_printer *isl_printer_print_schedule(
8620 __isl_take isl_printer *p,
8621 __isl_keep isl_schedule *schedule);
8622 __isl_give char *isl_schedule_to_str(
8623 __isl_keep isl_schedule *schedule);
8625 C<isl_schedule_to_str> prints the schedule in flow format.
8627 The schedule tree can be traversed through the use of
8628 C<isl_schedule_node> objects that point to a particular
8629 position in the schedule tree. Whenever a C<isl_schedule_node>
8630 is used to modify a node in the schedule tree, the original schedule
8631 tree is left untouched and the modifications are performed to a copy
8632 of the tree. The returned C<isl_schedule_node> then points to
8633 this modified copy of the tree.
8635 The root of the schedule tree can be obtained using the following function.
8637 #include <isl/schedule.h>
8638 __isl_give isl_schedule_node *isl_schedule_get_root(
8639 __isl_keep isl_schedule *schedule);
8641 A pointer to a newly created schedule tree with a single domain
8642 node can be created using the following functions.
8644 #include <isl/schedule_node.h>
8645 __isl_give isl_schedule_node *
8646 isl_schedule_node_from_domain(
8647 __isl_take isl_union_set *domain);
8648 __isl_give isl_schedule_node *
8649 isl_schedule_node_from_extension(
8650 __isl_take isl_union_map *extension);
8652 C<isl_schedule_node_from_extension> creates a tree with an extension
8655 Schedule nodes can be copied and freed using the following functions.
8657 #include <isl/schedule_node.h>
8658 __isl_give isl_schedule_node *isl_schedule_node_copy(
8659 __isl_keep isl_schedule_node *node);
8660 __isl_null isl_schedule_node *isl_schedule_node_free(
8661 __isl_take isl_schedule_node *node);
8663 The following functions can be used to check if two schedule
8664 nodes point to the same position in the same schedule.
8666 #include <isl/schedule_node.h>
8667 isl_bool isl_schedule_node_is_equal(
8668 __isl_keep isl_schedule_node *node1,
8669 __isl_keep isl_schedule_node *node2);
8671 The following properties can be obtained from a schedule node.
8673 #include <isl/schedule_node.h>
8674 enum isl_schedule_node_type isl_schedule_node_get_type(
8675 __isl_keep isl_schedule_node *node);
8676 enum isl_schedule_node_type
8677 isl_schedule_node_get_parent_type(
8678 __isl_keep isl_schedule_node *node);
8679 __isl_give isl_schedule *isl_schedule_node_get_schedule(
8680 __isl_keep isl_schedule_node *node);
8682 The function C<isl_schedule_node_get_type> returns the type of
8683 the node, while C<isl_schedule_node_get_parent_type> returns
8684 type of the parent of the node, which is required to exist.
8685 The function C<isl_schedule_node_get_schedule> returns a copy
8686 to the schedule to which the node belongs.
8688 The following functions can be used to move the schedule node
8689 to a different position in the tree or to check if such a position
8692 #include <isl/schedule_node.h>
8693 isl_bool isl_schedule_node_has_parent(
8694 __isl_keep isl_schedule_node *node);
8695 __isl_give isl_schedule_node *isl_schedule_node_parent(
8696 __isl_take isl_schedule_node *node);
8697 __isl_give isl_schedule_node *isl_schedule_node_root(
8698 __isl_take isl_schedule_node *node);
8699 __isl_give isl_schedule_node *isl_schedule_node_ancestor(
8700 __isl_take isl_schedule_node *node,
8702 isl_size isl_schedule_node_n_children(
8703 __isl_keep isl_schedule_node *node);
8704 __isl_give isl_schedule_node *isl_schedule_node_child(
8705 __isl_take isl_schedule_node *node, int pos);
8706 isl_bool isl_schedule_node_has_children(
8707 __isl_keep isl_schedule_node *node);
8708 __isl_give isl_schedule_node *isl_schedule_node_first_child(
8709 __isl_take isl_schedule_node *node);
8710 isl_bool isl_schedule_node_has_previous_sibling(
8711 __isl_keep isl_schedule_node *node);
8712 __isl_give isl_schedule_node *
8713 isl_schedule_node_previous_sibling(
8714 __isl_take isl_schedule_node *node);
8715 isl_bool isl_schedule_node_has_next_sibling(
8716 __isl_keep isl_schedule_node *node);
8717 __isl_give isl_schedule_node *
8718 isl_schedule_node_next_sibling(
8719 __isl_take isl_schedule_node *node);
8721 For C<isl_schedule_node_ancestor>, the ancestor of generation 0
8722 is the node itself, the ancestor of generation 1 is its parent and so on.
8724 It is also possible to query the number of ancestors of a node,
8725 the position of the current node
8726 within the children of its parent, the position of the subtree
8727 containing a node within the children of an ancestor
8728 or to obtain a copy of a given
8729 child without destroying the current node.
8730 Given two nodes that point to the same schedule, their closest
8731 shared ancestor can be obtained using
8732 C<isl_schedule_node_get_shared_ancestor>.
8734 #include <isl/schedule_node.h>
8735 isl_size isl_schedule_node_get_tree_depth(
8736 __isl_keep isl_schedule_node *node);
8737 isl_size isl_schedule_node_get_child_position(
8738 __isl_keep isl_schedule_node *node);
8739 isl_size isl_schedule_node_get_ancestor_child_position(
8740 __isl_keep isl_schedule_node *node,
8741 __isl_keep isl_schedule_node *ancestor);
8742 __isl_give isl_schedule_node *isl_schedule_node_get_child(
8743 __isl_keep isl_schedule_node *node, int pos);
8744 __isl_give isl_schedule_node *
8745 isl_schedule_node_get_shared_ancestor(
8746 __isl_keep isl_schedule_node *node1,
8747 __isl_keep isl_schedule_node *node2);
8749 All nodes in a schedule tree or
8750 all descendants of a specific node (including the node) can be visited
8751 in depth-first pre-order using the following functions.
8753 #include <isl/schedule.h>
8754 isl_stat isl_schedule_foreach_schedule_node_top_down(
8755 __isl_keep isl_schedule *sched,
8756 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
8757 void *user), void *user);
8759 #include <isl/schedule_node.h>
8760 isl_stat isl_schedule_node_foreach_descendant_top_down(
8761 __isl_keep isl_schedule_node *node,
8762 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
8763 void *user), void *user);
8765 The callback function is slightly different from the usual
8766 callbacks in that it not only indicates success (non-negative result)
8767 or failure (negative result), but also indicates whether the children
8768 of the given node should be visited. In particular, if the callback
8769 returns a positive value, then the children are visited, but if
8770 the callback returns zero, then the children are not visited.
8772 The following functions checks whether
8773 all descendants of a specific node (including the node itself)
8774 satisfy a user-specified test.
8776 #include <isl/schedule_node.h>
8777 isl_bool isl_schedule_node_every_descendant(
8778 __isl_keep isl_schedule_node *node,
8779 isl_bool (*test)(__isl_keep isl_schedule_node *node,
8780 void *user), void *user)
8782 The ancestors of a node in a schedule tree can be visited from
8783 the root down to and including the parent of the node using
8784 the following function.
8786 #include <isl/schedule_node.h>
8787 isl_stat isl_schedule_node_foreach_ancestor_top_down(
8788 __isl_keep isl_schedule_node *node,
8789 isl_stat (*fn)(__isl_keep isl_schedule_node *node,
8790 void *user), void *user);
8792 The following functions allows for a depth-first post-order
8793 traversal of the nodes in a schedule tree or
8794 of the descendants of a specific node (including the node
8795 itself), where the user callback is allowed to modify the
8798 #include <isl/schedule.h>
8799 __isl_give isl_schedule *
8800 isl_schedule_map_schedule_node_bottom_up(
8801 __isl_take isl_schedule *schedule,
8802 __isl_give isl_schedule_node *(*fn)(
8803 __isl_take isl_schedule_node *node,
8804 void *user), void *user);
8806 #include <isl/schedule_node.h>
8807 __isl_give isl_schedule_node *
8808 isl_schedule_node_map_descendant_bottom_up(
8809 __isl_take isl_schedule_node *node,
8810 __isl_give isl_schedule_node *(*fn)(
8811 __isl_take isl_schedule_node *node,
8812 void *user), void *user);
8814 The traversal continues from the node returned by the callback function.
8815 It is the responsibility of the user to ensure that this does not
8816 lead to an infinite loop. It is safest to always return a pointer
8817 to the same position (same ancestors and child positions) as the input node.
8819 The following function removes a node (along with its descendants)
8820 from a schedule tree and returns a pointer to the leaf at the
8821 same position in the updated tree.
8822 It is not allowed to remove the root of a schedule tree or
8823 a child of a set or sequence node.
8825 #include <isl/schedule_node.h>
8826 __isl_give isl_schedule_node *isl_schedule_node_cut(
8827 __isl_take isl_schedule_node *node);
8829 The following function removes a single node
8830 from a schedule tree and returns a pointer to the child
8831 of the node, now located at the position of the original node
8832 or to a leaf node at that position if there was no child.
8833 It is not allowed to remove the root of a schedule tree,
8834 a set or sequence node, a child of a set or sequence node or
8835 a band node with an anchored subtree.
8837 #include <isl/schedule_node.h>
8838 __isl_give isl_schedule_node *isl_schedule_node_delete(
8839 __isl_take isl_schedule_node *node);
8841 Most nodes in a schedule tree only contain local information.
8842 In some cases, however, a node may also refer to the schedule dimensions
8843 of its outer band nodes.
8844 This means that the position of the node within the tree should
8845 not be changed, or at least that no changes are performed to the
8846 outer band nodes. The following function can be used to test
8847 whether the subtree rooted at a given node contains any such nodes.
8849 #include <isl/schedule_node.h>
8850 isl_bool isl_schedule_node_is_subtree_anchored(
8851 __isl_keep isl_schedule_node *node);
8853 The following function resets the user pointers on all parameter
8854 and tuple identifiers referenced by the given schedule node.
8856 #include <isl/schedule_node.h>
8857 __isl_give isl_schedule_node *isl_schedule_node_reset_user(
8858 __isl_take isl_schedule_node *node);
8860 The following function aligns the parameters of the given schedule
8861 node to the given space.
8863 #include <isl/schedule_node.h>
8864 __isl_give isl_schedule_node *
8865 isl_schedule_node_align_params(
8866 __isl_take isl_schedule_node *node,
8867 __isl_take isl_space *space);
8869 Several node types have their own functions for querying
8870 (and in some cases setting) some node type specific properties.
8872 #include <isl/schedule_node.h>
8873 __isl_give isl_space *isl_schedule_node_band_get_space(
8874 __isl_keep isl_schedule_node *node);
8875 __isl_give isl_multi_union_pw_aff *
8876 isl_schedule_node_band_get_partial_schedule(
8877 __isl_keep isl_schedule_node *node);
8878 __isl_give isl_union_map *
8879 isl_schedule_node_band_get_partial_schedule_union_map(
8880 __isl_keep isl_schedule_node *node);
8881 isl_size isl_schedule_node_band_n_member(
8882 __isl_keep isl_schedule_node *node);
8883 isl_bool isl_schedule_node_band_member_get_coincident(
8884 __isl_keep isl_schedule_node *node, int pos);
8885 __isl_give isl_schedule_node *
8886 isl_schedule_node_band_member_set_coincident(
8887 __isl_take isl_schedule_node *node, int pos,
8889 isl_bool isl_schedule_node_band_get_permutable(
8890 __isl_keep isl_schedule_node *node);
8891 __isl_give isl_schedule_node *
8892 isl_schedule_node_band_set_permutable(
8893 __isl_take isl_schedule_node *node, int permutable);
8894 enum isl_ast_loop_type
8895 isl_schedule_node_band_member_get_ast_loop_type(
8896 __isl_keep isl_schedule_node *node, int pos);
8897 __isl_give isl_schedule_node *
8898 isl_schedule_node_band_member_set_ast_loop_type(
8899 __isl_take isl_schedule_node *node, int pos,
8900 enum isl_ast_loop_type type);
8901 __isl_give isl_union_set *
8902 enum isl_ast_loop_type
8903 isl_schedule_node_band_member_get_isolate_ast_loop_type(
8904 __isl_keep isl_schedule_node *node, int pos);
8905 __isl_give isl_schedule_node *
8906 isl_schedule_node_band_member_set_isolate_ast_loop_type(
8907 __isl_take isl_schedule_node *node, int pos,
8908 enum isl_ast_loop_type type);
8909 isl_schedule_node_band_get_ast_build_options(
8910 __isl_keep isl_schedule_node *node);
8911 __isl_give isl_schedule_node *
8912 isl_schedule_node_band_set_ast_build_options(
8913 __isl_take isl_schedule_node *node,
8914 __isl_take isl_union_set *options);
8915 __isl_give isl_set *
8916 isl_schedule_node_band_get_ast_isolate_option(
8917 __isl_keep isl_schedule_node *node);
8919 The function C<isl_schedule_node_band_get_space> returns the space
8920 of the partial schedule of the band.
8921 The function C<isl_schedule_node_band_get_partial_schedule_union_map>
8922 returns a representation of the partial schedule of the band node
8923 in the form of an C<isl_union_map>.
8924 The coincident and permutable properties are set by
8925 C<isl_schedule_constraints_compute_schedule> on the schedule tree
8927 A scheduling dimension is considered to be ``coincident''
8928 if it satisfies the coincidence constraints within its band.
8929 That is, if the dependence distances of the coincidence
8930 constraints are all zero in that direction (for fixed
8931 iterations of outer bands).
8932 A band is marked permutable if it was produced using the Pluto-like scheduler.
8933 Note that the scheduler may have to resort to a Feautrier style scheduling
8934 step even if the default scheduler is used.
8935 An C<isl_ast_loop_type> is one of C<isl_ast_loop_default>,
8936 C<isl_ast_loop_atomic>, C<isl_ast_loop_unroll> or C<isl_ast_loop_separate>.
8937 For the meaning of these loop AST generation types and the difference
8938 between the regular loop AST generation type and the isolate
8939 loop AST generation type, see L</"AST Generation Options (Schedule Tree)">.
8940 The functions C<isl_schedule_node_band_member_get_ast_loop_type>
8941 and C<isl_schedule_node_band_member_get_isolate_ast_loop_type>
8942 may return C<isl_ast_loop_error> if an error occurs.
8943 The AST build options govern how an AST is generated for
8944 the individual schedule dimensions during AST generation.
8945 See L</"AST Generation Options (Schedule Tree)">.
8946 The isolate option for the given node can be extracted from these
8947 AST build options using the function
8948 C<isl_schedule_node_band_get_ast_isolate_option>.
8950 #include <isl/schedule_node.h>
8951 __isl_give isl_set *
8952 isl_schedule_node_context_get_context(
8953 __isl_keep isl_schedule_node *node);
8955 #include <isl/schedule_node.h>
8956 __isl_give isl_union_set *
8957 isl_schedule_node_domain_get_domain(
8958 __isl_keep isl_schedule_node *node);
8960 #include <isl/schedule_node.h>
8961 __isl_give isl_union_map *
8962 isl_schedule_node_expansion_get_expansion(
8963 __isl_keep isl_schedule_node *node);
8964 __isl_give isl_union_pw_multi_aff *
8965 isl_schedule_node_expansion_get_contraction(
8966 __isl_keep isl_schedule_node *node);
8968 #include <isl/schedule_node.h>
8969 __isl_give isl_union_map *
8970 isl_schedule_node_extension_get_extension(
8971 __isl_keep isl_schedule_node *node);
8973 #include <isl/schedule_node.h>
8974 __isl_give isl_union_set *
8975 isl_schedule_node_filter_get_filter(
8976 __isl_keep isl_schedule_node *node);
8978 #include <isl/schedule_node.h>
8979 __isl_give isl_set *isl_schedule_node_guard_get_guard(
8980 __isl_keep isl_schedule_node *node);
8982 #include <isl/schedule_node.h>
8983 __isl_give isl_id *isl_schedule_node_mark_get_id(
8984 __isl_keep isl_schedule_node *node);
8986 The following functions can be used to obtain an C<isl_multi_union_pw_aff>,
8987 an C<isl_union_pw_multi_aff> or C<isl_union_map> representation of
8988 partial schedules related to the node.
8990 #include <isl/schedule_node.h>
8991 __isl_give isl_multi_union_pw_aff *
8992 isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(
8993 __isl_keep isl_schedule_node *node);
8994 __isl_give isl_union_pw_multi_aff *
8995 isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(
8996 __isl_keep isl_schedule_node *node);
8997 __isl_give isl_union_map *
8998 isl_schedule_node_get_prefix_schedule_union_map(
8999 __isl_keep isl_schedule_node *node);
9000 __isl_give isl_union_map *
9001 isl_schedule_node_get_prefix_schedule_relation(
9002 __isl_keep isl_schedule_node *node);
9003 __isl_give isl_union_map *
9004 isl_schedule_node_get_subtree_schedule_union_map(
9005 __isl_keep isl_schedule_node *node);
9007 In particular, the functions
9008 C<isl_schedule_node_get_prefix_schedule_multi_union_pw_aff>,
9009 C<isl_schedule_node_get_prefix_schedule_union_pw_multi_aff>
9010 and C<isl_schedule_node_get_prefix_schedule_union_map>
9011 return a relative ordering on the domain elements that reach the given
9012 node determined by its ancestors.
9013 The function C<isl_schedule_node_get_prefix_schedule_relation>
9014 additionally includes the domain constraints in the result.
9015 The function C<isl_schedule_node_get_subtree_schedule_union_map>
9016 returns a representation of the partial schedule defined by the
9017 subtree rooted at the given node.
9018 If the tree contains any expansion nodes, then the subtree schedule
9019 is formulated in terms of the expanded domain elements.
9020 The tree passed to functions returning a prefix schedule
9021 may only contain extension nodes if these would not affect
9022 the result of these functions. That is, if one of the ancestors
9023 is an extension node, then all of the domain elements that were
9024 added by the extension node need to have been filtered out
9025 by filter nodes between the extension node and the input node.
9026 The tree passed to C<isl_schedule_node_get_subtree_schedule_union_map>
9027 may not contain in extension nodes in the selected subtree.
9029 The expansion/contraction defined by an entire subtree, combining
9030 the expansions/contractions
9031 on the expansion nodes in the subtree, can be obtained using
9032 the following functions.
9034 #include <isl/schedule_node.h>
9035 __isl_give isl_union_map *
9036 isl_schedule_node_get_subtree_expansion(
9037 __isl_keep isl_schedule_node *node);
9038 __isl_give isl_union_pw_multi_aff *
9039 isl_schedule_node_get_subtree_contraction(
9040 __isl_keep isl_schedule_node *node);
9042 The total number of outer band members of given node, i.e.,
9043 the shared output dimension of the maps in the result
9044 of C<isl_schedule_node_get_prefix_schedule_union_map> can be obtained
9045 using the following function.
9047 #include <isl/schedule_node.h>
9048 isl_size isl_schedule_node_get_schedule_depth(
9049 __isl_keep isl_schedule_node *node);
9051 The following functions return the elements that reach the given node
9052 or the union of universes in the spaces that contain these elements.
9054 #include <isl/schedule_node.h>
9055 __isl_give isl_union_set *
9056 isl_schedule_node_get_domain(
9057 __isl_keep isl_schedule_node *node);
9058 __isl_give isl_union_set *
9059 isl_schedule_node_get_universe_domain(
9060 __isl_keep isl_schedule_node *node);
9062 The input tree of C<isl_schedule_node_get_domain>
9063 may only contain extension nodes if these would not affect
9064 the result of this function. That is, if one of the ancestors
9065 is an extension node, then all of the domain elements that were
9066 added by the extension node need to have been filtered out
9067 by filter nodes between the extension node and the input node.
9069 The following functions can be used to introduce additional nodes
9070 in the schedule tree. The new node is introduced at the point
9071 in the tree where the C<isl_schedule_node> points to and
9072 the results points to the new node.
9074 #include <isl/schedule_node.h>
9075 __isl_give isl_schedule_node *
9076 isl_schedule_node_insert_partial_schedule(
9077 __isl_take isl_schedule_node *node,
9078 __isl_take isl_multi_union_pw_aff *schedule);
9080 This function inserts a new band node with (the greatest integer
9081 part of) the given partial schedule.
9082 The subtree rooted at the given node is assumed not to have
9085 #include <isl/schedule_node.h>
9086 __isl_give isl_schedule_node *
9087 isl_schedule_node_insert_context(
9088 __isl_take isl_schedule_node *node,
9089 __isl_take isl_set *context);
9091 This function inserts a new context node with the given context constraints.
9093 #include <isl/schedule_node.h>
9094 __isl_give isl_schedule_node *
9095 isl_schedule_node_insert_filter(
9096 __isl_take isl_schedule_node *node,
9097 __isl_take isl_union_set *filter);
9099 This function inserts a new filter node with the given filter.
9100 If the original node already pointed to a filter node, then the
9101 two filter nodes are merged into one.
9103 #include <isl/schedule_node.h>
9104 __isl_give isl_schedule_node *
9105 isl_schedule_node_insert_guard(
9106 __isl_take isl_schedule_node *node,
9107 __isl_take isl_set *guard);
9109 This function inserts a new guard node with the given guard constraints.
9111 #include <isl/schedule_node.h>
9112 __isl_give isl_schedule_node *
9113 isl_schedule_node_insert_mark(
9114 __isl_take isl_schedule_node *node,
9115 __isl_take isl_id *mark);
9117 This function inserts a new mark node with the give mark identifier.
9119 #include <isl/schedule_node.h>
9120 __isl_give isl_schedule_node *
9121 isl_schedule_node_insert_sequence(
9122 __isl_take isl_schedule_node *node,
9123 __isl_take isl_union_set_list *filters);
9124 __isl_give isl_schedule_node *
9125 isl_schedule_node_insert_set(
9126 __isl_take isl_schedule_node *node,
9127 __isl_take isl_union_set_list *filters);
9129 These functions insert a new sequence or set node with the given
9130 filters as children.
9132 #include <isl/schedule_node.h>
9133 __isl_give isl_schedule_node *isl_schedule_node_group(
9134 __isl_take isl_schedule_node *node,
9135 __isl_take isl_id *group_id);
9137 This function introduces an expansion node in between the current
9138 node and its parent that expands instances of a space with tuple
9139 identifier C<group_id> to the original domain elements that reach
9140 the node. The group instances are identified by the prefix schedule
9141 of those domain elements. The ancestors of the node are adjusted
9142 to refer to the group instances instead of the original domain
9143 elements. The return value points to the same node in the updated
9144 schedule tree as the input node, i.e., to the child of the newly
9145 introduced expansion node. Grouping instances of different statements
9146 ensures that they will be treated as a single statement by the
9147 AST generator up to the point of the expansion node.
9149 The following function can be used to flatten a nested
9152 #include <isl/schedule_node.h>
9153 __isl_give isl_schedule_node *
9154 isl_schedule_node_sequence_splice_child(
9155 __isl_take isl_schedule_node *node, int pos);
9157 That is, given a sequence node C<node> that has another sequence node
9158 in its child at position C<pos> (in particular, the child of that filter
9159 node is a sequence node), attach the children of that other sequence
9160 node as children of C<node>, replacing the original child at position
9163 The partial schedule of a band node can be scaled (down) or reduced using
9164 the following functions.
9166 #include <isl/schedule_node.h>
9167 __isl_give isl_schedule_node *
9168 isl_schedule_node_band_scale(
9169 __isl_take isl_schedule_node *node,
9170 __isl_take isl_multi_val *mv);
9171 __isl_give isl_schedule_node *
9172 isl_schedule_node_band_scale_down(
9173 __isl_take isl_schedule_node *node,
9174 __isl_take isl_multi_val *mv);
9175 __isl_give isl_schedule_node *
9176 isl_schedule_node_band_mod(
9177 __isl_take isl_schedule_node *node,
9178 __isl_take isl_multi_val *mv);
9180 The spaces of the two arguments need to match.
9181 After scaling, the partial schedule is replaced by its greatest
9182 integer part to ensure that the schedule remains integral.
9184 The partial schedule of a band node can be shifted by an
9185 C<isl_multi_union_pw_aff> with a domain that is a superset
9186 of the domain of the partial schedule using
9187 the following function.
9189 #include <isl/schedule_node.h>
9190 __isl_give isl_schedule_node *
9191 isl_schedule_node_band_shift(
9192 __isl_take isl_schedule_node *node,
9193 __isl_take isl_multi_union_pw_aff *shift);
9195 A band node can be tiled using the following function.
9197 #include <isl/schedule_node.h>
9198 __isl_give isl_schedule_node *isl_schedule_node_band_tile(
9199 __isl_take isl_schedule_node *node,
9200 __isl_take isl_multi_val *sizes);
9202 isl_stat isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
9204 int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
9205 isl_stat isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
9207 int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
9209 The C<isl_schedule_node_band_tile> function tiles
9210 the band using the given tile sizes inside its schedule.
9211 A new child band node is created to represent the point loops and it is
9212 inserted between the modified band and its children.
9213 The subtree rooted at the given node is assumed not to have
9215 The C<tile_scale_tile_loops> option specifies whether the tile
9216 loops iterators should be scaled by the tile sizes.
9217 If the C<tile_shift_point_loops> option is set, then the point loops
9218 are shifted to start at zero.
9220 A band node can be split into two nested band nodes
9221 using the following function.
9223 #include <isl/schedule_node.h>
9224 __isl_give isl_schedule_node *isl_schedule_node_band_split(
9225 __isl_take isl_schedule_node *node, int pos);
9227 The resulting outer band node contains the first C<pos> dimensions of
9228 the schedule of C<node> while the inner band contains the remaining dimensions.
9229 The schedules of the two band nodes live in anonymous spaces.
9230 The loop AST generation type options and the isolate option
9231 are split over the two band nodes.
9233 A band node can be moved down to the leaves of the subtree rooted
9234 at the band node using the following function.
9236 #include <isl/schedule_node.h>
9237 __isl_give isl_schedule_node *isl_schedule_node_band_sink(
9238 __isl_take isl_schedule_node *node);
9240 The subtree rooted at the given node is assumed not to have
9242 The result points to the node in the resulting tree that is in the same
9243 position as the node pointed to by C<node> in the original tree.
9245 #include <isl/schedule_node.h>
9246 __isl_give isl_schedule_node *
9247 isl_schedule_node_order_before(
9248 __isl_take isl_schedule_node *node,
9249 __isl_take isl_union_set *filter);
9250 __isl_give isl_schedule_node *
9251 isl_schedule_node_order_after(
9252 __isl_take isl_schedule_node *node,
9253 __isl_take isl_union_set *filter);
9255 These functions split the domain elements that reach C<node>
9256 into those that satisfy C<filter> and those that do not and
9257 arranges for the elements that do satisfy the filter to be
9258 executed before (in case of C<isl_schedule_node_order_before>)
9259 or after (in case of C<isl_schedule_node_order_after>)
9260 those that do not. The order is imposed by
9261 a sequence node, possibly reusing the grandparent of C<node>
9262 on two copies of the subtree attached to the original C<node>.
9263 Both copies are simplified with respect to their filter.
9265 Return a pointer to the copy of the subtree that does not
9266 satisfy C<filter>. If there is no such copy (because all
9267 reaching domain elements satisfy the filter), then return
9268 the original pointer.
9270 #include <isl/schedule_node.h>
9271 __isl_give isl_schedule_node *
9272 isl_schedule_node_graft_before(
9273 __isl_take isl_schedule_node *node,
9274 __isl_take isl_schedule_node *graft);
9275 __isl_give isl_schedule_node *
9276 isl_schedule_node_graft_after(
9277 __isl_take isl_schedule_node *node,
9278 __isl_take isl_schedule_node *graft);
9280 This function inserts the C<graft> tree into the tree containing C<node>
9281 such that it is executed before (in case of C<isl_schedule_node_graft_before>)
9282 or after (in case of C<isl_schedule_node_graft_after>) C<node>.
9283 The root node of C<graft>
9284 should be an extension node where the domain of the extension
9285 is the flat product of all outer band nodes of C<node>.
9286 The root node may also be a domain node.
9287 The elements of the domain or the range of the extension may not
9288 intersect with the domain elements that reach "node".
9289 The schedule tree of C<graft> may not be anchored.
9291 The schedule tree of C<node> is modified to include an extension node
9292 corresponding to the root node of C<graft> as a child of the original
9293 parent of C<node>. The original node that C<node> points to and the
9294 child of the root node of C<graft> are attached to this extension node
9295 through a sequence, with appropriate filters and with the child
9296 of C<graft> appearing before or after the original C<node>.
9298 If C<node> already appears inside a sequence that is the child of
9299 an extension node and if the spaces of the new domain elements
9300 do not overlap with those of the original domain elements,
9301 then that extension node is extended with the new extension
9302 rather than introducing a new segment of extension and sequence nodes.
9304 Return a pointer to the same node in the modified tree that
9305 C<node> pointed to in the original tree.
9307 A representation of the schedule node can be printed using
9309 #include <isl/schedule_node.h>
9310 __isl_give isl_printer *isl_printer_print_schedule_node(
9311 __isl_take isl_printer *p,
9312 __isl_keep isl_schedule_node *node);
9313 __isl_give char *isl_schedule_node_to_str(
9314 __isl_keep isl_schedule_node *node);
9316 C<isl_schedule_node_to_str> prints the schedule node in block format.
9318 =head2 Dependence Analysis
9320 C<isl> contains specialized functionality for performing
9321 array dataflow analysis. That is, given a I<sink> access relation,
9322 a collection of possible I<source> accesses and
9323 a collection of I<kill> accesses,
9324 C<isl> can compute relations that describe
9325 for each iteration of the sink access, which iterations
9326 of which of the source access relations may have
9327 accessed the same data element before the given iteration
9328 of the sink access without any intermediate kill of that data element.
9329 The resulting dependence relations map source iterations
9330 to either the corresponding sink iterations or
9331 pairs of corresponding sink iterations and accessed data elements.
9332 To compute standard flow dependences, the sink should be
9333 a read, while the sources should be writes.
9334 If no kills are specified,
9335 then memory based dependence analysis is performed.
9336 If, on the other hand, all sources are also kills,
9337 then value based dependence analysis is performed.
9338 If any of the source accesses are marked as being I<must>
9339 accesses, then they are also treated as kills.
9340 Furthermore, the specification of must-sources results
9341 in the computation of must-dependences.
9342 Only dependences originating in a must access not coscheduled
9343 with any other access to the same element and without
9344 any may accesses between the must access and the sink access
9345 are considered to be must dependences.
9347 =head3 High-level Interface
9349 A high-level interface to dependence analysis is provided
9350 by the following function.
9352 #include <isl/flow.h>
9353 __isl_give isl_union_flow *
9354 isl_union_access_info_compute_flow(
9355 __isl_take isl_union_access_info *access);
9357 The input C<isl_union_access_info> object describes the sink
9358 access relations, the source access relations and a schedule,
9359 while the output C<isl_union_flow> object describes
9360 the resulting dependence relations and the subsets of the
9361 sink relations for which no source was found.
9363 An C<isl_union_access_info> is created, modified, copied and freed using
9364 the following functions.
9366 #include <isl/flow.h>
9367 __isl_give isl_union_access_info *
9368 isl_union_access_info_from_sink(
9369 __isl_take isl_union_map *sink);
9370 __isl_give isl_union_access_info *
9371 isl_union_access_info_set_kill(
9372 __isl_take isl_union_access_info *access,
9373 __isl_take isl_union_map *kill);
9374 __isl_give isl_union_access_info *
9375 isl_union_access_info_set_may_source(
9376 __isl_take isl_union_access_info *access,
9377 __isl_take isl_union_map *may_source);
9378 __isl_give isl_union_access_info *
9379 isl_union_access_info_set_must_source(
9380 __isl_take isl_union_access_info *access,
9381 __isl_take isl_union_map *must_source);
9382 __isl_give isl_union_access_info *
9383 isl_union_access_info_set_schedule(
9384 __isl_take isl_union_access_info *access,
9385 __isl_take isl_schedule *schedule);
9386 __isl_give isl_union_access_info *
9387 isl_union_access_info_set_schedule_map(
9388 __isl_take isl_union_access_info *access,
9389 __isl_take isl_union_map *schedule_map);
9390 __isl_give isl_union_access_info *
9391 isl_union_access_info_copy(
9392 __isl_keep isl_union_access_info *access);
9393 __isl_null isl_union_access_info *
9394 isl_union_access_info_free(
9395 __isl_take isl_union_access_info *access);
9397 The may sources set by C<isl_union_access_info_set_may_source>
9398 do not need to include the must sources set by
9399 C<isl_union_access_info_set_must_source> as a subset.
9400 The kills set by C<isl_union_access_info_set_kill> may overlap
9401 with the may-sources and/or must-sources.
9402 The user is free not to call one (or more) of these functions,
9403 in which case the corresponding set is kept to its empty default.
9404 Similarly, the default schedule initialized by
9405 C<isl_union_access_info_from_sink> is empty.
9406 The current schedule is determined by the last call to either
9407 C<isl_union_access_info_set_schedule> or
9408 C<isl_union_access_info_set_schedule_map>.
9409 The domain of the schedule corresponds to the domains of
9410 the access relations. In particular, the domains of the access
9411 relations are effectively intersected with the domain of the schedule
9412 and only the resulting accesses are considered by the dependence analysis.
9414 An C<isl_union_access_info> object can be read from input
9415 using the following function.
9417 #include <isl/flow.h>
9418 __isl_give isl_union_access_info *
9419 isl_union_access_info_read_from_file(isl_ctx *ctx,
9422 A representation of the information contained in an object
9423 of type C<isl_union_access_info> can be obtained using
9425 #include <isl/flow.h>
9426 __isl_give isl_printer *
9427 isl_printer_print_union_access_info(
9428 __isl_take isl_printer *p,
9429 __isl_keep isl_union_access_info *access);
9430 __isl_give char *isl_union_access_info_to_str(
9431 __isl_keep isl_union_access_info *access);
9433 C<isl_union_access_info_to_str> prints the information in flow format.
9435 The output of C<isl_union_access_info_compute_flow> can be examined,
9436 copied, and freed using the following functions.
9438 #include <isl/flow.h>
9439 __isl_give isl_union_map *isl_union_flow_get_must_dependence(
9440 __isl_keep isl_union_flow *flow);
9441 __isl_give isl_union_map *isl_union_flow_get_may_dependence(
9442 __isl_keep isl_union_flow *flow);
9443 __isl_give isl_union_map *
9444 isl_union_flow_get_full_must_dependence(
9445 __isl_keep isl_union_flow *flow);
9446 __isl_give isl_union_map *
9447 isl_union_flow_get_full_may_dependence(
9448 __isl_keep isl_union_flow *flow);
9449 __isl_give isl_union_map *isl_union_flow_get_must_no_source(
9450 __isl_keep isl_union_flow *flow);
9451 __isl_give isl_union_map *isl_union_flow_get_may_no_source(
9452 __isl_keep isl_union_flow *flow);
9453 __isl_give isl_union_flow *isl_union_flow_copy(
9454 __isl_keep isl_union_flow *flow);
9455 __isl_null isl_union_flow *isl_union_flow_free(
9456 __isl_take isl_union_flow *flow);
9458 The relation returned by C<isl_union_flow_get_must_dependence>
9459 relates domain elements of must sources to domain elements of the sink.
9460 The relation returned by C<isl_union_flow_get_may_dependence>
9461 relates domain elements of must or may sources to domain elements of the sink
9462 and includes the previous relation as a subset.
9463 The relation returned by C<isl_union_flow_get_full_must_dependence>
9464 relates domain elements of must sources to pairs of domain elements of the sink
9465 and accessed data elements.
9466 The relation returned by C<isl_union_flow_get_full_may_dependence>
9467 relates domain elements of must or may sources to pairs of
9468 domain elements of the sink and accessed data elements.
9469 This relation includes the previous relation as a subset.
9470 The relation returned by C<isl_union_flow_get_must_no_source> is the subset
9471 of the sink relation for which no dependences have been found.
9472 The relation returned by C<isl_union_flow_get_may_no_source> is the subset
9473 of the sink relation for which no definite dependences have been found.
9474 That is, it contains those sink access that do not contribute to any
9475 of the elements in the relation returned
9476 by C<isl_union_flow_get_must_dependence>.
9478 A representation of the information contained in an object
9479 of type C<isl_union_flow> can be obtained using
9481 #include <isl/flow.h>
9482 __isl_give isl_printer *isl_printer_print_union_flow(
9483 __isl_take isl_printer *p,
9484 __isl_keep isl_union_flow *flow);
9485 __isl_give char *isl_union_flow_to_str(
9486 __isl_keep isl_union_flow *flow);
9488 C<isl_union_flow_to_str> prints the information in flow format.
9490 =head3 Low-level Interface
9492 A lower-level interface is provided by the following functions.
9494 #include <isl/flow.h>
9496 typedef int (*isl_access_level_before)(void *first, void *second);
9498 __isl_give isl_access_info *isl_access_info_alloc(
9499 __isl_take isl_map *sink,
9500 void *sink_user, isl_access_level_before fn,
9502 __isl_give isl_access_info *isl_access_info_add_source(
9503 __isl_take isl_access_info *acc,
9504 __isl_take isl_map *source, int must,
9506 __isl_null isl_access_info *isl_access_info_free(
9507 __isl_take isl_access_info *acc);
9509 __isl_give isl_flow *isl_access_info_compute_flow(
9510 __isl_take isl_access_info *acc);
9512 isl_stat isl_flow_foreach(__isl_keep isl_flow *deps,
9513 isl_stat (*fn)(__isl_take isl_map *dep, int must,
9514 void *dep_user, void *user),
9516 __isl_give isl_map *isl_flow_get_no_source(
9517 __isl_keep isl_flow *deps, int must);
9518 __isl_null isl_flow *isl_flow_free(
9519 __isl_take isl_flow *deps);
9521 The function C<isl_access_info_compute_flow> performs the actual
9522 dependence analysis. The other functions are used to construct
9523 the input for this function or to read off the output.
9525 The input is collected in an C<isl_access_info>, which can
9526 be created through a call to C<isl_access_info_alloc>.
9527 The arguments to this functions are the sink access relation
9528 C<sink>, a token C<sink_user> used to identify the sink
9529 access to the user, a callback function for specifying the
9530 relative order of source and sink accesses, and the number
9531 of source access relations that will be added.
9533 The callback function has type C<int (*)(void *first, void *second)>.
9534 The function is called with two user supplied tokens identifying
9535 either a source or the sink and it should return the shared nesting
9536 level and the relative order of the two accesses.
9537 In particular, let I<n> be the number of loops shared by
9538 the two accesses. If C<first> precedes C<second> textually,
9539 then the function should return I<2 * n + 1>; otherwise,
9540 it should return I<2 * n>.
9541 The low-level interface assumes that no sources are coscheduled.
9542 If the information returned by the callback does not allow
9543 the relative order to be determined, then one of the sources
9544 is arbitrarily taken to be executed after the other(s).
9546 The sources can be added to the C<isl_access_info> object by performing
9547 (at most) C<max_source> calls to C<isl_access_info_add_source>.
9548 C<must> indicates whether the source is a I<must> access
9549 or a I<may> access. Note that a multi-valued access relation
9550 should only be marked I<must> if every iteration in the domain
9551 of the relation accesses I<all> elements in its image.
9552 The C<source_user> token is again used to identify
9553 the source access. The range of the source access relation
9554 C<source> should have the same dimension as the range
9555 of the sink access relation.
9556 The C<isl_access_info_free> function should usually not be
9557 called explicitly, because it is already called implicitly by
9558 C<isl_access_info_compute_flow>.
9560 The result of the dependence analysis is collected in an
9561 C<isl_flow>. There may be elements of
9562 the sink access for which no preceding source access could be
9563 found or for which all preceding sources are I<may> accesses.
9564 The relations containing these elements can be obtained through
9565 calls to C<isl_flow_get_no_source>, the first with C<must> set
9566 and the second with C<must> unset.
9567 In the case of standard flow dependence analysis,
9568 with the sink a read and the sources I<must> writes,
9569 the first relation corresponds to the reads from uninitialized
9570 array elements and the second relation is empty.
9571 The actual flow dependences can be extracted using
9572 C<isl_flow_foreach>. This function will call the user-specified
9573 callback function C<fn> for each B<non-empty> dependence between
9574 a source and the sink. The callback function is called
9575 with four arguments, the actual flow dependence relation
9576 mapping source iterations to sink iterations, a boolean that
9577 indicates whether it is a I<must> or I<may> dependence, a token
9578 identifying the source and an additional C<void *> with value
9579 equal to the third argument of the C<isl_flow_foreach> call.
9580 A dependence is marked I<must> if it originates from a I<must>
9581 source and if it is not followed by any I<may> sources.
9583 After finishing with an C<isl_flow>, the user should call
9584 C<isl_flow_free> to free all associated memory.
9586 =head3 Interaction with the Low-level Interface
9588 During the dependence analysis, we frequently need to perform
9589 the following operation. Given a relation between sink iterations
9590 and potential source iterations from a particular source domain,
9591 what is the last potential source iteration corresponding to each
9592 sink iteration. It can sometimes be convenient to adjust
9593 the set of potential source iterations before or after each such operation.
9594 The prototypical example is fuzzy array dataflow analysis,
9595 where we need to analyze if, based on data-dependent constraints,
9596 the sink iteration can ever be executed without one or more of
9597 the corresponding potential source iterations being executed.
9598 If so, we can introduce extra parameters and select an unknown
9599 but fixed source iteration from the potential source iterations.
9600 To be able to perform such manipulations, C<isl> provides the following
9603 #include <isl/flow.h>
9605 typedef __isl_give isl_restriction *(*isl_access_restrict)(
9606 __isl_keep isl_map *source_map,
9607 __isl_keep isl_set *sink, void *source_user,
9609 __isl_give isl_access_info *isl_access_info_set_restrict(
9610 __isl_take isl_access_info *acc,
9611 isl_access_restrict fn, void *user);
9613 The function C<isl_access_info_set_restrict> should be called
9614 before calling C<isl_access_info_compute_flow> and registers a callback function
9615 that will be called any time C<isl> is about to compute the last
9616 potential source. The first argument is the (reverse) proto-dependence,
9617 mapping sink iterations to potential source iterations.
9618 The second argument represents the sink iterations for which
9619 we want to compute the last source iteration.
9620 The third argument is the token corresponding to the source
9621 and the final argument is the token passed to C<isl_access_info_set_restrict>.
9622 The callback is expected to return a restriction on either the input or
9623 the output of the operation computing the last potential source.
9624 If the input needs to be restricted then restrictions are needed
9625 for both the source and the sink iterations. The sink iterations
9626 and the potential source iterations will be intersected with these sets.
9627 If the output needs to be restricted then only a restriction on the source
9628 iterations is required.
9629 If any error occurs, the callback should return C<NULL>.
9630 An C<isl_restriction> object can be created, freed and inspected
9631 using the following functions.
9633 #include <isl/flow.h>
9635 __isl_give isl_restriction *isl_restriction_input(
9636 __isl_take isl_set *source_restr,
9637 __isl_take isl_set *sink_restr);
9638 __isl_give isl_restriction *isl_restriction_output(
9639 __isl_take isl_set *source_restr);
9640 __isl_give isl_restriction *isl_restriction_none(
9641 __isl_take isl_map *source_map);
9642 __isl_give isl_restriction *isl_restriction_empty(
9643 __isl_take isl_map *source_map);
9644 __isl_null isl_restriction *isl_restriction_free(
9645 __isl_take isl_restriction *restr);
9647 C<isl_restriction_none> and C<isl_restriction_empty> are special
9648 cases of C<isl_restriction_input>. C<isl_restriction_none>
9649 is essentially equivalent to
9651 isl_restriction_input(isl_set_universe(
9652 isl_space_range(isl_map_get_space(source_map))),
9654 isl_space_domain(isl_map_get_space(source_map))));
9656 whereas C<isl_restriction_empty> is essentially equivalent to
9658 isl_restriction_input(isl_set_empty(
9659 isl_space_range(isl_map_get_space(source_map))),
9661 isl_space_domain(isl_map_get_space(source_map))));
9665 #include <isl/schedule.h>
9666 __isl_give isl_schedule *
9667 isl_schedule_constraints_compute_schedule(
9668 __isl_take isl_schedule_constraints *sc);
9670 The function C<isl_schedule_constraints_compute_schedule> can be
9671 used to compute a schedule that satisfies the given schedule constraints.
9672 These schedule constraints include the iteration domain for which
9673 a schedule should be computed and dependences between pairs of
9674 iterations. In particular, these dependences include
9675 I<validity> dependences and I<proximity> dependences.
9676 By default, the algorithm used to construct the schedule is similar
9677 to that of C<Pluto>.
9678 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
9680 The generated schedule respects all validity dependences.
9681 That is, all dependence distances over these dependences in the
9682 scheduled space are lexicographically positive.
9684 The default algorithm tries to ensure that the dependence distances
9685 over coincidence constraints are zero and to minimize the
9686 dependence distances over proximity dependences.
9687 Moreover, it tries to obtain sequences (bands) of schedule dimensions
9688 for groups of domains where the dependence distances over validity
9689 dependences have only non-negative values.
9690 Note that when minimizing the maximal dependence distance
9691 over proximity dependences, a single affine expression in the parameters
9692 is constructed that bounds all dependence distances. If no such expression
9693 exists, then the algorithm will fail and resort to an alternative
9694 scheduling algorithm. In particular, this means that adding proximity
9695 dependences may eliminate valid solutions. A typical example where this
9696 phenomenon may occur is when some subset of the proximity dependences
9697 has no restriction on some parameter, forcing the coefficient of that
9698 parameter to be zero, while some other subset forces the dependence
9699 distance to depend on that parameter, requiring the same coefficient
9701 When using Feautrier's algorithm, the coincidence and proximity constraints
9702 are only taken into account during the extension to a
9703 full-dimensional schedule.
9705 An C<isl_schedule_constraints> object can be constructed
9706 and manipulated using the following functions.
9708 #include <isl/schedule.h>
9709 __isl_give isl_schedule_constraints *
9710 isl_schedule_constraints_copy(
9711 __isl_keep isl_schedule_constraints *sc);
9712 __isl_give isl_schedule_constraints *
9713 isl_schedule_constraints_on_domain(
9714 __isl_take isl_union_set *domain);
9715 __isl_give isl_schedule_constraints *
9716 isl_schedule_constraints_set_context(
9717 __isl_take isl_schedule_constraints *sc,
9718 __isl_take isl_set *context);
9719 __isl_give isl_schedule_constraints *
9720 isl_schedule_constraints_set_validity(
9721 __isl_take isl_schedule_constraints *sc,
9722 __isl_take isl_union_map *validity);
9723 __isl_give isl_schedule_constraints *
9724 isl_schedule_constraints_set_coincidence(
9725 __isl_take isl_schedule_constraints *sc,
9726 __isl_take isl_union_map *coincidence);
9727 __isl_give isl_schedule_constraints *
9728 isl_schedule_constraints_set_proximity(
9729 __isl_take isl_schedule_constraints *sc,
9730 __isl_take isl_union_map *proximity);
9731 __isl_give isl_schedule_constraints *
9732 isl_schedule_constraints_set_conditional_validity(
9733 __isl_take isl_schedule_constraints *sc,
9734 __isl_take isl_union_map *condition,
9735 __isl_take isl_union_map *validity);
9736 __isl_give isl_schedule_constraints *
9737 isl_schedule_constraints_apply(
9738 __isl_take isl_schedule_constraints *sc,
9739 __isl_take isl_union_map *umap);
9740 __isl_null isl_schedule_constraints *
9741 isl_schedule_constraints_free(
9742 __isl_take isl_schedule_constraints *sc);
9744 The initial C<isl_schedule_constraints> object created by
9745 C<isl_schedule_constraints_on_domain> does not impose any constraints.
9746 That is, it has an empty set of dependences.
9747 The function C<isl_schedule_constraints_set_context> allows the user
9748 to specify additional constraints on the parameters that may
9749 be assumed to hold during the construction of the schedule.
9750 The function C<isl_schedule_constraints_set_validity> replaces the
9751 validity dependences, mapping domain elements I<i> to domain
9752 elements that should be scheduled after I<i>.
9753 The function C<isl_schedule_constraints_set_coincidence> replaces the
9754 coincidence dependences, mapping domain elements I<i> to domain
9755 elements that should be scheduled together with I<I>, if possible.
9756 The function C<isl_schedule_constraints_set_proximity> replaces the
9757 proximity dependences, mapping domain elements I<i> to domain
9758 elements that should be scheduled either before I<I>
9759 or as early as possible after I<i>.
9761 The function C<isl_schedule_constraints_set_conditional_validity>
9762 replaces the conditional validity constraints.
9763 A conditional validity constraint is only imposed when any of the corresponding
9764 conditions is satisfied, i.e., when any of them is non-zero.
9765 That is, the scheduler ensures that within each band if the dependence
9766 distances over the condition constraints are not all zero
9767 then all corresponding conditional validity constraints are respected.
9768 A conditional validity constraint corresponds to a condition
9769 if the two are adjacent, i.e., if the domain of one relation intersect
9770 the range of the other relation.
9771 The typical use case of conditional validity constraints is
9772 to allow order constraints between live ranges to be violated
9773 as long as the live ranges themselves are local to the band.
9774 To allow more fine-grained control over which conditions correspond
9775 to which conditional validity constraints, the domains and ranges
9776 of these relations may include I<tags>. That is, the domains and
9777 ranges of those relation may themselves be wrapped relations
9778 where the iteration domain appears in the domain of those wrapped relations
9779 and the range of the wrapped relations can be arbitrarily chosen
9780 by the user. Conditions and conditional validity constraints are only
9781 considered adjacent to each other if the entire wrapped relation matches.
9782 In particular, a relation with a tag will never be considered adjacent
9783 to a relation without a tag.
9785 The function C<isl_schedule_constraints_apply> takes
9786 schedule constraints that are defined on some set of domain elements
9787 and transforms them to schedule constraints on the elements
9788 to which these domain elements are mapped by the given transformation.
9790 An C<isl_schedule_constraints> object can be inspected
9791 using the following functions.
9793 #include <isl/schedule.h>
9794 __isl_give isl_union_set *
9795 isl_schedule_constraints_get_domain(
9796 __isl_keep isl_schedule_constraints *sc);
9797 __isl_give isl_set *isl_schedule_constraints_get_context(
9798 __isl_keep isl_schedule_constraints *sc);
9799 __isl_give isl_union_map *
9800 isl_schedule_constraints_get_validity(
9801 __isl_keep isl_schedule_constraints *sc);
9802 __isl_give isl_union_map *
9803 isl_schedule_constraints_get_coincidence(
9804 __isl_keep isl_schedule_constraints *sc);
9805 __isl_give isl_union_map *
9806 isl_schedule_constraints_get_proximity(
9807 __isl_keep isl_schedule_constraints *sc);
9808 __isl_give isl_union_map *
9809 isl_schedule_constraints_get_conditional_validity(
9810 __isl_keep isl_schedule_constraints *sc);
9811 __isl_give isl_union_map *
9812 isl_schedule_constraints_get_conditional_validity_condition(
9813 __isl_keep isl_schedule_constraints *sc);
9815 An C<isl_schedule_constraints> object can be read from input
9816 using the following functions.
9818 #include <isl/schedule.h>
9819 __isl_give isl_schedule_constraints *
9820 isl_schedule_constraints_read_from_str(isl_ctx *ctx,
9822 __isl_give isl_schedule_constraints *
9823 isl_schedule_constraints_read_from_file(isl_ctx *ctx,
9826 The contents of an C<isl_schedule_constraints> object can be printed
9827 using the following functions.
9829 #include <isl/schedule.h>
9830 __isl_give isl_printer *
9831 isl_printer_print_schedule_constraints(
9832 __isl_take isl_printer *p,
9833 __isl_keep isl_schedule_constraints *sc);
9834 __isl_give char *isl_schedule_constraints_to_str(
9835 __isl_keep isl_schedule_constraints *sc);
9837 The following function computes a schedule directly from
9838 an iteration domain and validity and proximity dependences
9839 and is implemented in terms of the functions described above.
9840 The use of C<isl_union_set_compute_schedule> is discouraged.
9842 #include <isl/schedule.h>
9843 __isl_give isl_schedule *isl_union_set_compute_schedule(
9844 __isl_take isl_union_set *domain,
9845 __isl_take isl_union_map *validity,
9846 __isl_take isl_union_map *proximity);
9848 The generated schedule represents a schedule tree.
9849 For more information on schedule trees, see
9850 L</"Schedule Trees">.
9854 #include <isl/schedule.h>
9855 isl_stat isl_options_set_schedule_max_coefficient(
9856 isl_ctx *ctx, int val);
9857 int isl_options_get_schedule_max_coefficient(
9859 isl_stat isl_options_set_schedule_max_constant_term(
9860 isl_ctx *ctx, int val);
9861 int isl_options_get_schedule_max_constant_term(
9863 isl_stat isl_options_set_schedule_serialize_sccs(
9864 isl_ctx *ctx, int val);
9865 int isl_options_get_schedule_serialize_sccs(isl_ctx *ctx);
9866 isl_stat isl_options_set_schedule_whole_component(
9867 isl_ctx *ctx, int val);
9868 int isl_options_get_schedule_whole_component(
9870 isl_stat isl_options_set_schedule_maximize_band_depth(
9871 isl_ctx *ctx, int val);
9872 int isl_options_get_schedule_maximize_band_depth(
9874 isl_stat isl_options_set_schedule_maximize_coincidence(
9875 isl_ctx *ctx, int val);
9876 int isl_options_get_schedule_maximize_coincidence(
9878 isl_stat isl_options_set_schedule_outer_coincidence(
9879 isl_ctx *ctx, int val);
9880 int isl_options_get_schedule_outer_coincidence(
9882 isl_stat isl_options_set_schedule_split_scaled(
9883 isl_ctx *ctx, int val);
9884 int isl_options_get_schedule_split_scaled(
9886 isl_stat isl_options_set_schedule_treat_coalescing(
9887 isl_ctx *ctx, int val);
9888 int isl_options_get_schedule_treat_coalescing(
9890 isl_stat isl_options_set_schedule_algorithm(
9891 isl_ctx *ctx, int val);
9892 int isl_options_get_schedule_algorithm(
9894 isl_stat isl_options_set_schedule_carry_self_first(
9895 isl_ctx *ctx, int val);
9896 int isl_options_get_schedule_carry_self_first(
9898 isl_stat isl_options_set_schedule_separate_components(
9899 isl_ctx *ctx, int val);
9900 int isl_options_get_schedule_separate_components(
9905 =item * schedule_max_coefficient
9907 This option enforces that the coefficients for variable and parameter
9908 dimensions in the calculated schedule are not larger than the specified value.
9909 This option can significantly increase the speed of the scheduling calculation
9910 and may also prevent fusing of unrelated dimensions. A value of -1 means that
9911 this option does not introduce bounds on the variable or parameter
9913 This option has no effect on the Feautrier style scheduler.
9915 =item * schedule_max_constant_term
9917 This option enforces that the constant coefficients in the calculated schedule
9918 are not larger than the maximal constant term. This option can significantly
9919 increase the speed of the scheduling calculation and may also prevent fusing of
9920 unrelated dimensions. A value of -1 means that this option does not introduce
9921 bounds on the constant coefficients.
9923 =item * schedule_serialize_sccs
9925 If this option is set, then all strongly connected components
9926 in the dependence graph are serialized as soon as they are detected.
9927 This means in particular that instances of statements will only
9928 appear in the same band node if these statements belong
9929 to the same strongly connected component at the point where
9930 the band node is constructed.
9932 =item * schedule_whole_component
9934 If this option is set, then entire (weakly) connected
9935 components in the dependence graph are scheduled together
9937 Otherwise, each strongly connected component within
9938 such a weakly connected component is first scheduled separately
9939 and then combined with other strongly connected components.
9940 This option has no effect if C<schedule_serialize_sccs> is set.
9942 =item * schedule_maximize_band_depth
9944 If this option is set, then the scheduler tries to maximize
9945 the width of the bands. Wider bands give more possibilities for tiling.
9946 In particular, if the C<schedule_whole_component> option is set,
9947 then bands are split if this might result in wider bands.
9948 Otherwise, the effect of this option is to only allow
9949 strongly connected components to be combined if this does
9950 not reduce the width of the bands.
9951 Note that if the C<schedule_serialize_sccs> options is set, then
9952 the C<schedule_maximize_band_depth> option therefore has no effect.
9954 =item * schedule_maximize_coincidence
9956 This option is only effective if the C<schedule_whole_component>
9957 option is turned off.
9958 If the C<schedule_maximize_coincidence> option is set, then (clusters of)
9959 strongly connected components are only combined with each other
9960 if this does not reduce the number of coincident band members.
9962 =item * schedule_outer_coincidence
9964 If this option is set, then we try to construct schedules
9965 where the outermost scheduling dimension in each band
9966 satisfies the coincidence constraints.
9968 =item * schedule_algorithm
9970 Selects the scheduling algorithm to be used.
9971 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
9972 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
9974 =item * schedule_split_scaled
9976 If this option is set, then we try to construct schedules in which the
9977 constant term is split off from the linear part if the linear parts of
9978 the scheduling rows for all nodes in the graph have a common non-trivial
9980 The constant term is then dropped and the linear
9982 This option is only effective when the Feautrier style scheduler is
9983 being used, either as the main scheduler or as a fallback for the
9984 Pluto-like scheduler.
9986 =item * schedule_treat_coalescing
9988 If this option is set, then the scheduler will try and avoid
9989 producing schedules that perform loop coalescing.
9990 In particular, for the Pluto-like scheduler, this option places
9991 bounds on the schedule coefficients based on the sizes of the instance sets.
9992 For the Feautrier style scheduler, this option detects potentially
9993 coalescing schedules and then tries to adjust the schedule to avoid
9996 =item * schedule_carry_self_first
9998 If this option is set, then the Feautrier style scheduler
9999 (when used as a fallback for the Pluto-like scheduler) will
10000 first try to only carry self-dependences.
10002 =item * schedule_separate_components
10004 If this option is set then the function C<isl_schedule_get_map>
10005 will treat set nodes in the same way as sequence nodes.
10009 =head2 AST Generation
10011 This section describes the C<isl> functionality for generating
10012 ASTs that visit all the elements
10013 in a domain in an order specified by a schedule tree or
10015 In case the schedule given as a C<isl_union_map>, an AST is generated
10016 that visits all the elements in the domain of the C<isl_union_map>
10017 according to the lexicographic order of the corresponding image
10018 element(s). If the range of the C<isl_union_map> consists of
10019 elements in more than one space, then each of these spaces is handled
10020 separately in an arbitrary order.
10021 It should be noted that the schedule tree or the image elements
10022 in a schedule map only specify the I<order>
10023 in which the corresponding domain elements should be visited.
10024 No direct relation between the partial schedule values
10025 or the image elements on the one hand and the loop iterators
10026 in the generated AST on the other hand should be assumed.
10028 Each AST is generated within a build. The initial build
10029 simply specifies the constraints on the parameters (if any)
10030 and can be created, inspected, copied and freed using the following functions.
10032 #include <isl/ast_build.h>
10033 __isl_give isl_ast_build *isl_ast_build_alloc(
10035 __isl_give isl_ast_build *isl_ast_build_from_context(
10036 __isl_take isl_set *set);
10037 __isl_give isl_ast_build *isl_ast_build_copy(
10038 __isl_keep isl_ast_build *build);
10039 __isl_null isl_ast_build *isl_ast_build_free(
10040 __isl_take isl_ast_build *build);
10042 The C<set> argument is usually a parameter set with zero or more parameters.
10043 In fact, when creating an AST using C<isl_ast_build_node_from_schedule>,
10044 this set is required to be a parameter set.
10045 An C<isl_ast_build> created using C<isl_ast_build_alloc> does not
10046 specify any parameter constraints.
10047 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
10048 and L</"Fine-grained Control over AST Generation">.
10049 Finally, the AST itself can be constructed using one of the following
10052 #include <isl/ast_build.h>
10053 __isl_give isl_ast_node *isl_ast_build_node_from_schedule(
10054 __isl_keep isl_ast_build *build,
10055 __isl_take isl_schedule *schedule);
10056 __isl_give isl_ast_node *
10057 isl_ast_build_node_from_schedule_map(
10058 __isl_keep isl_ast_build *build,
10059 __isl_take isl_union_map *schedule);
10061 =head3 Inspecting the AST
10063 The basic properties of an AST node can be obtained as follows.
10065 #include <isl/ast.h>
10066 enum isl_ast_node_type isl_ast_node_get_type(
10067 __isl_keep isl_ast_node *node);
10069 The type of an AST node is one of
10070 C<isl_ast_node_for>,
10071 C<isl_ast_node_if>,
10072 C<isl_ast_node_block>,
10073 C<isl_ast_node_mark> or
10074 C<isl_ast_node_user>.
10075 An C<isl_ast_node_for> represents a for node.
10076 An C<isl_ast_node_if> represents an if node.
10077 An C<isl_ast_node_block> represents a compound node.
10078 An C<isl_ast_node_mark> introduces a mark in the AST.
10079 An C<isl_ast_node_user> represents an expression statement.
10080 An expression statement typically corresponds to a domain element, i.e.,
10081 one of the elements that is visited by the AST.
10083 Each type of node has its own additional properties.
10085 #include <isl/ast.h>
10086 __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
10087 __isl_keep isl_ast_node *node);
10088 __isl_give isl_ast_expr *isl_ast_node_for_get_init(
10089 __isl_keep isl_ast_node *node);
10090 __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
10091 __isl_keep isl_ast_node *node);
10092 __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
10093 __isl_keep isl_ast_node *node);
10094 __isl_give isl_ast_node *isl_ast_node_for_get_body(
10095 __isl_keep isl_ast_node *node);
10096 isl_bool isl_ast_node_for_is_degenerate(
10097 __isl_keep isl_ast_node *node);
10099 An C<isl_ast_for> is considered degenerate if it is known to execute
10102 #include <isl/ast.h>
10103 __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
10104 __isl_keep isl_ast_node *node);
10105 __isl_give isl_ast_node *isl_ast_node_if_get_then_node(
10106 __isl_keep isl_ast_node *node);
10107 __isl_give isl_ast_node *isl_ast_node_if_get_then(
10108 __isl_keep isl_ast_node *node);
10109 isl_bool isl_ast_node_if_has_else_node(
10110 __isl_keep isl_ast_node *node);
10111 isl_bool isl_ast_node_if_has_else(
10112 __isl_keep isl_ast_node *node);
10113 __isl_give isl_ast_node *isl_ast_node_if_get_else_node(
10114 __isl_keep isl_ast_node *node);
10115 __isl_give isl_ast_node *isl_ast_node_if_get_else(
10116 __isl_keep isl_ast_node *node);
10118 C<isl_ast_node_if_get_then>,
10119 C<isl_ast_node_if_has_else> and
10120 C<isl_ast_node_if_get_else>
10121 are alternative names for
10122 C<isl_ast_node_if_get_then_node>,
10123 C<isl_ast_node_if_has_else_node> and
10124 C<isl_ast_node_if_get_else_node>, respectively.
10126 __isl_give isl_ast_node_list *
10127 isl_ast_node_block_get_children(
10128 __isl_keep isl_ast_node *node);
10130 __isl_give isl_id *isl_ast_node_mark_get_id(
10131 __isl_keep isl_ast_node *node);
10132 __isl_give isl_ast_node *isl_ast_node_mark_get_node(
10133 __isl_keep isl_ast_node *node);
10135 C<isl_ast_node_mark_get_id> returns the identifier of the mark.
10136 C<isl_ast_node_mark_get_node> returns the child node that is being marked.
10138 #include <isl/ast.h>
10139 __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
10140 __isl_keep isl_ast_node *node);
10142 All descendants of a specific node in the AST (including the node itself)
10144 in depth-first pre-order using the following function.
10146 #include <isl/ast.h>
10147 isl_stat isl_ast_node_foreach_descendant_top_down(
10148 __isl_keep isl_ast_node *node,
10149 isl_bool (*fn)(__isl_keep isl_ast_node *node,
10150 void *user), void *user);
10152 The callback function should return C<isl_bool_true> if the children
10153 of the given node should be visited and C<isl_bool_false> if they should not.
10154 It should return C<isl_bool_error> in case of failure, in which case
10155 the entire traversal is aborted.
10157 Each of the returned C<isl_ast_expr>s can in turn be inspected using
10158 the following functions.
10160 #include <isl/ast.h>
10161 enum isl_ast_expr_type isl_ast_expr_get_type(
10162 __isl_keep isl_ast_expr *expr);
10164 The type of an AST expression is one of
10165 C<isl_ast_expr_op>,
10166 C<isl_ast_expr_id> or
10167 C<isl_ast_expr_int>.
10168 An C<isl_ast_expr_op> represents the result of an operation.
10169 An C<isl_ast_expr_id> represents an identifier.
10170 An C<isl_ast_expr_int> represents an integer value.
10172 Each type of expression has its own additional properties.
10174 #include <isl/ast.h>
10175 enum isl_ast_expr_op_type isl_ast_expr_op_get_type(
10176 __isl_keep isl_ast_expr *expr);
10177 enum isl_ast_expr_op_type isl_ast_expr_get_op_type(
10178 __isl_keep isl_ast_expr *expr);
10179 isl_size isl_ast_expr_op_get_n_arg(__isl_keep isl_ast_expr *expr);
10180 isl_size isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
10181 __isl_give isl_ast_expr *isl_ast_expr_op_get_arg(
10182 __isl_keep isl_ast_expr *expr, int pos);
10183 __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
10184 __isl_keep isl_ast_expr *expr, int pos);
10185 isl_stat isl_ast_expr_foreach_ast_expr_op_type(
10186 __isl_keep isl_ast_expr *expr,
10187 isl_stat (*fn)(enum isl_ast_expr_op_type type,
10188 void *user), void *user);
10189 isl_stat isl_ast_expr_foreach_ast_op_type(
10190 __isl_keep isl_ast_expr *expr,
10191 isl_stat (*fn)(enum isl_ast_expr_op_type type,
10192 void *user), void *user);
10193 isl_stat isl_ast_node_foreach_ast_expr_op_type(
10194 __isl_keep isl_ast_node *node,
10195 isl_stat (*fn)(enum isl_ast_expr_op_type type,
10196 void *user), void *user);
10197 isl_stat isl_ast_node_foreach_ast_op_type(
10198 __isl_keep isl_ast_node *node,
10199 isl_stat (*fn)(enum isl_ast_expr_op_type type,
10200 void *user), void *user);
10202 C<isl_ast_expr_op_get_type> returns the type of the operation
10203 performed. C<isl_ast_expr_op_get_n_arg> returns the number of
10204 arguments. C<isl_ast_expr_get_op_arg> returns the specified
10206 C<isl_ast_expr_get_op_type> is an alternative name for
10207 C<isl_ast_expr_op_get_type>.
10209 C<isl_ast_expr_get_op_n_arg> is an alternative name for
10210 C<isl_ast_expr_op_get_n_arg> and
10211 C<isl_ast_expr_get_op_arg> is an alternative name for
10212 C<isl_ast_expr_op_get_arg>.
10214 C<isl_ast_expr_foreach_ast_expr_op_type> calls C<fn> for each distinct
10215 C<isl_ast_expr_op_type> that appears in C<expr>.
10216 C<isl_ast_expr_foreach_ast_op_type> is an alternative name for
10217 C<isl_ast_expr_foreach_ast_expr_op_type>.
10218 C<isl_ast_node_foreach_ast_expr_op_type> does the same for each distinct
10219 C<isl_ast_expr_op_type> that appears in C<node>.
10220 C<isl_ast_node_foreach_ast_op_type> is an alternative name for
10221 C<isl_ast_node_foreach_ast_expr_op_type>.
10222 The operation type is one of the following.
10226 =item C<isl_ast_expr_op_and>
10228 Logical I<and> of two arguments.
10229 Both arguments can be evaluated.
10231 =item C<isl_ast_expr_op_and_then>
10233 Logical I<and> of two arguments.
10234 The second argument can only be evaluated if the first evaluates to true.
10236 =item C<isl_ast_expr_op_or>
10238 Logical I<or> of two arguments.
10239 Both arguments can be evaluated.
10241 =item C<isl_ast_expr_op_or_else>
10243 Logical I<or> of two arguments.
10244 The second argument can only be evaluated if the first evaluates to false.
10246 =item C<isl_ast_expr_op_max>
10248 Maximum of two or more arguments.
10250 =item C<isl_ast_expr_op_min>
10252 Minimum of two or more arguments.
10254 =item C<isl_ast_expr_op_minus>
10258 =item C<isl_ast_expr_op_add>
10260 Sum of two arguments.
10262 =item C<isl_ast_expr_op_sub>
10264 Difference of two arguments.
10266 =item C<isl_ast_expr_op_mul>
10268 Product of two arguments.
10270 =item C<isl_ast_expr_op_div>
10272 Exact division. That is, the result is known to be an integer.
10274 =item C<isl_ast_expr_op_fdiv_q>
10276 Result of integer division, rounded towards negative
10278 The divisor is known to be positive.
10280 =item C<isl_ast_expr_op_pdiv_q>
10282 Result of integer division, where dividend is known to be non-negative.
10283 The divisor is known to be positive.
10285 =item C<isl_ast_expr_op_pdiv_r>
10287 Remainder of integer division, where dividend is known to be non-negative.
10288 The divisor is known to be positive.
10290 =item C<isl_ast_expr_op_zdiv_r>
10292 Equal to zero iff the remainder on integer division is zero.
10293 The divisor is known to be positive.
10295 =item C<isl_ast_expr_op_cond>
10297 Conditional operator defined on three arguments.
10298 If the first argument evaluates to true, then the result
10299 is equal to the second argument. Otherwise, the result
10300 is equal to the third argument.
10301 The second and third argument may only be evaluated if
10302 the first argument evaluates to true and false, respectively.
10303 Corresponds to C<a ? b : c> in C.
10305 =item C<isl_ast_expr_op_select>
10307 Conditional operator defined on three arguments.
10308 If the first argument evaluates to true, then the result
10309 is equal to the second argument. Otherwise, the result
10310 is equal to the third argument.
10311 The second and third argument may be evaluated independently
10312 of the value of the first argument.
10313 Corresponds to C<a * b + (1 - a) * c> in C.
10315 =item C<isl_ast_expr_op_eq>
10319 =item C<isl_ast_expr_op_le>
10321 Less than or equal relation.
10323 =item C<isl_ast_expr_op_lt>
10325 Less than relation.
10327 =item C<isl_ast_expr_op_ge>
10329 Greater than or equal relation.
10331 =item C<isl_ast_expr_op_gt>
10333 Greater than relation.
10335 =item C<isl_ast_expr_op_call>
10338 The number of arguments of the C<isl_ast_expr> is one more than
10339 the number of arguments in the function call, the first argument
10340 representing the function being called.
10342 =item C<isl_ast_expr_op_access>
10345 The number of arguments of the C<isl_ast_expr> is one more than
10346 the number of index expressions in the array access, the first argument
10347 representing the array being accessed.
10349 =item C<isl_ast_expr_op_member>
10352 This operation has two arguments, a structure and the name of
10353 the member of the structure being accessed.
10357 #include <isl/ast.h>
10358 __isl_give isl_id *isl_ast_expr_id_get_id(
10359 __isl_keep isl_ast_expr *expr);
10360 __isl_give isl_id *isl_ast_expr_get_id(
10361 __isl_keep isl_ast_expr *expr);
10363 Return the identifier represented by the AST expression.
10364 C<isl_ast_expr_get_id> is an alternative name for
10365 C<isl_ast_expr_id_get_id>.
10367 #include <isl/ast.h>
10368 __isl_give isl_val *isl_ast_expr_int_get_val(
10369 __isl_keep isl_ast_expr *expr);
10370 __isl_give isl_val *isl_ast_expr_get_val(
10371 __isl_keep isl_ast_expr *expr);
10373 Return the integer represented by the AST expression.
10374 C<isl_ast_expr_get_val> is an alternative name for
10375 C<isl_ast_expr_int_get_val>.
10377 =head3 Properties of ASTs
10379 #include <isl/ast.h>
10380 isl_bool isl_ast_expr_is_equal(
10381 __isl_keep isl_ast_expr *expr1,
10382 __isl_keep isl_ast_expr *expr2);
10384 Check if two C<isl_ast_expr>s are equal to each other.
10386 =head3 Manipulating and printing the AST
10388 AST nodes can be copied and freed using the following functions.
10390 #include <isl/ast.h>
10391 __isl_give isl_ast_node *isl_ast_node_copy(
10392 __isl_keep isl_ast_node *node);
10393 __isl_null isl_ast_node *isl_ast_node_free(
10394 __isl_take isl_ast_node *node);
10396 AST expressions can be copied and freed using the following functions.
10398 #include <isl/ast.h>
10399 __isl_give isl_ast_expr *isl_ast_expr_copy(
10400 __isl_keep isl_ast_expr *expr);
10401 __isl_null isl_ast_expr *isl_ast_expr_free(
10402 __isl_take isl_ast_expr *expr);
10404 New AST expressions can be created either directly or within
10405 the context of an C<isl_ast_build>.
10407 #include <isl/ast.h>
10408 __isl_give isl_ast_expr *isl_ast_expr_from_val(
10409 __isl_take isl_val *v);
10410 __isl_give isl_ast_expr *isl_ast_expr_from_id(
10411 __isl_take isl_id *id);
10412 __isl_give isl_ast_expr *isl_ast_expr_neg(
10413 __isl_take isl_ast_expr *expr);
10414 __isl_give isl_ast_expr *isl_ast_expr_address_of(
10415 __isl_take isl_ast_expr *expr);
10416 __isl_give isl_ast_expr *isl_ast_expr_add(
10417 __isl_take isl_ast_expr *expr1,
10418 __isl_take isl_ast_expr *expr2);
10419 __isl_give isl_ast_expr *isl_ast_expr_sub(
10420 __isl_take isl_ast_expr *expr1,
10421 __isl_take isl_ast_expr *expr2);
10422 __isl_give isl_ast_expr *isl_ast_expr_mul(
10423 __isl_take isl_ast_expr *expr1,
10424 __isl_take isl_ast_expr *expr2);
10425 __isl_give isl_ast_expr *isl_ast_expr_div(
10426 __isl_take isl_ast_expr *expr1,
10427 __isl_take isl_ast_expr *expr2);
10428 __isl_give isl_ast_expr *isl_ast_expr_pdiv_q(
10429 __isl_take isl_ast_expr *expr1,
10430 __isl_take isl_ast_expr *expr2);
10431 __isl_give isl_ast_expr *isl_ast_expr_pdiv_r(
10432 __isl_take isl_ast_expr *expr1,
10433 __isl_take isl_ast_expr *expr2);
10434 __isl_give isl_ast_expr *isl_ast_expr_and(
10435 __isl_take isl_ast_expr *expr1,
10436 __isl_take isl_ast_expr *expr2)
10437 __isl_give isl_ast_expr *isl_ast_expr_and_then(
10438 __isl_take isl_ast_expr *expr1,
10439 __isl_take isl_ast_expr *expr2)
10440 __isl_give isl_ast_expr *isl_ast_expr_or(
10441 __isl_take isl_ast_expr *expr1,
10442 __isl_take isl_ast_expr *expr2)
10443 __isl_give isl_ast_expr *isl_ast_expr_or_else(
10444 __isl_take isl_ast_expr *expr1,
10445 __isl_take isl_ast_expr *expr2)
10446 __isl_give isl_ast_expr *isl_ast_expr_eq(
10447 __isl_take isl_ast_expr *expr1,
10448 __isl_take isl_ast_expr *expr2);
10449 __isl_give isl_ast_expr *isl_ast_expr_le(
10450 __isl_take isl_ast_expr *expr1,
10451 __isl_take isl_ast_expr *expr2);
10452 __isl_give isl_ast_expr *isl_ast_expr_lt(
10453 __isl_take isl_ast_expr *expr1,
10454 __isl_take isl_ast_expr *expr2);
10455 __isl_give isl_ast_expr *isl_ast_expr_ge(
10456 __isl_take isl_ast_expr *expr1,
10457 __isl_take isl_ast_expr *expr2);
10458 __isl_give isl_ast_expr *isl_ast_expr_gt(
10459 __isl_take isl_ast_expr *expr1,
10460 __isl_take isl_ast_expr *expr2);
10461 __isl_give isl_ast_expr *isl_ast_expr_access(
10462 __isl_take isl_ast_expr *array,
10463 __isl_take isl_ast_expr_list *indices);
10464 __isl_give isl_ast_expr *isl_ast_expr_call(
10465 __isl_take isl_ast_expr *function,
10466 __isl_take isl_ast_expr_list *arguments);
10468 The function C<isl_ast_expr_address_of> can be applied to an
10469 C<isl_ast_expr> of type C<isl_ast_expr_op_access> only. It is meant
10470 to represent the address of the C<isl_ast_expr_access>.
10471 The second argument of the functions C<isl_ast_expr_pdiv_q> and
10472 C<isl_ast_expr_pdiv_r> should always evaluate to a positive number.
10474 C<isl_ast_expr_and_then> as well as C<isl_ast_expr_or_else> are short-circuit
10475 versions of C<isl_ast_expr_and> and C<isl_ast_expr_or>, respectively.
10477 #include <isl/ast_build.h>
10478 __isl_give isl_ast_expr *isl_ast_build_expr_from_set(
10479 __isl_keep isl_ast_build *build,
10480 __isl_take isl_set *set);
10481 __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
10482 __isl_keep isl_ast_build *build,
10483 __isl_take isl_pw_aff *pa);
10484 __isl_give isl_ast_expr *
10485 isl_ast_build_access_from_pw_multi_aff(
10486 __isl_keep isl_ast_build *build,
10487 __isl_take isl_pw_multi_aff *pma);
10488 __isl_give isl_ast_expr *
10489 isl_ast_build_access_from_multi_pw_aff(
10490 __isl_keep isl_ast_build *build,
10491 __isl_take isl_multi_pw_aff *mpa);
10492 __isl_give isl_ast_expr *
10493 isl_ast_build_call_from_pw_multi_aff(
10494 __isl_keep isl_ast_build *build,
10495 __isl_take isl_pw_multi_aff *pma);
10496 __isl_give isl_ast_expr *
10497 isl_ast_build_call_from_multi_pw_aff(
10498 __isl_keep isl_ast_build *build,
10499 __isl_take isl_multi_pw_aff *mpa);
10502 the domains of C<pa>, C<mpa> and C<pma> should correspond
10503 to the schedule space of C<build>.
10504 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
10505 the function being called.
10506 If the accessed space is a nested relation, then it is taken
10507 to represent an access of the member specified by the range
10508 of this nested relation of the structure specified by the domain
10509 of the nested relation.
10511 The following functions can be used to modify an C<isl_ast_expr>.
10513 #include <isl/ast.h>
10514 __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
10515 __isl_take isl_ast_expr *expr, int pos,
10516 __isl_take isl_ast_expr *arg);
10518 Replace the argument of C<expr> at position C<pos> by C<arg>.
10520 #include <isl/ast.h>
10521 __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
10522 __isl_take isl_ast_expr *expr,
10523 __isl_take isl_id_to_ast_expr *id2expr);
10525 The function C<isl_ast_expr_substitute_ids> replaces the
10526 subexpressions of C<expr> of type C<isl_ast_expr_id>
10527 by the corresponding expression in C<id2expr>, if there is any.
10530 User specified data can be attached to an C<isl_ast_node> and obtained
10531 from the same C<isl_ast_node> using the following functions.
10533 #include <isl/ast.h>
10534 __isl_give isl_ast_node *isl_ast_node_set_annotation(
10535 __isl_take isl_ast_node *node,
10536 __isl_take isl_id *annotation);
10537 __isl_give isl_id *isl_ast_node_get_annotation(
10538 __isl_keep isl_ast_node *node);
10540 Basic printing can be performed using the following functions.
10542 #include <isl/ast.h>
10543 __isl_give isl_printer *isl_printer_print_ast_expr(
10544 __isl_take isl_printer *p,
10545 __isl_keep isl_ast_expr *expr);
10546 __isl_give isl_printer *isl_printer_print_ast_node(
10547 __isl_take isl_printer *p,
10548 __isl_keep isl_ast_node *node);
10549 __isl_give char *isl_ast_expr_to_str(
10550 __isl_keep isl_ast_expr *expr);
10551 __isl_give char *isl_ast_node_to_str(
10552 __isl_keep isl_ast_node *node);
10553 __isl_give char *isl_ast_expr_to_C_str(
10554 __isl_keep isl_ast_expr *expr);
10555 __isl_give char *isl_ast_node_to_C_str(
10556 __isl_keep isl_ast_node *node);
10558 The functions C<isl_ast_expr_to_C_str> and
10559 C<isl_ast_node_to_C_str> are convenience functions
10560 that return a string representation of the input in C format.
10562 More advanced printing can be performed using the following functions.
10564 #include <isl/ast.h>
10565 __isl_give isl_printer *
10566 isl_ast_expr_op_type_set_print_name(
10567 __isl_take isl_printer *p,
10568 enum isl_ast_expr_op_type type,
10569 __isl_keep const char *name);
10570 __isl_give isl_printer *isl_ast_op_type_set_print_name(
10571 __isl_take isl_printer *p,
10572 enum isl_ast_expr_op_type type,
10573 __isl_keep const char *name);
10574 isl_stat isl_options_set_ast_print_macro_once(
10575 isl_ctx *ctx, int val);
10576 int isl_options_get_ast_print_macro_once(isl_ctx *ctx);
10577 __isl_give isl_printer *isl_ast_expr_op_type_print_macro(
10578 enum isl_ast_expr_op_type type,
10579 __isl_take isl_printer *p);
10580 __isl_give isl_printer *isl_ast_op_type_print_macro(
10581 enum isl_ast_expr_op_type type,
10582 __isl_take isl_printer *p);
10583 __isl_give isl_printer *isl_ast_expr_print_macros(
10584 __isl_keep isl_ast_expr *expr,
10585 __isl_take isl_printer *p);
10586 __isl_give isl_printer *isl_ast_node_print_macros(
10587 __isl_keep isl_ast_node *node,
10588 __isl_take isl_printer *p);
10589 __isl_give isl_printer *isl_ast_node_print(
10590 __isl_keep isl_ast_node *node,
10591 __isl_take isl_printer *p,
10592 __isl_take isl_ast_print_options *options);
10593 __isl_give isl_printer *isl_ast_node_for_print(
10594 __isl_keep isl_ast_node *node,
10595 __isl_take isl_printer *p,
10596 __isl_take isl_ast_print_options *options);
10597 __isl_give isl_printer *isl_ast_node_if_print(
10598 __isl_keep isl_ast_node *node,
10599 __isl_take isl_printer *p,
10600 __isl_take isl_ast_print_options *options);
10602 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
10603 C<isl> may print out an AST that makes use of macros such
10604 as C<floord>, C<min> and C<max>.
10605 The names of these macros may be modified by a call
10606 to C<isl_ast_expr_op_type_set_print_name>. The user-specified
10607 names are associated to the printer object.
10608 C<isl_ast_op_type_set_print_name> is an alternative name for
10609 C<isl_ast_expr_op_type_set_print_name>.
10610 C<isl_ast_expr_op_type_print_macro> prints out the macro
10611 corresponding to a specific C<isl_ast_expr_op_type>.
10612 If the print-macro-once option is set, then a given macro definition
10613 is only printed once to any given printer object.
10614 C<isl_ast_op_type_print_macro> is an alternative name for
10615 C<isl_ast_expr_op_type_print_macro>.
10616 C<isl_ast_expr_print_macros> scans the C<isl_ast_expr>
10617 for subexpressions where these macros would be used and prints
10618 out the required macro definitions.
10619 Essentially, C<isl_ast_expr_print_macros> calls
10620 C<isl_ast_expr_foreach_ast_expr_op_type> with
10621 C<isl_ast_expr_op_type_print_macro>
10622 as function argument.
10623 C<isl_ast_node_print_macros> does the same
10624 for expressions in its C<isl_ast_node> argument.
10625 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
10626 C<isl_ast_node_if_print> print an C<isl_ast_node>
10627 in C<ISL_FORMAT_C>, but allow for some extra control
10628 through an C<isl_ast_print_options> object.
10629 This object can be created using the following functions.
10631 #include <isl/ast.h>
10632 __isl_give isl_ast_print_options *
10633 isl_ast_print_options_alloc(isl_ctx *ctx);
10634 __isl_give isl_ast_print_options *
10635 isl_ast_print_options_copy(
10636 __isl_keep isl_ast_print_options *options);
10637 __isl_null isl_ast_print_options *
10638 isl_ast_print_options_free(
10639 __isl_take isl_ast_print_options *options);
10641 __isl_give isl_ast_print_options *
10642 isl_ast_print_options_set_print_user(
10643 __isl_take isl_ast_print_options *options,
10644 __isl_give isl_printer *(*print_user)(
10645 __isl_take isl_printer *p,
10646 __isl_take isl_ast_print_options *options,
10647 __isl_keep isl_ast_node *node, void *user),
10649 __isl_give isl_ast_print_options *
10650 isl_ast_print_options_set_print_for(
10651 __isl_take isl_ast_print_options *options,
10652 __isl_give isl_printer *(*print_for)(
10653 __isl_take isl_printer *p,
10654 __isl_take isl_ast_print_options *options,
10655 __isl_keep isl_ast_node *node, void *user),
10658 The callback set by C<isl_ast_print_options_set_print_user>
10659 is called whenever a node of type C<isl_ast_node_user> needs to
10661 The callback set by C<isl_ast_print_options_set_print_for>
10662 is called whenever a node of type C<isl_ast_node_for> needs to
10664 Note that C<isl_ast_node_for_print> will I<not> call the
10665 callback set by C<isl_ast_print_options_set_print_for> on the node
10666 on which C<isl_ast_node_for_print> is called, but only on nested
10667 nodes of type C<isl_ast_node_for>. It is therefore safe to
10668 call C<isl_ast_node_for_print> from within the callback set by
10669 C<isl_ast_print_options_set_print_for>.
10671 The following option determines the type to be used for iterators
10672 while printing the AST.
10674 isl_stat isl_options_set_ast_iterator_type(
10675 isl_ctx *ctx, const char *val);
10676 const char *isl_options_get_ast_iterator_type(
10679 The AST printer only prints body nodes as blocks if these
10680 blocks cannot be safely omitted.
10681 For example, a C<for> node with one body node will not be
10682 surrounded with braces in C<ISL_FORMAT_C>.
10683 A block will always be printed by setting the following option.
10685 isl_stat isl_options_set_ast_always_print_block(isl_ctx *ctx,
10687 int isl_options_get_ast_always_print_block(isl_ctx *ctx);
10691 #include <isl/ast_build.h>
10692 isl_stat isl_options_set_ast_build_atomic_upper_bound(
10693 isl_ctx *ctx, int val);
10694 int isl_options_get_ast_build_atomic_upper_bound(
10696 isl_stat isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
10698 int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
10699 isl_stat isl_options_set_ast_build_detect_min_max(
10700 isl_ctx *ctx, int val);
10701 int isl_options_get_ast_build_detect_min_max(
10703 isl_stat isl_options_set_ast_build_exploit_nested_bounds(
10704 isl_ctx *ctx, int val);
10705 int isl_options_get_ast_build_exploit_nested_bounds(
10707 isl_stat isl_options_set_ast_build_group_coscheduled(
10708 isl_ctx *ctx, int val);
10709 int isl_options_get_ast_build_group_coscheduled(
10711 isl_stat isl_options_set_ast_build_separation_bounds(
10712 isl_ctx *ctx, int val);
10713 int isl_options_get_ast_build_separation_bounds(
10715 isl_stat isl_options_set_ast_build_scale_strides(
10716 isl_ctx *ctx, int val);
10717 int isl_options_get_ast_build_scale_strides(
10719 isl_stat isl_options_set_ast_build_allow_else(isl_ctx *ctx,
10721 int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
10722 isl_stat isl_options_set_ast_build_allow_or(isl_ctx *ctx,
10724 int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
10728 =item * ast_build_atomic_upper_bound
10730 Generate loop upper bounds that consist of the current loop iterator,
10731 an operator and an expression not involving the iterator.
10732 If this option is not set, then the current loop iterator may appear
10733 several times in the upper bound.
10734 For example, when this option is turned off, AST generation
10737 [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
10741 for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
10744 When the option is turned on, the following AST is generated
10746 for (int c0 = 0; c0 <= min(100, n); c0 += 1)
10749 =item * ast_build_prefer_pdiv
10751 If this option is turned off, then the AST generation will
10752 produce ASTs that may only contain C<isl_ast_expr_op_fdiv_q>
10753 operators, but no C<isl_ast_expr_op_pdiv_q> or
10754 C<isl_ast_expr_op_pdiv_r> operators.
10755 If this option is turned on, then C<isl> will try to convert
10756 some of the C<isl_ast_expr_op_fdiv_q> operators to (expressions containing)
10757 C<isl_ast_expr_op_pdiv_q> or C<isl_ast_expr_op_pdiv_r> operators.
10759 =item * ast_build_detect_min_max
10761 If this option is turned on, then C<isl> will try and detect
10762 min or max-expressions when building AST expressions from
10763 piecewise affine expressions.
10765 =item * ast_build_exploit_nested_bounds
10767 Simplify conditions based on bounds of nested for loops.
10768 In particular, remove conditions that are implied by the fact
10769 that one or more nested loops have at least one iteration,
10770 meaning that the upper bound is at least as large as the lower bound.
10771 For example, when this option is turned off, AST generation
10774 [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
10780 for (int c0 = 0; c0 <= N; c0 += 1)
10781 for (int c1 = 0; c1 <= M; c1 += 1)
10784 When the option is turned on, the following AST is generated
10786 for (int c0 = 0; c0 <= N; c0 += 1)
10787 for (int c1 = 0; c1 <= M; c1 += 1)
10790 =item * ast_build_group_coscheduled
10792 If two domain elements are assigned the same schedule point, then
10793 they may be executed in any order and they may even appear in different
10794 loops. If this options is set, then the AST generator will make
10795 sure that coscheduled domain elements do not appear in separate parts
10796 of the AST. This is useful in case of nested AST generation
10797 if the outer AST generation is given only part of a schedule
10798 and the inner AST generation should handle the domains that are
10799 coscheduled by this initial part of the schedule together.
10800 For example if an AST is generated for a schedule
10802 { A[i] -> [0]; B[i] -> [0] }
10804 then the C<isl_ast_build_set_create_leaf> callback described
10805 below may get called twice, once for each domain.
10806 Setting this option ensures that the callback is only called once
10807 on both domains together.
10809 =item * ast_build_separation_bounds
10811 This option specifies which bounds to use during separation.
10812 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
10813 then all (possibly implicit) bounds on the current dimension will
10814 be used during separation.
10815 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
10816 then only those bounds that are explicitly available will
10817 be used during separation.
10819 =item * ast_build_scale_strides
10821 This option specifies whether the AST generator is allowed
10822 to scale down iterators of strided loops.
10824 =item * ast_build_allow_else
10826 This option specifies whether the AST generator is allowed
10827 to construct if statements with else branches.
10829 =item * ast_build_allow_or
10831 This option specifies whether the AST generator is allowed
10832 to construct if conditions with disjunctions.
10836 =head3 AST Generation Options (Schedule Tree)
10838 In case of AST construction from a schedule tree, the options
10839 that control how an AST is created from the individual schedule
10840 dimensions are stored in the band nodes of the tree
10841 (see L</"Schedule Trees">).
10843 In particular, a schedule dimension can be handled in four
10844 different ways, atomic, separate, unroll or the default.
10845 This loop AST generation type can be set using
10846 C<isl_schedule_node_band_member_set_ast_loop_type>.
10848 the first three can be selected by including a one-dimensional
10849 element with as value the position of the schedule dimension
10850 within the band and as name one of C<atomic>, C<separate>
10851 or C<unroll> in the options
10852 set by C<isl_schedule_node_band_set_ast_build_options>.
10853 Only one of these three may be specified for
10854 any given schedule dimension within a band node.
10855 If none of these is specified, then the default
10856 is used. The meaning of the options is as follows.
10862 When this option is specified, the AST generator will make
10863 sure that a given domains space only appears in a single
10864 loop at the specified level.
10866 For example, for the schedule tree
10868 domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
10870 schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
10871 options: "{ atomic[x] }"
10873 the following AST will be generated
10875 for (int c0 = 0; c0 <= 10; c0 += 1) {
10882 On the other hand, for the schedule tree
10884 domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
10886 schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
10887 options: "{ separate[x] }"
10889 the following AST will be generated
10893 for (int c0 = 1; c0 <= 9; c0 += 1) {
10900 If neither C<atomic> nor C<separate> is specified, then the AST generator
10901 may produce either of these two results or some intermediate form.
10905 When this option is specified, the AST generator will
10906 split the domain of the specified schedule dimension
10907 into pieces with a fixed set of statements for which
10908 instances need to be executed by the iterations in
10909 the schedule domain part. This option tends to avoid
10910 the generation of guards inside the corresponding loops.
10911 See also the C<atomic> option.
10915 When this option is specified, the AST generator will
10916 I<completely> unroll the corresponding schedule dimension.
10917 It is the responsibility of the user to ensure that such
10918 unrolling is possible.
10919 To obtain a partial unrolling, the user should apply an additional
10920 strip-mining to the schedule and fully unroll the inner schedule
10925 The C<isolate> option is a bit more involved. It allows the user
10926 to isolate a range of schedule dimension values from smaller and
10927 greater values. Additionally, the user may specify a different
10928 atomic/separate/unroll choice for the isolated part and the remaining
10929 parts. The typical use case of the C<isolate> option is to isolate
10930 full tiles from partial tiles.
10931 The part that needs to be isolated may depend on outer schedule dimensions.
10932 The option therefore needs to be able to reference those outer schedule
10933 dimensions. In particular, the space of the C<isolate> option is that
10934 of a wrapped map with as domain the flat product of all outer band nodes
10935 and as range the space of the current band node.
10936 The atomic/separate/unroll choice for the isolated part is determined
10937 by an option that lives in an unnamed wrapped space with as domain
10938 a zero-dimensional C<isolate> space and as range the regular
10939 C<atomic>, C<separate> or C<unroll> space.
10940 This option may also be set directly using
10941 C<isl_schedule_node_band_member_set_isolate_ast_loop_type>.
10942 The atomic/separate/unroll choice for the remaining part is determined
10943 by the regular C<atomic>, C<separate> or C<unroll> option.
10944 Since the C<isolate> option references outer schedule dimensions,
10945 its use in a band node causes any tree containing the node
10946 to be considered anchored.
10948 As an example, consider the isolation of full tiles from partial tiles
10949 in a tiling of a triangular domain. The original schedule is as follows.
10951 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10953 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10954 { A[i,j] -> [floor(j/10)] }, \
10955 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10959 for (int c0 = 0; c0 <= 10; c0 += 1)
10960 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10961 for (int c2 = 10 * c0;
10962 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10963 for (int c3 = 10 * c1;
10964 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10967 Isolating the full tiles, we have the following input
10969 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10971 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10972 { A[i,j] -> [floor(j/10)] }, \
10973 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10974 options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
10975 10a+9+10b+9 <= 100 }"
10980 for (int c0 = 0; c0 <= 8; c0 += 1) {
10981 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10982 for (int c2 = 10 * c0;
10983 c2 <= 10 * c0 + 9; c2 += 1)
10984 for (int c3 = 10 * c1;
10985 c3 <= 10 * c1 + 9; c3 += 1)
10987 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10988 for (int c2 = 10 * c0;
10989 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10990 for (int c3 = 10 * c1;
10991 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10994 for (int c0 = 9; c0 <= 10; c0 += 1)
10995 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10996 for (int c2 = 10 * c0;
10997 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10998 for (int c3 = 10 * c1;
10999 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
11003 We may then additionally unroll the innermost loop of the isolated part
11005 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
11007 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
11008 { A[i,j] -> [floor(j/10)] }, \
11009 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
11010 options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
11011 10a+9+10b+9 <= 100; [isolate[] -> unroll[3]] }"
11016 for (int c0 = 0; c0 <= 8; c0 += 1) {
11017 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
11018 for (int c2 = 10 * c0; c2 <= 10 * c0 + 9; c2 += 1) {
11020 A(c2, 10 * c1 + 1);
11021 A(c2, 10 * c1 + 2);
11022 A(c2, 10 * c1 + 3);
11023 A(c2, 10 * c1 + 4);
11024 A(c2, 10 * c1 + 5);
11025 A(c2, 10 * c1 + 6);
11026 A(c2, 10 * c1 + 7);
11027 A(c2, 10 * c1 + 8);
11028 A(c2, 10 * c1 + 9);
11030 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
11031 for (int c2 = 10 * c0;
11032 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
11033 for (int c3 = 10 * c1;
11034 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
11037 for (int c0 = 9; c0 <= 10; c0 += 1)
11038 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
11039 for (int c2 = 10 * c0;
11040 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
11041 for (int c3 = 10 * c1;
11042 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
11047 =head3 AST Generation Options (Schedule Map)
11049 In case of AST construction using
11050 C<isl_ast_build_node_from_schedule_map>, the options
11051 that control how an AST is created from the individual schedule
11052 dimensions are stored in the C<isl_ast_build>.
11053 They can be set using the following function.
11055 #include <isl/ast_build.h>
11056 __isl_give isl_ast_build *
11057 isl_ast_build_set_options(
11058 __isl_take isl_ast_build *build,
11059 __isl_take isl_union_map *options);
11061 The options are encoded in an C<isl_union_map>.
11062 The domain of this union relation refers to the schedule domain,
11063 i.e., the range of the schedule passed
11064 to C<isl_ast_build_node_from_schedule_map>.
11065 In the case of nested AST generation (see L</"Nested AST Generation">),
11066 the domain of C<options> should refer to the extra piece of the schedule.
11067 That is, it should be equal to the range of the wrapped relation in the
11068 range of the schedule.
11069 The range of the options can consist of elements in one or more spaces,
11070 the names of which determine the effect of the option.
11071 The values of the range typically also refer to the schedule dimension
11072 to which the option applies, with value C<0> representing
11073 the outermost schedule dimension. In case of nested AST generation
11074 (see L</"Nested AST Generation">), these values refer to the position
11075 of the schedule dimension within the innermost AST generation.
11076 The constraints on the domain elements of
11077 the option should only refer to this dimension and earlier dimensions.
11078 We consider the following spaces.
11082 =item C<separation_class>
11084 B<This option has been deprecated. Use the isolate option on
11085 schedule trees instead.>
11087 This space is a wrapped relation between two one dimensional spaces.
11088 The input space represents the schedule dimension to which the option
11089 applies and the output space represents the separation class.
11090 While constructing a loop corresponding to the specified schedule
11091 dimension(s), the AST generator will try to generate separate loops
11092 for domain elements that are assigned different classes.
11093 If only some of the elements are assigned a class, then those elements
11094 that are not assigned any class will be treated as belonging to a class
11095 that is separate from the explicitly assigned classes.
11096 The typical use case for this option is to separate full tiles from
11098 The other options, described below, are applied after the separation
11101 As an example, consider the separation into full and partial tiles
11102 of a tiling of a triangular domain.
11103 Take, for example, the domain
11105 { A[i,j] : 0 <= i,j and i + j <= 100 }
11107 and a tiling into tiles of 10 by 10. The input to the AST generator
11108 is then the schedule
11110 { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
11113 Without any options, the following AST is generated
11115 for (int c0 = 0; c0 <= 10; c0 += 1)
11116 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
11117 for (int c2 = 10 * c0;
11118 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
11120 for (int c3 = 10 * c1;
11121 c3 <= min(10 * c1 + 9, -c2 + 100);
11125 Separation into full and partial tiles can be obtained by assigning
11126 a class, say C<0>, to the full tiles. The full tiles are represented by those
11127 values of the first and second schedule dimensions for which there are
11128 values of the third and fourth dimensions to cover an entire tile.
11129 That is, we need to specify the following option
11131 { [a,b,c,d] -> separation_class[[0]->[0]] :
11132 exists b': 0 <= 10a,10b' and
11133 10a+9+10b'+9 <= 100;
11134 [a,b,c,d] -> separation_class[[1]->[0]] :
11135 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
11137 which simplifies to
11139 { [a, b, c, d] -> separation_class[[1] -> [0]] :
11140 a >= 0 and b >= 0 and b <= 8 - a;
11141 [a, b, c, d] -> separation_class[[0] -> [0]] :
11142 a >= 0 and a <= 8 }
11144 With this option, the generated AST is as follows
11147 for (int c0 = 0; c0 <= 8; c0 += 1) {
11148 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
11149 for (int c2 = 10 * c0;
11150 c2 <= 10 * c0 + 9; c2 += 1)
11151 for (int c3 = 10 * c1;
11152 c3 <= 10 * c1 + 9; c3 += 1)
11154 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
11155 for (int c2 = 10 * c0;
11156 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
11158 for (int c3 = 10 * c1;
11159 c3 <= min(-c2 + 100, 10 * c1 + 9);
11163 for (int c0 = 9; c0 <= 10; c0 += 1)
11164 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
11165 for (int c2 = 10 * c0;
11166 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
11168 for (int c3 = 10 * c1;
11169 c3 <= min(10 * c1 + 9, -c2 + 100);
11176 This is a single-dimensional space representing the schedule dimension(s)
11177 to which ``separation'' should be applied. Separation tries to split
11178 a loop into several pieces if this can avoid the generation of guards
11180 See also the C<atomic> option.
11184 This is a single-dimensional space representing the schedule dimension(s)
11185 for which the domains should be considered ``atomic''. That is, the
11186 AST generator will make sure that any given domain space will only appear
11187 in a single loop at the specified level.
11189 Consider the following schedule
11191 { a[i] -> [i] : 0 <= i < 10;
11192 b[i] -> [i+1] : 0 <= i < 10 }
11194 If the following option is specified
11196 { [i] -> separate[x] }
11198 then the following AST will be generated
11202 for (int c0 = 1; c0 <= 9; c0 += 1) {
11209 If, on the other hand, the following option is specified
11211 { [i] -> atomic[x] }
11213 then the following AST will be generated
11215 for (int c0 = 0; c0 <= 10; c0 += 1) {
11222 If neither C<atomic> nor C<separate> is specified, then the AST generator
11223 may produce either of these two results or some intermediate form.
11227 This is a single-dimensional space representing the schedule dimension(s)
11228 that should be I<completely> unrolled.
11229 To obtain a partial unrolling, the user should apply an additional
11230 strip-mining to the schedule and fully unroll the inner loop.
11234 =head3 Fine-grained Control over AST Generation
11236 Besides specifying the constraints on the parameters,
11237 an C<isl_ast_build> object can be used to control
11238 various aspects of the AST generation process.
11239 In case of AST construction using
11240 C<isl_ast_build_node_from_schedule_map>,
11241 the most prominent way of control is through ``options'',
11242 as explained above.
11244 Additional control is available through the following functions.
11246 #include <isl/ast_build.h>
11247 __isl_give isl_ast_build *
11248 isl_ast_build_set_iterators(
11249 __isl_take isl_ast_build *build,
11250 __isl_take isl_id_list *iterators);
11252 The function C<isl_ast_build_set_iterators> allows the user to
11253 specify a list of iterator C<isl_id>s to be used as iterators.
11254 If the input schedule is injective, then
11255 the number of elements in this list should be as large as the dimension
11256 of the schedule space, but no direct correspondence should be assumed
11257 between dimensions and elements.
11258 If the input schedule is not injective, then an additional number
11259 of C<isl_id>s equal to the largest dimension of the input domains
11261 If the number of provided C<isl_id>s is insufficient, then additional
11262 names are automatically generated.
11264 #include <isl/ast_build.h>
11265 __isl_give isl_ast_build *
11266 isl_ast_build_set_create_leaf(
11267 __isl_take isl_ast_build *build,
11268 __isl_give isl_ast_node *(*fn)(
11269 __isl_take isl_ast_build *build,
11270 void *user), void *user);
11273 C<isl_ast_build_set_create_leaf> function allows for the
11274 specification of a callback that should be called whenever the AST
11275 generator arrives at an element of the schedule domain.
11276 The callback should return an AST node that should be inserted
11277 at the corresponding position of the AST. The default action (when
11278 the callback is not set) is to continue generating parts of the AST to scan
11279 all the domain elements associated to the schedule domain element
11280 and to insert user nodes, ``calling'' the domain element, for each of them.
11281 The C<build> argument contains the current state of the C<isl_ast_build>.
11282 To ease nested AST generation (see L</"Nested AST Generation">),
11283 all control information that is
11284 specific to the current AST generation such as the options and
11285 the callbacks has been removed from this C<isl_ast_build>.
11286 The callback would typically return the result of a nested
11287 AST generation or a
11288 user defined node created using the following function.
11290 #include <isl/ast.h>
11291 __isl_give isl_ast_node *isl_ast_node_alloc_user(
11292 __isl_take isl_ast_expr *expr);
11294 #include <isl/ast_build.h>
11295 __isl_give isl_ast_build *
11296 isl_ast_build_set_at_each_domain(
11297 __isl_take isl_ast_build *build,
11298 __isl_give isl_ast_node *(*fn)(
11299 __isl_take isl_ast_node *node,
11300 __isl_keep isl_ast_build *build,
11301 void *user), void *user);
11302 __isl_give isl_ast_build *
11303 isl_ast_build_set_before_each_for(
11304 __isl_take isl_ast_build *build,
11305 __isl_give isl_id *(*fn)(
11306 __isl_keep isl_ast_build *build,
11307 void *user), void *user);
11308 __isl_give isl_ast_build *
11309 isl_ast_build_set_after_each_for(
11310 __isl_take isl_ast_build *build,
11311 __isl_give isl_ast_node *(*fn)(
11312 __isl_take isl_ast_node *node,
11313 __isl_keep isl_ast_build *build,
11314 void *user), void *user);
11315 __isl_give isl_ast_build *
11316 isl_ast_build_set_before_each_mark(
11317 __isl_take isl_ast_build *build,
11318 isl_stat (*fn)(__isl_keep isl_id *mark,
11319 __isl_keep isl_ast_build *build,
11320 void *user), void *user);
11321 __isl_give isl_ast_build *
11322 isl_ast_build_set_after_each_mark(
11323 __isl_take isl_ast_build *build,
11324 __isl_give isl_ast_node *(*fn)(
11325 __isl_take isl_ast_node *node,
11326 __isl_keep isl_ast_build *build,
11327 void *user), void *user);
11329 The callback set by C<isl_ast_build_set_at_each_domain> will
11330 be called for each domain AST node.
11331 The callbacks set by C<isl_ast_build_set_before_each_for>
11332 and C<isl_ast_build_set_after_each_for> will be called
11333 for each for AST node. The first will be called in depth-first
11334 pre-order, while the second will be called in depth-first post-order.
11335 Since C<isl_ast_build_set_before_each_for> is called before the for
11336 node is actually constructed, it is only passed an C<isl_ast_build>.
11337 The returned C<isl_id> will be added as an annotation (using
11338 C<isl_ast_node_set_annotation>) to the constructed for node.
11339 In particular, if the user has also specified an C<after_each_for>
11340 callback, then the annotation can be retrieved from the node passed to
11341 that callback using C<isl_ast_node_get_annotation>.
11342 The callbacks set by C<isl_ast_build_set_before_each_mark>
11343 and C<isl_ast_build_set_after_each_mark> will be called for each
11344 mark AST node that is created, i.e., for each mark schedule node
11345 in the input schedule tree. The first will be called in depth-first
11346 pre-order, while the second will be called in depth-first post-order.
11347 Since the callback set by C<isl_ast_build_set_before_each_mark>
11348 is called before the mark AST node is actually constructed, it is passed
11349 the identifier of the mark node.
11350 All callbacks should C<NULL> (or C<isl_stat_error>) on failure.
11351 The given C<isl_ast_build> can be used to create new
11352 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
11353 or C<isl_ast_build_call_from_pw_multi_aff>.
11355 =head3 Nested AST Generation
11357 C<isl> allows the user to create an AST within the context
11358 of another AST. These nested ASTs are created using the
11359 same C<isl_ast_build_node_from_schedule_map> function that is used to create
11360 the outer AST. The C<build> argument should be an C<isl_ast_build>
11361 passed to a callback set by
11362 C<isl_ast_build_set_create_leaf>.
11363 The space of the range of the C<schedule> argument should refer
11364 to this build. In particular, the space should be a wrapped
11365 relation and the domain of this wrapped relation should be the
11366 same as that of the range of the schedule returned by
11367 C<isl_ast_build_get_schedule> below.
11368 In practice, the new schedule is typically
11369 created by calling C<isl_union_map_range_product> on the old schedule
11370 and some extra piece of the schedule.
11371 The space of the schedule domain is also available from
11372 the C<isl_ast_build>.
11374 #include <isl/ast_build.h>
11375 __isl_give isl_union_map *isl_ast_build_get_schedule(
11376 __isl_keep isl_ast_build *build);
11377 __isl_give isl_space *isl_ast_build_get_schedule_space(
11378 __isl_keep isl_ast_build *build);
11379 __isl_give isl_ast_build *isl_ast_build_restrict(
11380 __isl_take isl_ast_build *build,
11381 __isl_take isl_set *set);
11383 The C<isl_ast_build_get_schedule> function returns a (partial)
11384 schedule for the domains elements for which part of the AST still needs to
11385 be generated in the current build.
11386 In particular, the domain elements are mapped to those iterations of the loops
11387 enclosing the current point of the AST generation inside which
11388 the domain elements are executed.
11389 No direct correspondence between
11390 the input schedule and this schedule should be assumed.
11391 The space obtained from C<isl_ast_build_get_schedule_space> can be used
11392 to create a set for C<isl_ast_build_restrict> to intersect
11393 with the current build. In particular, the set passed to
11394 C<isl_ast_build_restrict> can have additional parameters.
11395 The ids of the set dimensions in the space returned by
11396 C<isl_ast_build_get_schedule_space> correspond to the
11397 iterators of the already generated loops.
11398 The user should not rely on the ids of the output dimensions
11399 of the relations in the union relation returned by
11400 C<isl_ast_build_get_schedule> having any particular value.
11402 =head1 Applications
11404 Although C<isl> is mainly meant to be used as a library,
11405 it also contains some basic applications that use some
11406 of the functionality of C<isl>.
11407 For applications that take one or more polytopes or polyhedra
11408 as input, this input may be specified in either the L<isl format>
11409 or the L<PolyLib format>.
11411 =head2 C<isl_polyhedron_sample>
11413 C<isl_polyhedron_sample> takes a polyhedron as input and prints
11414 an integer element of the polyhedron, if there is any.
11415 The first column in the output is the denominator and is always
11416 equal to 1. If the polyhedron contains no integer points,
11417 then a vector of length zero is printed.
11421 C<isl_pip> takes the same input as the C<example> program
11422 from the C<piplib> distribution, i.e., a set of constraints
11423 on the parameters, a line containing only -1 and finally a set
11424 of constraints on a parametric polyhedron.
11425 The coefficients of the parameters appear in the last columns
11426 (but before the final constant column).
11427 The output is the lexicographic minimum of the parametric polyhedron.
11428 As C<isl> currently does not have its own output format, the output
11429 is just a dump of the internal state.
11431 =head2 C<isl_polyhedron_minimize>
11433 C<isl_polyhedron_minimize> computes the minimum of some linear
11434 or affine objective function over the integer points in a polyhedron.
11435 If an affine objective function
11436 is given, then the constant should appear in the last column.
11438 =head2 C<isl_polytope_scan>
11440 Given a polytope, C<isl_polytope_scan> prints
11441 all integer points in the polytope.
11445 Given an C<isl_union_access_info> object as input,
11446 C<isl_flow> prints out the corresponding dependences,
11447 as computed by C<isl_union_access_info_compute_flow>.
11449 =head2 C<isl_codegen>
11451 Given either a schedule tree or a sequence consisting of
11452 a schedule map, a context set and an options relation,
11453 C<isl_codegen> prints out an AST that scans the domain elements
11454 of the schedule in the order of their image(s) taking into account
11455 the constraints in the context set.
11457 =head2 C<isl_schedule>
11459 Given an C<isl_schedule_constraints> object as input,
11460 C<isl_schedule> prints out a schedule that satisfies the given