isl_vertices.c: fix typos
[isl.git] / isl_map_private.h
blob526dbca81d99f4f0ebf42c22053981eaa30172a1
1 /*
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
8 */
10 #ifndef ISL_MAP_PRIVATE_H
11 #define ISL_MAP_PRIVATE_H
13 #include <isl/set.h>
14 #include <isl/map.h>
15 #include <isl_reordering.h>
16 #include <isl/vec.h>
18 /* A "basic map" is a relation between two sets of variables,
19 * called the "in" and "out" variables.
21 * It is implemented as a set with two extra fields:
22 * n_in is the number of in variables
23 * n_out is the number of out variables
24 * n_in + n_out should be equal to set.dim
26 struct isl_basic_map {
27 int ref;
28 #define ISL_BASIC_MAP_FINAL (1 << 0)
29 #define ISL_BASIC_MAP_EMPTY (1 << 1)
30 #define ISL_BASIC_MAP_NO_IMPLICIT (1 << 2)
31 #define ISL_BASIC_MAP_NO_REDUNDANT (1 << 3)
32 #define ISL_BASIC_MAP_RATIONAL (1 << 4)
33 #define ISL_BASIC_MAP_NORMALIZED (1 << 5)
34 #define ISL_BASIC_MAP_NORMALIZED_DIVS (1 << 6)
35 #define ISL_BASIC_MAP_ALL_EQUALITIES (1 << 7)
36 unsigned flags;
38 struct isl_ctx *ctx;
40 struct isl_dim *dim;
41 unsigned extra;
43 unsigned n_eq;
44 unsigned n_ineq;
46 size_t c_size;
47 isl_int **eq;
48 isl_int **ineq;
50 unsigned n_div;
52 isl_int **div;
54 struct isl_vec *sample;
56 struct isl_blk block;
57 struct isl_blk block2;
60 /* A "basic set" is a basic map with a zero-dimensional
61 * domain.
63 struct isl_basic_set {
64 int ref;
65 #define ISL_BASIC_SET_FINAL (1 << 0)
66 #define ISL_BASIC_SET_EMPTY (1 << 1)
67 #define ISL_BASIC_SET_NO_IMPLICIT (1 << 2)
68 #define ISL_BASIC_SET_NO_REDUNDANT (1 << 3)
69 #define ISL_BASIC_SET_RATIONAL (1 << 4)
70 #define ISL_BASIC_SET_NORMALIZED (1 << 5)
71 #define ISL_BASIC_SET_NORMALIZED_DIVS (1 << 6)
72 #define ISL_BASIC_SET_ALL_EQUALITIES (1 << 7)
73 unsigned flags;
75 struct isl_ctx *ctx;
77 struct isl_dim *dim;
78 unsigned extra;
80 unsigned n_eq;
81 unsigned n_ineq;
83 size_t c_size;
84 isl_int **eq;
85 isl_int **ineq;
87 unsigned n_div;
89 isl_int **div;
91 struct isl_vec *sample;
93 struct isl_blk block;
94 struct isl_blk block2;
97 /* A "map" is a (disjoint) union of basic maps.
99 * Currently, the isl_set structure is identical to the isl_map structure
100 * and the library depends on this correspondence internally.
101 * However, users should not depend on this correspondence.
103 struct isl_map {
104 int ref;
105 #define ISL_MAP_DISJOINT (1 << 0)
106 #define ISL_MAP_NORMALIZED (1 << 1)
107 unsigned flags;
109 struct isl_ctx *ctx;
111 struct isl_dim *dim;
113 int n;
115 size_t size;
116 struct isl_basic_map *p[1];
119 /* A "set" is a (possibly disjoint) union of basic sets.
121 * See the documentation of isl_map.
123 struct isl_set {
124 int ref;
125 #define ISL_SET_DISJOINT (1 << 0)
126 #define ISL_SET_NORMALIZED (1 << 1)
127 unsigned flags;
129 struct isl_ctx *ctx;
131 struct isl_dim *dim;
133 int n;
135 size_t size;
136 struct isl_basic_set *p[1];
139 __isl_give isl_map *isl_map_realign(__isl_take isl_map *map,
140 __isl_take isl_reordering *r);
141 __isl_give isl_set *isl_set_realign(__isl_take isl_set *set,
142 __isl_take isl_reordering *r);
144 __isl_give isl_map *isl_map_reset(__isl_take isl_map *map,
145 enum isl_dim_type type);
147 __isl_give isl_basic_map *isl_basic_map_reset_dim(
148 __isl_take isl_basic_map *bmap, __isl_take isl_dim *dim);
149 __isl_give isl_map *isl_map_reset_dim(__isl_take isl_map *map,
150 __isl_take isl_dim *dim);
152 unsigned isl_basic_map_offset(struct isl_basic_map *bmap,
153 enum isl_dim_type type);
155 int isl_map_compatible_domain(struct isl_map *map, struct isl_set *set);
156 int isl_basic_map_compatible_domain(struct isl_basic_map *bmap,
157 struct isl_basic_set *bset);
158 int isl_basic_map_compatible_range(struct isl_basic_map *bmap,
159 struct isl_basic_set *bset);
161 struct isl_basic_map *isl_basic_map_extend_dim(struct isl_basic_map *base,
162 struct isl_dim *dim, unsigned extra,
163 unsigned n_eq, unsigned n_ineq);
164 struct isl_basic_set *isl_basic_set_extend_dim(struct isl_basic_set *base,
165 struct isl_dim *dim, unsigned extra,
166 unsigned n_eq, unsigned n_ineq);
167 struct isl_basic_set *isl_basic_set_add_constraints(struct isl_basic_set *bset1,
168 struct isl_basic_set *bset2, unsigned pos);
170 struct isl_map *isl_map_grow(struct isl_map *map, int n);
171 struct isl_set *isl_set_grow(struct isl_set *set, int n);
173 int isl_basic_set_contains(struct isl_basic_set *bset, struct isl_vec *vec);
174 int isl_basic_map_contains(struct isl_basic_map *bmap, struct isl_vec *vec);
176 struct isl_basic_set *isl_basic_set_alloc_dim(struct isl_dim *dim,
177 unsigned extra, unsigned n_eq, unsigned n_ineq);
178 struct isl_set *isl_set_alloc_dim(struct isl_dim *dim, int n, unsigned flags);
179 struct isl_basic_map *isl_basic_map_alloc_dim(struct isl_dim *dim,
180 unsigned extra, unsigned n_eq, unsigned n_ineq);
181 struct isl_map *isl_map_alloc_dim(struct isl_dim *dim, int n, unsigned flags);
183 unsigned isl_basic_map_total_dim(const struct isl_basic_map *bmap);
185 int isl_basic_map_alloc_equality(struct isl_basic_map *bmap);
186 int isl_basic_set_alloc_equality(struct isl_basic_set *bset);
187 int isl_basic_set_free_inequality(struct isl_basic_set *bset, unsigned n);
188 int isl_basic_map_free_equality(struct isl_basic_map *bmap, unsigned n);
189 int isl_basic_set_free_equality(struct isl_basic_set *bset, unsigned n);
190 int isl_basic_set_alloc_inequality(struct isl_basic_set *bset);
191 int isl_basic_map_alloc_inequality(struct isl_basic_map *bmap);
192 int isl_basic_map_free_inequality(struct isl_basic_map *bmap, unsigned n);
193 int isl_basic_map_alloc_div(struct isl_basic_map *bmap);
194 int isl_basic_set_alloc_div(struct isl_basic_set *bset);
195 int isl_basic_map_free_div(struct isl_basic_map *bmap, unsigned n);
196 int isl_basic_set_free_div(struct isl_basic_set *bset, unsigned n);
197 void isl_basic_map_inequality_to_equality(
198 struct isl_basic_map *bmap, unsigned pos);
199 int isl_basic_map_drop_equality(struct isl_basic_map *bmap, unsigned pos);
200 int isl_basic_set_drop_equality(struct isl_basic_set *bset, unsigned pos);
201 int isl_basic_set_drop_inequality(struct isl_basic_set *bset, unsigned pos);
202 int isl_basic_map_drop_inequality(struct isl_basic_map *bmap, unsigned pos);
203 __isl_give isl_basic_set *isl_basic_set_add_eq(__isl_take isl_basic_set *bset,
204 isl_int *eq);
205 __isl_give isl_basic_map *isl_basic_map_add_eq(__isl_take isl_basic_map *bmap,
206 isl_int *eq);
207 __isl_give isl_basic_set *isl_basic_set_add_ineq(__isl_take isl_basic_set *bset,
208 isl_int *ineq);
209 __isl_give isl_basic_map *isl_basic_map_add_ineq(__isl_take isl_basic_map *bmap,
210 isl_int *ineq);
212 int isl_inequality_negate(struct isl_basic_map *bmap, unsigned pos);
214 struct isl_basic_set *isl_basic_set_cow(struct isl_basic_set *bset);
215 struct isl_basic_map *isl_basic_map_cow(struct isl_basic_map *bmap);
216 struct isl_set *isl_set_cow(struct isl_set *set);
217 struct isl_map *isl_map_cow(struct isl_map *map);
219 struct isl_basic_map *isl_basic_map_set_to_empty(struct isl_basic_map *bmap);
220 struct isl_basic_set *isl_basic_set_set_to_empty(struct isl_basic_set *bset);
221 struct isl_basic_set *isl_basic_set_order_divs(struct isl_basic_set *bset);
222 void isl_basic_map_swap_div(struct isl_basic_map *bmap, int a, int b);
223 struct isl_basic_map *isl_basic_map_order_divs(struct isl_basic_map *bmap);
224 __isl_give isl_map *isl_map_order_divs(__isl_take isl_map *map);
225 struct isl_basic_map *isl_basic_map_align_divs(
226 struct isl_basic_map *dst, struct isl_basic_map *src);
227 struct isl_basic_set *isl_basic_set_align_divs(
228 struct isl_basic_set *dst, struct isl_basic_set *src);
229 struct isl_basic_map *isl_basic_map_gauss(
230 struct isl_basic_map *bmap, int *progress);
231 struct isl_basic_set *isl_basic_set_gauss(
232 struct isl_basic_set *bset, int *progress);
233 __isl_give isl_basic_set *isl_basic_set_sort_constraints(
234 __isl_take isl_basic_set *bset);
235 int isl_basic_map_fast_cmp(const __isl_keep isl_basic_map *bmap1,
236 const __isl_keep isl_basic_map *bmap2);
237 int isl_basic_set_fast_is_equal(__isl_keep isl_basic_set *bset1,
238 __isl_keep isl_basic_set *bset2);
239 int isl_basic_map_fast_is_equal(__isl_keep isl_basic_map *bmap1,
240 __isl_keep isl_basic_map *bmap2);
241 struct isl_basic_map *isl_basic_map_normalize_constraints(
242 struct isl_basic_map *bmap);
243 struct isl_basic_set *isl_basic_set_normalize_constraints(
244 struct isl_basic_set *bset);
245 struct isl_basic_map *isl_basic_map_implicit_equalities(
246 struct isl_basic_map *bmap);
247 struct isl_basic_set *isl_basic_map_underlying_set(struct isl_basic_map *bmap);
248 __isl_give isl_basic_set *isl_basic_set_underlying_set(
249 __isl_take isl_basic_set *bset);
250 struct isl_set *isl_map_underlying_set(struct isl_map *map);
251 struct isl_basic_map *isl_basic_map_overlying_set(struct isl_basic_set *bset,
252 struct isl_basic_map *like);
253 __isl_give isl_basic_set *isl_basic_set_drop_constraints_involving(
254 __isl_take isl_basic_set *bset, unsigned first, unsigned n);
255 __isl_give isl_basic_set *isl_basic_set_drop(__isl_take isl_basic_set *bset,
256 enum isl_dim_type type, unsigned first, unsigned n);
257 struct isl_basic_map *isl_basic_map_drop(struct isl_basic_map *bmap,
258 enum isl_dim_type type, unsigned first, unsigned n);
259 struct isl_set *isl_set_drop(struct isl_set *set,
260 enum isl_dim_type type, unsigned first, unsigned n);
261 struct isl_basic_set *isl_basic_set_drop_dims(
262 struct isl_basic_set *bset, unsigned first, unsigned n);
263 struct isl_set *isl_set_drop_dims(
264 struct isl_set *set, unsigned first, unsigned n);
265 struct isl_map *isl_map_drop_inputs(
266 struct isl_map *map, unsigned first, unsigned n);
267 struct isl_map *isl_map_drop(struct isl_map *map,
268 enum isl_dim_type type, unsigned first, unsigned n);
270 struct isl_map *isl_map_remove_empty_parts(struct isl_map *map);
271 struct isl_set *isl_set_remove_empty_parts(struct isl_set *set);
273 struct isl_set *isl_set_normalize(struct isl_set *set);
275 struct isl_set *isl_set_drop_vars(
276 struct isl_set *set, unsigned first, unsigned n);
278 struct isl_basic_map *isl_basic_map_eliminate_vars(
279 struct isl_basic_map *bmap, unsigned pos, unsigned n);
280 struct isl_basic_set *isl_basic_set_eliminate_vars(
281 struct isl_basic_set *bset, unsigned pos, unsigned n);
283 __isl_give isl_map *isl_map_eliminate(__isl_take isl_map *map,
284 enum isl_dim_type type, unsigned first, unsigned n);
285 __isl_give isl_set *isl_set_eliminate(__isl_take isl_set *set,
286 enum isl_dim_type type, unsigned first, unsigned n);
288 int isl_basic_set_constraint_is_redundant(struct isl_basic_set **bset,
289 isl_int *c, isl_int *opt_n, isl_int *opt_d);
291 int isl_basic_map_add_div_constraints(struct isl_basic_map *bmap, unsigned div);
292 struct isl_basic_map *isl_basic_map_drop_redundant_divs(
293 struct isl_basic_map *bmap);
294 struct isl_basic_set *isl_basic_set_drop_redundant_divs(
295 struct isl_basic_set *bset);
297 struct isl_basic_set *isl_basic_set_recession_cone(struct isl_basic_set *bset);
298 struct isl_basic_set *isl_basic_set_lineality_space(struct isl_basic_set *bset);
300 struct isl_basic_set *isl_basic_set_set_rational(struct isl_basic_set *bset);
302 struct isl_mat;
304 struct isl_basic_set *isl_basic_set_preimage(struct isl_basic_set *bset,
305 struct isl_mat *mat);
306 struct isl_set *isl_set_preimage(struct isl_set *set, struct isl_mat *mat);
308 isl_int *isl_set_wrap_facet(__isl_keep isl_set *set,
309 isl_int *facet, isl_int *ridge);
311 int isl_basic_map_contains_point(__isl_keep isl_basic_map *bmap,
312 __isl_keep isl_point *point);
313 int isl_set_contains_point(__isl_keep isl_set *set, __isl_keep isl_point *point);
315 int isl_basic_set_vars_get_sign(__isl_keep isl_basic_set *bset,
316 unsigned first, unsigned n, int *signs);
317 int isl_set_foreach_orthant(__isl_keep isl_set *set,
318 int (*fn)(__isl_take isl_set *orthant, int *signs, void *user),
319 void *user);
321 int isl_basic_set_add_div_constraints_var(__isl_keep isl_basic_set *bset,
322 unsigned pos, isl_int *div);
323 int isl_basic_map_is_div_constraint(__isl_keep isl_basic_map *bmap,
324 isl_int *constraint, unsigned div);
326 #endif