343
343
isl_ctx *isl_ctx_alloc();
344
344
void isl_ctx_free(isl_ctx *ctx);
348
All operations on integers, mainly the coefficients
349
of the constraints describing the sets and relations,
350
are performed in exact integer arithmetic using C<GMP>.
351
However, to allow future versions of C<isl> to optionally
352
support fixed integer arithmetic, all calls to C<GMP>
353
are wrapped inside C<isl> specific macros.
354
The basic type is C<isl_int> and the operations below
355
are available on this type.
348
An C<isl_val> represents an integer value, a rational value
349
or one of three special values, infinity, negative infinity and NaN.
350
Some predefined values can be created using the following functions.
353
__isl_give isl_val *isl_val_zero(isl_ctx *ctx);
354
__isl_give isl_val *isl_val_one(isl_ctx *ctx);
355
__isl_give isl_val *isl_val_nan(isl_ctx *ctx);
356
__isl_give isl_val *isl_val_infty(isl_ctx *ctx);
357
__isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
359
Specific integer values can be created using the following functions.
362
__isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
364
__isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
366
__isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
367
size_t n, size_t size, const void *chunks);
369
The function C<isl_val_int_from_chunks> constructs an C<isl_val>
370
from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
371
The least significant digit is assumed to be stored first.
373
Value objects can be copied and freed using the following functions.
376
__isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
377
void *isl_val_free(__isl_take isl_val *v);
379
They can be inspected using the following functions.
382
isl_ctx *isl_val_get_ctx(__isl_keep isl_val *val);
383
long isl_val_get_num_si(__isl_keep isl_val *v);
384
long isl_val_get_den_si(__isl_keep isl_val *v);
385
double isl_val_get_d(__isl_keep isl_val *v);
386
size_t isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
388
int isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
389
size_t size, void *chunks);
391
C<isl_val_n_abs_num_chunks> returns the number of I<digits>
392
of C<size> bytes needed to store the absolute value of the
394
C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
395
which is assumed to have been preallocated by the caller.
396
The least significant digit is stored first.
397
Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
398
C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
399
and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
401
An C<isl_val> can be modified using the following function.
404
__isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
407
The following unary properties are defined on C<isl_val>s.
410
int isl_val_sgn(__isl_keep isl_val *v);
411
int isl_val_is_zero(__isl_keep isl_val *v);
412
int isl_val_is_one(__isl_keep isl_val *v);
413
int isl_val_is_negone(__isl_keep isl_val *v);
414
int isl_val_is_nonneg(__isl_keep isl_val *v);
415
int isl_val_is_nonpos(__isl_keep isl_val *v);
416
int isl_val_is_pos(__isl_keep isl_val *v);
417
int isl_val_is_neg(__isl_keep isl_val *v);
418
int isl_val_is_int(__isl_keep isl_val *v);
419
int isl_val_is_rat(__isl_keep isl_val *v);
420
int isl_val_is_nan(__isl_keep isl_val *v);
421
int isl_val_is_infty(__isl_keep isl_val *v);
422
int isl_val_is_neginfty(__isl_keep isl_val *v);
424
Note that the sign of NaN is undefined.
426
The following binary properties are defined on pairs of C<isl_val>s.
429
int isl_val_lt(__isl_keep isl_val *v1,
430
__isl_keep isl_val *v2);
431
int isl_val_le(__isl_keep isl_val *v1,
432
__isl_keep isl_val *v2);
433
int isl_val_gt(__isl_keep isl_val *v1,
434
__isl_keep isl_val *v2);
435
int isl_val_ge(__isl_keep isl_val *v1,
436
__isl_keep isl_val *v2);
437
int isl_val_eq(__isl_keep isl_val *v1,
438
__isl_keep isl_val *v2);
439
int isl_val_ne(__isl_keep isl_val *v1,
440
__isl_keep isl_val *v2);
442
For integer C<isl_val>s we additionally have the following binary property.
445
int isl_val_is_divisible_by(__isl_keep isl_val *v1,
446
__isl_keep isl_val *v2);
448
An C<isl_val> can also be compared to an integer using the following
449
function. The result is undefined for NaN.
452
int isl_val_cmp_si(__isl_keep isl_val *v, long i);
454
The following unary operations are available on C<isl_val>s.
457
__isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
458
__isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
459
__isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
460
__isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
461
__isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
463
The following binary operations are available on C<isl_val>s.
466
__isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
467
__isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
468
__isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
469
__isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
470
__isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
471
__isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
472
__isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
473
__isl_take isl_val *v2);
474
__isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
475
__isl_take isl_val *v2);
476
__isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
477
__isl_take isl_val *v2);
478
__isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
480
__isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
481
__isl_take isl_val *v2);
482
__isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
484
__isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
485
__isl_take isl_val *v2);
486
__isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
488
__isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
489
__isl_take isl_val *v2);
491
On integer values, we additionally have the following operations.
494
__isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
495
__isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
496
__isl_take isl_val *v2);
497
__isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
498
__isl_take isl_val *v2);
499
__isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
500
__isl_take isl_val *v2, __isl_give isl_val **x,
501
__isl_give isl_val **y);
503
The function C<isl_val_gcdext> returns the greatest common divisor g
504
of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
505
that C<*x> * C<v1> + C<*y> * C<v2> = g.
507
A value can be read from input using
510
__isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
513
A value can be printed using
516
__isl_give isl_printer *isl_printer_print_val(
517
__isl_take isl_printer *p, __isl_keep isl_val *v);
519
=head3 GMP specific functions
521
These functions are only available if C<isl> has been compiled with C<GMP>
524
Specific integer and rational values can be created from C<GMP> values using
525
the following functions.
527
#include <isl/val_gmp.h>
528
__isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
530
__isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
531
const mpz_t n, const mpz_t d);
533
The numerator and denominator of a rational value can be extracted as
534
C<GMP> values using the following functions.
536
#include <isl/val_gmp.h>
537
int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
538
int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
540
=head3 Conversion from C<isl_int>
542
The following functions are only temporarily available to ease
543
the transition from C<isl_int> to C<isl_val>. They will be removed
546
#include <isl/val_int.h>
547
__isl_give isl_val *isl_val_int_from_isl_int(isl_ctx *ctx,
549
int isl_val_get_num_isl_int(__isl_keep isl_val *v,
552
=head2 Integers (obsolescent)
554
In previous versions of C<isl>, integers were represented
555
in the external interface using the C<isl_int> type.
556
This type has now been superseded by C<isl_val>.
557
The C<isl_int> type will be removed from the external interface
558
in future releases. New code should not use C<isl_int>.
560
The operations below are currently available on C<isl_int>s.
356
561
The meanings of these operations are essentially the same
357
562
as their C<GMP> C<mpz_> counterparts.
358
563
As always with C<GMP> types, C<isl_int>s need to be
2087
2341
__isl_give isl_basic_set *isl_basic_set_fix_si(
2088
2342
__isl_take isl_basic_set *bset,
2089
2343
enum isl_dim_type type, unsigned pos, int value);
2344
__isl_give isl_basic_set *isl_basic_set_fix_val(
2345
__isl_take isl_basic_set *bset,
2346
enum isl_dim_type type, unsigned pos,
2347
__isl_take isl_val *v);
2090
2348
__isl_give isl_set *isl_set_fix(__isl_take isl_set *set,
2091
2349
enum isl_dim_type type, unsigned pos,
2092
2350
isl_int value);
2093
2351
__isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
2094
2352
enum isl_dim_type type, unsigned pos, int value);
2353
__isl_give isl_set *isl_set_fix_val(
2354
__isl_take isl_set *set,
2355
enum isl_dim_type type, unsigned pos,
2356
__isl_take isl_val *v);
2095
2357
__isl_give isl_basic_map *isl_basic_map_fix_si(
2096
2358
__isl_take isl_basic_map *bmap,
2097
2359
enum isl_dim_type type, unsigned pos, int value);
2360
__isl_give isl_basic_map *isl_basic_map_fix_val(
2361
__isl_take isl_basic_map *bmap,
2362
enum isl_dim_type type, unsigned pos,
2363
__isl_take isl_val *v);
2098
2364
__isl_give isl_map *isl_map_fix(__isl_take isl_map *map,
2099
2365
enum isl_dim_type type, unsigned pos,
2100
2366
isl_int value);
2101
2367
__isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
2102
2368
enum isl_dim_type type, unsigned pos, int value);
2369
__isl_give isl_map *isl_map_fix_val(
2370
__isl_take isl_map *map,
2371
enum isl_dim_type type, unsigned pos,
2372
__isl_take isl_val *v);
2104
2374
Intersect the set or relation with the hyperplane where the given
2105
2375
dimension has the fixed given value.
2371
2658
enum isl_lp_result isl_basic_set_max(
2372
2659
__isl_keep isl_basic_set *bset,
2373
2660
__isl_keep isl_aff *obj, isl_int *opt)
2661
__isl_give isl_val *isl_basic_set_max_val(
2662
__isl_keep isl_basic_set *bset,
2663
__isl_keep isl_aff *obj);
2374
2664
enum isl_lp_result isl_set_min(__isl_keep isl_set *set,
2375
2665
__isl_keep isl_aff *obj, isl_int *opt);
2666
__isl_give isl_val *isl_set_min_val(
2667
__isl_keep isl_set *set,
2668
__isl_keep isl_aff *obj);
2376
2669
enum isl_lp_result isl_set_max(__isl_keep isl_set *set,
2377
2670
__isl_keep isl_aff *obj, isl_int *opt);
2671
__isl_give isl_val *isl_set_max_val(
2672
__isl_keep isl_set *set,
2673
__isl_keep isl_aff *obj);
2379
2675
Compute the minimum or maximum of the integer affine expression C<obj>
2380
2676
over the points in C<set>, returning the result in C<opt>.
2381
2677
The return value may be one of C<isl_lp_error>,
2382
C<isl_lp_ok>, C<isl_lp_unbounded> or C<isl_lp_empty>.
2678
C<isl_lp_ok>, C<isl_lp_unbounded> or C<isl_lp_empty>, in case of
2679
an C<isl_lp_result>. If the result is an C<isl_val> then
2680
the result is C<NULL> in case of an error, the optimal value in case
2681
there is one, negative infinity or infinity if the problem is unbounded and
2682
NaN if the problem is empty.
2384
2684
=item * Parametric optimization
3117
3452
__isl_take isl_printer *p,
3118
3453
__isl_keep isl_set_list *list);
3455
=head2 Multiple Values
3457
An C<isl_multi_val> object represents a sequence of zero or more values,
3458
living in a set space.
3460
An C<isl_multi_val> can be constructed from an C<isl_val_list>
3461
using the following function
3463
#include <isl/val.h>
3464
__isl_give isl_multi_val *isl_multi_val_from_val_list(
3465
__isl_take isl_space *space,
3466
__isl_take isl_val_list *list);
3468
The zero multiple value (with value zero for each set dimension)
3469
can be created using the following function.
3471
#include <isl/val.h>
3472
__isl_give isl_multi_val *isl_multi_val_zero(
3473
__isl_take isl_space *space);
3475
Multiple values can be copied and freed using
3477
#include <isl/val.h>
3478
__isl_give isl_multi_val *isl_multi_val_copy(
3479
__isl_keep isl_multi_val *mv);
3480
void *isl_multi_val_free(__isl_take isl_multi_val *mv);
3482
They can be inspected using
3484
#include <isl/val.h>
3485
isl_ctx *isl_multi_val_get_ctx(
3486
__isl_keep isl_multi_val *mv);
3487
unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
3488
enum isl_dim_type type);
3489
__isl_give isl_val *isl_multi_val_get_val(
3490
__isl_keep isl_multi_val *mv, int pos);
3491
const char *isl_multi_val_get_tuple_name(
3492
__isl_keep isl_multi_val *mv,
3493
enum isl_dim_type type);
3495
They can be modified using
3497
#include <isl/val.h>
3498
__isl_give isl_multi_val *isl_multi_val_set_val(
3499
__isl_take isl_multi_val *mv, int pos,
3500
__isl_take isl_val *val);
3501
__isl_give isl_multi_val *isl_multi_val_set_dim_name(
3502
__isl_take isl_multi_val *mv,
3503
enum isl_dim_type type, unsigned pos, const char *s);
3504
__isl_give isl_multi_val *isl_multi_val_set_tuple_name(
3505
__isl_take isl_multi_val *mv,
3506
enum isl_dim_type type, const char *s);
3507
__isl_give isl_multi_val *isl_multi_val_set_tuple_id(
3508
__isl_take isl_multi_val *mv,
3509
enum isl_dim_type type, __isl_take isl_id *id);
3511
__isl_give isl_multi_val *isl_multi_val_insert_dims(
3512
__isl_take isl_multi_val *mv,
3513
enum isl_dim_type type, unsigned first, unsigned n);
3514
__isl_give isl_multi_val *isl_multi_val_add_dims(
3515
__isl_take isl_multi_val *mv,
3516
enum isl_dim_type type, unsigned n);
3517
__isl_give isl_multi_val *isl_multi_val_drop_dims(
3518
__isl_take isl_multi_val *mv,
3519
enum isl_dim_type type, unsigned first, unsigned n);
3523
#include <isl/val.h>
3524
__isl_give isl_multi_val *isl_multi_val_align_params(
3525
__isl_take isl_multi_val *mv,
3526
__isl_take isl_space *model);
3527
__isl_give isl_multi_val *isl_multi_val_range_splice(
3528
__isl_take isl_multi_val *mv1, unsigned pos,
3529
__isl_take isl_multi_val *mv2);
3530
__isl_give isl_multi_val *isl_multi_val_range_product(
3531
__isl_take isl_multi_val *mv1,
3532
__isl_take isl_multi_val *mv2);
3533
__isl_give isl_multi_val *isl_multi_val_flat_range_product(
3534
__isl_take isl_multi_val *mv1,
3535
__isl_take isl_multi_aff *mv2);
3536
__isl_give isl_multi_val *isl_multi_val_add_val(
3537
__isl_take isl_multi_val *mv,
3538
__isl_take isl_val *v);
3539
__isl_give isl_multi_val *isl_multi_val_mod_val(
3540
__isl_take isl_multi_val *mv,
3541
__isl_take isl_val *v);
3542
__isl_give isl_multi_val *isl_multi_val_scale_val(
3543
__isl_take isl_multi_val *mv,
3544
__isl_take isl_val *v);
3545
__isl_give isl_multi_val *isl_multi_val_scale_multi_val(
3546
__isl_take isl_multi_val *mv1,
3547
__isl_take isl_multi_val *mv2);
3122
3551
Vectors can be created, copied and freed using the following functions.
3427
3893
__isl_take isl_pw_aff *pwaff);
3428
3894
__isl_give isl_aff *isl_aff_mod(__isl_take isl_aff *aff,
3896
__isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
3897
__isl_take isl_val *mod);
3430
3898
__isl_give isl_pw_aff *isl_pw_aff_mod(
3431
3899
__isl_take isl_pw_aff *pwaff, isl_int mod);
3900
__isl_give isl_pw_aff *isl_pw_aff_mod_val(
3901
__isl_take isl_pw_aff *pa,
3902
__isl_take isl_val *mod);
3432
3903
__isl_give isl_aff *isl_aff_scale(__isl_take isl_aff *aff,
3905
__isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
3906
__isl_take isl_val *v);
3434
3907
__isl_give isl_pw_aff *isl_pw_aff_scale(
3435
3908
__isl_take isl_pw_aff *pwaff, isl_int f);
3909
__isl_give isl_pw_aff *isl_pw_aff_scale_val(
3910
__isl_take isl_pw_aff *pa, __isl_take isl_val *v);
3436
3911
__isl_give isl_aff *isl_aff_scale_down(__isl_take isl_aff *aff,
3438
3913
__isl_give isl_aff *isl_aff_scale_down_ui(
3439
3914
__isl_take isl_aff *aff, unsigned f);
3915
__isl_give isl_aff *isl_aff_scale_down_val(
3916
__isl_take isl_aff *aff, __isl_take isl_val *v);
3440
3917
__isl_give isl_pw_aff *isl_pw_aff_scale_down(
3441
3918
__isl_take isl_pw_aff *pwaff, isl_int f);
3919
__isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
3920
__isl_take isl_pw_aff *pa,
3921
__isl_take isl_val *f);
3443
3923
__isl_give isl_pw_aff *isl_pw_aff_list_min(
3444
3924
__isl_take isl_pw_aff_list *list);
3872
4361
__isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
3873
4362
__isl_take isl_pw_multi_aff *pma1,
3874
4363
__isl_take isl_pw_multi_aff *pma2);
4364
__isl_give isl_multi_aff *isl_multi_aff_sub(
4365
__isl_take isl_multi_aff *ma1,
4366
__isl_take isl_multi_aff *ma2);
4367
__isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
4368
__isl_take isl_pw_multi_aff *pma1,
4369
__isl_take isl_pw_multi_aff *pma2);
4370
__isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
4371
__isl_take isl_union_pw_multi_aff *upma1,
4372
__isl_take isl_union_pw_multi_aff *upma2);
4374
C<isl_multi_aff_sub> subtracts the second argument from the first.
3875
4376
__isl_give isl_multi_aff *isl_multi_aff_scale(
3876
4377
__isl_take isl_multi_aff *maff,
4379
__isl_give isl_multi_aff *isl_multi_aff_scale_val(
4380
__isl_take isl_multi_aff *ma,
4381
__isl_take isl_val *v);
4382
__isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
4383
__isl_take isl_pw_multi_aff *pma,
4384
__isl_take isl_val *v);
4385
__isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
4386
__isl_take isl_multi_pw_aff *mpa,
4387
__isl_take isl_val *v);
4388
__isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
4389
__isl_take isl_multi_aff *ma,
4390
__isl_take isl_multi_val *mv);
4391
__isl_give isl_pw_multi_aff *
4392
isl_pw_multi_aff_scale_multi_val(
4393
__isl_take isl_pw_multi_aff *pma,
4394
__isl_take isl_multi_val *mv);
4395
__isl_give isl_multi_pw_aff *
4396
isl_multi_pw_aff_scale_multi_val(
4397
__isl_take isl_multi_pw_aff *mpa,
4398
__isl_take isl_multi_val *mv);
4399
__isl_give isl_union_pw_multi_aff *
4400
isl_union_pw_multi_aff_scale_multi_val(
4401
__isl_take isl_union_pw_multi_aff *upma,
4402
__isl_take isl_multi_val *mv);
4404
C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
4405
by the corresponding elements of C<mv>.
3878
4407
__isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
3879
4408
__isl_take isl_pw_multi_aff *pma,
3880
4409
__isl_take isl_set *set);
3881
4410
__isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
3882
4411
__isl_take isl_pw_multi_aff *pma,
3883
4412
__isl_take isl_set *set);
4413
__isl_give isl_union_pw_multi_aff *
4414
isl_union_pw_multi_aff_intersect_domain(
4415
__isl_take isl_union_pw_multi_aff *upma,
4416
__isl_take isl_union_set *uset);
3884
4417
__isl_give isl_multi_aff *isl_multi_aff_lift(
3885
4418
__isl_take isl_multi_aff *maff,
3886
4419
__isl_give isl_local_space **ls);