isl_space_dup: rename "dim" argument to "space"
[isl.git] / isl_polynomial_private.h
blobdd26b81bf9e2a421bbf7c24bced77fb2c2f198c9
1 #include <stdio.h>
2 #include <isl_int.h>
3 #include <isl/map.h>
4 #include <isl/mat.h>
5 #include <isl_morph.h>
6 #include <isl/polynomial.h>
7 #include <isl_reordering.h>
9 struct isl_upoly {
10 int ref;
11 struct isl_ctx *ctx;
13 int var;
16 struct isl_upoly_cst {
17 struct isl_upoly up;
18 isl_int n;
19 isl_int d;
22 struct isl_upoly_rec {
23 struct isl_upoly up;
24 int n;
26 size_t size;
27 struct isl_upoly *p[];
30 /* dim represents the domain space.
32 struct isl_qpolynomial {
33 int ref;
35 isl_space *dim;
36 struct isl_mat *div;
37 struct isl_upoly *upoly;
40 struct isl_term {
41 int ref;
43 isl_int n;
44 isl_int d;
46 isl_space *dim;
47 struct isl_mat *div;
49 int pow[1];
52 struct isl_pw_qpolynomial_piece {
53 struct isl_set *set;
54 struct isl_qpolynomial *qp;
57 struct isl_pw_qpolynomial {
58 int ref;
60 isl_space *dim;
62 int n;
64 size_t size;
65 struct isl_pw_qpolynomial_piece p[1];
68 #undef PW
69 #define PW isl_pw_qpolynomial
71 #include <isl_pw_templ.h>
73 #undef EL
74 #define EL isl_pw_qpolynomial
76 #include <isl_list_templ.h>
78 /* dim represents the domain space.
80 struct isl_qpolynomial_fold {
81 int ref;
83 enum isl_fold type;
84 isl_space *dim;
86 int n;
88 size_t size;
89 struct isl_qpolynomial *qp[1];
92 struct isl_pw_qpolynomial_fold_piece {
93 struct isl_set *set;
94 struct isl_qpolynomial_fold *fold;
97 struct isl_pw_qpolynomial_fold {
98 int ref;
100 enum isl_fold type;
101 isl_space *dim;
103 int n;
105 size_t size;
106 struct isl_pw_qpolynomial_fold_piece p[1];
109 #undef PW
110 #define PW isl_pw_qpolynomial_fold
112 #include <isl_pw_templ.h>
114 #undef EL
115 #define EL isl_pw_qpolynomial_fold
117 #include <isl_list_templ.h>
119 void isl_term_get_num(__isl_keep isl_term *term, isl_int *n);
121 __isl_give struct isl_upoly *isl_upoly_zero(struct isl_ctx *ctx);
122 __isl_give struct isl_upoly *isl_upoly_copy(__isl_keep struct isl_upoly *up);
123 __isl_give struct isl_upoly *isl_upoly_cow(__isl_take struct isl_upoly *up);
124 __isl_give struct isl_upoly *isl_upoly_dup(__isl_keep struct isl_upoly *up);
125 __isl_null struct isl_upoly *isl_upoly_free(__isl_take struct isl_upoly *up);
126 __isl_give struct isl_upoly *isl_upoly_mul(__isl_take struct isl_upoly *up1,
127 __isl_take struct isl_upoly *up2);
129 int isl_upoly_is_cst(__isl_keep struct isl_upoly *up);
130 int isl_upoly_is_zero(__isl_keep struct isl_upoly *up);
131 int isl_upoly_is_one(__isl_keep struct isl_upoly *up);
132 int isl_upoly_is_negone(__isl_keep struct isl_upoly *up);
133 __isl_keep struct isl_upoly_cst *isl_upoly_as_cst(__isl_keep struct isl_upoly *up);
134 __isl_keep struct isl_upoly_rec *isl_upoly_as_rec(__isl_keep struct isl_upoly *up);
136 __isl_give struct isl_upoly *isl_upoly_sum(__isl_take struct isl_upoly *up1,
137 __isl_take struct isl_upoly *up2);
138 __isl_give struct isl_upoly *isl_upoly_mul_isl_int(
139 __isl_take struct isl_upoly *up, isl_int v);
141 __isl_give isl_qpolynomial *isl_qpolynomial_alloc(__isl_take isl_space *space,
142 unsigned n_div, __isl_take struct isl_upoly *up);
143 __isl_give isl_qpolynomial *isl_qpolynomial_cow(__isl_take isl_qpolynomial *qp);
144 __isl_give isl_qpolynomial *isl_qpolynomial_dup(__isl_keep isl_qpolynomial *qp);
146 __isl_give isl_qpolynomial *isl_qpolynomial_cst_on_domain(__isl_take isl_space *dim,
147 isl_int v);
148 __isl_give isl_qpolynomial *isl_qpolynomial_rat_cst_on_domain(
149 __isl_take isl_space *space, const isl_int n, const isl_int d);
150 __isl_give isl_qpolynomial *isl_qpolynomial_var_pow_on_domain(__isl_take isl_space *dim,
151 int pos, int power);
152 isl_bool isl_qpolynomial_is_one(__isl_keep isl_qpolynomial *qp);
153 int isl_qpolynomial_is_affine(__isl_keep isl_qpolynomial *qp);
154 int isl_qpolynomial_is_cst(__isl_keep isl_qpolynomial *qp,
155 isl_int *n, isl_int *d);
157 unsigned isl_qpolynomial_domain_offset(__isl_keep isl_qpolynomial *qp,
158 enum isl_dim_type type);
160 __isl_give isl_qpolynomial *isl_qpolynomial_add_on_domain(
161 __isl_keep isl_set *dom,
162 __isl_take isl_qpolynomial *qp1,
163 __isl_take isl_qpolynomial *qp2);
165 int isl_qpolynomial_plain_cmp(__isl_keep isl_qpolynomial *qp1,
166 __isl_keep isl_qpolynomial *qp2);
168 int isl_qpolynomial_degree(__isl_keep isl_qpolynomial *poly);
169 __isl_give isl_qpolynomial *isl_qpolynomial_coeff(
170 __isl_keep isl_qpolynomial *poly,
171 enum isl_dim_type type, unsigned pos, int deg);
173 __isl_give isl_vec *isl_qpolynomial_extract_affine(
174 __isl_keep isl_qpolynomial *qp);
175 __isl_give isl_qpolynomial *isl_qpolynomial_from_affine(
176 __isl_take isl_space *space, isl_int *f, isl_int denom);
178 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_cow(
179 __isl_take isl_pw_qpolynomial *pwqp);
181 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_piece(
182 __isl_take isl_pw_qpolynomial *pwqp,
183 __isl_take isl_set *set, __isl_take isl_qpolynomial *qp);
184 int isl_pw_qpolynomial_is_one(__isl_keep isl_pw_qpolynomial *pwqp);
186 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_project_out(
187 __isl_take isl_pw_qpolynomial *pwqp,
188 enum isl_dim_type type, unsigned first, unsigned n);
190 __isl_give isl_val *isl_qpolynomial_opt_on_domain(
191 __isl_take isl_qpolynomial *qp, __isl_take isl_set *set, int max);
193 enum isl_fold isl_fold_type_negate(enum isl_fold type);
195 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_cow(
196 __isl_take isl_qpolynomial_fold *fold);
197 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_dup(
198 __isl_keep isl_qpolynomial_fold *fold);
200 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_cow(
201 __isl_take isl_pw_qpolynomial_fold *pwf);
203 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_add_on_domain(
204 __isl_keep isl_set *set,
205 __isl_take isl_qpolynomial_fold *fold1,
206 __isl_take isl_qpolynomial_fold *fold2);
207 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_fold_on_domain(
208 __isl_keep isl_set *set,
209 __isl_take isl_qpolynomial_fold *fold1,
210 __isl_take isl_qpolynomial_fold *fold2);
212 int isl_qpolynomial_fold_plain_cmp(__isl_keep isl_qpolynomial_fold *fold1,
213 __isl_keep isl_qpolynomial_fold *fold2);
215 __isl_give isl_val *isl_qpolynomial_fold_opt_on_domain(
216 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_set *set, int max);
218 int isl_pw_qpolynomial_fold_covers(__isl_keep isl_pw_qpolynomial_fold *pwf1,
219 __isl_keep isl_pw_qpolynomial_fold *pwf2);
221 __isl_give isl_qpolynomial *isl_qpolynomial_morph_domain(
222 __isl_take isl_qpolynomial *qp, __isl_take isl_morph *morph);
223 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_morph_domain(
224 __isl_take isl_pw_qpolynomial *pwqp, __isl_take isl_morph *morph);
225 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_morph_domain(
226 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_morph *morph);
227 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_morph_domain(
228 __isl_take isl_pw_qpolynomial_fold *pwf, __isl_take isl_morph *morph);
230 __isl_give isl_qpolynomial *isl_qpolynomial_lift(__isl_take isl_qpolynomial *qp,
231 __isl_take isl_space *space);
232 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_lift(
233 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_space *dim);
235 __isl_give isl_qpolynomial *isl_qpolynomial_substitute_equalities(
236 __isl_take isl_qpolynomial *qp, __isl_take isl_basic_set *eq);
237 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_substitute_equalities(
238 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_basic_set *eq);
239 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
240 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_set *context);
242 __isl_give isl_qpolynomial *isl_qpolynomial_realign_domain(
243 __isl_take isl_qpolynomial *qp, __isl_take isl_reordering *r);
244 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_realign_domain(
245 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_reordering *r);
246 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_realign_domain(
247 __isl_take isl_pw_qpolynomial *pwqp, __isl_take isl_reordering *r);
248 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_realign_domain(
249 __isl_take isl_pw_qpolynomial_fold *pwf, __isl_take isl_reordering *r);
251 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_reset_space(
252 __isl_take isl_pw_qpolynomial *pwqp, __isl_take isl_space *space);
253 __isl_give isl_qpolynomial *isl_qpolynomial_reset_domain_space(
254 __isl_take isl_qpolynomial *qp, __isl_take isl_space *dim);
255 __isl_give isl_qpolynomial *isl_qpolynomial_reset_space_and_domain(
256 __isl_take isl_qpolynomial *qp, __isl_take isl_space *space,
257 __isl_take isl_space *domain);
258 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_reset_domain_space(
259 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_space *dim);
260 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_reset_space_and_domain(
261 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_space *space,
262 __isl_take isl_space *domain);
263 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_reset_domain_space(
264 __isl_take isl_pw_qpolynomial_fold *pwf, __isl_take isl_space *dim);
266 void isl_qpolynomial_get_den(__isl_keep isl_qpolynomial *qp, isl_int *d);
267 __isl_give isl_qpolynomial *isl_qpolynomial_add_isl_int(
268 __isl_take isl_qpolynomial *qp, isl_int v);
269 __isl_give isl_qpolynomial *isl_qpolynomial_mul_isl_int(
270 __isl_take isl_qpolynomial *qp, isl_int v);
271 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul_isl_int(
272 __isl_take isl_pw_qpolynomial *pwqp, isl_int v);
274 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_scale(
275 __isl_take isl_qpolynomial_fold *fold, isl_int v);
277 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_mul_isl_int(
278 __isl_take isl_qpolynomial_fold *fold, isl_int v);
279 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_mul_isl_int(
280 __isl_take isl_pw_qpolynomial_fold *pwf, isl_int v);
281 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul_isl_int(
282 __isl_take isl_union_pw_qpolynomial *upwqp, isl_int v);
283 __isl_give isl_union_pw_qpolynomial_fold *
284 isl_union_pw_qpolynomial_fold_mul_isl_int(
285 __isl_take isl_union_pw_qpolynomial_fold *upwf, isl_int v);