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_ctx *isl_basic_set_get_ctx(__isl_keep isl_basic_set *bset);
89 isl_ctx *isl_set_get_ctx(__isl_keep isl_set *set);
90 __isl_give isl_dim *isl_basic_set_get_dim(__isl_keep isl_basic_set *bset);
91 __isl_give isl_dim *isl_set_get_dim(__isl_keep isl_set *set);
93 __isl_give isl_basic_set *isl_basic_set_set_dim_name(
94 __isl_take isl_basic_set *bset,
95 enum isl_dim_type type, unsigned pos, const char *s);
96 __isl_give isl_set *isl_set_set_dim_name(__isl_take isl_set *set,
97 enum isl_dim_type type, unsigned pos, const char *s);
99 struct isl_basic_set *isl_basic_set_alloc(struct isl_ctx *ctx,
100 unsigned nparam, unsigned dim, unsigned extra,
101 unsigned n_eq, unsigned n_ineq);
102 struct isl_basic_set *isl_basic_set_extend(struct isl_basic_set *base,
103 unsigned nparam, unsigned dim, unsigned extra,
104 unsigned n_eq, unsigned n_ineq);
105 struct isl_basic_set *isl_basic_set_extend_constraints(
106 struct isl_basic_set *base, unsigned n_eq, unsigned n_ineq);
107 struct isl_basic_set *isl_basic_set_finalize(struct isl_basic_set *bset);
108 void isl_basic_set_free(__isl_take isl_basic_set *bset);
109 __isl_give isl_basic_set *isl_basic_set_copy(__isl_keep isl_basic_set *bset);
110 struct isl_basic_set *isl_basic_set_dup(struct isl_basic_set *bset);
111 __isl_give isl_basic_set *isl_basic_set_empty(__isl_take isl_dim *dim);
112 struct isl_basic_set *isl_basic_set_empty_like(struct isl_basic_set *bset);
113 __isl_give isl_basic_set *isl_basic_set_universe(__isl_take isl_dim *dim);
114 struct isl_basic_set *isl_basic_set_universe_like(struct isl_basic_set *bset);
115 __isl_give isl_basic_set *isl_basic_set_universe_like_set(
116 __isl_keep isl_set *model);
117 struct isl_basic_set *isl_basic_set_interval(struct isl_ctx *ctx,
118 isl_int min, isl_int max);
119 struct isl_basic_set *isl_basic_set_positive_orthant(struct isl_dim *dims);
120 void isl_basic_set_dump(__isl_keep isl_basic_set *bset,
121 FILE *out, int indent);
122 struct isl_basic_set *isl_basic_set_swap_vars(
123 struct isl_basic_set *bset, unsigned n);
124 __isl_give isl_basic_set *isl_basic_set_intersect(
125 __isl_take isl_basic_set *bset1,
126 __isl_take isl_basic_set *bset2);
127 __isl_give isl_basic_set *isl_basic_set_apply(
128 __isl_take isl_basic_set *bset,
129 __isl_take isl_basic_map *bmap);
130 __isl_give isl_basic_set *isl_basic_set_affine_hull(
131 __isl_take isl_basic_set *bset);
132 __isl_give isl_basic_set *isl_basic_set_remove(__isl_take isl_basic_set *bset,
133 enum isl_dim_type type, unsigned first, unsigned n);
134 struct isl_basic_set *isl_basic_set_simplify(struct isl_basic_set *bset);
135 __isl_give isl_basic_set *isl_basic_set_detect_equalities(
136 __isl_take isl_basic_set *bset);
137 struct isl_basic_set *isl_basic_set_product(struct isl_basic_set_list *list);
139 __isl_give isl_basic_set *isl_basic_set_read_from_file(isl_ctx *ctx,
140 FILE *input, int nparam);
141 __isl_give isl_basic_set *isl_basic_set_read_from_str(isl_ctx *ctx,
142 const char *str, int nparam);
143 __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
144 FILE *input, int nparam);
145 __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
146 const char *str, int nparam);
147 __isl_give isl_printer *isl_printer_print_basic_set(
148 __isl_take isl_printer *printer, __isl_keep isl_basic_set *bset);
149 __isl_give isl_printer *isl_printer_print_set(__isl_take isl_printer *printer,
150 __isl_keep isl_set *map);
151 void isl_basic_set_print(__isl_keep isl_basic_set *bset, FILE *out, int indent,
152 const char *prefix, const char *suffix, unsigned output_format);
153 void isl_set_print(__isl_keep struct isl_set *set, FILE *out, int indent,
154 unsigned output_format);
155 __isl_give isl_basic_set *isl_basic_set_fix(__isl_take isl_basic_set *bset,
156 enum isl_dim_type type, unsigned pos, isl_int value);
157 struct isl_basic_set *isl_basic_set_fix_si(struct isl_basic_set *bset,
158 enum isl_dim_type type, unsigned pos, int value);
159 __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
160 enum isl_dim_type type, unsigned pos, int value);
161 __isl_give isl_set *isl_set_lower_bound_si(__isl_take isl_set *set,
162 enum isl_dim_type type, unsigned pos, int value);
164 struct isl_basic_set *isl_basic_set_from_underlying_set(
165 struct isl_basic_set *bset, struct isl_basic_set *like);
166 struct isl_set *isl_set_from_underlying_set(
167 struct isl_set *set, struct isl_basic_set *like);
168 struct isl_set *isl_set_to_underlying_set(struct isl_set *set);
170 int isl_basic_set_is_equal(
171 struct isl_basic_set *bset1, struct isl_basic_set *bset2);
173 __isl_give isl_set *isl_basic_set_partial_lexmin(
174 __isl_take isl_basic_set *bset, __isl_take isl_basic_set *dom,
175 __isl_give isl_set **empty);
176 __isl_give isl_set *isl_basic_set_partial_lexmax(
177 __isl_take isl_basic_set *bset, __isl_take isl_basic_set *dom,
178 __isl_give isl_set **empty);
179 __isl_give isl_set *isl_set_partial_lexmin(
180 __isl_take isl_set *set, __isl_take isl_set *dom,
181 __isl_give isl_set **empty);
182 __isl_give isl_set *isl_set_partial_lexmax(
183 __isl_take isl_set *set, __isl_take isl_set *dom,
184 __isl_give isl_set **empty);
185 __isl_give isl_set *isl_basic_set_lexmin(__isl_take isl_basic_set *bset);
186 __isl_give isl_set *isl_basic_set_lexmax(__isl_take isl_basic_set *bset);
187 __isl_give isl_set *isl_set_lexmin(__isl_take isl_set *set);
188 __isl_give isl_set *isl_set_lexmax(__isl_take isl_set *set);
189 __isl_give isl_set *isl_basic_set_union(
190 __isl_take isl_basic_set *bset1,
191 __isl_take isl_basic_set *bset2);
193 int isl_basic_set_compare_at(struct isl_basic_set *bset1,
194 struct isl_basic_set *bset2, int pos);
195 int isl_set_follows_at(__isl_keep isl_set *set1,
196 __isl_keep isl_set *set2, int pos);
198 int isl_basic_set_dims_get_sign(__isl_keep isl_basic_set *bset,
199 enum isl_dim_type type, unsigned pos, unsigned n, int *signs);
201 int isl_basic_set_is_universe(__isl_keep isl_basic_set *bset);
202 int isl_basic_set_fast_is_empty(__isl_keep isl_basic_set *bset);
203 int isl_basic_set_is_empty(__isl_keep isl_basic_set *bset);
204 int isl_basic_set_is_bounded(__isl_keep isl_basic_set *bset);
206 struct isl_set *isl_set_alloc(struct isl_ctx *ctx,
207 unsigned nparam, unsigned dim, int n, unsigned flags);
208 struct isl_set *isl_set_extend(struct isl_set *base,
209 unsigned nparam, unsigned dim);
210 __isl_give isl_set *isl_set_empty(__isl_take isl_dim *dim);
211 struct isl_set *isl_set_empty_like(struct isl_set *set);
212 __isl_give isl_set *isl_set_universe(__isl_take isl_dim *dim);
213 __isl_give isl_set *isl_set_universe_like(__isl_keep isl_set *model);
214 __isl_give isl_set *isl_set_add_basic_set(__isl_take isl_set *set,
215 __isl_take isl_basic_set *bset);
216 struct isl_set *isl_set_finalize(struct isl_set *set);
217 __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
218 void isl_set_free(__isl_take isl_set *set);
219 struct isl_set *isl_set_dup(struct isl_set *set);
220 __isl_give isl_set *isl_set_from_basic_set(__isl_take isl_basic_set *bset);
221 __isl_give isl_basic_set *isl_set_sample(__isl_take isl_set *set);
222 __isl_give isl_point *isl_set_sample_point(__isl_take isl_set *set);
223 __isl_give isl_set *isl_set_detect_equalities(__isl_take isl_set *set);
224 __isl_give isl_basic_set *isl_set_affine_hull(__isl_take isl_set *set);
225 __isl_give isl_basic_set *isl_set_convex_hull(__isl_take isl_set *set);
226 __isl_give isl_basic_set *isl_set_simple_hull(__isl_take isl_set *set);
227 struct isl_basic_set *isl_set_bounded_simple_hull(struct isl_set *set);
228 __isl_give isl_set *isl_set_recession_cone(__isl_take isl_set *set);
230 struct isl_set *isl_set_union_disjoint(
231 struct isl_set *set1, struct isl_set *set2);
232 __isl_give isl_set *isl_set_union(
233 __isl_take isl_set *set1,
234 __isl_take isl_set *set2);
235 struct isl_set *isl_set_product(struct isl_set *set1, struct isl_set *set2);
236 __isl_give isl_set *isl_set_flat_product(__isl_take isl_set *set1,
237 __isl_take isl_set *set2);
238 __isl_give isl_set *isl_set_intersect(
239 __isl_take isl_set *set1,
240 __isl_take isl_set *set2);
241 __isl_give isl_set *isl_set_subtract(
242 __isl_take isl_set *set1,
243 __isl_take isl_set *set2);
244 __isl_give isl_set *isl_set_complement(__isl_take isl_set *set);
245 __isl_give isl_set *isl_set_apply(
246 __isl_take isl_set *set,
247 __isl_take isl_map *map);
248 __isl_give isl_set *isl_set_fix(__isl_take isl_set *set,
249 enum isl_dim_type type, unsigned pos, isl_int value);
250 struct isl_set *isl_set_fix_dim_si(struct isl_set *set,
251 unsigned dim, int value);
252 struct isl_set *isl_set_lower_bound_dim(struct isl_set *set,
253 unsigned dim, isl_int value);
254 __isl_give isl_set *isl_set_insert(__isl_take isl_set *set,
255 enum isl_dim_type type, unsigned pos, unsigned n);
256 __isl_give isl_basic_set *isl_basic_set_add(__isl_take isl_basic_set *bset,
257 enum isl_dim_type type, unsigned n);
258 __isl_give isl_set *isl_set_add(__isl_take isl_set *set,
259 enum isl_dim_type type, unsigned n);
260 __isl_give isl_basic_set *isl_basic_set_move_dims(__isl_take isl_basic_set *bset,
261 enum isl_dim_type dst_type, unsigned dst_pos,
262 enum isl_dim_type src_type, unsigned src_pos, unsigned n);
263 __isl_give isl_set *isl_set_move_dims(__isl_take isl_set *set,
264 enum isl_dim_type dst_type, unsigned dst_pos,
265 enum isl_dim_type src_type, unsigned src_pos, unsigned n);
266 __isl_give isl_basic_set *isl_basic_set_project_out(
267 __isl_take isl_basic_set *bset,
268 enum isl_dim_type type, unsigned first, unsigned n);
269 __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
270 enum isl_dim_type type, unsigned first, unsigned n);
271 struct isl_basic_set *isl_basic_set_remove_dims(struct isl_basic_set *bset,
272 unsigned first, unsigned n);
273 struct isl_basic_set *isl_basic_set_remove_divs(struct isl_basic_set *bset);
274 struct isl_set *isl_set_eliminate_dims(struct isl_set *set,
275 unsigned first, unsigned n);
276 __isl_give isl_set *isl_set_remove(__isl_take isl_set *bset,
277 enum isl_dim_type type, unsigned first, unsigned n);
278 struct isl_set *isl_set_remove_dims(struct isl_set *set,
279 unsigned first, unsigned n);
280 struct isl_set *isl_set_remove_divs(struct isl_set *set);
281 __isl_give isl_set *isl_set_split_dims(__isl_take isl_set *set,
282 enum isl_dim_type type, unsigned first, unsigned n);
284 void isl_set_dump(__isl_keep isl_set *set, FILE *out, int indent);
285 struct isl_set *isl_set_swap_vars(struct isl_set *set, unsigned n);
286 int isl_set_fast_is_empty(__isl_keep isl_set *set);
287 int isl_set_fast_is_universe(__isl_keep isl_set *set);
288 int isl_set_is_empty(__isl_keep isl_set *set);
289 int isl_set_is_bounded(__isl_keep isl_set *set);
290 int isl_set_is_subset(__isl_keep isl_set *set1, __isl_keep isl_set *set2);
291 int isl_set_is_strict_subset(__isl_keep isl_set *set1, __isl_keep isl_set *set2);
292 int isl_set_is_equal(__isl_keep isl_set *set1, __isl_keep isl_set *set2);
293 int isl_set_is_singleton(__isl_keep isl_set *set);
294 int isl_set_is_box(__isl_keep isl_set *set);
295 int isl_set_has_equal_dim(__isl_keep isl_set *set1, __isl_keep isl_set *set2);
297 __isl_give isl_set *isl_set_sum(__isl_take isl_set *set1,
298 __isl_take isl_set *set2);
299 __isl_give isl_set *isl_set_neg(__isl_take isl_set *set);
301 __isl_give isl_set *isl_set_make_disjoint(__isl_take isl_set *set);
302 struct isl_set *isl_basic_set_compute_divs(struct isl_basic_set *bset);
303 __isl_give isl_set *isl_set_compute_divs(__isl_take isl_set *set);
304 __isl_give isl_set *isl_set_align_divs(__isl_take isl_set *set);
306 struct isl_basic_set *isl_set_copy_basic_set(struct isl_set *set);
307 struct isl_set *isl_set_drop_basic_set(struct isl_set *set,
308 struct isl_basic_set *bset);
310 int isl_basic_set_fast_dim_is_fixed(struct isl_basic_set *bset, unsigned dim,
313 int isl_set_fast_dim_is_fixed(struct isl_set *set, unsigned dim, isl_int *val);
314 int isl_set_fast_dim_has_fixed_lower_bound(struct isl_set *set,
315 unsigned dim, isl_int *val);
316 int isl_set_dim_is_bounded(__isl_keep isl_set *set,
317 enum isl_dim_type type, unsigned pos);
319 __isl_give isl_basic_set *isl_basic_set_gist(__isl_take isl_basic_set *bset,
320 __isl_take isl_basic_set *context);
321 __isl_give isl_set *isl_set_gist_basic_set(__isl_take isl_set *set,
322 __isl_take isl_basic_set *context);
323 __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
324 __isl_take isl_set *context);
325 int isl_basic_set_dim_residue_class(struct isl_basic_set *bset,
326 int pos, isl_int *modulo, isl_int *residue);
327 int isl_set_dim_residue_class(struct isl_set *set,
328 int pos, isl_int *modulo, isl_int *residue);
330 __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
332 int isl_set_fast_is_equal(__isl_keep isl_set *set1, __isl_keep isl_set *set2);
333 int isl_set_fast_is_disjoint(__isl_keep isl_set *set1, __isl_keep isl_set *set2);
335 uint32_t isl_set_get_hash(struct isl_set *set);
337 int isl_set_dim_is_unique(struct isl_set *set, unsigned dim);
339 int isl_set_foreach_basic_set(__isl_keep isl_set *set,
340 int (*fn)(__isl_take isl_basic_set *bset, void *user), void *user);
342 int isl_set_foreach_point(__isl_keep isl_set *set,
343 int (*fn)(__isl_take isl_point *pnt, void *user), void *user);
344 int isl_set_count(__isl_keep isl_set *set, isl_int *count);
345 int isl_set_count_upto(__isl_keep isl_set *set, isl_int max, isl_int *count);
347 __isl_give isl_set *isl_set_from_point(__isl_take isl_point *pnt);
348 __isl_give isl_set *isl_set_box_from_points(__isl_take isl_point *pnt1,
349 __isl_take isl_point *pnt2);
351 __isl_give isl_set *isl_set_lift(__isl_take isl_set *set);
353 __isl_give isl_map *isl_set_lex_le_set(__isl_take isl_set *set1,
354 __isl_take isl_set *set2);
355 __isl_give isl_map *isl_set_lex_lt_set(__isl_take isl_set *set1,
356 __isl_take isl_set *set2);
357 __isl_give isl_map *isl_set_lex_ge_set(__isl_take isl_set *set1,
358 __isl_take isl_set *set2);
359 __isl_give isl_map *isl_set_lex_gt_set(__isl_take isl_set *set1,
360 __isl_take isl_set *set2);
362 int isl_set_size(__isl_keep isl_set *set);
364 #if defined(__cplusplus)