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