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