isl_stream_read_multi_aff: extract out read_universe_params
[isl.git] / isl_polynomial_private.h
blobacab078385944c9c6eb170c0b2a428509e6c09c6
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>
8 #include "isl_list_private.h"
10 struct isl_poly {
11 int ref;
12 struct isl_ctx *ctx;
14 int var;
16 typedef struct isl_poly isl_poly;
18 struct isl_poly_cst {
19 struct isl_poly poly;
20 isl_int n;
21 isl_int d;
23 typedef struct isl_poly_cst isl_poly_cst;
25 struct isl_poly_rec {
26 struct isl_poly poly;
27 int n;
29 size_t size;
30 isl_poly *p[];
32 typedef struct isl_poly_rec isl_poly_rec;
34 /* dim represents the domain space.
36 struct isl_qpolynomial {
37 int ref;
39 isl_space *dim;
40 struct isl_mat *div;
41 isl_poly *poly;
44 #undef EL
45 #define EL isl_qpolynomial
47 #include <isl_list_templ.h>
49 struct isl_term {
50 int ref;
52 isl_int n;
53 isl_int d;
55 isl_space *dim;
56 struct isl_mat *div;
58 int pow[1];
61 struct isl_pw_qpolynomial_piece {
62 struct isl_set *set;
63 struct isl_qpolynomial *qp;
66 struct isl_pw_qpolynomial {
67 int ref;
69 isl_space *dim;
71 int n;
73 size_t size;
74 struct isl_pw_qpolynomial_piece p[1];
77 #undef PW
78 #define PW isl_pw_qpolynomial
80 #include <isl_pw_templ.h>
82 #undef EL
83 #define EL isl_pw_qpolynomial
85 #include <isl_list_templ.h>
87 /* dim represents the domain space.
89 struct isl_qpolynomial_fold {
90 int ref;
92 enum isl_fold type;
93 isl_space *dim;
95 isl_qpolynomial_list *list;
98 struct isl_pw_qpolynomial_fold_piece {
99 struct isl_set *set;
100 struct isl_qpolynomial_fold *fold;
103 struct isl_pw_qpolynomial_fold {
104 int ref;
106 enum isl_fold type;
107 isl_space *dim;
109 int n;
111 size_t size;
112 struct isl_pw_qpolynomial_fold_piece p[1];
115 #undef PW
116 #define PW isl_pw_qpolynomial_fold
118 #include <isl_pw_templ.h>
120 #undef EL
121 #define EL isl_pw_qpolynomial_fold
123 #include <isl_list_templ.h>
125 void isl_term_get_num(__isl_keep isl_term *term, isl_int *n);
127 __isl_give isl_poly *isl_poly_zero(struct isl_ctx *ctx);
128 __isl_give isl_poly *isl_poly_copy(__isl_keep isl_poly *poly);
129 __isl_give isl_poly *isl_poly_cow(__isl_take isl_poly *poly);
130 __isl_give isl_poly *isl_poly_dup(__isl_keep isl_poly *poly);
131 __isl_null isl_poly *isl_poly_free(__isl_take isl_poly *poly);
132 __isl_give struct isl_poly *isl_poly_mul(__isl_take struct isl_poly *poly1,
133 __isl_take struct isl_poly *poly2);
135 isl_bool isl_poly_is_cst(__isl_keep isl_poly *poly);
136 isl_bool isl_poly_is_zero(__isl_keep isl_poly *poly);
137 isl_bool isl_poly_is_one(__isl_keep isl_poly *poly);
138 isl_bool isl_poly_is_negone(__isl_keep isl_poly *poly);
139 __isl_keep isl_poly_cst *isl_poly_as_cst(__isl_keep isl_poly *poly);
140 __isl_keep isl_poly_rec *isl_poly_as_rec(__isl_keep isl_poly *poly);
142 __isl_give isl_poly *isl_poly_sum(__isl_take isl_poly *poly1,
143 __isl_take isl_poly *poly2);
144 __isl_give struct isl_poly *isl_poly_mul_isl_int(
145 __isl_take isl_poly *poly, isl_int v);
147 __isl_give isl_qpolynomial *isl_qpolynomial_alloc(__isl_take isl_space *space,
148 unsigned n_div, __isl_take isl_poly *poly);
149 __isl_give isl_qpolynomial *isl_qpolynomial_cow(__isl_take isl_qpolynomial *qp);
150 __isl_give isl_qpolynomial *isl_qpolynomial_dup(__isl_keep isl_qpolynomial *qp);
152 __isl_give isl_qpolynomial *isl_qpolynomial_cst_on_domain(
153 __isl_take isl_space *domain,
154 isl_int v);
155 __isl_give isl_qpolynomial *isl_qpolynomial_rat_cst_on_domain(
156 __isl_take isl_space *domain, const isl_int n, const isl_int d);
157 __isl_give isl_qpolynomial *isl_qpolynomial_var_pow_on_domain(
158 __isl_take isl_space *domain,
159 int pos, int power);
160 isl_bool isl_qpolynomial_is_one(__isl_keep isl_qpolynomial *qp);
161 isl_bool isl_qpolynomial_is_affine(__isl_keep isl_qpolynomial *qp);
162 isl_bool isl_qpolynomial_is_cst(__isl_keep isl_qpolynomial *qp,
163 isl_int *n, isl_int *d);
165 unsigned isl_qpolynomial_domain_offset(__isl_keep isl_qpolynomial *qp,
166 enum isl_dim_type type);
168 __isl_give isl_qpolynomial *isl_qpolynomial_add_on_domain(
169 __isl_keep isl_set *dom,
170 __isl_take isl_qpolynomial *qp1,
171 __isl_take isl_qpolynomial *qp2);
173 int isl_qpolynomial_plain_cmp(__isl_keep isl_qpolynomial *qp1,
174 __isl_keep isl_qpolynomial *qp2);
176 int isl_qpolynomial_degree(__isl_keep isl_qpolynomial *poly);
177 __isl_give isl_qpolynomial *isl_qpolynomial_coeff(
178 __isl_keep isl_qpolynomial *poly,
179 enum isl_dim_type type, unsigned pos, int deg);
181 __isl_give isl_vec *isl_qpolynomial_extract_affine(
182 __isl_keep isl_qpolynomial *qp);
183 __isl_give isl_qpolynomial *isl_qpolynomial_from_affine(
184 __isl_take isl_space *space, isl_int *f, isl_int denom);
186 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_cow(
187 __isl_take isl_pw_qpolynomial *pwqp);
189 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_piece(
190 __isl_take isl_pw_qpolynomial *pwqp,
191 __isl_take isl_set *set, __isl_take isl_qpolynomial *qp);
192 int isl_pw_qpolynomial_is_one(__isl_keep isl_pw_qpolynomial *pwqp);
194 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_project_out(
195 __isl_take isl_pw_qpolynomial *pwqp,
196 enum isl_dim_type type, unsigned first, unsigned n);
198 __isl_give isl_val *isl_qpolynomial_opt_on_domain(
199 __isl_take isl_qpolynomial *qp, __isl_take isl_set *set, int max);
201 enum isl_fold isl_fold_type_negate(enum isl_fold type);
203 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_cow(
204 __isl_take isl_qpolynomial_fold *fold);
205 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_dup(
206 __isl_keep isl_qpolynomial_fold *fold);
208 __isl_keep isl_qpolynomial_list *isl_qpolynomial_fold_peek_list(
209 __isl_keep isl_qpolynomial_fold *fold);
211 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_cow(
212 __isl_take isl_pw_qpolynomial_fold *pwf);
214 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_add_on_domain(
215 __isl_keep isl_set *set,
216 __isl_take isl_qpolynomial_fold *fold1,
217 __isl_take isl_qpolynomial_fold *fold2);
218 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_fold_on_domain(
219 __isl_keep isl_set *set,
220 __isl_take isl_qpolynomial_fold *fold1,
221 __isl_take isl_qpolynomial_fold *fold2);
223 int isl_qpolynomial_fold_plain_cmp(__isl_keep isl_qpolynomial_fold *fold1,
224 __isl_keep isl_qpolynomial_fold *fold2);
226 __isl_give isl_val *isl_qpolynomial_fold_opt_on_domain(
227 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_set *set, int max);
229 isl_bool isl_pw_qpolynomial_fold_covers(
230 __isl_keep isl_pw_qpolynomial_fold *pwf1,
231 __isl_keep isl_pw_qpolynomial_fold *pwf2);
233 __isl_give isl_qpolynomial *isl_qpolynomial_morph_domain(
234 __isl_take isl_qpolynomial *qp, __isl_take isl_morph *morph);
235 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_morph_domain(
236 __isl_take isl_pw_qpolynomial *pwqp, __isl_take isl_morph *morph);
237 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_morph_domain(
238 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_morph *morph);
239 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_morph_domain(
240 __isl_take isl_pw_qpolynomial_fold *pwf, __isl_take isl_morph *morph);
242 __isl_give isl_qpolynomial *isl_qpolynomial_lift(__isl_take isl_qpolynomial *qp,
243 __isl_take isl_space *space);
244 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_lift(
245 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_space *space);
247 __isl_give isl_qpolynomial *isl_qpolynomial_substitute_equalities(
248 __isl_take isl_qpolynomial *qp, __isl_take isl_basic_set *eq);
249 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_substitute_equalities(
250 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_basic_set *eq);
251 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
252 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_set *context);
254 __isl_give isl_qpolynomial *isl_qpolynomial_realign_domain(
255 __isl_take isl_qpolynomial *qp, __isl_take isl_reordering *r);
256 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_realign_domain(
257 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_reordering *r);
258 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_realign_domain(
259 __isl_take isl_pw_qpolynomial *pwqp, __isl_take isl_reordering *r);
260 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_realign_domain(
261 __isl_take isl_pw_qpolynomial_fold *pwf, __isl_take isl_reordering *r);
263 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_reset_space(
264 __isl_take isl_pw_qpolynomial *pwqp, __isl_take isl_space *space);
265 __isl_give isl_qpolynomial *isl_qpolynomial_reset_domain_space(
266 __isl_take isl_qpolynomial *qp, __isl_take isl_space *space);
267 __isl_give isl_qpolynomial *isl_qpolynomial_reset_space_and_domain(
268 __isl_take isl_qpolynomial *qp, __isl_take isl_space *space,
269 __isl_take isl_space *domain);
270 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_reset_domain_space(
271 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_space *space);
272 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_reset_space_and_domain(
273 __isl_take isl_qpolynomial_fold *fold, __isl_take isl_space *space,
274 __isl_take isl_space *domain);
275 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_reset_domain_space(
276 __isl_take isl_pw_qpolynomial_fold *pwf, __isl_take isl_space *space);
278 __isl_give isl_val *isl_qpolynomial_get_den(__isl_keep isl_qpolynomial *qp);
279 __isl_give isl_qpolynomial *isl_qpolynomial_add_isl_int(
280 __isl_take isl_qpolynomial *qp, isl_int v);
281 __isl_give isl_qpolynomial *isl_qpolynomial_mul_isl_int(
282 __isl_take isl_qpolynomial *qp, isl_int v);
283 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul_isl_int(
284 __isl_take isl_pw_qpolynomial *pwqp, isl_int v);
286 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_scale(
287 __isl_take isl_qpolynomial_fold *fold, isl_int v);
289 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_mul_isl_int(
290 __isl_take isl_qpolynomial_fold *fold, isl_int v);
291 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_mul_isl_int(
292 __isl_take isl_pw_qpolynomial_fold *pwf, isl_int v);
293 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul_isl_int(
294 __isl_take isl_union_pw_qpolynomial *upwqp, isl_int v);
295 __isl_give isl_union_pw_qpolynomial_fold *
296 isl_union_pw_qpolynomial_fold_mul_isl_int(
297 __isl_take isl_union_pw_qpolynomial_fold *upwf, isl_int v);
299 ISL_DECLARE_LIST_FN_PRIVATE(qpolynomial)