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 "set" is a (possibly disjoint) union of basic sets.
23 * See the documentation of isl_map.
27 #define ISL_SET_DISJOINT (1 << 0)
28 #define ISL_SET_NORMALIZED (1 << 1)
38 struct isl_basic_set *p[1];
41 unsigned isl_basic_set_n_dim(const struct isl_basic_set *bset);
42 unsigned isl_basic_set_n_param(const struct isl_basic_set *bset);
43 unsigned isl_basic_set_total_dim(const struct isl_basic_set *bset);
44 unsigned isl_basic_set_dim(const struct isl_basic_set *bset,
45 enum isl_dim_type type);
47 unsigned isl_set_n_dim(const struct isl_set *set);
48 unsigned isl_set_n_param(const struct isl_set *set);
49 unsigned isl_set_dim(const struct isl_set *set, enum isl_dim_type type);
51 isl_ctx *isl_basic_set_get_ctx(__isl_keep isl_basic_set *bset);
52 isl_ctx *isl_set_get_ctx(__isl_keep isl_set *set);
53 __isl_give isl_dim *isl_basic_set_get_dim(__isl_keep isl_basic_set *bset);
54 __isl_give isl_dim *isl_set_get_dim(__isl_keep isl_set *set);
55 __isl_give isl_set *isl_set_reset_dim(__isl_take isl_set *set,
56 __isl_take isl_dim *dim);
58 const char *isl_set_get_tuple_name(__isl_keep isl_set *set);
59 __isl_give isl_set *isl_set_set_tuple_name(__isl_take isl_set *set,
61 __isl_give isl_basic_set *isl_basic_set_set_dim_name(
62 __isl_take isl_basic_set *bset,
63 enum isl_dim_type type, unsigned pos, const char *s);
64 const char *isl_set_get_dim_name(__isl_keep isl_set *set,
65 enum isl_dim_type type, unsigned pos);
66 __isl_give isl_set *isl_set_set_dim_name(__isl_take isl_set *set,
67 enum isl_dim_type type, unsigned pos, const char *s);
69 struct isl_basic_set *isl_basic_set_alloc(struct isl_ctx *ctx,
70 unsigned nparam, unsigned dim, unsigned extra,
71 unsigned n_eq, unsigned n_ineq);
72 struct isl_basic_set *isl_basic_set_extend(struct isl_basic_set *base,
73 unsigned nparam, unsigned dim, unsigned extra,
74 unsigned n_eq, unsigned n_ineq);
75 struct isl_basic_set *isl_basic_set_extend_constraints(
76 struct isl_basic_set *base, unsigned n_eq, unsigned n_ineq);
77 struct isl_basic_set *isl_basic_set_finalize(struct isl_basic_set *bset);
78 void isl_basic_set_free(__isl_take isl_basic_set *bset);
79 __isl_give isl_basic_set *isl_basic_set_copy(__isl_keep isl_basic_set *bset);
80 struct isl_basic_set *isl_basic_set_dup(struct isl_basic_set *bset);
81 __isl_give isl_basic_set *isl_basic_set_empty(__isl_take isl_dim *dim);
82 struct isl_basic_set *isl_basic_set_empty_like(struct isl_basic_set *bset);
83 __isl_give isl_basic_set *isl_basic_set_universe(__isl_take isl_dim *dim);
84 struct isl_basic_set *isl_basic_set_universe_like(struct isl_basic_set *bset);
85 __isl_give isl_basic_set *isl_basic_set_universe_like_set(
86 __isl_keep isl_set *model);
87 struct isl_basic_set *isl_basic_set_interval(struct isl_ctx *ctx,
88 isl_int min, isl_int max);
89 struct isl_basic_set *isl_basic_set_positive_orthant(struct isl_dim *dims);
90 void isl_basic_set_dump(__isl_keep isl_basic_set *bset,
91 FILE *out, int indent);
92 struct isl_basic_set *isl_basic_set_swap_vars(
93 struct isl_basic_set *bset, unsigned n);
94 __isl_give isl_basic_set *isl_basic_set_intersect(
95 __isl_take isl_basic_set *bset1,
96 __isl_take isl_basic_set *bset2);
97 __isl_give isl_basic_set *isl_basic_set_apply(
98 __isl_take isl_basic_set *bset,
99 __isl_take isl_basic_map *bmap);
100 __isl_give isl_basic_set *isl_basic_set_affine_hull(
101 __isl_take isl_basic_set *bset);
102 __isl_give isl_basic_set *isl_basic_set_remove_dims(
103 __isl_take isl_basic_set *bset,
104 enum isl_dim_type type, unsigned first, unsigned n);
105 struct isl_basic_set *isl_basic_set_simplify(struct isl_basic_set *bset);
106 __isl_give isl_basic_set *isl_basic_set_detect_equalities(
107 __isl_take isl_basic_set *bset);
108 struct isl_basic_set *isl_basic_set_product(struct isl_basic_set_list *list);
110 __isl_give isl_basic_set *isl_basic_set_read_from_file(isl_ctx *ctx,
111 FILE *input, int nparam);
112 __isl_give isl_basic_set *isl_basic_set_read_from_str(isl_ctx *ctx,
113 const char *str, int nparam);
114 __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
115 FILE *input, int nparam);
116 __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
117 const char *str, int nparam);
118 __isl_give isl_printer *isl_printer_print_basic_set(
119 __isl_take isl_printer *printer, __isl_keep isl_basic_set *bset);
120 __isl_give isl_printer *isl_printer_print_set(__isl_take isl_printer *printer,
121 __isl_keep isl_set *map);
122 void isl_basic_set_print(__isl_keep isl_basic_set *bset, FILE *out, int indent,
123 const char *prefix, const char *suffix, unsigned output_format);
124 void isl_set_print(__isl_keep struct isl_set *set, FILE *out, int indent,
125 unsigned output_format);
126 __isl_give isl_basic_set *isl_basic_set_fix(__isl_take isl_basic_set *bset,
127 enum isl_dim_type type, unsigned pos, isl_int value);
128 struct isl_basic_set *isl_basic_set_fix_si(struct isl_basic_set *bset,
129 enum isl_dim_type type, unsigned pos, int value);
130 __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
131 enum isl_dim_type type, unsigned pos, int value);
132 __isl_give isl_set *isl_set_lower_bound_si(__isl_take isl_set *set,
133 enum isl_dim_type type, unsigned pos, int value);
135 struct isl_basic_set *isl_basic_set_from_underlying_set(
136 struct isl_basic_set *bset, struct isl_basic_set *like);
137 struct isl_set *isl_set_from_underlying_set(
138 struct isl_set *set, struct isl_basic_set *like);
139 struct isl_set *isl_set_to_underlying_set(struct isl_set *set);
141 int isl_basic_set_is_equal(
142 struct isl_basic_set *bset1, struct isl_basic_set *bset2);
144 __isl_give isl_set *isl_basic_set_partial_lexmin(
145 __isl_take isl_basic_set *bset, __isl_take isl_basic_set *dom,
146 __isl_give isl_set **empty);
147 __isl_give isl_set *isl_basic_set_partial_lexmax(
148 __isl_take isl_basic_set *bset, __isl_take isl_basic_set *dom,
149 __isl_give isl_set **empty);
150 __isl_give isl_set *isl_set_partial_lexmin(
151 __isl_take isl_set *set, __isl_take isl_set *dom,
152 __isl_give isl_set **empty);
153 __isl_give isl_set *isl_set_partial_lexmax(
154 __isl_take isl_set *set, __isl_take isl_set *dom,
155 __isl_give isl_set **empty);
156 __isl_give isl_set *isl_basic_set_lexmin(__isl_take isl_basic_set *bset);
157 __isl_give isl_set *isl_basic_set_lexmax(__isl_take isl_basic_set *bset);
158 __isl_give isl_set *isl_set_lexmin(__isl_take isl_set *set);
159 __isl_give isl_set *isl_set_lexmax(__isl_take isl_set *set);
160 __isl_give isl_set *isl_basic_set_union(
161 __isl_take isl_basic_set *bset1,
162 __isl_take isl_basic_set *bset2);
164 int isl_basic_set_compare_at(struct isl_basic_set *bset1,
165 struct isl_basic_set *bset2, int pos);
166 int isl_set_follows_at(__isl_keep isl_set *set1,
167 __isl_keep isl_set *set2, int pos);
169 int isl_basic_set_dims_get_sign(__isl_keep isl_basic_set *bset,
170 enum isl_dim_type type, unsigned pos, unsigned n, int *signs);
172 int isl_basic_set_is_universe(__isl_keep isl_basic_set *bset);
173 int isl_basic_set_fast_is_empty(__isl_keep isl_basic_set *bset);
174 int isl_basic_set_is_empty(__isl_keep isl_basic_set *bset);
175 int isl_basic_set_is_bounded(__isl_keep isl_basic_set *bset);
177 struct isl_set *isl_set_alloc(struct isl_ctx *ctx,
178 unsigned nparam, unsigned dim, int n, unsigned flags);
179 struct isl_set *isl_set_extend(struct isl_set *base,
180 unsigned nparam, unsigned dim);
181 __isl_give isl_set *isl_set_empty(__isl_take isl_dim *dim);
182 struct isl_set *isl_set_empty_like(struct isl_set *set);
183 __isl_give isl_set *isl_set_universe(__isl_take isl_dim *dim);
184 __isl_give isl_set *isl_set_universe_like(__isl_keep isl_set *model);
185 __isl_give isl_set *isl_set_add_basic_set(__isl_take isl_set *set,
186 __isl_take isl_basic_set *bset);
187 struct isl_set *isl_set_finalize(struct isl_set *set);
188 __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
189 void isl_set_free(__isl_take isl_set *set);
190 struct isl_set *isl_set_dup(struct isl_set *set);
191 __isl_give isl_set *isl_set_from_basic_set(__isl_take isl_basic_set *bset);
192 __isl_give isl_basic_set *isl_set_sample(__isl_take isl_set *set);
193 __isl_give isl_point *isl_basic_set_sample_point(__isl_take isl_basic_set *bset);
194 __isl_give isl_point *isl_set_sample_point(__isl_take isl_set *set);
195 __isl_give isl_set *isl_set_detect_equalities(__isl_take isl_set *set);
196 __isl_give isl_basic_set *isl_set_affine_hull(__isl_take isl_set *set);
197 __isl_give isl_basic_set *isl_set_convex_hull(__isl_take isl_set *set);
198 __isl_give isl_basic_set *isl_set_polyhedral_hull(__isl_take isl_set *set);
199 __isl_give isl_basic_set *isl_set_simple_hull(__isl_take isl_set *set);
200 struct isl_basic_set *isl_set_bounded_simple_hull(struct isl_set *set);
201 __isl_give isl_set *isl_set_recession_cone(__isl_take isl_set *set);
203 struct isl_set *isl_set_union_disjoint(
204 struct isl_set *set1, struct isl_set *set2);
205 __isl_give isl_set *isl_set_union(
206 __isl_take isl_set *set1,
207 __isl_take isl_set *set2);
208 struct isl_set *isl_set_product(struct isl_set *set1, struct isl_set *set2);
209 __isl_give isl_set *isl_set_flat_product(__isl_take isl_set *set1,
210 __isl_take isl_set *set2);
211 __isl_give isl_set *isl_set_intersect(
212 __isl_take isl_set *set1,
213 __isl_take isl_set *set2);
214 __isl_give isl_set *isl_set_subtract(
215 __isl_take isl_set *set1,
216 __isl_take isl_set *set2);
217 __isl_give isl_set *isl_set_complement(__isl_take isl_set *set);
218 __isl_give isl_set *isl_set_apply(
219 __isl_take isl_set *set,
220 __isl_take isl_map *map);
221 __isl_give isl_set *isl_set_fix(__isl_take isl_set *set,
222 enum isl_dim_type type, unsigned pos, isl_int value);
223 struct isl_set *isl_set_fix_dim_si(struct isl_set *set,
224 unsigned dim, int value);
225 struct isl_set *isl_set_lower_bound_dim(struct isl_set *set,
226 unsigned dim, isl_int value);
227 __isl_give isl_set *isl_set_insert(__isl_take isl_set *set,
228 enum isl_dim_type type, unsigned pos, unsigned n);
229 __isl_give isl_basic_set *isl_basic_set_add(__isl_take isl_basic_set *bset,
230 enum isl_dim_type type, unsigned n);
231 __isl_give isl_set *isl_set_add_dims(__isl_take isl_set *set,
232 enum isl_dim_type type, unsigned n);
233 __isl_give isl_basic_set *isl_basic_set_move_dims(__isl_take isl_basic_set *bset,
234 enum isl_dim_type dst_type, unsigned dst_pos,
235 enum isl_dim_type src_type, unsigned src_pos, unsigned n);
236 __isl_give isl_set *isl_set_move_dims(__isl_take isl_set *set,
237 enum isl_dim_type dst_type, unsigned dst_pos,
238 enum isl_dim_type src_type, unsigned src_pos, unsigned n);
239 __isl_give isl_basic_set *isl_basic_set_project_out(
240 __isl_take isl_basic_set *bset,
241 enum isl_dim_type type, unsigned first, unsigned n);
242 __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
243 enum isl_dim_type type, unsigned first, unsigned n);
244 __isl_give isl_basic_set *isl_basic_set_remove_divs(
245 __isl_take isl_basic_set *bset);
246 struct isl_set *isl_set_eliminate_dims(struct isl_set *set,
247 unsigned first, unsigned n);
248 __isl_give isl_set *isl_set_remove_dims(__isl_take isl_set *bset,
249 enum isl_dim_type type, unsigned first, unsigned n);
250 __isl_give isl_set *isl_set_remove_divs_involving_dims(__isl_take isl_set *set,
251 enum isl_dim_type type, unsigned first, unsigned n);
252 __isl_give isl_set *isl_set_remove_divs(__isl_take isl_set *set);
253 __isl_give isl_set *isl_set_split_dims(__isl_take isl_set *set,
254 enum isl_dim_type type, unsigned first, unsigned n);
256 void isl_set_dump(__isl_keep isl_set *set, FILE *out, int indent);
257 struct isl_set *isl_set_swap_vars(struct isl_set *set, unsigned n);
258 int isl_set_fast_is_empty(__isl_keep isl_set *set);
259 int isl_set_fast_is_universe(__isl_keep isl_set *set);
260 int isl_set_is_empty(__isl_keep isl_set *set);
261 int isl_set_is_bounded(__isl_keep isl_set *set);
262 int isl_set_is_subset(__isl_keep isl_set *set1, __isl_keep isl_set *set2);
263 int isl_set_is_strict_subset(__isl_keep isl_set *set1, __isl_keep isl_set *set2);
264 int isl_set_is_equal(__isl_keep isl_set *set1, __isl_keep isl_set *set2);
265 int isl_set_is_singleton(__isl_keep isl_set *set);
266 int isl_set_is_box(__isl_keep isl_set *set);
267 int isl_set_has_equal_dim(__isl_keep isl_set *set1, __isl_keep isl_set *set2);
269 __isl_give isl_set *isl_set_sum(__isl_take isl_set *set1,
270 __isl_take isl_set *set2);
271 __isl_give isl_set *isl_set_neg(__isl_take isl_set *set);
273 __isl_give isl_set *isl_set_make_disjoint(__isl_take isl_set *set);
274 struct isl_set *isl_basic_set_compute_divs(struct isl_basic_set *bset);
275 __isl_give isl_set *isl_set_compute_divs(__isl_take isl_set *set);
276 __isl_give isl_set *isl_set_align_divs(__isl_take isl_set *set);
278 struct isl_basic_set *isl_set_copy_basic_set(struct isl_set *set);
279 struct isl_set *isl_set_drop_basic_set(struct isl_set *set,
280 struct isl_basic_set *bset);
282 int isl_basic_set_fast_dim_is_fixed(struct isl_basic_set *bset, unsigned dim,
285 int isl_set_fast_dim_is_fixed(struct isl_set *set, unsigned dim, isl_int *val);
286 int isl_set_fast_dim_has_fixed_lower_bound(struct isl_set *set,
287 unsigned dim, isl_int *val);
288 int isl_set_dim_is_bounded(__isl_keep isl_set *set,
289 enum isl_dim_type type, unsigned pos);
291 __isl_give isl_basic_set *isl_basic_set_gist(__isl_take isl_basic_set *bset,
292 __isl_take isl_basic_set *context);
293 __isl_give isl_set *isl_set_gist_basic_set(__isl_take isl_set *set,
294 __isl_take isl_basic_set *context);
295 __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
296 __isl_take isl_set *context);
297 int isl_basic_set_dim_residue_class(struct isl_basic_set *bset,
298 int pos, isl_int *modulo, isl_int *residue);
299 int isl_set_dim_residue_class(struct isl_set *set,
300 int pos, isl_int *modulo, isl_int *residue);
302 __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
304 int isl_set_fast_is_equal(__isl_keep isl_set *set1, __isl_keep isl_set *set2);
305 int isl_set_fast_is_disjoint(__isl_keep isl_set *set1, __isl_keep isl_set *set2);
307 uint32_t isl_set_get_hash(struct isl_set *set);
309 int isl_set_dim_is_unique(struct isl_set *set, unsigned dim);
311 int isl_set_n_basic_set(__isl_keep isl_set *set);
312 int isl_set_foreach_basic_set(__isl_keep isl_set *set,
313 int (*fn)(__isl_take isl_basic_set *bset, void *user), void *user);
315 int isl_set_foreach_point(__isl_keep isl_set *set,
316 int (*fn)(__isl_take isl_point *pnt, void *user), void *user);
317 int isl_set_count(__isl_keep isl_set *set, isl_int *count);
318 int isl_set_count_upto(__isl_keep isl_set *set, isl_int max, isl_int *count);
320 __isl_give isl_basic_set *isl_basic_set_from_point(__isl_take isl_point *pnt);
321 __isl_give isl_set *isl_set_from_point(__isl_take isl_point *pnt);
322 __isl_give isl_basic_set *isl_basic_set_box_from_points(
323 __isl_take isl_point *pnt1, __isl_take isl_point *pnt2);
324 __isl_give isl_set *isl_set_box_from_points(__isl_take isl_point *pnt1,
325 __isl_take isl_point *pnt2);
327 __isl_give isl_basic_set *isl_basic_set_lift(__isl_take isl_basic_set *bset);
328 __isl_give isl_set *isl_set_lift(__isl_take isl_set *set);
330 __isl_give isl_map *isl_set_lex_le_set(__isl_take isl_set *set1,
331 __isl_take isl_set *set2);
332 __isl_give isl_map *isl_set_lex_lt_set(__isl_take isl_set *set1,
333 __isl_take isl_set *set2);
334 __isl_give isl_map *isl_set_lex_ge_set(__isl_take isl_set *set1,
335 __isl_take isl_set *set2);
336 __isl_give isl_map *isl_set_lex_gt_set(__isl_take isl_set *set1,
337 __isl_take isl_set *set2);
339 int isl_set_size(__isl_keep isl_set *set);
341 __isl_give isl_mat *isl_basic_set_equalities_matrix(
342 __isl_keep isl_basic_set *bset, enum isl_dim_type c1,
343 enum isl_dim_type c2, enum isl_dim_type c3, enum isl_dim_type c4);
344 __isl_give isl_mat *isl_basic_set_inequalities_matrix(
345 __isl_keep isl_basic_set *bset, enum isl_dim_type c1,
346 enum isl_dim_type c2, enum isl_dim_type c3, enum isl_dim_type c4);
347 __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
348 __isl_take isl_dim *dim,
349 __isl_take isl_mat *eq, __isl_take isl_mat *ineq, enum isl_dim_type c1,
350 enum isl_dim_type c2, enum isl_dim_type c3, enum isl_dim_type c4);
352 __isl_give isl_mat *isl_basic_set_reduced_basis(__isl_keep isl_basic_set *bset);
354 #if defined(__cplusplus)