2 * Copyright 2012 Ecole Normale Superieure
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege,
7 * Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
10 #include <isl/space.h>
17 /* Construct an isl_multi_val living in "space" with all values equal to "val".
19 __isl_give isl_multi_val
*ppcg_multi_val_from_int(__isl_take isl_space
*space
,
30 ctx
= isl_space_get_ctx(space
);
31 n
= isl_space_dim(space
, isl_dim_set
);
32 mv
= isl_multi_val_zero(space
);
33 v
= isl_val_int_from_si(ctx
, val
);
34 for (i
= 0; i
< n
; ++i
)
35 mv
= isl_multi_val_set_val(mv
, i
, isl_val_copy(v
));
41 /* Compute the size of a bounding box around the origin and "set",
42 * where "set" is assumed to contain only non-negative elements.
43 * In particular, compute the maximal value of "set" in each direction
46 __isl_give isl_multi_pw_aff
*ppcg_size_from_extent(__isl_take isl_set
*set
)
49 isl_multi_pw_aff
*mpa
;
51 n
= isl_set_dim(set
, isl_dim_set
);
52 mpa
= isl_multi_pw_aff_zero(isl_set_get_space(set
));
53 for (i
= 0; i
< n
; ++i
) {
58 if (!isl_set_dim_has_upper_bound(set
, isl_dim_set
, i
)) {
60 name
= isl_set_get_tuple_name(set
);
63 fprintf(stderr
, "unable to determine extent of '%s' "
64 "in dimension %d\n", name
, i
);
65 set
= isl_set_free(set
);
67 bound
= isl_set_dim_max(isl_set_copy(set
), i
);
69 space
= isl_pw_aff_get_domain_space(bound
);
70 one
= isl_aff_zero_on_domain(isl_local_space_from_space(space
));
71 one
= isl_aff_add_constant_si(one
, 1);
72 bound
= isl_pw_aff_add(bound
, isl_pw_aff_from_aff(one
));
73 mpa
= isl_multi_pw_aff_set_pw_aff(mpa
, i
, bound
);