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);
562 isl_ctx *isl_multi_id_get_ctx(
563 __isl_keep isl_multi_id *mi);
565 #include <isl/local_space.h>
566 isl_ctx *isl_local_space_get_ctx(
567 __isl_keep isl_local_space *ls);
570 isl_ctx *isl_set_list_get_ctx(
571 __isl_keep isl_set_list *list);
574 isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
575 isl_ctx *isl_multi_aff_get_ctx(
576 __isl_keep isl_multi_aff *maff);
577 isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pa);
578 isl_ctx *isl_pw_multi_aff_get_ctx(
579 __isl_keep isl_pw_multi_aff *pma);
580 isl_ctx *isl_multi_pw_aff_get_ctx(
581 __isl_keep isl_multi_pw_aff *mpa);
582 isl_ctx *isl_union_pw_aff_get_ctx(
583 __isl_keep isl_union_pw_aff *upa);
584 isl_ctx *isl_union_pw_multi_aff_get_ctx(
585 __isl_keep isl_union_pw_multi_aff *upma);
586 isl_ctx *isl_multi_union_pw_aff_get_ctx(
587 __isl_keep isl_multi_union_pw_aff *mupa);
589 #include <isl/id_to_ast_expr.h>
590 isl_ctx *isl_id_to_ast_expr_get_ctx(
591 __isl_keep isl_id_to_ast_expr *id2expr);
593 #include <isl/point.h>
594 isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
597 isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
600 isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
602 #include <isl/vertices.h>
603 isl_ctx *isl_vertices_get_ctx(
604 __isl_keep isl_vertices *vertices);
605 isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
606 isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
608 #include <isl/flow.h>
609 isl_ctx *isl_restriction_get_ctx(
610 __isl_keep isl_restriction *restr);
611 isl_ctx *isl_union_access_info_get_ctx(
612 __isl_keep isl_union_access_info *access);
613 isl_ctx *isl_union_flow_get_ctx(
614 __isl_keep isl_union_flow *flow);
616 #include <isl/schedule.h>
617 isl_ctx *isl_schedule_get_ctx(
618 __isl_keep isl_schedule *sched);
619 isl_ctx *isl_schedule_constraints_get_ctx(
620 __isl_keep isl_schedule_constraints *sc);
622 #include <isl/schedule_node.h>
623 isl_ctx *isl_schedule_node_get_ctx(
624 __isl_keep isl_schedule_node *node);
626 #include <isl/ast_build.h>
627 isl_ctx *isl_ast_build_get_ctx(
628 __isl_keep isl_ast_build *build);
631 isl_ctx *isl_ast_expr_get_ctx(
632 __isl_keep isl_ast_expr *expr);
633 isl_ctx *isl_ast_node_get_ctx(
634 __isl_keep isl_ast_node *node);
636 #include <isl/stride_info.h>
637 isl_ctx *isl_stride_info_get_ctx(
638 __isl_keep isl_stride_info *si);
640 #include <isl/fixed_box.h>
641 isl_ctx *isl_fixed_box_get_ctx(
642 __isl_keep isl_fixed_box *box);
646 C<isl> uses the special return type C<isl_size> for functions
647 that return a non-negative value, typically a number or a position.
648 Besides the regular non-negative return values, a special (negative)
649 value C<isl_size_error> may be returned, indicating that something
652 C<isl> also uses two special return types for functions that either return
653 a boolean or that in principle do not return anything.
654 In particular, the C<isl_bool> type has three possible values:
655 C<isl_bool_true> (a positive integer value), indicating I<true> or I<yes>;
656 C<isl_bool_false> (the integer value zero), indicating I<false> or I<no>; and
657 C<isl_bool_error> (a negative integer value), indicating that something
658 went wrong. The following operations are defined on C<isl_bool>. The function
659 C<isl_bool_not> can be used to negate an C<isl_bool>, where the negation of
660 C<isl_bool_error> is C<isl_bool_error> again. The function C<isl_bool_ok>
661 converts an integer to an C<isl_bool>. Any non-zero values yields
662 C<isl_bool_true> and zero yields C<isl_bool_false>.
665 isl_bool isl_bool_not(isl_bool b);
666 isl_bool isl_bool_ok(int b);
668 The C<isl_stat> type has two possible values:
669 C<isl_stat_ok> (the integer value zero), indicating a successful
671 C<isl_stat_error> (a negative integer value), indicating that something
673 See L</"Error Handling"> for more information on
674 C<isl_size_error>, C<isl_bool_error> and C<isl_stat_error>.
678 An C<isl_val> represents an integer value, a rational value
679 or one of three special values, infinity, negative infinity and NaN.
680 Some predefined values can be created using the following functions.
683 __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
684 __isl_give isl_val *isl_val_one(isl_ctx *ctx);
685 __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
686 __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
687 __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
688 __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
690 Specific integer values can be created using the following functions.
693 __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
695 __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
697 __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
698 size_t n, size_t size, const void *chunks);
700 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
701 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
702 The least significant digit is assumed to be stored first.
704 Value objects can be copied and freed using the following functions.
707 __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
708 __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
710 They can be inspected using the following functions.
713 long isl_val_get_num_si(__isl_keep isl_val *v);
714 long isl_val_get_den_si(__isl_keep isl_val *v);
715 __isl_give isl_val *isl_val_get_den_val(
716 __isl_keep isl_val *v);
717 double isl_val_get_d(__isl_keep isl_val *v);
718 isl_size isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
720 isl_stat isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
721 size_t size, void *chunks);
723 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
724 of C<size> bytes needed to store the absolute value of the
726 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
727 which is assumed to have been preallocated by the caller.
728 The least significant digit is stored first.
729 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
730 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
731 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
733 An C<isl_val> can be modified using the following function.
736 __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
739 The following unary properties are defined on C<isl_val>s.
742 int isl_val_sgn(__isl_keep isl_val *v);
743 isl_bool isl_val_is_zero(__isl_keep isl_val *v);
744 isl_bool isl_val_is_one(__isl_keep isl_val *v);
745 isl_bool isl_val_is_negone(__isl_keep isl_val *v);
746 isl_bool isl_val_is_nonneg(__isl_keep isl_val *v);
747 isl_bool isl_val_is_nonpos(__isl_keep isl_val *v);
748 isl_bool isl_val_is_pos(__isl_keep isl_val *v);
749 isl_bool isl_val_is_neg(__isl_keep isl_val *v);
750 isl_bool isl_val_is_int(__isl_keep isl_val *v);
751 isl_bool isl_val_is_rat(__isl_keep isl_val *v);
752 isl_bool isl_val_is_nan(__isl_keep isl_val *v);
753 isl_bool isl_val_is_infty(__isl_keep isl_val *v);
754 isl_bool isl_val_is_neginfty(__isl_keep isl_val *v);
756 Note that the sign of NaN is undefined.
758 The following binary properties are defined on pairs of C<isl_val>s.
761 isl_bool isl_val_lt(__isl_keep isl_val *v1,
762 __isl_keep isl_val *v2);
763 isl_bool isl_val_le(__isl_keep isl_val *v1,
764 __isl_keep isl_val *v2);
765 isl_bool isl_val_gt(__isl_keep isl_val *v1,
766 __isl_keep isl_val *v2);
767 isl_bool isl_val_ge(__isl_keep isl_val *v1,
768 __isl_keep isl_val *v2);
769 isl_bool isl_val_eq(__isl_keep isl_val *v1,
770 __isl_keep isl_val *v2);
771 isl_bool isl_val_ne(__isl_keep isl_val *v1,
772 __isl_keep isl_val *v2);
773 isl_bool isl_val_abs_eq(__isl_keep isl_val *v1,
774 __isl_keep isl_val *v2);
776 Comparisons to NaN always return false.
777 That is, a NaN is not considered to hold any relative position
778 with respect to any value. In particular, a NaN
779 is neither considered to be equal to nor to be different from
780 any value (including another NaN).
781 The function C<isl_val_abs_eq> checks whether its two arguments
782 are equal in absolute value.
784 For integer C<isl_val>s we additionally have the following binary property.
787 isl_bool isl_val_is_divisible_by(__isl_keep isl_val *v1,
788 __isl_keep isl_val *v2);
790 An C<isl_val> can also be compared to an integer using the following
791 functions. The result of C<isl_val_cmp_si> undefined for NaN.
794 isl_bool isl_val_gt_si(__isl_keep isl_val *v, long i);
795 int isl_val_cmp_si(__isl_keep isl_val *v, long i);
797 The following unary operations are available on C<isl_val>s.
800 __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
801 __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
802 __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
803 __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
804 __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
805 __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
807 The following binary operations are available on C<isl_val>s.
810 __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
811 __isl_take isl_val *v2);
812 __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
813 __isl_take isl_val *v2);
814 __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
815 __isl_take isl_val *v2);
816 __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
818 __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
819 __isl_take isl_val *v2);
820 __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
822 __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
823 __isl_take isl_val *v2);
824 __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
826 __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
827 __isl_take isl_val *v2);
828 __isl_give isl_val *isl_val_div_ui(__isl_take isl_val *v1,
831 On integer values, we additionally have the following operations.
834 __isl_give isl_val *isl_val_pow2(__isl_take isl_val *v);
835 __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
836 __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
837 __isl_take isl_val *v2);
838 __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
839 __isl_take isl_val *v2);
840 __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
841 __isl_take isl_val *v2, __isl_give isl_val **x,
842 __isl_give isl_val **y);
844 C<isl_val_2exp> is an alternative name for C<isl_val_pow2>.
845 The function C<isl_val_gcdext> returns the greatest common divisor g
846 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
847 that C<*x> * C<v1> + C<*y> * C<v2> = g.
849 =head3 GMP specific functions
851 These functions are only available if C<isl> has been compiled with C<GMP>
854 Specific integer and rational values can be created from C<GMP> values using
855 the following functions.
857 #include <isl/val_gmp.h>
858 __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
860 __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
861 const mpz_t n, const mpz_t d);
863 The numerator and denominator of a rational value can be extracted as
864 C<GMP> values using the following functions.
866 #include <isl/val_gmp.h>
867 int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
868 int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
870 =head2 Sets and Relations
872 C<isl> uses six types of objects for representing sets and relations,
873 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
874 C<isl_union_set> and C<isl_union_map>.
875 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
876 can be described as a conjunction of affine constraints, while
877 C<isl_set> and C<isl_map> represent unions of
878 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
879 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
880 to live in the same space. C<isl_union_set>s and C<isl_union_map>s
881 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
882 where spaces are considered different if they have a different number
883 of dimensions and/or different names (see L<"Spaces">).
884 The difference between sets and relations (maps) is that sets have
885 one set of variables, while relations have two sets of variables,
886 input variables and output variables.
888 =head2 Error Handling
890 C<isl> supports different ways to react in case a runtime error is triggered.
891 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
892 with two maps that have incompatible spaces. There are three possible ways
893 to react on error: to warn, to continue or to abort.
895 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
896 the last error in the corresponding C<isl_ctx> and the function in which the
897 error was triggered returns a value indicating that some error has
898 occurred. In case of functions returning a pointer, this value is
899 C<NULL>. In case of functions returning an C<isl_size>, C<isl_bool> or an
900 C<isl_stat>, this value is C<isl_size_error>,
901 C<isl_bool_error> or C<isl_stat_error>.
902 An error does not corrupt internal state,
903 such that isl can continue to be used. C<isl> also provides functions to
904 read the last error, including the specific error message,
905 the isl source file where the error occurred and the line number,
906 and to reset all information about the last error. The
907 last error is only stored for information purposes. Its presence does not
908 change the behavior of C<isl>. Hence, resetting an error is not required to
909 continue to use isl, but only to observe new errors.
912 enum isl_error isl_ctx_last_error(isl_ctx *ctx);
913 const char *isl_ctx_last_error_msg(isl_ctx *ctx);
914 const char *isl_ctx_last_error_file(isl_ctx *ctx);
915 int isl_ctx_last_error_line(isl_ctx *ctx);
916 void isl_ctx_reset_error(isl_ctx *ctx);
918 If no error has occurred since the last call to C<isl_ctx_reset_error>,
919 then the functions C<isl_ctx_last_error_msg> and
920 C<isl_ctx_last_error_file> return C<NULL>.
922 Another option is to continue on error. This is similar to warn on error mode,
923 except that C<isl> does not print any warning. This allows a program to
924 implement its own error reporting.
926 The last option is to directly abort the execution of the program from within
927 the isl library. This makes it obviously impossible to recover from an error,
928 but it allows to directly spot the error location. By aborting on error,
929 debuggers break at the location the error occurred and can provide a stack
930 trace. Other tools that automatically provide stack traces on abort or that do
931 not want to continue execution after an error was triggered may also prefer to
934 The on error behavior of isl can be specified by calling
935 C<isl_options_set_on_error> or by setting the command line option
936 C<--isl-on-error>. Valid arguments for the function call are
937 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
938 choices for the command line option are C<warn>, C<continue> and C<abort>.
939 It is also possible to query the current error mode.
941 #include <isl/options.h>
942 isl_stat isl_options_set_on_error(isl_ctx *ctx, int val);
943 int isl_options_get_on_error(isl_ctx *ctx);
947 Identifiers are used to identify both individual dimensions
948 and tuples of dimensions. They consist of an optional name and an optional
949 user pointer. The name and the user pointer cannot both be C<NULL>, however.
950 Identifiers with the same name but different pointer values
951 are considered to be distinct.
952 Similarly, identifiers with different names but the same pointer value
953 are also considered to be distinct.
954 Equal identifiers are represented using the same object.
955 Pairs of identifiers can therefore be tested for equality using the
957 Identifiers can be constructed, copied, freed, inspected and printed
958 using the following functions.
961 __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
962 __isl_keep const char *name, void *user);
963 __isl_give isl_id *isl_id_set_free_user(
964 __isl_take isl_id *id,
965 void (*free_user)(void *user));
966 __isl_give isl_id *isl_id_copy(isl_id *id);
967 __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
969 void *isl_id_get_user(__isl_keep isl_id *id);
970 __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
972 __isl_give isl_printer *isl_printer_print_id(
973 __isl_take isl_printer *p, __isl_keep isl_id *id);
975 The callback set by C<isl_id_set_free_user> is called on the user
976 pointer when the last reference to the C<isl_id> is freed.
977 Note that C<isl_id_get_name> returns a pointer to some internal
978 data structure, so the result can only be used while the
979 corresponding C<isl_id> is alive.
983 Whenever a new set, relation or similar object is created from scratch,
984 the space in which it lives needs to be specified using an C<isl_space>.
985 Each space involves zero or more parameters and zero, one or two
986 tuples of set or input/output dimensions. The parameters and dimensions
987 are identified by an C<isl_dim_type> and a position.
988 The type C<isl_dim_param> refers to parameters,
989 the type C<isl_dim_set> refers to set dimensions (for spaces
990 with a single tuple of dimensions) and the types C<isl_dim_in>
991 and C<isl_dim_out> refer to input and output dimensions
992 (for spaces with two tuples of dimensions).
993 Local spaces (see L</"Local Spaces">) also contain dimensions
994 of type C<isl_dim_div>.
995 Note that parameters are only identified by their position within
996 a given object. Across different objects, parameters are (usually)
997 identified by their names or identifiers. Only unnamed parameters
998 are identified by their positions across objects. The use of unnamed
999 parameters is discouraged.
1001 #include <isl/space.h>
1002 __isl_give isl_space *isl_space_unit(isl_ctx *ctx);
1003 __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
1004 unsigned nparam, unsigned n_in, unsigned n_out);
1005 __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
1007 __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
1008 unsigned nparam, unsigned dim);
1009 __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
1010 __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
1012 The space used for creating a parameter domain
1013 needs to be created using C<isl_space_unit> or C<isl_space_params_alloc>.
1014 For other sets, the space
1015 needs to be created using C<isl_space_set_alloc>, while
1016 for a relation, the space
1017 needs to be created using C<isl_space_alloc>.
1018 The use of C<isl_space_params_alloc>,
1019 C<isl_space_set_alloc> and C<isl_space_alloc> is discouraged as they allow
1020 for the introduction of unnamed parameters.
1022 To check whether a given space is that of a set or a map
1023 or whether it is a parameter space, use these functions:
1025 #include <isl/space.h>
1026 isl_bool isl_space_is_params(__isl_keep isl_space *space);
1027 isl_bool isl_space_is_set(__isl_keep isl_space *space);
1028 isl_bool isl_space_is_map(__isl_keep isl_space *space);
1030 Spaces can be compared using the following functions:
1032 #include <isl/space.h>
1033 isl_bool isl_space_is_equal(__isl_keep isl_space *space1,
1034 __isl_keep isl_space *space2);
1035 isl_bool isl_space_has_equal_params(
1036 __isl_keep isl_space *space1,
1037 __isl_keep isl_space *space2);
1038 isl_bool isl_space_has_equal_tuples(
1039 __isl_keep isl_space *space1,
1040 __isl_keep isl_space *space2);
1041 isl_bool isl_space_is_domain(__isl_keep isl_space *space1,
1042 __isl_keep isl_space *space2);
1043 isl_bool isl_space_is_range(__isl_keep isl_space *space1,
1044 __isl_keep isl_space *space2);
1045 isl_bool isl_space_tuple_is_equal(
1046 __isl_keep isl_space *space1,
1047 enum isl_dim_type type1,
1048 __isl_keep isl_space *space2,
1049 enum isl_dim_type type2);
1051 C<isl_space_is_domain> checks whether the first argument is equal
1052 to the domain of the second argument. This requires in particular that
1053 the first argument is a set space and that the second argument
1054 is a map space. C<isl_space_tuple_is_equal> checks whether the given
1055 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
1056 spaces are the same. That is, it checks if they have the same
1057 identifier (if any), the same dimension and the same internal structure
1060 C<isl_space_has_equal_params> checks whether two spaces
1061 have the same parameters in the same order.
1062 C<isl_space_has_equal_tuples> check whether two spaces have
1063 the same tuples. In contrast to C<isl_space_is_equal> below,
1064 it does not check the
1065 parameters. This is useful because many C<isl> functions align the
1066 parameters before they perform their operations, such that equivalence
1068 C<isl_space_is_equal> checks whether two spaces are identical,
1069 meaning that they have the same parameters and the same tuples.
1070 That is, it checks whether both C<isl_space_has_equal_params> and
1071 C<isl_space_has_equal_tuples> hold.
1073 It is often useful to create objects that live in the
1074 same space as some other object. This can be accomplished
1075 by creating the new objects
1076 (see L</"Creating New Sets and Relations"> or
1077 L</"Functions">) based on the space
1078 of the original object.
1080 #include <isl/set.h>
1081 __isl_give isl_space *isl_basic_set_get_space(
1082 __isl_keep isl_basic_set *bset);
1083 __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
1085 #include <isl/union_set.h>
1086 __isl_give isl_space *isl_union_set_get_space(
1087 __isl_keep isl_union_set *uset);
1089 #include <isl/map.h>
1090 __isl_give isl_space *isl_basic_map_get_space(
1091 __isl_keep isl_basic_map *bmap);
1092 __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
1094 #include <isl/union_map.h>
1095 __isl_give isl_space *isl_union_map_get_space(
1096 __isl_keep isl_union_map *umap);
1098 #include <isl/constraint.h>
1099 __isl_give isl_space *isl_constraint_get_space(
1100 __isl_keep isl_constraint *constraint);
1102 #include <isl/polynomial.h>
1103 __isl_give isl_space *isl_qpolynomial_get_domain_space(
1104 __isl_keep isl_qpolynomial *qp);
1105 __isl_give isl_space *isl_qpolynomial_get_space(
1106 __isl_keep isl_qpolynomial *qp);
1107 __isl_give isl_space *
1108 isl_qpolynomial_fold_get_domain_space(
1109 __isl_keep isl_qpolynomial_fold *fold);
1110 __isl_give isl_space *isl_qpolynomial_fold_get_space(
1111 __isl_keep isl_qpolynomial_fold *fold);
1112 __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
1113 __isl_keep isl_pw_qpolynomial *pwqp);
1114 __isl_give isl_space *isl_pw_qpolynomial_get_space(
1115 __isl_keep isl_pw_qpolynomial *pwqp);
1116 __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
1117 __isl_keep isl_pw_qpolynomial_fold *pwf);
1118 __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
1119 __isl_keep isl_pw_qpolynomial_fold *pwf);
1120 __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
1121 __isl_keep isl_union_pw_qpolynomial *upwqp);
1122 __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
1123 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
1126 __isl_give isl_space *isl_multi_id_get_space(
1127 __isl_keep isl_multi_id *mi);
1129 #include <isl/val.h>
1130 __isl_give isl_space *isl_multi_val_get_space(
1131 __isl_keep isl_multi_val *mv);
1133 #include <isl/aff.h>
1134 __isl_give isl_space *isl_aff_get_domain_space(
1135 __isl_keep isl_aff *aff);
1136 __isl_give isl_space *isl_aff_get_space(
1137 __isl_keep isl_aff *aff);
1138 __isl_give isl_space *isl_pw_aff_get_domain_space(
1139 __isl_keep isl_pw_aff *pwaff);
1140 __isl_give isl_space *isl_pw_aff_get_space(
1141 __isl_keep isl_pw_aff *pwaff);
1142 __isl_give isl_space *isl_multi_aff_get_domain_space(
1143 __isl_keep isl_multi_aff *maff);
1144 __isl_give isl_space *isl_multi_aff_get_space(
1145 __isl_keep isl_multi_aff *maff);
1146 __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
1147 __isl_keep isl_pw_multi_aff *pma);
1148 __isl_give isl_space *isl_pw_multi_aff_get_space(
1149 __isl_keep isl_pw_multi_aff *pma);
1150 __isl_give isl_space *isl_union_pw_aff_get_space(
1151 __isl_keep isl_union_pw_aff *upa);
1152 __isl_give isl_space *isl_union_pw_multi_aff_get_space(
1153 __isl_keep isl_union_pw_multi_aff *upma);
1154 __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
1155 __isl_keep isl_multi_pw_aff *mpa);
1156 __isl_give isl_space *isl_multi_pw_aff_get_space(
1157 __isl_keep isl_multi_pw_aff *mpa);
1158 __isl_give isl_space *
1159 isl_multi_union_pw_aff_get_domain_space(
1160 __isl_keep isl_multi_union_pw_aff *mupa);
1161 __isl_give isl_space *
1162 isl_multi_union_pw_aff_get_space(
1163 __isl_keep isl_multi_union_pw_aff *mupa);
1165 #include <isl/point.h>
1166 __isl_give isl_space *isl_point_get_space(
1167 __isl_keep isl_point *pnt);
1169 #include <isl/fixed_box.h>
1170 __isl_give isl_space *isl_fixed_box_get_space(
1171 __isl_keep isl_fixed_box *box);
1173 The number of dimensions of a given type of space
1174 may be read off from a space or an object that lives
1175 in a space using the following functions.
1176 In case of C<isl_space_dim>, type may be
1177 C<isl_dim_param>, C<isl_dim_in> (only for relations),
1178 C<isl_dim_out> (only for relations), C<isl_dim_set>
1179 (only for sets) or C<isl_dim_all>.
1181 #include <isl/space.h>
1182 isl_size isl_space_dim(__isl_keep isl_space *space,
1183 enum isl_dim_type type);
1185 #include <isl/local_space.h>
1186 isl_size isl_local_space_dim(__isl_keep isl_local_space *ls,
1187 enum isl_dim_type type);
1189 #include <isl/set.h>
1190 isl_size isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1191 enum isl_dim_type type);
1192 isl_size isl_set_dim(__isl_keep isl_set *set,
1193 enum isl_dim_type type);
1195 #include <isl/union_set.h>
1196 isl_size isl_union_set_dim(__isl_keep isl_union_set *uset,
1197 enum isl_dim_type type);
1199 #include <isl/map.h>
1200 isl_size isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1201 enum isl_dim_type type);
1202 isl_size isl_map_dim(__isl_keep isl_map *map,
1203 enum isl_dim_type type);
1205 #include <isl/union_map.h>
1206 isl_size isl_union_map_dim(__isl_keep isl_union_map *umap,
1207 enum isl_dim_type type);
1209 #include <isl/val.h>
1210 isl_size isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1211 enum isl_dim_type type);
1213 #include <isl/aff.h>
1214 isl_size isl_aff_dim(__isl_keep isl_aff *aff,
1215 enum isl_dim_type type);
1216 isl_size isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1217 enum isl_dim_type type);
1218 isl_size isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1219 enum isl_dim_type type);
1220 isl_size isl_pw_multi_aff_dim(
1221 __isl_keep isl_pw_multi_aff *pma,
1222 enum isl_dim_type type);
1223 isl_size isl_multi_pw_aff_dim(
1224 __isl_keep isl_multi_pw_aff *mpa,
1225 enum isl_dim_type type);
1226 isl_size isl_union_pw_aff_dim(
1227 __isl_keep isl_union_pw_aff *upa,
1228 enum isl_dim_type type);
1229 isl_size isl_union_pw_multi_aff_dim(
1230 __isl_keep isl_union_pw_multi_aff *upma,
1231 enum isl_dim_type type);
1232 isl_size isl_multi_union_pw_aff_dim(
1233 __isl_keep isl_multi_union_pw_aff *mupa,
1234 enum isl_dim_type type);
1236 #include <isl/polynomial.h>
1237 isl_size isl_union_pw_qpolynomial_dim(
1238 __isl_keep isl_union_pw_qpolynomial *upwqp,
1239 enum isl_dim_type type);
1240 isl_size isl_union_pw_qpolynomial_fold_dim(
1241 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1242 enum isl_dim_type type);
1244 Note that an C<isl_union_set>, an C<isl_union_map>,
1245 an C<isl_union_pw_multi_aff>,
1246 an C<isl_union_pw_qpolynomial> and
1247 an C<isl_union_pw_qpolynomial_fold>
1248 only have parameters.
1250 Additional parameters can be added to a space using the following function.
1252 #include <isl/space.h>
1253 __isl_give isl_space *isl_space_add_param_id(
1254 __isl_take isl_space *space,
1255 __isl_take isl_id *id);
1257 If a parameter with the given identifier already appears in the space,
1258 then it is not added again.
1260 Conversely, all parameters can be removed from a space
1261 using the following function.
1263 #include <isl/space.h>
1264 __isl_give isl_space *isl_space_drop_all_params(
1265 __isl_take isl_space *space);
1267 The identifiers or names of the individual dimensions of spaces
1268 may be set or read off using the following functions on spaces
1269 or objects that live in spaces.
1270 These functions are mostly useful to obtain the identifiers, positions
1271 or names of the parameters. Identifiers of individual dimensions are
1272 essentially only useful for printing. They are ignored by all other
1273 operations and may not be preserved across those operations.
1274 To keep track of a space along with names/identifiers of
1275 the set dimensions, use an C<isl_multi_id> as described in
1278 #include <isl/space.h>
1279 __isl_give isl_space *isl_space_set_dim_id(
1280 __isl_take isl_space *space,
1281 enum isl_dim_type type, unsigned pos,
1282 __isl_take isl_id *id);
1283 isl_bool isl_space_has_dim_id(__isl_keep isl_space *space,
1284 enum isl_dim_type type, unsigned pos);
1285 __isl_give isl_id *isl_space_get_dim_id(
1286 __isl_keep isl_space *space,
1287 enum isl_dim_type type, unsigned pos);
1288 __isl_give isl_space *isl_space_set_dim_name(
1289 __isl_take isl_space *space,
1290 enum isl_dim_type type, unsigned pos,
1291 __isl_keep const char *name);
1292 isl_bool isl_space_has_dim_name(__isl_keep isl_space *space,
1293 enum isl_dim_type type, unsigned pos);
1294 __isl_keep const char *isl_space_get_dim_name(
1295 __isl_keep isl_space *space,
1296 enum isl_dim_type type, unsigned pos);
1298 #include <isl/local_space.h>
1299 __isl_give isl_local_space *isl_local_space_set_dim_id(
1300 __isl_take isl_local_space *ls,
1301 enum isl_dim_type type, unsigned pos,
1302 __isl_take isl_id *id);
1303 isl_bool isl_local_space_has_dim_id(
1304 __isl_keep isl_local_space *ls,
1305 enum isl_dim_type type, unsigned pos);
1306 __isl_give isl_id *isl_local_space_get_dim_id(
1307 __isl_keep isl_local_space *ls,
1308 enum isl_dim_type type, unsigned pos);
1309 __isl_give isl_local_space *isl_local_space_set_dim_name(
1310 __isl_take isl_local_space *ls,
1311 enum isl_dim_type type, unsigned pos, const char *s);
1312 isl_bool isl_local_space_has_dim_name(
1313 __isl_keep isl_local_space *ls,
1314 enum isl_dim_type type, unsigned pos)
1315 const char *isl_local_space_get_dim_name(
1316 __isl_keep isl_local_space *ls,
1317 enum isl_dim_type type, unsigned pos);
1319 #include <isl/constraint.h>
1320 const char *isl_constraint_get_dim_name(
1321 __isl_keep isl_constraint *constraint,
1322 enum isl_dim_type type, unsigned pos);
1324 #include <isl/set.h>
1325 __isl_give isl_id *isl_basic_set_get_dim_id(
1326 __isl_keep isl_basic_set *bset,
1327 enum isl_dim_type type, unsigned pos);
1328 __isl_give isl_set *isl_set_set_dim_id(
1329 __isl_take isl_set *set, enum isl_dim_type type,
1330 unsigned pos, __isl_take isl_id *id);
1331 isl_bool isl_set_has_dim_id(__isl_keep isl_set *set,
1332 enum isl_dim_type type, unsigned pos);
1333 __isl_give isl_id *isl_set_get_dim_id(
1334 __isl_keep isl_set *set, enum isl_dim_type type,
1336 const char *isl_basic_set_get_dim_name(
1337 __isl_keep isl_basic_set *bset,
1338 enum isl_dim_type type, unsigned pos);
1339 isl_bool isl_set_has_dim_name(__isl_keep isl_set *set,
1340 enum isl_dim_type type, unsigned pos);
1341 const char *isl_set_get_dim_name(
1342 __isl_keep isl_set *set,
1343 enum isl_dim_type type, unsigned pos);
1345 #include <isl/map.h>
1346 __isl_give isl_map *isl_map_set_dim_id(
1347 __isl_take isl_map *map, enum isl_dim_type type,
1348 unsigned pos, __isl_take isl_id *id);
1349 isl_bool isl_basic_map_has_dim_id(
1350 __isl_keep isl_basic_map *bmap,
1351 enum isl_dim_type type, unsigned pos);
1352 isl_bool isl_map_has_dim_id(__isl_keep isl_map *map,
1353 enum isl_dim_type type, unsigned pos);
1354 __isl_give isl_id *isl_map_get_dim_id(
1355 __isl_keep isl_map *map, enum isl_dim_type type,
1357 __isl_give isl_id *isl_union_map_get_dim_id(
1358 __isl_keep isl_union_map *umap,
1359 enum isl_dim_type type, unsigned pos);
1360 const char *isl_basic_map_get_dim_name(
1361 __isl_keep isl_basic_map *bmap,
1362 enum isl_dim_type type, unsigned pos);
1363 isl_bool isl_map_has_dim_name(__isl_keep isl_map *map,
1364 enum isl_dim_type type, unsigned pos);
1365 const char *isl_map_get_dim_name(
1366 __isl_keep isl_map *map,
1367 enum isl_dim_type type, unsigned pos);
1369 #include <isl/val.h>
1370 __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1371 __isl_take isl_multi_val *mv,
1372 enum isl_dim_type type, unsigned pos,
1373 __isl_take isl_id *id);
1374 __isl_give isl_id *isl_multi_val_get_dim_id(
1375 __isl_keep isl_multi_val *mv,
1376 enum isl_dim_type type, unsigned pos);
1377 __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1378 __isl_take isl_multi_val *mv,
1379 enum isl_dim_type type, unsigned pos, const char *s);
1381 #include <isl/aff.h>
1382 __isl_give isl_aff *isl_aff_set_dim_id(
1383 __isl_take isl_aff *aff, enum isl_dim_type type,
1384 unsigned pos, __isl_take isl_id *id);
1385 __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1386 __isl_take isl_multi_aff *maff,
1387 enum isl_dim_type type, unsigned pos,
1388 __isl_take isl_id *id);
1389 __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1390 __isl_take isl_pw_aff *pma,
1391 enum isl_dim_type type, unsigned pos,
1392 __isl_take isl_id *id);
1393 __isl_give isl_multi_pw_aff *
1394 isl_multi_pw_aff_set_dim_id(
1395 __isl_take isl_multi_pw_aff *mpa,
1396 enum isl_dim_type type, unsigned pos,
1397 __isl_take isl_id *id);
1398 __isl_give isl_multi_union_pw_aff *
1399 isl_multi_union_pw_aff_set_dim_id(
1400 __isl_take isl_multi_union_pw_aff *mupa,
1401 enum isl_dim_type type, unsigned pos,
1402 __isl_take isl_id *id);
1403 __isl_give isl_id *isl_multi_aff_get_dim_id(
1404 __isl_keep isl_multi_aff *ma,
1405 enum isl_dim_type type, unsigned pos);
1406 isl_bool isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1407 enum isl_dim_type type, unsigned pos);
1408 __isl_give isl_id *isl_pw_aff_get_dim_id(
1409 __isl_keep isl_pw_aff *pa,
1410 enum isl_dim_type type, unsigned pos);
1411 __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1412 __isl_keep isl_pw_multi_aff *pma,
1413 enum isl_dim_type type, unsigned pos);
1414 __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1415 __isl_keep isl_multi_pw_aff *mpa,
1416 enum isl_dim_type type, unsigned pos);
1417 __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1418 __isl_keep isl_multi_union_pw_aff *mupa,
1419 enum isl_dim_type type, unsigned pos);
1420 __isl_give isl_aff *isl_aff_set_dim_name(
1421 __isl_take isl_aff *aff, enum isl_dim_type type,
1422 unsigned pos, const char *s);
1423 __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1424 __isl_take isl_multi_aff *maff,
1425 enum isl_dim_type type, unsigned pos, const char *s);
1426 __isl_give isl_multi_pw_aff *
1427 isl_multi_pw_aff_set_dim_name(
1428 __isl_take isl_multi_pw_aff *mpa,
1429 enum isl_dim_type type, unsigned pos, const char *s);
1430 __isl_give isl_union_pw_aff *
1431 isl_union_pw_aff_set_dim_name(
1432 __isl_take isl_union_pw_aff *upa,
1433 enum isl_dim_type type, unsigned pos,
1435 __isl_give isl_union_pw_multi_aff *
1436 isl_union_pw_multi_aff_set_dim_name(
1437 __isl_take isl_union_pw_multi_aff *upma,
1438 enum isl_dim_type type, unsigned pos,
1440 __isl_give isl_multi_union_pw_aff *
1441 isl_multi_union_pw_aff_set_dim_name(
1442 __isl_take isl_multi_union_pw_aff *mupa,
1443 enum isl_dim_type type, unsigned pos,
1444 const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1445 enum isl_dim_type type, unsigned pos);
1446 const char *isl_pw_aff_get_dim_name(
1447 __isl_keep isl_pw_aff *pa,
1448 enum isl_dim_type type, unsigned pos);
1449 const char *isl_pw_multi_aff_get_dim_name(
1450 __isl_keep isl_pw_multi_aff *pma,
1451 enum isl_dim_type type, unsigned pos);
1453 #include <isl/polynomial.h>
1454 __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1455 __isl_take isl_qpolynomial *qp,
1456 enum isl_dim_type type, unsigned pos,
1458 __isl_give isl_pw_qpolynomial *
1459 isl_pw_qpolynomial_set_dim_name(
1460 __isl_take isl_pw_qpolynomial *pwqp,
1461 enum isl_dim_type type, unsigned pos,
1463 __isl_give isl_pw_qpolynomial_fold *
1464 isl_pw_qpolynomial_fold_set_dim_name(
1465 __isl_take isl_pw_qpolynomial_fold *pwf,
1466 enum isl_dim_type type, unsigned pos,
1468 __isl_give isl_union_pw_qpolynomial *
1469 isl_union_pw_qpolynomial_set_dim_name(
1470 __isl_take isl_union_pw_qpolynomial *upwqp,
1471 enum isl_dim_type type, unsigned pos,
1473 __isl_give isl_union_pw_qpolynomial_fold *
1474 isl_union_pw_qpolynomial_fold_set_dim_name(
1475 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1476 enum isl_dim_type type, unsigned pos,
1479 Note that C<isl_space_get_name> returns a pointer to some internal
1480 data structure, so the result can only be used while the
1481 corresponding C<isl_space> is alive.
1482 Also note that every function that operates on two sets or relations
1483 requires that both arguments have the same parameters. This also
1484 means that if one of the arguments has named parameters, then the
1485 other needs to have named parameters too and the names need to match.
1486 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1487 arguments may have different parameters (as long as they are named),
1488 in which case the result will have as parameters the union of the parameters of
1491 Given the identifier or name of a dimension (typically a parameter),
1492 its position can be obtained from the following functions.
1494 #include <isl/space.h>
1495 int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1496 enum isl_dim_type type, __isl_keep isl_id *id);
1497 int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1498 enum isl_dim_type type, const char *name);
1500 #include <isl/local_space.h>
1501 int isl_local_space_find_dim_by_name(
1502 __isl_keep isl_local_space *ls,
1503 enum isl_dim_type type, const char *name);
1505 #include <isl/val.h>
1506 int isl_multi_val_find_dim_by_id(
1507 __isl_keep isl_multi_val *mv,
1508 enum isl_dim_type type, __isl_keep isl_id *id);
1509 int isl_multi_val_find_dim_by_name(
1510 __isl_keep isl_multi_val *mv,
1511 enum isl_dim_type type, const char *name);
1513 #include <isl/set.h>
1514 int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1515 enum isl_dim_type type, __isl_keep isl_id *id);
1516 int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1517 enum isl_dim_type type, const char *name);
1519 #include <isl/map.h>
1520 int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1521 enum isl_dim_type type, __isl_keep isl_id *id);
1522 int isl_basic_map_find_dim_by_name(
1523 __isl_keep isl_basic_map *bmap,
1524 enum isl_dim_type type, const char *name);
1525 int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1526 enum isl_dim_type type, const char *name);
1527 int isl_union_map_find_dim_by_name(
1528 __isl_keep isl_union_map *umap,
1529 enum isl_dim_type type, const char *name);
1531 #include <isl/aff.h>
1532 int isl_multi_aff_find_dim_by_id(
1533 __isl_keep isl_multi_aff *ma,
1534 enum isl_dim_type type, __isl_keep isl_id *id);
1535 int isl_multi_pw_aff_find_dim_by_id(
1536 __isl_keep isl_multi_pw_aff *mpa,
1537 enum isl_dim_type type, __isl_keep isl_id *id);
1538 int isl_multi_union_pw_aff_find_dim_by_id(
1539 __isl_keep isl_union_multi_pw_aff *mupa,
1540 enum isl_dim_type type, __isl_keep isl_id *id);
1541 int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1542 enum isl_dim_type type, const char *name);
1543 int isl_multi_aff_find_dim_by_name(
1544 __isl_keep isl_multi_aff *ma,
1545 enum isl_dim_type type, const char *name);
1546 int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1547 enum isl_dim_type type, const char *name);
1548 int isl_multi_pw_aff_find_dim_by_name(
1549 __isl_keep isl_multi_pw_aff *mpa,
1550 enum isl_dim_type type, const char *name);
1551 int isl_pw_multi_aff_find_dim_by_name(
1552 __isl_keep isl_pw_multi_aff *pma,
1553 enum isl_dim_type type, const char *name);
1554 int isl_union_pw_aff_find_dim_by_name(
1555 __isl_keep isl_union_pw_aff *upa,
1556 enum isl_dim_type type, const char *name);
1557 int isl_union_pw_multi_aff_find_dim_by_name(
1558 __isl_keep isl_union_pw_multi_aff *upma,
1559 enum isl_dim_type type, const char *name);
1560 int isl_multi_union_pw_aff_find_dim_by_name(
1561 __isl_keep isl_multi_union_pw_aff *mupa,
1562 enum isl_dim_type type, const char *name);
1564 #include <isl/polynomial.h>
1565 int isl_pw_qpolynomial_find_dim_by_name(
1566 __isl_keep isl_pw_qpolynomial *pwqp,
1567 enum isl_dim_type type, const char *name);
1568 int isl_pw_qpolynomial_fold_find_dim_by_name(
1569 __isl_keep isl_pw_qpolynomial_fold *pwf,
1570 enum isl_dim_type type, const char *name);
1571 int isl_union_pw_qpolynomial_find_dim_by_name(
1572 __isl_keep isl_union_pw_qpolynomial *upwqp,
1573 enum isl_dim_type type, const char *name);
1574 int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1575 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1576 enum isl_dim_type type, const char *name);
1578 The identifiers or names of entire spaces may be set or read off
1579 using the following functions.
1581 #include <isl/space.h>
1582 __isl_give isl_space *isl_space_set_tuple_id(
1583 __isl_take isl_space *space,
1584 enum isl_dim_type type, __isl_take isl_id *id);
1585 __isl_give isl_space *isl_space_reset_tuple_id(
1586 __isl_take isl_space *space, enum isl_dim_type type);
1587 isl_bool isl_space_has_tuple_id(
1588 __isl_keep isl_space *space,
1589 enum isl_dim_type type);
1590 __isl_give isl_id *isl_space_get_tuple_id(
1591 __isl_keep isl_space *space, enum isl_dim_type type);
1592 __isl_give isl_space *isl_space_set_tuple_name(
1593 __isl_take isl_space *space,
1594 enum isl_dim_type type, const char *s);
1595 isl_bool isl_space_has_tuple_name(
1596 __isl_keep isl_space *space,
1597 enum isl_dim_type type);
1598 __isl_keep const char *isl_space_get_tuple_name(
1599 __isl_keep isl_space *space,
1600 enum isl_dim_type type);
1602 #include <isl/local_space.h>
1603 __isl_give isl_local_space *isl_local_space_set_tuple_id(
1604 __isl_take isl_local_space *ls,
1605 enum isl_dim_type type, __isl_take isl_id *id);
1607 #include <isl/set.h>
1608 __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1609 __isl_take isl_basic_set *bset,
1610 __isl_take isl_id *id);
1611 __isl_give isl_set *isl_set_set_tuple_id(
1612 __isl_take isl_set *set, __isl_take isl_id *id);
1613 __isl_give isl_set *isl_set_reset_tuple_id(
1614 __isl_take isl_set *set);
1615 isl_bool isl_set_has_tuple_id(__isl_keep isl_set *set);
1616 __isl_give isl_id *isl_set_get_tuple_id(
1617 __isl_keep isl_set *set);
1618 __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1619 __isl_take isl_basic_set *set, const char *s);
1620 __isl_give isl_set *isl_set_set_tuple_name(
1621 __isl_take isl_set *set, const char *s);
1622 const char *isl_basic_set_get_tuple_name(
1623 __isl_keep isl_basic_set *bset);
1624 isl_bool isl_set_has_tuple_name(__isl_keep isl_set *set);
1625 const char *isl_set_get_tuple_name(
1626 __isl_keep isl_set *set);
1628 #include <isl/map.h>
1629 __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1630 __isl_take isl_basic_map *bmap,
1631 enum isl_dim_type type, __isl_take isl_id *id);
1632 __isl_give isl_map *isl_map_set_tuple_id(
1633 __isl_take isl_map *map, enum isl_dim_type type,
1634 __isl_take isl_id *id);
1635 __isl_give isl_map *isl_map_reset_tuple_id(
1636 __isl_take isl_map *map, enum isl_dim_type type);
1637 isl_bool isl_map_has_tuple_id(__isl_keep isl_map *map,
1638 enum isl_dim_type type);
1639 __isl_give isl_id *isl_map_get_tuple_id(
1640 __isl_keep isl_map *map, enum isl_dim_type type);
1641 __isl_give isl_map *isl_map_set_tuple_name(
1642 __isl_take isl_map *map,
1643 enum isl_dim_type type, const char *s);
1644 const char *isl_basic_map_get_tuple_name(
1645 __isl_keep isl_basic_map *bmap,
1646 enum isl_dim_type type);
1647 __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1648 __isl_take isl_basic_map *bmap,
1649 enum isl_dim_type type, const char *s);
1650 isl_bool isl_map_has_tuple_name(__isl_keep isl_map *map,
1651 enum isl_dim_type type);
1652 const char *isl_map_get_tuple_name(
1653 __isl_keep isl_map *map,
1654 enum isl_dim_type type);
1656 #include <isl/val.h>
1657 __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1658 __isl_take isl_multi_val *mv,
1659 enum isl_dim_type type, __isl_take isl_id *id);
1660 __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1661 __isl_take isl_multi_val *mv,
1662 enum isl_dim_type type);
1663 isl_bool isl_multi_val_has_tuple_id(
1664 __isl_keep isl_multi_val *mv,
1665 enum isl_dim_type type);
1666 __isl_give isl_id *isl_multi_val_get_tuple_id(
1667 __isl_keep isl_multi_val *mv,
1668 enum isl_dim_type type);
1669 __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1670 __isl_take isl_multi_val *mv,
1671 enum isl_dim_type type, const char *s);
1672 const char *isl_multi_val_get_tuple_name(
1673 __isl_keep isl_multi_val *mv,
1674 enum isl_dim_type type);
1676 #include <isl/aff.h>
1677 __isl_give isl_aff *isl_aff_set_tuple_id(
1678 __isl_take isl_aff *aff,
1679 enum isl_dim_type type, __isl_take isl_id *id);
1680 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1681 __isl_take isl_multi_aff *maff,
1682 enum isl_dim_type type, __isl_take isl_id *id);
1683 __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1684 __isl_take isl_pw_aff *pwaff,
1685 enum isl_dim_type type, __isl_take isl_id *id);
1686 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1687 __isl_take isl_pw_multi_aff *pma,
1688 enum isl_dim_type type, __isl_take isl_id *id);
1689 __isl_give isl_multi_union_pw_aff *
1690 isl_multi_union_pw_aff_set_tuple_id(
1691 __isl_take isl_multi_union_pw_aff *mupa,
1692 enum isl_dim_type type, __isl_take isl_id *id);
1693 __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1694 __isl_take isl_multi_aff *ma,
1695 enum isl_dim_type type);
1696 __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1697 __isl_take isl_pw_aff *pa,
1698 enum isl_dim_type type);
1699 __isl_give isl_multi_pw_aff *
1700 isl_multi_pw_aff_reset_tuple_id(
1701 __isl_take isl_multi_pw_aff *mpa,
1702 enum isl_dim_type type);
1703 __isl_give isl_pw_multi_aff *
1704 isl_pw_multi_aff_reset_tuple_id(
1705 __isl_take isl_pw_multi_aff *pma,
1706 enum isl_dim_type type);
1707 __isl_give isl_multi_union_pw_aff *
1708 isl_multi_union_pw_aff_reset_tuple_id(
1709 __isl_take isl_multi_union_pw_aff *mupa,
1710 enum isl_dim_type type);
1711 isl_bool isl_multi_aff_has_tuple_id(
1712 __isl_keep isl_multi_aff *ma,
1713 enum isl_dim_type type);
1714 __isl_give isl_id *isl_multi_aff_get_tuple_id(
1715 __isl_keep isl_multi_aff *ma,
1716 enum isl_dim_type type);
1717 isl_bool isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1718 enum isl_dim_type type);
1719 __isl_give isl_id *isl_pw_aff_get_tuple_id(
1720 __isl_keep isl_pw_aff *pa,
1721 enum isl_dim_type type);
1722 isl_bool isl_pw_multi_aff_has_tuple_id(
1723 __isl_keep isl_pw_multi_aff *pma,
1724 enum isl_dim_type type);
1725 __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1726 __isl_keep isl_pw_multi_aff *pma,
1727 enum isl_dim_type type);
1728 isl_bool isl_multi_pw_aff_has_tuple_id(
1729 __isl_keep isl_multi_pw_aff *mpa,
1730 enum isl_dim_type type);
1731 __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1732 __isl_keep isl_multi_pw_aff *mpa,
1733 enum isl_dim_type type);
1734 isl_bool isl_multi_union_pw_aff_has_tuple_id(
1735 __isl_keep isl_multi_union_pw_aff *mupa,
1736 enum isl_dim_type type);
1737 __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1738 __isl_keep isl_multi_union_pw_aff *mupa,
1739 enum isl_dim_type type);
1740 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1741 __isl_take isl_multi_aff *maff,
1742 enum isl_dim_type type, const char *s);
1743 __isl_give isl_multi_pw_aff *
1744 isl_multi_pw_aff_set_tuple_name(
1745 __isl_take isl_multi_pw_aff *mpa,
1746 enum isl_dim_type type, const char *s);
1747 __isl_give isl_multi_union_pw_aff *
1748 isl_multi_union_pw_aff_set_tuple_name(
1749 __isl_take isl_multi_union_pw_aff *mupa,
1750 enum isl_dim_type type, const char *s);
1751 const char *isl_multi_aff_get_tuple_name(
1752 __isl_keep isl_multi_aff *multi,
1753 enum isl_dim_type type);
1754 isl_bool isl_pw_multi_aff_has_tuple_name(
1755 __isl_keep isl_pw_multi_aff *pma,
1756 enum isl_dim_type type);
1757 const char *isl_pw_multi_aff_get_tuple_name(
1758 __isl_keep isl_pw_multi_aff *pma,
1759 enum isl_dim_type type);
1760 const char *isl_multi_union_pw_aff_get_tuple_name(
1761 __isl_keep isl_multi_union_pw_aff *mupa,
1762 enum isl_dim_type type);
1764 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1765 or C<isl_dim_set>. As with C<isl_space_get_name>,
1766 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1768 Binary operations require the corresponding spaces of their arguments
1769 to have the same name.
1771 To keep the names of all parameters and tuples, but reset the user pointers
1772 of all the corresponding identifiers, use the following function.
1774 #include <isl/space.h>
1775 __isl_give isl_space *isl_space_reset_user(
1776 __isl_take isl_space *space);
1778 #include <isl/set.h>
1779 __isl_give isl_set *isl_set_reset_user(
1780 __isl_take isl_set *set);
1782 #include <isl/map.h>
1783 __isl_give isl_map *isl_map_reset_user(
1784 __isl_take isl_map *map);
1786 #include <isl/union_set.h>
1787 __isl_give isl_union_set *isl_union_set_reset_user(
1788 __isl_take isl_union_set *uset);
1790 #include <isl/union_map.h>
1791 __isl_give isl_union_map *isl_union_map_reset_user(
1792 __isl_take isl_union_map *umap);
1795 __isl_give isl_multi_id *isl_multi_id_reset_user(
1796 __isl_take isl_multi_id *mi);
1798 #include <isl/val.h>
1799 __isl_give isl_multi_val *isl_multi_val_reset_user(
1800 __isl_take isl_multi_val *mv);
1802 #include <isl/aff.h>
1803 __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1804 __isl_take isl_multi_aff *ma);
1805 __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1806 __isl_take isl_pw_aff *pa);
1807 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1808 __isl_take isl_multi_pw_aff *mpa);
1809 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1810 __isl_take isl_pw_multi_aff *pma);
1811 __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1812 __isl_take isl_union_pw_aff *upa);
1813 __isl_give isl_multi_union_pw_aff *
1814 isl_multi_union_pw_aff_reset_user(
1815 __isl_take isl_multi_union_pw_aff *mupa);
1816 __isl_give isl_union_pw_multi_aff *
1817 isl_union_pw_multi_aff_reset_user(
1818 __isl_take isl_union_pw_multi_aff *upma);
1820 #include <isl/polynomial.h>
1821 __isl_give isl_pw_qpolynomial *
1822 isl_pw_qpolynomial_reset_user(
1823 __isl_take isl_pw_qpolynomial *pwqp);
1824 __isl_give isl_union_pw_qpolynomial *
1825 isl_union_pw_qpolynomial_reset_user(
1826 __isl_take isl_union_pw_qpolynomial *upwqp);
1827 __isl_give isl_pw_qpolynomial_fold *
1828 isl_pw_qpolynomial_fold_reset_user(
1829 __isl_take isl_pw_qpolynomial_fold *pwf);
1830 __isl_give isl_union_pw_qpolynomial_fold *
1831 isl_union_pw_qpolynomial_fold_reset_user(
1832 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1834 Spaces can be nested. In particular, the domain of a set or
1835 the domain or range of a relation can be a nested relation.
1836 This process is also called I<wrapping>.
1837 The functions for detecting, constructing and deconstructing
1838 such nested spaces can be found in the wrapping properties
1839 of L</"Unary Properties">, the wrapping operations
1840 of L</"Unary Operations"> and the Cartesian product operations
1841 of L</"Basic Operations">.
1843 Spaces can be created from other spaces
1844 using the functions described in L</"Unary Operations">
1845 and L</"Binary Operations">.
1849 A local space is essentially a space with
1850 zero or more existentially quantified variables.
1851 The local space of various objects can be obtained
1852 using the following functions.
1854 #include <isl/constraint.h>
1855 __isl_give isl_local_space *isl_constraint_get_local_space(
1856 __isl_keep isl_constraint *constraint);
1858 #include <isl/set.h>
1859 __isl_give isl_local_space *isl_basic_set_get_local_space(
1860 __isl_keep isl_basic_set *bset);
1862 #include <isl/map.h>
1863 __isl_give isl_local_space *isl_basic_map_get_local_space(
1864 __isl_keep isl_basic_map *bmap);
1866 #include <isl/aff.h>
1867 __isl_give isl_local_space *isl_aff_get_domain_local_space(
1868 __isl_keep isl_aff *aff);
1869 __isl_give isl_local_space *isl_aff_get_local_space(
1870 __isl_keep isl_aff *aff);
1872 A new local space can be created from a space using
1874 #include <isl/local_space.h>
1875 __isl_give isl_local_space *isl_local_space_from_space(
1876 __isl_take isl_space *space);
1878 They can be inspected, modified, copied and freed using the following functions.
1880 #include <isl/local_space.h>
1881 isl_bool isl_local_space_is_params(
1882 __isl_keep isl_local_space *ls);
1883 isl_bool isl_local_space_is_set(
1884 __isl_keep isl_local_space *ls);
1885 __isl_give isl_space *isl_local_space_get_space(
1886 __isl_keep isl_local_space *ls);
1887 __isl_give isl_aff *isl_local_space_get_div(
1888 __isl_keep isl_local_space *ls, int pos);
1889 __isl_give isl_local_space *isl_local_space_copy(
1890 __isl_keep isl_local_space *ls);
1891 __isl_null isl_local_space *isl_local_space_free(
1892 __isl_take isl_local_space *ls);
1894 Note that C<isl_local_space_get_div> can only be used on local spaces
1897 Two local spaces can be compared using
1899 isl_bool isl_local_space_is_equal(
1900 __isl_keep isl_local_space *ls1,
1901 __isl_keep isl_local_space *ls2);
1903 Local spaces can be created from other local spaces
1904 using the functions described in L</"Unary Operations">
1905 and L</"Binary Operations">.
1907 =head2 Creating New Sets and Relations
1909 C<isl> has functions for creating some standard sets and relations.
1913 =item * Empty sets and relations
1915 __isl_give isl_basic_set *isl_basic_set_empty(
1916 __isl_take isl_space *space);
1917 __isl_give isl_basic_map *isl_basic_map_empty(
1918 __isl_take isl_space *space);
1919 __isl_give isl_set *isl_set_empty(
1920 __isl_take isl_space *space);
1921 __isl_give isl_map *isl_map_empty(
1922 __isl_take isl_space *space);
1923 __isl_give isl_union_set *isl_union_set_empty(
1924 __isl_take isl_space *space);
1925 __isl_give isl_union_map *isl_union_map_empty(
1926 __isl_take isl_space *space);
1928 For C<isl_union_set>s and C<isl_union_map>s, the space
1929 is only used to specify the parameters.
1931 =item * Universe sets and relations
1933 __isl_give isl_basic_set *isl_basic_set_universe(
1934 __isl_take isl_space *space);
1935 __isl_give isl_basic_map *isl_basic_map_universe(
1936 __isl_take isl_space *space);
1937 __isl_give isl_set *isl_set_universe(
1938 __isl_take isl_space *space);
1939 __isl_give isl_map *isl_map_universe(
1940 __isl_take isl_space *space);
1941 __isl_give isl_union_set *isl_union_set_universe(
1942 __isl_take isl_union_set *uset);
1943 __isl_give isl_union_map *isl_union_map_universe(
1944 __isl_take isl_union_map *umap);
1946 The sets and relations constructed by the functions above
1947 contain all integer values, while those constructed by the
1948 functions below only contain non-negative values.
1950 __isl_give isl_basic_set *isl_basic_set_nat_universe(
1951 __isl_take isl_space *space);
1952 __isl_give isl_basic_map *isl_basic_map_nat_universe(
1953 __isl_take isl_space *space);
1954 __isl_give isl_set *isl_set_nat_universe(
1955 __isl_take isl_space *space);
1956 __isl_give isl_map *isl_map_nat_universe(
1957 __isl_take isl_space *space);
1959 =item * Identity relations
1961 __isl_give isl_basic_map *isl_basic_map_identity(
1962 __isl_take isl_space *space);
1963 __isl_give isl_map *isl_map_identity(
1964 __isl_take isl_space *space);
1966 The number of input and output dimensions in C<space> needs
1969 =item * Lexicographic order
1971 __isl_give isl_map *isl_map_lex_lt(
1972 __isl_take isl_space *set_space);
1973 __isl_give isl_map *isl_map_lex_le(
1974 __isl_take isl_space *set_space);
1975 __isl_give isl_map *isl_map_lex_gt(
1976 __isl_take isl_space *set_space);
1977 __isl_give isl_map *isl_map_lex_ge(
1978 __isl_take isl_space *set_space);
1979 __isl_give isl_map *isl_map_lex_lt_first(
1980 __isl_take isl_space *space, unsigned n);
1981 __isl_give isl_map *isl_map_lex_le_first(
1982 __isl_take isl_space *space, unsigned n);
1983 __isl_give isl_map *isl_map_lex_gt_first(
1984 __isl_take isl_space *space, unsigned n);
1985 __isl_give isl_map *isl_map_lex_ge_first(
1986 __isl_take isl_space *space, unsigned n);
1988 The first four functions take a space for a B<set>
1989 and return relations that express that the elements in the domain
1990 are lexicographically less
1991 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1992 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1993 than the elements in the range.
1994 The last four functions take a space for a map
1995 and return relations that express that the first C<n> dimensions
1996 in the domain are lexicographically less
1997 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1998 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1999 than the first C<n> dimensions in the range.
2003 A basic set or relation can be converted to a set or relation
2004 using the following functions.
2006 __isl_give isl_set *isl_set_from_basic_set(
2007 __isl_take isl_basic_set *bset);
2008 __isl_give isl_map *isl_map_from_basic_map(
2009 __isl_take isl_basic_map *bmap);
2011 Sets and relations can be converted to union sets and relations
2012 using the following functions.
2014 __isl_give isl_union_set *isl_union_set_from_basic_set(
2015 __isl_take isl_basic_set *bset);
2016 __isl_give isl_union_map *isl_union_map_from_basic_map(
2017 __isl_take isl_basic_map *bmap);
2018 __isl_give isl_union_set *isl_union_set_from_set(
2019 __isl_take isl_set *set);
2020 __isl_give isl_union_map *isl_union_map_from_map(
2021 __isl_take isl_map *map);
2023 The inverse conversions below can only be used if the input
2024 union set or relation is known to contain elements in exactly one
2027 #include <isl/union_set.h>
2028 isl_bool isl_union_set_isa_set(
2029 __isl_keep isl_union_set *uset);
2030 __isl_give isl_set *isl_set_from_union_set(
2031 __isl_take isl_union_set *uset);
2033 #include <isl/union_map.h>
2034 isl_bool isl_union_map_isa_map(
2035 __isl_keep isl_union_map *umap);
2036 __isl_give isl_map *isl_map_from_union_map(
2037 __isl_take isl_union_map *umap);
2039 Sets and relations can be copied and freed again using the following
2042 __isl_give isl_basic_set *isl_basic_set_copy(
2043 __isl_keep isl_basic_set *bset);
2044 __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
2045 __isl_give isl_union_set *isl_union_set_copy(
2046 __isl_keep isl_union_set *uset);
2047 __isl_give isl_basic_map *isl_basic_map_copy(
2048 __isl_keep isl_basic_map *bmap);
2049 __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
2050 __isl_give isl_union_map *isl_union_map_copy(
2051 __isl_keep isl_union_map *umap);
2052 __isl_null isl_basic_set *isl_basic_set_free(
2053 __isl_take isl_basic_set *bset);
2054 __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
2055 __isl_null isl_union_set *isl_union_set_free(
2056 __isl_take isl_union_set *uset);
2057 __isl_null isl_basic_map *isl_basic_map_free(
2058 __isl_take isl_basic_map *bmap);
2059 __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
2060 __isl_null isl_union_map *isl_union_map_free(
2061 __isl_take isl_union_map *umap);
2063 Other sets and relations can be constructed by starting
2064 from a universe set or relation, adding equality and/or
2065 inequality constraints and then projecting out the
2066 existentially quantified variables, if any.
2067 Constraints can be constructed, manipulated and
2068 added to (or removed from) (basic) sets and relations
2069 using the following functions.
2071 #include <isl/constraint.h>
2072 __isl_give isl_constraint *isl_constraint_alloc_equality(
2073 __isl_take isl_local_space *ls);
2074 __isl_give isl_constraint *isl_constraint_alloc_inequality(
2075 __isl_take isl_local_space *ls);
2076 __isl_give isl_constraint *isl_constraint_set_constant_si(
2077 __isl_take isl_constraint *constraint, int v);
2078 __isl_give isl_constraint *isl_constraint_set_constant_val(
2079 __isl_take isl_constraint *constraint,
2080 __isl_take isl_val *v);
2081 __isl_give isl_constraint *isl_constraint_set_coefficient_si(
2082 __isl_take isl_constraint *constraint,
2083 enum isl_dim_type type, int pos, int v);
2084 __isl_give isl_constraint *
2085 isl_constraint_set_coefficient_val(
2086 __isl_take isl_constraint *constraint,
2087 enum isl_dim_type type, int pos,
2088 __isl_take isl_val *v);
2089 __isl_give isl_basic_map *isl_basic_map_add_constraint(
2090 __isl_take isl_basic_map *bmap,
2091 __isl_take isl_constraint *constraint);
2092 __isl_give isl_basic_set *isl_basic_set_add_constraint(
2093 __isl_take isl_basic_set *bset,
2094 __isl_take isl_constraint *constraint);
2095 __isl_give isl_map *isl_map_add_constraint(
2096 __isl_take isl_map *map,
2097 __isl_take isl_constraint *constraint);
2098 __isl_give isl_set *isl_set_add_constraint(
2099 __isl_take isl_set *set,
2100 __isl_take isl_constraint *constraint);
2102 For example, to create a set containing the even integers
2103 between 10 and 42, you would use the following code.
2106 isl_local_space *ls;
2108 isl_basic_set *bset;
2110 space = isl_space_set_alloc(ctx, 0, 2);
2111 bset = isl_basic_set_universe(isl_space_copy(space));
2112 ls = isl_local_space_from_space(space);
2114 c = isl_constraint_alloc_equality(isl_local_space_copy(ls));
2115 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
2116 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
2117 bset = isl_basic_set_add_constraint(bset, c);
2119 c = isl_constraint_alloc_inequality(isl_local_space_copy(ls));
2120 c = isl_constraint_set_constant_si(c, -10);
2121 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
2122 bset = isl_basic_set_add_constraint(bset, c);
2124 c = isl_constraint_alloc_inequality(ls);
2125 c = isl_constraint_set_constant_si(c, 42);
2126 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
2127 bset = isl_basic_set_add_constraint(bset, c);
2129 bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
2133 isl_basic_set *bset;
2134 bset = isl_basic_set_read_from_str(ctx,
2135 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
2137 A basic set or relation can also be constructed from two matrices
2138 describing the equalities and the inequalities.
2140 __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
2141 __isl_take isl_space *space,
2142 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
2143 enum isl_dim_type c1,
2144 enum isl_dim_type c2, enum isl_dim_type c3,
2145 enum isl_dim_type c4);
2146 __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
2147 __isl_take isl_space *space,
2148 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
2149 enum isl_dim_type c1,
2150 enum isl_dim_type c2, enum isl_dim_type c3,
2151 enum isl_dim_type c4, enum isl_dim_type c5);
2153 The C<isl_dim_type> arguments indicate the order in which
2154 different kinds of variables appear in the input matrices
2155 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
2156 C<isl_dim_set> and C<isl_dim_div> for sets and
2157 of C<isl_dim_cst>, C<isl_dim_param>,
2158 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
2160 A (basic or union) set or relation can also be constructed from a
2161 (union) (piecewise) (multiple) affine expression
2162 or a list of affine expressions
2163 (See L</"Functions">), provided these affine expressions do not
2166 #include <isl/set.h>
2167 __isl_give isl_basic_set *isl_basic_set_from_multi_aff(
2168 __isl_take isl_multi_aff *ma);
2169 __isl_give isl_set *isl_set_from_multi_aff(
2170 __isl_take isl_multi_aff *ma);
2172 #include <isl/map.h>
2173 __isl_give isl_basic_map *isl_basic_map_from_aff(
2174 __isl_take isl_aff *aff);
2175 __isl_give isl_map *isl_map_from_aff(
2176 __isl_take isl_aff *aff);
2177 __isl_give isl_basic_map *isl_basic_map_from_aff_list(
2178 __isl_take isl_space *domain_space,
2179 __isl_take isl_aff_list *list);
2180 __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
2181 __isl_take isl_multi_aff *maff)
2182 __isl_give isl_map *isl_map_from_multi_aff(
2183 __isl_take isl_multi_aff *maff)
2185 #include <isl/aff.h>
2186 __isl_give isl_set *isl_set_from_pw_aff(
2187 __isl_take isl_pw_aff *pwaff);
2188 __isl_give isl_map *isl_map_from_pw_aff(
2189 __isl_take isl_pw_aff *pwaff);
2190 __isl_give isl_set *isl_set_from_pw_multi_aff(
2191 __isl_take isl_pw_multi_aff *pma);
2192 __isl_give isl_map *isl_map_from_pw_multi_aff(
2193 __isl_take isl_pw_multi_aff *pma);
2194 __isl_give isl_set *isl_set_from_multi_pw_aff(
2195 __isl_take isl_multi_pw_aff *mpa);
2196 __isl_give isl_map *isl_map_from_multi_pw_aff(
2197 __isl_take isl_multi_pw_aff *mpa);
2198 __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
2199 __isl_take isl_union_pw_aff *upa);
2200 __isl_give isl_union_map *
2201 isl_union_map_from_union_pw_multi_aff(
2202 __isl_take isl_union_pw_multi_aff *upma);
2203 __isl_give isl_union_map *
2204 isl_union_map_from_multi_union_pw_aff(
2205 __isl_take isl_multi_union_pw_aff *mupa);
2207 The C<domain_space> argument describes the domain of the resulting
2208 basic relation. It is required because the C<list> may consist
2209 of zero affine expressions.
2210 The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
2211 is not allowed to be zero-dimensional. The domain of the result
2212 is the shared domain of the union piecewise affine elements.
2214 =head2 Inspecting Sets and Relations
2216 Usually, the user should not have to care about the actual constraints
2217 of the sets and maps, but should instead apply the abstract operations
2218 explained in the following sections.
2219 Occasionally, however, it may be required to inspect the individual
2220 coefficients of the constraints. This section explains how to do so.
2221 In these cases, it may also be useful to have C<isl> compute
2222 an explicit representation of the existentially quantified variables.
2224 __isl_give isl_set *isl_set_compute_divs(
2225 __isl_take isl_set *set);
2226 __isl_give isl_map *isl_map_compute_divs(
2227 __isl_take isl_map *map);
2228 __isl_give isl_union_set *isl_union_set_compute_divs(
2229 __isl_take isl_union_set *uset);
2230 __isl_give isl_union_map *isl_union_map_compute_divs(
2231 __isl_take isl_union_map *umap);
2233 This explicit representation defines the existentially quantified
2234 variables as integer divisions of the other variables, possibly
2235 including earlier existentially quantified variables.
2236 An explicitly represented existentially quantified variable therefore
2237 has a unique value when the values of the other variables are known.
2239 Alternatively, the existentially quantified variables can be removed
2240 using the following functions, which compute an overapproximation.
2242 #include <isl/set.h>
2243 __isl_give isl_basic_set *isl_basic_set_remove_divs(
2244 __isl_take isl_basic_set *bset);
2245 __isl_give isl_set *isl_set_remove_divs(
2246 __isl_take isl_set *set);
2248 #include <isl/map.h>
2249 __isl_give isl_basic_map *isl_basic_map_remove_divs(
2250 __isl_take isl_basic_map *bmap);
2251 __isl_give isl_map *isl_map_remove_divs(
2252 __isl_take isl_map *map);
2254 #include <isl/union_set.h>
2255 __isl_give isl_union_set *isl_union_set_remove_divs(
2256 __isl_take isl_union_set *bset);
2258 #include <isl/union_map.h>
2259 __isl_give isl_union_map *isl_union_map_remove_divs(
2260 __isl_take isl_union_map *bmap);
2262 It is also possible to only remove those divs that are defined
2263 in terms of a given range of dimensions or only those for which
2264 no explicit representation is known.
2266 __isl_give isl_basic_set *
2267 isl_basic_set_remove_divs_involving_dims(
2268 __isl_take isl_basic_set *bset,
2269 enum isl_dim_type type,
2270 unsigned first, unsigned n);
2271 __isl_give isl_basic_map *
2272 isl_basic_map_remove_divs_involving_dims(
2273 __isl_take isl_basic_map *bmap,
2274 enum isl_dim_type type,
2275 unsigned first, unsigned n);
2276 __isl_give isl_set *isl_set_remove_divs_involving_dims(
2277 __isl_take isl_set *set, enum isl_dim_type type,
2278 unsigned first, unsigned n);
2279 __isl_give isl_map *isl_map_remove_divs_involving_dims(
2280 __isl_take isl_map *map, enum isl_dim_type type,
2281 unsigned first, unsigned n);
2283 __isl_give isl_basic_set *
2284 isl_basic_set_remove_unknown_divs(
2285 __isl_take isl_basic_set *bset);
2286 __isl_give isl_set *isl_set_remove_unknown_divs(
2287 __isl_take isl_set *set);
2288 __isl_give isl_map *isl_map_remove_unknown_divs(
2289 __isl_take isl_map *map);
2291 To iterate over all the sets or maps in a union set or map, use
2293 #include <isl/union_set.h>
2294 isl_stat isl_union_set_foreach_set(
2295 __isl_keep isl_union_set *uset,
2296 isl_stat (*fn)(__isl_take isl_set *set, void *user),
2298 isl_bool isl_union_set_every_set(
2299 __isl_keep isl_union_set *uset,
2300 isl_bool (*test)(__isl_keep isl_set *set,
2304 #include <isl/union_map.h>
2305 isl_stat isl_union_map_foreach_map(
2306 __isl_keep isl_union_map *umap,
2307 isl_stat (*fn)(__isl_take isl_map *map, void *user),
2309 isl_bool isl_union_map_every_map(
2310 __isl_keep isl_union_map *umap,
2311 isl_bool (*test)(__isl_keep isl_map *map,
2315 These functions call the callback function once for each
2316 (pair of) space(s) for which there are elements in the input.
2317 The argument to the callback contains all elements in the input
2318 with that (pair of) space(s).
2319 The C<isl_union_set_every_set> and
2320 C<isl_union_map_every_map> variants check whether each
2321 call to the callback returns true and stops checking as soon as one
2322 of these calls returns false.
2324 The number of sets or maps in a union set or map can be obtained
2327 isl_size isl_union_set_n_set(__isl_keep isl_union_set *uset);
2328 isl_size isl_union_map_n_map(__isl_keep isl_union_map *umap);
2330 To extract the set or map in a given space from a union, use
2332 __isl_give isl_set *isl_union_set_extract_set(
2333 __isl_keep isl_union_set *uset,
2334 __isl_take isl_space *space);
2335 __isl_give isl_map *isl_union_map_extract_map(
2336 __isl_keep isl_union_map *umap,
2337 __isl_take isl_space *space);
2339 To iterate over all the basic sets or maps in a set or map, use
2341 isl_stat isl_set_foreach_basic_set(__isl_keep isl_set *set,
2342 isl_stat (*fn)(__isl_take isl_basic_set *bset,
2345 isl_stat isl_map_foreach_basic_map(__isl_keep isl_map *map,
2346 isl_stat (*fn)(__isl_take isl_basic_map *bmap,
2350 The callback function C<fn> should return C<isl_stat_ok> if successful and
2351 C<isl_stat_error> if an error occurs. In the latter case, or if any other error
2352 occurs, the above functions will return C<isl_stat_error>.
2354 It should be noted that C<isl> does not guarantee that
2355 the basic sets or maps passed to C<fn> are disjoint.
2356 If this is required, then the user should call one of
2357 the following functions first.
2359 __isl_give isl_set *isl_set_make_disjoint(
2360 __isl_take isl_set *set);
2361 __isl_give isl_map *isl_map_make_disjoint(
2362 __isl_take isl_map *map);
2364 The number of basic sets in a set can be obtained
2365 or the number of basic maps in a map can be obtained
2368 #include <isl/set.h>
2369 isl_size isl_set_n_basic_set(__isl_keep isl_set *set);
2371 #include <isl/map.h>
2372 isl_size isl_map_n_basic_map(__isl_keep isl_map *map);
2374 It is also possible to obtain a list of (basic) sets from a set
2375 or union set, a list of basic maps from a map and a list of maps from a union
2378 #include <isl/set.h>
2379 __isl_give isl_basic_set_list *isl_set_get_basic_set_list(
2380 __isl_keep isl_set *set);
2382 #include <isl/union_set.h>
2383 __isl_give isl_basic_set_list *
2384 isl_union_set_get_basic_set_list(
2385 __isl_keep isl_union_set *uset);
2386 __isl_give isl_set_list *isl_union_set_get_set_list(
2387 __isl_keep isl_union_set *uset);
2389 #include <isl/map.h>
2390 __isl_give isl_basic_map_list *isl_map_get_basic_map_list(
2391 __isl_keep isl_map *map);
2393 #include <isl/union_map.h>
2394 __isl_give isl_map_list *isl_union_map_get_map_list(
2395 __isl_keep isl_union_map *umap);
2397 The returned list can be manipulated using the functions in L<"Lists">.
2399 To iterate over the constraints of a basic set or map, use
2401 #include <isl/constraint.h>
2403 isl_size isl_basic_set_n_constraint(
2404 __isl_keep isl_basic_set *bset);
2405 isl_stat isl_basic_set_foreach_constraint(
2406 __isl_keep isl_basic_set *bset,
2407 isl_stat (*fn)(__isl_take isl_constraint *c,
2410 isl_size isl_basic_map_n_constraint(
2411 __isl_keep isl_basic_map *bmap);
2412 isl_stat isl_basic_map_foreach_constraint(
2413 __isl_keep isl_basic_map *bmap,
2414 isl_stat (*fn)(__isl_take isl_constraint *c,
2417 __isl_null isl_constraint *isl_constraint_free(
2418 __isl_take isl_constraint *c);
2420 Again, the callback function C<fn> should return C<isl_stat_ok>
2422 C<isl_stat_error> if an error occurs. In the latter case, or if any other error
2423 occurs, the above functions will return C<isl_stat_error>.
2424 The constraint C<c> represents either an equality or an inequality.
2425 Use the following function to find out whether a constraint
2426 represents an equality. If not, it represents an inequality.
2428 isl_bool isl_constraint_is_equality(
2429 __isl_keep isl_constraint *constraint);
2431 It is also possible to obtain a list of constraints from a basic
2434 #include <isl/constraint.h>
2435 __isl_give isl_constraint_list *
2436 isl_basic_map_get_constraint_list(
2437 __isl_keep isl_basic_map *bmap);
2438 __isl_give isl_constraint_list *
2439 isl_basic_set_get_constraint_list(
2440 __isl_keep isl_basic_set *bset);
2442 These functions require that all existentially quantified variables
2443 have an explicit representation.
2444 The returned list can be manipulated using the functions in L<"Lists">.
2446 The coefficients of the constraints can be inspected using
2447 the following functions.
2449 isl_bool isl_constraint_is_lower_bound(
2450 __isl_keep isl_constraint *constraint,
2451 enum isl_dim_type type, unsigned pos);
2452 isl_bool isl_constraint_is_upper_bound(
2453 __isl_keep isl_constraint *constraint,
2454 enum isl_dim_type type, unsigned pos);
2455 __isl_give isl_val *isl_constraint_get_constant_val(
2456 __isl_keep isl_constraint *constraint);
2457 __isl_give isl_val *isl_constraint_get_coefficient_val(
2458 __isl_keep isl_constraint *constraint,
2459 enum isl_dim_type type, int pos);
2461 The explicit representations of the existentially quantified
2462 variables can be inspected using the following function.
2463 Note that the user is only allowed to use this function
2464 if the inspected set or map is the result of a call
2465 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2466 The existentially quantified variable is equal to the floor
2467 of the returned affine expression. The affine expression
2468 itself can be inspected using the functions in
2471 __isl_give isl_aff *isl_constraint_get_div(
2472 __isl_keep isl_constraint *constraint, int pos);
2474 To obtain the constraints of a basic set or map in matrix
2475 form, use the following functions.
2477 __isl_give isl_mat *isl_basic_set_equalities_matrix(
2478 __isl_keep isl_basic_set *bset,
2479 enum isl_dim_type c1, enum isl_dim_type c2,
2480 enum isl_dim_type c3, enum isl_dim_type c4);
2481 __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2482 __isl_keep isl_basic_set *bset,
2483 enum isl_dim_type c1, enum isl_dim_type c2,
2484 enum isl_dim_type c3, enum isl_dim_type c4);
2485 __isl_give isl_mat *isl_basic_map_equalities_matrix(
2486 __isl_keep isl_basic_map *bmap,
2487 enum isl_dim_type c1,
2488 enum isl_dim_type c2, enum isl_dim_type c3,
2489 enum isl_dim_type c4, enum isl_dim_type c5);
2490 __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2491 __isl_keep isl_basic_map *bmap,
2492 enum isl_dim_type c1,
2493 enum isl_dim_type c2, enum isl_dim_type c3,
2494 enum isl_dim_type c4, enum isl_dim_type c5);
2496 The C<isl_dim_type> arguments dictate the order in which
2497 different kinds of variables appear in the resulting matrix.
2498 For set inputs, they should be a permutation of
2499 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2500 For map inputs, they should be a permutation of
2501 C<isl_dim_cst>, C<isl_dim_param>,
2502 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2506 Points are elements of a set. They can be used to construct
2507 simple sets (boxes) or they can be used to represent the
2508 individual elements of a set.
2509 The zero point (the origin) can be created using
2511 __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2513 The coordinates of a point can be inspected, set and changed
2516 __isl_give isl_val *isl_point_get_coordinate_val(
2517 __isl_keep isl_point *pnt,
2518 enum isl_dim_type type, int pos);
2519 __isl_give isl_point *isl_point_set_coordinate_val(
2520 __isl_take isl_point *pnt,
2521 enum isl_dim_type type, int pos,
2522 __isl_take isl_val *v);
2524 __isl_give isl_point *isl_point_add_ui(
2525 __isl_take isl_point *pnt,
2526 enum isl_dim_type type, int pos, unsigned val);
2527 __isl_give isl_point *isl_point_sub_ui(
2528 __isl_take isl_point *pnt,
2529 enum isl_dim_type type, int pos, unsigned val);
2531 Points can be copied or freed using
2533 __isl_give isl_point *isl_point_copy(
2534 __isl_keep isl_point *pnt);
2535 __isl_null isl_point *isl_point_free(
2536 __isl_take isl_point *pnt);
2538 A singleton set can be created from a point using
2540 __isl_give isl_basic_set *isl_basic_set_from_point(
2541 __isl_take isl_point *pnt);
2542 __isl_give isl_set *isl_set_from_point(
2543 __isl_take isl_point *pnt);
2544 __isl_give isl_union_set *isl_union_set_from_point(
2545 __isl_take isl_point *pnt);
2547 and a box can be created from two opposite extremal points using
2549 __isl_give isl_basic_set *isl_basic_set_box_from_points(
2550 __isl_take isl_point *pnt1,
2551 __isl_take isl_point *pnt2);
2552 __isl_give isl_set *isl_set_box_from_points(
2553 __isl_take isl_point *pnt1,
2554 __isl_take isl_point *pnt2);
2556 All elements of a B<bounded> (union) set can be enumerated using
2557 the following functions.
2559 isl_stat isl_set_foreach_point(__isl_keep isl_set *set,
2560 isl_stat (*fn)(__isl_take isl_point *pnt,
2563 isl_stat isl_union_set_foreach_point(
2564 __isl_keep isl_union_set *uset,
2565 isl_stat (*fn)(__isl_take isl_point *pnt,
2569 The function C<fn> is called for each integer point in
2570 C<set> with as second argument the last argument of
2571 the C<isl_set_foreach_point> call. The function C<fn>
2572 should return C<isl_stat_ok> on success and C<isl_stat_error> on failure.
2573 In the latter case, C<isl_set_foreach_point> will stop
2574 enumerating and return C<isl_stat_error> as well.
2575 If the enumeration is performed successfully and to completion,
2576 then C<isl_set_foreach_point> returns C<isl_stat_ok>.
2578 To obtain a single point of a (basic or union) set, use
2580 __isl_give isl_point *isl_basic_set_sample_point(
2581 __isl_take isl_basic_set *bset);
2582 __isl_give isl_point *isl_set_sample_point(
2583 __isl_take isl_set *set);
2584 __isl_give isl_point *isl_union_set_sample_point(
2585 __isl_take isl_union_set *uset);
2587 If C<set> does not contain any (integer) points, then the
2588 resulting point will be ``void'', a property that can be
2591 isl_bool isl_point_is_void(__isl_keep isl_point *pnt);
2595 Besides sets and relation, C<isl> also supports various types of functions.
2596 Each of these types is derived from the value type (see L</"Values">)
2597 or from one of two primitive function types
2598 through the application of zero or more type constructors.
2599 As a special case, a multiple expression can also be derived
2600 from an identifier (see L</"Identifiers">) although the result
2601 is not really a function.
2602 We first describe the primitive type and then we describe
2603 the types derived from these primitive types.
2605 =head3 Primitive Functions
2607 C<isl> support two primitive function types, quasi-affine
2608 expressions and quasipolynomials.
2609 A quasi-affine expression is defined either over a parameter
2610 space or over a set and is composed of integer constants,
2611 parameters and set variables, addition, subtraction and
2612 integer division by an integer constant.
2613 For example, the quasi-affine expression
2615 [n] -> { [x] -> [2*floor((4 n + x)/9)] }
2617 maps C<x> to C<2*floor((4 n + x)/9>.
2618 A quasipolynomial is a polynomial expression in quasi-affine
2619 expression. That is, it additionally allows for multiplication.
2620 Note, though, that it is not allowed to construct an integer
2621 division of an expression involving multiplications.
2622 Here is an example of a quasipolynomial that is not
2623 quasi-affine expression
2625 [n] -> { [x] -> (n*floor((4 n + x)/9)) }
2627 Note that the external representations of quasi-affine expressions
2628 and quasipolynomials are different. Quasi-affine expressions
2629 use a notation with square brackets just like binary relations,
2630 while quasipolynomials do not. This might change at some point.
2632 If a primitive function is defined over a parameter space,
2633 then the space of the function itself is that of a set.
2634 If it is defined over a set, then the space of the function
2635 is that of a relation. In both cases, the set space (or
2636 the output space) is single-dimensional, anonymous and unstructured.
2637 To create functions with multiple dimensions or with other kinds
2638 of set or output spaces, use multiple expressions
2639 (see L</"Multiple Expressions">).
2643 =item * Quasi-affine Expressions
2645 Besides the expressions described above, a quasi-affine
2646 expression can also be set to NaN. Such expressions
2647 typically represent a failure to represent a result
2648 as a quasi-affine expression.
2650 The zero quasi affine expression or the quasi affine expression
2651 that is equal to a given value, parameter or
2652 a specified dimension on a given domain can be created using
2654 #include <isl/aff.h>
2655 __isl_give isl_aff *isl_aff_zero_on_domain(
2656 __isl_take isl_local_space *ls);
2657 __isl_give isl_aff *isl_aff_val_on_domain(
2658 __isl_take isl_local_space *ls,
2659 __isl_take isl_val *val);
2660 __isl_give isl_aff *isl_aff_param_on_domain_space_id(
2661 __isl_take isl_space *space,
2662 __isl_take isl_id *id);
2663 __isl_give isl_aff *isl_aff_var_on_domain(
2664 __isl_take isl_local_space *ls,
2665 enum isl_dim_type type, unsigned pos);
2666 __isl_give isl_aff *isl_aff_nan_on_domain(
2667 __isl_take isl_local_space *ls);
2669 The space passed to C<isl_aff_param_on_domain_space_id>
2670 is required to have a parameter with the given identifier.
2672 Quasi affine expressions can be copied and freed using
2674 #include <isl/aff.h>
2675 __isl_give isl_aff *isl_aff_copy(
2676 __isl_keep isl_aff *aff);
2677 __isl_null isl_aff *isl_aff_free(
2678 __isl_take isl_aff *aff);
2680 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2681 using the following function. The constraint is required to have
2682 a non-zero coefficient for the specified dimension.
2684 #include <isl/constraint.h>
2685 __isl_give isl_aff *isl_constraint_get_bound(
2686 __isl_keep isl_constraint *constraint,
2687 enum isl_dim_type type, int pos);
2689 The entire affine expression of the constraint can also be extracted
2690 using the following function.
2692 #include <isl/constraint.h>
2693 __isl_give isl_aff *isl_constraint_get_aff(
2694 __isl_keep isl_constraint *constraint);
2696 Conversely, an equality constraint equating
2697 the affine expression to zero or an inequality constraint enforcing
2698 the affine expression to be non-negative, can be constructed using
2700 __isl_give isl_constraint *isl_equality_from_aff(
2701 __isl_take isl_aff *aff);
2702 __isl_give isl_constraint *isl_inequality_from_aff(
2703 __isl_take isl_aff *aff);
2705 The coefficients and the integer divisions of an affine expression
2706 can be inspected using the following functions.
2708 #include <isl/aff.h>
2709 __isl_give isl_val *isl_aff_get_constant_val(
2710 __isl_keep isl_aff *aff);
2711 __isl_give isl_val *isl_aff_get_coefficient_val(
2712 __isl_keep isl_aff *aff,
2713 enum isl_dim_type type, int pos);
2714 int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2715 enum isl_dim_type type, int pos);
2716 __isl_give isl_val *isl_aff_get_denominator_val(
2717 __isl_keep isl_aff *aff);
2718 __isl_give isl_aff *isl_aff_get_div(
2719 __isl_keep isl_aff *aff, int pos);
2721 They can be modified using the following functions.
2723 #include <isl/aff.h>
2724 __isl_give isl_aff *isl_aff_set_constant_si(
2725 __isl_take isl_aff *aff, int v);
2726 __isl_give isl_aff *isl_aff_set_constant_val(
2727 __isl_take isl_aff *aff, __isl_take isl_val *v);
2728 __isl_give isl_aff *isl_aff_set_coefficient_si(
2729 __isl_take isl_aff *aff,
2730 enum isl_dim_type type, int pos, int v);
2731 __isl_give isl_aff *isl_aff_set_coefficient_val(
2732 __isl_take isl_aff *aff,
2733 enum isl_dim_type type, int pos,
2734 __isl_take isl_val *v);
2736 __isl_give isl_aff *isl_aff_add_constant_si(
2737 __isl_take isl_aff *aff, int v);
2738 __isl_give isl_aff *isl_aff_add_constant_val(
2739 __isl_take isl_aff *aff, __isl_take isl_val *v);
2740 __isl_give isl_aff *isl_aff_add_constant_num_si(
2741 __isl_take isl_aff *aff, int v);
2742 __isl_give isl_aff *isl_aff_add_coefficient_si(
2743 __isl_take isl_aff *aff,
2744 enum isl_dim_type type, int pos, int v);
2745 __isl_give isl_aff *isl_aff_add_coefficient_val(
2746 __isl_take isl_aff *aff,
2747 enum isl_dim_type type, int pos,
2748 __isl_take isl_val *v);
2750 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2751 set the I<numerator> of the constant or coefficient, while
2752 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2753 the constant or coefficient as a whole.
2754 The C<add_constant> and C<add_coefficient> functions add an integer
2755 or rational value to
2756 the possibly rational constant or coefficient.
2757 The C<add_constant_num> functions add an integer value to
2760 =item * Quasipolynomials
2762 Some simple quasipolynomials can be created using the following functions.
2764 #include <isl/polynomial.h>
2765 __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2766 __isl_take isl_space *domain);
2767 __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2768 __isl_take isl_space *domain);
2769 __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2770 __isl_take isl_space *domain);
2771 __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2772 __isl_take isl_space *domain);
2773 __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2774 __isl_take isl_space *domain);
2775 __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2776 __isl_take isl_space *domain,
2777 __isl_take isl_val *val);
2778 __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2779 __isl_take isl_space *domain,
2780 enum isl_dim_type type, unsigned pos);
2781 __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2782 __isl_take isl_aff *aff);
2784 Recall that the space in which a quasipolynomial lives is a map space
2785 with a one-dimensional range. The C<domain> argument in some of
2786 the functions above corresponds to the domain of this map space.
2788 Quasipolynomials can be copied and freed again using the following
2791 #include <isl/polynomial.h>
2792 __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2793 __isl_keep isl_qpolynomial *qp);
2794 __isl_null isl_qpolynomial *isl_qpolynomial_free(
2795 __isl_take isl_qpolynomial *qp);
2797 The constant term of a quasipolynomial can be extracted using
2799 __isl_give isl_val *isl_qpolynomial_get_constant_val(
2800 __isl_keep isl_qpolynomial *qp);
2802 To iterate over all terms in a quasipolynomial,
2805 isl_stat isl_qpolynomial_foreach_term(
2806 __isl_keep isl_qpolynomial *qp,
2807 isl_stat (*fn)(__isl_take isl_term *term,
2808 void *user), void *user);
2810 The terms themselves can be inspected and freed using
2813 isl_size isl_term_dim(__isl_keep isl_term *term,
2814 enum isl_dim_type type);
2815 __isl_give isl_val *isl_term_get_coefficient_val(
2816 __isl_keep isl_term *term);
2817 isl_size isl_term_get_exp(__isl_keep isl_term *term,
2818 enum isl_dim_type type, unsigned pos);
2819 __isl_give isl_aff *isl_term_get_div(
2820 __isl_keep isl_term *term, unsigned pos);
2821 __isl_null isl_term *isl_term_free(
2822 __isl_take isl_term *term);
2824 Each term is a product of parameters, set variables and
2825 integer divisions. The function C<isl_term_get_exp>
2826 returns the exponent of a given dimensions in the given term.
2832 A reduction represents a maximum or a minimum of its
2834 The only reduction type defined by C<isl> is
2835 C<isl_qpolynomial_fold>.
2837 There are currently no functions to directly create such
2838 objects, but they do appear in the piecewise quasipolynomial
2839 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2841 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2843 Reductions can be copied and freed using
2844 the following functions.
2846 #include <isl/polynomial.h>
2847 __isl_give isl_qpolynomial_fold *
2848 isl_qpolynomial_fold_copy(
2849 __isl_keep isl_qpolynomial_fold *fold);
2850 __isl_null isl_qpolynomial_fold *
2851 isl_qpolynomial_fold_free(
2852 __isl_take isl_qpolynomial_fold *fold);
2854 To iterate over all quasipolynomials in a reduction, use
2856 isl_stat isl_qpolynomial_fold_foreach_qpolynomial(
2857 __isl_keep isl_qpolynomial_fold *fold,
2858 isl_stat (*fn)(__isl_take isl_qpolynomial *qp,
2859 void *user), void *user);
2861 =head3 Multiple Expressions
2863 A multiple expression represents a sequence of zero or
2864 more base expressions, all defined on the same domain space.
2865 The domain space of the multiple expression is the same
2866 as that of the base expressions, but the range space
2867 can be any space. In case the base expressions have
2868 a set space, the corresponding multiple expression
2869 also has a set space.
2870 Objects of the value or identifier type do not have an associated space.
2871 The space of a multiple value or
2872 multiple identifier is therefore always a set space.
2873 Similarly, the space of a multiple union piecewise
2874 affine expression is always a set space.
2875 If the base expressions are not total, then
2876 a corresponding zero-dimensional multiple expression may
2877 have an explicit domain that keeps track of the domain
2878 outside of any base expressions.
2880 The multiple expression types defined by C<isl>
2881 are C<isl_multi_val>, C<isl_multi_id>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
2882 C<isl_multi_union_pw_aff>.
2884 A multiple expression with the value zero for
2885 each output (or set) dimension can be created
2886 using the following functions.
2888 #include <isl/val.h>
2889 __isl_give isl_multi_val *isl_multi_val_zero(
2890 __isl_take isl_space *space);
2892 #include <isl/aff.h>
2893 __isl_give isl_multi_aff *isl_multi_aff_zero(
2894 __isl_take isl_space *space);
2895 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2896 __isl_take isl_space *space);
2897 __isl_give isl_multi_union_pw_aff *
2898 isl_multi_union_pw_aff_zero(
2899 __isl_take isl_space *space);
2901 Since there is no canonical way of representing a zero
2902 value of type C<isl_union_pw_aff>, the space passed
2903 to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
2905 An identity function can be created using the following
2906 functions. The space needs to be that of a relation
2907 with the same number of input and output dimensions.
2909 #include <isl/aff.h>
2910 __isl_give isl_multi_aff *isl_multi_aff_identity(
2911 __isl_take isl_space *space);
2912 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2913 __isl_take isl_space *space);
2915 A function that performs a projection on a universe
2916 relation or set can be created using the following functions.
2917 See also the corresponding
2918 projection operations in L</"Unary Operations">.
2920 #include <isl/aff.h>
2921 __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2922 __isl_take isl_space *space);
2923 __isl_give isl_multi_aff *isl_multi_aff_range_map(
2924 __isl_take isl_space *space);
2925 __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2926 __isl_take isl_space *space,
2927 enum isl_dim_type type,
2928 unsigned first, unsigned n);
2930 A multiple expression can be created from a single
2931 base expression using the following functions.
2932 The space of the created multiple expression is the same
2933 as that of the base expression, except for
2934 C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
2935 lives in a parameter space and the output lives
2936 in a single-dimensional set space.
2938 #include <isl/aff.h>
2939 __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2940 __isl_take isl_aff *aff);
2941 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2942 __isl_take isl_pw_aff *pa);
2943 __isl_give isl_multi_union_pw_aff *
2944 isl_multi_union_pw_aff_from_union_pw_aff(
2945 __isl_take isl_union_pw_aff *upa);
2947 A multiple expression can be created from a list
2948 of base expression in a specified space.
2949 The domain of this space needs to be the same
2950 as the domains of the base expressions in the list.
2951 If the base expressions have a set space (or no associated space),
2952 then this space also needs to be a set space.
2955 __isl_give isl_multi_id *isl_multi_id_from_id_list(
2956 __isl_take isl_space *space,
2957 __isl_take isl_id_list *list);
2959 #include <isl/val.h>
2960 __isl_give isl_multi_val *isl_multi_val_from_val_list(
2961 __isl_take isl_space *space,
2962 __isl_take isl_val_list *list);
2964 #include <isl/aff.h>
2965 __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2966 __isl_take isl_space *space,
2967 __isl_take isl_aff_list *list);
2968 __isl_give isl_multi_pw_aff *
2969 isl_multi_pw_aff_from_pw_aff_list(
2970 __isl_take isl_space *space,
2971 __isl_take isl_pw_aff_list *list);
2972 __isl_give isl_multi_union_pw_aff *
2973 isl_multi_union_pw_aff_from_union_pw_aff_list(
2974 __isl_take isl_space *space,
2975 __isl_take isl_union_pw_aff_list *list);
2977 As a convenience, a multiple piecewise expression can
2978 also be created from a multiple expression.
2979 Each piecewise expression in the result has a single
2982 #include <isl/aff.h>
2983 __isl_give isl_multi_pw_aff *
2984 isl_multi_pw_aff_from_multi_aff(
2985 __isl_take isl_multi_aff *ma);
2987 Similarly, a multiple union expression can be
2988 created from a multiple expression.
2990 #include <isl/aff.h>
2991 __isl_give isl_multi_union_pw_aff *
2992 isl_multi_union_pw_aff_from_multi_aff(
2993 __isl_take isl_multi_aff *ma);
2994 __isl_give isl_multi_union_pw_aff *
2995 isl_multi_union_pw_aff_from_multi_pw_aff(
2996 __isl_take isl_multi_pw_aff *mpa);
2998 A multiple quasi-affine expression can be created from
2999 a multiple value with a given domain space using the following
3002 #include <isl/aff.h>
3003 __isl_give isl_multi_aff *
3004 isl_multi_aff_multi_val_on_space(
3005 __isl_take isl_space *space,
3006 __isl_take isl_multi_val *mv);
3009 a multiple union piecewise affine expression can be created from
3010 a multiple value with a given domain or
3011 a (piecewise) multiple affine expression with a given domain
3012 using the following functions.
3014 #include <isl/aff.h>
3015 __isl_give isl_multi_union_pw_aff *
3016 isl_multi_union_pw_aff_multi_val_on_domain(
3017 __isl_take isl_union_set *domain,
3018 __isl_take isl_multi_val *mv);
3019 __isl_give isl_multi_union_pw_aff *
3020 isl_multi_union_pw_aff_multi_aff_on_domain(
3021 __isl_take isl_union_set *domain,
3022 __isl_take isl_multi_aff *ma);
3023 __isl_give isl_multi_union_pw_aff *
3024 isl_multi_union_pw_aff_pw_multi_aff_on_domain(
3025 __isl_take isl_union_set *domain,
3026 __isl_take isl_pw_multi_aff *pma);
3028 Multiple expressions can be copied and freed using
3029 the following functions.
3032 __isl_give isl_multi_id *isl_multi_id_copy(
3033 __isl_keep isl_multi_id *mi);
3034 __isl_null isl_multi_id *isl_multi_id_free(
3035 __isl_take isl_multi_id *mi);
3037 #include <isl/val.h>
3038 __isl_give isl_multi_val *isl_multi_val_copy(
3039 __isl_keep isl_multi_val *mv);
3040 __isl_null isl_multi_val *isl_multi_val_free(
3041 __isl_take isl_multi_val *mv);
3043 #include <isl/aff.h>
3044 __isl_give isl_multi_aff *isl_multi_aff_copy(
3045 __isl_keep isl_multi_aff *maff);
3046 __isl_null isl_multi_aff *isl_multi_aff_free(
3047 __isl_take isl_multi_aff *maff);
3048 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
3049 __isl_keep isl_multi_pw_aff *mpa);
3050 __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
3051 __isl_take isl_multi_pw_aff *mpa);
3052 __isl_give isl_multi_union_pw_aff *
3053 isl_multi_union_pw_aff_copy(
3054 __isl_keep isl_multi_union_pw_aff *mupa);
3055 __isl_null isl_multi_union_pw_aff *
3056 isl_multi_union_pw_aff_free(
3057 __isl_take isl_multi_union_pw_aff *mupa);
3059 The number of base expressions in a multiple
3060 expression can be obtained using the following functions.
3063 int isl_multi_id_size(__isl_keep isl_multi_id *mi);
3065 #include <isl/val.h>
3066 isl_size isl_multi_val_size(__isl_keep isl_multi_val *mv);
3068 #include <isl/aff.h>
3069 isl_size isl_multi_aff_size(
3070 __isl_keep isl_multi_aff *multi);
3071 isl_size isl_multi_pw_aff_size(
3072 __isl_keep isl_multi_pw_aff *mpa);
3073 isl_size isl_multi_union_pw_aff_size(
3074 __isl_keep isl_multi_union_pw_aff *mupa);
3076 The base expression at a given position of a multiple
3077 expression can be extracted using the following functions.
3080 __isl_give isl_id *isl_multi_id_get_at(
3081 __isl_keep isl_multi_id *mi, int pos);
3082 __isl_give isl_id *isl_multi_id_get_id(
3083 __isl_keep isl_multi_id *mi, int pos);
3085 #include <isl/val.h>
3086 __isl_give isl_val *isl_multi_val_get_at(
3087 __isl_keep isl_multi_val *mv, int pos);
3088 __isl_give isl_val *isl_multi_val_get_val(
3089 __isl_keep isl_multi_val *mv, int pos);
3091 #include <isl/aff.h>
3092 __isl_give isl_aff *isl_multi_aff_get_at(
3093 __isl_keep isl_multi_aff *ma, int pos);
3094 __isl_give isl_aff *isl_multi_aff_get_aff(
3095 __isl_keep isl_multi_aff *multi, int pos);
3096 __isl_give isl_pw_aff *isl_multi_pw_aff_get_at(
3097 __isl_keep isl_multi_pw_aff *mpa, int pos);
3098 __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
3099 __isl_keep isl_multi_pw_aff *mpa, int pos);
3100 __isl_give isl_union_pw_aff *
3101 isl_multi_union_pw_aff_get_at(
3102 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
3103 __isl_give isl_union_pw_aff *
3104 isl_multi_union_pw_aff_get_union_pw_aff(
3105 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
3107 C<isl_multi_id_get_id> is an alternative name for C<isl_multi_id_get_at>.
3108 Similarly for the other pairs of functions.
3110 The base expression can be replaced using the following functions.
3113 __isl_give isl_multi_id *isl_multi_id_set_at(
3114 __isl_take isl_multi_id *mi, int pos,
3115 __isl_take isl_id *id);
3116 __isl_give isl_multi_id *isl_multi_id_set_id(
3117 __isl_take isl_multi_id *mi, int pos,
3118 __isl_take isl_id *id);
3120 #include <isl/val.h>
3121 __isl_give isl_multi_val *isl_multi_val_set_at(
3122 __isl_take isl_multi_val *mv, int pos,
3123 __isl_take isl_val *val);
3124 __isl_give isl_multi_val *isl_multi_val_set_val(
3125 __isl_take isl_multi_val *mv, int pos,
3126 __isl_take isl_val *val);
3128 #include <isl/aff.h>
3129 __isl_give isl_multi_aff *isl_multi_aff_set_at(
3130 __isl_take isl_multi_aff *ma, int pos,
3131 __isl_take isl_aff *aff);
3132 __isl_give isl_multi_aff *isl_multi_aff_set_aff(
3133 __isl_take isl_multi_aff *multi, int pos,
3134 __isl_take isl_aff *aff);
3135 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_set_at(
3136 __isl_take isl_multi_pw_aff *mpa, int pos,
3137 __isl_take isl_pw_aff *pa);
3138 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_set_pw_aff(
3139 __isl_take isl_multi_pw_aff *mpa, int pos,
3140 __isl_take isl_pw_aff *pa);
3141 __isl_give isl_multi_union_pw_aff *
3142 isl_multi_union_pw_aff_set_at(
3143 __isl_take isl_multi_union_pw_aff *mupa, int pos,
3144 __isl_take isl_union_pw_aff *upa);
3145 __isl_give isl_multi_union_pw_aff *
3146 isl_multi_union_pw_aff_set_union_pw_aff(
3147 __isl_take isl_multi_union_pw_aff *mupa, int pos,
3148 __isl_take isl_union_pw_aff *upa);
3150 C<isl_multi_id_set_id> is an alternative name for C<isl_multi_id_set_at>.
3151 Similarly for the other pairs of functions.
3153 As a convenience, a sequence of base expressions that have
3154 their domains in a given space can be extracted from a sequence
3155 of union expressions using the following function.
3157 #include <isl/aff.h>
3158 __isl_give isl_multi_pw_aff *
3159 isl_multi_union_pw_aff_extract_multi_pw_aff(
3160 __isl_keep isl_multi_union_pw_aff *mupa,
3161 __isl_take isl_space *space);
3163 Note that there is a difference between C<isl_multi_union_pw_aff>
3164 and C<isl_union_pw_multi_aff> objects. The first is a sequence
3165 of unions of piecewise expressions, while the second is a union
3166 of piecewise sequences. In particular, multiple affine expressions
3167 in an C<isl_union_pw_multi_aff> may live in different spaces,
3168 while there is only a single multiple expression in
3169 an C<isl_multi_union_pw_aff>, which can therefore only live
3170 in a single space. This means that not every
3171 C<isl_union_pw_multi_aff> can be converted to
3172 an C<isl_multi_union_pw_aff>. Conversely, the elements
3173 of an C<isl_multi_union_pw_aff> may be defined over different domains,
3174 while each multiple expression inside an C<isl_union_pw_multi_aff>
3175 has a single domain. The conversion of an C<isl_union_pw_multi_aff>
3176 of dimension greater than one may therefore not be exact.
3177 The following functions can
3178 be used to perform these conversions when they are possible.
3180 #include <isl/aff.h>
3181 __isl_give isl_multi_union_pw_aff *
3182 isl_multi_union_pw_aff_from_union_pw_multi_aff(
3183 __isl_take isl_union_pw_multi_aff *upma);
3184 __isl_give isl_union_pw_multi_aff *
3185 isl_union_pw_multi_aff_from_multi_union_pw_aff(
3186 __isl_take isl_multi_union_pw_aff *mupa);
3188 =head3 Piecewise Expressions
3190 A piecewise expression is an expression that is described
3191 using zero or more base expression defined over the same
3192 number of cells in the domain space of the base expressions.
3193 All base expressions are defined over the same
3194 domain space and the cells are disjoint.
3195 The space of a piecewise expression is the same as
3196 that of the base expressions.
3197 If the union of the cells is a strict subset of the domain
3198 space, then the value of the piecewise expression outside
3199 this union is different for types derived from quasi-affine
3200 expressions and those derived from quasipolynomials.
3201 Piecewise expressions derived from quasi-affine expressions
3202 are considered to be undefined outside the union of their cells.
3203 Piecewise expressions derived from quasipolynomials
3204 are considered to be zero outside the union of their cells.
3206 Piecewise quasipolynomials are mainly used by the C<barvinok>
3207 library for representing the number of elements in a parametric set or map.
3208 For example, the piecewise quasipolynomial
3210 [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
3212 represents the number of points in the map
3214 [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
3216 The piecewise expression types defined by C<isl>
3217 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
3218 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
3220 A piecewise expression with no cells can be created using
3221 the following functions.
3223 #include <isl/aff.h>
3224 __isl_give isl_pw_aff *isl_pw_aff_empty(
3225 __isl_take isl_space *space);
3226 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
3227 __isl_take isl_space *space);
3229 A piecewise expression with a single universe cell can be
3230 created using the following functions.
3232 #include <isl/aff.h>
3233 __isl_give isl_pw_aff *isl_pw_aff_from_aff(
3234 __isl_take isl_aff *aff);
3235 __isl_give isl_pw_multi_aff *
3236 isl_pw_multi_aff_from_multi_aff(
3237 __isl_take isl_multi_aff *ma);
3239 #include <isl/polynomial.h>
3240 __isl_give isl_pw_qpolynomial *
3241 isl_pw_qpolynomial_from_qpolynomial(
3242 __isl_take isl_qpolynomial *qp);
3244 A piecewise expression with a single specified cell can be
3245 created using the following functions.
3247 #include <isl/aff.h>
3248 __isl_give isl_pw_aff *isl_pw_aff_alloc(
3249 __isl_take isl_set *set, __isl_take isl_aff *aff);
3250 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
3251 __isl_take isl_set *set,
3252 __isl_take isl_multi_aff *maff);
3254 #include <isl/polynomial.h>
3255 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
3256 __isl_take isl_set *set,
3257 __isl_take isl_qpolynomial *qp);
3259 The following convenience functions first create a base expression and
3260 then create a piecewise expression over a universe domain.
3262 #include <isl/aff.h>
3263 __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
3264 __isl_take isl_local_space *ls);
3265 __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
3266 __isl_take isl_local_space *ls,
3267 enum isl_dim_type type, unsigned pos);
3268 __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
3269 __isl_take isl_local_space *ls);
3270 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
3271 __isl_take isl_space *space);
3272 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
3273 __isl_take isl_space *space);
3274 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
3275 __isl_take isl_space *space);
3276 __isl_give isl_pw_multi_aff *
3277 isl_pw_multi_aff_project_out_map(
3278 __isl_take isl_space *space,
3279 enum isl_dim_type type,
3280 unsigned first, unsigned n);
3282 #include <isl/polynomial.h>
3283 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
3284 __isl_take isl_space *space);
3286 The following convenience functions first create a base expression and
3287 then create a piecewise expression over a given domain.
3289 #include <isl/aff.h>
3290 __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
3291 __isl_take isl_set *domain,
3292 __isl_take isl_val *v);
3293 __isl_give isl_pw_multi_aff *
3294 isl_pw_multi_aff_multi_val_on_domain(
3295 __isl_take isl_set *domain,
3296 __isl_take isl_multi_val *mv);
3298 As a convenience, a piecewise multiple expression can
3299 also be created from a piecewise expression.
3300 Each multiple expression in the result is derived
3301 from the corresponding base expression.
3303 #include <isl/aff.h>
3304 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
3305 __isl_take isl_pw_aff *pa);
3307 Similarly, a piecewise quasipolynomial can be
3308 created from a piecewise quasi-affine expression using
3309 the following function.
3311 #include <isl/polynomial.h>
3312 __isl_give isl_pw_qpolynomial *
3313 isl_pw_qpolynomial_from_pw_aff(
3314 __isl_take isl_pw_aff *pwaff);
3316 Piecewise expressions can be copied and freed using the following functions.
3318 #include <isl/aff.h>
3319 __isl_give isl_pw_aff *isl_pw_aff_copy(
3320 __isl_keep isl_pw_aff *pwaff);
3321 __isl_null isl_pw_aff *isl_pw_aff_free(
3322 __isl_take isl_pw_aff *pwaff);
3323 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
3324 __isl_keep isl_pw_multi_aff *pma);
3325 __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
3326 __isl_take isl_pw_multi_aff *pma);
3328 #include <isl/polynomial.h>
3329 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
3330 __isl_keep isl_pw_qpolynomial *pwqp);
3331 __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
3332 __isl_take isl_pw_qpolynomial *pwqp);
3333 __isl_give isl_pw_qpolynomial_fold *
3334 isl_pw_qpolynomial_fold_copy(
3335 __isl_keep isl_pw_qpolynomial_fold *pwf);
3336 __isl_null isl_pw_qpolynomial_fold *
3337 isl_pw_qpolynomial_fold_free(
3338 __isl_take isl_pw_qpolynomial_fold *pwf);
3340 To iterate over the different cells of a piecewise expression,
3341 use the following functions.
3343 #include <isl/aff.h>
3344 isl_bool isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
3345 isl_size isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
3346 isl_stat isl_pw_aff_foreach_piece(
3347 __isl_keep isl_pw_aff *pwaff,
3348 isl_stat (*fn)(__isl_take isl_set *set,
3349 __isl_take isl_aff *aff,
3350 void *user), void *user);
3351 isl_size isl_pw_multi_aff_n_piece(
3352 __isl_keep isl_pw_multi_aff *pma);
3353 isl_stat isl_pw_multi_aff_foreach_piece(
3354 __isl_keep isl_pw_multi_aff *pma,
3355 isl_stat (*fn)(__isl_take isl_set *set,
3356 __isl_take isl_multi_aff *maff,
3357 void *user), void *user);
3359 #include <isl/polynomial.h>
3360 isl_size isl_pw_qpolynomial_n_piece(
3361 __isl_keep isl_pw_qpolynomial *pwqp);
3362 isl_stat isl_pw_qpolynomial_foreach_piece(
3363 __isl_keep isl_pw_qpolynomial *pwqp,
3364 isl_stat (*fn)(__isl_take isl_set *set,
3365 __isl_take isl_qpolynomial *qp,
3366 void *user), void *user);
3367 isl_stat isl_pw_qpolynomial_foreach_lifted_piece(
3368 __isl_keep isl_pw_qpolynomial *pwqp,
3369 isl_stat (*fn)(__isl_take isl_set *set,
3370 __isl_take isl_qpolynomial *qp,
3371 void *user), void *user);
3372 isl_size isl_pw_qpolynomial_fold_n_piece(
3373 __isl_keep isl_pw_qpolynomial_fold *pwf);
3374 isl_stat isl_pw_qpolynomial_fold_foreach_piece(
3375 __isl_keep isl_pw_qpolynomial_fold *pwf,
3376 isl_stat (*fn)(__isl_take isl_set *set,
3377 __isl_take isl_qpolynomial_fold *fold,
3378 void *user), void *user);
3379 isl_stat isl_pw_qpolynomial_fold_foreach_lifted_piece(
3380 __isl_keep isl_pw_qpolynomial_fold *pwf,
3381 isl_stat (*fn)(__isl_take isl_set *set,
3382 __isl_take isl_qpolynomial_fold *fold,
3383 void *user), void *user);
3385 As usual, the function C<fn> should return C<isl_stat_ok> on success
3386 and C<isl_stat_error> on failure. The difference between
3387 C<isl_pw_qpolynomial_foreach_piece> and
3388 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
3389 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
3390 compute unique representations for all existentially quantified
3391 variables and then turn these existentially quantified variables
3392 into extra set variables, adapting the associated quasipolynomial
3393 accordingly. This means that the C<set> passed to C<fn>
3394 will not have any existentially quantified variables, but that
3395 the dimensions of the sets may be different for different
3396 invocations of C<fn>.
3397 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
3398 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
3400 A piecewise expression consisting of the expressions at a given
3401 position of a piecewise multiple expression can be extracted
3402 using the following function.
3404 #include <isl/aff.h>
3405 __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3406 __isl_keep isl_pw_multi_aff *pma, int pos);
3408 These expressions can be replaced using the following function.
3410 #include <isl/aff.h>
3411 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3412 __isl_take isl_pw_multi_aff *pma, unsigned pos,
3413 __isl_take isl_pw_aff *pa);
3415 Note that there is a difference between C<isl_multi_pw_aff> and
3416 C<isl_pw_multi_aff> objects. The first is a sequence of piecewise
3417 affine expressions, while the second is a piecewise sequence
3418 of affine expressions. In particular, each of the piecewise
3419 affine expressions in an C<isl_multi_pw_aff> may have a different
3420 domain, while all multiple expressions associated to a cell
3421 in an C<isl_pw_multi_aff> have the same domain.
3422 It is possible to convert between the two, but when converting
3423 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3424 of the result is the intersection of the domains of the input.
3425 The reverse conversion is exact.
3427 #include <isl/aff.h>
3428 __isl_give isl_pw_multi_aff *
3429 isl_pw_multi_aff_from_multi_pw_aff(
3430 __isl_take isl_multi_pw_aff *mpa);
3431 __isl_give isl_multi_pw_aff *
3432 isl_multi_pw_aff_from_pw_multi_aff(
3433 __isl_take isl_pw_multi_aff *pma);
3435 =head3 Union Expressions
3437 A union expression collects base expressions defined
3438 over different domains. The space of a union expression
3439 is that of the shared parameter space.
3441 The union expression types defined by C<isl>
3442 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3443 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3445 C<isl_union_pw_aff>,
3446 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>,
3447 there can be at most one base expression for a given domain space.
3449 C<isl_union_pw_multi_aff>,
3450 there can be multiple such expressions for a given domain space,
3451 but the domains of these expressions need to be disjoint.
3453 An empty union expression can be created using the following functions.
3455 #include <isl/aff.h>
3456 __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
3457 __isl_take isl_space *space);
3458 __isl_give isl_union_pw_multi_aff *
3459 isl_union_pw_multi_aff_empty(
3460 __isl_take isl_space *space);
3462 #include <isl/polynomial.h>
3463 __isl_give isl_union_pw_qpolynomial *
3464 isl_union_pw_qpolynomial_zero(
3465 __isl_take isl_space *space);
3467 A union expression containing a single base expression
3468 can be created using the following functions.
3470 #include <isl/aff.h>
3471 __isl_give isl_union_pw_aff *
3472 isl_union_pw_aff_from_pw_aff(
3473 __isl_take isl_pw_aff *pa);
3474 __isl_give isl_union_pw_multi_aff *
3475 isl_union_pw_multi_aff_from_aff(
3476 __isl_take isl_aff *aff);
3477 __isl_give isl_union_pw_multi_aff *
3478 isl_union_pw_multi_aff_from_pw_multi_aff(
3479 __isl_take isl_pw_multi_aff *pma);
3481 #include <isl/polynomial.h>
3482 __isl_give isl_union_pw_qpolynomial *
3483 isl_union_pw_qpolynomial_from_pw_qpolynomial(
3484 __isl_take isl_pw_qpolynomial *pwqp);
3486 The following functions create a base expression on each
3487 of the sets in the union set and collect the results.
3489 #include <isl/aff.h>
3490 __isl_give isl_union_pw_multi_aff *
3491 isl_union_pw_multi_aff_from_union_pw_aff(
3492 __isl_take isl_union_pw_aff *upa);
3493 __isl_give isl_union_pw_aff *
3494 isl_union_pw_multi_aff_get_union_pw_aff(
3495 __isl_keep isl_union_pw_multi_aff *upma, int pos);
3496 __isl_give isl_union_pw_aff *
3497 isl_union_pw_aff_val_on_domain(
3498 __isl_take isl_union_set *domain,
3499 __isl_take isl_val *v);
3500 __isl_give isl_union_pw_multi_aff *
3501 isl_union_pw_multi_aff_multi_val_on_domain(
3502 __isl_take isl_union_set *domain,
3503 __isl_take isl_multi_val *mv);
3504 __isl_give isl_union_pw_aff *
3505 isl_union_pw_aff_param_on_domain_id(
3506 __isl_take isl_union_set *domain,
3507 __isl_take isl_id *id);
3509 The C<id> argument of C<isl_union_pw_aff_param_on_domain_id>
3510 is the identifier of a parameter that may or may not already
3511 be present in C<domain>.
3513 An C<isl_union_pw_aff> that is equal to a (parametric) affine
3515 expression on a given domain can be created using the following
3518 #include <isl/aff.h>
3519 __isl_give isl_union_pw_aff *
3520 isl_union_pw_aff_aff_on_domain(
3521 __isl_take isl_union_set *domain,
3522 __isl_take isl_aff *aff);
3523 __isl_give isl_union_pw_aff *
3524 isl_union_pw_aff_pw_aff_on_domain(
3525 __isl_take isl_union_set *domain,
3526 __isl_take isl_pw_aff *pa);
3528 A base expression can be added to a union expression using
3529 the following functions.
3531 #include <isl/aff.h>
3532 __isl_give isl_union_pw_aff *
3533 isl_union_pw_aff_add_pw_aff(
3534 __isl_take isl_union_pw_aff *upa,
3535 __isl_take isl_pw_aff *pa);
3536 __isl_give isl_union_pw_multi_aff *
3537 isl_union_pw_multi_aff_add_pw_multi_aff(
3538 __isl_take isl_union_pw_multi_aff *upma,
3539 __isl_take isl_pw_multi_aff *pma);
3541 #include <isl/polynomial.h>
3542 __isl_give isl_union_pw_qpolynomial *
3543 isl_union_pw_qpolynomial_add_pw_qpolynomial(
3544 __isl_take isl_union_pw_qpolynomial *upwqp,
3545 __isl_take isl_pw_qpolynomial *pwqp);
3547 Union expressions can be copied and freed using
3548 the following functions.
3550 #include <isl/aff.h>
3551 __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
3552 __isl_keep isl_union_pw_aff *upa);
3553 __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
3554 __isl_take isl_union_pw_aff *upa);
3555 __isl_give isl_union_pw_multi_aff *
3556 isl_union_pw_multi_aff_copy(
3557 __isl_keep isl_union_pw_multi_aff *upma);
3558 __isl_null isl_union_pw_multi_aff *
3559 isl_union_pw_multi_aff_free(
3560 __isl_take isl_union_pw_multi_aff *upma);
3562 #include <isl/polynomial.h>
3563 __isl_give isl_union_pw_qpolynomial *
3564 isl_union_pw_qpolynomial_copy(
3565 __isl_keep isl_union_pw_qpolynomial *upwqp);
3566 __isl_null isl_union_pw_qpolynomial *
3567 isl_union_pw_qpolynomial_free(
3568 __isl_take isl_union_pw_qpolynomial *upwqp);
3569 __isl_give isl_union_pw_qpolynomial_fold *
3570 isl_union_pw_qpolynomial_fold_copy(
3571 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3572 __isl_null isl_union_pw_qpolynomial_fold *
3573 isl_union_pw_qpolynomial_fold_free(
3574 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3576 To iterate over the base expressions in a union expression,
3577 use the following functions.
3579 #include <isl/aff.h>
3580 isl_size isl_union_pw_aff_n_pw_aff(
3581 __isl_keep isl_union_pw_aff *upa);
3582 isl_stat isl_union_pw_aff_foreach_pw_aff(
3583 __isl_keep isl_union_pw_aff *upa,
3584 isl_stat (*fn)(__isl_take isl_pw_aff *pa,
3585 void *user), void *user);
3586 isl_size isl_union_pw_multi_aff_n_pw_multi_aff(
3587 __isl_keep isl_union_pw_multi_aff *upma);
3588 isl_stat isl_union_pw_multi_aff_foreach_pw_multi_aff(
3589 __isl_keep isl_union_pw_multi_aff *upma,
3590 isl_stat (*fn)(__isl_take isl_pw_multi_aff *pma,
3591 void *user), void *user);
3593 #include <isl/polynomial.h>
3594 isl_size isl_union_pw_qpolynomial_n_pw_qpolynomial(
3595 __isl_keep isl_union_pw_qpolynomial *upwqp);
3596 isl_stat isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3597 __isl_keep isl_union_pw_qpolynomial *upwqp,
3598 isl_stat (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3599 void *user), void *user);
3600 isl_size isl_union_pw_qpolynomial_fold_n_pw_qpolynomial_fold(
3601 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3602 isl_stat isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3603 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3604 isl_stat (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3605 void *user), void *user);
3607 To extract the base expression in a given space from a union, use
3608 the following functions.
3610 #include <isl/aff.h>
3611 __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3612 __isl_keep isl_union_pw_aff *upa,
3613 __isl_take isl_space *space);
3614 __isl_give isl_pw_multi_aff *
3615 isl_union_pw_multi_aff_extract_pw_multi_aff(
3616 __isl_keep isl_union_pw_multi_aff *upma,
3617 __isl_take isl_space *space);
3619 #include <isl/polynomial.h>
3620 __isl_give isl_pw_qpolynomial *
3621 isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3622 __isl_keep isl_union_pw_qpolynomial *upwqp,
3623 __isl_take isl_space *space);
3625 It is also possible to obtain a list of the base expressions using
3626 the following functions.
3628 #include <isl/aff.h>
3629 __isl_give isl_pw_aff_list *
3630 isl_union_pw_aff_get_pw_aff_list(
3631 __isl_keep isl_union_pw_aff *upa);
3632 __isl_give isl_pw_multi_aff_list *
3633 isl_union_pw_multi_aff_get_pw_multi_aff_list(
3634 __isl_keep isl_union_pw_multi_aff *upma);
3636 #include <isl/polynomial.h>
3637 __isl_give isl_pw_qpolynomial_list *
3638 isl_union_pw_qpolynomial_get_pw_qpolynomial_list(
3639 __isl_keep isl_union_pw_qpolynomial *upwqp);
3640 __isl_give isl_pw_qpolynomial_fold_list *
3641 isl_union_pw_qpolynomial_fold_get_pw_qpolynomial_fold_list(
3642 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3644 The returned list can be manipulated using the functions in L<"Lists">.
3646 =head2 Input and Output
3648 For set and relation,
3649 C<isl> supports its own input/output format, which is similar
3650 to the C<Omega> format, but also supports the C<PolyLib> format
3652 For other object types, typically only an C<isl> format is supported.
3654 =head3 C<isl> format
3656 The C<isl> format is similar to that of C<Omega>, but has a different
3657 syntax for describing the parameters and allows for the definition
3658 of an existentially quantified variable as the integer division
3659 of an affine expression.
3660 For example, the set of integers C<i> between C<0> and C<n>
3661 such that C<i % 10 <= 6> can be described as
3663 [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3666 A set or relation can have several disjuncts, separated
3667 by the keyword C<or>. Each disjunct is either a conjunction
3668 of constraints or a projection (C<exists>) of a conjunction
3669 of constraints. The constraints are separated by the keyword
3672 =head3 C<PolyLib> format
3674 If the represented set is a union, then the first line
3675 contains a single number representing the number of disjuncts.
3676 Otherwise, a line containing the number C<1> is optional.
3678 Each disjunct is represented by a matrix of constraints.
3679 The first line contains two numbers representing
3680 the number of rows and columns,
3681 where the number of rows is equal to the number of constraints
3682 and the number of columns is equal to two plus the number of variables.
3683 The following lines contain the actual rows of the constraint matrix.
3684 In each row, the first column indicates whether the constraint
3685 is an equality (C<0>) or inequality (C<1>). The final column
3686 corresponds to the constant term.
3688 If the set is parametric, then the coefficients of the parameters
3689 appear in the last columns before the constant column.
3690 The coefficients of any existentially quantified variables appear
3691 between those of the set variables and those of the parameters.
3693 =head3 Extended C<PolyLib> format
3695 The extended C<PolyLib> format is nearly identical to the
3696 C<PolyLib> format. The only difference is that the line
3697 containing the number of rows and columns of a constraint matrix
3698 also contains four additional numbers:
3699 the number of output dimensions, the number of input dimensions,
3700 the number of local dimensions (i.e., the number of existentially
3701 quantified variables) and the number of parameters.
3702 For sets, the number of ``output'' dimensions is equal
3703 to the number of set dimensions, while the number of ``input''
3708 Objects can be read from input using the following functions.
3711 __isl_give isl_id *isl_id_read_from_str(isl_ctx *ctx,
3713 __isl_give isl_multi_id *isl_multi_id_read_from_str(
3714 isl_ctx *ctx, const char *str);
3716 #include <isl/val.h>
3717 __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3719 __isl_give isl_multi_val *isl_multi_val_read_from_str(
3720 isl_ctx *ctx, const char *str);
3722 #include <isl/set.h>
3723 __isl_give isl_basic_set *isl_basic_set_read_from_file(
3724 isl_ctx *ctx, FILE *input);
3725 __isl_give isl_basic_set *isl_basic_set_read_from_str(
3726 isl_ctx *ctx, const char *str);
3727 __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3729 __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3732 #include <isl/map.h>
3733 __isl_give isl_basic_map *isl_basic_map_read_from_file(
3734 isl_ctx *ctx, FILE *input);
3735 __isl_give isl_basic_map *isl_basic_map_read_from_str(
3736 isl_ctx *ctx, const char *str);
3737 __isl_give isl_map *isl_map_read_from_file(
3738 isl_ctx *ctx, FILE *input);
3739 __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3742 #include <isl/union_set.h>
3743 __isl_give isl_union_set *isl_union_set_read_from_file(
3744 isl_ctx *ctx, FILE *input);
3745 __isl_give isl_union_set *isl_union_set_read_from_str(
3746 isl_ctx *ctx, const char *str);
3748 #include <isl/union_map.h>
3749 __isl_give isl_union_map *isl_union_map_read_from_file(
3750 isl_ctx *ctx, FILE *input);
3751 __isl_give isl_union_map *isl_union_map_read_from_str(
3752 isl_ctx *ctx, const char *str);
3754 #include <isl/aff.h>
3755 __isl_give isl_aff *isl_aff_read_from_str(
3756 isl_ctx *ctx, const char *str);
3757 __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3758 isl_ctx *ctx, const char *str);
3759 __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3760 isl_ctx *ctx, const char *str);
3761 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3762 isl_ctx *ctx, const char *str);
3763 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3764 isl_ctx *ctx, const char *str);
3765 __isl_give isl_union_pw_aff *
3766 isl_union_pw_aff_read_from_str(
3767 isl_ctx *ctx, const char *str);
3768 __isl_give isl_union_pw_multi_aff *
3769 isl_union_pw_multi_aff_read_from_str(
3770 isl_ctx *ctx, const char *str);
3771 __isl_give isl_multi_union_pw_aff *
3772 isl_multi_union_pw_aff_read_from_str(
3773 isl_ctx *ctx, const char *str);
3775 #include <isl/polynomial.h>
3776 __isl_give isl_union_pw_qpolynomial *
3777 isl_union_pw_qpolynomial_read_from_str(
3778 isl_ctx *ctx, const char *str);
3780 For sets and relations,
3781 the input format is autodetected and may be either the C<PolyLib> format
3782 or the C<isl> format.
3786 Before anything can be printed, an C<isl_printer> needs to
3789 __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3791 __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3792 __isl_null isl_printer *isl_printer_free(
3793 __isl_take isl_printer *printer);
3795 C<isl_printer_to_file> prints to the given file, while
3796 C<isl_printer_to_str> prints to a string that can be extracted
3797 using the following function.
3799 #include <isl/printer.h>
3800 __isl_give char *isl_printer_get_str(
3801 __isl_keep isl_printer *printer);
3803 The printer can be inspected using the following functions.
3805 FILE *isl_printer_get_file(
3806 __isl_keep isl_printer *printer);
3807 int isl_printer_get_output_format(
3808 __isl_keep isl_printer *p);
3809 int isl_printer_get_yaml_style(__isl_keep isl_printer *p);
3811 The behavior of the printer can be modified in various ways
3813 __isl_give isl_printer *isl_printer_set_output_format(
3814 __isl_take isl_printer *p, int output_format);
3815 __isl_give isl_printer *isl_printer_set_indent(
3816 __isl_take isl_printer *p, int indent);
3817 __isl_give isl_printer *isl_printer_set_indent_prefix(
3818 __isl_take isl_printer *p, const char *prefix);
3819 __isl_give isl_printer *isl_printer_indent(
3820 __isl_take isl_printer *p, int indent);
3821 __isl_give isl_printer *isl_printer_set_prefix(
3822 __isl_take isl_printer *p, const char *prefix);
3823 __isl_give isl_printer *isl_printer_set_suffix(
3824 __isl_take isl_printer *p, const char *suffix);
3825 __isl_give isl_printer *isl_printer_set_yaml_style(
3826 __isl_take isl_printer *p, int yaml_style);
3828 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3829 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3830 and defaults to C<ISL_FORMAT_ISL>.
3831 Each line in the output is prefixed by C<indent_prefix>,
3832 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3833 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3834 In the C<PolyLib> format output,
3835 the coefficients of the existentially quantified variables
3836 appear between those of the set variables and those
3838 The function C<isl_printer_indent> increases the indentation
3839 by the specified amount (which may be negative).
3840 The YAML style may be either C<ISL_YAML_STYLE_BLOCK> or
3841 C<ISL_YAML_STYLE_FLOW> and when we are printing something
3844 To actually print something, use
3846 #include <isl/printer.h>
3847 __isl_give isl_printer *isl_printer_print_double(
3848 __isl_take isl_printer *p, double d);
3850 #include <isl/val.h>
3851 __isl_give isl_printer *isl_printer_print_val(
3852 __isl_take isl_printer *p, __isl_keep isl_val *v);
3854 #include <isl/set.h>
3855 __isl_give isl_printer *isl_printer_print_basic_set(
3856 __isl_take isl_printer *printer,
3857 __isl_keep isl_basic_set *bset);
3858 __isl_give isl_printer *isl_printer_print_set(
3859 __isl_take isl_printer *printer,
3860 __isl_keep isl_set *set);
3862 #include <isl/map.h>
3863 __isl_give isl_printer *isl_printer_print_basic_map(
3864 __isl_take isl_printer *printer,
3865 __isl_keep isl_basic_map *bmap);
3866 __isl_give isl_printer *isl_printer_print_map(
3867 __isl_take isl_printer *printer,
3868 __isl_keep isl_map *map);
3870 #include <isl/union_set.h>
3871 __isl_give isl_printer *isl_printer_print_union_set(
3872 __isl_take isl_printer *p,
3873 __isl_keep isl_union_set *uset);
3875 #include <isl/union_map.h>
3876 __isl_give isl_printer *isl_printer_print_union_map(
3877 __isl_take isl_printer *p,
3878 __isl_keep isl_union_map *umap);
3880 #include <isl/val.h>
3881 __isl_give isl_printer *isl_printer_print_multi_val(
3882 __isl_take isl_printer *p,
3883 __isl_keep isl_multi_val *mv);
3886 __isl_give isl_printer *isl_printer_print_multi_id(
3887 __isl_take isl_printer *p,
3888 __isl_keep isl_multi_id *mi);
3890 #include <isl/aff.h>
3891 __isl_give isl_printer *isl_printer_print_aff(
3892 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3893 __isl_give isl_printer *isl_printer_print_multi_aff(
3894 __isl_take isl_printer *p,
3895 __isl_keep isl_multi_aff *maff);
3896 __isl_give isl_printer *isl_printer_print_pw_aff(
3897 __isl_take isl_printer *p,
3898 __isl_keep isl_pw_aff *pwaff);
3899 __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3900 __isl_take isl_printer *p,
3901 __isl_keep isl_pw_multi_aff *pma);
3902 __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3903 __isl_take isl_printer *p,
3904 __isl_keep isl_multi_pw_aff *mpa);
3905 __isl_give isl_printer *isl_printer_print_union_pw_aff(
3906 __isl_take isl_printer *p,
3907 __isl_keep isl_union_pw_aff *upa);
3908 __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3909 __isl_take isl_printer *p,
3910 __isl_keep isl_union_pw_multi_aff *upma);
3911 __isl_give isl_printer *
3912 isl_printer_print_multi_union_pw_aff(
3913 __isl_take isl_printer *p,
3914 __isl_keep isl_multi_union_pw_aff *mupa);
3916 #include <isl/polynomial.h>
3917 __isl_give isl_printer *isl_printer_print_qpolynomial(
3918 __isl_take isl_printer *p,
3919 __isl_keep isl_qpolynomial *qp);
3920 __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3921 __isl_take isl_printer *p,
3922 __isl_keep isl_pw_qpolynomial *pwqp);
3923 __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3924 __isl_take isl_printer *p,
3925 __isl_keep isl_union_pw_qpolynomial *upwqp);
3927 __isl_give isl_printer *
3928 isl_printer_print_pw_qpolynomial_fold(
3929 __isl_take isl_printer *p,
3930 __isl_keep isl_pw_qpolynomial_fold *pwf);
3931 __isl_give isl_printer *
3932 isl_printer_print_union_pw_qpolynomial_fold(
3933 __isl_take isl_printer *p,
3934 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3936 For C<isl_printer_print_qpolynomial>,
3937 C<isl_printer_print_pw_qpolynomial> and
3938 C<isl_printer_print_pw_qpolynomial_fold>,
3939 the output format of the printer
3940 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3941 For C<isl_printer_print_union_pw_qpolynomial> and
3942 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3944 In case of printing in C<ISL_FORMAT_C>, the user may want
3945 to set the names of all dimensions first.
3947 C<isl> also provides limited support for printing YAML documents,
3948 just enough for the internal use for printing such documents.
3950 #include <isl/printer.h>
3951 __isl_give isl_printer *isl_printer_yaml_start_mapping(
3952 __isl_take isl_printer *p);
3953 __isl_give isl_printer *isl_printer_yaml_end_mapping(
3954 __isl_take isl_printer *p);
3955 __isl_give isl_printer *isl_printer_yaml_start_sequence(
3956 __isl_take isl_printer *p);
3957 __isl_give isl_printer *isl_printer_yaml_end_sequence(
3958 __isl_take isl_printer *p);
3959 __isl_give isl_printer *isl_printer_yaml_next(
3960 __isl_take isl_printer *p);
3962 A document is started by a call to either
3963 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3964 Anything printed to the printer after such a call belong to the
3965 first key of the mapping or the first element in the sequence.
3966 The function C<isl_printer_yaml_next> moves to the value if
3967 we are currently printing a mapping key, the next key if we
3968 are printing a value or the next element if we are printing
3969 an element in a sequence.
3970 Nested mappings and sequences are initiated by the same
3971 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3972 Each call to these functions needs to have a corresponding call to
3973 C<isl_printer_yaml_end_mapping> or C<isl_printer_yaml_end_sequence>.
3975 When called on a file printer, the following function flushes
3976 the file. When called on a string printer, the buffer is cleared.
3978 __isl_give isl_printer *isl_printer_flush(
3979 __isl_take isl_printer *p);
3981 The following functions allow the user to attach
3982 notes to a printer in order to keep track of additional state.
3984 #include <isl/printer.h>
3985 isl_bool isl_printer_has_note(__isl_keep isl_printer *p,
3986 __isl_keep isl_id *id);
3987 __isl_give isl_id *isl_printer_get_note(
3988 __isl_keep isl_printer *p, __isl_take isl_id *id);
3989 __isl_give isl_printer *isl_printer_set_note(
3990 __isl_take isl_printer *p,
3991 __isl_take isl_id *id, __isl_take isl_id *note);
3993 C<isl_printer_set_note> associates the given note to the given
3994 identifier in the printer.
3995 C<isl_printer_get_note> retrieves a note associated to an
3997 C<isl_printer_has_note> checks if there is such a note.
3998 C<isl_printer_get_note> fails if the requested note does not exist.
4000 Alternatively, a string representation can be obtained
4001 directly using the following functions, which always print
4005 __isl_give char *isl_id_to_str(
4006 __isl_keep isl_id *id);
4007 __isl_give char *isl_multi_id_to_str(
4008 __isl_keep isl_multi_id *mi);
4010 #include <isl/space.h>
4011 __isl_give char *isl_space_to_str(
4012 __isl_keep isl_space *space);
4014 #include <isl/val.h>
4015 __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
4016 __isl_give char *isl_multi_val_to_str(
4017 __isl_keep isl_multi_val *mv);
4019 #include <isl/set.h>
4020 __isl_give char *isl_basic_set_to_str(
4021 __isl_keep isl_basic_set *bset);
4022 __isl_give char *isl_set_to_str(
4023 __isl_keep isl_set *set);
4025 #include <isl/union_set.h>
4026 __isl_give char *isl_union_set_to_str(
4027 __isl_keep isl_union_set *uset);
4029 #include <isl/map.h>
4030 __isl_give char *isl_basic_map_to_str(
4031 __isl_keep isl_basic_map *bmap);
4032 __isl_give char *isl_map_to_str(
4033 __isl_keep isl_map *map);
4035 #include <isl/union_map.h>
4036 __isl_give char *isl_union_map_to_str(
4037 __isl_keep isl_union_map *umap);
4039 #include <isl/aff.h>
4040 __isl_give char *isl_aff_to_str(__isl_keep isl_aff *aff);
4041 __isl_give char *isl_pw_aff_to_str(
4042 __isl_keep isl_pw_aff *pa);
4043 __isl_give char *isl_multi_aff_to_str(
4044 __isl_keep isl_multi_aff *ma);
4045 __isl_give char *isl_pw_multi_aff_to_str(
4046 __isl_keep isl_pw_multi_aff *pma);
4047 __isl_give char *isl_multi_pw_aff_to_str(
4048 __isl_keep isl_multi_pw_aff *mpa);
4049 __isl_give char *isl_union_pw_aff_to_str(
4050 __isl_keep isl_union_pw_aff *upa);
4051 __isl_give char *isl_union_pw_multi_aff_to_str(
4052 __isl_keep isl_union_pw_multi_aff *upma);
4053 __isl_give char *isl_multi_union_pw_aff_to_str(
4054 __isl_keep isl_multi_union_pw_aff *mupa);
4056 #include <isl/point.h>
4057 __isl_give char *isl_point_to_str(
4058 __isl_keep isl_point *pnt);
4060 #include <isl/polynomial.h>
4061 __isl_give char *isl_pw_qpolynomial_to_str(
4062 __isl_keep isl_pw_qpolynomial *pwqp);
4063 __isl_give char *isl_union_pw_qpolynomial_to_str(
4064 __isl_keep isl_union_pw_qpolynomial *upwqp);
4068 =head3 Unary Properties
4074 The following functions test whether the given set or relation
4075 contains any integer points. The ``plain'' variants do not perform
4076 any computations, but simply check if the given set or relation
4077 is already known to be empty.
4079 #include <isl/set.h>
4080 isl_bool isl_basic_set_plain_is_empty(
4081 __isl_keep isl_basic_set *bset);
4082 isl_bool isl_basic_set_is_empty(
4083 __isl_keep isl_basic_set *bset);
4084 isl_bool isl_set_plain_is_empty(
4085 __isl_keep isl_set *set);
4086 isl_bool isl_set_is_empty(__isl_keep isl_set *set);
4088 #include <isl/union_set.h>
4089 isl_bool isl_union_set_is_empty(
4090 __isl_keep isl_union_set *uset);
4092 #include <isl/map.h>
4093 isl_bool isl_basic_map_plain_is_empty(
4094 __isl_keep isl_basic_map *bmap);
4095 isl_bool isl_basic_map_is_empty(
4096 __isl_keep isl_basic_map *bmap);
4097 isl_bool isl_map_plain_is_empty(
4098 __isl_keep isl_map *map);
4099 isl_bool isl_map_is_empty(__isl_keep isl_map *map);
4101 #include <isl/union_map.h>
4102 isl_bool isl_union_map_plain_is_empty(
4103 __isl_keep isl_union_map *umap);
4104 isl_bool isl_union_map_is_empty(
4105 __isl_keep isl_union_map *umap);
4107 =item * Universality
4109 isl_bool isl_basic_set_plain_is_universe(
4110 __isl_keep isl_basic_set *bset);
4111 isl_bool isl_basic_set_is_universe(
4112 __isl_keep isl_basic_set *bset);
4113 isl_bool isl_basic_map_plain_is_universe(
4114 __isl_keep isl_basic_map *bmap);
4115 isl_bool isl_basic_map_is_universe(
4116 __isl_keep isl_basic_map *bmap);
4117 isl_bool isl_set_plain_is_universe(
4118 __isl_keep isl_set *set);
4119 isl_bool isl_map_plain_is_universe(
4120 __isl_keep isl_map *map);
4122 =item * Single-valuedness
4124 #include <isl/set.h>
4125 isl_bool isl_set_is_singleton(__isl_keep isl_set *set);
4127 #include <isl/map.h>
4128 isl_bool isl_basic_map_is_single_valued(
4129 __isl_keep isl_basic_map *bmap);
4130 isl_bool isl_map_plain_is_single_valued(
4131 __isl_keep isl_map *map);
4132 isl_bool isl_map_is_single_valued(__isl_keep isl_map *map);
4134 #include <isl/union_map.h>
4135 isl_bool isl_union_map_is_single_valued(
4136 __isl_keep isl_union_map *umap);
4140 isl_bool isl_map_plain_is_injective(
4141 __isl_keep isl_map *map);
4142 isl_bool isl_map_is_injective(
4143 __isl_keep isl_map *map);
4144 isl_bool isl_union_map_plain_is_injective(
4145 __isl_keep isl_union_map *umap);
4146 isl_bool isl_union_map_is_injective(
4147 __isl_keep isl_union_map *umap);
4151 isl_bool isl_map_is_bijective(
4152 __isl_keep isl_map *map);
4153 isl_bool isl_union_map_is_bijective(
4154 __isl_keep isl_union_map *umap);
4158 The following functions test whether the given relation
4159 only maps elements to themselves.
4161 #include <isl/map.h>
4162 isl_bool isl_map_is_identity(
4163 __isl_keep isl_map *map);
4165 #include <isl/union_map.h>
4166 isl_bool isl_union_map_is_identity(
4167 __isl_keep isl_union_map *umap);
4171 __isl_give isl_val *
4172 isl_basic_map_plain_get_val_if_fixed(
4173 __isl_keep isl_basic_map *bmap,
4174 enum isl_dim_type type, unsigned pos);
4175 __isl_give isl_val *isl_set_plain_get_val_if_fixed(
4176 __isl_keep isl_set *set,
4177 enum isl_dim_type type, unsigned pos);
4178 __isl_give isl_val *isl_map_plain_get_val_if_fixed(
4179 __isl_keep isl_map *map,
4180 enum isl_dim_type type, unsigned pos);
4182 If the set or relation obviously lies on a hyperplane where the given dimension
4183 has a fixed value, then return that value.
4184 Otherwise return NaN.
4188 isl_stat isl_set_dim_residue_class_val(
4189 __isl_keep isl_set *set,
4190 int pos, __isl_give isl_val **modulo,
4191 __isl_give isl_val **residue);
4193 Check if the values of the given set dimension are equal to a fixed
4194 value modulo some integer value. If so, assign the modulo to C<*modulo>
4195 and the fixed value to C<*residue>. If the given dimension attains only
4196 a single value, then assign C<0> to C<*modulo> and the fixed value to
4198 If the dimension does not attain only a single value and if no modulo
4199 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
4201 #include <isl/set.h>
4202 __isl_give isl_stride_info *isl_set_get_stride_info(
4203 __isl_keep isl_set *set, int pos);
4204 __isl_give isl_val *isl_set_get_stride(
4205 __isl_keep isl_set *set, int pos);
4207 #include <isl/map.h>
4208 __isl_give isl_stride_info *
4209 isl_map_get_range_stride_info(
4210 __isl_keep isl_map *map, int pos);
4212 Check if the values of the given set dimension are equal to
4213 some affine expression of the other dimensions (the offset)
4214 modulo some integer stride or
4215 check if the values of the given output dimensions are equal to
4216 some affine expression of the input dimensions (the offset)
4217 modulo some integer stride.
4218 If no more specific information can be found, then the stride
4219 is taken to be one and the offset is taken to be the zero expression.
4220 The function C<isl_set_get_stride> performs the same
4221 computation as C<isl_set_get_stride_info> but only returns the stride.
4222 For the other functions,
4223 the stride and offset can be extracted from the returned object
4224 using the following functions.
4226 #include <isl/stride_info.h>
4227 __isl_give isl_val *isl_stride_info_get_stride(
4228 __isl_keep isl_stride_info *si);
4229 __isl_give isl_aff *isl_stride_info_get_offset(
4230 __isl_keep isl_stride_info *si);
4232 The stride info object can be copied and released using the following
4235 #include <isl/stride_info.h>
4236 __isl_give isl_stride_info *isl_stride_info_copy(
4237 __isl_keep isl_stride_info *si);
4238 __isl_null isl_stride_info *isl_stride_info_free(
4239 __isl_take isl_stride_info *si);
4243 To check whether the description of a set, relation or function depends
4244 on a parameter or one or more given dimensions,
4245 the following functions can be used.
4247 #include <isl/constraint.h>
4248 isl_bool isl_constraint_involves_dims(
4249 __isl_keep isl_constraint *constraint,
4250 enum isl_dim_type type, unsigned first, unsigned n);
4252 #include <isl/set.h>
4253 isl_bool isl_basic_set_involves_dims(
4254 __isl_keep isl_basic_set *bset,
4255 enum isl_dim_type type, unsigned first, unsigned n);
4256 isl_bool isl_set_involves_dims(__isl_keep isl_set *set,
4257 enum isl_dim_type type, unsigned first, unsigned n);
4259 #include <isl/map.h>
4260 isl_bool isl_basic_map_involves_dims(
4261 __isl_keep isl_basic_map *bmap,
4262 enum isl_dim_type type, unsigned first, unsigned n);
4263 isl_bool isl_map_involves_dims(__isl_keep isl_map *map,
4264 enum isl_dim_type type, unsigned first, unsigned n);
4266 #include <isl/union_map.h>
4267 isl_bool isl_union_map_involves_dims(
4268 __isl_keep isl_union_map *umap,
4269 enum isl_dim_type type, unsigned first, unsigned n);
4271 #include <isl/aff.h>
4272 isl_bool isl_aff_involves_dims(__isl_keep isl_aff *aff,
4273 enum isl_dim_type type, unsigned first, unsigned n);
4274 isl_bool isl_pw_aff_involves_param_id(
4275 __isl_keep isl_pw_aff *pa,
4276 __isl_keep isl_id *id);
4277 isl_bool isl_pw_aff_involves_dims(
4278 __isl_keep isl_pw_aff *pwaff,
4279 enum isl_dim_type type, unsigned first, unsigned n);
4280 isl_bool isl_multi_aff_involves_dims(
4281 __isl_keep isl_multi_aff *ma,
4282 enum isl_dim_type type, unsigned first, unsigned n);
4283 isl_bool isl_pw_multi_aff_involves_param_id(
4284 __isl_keep isl_pw_multi_aff *pma,
4285 __isl_keep isl_id *id);
4286 isl_bool isl_pw_multi_aff_involves_dims(
4287 __isl_keep isl_pw_multi_aff *pma,
4288 enum isl_dim_type type, unsigned first, unsigned n);
4289 isl_bool isl_multi_pw_aff_involves_dims(
4290 __isl_keep isl_multi_pw_aff *mpa,
4291 enum isl_dim_type type, unsigned first, unsigned n);
4292 isl_bool isl_multi_pw_aff_involves_param_id(
4293 __isl_keep isl_multi_pw_aff *mpa,
4294 __isl_keep isl_id *id);
4295 isl_bool isl_multi_pw_aff_involves_param_id_list(
4296 __isl_keep isl_multi_pw_aff *mpa,
4297 __isl_keep isl_id_list *list);
4299 #include <isl/polynomial.h>
4300 isl_bool isl_qpolynomial_involves_dims(
4301 __isl_keep isl_qpolynomial *qp,
4302 enum isl_dim_type type, unsigned first, unsigned n);
4303 isl_bool isl_pw_qpolynomial_involves_param_id(
4304 __isl_keep isl_pw_qpolynomial *pwqp,
4305 __isl_keep isl_id *id);
4306 isl_bool isl_pw_qpolynomial_fold_involves_param_id(
4307 __isl_keep isl_pw_qpolynomial_fold *pwf,
4308 __isl_keep isl_id *id);
4310 Similarly, the following functions can be used to check whether
4311 a given dimension is involved in any lower or upper bound.
4313 #include <isl/set.h>
4314 isl_bool isl_set_dim_has_any_lower_bound(
4315 __isl_keep isl_set *set,
4316 enum isl_dim_type type, unsigned pos);
4317 isl_bool isl_set_dim_has_any_upper_bound(
4318 __isl_keep isl_set *set,
4319 enum isl_dim_type type, unsigned pos);
4321 Note that these functions return true even if there is a bound on
4322 the dimension on only some of the basic sets of C<set>.
4323 To check if they have a bound for all of the basic sets in C<set>,
4324 use the following functions instead.
4326 #include <isl/set.h>
4327 isl_bool isl_set_dim_has_lower_bound(
4328 __isl_keep isl_set *set,
4329 enum isl_dim_type type, unsigned pos);
4330 isl_bool isl_set_dim_has_upper_bound(
4331 __isl_keep isl_set *set,
4332 enum isl_dim_type type, unsigned pos);
4336 To check whether a set is a parameter domain, use this function:
4338 isl_bool isl_set_is_params(__isl_keep isl_set *set);
4339 isl_bool isl_union_set_is_params(
4340 __isl_keep isl_union_set *uset);
4344 The following functions check whether the space of the given
4345 (basic) set or relation domain and/or range is a wrapped relation.
4347 #include <isl/space.h>
4348 isl_bool isl_space_is_wrapping(
4349 __isl_keep isl_space *space);
4350 isl_bool isl_space_domain_is_wrapping(
4351 __isl_keep isl_space *space);
4352 isl_bool isl_space_range_is_wrapping(
4353 __isl_keep isl_space *space);
4354 isl_bool isl_space_is_product(
4355 __isl_keep isl_space *space);
4357 #include <isl/set.h>
4358 isl_bool isl_basic_set_is_wrapping(
4359 __isl_keep isl_basic_set *bset);
4360 isl_bool isl_set_is_wrapping(__isl_keep isl_set *set);
4362 #include <isl/map.h>
4363 isl_bool isl_map_domain_is_wrapping(
4364 __isl_keep isl_map *map);
4365 isl_bool isl_map_range_is_wrapping(
4366 __isl_keep isl_map *map);
4367 isl_bool isl_map_is_product(__isl_keep isl_map *map);
4370 isl_bool isl_multi_id_range_is_wrapping(
4371 __isl_keep isl_multi_id *mi);
4373 #include <isl/val.h>
4374 isl_bool isl_multi_val_range_is_wrapping(
4375 __isl_keep isl_multi_val *mv);
4377 #include <isl/aff.h>
4378 isl_bool isl_multi_aff_range_is_wrapping(
4379 __isl_keep isl_multi_aff *ma);
4380 isl_bool isl_multi_pw_aff_range_is_wrapping(
4381 __isl_keep isl_multi_pw_aff *mpa);
4382 isl_bool isl_multi_union_pw_aff_range_is_wrapping(
4383 __isl_keep isl_multi_union_pw_aff *mupa);
4385 The input to C<isl_space_is_wrapping> should
4386 be the space of a set, while that of
4387 C<isl_space_domain_is_wrapping> and
4388 C<isl_space_range_is_wrapping> should be the space of a relation.
4389 The input to C<isl_space_is_product> can be either the space
4390 of a set or that of a binary relation.
4391 In case the input is the space of a binary relation, it checks
4392 whether both domain and range are wrapping.
4394 =item * Internal Product
4396 isl_bool isl_basic_map_can_zip(
4397 __isl_keep isl_basic_map *bmap);
4398 isl_bool isl_map_can_zip(__isl_keep isl_map *map);
4400 Check whether the product of domain and range of the given relation
4402 i.e., whether both domain and range are nested relations.
4406 #include <isl/space.h>
4407 isl_bool isl_space_can_curry(
4408 __isl_keep isl_space *space);
4410 #include <isl/map.h>
4411 isl_bool isl_basic_map_can_curry(
4412 __isl_keep isl_basic_map *bmap);
4413 isl_bool isl_map_can_curry(__isl_keep isl_map *map);
4415 Check whether the domain of the (basic) relation is a wrapped relation.
4417 #include <isl/space.h>
4418 __isl_give isl_space *isl_space_uncurry(
4419 __isl_take isl_space *space);
4421 #include <isl/map.h>
4422 isl_bool isl_basic_map_can_uncurry(
4423 __isl_keep isl_basic_map *bmap);
4424 isl_bool isl_map_can_uncurry(__isl_keep isl_map *map);
4426 Check whether the range of the (basic) relation is a wrapped relation.
4428 #include <isl/space.h>
4429 isl_bool isl_space_can_range_curry(
4430 __isl_keep isl_space *space);
4432 #include <isl/map.h>
4433 isl_bool isl_map_can_range_curry(
4434 __isl_keep isl_map *map);
4436 Check whether the domain of the relation wrapped in the range of
4437 the input is itself a wrapped relation.
4439 =item * Special Values
4441 #include <isl/aff.h>
4442 isl_bool isl_aff_is_cst(__isl_keep isl_aff *aff);
4443 isl_bool isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
4444 isl_bool isl_multi_pw_aff_is_cst(
4445 __isl_keep isl_multi_pw_aff *mpa);
4447 Check whether the given expression is a constant.
4449 #include <isl/val.h>
4450 isl_bool isl_multi_val_involves_nan(
4451 __isl_keep isl_multi_val *mv);
4453 #include <isl/aff.h>
4454 isl_bool isl_aff_is_nan(__isl_keep isl_aff *aff);
4455 isl_bool isl_multi_aff_involves_nan(
4456 __isl_keep isl_multi_aff *ma);
4457 isl_bool isl_pw_aff_involves_nan(
4458 __isl_keep isl_pw_aff *pa);
4459 isl_bool isl_pw_multi_aff_involves_nan(
4460 __isl_keep isl_pw_multi_aff *pma);
4461 isl_bool isl_multi_pw_aff_involves_nan(
4462 __isl_keep isl_multi_pw_aff *mpa);
4463 isl_bool isl_union_pw_aff_involves_nan(
4464 __isl_keep isl_union_pw_aff *upa);
4465 isl_bool isl_union_pw_multi_aff_involves_nan(
4466 __isl_keep isl_union_pw_multi_aff *upma);
4467 isl_bool isl_multi_union_pw_aff_involves_nan(
4468 __isl_keep isl_multi_union_pw_aff *mupa);
4470 #include <isl/polynomial.h>
4471 isl_bool isl_qpolynomial_is_nan(
4472 __isl_keep isl_qpolynomial *qp);
4473 isl_bool isl_qpolynomial_fold_is_nan(
4474 __isl_keep isl_qpolynomial_fold *fold);
4475 isl_bool isl_pw_qpolynomial_involves_nan(
4476 __isl_keep isl_pw_qpolynomial *pwqp);
4477 isl_bool isl_pw_qpolynomial_fold_involves_nan(
4478 __isl_keep isl_pw_qpolynomial_fold *pwf);
4479 isl_bool isl_union_pw_qpolynomial_involves_nan(
4480 __isl_keep isl_union_pw_qpolynomial *upwqp);
4481 isl_bool isl_union_pw_qpolynomial_fold_involves_nan(
4482 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
4484 Check whether the given expression is equal to or involves NaN.
4486 #include <isl/aff.h>
4487 isl_bool isl_aff_plain_is_zero(
4488 __isl_keep isl_aff *aff);
4490 Check whether the affine expression is obviously zero.
4494 =head3 Binary Properties
4500 The following functions check whether two objects
4501 represent the same set, relation or function.
4502 The C<plain> variants only return true if the objects
4503 are obviously the same. That is, they may return false
4504 even if the objects are the same, but they will never
4505 return true if the objects are not the same.
4507 #include <isl/set.h>
4508 isl_bool isl_basic_set_plain_is_equal(
4509 __isl_keep isl_basic_set *bset1,
4510 __isl_keep isl_basic_set *bset2);
4511 isl_bool isl_basic_set_is_equal(
4512 __isl_keep isl_basic_set *bset1,
4513 __isl_keep isl_basic_set *bset2);
4514 isl_bool isl_set_plain_is_equal(
4515 __isl_keep isl_set *set1,
4516 __isl_keep isl_set *set2);
4517 isl_bool isl_set_is_equal(__isl_keep isl_set *set1,
4518 __isl_keep isl_set *set2);
4520 #include <isl/map.h>
4521 isl_bool isl_basic_map_is_equal(
4522 __isl_keep isl_basic_map *bmap1,
4523 __isl_keep isl_basic_map *bmap2);
4524 isl_bool isl_map_is_equal(__isl_keep isl_map *map1,
4525 __isl_keep isl_map *map2);
4526 isl_bool isl_map_plain_is_equal(
4527 __isl_keep isl_map *map1,
4528 __isl_keep isl_map *map2);
4530 #include <isl/union_set.h>
4531 isl_bool isl_union_set_is_equal(
4532 __isl_keep isl_union_set *uset1,
4533 __isl_keep isl_union_set *uset2);
4535 #include <isl/union_map.h>
4536 isl_bool isl_union_map_is_equal(
4537 __isl_keep isl_union_map *umap1,
4538 __isl_keep isl_union_map *umap2);
4541 isl_bool isl_multi_id_plain_is_equal(
4542 __isl_keep isl_multi_id *mi1,
4543 __isl_keep isl_multi_id *mi2);
4545 #include <isl/val.h>
4546 isl_bool isl_multi_val_plain_is_equal(
4547 __isl_keep isl_multi_val *mv1,
4548 __isl_keep isl_multi_val *mv2);
4550 #include <isl/aff.h>
4551 isl_bool isl_aff_plain_is_equal(
4552 __isl_keep isl_aff *aff1,
4553 __isl_keep isl_aff *aff2);
4554 isl_bool isl_multi_aff_plain_is_equal(
4555 __isl_keep isl_multi_aff *maff1,
4556 __isl_keep isl_multi_aff *maff2);
4557 isl_bool isl_pw_aff_plain_is_equal(
4558 __isl_keep isl_pw_aff *pwaff1,
4559 __isl_keep isl_pw_aff *pwaff2);
4560 isl_bool isl_pw_aff_is_equal(
4561 __isl_keep isl_pw_aff *pa1,
4562 __isl_keep isl_pw_aff *pa2);
4563 isl_bool isl_pw_multi_aff_plain_is_equal(
4564 __isl_keep isl_pw_multi_aff *pma1,
4565 __isl_keep isl_pw_multi_aff *pma2);
4566 isl_bool isl_pw_multi_aff_is_equal(
4567 __isl_keep isl_pw_multi_aff *pma1,
4568 __isl_keep isl_pw_multi_aff *pma2);
4569 isl_bool isl_multi_pw_aff_plain_is_equal(
4570 __isl_keep isl_multi_pw_aff *mpa1,
4571 __isl_keep isl_multi_pw_aff *mpa2);
4572 isl_bool isl_multi_pw_aff_is_equal(
4573 __isl_keep isl_multi_pw_aff *mpa1,
4574 __isl_keep isl_multi_pw_aff *mpa2);
4575 isl_bool isl_union_pw_aff_plain_is_equal(
4576 __isl_keep isl_union_pw_aff *upa1,
4577 __isl_keep isl_union_pw_aff *upa2);
4578 isl_bool isl_union_pw_multi_aff_plain_is_equal(
4579 __isl_keep isl_union_pw_multi_aff *upma1,
4580 __isl_keep isl_union_pw_multi_aff *upma2);
4581 isl_bool isl_multi_union_pw_aff_plain_is_equal(
4582 __isl_keep isl_multi_union_pw_aff *mupa1,
4583 __isl_keep isl_multi_union_pw_aff *mupa2);
4585 #include <isl/polynomial.h>
4586 isl_bool isl_union_pw_qpolynomial_plain_is_equal(
4587 __isl_keep isl_union_pw_qpolynomial *upwqp1,
4588 __isl_keep isl_union_pw_qpolynomial *upwqp2);
4589 isl_bool isl_union_pw_qpolynomial_fold_plain_is_equal(
4590 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
4591 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
4593 =item * Disjointness
4595 #include <isl/set.h>
4596 isl_bool isl_basic_set_is_disjoint(
4597 __isl_keep isl_basic_set *bset1,
4598 __isl_keep isl_basic_set *bset2);
4599 isl_bool isl_set_plain_is_disjoint(
4600 __isl_keep isl_set *set1,
4601 __isl_keep isl_set *set2);
4602 isl_bool isl_set_is_disjoint(__isl_keep isl_set *set1,
4603 __isl_keep isl_set *set2);
4605 #include <isl/map.h>
4606 isl_bool isl_basic_map_is_disjoint(
4607 __isl_keep isl_basic_map *bmap1,
4608 __isl_keep isl_basic_map *bmap2);
4609 isl_bool isl_map_is_disjoint(__isl_keep isl_map *map1,
4610 __isl_keep isl_map *map2);
4612 #include <isl/union_set.h>
4613 isl_bool isl_union_set_is_disjoint(
4614 __isl_keep isl_union_set *uset1,
4615 __isl_keep isl_union_set *uset2);
4617 #include <isl/union_map.h>
4618 isl_bool isl_union_map_is_disjoint(
4619 __isl_keep isl_union_map *umap1,
4620 __isl_keep isl_union_map *umap2);
4624 isl_bool isl_basic_set_is_subset(
4625 __isl_keep isl_basic_set *bset1,
4626 __isl_keep isl_basic_set *bset2);
4627 isl_bool isl_set_is_subset(__isl_keep isl_set *set1,
4628 __isl_keep isl_set *set2);
4629 isl_bool isl_set_is_strict_subset(
4630 __isl_keep isl_set *set1,
4631 __isl_keep isl_set *set2);
4632 isl_bool isl_union_set_is_subset(
4633 __isl_keep isl_union_set *uset1,
4634 __isl_keep isl_union_set *uset2);
4635 isl_bool isl_union_set_is_strict_subset(
4636 __isl_keep isl_union_set *uset1,
4637 __isl_keep isl_union_set *uset2);
4638 isl_bool isl_basic_map_is_subset(
4639 __isl_keep isl_basic_map *bmap1,
4640 __isl_keep isl_basic_map *bmap2);
4641 isl_bool isl_basic_map_is_strict_subset(
4642 __isl_keep isl_basic_map *bmap1,
4643 __isl_keep isl_basic_map *bmap2);
4644 isl_bool isl_map_is_subset(
4645 __isl_keep isl_map *map1,
4646 __isl_keep isl_map *map2);
4647 isl_bool isl_map_is_strict_subset(
4648 __isl_keep isl_map *map1,
4649 __isl_keep isl_map *map2);
4650 isl_bool isl_union_map_is_subset(
4651 __isl_keep isl_union_map *umap1,
4652 __isl_keep isl_union_map *umap2);
4653 isl_bool isl_union_map_is_strict_subset(
4654 __isl_keep isl_union_map *umap1,
4655 __isl_keep isl_union_map *umap2);
4657 Check whether the first argument is a (strict) subset of the
4662 Every comparison function returns a negative value if the first
4663 argument is considered smaller than the second, a positive value
4664 if the first argument is considered greater and zero if the two
4665 constraints are considered the same by the comparison criterion.
4667 #include <isl/constraint.h>
4668 int isl_constraint_plain_cmp(
4669 __isl_keep isl_constraint *c1,
4670 __isl_keep isl_constraint *c2);
4672 This function is useful for sorting C<isl_constraint>s.
4673 The order depends on the internal representation of the inputs.
4674 The order is fixed over different calls to the function (assuming
4675 the internal representation of the inputs has not changed), but may
4676 change over different versions of C<isl>.
4678 #include <isl/constraint.h>
4679 int isl_constraint_cmp_last_non_zero(
4680 __isl_keep isl_constraint *c1,
4681 __isl_keep isl_constraint *c2);
4683 This function can be used to sort constraints that live in the same
4684 local space. Constraints that involve ``earlier'' dimensions or
4685 that have a smaller coefficient for the shared latest dimension
4686 are considered smaller than other constraints.
4687 This function only defines a B<partial> order.
4689 #include <isl/set.h>
4690 int isl_set_plain_cmp(__isl_keep isl_set *set1,
4691 __isl_keep isl_set *set2);
4693 This function is useful for sorting C<isl_set>s.
4694 The order depends on the internal representation of the inputs.
4695 The order is fixed over different calls to the function (assuming
4696 the internal representation of the inputs has not changed), but may
4697 change over different versions of C<isl>.
4699 #include <isl/aff.h>
4700 int isl_multi_aff_plain_cmp(
4701 __isl_keep isl_multi_aff *ma1,
4702 __isl_keep isl_multi_aff *ma2);
4703 int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
4704 __isl_keep isl_pw_aff *pa2);
4706 The functions C<isl_multi_aff_plain_cmp> and
4707 C<isl_pw_aff_plain_cmp> can be used to sort C<isl_multi_aff>s and
4708 C<isl_pw_aff>s. The order is not strictly defined.
4709 The current order sorts expressions that only involve
4710 earlier dimensions before those that involve later dimensions.
4714 =head2 Unary Operations
4720 __isl_give isl_set *isl_set_complement(
4721 __isl_take isl_set *set);
4722 __isl_give isl_map *isl_map_complement(
4723 __isl_take isl_map *map);
4727 #include <isl/space.h>
4728 __isl_give isl_space *isl_space_reverse(
4729 __isl_take isl_space *space);
4731 #include <isl/map.h>
4732 __isl_give isl_basic_map *isl_basic_map_reverse(
4733 __isl_take isl_basic_map *bmap);
4734 __isl_give isl_map *isl_map_reverse(
4735 __isl_take isl_map *map);
4737 #include <isl/union_map.h>
4738 __isl_give isl_union_map *isl_union_map_reverse(
4739 __isl_take isl_union_map *umap);
4741 =item * Tuple binding
4743 The following function binds
4744 a tuple to a sequence of parameter identifiers, equating
4745 the tuple dimensions to the parameters with those identifiers and
4746 subsequently projecting out the tuple.
4747 If the original object did not reference any such parameters,
4748 then this means that the tuple dimensions are reinterpreted
4750 The space of C<tuple> needs to match that of the bound tuple.
4752 #include <isl/set.h>
4753 __isl_give isl_set *isl_set_bind(
4754 __isl_take isl_set *set,
4755 __isl_take isl_multi_id *tuple);
4757 #include <isl/map.h>
4758 __isl_give isl_set *isl_map_bind_domain(
4759 __isl_take isl_map *map,
4760 __isl_take isl_multi_id *tuple);
4761 __isl_give isl_set *isl_map_bind_range(
4762 __isl_take isl_map *map,
4763 __isl_take isl_multi_id *tuple);
4765 #include <isl/aff.h>
4766 __isl_give isl_pw_aff *isl_pw_aff_bind_domain(
4767 __isl_take isl_pw_aff *pa,
4768 __isl_take isl_multi_id *tuple);
4769 __isl_give isl_multi_aff *isl_multi_aff_bind_domain(
4770 __isl_take isl_multi_aff *ma,
4771 __isl_take isl_multi_id *tuple);
4772 __isl_give isl_pw_multi_aff *
4773 isl_pw_multi_aff_bind_domain(
4774 __isl_take isl_pw_multi_aff *pma,
4775 __isl_take isl_multi_id *tuple);
4776 __isl_give isl_multi_pw_aff *
4777 isl_multi_pw_aff_bind_domain(
4778 __isl_take isl_multi_pw_aff *mpa,
4779 __isl_take isl_multi_id *tuple);
4780 __isl_give isl_pw_aff *
4781 isl_pw_aff_bind_domain_wrapped_domain(
4782 __isl_take isl_pw_aff *pa,
4783 __isl_take isl_multi_id *tuple);
4784 __isl_give isl_multi_aff *
4785 isl_multi_aff_bind_domain_wrapped_domain(
4786 __isl_take isl_multi_aff *ma,
4787 __isl_take isl_multi_id *tuple);
4788 __isl_give isl_pw_multi_aff *
4789 isl_pw_multi_aff_bind_domain_wrapped_domain(
4790 __isl_take isl_pw_multi_aff *pma,
4791 __isl_take isl_multi_id *tuple);
4792 __isl_give isl_multi_pw_aff *
4793 isl_multi_pw_aff_bind_domain_wrapped_domain(
4794 __isl_take isl_multi_pw_aff *mpa,
4795 __isl_take isl_multi_id *tuple);
4796 __isl_give isl_basic_set *isl_aff_bind_id(
4797 __isl_take isl_aff *aff,
4798 __isl_take isl_id *id);
4799 __isl_give isl_set *isl_pw_aff_bind_id(
4800 __isl_take isl_pw_aff *pa,
4801 __isl_take isl_id *id);
4802 __isl_give isl_basic_set *isl_multi_aff_bind(
4803 __isl_take isl_multi_aff *ma,
4804 __isl_take isl_multi_id *tuple);
4805 __isl_give isl_set *isl_multi_pw_aff_bind(
4806 __isl_take isl_multi_pw_aff *mpa,
4807 __isl_take isl_multi_id *tuple);
4808 __isl_give isl_union_set *isl_union_pw_aff_bind_id(
4809 __isl_take isl_union_pw_aff *upa,
4810 __isl_take isl_id *id);
4811 __isl_give isl_union_set *
4812 isl_multi_union_pw_aff_bind(
4813 __isl_take isl_multi_union_pw_aff *mupa,
4814 __isl_take isl_multi_id *tuple);
4816 Projecting out the domain of the wrapped relation in the domain
4817 of a function leaves the range of that wrapped relation
4818 in the domain of the resulting function.
4819 In the case of C<isl_aff_bind_id>, C<isl_pw_aff_bind_id>,
4820 C<isl_multi_aff_bind>, C<isl_multi_pw_aff_bind>,
4821 C<isl_union_pw_aff_bind_id> and
4822 C<isl_multi_union_pw_aff_bind>, the parameters
4823 are bound to the function values and the result lives
4824 in the domain of the input function.
4828 #include <isl/space.h>
4829 __isl_give isl_space *isl_space_domain(
4830 __isl_take isl_space *space);
4831 __isl_give isl_space *isl_space_range(
4832 __isl_take isl_space *space);
4833 __isl_give isl_space *isl_space_params(
4834 __isl_take isl_space *space);
4836 #include <isl/local_space.h>
4837 __isl_give isl_local_space *isl_local_space_domain(
4838 __isl_take isl_local_space *ls);
4839 __isl_give isl_local_space *isl_local_space_range(
4840 __isl_take isl_local_space *ls);
4842 #include <isl/set.h>
4843 __isl_give isl_basic_set *isl_basic_set_project_out(
4844 __isl_take isl_basic_set *bset,
4845 enum isl_dim_type type, unsigned first, unsigned n);
4846 __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
4847 enum isl_dim_type type, unsigned first, unsigned n);
4848 __isl_give isl_map *isl_set_project_onto_map(
4849 __isl_take isl_set *set,
4850 enum isl_dim_type type, unsigned first,
4852 __isl_give isl_basic_set *isl_basic_set_params(
4853 __isl_take isl_basic_set *bset);
4854 __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
4856 The function C<isl_set_project_onto_map> returns a relation
4857 that projects the input set onto the given set dimensions.
4859 #include <isl/map.h>
4860 __isl_give isl_basic_map *isl_basic_map_project_out(
4861 __isl_take isl_basic_map *bmap,
4862 enum isl_dim_type type, unsigned first, unsigned n);
4863 __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
4864 enum isl_dim_type type, unsigned first, unsigned n);
4865 __isl_give isl_basic_set *isl_basic_map_domain(
4866 __isl_take isl_basic_map *bmap);
4867 __isl_give isl_basic_set *isl_basic_map_range(
4868 __isl_take isl_basic_map *bmap);
4869 __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
4870 __isl_give isl_set *isl_map_domain(
4871 __isl_take isl_map *bmap);
4872 __isl_give isl_set *isl_map_range(
4873 __isl_take isl_map *map);
4875 #include <isl/union_set.h>
4876 __isl_give isl_union_set *isl_union_set_project_out(
4877 __isl_take isl_union_set *uset,
4878 enum isl_dim_type type,
4879 unsigned first, unsigned n);
4880 __isl_give isl_union_set *
4881 isl_union_set_project_out_all_params(
4882 __isl_take isl_union_set *uset);
4883 __isl_give isl_set *isl_union_set_params(
4884 __isl_take isl_union_set *uset);
4886 The function C<isl_union_set_project_out> can only project out
4889 #include <isl/union_map.h>
4890 __isl_give isl_union_map *isl_union_map_project_out(
4891 __isl_take isl_union_map *umap,
4892 enum isl_dim_type type, unsigned first, unsigned n);
4893 __isl_give isl_union_map *
4894 isl_union_map_project_out_all_params(
4895 __isl_take isl_union_map *umap);
4896 __isl_give isl_set *isl_union_map_params(
4897 __isl_take isl_union_map *umap);
4898 __isl_give isl_union_set *isl_union_map_domain(
4899 __isl_take isl_union_map *umap);
4900 __isl_give isl_union_set *isl_union_map_range(
4901 __isl_take isl_union_map *umap);
4903 The function C<isl_union_map_project_out> can only project out
4906 #include <isl/aff.h>
4907 __isl_give isl_aff *isl_aff_project_domain_on_params(
4908 __isl_take isl_aff *aff);
4909 __isl_give isl_multi_aff *
4910 isl_multi_aff_project_domain_on_params(
4911 __isl_take isl_multi_aff *ma);
4912 __isl_give isl_pw_aff *
4913 isl_pw_aff_project_domain_on_params(
4914 __isl_take isl_pw_aff *pa);
4915 __isl_give isl_multi_pw_aff *
4916 isl_multi_pw_aff_project_domain_on_params(
4917 __isl_take isl_multi_pw_aff *mpa);
4918 __isl_give isl_pw_multi_aff *
4919 isl_pw_multi_aff_project_domain_on_params(
4920 __isl_take isl_pw_multi_aff *pma);
4921 __isl_give isl_set *isl_pw_aff_domain(
4922 __isl_take isl_pw_aff *pwaff);
4923 __isl_give isl_set *isl_pw_multi_aff_domain(
4924 __isl_take isl_pw_multi_aff *pma);
4925 __isl_give isl_set *isl_multi_pw_aff_domain(
4926 __isl_take isl_multi_pw_aff *mpa);
4927 __isl_give isl_union_set *isl_union_pw_aff_domain(
4928 __isl_take isl_union_pw_aff *upa);
4929 __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
4930 __isl_take isl_union_pw_multi_aff *upma);
4931 __isl_give isl_union_set *
4932 isl_multi_union_pw_aff_domain(
4933 __isl_take isl_multi_union_pw_aff *mupa);
4934 __isl_give isl_set *isl_pw_aff_params(
4935 __isl_take isl_pw_aff *pwa);
4937 If no explicit domain was set on a zero-dimensional input to
4938 C<isl_multi_union_pw_aff_domain>, then this function will
4939 return a parameter set.
4941 #include <isl/polynomial.h>
4942 __isl_give isl_qpolynomial *
4943 isl_qpolynomial_project_domain_on_params(
4944 __isl_take isl_qpolynomial *qp);
4945 __isl_give isl_pw_qpolynomial *
4946 isl_pw_qpolynomial_project_domain_on_params(
4947 __isl_take isl_pw_qpolynomial *pwqp);
4948 __isl_give isl_pw_qpolynomial_fold *
4949 isl_pw_qpolynomial_fold_project_domain_on_params(
4950 __isl_take isl_pw_qpolynomial_fold *pwf);
4951 __isl_give isl_set *isl_pw_qpolynomial_domain(
4952 __isl_take isl_pw_qpolynomial *pwqp);
4953 __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
4954 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4955 __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
4956 __isl_take isl_union_pw_qpolynomial *upwqp);
4958 #include <isl/space.h>
4959 __isl_give isl_space *isl_space_domain_map(
4960 __isl_take isl_space *space);
4961 __isl_give isl_space *isl_space_range_map(
4962 __isl_take isl_space *space);
4964 #include <isl/map.h>
4965 __isl_give isl_map *isl_set_wrapped_domain_map(
4966 __isl_take isl_set *set);
4967 __isl_give isl_basic_map *isl_basic_map_domain_map(
4968 __isl_take isl_basic_map *bmap);
4969 __isl_give isl_basic_map *isl_basic_map_range_map(
4970 __isl_take isl_basic_map *bmap);
4971 __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
4972 __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
4974 #include <isl/union_map.h>
4975 __isl_give isl_union_map *isl_union_map_domain_map(
4976 __isl_take isl_union_map *umap);
4977 __isl_give isl_union_pw_multi_aff *
4978 isl_union_map_domain_map_union_pw_multi_aff(
4979 __isl_take isl_union_map *umap);
4980 __isl_give isl_union_map *isl_union_map_range_map(
4981 __isl_take isl_union_map *umap);
4982 __isl_give isl_union_map *
4983 isl_union_set_wrapped_domain_map(
4984 __isl_take isl_union_set *uset);
4986 The functions above construct a (basic, regular or union) relation
4987 that maps (a wrapped version of) the input relation to its domain or range.
4988 C<isl_set_wrapped_domain_map> maps the input set to the domain
4989 of its wrapped relation.
4993 __isl_give isl_basic_set *isl_basic_set_eliminate(
4994 __isl_take isl_basic_set *bset,
4995 enum isl_dim_type type,
4996 unsigned first, unsigned n);
4997 __isl_give isl_set *isl_set_eliminate(
4998 __isl_take isl_set *set, enum isl_dim_type type,
4999 unsigned first, unsigned n);
5000 __isl_give isl_basic_map *isl_basic_map_eliminate(
5001 __isl_take isl_basic_map *bmap,
5002 enum isl_dim_type type,
5003 unsigned first, unsigned n);
5004 __isl_give isl_map *isl_map_eliminate(
5005 __isl_take isl_map *map, enum isl_dim_type type,
5006 unsigned first, unsigned n);
5008 Eliminate the coefficients for the given dimensions from the constraints,
5009 without removing the dimensions.
5011 =item * Constructing a set from a parameter domain
5013 A set space of a given dimension and with an optional name
5014 can be created from a parameter space using the following functions.
5016 #include <isl/space.h>
5017 __isl_give isl_space *isl_space_add_unnamed_tuple_ui(
5018 __isl_take isl_space *space, unsigned dim);
5019 __isl_give isl_space *
5020 isl_space_add_named_tuple_id_ui(
5021 __isl_take isl_space *space,
5022 __isl_take isl_id *tuple_id, unsigned dim);
5024 A set with a given tuple can be created from a parameter domain
5025 using the following function.
5027 #include <isl/set.h>
5028 __isl_give isl_set *isl_set_unbind_params(
5029 __isl_take isl_set *set,
5030 __isl_take isl_multi_id *tuple);
5032 Any parameters with identifiers in C<tuple> are reinterpreted
5033 as the corresponding set dimensions.
5035 A zero-dimensional (local) space or (basic) set can be constructed
5036 on a given parameter domain using the following functions.
5038 #include <isl/space.h>
5039 __isl_give isl_space *isl_space_set_from_params(
5040 __isl_take isl_space *space);
5042 #include <isl/local_space.h>
5043 __isl_give isl_local_space *
5044 isl_local_space_set_from_params(
5045 __isl_take isl_local_space *ls);
5047 #include <isl/set.h>
5048 __isl_give isl_basic_set *isl_basic_set_from_params(
5049 __isl_take isl_basic_set *bset);
5050 __isl_give isl_set *isl_set_from_params(
5051 __isl_take isl_set *set);
5053 =item * Constructing a relation from one or two sets
5055 A map space with a range of a given dimension and with an optional name
5056 can be created from a domain space using the functions
5057 C<isl_space_add_unnamed_tuple_ui> and C<isl_space_add_named_tuple_id_ui>
5060 A relation with a given domain tuple can be created from a set
5061 that will become the range of the relation
5062 using the following function.
5064 #include <isl/set.h>
5065 __isl_give isl_map *
5066 isl_set_unbind_params_insert_domain(
5067 __isl_take isl_set *set,
5068 __isl_take isl_multi_id *domain);
5070 Any parameters with identifiers in C<domain> are reinterpreted
5071 as the corresponding input dimensions.
5073 Similarly, a function defined over a parameter domain can
5074 be converted into one defined over a set domain
5075 using the following function.
5077 #include <isl/aff.h>
5078 __isl_give isl_aff *
5079 isl_aff_unbind_params_insert_domain(
5080 __isl_take isl_aff *aff,
5081 __isl_take isl_multi_id *domain);
5084 any parameters with identifiers in C<domain> are reinterpreted
5085 as the corresponding input dimensions.
5087 Create a relation with the given set(s) as domain and/or range.
5088 If only the domain or the range is specified, then
5089 the range or domain of the created relation is a zero-dimensional
5090 flat anonymous space.
5092 #include <isl/space.h>
5093 __isl_give isl_space *isl_space_from_domain(
5094 __isl_take isl_space *space);
5095 __isl_give isl_space *isl_space_from_range(
5096 __isl_take isl_space *space);
5097 __isl_give isl_space *isl_space_map_from_set(
5098 __isl_take isl_space *space);
5099 __isl_give isl_space *isl_space_map_from_domain_and_range(
5100 __isl_take isl_space *domain,
5101 __isl_take isl_space *range);
5103 #include <isl/local_space.h>
5104 __isl_give isl_local_space *isl_local_space_from_domain(
5105 __isl_take isl_local_space *ls);
5107 #include <isl/map.h>
5108 __isl_give isl_map *isl_map_from_domain(
5109 __isl_take isl_set *set);
5110 __isl_give isl_map *isl_map_from_range(
5111 __isl_take isl_set *set);
5113 #include <isl/union_map.h>
5114 __isl_give isl_union_map *isl_union_map_from_domain(
5115 __isl_take isl_union_set *uset);
5116 __isl_give isl_union_map *isl_union_map_from_range(
5117 __isl_take isl_union_set *uset);
5118 __isl_give isl_union_map *
5119 isl_union_map_from_domain_and_range(
5120 __isl_take isl_union_set *domain,
5121 __isl_take isl_union_set *range);
5124 __isl_give isl_multi_id *isl_multi_id_from_range(
5125 __isl_take isl_multi_id *mi);
5127 #include <isl/val.h>
5128 __isl_give isl_multi_val *isl_multi_val_from_range(
5129 __isl_take isl_multi_val *mv);
5131 #include <isl/aff.h>
5132 __isl_give isl_aff *isl_aff_from_range(
5133 __isl_take isl_aff *aff);
5134 __isl_give isl_multi_aff *isl_multi_aff_from_range(
5135 __isl_take isl_multi_aff *ma);
5136 __isl_give isl_pw_aff *isl_pw_aff_from_range(
5137 __isl_take isl_pw_aff *pwa);
5138 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
5139 __isl_take isl_multi_pw_aff *mpa);
5140 __isl_give isl_multi_union_pw_aff *
5141 isl_multi_union_pw_aff_from_range(
5142 __isl_take isl_multi_union_pw_aff *mupa);
5143 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
5144 __isl_take isl_set *set);
5145 __isl_give isl_union_pw_multi_aff *
5146 isl_union_pw_multi_aff_from_domain(
5147 __isl_take isl_union_set *uset);
5149 #include <isl/polynomial.h>
5150 __isl_give isl_pw_qpolynomial *
5151 isl_pw_qpolynomial_from_range(
5152 __isl_take isl_pw_qpolynomial *pwqp);
5153 __isl_give isl_pw_qpolynomial_fold *
5154 isl_pw_qpolynomial_fold_from_range(
5155 __isl_take isl_pw_qpolynomial_fold *pwf);
5159 #include <isl/set.h>
5160 __isl_give isl_basic_set *isl_basic_set_fix_si(
5161 __isl_take isl_basic_set *bset,
5162 enum isl_dim_type type, unsigned pos, int value);
5163 __isl_give isl_basic_set *isl_basic_set_fix_val(
5164 __isl_take isl_basic_set *bset,
5165 enum isl_dim_type type, unsigned pos,
5166 __isl_take isl_val *v);
5167 __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
5168 enum isl_dim_type type, unsigned pos, int value);
5169 __isl_give isl_set *isl_set_fix_val(
5170 __isl_take isl_set *set,
5171 enum isl_dim_type type, unsigned pos,
5172 __isl_take isl_val *v);
5174 #include <isl/map.h>
5175 __isl_give isl_basic_map *isl_basic_map_fix_si(
5176 __isl_take isl_basic_map *bmap,
5177 enum isl_dim_type type, unsigned pos, int value);
5178 __isl_give isl_basic_map *isl_basic_map_fix_val(
5179 __isl_take isl_basic_map *bmap,
5180 enum isl_dim_type type, unsigned pos,
5181 __isl_take isl_val *v);
5182 __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
5183 enum isl_dim_type type, unsigned pos, int value);
5184 __isl_give isl_map *isl_map_fix_val(
5185 __isl_take isl_map *map,
5186 enum isl_dim_type type, unsigned pos,
5187 __isl_take isl_val *v);
5189 #include <isl/aff.h>
5190 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
5191 __isl_take isl_pw_multi_aff *pma,
5192 enum isl_dim_type type, unsigned pos, int value);
5194 #include <isl/polynomial.h>
5195 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
5196 __isl_take isl_pw_qpolynomial *pwqp,
5197 enum isl_dim_type type, unsigned n,
5198 __isl_take isl_val *v);
5199 __isl_give isl_pw_qpolynomial_fold *
5200 isl_pw_qpolynomial_fold_fix_val(
5201 __isl_take isl_pw_qpolynomial_fold *pwf,
5202 enum isl_dim_type type, unsigned n,
5203 __isl_take isl_val *v);
5205 Intersect the set, relation or function domain
5206 with the hyperplane where the given
5207 dimension has the fixed given value.
5209 #include <isl/set.h>
5210 __isl_give isl_basic_set *
5211 isl_basic_set_lower_bound_val(
5212 __isl_take isl_basic_set *bset,
5213 enum isl_dim_type type, unsigned pos,
5214 __isl_take isl_val *value);
5215 __isl_give isl_basic_set *
5216 isl_basic_set_upper_bound_val(
5217 __isl_take isl_basic_set *bset,
5218 enum isl_dim_type type, unsigned pos,
5219 __isl_take isl_val *value);
5220 __isl_give isl_set *isl_set_lower_bound_si(
5221 __isl_take isl_set *set,
5222 enum isl_dim_type type, unsigned pos, int value);
5223 __isl_give isl_set *isl_set_lower_bound_val(
5224 __isl_take isl_set *set,
5225 enum isl_dim_type type, unsigned pos,
5226 __isl_take isl_val *value);
5227 __isl_give isl_set *isl_set_upper_bound_si(
5228 __isl_take isl_set *set,
5229 enum isl_dim_type type, unsigned pos, int value);
5230 __isl_give isl_set *isl_set_upper_bound_val(
5231 __isl_take isl_set *set,
5232 enum isl_dim_type type, unsigned pos,
5233 __isl_take isl_val *value);
5235 #include <isl/map.h>
5236 __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
5237 __isl_take isl_basic_map *bmap,
5238 enum isl_dim_type type, unsigned pos, int value);
5239 __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
5240 __isl_take isl_basic_map *bmap,
5241 enum isl_dim_type type, unsigned pos, int value);
5242 __isl_give isl_map *isl_map_lower_bound_si(
5243 __isl_take isl_map *map,
5244 enum isl_dim_type type, unsigned pos, int value);
5245 __isl_give isl_map *isl_map_upper_bound_si(
5246 __isl_take isl_map *map,
5247 enum isl_dim_type type, unsigned pos, int value);
5249 Intersect the set or relation with the half-space where the given
5250 dimension has a value bounded by the fixed given integer value.
5252 __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
5253 enum isl_dim_type type1, int pos1,
5254 enum isl_dim_type type2, int pos2);
5255 __isl_give isl_basic_map *isl_basic_map_equate(
5256 __isl_take isl_basic_map *bmap,
5257 enum isl_dim_type type1, int pos1,
5258 enum isl_dim_type type2, int pos2);
5259 __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
5260 enum isl_dim_type type1, int pos1,
5261 enum isl_dim_type type2, int pos2);
5263 Intersect the set or relation with the hyperplane where the given
5264 dimensions are equal to each other.
5266 __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
5267 enum isl_dim_type type1, int pos1,
5268 enum isl_dim_type type2, int pos2);
5270 Intersect the relation with the hyperplane where the given
5271 dimensions have opposite values.
5273 __isl_give isl_map *isl_map_order_le(
5274 __isl_take isl_map *map,
5275 enum isl_dim_type type1, int pos1,
5276 enum isl_dim_type type2, int pos2);
5277 __isl_give isl_basic_map *isl_basic_map_order_ge(
5278 __isl_take isl_basic_map *bmap,
5279 enum isl_dim_type type1, int pos1,
5280 enum isl_dim_type type2, int pos2);
5281 __isl_give isl_map *isl_map_order_ge(
5282 __isl_take isl_map *map,
5283 enum isl_dim_type type1, int pos1,
5284 enum isl_dim_type type2, int pos2);
5285 __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
5286 enum isl_dim_type type1, int pos1,
5287 enum isl_dim_type type2, int pos2);
5288 __isl_give isl_basic_map *isl_basic_map_order_gt(
5289 __isl_take isl_basic_map *bmap,
5290 enum isl_dim_type type1, int pos1,
5291 enum isl_dim_type type2, int pos2);
5292 __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
5293 enum isl_dim_type type1, int pos1,
5294 enum isl_dim_type type2, int pos2);
5296 Intersect the relation with the half-space where the given
5297 dimensions satisfy the given ordering.
5299 #include <isl/union_set.h>
5300 __isl_give isl_union_map *isl_union_map_remove_map_if(
5301 __isl_take isl_union_map *umap,
5302 isl_bool (*fn)(__isl_keep isl_map *map,
5303 void *user), void *user);
5305 This function calls the callback function once for each
5306 pair of spaces for which there are elements in the input.
5307 If the callback returns C<isl_bool_true>, then all those elements
5308 are removed from the result. The only remaining elements in the output
5309 are then those for which the callback returns C<isl_bool_false>.
5313 #include <isl/aff.h>
5314 __isl_give isl_basic_set *isl_aff_zero_basic_set(
5315 __isl_take isl_aff *aff);
5316 __isl_give isl_basic_set *isl_aff_neg_basic_set(
5317 __isl_take isl_aff *aff);
5318 __isl_give isl_set *isl_pw_aff_pos_set(
5319 __isl_take isl_pw_aff *pa);
5320 __isl_give isl_set *isl_pw_aff_nonneg_set(
5321 __isl_take isl_pw_aff *pwaff);
5322 __isl_give isl_set *isl_pw_aff_zero_set(
5323 __isl_take isl_pw_aff *pwaff);
5324 __isl_give isl_set *isl_pw_aff_non_zero_set(
5325 __isl_take isl_pw_aff *pwaff);
5326 __isl_give isl_union_set *
5327 isl_union_pw_aff_zero_union_set(
5328 __isl_take isl_union_pw_aff *upa);
5329 __isl_give isl_union_set *
5330 isl_multi_union_pw_aff_zero_union_set(
5331 __isl_take isl_multi_union_pw_aff *mupa);
5333 The function C<isl_aff_neg_basic_set> returns a basic set
5334 containing those elements in the domain space
5335 of C<aff> where C<aff> is negative.
5336 The function C<isl_pw_aff_nonneg_set> returns a set
5337 containing those elements in the domain
5338 of C<pwaff> where C<pwaff> is non-negative.
5339 The function C<isl_multi_union_pw_aff_zero_union_set>
5340 returns a union set containing those elements
5341 in the domains of its elements where they are all zero.
5345 __isl_give isl_map *isl_set_identity(
5346 __isl_take isl_set *set);
5347 __isl_give isl_union_map *isl_union_set_identity(
5348 __isl_take isl_union_set *uset);
5349 __isl_give isl_union_pw_multi_aff *
5350 isl_union_set_identity_union_pw_multi_aff(
5351 __isl_take isl_union_set *uset);
5353 Construct an identity relation on the given (union) set.
5355 =item * Function Extraction
5357 A piecewise quasi affine expression that is equal to 1 on a set
5358 and 0 outside the set can be created using the following function.
5360 #include <isl/aff.h>
5361 __isl_give isl_pw_aff *isl_set_indicator_function(
5362 __isl_take isl_set *set);
5364 A piecewise multiple quasi affine expression can be extracted
5365 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
5366 and the C<isl_map> is single-valued.
5367 In case of a conversion from an C<isl_union_map>
5368 to an C<isl_union_pw_multi_aff>, these properties need to hold
5369 in each domain space.
5370 A conversion to a C<isl_multi_union_pw_aff> additionally
5371 requires that the input is non-empty and involves only a single
5374 #include <isl/aff.h>
5375 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
5376 __isl_take isl_set *set);
5377 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
5378 __isl_take isl_map *map);
5380 __isl_give isl_union_pw_multi_aff *
5381 isl_union_pw_multi_aff_from_union_set(
5382 __isl_take isl_union_set *uset);
5383 __isl_give isl_union_pw_multi_aff *
5384 isl_union_pw_multi_aff_from_union_map(
5385 __isl_take isl_union_map *umap);
5387 __isl_give isl_multi_union_pw_aff *
5388 isl_multi_union_pw_aff_from_union_map(
5389 __isl_take isl_union_map *umap);
5393 __isl_give isl_basic_set *isl_basic_map_deltas(
5394 __isl_take isl_basic_map *bmap);
5395 __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
5396 __isl_give isl_union_set *isl_union_map_deltas(
5397 __isl_take isl_union_map *umap);
5399 These functions return a (basic) set containing the differences
5400 between image elements and corresponding domain elements in the input.
5402 __isl_give isl_basic_map *isl_basic_map_deltas_map(
5403 __isl_take isl_basic_map *bmap);
5404 __isl_give isl_map *isl_map_deltas_map(
5405 __isl_take isl_map *map);
5406 __isl_give isl_union_map *isl_union_map_deltas_map(
5407 __isl_take isl_union_map *umap);
5409 The functions above construct a (basic, regular or union) relation
5410 that maps (a wrapped version of) the input relation to its delta set.
5414 Simplify the representation of a set, relation or functions by trying
5415 to combine pairs of basic sets or relations into a single
5416 basic set or relation.
5418 #include <isl/set.h>
5419 __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
5421 #include <isl/map.h>
5422 __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
5424 #include <isl/union_set.h>
5425 __isl_give isl_union_set *isl_union_set_coalesce(
5426 __isl_take isl_union_set *uset);
5428 #include <isl/union_map.h>
5429 __isl_give isl_union_map *isl_union_map_coalesce(
5430 __isl_take isl_union_map *umap);
5432 #include <isl/aff.h>
5433 __isl_give isl_pw_aff *isl_pw_aff_coalesce(
5434 __isl_take isl_pw_aff *pwqp);
5435 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
5436 __isl_take isl_pw_multi_aff *pma);
5437 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
5438 __isl_take isl_multi_pw_aff *mpa);
5439 __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
5440 __isl_take isl_union_pw_aff *upa);
5441 __isl_give isl_union_pw_multi_aff *
5442 isl_union_pw_multi_aff_coalesce(
5443 __isl_take isl_union_pw_multi_aff *upma);
5444 __isl_give isl_multi_union_pw_aff *
5445 isl_multi_union_pw_aff_coalesce(
5446 __isl_take isl_multi_union_pw_aff *aff);
5448 #include <isl/polynomial.h>
5449 __isl_give isl_pw_qpolynomial_fold *
5450 isl_pw_qpolynomial_fold_coalesce(
5451 __isl_take isl_pw_qpolynomial_fold *pwf);
5452 __isl_give isl_union_pw_qpolynomial *
5453 isl_union_pw_qpolynomial_coalesce(
5454 __isl_take isl_union_pw_qpolynomial *upwqp);
5455 __isl_give isl_union_pw_qpolynomial_fold *
5456 isl_union_pw_qpolynomial_fold_coalesce(
5457 __isl_take isl_union_pw_qpolynomial_fold *upwf);
5459 One of the methods for combining pairs of basic sets or relations
5460 can result in coefficients that are much larger than those that appear
5461 in the constraints of the input. By default, the coefficients are
5462 not allowed to grow larger, but this can be changed by unsetting
5463 the following option.
5465 isl_stat isl_options_set_coalesce_bounded_wrapping(
5466 isl_ctx *ctx, int val);
5467 int isl_options_get_coalesce_bounded_wrapping(
5470 One of the other methods tries to combine pairs of basic sets
5471 with different local variables, treating them as existentially
5472 quantified variables even if they have known (but different)
5473 integer division expressions. The result may then also have
5474 existentially quantified variables. Turning on the following
5475 option prevents this from happening.
5477 isl_stat isl_options_set_coalesce_preserve_locals(
5478 isl_ctx *ctx, int val);
5479 int isl_options_get_coalesce_preserve_locals(isl_ctx *ctx);
5481 =item * Detecting equalities
5483 __isl_give isl_basic_set *isl_basic_set_detect_equalities(
5484 __isl_take isl_basic_set *bset);
5485 __isl_give isl_basic_map *isl_basic_map_detect_equalities(
5486 __isl_take isl_basic_map *bmap);
5487 __isl_give isl_set *isl_set_detect_equalities(
5488 __isl_take isl_set *set);
5489 __isl_give isl_map *isl_map_detect_equalities(
5490 __isl_take isl_map *map);
5491 __isl_give isl_union_set *isl_union_set_detect_equalities(
5492 __isl_take isl_union_set *uset);
5493 __isl_give isl_union_map *isl_union_map_detect_equalities(
5494 __isl_take isl_union_map *umap);
5496 Simplify the representation of a set or relation by detecting implicit
5499 =item * Removing redundant constraints
5501 #include <isl/set.h>
5502 __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
5503 __isl_take isl_basic_set *bset);
5504 __isl_give isl_set *isl_set_remove_redundancies(
5505 __isl_take isl_set *set);
5507 #include <isl/union_set.h>
5508 __isl_give isl_union_set *
5509 isl_union_set_remove_redundancies(
5510 __isl_take isl_union_set *uset);
5512 #include <isl/map.h>
5513 __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
5514 __isl_take isl_basic_map *bmap);
5515 __isl_give isl_map *isl_map_remove_redundancies(
5516 __isl_take isl_map *map);
5518 #include <isl/union_map.h>
5519 __isl_give isl_union_map *
5520 isl_union_map_remove_redundancies(
5521 __isl_take isl_union_map *umap);
5525 __isl_give isl_basic_set *isl_set_convex_hull(
5526 __isl_take isl_set *set);
5527 __isl_give isl_basic_map *isl_map_convex_hull(
5528 __isl_take isl_map *map);
5530 If the input set or relation has any existentially quantified
5531 variables, then the result of these operations is currently undefined.
5535 #include <isl/set.h>
5536 __isl_give isl_basic_set *
5537 isl_set_unshifted_simple_hull(
5538 __isl_take isl_set *set);
5539 __isl_give isl_basic_set *isl_set_simple_hull(
5540 __isl_take isl_set *set);
5541 __isl_give isl_basic_set *
5542 isl_set_plain_unshifted_simple_hull(
5543 __isl_take isl_set *set);
5544 __isl_give isl_basic_set *
5545 isl_set_unshifted_simple_hull_from_set_list(
5546 __isl_take isl_set *set,
5547 __isl_take isl_set_list *list);
5549 #include <isl/map.h>
5550 __isl_give isl_basic_map *
5551 isl_map_unshifted_simple_hull(
5552 __isl_take isl_map *map);
5553 __isl_give isl_basic_map *isl_map_simple_hull(
5554 __isl_take isl_map *map);
5555 __isl_give isl_basic_map *
5556 isl_map_plain_unshifted_simple_hull(
5557 __isl_take isl_map *map);
5558 __isl_give isl_basic_map *
5559 isl_map_unshifted_simple_hull_from_map_list(
5560 __isl_take isl_map *map,
5561 __isl_take isl_map_list *list);
5563 #include <isl/union_map.h>
5564 __isl_give isl_union_map *isl_union_map_simple_hull(
5565 __isl_take isl_union_map *umap);
5567 These functions compute a single basic set or relation
5568 that contains the whole input set or relation.
5569 In particular, the output is described by translates
5570 of the constraints describing the basic sets or relations in the input.
5571 In case of C<isl_set_unshifted_simple_hull>, only the original
5572 constraints are used, without any translation.
5573 In case of C<isl_set_plain_unshifted_simple_hull> and
5574 C<isl_map_plain_unshifted_simple_hull>, the result is described
5575 by original constraints that are obviously satisfied
5576 by the entire input set or relation.
5577 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
5578 C<isl_map_unshifted_simple_hull_from_map_list>, the
5579 constraints are taken from the elements of the second argument.
5583 (See \autoref{s:simple hull}.)
5589 __isl_give isl_basic_set *isl_basic_set_affine_hull(
5590 __isl_take isl_basic_set *bset);
5591 __isl_give isl_basic_set *isl_set_affine_hull(
5592 __isl_take isl_set *set);
5593 __isl_give isl_union_set *isl_union_set_affine_hull(
5594 __isl_take isl_union_set *uset);
5595 __isl_give isl_basic_map *isl_basic_map_affine_hull(
5596 __isl_take isl_basic_map *bmap);
5597 __isl_give isl_basic_map *isl_map_affine_hull(
5598 __isl_take isl_map *map);
5599 __isl_give isl_union_map *isl_union_map_affine_hull(
5600 __isl_take isl_union_map *umap);
5602 In case of union sets and relations, the affine hull is computed
5605 =item * Polyhedral hull
5607 __isl_give isl_basic_set *isl_set_polyhedral_hull(
5608 __isl_take isl_set *set);
5609 __isl_give isl_basic_map *isl_map_polyhedral_hull(
5610 __isl_take isl_map *map);
5611 __isl_give isl_union_set *isl_union_set_polyhedral_hull(
5612 __isl_take isl_union_set *uset);
5613 __isl_give isl_union_map *isl_union_map_polyhedral_hull(
5614 __isl_take isl_union_map *umap);
5616 These functions compute a single basic set or relation
5617 not involving any existentially quantified variables
5618 that contains the whole input set or relation.
5619 In case of union sets and relations, the polyhedral hull is computed
5624 #include <isl/map.h>
5625 __isl_give isl_fixed_box *
5626 isl_map_get_range_simple_fixed_box_hull(
5627 __isl_keep isl_map *map);
5629 This function tries to approximate the range of the map by a box of fixed size.
5630 The box is described in terms of an offset living in the same space as
5631 the input map and a size living in the range space. For any element
5632 in the input map, the range value is greater than or equal to
5633 the offset applied to the domain value and the difference with
5634 this offset is strictly smaller than the size.
5635 If no fixed-size approximation of the range can be found,
5636 an I<invalid> box is returned, i.e., one for which
5637 C<isl_fixed_box_is_valid> below returns false.
5639 The validity, the offset and the size of the box can be obtained using
5640 the following functions.
5642 #include <isl/fixed_box.h>
5643 isl_bool isl_fixed_box_is_valid(
5644 __isl_keep isl_fixed_box *box);
5645 __isl_give isl_multi_aff *isl_fixed_box_get_offset(
5646 __isl_keep isl_fixed_box *box);
5647 __isl_give isl_multi_val *isl_fixed_box_get_size(
5648 __isl_keep isl_fixed_box *box);
5650 The box can be copied and freed using the following functions.
5652 #include <isl/fixed_box.h>
5653 __isl_give isl_fixed_box *isl_fixed_box_copy(
5654 __isl_keep isl_fixed_box *box);
5655 __isl_null isl_fixed_box *isl_fixed_box_free(
5656 __isl_take isl_fixed_box *box);
5658 A representation of the information contained in an object
5659 of type C<isl_fixed_box> can be obtained using
5661 #include <isl/fixed_box.h>
5662 __isl_give isl_printer *isl_printer_print_fixed_box(
5663 __isl_take isl_printer *p,
5664 __isl_keep isl_fixed_box *box);
5665 __isl_give char *isl_fixed_box_to_str(
5666 __isl_keep isl_fixed_box *box);
5668 C<isl_fixed_box_to_str> prints the information in flow format.
5670 =item * Other approximations
5672 #include <isl/set.h>
5673 __isl_give isl_basic_set *
5674 isl_basic_set_drop_constraints_involving_dims(
5675 __isl_take isl_basic_set *bset,
5676 enum isl_dim_type type,
5677 unsigned first, unsigned n);
5678 __isl_give isl_basic_set *
5679 isl_basic_set_drop_constraints_not_involving_dims(
5680 __isl_take isl_basic_set *bset,
5681 enum isl_dim_type type,
5682 unsigned first, unsigned n);
5683 __isl_give isl_set *
5684 isl_set_drop_constraints_involving_dims(
5685 __isl_take isl_set *set,
5686 enum isl_dim_type type,
5687 unsigned first, unsigned n);
5688 __isl_give isl_set *
5689 isl_set_drop_constraints_not_involving_dims(
5690 __isl_take isl_set *set,
5691 enum isl_dim_type type,
5692 unsigned first, unsigned n);
5694 #include <isl/map.h>
5695 __isl_give isl_basic_map *
5696 isl_basic_map_drop_constraints_involving_dims(
5697 __isl_take isl_basic_map *bmap,
5698 enum isl_dim_type type,
5699 unsigned first, unsigned n);
5700 __isl_give isl_basic_map *
5701 isl_basic_map_drop_constraints_not_involving_dims(
5702 __isl_take isl_basic_map *bmap,
5703 enum isl_dim_type type,
5704 unsigned first, unsigned n);
5705 __isl_give isl_map *
5706 isl_map_drop_constraints_involving_dims(
5707 __isl_take isl_map *map,
5708 enum isl_dim_type type,
5709 unsigned first, unsigned n);
5710 __isl_give isl_map *
5711 isl_map_drop_constraints_not_involving_dims(
5712 __isl_take isl_map *map,
5713 enum isl_dim_type type,
5714 unsigned first, unsigned n);
5716 These functions drop any constraints (not) involving the specified dimensions.
5717 Note that the result depends on the representation of the input.
5719 #include <isl/polynomial.h>
5720 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
5721 __isl_take isl_pw_qpolynomial *pwqp, int sign);
5722 __isl_give isl_union_pw_qpolynomial *
5723 isl_union_pw_qpolynomial_to_polynomial(
5724 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
5726 Approximate each quasipolynomial by a polynomial. If C<sign> is positive,
5727 the polynomial will be an overapproximation. If C<sign> is negative,
5728 it will be an underapproximation. If C<sign> is zero, the approximation
5729 will lie somewhere in between.
5733 __isl_give isl_basic_set *isl_basic_set_sample(
5734 __isl_take isl_basic_set *bset);
5735 __isl_give isl_basic_set *isl_set_sample(
5736 __isl_take isl_set *set);
5737 __isl_give isl_basic_map *isl_basic_map_sample(
5738 __isl_take isl_basic_map *bmap);
5739 __isl_give isl_basic_map *isl_map_sample(
5740 __isl_take isl_map *map);
5742 If the input (basic) set or relation is non-empty, then return
5743 a singleton subset of the input. Otherwise, return an empty set.
5745 =item * Optimization
5747 #include <isl/ilp.h>
5748 __isl_give isl_val *isl_basic_set_max_val(
5749 __isl_keep isl_basic_set *bset,
5750 __isl_keep isl_aff *obj);
5751 __isl_give isl_val *isl_set_min_val(
5752 __isl_keep isl_set *set,
5753 __isl_keep isl_aff *obj);
5754 __isl_give isl_val *isl_set_max_val(
5755 __isl_keep isl_set *set,
5756 __isl_keep isl_aff *obj);
5757 __isl_give isl_multi_val *
5758 isl_union_set_min_multi_union_pw_aff(
5759 __isl_keep isl_union_set *uset,
5760 __isl_keep isl_multi_union_pw_aff *obj);
5762 Compute the minimum or maximum of the integer affine expression C<obj>
5763 over the points in C<set>.
5764 The result is C<NULL> in case of an error, the optimal value in case
5765 there is one, negative infinity or infinity if the problem is unbounded and
5766 NaN if the problem is empty.
5768 #include <isl/ilp.h>
5769 __isl_give isl_val *isl_union_pw_aff_min_val(
5770 __isl_take isl_union_pw_aff *upa);
5771 __isl_give isl_val *isl_union_pw_aff_max_val(
5772 __isl_take isl_union_pw_aff *upa);
5773 __isl_give isl_multi_val *
5774 isl_multi_union_pw_aff_min_multi_val(
5775 __isl_take isl_multi_union_pw_aff *mupa);
5776 __isl_give isl_multi_val *
5777 isl_multi_union_pw_aff_max_multi_val(
5778 __isl_take isl_multi_union_pw_aff *mupa);
5780 Compute the minimum or maximum of the integer affine expression
5781 over its definition domain.
5782 The result is C<NULL> in case of an error, the optimal value in case
5783 there is one, negative infinity or infinity if the problem is unbounded and
5784 NaN if the problem is empty.
5786 #include <isl/ilp.h>
5787 __isl_give isl_val *isl_basic_set_dim_max_val(
5788 __isl_take isl_basic_set *bset, int pos);
5790 Return the maximal value attained by the given set dimension,
5791 independently of the parameter values and of any other dimensions.
5792 The result is C<NULL> in case of an error, the optimal value in case
5793 there is one, infinity if the problem is unbounded and
5794 NaN if the input is empty.
5796 =item * Parametric optimization
5798 __isl_give isl_pw_aff *isl_set_dim_min(
5799 __isl_take isl_set *set, int pos);
5800 __isl_give isl_pw_aff *isl_set_dim_max(
5801 __isl_take isl_set *set, int pos);
5802 __isl_give isl_pw_aff *isl_map_dim_min(
5803 __isl_take isl_map *map, int pos);
5804 __isl_give isl_pw_aff *isl_map_dim_max(
5805 __isl_take isl_map *map, int pos);
5807 Compute the minimum or maximum of the given set or output dimension
5808 as a function of the parameters (and input dimensions), but independently
5809 of the other set or output dimensions.
5810 For lexicographic optimization, see L<"Lexicographic Optimization">.
5814 The following functions compute either the set of (rational) coefficient
5815 values of valid constraints for the given set or the set of (rational)
5816 values satisfying the constraints with coefficients from the given set.
5817 Internally, these two sets of functions perform essentially the
5818 same operations, except that the set of coefficients is assumed to
5819 be a cone, while the set of values may be any polyhedron.
5820 The current implementation is based on the Farkas lemma and
5821 Fourier-Motzkin elimination, but this may change or be made optional
5822 in future. In particular, future implementations may use different
5823 dualization algorithms or skip the elimination step.
5825 #include <isl/set.h>
5826 __isl_give isl_basic_set *isl_basic_set_coefficients(
5827 __isl_take isl_basic_set *bset);
5828 __isl_give isl_basic_set_list *
5829 isl_basic_set_list_coefficients(
5830 __isl_take isl_basic_set_list *list);
5831 __isl_give isl_basic_set *isl_set_coefficients(
5832 __isl_take isl_set *set);
5833 __isl_give isl_union_set *isl_union_set_coefficients(
5834 __isl_take isl_union_set *bset);
5835 __isl_give isl_basic_set *isl_basic_set_solutions(
5836 __isl_take isl_basic_set *bset);
5837 __isl_give isl_basic_set *isl_set_solutions(
5838 __isl_take isl_set *set);
5839 __isl_give isl_union_set *isl_union_set_solutions(
5840 __isl_take isl_union_set *bset);
5844 __isl_give isl_map *isl_map_fixed_power_val(
5845 __isl_take isl_map *map,
5846 __isl_take isl_val *exp);
5847 __isl_give isl_union_map *
5848 isl_union_map_fixed_power_val(
5849 __isl_take isl_union_map *umap,
5850 __isl_take isl_val *exp);
5852 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
5853 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
5854 of C<map> is computed.
5856 __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
5858 __isl_give isl_union_map *isl_union_map_power(
5859 __isl_take isl_union_map *umap, isl_bool *exact);
5861 Compute a parametric representation for all positive powers I<k> of C<map>.
5862 The result maps I<k> to a nested relation corresponding to the
5863 I<k>th power of C<map>.
5864 The result may be an overapproximation. If the result is known to be exact,
5865 then C<*exact> is set to C<1>.
5867 =item * Transitive closure
5869 __isl_give isl_map *isl_map_transitive_closure(
5870 __isl_take isl_map *map, isl_bool *exact);
5871 __isl_give isl_union_map *isl_union_map_transitive_closure(
5872 __isl_take isl_union_map *umap, isl_bool *exact);
5874 Compute the transitive closure of C<map>.
5875 The result may be an overapproximation. If the result is known to be exact,
5876 then C<*exact> is set to C<1>.
5878 =item * Reaching path lengths
5880 __isl_give isl_map *isl_map_reaching_path_lengths(
5881 __isl_take isl_map *map, isl_bool *exact);
5883 Compute a relation that maps each element in the range of C<map>
5884 to the lengths of all paths composed of edges in C<map> that
5885 end up in the given element.
5886 The result may be an overapproximation. If the result is known to be exact,
5887 then C<*exact> is set to C<1>.
5888 To compute the I<maximal> path length, the resulting relation
5889 should be postprocessed by C<isl_map_lexmax>.
5890 In particular, if the input relation is a dependence relation
5891 (mapping sources to sinks), then the maximal path length corresponds
5892 to the free schedule.
5893 Note, however, that C<isl_map_lexmax> expects the maximum to be
5894 finite, so if the path lengths are unbounded (possibly due to
5895 the overapproximation), then you will get an error message.
5899 #include <isl/space.h>
5900 __isl_give isl_space *isl_space_wrap(
5901 __isl_take isl_space *space);
5902 __isl_give isl_space *isl_space_unwrap(
5903 __isl_take isl_space *space);
5905 #include <isl/local_space.h>
5906 __isl_give isl_local_space *isl_local_space_wrap(
5907 __isl_take isl_local_space *ls);
5909 #include <isl/set.h>
5910 __isl_give isl_basic_map *isl_basic_set_unwrap(
5911 __isl_take isl_basic_set *bset);
5912 __isl_give isl_map *isl_set_unwrap(
5913 __isl_take isl_set *set);
5915 #include <isl/map.h>
5916 __isl_give isl_basic_set *isl_basic_map_wrap(
5917 __isl_take isl_basic_map *bmap);
5918 __isl_give isl_set *isl_map_wrap(
5919 __isl_take isl_map *map);
5921 #include <isl/union_set.h>
5922 __isl_give isl_union_map *isl_union_set_unwrap(
5923 __isl_take isl_union_set *uset);
5925 #include <isl/union_map.h>
5926 __isl_give isl_union_set *isl_union_map_wrap(
5927 __isl_take isl_union_map *umap);
5929 The input to C<isl_space_unwrap> should
5930 be the space of a set, while that of
5931 C<isl_space_wrap> should be the space of a relation.
5932 Conversely, the output of C<isl_space_unwrap> is the space
5933 of a relation, while that of C<isl_space_wrap> is the space of a set.
5937 Remove any internal structure of domain (and range) of the given
5938 set or relation. If there is any such internal structure in the input,
5939 then the name of the space is also removed.
5941 #include <isl/space.h>
5942 __isl_give isl_space *isl_space_flatten_domain(
5943 __isl_take isl_space *space);
5944 __isl_give isl_space *isl_space_flatten_range(
5945 __isl_take isl_space *space);
5947 #include <isl/local_space.h>
5948 __isl_give isl_local_space *
5949 isl_local_space_flatten_domain(
5950 __isl_take isl_local_space *ls);
5951 __isl_give isl_local_space *
5952 isl_local_space_flatten_range(
5953 __isl_take isl_local_space *ls);
5955 #include <isl/set.h>
5956 __isl_give isl_basic_set *isl_basic_set_flatten(
5957 __isl_take isl_basic_set *bset);
5958 __isl_give isl_set *isl_set_flatten(
5959 __isl_take isl_set *set);
5961 #include <isl/map.h>
5962 __isl_give isl_basic_map *isl_basic_map_flatten_domain(
5963 __isl_take isl_basic_map *bmap);
5964 __isl_give isl_basic_map *isl_basic_map_flatten_range(
5965 __isl_take isl_basic_map *bmap);
5966 __isl_give isl_map *isl_map_flatten_range(
5967 __isl_take isl_map *map);
5968 __isl_give isl_map *isl_map_flatten_domain(
5969 __isl_take isl_map *map);
5970 __isl_give isl_basic_map *isl_basic_map_flatten(
5971 __isl_take isl_basic_map *bmap);
5972 __isl_give isl_map *isl_map_flatten(
5973 __isl_take isl_map *map);
5976 __isl_give isl_multi_id *isl_multi_id_flatten_range(
5977 __isl_take isl_multi_id *mi);
5979 #include <isl/val.h>
5980 __isl_give isl_multi_val *isl_multi_val_flatten_range(
5981 __isl_take isl_multi_val *mv);
5983 #include <isl/aff.h>
5984 __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
5985 __isl_take isl_multi_aff *ma);
5986 __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
5987 __isl_take isl_multi_aff *ma);
5988 __isl_give isl_multi_pw_aff *
5989 isl_multi_pw_aff_flatten_range(
5990 __isl_take isl_multi_pw_aff *mpa);
5991 __isl_give isl_multi_union_pw_aff *
5992 isl_multi_union_pw_aff_flatten_range(
5993 __isl_take isl_multi_union_pw_aff *mupa);
5995 #include <isl/map.h>
5996 __isl_give isl_map *isl_set_flatten_map(
5997 __isl_take isl_set *set);
5999 The function above constructs a relation
6000 that maps the input set to a flattened version of the set.
6004 Lift the input set to a space with extra dimensions corresponding
6005 to the existentially quantified variables in the input.
6006 In particular, the result lives in a wrapped map where the domain
6007 is the original space and the range corresponds to the original
6008 existentially quantified variables.
6010 #include <isl/set.h>
6011 __isl_give isl_basic_set *isl_basic_set_lift(
6012 __isl_take isl_basic_set *bset);
6013 __isl_give isl_set *isl_set_lift(
6014 __isl_take isl_set *set);
6015 __isl_give isl_union_set *isl_union_set_lift(
6016 __isl_take isl_union_set *uset);
6018 Given a local space that contains the existentially quantified
6019 variables of a set, a basic relation that, when applied to
6020 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
6021 can be constructed using the following function.
6023 #include <isl/local_space.h>
6024 __isl_give isl_basic_map *isl_local_space_lifting(
6025 __isl_take isl_local_space *ls);
6027 #include <isl/aff.h>
6028 __isl_give isl_multi_aff *isl_multi_aff_lift(
6029 __isl_take isl_multi_aff *maff,
6030 __isl_give isl_local_space **ls);
6032 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
6033 then it is assigned the local space that lies at the basis of
6034 the lifting applied.
6036 =item * Internal Product
6038 #include <isl/space.h>
6039 __isl_give isl_space *isl_space_zip(
6040 __isl_take isl_space *space);
6042 #include <isl/map.h>
6043 __isl_give isl_basic_map *isl_basic_map_zip(
6044 __isl_take isl_basic_map *bmap);
6045 __isl_give isl_map *isl_map_zip(
6046 __isl_take isl_map *map);
6048 #include <isl/union_map.h>
6049 __isl_give isl_union_map *isl_union_map_zip(
6050 __isl_take isl_union_map *umap);
6052 Given a relation with nested relations for domain and range,
6053 interchange the range of the domain with the domain of the range.
6057 #include <isl/space.h>
6058 __isl_give isl_space *isl_space_curry(
6059 __isl_take isl_space *space);
6060 __isl_give isl_space *isl_space_uncurry(
6061 __isl_take isl_space *space);
6063 #include <isl/map.h>
6064 __isl_give isl_basic_map *isl_basic_map_curry(
6065 __isl_take isl_basic_map *bmap);
6066 __isl_give isl_basic_map *isl_basic_map_uncurry(
6067 __isl_take isl_basic_map *bmap);
6068 __isl_give isl_map *isl_map_curry(
6069 __isl_take isl_map *map);
6070 __isl_give isl_map *isl_map_uncurry(
6071 __isl_take isl_map *map);
6073 #include <isl/union_map.h>
6074 __isl_give isl_union_map *isl_union_map_curry(
6075 __isl_take isl_union_map *umap);
6076 __isl_give isl_union_map *isl_union_map_uncurry(
6077 __isl_take isl_union_map *umap);
6079 Given a relation with a nested relation for domain,
6080 the C<curry> functions
6081 move the range of the nested relation out of the domain
6082 and use it as the domain of a nested relation in the range,
6083 with the original range as range of this nested relation.
6084 The C<uncurry> functions perform the inverse operation.
6086 #include <isl/space.h>
6087 __isl_give isl_space *isl_space_range_curry(
6088 __isl_take isl_space *space);
6090 #include <isl/map.h>
6091 __isl_give isl_map *isl_map_range_curry(
6092 __isl_take isl_map *map);
6094 #include <isl/union_map.h>
6095 __isl_give isl_union_map *isl_union_map_range_curry(
6096 __isl_take isl_union_map *umap);
6098 These functions apply the currying to the relation that
6099 is nested inside the range of the input.
6101 =item * Aligning parameters
6103 Change the order of the parameters of the given set, relation
6105 such that the first parameters match those of C<model>.
6106 This may involve the introduction of extra parameters.
6107 All parameters need to be named.
6109 #include <isl/space.h>
6110 __isl_give isl_space *isl_space_align_params(
6111 __isl_take isl_space *space1,
6112 __isl_take isl_space *space2)
6114 #include <isl/set.h>
6115 __isl_give isl_basic_set *isl_basic_set_align_params(
6116 __isl_take isl_basic_set *bset,
6117 __isl_take isl_space *model);
6118 __isl_give isl_set *isl_set_align_params(
6119 __isl_take isl_set *set,
6120 __isl_take isl_space *model);
6122 #include <isl/map.h>
6123 __isl_give isl_basic_map *isl_basic_map_align_params(
6124 __isl_take isl_basic_map *bmap,
6125 __isl_take isl_space *model);
6126 __isl_give isl_map *isl_map_align_params(
6127 __isl_take isl_map *map,
6128 __isl_take isl_space *model);
6131 __isl_give isl_multi_id *isl_multi_id_align_params(
6132 __isl_take isl_multi_id *mi,
6133 __isl_take isl_space *model);
6135 #include <isl/val.h>
6136 __isl_give isl_multi_val *isl_multi_val_align_params(
6137 __isl_take isl_multi_val *mv,
6138 __isl_take isl_space *model);
6140 #include <isl/aff.h>
6141 __isl_give isl_aff *isl_aff_align_params(
6142 __isl_take isl_aff *aff,
6143 __isl_take isl_space *model);
6144 __isl_give isl_multi_aff *isl_multi_aff_align_params(
6145 __isl_take isl_multi_aff *multi,
6146 __isl_take isl_space *model);
6147 __isl_give isl_pw_aff *isl_pw_aff_align_params(
6148 __isl_take isl_pw_aff *pwaff,
6149 __isl_take isl_space *model);
6150 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
6151 __isl_take isl_pw_multi_aff *pma,
6152 __isl_take isl_space *model);
6153 __isl_give isl_union_pw_aff *
6154 isl_union_pw_aff_align_params(
6155 __isl_take isl_union_pw_aff *upa,
6156 __isl_take isl_space *model);
6157 __isl_give isl_union_pw_multi_aff *
6158 isl_union_pw_multi_aff_align_params(
6159 __isl_take isl_union_pw_multi_aff *upma,
6160 __isl_take isl_space *model);
6161 __isl_give isl_multi_union_pw_aff *
6162 isl_multi_union_pw_aff_align_params(
6163 __isl_take isl_multi_union_pw_aff *mupa,
6164 __isl_take isl_space *model);
6166 #include <isl/polynomial.h>
6167 __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
6168 __isl_take isl_qpolynomial *qp,
6169 __isl_take isl_space *model);
6171 =item * Drop unused parameters
6173 Drop parameters that are not referenced by the isl object.
6174 All parameters need to be named.
6176 #include <isl/set.h>
6177 __isl_give isl_basic_set *
6178 isl_basic_set_drop_unused_params(
6179 __isl_take isl_basic_set *bset);
6180 __isl_give isl_set *isl_set_drop_unused_params(
6181 __isl_take isl_set *set);
6183 #include <isl/map.h>
6184 __isl_give isl_basic_map *
6185 isl_basic_map_drop_unused_params(
6186 __isl_take isl_basic_map *bmap);
6187 __isl_give isl_map *isl_map_drop_unused_params(
6188 __isl_take isl_map *map);
6190 #include <isl/aff.h>
6191 __isl_give isl_pw_aff *isl_pw_aff_drop_unused_params(
6192 __isl_take isl_pw_aff *pa);
6193 __isl_give isl_pw_multi_aff *
6194 isl_pw_multi_aff_drop_unused_params(
6195 __isl_take isl_pw_multi_aff *pma);
6197 #include <isl/polynomial.h>
6198 __isl_give isl_pw_qpolynomial *
6199 isl_pw_qpolynomial_drop_unused_params(
6200 __isl_take isl_pw_qpolynomial *pwqp);
6201 __isl_give isl_pw_qpolynomial_fold *
6202 isl_pw_qpolynomial_fold_drop_unused_params(
6203 __isl_take isl_pw_qpolynomial_fold *pwf);
6205 =item * Unary Arithmetic Operations
6207 #include <isl/set.h>
6208 __isl_give isl_set *isl_set_neg(
6209 __isl_take isl_set *set);
6210 #include <isl/map.h>
6211 __isl_give isl_map *isl_map_neg(
6212 __isl_take isl_map *map);
6214 C<isl_set_neg> constructs a set containing the opposites of
6215 the elements in its argument.
6216 The domain of the result of C<isl_map_neg> is the same
6217 as the domain of its argument. The corresponding range
6218 elements are the opposites of the corresponding range
6219 elements in the argument.
6221 #include <isl/val.h>
6222 __isl_give isl_multi_val *isl_multi_val_neg(
6223 __isl_take isl_multi_val *mv);
6225 #include <isl/aff.h>
6226 __isl_give isl_aff *isl_aff_neg(
6227 __isl_take isl_aff *aff);
6228 __isl_give isl_multi_aff *isl_multi_aff_neg(
6229 __isl_take isl_multi_aff *ma);
6230 __isl_give isl_pw_aff *isl_pw_aff_neg(
6231 __isl_take isl_pw_aff *pwaff);
6232 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
6233 __isl_take isl_pw_multi_aff *pma);
6234 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
6235 __isl_take isl_multi_pw_aff *mpa);
6236 __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
6237 __isl_take isl_union_pw_aff *upa);
6238 __isl_give isl_union_pw_multi_aff *
6239 isl_union_pw_multi_aff_neg(
6240 __isl_take isl_union_pw_multi_aff *upma);
6241 __isl_give isl_multi_union_pw_aff *
6242 isl_multi_union_pw_aff_neg(
6243 __isl_take isl_multi_union_pw_aff *mupa);
6244 __isl_give isl_aff *isl_aff_ceil(
6245 __isl_take isl_aff *aff);
6246 __isl_give isl_pw_aff *isl_pw_aff_ceil(
6247 __isl_take isl_pw_aff *pwaff);
6248 __isl_give isl_aff *isl_aff_floor(
6249 __isl_take isl_aff *aff);
6250 __isl_give isl_multi_aff *isl_multi_aff_floor(
6251 __isl_take isl_multi_aff *ma);
6252 __isl_give isl_pw_aff *isl_pw_aff_floor(
6253 __isl_take isl_pw_aff *pwaff);
6254 __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
6255 __isl_take isl_union_pw_aff *upa);
6256 __isl_give isl_multi_union_pw_aff *
6257 isl_multi_union_pw_aff_floor(
6258 __isl_take isl_multi_union_pw_aff *mupa);
6260 #include <isl/aff.h>
6261 __isl_give isl_pw_aff *isl_pw_aff_list_min(
6262 __isl_take isl_pw_aff_list *list);
6263 __isl_give isl_pw_aff *isl_pw_aff_list_max(
6264 __isl_take isl_pw_aff_list *list);
6266 #include <isl/polynomial.h>
6267 __isl_give isl_qpolynomial *isl_qpolynomial_neg(
6268 __isl_take isl_qpolynomial *qp);
6269 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
6270 __isl_take isl_pw_qpolynomial *pwqp);
6271 __isl_give isl_union_pw_qpolynomial *
6272 isl_union_pw_qpolynomial_neg(
6273 __isl_take isl_union_pw_qpolynomial *upwqp);
6274 __isl_give isl_qpolynomial *isl_qpolynomial_pow(
6275 __isl_take isl_qpolynomial *qp,
6277 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
6278 __isl_take isl_pw_qpolynomial *pwqp,
6283 The following functions evaluate a function in a point.
6285 #include <isl/aff.h>
6286 __isl_give isl_val *isl_aff_eval(
6287 __isl_take isl_aff *aff,
6288 __isl_take isl_point *pnt);
6289 __isl_give isl_val *isl_pw_aff_eval(
6290 __isl_take isl_pw_aff *pa,
6291 __isl_take isl_point *pnt);
6293 #include <isl/polynomial.h>
6294 __isl_give isl_val *isl_pw_qpolynomial_eval(
6295 __isl_take isl_pw_qpolynomial *pwqp,
6296 __isl_take isl_point *pnt);
6297 __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
6298 __isl_take isl_pw_qpolynomial_fold *pwf,
6299 __isl_take isl_point *pnt);
6300 __isl_give isl_val *isl_union_pw_qpolynomial_eval(
6301 __isl_take isl_union_pw_qpolynomial *upwqp,
6302 __isl_take isl_point *pnt);
6303 __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
6304 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6305 __isl_take isl_point *pnt);
6307 These functions return NaN when evaluated at a void point.
6308 Note that C<isl_pw_aff_eval> returns NaN when the function is evaluated outside
6309 its definition domain, while C<isl_pw_qpolynomial_eval> returns zero
6310 when the function is evaluated outside its explicit domain.
6312 =item * Dimension manipulation
6314 It is usually not advisable to directly change the (input or output)
6315 space of a set or a relation as this removes the name and the internal
6316 structure of the space. However, the functions below can be useful
6317 to add new parameters, assuming
6318 C<isl_set_align_params> and C<isl_map_align_params>
6321 #include <isl/space.h>
6322 __isl_give isl_space *isl_space_add_dims(
6323 __isl_take isl_space *space,
6324 enum isl_dim_type type, unsigned n);
6325 __isl_give isl_space *isl_space_insert_dims(
6326 __isl_take isl_space *space,
6327 enum isl_dim_type type, unsigned pos, unsigned n);
6328 __isl_give isl_space *isl_space_drop_dims(
6329 __isl_take isl_space *space,
6330 enum isl_dim_type type, unsigned first, unsigned n);
6331 __isl_give isl_space *isl_space_move_dims(
6332 __isl_take isl_space *space,
6333 enum isl_dim_type dst_type, unsigned dst_pos,
6334 enum isl_dim_type src_type, unsigned src_pos,
6337 #include <isl/local_space.h>
6338 __isl_give isl_local_space *isl_local_space_add_dims(
6339 __isl_take isl_local_space *ls,
6340 enum isl_dim_type type, unsigned n);
6341 __isl_give isl_local_space *isl_local_space_insert_dims(
6342 __isl_take isl_local_space *ls,
6343 enum isl_dim_type type, unsigned first, unsigned n);
6344 __isl_give isl_local_space *isl_local_space_drop_dims(
6345 __isl_take isl_local_space *ls,
6346 enum isl_dim_type type, unsigned first, unsigned n);
6348 #include <isl/set.h>
6349 __isl_give isl_basic_set *isl_basic_set_add_dims(
6350 __isl_take isl_basic_set *bset,
6351 enum isl_dim_type type, unsigned n);
6352 __isl_give isl_set *isl_set_add_dims(
6353 __isl_take isl_set *set,
6354 enum isl_dim_type type, unsigned n);
6355 __isl_give isl_basic_set *isl_basic_set_insert_dims(
6356 __isl_take isl_basic_set *bset,
6357 enum isl_dim_type type, unsigned pos,
6359 __isl_give isl_set *isl_set_insert_dims(
6360 __isl_take isl_set *set,
6361 enum isl_dim_type type, unsigned pos, unsigned n);
6362 __isl_give isl_basic_set *isl_basic_set_move_dims(
6363 __isl_take isl_basic_set *bset,
6364 enum isl_dim_type dst_type, unsigned dst_pos,
6365 enum isl_dim_type src_type, unsigned src_pos,
6367 __isl_give isl_set *isl_set_move_dims(
6368 __isl_take isl_set *set,
6369 enum isl_dim_type dst_type, unsigned dst_pos,
6370 enum isl_dim_type src_type, unsigned src_pos,
6373 #include <isl/map.h>
6374 __isl_give isl_basic_map *isl_basic_map_add_dims(
6375 __isl_take isl_basic_map *bmap,
6376 enum isl_dim_type type, unsigned n);
6377 __isl_give isl_map *isl_map_add_dims(
6378 __isl_take isl_map *map,
6379 enum isl_dim_type type, unsigned n);
6380 __isl_give isl_basic_map *isl_basic_map_insert_dims(
6381 __isl_take isl_basic_map *bmap,
6382 enum isl_dim_type type, unsigned pos,
6384 __isl_give isl_map *isl_map_insert_dims(
6385 __isl_take isl_map *map,
6386 enum isl_dim_type type, unsigned pos, unsigned n);
6387 __isl_give isl_basic_map *isl_basic_map_move_dims(
6388 __isl_take isl_basic_map *bmap,
6389 enum isl_dim_type dst_type, unsigned dst_pos,
6390 enum isl_dim_type src_type, unsigned src_pos,
6392 __isl_give isl_map *isl_map_move_dims(
6393 __isl_take isl_map *map,
6394 enum isl_dim_type dst_type, unsigned dst_pos,
6395 enum isl_dim_type src_type, unsigned src_pos,
6398 #include <isl/val.h>
6399 __isl_give isl_multi_val *isl_multi_val_insert_dims(
6400 __isl_take isl_multi_val *mv,
6401 enum isl_dim_type type, unsigned first, unsigned n);
6402 __isl_give isl_multi_val *isl_multi_val_add_dims(
6403 __isl_take isl_multi_val *mv,
6404 enum isl_dim_type type, unsigned n);
6405 __isl_give isl_multi_val *isl_multi_val_drop_dims(
6406 __isl_take isl_multi_val *mv,
6407 enum isl_dim_type type, unsigned first, unsigned n);
6409 #include <isl/aff.h>
6410 __isl_give isl_aff *isl_aff_insert_dims(
6411 __isl_take isl_aff *aff,
6412 enum isl_dim_type type, unsigned first, unsigned n);
6413 __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
6414 __isl_take isl_multi_aff *ma,
6415 enum isl_dim_type type, unsigned first, unsigned n);
6416 __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
6417 __isl_take isl_pw_aff *pwaff,
6418 enum isl_dim_type type, unsigned first, unsigned n);
6419 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
6420 __isl_take isl_multi_pw_aff *mpa,
6421 enum isl_dim_type type, unsigned first, unsigned n);
6422 __isl_give isl_aff *isl_aff_add_dims(
6423 __isl_take isl_aff *aff,
6424 enum isl_dim_type type, unsigned n);
6425 __isl_give isl_multi_aff *isl_multi_aff_add_dims(
6426 __isl_take isl_multi_aff *ma,
6427 enum isl_dim_type type, unsigned n);
6428 __isl_give isl_pw_aff *isl_pw_aff_add_dims(
6429 __isl_take isl_pw_aff *pwaff,
6430 enum isl_dim_type type, unsigned n);
6431 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
6432 __isl_take isl_multi_pw_aff *mpa,
6433 enum isl_dim_type type, unsigned n);
6434 __isl_give isl_aff *isl_aff_drop_dims(
6435 __isl_take isl_aff *aff,
6436 enum isl_dim_type type, unsigned first, unsigned n);
6437 __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
6438 __isl_take isl_multi_aff *maff,
6439 enum isl_dim_type type, unsigned first, unsigned n);
6440 __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
6441 __isl_take isl_pw_aff *pwaff,
6442 enum isl_dim_type type, unsigned first, unsigned n);
6443 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
6444 __isl_take isl_pw_multi_aff *pma,
6445 enum isl_dim_type type, unsigned first, unsigned n);
6446 __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
6447 __isl_take isl_union_pw_aff *upa,
6448 enum isl_dim_type type, unsigned first, unsigned n);
6449 __isl_give isl_union_pw_multi_aff *
6450 isl_union_pw_multi_aff_drop_dims(
6451 __isl_take isl_union_pw_multi_aff *upma,
6452 enum isl_dim_type type,
6453 unsigned first, unsigned n);
6454 __isl_give isl_multi_union_pw_aff *
6455 isl_multi_union_pw_aff_drop_dims(
6456 __isl_take isl_multi_union_pw_aff *mupa,
6457 enum isl_dim_type type, unsigned first,
6459 __isl_give isl_aff *isl_aff_move_dims(
6460 __isl_take isl_aff *aff,
6461 enum isl_dim_type dst_type, unsigned dst_pos,
6462 enum isl_dim_type src_type, unsigned src_pos,
6464 __isl_give isl_multi_aff *isl_multi_aff_move_dims(
6465 __isl_take isl_multi_aff *ma,
6466 enum isl_dim_type dst_type, unsigned dst_pos,
6467 enum isl_dim_type src_type, unsigned src_pos,
6469 __isl_give isl_pw_aff *isl_pw_aff_move_dims(
6470 __isl_take isl_pw_aff *pa,
6471 enum isl_dim_type dst_type, unsigned dst_pos,
6472 enum isl_dim_type src_type, unsigned src_pos,
6474 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
6475 __isl_take isl_multi_pw_aff *pma,
6476 enum isl_dim_type dst_type, unsigned dst_pos,
6477 enum isl_dim_type src_type, unsigned src_pos,
6480 #include <isl/polynomial.h>
6481 __isl_give isl_union_pw_qpolynomial *
6482 isl_union_pw_qpolynomial_drop_dims(
6483 __isl_take isl_union_pw_qpolynomial *upwqp,
6484 enum isl_dim_type type,
6485 unsigned first, unsigned n);
6486 __isl_give isl_union_pw_qpolynomial_fold *
6487 isl_union_pw_qpolynomial_fold_drop_dims(
6488 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6489 enum isl_dim_type type,
6490 unsigned first, unsigned n);
6492 The operations on union expressions can only manipulate parameters.
6496 =head2 Binary Operations
6498 The two arguments of a binary operation not only need to live
6499 in the same C<isl_ctx>, they currently also need to have
6500 the same (number of) parameters.
6502 =head3 Basic Operations
6506 =item * Intersection
6508 #include <isl/local_space.h>
6509 __isl_give isl_local_space *isl_local_space_intersect(
6510 __isl_take isl_local_space *ls1,
6511 __isl_take isl_local_space *ls2);
6513 #include <isl/set.h>
6514 __isl_give isl_basic_set *isl_basic_set_intersect_params(
6515 __isl_take isl_basic_set *bset1,
6516 __isl_take isl_basic_set *bset2);
6517 __isl_give isl_basic_set *isl_basic_set_intersect(
6518 __isl_take isl_basic_set *bset1,
6519 __isl_take isl_basic_set *bset2);
6520 __isl_give isl_basic_set *isl_basic_set_list_intersect(
6521 __isl_take struct isl_basic_set_list *list);
6522 __isl_give isl_set *isl_set_intersect_params(
6523 __isl_take isl_set *set,
6524 __isl_take isl_set *params);
6525 __isl_give isl_set *isl_set_intersect(
6526 __isl_take isl_set *set1,
6527 __isl_take isl_set *set2);
6529 #include <isl/map.h>
6530 __isl_give isl_basic_map *isl_basic_map_intersect_domain(
6531 __isl_take isl_basic_map *bmap,
6532 __isl_take isl_basic_set *bset);
6533 __isl_give isl_basic_map *isl_basic_map_intersect_range(
6534 __isl_take isl_basic_map *bmap,
6535 __isl_take isl_basic_set *bset);
6536 __isl_give isl_basic_map *isl_basic_map_intersect(
6537 __isl_take isl_basic_map *bmap1,
6538 __isl_take isl_basic_map *bmap2);
6539 __isl_give isl_basic_map *isl_basic_map_list_intersect(
6540 __isl_take isl_basic_map_list *list);
6541 __isl_give isl_map *isl_map_intersect_params(
6542 __isl_take isl_map *map,
6543 __isl_take isl_set *params);
6544 __isl_give isl_map *isl_map_intersect_domain(
6545 __isl_take isl_map *map,
6546 __isl_take isl_set *set);
6547 __isl_give isl_map *isl_map_intersect_range(
6548 __isl_take isl_map *map,
6549 __isl_take isl_set *set);
6550 __isl_give isl_map *isl_map_intersect(
6551 __isl_take isl_map *map1,
6552 __isl_take isl_map *map2);
6553 __isl_give isl_map *
6554 isl_map_intersect_domain_factor_range(
6555 __isl_take isl_map *map,
6556 __isl_take isl_map *factor);
6557 __isl_give isl_map *
6558 isl_map_intersect_range_factor_range(
6559 __isl_take isl_map *map,
6560 __isl_take isl_map *factor);
6562 #include <isl/union_set.h>
6563 __isl_give isl_union_set *isl_union_set_intersect_params(
6564 __isl_take isl_union_set *uset,
6565 __isl_take isl_set *set);
6566 __isl_give isl_union_set *isl_union_set_intersect(
6567 __isl_take isl_union_set *uset1,
6568 __isl_take isl_union_set *uset2);
6570 #include <isl/union_map.h>
6571 __isl_give isl_union_map *isl_union_map_intersect_params(
6572 __isl_take isl_union_map *umap,
6573 __isl_take isl_set *set);
6574 __isl_give isl_union_map *isl_union_map_intersect_domain(
6575 __isl_take isl_union_map *umap,
6576 __isl_take isl_union_set *uset);
6577 __isl_give isl_union_map *isl_union_map_intersect_range(
6578 __isl_take isl_union_map *umap,
6579 __isl_take isl_union_set *uset);
6580 __isl_give isl_union_map *isl_union_map_intersect(
6581 __isl_take isl_union_map *umap1,
6582 __isl_take isl_union_map *umap2);
6583 __isl_give isl_union_map *
6584 isl_union_map_intersect_range_factor_range(
6585 __isl_take isl_union_map *umap,
6586 __isl_take isl_union_map *factor);
6588 #include <isl/aff.h>
6589 __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
6590 __isl_take isl_pw_aff *pa,
6591 __isl_take isl_set *set);
6592 __isl_give isl_multi_pw_aff *
6593 isl_multi_pw_aff_intersect_domain(
6594 __isl_take isl_multi_pw_aff *mpa,
6595 __isl_take isl_set *domain);
6596 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
6597 __isl_take isl_pw_multi_aff *pma,
6598 __isl_take isl_set *set);
6599 __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
6600 __isl_take isl_union_pw_aff *upa,
6601 __isl_take isl_union_set *uset);
6602 __isl_give isl_union_pw_multi_aff *
6603 isl_union_pw_multi_aff_intersect_domain(
6604 __isl_take isl_union_pw_multi_aff *upma,
6605 __isl_take isl_union_set *uset);
6606 __isl_give isl_multi_union_pw_aff *
6607 isl_multi_union_pw_aff_intersect_domain(
6608 __isl_take isl_multi_union_pw_aff *mupa,
6609 __isl_take isl_union_set *uset);
6610 __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
6611 __isl_take isl_pw_aff *pa,
6612 __isl_take isl_set *set);
6613 __isl_give isl_multi_pw_aff *
6614 isl_multi_pw_aff_intersect_params(
6615 __isl_take isl_multi_pw_aff *mpa,
6616 __isl_take isl_set *set);
6617 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
6618 __isl_take isl_pw_multi_aff *pma,
6619 __isl_take isl_set *set);
6620 __isl_give isl_union_pw_aff *
6621 isl_union_pw_aff_intersect_params(
6622 __isl_take isl_union_pw_aff *upa,
6623 __isl_give isl_union_pw_multi_aff *
6624 isl_union_pw_multi_aff_intersect_params(
6625 __isl_take isl_union_pw_multi_aff *upma,
6626 __isl_take isl_set *set);
6627 __isl_give isl_multi_union_pw_aff *
6628 isl_multi_union_pw_aff_intersect_params(
6629 __isl_take isl_multi_union_pw_aff *mupa,
6630 __isl_take isl_set *params);
6631 isl_multi_union_pw_aff_intersect_range(
6632 __isl_take isl_multi_union_pw_aff *mupa,
6633 __isl_take isl_set *set);
6635 #include <isl/polynomial.h>
6636 __isl_give isl_pw_qpolynomial *
6637 isl_pw_qpolynomial_intersect_domain(
6638 __isl_take isl_pw_qpolynomial *pwpq,
6639 __isl_take isl_set *set);
6640 __isl_give isl_union_pw_qpolynomial *
6641 isl_union_pw_qpolynomial_intersect_domain(
6642 __isl_take isl_union_pw_qpolynomial *upwpq,
6643 __isl_take isl_union_set *uset);
6644 __isl_give isl_union_pw_qpolynomial_fold *
6645 isl_union_pw_qpolynomial_fold_intersect_domain(
6646 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6647 __isl_take isl_union_set *uset);
6648 __isl_give isl_pw_qpolynomial *
6649 isl_pw_qpolynomial_intersect_params(
6650 __isl_take isl_pw_qpolynomial *pwpq,
6651 __isl_take isl_set *set);
6652 __isl_give isl_pw_qpolynomial_fold *
6653 isl_pw_qpolynomial_fold_intersect_params(
6654 __isl_take isl_pw_qpolynomial_fold *pwf,
6655 __isl_take isl_set *set);
6656 __isl_give isl_union_pw_qpolynomial *
6657 isl_union_pw_qpolynomial_intersect_params(
6658 __isl_take isl_union_pw_qpolynomial *upwpq,
6659 __isl_take isl_set *set);
6660 __isl_give isl_union_pw_qpolynomial_fold *
6661 isl_union_pw_qpolynomial_fold_intersect_params(
6662 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6663 __isl_take isl_set *set);
6665 The second argument to the C<_params> functions needs to be
6666 a parametric (basic) set. For the other functions, a parametric set
6667 for either argument is only allowed if the other argument is
6668 a parametric set as well.
6669 The list passed to C<isl_basic_set_list_intersect> needs to have
6670 at least one element and all elements need to live in the same space.
6671 The function C<isl_multi_union_pw_aff_intersect_range>
6672 restricts the input function to those shared domain elements
6673 that map to the specified range.
6677 #include <isl/set.h>
6678 __isl_give isl_set *isl_basic_set_union(
6679 __isl_take isl_basic_set *bset1,
6680 __isl_take isl_basic_set *bset2);
6681 __isl_give isl_set *isl_set_union(
6682 __isl_take isl_set *set1,
6683 __isl_take isl_set *set2);
6684 __isl_give isl_set *isl_set_list_union(
6685 __isl_take isl_set_list *list);
6687 #include <isl/map.h>
6688 __isl_give isl_map *isl_basic_map_union(
6689 __isl_take isl_basic_map *bmap1,
6690 __isl_take isl_basic_map *bmap2);
6691 __isl_give isl_map *isl_map_union(
6692 __isl_take isl_map *map1,
6693 __isl_take isl_map *map2);
6695 #include <isl/union_set.h>
6696 __isl_give isl_union_set *isl_union_set_union(
6697 __isl_take isl_union_set *uset1,
6698 __isl_take isl_union_set *uset2);
6699 __isl_give isl_union_set *isl_union_set_list_union(
6700 __isl_take isl_union_set_list *list);
6702 #include <isl/union_map.h>
6703 __isl_give isl_union_map *isl_union_map_union(
6704 __isl_take isl_union_map *umap1,
6705 __isl_take isl_union_map *umap2);
6707 The list passed to C<isl_set_list_union> needs to have
6708 at least one element and all elements need to live in the same space.
6710 =item * Set difference
6712 #include <isl/set.h>
6713 __isl_give isl_set *isl_set_subtract(
6714 __isl_take isl_set *set1,
6715 __isl_take isl_set *set2);
6717 #include <isl/map.h>
6718 __isl_give isl_map *isl_map_subtract(
6719 __isl_take isl_map *map1,
6720 __isl_take isl_map *map2);
6721 __isl_give isl_map *isl_map_subtract_domain(
6722 __isl_take isl_map *map,
6723 __isl_take isl_set *dom);
6724 __isl_give isl_map *isl_map_subtract_range(
6725 __isl_take isl_map *map,
6726 __isl_take isl_set *dom);
6728 #include <isl/union_set.h>
6729 __isl_give isl_union_set *isl_union_set_subtract(
6730 __isl_take isl_union_set *uset1,
6731 __isl_take isl_union_set *uset2);
6733 #include <isl/union_map.h>
6734 __isl_give isl_union_map *isl_union_map_subtract(
6735 __isl_take isl_union_map *umap1,
6736 __isl_take isl_union_map *umap2);
6737 __isl_give isl_union_map *isl_union_map_subtract_domain(
6738 __isl_take isl_union_map *umap,
6739 __isl_take isl_union_set *dom);
6740 __isl_give isl_union_map *isl_union_map_subtract_range(
6741 __isl_take isl_union_map *umap,
6742 __isl_take isl_union_set *dom);
6744 #include <isl/aff.h>
6745 __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
6746 __isl_take isl_pw_aff *pa,
6747 __isl_take isl_set *set);
6748 __isl_give isl_pw_multi_aff *
6749 isl_pw_multi_aff_subtract_domain(
6750 __isl_take isl_pw_multi_aff *pma,
6751 __isl_take isl_set *set);
6752 __isl_give isl_union_pw_aff *
6753 isl_union_pw_aff_subtract_domain(
6754 __isl_take isl_union_pw_aff *upa,
6755 __isl_take isl_union_set *uset);
6756 __isl_give isl_union_pw_multi_aff *
6757 isl_union_pw_multi_aff_subtract_domain(
6758 __isl_take isl_union_pw_multi_aff *upma,
6759 __isl_take isl_set *set);
6761 #include <isl/polynomial.h>
6762 __isl_give isl_pw_qpolynomial *
6763 isl_pw_qpolynomial_subtract_domain(
6764 __isl_take isl_pw_qpolynomial *pwpq,
6765 __isl_take isl_set *set);
6766 __isl_give isl_pw_qpolynomial_fold *
6767 isl_pw_qpolynomial_fold_subtract_domain(
6768 __isl_take isl_pw_qpolynomial_fold *pwf,
6769 __isl_take isl_set *set);
6770 __isl_give isl_union_pw_qpolynomial *
6771 isl_union_pw_qpolynomial_subtract_domain(
6772 __isl_take isl_union_pw_qpolynomial *upwpq,
6773 __isl_take isl_union_set *uset);
6774 __isl_give isl_union_pw_qpolynomial_fold *
6775 isl_union_pw_qpolynomial_fold_subtract_domain(
6776 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6777 __isl_take isl_union_set *uset);
6781 #include <isl/space.h>
6782 __isl_give isl_space *isl_space_join(
6783 __isl_take isl_space *left,
6784 __isl_take isl_space *right);
6786 #include <isl/map.h>
6787 __isl_give isl_basic_set *isl_basic_set_apply(
6788 __isl_take isl_basic_set *bset,
6789 __isl_take isl_basic_map *bmap);
6790 __isl_give isl_set *isl_set_apply(
6791 __isl_take isl_set *set,
6792 __isl_take isl_map *map);
6793 __isl_give isl_union_set *isl_union_set_apply(
6794 __isl_take isl_union_set *uset,
6795 __isl_take isl_union_map *umap);
6796 __isl_give isl_basic_map *isl_basic_map_apply_domain(
6797 __isl_take isl_basic_map *bmap1,
6798 __isl_take isl_basic_map *bmap2);
6799 __isl_give isl_basic_map *isl_basic_map_apply_range(
6800 __isl_take isl_basic_map *bmap1,
6801 __isl_take isl_basic_map *bmap2);
6802 __isl_give isl_map *isl_map_apply_domain(
6803 __isl_take isl_map *map1,
6804 __isl_take isl_map *map2);
6805 __isl_give isl_map *isl_map_apply_range(
6806 __isl_take isl_map *map1,
6807 __isl_take isl_map *map2);
6809 #include <isl/union_map.h>
6810 __isl_give isl_union_map *isl_union_map_apply_domain(
6811 __isl_take isl_union_map *umap1,
6812 __isl_take isl_union_map *umap2);
6813 __isl_give isl_union_map *isl_union_map_apply_range(
6814 __isl_take isl_union_map *umap1,
6815 __isl_take isl_union_map *umap2);
6817 #include <isl/aff.h>
6818 __isl_give isl_union_pw_aff *
6819 isl_multi_union_pw_aff_apply_aff(
6820 __isl_take isl_multi_union_pw_aff *mupa,
6821 __isl_take isl_aff *aff);
6822 __isl_give isl_union_pw_aff *
6823 isl_multi_union_pw_aff_apply_pw_aff(
6824 __isl_take isl_multi_union_pw_aff *mupa,
6825 __isl_take isl_pw_aff *pa);
6826 __isl_give isl_multi_union_pw_aff *
6827 isl_multi_union_pw_aff_apply_multi_aff(
6828 __isl_take isl_multi_union_pw_aff *mupa,
6829 __isl_take isl_multi_aff *ma);
6830 __isl_give isl_multi_union_pw_aff *
6831 isl_multi_union_pw_aff_apply_pw_multi_aff(
6832 __isl_take isl_multi_union_pw_aff *mupa,
6833 __isl_take isl_pw_multi_aff *pma);
6835 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
6836 over the shared domain of the elements of the input. The dimension is
6837 required to be greater than zero.
6838 The C<isl_multi_union_pw_aff> argument of
6839 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
6840 but only if the range of the C<isl_multi_aff> argument
6841 is also zero-dimensional.
6842 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
6844 #include <isl/polynomial.h>
6845 __isl_give isl_pw_qpolynomial_fold *
6846 isl_set_apply_pw_qpolynomial_fold(
6847 __isl_take isl_set *set,
6848 __isl_take isl_pw_qpolynomial_fold *pwf,
6850 __isl_give isl_pw_qpolynomial_fold *
6851 isl_map_apply_pw_qpolynomial_fold(
6852 __isl_take isl_map *map,
6853 __isl_take isl_pw_qpolynomial_fold *pwf,
6855 __isl_give isl_union_pw_qpolynomial_fold *
6856 isl_union_set_apply_union_pw_qpolynomial_fold(
6857 __isl_take isl_union_set *uset,
6858 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6860 __isl_give isl_union_pw_qpolynomial_fold *
6861 isl_union_map_apply_union_pw_qpolynomial_fold(
6862 __isl_take isl_union_map *umap,
6863 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6866 The functions taking a map
6867 compose the given map with the given piecewise quasipolynomial reduction.
6868 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
6869 over all elements in the intersection of the range of the map
6870 and the domain of the piecewise quasipolynomial reduction
6871 as a function of an element in the domain of the map.
6872 The functions taking a set compute a bound over all elements in the
6873 intersection of the set and the domain of the
6874 piecewise quasipolynomial reduction.
6878 #include <isl/set.h>
6879 __isl_give isl_basic_set *
6880 isl_basic_set_preimage_multi_aff(
6881 __isl_take isl_basic_set *bset,
6882 __isl_take isl_multi_aff *ma);
6883 __isl_give isl_set *isl_set_preimage_multi_aff(
6884 __isl_take isl_set *set,
6885 __isl_take isl_multi_aff *ma);
6886 __isl_give isl_set *isl_set_preimage_pw_multi_aff(
6887 __isl_take isl_set *set,
6888 __isl_take isl_pw_multi_aff *pma);
6889 __isl_give isl_set *isl_set_preimage_multi_pw_aff(
6890 __isl_take isl_set *set,
6891 __isl_take isl_multi_pw_aff *mpa);
6893 #include <isl/union_set.h>
6894 __isl_give isl_union_set *
6895 isl_union_set_preimage_multi_aff(
6896 __isl_take isl_union_set *uset,
6897 __isl_take isl_multi_aff *ma);
6898 __isl_give isl_union_set *
6899 isl_union_set_preimage_pw_multi_aff(
6900 __isl_take isl_union_set *uset,
6901 __isl_take isl_pw_multi_aff *pma);
6902 __isl_give isl_union_set *
6903 isl_union_set_preimage_union_pw_multi_aff(
6904 __isl_take isl_union_set *uset,
6905 __isl_take isl_union_pw_multi_aff *upma);
6907 #include <isl/map.h>
6908 __isl_give isl_basic_map *
6909 isl_basic_map_preimage_domain_multi_aff(
6910 __isl_take isl_basic_map *bmap,
6911 __isl_take isl_multi_aff *ma);
6912 __isl_give isl_map *isl_map_preimage_domain_multi_aff(
6913 __isl_take isl_map *map,
6914 __isl_take isl_multi_aff *ma);
6915 __isl_give isl_map *isl_map_preimage_range_multi_aff(
6916 __isl_take isl_map *map,
6917 __isl_take isl_multi_aff *ma);
6918 __isl_give isl_map *
6919 isl_map_preimage_domain_pw_multi_aff(
6920 __isl_take isl_map *map,
6921 __isl_take isl_pw_multi_aff *pma);
6922 __isl_give isl_map *
6923 isl_map_preimage_range_pw_multi_aff(
6924 __isl_take isl_map *map,
6925 __isl_take isl_pw_multi_aff *pma);
6926 __isl_give isl_map *
6927 isl_map_preimage_domain_multi_pw_aff(
6928 __isl_take isl_map *map,
6929 __isl_take isl_multi_pw_aff *mpa);
6930 __isl_give isl_basic_map *
6931 isl_basic_map_preimage_range_multi_aff(
6932 __isl_take isl_basic_map *bmap,
6933 __isl_take isl_multi_aff *ma);
6935 #include <isl/union_map.h>
6936 __isl_give isl_union_map *
6937 isl_union_map_preimage_domain_multi_aff(
6938 __isl_take isl_union_map *umap,
6939 __isl_take isl_multi_aff *ma);
6940 __isl_give isl_union_map *
6941 isl_union_map_preimage_range_multi_aff(
6942 __isl_take isl_union_map *umap,
6943 __isl_take isl_multi_aff *ma);
6944 __isl_give isl_union_map *
6945 isl_union_map_preimage_domain_pw_multi_aff(
6946 __isl_take isl_union_map *umap,
6947 __isl_take isl_pw_multi_aff *pma);
6948 __isl_give isl_union_map *
6949 isl_union_map_preimage_range_pw_multi_aff(
6950 __isl_take isl_union_map *umap,
6951 __isl_take isl_pw_multi_aff *pma);
6952 __isl_give isl_union_map *
6953 isl_union_map_preimage_domain_union_pw_multi_aff(
6954 __isl_take isl_union_map *umap,
6955 __isl_take isl_union_pw_multi_aff *upma);
6956 __isl_give isl_union_map *
6957 isl_union_map_preimage_range_union_pw_multi_aff(
6958 __isl_take isl_union_map *umap,
6959 __isl_take isl_union_pw_multi_aff *upma);
6961 These functions compute the preimage of the given set or map domain/range under
6962 the given function. In other words, the expression is plugged
6963 into the set description or into the domain/range of the map.
6967 #include <isl/aff.h>
6968 __isl_give isl_aff *isl_aff_pullback_aff(
6969 __isl_take isl_aff *aff1,
6970 __isl_take isl_aff *aff2);
6971 __isl_give isl_aff *isl_aff_pullback_multi_aff(
6972 __isl_take isl_aff *aff,
6973 __isl_take isl_multi_aff *ma);
6974 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
6975 __isl_take isl_pw_aff *pa,
6976 __isl_take isl_multi_aff *ma);
6977 __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
6978 __isl_take isl_pw_aff *pa,
6979 __isl_take isl_pw_multi_aff *pma);
6980 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
6981 __isl_take isl_pw_aff *pa,
6982 __isl_take isl_multi_pw_aff *mpa);
6983 __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
6984 __isl_take isl_multi_aff *ma1,
6985 __isl_take isl_multi_aff *ma2);
6986 __isl_give isl_pw_multi_aff *
6987 isl_pw_multi_aff_pullback_multi_aff(
6988 __isl_take isl_pw_multi_aff *pma,
6989 __isl_take isl_multi_aff *ma);
6990 __isl_give isl_multi_pw_aff *
6991 isl_multi_pw_aff_pullback_multi_aff(
6992 __isl_take isl_multi_pw_aff *mpa,
6993 __isl_take isl_multi_aff *ma);
6994 __isl_give isl_pw_multi_aff *
6995 isl_pw_multi_aff_pullback_pw_multi_aff(
6996 __isl_take isl_pw_multi_aff *pma1,
6997 __isl_take isl_pw_multi_aff *pma2);
6998 __isl_give isl_multi_pw_aff *
6999 isl_multi_pw_aff_pullback_pw_multi_aff(
7000 __isl_take isl_multi_pw_aff *mpa,
7001 __isl_take isl_pw_multi_aff *pma);
7002 __isl_give isl_multi_pw_aff *
7003 isl_multi_pw_aff_pullback_multi_pw_aff(
7004 __isl_take isl_multi_pw_aff *mpa1,
7005 __isl_take isl_multi_pw_aff *mpa2);
7006 __isl_give isl_union_pw_aff *
7007 isl_union_pw_aff_pullback_union_pw_multi_aff(
7008 __isl_take isl_union_pw_aff *upa,
7009 __isl_take isl_union_pw_multi_aff *upma);
7010 __isl_give isl_union_pw_multi_aff *
7011 isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
7012 __isl_take isl_union_pw_multi_aff *upma1,
7013 __isl_take isl_union_pw_multi_aff *upma2);
7014 __isl_give isl_multi_union_pw_aff *
7015 isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
7016 __isl_take isl_multi_union_pw_aff *mupa,
7017 __isl_take isl_union_pw_multi_aff *upma);
7019 These functions precompose the first expression by the second function.
7020 In other words, the second function is plugged
7021 into the first expression.
7025 #include <isl/aff.h>
7026 __isl_give isl_basic_set *isl_aff_eq_basic_set(
7027 __isl_take isl_aff *aff1,
7028 __isl_take isl_aff *aff2);
7029 __isl_give isl_set *isl_aff_eq_set(
7030 __isl_take isl_aff *aff1,
7031 __isl_take isl_aff *aff2);
7032 __isl_give isl_set *isl_aff_ne_set(
7033 __isl_take isl_aff *aff1,
7034 __isl_take isl_aff *aff2);
7035 __isl_give isl_basic_set *isl_aff_le_basic_set(
7036 __isl_take isl_aff *aff1,
7037 __isl_take isl_aff *aff2);
7038 __isl_give isl_set *isl_aff_le_set(
7039 __isl_take isl_aff *aff1,
7040 __isl_take isl_aff *aff2);
7041 __isl_give isl_basic_set *isl_aff_lt_basic_set(
7042 __isl_take isl_aff *aff1,
7043 __isl_take isl_aff *aff2);
7044 __isl_give isl_set *isl_aff_lt_set(
7045 __isl_take isl_aff *aff1,
7046 __isl_take isl_aff *aff2);
7047 __isl_give isl_basic_set *isl_aff_ge_basic_set(
7048 __isl_take isl_aff *aff1,
7049 __isl_take isl_aff *aff2);
7050 __isl_give isl_set *isl_aff_ge_set(
7051 __isl_take isl_aff *aff1,
7052 __isl_take isl_aff *aff2);
7053 __isl_give isl_basic_set *isl_aff_gt_basic_set(
7054 __isl_take isl_aff *aff1,
7055 __isl_take isl_aff *aff2);
7056 __isl_give isl_set *isl_aff_gt_set(
7057 __isl_take isl_aff *aff1,
7058 __isl_take isl_aff *aff2);
7059 __isl_give isl_set *isl_pw_aff_eq_set(
7060 __isl_take isl_pw_aff *pwaff1,
7061 __isl_take isl_pw_aff *pwaff2);
7062 __isl_give isl_set *isl_pw_aff_ne_set(
7063 __isl_take isl_pw_aff *pwaff1,
7064 __isl_take isl_pw_aff *pwaff2);
7065 __isl_give isl_set *isl_pw_aff_le_set(
7066 __isl_take isl_pw_aff *pwaff1,
7067 __isl_take isl_pw_aff *pwaff2);
7068 __isl_give isl_set *isl_pw_aff_lt_set(
7069 __isl_take isl_pw_aff *pwaff1,
7070 __isl_take isl_pw_aff *pwaff2);
7071 __isl_give isl_set *isl_pw_aff_ge_set(
7072 __isl_take isl_pw_aff *pwaff1,
7073 __isl_take isl_pw_aff *pwaff2);
7074 __isl_give isl_set *isl_pw_aff_gt_set(
7075 __isl_take isl_pw_aff *pwaff1,
7076 __isl_take isl_pw_aff *pwaff2);
7078 __isl_give isl_set *isl_multi_aff_lex_le_set(
7079 __isl_take isl_multi_aff *ma1,
7080 __isl_take isl_multi_aff *ma2);
7081 __isl_give isl_set *isl_multi_aff_lex_lt_set(
7082 __isl_take isl_multi_aff *ma1,
7083 __isl_take isl_multi_aff *ma2);
7084 __isl_give isl_set *isl_multi_aff_lex_ge_set(
7085 __isl_take isl_multi_aff *ma1,
7086 __isl_take isl_multi_aff *ma2);
7087 __isl_give isl_set *isl_multi_aff_lex_gt_set(
7088 __isl_take isl_multi_aff *ma1,
7089 __isl_take isl_multi_aff *ma2);
7091 __isl_give isl_set *isl_pw_aff_list_eq_set(
7092 __isl_take isl_pw_aff_list *list1,
7093 __isl_take isl_pw_aff_list *list2);
7094 __isl_give isl_set *isl_pw_aff_list_ne_set(
7095 __isl_take isl_pw_aff_list *list1,
7096 __isl_take isl_pw_aff_list *list2);
7097 __isl_give isl_set *isl_pw_aff_list_le_set(
7098 __isl_take isl_pw_aff_list *list1,
7099 __isl_take isl_pw_aff_list *list2);
7100 __isl_give isl_set *isl_pw_aff_list_lt_set(
7101 __isl_take isl_pw_aff_list *list1,
7102 __isl_take isl_pw_aff_list *list2);
7103 __isl_give isl_set *isl_pw_aff_list_ge_set(
7104 __isl_take isl_pw_aff_list *list1,
7105 __isl_take isl_pw_aff_list *list2);
7106 __isl_give isl_set *isl_pw_aff_list_gt_set(
7107 __isl_take isl_pw_aff_list *list1,
7108 __isl_take isl_pw_aff_list *list2);
7110 The function C<isl_aff_ge_basic_set> returns a basic set
7111 containing those elements in the shared space
7112 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
7113 The function C<isl_pw_aff_ge_set> returns a set
7114 containing those elements in the shared domain
7115 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
7116 greater than or equal to C<pwaff2>.
7117 The function C<isl_multi_aff_lex_le_set> returns a set
7118 containing those elements in the shared domain space
7119 where C<ma1> is lexicographically smaller than or
7121 The functions operating on C<isl_pw_aff_list> apply the corresponding
7122 C<isl_pw_aff> function to each pair of elements in the two lists.
7124 #include <isl/aff.h>
7125 __isl_give isl_map *isl_pw_aff_eq_map(
7126 __isl_take isl_pw_aff *pa1,
7127 __isl_take isl_pw_aff *pa2);
7128 __isl_give isl_map *isl_pw_aff_lt_map(
7129 __isl_take isl_pw_aff *pa1,
7130 __isl_take isl_pw_aff *pa2);
7131 __isl_give isl_map *isl_pw_aff_gt_map(
7132 __isl_take isl_pw_aff *pa1,
7133 __isl_take isl_pw_aff *pa2);
7135 __isl_give isl_map *isl_multi_pw_aff_eq_map(
7136 __isl_take isl_multi_pw_aff *mpa1,
7137 __isl_take isl_multi_pw_aff *mpa2);
7138 __isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
7139 __isl_take isl_multi_pw_aff *mpa1,
7140 __isl_take isl_multi_pw_aff *mpa2);
7141 __isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
7142 __isl_take isl_multi_pw_aff *mpa1,
7143 __isl_take isl_multi_pw_aff *mpa2);
7145 These functions return a map between domain elements of the arguments
7146 where the function values satisfy the given relation.
7148 #include <isl/union_map.h>
7149 __isl_give isl_union_map *
7150 isl_union_map_eq_at_multi_union_pw_aff(
7151 __isl_take isl_union_map *umap,
7152 __isl_take isl_multi_union_pw_aff *mupa);
7153 __isl_give isl_union_map *
7154 isl_union_map_lex_lt_at_multi_union_pw_aff(
7155 __isl_take isl_union_map *umap,
7156 __isl_take isl_multi_union_pw_aff *mupa);
7157 __isl_give isl_union_map *
7158 isl_union_map_lex_gt_at_multi_union_pw_aff(
7159 __isl_take isl_union_map *umap,
7160 __isl_take isl_multi_union_pw_aff *mupa);
7162 These functions select the subset of elements in the union map
7163 that have an equal or lexicographically smaller function value.
7165 =item * Cartesian Product
7167 #include <isl/space.h>
7168 __isl_give isl_space *isl_space_product(
7169 __isl_take isl_space *space1,
7170 __isl_take isl_space *space2);
7171 __isl_give isl_space *isl_space_domain_product(
7172 __isl_take isl_space *space1,
7173 __isl_take isl_space *space2);
7174 __isl_give isl_space *isl_space_range_product(
7175 __isl_take isl_space *space1,
7176 __isl_take isl_space *space2);
7179 C<isl_space_product>, C<isl_space_domain_product>
7180 and C<isl_space_range_product> take pairs or relation spaces and
7181 produce a single relations space, where either the domain, the range
7182 or both domain and range are wrapped spaces of relations between
7183 the domains and/or ranges of the input spaces.
7184 If the product is only constructed over the domain or the range
7185 then the ranges or the domains of the inputs should be the same.
7186 The function C<isl_space_product> also accepts a pair of set spaces,
7187 in which case it returns a wrapped space of a relation between the
7190 #include <isl/set.h>
7191 __isl_give isl_set *isl_set_product(
7192 __isl_take isl_set *set1,
7193 __isl_take isl_set *set2);
7195 #include <isl/map.h>
7196 __isl_give isl_basic_map *isl_basic_map_domain_product(
7197 __isl_take isl_basic_map *bmap1,
7198 __isl_take isl_basic_map *bmap2);
7199 __isl_give isl_basic_map *isl_basic_map_range_product(
7200 __isl_take isl_basic_map *bmap1,
7201 __isl_take isl_basic_map *bmap2);
7202 __isl_give isl_basic_map *isl_basic_map_product(
7203 __isl_take isl_basic_map *bmap1,
7204 __isl_take isl_basic_map *bmap2);
7205 __isl_give isl_map *isl_map_domain_product(
7206 __isl_take isl_map *map1,
7207 __isl_take isl_map *map2);
7208 __isl_give isl_map *isl_map_range_product(
7209 __isl_take isl_map *map1,
7210 __isl_take isl_map *map2);
7211 __isl_give isl_map *isl_map_product(
7212 __isl_take isl_map *map1,
7213 __isl_take isl_map *map2);
7215 #include <isl/union_set.h>
7216 __isl_give isl_union_set *isl_union_set_product(
7217 __isl_take isl_union_set *uset1,
7218 __isl_take isl_union_set *uset2);
7220 #include <isl/union_map.h>
7221 __isl_give isl_union_map *isl_union_map_domain_product(
7222 __isl_take isl_union_map *umap1,
7223 __isl_take isl_union_map *umap2);
7224 __isl_give isl_union_map *isl_union_map_range_product(
7225 __isl_take isl_union_map *umap1,
7226 __isl_take isl_union_map *umap2);
7227 __isl_give isl_union_map *isl_union_map_product(
7228 __isl_take isl_union_map *umap1,
7229 __isl_take isl_union_map *umap2);
7232 __isl_give isl_multi_id *isl_multi_id_range_product(
7233 __isl_take isl_multi_id *mi1,
7234 __isl_take isl_multi_id *mi2);
7236 #include <isl/val.h>
7237 __isl_give isl_multi_val *isl_multi_val_range_product(
7238 __isl_take isl_multi_val *mv1,
7239 __isl_take isl_multi_val *mv2);
7240 __isl_give isl_multi_val *isl_multi_val_product(
7241 __isl_take isl_multi_val *mv1,
7242 __isl_take isl_multi_val *mv2);
7244 #include <isl/aff.h>
7245 __isl_give isl_multi_aff *isl_multi_aff_range_product(
7246 __isl_take isl_multi_aff *ma1,
7247 __isl_take isl_multi_aff *ma2);
7248 __isl_give isl_multi_aff *isl_multi_aff_product(
7249 __isl_take isl_multi_aff *ma1,
7250 __isl_take isl_multi_aff *ma2);
7251 __isl_give isl_multi_pw_aff *
7252 isl_multi_pw_aff_range_product(
7253 __isl_take isl_multi_pw_aff *mpa1,
7254 __isl_take isl_multi_pw_aff *mpa2);
7255 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
7256 __isl_take isl_multi_pw_aff *mpa1,
7257 __isl_take isl_multi_pw_aff *mpa2);
7258 __isl_give isl_pw_multi_aff *
7259 isl_pw_multi_aff_range_product(
7260 __isl_take isl_pw_multi_aff *pma1,
7261 __isl_take isl_pw_multi_aff *pma2);
7262 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
7263 __isl_take isl_pw_multi_aff *pma1,
7264 __isl_take isl_pw_multi_aff *pma2);
7265 __isl_give isl_multi_union_pw_aff *
7266 isl_multi_union_pw_aff_range_product(
7267 __isl_take isl_multi_union_pw_aff *mupa1,
7268 __isl_take isl_multi_union_pw_aff *mupa2);
7270 The above functions compute the cross product of the given
7271 sets, relations or functions. The domains and ranges of the results
7272 are wrapped maps between domains and ranges of the inputs.
7273 To obtain a ``flat'' product, use the following functions
7276 #include <isl/set.h>
7277 __isl_give isl_basic_set *isl_basic_set_flat_product(
7278 __isl_take isl_basic_set *bset1,
7279 __isl_take isl_basic_set *bset2);
7280 __isl_give isl_set *isl_set_flat_product(
7281 __isl_take isl_set *set1,
7282 __isl_take isl_set *set2);
7284 #include <isl/map.h>
7285 __isl_give isl_basic_map *isl_basic_map_flat_range_product(
7286 __isl_take isl_basic_map *bmap1,
7287 __isl_take isl_basic_map *bmap2);
7288 __isl_give isl_map *isl_map_flat_domain_product(
7289 __isl_take isl_map *map1,
7290 __isl_take isl_map *map2);
7291 __isl_give isl_map *isl_map_flat_range_product(
7292 __isl_take isl_map *map1,
7293 __isl_take isl_map *map2);
7294 __isl_give isl_basic_map *isl_basic_map_flat_product(
7295 __isl_take isl_basic_map *bmap1,
7296 __isl_take isl_basic_map *bmap2);
7297 __isl_give isl_map *isl_map_flat_product(
7298 __isl_take isl_map *map1,
7299 __isl_take isl_map *map2);
7301 #include <isl/union_map.h>
7302 __isl_give isl_union_map *
7303 isl_union_map_flat_domain_product(
7304 __isl_take isl_union_map *umap1,
7305 __isl_take isl_union_map *umap2);
7306 __isl_give isl_union_map *
7307 isl_union_map_flat_range_product(
7308 __isl_take isl_union_map *umap1,
7309 __isl_take isl_union_map *umap2);
7312 __isl_give isl_multi_id *
7313 isl_multi_id_flat_range_product(
7314 __isl_take isl_multi_id *mi1,
7315 __isl_take isl_multi_id *mi2);
7317 #include <isl/val.h>
7318 __isl_give isl_multi_val *isl_multi_val_flat_range_product(
7319 __isl_take isl_multi_val *mv1,
7320 __isl_take isl_multi_val *mv2);
7322 #include <isl/aff.h>
7323 __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
7324 __isl_take isl_multi_aff *ma1,
7325 __isl_take isl_multi_aff *ma2);
7326 __isl_give isl_pw_multi_aff *
7327 isl_pw_multi_aff_flat_range_product(
7328 __isl_take isl_pw_multi_aff *pma1,
7329 __isl_take isl_pw_multi_aff *pma2);
7330 __isl_give isl_multi_pw_aff *
7331 isl_multi_pw_aff_flat_range_product(
7332 __isl_take isl_multi_pw_aff *mpa1,
7333 __isl_take isl_multi_pw_aff *mpa2);
7334 __isl_give isl_union_pw_multi_aff *
7335 isl_union_pw_multi_aff_flat_range_product(
7336 __isl_take isl_union_pw_multi_aff *upma1,
7337 __isl_take isl_union_pw_multi_aff *upma2);
7338 __isl_give isl_multi_union_pw_aff *
7339 isl_multi_union_pw_aff_flat_range_product(
7340 __isl_take isl_multi_union_pw_aff *mupa1,
7341 __isl_take isl_multi_union_pw_aff *mupa2);
7343 #include <isl/space.h>
7344 __isl_give isl_space *isl_space_factor_domain(
7345 __isl_take isl_space *space);
7346 __isl_give isl_space *isl_space_factor_range(
7347 __isl_take isl_space *space);
7348 __isl_give isl_space *isl_space_domain_factor_domain(
7349 __isl_take isl_space *space);
7350 __isl_give isl_space *isl_space_domain_factor_range(
7351 __isl_take isl_space *space);
7352 __isl_give isl_space *isl_space_range_factor_domain(
7353 __isl_take isl_space *space);
7354 __isl_give isl_space *isl_space_range_factor_range(
7355 __isl_take isl_space *space);
7357 The functions C<isl_space_range_factor_domain> and
7358 C<isl_space_range_factor_range> extract the two arguments from
7359 the result of a call to C<isl_space_range_product>.
7361 The arguments of a call to a product can be extracted
7362 from the result using the following functions.
7364 #include <isl/map.h>
7365 __isl_give isl_map *isl_map_factor_domain(
7366 __isl_take isl_map *map);
7367 __isl_give isl_map *isl_map_factor_range(
7368 __isl_take isl_map *map);
7369 __isl_give isl_map *isl_map_domain_factor_domain(
7370 __isl_take isl_map *map);
7371 __isl_give isl_map *isl_map_domain_factor_range(
7372 __isl_take isl_map *map);
7373 __isl_give isl_map *isl_map_range_factor_domain(
7374 __isl_take isl_map *map);
7375 __isl_give isl_map *isl_map_range_factor_range(
7376 __isl_take isl_map *map);
7378 #include <isl/union_map.h>
7379 __isl_give isl_union_map *isl_union_map_factor_domain(
7380 __isl_take isl_union_map *umap);
7381 __isl_give isl_union_map *isl_union_map_factor_range(
7382 __isl_take isl_union_map *umap);
7383 __isl_give isl_union_map *
7384 isl_union_map_domain_factor_domain(
7385 __isl_take isl_union_map *umap);
7386 __isl_give isl_union_map *
7387 isl_union_map_domain_factor_range(
7388 __isl_take isl_union_map *umap);
7389 __isl_give isl_union_map *
7390 isl_union_map_range_factor_domain(
7391 __isl_take isl_union_map *umap);
7392 __isl_give isl_union_map *
7393 isl_union_map_range_factor_range(
7394 __isl_take isl_union_map *umap);
7397 __isl_give isl_multi_id *isl_multi_id_factor_range(
7398 __isl_take isl_multi_id *mi);
7399 __isl_give isl_multi_id *
7400 isl_multi_id_range_factor_domain(
7401 __isl_take isl_multi_id *mi);
7402 __isl_give isl_multi_id *
7403 isl_multi_id_range_factor_range(
7404 __isl_take isl_multi_id *mi);
7406 #include <isl/val.h>
7407 __isl_give isl_multi_val *isl_multi_val_factor_range(
7408 __isl_take isl_multi_val *mv);
7409 __isl_give isl_multi_val *
7410 isl_multi_val_range_factor_domain(
7411 __isl_take isl_multi_val *mv);
7412 __isl_give isl_multi_val *
7413 isl_multi_val_range_factor_range(
7414 __isl_take isl_multi_val *mv);
7416 #include <isl/aff.h>
7417 __isl_give isl_multi_aff *isl_multi_aff_factor_range(
7418 __isl_take isl_multi_aff *ma);
7419 __isl_give isl_multi_aff *
7420 isl_multi_aff_range_factor_domain(
7421 __isl_take isl_multi_aff *ma);
7422 __isl_give isl_multi_aff *
7423 isl_multi_aff_range_factor_range(
7424 __isl_take isl_multi_aff *ma);
7425 __isl_give isl_multi_pw_aff *
7426 isl_multi_pw_aff_factor_range(
7427 __isl_take isl_multi_pw_aff *mpa);
7428 __isl_give isl_multi_pw_aff *
7429 isl_multi_pw_aff_range_factor_domain(
7430 __isl_take isl_multi_pw_aff *mpa);
7431 __isl_give isl_multi_pw_aff *
7432 isl_multi_pw_aff_range_factor_range(
7433 __isl_take isl_multi_pw_aff *mpa);
7434 __isl_give isl_multi_union_pw_aff *
7435 isl_multi_union_pw_aff_factor_range(
7436 __isl_take isl_multi_union_pw_aff *mupa);
7437 __isl_give isl_multi_union_pw_aff *
7438 isl_multi_union_pw_aff_range_factor_domain(
7439 __isl_take isl_multi_union_pw_aff *mupa);
7440 __isl_give isl_multi_union_pw_aff *
7441 isl_multi_union_pw_aff_range_factor_range(
7442 __isl_take isl_multi_union_pw_aff *mupa);
7444 The splice functions are a generalization of the flat product functions,
7445 where the second argument may be inserted at any position inside
7446 the first argument rather than being placed at the end.
7447 The functions C<isl_multi_val_factor_range>,
7448 C<isl_multi_aff_factor_range>,
7449 C<isl_multi_pw_aff_factor_range> and
7450 C<isl_multi_union_pw_aff_factor_range>
7451 take functions that live in a set space.
7454 __isl_give isl_multi_id *isl_multi_id_range_splice(
7455 __isl_take isl_multi_id *mi1, unsigned pos,
7456 __isl_take isl_multi_id *mi2);
7458 #include <isl/val.h>
7459 __isl_give isl_multi_val *isl_multi_val_range_splice(
7460 __isl_take isl_multi_val *mv1, unsigned pos,
7461 __isl_take isl_multi_val *mv2);
7463 #include <isl/aff.h>
7464 __isl_give isl_multi_aff *isl_multi_aff_range_splice(
7465 __isl_take isl_multi_aff *ma1, unsigned pos,
7466 __isl_take isl_multi_aff *ma2);
7467 __isl_give isl_multi_aff *isl_multi_aff_splice(
7468 __isl_take isl_multi_aff *ma1,
7469 unsigned in_pos, unsigned out_pos,
7470 __isl_take isl_multi_aff *ma2);
7471 __isl_give isl_multi_pw_aff *
7472 isl_multi_pw_aff_range_splice(
7473 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
7474 __isl_take isl_multi_pw_aff *mpa2);
7475 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
7476 __isl_take isl_multi_pw_aff *mpa1,
7477 unsigned in_pos, unsigned out_pos,
7478 __isl_take isl_multi_pw_aff *mpa2);
7479 __isl_give isl_multi_union_pw_aff *
7480 isl_multi_union_pw_aff_range_splice(
7481 __isl_take isl_multi_union_pw_aff *mupa1,
7483 __isl_take isl_multi_union_pw_aff *mupa2);
7485 =item * Simplification
7487 When applied to a set or relation,
7488 the gist operation returns a set or relation that has the
7489 same intersection with the context as the input set or relation.
7490 Any implicit equality in the intersection is made explicit in the result,
7491 while all inequalities that are redundant with respect to the intersection
7493 In case of union sets and relations, the gist operation is performed
7496 When applied to a function,
7497 the gist operation applies the set gist operation to each of
7498 the cells in the domain of the input piecewise expression.
7499 The context is also exploited
7500 to simplify the expression associated to each cell.
7502 #include <isl/set.h>
7503 __isl_give isl_basic_set *isl_basic_set_gist(
7504 __isl_take isl_basic_set *bset,
7505 __isl_take isl_basic_set *context);
7506 __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
7507 __isl_take isl_set *context);
7508 __isl_give isl_set *isl_set_gist_params(
7509 __isl_take isl_set *set,
7510 __isl_take isl_set *context);
7512 #include <isl/map.h>
7513 __isl_give isl_basic_map *isl_basic_map_gist(
7514 __isl_take isl_basic_map *bmap,
7515 __isl_take isl_basic_map *context);
7516 __isl_give isl_basic_map *isl_basic_map_gist_domain(
7517 __isl_take isl_basic_map *bmap,
7518 __isl_take isl_basic_set *context);
7519 __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
7520 __isl_take isl_map *context);
7521 __isl_give isl_map *isl_map_gist_params(
7522 __isl_take isl_map *map,
7523 __isl_take isl_set *context);
7524 __isl_give isl_map *isl_map_gist_domain(
7525 __isl_take isl_map *map,
7526 __isl_take isl_set *context);
7527 __isl_give isl_map *isl_map_gist_range(
7528 __isl_take isl_map *map,
7529 __isl_take isl_set *context);
7531 #include <isl/union_set.h>
7532 __isl_give isl_union_set *isl_union_set_gist(
7533 __isl_take isl_union_set *uset,
7534 __isl_take isl_union_set *context);
7535 __isl_give isl_union_set *isl_union_set_gist_params(
7536 __isl_take isl_union_set *uset,
7537 __isl_take isl_set *set);
7539 #include <isl/union_map.h>
7540 __isl_give isl_union_map *isl_union_map_gist(
7541 __isl_take isl_union_map *umap,
7542 __isl_take isl_union_map *context);
7543 __isl_give isl_union_map *isl_union_map_gist_params(
7544 __isl_take isl_union_map *umap,
7545 __isl_take isl_set *set);
7546 __isl_give isl_union_map *isl_union_map_gist_domain(
7547 __isl_take isl_union_map *umap,
7548 __isl_take isl_union_set *uset);
7549 __isl_give isl_union_map *isl_union_map_gist_range(
7550 __isl_take isl_union_map *umap,
7551 __isl_take isl_union_set *uset);
7553 #include <isl/aff.h>
7554 __isl_give isl_aff *isl_aff_gist_params(
7555 __isl_take isl_aff *aff,
7556 __isl_take isl_set *context);
7557 __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
7558 __isl_take isl_set *context);
7559 __isl_give isl_multi_aff *isl_multi_aff_gist_params(
7560 __isl_take isl_multi_aff *maff,
7561 __isl_take isl_set *context);
7562 __isl_give isl_multi_aff *isl_multi_aff_gist(
7563 __isl_take isl_multi_aff *maff,
7564 __isl_take isl_set *context);
7565 __isl_give isl_pw_aff *isl_pw_aff_gist_params(
7566 __isl_take isl_pw_aff *pwaff,
7567 __isl_take isl_set *context);
7568 __isl_give isl_pw_aff *isl_pw_aff_gist(
7569 __isl_take isl_pw_aff *pwaff,
7570 __isl_take isl_set *context);
7571 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
7572 __isl_take isl_pw_multi_aff *pma,
7573 __isl_take isl_set *set);
7574 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
7575 __isl_take isl_pw_multi_aff *pma,
7576 __isl_take isl_set *set);
7577 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
7578 __isl_take isl_multi_pw_aff *mpa,
7579 __isl_take isl_set *set);
7580 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
7581 __isl_take isl_multi_pw_aff *mpa,
7582 __isl_take isl_set *set);
7583 __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
7584 __isl_take isl_union_pw_aff *upa,
7585 __isl_take isl_union_set *context);
7586 __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
7587 __isl_take isl_union_pw_aff *upa,
7588 __isl_take isl_set *context);
7589 __isl_give isl_union_pw_multi_aff *
7590 isl_union_pw_multi_aff_gist_params(
7591 __isl_take isl_union_pw_multi_aff *upma,
7592 __isl_take isl_set *context);
7593 __isl_give isl_union_pw_multi_aff *
7594 isl_union_pw_multi_aff_gist(
7595 __isl_take isl_union_pw_multi_aff *upma,
7596 __isl_take isl_union_set *context);
7597 __isl_give isl_multi_union_pw_aff *
7598 isl_multi_union_pw_aff_gist_params(
7599 __isl_take isl_multi_union_pw_aff *aff,
7600 __isl_take isl_set *context);
7601 __isl_give isl_multi_union_pw_aff *
7602 isl_multi_union_pw_aff_gist(
7603 __isl_take isl_multi_union_pw_aff *aff,
7604 __isl_take isl_union_set *context);
7606 #include <isl/polynomial.h>
7607 __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
7608 __isl_take isl_qpolynomial *qp,
7609 __isl_take isl_set *context);
7610 __isl_give isl_qpolynomial *isl_qpolynomial_gist(
7611 __isl_take isl_qpolynomial *qp,
7612 __isl_take isl_set *context);
7613 __isl_give isl_qpolynomial_fold *
7614 isl_qpolynomial_fold_gist_params(
7615 __isl_take isl_qpolynomial_fold *fold,
7616 __isl_take isl_set *context);
7617 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
7618 __isl_take isl_qpolynomial_fold *fold,
7619 __isl_take isl_set *context);
7620 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
7621 __isl_take isl_pw_qpolynomial *pwqp,
7622 __isl_take isl_set *context);
7623 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
7624 __isl_take isl_pw_qpolynomial *pwqp,
7625 __isl_take isl_set *context);
7626 __isl_give isl_pw_qpolynomial_fold *
7627 isl_pw_qpolynomial_fold_gist(
7628 __isl_take isl_pw_qpolynomial_fold *pwf,
7629 __isl_take isl_set *context);
7630 __isl_give isl_pw_qpolynomial_fold *
7631 isl_pw_qpolynomial_fold_gist_params(
7632 __isl_take isl_pw_qpolynomial_fold *pwf,
7633 __isl_take isl_set *context);
7634 __isl_give isl_union_pw_qpolynomial *
7635 isl_union_pw_qpolynomial_gist_params(
7636 __isl_take isl_union_pw_qpolynomial *upwqp,
7637 __isl_take isl_set *context);
7638 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
7639 __isl_take isl_union_pw_qpolynomial *upwqp,
7640 __isl_take isl_union_set *context);
7641 __isl_give isl_union_pw_qpolynomial_fold *
7642 isl_union_pw_qpolynomial_fold_gist(
7643 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7644 __isl_take isl_union_set *context);
7645 __isl_give isl_union_pw_qpolynomial_fold *
7646 isl_union_pw_qpolynomial_fold_gist_params(
7647 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7648 __isl_take isl_set *context);
7650 =item * Binary Arithmetic Operations
7652 #include <isl/set.h>
7653 __isl_give isl_set *isl_set_sum(
7654 __isl_take isl_set *set1,
7655 __isl_take isl_set *set2);
7656 #include <isl/map.h>
7657 __isl_give isl_map *isl_map_sum(
7658 __isl_take isl_map *map1,
7659 __isl_take isl_map *map2);
7661 C<isl_set_sum> computes the Minkowski sum of its two arguments,
7662 i.e., the set containing the sums of pairs of elements from
7663 C<set1> and C<set2>.
7664 The domain of the result of C<isl_map_sum> is the intersection
7665 of the domains of its two arguments. The corresponding range
7666 elements are the sums of the corresponding range elements
7667 in the two arguments.
7669 #include <isl/val.h>
7670 __isl_give isl_multi_val *isl_multi_val_add(
7671 __isl_take isl_multi_val *mv1,
7672 __isl_take isl_multi_val *mv2);
7673 __isl_give isl_multi_val *isl_multi_val_sub(
7674 __isl_take isl_multi_val *mv1,
7675 __isl_take isl_multi_val *mv2);
7677 #include <isl/aff.h>
7678 __isl_give isl_aff *isl_aff_add(
7679 __isl_take isl_aff *aff1,
7680 __isl_take isl_aff *aff2);
7681 __isl_give isl_multi_aff *isl_multi_aff_add(
7682 __isl_take isl_multi_aff *maff1,
7683 __isl_take isl_multi_aff *maff2);
7684 __isl_give isl_pw_aff *isl_pw_aff_add(
7685 __isl_take isl_pw_aff *pwaff1,
7686 __isl_take isl_pw_aff *pwaff2);
7687 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add(
7688 __isl_take isl_multi_pw_aff *mpa1,
7689 __isl_take isl_multi_pw_aff *mpa2);
7690 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
7691 __isl_take isl_pw_multi_aff *pma1,
7692 __isl_take isl_pw_multi_aff *pma2);
7693 __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
7694 __isl_take isl_union_pw_aff *upa1,
7695 __isl_take isl_union_pw_aff *upa2);
7696 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
7697 __isl_take isl_union_pw_multi_aff *upma1,
7698 __isl_take isl_union_pw_multi_aff *upma2);
7699 __isl_give isl_multi_union_pw_aff *
7700 isl_multi_union_pw_aff_add(
7701 __isl_take isl_multi_union_pw_aff *mupa1,
7702 __isl_take isl_multi_union_pw_aff *mupa2);
7703 __isl_give isl_pw_aff *isl_pw_aff_min(
7704 __isl_take isl_pw_aff *pwaff1,
7705 __isl_take isl_pw_aff *pwaff2);
7706 __isl_give isl_pw_aff *isl_pw_aff_max(
7707 __isl_take isl_pw_aff *pwaff1,
7708 __isl_take isl_pw_aff *pwaff2);
7709 __isl_give isl_aff *isl_aff_sub(
7710 __isl_take isl_aff *aff1,
7711 __isl_take isl_aff *aff2);
7712 __isl_give isl_multi_aff *isl_multi_aff_sub(
7713 __isl_take isl_multi_aff *ma1,
7714 __isl_take isl_multi_aff *ma2);
7715 __isl_give isl_pw_aff *isl_pw_aff_sub(
7716 __isl_take isl_pw_aff *pwaff1,
7717 __isl_take isl_pw_aff *pwaff2);
7718 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
7719 __isl_take isl_multi_pw_aff *mpa1,
7720 __isl_take isl_multi_pw_aff *mpa2);
7721 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
7722 __isl_take isl_pw_multi_aff *pma1,
7723 __isl_take isl_pw_multi_aff *pma2);
7724 __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
7725 __isl_take isl_union_pw_aff *upa1,
7726 __isl_take isl_union_pw_aff *upa2);
7727 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
7728 __isl_take isl_union_pw_multi_aff *upma1,
7729 __isl_take isl_union_pw_multi_aff *upma2);
7730 __isl_give isl_multi_union_pw_aff *
7731 isl_multi_union_pw_aff_sub(
7732 __isl_take isl_multi_union_pw_aff *mupa1,
7733 __isl_take isl_multi_union_pw_aff *mupa2);
7735 C<isl_aff_sub> subtracts the second argument from the first.
7737 #include <isl/polynomial.h>
7738 __isl_give isl_qpolynomial *isl_qpolynomial_add(
7739 __isl_take isl_qpolynomial *qp1,
7740 __isl_take isl_qpolynomial *qp2);
7741 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
7742 __isl_take isl_pw_qpolynomial *pwqp1,
7743 __isl_take isl_pw_qpolynomial *pwqp2);
7744 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
7745 __isl_take isl_pw_qpolynomial *pwqp1,
7746 __isl_take isl_pw_qpolynomial *pwqp2);
7747 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
7748 __isl_take isl_pw_qpolynomial_fold *pwf1,
7749 __isl_take isl_pw_qpolynomial_fold *pwf2);
7750 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
7751 __isl_take isl_union_pw_qpolynomial *upwqp1,
7752 __isl_take isl_union_pw_qpolynomial *upwqp2);
7753 __isl_give isl_qpolynomial *isl_qpolynomial_sub(
7754 __isl_take isl_qpolynomial *qp1,
7755 __isl_take isl_qpolynomial *qp2);
7756 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
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_sub(
7760 __isl_take isl_union_pw_qpolynomial *upwqp1,
7761 __isl_take isl_union_pw_qpolynomial *upwqp2);
7762 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
7763 __isl_take isl_pw_qpolynomial_fold *pwf1,
7764 __isl_take isl_pw_qpolynomial_fold *pwf2);
7765 __isl_give isl_union_pw_qpolynomial_fold *
7766 isl_union_pw_qpolynomial_fold_fold(
7767 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
7768 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
7770 #include <isl/aff.h>
7771 __isl_give isl_pw_aff *isl_pw_aff_union_add(
7772 __isl_take isl_pw_aff *pwaff1,
7773 __isl_take isl_pw_aff *pwaff2);
7774 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
7775 __isl_take isl_pw_multi_aff *pma1,
7776 __isl_take isl_pw_multi_aff *pma2);
7777 __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
7778 __isl_take isl_union_pw_aff *upa1,
7779 __isl_take isl_union_pw_aff *upa2);
7780 __isl_give isl_union_pw_multi_aff *
7781 isl_union_pw_multi_aff_union_add(
7782 __isl_take isl_union_pw_multi_aff *upma1,
7783 __isl_take isl_union_pw_multi_aff *upma2);
7784 __isl_give isl_multi_union_pw_aff *
7785 isl_multi_union_pw_aff_union_add(
7786 __isl_take isl_multi_union_pw_aff *mupa1,
7787 __isl_take isl_multi_union_pw_aff *mupa2);
7788 __isl_give isl_pw_aff *isl_pw_aff_union_min(
7789 __isl_take isl_pw_aff *pwaff1,
7790 __isl_take isl_pw_aff *pwaff2);
7791 __isl_give isl_pw_aff *isl_pw_aff_union_max(
7792 __isl_take isl_pw_aff *pwaff1,
7793 __isl_take isl_pw_aff *pwaff2);
7795 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
7796 expression with a domain that is the union of those of C<pwaff1> and
7797 C<pwaff2> and such that on each cell, the quasi-affine expression is
7798 the maximum of those of C<pwaff1> and C<pwaff2>. If only one of
7799 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
7800 associated expression is the defined one.
7801 This in contrast to the C<isl_pw_aff_max> function, which is
7802 only defined on the shared definition domain of the arguments.
7804 #include <isl/val.h>
7805 __isl_give isl_multi_val *isl_multi_val_add_val(
7806 __isl_take isl_multi_val *mv,
7807 __isl_take isl_val *v);
7808 __isl_give isl_multi_val *isl_multi_val_mod_val(
7809 __isl_take isl_multi_val *mv,
7810 __isl_take isl_val *v);
7811 __isl_give isl_multi_val *isl_multi_val_scale_val(
7812 __isl_take isl_multi_val *mv,
7813 __isl_take isl_val *v);
7814 __isl_give isl_multi_val *isl_multi_val_scale_down_val(
7815 __isl_take isl_multi_val *mv,
7816 __isl_take isl_val *v);
7818 #include <isl/aff.h>
7819 __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
7820 __isl_take isl_val *mod);
7821 __isl_give isl_pw_aff *isl_pw_aff_mod_val(
7822 __isl_take isl_pw_aff *pa,
7823 __isl_take isl_val *mod);
7824 __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
7825 __isl_take isl_union_pw_aff *upa,
7826 __isl_take isl_val *f);
7827 __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
7828 __isl_take isl_val *v);
7829 __isl_give isl_multi_aff *isl_multi_aff_scale_val(
7830 __isl_take isl_multi_aff *ma,
7831 __isl_take isl_val *v);
7832 __isl_give isl_pw_aff *isl_pw_aff_scale_val(
7833 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
7834 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
7835 __isl_take isl_multi_pw_aff *mpa,
7836 __isl_take isl_val *v);
7837 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
7838 __isl_take isl_pw_multi_aff *pma,
7839 __isl_take isl_val *v);
7840 __isl_give isl_union_pw_multi_aff *
7841 __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
7842 __isl_take isl_union_pw_aff *upa,
7843 __isl_take isl_val *f);
7844 isl_union_pw_multi_aff_scale_val(
7845 __isl_take isl_union_pw_multi_aff *upma,
7846 __isl_take isl_val *val);
7847 __isl_give isl_multi_union_pw_aff *
7848 isl_multi_union_pw_aff_scale_val(
7849 __isl_take isl_multi_union_pw_aff *mupa,
7850 __isl_take isl_val *v);
7851 __isl_give isl_aff *isl_aff_scale_down_ui(
7852 __isl_take isl_aff *aff, unsigned f);
7853 __isl_give isl_aff *isl_aff_scale_down_val(
7854 __isl_take isl_aff *aff, __isl_take isl_val *v);
7855 __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
7856 __isl_take isl_multi_aff *ma,
7857 __isl_take isl_val *v);
7858 __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
7859 __isl_take isl_pw_aff *pa,
7860 __isl_take isl_val *f);
7861 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
7862 __isl_take isl_multi_pw_aff *mpa,
7863 __isl_take isl_val *v);
7864 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
7865 __isl_take isl_pw_multi_aff *pma,
7866 __isl_take isl_val *v);
7867 __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
7868 __isl_take isl_union_pw_aff *upa,
7869 __isl_take isl_val *v);
7870 __isl_give isl_union_pw_multi_aff *
7871 isl_union_pw_multi_aff_scale_down_val(
7872 __isl_take isl_union_pw_multi_aff *upma,
7873 __isl_take isl_val *val);
7874 __isl_give isl_multi_union_pw_aff *
7875 isl_multi_union_pw_aff_scale_down_val(
7876 __isl_take isl_multi_union_pw_aff *mupa,
7877 __isl_take isl_val *v);
7879 #include <isl/polynomial.h>
7880 __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
7881 __isl_take isl_qpolynomial *qp,
7882 __isl_take isl_val *v);
7883 __isl_give isl_qpolynomial_fold *
7884 isl_qpolynomial_fold_scale_val(
7885 __isl_take isl_qpolynomial_fold *fold,
7886 __isl_take isl_val *v);
7887 __isl_give isl_pw_qpolynomial *
7888 isl_pw_qpolynomial_scale_val(
7889 __isl_take isl_pw_qpolynomial *pwqp,
7890 __isl_take isl_val *v);
7891 __isl_give isl_pw_qpolynomial_fold *
7892 isl_pw_qpolynomial_fold_scale_val(
7893 __isl_take isl_pw_qpolynomial_fold *pwf,
7894 __isl_take isl_val *v);
7895 __isl_give isl_union_pw_qpolynomial *
7896 isl_union_pw_qpolynomial_scale_val(
7897 __isl_take isl_union_pw_qpolynomial *upwqp,
7898 __isl_take isl_val *v);
7899 __isl_give isl_union_pw_qpolynomial_fold *
7900 isl_union_pw_qpolynomial_fold_scale_val(
7901 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7902 __isl_take isl_val *v);
7903 __isl_give isl_qpolynomial *
7904 isl_qpolynomial_scale_down_val(
7905 __isl_take isl_qpolynomial *qp,
7906 __isl_take isl_val *v);
7907 __isl_give isl_qpolynomial_fold *
7908 isl_qpolynomial_fold_scale_down_val(
7909 __isl_take isl_qpolynomial_fold *fold,
7910 __isl_take isl_val *v);
7911 __isl_give isl_pw_qpolynomial *
7912 isl_pw_qpolynomial_scale_down_val(
7913 __isl_take isl_pw_qpolynomial *pwqp,
7914 __isl_take isl_val *v);
7915 __isl_give isl_pw_qpolynomial_fold *
7916 isl_pw_qpolynomial_fold_scale_down_val(
7917 __isl_take isl_pw_qpolynomial_fold *pwf,
7918 __isl_take isl_val *v);
7919 __isl_give isl_union_pw_qpolynomial *
7920 isl_union_pw_qpolynomial_scale_down_val(
7921 __isl_take isl_union_pw_qpolynomial *upwqp,
7922 __isl_take isl_val *v);
7923 __isl_give isl_union_pw_qpolynomial_fold *
7924 isl_union_pw_qpolynomial_fold_scale_down_val(
7925 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7926 __isl_take isl_val *v);
7928 #include <isl/val.h>
7929 __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
7930 __isl_take isl_multi_val *mv1,
7931 __isl_take isl_multi_val *mv2);
7932 __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
7933 __isl_take isl_multi_val *mv1,
7934 __isl_take isl_multi_val *mv2);
7935 __isl_give isl_multi_val *
7936 isl_multi_val_scale_down_multi_val(
7937 __isl_take isl_multi_val *mv1,
7938 __isl_take isl_multi_val *mv2);
7940 #include <isl/aff.h>
7941 __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
7942 __isl_take isl_multi_aff *ma,
7943 __isl_take isl_multi_val *mv);
7944 __isl_give isl_multi_union_pw_aff *
7945 isl_multi_union_pw_aff_mod_multi_val(
7946 __isl_take isl_multi_union_pw_aff *upma,
7947 __isl_take isl_multi_val *mv);
7948 __isl_give isl_multi_pw_aff *
7949 isl_multi_pw_aff_mod_multi_val(
7950 __isl_take isl_multi_pw_aff *mpa,
7951 __isl_take isl_multi_val *mv);
7952 __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
7953 __isl_take isl_multi_aff *ma,
7954 __isl_take isl_multi_val *mv);
7955 __isl_give isl_pw_multi_aff *
7956 isl_pw_multi_aff_scale_multi_val(
7957 __isl_take isl_pw_multi_aff *pma,
7958 __isl_take isl_multi_val *mv);
7959 __isl_give isl_multi_pw_aff *
7960 isl_multi_pw_aff_scale_multi_val(
7961 __isl_take isl_multi_pw_aff *mpa,
7962 __isl_take isl_multi_val *mv);
7963 __isl_give isl_multi_union_pw_aff *
7964 isl_multi_union_pw_aff_scale_multi_val(
7965 __isl_take isl_multi_union_pw_aff *mupa,
7966 __isl_take isl_multi_val *mv);
7967 __isl_give isl_union_pw_multi_aff *
7968 isl_union_pw_multi_aff_scale_multi_val(
7969 __isl_take isl_union_pw_multi_aff *upma,
7970 __isl_take isl_multi_val *mv);
7971 __isl_give isl_multi_aff *
7972 isl_multi_aff_scale_down_multi_val(
7973 __isl_take isl_multi_aff *ma,
7974 __isl_take isl_multi_val *mv);
7975 __isl_give isl_multi_pw_aff *
7976 isl_multi_pw_aff_scale_down_multi_val(
7977 __isl_take isl_multi_pw_aff *mpa,
7978 __isl_take isl_multi_val *mv);
7979 __isl_give isl_multi_union_pw_aff *
7980 isl_multi_union_pw_aff_scale_down_multi_val(
7981 __isl_take isl_multi_union_pw_aff *mupa,
7982 __isl_take isl_multi_val *mv);
7984 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
7985 by the corresponding elements of C<mv>.
7987 #include <isl/aff.h>
7988 __isl_give isl_aff *isl_aff_mul(
7989 __isl_take isl_aff *aff1,
7990 __isl_take isl_aff *aff2);
7991 __isl_give isl_aff *isl_aff_div(
7992 __isl_take isl_aff *aff1,
7993 __isl_take isl_aff *aff2);
7994 __isl_give isl_pw_aff *isl_pw_aff_mul(
7995 __isl_take isl_pw_aff *pwaff1,
7996 __isl_take isl_pw_aff *pwaff2);
7997 __isl_give isl_pw_aff *isl_pw_aff_div(
7998 __isl_take isl_pw_aff *pa1,
7999 __isl_take isl_pw_aff *pa2);
8000 __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
8001 __isl_take isl_pw_aff *pa1,
8002 __isl_take isl_pw_aff *pa2);
8003 __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
8004 __isl_take isl_pw_aff *pa1,
8005 __isl_take isl_pw_aff *pa2);
8007 When multiplying two affine expressions, at least one of the two needs
8008 to be a constant. Similarly, when dividing an affine expression by another,
8009 the second expression needs to be a constant.
8010 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
8011 rounding towards zero. C<isl_pw_aff_tdiv_r> computes the corresponding
8014 #include <isl/polynomial.h>
8015 __isl_give isl_qpolynomial *isl_qpolynomial_mul(
8016 __isl_take isl_qpolynomial *qp1,
8017 __isl_take isl_qpolynomial *qp2);
8018 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
8019 __isl_take isl_pw_qpolynomial *pwqp1,
8020 __isl_take isl_pw_qpolynomial *pwqp2);
8021 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
8022 __isl_take isl_union_pw_qpolynomial *upwqp1,
8023 __isl_take isl_union_pw_qpolynomial *upwqp2);
8027 =head3 Lexicographic Optimization
8029 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
8030 the following functions
8031 compute a set that contains the lexicographic minimum or maximum
8032 of the elements in C<set> (or C<bset>) for those values of the parameters
8033 that satisfy C<dom>.
8034 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
8035 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
8037 In other words, the union of the parameter values
8038 for which the result is non-empty and of C<*empty>
8041 #include <isl/set.h>
8042 __isl_give isl_set *isl_basic_set_partial_lexmin(
8043 __isl_take isl_basic_set *bset,
8044 __isl_take isl_basic_set *dom,
8045 __isl_give isl_set **empty);
8046 __isl_give isl_set *isl_basic_set_partial_lexmax(
8047 __isl_take isl_basic_set *bset,
8048 __isl_take isl_basic_set *dom,
8049 __isl_give isl_set **empty);
8050 __isl_give isl_set *isl_set_partial_lexmin(
8051 __isl_take isl_set *set, __isl_take isl_set *dom,
8052 __isl_give isl_set **empty);
8053 __isl_give isl_set *isl_set_partial_lexmax(
8054 __isl_take isl_set *set, __isl_take isl_set *dom,
8055 __isl_give isl_set **empty);
8057 Given a (basic) set C<set> (or C<bset>), the following functions simply
8058 return a set containing the lexicographic minimum or maximum
8059 of the elements in C<set> (or C<bset>).
8060 In case of union sets, the optimum is computed per space.
8062 #include <isl/set.h>
8063 __isl_give isl_set *isl_basic_set_lexmin(
8064 __isl_take isl_basic_set *bset);
8065 __isl_give isl_set *isl_basic_set_lexmax(
8066 __isl_take isl_basic_set *bset);
8067 __isl_give isl_set *isl_set_lexmin(
8068 __isl_take isl_set *set);
8069 __isl_give isl_set *isl_set_lexmax(
8070 __isl_take isl_set *set);
8071 __isl_give isl_union_set *isl_union_set_lexmin(
8072 __isl_take isl_union_set *uset);
8073 __isl_give isl_union_set *isl_union_set_lexmax(
8074 __isl_take isl_union_set *uset);
8076 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
8077 the following functions
8078 compute a relation that maps each element of C<dom>
8079 to the single lexicographic minimum or maximum
8080 of the elements that are associated to that same
8081 element in C<map> (or C<bmap>).
8082 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
8083 that contains the elements in C<dom> that do not map
8084 to any elements in C<map> (or C<bmap>).
8085 In other words, the union of the domain of the result and of C<*empty>
8088 #include <isl/map.h>
8089 __isl_give isl_map *isl_basic_map_partial_lexmax(
8090 __isl_take isl_basic_map *bmap,
8091 __isl_take isl_basic_set *dom,
8092 __isl_give isl_set **empty);
8093 __isl_give isl_map *isl_basic_map_partial_lexmin(
8094 __isl_take isl_basic_map *bmap,
8095 __isl_take isl_basic_set *dom,
8096 __isl_give isl_set **empty);
8097 __isl_give isl_map *isl_map_partial_lexmax(
8098 __isl_take isl_map *map, __isl_take isl_set *dom,
8099 __isl_give isl_set **empty);
8100 __isl_give isl_map *isl_map_partial_lexmin(
8101 __isl_take isl_map *map, __isl_take isl_set *dom,
8102 __isl_give isl_set **empty);
8104 Given a (basic) map C<map> (or C<bmap>), the following functions simply
8105 return a map mapping each element in the domain of
8106 C<map> (or C<bmap>) to the lexicographic minimum or maximum
8107 of all elements associated to that element.
8108 In case of union relations, the optimum is computed per space.
8110 #include <isl/map.h>
8111 __isl_give isl_map *isl_basic_map_lexmin(
8112 __isl_take isl_basic_map *bmap);
8113 __isl_give isl_map *isl_basic_map_lexmax(
8114 __isl_take isl_basic_map *bmap);
8115 __isl_give isl_map *isl_map_lexmin(
8116 __isl_take isl_map *map);
8117 __isl_give isl_map *isl_map_lexmax(
8118 __isl_take isl_map *map);
8119 __isl_give isl_union_map *isl_union_map_lexmin(
8120 __isl_take isl_union_map *umap);
8121 __isl_give isl_union_map *isl_union_map_lexmax(
8122 __isl_take isl_union_map *umap);
8124 The following functions return their result in the form of
8125 a piecewise multi-affine expression,
8126 but are otherwise equivalent to the corresponding functions
8127 returning a basic set or relation.
8129 #include <isl/set.h>
8130 __isl_give isl_pw_multi_aff *
8131 isl_basic_set_partial_lexmin_pw_multi_aff(
8132 __isl_take isl_basic_set *bset,
8133 __isl_take isl_basic_set *dom,
8134 __isl_give isl_set **empty);
8135 __isl_give isl_pw_multi_aff *
8136 isl_basic_set_partial_lexmax_pw_multi_aff(
8137 __isl_take isl_basic_set *bset,
8138 __isl_take isl_basic_set *dom,
8139 __isl_give isl_set **empty);
8140 __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
8141 __isl_take isl_set *set);
8142 __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
8143 __isl_take isl_set *set);
8145 #include <isl/map.h>
8146 __isl_give isl_pw_multi_aff *
8147 isl_basic_map_lexmin_pw_multi_aff(
8148 __isl_take isl_basic_map *bmap);
8149 __isl_give isl_pw_multi_aff *
8150 isl_basic_map_partial_lexmin_pw_multi_aff(
8151 __isl_take isl_basic_map *bmap,
8152 __isl_take isl_basic_set *dom,
8153 __isl_give isl_set **empty);
8154 __isl_give isl_pw_multi_aff *
8155 isl_basic_map_partial_lexmax_pw_multi_aff(
8156 __isl_take isl_basic_map *bmap,
8157 __isl_take isl_basic_set *dom,
8158 __isl_give isl_set **empty);
8159 __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
8160 __isl_take isl_map *map);
8161 __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
8162 __isl_take isl_map *map);
8164 The following functions return the lexicographic minimum or maximum
8165 on the shared domain of the inputs and the single defined function
8166 on those parts of the domain where only a single function is defined.
8168 #include <isl/aff.h>
8169 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
8170 __isl_take isl_pw_multi_aff *pma1,
8171 __isl_take isl_pw_multi_aff *pma2);
8172 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
8173 __isl_take isl_pw_multi_aff *pma1,
8174 __isl_take isl_pw_multi_aff *pma2);
8176 If the input to a lexicographic optimization problem has
8177 multiple constraints with the same coefficients for the optimized
8178 variables, then, by default, this symmetry is exploited by
8179 replacing those constraints by a single constraint with
8180 an abstract bound, which is in turn bounded by the corresponding terms
8181 in the original constraints.
8182 Without this optimization, the solver would typically consider
8183 all possible orderings of those original bounds, resulting in a needless
8184 decomposition of the domain.
8185 However, the optimization can also result in slowdowns since
8186 an extra parameter is introduced that may get used in additional
8188 The following option determines whether symmetry detection is applied
8189 during lexicographic optimization.
8191 #include <isl/options.h>
8192 isl_stat isl_options_set_pip_symmetry(isl_ctx *ctx,
8194 int isl_options_get_pip_symmetry(isl_ctx *ctx);
8198 See also \autoref{s:offline}.
8202 =head2 Ternary Operations
8204 #include <isl/aff.h>
8205 __isl_give isl_pw_aff *isl_pw_aff_cond(
8206 __isl_take isl_pw_aff *cond,
8207 __isl_take isl_pw_aff *pwaff_true,
8208 __isl_take isl_pw_aff *pwaff_false);
8210 The function C<isl_pw_aff_cond> performs a conditional operator
8211 and returns an expression that is equal to C<pwaff_true>
8212 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
8213 where C<cond> is zero.
8217 Lists are defined over several element types, including
8218 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_pw_multi_aff>,
8219 C<isl_union_pw_aff>,
8220 C<isl_union_pw_multi_aff>,
8221 C<isl_pw_qpolynomial>, C<isl_pw_qpolynomial_fold>,
8223 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
8224 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
8225 Here we take lists of C<isl_set>s as an example.
8226 Lists can be created, copied, modified and freed using the following functions.
8228 #include <isl/set.h>
8229 __isl_give isl_set_list *isl_set_list_from_set(
8230 __isl_take isl_set *el);
8231 __isl_give isl_set_list *isl_set_list_alloc(
8232 isl_ctx *ctx, int n);
8233 __isl_give isl_set_list *isl_set_list_copy(
8234 __isl_keep isl_set_list *list);
8235 __isl_give isl_set_list *isl_set_list_insert(
8236 __isl_take isl_set_list *list, unsigned pos,
8237 __isl_take isl_set *el);
8238 __isl_give isl_set_list *isl_set_list_add(
8239 __isl_take isl_set_list *list,
8240 __isl_take isl_set *el);
8241 __isl_give isl_set_list *isl_set_list_drop(
8242 __isl_take isl_set_list *list,
8243 unsigned first, unsigned n);
8244 __isl_give isl_set_list *isl_set_list_swap(
8245 __isl_take isl_set_list *list,
8246 unsigned pos1, unsigned pos2);
8247 __isl_give isl_set_list *isl_set_list_reverse(
8248 __isl_take isl_set_list *list);
8249 __isl_give isl_set_list *isl_set_list_set_set(
8250 __isl_take isl_set_list *list, int index,
8251 __isl_take isl_set *set);
8252 __isl_give isl_set_list *isl_set_list_concat(
8253 __isl_take isl_set_list *list1,
8254 __isl_take isl_set_list *list2);
8255 __isl_give isl_set_list *isl_set_list_map(
8256 __isl_take isl_set_list *list,
8257 __isl_give isl_set *(*fn)(__isl_take isl_set *el,
8260 __isl_give isl_set_list *isl_set_list_sort(
8261 __isl_take isl_set_list *list,
8262 int (*cmp)(__isl_keep isl_set *a,
8263 __isl_keep isl_set *b, void *user),
8265 __isl_null isl_set_list *isl_set_list_free(
8266 __isl_take isl_set_list *list);
8268 C<isl_set_list_alloc> creates an empty list with an initial capacity
8269 for C<n> elements. C<isl_set_list_insert> and C<isl_set_list_add>
8270 add elements to a list, increasing its capacity as needed.
8271 C<isl_set_list_from_set> creates a list with a single element.
8272 C<isl_set_list_swap> swaps the elements at the specified locations.
8273 C<isl_set_list_reverse> reverses the elements in the list.
8275 Lists can be inspected using the following functions.
8277 #include <isl/set.h>
8278 isl_size isl_set_list_size(__isl_keep isl_set_list *list);
8279 isl_size isl_set_list_n_set(__isl_keep isl_set_list *list);
8280 __isl_give isl_set *isl_set_list_get_at(
8281 __isl_keep isl_set_list *list, int index);
8282 __isl_give isl_set *isl_set_list_get_set(
8283 __isl_keep isl_set_list *list, int index);
8284 isl_stat isl_set_list_foreach(__isl_keep isl_set_list *list,
8285 isl_stat (*fn)(__isl_take isl_set *el, void *user),
8287 isl_stat isl_set_list_foreach_scc(
8288 __isl_keep isl_set_list *list,
8289 isl_bool (*follows)(__isl_keep isl_set *a,
8290 __isl_keep isl_set *b, void *user),
8292 isl_stat (*fn)(__isl_take isl_set *el, void *user),
8295 C<isl_set_list_n_set> is an alternative name for C<isl_set_list_size>.
8297 C<isl_set_list_get_set> is an alternative name for C<isl_set_list_get_at>.
8298 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
8299 strongly connected components of the graph with as vertices the elements
8300 of C<list> and a directed edge from vertex C<b> to vertex C<a>
8301 iff C<follows(a, b)> returns C<isl_bool_true>. The callbacks C<follows> and
8302 C<fn> should return C<isl_bool_error> or C<isl_stat_error> on error.
8304 Lists can be printed using
8306 #include <isl/set.h>
8307 __isl_give isl_printer *isl_printer_print_set_list(
8308 __isl_take isl_printer *p,
8309 __isl_keep isl_set_list *list);
8311 Alternatively, a string representation can be obtained
8312 directly using the following function, which always prints
8315 #include <isl/set.h>
8316 __isl_give char *isl_set_list_to_str(
8317 __isl_keep isl_set_list *list);
8319 =head2 Associative arrays
8321 Associative arrays map isl objects of a specific type to isl objects
8322 of some (other) specific type. They are defined for several pairs
8323 of types, including (C<isl_map>, C<isl_basic_set>),
8324 (C<isl_id>, C<isl_ast_expr>),
8325 (C<isl_id>, C<isl_id>) and
8326 (C<isl_id>, C<isl_pw_aff>).
8327 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
8330 Associative arrays can be created, copied and freed using
8331 the following functions.
8333 #include <isl/id_to_ast_expr.h>
8334 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
8335 isl_ctx *ctx, int min_size);
8336 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
8337 __isl_keep isl_id_to_ast_expr *id2expr);
8338 __isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
8339 __isl_take isl_id_to_ast_expr *id2expr);
8341 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
8342 to specify the expected size of the associative array.
8343 The associative array will be grown automatically as needed.
8345 Associative arrays can be inspected using the following functions.
8347 #include <isl/id_to_ast_expr.h>
8348 __isl_give isl_maybe_isl_ast_expr
8349 isl_id_to_ast_expr_try_get(
8350 __isl_keep isl_id_to_ast_expr *id2expr,
8351 __isl_keep isl_id *key);
8352 isl_bool isl_id_to_ast_expr_has(
8353 __isl_keep isl_id_to_ast_expr *id2expr,
8354 __isl_keep isl_id *key);
8355 __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
8356 __isl_keep isl_id_to_ast_expr *id2expr,
8357 __isl_take isl_id *key);
8358 isl_stat isl_id_to_ast_expr_foreach(
8359 __isl_keep isl_id_to_ast_expr *id2expr,
8360 isl_stat (*fn)(__isl_take isl_id *key,
8361 __isl_take isl_ast_expr *val, void *user),
8364 The function C<isl_id_to_ast_expr_try_get> returns a structure
8365 containing two elements, C<valid> and C<value>.
8366 If there is a value associated to the key, then C<valid>
8367 is set to C<isl_bool_true> and C<value> contains a copy of
8368 the associated value. Otherwise C<value> is C<NULL> and
8369 C<valid> may be C<isl_bool_error> or C<isl_bool_false> depending
8370 on whether some error has occurred or there simply is no associated value.
8371 The function C<isl_id_to_ast_expr_has> returns the C<valid> field
8372 in the structure and
8373 the function C<isl_id_to_ast_expr_get> returns the C<value> field.
8375 Associative arrays can be modified using the following functions.
8377 #include <isl/id_to_ast_expr.h>
8378 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
8379 __isl_take isl_id_to_ast_expr *id2expr,
8380 __isl_take isl_id *key,
8381 __isl_take isl_ast_expr *val);
8382 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
8383 __isl_take isl_id_to_ast_expr *id2expr,
8384 __isl_take isl_id *key);
8386 Associative arrays can be printed using the following function.
8388 #include <isl/id_to_ast_expr.h>
8389 __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
8390 __isl_take isl_printer *p,
8391 __isl_keep isl_id_to_ast_expr *id2expr);
8395 Vectors can be created, copied and freed using the following functions.
8397 #include <isl/vec.h>
8398 __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
8400 __isl_give isl_vec *isl_vec_zero(isl_ctx *ctx,
8402 __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
8403 __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
8405 Note that the elements of a vector created by C<isl_vec_alloc>
8406 may have arbitrary values.
8407 A vector created by C<isl_vec_zero> has elements with value zero.
8408 The elements can be changed and inspected using the following functions.
8410 isl_size isl_vec_size(__isl_keep isl_vec *vec);
8411 __isl_give isl_val *isl_vec_get_element_val(
8412 __isl_keep isl_vec *vec, int pos);
8413 __isl_give isl_vec *isl_vec_set_element_si(
8414 __isl_take isl_vec *vec, int pos, int v);
8415 __isl_give isl_vec *isl_vec_set_element_val(
8416 __isl_take isl_vec *vec, int pos,
8417 __isl_take isl_val *v);
8418 __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
8420 __isl_give isl_vec *isl_vec_set_val(
8421 __isl_take isl_vec *vec, __isl_take isl_val *v);
8422 int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
8423 __isl_keep isl_vec *vec2, int pos);
8425 C<isl_vec_get_element> will return a negative value if anything went wrong.
8426 In that case, the value of C<*v> is undefined.
8428 The following function can be used to concatenate two vectors.
8430 __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
8431 __isl_take isl_vec *vec2);
8435 Matrices can be created, copied and freed using the following functions.
8437 #include <isl/mat.h>
8438 __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
8439 unsigned n_row, unsigned n_col);
8440 __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
8441 __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
8443 Note that the elements of a newly created matrix may have arbitrary values.
8444 The elements can be changed and inspected using the following functions.
8446 isl_size isl_mat_rows(__isl_keep isl_mat *mat);
8447 isl_size isl_mat_cols(__isl_keep isl_mat *mat);
8448 __isl_give isl_val *isl_mat_get_element_val(
8449 __isl_keep isl_mat *mat, int row, int col);
8450 __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
8451 int row, int col, int v);
8452 __isl_give isl_mat *isl_mat_set_element_val(
8453 __isl_take isl_mat *mat, int row, int col,
8454 __isl_take isl_val *v);
8456 The following function computes the rank of a matrix.
8457 The return value may be -1 if some error occurred.
8459 #include <isl/mat.h>
8460 isl_size isl_mat_rank(__isl_keep isl_mat *mat);
8462 The following function can be used to compute the (right) inverse
8463 of a matrix, i.e., a matrix such that the product of the original
8464 and the inverse (in that order) is a multiple of the identity matrix.
8465 The input matrix is assumed to be of full row-rank.
8467 __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
8469 The following function can be used to compute the (right) kernel
8470 (or null space) of a matrix, i.e., a matrix such that the product of
8471 the original and the kernel (in that order) is the zero matrix.
8473 __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
8475 The following function computes a basis for the space spanned
8476 by the rows of a matrix.
8478 __isl_give isl_mat *isl_mat_row_basis(
8479 __isl_take isl_mat *mat);
8481 The following function computes rows that extend a basis of C<mat1>
8482 to a basis that also covers C<mat2>.
8484 __isl_give isl_mat *isl_mat_row_basis_extension(
8485 __isl_take isl_mat *mat1,
8486 __isl_take isl_mat *mat2);
8488 The following function checks whether there is no linear dependence
8489 among the combined rows of "mat1" and "mat2" that is not already present
8490 in "mat1" or "mat2" individually.
8491 If "mat1" and "mat2" have linearly independent rows by themselves,
8492 then this means that there is no linear dependence among all rows together.
8494 isl_bool isl_mat_has_linearly_independent_rows(
8495 __isl_keep isl_mat *mat1,
8496 __isl_keep isl_mat *mat2);
8498 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
8500 The following functions determine
8501 an upper or lower bound on a quasipolynomial over its domain.
8503 __isl_give isl_pw_qpolynomial_fold *
8504 isl_pw_qpolynomial_bound(
8505 __isl_take isl_pw_qpolynomial *pwqp,
8506 enum isl_fold type, isl_bool *tight);
8508 __isl_give isl_union_pw_qpolynomial_fold *
8509 isl_union_pw_qpolynomial_bound(
8510 __isl_take isl_union_pw_qpolynomial *upwqp,
8511 enum isl_fold type, isl_bool *tight);
8513 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
8514 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
8515 is the returned bound is known be tight, i.e., for each value
8516 of the parameters there is at least
8517 one element in the domain that reaches the bound.
8518 If the domain of C<pwqp> is not wrapping, then the bound is computed
8519 over all elements in that domain and the result has a purely parametric
8520 domain. If the domain of C<pwqp> is wrapping, then the bound is
8521 computed over the range of the wrapped relation. The domain of the
8522 wrapped relation becomes the domain of the result.
8524 =head2 Parametric Vertex Enumeration
8526 The parametric vertex enumeration described in this section
8527 is mainly intended to be used internally and by the C<barvinok>
8530 #include <isl/vertices.h>
8531 __isl_give isl_vertices *isl_basic_set_compute_vertices(
8532 __isl_keep isl_basic_set *bset);
8534 The function C<isl_basic_set_compute_vertices> performs the
8535 actual computation of the parametric vertices and the chamber
8536 decomposition and stores the result in an C<isl_vertices> object.
8537 This information can be queried by either iterating over all
8538 the vertices or iterating over all the chambers or cells
8539 and then iterating over all vertices that are active on the chamber.
8541 isl_stat isl_vertices_foreach_vertex(
8542 __isl_keep isl_vertices *vertices,
8543 isl_stat (*fn)(__isl_take isl_vertex *vertex,
8544 void *user), void *user);
8546 isl_stat isl_vertices_foreach_cell(
8547 __isl_keep isl_vertices *vertices,
8548 isl_stat (*fn)(__isl_take isl_cell *cell,
8549 void *user), void *user);
8550 isl_stat isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
8551 isl_stat (*fn)(__isl_take isl_vertex *vertex,
8552 void *user), void *user);
8554 Other operations that can be performed on an C<isl_vertices> object are
8557 isl_size isl_vertices_get_n_vertices(
8558 __isl_keep isl_vertices *vertices);
8559 __isl_null isl_vertices *isl_vertices_free(
8560 __isl_take isl_vertices *vertices);
8562 Vertices can be inspected and destroyed using the following functions.
8564 isl_size isl_vertex_get_id(__isl_keep isl_vertex *vertex);
8565 __isl_give isl_basic_set *isl_vertex_get_domain(
8566 __isl_keep isl_vertex *vertex);
8567 __isl_give isl_multi_aff *isl_vertex_get_expr(
8568 __isl_keep isl_vertex *vertex);
8569 __isl_null isl_vertex *isl_vertex_free(
8570 __isl_take isl_vertex *vertex);
8572 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
8573 describing the vertex in terms of the parameters,
8574 while C<isl_vertex_get_domain> returns the activity domain
8577 Chambers can be inspected and destroyed using the following functions.
8579 __isl_give isl_basic_set *isl_cell_get_domain(
8580 __isl_keep isl_cell *cell);
8581 __isl_null isl_cell *isl_cell_free(
8582 __isl_take isl_cell *cell);
8584 =head1 Polyhedral Compilation Library
8586 This section collects functionality in C<isl> that has been specifically
8587 designed for use during polyhedral compilation.
8589 =head2 Schedule Trees
8591 A schedule tree is a structured representation of a schedule,
8592 assigning a relative order to a set of domain elements.
8593 The relative order expressed by the schedule tree is
8594 defined recursively. In particular, the order between
8595 two domain elements is determined by the node that is closest
8596 to the root that refers to both elements and that orders them apart.
8597 Each node in the tree is of one of several types.
8598 The root node is always of type C<isl_schedule_node_domain>
8599 (or C<isl_schedule_node_extension>)
8600 and it describes the (extra) domain elements to which the schedule applies.
8601 The other types of nodes are as follows.
8605 =item C<isl_schedule_node_band>
8607 A band of schedule dimensions. Each schedule dimension is represented
8608 by a union piecewise quasi-affine expression. If this expression
8609 assigns a different value to two domain elements, while all previous
8610 schedule dimensions in the same band assign them the same value,
8611 then the two domain elements are ordered according to these two
8613 Each expression is required to be total in the domain elements
8614 that reach the band node.
8616 =item C<isl_schedule_node_expansion>
8618 An expansion node maps each of the domain elements that reach the node
8619 to one or more domain elements. The image of this mapping forms
8620 the set of domain elements that reach the child of the expansion node.
8621 The function that maps each of the expanded domain elements
8622 to the original domain element from which it was expanded
8623 is called the contraction.
8625 =item C<isl_schedule_node_filter>
8627 A filter node does not impose any ordering, but rather intersects
8628 the set of domain elements that the current subtree refers to
8629 with a given union set. The subtree of the filter node only
8630 refers to domain elements in the intersection.
8631 A filter node is typically only used as a child of a sequence or
8634 =item C<isl_schedule_node_leaf>
8636 A leaf of the schedule tree. Leaf nodes do not impose any ordering.
8638 =item C<isl_schedule_node_mark>
8640 A mark node can be used to attach any kind of information to a subtree
8641 of the schedule tree.
8643 =item C<isl_schedule_node_sequence>
8645 A sequence node has one or more children, each of which is a filter node.
8646 The filters on these filter nodes form a partition of
8647 the domain elements that the current subtree refers to.
8648 If two domain elements appear in distinct filters then the sequence
8649 node orders them according to the child positions of the corresponding
8652 =item C<isl_schedule_node_set>
8654 A set node is similar to a sequence node, except that
8655 it expresses that domain elements appearing in distinct filters
8656 may have any order. The order of the children of a set node
8657 is therefore also immaterial.
8661 The following node types are only supported by the AST generator.
8665 =item C<isl_schedule_node_context>
8667 The context describes constraints on the parameters and
8668 the schedule dimensions of outer
8669 bands that the AST generator may assume to hold. It is also the only
8670 kind of node that may introduce additional parameters.
8671 The space of the context is that of the flat product of the outer
8672 band nodes. In particular, if there are no outer band nodes, then
8673 this space is the unnamed zero-dimensional space.
8674 Since a context node references the outer band nodes, any tree
8675 containing a context node is considered to be anchored.
8677 =item C<isl_schedule_node_extension>
8679 An extension node instructs the AST generator to add additional
8680 domain elements that need to be scheduled.
8681 The additional domain elements are described by the range of
8682 the extension map in terms of the outer schedule dimensions,
8683 i.e., the flat product of the outer band nodes.
8684 Note that domain elements are added whenever the AST generator
8685 reaches the extension node, meaning that there are still some
8686 active domain elements for which an AST needs to be generated.
8687 The conditions under which some domain elements are still active
8688 may however not be completely described by the outer AST nodes
8689 generated at that point.
8690 Since an extension node references the outer band nodes, any tree
8691 containing an extension node is considered to be anchored.
8693 An extension node may also appear as the root of a schedule tree,
8694 when it is intended to be inserted into another tree
8695 using C<isl_schedule_node_graft_before> or C<isl_schedule_node_graft_after>.
8696 In this case, the domain of the extension node should
8697 correspond to the flat product of the outer band nodes
8698 in this other schedule tree at the point where the extension tree
8701 =item C<isl_schedule_node_guard>
8703 The guard describes constraints on the parameters and
8704 the schedule dimensions of outer
8705 bands that need to be enforced by the outer nodes
8706 in the generated AST.
8707 That is, the part of the AST that is generated from descendants
8708 of the guard node can assume that these constraints are satisfied.
8709 The space of the guard is that of the flat product of the outer
8710 band nodes. In particular, if there are no outer band nodes, then
8711 this space is the unnamed zero-dimensional space.
8712 Since a guard node references the outer band nodes, any tree
8713 containing a guard node is considered to be anchored.
8717 Except for the C<isl_schedule_node_context> nodes,
8718 none of the nodes may introduce any parameters that were not
8719 already present in the root domain node.
8721 A schedule tree is encapsulated in an C<isl_schedule> object.
8722 The simplest such objects, those with a tree consisting of single domain node,
8723 can be created using the following functions with either an empty
8724 domain or a given domain.
8726 #include <isl/schedule.h>
8727 __isl_give isl_schedule *isl_schedule_empty(
8728 __isl_take isl_space *space);
8729 __isl_give isl_schedule *isl_schedule_from_domain(
8730 __isl_take isl_union_set *domain);
8732 The function C<isl_schedule_constraints_compute_schedule> described
8733 in L</"Scheduling"> can also be used to construct schedules.
8735 C<isl_schedule> objects may be copied and freed using the following functions.
8737 #include <isl/schedule.h>
8738 __isl_give isl_schedule *isl_schedule_copy(
8739 __isl_keep isl_schedule *sched);
8740 __isl_null isl_schedule *isl_schedule_free(
8741 __isl_take isl_schedule *sched);
8743 The following functions checks whether two C<isl_schedule> objects
8744 are obviously the same.
8746 #include <isl/schedule.h>
8747 isl_bool isl_schedule_plain_is_equal(
8748 __isl_keep isl_schedule *schedule1,
8749 __isl_keep isl_schedule *schedule2);
8751 The domain of the schedule, i.e., the domain described by the root node,
8752 can be obtained using the following function.
8754 #include <isl/schedule.h>
8755 __isl_give isl_union_set *isl_schedule_get_domain(
8756 __isl_keep isl_schedule *schedule);
8758 An extra top-level band node (right underneath the domain node) can
8759 be introduced into the schedule using the following function.
8760 The schedule tree is assumed not to have any anchored nodes.
8762 #include <isl/schedule.h>
8763 __isl_give isl_schedule *
8764 isl_schedule_insert_partial_schedule(
8765 __isl_take isl_schedule *schedule,
8766 __isl_take isl_multi_union_pw_aff *partial);
8768 A top-level context node (right underneath the domain node) can
8769 be introduced into the schedule using the following function.
8771 #include <isl/schedule.h>
8772 __isl_give isl_schedule *isl_schedule_insert_context(
8773 __isl_take isl_schedule *schedule,
8774 __isl_take isl_set *context)
8776 A top-level guard node (right underneath the domain node) can
8777 be introduced into the schedule using the following function.
8779 #include <isl/schedule.h>
8780 __isl_give isl_schedule *isl_schedule_insert_guard(
8781 __isl_take isl_schedule *schedule,
8782 __isl_take isl_set *guard)
8784 A schedule that combines two schedules either in the given
8785 order or in an arbitrary order, i.e., with an C<isl_schedule_node_sequence>
8786 or an C<isl_schedule_node_set> node,
8787 can be created using the following functions.
8789 #include <isl/schedule.h>
8790 __isl_give isl_schedule *isl_schedule_sequence(
8791 __isl_take isl_schedule *schedule1,
8792 __isl_take isl_schedule *schedule2);
8793 __isl_give isl_schedule *isl_schedule_set(
8794 __isl_take isl_schedule *schedule1,
8795 __isl_take isl_schedule *schedule2);
8797 The domains of the two input schedules need to be disjoint.
8799 The following function can be used to restrict the domain
8800 of a schedule with a domain node as root to be a subset of the given union set.
8801 This operation may remove nodes in the tree that have become
8804 #include <isl/schedule.h>
8805 __isl_give isl_schedule *isl_schedule_intersect_domain(
8806 __isl_take isl_schedule *schedule,
8807 __isl_take isl_union_set *domain);
8809 The following function can be used to simplify the domain
8810 of a schedule with a domain node as root with respect to the given
8813 #include <isl/schedule.h>
8814 __isl_give isl_schedule *isl_schedule_gist_domain_params(
8815 __isl_take isl_schedule *schedule,
8816 __isl_take isl_set *context);
8818 The following function resets the user pointers on all parameter
8819 and tuple identifiers referenced by the nodes of the given schedule.
8821 #include <isl/schedule.h>
8822 __isl_give isl_schedule *isl_schedule_reset_user(
8823 __isl_take isl_schedule *schedule);
8825 The following function aligns the parameters of all nodes
8826 in the given schedule to the given space.
8828 #include <isl/schedule.h>
8829 __isl_give isl_schedule *isl_schedule_align_params(
8830 __isl_take isl_schedule *schedule,
8831 __isl_take isl_space *space);
8833 The following function allows the user to plug in a given function
8834 in the iteration domains. The input schedule is not allowed to contain
8835 any expansion nodes.
8837 #include <isl/schedule.h>
8838 __isl_give isl_schedule *
8839 isl_schedule_pullback_union_pw_multi_aff(
8840 __isl_take isl_schedule *schedule,
8841 __isl_take isl_union_pw_multi_aff *upma);
8843 The following function can be used to plug in the schedule C<expansion>
8844 in the leaves of C<schedule>, where C<contraction> describes how
8845 the domain elements of C<expansion> map to the domain elements
8846 at the original leaves of C<schedule>.
8847 The resulting schedule will contain expansion nodes, unless
8848 C<contraction> is an identity function.
8850 #include <isl/schedule.h>
8851 __isl_give isl_schedule *isl_schedule_expand(
8852 __isl_take isl_schedule *schedule,
8853 __isl_take isl_union_pw_multi_aff *contraction,
8854 __isl_take isl_schedule *expansion);
8856 An C<isl_union_map> representation of the schedule can be obtained
8857 from an C<isl_schedule> using the following function.
8859 #include <isl/schedule.h>
8860 __isl_give isl_union_map *isl_schedule_get_map(
8861 __isl_keep isl_schedule *sched);
8863 The resulting relation encodes the same relative ordering as
8864 the schedule by mapping the domain elements to a common schedule space.
8865 If the schedule_separate_components option is set, then the order
8866 of the children of a set node is explicitly encoded in the result.
8867 If the tree contains any expansion nodes, then the relation
8868 is formulated in terms of the expanded domain elements.
8870 Schedules can be read from input using the following functions.
8872 #include <isl/schedule.h>
8873 __isl_give isl_schedule *isl_schedule_read_from_file(
8874 isl_ctx *ctx, FILE *input);
8875 __isl_give isl_schedule *isl_schedule_read_from_str(
8876 isl_ctx *ctx, const char *str);
8878 A representation of the schedule can be printed using
8880 #include <isl/schedule.h>
8881 __isl_give isl_printer *isl_printer_print_schedule(
8882 __isl_take isl_printer *p,
8883 __isl_keep isl_schedule *schedule);
8884 __isl_give char *isl_schedule_to_str(
8885 __isl_keep isl_schedule *schedule);
8887 C<isl_schedule_to_str> prints the schedule in flow format.
8889 The schedule tree can be traversed through the use of
8890 C<isl_schedule_node> objects that point to a particular
8891 position in the schedule tree. Whenever a C<isl_schedule_node>
8892 is used to modify a node in the schedule tree, the original schedule
8893 tree is left untouched and the modifications are performed to a copy
8894 of the tree. The returned C<isl_schedule_node> then points to
8895 this modified copy of the tree.
8897 The root of the schedule tree can be obtained using the following function.
8899 #include <isl/schedule.h>
8900 __isl_give isl_schedule_node *isl_schedule_get_root(
8901 __isl_keep isl_schedule *schedule);
8903 A pointer to a newly created schedule tree with a single domain
8904 node can be created using the following functions.
8906 #include <isl/schedule_node.h>
8907 __isl_give isl_schedule_node *
8908 isl_schedule_node_from_domain(
8909 __isl_take isl_union_set *domain);
8910 __isl_give isl_schedule_node *
8911 isl_schedule_node_from_extension(
8912 __isl_take isl_union_map *extension);
8914 C<isl_schedule_node_from_extension> creates a tree with an extension
8917 Schedule nodes can be copied and freed using the following functions.
8919 #include <isl/schedule_node.h>
8920 __isl_give isl_schedule_node *isl_schedule_node_copy(
8921 __isl_keep isl_schedule_node *node);
8922 __isl_null isl_schedule_node *isl_schedule_node_free(
8923 __isl_take isl_schedule_node *node);
8925 The following functions can be used to check if two schedule
8926 nodes point to the same position in the same schedule.
8928 #include <isl/schedule_node.h>
8929 isl_bool isl_schedule_node_is_equal(
8930 __isl_keep isl_schedule_node *node1,
8931 __isl_keep isl_schedule_node *node2);
8933 The following properties can be obtained from a schedule node.
8935 #include <isl/schedule_node.h>
8936 enum isl_schedule_node_type isl_schedule_node_get_type(
8937 __isl_keep isl_schedule_node *node);
8938 enum isl_schedule_node_type
8939 isl_schedule_node_get_parent_type(
8940 __isl_keep isl_schedule_node *node);
8941 __isl_give isl_schedule *isl_schedule_node_get_schedule(
8942 __isl_keep isl_schedule_node *node);
8944 The function C<isl_schedule_node_get_type> returns the type of
8945 the node, while C<isl_schedule_node_get_parent_type> returns
8946 type of the parent of the node, which is required to exist.
8947 The function C<isl_schedule_node_get_schedule> returns a copy
8948 to the schedule to which the node belongs.
8950 The following functions can be used to move the schedule node
8951 to a different position in the tree or to check if such a position
8954 #include <isl/schedule_node.h>
8955 isl_bool isl_schedule_node_has_parent(
8956 __isl_keep isl_schedule_node *node);
8957 __isl_give isl_schedule_node *isl_schedule_node_parent(
8958 __isl_take isl_schedule_node *node);
8959 __isl_give isl_schedule_node *isl_schedule_node_root(
8960 __isl_take isl_schedule_node *node);
8961 __isl_give isl_schedule_node *isl_schedule_node_ancestor(
8962 __isl_take isl_schedule_node *node,
8964 isl_size isl_schedule_node_n_children(
8965 __isl_keep isl_schedule_node *node);
8966 __isl_give isl_schedule_node *isl_schedule_node_child(
8967 __isl_take isl_schedule_node *node, int pos);
8968 isl_bool isl_schedule_node_has_children(
8969 __isl_keep isl_schedule_node *node);
8970 __isl_give isl_schedule_node *isl_schedule_node_first_child(
8971 __isl_take isl_schedule_node *node);
8972 isl_bool isl_schedule_node_has_previous_sibling(
8973 __isl_keep isl_schedule_node *node);
8974 __isl_give isl_schedule_node *
8975 isl_schedule_node_previous_sibling(
8976 __isl_take isl_schedule_node *node);
8977 isl_bool isl_schedule_node_has_next_sibling(
8978 __isl_keep isl_schedule_node *node);
8979 __isl_give isl_schedule_node *
8980 isl_schedule_node_next_sibling(
8981 __isl_take isl_schedule_node *node);
8983 For C<isl_schedule_node_ancestor>, the ancestor of generation 0
8984 is the node itself, the ancestor of generation 1 is its parent and so on.
8986 It is also possible to query the number of ancestors of a node,
8987 the position of the current node
8988 within the children of its parent, the position of the subtree
8989 containing a node within the children of an ancestor
8990 or to obtain a copy of a given
8991 child without destroying the current node.
8992 Given two nodes that point to the same schedule, their closest
8993 shared ancestor can be obtained using
8994 C<isl_schedule_node_get_shared_ancestor>.
8996 #include <isl/schedule_node.h>
8997 isl_size isl_schedule_node_get_tree_depth(
8998 __isl_keep isl_schedule_node *node);
8999 isl_size isl_schedule_node_get_child_position(
9000 __isl_keep isl_schedule_node *node);
9001 isl_size isl_schedule_node_get_ancestor_child_position(
9002 __isl_keep isl_schedule_node *node,
9003 __isl_keep isl_schedule_node *ancestor);
9004 __isl_give isl_schedule_node *isl_schedule_node_get_child(
9005 __isl_keep isl_schedule_node *node, int pos);
9006 __isl_give isl_schedule_node *
9007 isl_schedule_node_get_shared_ancestor(
9008 __isl_keep isl_schedule_node *node1,
9009 __isl_keep isl_schedule_node *node2);
9011 All nodes in a schedule tree or
9012 all descendants of a specific node (including the node) can be visited
9013 in depth-first pre-order using the following functions.
9015 #include <isl/schedule.h>
9016 isl_stat isl_schedule_foreach_schedule_node_top_down(
9017 __isl_keep isl_schedule *sched,
9018 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
9019 void *user), void *user);
9021 #include <isl/schedule_node.h>
9022 isl_stat isl_schedule_node_foreach_descendant_top_down(
9023 __isl_keep isl_schedule_node *node,
9024 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
9025 void *user), void *user);
9027 The callback function is slightly different from the usual
9028 callbacks in that it not only indicates success (non-negative result)
9029 or failure (negative result), but also indicates whether the children
9030 of the given node should be visited. In particular, if the callback
9031 returns a positive value, then the children are visited, but if
9032 the callback returns zero, then the children are not visited.
9034 The following functions checks whether
9035 all descendants of a specific node (including the node itself)
9036 satisfy a user-specified test.
9038 #include <isl/schedule_node.h>
9039 isl_bool isl_schedule_node_every_descendant(
9040 __isl_keep isl_schedule_node *node,
9041 isl_bool (*test)(__isl_keep isl_schedule_node *node,
9042 void *user), void *user)
9044 The ancestors of a node in a schedule tree can be visited from
9045 the root down to and including the parent of the node using
9046 the following function.
9048 #include <isl/schedule_node.h>
9049 isl_stat isl_schedule_node_foreach_ancestor_top_down(
9050 __isl_keep isl_schedule_node *node,
9051 isl_stat (*fn)(__isl_keep isl_schedule_node *node,
9052 void *user), void *user);
9054 The following functions allows for a depth-first post-order
9055 traversal of the nodes in a schedule tree or
9056 of the descendants of a specific node (including the node
9057 itself), where the user callback is allowed to modify the
9060 #include <isl/schedule.h>
9061 __isl_give isl_schedule *
9062 isl_schedule_map_schedule_node_bottom_up(
9063 __isl_take isl_schedule *schedule,
9064 __isl_give isl_schedule_node *(*fn)(
9065 __isl_take isl_schedule_node *node,
9066 void *user), void *user);
9068 #include <isl/schedule_node.h>
9069 __isl_give isl_schedule_node *
9070 isl_schedule_node_map_descendant_bottom_up(
9071 __isl_take isl_schedule_node *node,
9072 __isl_give isl_schedule_node *(*fn)(
9073 __isl_take isl_schedule_node *node,
9074 void *user), void *user);
9076 The traversal continues from the node returned by the callback function.
9077 It is the responsibility of the user to ensure that this does not
9078 lead to an infinite loop. It is safest to always return a pointer
9079 to the same position (same ancestors and child positions) as the input node.
9081 The following function removes a node (along with its descendants)
9082 from a schedule tree and returns a pointer to the leaf at the
9083 same position in the updated tree.
9084 It is not allowed to remove the root of a schedule tree or
9085 a child of a set or sequence node.
9087 #include <isl/schedule_node.h>
9088 __isl_give isl_schedule_node *isl_schedule_node_cut(
9089 __isl_take isl_schedule_node *node);
9091 The following function removes a single node
9092 from a schedule tree and returns a pointer to the child
9093 of the node, now located at the position of the original node
9094 or to a leaf node at that position if there was no child.
9095 It is not allowed to remove the root of a schedule tree,
9096 a set or sequence node, a child of a set or sequence node or
9097 a band node with an anchored subtree.
9099 #include <isl/schedule_node.h>
9100 __isl_give isl_schedule_node *isl_schedule_node_delete(
9101 __isl_take isl_schedule_node *node);
9103 Most nodes in a schedule tree only contain local information.
9104 In some cases, however, a node may also refer to the schedule dimensions
9105 of its outer band nodes.
9106 This means that the position of the node within the tree should
9107 not be changed, or at least that no changes are performed to the
9108 outer band nodes. The following function can be used to test
9109 whether the subtree rooted at a given node contains any such nodes.
9111 #include <isl/schedule_node.h>
9112 isl_bool isl_schedule_node_is_subtree_anchored(
9113 __isl_keep isl_schedule_node *node);
9115 The following function resets the user pointers on all parameter
9116 and tuple identifiers referenced by the given schedule node.
9118 #include <isl/schedule_node.h>
9119 __isl_give isl_schedule_node *isl_schedule_node_reset_user(
9120 __isl_take isl_schedule_node *node);
9122 The following function aligns the parameters of the given schedule
9123 node to the given space.
9125 #include <isl/schedule_node.h>
9126 __isl_give isl_schedule_node *
9127 isl_schedule_node_align_params(
9128 __isl_take isl_schedule_node *node,
9129 __isl_take isl_space *space);
9131 Several node types have their own functions for querying
9132 (and in some cases setting) some node type specific properties.
9134 #include <isl/schedule_node.h>
9135 __isl_give isl_space *isl_schedule_node_band_get_space(
9136 __isl_keep isl_schedule_node *node);
9137 __isl_give isl_multi_union_pw_aff *
9138 isl_schedule_node_band_get_partial_schedule(
9139 __isl_keep isl_schedule_node *node);
9140 __isl_give isl_union_map *
9141 isl_schedule_node_band_get_partial_schedule_union_map(
9142 __isl_keep isl_schedule_node *node);
9143 isl_size isl_schedule_node_band_n_member(
9144 __isl_keep isl_schedule_node *node);
9145 isl_bool isl_schedule_node_band_member_get_coincident(
9146 __isl_keep isl_schedule_node *node, int pos);
9147 __isl_give isl_schedule_node *
9148 isl_schedule_node_band_member_set_coincident(
9149 __isl_take isl_schedule_node *node, int pos,
9151 isl_bool isl_schedule_node_band_get_permutable(
9152 __isl_keep isl_schedule_node *node);
9153 __isl_give isl_schedule_node *
9154 isl_schedule_node_band_set_permutable(
9155 __isl_take isl_schedule_node *node, int permutable);
9156 enum isl_ast_loop_type
9157 isl_schedule_node_band_member_get_ast_loop_type(
9158 __isl_keep isl_schedule_node *node, int pos);
9159 __isl_give isl_schedule_node *
9160 isl_schedule_node_band_member_set_ast_loop_type(
9161 __isl_take isl_schedule_node *node, int pos,
9162 enum isl_ast_loop_type type);
9163 __isl_give isl_union_set *
9164 enum isl_ast_loop_type
9165 isl_schedule_node_band_member_get_isolate_ast_loop_type(
9166 __isl_keep isl_schedule_node *node, int pos);
9167 __isl_give isl_schedule_node *
9168 isl_schedule_node_band_member_set_isolate_ast_loop_type(
9169 __isl_take isl_schedule_node *node, int pos,
9170 enum isl_ast_loop_type type);
9171 isl_schedule_node_band_get_ast_build_options(
9172 __isl_keep isl_schedule_node *node);
9173 __isl_give isl_schedule_node *
9174 isl_schedule_node_band_set_ast_build_options(
9175 __isl_take isl_schedule_node *node,
9176 __isl_take isl_union_set *options);
9177 __isl_give isl_set *
9178 isl_schedule_node_band_get_ast_isolate_option(
9179 __isl_keep isl_schedule_node *node);
9181 The function C<isl_schedule_node_band_get_space> returns the space
9182 of the partial schedule of the band.
9183 The function C<isl_schedule_node_band_get_partial_schedule_union_map>
9184 returns a representation of the partial schedule of the band node
9185 in the form of an C<isl_union_map>.
9186 The coincident and permutable properties are set by
9187 C<isl_schedule_constraints_compute_schedule> on the schedule tree
9189 A scheduling dimension is considered to be ``coincident''
9190 if it satisfies the coincidence constraints within its band.
9191 That is, if the dependence distances of the coincidence
9192 constraints are all zero in that direction (for fixed
9193 iterations of outer bands).
9194 A band is marked permutable if it was produced using the Pluto-like scheduler.
9195 Note that the scheduler may have to resort to a Feautrier style scheduling
9196 step even if the default scheduler is used.
9197 An C<isl_ast_loop_type> is one of C<isl_ast_loop_default>,
9198 C<isl_ast_loop_atomic>, C<isl_ast_loop_unroll> or C<isl_ast_loop_separate>.
9199 For the meaning of these loop AST generation types and the difference
9200 between the regular loop AST generation type and the isolate
9201 loop AST generation type, see L</"AST Generation Options (Schedule Tree)">.
9202 The functions C<isl_schedule_node_band_member_get_ast_loop_type>
9203 and C<isl_schedule_node_band_member_get_isolate_ast_loop_type>
9204 may return C<isl_ast_loop_error> if an error occurs.
9205 The AST build options govern how an AST is generated for
9206 the individual schedule dimensions during AST generation.
9207 See L</"AST Generation Options (Schedule Tree)">.
9208 The isolate option for the given node can be extracted from these
9209 AST build options using the function
9210 C<isl_schedule_node_band_get_ast_isolate_option>.
9212 #include <isl/schedule_node.h>
9213 __isl_give isl_set *
9214 isl_schedule_node_context_get_context(
9215 __isl_keep isl_schedule_node *node);
9217 #include <isl/schedule_node.h>
9218 __isl_give isl_union_set *
9219 isl_schedule_node_domain_get_domain(
9220 __isl_keep isl_schedule_node *node);
9222 #include <isl/schedule_node.h>
9223 __isl_give isl_union_map *
9224 isl_schedule_node_expansion_get_expansion(
9225 __isl_keep isl_schedule_node *node);
9226 __isl_give isl_union_pw_multi_aff *
9227 isl_schedule_node_expansion_get_contraction(
9228 __isl_keep isl_schedule_node *node);
9230 #include <isl/schedule_node.h>
9231 __isl_give isl_union_map *
9232 isl_schedule_node_extension_get_extension(
9233 __isl_keep isl_schedule_node *node);
9235 #include <isl/schedule_node.h>
9236 __isl_give isl_union_set *
9237 isl_schedule_node_filter_get_filter(
9238 __isl_keep isl_schedule_node *node);
9240 #include <isl/schedule_node.h>
9241 __isl_give isl_set *isl_schedule_node_guard_get_guard(
9242 __isl_keep isl_schedule_node *node);
9244 #include <isl/schedule_node.h>
9245 __isl_give isl_id *isl_schedule_node_mark_get_id(
9246 __isl_keep isl_schedule_node *node);
9248 The following functions can be used to obtain an C<isl_multi_union_pw_aff>,
9249 an C<isl_union_pw_multi_aff> or C<isl_union_map> representation of
9250 partial schedules related to the node.
9252 #include <isl/schedule_node.h>
9253 __isl_give isl_multi_union_pw_aff *
9254 isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(
9255 __isl_keep isl_schedule_node *node);
9256 __isl_give isl_union_pw_multi_aff *
9257 isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(
9258 __isl_keep isl_schedule_node *node);
9259 __isl_give isl_union_map *
9260 isl_schedule_node_get_prefix_schedule_union_map(
9261 __isl_keep isl_schedule_node *node);
9262 __isl_give isl_union_map *
9263 isl_schedule_node_get_prefix_schedule_relation(
9264 __isl_keep isl_schedule_node *node);
9265 __isl_give isl_union_map *
9266 isl_schedule_node_get_subtree_schedule_union_map(
9267 __isl_keep isl_schedule_node *node);
9269 In particular, the functions
9270 C<isl_schedule_node_get_prefix_schedule_multi_union_pw_aff>,
9271 C<isl_schedule_node_get_prefix_schedule_union_pw_multi_aff>
9272 and C<isl_schedule_node_get_prefix_schedule_union_map>
9273 return a relative ordering on the domain elements that reach the given
9274 node determined by its ancestors.
9275 The function C<isl_schedule_node_get_prefix_schedule_relation>
9276 additionally includes the domain constraints in the result.
9277 The function C<isl_schedule_node_get_subtree_schedule_union_map>
9278 returns a representation of the partial schedule defined by the
9279 subtree rooted at the given node.
9280 If the tree contains any expansion nodes, then the subtree schedule
9281 is formulated in terms of the expanded domain elements.
9282 The tree passed to functions returning a prefix schedule
9283 may only contain extension nodes if these would not affect
9284 the result of these functions. That is, if one of the ancestors
9285 is an extension node, then all of the domain elements that were
9286 added by the extension node need to have been filtered out
9287 by filter nodes between the extension node and the input node.
9288 The tree passed to C<isl_schedule_node_get_subtree_schedule_union_map>
9289 may not contain in extension nodes in the selected subtree.
9291 The expansion/contraction defined by an entire subtree, combining
9292 the expansions/contractions
9293 on the expansion nodes in the subtree, can be obtained using
9294 the following functions.
9296 #include <isl/schedule_node.h>
9297 __isl_give isl_union_map *
9298 isl_schedule_node_get_subtree_expansion(
9299 __isl_keep isl_schedule_node *node);
9300 __isl_give isl_union_pw_multi_aff *
9301 isl_schedule_node_get_subtree_contraction(
9302 __isl_keep isl_schedule_node *node);
9304 The total number of outer band members of given node, i.e.,
9305 the shared output dimension of the maps in the result
9306 of C<isl_schedule_node_get_prefix_schedule_union_map> can be obtained
9307 using the following function.
9309 #include <isl/schedule_node.h>
9310 isl_size isl_schedule_node_get_schedule_depth(
9311 __isl_keep isl_schedule_node *node);
9313 The following functions return the elements that reach the given node
9314 or the union of universes in the spaces that contain these elements.
9316 #include <isl/schedule_node.h>
9317 __isl_give isl_union_set *
9318 isl_schedule_node_get_domain(
9319 __isl_keep isl_schedule_node *node);
9320 __isl_give isl_union_set *
9321 isl_schedule_node_get_universe_domain(
9322 __isl_keep isl_schedule_node *node);
9324 The input tree of C<isl_schedule_node_get_domain>
9325 may only contain extension nodes if these would not affect
9326 the result of this function. That is, if one of the ancestors
9327 is an extension node, then all of the domain elements that were
9328 added by the extension node need to have been filtered out
9329 by filter nodes between the extension node and the input node.
9331 The following functions can be used to introduce additional nodes
9332 in the schedule tree. The new node is introduced at the point
9333 in the tree where the C<isl_schedule_node> points to and
9334 the results points to the new node.
9336 #include <isl/schedule_node.h>
9337 __isl_give isl_schedule_node *
9338 isl_schedule_node_insert_partial_schedule(
9339 __isl_take isl_schedule_node *node,
9340 __isl_take isl_multi_union_pw_aff *schedule);
9342 This function inserts a new band node with (the greatest integer
9343 part of) the given partial schedule.
9344 The subtree rooted at the given node is assumed not to have
9347 #include <isl/schedule_node.h>
9348 __isl_give isl_schedule_node *
9349 isl_schedule_node_insert_context(
9350 __isl_take isl_schedule_node *node,
9351 __isl_take isl_set *context);
9353 This function inserts a new context node with the given context constraints.
9355 #include <isl/schedule_node.h>
9356 __isl_give isl_schedule_node *
9357 isl_schedule_node_insert_filter(
9358 __isl_take isl_schedule_node *node,
9359 __isl_take isl_union_set *filter);
9361 This function inserts a new filter node with the given filter.
9362 If the original node already pointed to a filter node, then the
9363 two filter nodes are merged into one.
9365 #include <isl/schedule_node.h>
9366 __isl_give isl_schedule_node *
9367 isl_schedule_node_insert_guard(
9368 __isl_take isl_schedule_node *node,
9369 __isl_take isl_set *guard);
9371 This function inserts a new guard node with the given guard constraints.
9373 #include <isl/schedule_node.h>
9374 __isl_give isl_schedule_node *
9375 isl_schedule_node_insert_mark(
9376 __isl_take isl_schedule_node *node,
9377 __isl_take isl_id *mark);
9379 This function inserts a new mark node with the give mark identifier.
9381 #include <isl/schedule_node.h>
9382 __isl_give isl_schedule_node *
9383 isl_schedule_node_insert_sequence(
9384 __isl_take isl_schedule_node *node,
9385 __isl_take isl_union_set_list *filters);
9386 __isl_give isl_schedule_node *
9387 isl_schedule_node_insert_set(
9388 __isl_take isl_schedule_node *node,
9389 __isl_take isl_union_set_list *filters);
9391 These functions insert a new sequence or set node with the given
9392 filters as children.
9394 #include <isl/schedule_node.h>
9395 __isl_give isl_schedule_node *isl_schedule_node_group(
9396 __isl_take isl_schedule_node *node,
9397 __isl_take isl_id *group_id);
9399 This function introduces an expansion node in between the current
9400 node and its parent that expands instances of a space with tuple
9401 identifier C<group_id> to the original domain elements that reach
9402 the node. The group instances are identified by the prefix schedule
9403 of those domain elements. The ancestors of the node are adjusted
9404 to refer to the group instances instead of the original domain
9405 elements. The return value points to the same node in the updated
9406 schedule tree as the input node, i.e., to the child of the newly
9407 introduced expansion node. Grouping instances of different statements
9408 ensures that they will be treated as a single statement by the
9409 AST generator up to the point of the expansion node.
9411 The following function can be used to flatten a nested
9414 #include <isl/schedule_node.h>
9415 __isl_give isl_schedule_node *
9416 isl_schedule_node_sequence_splice_child(
9417 __isl_take isl_schedule_node *node, int pos);
9419 That is, given a sequence node C<node> that has another sequence node
9420 in its child at position C<pos> (in particular, the child of that filter
9421 node is a sequence node), attach the children of that other sequence
9422 node as children of C<node>, replacing the original child at position
9425 The partial schedule of a band node can be scaled (down) or reduced using
9426 the following functions.
9428 #include <isl/schedule_node.h>
9429 __isl_give isl_schedule_node *
9430 isl_schedule_node_band_scale(
9431 __isl_take isl_schedule_node *node,
9432 __isl_take isl_multi_val *mv);
9433 __isl_give isl_schedule_node *
9434 isl_schedule_node_band_scale_down(
9435 __isl_take isl_schedule_node *node,
9436 __isl_take isl_multi_val *mv);
9437 __isl_give isl_schedule_node *
9438 isl_schedule_node_band_mod(
9439 __isl_take isl_schedule_node *node,
9440 __isl_take isl_multi_val *mv);
9442 The spaces of the two arguments need to match.
9443 After scaling, the partial schedule is replaced by its greatest
9444 integer part to ensure that the schedule remains integral.
9446 The partial schedule of a band node can be shifted by an
9447 C<isl_multi_union_pw_aff> with a domain that is a superset
9448 of the domain of the partial schedule using
9449 the following function.
9451 #include <isl/schedule_node.h>
9452 __isl_give isl_schedule_node *
9453 isl_schedule_node_band_shift(
9454 __isl_take isl_schedule_node *node,
9455 __isl_take isl_multi_union_pw_aff *shift);
9457 A band node can be tiled using the following function.
9459 #include <isl/schedule_node.h>
9460 __isl_give isl_schedule_node *isl_schedule_node_band_tile(
9461 __isl_take isl_schedule_node *node,
9462 __isl_take isl_multi_val *sizes);
9464 isl_stat isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
9466 int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
9467 isl_stat isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
9469 int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
9471 The C<isl_schedule_node_band_tile> function tiles
9472 the band using the given tile sizes inside its schedule.
9473 A new child band node is created to represent the point loops and it is
9474 inserted between the modified band and its children.
9475 The subtree rooted at the given node is assumed not to have
9477 The C<tile_scale_tile_loops> option specifies whether the tile
9478 loops iterators should be scaled by the tile sizes.
9479 If the C<tile_shift_point_loops> option is set, then the point loops
9480 are shifted to start at zero.
9482 A band node can be split into two nested band nodes
9483 using the following function.
9485 #include <isl/schedule_node.h>
9486 __isl_give isl_schedule_node *isl_schedule_node_band_split(
9487 __isl_take isl_schedule_node *node, int pos);
9489 The resulting outer band node contains the first C<pos> dimensions of
9490 the schedule of C<node> while the inner band contains the remaining dimensions.
9491 The schedules of the two band nodes live in anonymous spaces.
9492 The loop AST generation type options and the isolate option
9493 are split over the two band nodes.
9495 A band node can be moved down to the leaves of the subtree rooted
9496 at the band node using the following function.
9498 #include <isl/schedule_node.h>
9499 __isl_give isl_schedule_node *isl_schedule_node_band_sink(
9500 __isl_take isl_schedule_node *node);
9502 The subtree rooted at the given node is assumed not to have
9504 The result points to the node in the resulting tree that is in the same
9505 position as the node pointed to by C<node> in the original tree.
9507 #include <isl/schedule_node.h>
9508 __isl_give isl_schedule_node *
9509 isl_schedule_node_order_before(
9510 __isl_take isl_schedule_node *node,
9511 __isl_take isl_union_set *filter);
9512 __isl_give isl_schedule_node *
9513 isl_schedule_node_order_after(
9514 __isl_take isl_schedule_node *node,
9515 __isl_take isl_union_set *filter);
9517 These functions split the domain elements that reach C<node>
9518 into those that satisfy C<filter> and those that do not and
9519 arranges for the elements that do satisfy the filter to be
9520 executed before (in case of C<isl_schedule_node_order_before>)
9521 or after (in case of C<isl_schedule_node_order_after>)
9522 those that do not. The order is imposed by
9523 a sequence node, possibly reusing the grandparent of C<node>
9524 on two copies of the subtree attached to the original C<node>.
9525 Both copies are simplified with respect to their filter.
9527 Return a pointer to the copy of the subtree that does not
9528 satisfy C<filter>. If there is no such copy (because all
9529 reaching domain elements satisfy the filter), then return
9530 the original pointer.
9532 #include <isl/schedule_node.h>
9533 __isl_give isl_schedule_node *
9534 isl_schedule_node_graft_before(
9535 __isl_take isl_schedule_node *node,
9536 __isl_take isl_schedule_node *graft);
9537 __isl_give isl_schedule_node *
9538 isl_schedule_node_graft_after(
9539 __isl_take isl_schedule_node *node,
9540 __isl_take isl_schedule_node *graft);
9542 This function inserts the C<graft> tree into the tree containing C<node>
9543 such that it is executed before (in case of C<isl_schedule_node_graft_before>)
9544 or after (in case of C<isl_schedule_node_graft_after>) C<node>.
9545 The root node of C<graft>
9546 should be an extension node where the domain of the extension
9547 is the flat product of all outer band nodes of C<node>.
9548 The root node may also be a domain node.
9549 The elements of the domain or the range of the extension may not
9550 intersect with the domain elements that reach "node".
9551 The schedule tree of C<graft> may not be anchored.
9553 The schedule tree of C<node> is modified to include an extension node
9554 corresponding to the root node of C<graft> as a child of the original
9555 parent of C<node>. The original node that C<node> points to and the
9556 child of the root node of C<graft> are attached to this extension node
9557 through a sequence, with appropriate filters and with the child
9558 of C<graft> appearing before or after the original C<node>.
9560 If C<node> already appears inside a sequence that is the child of
9561 an extension node and if the spaces of the new domain elements
9562 do not overlap with those of the original domain elements,
9563 then that extension node is extended with the new extension
9564 rather than introducing a new segment of extension and sequence nodes.
9566 Return a pointer to the same node in the modified tree that
9567 C<node> pointed to in the original tree.
9569 A representation of the schedule node can be printed using
9571 #include <isl/schedule_node.h>
9572 __isl_give isl_printer *isl_printer_print_schedule_node(
9573 __isl_take isl_printer *p,
9574 __isl_keep isl_schedule_node *node);
9575 __isl_give char *isl_schedule_node_to_str(
9576 __isl_keep isl_schedule_node *node);
9578 C<isl_schedule_node_to_str> prints the schedule node in block format.
9580 =head2 Dependence Analysis
9582 C<isl> contains specialized functionality for performing
9583 array dataflow analysis. That is, given a I<sink> access relation,
9584 a collection of possible I<source> accesses and
9585 a collection of I<kill> accesses,
9586 C<isl> can compute relations that describe
9587 for each iteration of the sink access, which iterations
9588 of which of the source access relations may have
9589 accessed the same data element before the given iteration
9590 of the sink access without any intermediate kill of that data element.
9591 The resulting dependence relations map source iterations
9592 to either the corresponding sink iterations or
9593 pairs of corresponding sink iterations and accessed data elements.
9594 To compute standard flow dependences, the sink should be
9595 a read, while the sources should be writes.
9596 If no kills are specified,
9597 then memory based dependence analysis is performed.
9598 If, on the other hand, all sources are also kills,
9599 then value based dependence analysis is performed.
9600 If any of the source accesses are marked as being I<must>
9601 accesses, then they are also treated as kills.
9602 Furthermore, the specification of must-sources results
9603 in the computation of must-dependences.
9604 Only dependences originating in a must access not coscheduled
9605 with any other access to the same element and without
9606 any may accesses between the must access and the sink access
9607 are considered to be must dependences.
9609 =head3 High-level Interface
9611 A high-level interface to dependence analysis is provided
9612 by the following function.
9614 #include <isl/flow.h>
9615 __isl_give isl_union_flow *
9616 isl_union_access_info_compute_flow(
9617 __isl_take isl_union_access_info *access);
9619 The input C<isl_union_access_info> object describes the sink
9620 access relations, the source access relations and a schedule,
9621 while the output C<isl_union_flow> object describes
9622 the resulting dependence relations and the subsets of the
9623 sink relations for which no source was found.
9625 An C<isl_union_access_info> is created, modified, copied and freed using
9626 the following functions.
9628 #include <isl/flow.h>
9629 __isl_give isl_union_access_info *
9630 isl_union_access_info_from_sink(
9631 __isl_take isl_union_map *sink);
9632 __isl_give isl_union_access_info *
9633 isl_union_access_info_set_kill(
9634 __isl_take isl_union_access_info *access,
9635 __isl_take isl_union_map *kill);
9636 __isl_give isl_union_access_info *
9637 isl_union_access_info_set_may_source(
9638 __isl_take isl_union_access_info *access,
9639 __isl_take isl_union_map *may_source);
9640 __isl_give isl_union_access_info *
9641 isl_union_access_info_set_must_source(
9642 __isl_take isl_union_access_info *access,
9643 __isl_take isl_union_map *must_source);
9644 __isl_give isl_union_access_info *
9645 isl_union_access_info_set_schedule(
9646 __isl_take isl_union_access_info *access,
9647 __isl_take isl_schedule *schedule);
9648 __isl_give isl_union_access_info *
9649 isl_union_access_info_set_schedule_map(
9650 __isl_take isl_union_access_info *access,
9651 __isl_take isl_union_map *schedule_map);
9652 __isl_give isl_union_access_info *
9653 isl_union_access_info_copy(
9654 __isl_keep isl_union_access_info *access);
9655 __isl_null isl_union_access_info *
9656 isl_union_access_info_free(
9657 __isl_take isl_union_access_info *access);
9659 The may sources set by C<isl_union_access_info_set_may_source>
9660 do not need to include the must sources set by
9661 C<isl_union_access_info_set_must_source> as a subset.
9662 The kills set by C<isl_union_access_info_set_kill> may overlap
9663 with the may-sources and/or must-sources.
9664 The user is free not to call one (or more) of these functions,
9665 in which case the corresponding set is kept to its empty default.
9666 Similarly, the default schedule initialized by
9667 C<isl_union_access_info_from_sink> is empty.
9668 The current schedule is determined by the last call to either
9669 C<isl_union_access_info_set_schedule> or
9670 C<isl_union_access_info_set_schedule_map>.
9671 The domain of the schedule corresponds to the domains of
9672 the access relations. In particular, the domains of the access
9673 relations are effectively intersected with the domain of the schedule
9674 and only the resulting accesses are considered by the dependence analysis.
9676 An C<isl_union_access_info> object can be read from input
9677 using the following function.
9679 #include <isl/flow.h>
9680 __isl_give isl_union_access_info *
9681 isl_union_access_info_read_from_file(isl_ctx *ctx,
9684 A representation of the information contained in an object
9685 of type C<isl_union_access_info> can be obtained using
9687 #include <isl/flow.h>
9688 __isl_give isl_printer *
9689 isl_printer_print_union_access_info(
9690 __isl_take isl_printer *p,
9691 __isl_keep isl_union_access_info *access);
9692 __isl_give char *isl_union_access_info_to_str(
9693 __isl_keep isl_union_access_info *access);
9695 C<isl_union_access_info_to_str> prints the information in flow format.
9697 The output of C<isl_union_access_info_compute_flow> can be examined,
9698 copied, and freed using the following functions.
9700 #include <isl/flow.h>
9701 __isl_give isl_union_map *isl_union_flow_get_must_dependence(
9702 __isl_keep isl_union_flow *flow);
9703 __isl_give isl_union_map *isl_union_flow_get_may_dependence(
9704 __isl_keep isl_union_flow *flow);
9705 __isl_give isl_union_map *
9706 isl_union_flow_get_full_must_dependence(
9707 __isl_keep isl_union_flow *flow);
9708 __isl_give isl_union_map *
9709 isl_union_flow_get_full_may_dependence(
9710 __isl_keep isl_union_flow *flow);
9711 __isl_give isl_union_map *isl_union_flow_get_must_no_source(
9712 __isl_keep isl_union_flow *flow);
9713 __isl_give isl_union_map *isl_union_flow_get_may_no_source(
9714 __isl_keep isl_union_flow *flow);
9715 __isl_give isl_union_flow *isl_union_flow_copy(
9716 __isl_keep isl_union_flow *flow);
9717 __isl_null isl_union_flow *isl_union_flow_free(
9718 __isl_take isl_union_flow *flow);
9720 The relation returned by C<isl_union_flow_get_must_dependence>
9721 relates domain elements of must sources to domain elements of the sink.
9722 The relation returned by C<isl_union_flow_get_may_dependence>
9723 relates domain elements of must or may sources to domain elements of the sink
9724 and includes the previous relation as a subset.
9725 The relation returned by C<isl_union_flow_get_full_must_dependence>
9726 relates domain elements of must sources to pairs of domain elements of the sink
9727 and accessed data elements.
9728 The relation returned by C<isl_union_flow_get_full_may_dependence>
9729 relates domain elements of must or may sources to pairs of
9730 domain elements of the sink and accessed data elements.
9731 This relation includes the previous relation as a subset.
9732 The relation returned by C<isl_union_flow_get_must_no_source> is the subset
9733 of the sink relation for which no dependences have been found.
9734 The relation returned by C<isl_union_flow_get_may_no_source> is the subset
9735 of the sink relation for which no definite dependences have been found.
9736 That is, it contains those sink access that do not contribute to any
9737 of the elements in the relation returned
9738 by C<isl_union_flow_get_must_dependence>.
9740 A representation of the information contained in an object
9741 of type C<isl_union_flow> can be obtained using
9743 #include <isl/flow.h>
9744 __isl_give isl_printer *isl_printer_print_union_flow(
9745 __isl_take isl_printer *p,
9746 __isl_keep isl_union_flow *flow);
9747 __isl_give char *isl_union_flow_to_str(
9748 __isl_keep isl_union_flow *flow);
9750 C<isl_union_flow_to_str> prints the information in flow format.
9752 =head3 Low-level Interface
9754 A lower-level interface is provided by the following functions.
9756 #include <isl/flow.h>
9758 typedef int (*isl_access_level_before)(void *first, void *second);
9760 __isl_give isl_access_info *isl_access_info_alloc(
9761 __isl_take isl_map *sink,
9762 void *sink_user, isl_access_level_before fn,
9764 __isl_give isl_access_info *isl_access_info_add_source(
9765 __isl_take isl_access_info *acc,
9766 __isl_take isl_map *source, int must,
9768 __isl_null isl_access_info *isl_access_info_free(
9769 __isl_take isl_access_info *acc);
9771 __isl_give isl_flow *isl_access_info_compute_flow(
9772 __isl_take isl_access_info *acc);
9774 isl_stat isl_flow_foreach(__isl_keep isl_flow *deps,
9775 isl_stat (*fn)(__isl_take isl_map *dep, int must,
9776 void *dep_user, void *user),
9778 __isl_give isl_map *isl_flow_get_no_source(
9779 __isl_keep isl_flow *deps, int must);
9780 __isl_null isl_flow *isl_flow_free(
9781 __isl_take isl_flow *deps);
9783 The function C<isl_access_info_compute_flow> performs the actual
9784 dependence analysis. The other functions are used to construct
9785 the input for this function or to read off the output.
9787 The input is collected in an C<isl_access_info>, which can
9788 be created through a call to C<isl_access_info_alloc>.
9789 The arguments to this functions are the sink access relation
9790 C<sink>, a token C<sink_user> used to identify the sink
9791 access to the user, a callback function for specifying the
9792 relative order of source and sink accesses, and the number
9793 of source access relations that will be added.
9795 The callback function has type C<int (*)(void *first, void *second)>.
9796 The function is called with two user supplied tokens identifying
9797 either a source or the sink and it should return the shared nesting
9798 level and the relative order of the two accesses.
9799 In particular, let I<n> be the number of loops shared by
9800 the two accesses. If C<first> precedes C<second> textually,
9801 then the function should return I<2 * n + 1>; otherwise,
9802 it should return I<2 * n>.
9803 The low-level interface assumes that no sources are coscheduled.
9804 If the information returned by the callback does not allow
9805 the relative order to be determined, then one of the sources
9806 is arbitrarily taken to be executed after the other(s).
9808 The sources can be added to the C<isl_access_info> object by performing
9809 (at most) C<max_source> calls to C<isl_access_info_add_source>.
9810 C<must> indicates whether the source is a I<must> access
9811 or a I<may> access. Note that a multi-valued access relation
9812 should only be marked I<must> if every iteration in the domain
9813 of the relation accesses I<all> elements in its image.
9814 The C<source_user> token is again used to identify
9815 the source access. The range of the source access relation
9816 C<source> should have the same dimension as the range
9817 of the sink access relation.
9818 The C<isl_access_info_free> function should usually not be
9819 called explicitly, because it is already called implicitly by
9820 C<isl_access_info_compute_flow>.
9822 The result of the dependence analysis is collected in an
9823 C<isl_flow>. There may be elements of
9824 the sink access for which no preceding source access could be
9825 found or for which all preceding sources are I<may> accesses.
9826 The relations containing these elements can be obtained through
9827 calls to C<isl_flow_get_no_source>, the first with C<must> set
9828 and the second with C<must> unset.
9829 In the case of standard flow dependence analysis,
9830 with the sink a read and the sources I<must> writes,
9831 the first relation corresponds to the reads from uninitialized
9832 array elements and the second relation is empty.
9833 The actual flow dependences can be extracted using
9834 C<isl_flow_foreach>. This function will call the user-specified
9835 callback function C<fn> for each B<non-empty> dependence between
9836 a source and the sink. The callback function is called
9837 with four arguments, the actual flow dependence relation
9838 mapping source iterations to sink iterations, a boolean that
9839 indicates whether it is a I<must> or I<may> dependence, a token
9840 identifying the source and an additional C<void *> with value
9841 equal to the third argument of the C<isl_flow_foreach> call.
9842 A dependence is marked I<must> if it originates from a I<must>
9843 source and if it is not followed by any I<may> sources.
9845 After finishing with an C<isl_flow>, the user should call
9846 C<isl_flow_free> to free all associated memory.
9848 =head3 Interaction with the Low-level Interface
9850 During the dependence analysis, we frequently need to perform
9851 the following operation. Given a relation between sink iterations
9852 and potential source iterations from a particular source domain,
9853 what is the last potential source iteration corresponding to each
9854 sink iteration. It can sometimes be convenient to adjust
9855 the set of potential source iterations before or after each such operation.
9856 The prototypical example is fuzzy array dataflow analysis,
9857 where we need to analyze if, based on data-dependent constraints,
9858 the sink iteration can ever be executed without one or more of
9859 the corresponding potential source iterations being executed.
9860 If so, we can introduce extra parameters and select an unknown
9861 but fixed source iteration from the potential source iterations.
9862 To be able to perform such manipulations, C<isl> provides the following
9865 #include <isl/flow.h>
9867 typedef __isl_give isl_restriction *(*isl_access_restrict)(
9868 __isl_keep isl_map *source_map,
9869 __isl_keep isl_set *sink, void *source_user,
9871 __isl_give isl_access_info *isl_access_info_set_restrict(
9872 __isl_take isl_access_info *acc,
9873 isl_access_restrict fn, void *user);
9875 The function C<isl_access_info_set_restrict> should be called
9876 before calling C<isl_access_info_compute_flow> and registers a callback function
9877 that will be called any time C<isl> is about to compute the last
9878 potential source. The first argument is the (reverse) proto-dependence,
9879 mapping sink iterations to potential source iterations.
9880 The second argument represents the sink iterations for which
9881 we want to compute the last source iteration.
9882 The third argument is the token corresponding to the source
9883 and the final argument is the token passed to C<isl_access_info_set_restrict>.
9884 The callback is expected to return a restriction on either the input or
9885 the output of the operation computing the last potential source.
9886 If the input needs to be restricted then restrictions are needed
9887 for both the source and the sink iterations. The sink iterations
9888 and the potential source iterations will be intersected with these sets.
9889 If the output needs to be restricted then only a restriction on the source
9890 iterations is required.
9891 If any error occurs, the callback should return C<NULL>.
9892 An C<isl_restriction> object can be created, freed and inspected
9893 using the following functions.
9895 #include <isl/flow.h>
9897 __isl_give isl_restriction *isl_restriction_input(
9898 __isl_take isl_set *source_restr,
9899 __isl_take isl_set *sink_restr);
9900 __isl_give isl_restriction *isl_restriction_output(
9901 __isl_take isl_set *source_restr);
9902 __isl_give isl_restriction *isl_restriction_none(
9903 __isl_take isl_map *source_map);
9904 __isl_give isl_restriction *isl_restriction_empty(
9905 __isl_take isl_map *source_map);
9906 __isl_null isl_restriction *isl_restriction_free(
9907 __isl_take isl_restriction *restr);
9909 C<isl_restriction_none> and C<isl_restriction_empty> are special
9910 cases of C<isl_restriction_input>. C<isl_restriction_none>
9911 is essentially equivalent to
9913 isl_restriction_input(isl_set_universe(
9914 isl_space_range(isl_map_get_space(source_map))),
9916 isl_space_domain(isl_map_get_space(source_map))));
9918 whereas C<isl_restriction_empty> is essentially equivalent to
9920 isl_restriction_input(isl_set_empty(
9921 isl_space_range(isl_map_get_space(source_map))),
9923 isl_space_domain(isl_map_get_space(source_map))));
9927 #include <isl/schedule.h>
9928 __isl_give isl_schedule *
9929 isl_schedule_constraints_compute_schedule(
9930 __isl_take isl_schedule_constraints *sc);
9932 The function C<isl_schedule_constraints_compute_schedule> can be
9933 used to compute a schedule that satisfies the given schedule constraints.
9934 These schedule constraints include the iteration domain for which
9935 a schedule should be computed and dependences between pairs of
9936 iterations. In particular, these dependences include
9937 I<validity> dependences and I<proximity> dependences.
9938 By default, the algorithm used to construct the schedule is similar
9939 to that of C<Pluto>.
9940 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
9942 The generated schedule respects all validity dependences.
9943 That is, all dependence distances over these dependences in the
9944 scheduled space are lexicographically positive.
9946 The default algorithm tries to ensure that the dependence distances
9947 over coincidence constraints are zero and to minimize the
9948 dependence distances over proximity dependences.
9949 Moreover, it tries to obtain sequences (bands) of schedule dimensions
9950 for groups of domains where the dependence distances over validity
9951 dependences have only non-negative values.
9952 Note that when minimizing the maximal dependence distance
9953 over proximity dependences, a single affine expression in the parameters
9954 is constructed that bounds all dependence distances. If no such expression
9955 exists, then the algorithm will fail and resort to an alternative
9956 scheduling algorithm. In particular, this means that adding proximity
9957 dependences may eliminate valid solutions. A typical example where this
9958 phenomenon may occur is when some subset of the proximity dependences
9959 has no restriction on some parameter, forcing the coefficient of that
9960 parameter to be zero, while some other subset forces the dependence
9961 distance to depend on that parameter, requiring the same coefficient
9963 When using Feautrier's algorithm, the coincidence and proximity constraints
9964 are only taken into account during the extension to a
9965 full-dimensional schedule.
9967 An C<isl_schedule_constraints> object can be constructed
9968 and manipulated using the following functions.
9970 #include <isl/schedule.h>
9971 __isl_give isl_schedule_constraints *
9972 isl_schedule_constraints_copy(
9973 __isl_keep isl_schedule_constraints *sc);
9974 __isl_give isl_schedule_constraints *
9975 isl_schedule_constraints_on_domain(
9976 __isl_take isl_union_set *domain);
9977 __isl_give isl_schedule_constraints *
9978 isl_schedule_constraints_set_context(
9979 __isl_take isl_schedule_constraints *sc,
9980 __isl_take isl_set *context);
9981 __isl_give isl_schedule_constraints *
9982 isl_schedule_constraints_set_validity(
9983 __isl_take isl_schedule_constraints *sc,
9984 __isl_take isl_union_map *validity);
9985 __isl_give isl_schedule_constraints *
9986 isl_schedule_constraints_set_coincidence(
9987 __isl_take isl_schedule_constraints *sc,
9988 __isl_take isl_union_map *coincidence);
9989 __isl_give isl_schedule_constraints *
9990 isl_schedule_constraints_set_proximity(
9991 __isl_take isl_schedule_constraints *sc,
9992 __isl_take isl_union_map *proximity);
9993 __isl_give isl_schedule_constraints *
9994 isl_schedule_constraints_set_conditional_validity(
9995 __isl_take isl_schedule_constraints *sc,
9996 __isl_take isl_union_map *condition,
9997 __isl_take isl_union_map *validity);
9998 __isl_give isl_schedule_constraints *
9999 isl_schedule_constraints_apply(
10000 __isl_take isl_schedule_constraints *sc,
10001 __isl_take isl_union_map *umap);
10002 __isl_null isl_schedule_constraints *
10003 isl_schedule_constraints_free(
10004 __isl_take isl_schedule_constraints *sc);
10006 The initial C<isl_schedule_constraints> object created by
10007 C<isl_schedule_constraints_on_domain> does not impose any constraints.
10008 That is, it has an empty set of dependences.
10009 The function C<isl_schedule_constraints_set_context> allows the user
10010 to specify additional constraints on the parameters that may
10011 be assumed to hold during the construction of the schedule.
10012 The function C<isl_schedule_constraints_set_validity> replaces the
10013 validity dependences, mapping domain elements I<i> to domain
10014 elements that should be scheduled after I<i>.
10015 The function C<isl_schedule_constraints_set_coincidence> replaces the
10016 coincidence dependences, mapping domain elements I<i> to domain
10017 elements that should be scheduled together with I<I>, if possible.
10018 The function C<isl_schedule_constraints_set_proximity> replaces the
10019 proximity dependences, mapping domain elements I<i> to domain
10020 elements that should be scheduled either before I<I>
10021 or as early as possible after I<i>.
10023 The function C<isl_schedule_constraints_set_conditional_validity>
10024 replaces the conditional validity constraints.
10025 A conditional validity constraint is only imposed when any of the corresponding
10026 conditions is satisfied, i.e., when any of them is non-zero.
10027 That is, the scheduler ensures that within each band if the dependence
10028 distances over the condition constraints are not all zero
10029 then all corresponding conditional validity constraints are respected.
10030 A conditional validity constraint corresponds to a condition
10031 if the two are adjacent, i.e., if the domain of one relation intersect
10032 the range of the other relation.
10033 The typical use case of conditional validity constraints is
10034 to allow order constraints between live ranges to be violated
10035 as long as the live ranges themselves are local to the band.
10036 To allow more fine-grained control over which conditions correspond
10037 to which conditional validity constraints, the domains and ranges
10038 of these relations may include I<tags>. That is, the domains and
10039 ranges of those relation may themselves be wrapped relations
10040 where the iteration domain appears in the domain of those wrapped relations
10041 and the range of the wrapped relations can be arbitrarily chosen
10042 by the user. Conditions and conditional validity constraints are only
10043 considered adjacent to each other if the entire wrapped relation matches.
10044 In particular, a relation with a tag will never be considered adjacent
10045 to a relation without a tag.
10047 The function C<isl_schedule_constraints_apply> takes
10048 schedule constraints that are defined on some set of domain elements
10049 and transforms them to schedule constraints on the elements
10050 to which these domain elements are mapped by the given transformation.
10052 An C<isl_schedule_constraints> object can be inspected
10053 using the following functions.
10055 #include <isl/schedule.h>
10056 __isl_give isl_union_set *
10057 isl_schedule_constraints_get_domain(
10058 __isl_keep isl_schedule_constraints *sc);
10059 __isl_give isl_set *isl_schedule_constraints_get_context(
10060 __isl_keep isl_schedule_constraints *sc);
10061 __isl_give isl_union_map *
10062 isl_schedule_constraints_get_validity(
10063 __isl_keep isl_schedule_constraints *sc);
10064 __isl_give isl_union_map *
10065 isl_schedule_constraints_get_coincidence(
10066 __isl_keep isl_schedule_constraints *sc);
10067 __isl_give isl_union_map *
10068 isl_schedule_constraints_get_proximity(
10069 __isl_keep isl_schedule_constraints *sc);
10070 __isl_give isl_union_map *
10071 isl_schedule_constraints_get_conditional_validity(
10072 __isl_keep isl_schedule_constraints *sc);
10073 __isl_give isl_union_map *
10074 isl_schedule_constraints_get_conditional_validity_condition(
10075 __isl_keep isl_schedule_constraints *sc);
10077 An C<isl_schedule_constraints> object can be read from input
10078 using the following functions.
10080 #include <isl/schedule.h>
10081 __isl_give isl_schedule_constraints *
10082 isl_schedule_constraints_read_from_str(isl_ctx *ctx,
10084 __isl_give isl_schedule_constraints *
10085 isl_schedule_constraints_read_from_file(isl_ctx *ctx,
10088 The contents of an C<isl_schedule_constraints> object can be printed
10089 using the following functions.
10091 #include <isl/schedule.h>
10092 __isl_give isl_printer *
10093 isl_printer_print_schedule_constraints(
10094 __isl_take isl_printer *p,
10095 __isl_keep isl_schedule_constraints *sc);
10096 __isl_give char *isl_schedule_constraints_to_str(
10097 __isl_keep isl_schedule_constraints *sc);
10099 The following function computes a schedule directly from
10100 an iteration domain and validity and proximity dependences
10101 and is implemented in terms of the functions described above.
10102 The use of C<isl_union_set_compute_schedule> is discouraged.
10104 #include <isl/schedule.h>
10105 __isl_give isl_schedule *isl_union_set_compute_schedule(
10106 __isl_take isl_union_set *domain,
10107 __isl_take isl_union_map *validity,
10108 __isl_take isl_union_map *proximity);
10110 The generated schedule represents a schedule tree.
10111 For more information on schedule trees, see
10112 L</"Schedule Trees">.
10116 #include <isl/schedule.h>
10117 isl_stat isl_options_set_schedule_max_coefficient(
10118 isl_ctx *ctx, int val);
10119 int isl_options_get_schedule_max_coefficient(
10121 isl_stat isl_options_set_schedule_max_constant_term(
10122 isl_ctx *ctx, int val);
10123 int isl_options_get_schedule_max_constant_term(
10125 isl_stat isl_options_set_schedule_serialize_sccs(
10126 isl_ctx *ctx, int val);
10127 int isl_options_get_schedule_serialize_sccs(isl_ctx *ctx);
10128 isl_stat isl_options_set_schedule_whole_component(
10129 isl_ctx *ctx, int val);
10130 int isl_options_get_schedule_whole_component(
10132 isl_stat isl_options_set_schedule_maximize_band_depth(
10133 isl_ctx *ctx, int val);
10134 int isl_options_get_schedule_maximize_band_depth(
10136 isl_stat isl_options_set_schedule_maximize_coincidence(
10137 isl_ctx *ctx, int val);
10138 int isl_options_get_schedule_maximize_coincidence(
10140 isl_stat isl_options_set_schedule_outer_coincidence(
10141 isl_ctx *ctx, int val);
10142 int isl_options_get_schedule_outer_coincidence(
10144 isl_stat isl_options_set_schedule_split_scaled(
10145 isl_ctx *ctx, int val);
10146 int isl_options_get_schedule_split_scaled(
10148 isl_stat isl_options_set_schedule_treat_coalescing(
10149 isl_ctx *ctx, int val);
10150 int isl_options_get_schedule_treat_coalescing(
10152 isl_stat isl_options_set_schedule_algorithm(
10153 isl_ctx *ctx, int val);
10154 int isl_options_get_schedule_algorithm(
10156 isl_stat isl_options_set_schedule_carry_self_first(
10157 isl_ctx *ctx, int val);
10158 int isl_options_get_schedule_carry_self_first(
10160 isl_stat isl_options_set_schedule_separate_components(
10161 isl_ctx *ctx, int val);
10162 int isl_options_get_schedule_separate_components(
10167 =item * schedule_max_coefficient
10169 This option enforces that the coefficients for variable and parameter
10170 dimensions in the calculated schedule are not larger than the specified value.
10171 This option can significantly increase the speed of the scheduling calculation
10172 and may also prevent fusing of unrelated dimensions. A value of -1 means that
10173 this option does not introduce bounds on the variable or parameter
10175 This option has no effect on the Feautrier style scheduler.
10177 =item * schedule_max_constant_term
10179 This option enforces that the constant coefficients in the calculated schedule
10180 are not larger than the maximal constant term. This option can significantly
10181 increase the speed of the scheduling calculation and may also prevent fusing of
10182 unrelated dimensions. A value of -1 means that this option does not introduce
10183 bounds on the constant coefficients.
10185 =item * schedule_serialize_sccs
10187 If this option is set, then all strongly connected components
10188 in the dependence graph are serialized as soon as they are detected.
10189 This means in particular that instances of statements will only
10190 appear in the same band node if these statements belong
10191 to the same strongly connected component at the point where
10192 the band node is constructed.
10194 =item * schedule_whole_component
10196 If this option is set, then entire (weakly) connected
10197 components in the dependence graph are scheduled together
10199 Otherwise, each strongly connected component within
10200 such a weakly connected component is first scheduled separately
10201 and then combined with other strongly connected components.
10202 This option has no effect if C<schedule_serialize_sccs> is set.
10204 =item * schedule_maximize_band_depth
10206 If this option is set, then the scheduler tries to maximize
10207 the width of the bands. Wider bands give more possibilities for tiling.
10208 In particular, if the C<schedule_whole_component> option is set,
10209 then bands are split if this might result in wider bands.
10210 Otherwise, the effect of this option is to only allow
10211 strongly connected components to be combined if this does
10212 not reduce the width of the bands.
10213 Note that if the C<schedule_serialize_sccs> options is set, then
10214 the C<schedule_maximize_band_depth> option therefore has no effect.
10216 =item * schedule_maximize_coincidence
10218 This option is only effective if the C<schedule_whole_component>
10219 option is turned off.
10220 If the C<schedule_maximize_coincidence> option is set, then (clusters of)
10221 strongly connected components are only combined with each other
10222 if this does not reduce the number of coincident band members.
10224 =item * schedule_outer_coincidence
10226 If this option is set, then we try to construct schedules
10227 where the outermost scheduling dimension in each band
10228 satisfies the coincidence constraints.
10230 =item * schedule_algorithm
10232 Selects the scheduling algorithm to be used.
10233 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
10234 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
10236 =item * schedule_split_scaled
10238 If this option is set, then we try to construct schedules in which the
10239 constant term is split off from the linear part if the linear parts of
10240 the scheduling rows for all nodes in the graph have a common non-trivial
10242 The constant term is then dropped and the linear
10244 This option is only effective when the Feautrier style scheduler is
10245 being used, either as the main scheduler or as a fallback for the
10246 Pluto-like scheduler.
10248 =item * schedule_treat_coalescing
10250 If this option is set, then the scheduler will try and avoid
10251 producing schedules that perform loop coalescing.
10252 In particular, for the Pluto-like scheduler, this option places
10253 bounds on the schedule coefficients based on the sizes of the instance sets.
10254 For the Feautrier style scheduler, this option detects potentially
10255 coalescing schedules and then tries to adjust the schedule to avoid
10258 =item * schedule_carry_self_first
10260 If this option is set, then the Feautrier style scheduler
10261 (when used as a fallback for the Pluto-like scheduler) will
10262 first try to only carry self-dependences.
10264 =item * schedule_separate_components
10266 If this option is set then the function C<isl_schedule_get_map>
10267 will treat set nodes in the same way as sequence nodes.
10271 =head2 AST Generation
10273 This section describes the C<isl> functionality for generating
10274 ASTs that visit all the elements
10275 in a domain in an order specified by a schedule tree or
10277 In case the schedule given as a C<isl_union_map>, an AST is generated
10278 that visits all the elements in the domain of the C<isl_union_map>
10279 according to the lexicographic order of the corresponding image
10280 element(s). If the range of the C<isl_union_map> consists of
10281 elements in more than one space, then each of these spaces is handled
10282 separately in an arbitrary order.
10283 It should be noted that the schedule tree or the image elements
10284 in a schedule map only specify the I<order>
10285 in which the corresponding domain elements should be visited.
10286 No direct relation between the partial schedule values
10287 or the image elements on the one hand and the loop iterators
10288 in the generated AST on the other hand should be assumed.
10290 Each AST is generated within a build. The initial build
10291 simply specifies the constraints on the parameters (if any)
10292 and can be created, inspected, copied and freed using the following functions.
10294 #include <isl/ast_build.h>
10295 __isl_give isl_ast_build *isl_ast_build_alloc(
10297 __isl_give isl_ast_build *isl_ast_build_from_context(
10298 __isl_take isl_set *set);
10299 __isl_give isl_ast_build *isl_ast_build_copy(
10300 __isl_keep isl_ast_build *build);
10301 __isl_null isl_ast_build *isl_ast_build_free(
10302 __isl_take isl_ast_build *build);
10304 The C<set> argument is usually a parameter set with zero or more parameters.
10305 In fact, when creating an AST using C<isl_ast_build_node_from_schedule>,
10306 this set is required to be a parameter set.
10307 An C<isl_ast_build> created using C<isl_ast_build_alloc> does not
10308 specify any parameter constraints.
10309 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
10310 and L</"Fine-grained Control over AST Generation">.
10311 Finally, the AST itself can be constructed using one of the following
10314 #include <isl/ast_build.h>
10315 __isl_give isl_ast_node *isl_ast_build_node_from_schedule(
10316 __isl_keep isl_ast_build *build,
10317 __isl_take isl_schedule *schedule);
10318 __isl_give isl_ast_node *
10319 isl_ast_build_node_from_schedule_map(
10320 __isl_keep isl_ast_build *build,
10321 __isl_take isl_union_map *schedule);
10323 =head3 Inspecting the AST
10325 The basic properties of an AST node can be obtained as follows.
10327 #include <isl/ast.h>
10328 enum isl_ast_node_type isl_ast_node_get_type(
10329 __isl_keep isl_ast_node *node);
10331 The type of an AST node is one of
10332 C<isl_ast_node_for>,
10333 C<isl_ast_node_if>,
10334 C<isl_ast_node_block>,
10335 C<isl_ast_node_mark> or
10336 C<isl_ast_node_user>.
10337 An C<isl_ast_node_for> represents a for node.
10338 An C<isl_ast_node_if> represents an if node.
10339 An C<isl_ast_node_block> represents a compound node.
10340 An C<isl_ast_node_mark> introduces a mark in the AST.
10341 An C<isl_ast_node_user> represents an expression statement.
10342 An expression statement typically corresponds to a domain element, i.e.,
10343 one of the elements that is visited by the AST.
10345 Each type of node has its own additional properties.
10347 #include <isl/ast.h>
10348 __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
10349 __isl_keep isl_ast_node *node);
10350 __isl_give isl_ast_expr *isl_ast_node_for_get_init(
10351 __isl_keep isl_ast_node *node);
10352 __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
10353 __isl_keep isl_ast_node *node);
10354 __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
10355 __isl_keep isl_ast_node *node);
10356 __isl_give isl_ast_node *isl_ast_node_for_get_body(
10357 __isl_keep isl_ast_node *node);
10358 isl_bool isl_ast_node_for_is_degenerate(
10359 __isl_keep isl_ast_node *node);
10361 An C<isl_ast_for> is considered degenerate if it is known to execute
10364 #include <isl/ast.h>
10365 __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
10366 __isl_keep isl_ast_node *node);
10367 __isl_give isl_ast_node *isl_ast_node_if_get_then_node(
10368 __isl_keep isl_ast_node *node);
10369 __isl_give isl_ast_node *isl_ast_node_if_get_then(
10370 __isl_keep isl_ast_node *node);
10371 isl_bool isl_ast_node_if_has_else_node(
10372 __isl_keep isl_ast_node *node);
10373 isl_bool isl_ast_node_if_has_else(
10374 __isl_keep isl_ast_node *node);
10375 __isl_give isl_ast_node *isl_ast_node_if_get_else_node(
10376 __isl_keep isl_ast_node *node);
10377 __isl_give isl_ast_node *isl_ast_node_if_get_else(
10378 __isl_keep isl_ast_node *node);
10380 C<isl_ast_node_if_get_then>,
10381 C<isl_ast_node_if_has_else> and
10382 C<isl_ast_node_if_get_else>
10383 are alternative names for
10384 C<isl_ast_node_if_get_then_node>,
10385 C<isl_ast_node_if_has_else_node> and
10386 C<isl_ast_node_if_get_else_node>, respectively.
10388 __isl_give isl_ast_node_list *
10389 isl_ast_node_block_get_children(
10390 __isl_keep isl_ast_node *node);
10392 __isl_give isl_id *isl_ast_node_mark_get_id(
10393 __isl_keep isl_ast_node *node);
10394 __isl_give isl_ast_node *isl_ast_node_mark_get_node(
10395 __isl_keep isl_ast_node *node);
10397 C<isl_ast_node_mark_get_id> returns the identifier of the mark.
10398 C<isl_ast_node_mark_get_node> returns the child node that is being marked.
10400 #include <isl/ast.h>
10401 __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
10402 __isl_keep isl_ast_node *node);
10404 All descendants of a specific node in the AST (including the node itself)
10406 in depth-first pre-order using the following function.
10408 #include <isl/ast.h>
10409 isl_stat isl_ast_node_foreach_descendant_top_down(
10410 __isl_keep isl_ast_node *node,
10411 isl_bool (*fn)(__isl_keep isl_ast_node *node,
10412 void *user), void *user);
10414 The callback function should return C<isl_bool_true> if the children
10415 of the given node should be visited and C<isl_bool_false> if they should not.
10416 It should return C<isl_bool_error> in case of failure, in which case
10417 the entire traversal is aborted.
10419 Each of the returned C<isl_ast_expr>s can in turn be inspected using
10420 the following functions.
10422 #include <isl/ast.h>
10423 enum isl_ast_expr_type isl_ast_expr_get_type(
10424 __isl_keep isl_ast_expr *expr);
10426 The type of an AST expression is one of
10427 C<isl_ast_expr_op>,
10428 C<isl_ast_expr_id> or
10429 C<isl_ast_expr_int>.
10430 An C<isl_ast_expr_op> represents the result of an operation.
10431 An C<isl_ast_expr_id> represents an identifier.
10432 An C<isl_ast_expr_int> represents an integer value.
10434 Each type of expression has its own additional properties.
10436 #include <isl/ast.h>
10437 enum isl_ast_expr_op_type isl_ast_expr_op_get_type(
10438 __isl_keep isl_ast_expr *expr);
10439 enum isl_ast_expr_op_type isl_ast_expr_get_op_type(
10440 __isl_keep isl_ast_expr *expr);
10441 isl_size isl_ast_expr_op_get_n_arg(__isl_keep isl_ast_expr *expr);
10442 isl_size isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
10443 __isl_give isl_ast_expr *isl_ast_expr_op_get_arg(
10444 __isl_keep isl_ast_expr *expr, int pos);
10445 __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
10446 __isl_keep isl_ast_expr *expr, int pos);
10447 isl_stat isl_ast_expr_foreach_ast_expr_op_type(
10448 __isl_keep isl_ast_expr *expr,
10449 isl_stat (*fn)(enum isl_ast_expr_op_type type,
10450 void *user), void *user);
10451 isl_stat isl_ast_expr_foreach_ast_op_type(
10452 __isl_keep isl_ast_expr *expr,
10453 isl_stat (*fn)(enum isl_ast_expr_op_type type,
10454 void *user), void *user);
10455 isl_stat isl_ast_node_foreach_ast_expr_op_type(
10456 __isl_keep isl_ast_node *node,
10457 isl_stat (*fn)(enum isl_ast_expr_op_type type,
10458 void *user), void *user);
10459 isl_stat isl_ast_node_foreach_ast_op_type(
10460 __isl_keep isl_ast_node *node,
10461 isl_stat (*fn)(enum isl_ast_expr_op_type type,
10462 void *user), void *user);
10464 C<isl_ast_expr_op_get_type> returns the type of the operation
10465 performed. C<isl_ast_expr_op_get_n_arg> returns the number of
10466 arguments. C<isl_ast_expr_get_op_arg> returns the specified
10468 C<isl_ast_expr_get_op_type> is an alternative name for
10469 C<isl_ast_expr_op_get_type>.
10471 C<isl_ast_expr_get_op_n_arg> is an alternative name for
10472 C<isl_ast_expr_op_get_n_arg> and
10473 C<isl_ast_expr_get_op_arg> is an alternative name for
10474 C<isl_ast_expr_op_get_arg>.
10476 C<isl_ast_expr_foreach_ast_expr_op_type> calls C<fn> for each distinct
10477 C<isl_ast_expr_op_type> that appears in C<expr>.
10478 C<isl_ast_expr_foreach_ast_op_type> is an alternative name for
10479 C<isl_ast_expr_foreach_ast_expr_op_type>.
10480 C<isl_ast_node_foreach_ast_expr_op_type> does the same for each distinct
10481 C<isl_ast_expr_op_type> that appears in C<node>.
10482 C<isl_ast_node_foreach_ast_op_type> is an alternative name for
10483 C<isl_ast_node_foreach_ast_expr_op_type>.
10484 The operation type is one of the following.
10488 =item C<isl_ast_expr_op_and>
10490 Logical I<and> of two arguments.
10491 Both arguments can be evaluated.
10493 =item C<isl_ast_expr_op_and_then>
10495 Logical I<and> of two arguments.
10496 The second argument can only be evaluated if the first evaluates to true.
10498 =item C<isl_ast_expr_op_or>
10500 Logical I<or> of two arguments.
10501 Both arguments can be evaluated.
10503 =item C<isl_ast_expr_op_or_else>
10505 Logical I<or> of two arguments.
10506 The second argument can only be evaluated if the first evaluates to false.
10508 =item C<isl_ast_expr_op_max>
10510 Maximum of two or more arguments.
10512 =item C<isl_ast_expr_op_min>
10514 Minimum of two or more arguments.
10516 =item C<isl_ast_expr_op_minus>
10520 =item C<isl_ast_expr_op_add>
10522 Sum of two arguments.
10524 =item C<isl_ast_expr_op_sub>
10526 Difference of two arguments.
10528 =item C<isl_ast_expr_op_mul>
10530 Product of two arguments.
10532 =item C<isl_ast_expr_op_div>
10534 Exact division. That is, the result is known to be an integer.
10536 =item C<isl_ast_expr_op_fdiv_q>
10538 Result of integer division, rounded towards negative
10540 The divisor is known to be positive.
10542 =item C<isl_ast_expr_op_pdiv_q>
10544 Result of integer division, where dividend is known to be non-negative.
10545 The divisor is known to be positive.
10547 =item C<isl_ast_expr_op_pdiv_r>
10549 Remainder of integer division, where dividend is known to be non-negative.
10550 The divisor is known to be positive.
10552 =item C<isl_ast_expr_op_zdiv_r>
10554 Equal to zero iff the remainder on integer division is zero.
10555 The divisor is known to be positive.
10557 =item C<isl_ast_expr_op_cond>
10559 Conditional operator defined on three arguments.
10560 If the first argument evaluates to true, then the result
10561 is equal to the second argument. Otherwise, the result
10562 is equal to the third argument.
10563 The second and third argument may only be evaluated if
10564 the first argument evaluates to true and false, respectively.
10565 Corresponds to C<a ? b : c> in C.
10567 =item C<isl_ast_expr_op_select>
10569 Conditional operator defined on three arguments.
10570 If the first argument evaluates to true, then the result
10571 is equal to the second argument. Otherwise, the result
10572 is equal to the third argument.
10573 The second and third argument may be evaluated independently
10574 of the value of the first argument.
10575 Corresponds to C<a * b + (1 - a) * c> in C.
10577 =item C<isl_ast_expr_op_eq>
10581 =item C<isl_ast_expr_op_le>
10583 Less than or equal relation.
10585 =item C<isl_ast_expr_op_lt>
10587 Less than relation.
10589 =item C<isl_ast_expr_op_ge>
10591 Greater than or equal relation.
10593 =item C<isl_ast_expr_op_gt>
10595 Greater than relation.
10597 =item C<isl_ast_expr_op_call>
10600 The number of arguments of the C<isl_ast_expr> is one more than
10601 the number of arguments in the function call, the first argument
10602 representing the function being called.
10604 =item C<isl_ast_expr_op_access>
10607 The number of arguments of the C<isl_ast_expr> is one more than
10608 the number of index expressions in the array access, the first argument
10609 representing the array being accessed.
10611 =item C<isl_ast_expr_op_member>
10614 This operation has two arguments, a structure and the name of
10615 the member of the structure being accessed.
10619 #include <isl/ast.h>
10620 __isl_give isl_id *isl_ast_expr_id_get_id(
10621 __isl_keep isl_ast_expr *expr);
10622 __isl_give isl_id *isl_ast_expr_get_id(
10623 __isl_keep isl_ast_expr *expr);
10625 Return the identifier represented by the AST expression.
10626 C<isl_ast_expr_get_id> is an alternative name for
10627 C<isl_ast_expr_id_get_id>.
10629 #include <isl/ast.h>
10630 __isl_give isl_val *isl_ast_expr_int_get_val(
10631 __isl_keep isl_ast_expr *expr);
10632 __isl_give isl_val *isl_ast_expr_get_val(
10633 __isl_keep isl_ast_expr *expr);
10635 Return the integer represented by the AST expression.
10636 C<isl_ast_expr_get_val> is an alternative name for
10637 C<isl_ast_expr_int_get_val>.
10639 =head3 Properties of ASTs
10641 #include <isl/ast.h>
10642 isl_bool isl_ast_expr_is_equal(
10643 __isl_keep isl_ast_expr *expr1,
10644 __isl_keep isl_ast_expr *expr2);
10646 Check if two C<isl_ast_expr>s are equal to each other.
10648 =head3 Manipulating and printing the AST
10650 AST nodes can be copied and freed using the following functions.
10652 #include <isl/ast.h>
10653 __isl_give isl_ast_node *isl_ast_node_copy(
10654 __isl_keep isl_ast_node *node);
10655 __isl_null isl_ast_node *isl_ast_node_free(
10656 __isl_take isl_ast_node *node);
10658 AST expressions can be copied and freed using the following functions.
10660 #include <isl/ast.h>
10661 __isl_give isl_ast_expr *isl_ast_expr_copy(
10662 __isl_keep isl_ast_expr *expr);
10663 __isl_null isl_ast_expr *isl_ast_expr_free(
10664 __isl_take isl_ast_expr *expr);
10666 New AST expressions can be created either directly or within
10667 the context of an C<isl_ast_build>.
10669 #include <isl/ast.h>
10670 __isl_give isl_ast_expr *isl_ast_expr_from_val(
10671 __isl_take isl_val *v);
10672 __isl_give isl_ast_expr *isl_ast_expr_from_id(
10673 __isl_take isl_id *id);
10674 __isl_give isl_ast_expr *isl_ast_expr_neg(
10675 __isl_take isl_ast_expr *expr);
10676 __isl_give isl_ast_expr *isl_ast_expr_address_of(
10677 __isl_take isl_ast_expr *expr);
10678 __isl_give isl_ast_expr *isl_ast_expr_add(
10679 __isl_take isl_ast_expr *expr1,
10680 __isl_take isl_ast_expr *expr2);
10681 __isl_give isl_ast_expr *isl_ast_expr_sub(
10682 __isl_take isl_ast_expr *expr1,
10683 __isl_take isl_ast_expr *expr2);
10684 __isl_give isl_ast_expr *isl_ast_expr_mul(
10685 __isl_take isl_ast_expr *expr1,
10686 __isl_take isl_ast_expr *expr2);
10687 __isl_give isl_ast_expr *isl_ast_expr_div(
10688 __isl_take isl_ast_expr *expr1,
10689 __isl_take isl_ast_expr *expr2);
10690 __isl_give isl_ast_expr *isl_ast_expr_pdiv_q(
10691 __isl_take isl_ast_expr *expr1,
10692 __isl_take isl_ast_expr *expr2);
10693 __isl_give isl_ast_expr *isl_ast_expr_pdiv_r(
10694 __isl_take isl_ast_expr *expr1,
10695 __isl_take isl_ast_expr *expr2);
10696 __isl_give isl_ast_expr *isl_ast_expr_and(
10697 __isl_take isl_ast_expr *expr1,
10698 __isl_take isl_ast_expr *expr2)
10699 __isl_give isl_ast_expr *isl_ast_expr_and_then(
10700 __isl_take isl_ast_expr *expr1,
10701 __isl_take isl_ast_expr *expr2)
10702 __isl_give isl_ast_expr *isl_ast_expr_or(
10703 __isl_take isl_ast_expr *expr1,
10704 __isl_take isl_ast_expr *expr2)
10705 __isl_give isl_ast_expr *isl_ast_expr_or_else(
10706 __isl_take isl_ast_expr *expr1,
10707 __isl_take isl_ast_expr *expr2)
10708 __isl_give isl_ast_expr *isl_ast_expr_eq(
10709 __isl_take isl_ast_expr *expr1,
10710 __isl_take isl_ast_expr *expr2);
10711 __isl_give isl_ast_expr *isl_ast_expr_le(
10712 __isl_take isl_ast_expr *expr1,
10713 __isl_take isl_ast_expr *expr2);
10714 __isl_give isl_ast_expr *isl_ast_expr_lt(
10715 __isl_take isl_ast_expr *expr1,
10716 __isl_take isl_ast_expr *expr2);
10717 __isl_give isl_ast_expr *isl_ast_expr_ge(
10718 __isl_take isl_ast_expr *expr1,
10719 __isl_take isl_ast_expr *expr2);
10720 __isl_give isl_ast_expr *isl_ast_expr_gt(
10721 __isl_take isl_ast_expr *expr1,
10722 __isl_take isl_ast_expr *expr2);
10723 __isl_give isl_ast_expr *isl_ast_expr_access(
10724 __isl_take isl_ast_expr *array,
10725 __isl_take isl_ast_expr_list *indices);
10726 __isl_give isl_ast_expr *isl_ast_expr_call(
10727 __isl_take isl_ast_expr *function,
10728 __isl_take isl_ast_expr_list *arguments);
10730 The function C<isl_ast_expr_address_of> can be applied to an
10731 C<isl_ast_expr> of type C<isl_ast_expr_op_access> only. It is meant
10732 to represent the address of the C<isl_ast_expr_access>.
10733 The second argument of the functions C<isl_ast_expr_pdiv_q> and
10734 C<isl_ast_expr_pdiv_r> should always evaluate to a positive number.
10736 C<isl_ast_expr_and_then> as well as C<isl_ast_expr_or_else> are short-circuit
10737 versions of C<isl_ast_expr_and> and C<isl_ast_expr_or>, respectively.
10739 #include <isl/ast_build.h>
10740 __isl_give isl_ast_expr *isl_ast_build_expr_from_set(
10741 __isl_keep isl_ast_build *build,
10742 __isl_take isl_set *set);
10743 __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
10744 __isl_keep isl_ast_build *build,
10745 __isl_take isl_pw_aff *pa);
10746 __isl_give isl_ast_expr *
10747 isl_ast_build_access_from_pw_multi_aff(
10748 __isl_keep isl_ast_build *build,
10749 __isl_take isl_pw_multi_aff *pma);
10750 __isl_give isl_ast_expr *
10751 isl_ast_build_access_from_multi_pw_aff(
10752 __isl_keep isl_ast_build *build,
10753 __isl_take isl_multi_pw_aff *mpa);
10754 __isl_give isl_ast_expr *
10755 isl_ast_build_call_from_pw_multi_aff(
10756 __isl_keep isl_ast_build *build,
10757 __isl_take isl_pw_multi_aff *pma);
10758 __isl_give isl_ast_expr *
10759 isl_ast_build_call_from_multi_pw_aff(
10760 __isl_keep isl_ast_build *build,
10761 __isl_take isl_multi_pw_aff *mpa);
10764 the domains of C<pa>, C<mpa> and C<pma> should correspond
10765 to the schedule space of C<build>.
10766 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
10767 the function being called.
10768 If the accessed space is a nested relation, then it is taken
10769 to represent an access of the member specified by the range
10770 of this nested relation of the structure specified by the domain
10771 of the nested relation.
10773 The following functions can be used to modify an C<isl_ast_expr>.
10775 #include <isl/ast.h>
10776 __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
10777 __isl_take isl_ast_expr *expr, int pos,
10778 __isl_take isl_ast_expr *arg);
10780 Replace the argument of C<expr> at position C<pos> by C<arg>.
10782 #include <isl/ast.h>
10783 __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
10784 __isl_take isl_ast_expr *expr,
10785 __isl_take isl_id_to_ast_expr *id2expr);
10787 The function C<isl_ast_expr_substitute_ids> replaces the
10788 subexpressions of C<expr> of type C<isl_ast_expr_id>
10789 by the corresponding expression in C<id2expr>, if there is any.
10792 User specified data can be attached to an C<isl_ast_node> and obtained
10793 from the same C<isl_ast_node> using the following functions.
10795 #include <isl/ast.h>
10796 __isl_give isl_ast_node *isl_ast_node_set_annotation(
10797 __isl_take isl_ast_node *node,
10798 __isl_take isl_id *annotation);
10799 __isl_give isl_id *isl_ast_node_get_annotation(
10800 __isl_keep isl_ast_node *node);
10802 Basic printing can be performed using the following functions.
10804 #include <isl/ast.h>
10805 __isl_give isl_printer *isl_printer_print_ast_expr(
10806 __isl_take isl_printer *p,
10807 __isl_keep isl_ast_expr *expr);
10808 __isl_give isl_printer *isl_printer_print_ast_node(
10809 __isl_take isl_printer *p,
10810 __isl_keep isl_ast_node *node);
10811 __isl_give char *isl_ast_expr_to_str(
10812 __isl_keep isl_ast_expr *expr);
10813 __isl_give char *isl_ast_node_to_str(
10814 __isl_keep isl_ast_node *node);
10815 __isl_give char *isl_ast_expr_to_C_str(
10816 __isl_keep isl_ast_expr *expr);
10817 __isl_give char *isl_ast_node_to_C_str(
10818 __isl_keep isl_ast_node *node);
10820 The functions C<isl_ast_expr_to_C_str> and
10821 C<isl_ast_node_to_C_str> are convenience functions
10822 that return a string representation of the input in C format.
10824 More advanced printing can be performed using the following functions.
10826 #include <isl/ast.h>
10827 __isl_give isl_printer *
10828 isl_ast_expr_op_type_set_print_name(
10829 __isl_take isl_printer *p,
10830 enum isl_ast_expr_op_type type,
10831 __isl_keep const char *name);
10832 __isl_give isl_printer *isl_ast_op_type_set_print_name(
10833 __isl_take isl_printer *p,
10834 enum isl_ast_expr_op_type type,
10835 __isl_keep const char *name);
10836 isl_stat isl_options_set_ast_print_macro_once(
10837 isl_ctx *ctx, int val);
10838 int isl_options_get_ast_print_macro_once(isl_ctx *ctx);
10839 __isl_give isl_printer *isl_ast_expr_op_type_print_macro(
10840 enum isl_ast_expr_op_type type,
10841 __isl_take isl_printer *p);
10842 __isl_give isl_printer *isl_ast_op_type_print_macro(
10843 enum isl_ast_expr_op_type type,
10844 __isl_take isl_printer *p);
10845 __isl_give isl_printer *isl_ast_expr_print_macros(
10846 __isl_keep isl_ast_expr *expr,
10847 __isl_take isl_printer *p);
10848 __isl_give isl_printer *isl_ast_node_print_macros(
10849 __isl_keep isl_ast_node *node,
10850 __isl_take isl_printer *p);
10851 __isl_give isl_printer *isl_ast_node_print(
10852 __isl_keep isl_ast_node *node,
10853 __isl_take isl_printer *p,
10854 __isl_take isl_ast_print_options *options);
10855 __isl_give isl_printer *isl_ast_node_for_print(
10856 __isl_keep isl_ast_node *node,
10857 __isl_take isl_printer *p,
10858 __isl_take isl_ast_print_options *options);
10859 __isl_give isl_printer *isl_ast_node_if_print(
10860 __isl_keep isl_ast_node *node,
10861 __isl_take isl_printer *p,
10862 __isl_take isl_ast_print_options *options);
10864 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
10865 C<isl> may print out an AST that makes use of macros such
10866 as C<floord>, C<min> and C<max>.
10867 The names of these macros may be modified by a call
10868 to C<isl_ast_expr_op_type_set_print_name>. The user-specified
10869 names are associated to the printer object.
10870 C<isl_ast_op_type_set_print_name> is an alternative name for
10871 C<isl_ast_expr_op_type_set_print_name>.
10872 C<isl_ast_expr_op_type_print_macro> prints out the macro
10873 corresponding to a specific C<isl_ast_expr_op_type>.
10874 If the print-macro-once option is set, then a given macro definition
10875 is only printed once to any given printer object.
10876 C<isl_ast_op_type_print_macro> is an alternative name for
10877 C<isl_ast_expr_op_type_print_macro>.
10878 C<isl_ast_expr_print_macros> scans the C<isl_ast_expr>
10879 for subexpressions where these macros would be used and prints
10880 out the required macro definitions.
10881 Essentially, C<isl_ast_expr_print_macros> calls
10882 C<isl_ast_expr_foreach_ast_expr_op_type> with
10883 C<isl_ast_expr_op_type_print_macro>
10884 as function argument.
10885 C<isl_ast_node_print_macros> does the same
10886 for expressions in its C<isl_ast_node> argument.
10887 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
10888 C<isl_ast_node_if_print> print an C<isl_ast_node>
10889 in C<ISL_FORMAT_C>, but allow for some extra control
10890 through an C<isl_ast_print_options> object.
10891 This object can be created using the following functions.
10893 #include <isl/ast.h>
10894 __isl_give isl_ast_print_options *
10895 isl_ast_print_options_alloc(isl_ctx *ctx);
10896 __isl_give isl_ast_print_options *
10897 isl_ast_print_options_copy(
10898 __isl_keep isl_ast_print_options *options);
10899 __isl_null isl_ast_print_options *
10900 isl_ast_print_options_free(
10901 __isl_take isl_ast_print_options *options);
10903 __isl_give isl_ast_print_options *
10904 isl_ast_print_options_set_print_user(
10905 __isl_take isl_ast_print_options *options,
10906 __isl_give isl_printer *(*print_user)(
10907 __isl_take isl_printer *p,
10908 __isl_take isl_ast_print_options *options,
10909 __isl_keep isl_ast_node *node, void *user),
10911 __isl_give isl_ast_print_options *
10912 isl_ast_print_options_set_print_for(
10913 __isl_take isl_ast_print_options *options,
10914 __isl_give isl_printer *(*print_for)(
10915 __isl_take isl_printer *p,
10916 __isl_take isl_ast_print_options *options,
10917 __isl_keep isl_ast_node *node, void *user),
10920 The callback set by C<isl_ast_print_options_set_print_user>
10921 is called whenever a node of type C<isl_ast_node_user> needs to
10923 The callback set by C<isl_ast_print_options_set_print_for>
10924 is called whenever a node of type C<isl_ast_node_for> needs to
10926 Note that C<isl_ast_node_for_print> will I<not> call the
10927 callback set by C<isl_ast_print_options_set_print_for> on the node
10928 on which C<isl_ast_node_for_print> is called, but only on nested
10929 nodes of type C<isl_ast_node_for>. It is therefore safe to
10930 call C<isl_ast_node_for_print> from within the callback set by
10931 C<isl_ast_print_options_set_print_for>.
10933 The following option determines the type to be used for iterators
10934 while printing the AST.
10936 isl_stat isl_options_set_ast_iterator_type(
10937 isl_ctx *ctx, const char *val);
10938 const char *isl_options_get_ast_iterator_type(
10941 The AST printer only prints body nodes as blocks if these
10942 blocks cannot be safely omitted.
10943 For example, a C<for> node with one body node will not be
10944 surrounded with braces in C<ISL_FORMAT_C>.
10945 A block will always be printed by setting the following option.
10947 isl_stat isl_options_set_ast_always_print_block(isl_ctx *ctx,
10949 int isl_options_get_ast_always_print_block(isl_ctx *ctx);
10953 #include <isl/ast_build.h>
10954 isl_stat isl_options_set_ast_build_atomic_upper_bound(
10955 isl_ctx *ctx, int val);
10956 int isl_options_get_ast_build_atomic_upper_bound(
10958 isl_stat isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
10960 int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
10961 isl_stat isl_options_set_ast_build_detect_min_max(
10962 isl_ctx *ctx, int val);
10963 int isl_options_get_ast_build_detect_min_max(
10965 isl_stat isl_options_set_ast_build_exploit_nested_bounds(
10966 isl_ctx *ctx, int val);
10967 int isl_options_get_ast_build_exploit_nested_bounds(
10969 isl_stat isl_options_set_ast_build_group_coscheduled(
10970 isl_ctx *ctx, int val);
10971 int isl_options_get_ast_build_group_coscheduled(
10973 isl_stat isl_options_set_ast_build_separation_bounds(
10974 isl_ctx *ctx, int val);
10975 int isl_options_get_ast_build_separation_bounds(
10977 isl_stat isl_options_set_ast_build_scale_strides(
10978 isl_ctx *ctx, int val);
10979 int isl_options_get_ast_build_scale_strides(
10981 isl_stat isl_options_set_ast_build_allow_else(isl_ctx *ctx,
10983 int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
10984 isl_stat isl_options_set_ast_build_allow_or(isl_ctx *ctx,
10986 int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
10990 =item * ast_build_atomic_upper_bound
10992 Generate loop upper bounds that consist of the current loop iterator,
10993 an operator and an expression not involving the iterator.
10994 If this option is not set, then the current loop iterator may appear
10995 several times in the upper bound.
10996 For example, when this option is turned off, AST generation
10999 [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
11003 for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
11006 When the option is turned on, the following AST is generated
11008 for (int c0 = 0; c0 <= min(100, n); c0 += 1)
11011 =item * ast_build_prefer_pdiv
11013 If this option is turned off, then the AST generation will
11014 produce ASTs that may only contain C<isl_ast_expr_op_fdiv_q>
11015 operators, but no C<isl_ast_expr_op_pdiv_q> or
11016 C<isl_ast_expr_op_pdiv_r> operators.
11017 If this option is turned on, then C<isl> will try to convert
11018 some of the C<isl_ast_expr_op_fdiv_q> operators to (expressions containing)
11019 C<isl_ast_expr_op_pdiv_q> or C<isl_ast_expr_op_pdiv_r> operators.
11021 =item * ast_build_detect_min_max
11023 If this option is turned on, then C<isl> will try and detect
11024 min or max-expressions when building AST expressions from
11025 piecewise affine expressions.
11027 =item * ast_build_exploit_nested_bounds
11029 Simplify conditions based on bounds of nested for loops.
11030 In particular, remove conditions that are implied by the fact
11031 that one or more nested loops have at least one iteration,
11032 meaning that the upper bound is at least as large as the lower bound.
11033 For example, when this option is turned off, AST generation
11036 [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
11042 for (int c0 = 0; c0 <= N; c0 += 1)
11043 for (int c1 = 0; c1 <= M; c1 += 1)
11046 When the option is turned on, the following AST is generated
11048 for (int c0 = 0; c0 <= N; c0 += 1)
11049 for (int c1 = 0; c1 <= M; c1 += 1)
11052 =item * ast_build_group_coscheduled
11054 If two domain elements are assigned the same schedule point, then
11055 they may be executed in any order and they may even appear in different
11056 loops. If this options is set, then the AST generator will make
11057 sure that coscheduled domain elements do not appear in separate parts
11058 of the AST. This is useful in case of nested AST generation
11059 if the outer AST generation is given only part of a schedule
11060 and the inner AST generation should handle the domains that are
11061 coscheduled by this initial part of the schedule together.
11062 For example if an AST is generated for a schedule
11064 { A[i] -> [0]; B[i] -> [0] }
11066 then the C<isl_ast_build_set_create_leaf> callback described
11067 below may get called twice, once for each domain.
11068 Setting this option ensures that the callback is only called once
11069 on both domains together.
11071 =item * ast_build_separation_bounds
11073 This option specifies which bounds to use during separation.
11074 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
11075 then all (possibly implicit) bounds on the current dimension will
11076 be used during separation.
11077 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
11078 then only those bounds that are explicitly available will
11079 be used during separation.
11081 =item * ast_build_scale_strides
11083 This option specifies whether the AST generator is allowed
11084 to scale down iterators of strided loops.
11086 =item * ast_build_allow_else
11088 This option specifies whether the AST generator is allowed
11089 to construct if statements with else branches.
11091 =item * ast_build_allow_or
11093 This option specifies whether the AST generator is allowed
11094 to construct if conditions with disjunctions.
11098 =head3 AST Generation Options (Schedule Tree)
11100 In case of AST construction from a schedule tree, the options
11101 that control how an AST is created from the individual schedule
11102 dimensions are stored in the band nodes of the tree
11103 (see L</"Schedule Trees">).
11105 In particular, a schedule dimension can be handled in four
11106 different ways, atomic, separate, unroll or the default.
11107 This loop AST generation type can be set using
11108 C<isl_schedule_node_band_member_set_ast_loop_type>.
11110 the first three can be selected by including a one-dimensional
11111 element with as value the position of the schedule dimension
11112 within the band and as name one of C<atomic>, C<separate>
11113 or C<unroll> in the options
11114 set by C<isl_schedule_node_band_set_ast_build_options>.
11115 Only one of these three may be specified for
11116 any given schedule dimension within a band node.
11117 If none of these is specified, then the default
11118 is used. The meaning of the options is as follows.
11124 When this option is specified, the AST generator will make
11125 sure that a given domains space only appears in a single
11126 loop at the specified level.
11128 For example, for the schedule tree
11130 domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
11132 schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
11133 options: "{ atomic[x] }"
11135 the following AST will be generated
11137 for (int c0 = 0; c0 <= 10; c0 += 1) {
11144 On the other hand, for the schedule tree
11146 domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
11148 schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
11149 options: "{ separate[x] }"
11151 the following AST will be generated
11155 for (int c0 = 1; c0 <= 9; c0 += 1) {
11162 If neither C<atomic> nor C<separate> is specified, then the AST generator
11163 may produce either of these two results or some intermediate form.
11167 When this option is specified, the AST generator will
11168 split the domain of the specified schedule dimension
11169 into pieces with a fixed set of statements for which
11170 instances need to be executed by the iterations in
11171 the schedule domain part. This option tends to avoid
11172 the generation of guards inside the corresponding loops.
11173 See also the C<atomic> option.
11177 When this option is specified, the AST generator will
11178 I<completely> unroll the corresponding schedule dimension.
11179 It is the responsibility of the user to ensure that such
11180 unrolling is possible.
11181 To obtain a partial unrolling, the user should apply an additional
11182 strip-mining to the schedule and fully unroll the inner schedule
11187 The C<isolate> option is a bit more involved. It allows the user
11188 to isolate a range of schedule dimension values from smaller and
11189 greater values. Additionally, the user may specify a different
11190 atomic/separate/unroll choice for the isolated part and the remaining
11191 parts. The typical use case of the C<isolate> option is to isolate
11192 full tiles from partial tiles.
11193 The part that needs to be isolated may depend on outer schedule dimensions.
11194 The option therefore needs to be able to reference those outer schedule
11195 dimensions. In particular, the space of the C<isolate> option is that
11196 of a wrapped map with as domain the flat product of all outer band nodes
11197 and as range the space of the current band node.
11198 The atomic/separate/unroll choice for the isolated part is determined
11199 by an option that lives in an unnamed wrapped space with as domain
11200 a zero-dimensional C<isolate> space and as range the regular
11201 C<atomic>, C<separate> or C<unroll> space.
11202 This option may also be set directly using
11203 C<isl_schedule_node_band_member_set_isolate_ast_loop_type>.
11204 The atomic/separate/unroll choice for the remaining part is determined
11205 by the regular C<atomic>, C<separate> or C<unroll> option.
11206 Since the C<isolate> option references outer schedule dimensions,
11207 its use in a band node causes any tree containing the node
11208 to be considered anchored.
11210 As an example, consider the isolation of full tiles from partial tiles
11211 in a tiling of a triangular domain. The original schedule is as follows.
11213 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
11215 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
11216 { A[i,j] -> [floor(j/10)] }, \
11217 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
11221 for (int c0 = 0; c0 <= 10; c0 += 1)
11222 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
11223 for (int c2 = 10 * c0;
11224 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
11225 for (int c3 = 10 * c1;
11226 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
11229 Isolating the full tiles, we have the following input
11231 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
11233 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
11234 { A[i,j] -> [floor(j/10)] }, \
11235 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
11236 options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
11237 10a+9+10b+9 <= 100 }"
11242 for (int c0 = 0; c0 <= 8; c0 += 1) {
11243 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
11244 for (int c2 = 10 * c0;
11245 c2 <= 10 * c0 + 9; c2 += 1)
11246 for (int c3 = 10 * c1;
11247 c3 <= 10 * c1 + 9; c3 += 1)
11249 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
11250 for (int c2 = 10 * c0;
11251 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
11252 for (int c3 = 10 * c1;
11253 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
11256 for (int c0 = 9; c0 <= 10; c0 += 1)
11257 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
11258 for (int c2 = 10 * c0;
11259 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
11260 for (int c3 = 10 * c1;
11261 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
11265 We may then additionally unroll the innermost loop of the isolated part
11267 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
11269 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
11270 { A[i,j] -> [floor(j/10)] }, \
11271 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
11272 options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
11273 10a+9+10b+9 <= 100; [isolate[] -> unroll[3]] }"
11278 for (int c0 = 0; c0 <= 8; c0 += 1) {
11279 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
11280 for (int c2 = 10 * c0; c2 <= 10 * c0 + 9; c2 += 1) {
11282 A(c2, 10 * c1 + 1);
11283 A(c2, 10 * c1 + 2);
11284 A(c2, 10 * c1 + 3);
11285 A(c2, 10 * c1 + 4);
11286 A(c2, 10 * c1 + 5);
11287 A(c2, 10 * c1 + 6);
11288 A(c2, 10 * c1 + 7);
11289 A(c2, 10 * c1 + 8);
11290 A(c2, 10 * c1 + 9);
11292 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
11293 for (int c2 = 10 * c0;
11294 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
11295 for (int c3 = 10 * c1;
11296 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
11299 for (int c0 = 9; c0 <= 10; c0 += 1)
11300 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
11301 for (int c2 = 10 * c0;
11302 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
11303 for (int c3 = 10 * c1;
11304 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
11309 =head3 AST Generation Options (Schedule Map)
11311 In case of AST construction using
11312 C<isl_ast_build_node_from_schedule_map>, the options
11313 that control how an AST is created from the individual schedule
11314 dimensions are stored in the C<isl_ast_build>.
11315 They can be set using the following function.
11317 #include <isl/ast_build.h>
11318 __isl_give isl_ast_build *
11319 isl_ast_build_set_options(
11320 __isl_take isl_ast_build *build,
11321 __isl_take isl_union_map *options);
11323 The options are encoded in an C<isl_union_map>.
11324 The domain of this union relation refers to the schedule domain,
11325 i.e., the range of the schedule passed
11326 to C<isl_ast_build_node_from_schedule_map>.
11327 In the case of nested AST generation (see L</"Nested AST Generation">),
11328 the domain of C<options> should refer to the extra piece of the schedule.
11329 That is, it should be equal to the range of the wrapped relation in the
11330 range of the schedule.
11331 The range of the options can consist of elements in one or more spaces,
11332 the names of which determine the effect of the option.
11333 The values of the range typically also refer to the schedule dimension
11334 to which the option applies, with value C<0> representing
11335 the outermost schedule dimension. In case of nested AST generation
11336 (see L</"Nested AST Generation">), these values refer to the position
11337 of the schedule dimension within the innermost AST generation.
11338 The constraints on the domain elements of
11339 the option should only refer to this dimension and earlier dimensions.
11340 We consider the following spaces.
11344 =item C<separation_class>
11346 B<This option has been deprecated. Use the isolate option on
11347 schedule trees instead.>
11349 This space is a wrapped relation between two one dimensional spaces.
11350 The input space represents the schedule dimension to which the option
11351 applies and the output space represents the separation class.
11352 While constructing a loop corresponding to the specified schedule
11353 dimension(s), the AST generator will try to generate separate loops
11354 for domain elements that are assigned different classes.
11355 If only some of the elements are assigned a class, then those elements
11356 that are not assigned any class will be treated as belonging to a class
11357 that is separate from the explicitly assigned classes.
11358 The typical use case for this option is to separate full tiles from
11360 The other options, described below, are applied after the separation
11363 As an example, consider the separation into full and partial tiles
11364 of a tiling of a triangular domain.
11365 Take, for example, the domain
11367 { A[i,j] : 0 <= i,j and i + j <= 100 }
11369 and a tiling into tiles of 10 by 10. The input to the AST generator
11370 is then the schedule
11372 { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
11375 Without any options, the following AST is generated
11377 for (int c0 = 0; c0 <= 10; c0 += 1)
11378 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
11379 for (int c2 = 10 * c0;
11380 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
11382 for (int c3 = 10 * c1;
11383 c3 <= min(10 * c1 + 9, -c2 + 100);
11387 Separation into full and partial tiles can be obtained by assigning
11388 a class, say C<0>, to the full tiles. The full tiles are represented by those
11389 values of the first and second schedule dimensions for which there are
11390 values of the third and fourth dimensions to cover an entire tile.
11391 That is, we need to specify the following option
11393 { [a,b,c,d] -> separation_class[[0]->[0]] :
11394 exists b': 0 <= 10a,10b' and
11395 10a+9+10b'+9 <= 100;
11396 [a,b,c,d] -> separation_class[[1]->[0]] :
11397 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
11399 which simplifies to
11401 { [a, b, c, d] -> separation_class[[1] -> [0]] :
11402 a >= 0 and b >= 0 and b <= 8 - a;
11403 [a, b, c, d] -> separation_class[[0] -> [0]] :
11404 a >= 0 and a <= 8 }
11406 With this option, the generated AST is as follows
11409 for (int c0 = 0; c0 <= 8; c0 += 1) {
11410 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
11411 for (int c2 = 10 * c0;
11412 c2 <= 10 * c0 + 9; c2 += 1)
11413 for (int c3 = 10 * c1;
11414 c3 <= 10 * c1 + 9; c3 += 1)
11416 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
11417 for (int c2 = 10 * c0;
11418 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
11420 for (int c3 = 10 * c1;
11421 c3 <= min(-c2 + 100, 10 * c1 + 9);
11425 for (int c0 = 9; c0 <= 10; c0 += 1)
11426 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
11427 for (int c2 = 10 * c0;
11428 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
11430 for (int c3 = 10 * c1;
11431 c3 <= min(10 * c1 + 9, -c2 + 100);
11438 This is a single-dimensional space representing the schedule dimension(s)
11439 to which ``separation'' should be applied. Separation tries to split
11440 a loop into several pieces if this can avoid the generation of guards
11442 See also the C<atomic> option.
11446 This is a single-dimensional space representing the schedule dimension(s)
11447 for which the domains should be considered ``atomic''. That is, the
11448 AST generator will make sure that any given domain space will only appear
11449 in a single loop at the specified level.
11451 Consider the following schedule
11453 { a[i] -> [i] : 0 <= i < 10;
11454 b[i] -> [i+1] : 0 <= i < 10 }
11456 If the following option is specified
11458 { [i] -> separate[x] }
11460 then the following AST will be generated
11464 for (int c0 = 1; c0 <= 9; c0 += 1) {
11471 If, on the other hand, the following option is specified
11473 { [i] -> atomic[x] }
11475 then the following AST will be generated
11477 for (int c0 = 0; c0 <= 10; c0 += 1) {
11484 If neither C<atomic> nor C<separate> is specified, then the AST generator
11485 may produce either of these two results or some intermediate form.
11489 This is a single-dimensional space representing the schedule dimension(s)
11490 that should be I<completely> unrolled.
11491 To obtain a partial unrolling, the user should apply an additional
11492 strip-mining to the schedule and fully unroll the inner loop.
11496 =head3 Fine-grained Control over AST Generation
11498 Besides specifying the constraints on the parameters,
11499 an C<isl_ast_build> object can be used to control
11500 various aspects of the AST generation process.
11501 In case of AST construction using
11502 C<isl_ast_build_node_from_schedule_map>,
11503 the most prominent way of control is through ``options'',
11504 as explained above.
11506 Additional control is available through the following functions.
11508 #include <isl/ast_build.h>
11509 __isl_give isl_ast_build *
11510 isl_ast_build_set_iterators(
11511 __isl_take isl_ast_build *build,
11512 __isl_take isl_id_list *iterators);
11514 The function C<isl_ast_build_set_iterators> allows the user to
11515 specify a list of iterator C<isl_id>s to be used as iterators.
11516 If the input schedule is injective, then
11517 the number of elements in this list should be as large as the dimension
11518 of the schedule space, but no direct correspondence should be assumed
11519 between dimensions and elements.
11520 If the input schedule is not injective, then an additional number
11521 of C<isl_id>s equal to the largest dimension of the input domains
11523 If the number of provided C<isl_id>s is insufficient, then additional
11524 names are automatically generated.
11526 #include <isl/ast_build.h>
11527 __isl_give isl_ast_build *
11528 isl_ast_build_set_create_leaf(
11529 __isl_take isl_ast_build *build,
11530 __isl_give isl_ast_node *(*fn)(
11531 __isl_take isl_ast_build *build,
11532 void *user), void *user);
11535 C<isl_ast_build_set_create_leaf> function allows for the
11536 specification of a callback that should be called whenever the AST
11537 generator arrives at an element of the schedule domain.
11538 The callback should return an AST node that should be inserted
11539 at the corresponding position of the AST. The default action (when
11540 the callback is not set) is to continue generating parts of the AST to scan
11541 all the domain elements associated to the schedule domain element
11542 and to insert user nodes, ``calling'' the domain element, for each of them.
11543 The C<build> argument contains the current state of the C<isl_ast_build>.
11544 To ease nested AST generation (see L</"Nested AST Generation">),
11545 all control information that is
11546 specific to the current AST generation such as the options and
11547 the callbacks has been removed from this C<isl_ast_build>.
11548 The callback would typically return the result of a nested
11549 AST generation or a
11550 user defined node created using the following function.
11552 #include <isl/ast.h>
11553 __isl_give isl_ast_node *isl_ast_node_alloc_user(
11554 __isl_take isl_ast_expr *expr);
11556 #include <isl/ast_build.h>
11557 __isl_give isl_ast_build *
11558 isl_ast_build_set_at_each_domain(
11559 __isl_take isl_ast_build *build,
11560 __isl_give isl_ast_node *(*fn)(
11561 __isl_take isl_ast_node *node,
11562 __isl_keep isl_ast_build *build,
11563 void *user), void *user);
11564 __isl_give isl_ast_build *
11565 isl_ast_build_set_before_each_for(
11566 __isl_take isl_ast_build *build,
11567 __isl_give isl_id *(*fn)(
11568 __isl_keep isl_ast_build *build,
11569 void *user), void *user);
11570 __isl_give isl_ast_build *
11571 isl_ast_build_set_after_each_for(
11572 __isl_take isl_ast_build *build,
11573 __isl_give isl_ast_node *(*fn)(
11574 __isl_take isl_ast_node *node,
11575 __isl_keep isl_ast_build *build,
11576 void *user), void *user);
11577 __isl_give isl_ast_build *
11578 isl_ast_build_set_before_each_mark(
11579 __isl_take isl_ast_build *build,
11580 isl_stat (*fn)(__isl_keep isl_id *mark,
11581 __isl_keep isl_ast_build *build,
11582 void *user), void *user);
11583 __isl_give isl_ast_build *
11584 isl_ast_build_set_after_each_mark(
11585 __isl_take isl_ast_build *build,
11586 __isl_give isl_ast_node *(*fn)(
11587 __isl_take isl_ast_node *node,
11588 __isl_keep isl_ast_build *build,
11589 void *user), void *user);
11591 The callback set by C<isl_ast_build_set_at_each_domain> will
11592 be called for each domain AST node.
11593 The callbacks set by C<isl_ast_build_set_before_each_for>
11594 and C<isl_ast_build_set_after_each_for> will be called
11595 for each for AST node. The first will be called in depth-first
11596 pre-order, while the second will be called in depth-first post-order.
11597 Since C<isl_ast_build_set_before_each_for> is called before the for
11598 node is actually constructed, it is only passed an C<isl_ast_build>.
11599 The returned C<isl_id> will be added as an annotation (using
11600 C<isl_ast_node_set_annotation>) to the constructed for node.
11601 In particular, if the user has also specified an C<after_each_for>
11602 callback, then the annotation can be retrieved from the node passed to
11603 that callback using C<isl_ast_node_get_annotation>.
11604 The callbacks set by C<isl_ast_build_set_before_each_mark>
11605 and C<isl_ast_build_set_after_each_mark> will be called for each
11606 mark AST node that is created, i.e., for each mark schedule node
11607 in the input schedule tree. The first will be called in depth-first
11608 pre-order, while the second will be called in depth-first post-order.
11609 Since the callback set by C<isl_ast_build_set_before_each_mark>
11610 is called before the mark AST node is actually constructed, it is passed
11611 the identifier of the mark node.
11612 All callbacks should C<NULL> (or C<isl_stat_error>) on failure.
11613 The given C<isl_ast_build> can be used to create new
11614 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
11615 or C<isl_ast_build_call_from_pw_multi_aff>.
11617 =head3 Nested AST Generation
11619 C<isl> allows the user to create an AST within the context
11620 of another AST. These nested ASTs are created using the
11621 same C<isl_ast_build_node_from_schedule_map> function that is used to create
11622 the outer AST. The C<build> argument should be an C<isl_ast_build>
11623 passed to a callback set by
11624 C<isl_ast_build_set_create_leaf>.
11625 The space of the range of the C<schedule> argument should refer
11626 to this build. In particular, the space should be a wrapped
11627 relation and the domain of this wrapped relation should be the
11628 same as that of the range of the schedule returned by
11629 C<isl_ast_build_get_schedule> below.
11630 In practice, the new schedule is typically
11631 created by calling C<isl_union_map_range_product> on the old schedule
11632 and some extra piece of the schedule.
11633 The space of the schedule domain is also available from
11634 the C<isl_ast_build>.
11636 #include <isl/ast_build.h>
11637 __isl_give isl_union_map *isl_ast_build_get_schedule(
11638 __isl_keep isl_ast_build *build);
11639 __isl_give isl_space *isl_ast_build_get_schedule_space(
11640 __isl_keep isl_ast_build *build);
11641 __isl_give isl_ast_build *isl_ast_build_restrict(
11642 __isl_take isl_ast_build *build,
11643 __isl_take isl_set *set);
11645 The C<isl_ast_build_get_schedule> function returns a (partial)
11646 schedule for the domains elements for which part of the AST still needs to
11647 be generated in the current build.
11648 In particular, the domain elements are mapped to those iterations of the loops
11649 enclosing the current point of the AST generation inside which
11650 the domain elements are executed.
11651 No direct correspondence between
11652 the input schedule and this schedule should be assumed.
11653 The space obtained from C<isl_ast_build_get_schedule_space> can be used
11654 to create a set for C<isl_ast_build_restrict> to intersect
11655 with the current build. In particular, the set passed to
11656 C<isl_ast_build_restrict> can have additional parameters.
11657 The ids of the set dimensions in the space returned by
11658 C<isl_ast_build_get_schedule_space> correspond to the
11659 iterators of the already generated loops.
11660 The user should not rely on the ids of the output dimensions
11661 of the relations in the union relation returned by
11662 C<isl_ast_build_get_schedule> having any particular value.
11664 =head1 Applications
11666 Although C<isl> is mainly meant to be used as a library,
11667 it also contains some basic applications that use some
11668 of the functionality of C<isl>.
11669 For applications that take one or more polytopes or polyhedra
11670 as input, this input may be specified in either the L<isl format>
11671 or the L<PolyLib format>.
11673 =head2 C<isl_polyhedron_sample>
11675 C<isl_polyhedron_sample> takes a polyhedron as input and prints
11676 an integer element of the polyhedron, if there is any.
11677 The first column in the output is the denominator and is always
11678 equal to 1. If the polyhedron contains no integer points,
11679 then a vector of length zero is printed.
11683 C<isl_pip> takes the same input as the C<example> program
11684 from the C<piplib> distribution, i.e., a set of constraints
11685 on the parameters, a line containing only -1 and finally a set
11686 of constraints on a parametric polyhedron.
11687 The coefficients of the parameters appear in the last columns
11688 (but before the final constant column).
11689 The output is the lexicographic minimum of the parametric polyhedron.
11690 As C<isl> currently does not have its own output format, the output
11691 is just a dump of the internal state.
11693 =head2 C<isl_polyhedron_minimize>
11695 C<isl_polyhedron_minimize> computes the minimum of some linear
11696 or affine objective function over the integer points in a polyhedron.
11697 If an affine objective function
11698 is given, then the constant should appear in the last column.
11700 =head2 C<isl_polytope_scan>
11702 Given a polytope, C<isl_polytope_scan> prints
11703 all integer points in the polytope.
11707 Given an C<isl_union_access_info> object as input,
11708 C<isl_flow> prints out the corresponding dependences,
11709 as computed by C<isl_union_access_info_compute_flow>.
11711 =head2 C<isl_codegen>
11713 Given either a schedule tree or a sequence consisting of
11714 a schedule map, a context set and an options relation,
11715 C<isl_codegen> prints out an AST that scans the domain elements
11716 of the schedule in the order of their image(s) taking into account
11717 the constraints in the context set.
11719 =head2 C<isl_schedule>
11721 Given an C<isl_schedule_constraints> object as input,
11722 C<isl_schedule> prints out a schedule that satisfies the given