2 * Copyright 2008-2009 Katholieke Universiteit Leuven
4 * Use of this software is governed by the GNU LGPLv2.1 license
6 * Written by Sven Verdoolaege, K.U.Leuven, Departement
7 * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
15 #include <isl_point.h>
17 #if defined(__cplusplus)
21 /* A "basic set" is a basic map with a zero-dimensional
24 struct isl_basic_set
{
26 #define ISL_BASIC_SET_FINAL (1 << 0)
27 #define ISL_BASIC_SET_EMPTY (1 << 1)
28 #define ISL_BASIC_SET_NO_IMPLICIT (1 << 2)
29 #define ISL_BASIC_SET_NO_REDUNDANT (1 << 3)
30 #define ISL_BASIC_SET_RATIONAL (1 << 4)
31 #define ISL_BASIC_SET_NORMALIZED (1 << 5)
32 #define ISL_BASIC_SET_NORMALIZED_DIVS (1 << 6)
33 #define ISL_BASIC_SET_ALL_EQUALITIES (1 << 7)
52 struct isl_vec
*sample
;
55 struct isl_blk block2
;
58 /* A "set" is a (possibly disjoint) union of basic sets.
60 * See the documentation of isl_map.
64 #define ISL_SET_DISJOINT (1 << 0)
65 #define ISL_SET_NORMALIZED (1 << 1)
75 struct isl_basic_set
*p
[1];
78 unsigned isl_basic_set_n_dim(const struct isl_basic_set
*bset
);
79 unsigned isl_basic_set_n_param(const struct isl_basic_set
*bset
);
80 unsigned isl_basic_set_total_dim(const struct isl_basic_set
*bset
);
81 unsigned isl_basic_set_dim(const struct isl_basic_set
*bset
,
82 enum isl_dim_type type
);
84 unsigned isl_set_n_dim(const struct isl_set
*set
);
85 unsigned isl_set_n_param(const struct isl_set
*set
);
86 unsigned isl_set_dim(const struct isl_set
*set
, enum isl_dim_type type
);
88 __isl_give isl_dim
*isl_basic_set_get_dim(__isl_keep isl_basic_set
*bset
);
89 __isl_give isl_dim
*isl_set_get_dim(__isl_keep isl_set
*set
);
91 __isl_give isl_basic_set
*isl_basic_set_set_dim_name(
92 __isl_take isl_basic_set
*bset
,
93 enum isl_dim_type type
, unsigned pos
, const char *s
);
94 __isl_give isl_set
*isl_set_set_dim_name(__isl_take isl_set
*set
,
95 enum isl_dim_type type
, unsigned pos
, const char *s
);
97 struct isl_basic_set
*isl_basic_set_alloc(struct isl_ctx
*ctx
,
98 unsigned nparam
, unsigned dim
, unsigned extra
,
99 unsigned n_eq
, unsigned n_ineq
);
100 struct isl_basic_set
*isl_basic_set_extend(struct isl_basic_set
*base
,
101 unsigned nparam
, unsigned dim
, unsigned extra
,
102 unsigned n_eq
, unsigned n_ineq
);
103 struct isl_basic_set
*isl_basic_set_extend_constraints(
104 struct isl_basic_set
*base
, unsigned n_eq
, unsigned n_ineq
);
105 struct isl_basic_set
*isl_basic_set_finalize(struct isl_basic_set
*bset
);
106 void isl_basic_set_free(__isl_take isl_basic_set
*bset
);
107 __isl_give isl_basic_set
*isl_basic_set_copy(__isl_keep isl_basic_set
*bset
);
108 struct isl_basic_set
*isl_basic_set_dup(struct isl_basic_set
*bset
);
109 __isl_give isl_basic_set
*isl_basic_set_empty(__isl_take isl_dim
*dim
);
110 struct isl_basic_set
*isl_basic_set_empty_like(struct isl_basic_set
*bset
);
111 __isl_give isl_basic_set
*isl_basic_set_universe(__isl_take isl_dim
*dim
);
112 struct isl_basic_set
*isl_basic_set_universe_like(struct isl_basic_set
*bset
);
113 __isl_give isl_basic_set
*isl_basic_set_universe_like_set(
114 __isl_keep isl_set
*model
);
115 struct isl_basic_set
*isl_basic_set_interval(struct isl_ctx
*ctx
,
116 isl_int min
, isl_int max
);
117 struct isl_basic_set
*isl_basic_set_positive_orthant(struct isl_dim
*dims
);
118 void isl_basic_set_dump(__isl_keep isl_basic_set
*bset
,
119 FILE *out
, int indent
);
120 struct isl_basic_set
*isl_basic_set_swap_vars(
121 struct isl_basic_set
*bset
, unsigned n
);
122 __isl_give isl_basic_set
*isl_basic_set_intersect(
123 __isl_take isl_basic_set
*bset1
,
124 __isl_take isl_basic_set
*bset2
);
125 __isl_give isl_basic_set
*isl_basic_set_apply(
126 __isl_take isl_basic_set
*bset
,
127 __isl_take isl_basic_map
*bmap
);
128 __isl_give isl_basic_set
*isl_basic_set_affine_hull(
129 __isl_take isl_basic_set
*bset
);
130 __isl_give isl_basic_set
*isl_basic_set_remove(__isl_take isl_basic_set
*bset
,
131 enum isl_dim_type type
, unsigned first
, unsigned n
);
132 struct isl_basic_set
*isl_basic_set_simplify(struct isl_basic_set
*bset
);
133 __isl_give isl_basic_set
*isl_basic_set_detect_equalities(
134 __isl_take isl_basic_set
*bset
);
135 struct isl_basic_set
*isl_basic_set_product(struct isl_basic_set_list
*list
);
137 __isl_give isl_basic_set
*isl_basic_set_read_from_file(isl_ctx
*ctx
,
138 FILE *input
, int nparam
);
139 __isl_give isl_basic_set
*isl_basic_set_read_from_str(isl_ctx
*ctx
,
140 const char *str
, int nparam
);
141 __isl_give isl_set
*isl_set_read_from_file(isl_ctx
*ctx
,
142 FILE *input
, int nparam
);
143 __isl_give isl_set
*isl_set_read_from_str(isl_ctx
*ctx
,
144 const char *str
, int nparam
);
145 __isl_give isl_printer
*isl_printer_print_basic_set(
146 __isl_take isl_printer
*printer
, __isl_keep isl_basic_set
*bset
);
147 __isl_give isl_printer
*isl_printer_print_set(__isl_take isl_printer
*printer
,
148 __isl_keep isl_set
*map
);
149 void isl_basic_set_print(__isl_keep isl_basic_set
*bset
, FILE *out
, int indent
,
150 const char *prefix
, const char *suffix
, unsigned output_format
);
151 void isl_set_print(__isl_keep
struct isl_set
*set
, FILE *out
, int indent
,
152 unsigned output_format
);
153 __isl_give isl_basic_set
*isl_basic_set_fix(__isl_take isl_basic_set
*bset
,
154 enum isl_dim_type type
, unsigned pos
, isl_int value
);
155 struct isl_basic_set
*isl_basic_set_fix_si(struct isl_basic_set
*bset
,
156 enum isl_dim_type type
, unsigned pos
, int value
);
157 __isl_give isl_set
*isl_set_fix_si(__isl_take isl_set
*set
,
158 enum isl_dim_type type
, unsigned pos
, int value
);
159 __isl_give isl_set
*isl_set_lower_bound_si(__isl_take isl_set
*set
,
160 enum isl_dim_type type
, unsigned pos
, int value
);
162 struct isl_basic_set
*isl_basic_set_from_underlying_set(
163 struct isl_basic_set
*bset
, struct isl_basic_set
*like
);
164 struct isl_set
*isl_set_from_underlying_set(
165 struct isl_set
*set
, struct isl_basic_set
*like
);
166 struct isl_set
*isl_set_to_underlying_set(struct isl_set
*set
);
168 int isl_basic_set_is_equal(
169 struct isl_basic_set
*bset1
, struct isl_basic_set
*bset2
);
171 __isl_give isl_set
*isl_basic_set_partial_lexmin(
172 __isl_take isl_basic_set
*bset
, __isl_take isl_basic_set
*dom
,
173 __isl_give isl_set
**empty
);
174 __isl_give isl_set
*isl_basic_set_partial_lexmax(
175 __isl_take isl_basic_set
*bset
, __isl_take isl_basic_set
*dom
,
176 __isl_give isl_set
**empty
);
177 __isl_give isl_set
*isl_set_partial_lexmin(
178 __isl_take isl_set
*set
, __isl_take isl_set
*dom
,
179 __isl_give isl_set
**empty
);
180 __isl_give isl_set
*isl_set_partial_lexmax(
181 __isl_take isl_set
*set
, __isl_take isl_set
*dom
,
182 __isl_give isl_set
**empty
);
183 __isl_give isl_set
*isl_basic_set_lexmin(__isl_take isl_basic_set
*bset
);
184 __isl_give isl_set
*isl_basic_set_lexmax(__isl_take isl_basic_set
*bset
);
185 __isl_give isl_set
*isl_set_lexmin(__isl_take isl_set
*set
);
186 __isl_give isl_set
*isl_set_lexmax(__isl_take isl_set
*set
);
187 __isl_give isl_set
*isl_basic_set_union(
188 __isl_take isl_basic_set
*bset1
,
189 __isl_take isl_basic_set
*bset2
);
191 int isl_basic_set_compare_at(struct isl_basic_set
*bset1
,
192 struct isl_basic_set
*bset2
, int pos
);
193 int isl_set_follows_at(__isl_keep isl_set
*set1
,
194 __isl_keep isl_set
*set2
, int pos
);
196 int isl_basic_set_dims_get_sign(__isl_keep isl_basic_set
*bset
,
197 enum isl_dim_type type
, unsigned pos
, unsigned n
, int *signs
);
199 int isl_basic_set_is_universe(__isl_keep isl_basic_set
*bset
);
200 int isl_basic_set_fast_is_empty(__isl_keep isl_basic_set
*bset
);
201 int isl_basic_set_is_empty(__isl_keep isl_basic_set
*bset
);
202 int isl_basic_set_is_bounded(__isl_keep isl_basic_set
*bset
);
204 struct isl_set
*isl_set_alloc(struct isl_ctx
*ctx
,
205 unsigned nparam
, unsigned dim
, int n
, unsigned flags
);
206 struct isl_set
*isl_set_extend(struct isl_set
*base
,
207 unsigned nparam
, unsigned dim
);
208 __isl_give isl_set
*isl_set_empty(__isl_take isl_dim
*dim
);
209 struct isl_set
*isl_set_empty_like(struct isl_set
*set
);
210 __isl_give isl_set
*isl_set_universe(__isl_take isl_dim
*dim
);
211 __isl_give isl_set
*isl_set_universe_like(__isl_keep isl_set
*model
);
212 __isl_give isl_set
*isl_set_add_basic_set(__isl_take isl_set
*set
,
213 __isl_take isl_basic_set
*bset
);
214 struct isl_set
*isl_set_finalize(struct isl_set
*set
);
215 __isl_give isl_set
*isl_set_copy(__isl_keep isl_set
*set
);
216 void isl_set_free(__isl_take isl_set
*set
);
217 struct isl_set
*isl_set_dup(struct isl_set
*set
);
218 __isl_give isl_set
*isl_set_from_basic_set(__isl_take isl_basic_set
*bset
);
219 __isl_give isl_basic_set
*isl_set_sample(__isl_take isl_set
*set
);
220 __isl_give isl_point
*isl_set_sample_point(__isl_take isl_set
*set
);
221 __isl_give isl_set
*isl_set_detect_equalities(__isl_take isl_set
*set
);
222 __isl_give isl_basic_set
*isl_set_affine_hull(__isl_take isl_set
*set
);
223 __isl_give isl_basic_set
*isl_set_convex_hull(__isl_take isl_set
*set
);
224 __isl_give isl_basic_set
*isl_set_simple_hull(__isl_take isl_set
*set
);
225 struct isl_basic_set
*isl_set_bounded_simple_hull(struct isl_set
*set
);
226 __isl_give isl_set
*isl_set_recession_cone(__isl_take isl_set
*set
);
228 struct isl_set
*isl_set_union_disjoint(
229 struct isl_set
*set1
, struct isl_set
*set2
);
230 __isl_give isl_set
*isl_set_union(
231 __isl_take isl_set
*set1
,
232 __isl_take isl_set
*set2
);
233 struct isl_set
*isl_set_product(struct isl_set
*set1
, struct isl_set
*set2
);
234 __isl_give isl_set
*isl_set_intersect(
235 __isl_take isl_set
*set1
,
236 __isl_take isl_set
*set2
);
237 __isl_give isl_set
*isl_set_subtract(
238 __isl_take isl_set
*set1
,
239 __isl_take isl_set
*set2
);
240 __isl_give isl_set
*isl_set_complement(__isl_take isl_set
*set
);
241 __isl_give isl_set
*isl_set_apply(
242 __isl_take isl_set
*set
,
243 __isl_take isl_map
*map
);
244 __isl_give isl_set
*isl_set_fix(__isl_take isl_set
*set
,
245 enum isl_dim_type type
, unsigned pos
, isl_int value
);
246 struct isl_set
*isl_set_fix_dim_si(struct isl_set
*set
,
247 unsigned dim
, int value
);
248 struct isl_set
*isl_set_lower_bound_dim(struct isl_set
*set
,
249 unsigned dim
, isl_int value
);
250 __isl_give isl_basic_set
*isl_basic_set_add(__isl_take isl_basic_set
*bset
,
251 enum isl_dim_type type
, unsigned n
);
252 __isl_give isl_set
*isl_set_add(__isl_take isl_set
*set
,
253 enum isl_dim_type type
, unsigned n
);
254 __isl_give isl_basic_set
*isl_basic_set_move_dims(__isl_take isl_basic_set
*bset
,
255 enum isl_dim_type dst_type
, unsigned dst_pos
,
256 enum isl_dim_type src_type
, unsigned src_pos
, unsigned n
);
257 __isl_give isl_set
*isl_set_move_dims(__isl_take isl_set
*set
,
258 enum isl_dim_type dst_type
, unsigned dst_pos
,
259 enum isl_dim_type src_type
, unsigned src_pos
, unsigned n
);
260 __isl_give isl_basic_set
*isl_basic_set_project_out(
261 __isl_take isl_basic_set
*bset
,
262 enum isl_dim_type type
, unsigned first
, unsigned n
);
263 __isl_give isl_set
*isl_set_project_out(__isl_take isl_set
*set
,
264 enum isl_dim_type type
, unsigned first
, unsigned n
);
265 struct isl_basic_set
*isl_basic_set_remove_dims(struct isl_basic_set
*bset
,
266 unsigned first
, unsigned n
);
267 struct isl_basic_set
*isl_basic_set_remove_divs(struct isl_basic_set
*bset
);
268 struct isl_set
*isl_set_eliminate_dims(struct isl_set
*set
,
269 unsigned first
, unsigned n
);
270 __isl_give isl_set
*isl_set_remove(__isl_take isl_set
*bset
,
271 enum isl_dim_type type
, unsigned first
, unsigned n
);
272 struct isl_set
*isl_set_remove_dims(struct isl_set
*set
,
273 unsigned first
, unsigned n
);
274 struct isl_set
*isl_set_remove_divs(struct isl_set
*set
);
275 __isl_give isl_set
*isl_set_split_dims(__isl_take isl_set
*set
,
276 enum isl_dim_type type
, unsigned first
, unsigned n
);
278 void isl_set_dump(__isl_keep isl_set
*set
, FILE *out
, int indent
);
279 struct isl_set
*isl_set_swap_vars(struct isl_set
*set
, unsigned n
);
280 int isl_set_fast_is_empty(__isl_keep isl_set
*set
);
281 int isl_set_fast_is_universe(__isl_keep isl_set
*set
);
282 int isl_set_is_empty(__isl_keep isl_set
*set
);
283 int isl_set_is_bounded(__isl_keep isl_set
*set
);
284 int isl_set_is_subset(__isl_keep isl_set
*set1
, __isl_keep isl_set
*set2
);
285 int isl_set_is_strict_subset(__isl_keep isl_set
*set1
, __isl_keep isl_set
*set2
);
286 int isl_set_is_equal(__isl_keep isl_set
*set1
, __isl_keep isl_set
*set2
);
287 int isl_set_is_singleton(__isl_keep isl_set
*set
);
288 int isl_set_is_box(__isl_keep isl_set
*set
);
290 __isl_give isl_set
*isl_set_sum(__isl_take isl_set
*set1
,
291 __isl_take isl_set
*set2
);
292 __isl_give isl_set
*isl_set_neg(__isl_take isl_set
*set
);
294 __isl_give isl_set
*isl_set_make_disjoint(__isl_take isl_set
*set
);
295 struct isl_set
*isl_basic_set_compute_divs(struct isl_basic_set
*bset
);
296 __isl_give isl_set
*isl_set_compute_divs(__isl_take isl_set
*set
);
297 __isl_give isl_set
*isl_set_align_divs(__isl_take isl_set
*set
);
299 struct isl_basic_set
*isl_set_copy_basic_set(struct isl_set
*set
);
300 struct isl_set
*isl_set_drop_basic_set(struct isl_set
*set
,
301 struct isl_basic_set
*bset
);
303 int isl_basic_set_fast_dim_is_fixed(struct isl_basic_set
*bset
, unsigned dim
,
306 int isl_set_fast_dim_is_fixed(struct isl_set
*set
, unsigned dim
, isl_int
*val
);
307 int isl_set_fast_dim_has_fixed_lower_bound(struct isl_set
*set
,
308 unsigned dim
, isl_int
*val
);
309 int isl_set_dim_is_bounded(__isl_keep isl_set
*set
,
310 enum isl_dim_type type
, unsigned pos
);
312 __isl_give isl_basic_set
*isl_basic_set_gist(__isl_take isl_basic_set
*bset
,
313 __isl_take isl_basic_set
*context
);
314 __isl_give isl_set
*isl_set_gist_basic_set(__isl_take isl_set
*set
,
315 __isl_take isl_basic_set
*context
);
316 __isl_give isl_set
*isl_set_gist(__isl_take isl_set
*set
,
317 __isl_take isl_set
*context
);
318 int isl_basic_set_dim_residue_class(struct isl_basic_set
*bset
,
319 int pos
, isl_int
*modulo
, isl_int
*residue
);
320 int isl_set_dim_residue_class(struct isl_set
*set
,
321 int pos
, isl_int
*modulo
, isl_int
*residue
);
323 __isl_give isl_set
*isl_set_coalesce(__isl_take isl_set
*set
);
325 int isl_set_fast_is_equal(__isl_keep isl_set
*set1
, __isl_keep isl_set
*set2
);
326 int isl_set_fast_is_disjoint(__isl_keep isl_set
*set1
, __isl_keep isl_set
*set2
);
328 uint32_t isl_set_get_hash(struct isl_set
*set
);
330 int isl_set_dim_is_unique(struct isl_set
*set
, unsigned dim
);
332 int isl_set_foreach_basic_set(__isl_keep isl_set
*set
,
333 int (*fn
)(__isl_take isl_basic_set
*bset
, void *user
), void *user
);
335 int isl_set_foreach_point(__isl_keep isl_set
*set
,
336 int (*fn
)(__isl_take isl_point
*pnt
, void *user
), void *user
);
337 int isl_set_count(__isl_keep isl_set
*set
, isl_int
*count
);
338 int isl_set_count_upto(__isl_keep isl_set
*set
, isl_int max
, isl_int
*count
);
340 __isl_give isl_set
*isl_set_from_point(__isl_take isl_point
*pnt
);
341 __isl_give isl_set
*isl_set_box_from_points(__isl_take isl_point
*pnt1
,
342 __isl_take isl_point
*pnt2
);
344 __isl_give isl_set
*isl_set_lift(__isl_take isl_set
*set
);
346 int isl_set_size(__isl_keep isl_set
*set
);
348 #if defined(__cplusplus)