13 #if defined(__cplusplus)
19 * All structures are reference counted to allow reuse without duplication.
20 * A *_copy operation will increase the reference count, while a *_free
21 * operation will decrease the reference count and only actually release
22 * the structures when the reference count drops to zero.
24 * Functions that return an isa structure will in general _destroy_
25 * all argument isa structures (the obvious execption begin the _copy
26 * functions). A pointer passed to such a function may therefore
27 * never be used after the function call. If you want to keep a
28 * reference to the old structure(s), use the appropriate _copy function.
31 /* A "basic map" is a relation between two sets of variables,
32 * called the "in" and "out" variables.
34 * It is implemented as a set with two extra fields:
35 * n_in is the number of in variables
36 * n_out is the number of out variables
37 * n_in + n_out should be equal to set.dim
40 struct isl_basic_map {
42 #define ISL_BASIC_MAP_FINAL (1 << 0)
43 #define ISL_BASIC_MAP_EMPTY (1 << 1)
44 #define ISL_BASIC_MAP_NO_IMPLICIT (1 << 2)
45 #define ISL_BASIC_MAP_NO_REDUNDANT (1 << 3)
46 #define ISL_BASIC_MAP_RATIONAL (1 << 4)
47 #define ISL_BASIC_MAP_NORMALIZED (1 << 5)
48 #define ISL_BASIC_MAP_NORMALIZED_DIVS (1 << 6)
49 #define ISL_BASIC_MAP_ALL_EQUALITIES (1 << 7)
68 struct isl_vec *sample;
71 struct isl_blk block2;
73 typedef struct isl_basic_map isl_basic_map;
75 typedef struct isl_basic_set isl_basic_set;
77 /* A "map" is a (disjoint) union of basic maps.
79 * Currently, the isl_set structure is identical to the isl_map structure
80 * and the library depends on this correspondence internally.
81 * However, users should not depend on this correspondence.
85 #define ISL_MAP_DISJOINT (1 << 0)
86 #define ISL_MAP_NORMALIZED (1 << 1)
96 struct isl_basic_map *p[1];
98 typedef struct isl_map isl_map;
100 typedef struct isl_set isl_set;
102 unsigned isl_basic_map_n_in(const struct isl_basic_map *bmap);
103 unsigned isl_basic_map_n_out(const struct isl_basic_map *bmap);
104 unsigned isl_basic_map_n_param(const struct isl_basic_map *bmap);
105 unsigned isl_basic_map_n_div(const struct isl_basic_map *bmap);
106 unsigned isl_basic_map_total_dim(const struct isl_basic_map *bmap);
107 unsigned isl_basic_map_dim(const struct isl_basic_map *bmap,
108 enum isl_dim_type type);
110 unsigned isl_map_n_in(const struct isl_map *map);
111 unsigned isl_map_n_out(const struct isl_map *map);
112 unsigned isl_map_n_param(const struct isl_map *map);
113 unsigned isl_map_dim(const struct isl_map *map, enum isl_dim_type type);
115 struct isl_dim *isl_basic_map_get_dim(struct isl_basic_map *bmap);
116 struct isl_dim *isl_map_get_dim(struct isl_map *map);
118 struct isl_basic_map *isl_basic_map_alloc(struct isl_ctx *ctx,
119 unsigned nparam, unsigned in, unsigned out, unsigned extra,
120 unsigned n_eq, unsigned n_ineq);
121 __isl_give isl_basic_map *isl_basic_map_identity(__isl_take isl_dim *set_dim);
122 struct isl_basic_map *isl_basic_map_identity_like(struct isl_basic_map *model);
123 struct isl_basic_map *isl_basic_map_finalize(struct isl_basic_map *bmap);
124 void isl_basic_map_free(__isl_take isl_basic_map *bmap);
125 __isl_give isl_basic_map *isl_basic_map_copy(__isl_keep isl_basic_map *bmap);
126 struct isl_basic_map *isl_basic_map_extend(struct isl_basic_map *base,
127 unsigned nparam, unsigned n_in, unsigned n_out, unsigned extra,
128 unsigned n_eq, unsigned n_ineq);
129 struct isl_basic_map *isl_basic_map_extend_constraints(
130 struct isl_basic_map *base, unsigned n_eq, unsigned n_ineq);
131 struct isl_basic_map *isl_basic_map_equal(
132 struct isl_dim *dim, unsigned n_equal);
133 struct isl_basic_map *isl_basic_map_less_at(struct isl_dim *dim, unsigned pos);
134 struct isl_basic_map *isl_basic_map_more_at(struct isl_dim *dim, unsigned pos);
135 __isl_give isl_basic_map *isl_basic_map_empty(__isl_take isl_dim *dim);
136 struct isl_basic_map *isl_basic_map_empty_like(struct isl_basic_map *model);
137 struct isl_basic_map *isl_basic_map_empty_like_map(struct isl_map *model);
138 __isl_give isl_basic_map *isl_basic_map_universe(__isl_take isl_dim *dim);
139 __isl_give isl_basic_map *isl_basic_map_universe_like(
140 __isl_keep isl_basic_map *bmap);
141 struct isl_basic_map *isl_basic_map_convex_hull(struct isl_basic_map *bmap);
143 __isl_give isl_basic_map *isl_basic_map_intersect_domain(
144 __isl_take isl_basic_map *bmap,
145 __isl_take isl_basic_set *bset);
146 __isl_give isl_basic_map *isl_basic_map_intersect_range(
147 __isl_take isl_basic_map *bmap,
148 __isl_take isl_basic_set *bset);
149 __isl_give isl_basic_map *isl_basic_map_intersect(
150 __isl_take isl_basic_map *bmap1,
151 __isl_take isl_basic_map *bmap2);
152 __isl_give isl_map *isl_basic_map_union(
153 __isl_take isl_basic_map *bmap1,
154 __isl_take isl_basic_map *bmap2);
155 __isl_give isl_basic_map *isl_basic_map_apply_domain(
156 __isl_take isl_basic_map *bmap1,
157 __isl_take isl_basic_map *bmap2);
158 __isl_give isl_basic_map *isl_basic_map_apply_range(
159 __isl_take isl_basic_map *bmap1,
160 __isl_take isl_basic_map *bmap2);
161 __isl_give isl_basic_map *isl_basic_map_affine_hull(
162 __isl_take isl_basic_map *bmap);
163 struct isl_basic_map *isl_basic_map_reverse(struct isl_basic_map *bmap);
164 __isl_give isl_basic_set *isl_basic_map_domain(__isl_take isl_basic_map *bmap);
165 __isl_give isl_basic_set *isl_basic_map_range(__isl_take isl_basic_map *bmap);
166 struct isl_basic_map *isl_basic_map_remove(struct isl_basic_map *bmap,
167 enum isl_dim_type type, unsigned first, unsigned n);
168 struct isl_basic_map *isl_basic_map_from_basic_set(struct isl_basic_set *bset,
169 struct isl_dim *dim);
170 struct isl_basic_set *isl_basic_set_from_basic_map(struct isl_basic_map *bmap);
171 __isl_give isl_basic_map *isl_basic_map_sample(__isl_take isl_basic_map *bmap);
172 struct isl_basic_map *isl_basic_map_simplify(struct isl_basic_map *bmap);
173 struct isl_basic_map *isl_basic_map_detect_equalities(
174 struct isl_basic_map *bmap);
175 #define ISL_FORMAT_POLYLIB 1
176 #define ISL_FORMAT_OMEGA 2
177 __isl_give isl_basic_map *isl_basic_map_read_from_file(isl_ctx *ctx,
178 FILE *input, unsigned nparam, unsigned input_format);
179 struct isl_basic_map *isl_basic_map_fix_si(struct isl_basic_map *bmap,
180 enum isl_dim_type type, unsigned pos, int value);
182 struct isl_basic_map *isl_basic_map_sum(
183 struct isl_basic_map *bmap1, struct isl_basic_map *bmap2);
184 struct isl_basic_map *isl_basic_map_neg(struct isl_basic_map *bmap);
185 struct isl_basic_map *isl_basic_map_floordiv(struct isl_basic_map *bmap,
188 struct isl_map *isl_map_sum(struct isl_map *map1, struct isl_map *map2);
189 struct isl_map *isl_map_neg(struct isl_map *map);
190 struct isl_map *isl_map_floordiv(struct isl_map *map, isl_int d);
192 int isl_basic_map_is_equal(
193 __isl_keep isl_basic_map *bmap1,
194 __isl_keep isl_basic_map *bmap2);
196 __isl_give isl_map *isl_basic_map_partial_lexmax(
197 __isl_take isl_basic_map *bmap, __isl_take isl_basic_set *dom,
198 __isl_give isl_set **empty);
199 __isl_give isl_map *isl_basic_map_partial_lexmin(
200 __isl_take isl_basic_map *bmap, __isl_take isl_basic_set *dom,
201 __isl_give isl_set **empty);
202 __isl_give isl_map *isl_basic_map_lexmin(__isl_take isl_basic_map *bmap);
203 int isl_basic_map_foreach_lexmin(__isl_keep isl_basic_map *bmap,
204 int (*fn)(__isl_take isl_basic_set *dom, __isl_take isl_mat *map,
208 void isl_basic_map_dump(__isl_keep isl_basic_map *bmap, FILE *out, int indent);
210 struct isl_basic_map *isl_map_copy_basic_map(struct isl_map *map);
211 struct isl_map *isl_map_drop_basic_map(struct isl_map *map,
212 struct isl_basic_map *bmap);
214 int isl_basic_map_fast_is_fixed(struct isl_basic_map *bmap,
215 enum isl_dim_type type, unsigned pos, isl_int *val);
217 int isl_basic_map_is_universe(__isl_keep isl_basic_map *bmap);
218 int isl_basic_map_fast_is_empty(__isl_keep isl_basic_map *bmap);
219 int isl_basic_map_is_empty(__isl_keep isl_basic_map *bmap);
220 int isl_basic_map_is_subset(__isl_keep isl_basic_map *bmap1,
221 __isl_keep isl_basic_map *bmap2);
222 int isl_basic_map_is_strict_subset(__isl_keep isl_basic_map *bmap1,
223 __isl_keep isl_basic_map *bmap2);
225 struct isl_map *isl_map_alloc(struct isl_ctx *ctx,
226 unsigned nparam, unsigned in, unsigned out, int n,
228 __isl_give isl_map *isl_map_universe(__isl_take isl_dim *dim);
229 __isl_give isl_map *isl_map_empty(__isl_take isl_dim *dim);
230 struct isl_map *isl_map_empty_like(struct isl_map *model);
231 struct isl_map *isl_map_empty_like_basic_map(struct isl_basic_map *model);
232 struct isl_map *isl_map_dup(struct isl_map *map);
233 struct isl_map *isl_map_add(struct isl_map *map, struct isl_basic_map *bmap);
234 __isl_give isl_map *isl_map_identity(__isl_take isl_dim *set_dim);
235 struct isl_map *isl_map_identity_like(struct isl_map *model);
236 struct isl_map *isl_map_identity_like_basic_map(struct isl_basic_map *model);
237 __isl_give isl_map *isl_map_lex_lt(__isl_take isl_dim *set_dim);
238 __isl_give isl_map *isl_map_lex_le(__isl_take isl_dim *set_dim);
239 __isl_give isl_map *isl_map_lex_gt(__isl_take isl_dim *set_dim);
240 __isl_give isl_map *isl_map_lex_ge(__isl_take isl_dim *set_dim);
241 struct isl_map *isl_map_finalize(struct isl_map *map);
242 void isl_map_free(__isl_take isl_map *map);
243 __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
244 struct isl_map *isl_map_extend(struct isl_map *base,
245 unsigned nparam, unsigned n_in, unsigned n_out);
246 struct isl_map *isl_map_reverse(struct isl_map *map);
247 __isl_give isl_map *isl_map_union(
248 __isl_take isl_map *map1,
249 __isl_take isl_map *map2);
250 struct isl_map *isl_map_union_disjoint(
251 struct isl_map *map1, struct isl_map *map2);
252 __isl_give isl_map *isl_map_intersect_domain(
253 __isl_take isl_map *map,
254 __isl_take isl_set *set);
255 __isl_give isl_map *isl_map_intersect_range(
256 __isl_take isl_map *map,
257 __isl_take isl_set *set);
258 __isl_give isl_map *isl_map_apply_domain(
259 __isl_take isl_map *map1,
260 __isl_take isl_map *map2);
261 __isl_give isl_map *isl_map_apply_range(
262 __isl_take isl_map *map1,
263 __isl_take isl_map *map2);
264 struct isl_map *isl_map_product(struct isl_map *map1, struct isl_map *map2);
265 __isl_give isl_map *isl_map_intersect(__isl_take isl_map *map1,
266 __isl_take isl_map *map2);
267 __isl_give isl_map *isl_map_subtract(
268 __isl_take isl_map *map1,
269 __isl_take isl_map *map2);
270 struct isl_map *isl_map_fix_input_si(struct isl_map *map,
271 unsigned input, int value);
272 struct isl_map *isl_map_fix_si(struct isl_map *map,
273 enum isl_dim_type type, unsigned pos, int value);
274 struct isl_basic_set *isl_basic_map_deltas(struct isl_basic_map *bmap);
275 struct isl_set *isl_map_deltas(struct isl_map *map);
276 struct isl_map *isl_map_detect_equalities(struct isl_map *map);
277 __isl_give isl_basic_map *isl_map_affine_hull(__isl_take isl_map *map);
278 __isl_give isl_basic_map *isl_map_convex_hull(__isl_take isl_map *map);
279 struct isl_map *isl_map_remove(struct isl_map *map,
280 enum isl_dim_type type, unsigned first, unsigned n);
281 struct isl_map *isl_map_remove_inputs(struct isl_map *map,
282 unsigned first, unsigned n);
284 __isl_give isl_set *isl_map_domain(__isl_take isl_map *bmap);
285 __isl_give isl_set *isl_map_range(__isl_take isl_map *map);
286 __isl_give isl_map *isl_map_from_basic_map(__isl_take isl_basic_map *bmap);
287 struct isl_map *isl_map_from_range(struct isl_set *set);
288 struct isl_map *isl_map_from_set(struct isl_set *set, struct isl_dim *dim);
289 struct isl_set *isl_set_from_map(struct isl_map *map);
290 __isl_give isl_basic_map *isl_map_sample(__isl_take isl_map *map);
292 int isl_map_fast_is_empty(__isl_keep isl_map *map);
293 int isl_map_fast_is_universe(__isl_keep isl_map *map);
294 int isl_map_is_empty(__isl_keep isl_map *map);
295 int isl_map_is_subset(__isl_keep isl_map *map1, __isl_keep isl_map *map2);
296 int isl_map_is_strict_subset(__isl_keep isl_map *map1, __isl_keep isl_map *map2);
297 int isl_map_is_equal(__isl_keep isl_map *map1, __isl_keep isl_map *map2);
299 void isl_map_dump(__isl_keep isl_map *map, FILE *out, int indent);
301 int isl_map_fast_input_is_fixed(struct isl_map *map,
302 unsigned in, isl_int *val);
303 int isl_map_fast_is_fixed(struct isl_map *map,
304 enum isl_dim_type type, unsigned pos, isl_int *val);
306 __isl_give isl_basic_map *isl_basic_map_gist(__isl_take isl_basic_map *bmap,
307 __isl_take isl_basic_map *context);
309 __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
311 int isl_map_fast_is_equal(__isl_keep isl_map *map1, __isl_keep isl_map *map2);
313 int isl_map_foreach_basic_map(__isl_keep isl_map *map,
314 int (*fn)(__isl_take isl_basic_map *bmap, void *user), void *user);
316 __isl_give isl_map *isl_set_lifting(__isl_take isl_set *set);
318 #if defined(__cplusplus)